diff --git a/.gitignore b/.gitignore index aa3f65077..ee2d1e325 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ tags # Project-specific ignores *.z64 +*.n64 +*.v64 *.sra *.bin *.elf diff --git a/Makefile b/Makefile index 75ad3a54c..3a488dc84 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ build/src/libultra/rmon/%.o: OPTFLAGS := -O2 build/src/libultra/flash/%.o: OPTFLAGS := -g build/src/libultra/flash/%.o: MIPS_VERSION := -mips1 -build/src/code/audio/%.o: OPTFLAGS := -O2 +build/src/audio/%.o: OPTFLAGS := -O2 build/assets/%.o: OPTFLAGS := -O1 build/assets/%.o: ASM_PROC_FLAGS := @@ -238,7 +238,7 @@ build/src/libultra/%.o: CC := $(CC_OLD) build/src/libultra/voice/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC_OLD) -- $(AS) $(ASFLAGS) -- build/src/code/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- -build/src/code/audio/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +build/src/audio/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- build/src/overlays/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- diff --git a/assets/xml/code/debug_display.xml b/assets/xml/code/debug_display.xml index c8ac659bc..7a25bbd0c 100644 --- a/assets/xml/code/debug_display.xml +++ b/assets/xml/code/debug_display.xml @@ -4,7 +4,7 @@ - + diff --git a/assets/xml/code/eff_footmark.xml b/assets/xml/code/eff_footmark.xml new file mode 100644 index 000000000..2fae1fe16 --- /dev/null +++ b/assets/xml/code/eff_footmark.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/xml/objects/object_ahg.xml b/assets/xml/objects/object_ahg.xml index 7eb4c7126..8233a5b27 100644 --- a/assets/xml/objects/object_ahg.xml +++ b/assets/xml/objects/object_ahg.xml @@ -1,53 +1,62 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_am.xml b/assets/xml/objects/object_am.xml index 259700dc8..bec26eb3a 100644 --- a/assets/xml/objects/object_am.xml +++ b/assets/xml/objects/object_am.xml @@ -1,6 +1,6 @@  - + @@ -36,6 +36,6 @@ - + diff --git a/assets/xml/objects/object_astr_obj.xml b/assets/xml/objects/object_astr_obj.xml index 75a8e7ca2..233de785b 100644 --- a/assets/xml/objects/object_astr_obj.xml +++ b/assets/xml/objects/object_astr_obj.xml @@ -8,6 +8,6 @@ - + diff --git a/assets/xml/objects/object_botihasira.xml b/assets/xml/objects/object_botihasira.xml index f949abcc7..0a2212760 100644 --- a/assets/xml/objects/object_botihasira.xml +++ b/assets/xml/objects/object_botihasira.xml @@ -6,6 +6,6 @@ - + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index be4f34b87..c0603a6cf 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -48,6 +48,6 @@ - + diff --git a/assets/xml/objects/object_crace_object.xml b/assets/xml/objects/object_crace_object.xml index af0cb89e0..63dd9913d 100644 --- a/assets/xml/objects/object_crace_object.xml +++ b/assets/xml/objects/object_crace_object.xml @@ -4,6 +4,6 @@ - + diff --git a/assets/xml/objects/object_ctower_rot.xml b/assets/xml/objects/object_ctower_rot.xml index ad2336257..044443c98 100644 --- a/assets/xml/objects/object_ctower_rot.xml +++ b/assets/xml/objects/object_ctower_rot.xml @@ -73,12 +73,12 @@ - + - + @@ -86,15 +86,15 @@ - + - + - + diff --git a/assets/xml/objects/object_d_hsblock.xml b/assets/xml/objects/object_d_hsblock.xml index b43647dc3..ee61d0a54 100644 --- a/assets/xml/objects/object_d_hsblock.xml +++ b/assets/xml/objects/object_d_hsblock.xml @@ -1,10 +1,10 @@  - - - - + + + + diff --git a/assets/xml/objects/object_d_lift.xml b/assets/xml/objects/object_d_lift.xml index 475f7fd3e..868eccd85 100644 --- a/assets/xml/objects/object_d_lift.xml +++ b/assets/xml/objects/object_d_lift.xml @@ -3,8 +3,8 @@ - - + + diff --git a/assets/xml/objects/object_dai.xml b/assets/xml/objects/object_dai.xml index b547897f8..927e3f1e1 100644 --- a/assets/xml/objects/object_dai.xml +++ b/assets/xml/objects/object_dai.xml @@ -2,21 +2,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_daiku.xml b/assets/xml/objects/object_daiku.xml index 17d8ddbf0..0152a6e7d 100644 --- a/assets/xml/objects/object_daiku.xml +++ b/assets/xml/objects/object_daiku.xml @@ -1,11 +1,11 @@  - - - - - - + + + + + + @@ -39,10 +39,10 @@ - + - + @@ -66,11 +66,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_danpei_object.xml b/assets/xml/objects/object_danpei_object.xml index 3f373a8ce..8e86f2f79 100644 --- a/assets/xml/objects/object_danpei_object.xml +++ b/assets/xml/objects/object_danpei_object.xml @@ -3,9 +3,9 @@ - - - + + + diff --git a/assets/xml/objects/object_dblue_object.xml b/assets/xml/objects/object_dblue_object.xml index 8611c539b..08cb20ec3 100644 --- a/assets/xml/objects/object_dblue_object.xml +++ b/assets/xml/objects/object_dblue_object.xml @@ -4,17 +4,17 @@ - + - + - + @@ -25,22 +25,22 @@ - + - - + + - + @@ -50,17 +50,17 @@ - + - + - + diff --git a/assets/xml/objects/object_death.xml b/assets/xml/objects/object_death.xml index 77d4ccd4a..7588c484a 100644 --- a/assets/xml/objects/object_death.xml +++ b/assets/xml/objects/object_death.xml @@ -1,17 +1,17 @@  - - - - - - - + + + + + + + - - + + @@ -41,7 +41,7 @@ - + @@ -76,9 +76,9 @@ - - - + + + diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index eb80e770b..053b82f61 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -1,27 +1,40 @@  + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dekucity_obj.xml b/assets/xml/objects/object_dekucity_obj.xml index 1d680965e..2d1da14a0 100644 --- a/assets/xml/objects/object_dekucity_obj.xml +++ b/assets/xml/objects/object_dekucity_obj.xml @@ -1,22 +1,22 @@  - - + + - + - + - + diff --git a/assets/xml/objects/object_delf.xml b/assets/xml/objects/object_delf.xml index 39996c0f0..85f3138e1 100644 --- a/assets/xml/objects/object_delf.xml +++ b/assets/xml/objects/object_delf.xml @@ -1,82 +1,82 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dhouse.xml b/assets/xml/objects/object_dhouse.xml index dd95b8b98..a5894a4df 100644 --- a/assets/xml/objects/object_dhouse.xml +++ b/assets/xml/objects/object_dhouse.xml @@ -9,25 +9,25 @@ - + - + - + - + - + - + - + - + - - + + - + diff --git a/assets/xml/objects/object_dinofos.xml b/assets/xml/objects/object_dinofos.xml index 8db9c7c4a..435d60e95 100644 --- a/assets/xml/objects/object_dinofos.xml +++ b/assets/xml/objects/object_dinofos.xml @@ -1,13 +1,13 @@  - - - - - - - - + + + + + + + + @@ -62,10 +62,10 @@ - - - - - + + + + + diff --git a/assets/xml/objects/object_dkjail_obj.xml b/assets/xml/objects/object_dkjail_obj.xml index ada181475..d0d2775c3 100644 --- a/assets/xml/objects/object_dkjail_obj.xml +++ b/assets/xml/objects/object_dkjail_obj.xml @@ -1,9 +1,9 @@  - + - + diff --git a/assets/xml/objects/object_dmask.xml b/assets/xml/objects/object_dmask.xml index a7b3874ec..29f245b1b 100644 --- a/assets/xml/objects/object_dmask.xml +++ b/assets/xml/objects/object_dmask.xml @@ -1,17 +1,17 @@  - - + + - + - - + + @@ -21,7 +21,7 @@ - + diff --git a/assets/xml/objects/object_dnk.xml b/assets/xml/objects/object_dnk.xml index bec6ce45d..b085eed28 100644 --- a/assets/xml/objects/object_dnk.xml +++ b/assets/xml/objects/object_dnk.xml @@ -1,11 +1,11 @@  - - - - - + + + + + @@ -45,7 +45,7 @@ - - + + diff --git a/assets/xml/objects/object_dnt.xml b/assets/xml/objects/object_dnt.xml index 96b793849..9f3fcf996 100644 --- a/assets/xml/objects/object_dnt.xml +++ b/assets/xml/objects/object_dnt.xml @@ -1,25 +1,25 @@  - - + + - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + @@ -85,7 +85,7 @@ - + diff --git a/assets/xml/objects/object_dodongo.xml b/assets/xml/objects/object_dodongo.xml index 8de3f4653..cc9b41e25 100644 --- a/assets/xml/objects/object_dodongo.xml +++ b/assets/xml/objects/object_dodongo.xml @@ -1,15 +1,15 @@  - + - - - - + + + + - - - + + + @@ -59,9 +59,9 @@ - - - + + + diff --git a/assets/xml/objects/object_dor01.xml b/assets/xml/objects/object_dor01.xml index 39c950680..9708d97c6 100644 --- a/assets/xml/objects/object_dor01.xml +++ b/assets/xml/objects/object_dor01.xml @@ -1,7 +1,7 @@  - - + + diff --git a/assets/xml/objects/object_dor02.xml b/assets/xml/objects/object_dor02.xml index c60fa9ba9..3cc3d1411 100644 --- a/assets/xml/objects/object_dor02.xml +++ b/assets/xml/objects/object_dor02.xml @@ -1,7 +1,7 @@  - - + + diff --git a/assets/xml/objects/object_dor03.xml b/assets/xml/objects/object_dor03.xml index 941fa6fcc..c7971db0c 100644 --- a/assets/xml/objects/object_dor03.xml +++ b/assets/xml/objects/object_dor03.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_dor04.xml b/assets/xml/objects/object_dor04.xml index 394f5a6fe..4e78d9efe 100644 --- a/assets/xml/objects/object_dor04.xml +++ b/assets/xml/objects/object_dor04.xml @@ -1,7 +1,7 @@  - - + + diff --git a/assets/xml/objects/object_dora.xml b/assets/xml/objects/object_dora.xml index ab4b09cf7..09732ba0a 100644 --- a/assets/xml/objects/object_dora.xml +++ b/assets/xml/objects/object_dora.xml @@ -1,17 +1,17 @@  - + - - - - + + + + - - + + diff --git a/assets/xml/objects/object_driftice.xml b/assets/xml/objects/object_driftice.xml index 0ddb6e204..c380c09c1 100644 --- a/assets/xml/objects/object_driftice.xml +++ b/assets/xml/objects/object_driftice.xml @@ -5,7 +5,7 @@ - - + + diff --git a/assets/xml/objects/object_drs.xml b/assets/xml/objects/object_drs.xml index 1b6c29597..ef9788fd5 100644 --- a/assets/xml/objects/object_drs.xml +++ b/assets/xml/objects/object_drs.xml @@ -1,7 +1,7 @@  - + diff --git a/assets/xml/objects/object_ds2.xml b/assets/xml/objects/object_ds2.xml index 1794c4bf8..0eb35db79 100644 --- a/assets/xml/objects/object_ds2.xml +++ b/assets/xml/objects/object_ds2.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml index 7e7d45f0c..da6ce5e87 100644 --- a/assets/xml/objects/object_ds2n.xml +++ b/assets/xml/objects/object_ds2n.xml @@ -65,7 +65,7 @@ - + diff --git a/assets/xml/objects/object_dt.xml b/assets/xml/objects/object_dt.xml index 8b2a90217..3acf0c442 100644 --- a/assets/xml/objects/object_dt.xml +++ b/assets/xml/objects/object_dt.xml @@ -1,10 +1,10 @@  - - - - - + + + + + @@ -28,8 +28,8 @@ - - + + @@ -37,15 +37,15 @@ - + - - - + + + - - + + @@ -62,6 +62,6 @@ - + diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml index a64bc975b..91b9a55fb 100644 --- a/assets/xml/objects/object_dy_obj.xml +++ b/assets/xml/objects/object_dy_obj.xml @@ -1,15 +1,15 @@  - - - - - - - - - - + + + + + + + + + + @@ -18,7 +18,7 @@ - + diff --git a/assets/xml/objects/object_efc_star_field.xml b/assets/xml/objects/object_efc_star_field.xml index 72b7ef636..90ea17929 100644 --- a/assets/xml/objects/object_efc_star_field.xml +++ b/assets/xml/objects/object_efc_star_field.xml @@ -1,8 +1,8 @@  - + - + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index 709224f9d..a7ca81b55 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -4,7 +4,7 @@ - + diff --git a/assets/xml/objects/object_eg.xml b/assets/xml/objects/object_eg.xml index 6aba85e62..26e5c86bc 100644 --- a/assets/xml/objects/object_eg.xml +++ b/assets/xml/objects/object_eg.xml @@ -2,20 +2,20 @@ - + - + - + - + - + @@ -24,7 +24,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -105,32 +105,32 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + - - - - - + + + + + - + diff --git a/assets/xml/objects/object_ending_obj.xml b/assets/xml/objects/object_ending_obj.xml index ad13ce7b8..f8902e353 100644 --- a/assets/xml/objects/object_ending_obj.xml +++ b/assets/xml/objects/object_ending_obj.xml @@ -1,13 +1,13 @@  - + - - + + diff --git a/assets/xml/objects/object_f40_obj.xml b/assets/xml/objects/object_f40_obj.xml index 59bff9d05..17e7210de 100644 --- a/assets/xml/objects/object_f40_obj.xml +++ b/assets/xml/objects/object_f40_obj.xml @@ -11,7 +11,7 @@ - - + + diff --git a/assets/xml/objects/object_f40_switch.xml b/assets/xml/objects/object_f40_switch.xml index a5c823baa..7e7fb5b1c 100644 --- a/assets/xml/objects/object_f40_switch.xml +++ b/assets/xml/objects/object_f40_switch.xml @@ -1,8 +1,8 @@  - - - + + + diff --git a/assets/xml/objects/object_f52_obj.xml b/assets/xml/objects/object_f52_obj.xml index f80b67696..697a5b100 100644 --- a/assets/xml/objects/object_f52_obj.xml +++ b/assets/xml/objects/object_f52_obj.xml @@ -1,16 +1,16 @@  - - + + - - + + - + diff --git a/assets/xml/objects/object_f53_obj.xml b/assets/xml/objects/object_f53_obj.xml index 424d7c003..d93048a9d 100644 --- a/assets/xml/objects/object_f53_obj.xml +++ b/assets/xml/objects/object_f53_obj.xml @@ -1,13 +1,13 @@  - + - + diff --git a/assets/xml/objects/object_fall.xml b/assets/xml/objects/object_fall.xml index 47fa1da70..04c1ff058 100644 --- a/assets/xml/objects/object_fall.xml +++ b/assets/xml/objects/object_fall.xml @@ -7,14 +7,14 @@ --> - + - + - - - - \ + + + + @@ -22,7 +22,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -43,7 +43,7 @@ - + diff --git a/assets/xml/objects/object_fall2.xml b/assets/xml/objects/object_fall2.xml index 25439a50a..12299ab74 100644 --- a/assets/xml/objects/object_fall2.xml +++ b/assets/xml/objects/object_fall2.xml @@ -4,7 +4,7 @@ moon's mouth, both used in the cutscene before warping to the moon. --> - + @@ -12,7 +12,7 @@ - + @@ -29,6 +29,6 @@ - + diff --git a/assets/xml/objects/object_famos.xml b/assets/xml/objects/object_famos.xml index d12a94d66..186e2b59b 100644 --- a/assets/xml/objects/object_famos.xml +++ b/assets/xml/objects/object_famos.xml @@ -1,7 +1,7 @@  - + @@ -24,7 +24,7 @@ - + diff --git a/assets/xml/objects/object_fb.xml b/assets/xml/objects/object_fb.xml index bb630781c..59ecaf9e5 100644 --- a/assets/xml/objects/object_fb.xml +++ b/assets/xml/objects/object_fb.xml @@ -1,10 +1,10 @@  - - - - - + + + + + diff --git a/assets/xml/objects/object_fbdemo_triforce.xml b/assets/xml/objects/object_fbdemo_triforce.xml index a00c9bf13..ed23e36c3 100644 --- a/assets/xml/objects/object_fbdemo_triforce.xml +++ b/assets/xml/objects/object_fbdemo_triforce.xml @@ -1,7 +1,7 @@ - - + + diff --git a/assets/xml/objects/object_firefly.xml b/assets/xml/objects/object_firefly.xml index 4c6aacd16..acdcedb1d 100644 --- a/assets/xml/objects/object_firefly.xml +++ b/assets/xml/objects/object_firefly.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index 4d9a86e51..918c0eb5f 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -1,6 +1,6 @@  - + @@ -54,10 +54,10 @@ - + - + @@ -78,7 +78,7 @@ - + @@ -99,10 +99,10 @@ - + - + @@ -137,26 +137,26 @@ - + - - + + - + - + - + diff --git a/assets/xml/objects/object_flowerpot.xml b/assets/xml/objects/object_flowerpot.xml index b6adc70d4..01d16b663 100644 --- a/assets/xml/objects/object_flowerpot.xml +++ b/assets/xml/objects/object_flowerpot.xml @@ -3,9 +3,9 @@ - - - - + + + + diff --git a/assets/xml/objects/object_fr.xml b/assets/xml/objects/object_fr.xml index 0cd28760e..f7fa4354b 100644 --- a/assets/xml/objects/object_fr.xml +++ b/assets/xml/objects/object_fr.xml @@ -1,8 +1,8 @@  - - - + + + diff --git a/assets/xml/objects/object_fsn.xml b/assets/xml/objects/object_fsn.xml index dd67874f0..37867dc32 100644 --- a/assets/xml/objects/object_fsn.xml +++ b/assets/xml/objects/object_fsn.xml @@ -57,15 +57,14 @@ - - - - - - - - - + + + + + + + + @@ -78,8 +77,8 @@ - - + + @@ -106,7 +105,7 @@ - - + + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml index 19404f90e..fb41a85e8 100644 --- a/assets/xml/objects/object_fu.xml +++ b/assets/xml/objects/object_fu.xml @@ -1,7 +1,7 @@  - - + + diff --git a/assets/xml/objects/object_fu_kaiten.xml b/assets/xml/objects/object_fu_kaiten.xml index 37a7ec4bc..ad277bb26 100644 --- a/assets/xml/objects/object_fu_kaiten.xml +++ b/assets/xml/objects/object_fu_kaiten.xml @@ -1,18 +1,18 @@  - + - - + + - + diff --git a/assets/xml/objects/object_fu_mato.xml b/assets/xml/objects/object_fu_mato.xml index b28899f3c..bedf6906f 100644 --- a/assets/xml/objects/object_fu_mato.xml +++ b/assets/xml/objects/object_fu_mato.xml @@ -1,21 +1,21 @@  - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_funen.xml b/assets/xml/objects/object_funen.xml index 5f8c18c3d..7a0410008 100644 --- a/assets/xml/objects/object_funen.xml +++ b/assets/xml/objects/object_funen.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_fusen.xml b/assets/xml/objects/object_fusen.xml index 2e115b2b7..2ee47097a 100644 --- a/assets/xml/objects/object_fusen.xml +++ b/assets/xml/objects/object_fusen.xml @@ -1,8 +1,8 @@  - - + + - + diff --git a/assets/xml/objects/object_fwall.xml b/assets/xml/objects/object_fwall.xml index 1bbb5d572..a4311c173 100644 --- a/assets/xml/objects/object_fwall.xml +++ b/assets/xml/objects/object_fwall.xml @@ -1,6 +1,6 @@  - + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index 7463cd2e0..757e652c9 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -1,73 +1,78 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_fusen.xml b/assets/xml/objects/object_po_fusen.xml index a25c9d960..23bfbe075 100644 --- a/assets/xml/objects/object_po_fusen.xml +++ b/assets/xml/objects/object_po_fusen.xml @@ -1,32 +1,39 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index e2e57a31a..cc00b50a1 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -3,68 +3,68 @@ - + - + - - - + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - + diff --git a/assets/xml/objects/object_sth.xml b/assets/xml/objects/object_sth.xml index b176cd8cc..53040ae05 100644 --- a/assets/xml/objects/object_sth.xml +++ b/assets/xml/objects/object_sth.xml @@ -1,42 +1,53 @@  + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index b6c5b640d..0d8fdb68c 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -65,11 +65,11 @@ - - - - - + + + + + @@ -135,8 +135,8 @@ - + - + diff --git a/assets/xml/overlays/ovl_En_Sth.xml b/assets/xml/overlays/ovl_En_Sth.xml index 51b29870d..a0d90d9e8 100644 --- a/assets/xml/overlays/ovl_En_Sth.xml +++ b/assets/xml/overlays/ovl_En_Sth.xml @@ -1,14 +1,15 @@ - - - - - - - - - - + + + + + + + + + + + diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 493486e79..2f4c9854a 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -14,7 +14,7 @@ Most discussions happen on our [Discord Server](https://discord.zelda64.dev) whe - [Style Guide](STYLE.md) - Description of the project style that we ask contributors to adhere to. - [Code Review Guidelines](REVIEWING.md) - These are the guidelines that reviewers will be using when reviewing your code. Good to be familiar with these before submitting your code. -- [Zelda 64 Reverse Engineering Website](https://zelda64.dev/mm) - Our homepage, with FAQ and progress graph :chart_with_upwards_trend:. +- [Zelda 64 Reverse Engineering Website](https://zelda64.dev/games/mm) - Our homepage, with FAQ and progress graph :chart_with_upwards_trend:. - [MM decomp tutorial](tutorial/contents.md) Detailed tutorial for learning in general how decomp works and how to decompile a small, simple file. - [Introduction to OOT decomp](https://github.com/zeldaret/oot/blob/master/docs/tutorial/contents.md) - The tutorial the MM one was based on. For OOT, but largely applicable to MM as well. Covers slightly different topics, including how to get your data OK with `vbindiff`. - The `#resources` channel on the Discord contains many more links on specific details of decompiling IDO MIPS code. diff --git a/docs/tools.md b/docs/tools.md index 0aba4fa47..5005f7f93 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -127,7 +127,7 @@ Gives the progress output that the website uses. Run for that warm glow. ### `tools/regconvert.py` -Convert `mips2c`'s `gGameInfo->data[n]` output (or a raw offset) into the appropriate variable in the REG pages. Can also be run on a file to mass-convert them: run with `-h` for details. +Convert `mips2c`'s `gRegEditor->data[n]` output (or a raw offset) into the appropriate variable in the REG pages. Can also be run on a file to mass-convert them: run with `-h` for details. ### `tools/rename_global_asm.py` diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index 96ba7a43d..528b052f9 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -67,7 +67,7 @@ void EnMs_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.015f); this->actor.colChkInfo.mass = 0xFF; this->actionFunc = func_80952734; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; } @@ -107,13 +107,13 @@ void func_809529AC(EnMs* this, PlayState* play) { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80952A1C; } else { - Actor_PickUp(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } void func_80952A1C(EnMs* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80151938(play, 0x936U); + Message_ContinueTextbox(play, 0x936U); this->actionFunc = func_809527F8; } else { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); @@ -167,8 +167,8 @@ void func_809527F8(EnMs* this, PlayState* play) { return; } if (Message_ShouldAdvance(play) != 0) { - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; } @@ -182,23 +182,23 @@ void func_809527F8(EnMs* this, PlayState* play) { } func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); // Duplicate return node #17. Try simplifying control flow for better match return; } - func_801477B4(play); + Message_CloseTextbox(play); if ((s32) gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; } if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } @@ -256,8 +256,8 @@ block_5: if (Message_ShouldAdvance(play) == 0) { goto block_17; } - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: @@ -273,29 +273,29 @@ block_7: } goto block_16; block_11: - func_801477B4(play); + Message_CloseTextbox(play); if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; block_13: if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] < 0x14) { goto block_15; } play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); return; block_15: func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); block_17: return; } @@ -316,7 +316,7 @@ The simplest sort of block label to eliminate is one that is only used once, and goto block_13; } play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; block_13: ``` @@ -326,7 +326,7 @@ Currently, this says to jump over the code block `play_sound...` if the conditio ```C if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; } ``` @@ -359,8 +359,8 @@ block_5: if (Message_ShouldAdvance(play) == 0) { goto block_17; } - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: @@ -376,27 +376,27 @@ block_7: } goto block_16; block_11: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); block_17: return; } @@ -428,8 +428,8 @@ block_5: if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: @@ -445,27 +445,27 @@ block_7: } goto block_16; block_11: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); } ``` @@ -495,21 +495,21 @@ So let us rewrite the entire second half as a switch: ```C switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); return; } if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); return; } func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; @@ -518,7 +518,7 @@ So let us rewrite the entire second half as a switch: case 1: default: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); break; } ``` @@ -531,17 +531,17 @@ There's a couple of other obvious things here: ```C switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } @@ -550,7 +550,7 @@ There's a couple of other obvious things here: case 1: default: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); break; } ``` @@ -588,25 +588,25 @@ block_5: if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; return; block_7: if (Message_ShouldAdvance(play) != 0) { switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } @@ -615,7 +615,7 @@ block_7: case 1: default: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); break; } } @@ -652,8 +652,8 @@ void func_809527F8(EnMs* this, PlayState* play) { if (Message_ShouldAdvance(play) == 0) { return; } - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; break; @@ -661,17 +661,17 @@ void func_809527F8(EnMs* this, PlayState* play) { if (Message_ShouldAdvance(play) != 0) { switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } @@ -680,7 +680,7 @@ void func_809527F8(EnMs* this, PlayState* play) { case 1: default: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); break; } } @@ -703,8 +703,8 @@ void func_809527F8(EnMs* this, PlayState* play) { case 5: if (Message_ShouldAdvance(play) != 0) { - func_801477B4(play); - Actor_PickUp((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem((Actor *) this, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809529AC; } break; @@ -713,17 +713,17 @@ void func_809527F8(EnMs* this, PlayState* play) { if (Message_ShouldAdvance(play) != 0) { switch (play->msgCtx.choiceIndex) { case 0: - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 0xA) { play_sound(0x4806U); - func_80151938(play, 0x935U); + Message_ContinueTextbox(play, 0x935U); } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); - func_80151938(play, 0x937U); + Message_ContinueTextbox(play, 0x937U); } else { func_8019F208(); - Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); + Actor_OfferGetItem((Actor *) this, play, 0x35, 90.0f, 10.0f); Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } @@ -732,7 +732,7 @@ void func_809527F8(EnMs* this, PlayState* play) { case 1: default: func_8019F230(); - func_80151938(play, 0x934U); + Message_ContinueTextbox(play, 0x934U); break; } } diff --git a/docs/tutorial/documenting.md b/docs/tutorial/documenting.md index 68c90ef66..7ecd37ccb 100644 --- a/docs/tutorial/documenting.md +++ b/docs/tutorial/documenting.md @@ -203,7 +203,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2AE0; } } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } @@ -327,17 +327,13 @@ the fourth element is the object (it is actually an enum, but the file itself ha ## Z64Utils -The latest release of Z64Utils can be downloaded from [https://github.com/Random06457/Z64Utils/releases]. To use it with MM, you also need a json file to fill in the file names: the latest version can be obtained from [https://github.com/Random06457/Z64Utils-Config]. It should work on Wine. Some graphics cards don't love it, but the 3D graphical part is only required for skeleton and animations. +The latest release of Z64Utils can be downloaded from [https://github.com/zeldaret/Z64Utils/releases]. It should work on Wine. Some graphics cards don't love it, but the 3D graphical part is only required for skeleton and animations. Having downloaded and unzipped it, open the baserom file. This will populate the main window with a list: ![Z64Utils' main window](images/z64utils_main.png) -Search for the object file, right-click and select "Open in Object Analyzer". It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment `6`, so just click okay. This will open this window: - -![Z64Utils' object analyzer window](images/z64utils_object_analyzer.png) - -Go to "Analysis -> Find Dlists" and press OK (the defaults are usually fine). This will automatically search for displaylists in the object, which are a sufficiently distinctive format to be easy to find. We want to see the other stuff in the object too, so also do "Analysis -> Analyze Dlists". This will populate the window with even more stuff: +Search for the object file, then either double-click it or right-click it and select "Open in Object Analyzer" to open it. It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment `6`, so just click okay. This will open this window; displaylists and other data will automatically be analyzed when the object is opened: ![Z64Utils, with an analyzed object](images/z64utils_object_analyzed.png) @@ -347,7 +343,7 @@ We will talk about what all these types of data are next time, but for now, all static void* D_80C106B0[4] = { object_bg_Tex_00F8F0, object_bg_Tex_00FCF0, object_bg_Tex_0100F0, object_bg_Tex_00FCF0 }; ``` -actually are. We know they are set on segment 8, so we need to find where the skeleton uses them. We know from `object_bg_Skel_011B60` that this is at `0x06011B60`, so scroll down to it, right-click on it, and choose "Open in Skeleton Viewer". Pick an animation that we know it uses (sometimes Z64Utils misidentifies other things for animations), such as `object_bg_Anim_000968`, and you will get this error: +actually are. We know they are set on segment 8, so we need to find where the skeleton uses them. We know from `object_bg_Skel_011B60` that this is at `0x06011B60`, so scroll down to it and either double-click on it or right-click on it and choose "Open in Skeleton Viewer". Pick an animation that we know it uses (sometimes Z64Utils misidentifies other things for animations), such as `object_bg_Anim_000968`, and you will get this error: ![Z64Utils, error when viewing skeleton](images/z64utils_skeleton_error.png) @@ -447,7 +443,7 @@ void EnRecepgirl_UnkLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } ``` -It is used to do a rotation of whatever limb `5` is. (The `+=` is because `rot->x` is the base rotation of the limb, and we have to add the same thing to it every frame to keep the angle changed and constant.) We can use Z64Utils to : setting segment `8` to one of what we know now are the eye textures, we can view the model in the skeleton viewer. The limb numbers in the object are one smaller than those in the actor (the root limb is only a concept for the code, not the object), so we find limb 4: +It is used to do a rotation of whatever limb `5` is. (The `+=` is because `rot->x` is the base rotation of the limb, and we have to add the same thing to it every frame to keep the angle changed and constant.) We can use Z64Utils to figure this out: setting segment `8` to one of what we know now are the eye textures, we can view the model in the skeleton viewer. The limb numbers in the object are one smaller than those in the actor (the root limb is only a concept for the code, not the object), so we find limb 4: ![Z64Utils highlighting a limb](images/z64utils_skeleton_head.png) @@ -540,7 +536,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment } } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } ``` diff --git a/docs/tutorial/images/z64utils_object_analyzer.png b/docs/tutorial/images/z64utils_object_analyzer.png deleted file mode 100644 index 7a6adec3d..000000000 Binary files a/docs/tutorial/images/z64utils_object_analyzer.png and /dev/null differ diff --git a/docs/tutorial/introduction.md b/docs/tutorial/introduction.md index 2115faace..aba8beede 100644 --- a/docs/tutorial/introduction.md +++ b/docs/tutorial/introduction.md @@ -27,7 +27,7 @@ glabel func_809529AC /* 0003D8 809529F8 C484009C */ lwc1 $f4, 0x9c($a0) /* 0003DC 809529FC 8C870098 */ lw $a3, 0x98($a0) /* 0003E0 80952A00 24060035 */ addiu $a2, $zero, 0x35 -/* 0003E4 80952A04 0C02E287 */ jal Actor_PickUp +/* 0003E4 80952A04 0C02E287 */ jal Actor_OfferGetItem /* 0003E8 80952A08 E7A40010 */ swc1 $f4, 0x10($sp) .L80952A0C: /* 0003EC 80952A0C 8FBF001C */ lw $ra, 0x1c($sp) @@ -46,7 +46,7 @@ void func_809529AC(EnMs* this, PlayState* play) { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80952A1C; } else { - Actor_PickUp(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } ``` diff --git a/docs/tutorial/object_decomp.md b/docs/tutorial/object_decomp.md index 90ed70405..2406b715d 100644 --- a/docs/tutorial/object_decomp.md +++ b/docs/tutorial/object_decomp.md @@ -111,7 +111,7 @@ If in doubt, look at completed objects in the repo, and if still in doubt, ask. We are very fortunate that several nice tools have been written recently that are excellent for documenting asset files: -- [Z64Utils](https://github.com/Random06457/Z64Utils/releases), for looking at displaylists, textures they reference, the skeleton, animations, etc. +- [Z64Utils](https://github.com/zeldaret/Z64Utils/releases), for looking at displaylists, textures they reference, the skeleton, animations, etc. - [Texture64](https://github.com/queueRAM/Texture64/releases), for looking at textures in all the common N64 formats (needed since Z64Utils cannot interpret textures not explicitly referenced in displaylists currently) ## Building and investigative modding diff --git a/docs/tutorial/object_decomp_example.md b/docs/tutorial/object_decomp_example.md index f4030be5b..829dbb917 100644 --- a/docs/tutorial/object_decomp_example.md +++ b/docs/tutorial/object_decomp_example.md @@ -6,11 +6,11 @@ Let's take a look at `object_dns`, which is a pretty typical NPC object. It's us ## Step 1: Naming the skeleton and limbs -We already went through the steps of opening an object file in Z64Utils in the [documenting step](documenting.md#z64utils), but we'll do it in more detail here. First, search for the object file, then right-click and select "Open in Object Analyzer". It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment 6, so just click OK. +We already went through the steps of opening an object file in Z64Utils in the [documenting step](documenting.md#z64utils), but we'll do it in more detail here. First, search for the object file, then either double-click on it or right-click it and select "Open in Object Analyzer". It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment 6, so just click OK. ![Opening object_dns in Z64Utils](images/z64utils_open_dns.png) -In the resulting window, go to "Analysis -> Find Dlists" and press OK (the defaults are usually fine). This will only find display lists, so to find everything else in the obect, do "Analysis -> Analyze Dlists". We're looking for the skeleton, so scroll down to the SkeletonHeader, right-click it, and select "Open in Skeleton Viewer": +In the resulting window, you'll see displaylists, textures, and other assets. We're looking for the skeleton, so scroll down to the SkeletonHeader, then either double-click on it or right-click it and select "Open in Skeleton Viewer": ![Finding object_dns's SkeletonHeader in Z64Utils](images/z64utils_dns_skeletonheader.png) @@ -186,7 +186,7 @@ For some actors, there may be a few other things left to name that are directly gSPDisplayList(POLY_OPA_DISP++, &D_06002C48); ``` -In Z64Utils, scroll to find this display list, then right-click and select "Open in Dlist Viewer": +In Z64Utils, scroll to find this display list, then either double-click it or right-click it and select "Open in Dlist Viewer": ![Opening dlist_00002C48 in Z64Utils](images/z64utils_dns_display_list.png) diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 1c8ba6b5b..c6ac63a64 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -334,7 +334,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2AE0; } } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } ``` @@ -392,7 +392,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2AE0; } } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } ``` diff --git a/format.py b/format.py index 5b3cd3158..5e2c29feb 100755 --- a/format.py +++ b/format.py @@ -52,7 +52,7 @@ def get_tidy_version(tidy_executable: str): CLANG_FORMAT = get_clang_executable([f"clang-format-{CLANG_VER}"]) if CLANG_FORMAT is None: - sys.exit(f"Error: clang-format-{CLANG_VER} found") + sys.exit(f"Error: clang-format-{CLANG_VER} not found") CLANG_TIDY = get_clang_executable([f"clang-tidy-{CLANG_VER}", "clang-tidy"]) if CLANG_TIDY is None: diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 07fa0ac2c..3ba8748b0 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -4082,7 +4082,7 @@ _DW({ \ #define gDPLoadTextureTile(pkt, timg, fmt, siz, width, height, \ uls, ult, lrs, lrt, pal, \ cms, cmt, masks, maskt, shifts, shiftt) \ -{ \ +_DW({ \ gDPSetTextureImage(pkt, fmt, siz, width, timg); \ gDPSetTile(pkt, fmt, siz, \ (((((lrs)-(uls)+1) * siz##_TILE_BYTES)+7)>>3), 0, \ @@ -4104,7 +4104,7 @@ _DW({ \ (ult)<= 0.0) ? ((x) + 0.5) : ((x) - 0.5)) -#define SWAP(type, a, b) \ - { \ - type _temp = (a); \ - (a) = (b); \ - (b) = _temp; \ - } +#define SWAP(type, a, b) \ + { \ + type _temp = (a); \ + (a) = (b); \ + (b) = _temp; \ + } \ + (void)0 #define OVERLAY_RELOCATION_OFFSET(overlayEntry) ((uintptr_t)((overlayEntry)->vramStart) - (uintptr_t)((overlayEntry)->loadedRamAddr)) #define VRAM_PTR_SIZE(entry) ((uintptr_t)((entry)->vramEnd) - (uintptr_t)((entry)->vramStart)) diff --git a/include/regs.h b/include/regs.h index 9ea58aed1..8de13fb66 100644 --- a/include/regs.h +++ b/include/regs.h @@ -4,13 +4,28 @@ #ifndef REGS_H #define REGS_H +#include "ultra64.h" + #define REG_GROUPS 29 // number of REG groups, i.e. REG, SREG, OREG, etc. #define REG_PAGES 6 #define REG_PER_PAGE 16 #define REG_PER_GROUP REG_PAGES * REG_PER_PAGE -/* We probably want a better name for gGameInfo based on OoT discussions */ -#define BASE_REG(n, r) gGameInfo->data[n * REG_PER_GROUP + r] +typedef struct RegEditor { + /* 0x00 */ u8 regPage; // 0: no page selected (reg editor is not active); 1: first page; `REG_PAGES`: last page + /* 0x01 */ u8 regGroup; // Indexed from 0 to `REG_GROUPS`-1. Each group has its own character to identify it. + /* 0x02 */ u8 regCur; // Selected reg, indexed from 0 as the page start + /* 0x03 */ u8 dPadInputPrev; + /* 0x04 */ u32 inputRepeatTimer; + /* 0x08 */ UNK_TYPE1 pad_08[0xC]; + /* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // Accessed through *REG macros +} RegEditor; // size = 0x15D4 + +void Regs_Init(void); + +extern RegEditor* gRegEditor; + +#define BASE_REG(n, r) (gRegEditor->data[n * REG_PER_GROUP + r]) #define REG(r) BASE_REG(0, r) #define SREG(r) BASE_REG(1, r) @@ -42,11 +57,13 @@ #define kREG(r) BASE_REG(27, r) #define bREG(r) BASE_REG(28, r) -/* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */ +/* TODO: There are still a few OoT defines here that need confirmation */ + #define R_TIME_SPEED REG(15) #define R_RUN_SPEED_LIMIT REG(45) #define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT +#define R_ROOM_IMAGE_NODRAW_FLAGS SREG(25) #define R_UPDATE_RATE SREG(30) #define R_FB_FILTER_TYPE SREG(80) #define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c) @@ -122,6 +139,12 @@ #define R_REVERSE_FLOOR_INDEX XREG(94) #define R_MINIMAP_DISABLED XREG(95) +#define R_TRANS_FADE_FLASH_ALPHA_STEP iREG(50) // Set to a negative number to start the flash +#define R_ROOM_CULL_DEBUG_MODE iREG(86) +#define R_ROOM_CULL_NUM_ENTRIES iREG(87) +#define R_ROOM_CULL_USED_ENTRIES iREG(88) +#define R_ROOM_CULL_DEBUG_TARGET iREG(89) + #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) #define R_OW_MINIMAP_Y WREG(30) diff --git a/include/segment_symbols.h b/include/segment_symbols.h index ccb5488d1..79601bc93 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -88,508 +88,21 @@ DECLARE_OVERLAY_SEGMENT(player_actor) #undef DEFINE_ACTOR_INTERNAL #undef DEFINE_ACTOR_UNSET -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dust) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Kirakira) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bomb2) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Blast) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Spk) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_D_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bubble) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Ripple) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Splash) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Lightning) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dt_Bubble) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Hahen) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stick) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sibuki) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stone1) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Hitmark) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fhg_Flash) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_K_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Solder_Srch_Ball) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Kakera) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Piece) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Ice) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fire_Tail) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Extra) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Db) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Dd) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Ds) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Smoke) -DECLARE_OVERLAY_SEGMENT(Effect_En_Ice_Block) DECLARE_OVERLAY_SEGMENT(fbdemo_triforce) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe1) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe3) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe4) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe5) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sbn) -DECLARE_ROM_SEGMENT(gameplay_keep) -DECLARE_ROM_SEGMENT(gameplay_field_keep) -DECLARE_ROM_SEGMENT(gameplay_dangeon_keep) -DECLARE_ROM_SEGMENT(object_link_boy) -DECLARE_ROM_SEGMENT(object_link_child) -DECLARE_ROM_SEGMENT(object_link_goron) -DECLARE_ROM_SEGMENT(object_link_zora) -DECLARE_ROM_SEGMENT(object_link_nuts) -DECLARE_ROM_SEGMENT(object_mask_ki_tan) -DECLARE_ROM_SEGMENT(object_mask_rabit) -DECLARE_ROM_SEGMENT(object_mask_skj) -DECLARE_ROM_SEGMENT(object_mask_truth) -DECLARE_ROM_SEGMENT(object_mask_gibudo) -DECLARE_ROM_SEGMENT(object_mask_json) -DECLARE_ROM_SEGMENT(object_mask_kerfay) -DECLARE_ROM_SEGMENT(object_mask_bigelf) -DECLARE_ROM_SEGMENT(object_mask_kyojin) -DECLARE_ROM_SEGMENT(object_mask_romerny) -DECLARE_ROM_SEGMENT(object_mask_posthat) -DECLARE_ROM_SEGMENT(object_mask_zacho) -DECLARE_ROM_SEGMENT(object_mask_stone) -DECLARE_ROM_SEGMENT(object_mask_bree) -DECLARE_ROM_SEGMENT(object_mask_gero) -DECLARE_ROM_SEGMENT(object_mask_yofukasi) -DECLARE_ROM_SEGMENT(object_mask_meoto) -DECLARE_ROM_SEGMENT(object_mask_dancer) -DECLARE_ROM_SEGMENT(object_mask_bakuretu) -DECLARE_ROM_SEGMENT(object_mask_bu_san) -DECLARE_ROM_SEGMENT(object_mask_goron) -DECLARE_ROM_SEGMENT(object_mask_zora) -DECLARE_ROM_SEGMENT(object_mask_nuts) -DECLARE_ROM_SEGMENT(object_mask_boy) -DECLARE_ROM_SEGMENT(object_box) -DECLARE_ROM_SEGMENT(object_okuta) -DECLARE_ROM_SEGMENT(object_wallmaster) -DECLARE_ROM_SEGMENT(object_dy_obj) -DECLARE_ROM_SEGMENT(object_firefly) -DECLARE_ROM_SEGMENT(object_dodongo) -DECLARE_ROM_SEGMENT(object_niw) -DECLARE_ROM_SEGMENT(object_tite) -DECLARE_ROM_SEGMENT(object_ph) -DECLARE_ROM_SEGMENT(object_dinofos) -DECLARE_ROM_SEGMENT(object_zl1) -DECLARE_ROM_SEGMENT(object_bubble) -DECLARE_ROM_SEGMENT(object_test3) -DECLARE_ROM_SEGMENT(object_famos) -DECLARE_ROM_SEGMENT(object_st) -DECLARE_ROM_SEGMENT(object_thiefbird) -DECLARE_ROM_SEGMENT(object_bombf) -DECLARE_ROM_SEGMENT(object_am) -DECLARE_ROM_SEGMENT(object_dekubaba) -DECLARE_ROM_SEGMENT(object_warp1) -DECLARE_ROM_SEGMENT(object_b_heart) -DECLARE_ROM_SEGMENT(object_dekunuts) -DECLARE_ROM_SEGMENT(object_bb) -DECLARE_ROM_SEGMENT(object_death) -DECLARE_ROM_SEGMENT(object_hata) -DECLARE_ROM_SEGMENT(object_wood02) -DECLARE_ROM_SEGMENT(object_trap) -DECLARE_ROM_SEGMENT(object_vm) -DECLARE_ROM_SEGMENT(object_efc_star_field) -DECLARE_ROM_SEGMENT(object_rd) -DECLARE_ROM_SEGMENT(object_yukimura_obj) -DECLARE_ROM_SEGMENT(object_horse_link_child) -DECLARE_ROM_SEGMENT(object_syokudai) -DECLARE_ROM_SEGMENT(object_efc_tw) -DECLARE_ROM_SEGMENT(object_gi_key) -DECLARE_ROM_SEGMENT(object_mir_ray) -DECLARE_ROM_SEGMENT(object_ctower_rot) -DECLARE_ROM_SEGMENT(object_bdoor) -DECLARE_ROM_SEGMENT(object_sb) -DECLARE_ROM_SEGMENT(object_gi_melody) -DECLARE_ROM_SEGMENT(object_gi_heart) -DECLARE_ROM_SEGMENT(object_gi_compass) -DECLARE_ROM_SEGMENT(object_gi_bosskey) -DECLARE_ROM_SEGMENT(object_gi_nuts) -DECLARE_ROM_SEGMENT(object_gi_hearts) -DECLARE_ROM_SEGMENT(object_gi_arrowcase) -DECLARE_ROM_SEGMENT(object_gi_bombpouch) -DECLARE_ROM_SEGMENT(object_in) -DECLARE_ROM_SEGMENT(object_os_anime) -DECLARE_ROM_SEGMENT(object_gi_bottle) -DECLARE_ROM_SEGMENT(object_gi_stick) -DECLARE_ROM_SEGMENT(object_gi_map) -DECLARE_ROM_SEGMENT(object_oF1d_map) -DECLARE_ROM_SEGMENT(object_ru2) -DECLARE_ROM_SEGMENT(object_gi_magicpot) -DECLARE_ROM_SEGMENT(object_gi_bomb_1) -DECLARE_ROM_SEGMENT(object_ma2) -DECLARE_ROM_SEGMENT(object_gi_purse) -DECLARE_ROM_SEGMENT(object_rr) -DECLARE_ROM_SEGMENT(object_gi_arrow) -DECLARE_ROM_SEGMENT(object_gi_bomb_2) -DECLARE_ROM_SEGMENT(object_gi_shield_2) -DECLARE_ROM_SEGMENT(object_gi_hookshot) -DECLARE_ROM_SEGMENT(object_gi_ocarina) -DECLARE_ROM_SEGMENT(object_gi_milk) -DECLARE_ROM_SEGMENT(object_ma1) -DECLARE_ROM_SEGMENT(object_ny) -DECLARE_ROM_SEGMENT(object_fr) -DECLARE_ROM_SEGMENT(object_gi_bow) -DECLARE_ROM_SEGMENT(object_gi_glasses) -DECLARE_ROM_SEGMENT(object_gi_liquid) -DECLARE_ROM_SEGMENT(object_ani) -DECLARE_ROM_SEGMENT(object_gi_shield_3) -DECLARE_ROM_SEGMENT(object_gi_bean) -DECLARE_ROM_SEGMENT(object_gi_fish) -DECLARE_ROM_SEGMENT(object_gi_longsword) -DECLARE_ROM_SEGMENT(object_zo) -DECLARE_ROM_SEGMENT(object_umajump) -DECLARE_ROM_SEGMENT(object_mastergolon) -DECLARE_ROM_SEGMENT(object_masterzoora) -DECLARE_ROM_SEGMENT(object_aob) -DECLARE_ROM_SEGMENT(object_ik) -DECLARE_ROM_SEGMENT(object_ahg) -DECLARE_ROM_SEGMENT(object_cne) -DECLARE_ROM_SEGMENT(object_bji) -DECLARE_ROM_SEGMENT(object_bba) -DECLARE_ROM_SEGMENT(object_an1) -DECLARE_ROM_SEGMENT(object_boj) -DECLARE_ROM_SEGMENT(object_fz) -DECLARE_ROM_SEGMENT(object_bob) -DECLARE_ROM_SEGMENT(object_ge1) -DECLARE_ROM_SEGMENT(object_yabusame_point) -DECLARE_ROM_SEGMENT(object_d_hsblock) -DECLARE_ROM_SEGMENT(object_d_lift) -DECLARE_ROM_SEGMENT(object_mamenoki) -DECLARE_ROM_SEGMENT(object_goroiwa) -DECLARE_ROM_SEGMENT(object_toryo) -DECLARE_ROM_SEGMENT(object_daiku) -DECLARE_ROM_SEGMENT(object_nwc) -DECLARE_ROM_SEGMENT(object_gm) -DECLARE_ROM_SEGMENT(object_ms) -DECLARE_ROM_SEGMENT(object_hs) -DECLARE_ROM_SEGMENT(object_lightswitch) -DECLARE_ROM_SEGMENT(object_kusa) -DECLARE_ROM_SEGMENT(object_tsubo) -DECLARE_ROM_SEGMENT(object_kanban) -DECLARE_ROM_SEGMENT(object_owl) -DECLARE_ROM_SEGMENT(object_mk) -DECLARE_ROM_SEGMENT(object_fu) -DECLARE_ROM_SEGMENT(object_gi_ki_tan_mask) -DECLARE_ROM_SEGMENT(object_gi_mask18) -DECLARE_ROM_SEGMENT(object_gi_rabit_mask) -DECLARE_ROM_SEGMENT(object_gi_truth_mask) -DECLARE_ROM_SEGMENT(object_stream) -DECLARE_ROM_SEGMENT(object_mm) -DECLARE_ROM_SEGMENT(object_js) -DECLARE_ROM_SEGMENT(object_cs) -DECLARE_ROM_SEGMENT(object_gi_soldout) -DECLARE_ROM_SEGMENT(object_mag) -DECLARE_ROM_SEGMENT(object_gi_golonmask) -DECLARE_ROM_SEGMENT(object_gi_zoramask) -DECLARE_ROM_SEGMENT(object_ka) -DECLARE_ROM_SEGMENT(object_zg) -DECLARE_ROM_SEGMENT(object_gi_m_arrow) -DECLARE_ROM_SEGMENT(object_ds2) -DECLARE_ROM_SEGMENT(object_fish) -DECLARE_ROM_SEGMENT(object_gi_sutaru) -DECLARE_ROM_SEGMENT(object_ssh) -DECLARE_ROM_SEGMENT(object_bigslime) -DECLARE_ROM_SEGMENT(object_bg) -DECLARE_ROM_SEGMENT(object_bombiwa) -DECLARE_ROM_SEGMENT(object_hintnuts) -DECLARE_ROM_SEGMENT(object_rs) -DECLARE_ROM_SEGMENT(object_gla) -DECLARE_ROM_SEGMENT(object_geldb) -DECLARE_ROM_SEGMENT(object_dog) -DECLARE_ROM_SEGMENT(object_kibako2) -DECLARE_ROM_SEGMENT(object_dns) -DECLARE_ROM_SEGMENT(object_dnk) -DECLARE_ROM_SEGMENT(object_gi_insect) -DECLARE_ROM_SEGMENT(object_gi_ghost) -DECLARE_ROM_SEGMENT(object_gi_soul) -DECLARE_ROM_SEGMENT(object_f40_obj) -DECLARE_ROM_SEGMENT(object_gi_rupy) -DECLARE_ROM_SEGMENT(object_po_composer) -DECLARE_ROM_SEGMENT(object_mu) -DECLARE_ROM_SEGMENT(object_wf) -DECLARE_ROM_SEGMENT(object_skb) -DECLARE_ROM_SEGMENT(object_gs) -DECLARE_ROM_SEGMENT(object_ps) -DECLARE_ROM_SEGMENT(object_omoya_obj) -DECLARE_ROM_SEGMENT(object_crow) -DECLARE_ROM_SEGMENT(object_cow) -DECLARE_ROM_SEGMENT(object_gi_sword_1) -DECLARE_ROM_SEGMENT(object_zl4) -DECLARE_ROM_SEGMENT(object_grasshopper) -DECLARE_ROM_SEGMENT(object_boyo) -DECLARE_ROM_SEGMENT(object_fwall) -DECLARE_ROM_SEGMENT(object_jso) -DECLARE_ROM_SEGMENT(object_knight) -DECLARE_ROM_SEGMENT(object_icicle) -DECLARE_ROM_SEGMENT(object_spdweb) -DECLARE_ROM_SEGMENT(object_boss01) -DECLARE_ROM_SEGMENT(object_boss02) -DECLARE_ROM_SEGMENT(object_boss03) -DECLARE_ROM_SEGMENT(object_boss04) -DECLARE_ROM_SEGMENT(object_boss05) -DECLARE_ROM_SEGMENT(object_boss07) -DECLARE_ROM_SEGMENT(object_raf) -DECLARE_ROM_SEGMENT(object_funen) -DECLARE_ROM_SEGMENT(object_raillift) -DECLARE_ROM_SEGMENT(object_numa_obj) -DECLARE_ROM_SEGMENT(object_flowerpot) -DECLARE_ROM_SEGMENT(object_spinyroll) -DECLARE_ROM_SEGMENT(object_ice_block) -DECLARE_ROM_SEGMENT(object_keikoku_demo) -DECLARE_ROM_SEGMENT(object_slime) -DECLARE_ROM_SEGMENT(object_pr) -DECLARE_ROM_SEGMENT(object_f52_obj) -DECLARE_ROM_SEGMENT(object_f53_obj) -DECLARE_ROM_SEGMENT(object_kibako) -DECLARE_ROM_SEGMENT(object_sek) -DECLARE_ROM_SEGMENT(object_gmo) -DECLARE_ROM_SEGMENT(object_bat) -DECLARE_ROM_SEGMENT(object_sekihil) -DECLARE_ROM_SEGMENT(object_sekihig) -DECLARE_ROM_SEGMENT(object_sekihin) -DECLARE_ROM_SEGMENT(object_sekihiz) -DECLARE_ROM_SEGMENT(object_wiz) -DECLARE_ROM_SEGMENT(object_ladder) -DECLARE_ROM_SEGMENT(object_mkk) -DECLARE_ROM_SEGMENT(object_keikoku_obj) -DECLARE_ROM_SEGMENT(object_sichitai_obj) -DECLARE_ROM_SEGMENT(object_dekucity_ana_obj) -DECLARE_ROM_SEGMENT(object_rat) -DECLARE_ROM_SEGMENT(object_water_effect) -DECLARE_ROM_SEGMENT(object_dblue_object) -DECLARE_ROM_SEGMENT(object_bal) -DECLARE_ROM_SEGMENT(object_warp_uzu) -DECLARE_ROM_SEGMENT(object_driftice) -DECLARE_ROM_SEGMENT(object_fall) -DECLARE_ROM_SEGMENT(object_hanareyama_obj) -DECLARE_ROM_SEGMENT(object_crace_object) -DECLARE_ROM_SEGMENT(object_dno) -DECLARE_ROM_SEGMENT(object_obj_tokeidai) -DECLARE_ROM_SEGMENT(object_eg) -DECLARE_ROM_SEGMENT(object_tru) -DECLARE_ROM_SEGMENT(object_trt) -DECLARE_ROM_SEGMENT(object_hakugin_obj) -DECLARE_ROM_SEGMENT(object_horse_game_check) -DECLARE_ROM_SEGMENT(object_stk) -DECLARE_ROM_SEGMENT(object_mnk) -DECLARE_ROM_SEGMENT(object_gi_bottle_red) -DECLARE_ROM_SEGMENT(object_tokei_tobira) -DECLARE_ROM_SEGMENT(object_az) -DECLARE_ROM_SEGMENT(object_twig) -DECLARE_ROM_SEGMENT(object_dekucity_obj) -DECLARE_ROM_SEGMENT(object_po_fusen) -DECLARE_ROM_SEGMENT(object_racetsubo) -DECLARE_ROM_SEGMENT(object_ha) -DECLARE_ROM_SEGMENT(object_bigokuta) -DECLARE_ROM_SEGMENT(object_open_obj) -DECLARE_ROM_SEGMENT(object_fu_kaiten) -DECLARE_ROM_SEGMENT(object_fu_mato) -DECLARE_ROM_SEGMENT(object_mtoride) -DECLARE_ROM_SEGMENT(object_osn) -DECLARE_ROM_SEGMENT(object_tokei_step) -DECLARE_ROM_SEGMENT(object_lotus) -DECLARE_ROM_SEGMENT(object_tl) -DECLARE_ROM_SEGMENT(object_dkjail_obj) -DECLARE_ROM_SEGMENT(object_visiblock) -DECLARE_ROM_SEGMENT(object_tsn) -DECLARE_ROM_SEGMENT(object_ds2n) -DECLARE_ROM_SEGMENT(object_fsn) -DECLARE_ROM_SEGMENT(object_shn) -DECLARE_ROM_SEGMENT(object_bigicicle) -DECLARE_ROM_SEGMENT(object_gi_bottle_15) -DECLARE_ROM_SEGMENT(object_tk) -DECLARE_ROM_SEGMENT(object_market_obj) -DECLARE_ROM_SEGMENT(object_gi_reserve00) -DECLARE_ROM_SEGMENT(object_gi_reserve01) -DECLARE_ROM_SEGMENT(object_lightblock) -DECLARE_ROM_SEGMENT(object_takaraya_objects) -DECLARE_ROM_SEGMENT(object_wdhand) -DECLARE_ROM_SEGMENT(object_sdn) -DECLARE_ROM_SEGMENT(object_snowwd) -DECLARE_ROM_SEGMENT(object_giant) -DECLARE_ROM_SEGMENT(object_comb) -DECLARE_ROM_SEGMENT(object_hana) -DECLARE_ROM_SEGMENT(object_boss_hakugin) -DECLARE_ROM_SEGMENT(object_meganeana_obj) -DECLARE_ROM_SEGMENT(object_gi_nutsmask) -DECLARE_ROM_SEGMENT(object_stk2) -DECLARE_ROM_SEGMENT(object_spot11_obj) -DECLARE_ROM_SEGMENT(object_danpei_object) -DECLARE_ROM_SEGMENT(object_dhouse) -DECLARE_ROM_SEGMENT(object_hakaisi) -DECLARE_ROM_SEGMENT(object_po) -DECLARE_ROM_SEGMENT(object_snowman) -DECLARE_ROM_SEGMENT(object_po_sisters) -DECLARE_ROM_SEGMENT(object_pp) -DECLARE_ROM_SEGMENT(object_goronswitch) -DECLARE_ROM_SEGMENT(object_delf) -DECLARE_ROM_SEGMENT(object_botihasira) -DECLARE_ROM_SEGMENT(object_gi_bigbomb) -DECLARE_ROM_SEGMENT(object_pst) -DECLARE_ROM_SEGMENT(object_bsmask) -DECLARE_ROM_SEGMENT(object_spidertent) -DECLARE_ROM_SEGMENT(object_zoraegg) -DECLARE_ROM_SEGMENT(object_kbt) -DECLARE_ROM_SEGMENT(object_gg) -DECLARE_ROM_SEGMENT(object_maruta) -DECLARE_ROM_SEGMENT(object_ghaka) -DECLARE_ROM_SEGMENT(object_oyu) -DECLARE_ROM_SEGMENT(object_dnq) -DECLARE_ROM_SEGMENT(object_dai) -DECLARE_ROM_SEGMENT(object_kgy) -DECLARE_ROM_SEGMENT(object_fb) -DECLARE_ROM_SEGMENT(object_taisou) -DECLARE_ROM_SEGMENT(object_gk) -DECLARE_ROM_SEGMENT(object_haka_obj) -DECLARE_ROM_SEGMENT(object_dnt) -DECLARE_ROM_SEGMENT(object_yukiyama) -DECLARE_ROM_SEGMENT(object_icefloe) -DECLARE_ROM_SEGMENT(object_gi_gold_dust) -DECLARE_ROM_SEGMENT(object_gi_bottle_16) -DECLARE_ROM_SEGMENT(object_gi_bottle_22) -DECLARE_ROM_SEGMENT(object_bee) -DECLARE_ROM_SEGMENT(object_ot) -DECLARE_ROM_SEGMENT(object_utubo) -DECLARE_ROM_SEGMENT(object_dora) -DECLARE_ROM_SEGMENT(object_gi_loach) -DECLARE_ROM_SEGMENT(object_gi_seahorse) -DECLARE_ROM_SEGMENT(object_bigpo) -DECLARE_ROM_SEGMENT(object_hariko) -DECLARE_ROM_SEGMENT(object_dnj) -DECLARE_ROM_SEGMENT(object_sinkai_kabe) -DECLARE_ROM_SEGMENT(object_kin2_obj) -DECLARE_ROM_SEGMENT(object_ishi) -DECLARE_ROM_SEGMENT(object_hakugin_demo) -DECLARE_ROM_SEGMENT(object_jg) -DECLARE_ROM_SEGMENT(object_gi_sword_2) -DECLARE_ROM_SEGMENT(object_gi_sword_3) -DECLARE_ROM_SEGMENT(object_gi_sword_4) -DECLARE_ROM_SEGMENT(object_um) -DECLARE_ROM_SEGMENT(object_rb) -DECLARE_ROM_SEGMENT(object_mbar_obj) -DECLARE_ROM_SEGMENT(object_ikana_obj) -DECLARE_ROM_SEGMENT(object_kz) -DECLARE_ROM_SEGMENT(object_tokei_turret) -DECLARE_ROM_SEGMENT(object_zog) -DECLARE_ROM_SEGMENT(object_rotlift) -DECLARE_ROM_SEGMENT(object_posthouse_obj) -DECLARE_ROM_SEGMENT(object_gi_mask09) -DECLARE_ROM_SEGMENT(object_gi_mask14) -DECLARE_ROM_SEGMENT(object_gi_mask15) -DECLARE_ROM_SEGMENT(object_inibs_object) -DECLARE_ROM_SEGMENT(object_tree) -DECLARE_ROM_SEGMENT(object_kaizoku_obj) -DECLARE_ROM_SEGMENT(object_gi_reserve_b_00) -DECLARE_ROM_SEGMENT(object_gi_reserve_c_00) -DECLARE_ROM_SEGMENT(object_zob) -DECLARE_ROM_SEGMENT(object_milkbar) -DECLARE_ROM_SEGMENT(object_dmask) -DECLARE_ROM_SEGMENT(object_gi_reserve_c_01) -DECLARE_ROM_SEGMENT(object_zod) -DECLARE_ROM_SEGMENT(object_kumo30) -DECLARE_ROM_SEGMENT(object_obj_yasi) -DECLARE_ROM_SEGMENT(object_tanron1) -DECLARE_ROM_SEGMENT(object_tanron2) -DECLARE_ROM_SEGMENT(object_tanron3) -DECLARE_ROM_SEGMENT(object_gi_magicmushroom) -DECLARE_ROM_SEGMENT(object_obj_chan) -DECLARE_ROM_SEGMENT(object_gi_mask10) -DECLARE_ROM_SEGMENT(object_zos) -DECLARE_ROM_SEGMENT(object_an2) -DECLARE_ROM_SEGMENT(object_an3) -DECLARE_ROM_SEGMENT(object_f40_switch) -DECLARE_ROM_SEGMENT(object_lodmoon) -DECLARE_ROM_SEGMENT(object_tro) -DECLARE_ROM_SEGMENT(object_gi_mask12) -DECLARE_ROM_SEGMENT(object_gi_mask23) -DECLARE_ROM_SEGMENT(object_gi_bottle_21) -DECLARE_ROM_SEGMENT(object_gi_camera) -DECLARE_ROM_SEGMENT(object_kamejima) -DECLARE_ROM_SEGMENT(object_nb) -DECLARE_ROM_SEGMENT(object_harfgibud) -DECLARE_ROM_SEGMENT(object_zov) -DECLARE_ROM_SEGMENT(object_ah) -DECLARE_ROM_SEGMENT(object_hgdoor) -DECLARE_ROM_SEGMENT(object_dor01) -DECLARE_ROM_SEGMENT(object_dor02) -DECLARE_ROM_SEGMENT(object_dor03) -DECLARE_ROM_SEGMENT(object_dor04) -DECLARE_ROM_SEGMENT(object_last_obj) -DECLARE_ROM_SEGMENT(object_redead_obj) -DECLARE_ROM_SEGMENT(object_ikninside_obj) -DECLARE_ROM_SEGMENT(object_iknv_obj) -DECLARE_ROM_SEGMENT(object_pamera) -DECLARE_ROM_SEGMENT(object_hsstump) -DECLARE_ROM_SEGMENT(object_zm) -DECLARE_ROM_SEGMENT(object_al) -DECLARE_ROM_SEGMENT(object_tab) -DECLARE_ROM_SEGMENT(object_secom_obj) -DECLARE_ROM_SEGMENT(object_dt) -DECLARE_ROM_SEGMENT(object_gi_mask03) -DECLARE_ROM_SEGMENT(object_cha) -DECLARE_ROM_SEGMENT(object_obj_dinner) -DECLARE_ROM_SEGMENT(object_gi_reserve_b_01) -DECLARE_ROM_SEGMENT(object_lastday) -DECLARE_ROM_SEGMENT(object_bai) -DECLARE_ROM_SEGMENT(object_ikn_demo) -DECLARE_ROM_SEGMENT(object_gi_fieldmap) -DECLARE_ROM_SEGMENT(object_big_fwall) -DECLARE_ROM_SEGMENT(object_hunsui) -DECLARE_ROM_SEGMENT(object_uch) -DECLARE_ROM_SEGMENT(object_tanron4) -DECLARE_ROM_SEGMENT(object_tanron5) -DECLARE_ROM_SEGMENT(object_in2) -DECLARE_ROM_SEGMENT(object_yb) -DECLARE_ROM_SEGMENT(object_rz) -DECLARE_ROM_SEGMENT(object_bjt) -DECLARE_ROM_SEGMENT(object_taru) -DECLARE_ROM_SEGMENT(object_moonston) -DECLARE_ROM_SEGMENT(object_gi_schedule) -DECLARE_ROM_SEGMENT(object_gi_stonemask) -DECLARE_ROM_SEGMENT(object_zoraband) -DECLARE_ROM_SEGMENT(object_kepn_koya) -DECLARE_ROM_SEGMENT(object_obj_usiyane) -DECLARE_ROM_SEGMENT(object_gi_mask05) -DECLARE_ROM_SEGMENT(object_gi_mask11) -DECLARE_ROM_SEGMENT(object_gi_mask20) -DECLARE_ROM_SEGMENT(object_nnh) -DECLARE_ROM_SEGMENT(object_kzsaku) -DECLARE_ROM_SEGMENT(object_obj_milk_bin) -DECLARE_ROM_SEGMENT(object_random_obj) -DECLARE_ROM_SEGMENT(object_kujiya) -DECLARE_ROM_SEGMENT(object_kitan) -DECLARE_ROM_SEGMENT(object_gi_mask06) -DECLARE_ROM_SEGMENT(object_gi_mask16) -DECLARE_ROM_SEGMENT(object_astr_obj) -DECLARE_ROM_SEGMENT(object_bsb) -DECLARE_ROM_SEGMENT(object_fall2) -DECLARE_ROM_SEGMENT(object_sth) -DECLARE_ROM_SEGMENT(object_gi_mssa) -DECLARE_ROM_SEGMENT(object_smtower) -DECLARE_ROM_SEGMENT(object_gi_mask21) -DECLARE_ROM_SEGMENT(object_yado_obj) -DECLARE_ROM_SEGMENT(object_syoten) -DECLARE_ROM_SEGMENT(object_moonend) -DECLARE_ROM_SEGMENT(object_ob) -DECLARE_ROM_SEGMENT(object_gi_bottle_04) -DECLARE_ROM_SEGMENT(object_and) -DECLARE_ROM_SEGMENT(object_obj_danpeilift) -DECLARE_ROM_SEGMENT(object_drs) -DECLARE_ROM_SEGMENT(object_msmo) -DECLARE_ROM_SEGMENT(object_an4) -DECLARE_ROM_SEGMENT(object_wdor01) -DECLARE_ROM_SEGMENT(object_wdor02) -DECLARE_ROM_SEGMENT(object_wdor03) -DECLARE_ROM_SEGMENT(object_wdor04) -DECLARE_ROM_SEGMENT(object_wdor05) -DECLARE_ROM_SEGMENT(object_stk3) -DECLARE_ROM_SEGMENT(object_kinsta1_obj) -DECLARE_ROM_SEGMENT(object_kinsta2_obj) -DECLARE_ROM_SEGMENT(object_bh) -DECLARE_ROM_SEGMENT(object_gi_mask17) -DECLARE_ROM_SEGMENT(object_gi_mask22) -DECLARE_ROM_SEGMENT(object_lbfshot) -DECLARE_ROM_SEGMENT(object_fusen) -DECLARE_ROM_SEGMENT(object_ending_obj) -DECLARE_ROM_SEGMENT(object_gi_mask13) +#define DEFINE_OBJECT(name, _enumValue) DECLARE_ROM_SEGMENT(name) +#define DEFINE_OBJECT_UNSET(_enumValue) +#define DEFINE_OBJECT_SIZE_ZERO(_name, _enumValue) + +#include "tables/object_table.h" + +#undef DEFINE_OBJECT +#undef DEFINE_OBJECT_UNSET +#undef DEFINE_OBJECT_SIZE_ZERO DECLARE_ROM_SEGMENT(scene_texture_01) DECLARE_ROM_SEGMENT(scene_texture_02) @@ -1121,4 +634,5 @@ DECLARE_ROM_SEGMENT(KAKUSIANA_room_13) DECLARE_ROM_SEGMENT(KAKUSIANA_room_14) DECLARE_ROM_SEGMENT(bump_texture_static) + #endif diff --git a/include/seqcmd.h b/include/seqcmd.h new file mode 100644 index 000000000..a7db69dad --- /dev/null +++ b/include/seqcmd.h @@ -0,0 +1,521 @@ +#ifndef SEQCMD_H +#define SEQCMD_H + +// ==== Primary commands ==== + +#define SEQCMD_OP_MASK 0xF0000000 +#define SEQCMD_ASYNC_ACTIVE 0x8000000 +#define SEQCMD_SEQPLAYER_MASK 0x7000000 +#define SEQCMD_SEQID_MASK 0xFF // Only applies to certain seqcmds + +typedef enum { + /* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE, + /* 0x1 */ SEQCMD_OP_STOP_SEQUENCE, + /* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE, + /* 0x3 */ SEQCMD_OP_UNQUEUE_SEQUENCE, + /* 0x4 */ SEQCMD_OP_SET_SEQPLAYER_VOLUME, + /* 0x5 */ SEQCMD_OP_SET_SEQPLAYER_FREQ, + /* 0x6 */ SEQCMD_OP_SET_CHANNEL_VOLUME, + /* 0x7 */ SEQCMD_OP_SET_SEQPLAYER_IO, + /* 0x8 */ SEQCMD_OP_SET_CHANNEL_IO, + /* 0x9 */ SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK, + /* 0xA */ SEQCMD_OP_SET_CHANNEL_DISABLE_MASK, + /* 0xB */ SEQCMD_OP_TEMPO_CMD, + /* 0xC */ SEQCMD_OP_SETUP_CMD, + /* 0xD */ SEQCMD_OP_SET_CHANNEL_FREQ, + /* 0xE */ SEQCMD_OP_GLOBAL_CMD, + /* 0xF */ SEQCMD_OP_RESET_AUDIO_HEAP +} SeqCmdOp; + +// ==== Secondary commands ==== + +// Subset of `SEQCMD_OP_TEMPO_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET, + /* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP, + /* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN, + /* 0x3 */ SEQCMD_SUB_OP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_TEMPO_RESET +} SeqCmdTempoCmdOp; + +// Subset of `SEQCMD_OP_SETUP_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME, + /* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE, + /* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ, + /* 0x3 */ SEQCMD_SUB_OP_SETUP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_SETUP_TEMPO_RESET, + /* 0x5 */ SEQCMD_SUB_OP_SETUP_PLAY_SEQ, + /* 0x6 */ SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER, + /* 0x7 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED, + /* 0x8 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX, + /* 0x9 */ SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK, + /* 0xA */ SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ, + /* 0xE */ SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE = 0xE, + /* 0xF */ SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS +} SeqCmdSetupCmdOp; + +// Subset of `SEQCMD_OP_GLOBAL_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, + /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES, + /* 0x2 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 +} SeqCmdSubCmdOp; + +// ==== Audio Sequence Primary Commands ==== + +/** + * Play a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration effect will depend on seqArg. See below + * @param seqArg no effect: < 0x7F, skip ticks: = 0x7F, play after loading asynchronously: >= 0x80 (see note) + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note seqArg will also be stored in gActiveSeqs.seqId, any check against that seqId must also include seqArg. + * seqArg = 0x7F will interpret the duration as the number of ticks to skip. + * seqArg >= 0x80 load the soundFont asynchronously, will only start playing once loaded. + */ +#define SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_PLAY_SEQUENCE << 28) | ((seqPlayerIndex) << 24) | ((u32)(fadeInDuration) << 16) | \ + (u32)(seqId)) + +/** + * Stop a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to stop the sequence + * @param fadeOutDuration duration the sequence will fade out over + * + * @note the 0xFF in the command is not read from at all, but is common in all Stop SeqPlayer Commands + */ +#define SEQCMD_STOP_SEQUENCE(seqPlayerIndex, fadeOutDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(seqPlayerIndex) << 24) | \ + ((fadeOutDuration) << 16)) + +/** + * Add a sequence to a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, play the sequence + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is played, duration the sequence will fade in over + * @param priority priority in the queue. The highest valued priority will be queued to play first. Also used as `seqArg`. + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with the unqueue command + * @note for a priority >= 0x7F, similar effects happen as `seqArg` in the play sequence command + */ +#define SEQCMD_QUEUE_SEQUENCE(seqPlayerIndex, fadeInDuration, priority, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_QUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(fadeInDuration) << 16) | ((u8)(priority) << 8) | (u8)(seqId)) + +/** + * Remove a sequence from a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, stop the sequence, and play the next one in queue if any + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is stopped, duration the sequence will fade out over, and duration the next seq will fade in over + * @param seqId the id of the sequence to remove, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with this command + */ +#define SEQCMD_UNQUEUE_SEQUENCE(seqPlayerIndex, fadeOutInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_UNQUEUE_SEQUENCE << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u8)(fadeOutInDuration) << 16) | (u32)(seqId)) + +/** + * Set the volume of an entire sequence on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_SEQPLAYER_VOLUME(seqPlayerIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | (volume)) + +/** + * Scale the frequency of every channel on a given seqPlayer over a specified duration. + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFFF, with 1000 mapping to 1.0f + * + * @note 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave). + * Cannot be used with `SEQCMD_SET_CHANNEL_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_FREQ << 28) | (u32)((seqPlayerIndex) << 24) | \ + ((u32)((duration) << 16)) | (u16)(freqScale)) + +/** + * Scale the frequency of a specific channel on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFF, with 1000 mapping to 1.0f + * + * @note a frequency of 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an + * octave). Cannot be used with `SEQCMD_SET_SEQPLAYER_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_CHANNEL_FREQ(seqPlayerIndex, channelIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + ((channelIndex) << 12) | (freqScale)) + +/** + * Set the volume of a specific channel on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, channelIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | ((u32)(channelIndex) << 8) | (volume)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the global + * ioPort, which can affect the entire sequence. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each seqPlayer has 8 global ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + (u32)(ioData)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the channel + * ioPort, which will only affect a single channel. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param channelIndex the index of the channel to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each channel has 8 channel ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + ((u32)(channelIndex) << 8) | (u32)(ioData)) + +/** + * Disable (or reenable) specific channels from receiving input set by `SEQCMD_SET_CHANNEL_IO` + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + * + * @note using Audio_QueueCmdS8 0x06 will bypass this channelMask + */ +#define SEQCMD_SET_CHANNEL_IO_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | \ + (u16)(channelMask)) + +/** + * Disable (or reenable) specific channels + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_DISABLE_MASK << 28) | ((u32)(seqPlayerIndex) << 24) | \ + (u32)(channelMask)) + +// ==== Audio Sequence Tempo Commands ==== + +/** + * Set the absolute tempo of a sequence on a given seqPlayer, fading over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoTarget the target tempo for the sequence + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SET_TEMPO(seqPlayerIndex, duration, tempoTarget) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SET << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u8)(tempoTarget)) + +/** + * Increase the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoIncrease the change to add to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SPEED_UP_TEMPO(seqPlayerIndex, duration, tempoIncrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SPEED_UP << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoIncrease)) + +/** + * Decrease the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoDecrease the change to subtract to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SLOW_DOWN_TEMPO(seqPlayerIndex, duration, tempoDecrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SLOW_DOWN << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoDecrease)) + +/** + * Scale the tempo of a sequence by a multiplicative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SCALE << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | (u16)(tempoScale)) + +/** + * Reset the tempo of a sequence to the original tempo on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_RESET_TEMPO(seqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_RESET << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16)) + +/** + * ==== Audio Sequence Setup Commands ==== + * + * The setup commands are designed to wait to be executed. + * Up to 8 commands can be queued per `seqPlayerIndex`. + * These commands will only execute once that `seqPlayerIndex` is finished playing and is no longer enabled. + * They will often target a different player (`targetSeqPlayerIndex`) but not always. + */ + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to unqueue a seqPlayer once that same setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to unqueue once the same seqPlayer is disabled + * + * @bug this command was misimplemented and fails to unqueue. The command relies on `gActiveSeqs.seqId` for + * unqueueing, but seqId is reset before being used to unqueue. A simple fix is to unqueue based on + * `gActiveSeqs.prevSeqId` instead. + */ +#define SEQCMD_SETUP_UNQUEUE_SEQUENCE(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * Setup a request to restart and play an active sequence currently playing on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to restart its active sequence + */ +#define SEQCMD_SETUP_RESTART_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTART_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16)) + +/** + * Setup a request to scale the tempo of a sequence by a multiplicative value on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SETUP_SCALE_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_SCALE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(tempoScale)) + +/** + * Setup a request to reset the tempo of a sequence to the original tempo on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_SETUP_RESET_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_RESET << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to play a sequence on a target seqPlayer once a setup seqPlayer is finished playing and disabled. + * This command is optionally paired with `SEQCMD_SETUP_SET_FADE_IN_TIMER` to set the fade in duration + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param seqId the id of the sequence to play, see `SeqId` + */ +#define SEQCMD_SETUP_PLAY_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_PLAY_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(seqId)) + +/** + * This command is an optional command before `SEQCMD_SETUP_PLAY_SEQUENCE` to set the fade in duration + * (see cmd above) + * + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration duration the sequence will fade in over + */ +#define SEQCMD_SETUP_SET_FADE_IN_TIMER(targetSeqPlayerIndex, fadeInDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER << 20) | \ + ((u8)(targetSeqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 8)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Specifically, it will only restore volume if the number of queued requests on the setup seqPlayer matches + * the number of sequences queued + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param numSeqRequests the number of sequence requests queued that must match the actual number of sequence requests + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, \ + numSeqRequests) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(numSeqRequests)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Allows `scaleIndex` to be specified. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param scaleIndex the scale index of a seqPlayer + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(setupSeqPlayerIndex, targetSeqPlayerIndex, scaleIndex, \ + duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(scaleIndex) << 8) | (u8)(duration)) + +/** + * Setup a request to disable (or reenable) specific channels on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(setupSeqPlayerIndex, targetSeqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(channelMask)) + +/** + * Queue a request to scale the frequency of an entire sequence on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFF, with 100 mapping to 1.0f + * + * @note The base value for frequency, 100, is 10 times smaller than other frequency commands. + * 200 will double the frequency (raise an octave), 50 will halve the frequency (lower an octave). + */ +#define SEQCMD_SETUP_SET_SEQPLAYER_FREQ(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(freqScale)) + +/** + * Queue a request to discard audio data by popping an entry from the persistent caches on the audio heap, + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param tableTypeFlag All tables with the flag `(tableTypeFlag & (1 << tableType))` will be discarded. Specifically: + * `(tableTypeFlag & 1)` will discard the `SEQUENCE_TABLE` + * `(tableTypeFlag & 2)` will discard the `FONT_TABLE` + * `(tableTypeFlag & 4)` will discard the `SAMPLE_TABLE` + */ +#define SEQCMD_SETUP_POP_PERSISTENT_CACHE(setupSeqPlayerIndex, tableTypeFlag) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)tableTypeFlag)) + +/** + * Discard all setup command requests on a seqPlayerIndex by resetting the setup command queue + * + * @param setupSeqPlayerIndex the index of the seqPlayer to disable all setup commands + */ +#define SEQCMD_RESET_SETUP_CMDS(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * ==== Audio Sequence Global Commands ==== + * + * The global commands will apply to the entire audio system and all 4 sequence players + */ + +/** + * Change the sound mode of audio + * + * @param soundMode see the `SoundMode` enum + */ +#define SEQCMD_SET_SOUND_MODE(soundMode) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (soundMode)) + +/** + * Disable (or reenable) new sequences from starting + * + * @param isDisabled true to disable, false to enable + * + * @note this does not disable the sfx player + */ +#define SEQCMD_DISABLE_PLAY_SEQUENCES(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES << 8) | \ + (u16)(isDisabled)) + +#define SEQCMD_DISABLE_PLAY_SEQUENCES_2(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 << 8) | \ + (u16)(isDisabled)) + +/** + * Restart the audio heap with the specified settings + * + * @param fadeReverb bitmask for reverb indices indicating which reverbs to fade leading into audio heap reset + * @param sfxChannelLayout index for different mappings between the 7 banks and the 16 channels + * @param specId index for the audio specifications to set high-level audio parameters + * + * @note: For sfxChannelLayout, There are 4 possible layouts indexed by 0-3. + * However, only index 0 is properly implemented. Other indices lead to bugs and softlocks. + */ +#define SEQCMD_RESET_AUDIO_HEAP(fadeReverb, sfxChannelLayout, specId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_RESET_AUDIO_HEAP << 28) | ((u8)(fadeReverb) << 16) | \ + ((u8)(sfxChannelLayout) << 8) | (u8)(specId)) + +#endif diff --git a/include/sequence.h b/include/sequence.h index 857609d4b..d8a9cd95a 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,8 +1,6 @@ #ifndef SEQUENCE_H #define SEQUENCE_H -#define NA_BGM_STOP 0x100000FF - #define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects #define NA_BGM_AMBIENCE 0x01 // Ambient background noises #define NA_BGM_TERMINA_FIELD 0x02 // Termina Field @@ -133,12 +131,15 @@ #define NA_BGM_END_CREDITS_2 0x82 // The End/Credits II "STAFFROLL2" #define NA_BGM_DISABLED 0xFFFF +#define SEQ_FLAG_ASYNC 0x8000 + typedef enum { /* 0 */ SEQ_PLAYER_BGM_MAIN, /* 1 */ SEQ_PLAYER_FANFARE, /* 2 */ SEQ_PLAYER_SFX, /* 3 */ SEQ_PLAYER_BGM_SUB, /* 4 */ SEQ_PLAYER_AMBIENCE, + /* 5 */ SEQ_PLAYER_MAX, /* 0xFF */ SEQ_PLAYER_INVALID = 0xFF } SequencePlayerId; @@ -160,6 +161,14 @@ typedef enum { /* 0x7 */ CHANNEL_IO_PORT_7 } ChannelIOPort; +typedef enum { + /* 0 */ VOL_SCALE_INDEX_BGM_MAIN, + /* 1 */ VOL_SCALE_INDEX_FANFARE, + /* 2 */ VOL_SCALE_INDEX_SFX, + /* 3 */ VOL_SCALE_INDEX_BGM_SUB, + /* 4 */ VOL_SCALE_INDEX_MAX +} VolumeScaleIndex; // May be worth using SequencePlayerId instead + typedef enum { /* 0x0 */ AMBIENCE_CHANNEL_STREAM_0, /* 0x1 */ AMBIENCE_CHANNEL_CRITTER_0, @@ -174,7 +183,7 @@ typedef enum { /* 0xD */ AMBIENCE_CHANNEL_SOUND_MODE, /* 0xE */ AMBIENCE_CHANNEL_RAIN, /* 0xF */ AMBIENCE_CHANNEL_LIGHTNING -} AmbienceChannelIndex; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceChannelIndex; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_ID_00, @@ -198,7 +207,7 @@ typedef enum { /* 0x12 */ AMBIENCE_ID_12, /* 0x13 */ AMBIENCE_ID_13, /* 0xFF */ AMBIENCE_ID_DISABLED = 0xFF -} AmbienceId; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceId; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_STREAM_0, diff --git a/include/slowly.h b/include/slowly.h new file mode 100644 index 000000000..b91d652d9 --- /dev/null +++ b/include/slowly.h @@ -0,0 +1,31 @@ +#ifndef SLOWLY_H +#define SLOWLY_H + +#include "ultra64.h" + +#define SLOWLY_STATUS_DONE (1 << 0) +#define SLOWLY_STATUS_STARTED (1 << 1) + +typedef void (*SlowlyCallbackZero)(void); +typedef void (*SlowlyCallbackOne)(void*); +typedef void (*SlowlyCallbackTwo)(void*, void*); + +typedef union { + SlowlyCallbackZero zero; + SlowlyCallbackOne one; + SlowlyCallbackTwo two; +} SlowlyCallback; // size = 0x4 + +typedef struct { + /* 0x000 */ OSThread thread; + /* 0x1B0 */ u8 argCount; + /* 0x1B1 */ u8 status; + /* 0x1B4 */ SlowlyCallback callback; + /* 0x1B8 */ void* arg0; + /* 0x1BC */ void* arg1; +} SlowlyMgr; // size = 0x1C0 + +void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1); +void Slowly_Destroy(SlowlyMgr* slowly); + +#endif diff --git a/include/stack.h b/include/stack.h new file mode 100644 index 000000000..3667862cb --- /dev/null +++ b/include/stack.h @@ -0,0 +1,12 @@ +#ifndef STACK_H +#define STACK_H + +#include "alignment.h" + +#define STACK(stack, size) \ + u64 stack[ALIGN8(size) / sizeof(u64)] + +#define STACK_TOP(stack) \ + ((u8*)(stack) + sizeof(stack)) + +#endif diff --git a/include/tables/effect_ss_table.h b/include/tables/effect_ss_table.h new file mode 100644 index 000000000..c51847995 --- /dev/null +++ b/include/tables/effect_ss_table.h @@ -0,0 +1,48 @@ +/** + * Effect Soft Sprite Table + * + * DEFINE_EFFECT_SS should be used for normal effects soft sprites + * - Argument 0: Name of the effect (without the ovl_ part) + * - Argument 1: Enum value for this effect + * + * DEFINE_EFFECT_SS_UNSET is needed to define empty entries from the original game + */ +/* 0x00 */ DEFINE_EFFECT_SS(Effect_Ss_Dust, EFFECT_SS_DUST) +/* 0x01 */ DEFINE_EFFECT_SS(Effect_Ss_Kirakira, EFFECT_SS_KIRAKIRA) +/* 0x02 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_02) +/* 0x03 */ DEFINE_EFFECT_SS(Effect_Ss_Bomb2, EFFECT_SS_BOMB2) +/* 0x04 */ DEFINE_EFFECT_SS(Effect_Ss_Blast, EFFECT_SS_BLAST) +/* 0x05 */ DEFINE_EFFECT_SS(Effect_Ss_G_Spk, EFFECT_SS_G_SPK) +/* 0x06 */ DEFINE_EFFECT_SS(Effect_Ss_D_Fire, EFFECT_SS_D_FIRE) +/* 0x07 */ DEFINE_EFFECT_SS(Effect_Ss_Bubble, EFFECT_SS_BUBBLE) +/* 0x08 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_08) +/* 0x09 */ DEFINE_EFFECT_SS(Effect_Ss_G_Ripple, EFFECT_SS_G_RIPPLE) +/* 0x0A */ DEFINE_EFFECT_SS(Effect_Ss_G_Splash, EFFECT_SS_G_SPLASH) +/* 0x0B */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_0B) +/* 0x0C */ DEFINE_EFFECT_SS(Effect_Ss_G_Fire, EFFECT_SS_G_FIRE) +/* 0x0D */ DEFINE_EFFECT_SS(Effect_Ss_Lightning, EFFECT_SS_LIGHTNING) +/* 0x0E */ DEFINE_EFFECT_SS(Effect_Ss_Dt_Bubble, EFFECT_SS_DT_BUBBLE) +/* 0x0F */ DEFINE_EFFECT_SS(Effect_Ss_Hahen, EFFECT_SS_HAHEN) +/* 0x10 */ DEFINE_EFFECT_SS(Effect_Ss_Stick, EFFECT_SS_STICK) +/* 0x11 */ DEFINE_EFFECT_SS(Effect_Ss_Sibuki, EFFECT_SS_SIBUKI) +/* 0x12 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_12) +/* 0x13 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_13) +/* 0x14 */ DEFINE_EFFECT_SS(Effect_Ss_Stone1, EFFECT_SS_STONE1) +/* 0x15 */ DEFINE_EFFECT_SS(Effect_Ss_Hitmark, EFFECT_SS_HITMARK) +/* 0x16 */ DEFINE_EFFECT_SS(Effect_Ss_Fhg_Flash, EFFECT_SS_FHG_FLASH) +/* 0x17 */ DEFINE_EFFECT_SS(Effect_Ss_K_Fire, EFFECT_SS_K_FIRE) +/* 0x18 */ DEFINE_EFFECT_SS(Effect_Ss_Solder_Srch_Ball, EFFECT_SS_SOLDER_SRCH_BALL) +/* 0x19 */ DEFINE_EFFECT_SS(Effect_Ss_Kakera, EFFECT_SS_KAKERA) +/* 0x1A */ DEFINE_EFFECT_SS(Effect_Ss_Ice_Piece, EFFECT_SS_ICE_PIECE) +/* 0x1B */ DEFINE_EFFECT_SS(Effect_Ss_En_Ice, EFFECT_SS_EN_ICE) +/* 0x1C */ DEFINE_EFFECT_SS(Effect_Ss_Fire_Tail, EFFECT_SS_FIRE_TAIL) +/* 0x1D */ DEFINE_EFFECT_SS(Effect_Ss_En_Fire, EFFECT_SS_EN_FIRE) +/* 0x1E */ DEFINE_EFFECT_SS(Effect_Ss_Extra, EFFECT_SS_EXTRA) +/* 0x1F */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_1F) +/* 0x20 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Db, EFFECT_SS_DEAD_DB) +/* 0x21 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Dd, EFFECT_SS_DEAD_DD) +/* 0x22 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Ds, EFFECT_SS_DEAD_DS) +/* 0x23 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_23) +/* 0x24 */ DEFINE_EFFECT_SS(Effect_Ss_Ice_Smoke, EFFECT_SS_ICE_SMOKE) +/* 0x25 */ DEFINE_EFFECT_SS(Effect_En_Ice_Block, EFFECT_EN_ICE_BLOCK) +/* 0x26 */ DEFINE_EFFECT_SS(Effect_Ss_Sbn, EFFECT_SS_SBN) diff --git a/include/tables/object_table.h b/include/tables/object_table.h new file mode 100644 index 000000000..61175c118 --- /dev/null +++ b/include/tables/object_table.h @@ -0,0 +1,659 @@ +/** + * Object Table + * + * DEFINE_OBJECT should be used for normal objects + * - Argument 0: Name of the object segment in spec + * - Argument 1: Enum value for this object + * + * DEFINE_OBJECT_UNSET and DEFINE_OBJECT_SIZE_ZERO are needed to define empty entries from the original game + * + * DEFINE_OBJECT_UNSET is used to declare a placeholder enum value which maps to an entry with zeroes in `gObjectTable` + * - Argument 0: Enum value for this object + * + * DEFINE_OBJECT_SIZE_ZERO is used to declare a placeholder enum value which maps to a zero-size entry in `gObjectTable`, with no corresponding segment in the rom. + * - Argument 0: Name of the object segment in spec + * - Argument 1: Enum value for this object + */ +/* 0x000 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_0) +/* 0x001 */ DEFINE_OBJECT(gameplay_keep, GAMEPLAY_KEEP) +/* 0x002 */ DEFINE_OBJECT(gameplay_field_keep, GAMEPLAY_FIELD_KEEP) +/* 0x003 */ DEFINE_OBJECT(gameplay_dangeon_keep, GAMEPLAY_DANGEON_KEEP) +/* 0x004 */ DEFINE_OBJECT(object_nb, OBJECT_NB) +/* 0x005 */ DEFINE_OBJECT(object_okuta, OBJECT_OKUTA) +/* 0x006 */ DEFINE_OBJECT(object_crow, OBJECT_CROW) +/* 0x007 */ DEFINE_OBJECT(object_ah, OBJECT_AH) +/* 0x008 */ DEFINE_OBJECT(object_dy_obj, OBJECT_DY_OBJ) +/* 0x009 */ DEFINE_OBJECT(object_wallmaster, OBJECT_WALLMASTER) +/* 0x00A */ DEFINE_OBJECT(object_dodongo, OBJECT_DODONGO) +/* 0x00B */ DEFINE_OBJECT(object_firefly, OBJECT_FIREFLY) +/* 0x00C */ DEFINE_OBJECT(object_box, OBJECT_BOX) +/* 0x00D */ DEFINE_OBJECT(object_al, OBJECT_AL) +/* 0x00E */ DEFINE_OBJECT(object_bubble, OBJECT_BUBBLE) +/* 0x00F */ DEFINE_OBJECT(object_niw, OBJECT_NIW) +/* 0x010 */ DEFINE_OBJECT(object_link_boy, OBJECT_LINK_BOY) +/* 0x011 */ DEFINE_OBJECT(object_link_child, OBJECT_LINK_CHILD) +/* 0x012 */ DEFINE_OBJECT(object_tite, OBJECT_TITE) +/* 0x013 */ DEFINE_OBJECT(object_tab, OBJECT_TAB) +/* 0x014 */ DEFINE_OBJECT(object_ph, OBJECT_PH) +/* 0x015 */ DEFINE_OBJECT(object_and, OBJECT_AND) +/* 0x016 */ DEFINE_OBJECT(object_msmo, OBJECT_MSMO) +/* 0x017 */ DEFINE_OBJECT(object_dinofos, OBJECT_DINOFOS) +/* 0x018 */ DEFINE_OBJECT(object_drs, OBJECT_DRS) +/* 0x019 */ DEFINE_OBJECT(object_zl1, OBJECT_ZL1) +/* 0x01A */ DEFINE_OBJECT(object_an4, OBJECT_AN4) +/* 0x01B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_1B) +/* 0x01C */ DEFINE_OBJECT(object_test3, OBJECT_TEST3) +/* 0x01D */ DEFINE_OBJECT(object_famos, OBJECT_FAMOS) +/* 0x01E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_1E) +/* 0x01F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_1F) +/* 0x020 */ DEFINE_OBJECT(object_st, OBJECT_ST) +/* 0x021 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_21) +/* 0x022 */ DEFINE_OBJECT(object_thiefbird, OBJECT_THIEFBIRD) +/* 0x023 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_23) +/* 0x024 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_24) +/* 0x025 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_25) +/* 0x026 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_26) +/* 0x027 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_27) +/* 0x028 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_28) +/* 0x029 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_29) +/* 0x02A */ DEFINE_OBJECT(object_bombf, OBJECT_BOMBF) +/* 0x02B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_2B) +/* 0x02C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_2C) +/* 0x02D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_2D) +/* 0x02E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_2E) +/* 0x02F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_2F) +/* 0x030 */ DEFINE_OBJECT(object_am, OBJECT_AM) +/* 0x031 */ DEFINE_OBJECT(object_dekubaba, OBJECT_DEKUBABA) +/* 0x032 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_32) +/* 0x033 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_33) +/* 0x034 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_34) +/* 0x035 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_35) +/* 0x036 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_36) +/* 0x037 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_37) +/* 0x038 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_38) +/* 0x039 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_39) +/* 0x03A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_3A) +/* 0x03B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_3B) +/* 0x03C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_3C) +/* 0x03D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_3D) +/* 0x03E */ DEFINE_OBJECT(object_warp1, OBJECT_WARP1) +/* 0x03F */ DEFINE_OBJECT(object_b_heart, OBJECT_B_HEART) +/* 0x040 */ DEFINE_OBJECT(object_dekunuts, OBJECT_DEKUNUTS) +/* 0x041 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_41) +/* 0x042 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_42) +/* 0x043 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_43) +/* 0x044 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_44) +/* 0x045 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_45) +/* 0x046 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_46) +/* 0x047 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_47) +/* 0x048 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_48) +/* 0x049 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_49) +/* 0x04A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4A) +/* 0x04B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4B) +/* 0x04C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4C) +/* 0x04D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4D) +/* 0x04E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4E) +/* 0x04F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_4F) +/* 0x050 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_50) +/* 0x051 */ DEFINE_OBJECT(object_bb, OBJECT_BB) +/* 0x052 */ DEFINE_OBJECT(object_death, OBJECT_DEATH) +/* 0x053 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_53) +/* 0x054 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_54) +/* 0x055 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_55) +/* 0x056 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_56) +/* 0x057 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_57) +/* 0x058 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_58) +/* 0x059 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_59) +/* 0x05A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_5A) +/* 0x05B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_5B) +/* 0x05C */ DEFINE_OBJECT(object_f40_obj, OBJECT_F40_OBJ) +/* 0x05D */ DEFINE_OBJECT(object_po_composer, OBJECT_PO_COMPOSER) +/* 0x05E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_5E) +/* 0x05F */ DEFINE_OBJECT(object_hata, OBJECT_HATA) +/* 0x060 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_60) +/* 0x061 */ DEFINE_OBJECT(object_wood02, OBJECT_WOOD02) +/* 0x062 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_62) +/* 0x063 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_63) +/* 0x064 */ DEFINE_OBJECT(object_trap, OBJECT_TRAP) +/* 0x065 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_65) +/* 0x066 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_66) +/* 0x067 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_67) +/* 0x068 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_68) +/* 0x069 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_69) +/* 0x06A */ DEFINE_OBJECT(object_vm, OBJECT_VM) +/* 0x06B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_6B) +/* 0x06C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_6C) +/* 0x06D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_6D) +/* 0x06E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_6E) +/* 0x06F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_6F) +/* 0x070 */ DEFINE_OBJECT(object_efc_star_field, OBJECT_EFC_STAR_FIELD) +/* 0x071 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_71) +/* 0x072 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_72) +/* 0x073 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_73) +/* 0x074 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_74) +/* 0x075 */ DEFINE_OBJECT(object_rd, OBJECT_RD) +/* 0x076 */ DEFINE_OBJECT(object_yukimura_obj, OBJECT_YUKIMURA_OBJ) +/* 0x077 */ DEFINE_OBJECT_UNSET(OBJECT_HEAVY_OBJECT) +/* 0x078 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_78) +/* 0x079 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_79) +/* 0x07A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_7A) +/* 0x07B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_7B) +/* 0x07C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_7C) +/* 0x07D */ DEFINE_OBJECT(object_horse_link_child, OBJECT_HORSE_LINK_CHILD) +/* 0x07E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_7E) +/* 0x07F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_7F) +/* 0x080 */ DEFINE_OBJECT(object_syokudai, OBJECT_SYOKUDAI) +/* 0x081 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_81) +/* 0x082 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_82) +/* 0x083 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_83) +/* 0x084 */ DEFINE_OBJECT(object_efc_tw, OBJECT_EFC_TW) +/* 0x085 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_85) +/* 0x086 */ DEFINE_OBJECT(object_gi_key, OBJECT_GI_KEY) +/* 0x087 */ DEFINE_OBJECT(object_mir_ray, OBJECT_MIR_RAY) +/* 0x088 */ DEFINE_OBJECT(object_ctower_rot, OBJECT_CTOWER_ROT) +/* 0x089 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_89) +/* 0x08A */ DEFINE_OBJECT(object_bdoor, OBJECT_BDOOR) +/* 0x08B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_8B) +/* 0x08C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_8C) +/* 0x08D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_8D) +/* 0x08E */ DEFINE_OBJECT(object_sb, OBJECT_SB) +/* 0x08F */ DEFINE_OBJECT(object_gi_melody, OBJECT_GI_MELODY) +/* 0x090 */ DEFINE_OBJECT(object_gi_heart, OBJECT_GI_HEART) +/* 0x091 */ DEFINE_OBJECT(object_gi_compass, OBJECT_GI_COMPASS) +/* 0x092 */ DEFINE_OBJECT(object_gi_bosskey, OBJECT_GI_BOSSKEY) +/* 0x093 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_93) +/* 0x094 */ DEFINE_OBJECT(object_gi_nuts, OBJECT_GI_NUTS) +/* 0x095 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_95) +/* 0x096 */ DEFINE_OBJECT(object_gi_hearts, OBJECT_GI_HEARTS) +/* 0x097 */ DEFINE_OBJECT(object_gi_arrowcase, OBJECT_GI_ARROWCASE) +/* 0x098 */ DEFINE_OBJECT(object_gi_bombpouch, OBJECT_GI_BOMBPOUCH) +/* 0x099 */ DEFINE_OBJECT(object_in, OBJECT_IN) +/* 0x09A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_9A) +/* 0x09B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_9B) +/* 0x09C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_9C) +/* 0x09D */ DEFINE_OBJECT(object_os_anime, OBJECT_OS_ANIME) +/* 0x09E */ DEFINE_OBJECT(object_gi_bottle, OBJECT_GI_BOTTLE) +/* 0x09F */ DEFINE_OBJECT(object_gi_stick, OBJECT_GI_STICK) +/* 0x0A0 */ DEFINE_OBJECT(object_gi_map, OBJECT_GI_MAP) +/* 0x0A1 */ DEFINE_OBJECT(object_oF1d_map, OBJECT_OF1D_MAP) +/* 0x0A2 */ DEFINE_OBJECT(object_ru2, OBJECT_RU2) +/* 0x0A3 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_A3) +/* 0x0A4 */ DEFINE_OBJECT(object_gi_magicpot, OBJECT_GI_MAGICPOT) +/* 0x0A5 */ DEFINE_OBJECT(object_gi_bomb_1, OBJECT_GI_BOMB_1) +/* 0x0A6 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_A6) +/* 0x0A7 */ DEFINE_OBJECT(object_ma2, OBJECT_MA2) +/* 0x0A8 */ DEFINE_OBJECT(object_gi_purse, OBJECT_GI_PURSE) +/* 0x0A9 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_A9) +/* 0x0AA */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_AA) +/* 0x0AB */ DEFINE_OBJECT(object_rr, OBJECT_RR) +/* 0x0AC */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_AC) +/* 0x0AD */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_AD) +/* 0x0AE */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_AE) +/* 0x0AF */ DEFINE_OBJECT(object_gi_arrow, OBJECT_GI_ARROW) +/* 0x0B0 */ DEFINE_OBJECT(object_gi_bomb_2, OBJECT_GI_BOMB_2) +/* 0x0B1 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_B1) +/* 0x0B2 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_B2) +/* 0x0B3 */ DEFINE_OBJECT(object_gi_shield_2, OBJECT_GI_SHIELD_2) +/* 0x0B4 */ DEFINE_OBJECT(object_gi_hookshot, OBJECT_GI_HOOKSHOT) +/* 0x0B5 */ DEFINE_OBJECT(object_gi_ocarina, OBJECT_GI_OCARINA) +/* 0x0B6 */ DEFINE_OBJECT(object_gi_milk, OBJECT_GI_MILK) +/* 0x0B7 */ DEFINE_OBJECT(object_ma1, OBJECT_MA1) +/* 0x0B8 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_B8) +/* 0x0B9 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_B9) +/* 0x0BA */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_BA) +/* 0x0BB */ DEFINE_OBJECT(object_ny, OBJECT_NY) +/* 0x0BC */ DEFINE_OBJECT(object_fr, OBJECT_FR) +/* 0x0BD */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_BD) +/* 0x0BE */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_BE) +/* 0x0BF */ DEFINE_OBJECT(object_gi_bow, OBJECT_GI_BOW) +/* 0x0C0 */ DEFINE_OBJECT(object_gi_glasses, OBJECT_GI_GLASSES) +/* 0x0C1 */ DEFINE_OBJECT(object_gi_liquid, OBJECT_GI_LIQUID) +/* 0x0C2 */ DEFINE_OBJECT(object_ani, OBJECT_ANI) +/* 0x0C3 */ DEFINE_OBJECT(object_gi_shield_3, OBJECT_GI_SHIELD_3) +/* 0x0C4 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_C4) +/* 0x0C5 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_C5) +/* 0x0C6 */ DEFINE_OBJECT(object_gi_bean, OBJECT_GI_BEAN) +/* 0x0C7 */ DEFINE_OBJECT(object_gi_fish, OBJECT_GI_FISH) +/* 0x0C8 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_C8) +/* 0x0C9 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_C9) +/* 0x0CA */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_CA) +/* 0x0CB */ DEFINE_OBJECT(object_gi_longsword, OBJECT_GI_LONGSWORD) +/* 0x0CC */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_CC) +/* 0x0CD */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_CD) +/* 0x0CE */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_CE) +/* 0x0CF */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_CF) +/* 0x0D0 */ DEFINE_OBJECT(object_zo, OBJECT_ZO) +/* 0x0D1 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_D1) +/* 0x0D2 */ DEFINE_OBJECT(object_umajump, OBJECT_UMAJUMP) +/* 0x0D3 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_D3) +/* 0x0D4 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_D4) +/* 0x0D5 */ DEFINE_OBJECT(object_mastergolon, OBJECT_MASTERGOLON) +/* 0x0D6 */ DEFINE_OBJECT(object_masterzoora, OBJECT_MASTERZOORA) +/* 0x0D7 */ DEFINE_OBJECT(object_aob, OBJECT_AOB) +/* 0x0D8 */ DEFINE_OBJECT(object_ik, OBJECT_IK) +/* 0x0D9 */ DEFINE_OBJECT(object_ahg, OBJECT_AHG) +/* 0x0DA */ DEFINE_OBJECT(object_cne, OBJECT_CNE) +/* 0x0DB */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_DB) +/* 0x0DC */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_DC) +/* 0x0DD */ DEFINE_OBJECT(object_an3, OBJECT_AN3) +/* 0x0DE */ DEFINE_OBJECT(object_bji, OBJECT_BJI) +/* 0x0DF */ DEFINE_OBJECT(object_bba, OBJECT_BBA) +/* 0x0E0 */ DEFINE_OBJECT(object_an2, OBJECT_AN2) +/* 0x0E1 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_E1) +/* 0x0E2 */ DEFINE_OBJECT(object_an1, OBJECT_AN1) +/* 0x0E3 */ DEFINE_OBJECT(object_boj, OBJECT_BOJ) +/* 0x0E4 */ DEFINE_OBJECT(object_fz, OBJECT_FZ) +/* 0x0E5 */ DEFINE_OBJECT(object_bob, OBJECT_BOB) +/* 0x0E6 */ DEFINE_OBJECT(object_ge1, OBJECT_GE1) +/* 0x0E7 */ DEFINE_OBJECT(object_yabusame_point, OBJECT_YABUSAME_POINT) +/* 0x0E8 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_E8) +/* 0x0E9 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_E9) +/* 0x0EA */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_EA) +/* 0x0EB */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_EB) +/* 0x0EC */ DEFINE_OBJECT(object_d_hsblock, OBJECT_D_HSBLOCK) +/* 0x0ED */ DEFINE_OBJECT(object_d_lift, OBJECT_D_LIFT) +/* 0x0EE */ DEFINE_OBJECT(object_mamenoki, OBJECT_MAMENOKI) +/* 0x0EF */ DEFINE_OBJECT(object_goroiwa, OBJECT_GOROIWA) +/* 0x0F0 */ DEFINE_OBJECT(object_toryo, OBJECT_TORYO) +/* 0x0F1 */ DEFINE_OBJECT(object_daiku, OBJECT_DAIKU) +/* 0x0F2 */ DEFINE_OBJECT(object_nwc, OBJECT_NWC) +/* 0x0F3 */ DEFINE_OBJECT(object_gm, OBJECT_GM) +/* 0x0F4 */ DEFINE_OBJECT(object_ms, OBJECT_MS) +/* 0x0F5 */ DEFINE_OBJECT(object_hs, OBJECT_HS) +/* 0x0F6 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_F6) +/* 0x0F7 */ DEFINE_OBJECT(object_lightswitch, OBJECT_LIGHTSWITCH) +/* 0x0F8 */ DEFINE_OBJECT(object_kusa, OBJECT_KUSA) +/* 0x0F9 */ DEFINE_OBJECT(object_tsubo, OBJECT_TSUBO) +/* 0x0FA */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_FA) +/* 0x0FB */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_FB) +/* 0x0FC */ DEFINE_OBJECT(object_kanban, OBJECT_KANBAN) +/* 0x0FD */ DEFINE_OBJECT(object_owl, OBJECT_OWL) +/* 0x0FE */ DEFINE_OBJECT(object_mk, OBJECT_MK) +/* 0x0FF */ DEFINE_OBJECT(object_fu, OBJECT_FU) +/* 0x100 */ DEFINE_OBJECT(object_gi_ki_tan_mask, OBJECT_GI_KI_TAN_MASK) +/* 0x101 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_101) +/* 0x102 */ DEFINE_OBJECT(object_gi_mask18, OBJECT_GI_MASK18) +/* 0x103 */ DEFINE_OBJECT(object_gi_rabit_mask, OBJECT_GI_RABIT_MASK) +/* 0x104 */ DEFINE_OBJECT(object_gi_truth_mask, OBJECT_GI_TRUTH_MASK) +/* 0x105 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_105) +/* 0x106 */ DEFINE_OBJECT(object_stream, OBJECT_STREAM) +/* 0x107 */ DEFINE_OBJECT(object_mm, OBJECT_MM) +/* 0x108 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_108) +/* 0x109 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_109) +/* 0x10A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_10A) +/* 0x10B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_10B) +/* 0x10C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_10C) +/* 0x10D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_10D) +/* 0x10E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_10E) +/* 0x10F */ DEFINE_OBJECT(object_js, OBJECT_JS) +/* 0x110 */ DEFINE_OBJECT(object_cs, OBJECT_CS) +/* 0x111 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_111) +/* 0x112 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_112) +/* 0x113 */ DEFINE_OBJECT(object_gi_soldout, OBJECT_GI_SOLDOUT) +/* 0x114 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_114) +/* 0x115 */ DEFINE_OBJECT(object_mag, OBJECT_MAG) +/* 0x116 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_116) +/* 0x117 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_117) +/* 0x118 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_118) +/* 0x119 */ DEFINE_OBJECT(object_gi_golonmask, OBJECT_GI_GOLONMASK) +/* 0x11A */ DEFINE_OBJECT(object_gi_zoramask, OBJECT_GI_ZORAMASK) +/* 0x11B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_11B) +/* 0x11C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_11C) +/* 0x11D */ DEFINE_OBJECT(object_ka, OBJECT_KA) +/* 0x11E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_11E) +/* 0x11F */ DEFINE_OBJECT(object_zg, OBJECT_ZG) +/* 0x120 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_120) +/* 0x121 */ DEFINE_OBJECT(object_gi_m_arrow, OBJECT_GI_M_ARROW) +/* 0x122 */ DEFINE_OBJECT(object_ds2, OBJECT_DS2) +/* 0x123 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_123) +/* 0x124 */ DEFINE_OBJECT(object_fish, OBJECT_FISH) +/* 0x125 */ DEFINE_OBJECT(object_gi_sutaru, OBJECT_GI_SUTARU) +/* 0x126 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_126) +/* 0x127 */ DEFINE_OBJECT(object_ssh, OBJECT_SSH) +/* 0x128 */ DEFINE_OBJECT(object_bigslime, OBJECT_BIGSLIME) +/* 0x129 */ DEFINE_OBJECT(object_bg, OBJECT_BG) +/* 0x12A */ DEFINE_OBJECT(object_bombiwa, OBJECT_BOMBIWA) +/* 0x12B */ DEFINE_OBJECT(object_hintnuts, OBJECT_HINTNUTS) +/* 0x12C */ DEFINE_OBJECT(object_rs, OBJECT_RS) +/* 0x12D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_12D) +/* 0x12E */ DEFINE_OBJECT(object_gla, OBJECT_GLA) +/* 0x12F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_12F) +/* 0x130 */ DEFINE_OBJECT(object_geldb, OBJECT_GELDB) +/* 0x131 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_131) +/* 0x132 */ DEFINE_OBJECT(object_dog, OBJECT_DOG) +/* 0x133 */ DEFINE_OBJECT(object_kibako2, OBJECT_KIBAKO2) +/* 0x134 */ DEFINE_OBJECT(object_dns, OBJECT_DNS) +/* 0x135 */ DEFINE_OBJECT(object_dnk, OBJECT_DNK) +/* 0x136 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_136) +/* 0x137 */ DEFINE_OBJECT(object_gi_insect, OBJECT_GI_INSECT) +/* 0x138 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_138) +/* 0x139 */ DEFINE_OBJECT(object_gi_ghost, OBJECT_GI_GHOST) +/* 0x13A */ DEFINE_OBJECT(object_gi_soul, OBJECT_GI_SOUL) +/* 0x13B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_13B) +/* 0x13C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_13C) +/* 0x13D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_13D) +/* 0x13E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_13E) +/* 0x13F */ DEFINE_OBJECT(object_gi_rupy, OBJECT_GI_RUPY) +/* 0x140 */ DEFINE_OBJECT(object_mu, OBJECT_MU) +/* 0x141 */ DEFINE_OBJECT(object_wf, OBJECT_WF) +/* 0x142 */ DEFINE_OBJECT(object_skb, OBJECT_SKB) +/* 0x143 */ DEFINE_OBJECT(object_gs, OBJECT_GS) +/* 0x144 */ DEFINE_OBJECT(object_ps, OBJECT_PS) +/* 0x145 */ DEFINE_OBJECT(object_omoya_obj, OBJECT_OMOYA_OBJ) +/* 0x146 */ DEFINE_OBJECT(object_cow, OBJECT_COW) +/* 0x147 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_147) +/* 0x148 */ DEFINE_OBJECT(object_gi_sword_1, OBJECT_GI_SWORD_1) +/* 0x149 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_149) +/* 0x14A */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_14A) +/* 0x14B */ DEFINE_OBJECT(object_zl4, OBJECT_ZL4) +/* 0x14C */ DEFINE_OBJECT(object_link_goron, OBJECT_LINK_GORON) +/* 0x14D */ DEFINE_OBJECT(object_link_zora, OBJECT_LINK_ZORA) +/* 0x14E */ DEFINE_OBJECT(object_grasshopper, OBJECT_GRASSHOPPER) +/* 0x14F */ DEFINE_OBJECT(object_boyo, OBJECT_BOYO) +/* 0x150 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_150) +/* 0x151 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_151) +/* 0x152 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_152) +/* 0x153 */ DEFINE_OBJECT(object_fwall, OBJECT_FWALL) +/* 0x154 */ DEFINE_OBJECT(object_link_nuts, OBJECT_LINK_NUTS) +/* 0x155 */ DEFINE_OBJECT(object_jso, OBJECT_JSO) +/* 0x156 */ DEFINE_OBJECT(object_knight, OBJECT_KNIGHT) +/* 0x157 */ DEFINE_OBJECT(object_icicle, OBJECT_ICICLE) +/* 0x158 */ DEFINE_OBJECT(object_spdweb, OBJECT_SPDWEB) +/* 0x159 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_159) +/* 0x15A */ DEFINE_OBJECT(object_boss01, OBJECT_BOSS01) +/* 0x15B */ DEFINE_OBJECT(object_boss02, OBJECT_BOSS02) +/* 0x15C */ DEFINE_OBJECT(object_boss03, OBJECT_BOSS03) +/* 0x15D */ DEFINE_OBJECT(object_boss04, OBJECT_BOSS04) +/* 0x15E */ DEFINE_OBJECT(object_boss05, OBJECT_BOSS05) +/* 0x15F */ DEFINE_OBJECT_SIZE_ZERO(object_boss07, OBJECT_UNSET_15F) // unused duplicate with size 0 +/* 0x160 */ DEFINE_OBJECT(object_boss07, OBJECT_BOSS07) +/* 0x161 */ DEFINE_OBJECT(object_raf, OBJECT_RAF) +/* 0x162 */ DEFINE_OBJECT(object_funen, OBJECT_FUNEN) +/* 0x163 */ DEFINE_OBJECT(object_raillift, OBJECT_RAILLIFT) +/* 0x164 */ DEFINE_OBJECT(object_numa_obj, OBJECT_NUMA_OBJ) +/* 0x165 */ DEFINE_OBJECT(object_flowerpot, OBJECT_FLOWERPOT) +/* 0x166 */ DEFINE_OBJECT(object_spinyroll, OBJECT_SPINYROLL) +/* 0x167 */ DEFINE_OBJECT(object_ice_block, OBJECT_ICE_BLOCK) +/* 0x168 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_168) +/* 0x169 */ DEFINE_OBJECT(object_keikoku_demo, OBJECT_KEIKOKU_DEMO) +/* 0x16A */ DEFINE_OBJECT(object_slime, OBJECT_SLIME) +/* 0x16B */ DEFINE_OBJECT(object_pr, OBJECT_PR) +/* 0x16C */ DEFINE_OBJECT(object_f52_obj, OBJECT_F52_OBJ) +/* 0x16D */ DEFINE_OBJECT(object_f53_obj, OBJECT_F53_OBJ) +/* 0x16E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_16E) +/* 0x16F */ DEFINE_OBJECT(object_kibako, OBJECT_KIBAKO) +/* 0x170 */ DEFINE_OBJECT(object_sek, OBJECT_SEK) +/* 0x171 */ DEFINE_OBJECT(object_gmo, OBJECT_GMO) +/* 0x172 */ DEFINE_OBJECT(object_bat, OBJECT_BAT) +/* 0x173 */ DEFINE_OBJECT(object_sekihil, OBJECT_SEKIHIL) +/* 0x174 */ DEFINE_OBJECT(object_sekihig, OBJECT_SEKIHIG) +/* 0x175 */ DEFINE_OBJECT(object_sekihin, OBJECT_SEKIHIN) +/* 0x176 */ DEFINE_OBJECT(object_sekihiz, OBJECT_SEKIHIZ) +/* 0x177 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_177) +/* 0x178 */ DEFINE_OBJECT(object_wiz, OBJECT_WIZ) +/* 0x179 */ DEFINE_OBJECT(object_ladder, OBJECT_LADDER) +/* 0x17A */ DEFINE_OBJECT(object_mkk, OBJECT_MKK) +/* 0x17B */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_17B) +/* 0x17C */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_17C) +/* 0x17D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_17D) +/* 0x17E */ DEFINE_OBJECT(object_keikoku_obj, OBJECT_KEIKOKU_OBJ) +/* 0x17F */ DEFINE_OBJECT(object_sichitai_obj, OBJECT_SICHITAI_OBJ) +/* 0x180 */ DEFINE_OBJECT(object_dekucity_ana_obj, OBJECT_DEKUCITY_ANA_OBJ) +/* 0x181 */ DEFINE_OBJECT(object_rat, OBJECT_RAT) +/* 0x182 */ DEFINE_OBJECT(object_water_effect, OBJECT_WATER_EFFECT) +/* 0x183 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_183) +/* 0x184 */ DEFINE_OBJECT(object_dblue_object, OBJECT_DBLUE_OBJECT) +/* 0x185 */ DEFINE_OBJECT(object_bal, OBJECT_BAL) +/* 0x186 */ DEFINE_OBJECT(object_warp_uzu, OBJECT_WARP_UZU) +/* 0x187 */ DEFINE_OBJECT(object_driftice, OBJECT_DRIFTICE) +/* 0x188 */ DEFINE_OBJECT(object_fall, OBJECT_FALL) +/* 0x189 */ DEFINE_OBJECT(object_hanareyama_obj, OBJECT_HANAREYAMA_OBJ) +/* 0x18A */ DEFINE_OBJECT(object_crace_object, OBJECT_CRACE_OBJECT) +/* 0x18B */ DEFINE_OBJECT(object_dno, OBJECT_DNO) +/* 0x18C */ DEFINE_OBJECT(object_obj_tokeidai, OBJECT_OBJ_TOKEIDAI) +/* 0x18D */ DEFINE_OBJECT(object_eg, OBJECT_EG) +/* 0x18E */ DEFINE_OBJECT(object_tru, OBJECT_TRU) +/* 0x18F */ DEFINE_OBJECT(object_trt, OBJECT_TRT) +/* 0x190 */ DEFINE_OBJECT(object_hakugin_obj, OBJECT_HAKUGIN_OBJ) +/* 0x191 */ DEFINE_OBJECT(object_horse_game_check, OBJECT_HORSE_GAME_CHECK) +/* 0x192 */ DEFINE_OBJECT(object_stk, OBJECT_STK) +/* 0x193 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_193) +/* 0x194 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_194) +/* 0x195 */ DEFINE_OBJECT(object_mnk, OBJECT_MNK) +/* 0x196 */ DEFINE_OBJECT(object_gi_bottle_red, OBJECT_GI_BOTTLE_RED) +/* 0x197 */ DEFINE_OBJECT(object_tokei_tobira, OBJECT_TOKEI_TOBIRA) +/* 0x198 */ DEFINE_OBJECT(object_az, OBJECT_AZ) +/* 0x199 */ DEFINE_OBJECT(object_twig, OBJECT_TWIG) +/* 0x19A */ DEFINE_OBJECT(object_dekucity_obj, OBJECT_DEKUCITY_OBJ) +/* 0x19B */ DEFINE_OBJECT(object_po_fusen, OBJECT_PO_FUSEN) +/* 0x19C */ DEFINE_OBJECT(object_racetsubo, OBJECT_RACETSUBO) +/* 0x19D */ DEFINE_OBJECT(object_ha, OBJECT_HA) +/* 0x19E */ DEFINE_OBJECT(object_bigokuta, OBJECT_BIGOKUTA) +/* 0x19F */ DEFINE_OBJECT(object_open_obj, OBJECT_OPEN_OBJ) +/* 0x1A0 */ DEFINE_OBJECT(object_fu_kaiten, OBJECT_FU_KAITEN) +/* 0x1A1 */ DEFINE_OBJECT(object_fu_mato, OBJECT_FU_MATO) +/* 0x1A2 */ DEFINE_OBJECT(object_mtoride, OBJECT_MTORIDE) +/* 0x1A3 */ DEFINE_OBJECT(object_osn, OBJECT_OSN) +/* 0x1A4 */ DEFINE_OBJECT(object_tokei_step, OBJECT_TOKEI_STEP) +/* 0x1A5 */ DEFINE_OBJECT(object_lotus, OBJECT_LOTUS) +/* 0x1A6 */ DEFINE_OBJECT(object_tl, OBJECT_TL) +/* 0x1A7 */ DEFINE_OBJECT(object_dkjail_obj, OBJECT_DKJAIL_OBJ) +/* 0x1A8 */ DEFINE_OBJECT(object_visiblock, OBJECT_VISIBLOCK) +/* 0x1A9 */ DEFINE_OBJECT(object_tsn, OBJECT_TSN) +/* 0x1AA */ DEFINE_OBJECT(object_ds2n, OBJECT_DS2N) +/* 0x1AB */ DEFINE_OBJECT(object_fsn, OBJECT_FSN) +/* 0x1AC */ DEFINE_OBJECT(object_shn, OBJECT_SHN) +/* 0x1AD */ DEFINE_OBJECT(object_bigicicle, OBJECT_BIGICICLE) +/* 0x1AE */ DEFINE_OBJECT(object_gi_bottle_15, OBJECT_GI_BOTTLE_15) +/* 0x1AF */ DEFINE_OBJECT(object_tk, OBJECT_TK) +/* 0x1B0 */ DEFINE_OBJECT(object_market_obj, OBJECT_MARKET_OBJ) +/* 0x1B1 */ DEFINE_OBJECT(object_gi_reserve00, OBJECT_GI_RESERVE00) +/* 0x1B2 */ DEFINE_OBJECT(object_gi_reserve01, OBJECT_GI_RESERVE01) +/* 0x1B3 */ DEFINE_OBJECT(object_lightblock, OBJECT_LIGHTBLOCK) +/* 0x1B4 */ DEFINE_OBJECT(object_takaraya_objects, OBJECT_TAKARAYA_OBJECTS) +/* 0x1B5 */ DEFINE_OBJECT(object_wdhand, OBJECT_WDHAND) +/* 0x1B6 */ DEFINE_OBJECT(object_sdn, OBJECT_SDN) +/* 0x1B7 */ DEFINE_OBJECT(object_snowwd, OBJECT_SNOWWD) +/* 0x1B8 */ DEFINE_OBJECT(object_giant, OBJECT_GIANT) +/* 0x1B9 */ DEFINE_OBJECT(object_comb, OBJECT_COMB) +/* 0x1BA */ DEFINE_OBJECT(object_hana, OBJECT_HANA) +/* 0x1BB */ DEFINE_OBJECT(object_boss_hakugin, OBJECT_BOSS_HAKUGIN) +/* 0x1BC */ DEFINE_OBJECT(object_meganeana_obj, OBJECT_MEGANEANA_OBJ) +/* 0x1BD */ DEFINE_OBJECT(object_gi_nutsmask, OBJECT_GI_NUTSMASK) +/* 0x1BE */ DEFINE_OBJECT(object_stk2, OBJECT_STK2) +/* 0x1BF */ DEFINE_OBJECT(object_spot11_obj, OBJECT_SPOT11_OBJ) +/* 0x1C0 */ DEFINE_OBJECT(object_danpei_object, OBJECT_DANPEI_OBJECT) +/* 0x1C1 */ DEFINE_OBJECT(object_dhouse, OBJECT_DHOUSE) +/* 0x1C2 */ DEFINE_OBJECT(object_hakaisi, OBJECT_HAKAISI) +/* 0x1C3 */ DEFINE_OBJECT(object_po, OBJECT_PO) +/* 0x1C4 */ DEFINE_OBJECT(object_snowman, OBJECT_SNOWMAN) +/* 0x1C5 */ DEFINE_OBJECT(object_po_sisters, OBJECT_PO_SISTERS) +/* 0x1C6 */ DEFINE_OBJECT(object_pp, OBJECT_PP) +/* 0x1C7 */ DEFINE_OBJECT(object_goronswitch, OBJECT_GORONSWITCH) +/* 0x1C8 */ DEFINE_OBJECT(object_delf, OBJECT_DELF) +/* 0x1C9 */ DEFINE_OBJECT(object_botihasira, OBJECT_BOTIHASIRA) +/* 0x1CA */ DEFINE_OBJECT(object_gi_bigbomb, OBJECT_GI_BIGBOMB) +/* 0x1CB */ DEFINE_OBJECT(object_pst, OBJECT_PST) +/* 0x1CC */ DEFINE_OBJECT(object_bsmask, OBJECT_BSMASK) +/* 0x1CD */ DEFINE_OBJECT(object_spidertent, OBJECT_SPIDERTENT) +/* 0x1CE */ DEFINE_OBJECT(object_zoraegg, OBJECT_ZORAEGG) +/* 0x1CF */ DEFINE_OBJECT(object_kbt, OBJECT_KBT) +/* 0x1D0 */ DEFINE_OBJECT(object_gg, OBJECT_GG) +/* 0x1D1 */ DEFINE_OBJECT(object_maruta, OBJECT_MARUTA) +/* 0x1D2 */ DEFINE_OBJECT(object_ghaka, OBJECT_GHAKA) +/* 0x1D3 */ DEFINE_OBJECT(object_oyu, OBJECT_OYU) +/* 0x1D4 */ DEFINE_OBJECT(object_dnq, OBJECT_DNQ) +/* 0x1D5 */ DEFINE_OBJECT(object_dai, OBJECT_DAI) +/* 0x1D6 */ DEFINE_OBJECT(object_kgy, OBJECT_KGY) +/* 0x1D7 */ DEFINE_OBJECT(object_fb, OBJECT_FB) +/* 0x1D8 */ DEFINE_OBJECT(object_taisou, OBJECT_TAISOU) +/* 0x1D9 */ DEFINE_OBJECT(object_mask_bu_san, OBJECT_MASK_BU_SAN) +/* 0x1DA */ DEFINE_OBJECT(object_mask_ki_tan, OBJECT_MASK_KI_TAN) +/* 0x1DB */ DEFINE_OBJECT(object_mask_rabit, OBJECT_MASK_RABIT) +/* 0x1DC */ DEFINE_OBJECT(object_mask_skj, OBJECT_MASK_SKJ) +/* 0x1DD */ DEFINE_OBJECT(object_mask_bakuretu, OBJECT_MASK_BAKURETU) +/* 0x1DE */ DEFINE_OBJECT(object_mask_truth, OBJECT_MASK_TRUTH) +/* 0x1DF */ DEFINE_OBJECT(object_gk, OBJECT_GK) +/* 0x1E0 */ DEFINE_OBJECT(object_haka_obj, OBJECT_HAKA_OBJ) +/* 0x1E1 */ DEFINE_OBJECT(object_mask_goron, OBJECT_MASK_GORON) +/* 0x1E2 */ DEFINE_OBJECT(object_mask_zora, OBJECT_MASK_ZORA) +/* 0x1E3 */ DEFINE_OBJECT(object_mask_nuts, OBJECT_MASK_NUTS) +/* 0x1E4 */ DEFINE_OBJECT(object_mask_boy, OBJECT_MASK_BOY) +/* 0x1E5 */ DEFINE_OBJECT(object_dnt, OBJECT_DNT) +/* 0x1E6 */ DEFINE_OBJECT(object_yukiyama, OBJECT_YUKIYAMA) +/* 0x1E7 */ DEFINE_OBJECT(object_icefloe, OBJECT_ICEFLOE) +/* 0x1E8 */ DEFINE_OBJECT(object_gi_gold_dust, OBJECT_GI_GOLD_DUST) +/* 0x1E9 */ DEFINE_OBJECT(object_gi_bottle_16, OBJECT_GI_BOTTLE_16) +/* 0x1EA */ DEFINE_OBJECT(object_gi_bottle_22, OBJECT_GI_BOTTLE_22) +/* 0x1EB */ DEFINE_OBJECT(object_bee, OBJECT_BEE) +/* 0x1EC */ DEFINE_OBJECT(object_ot, OBJECT_OT) +/* 0x1ED */ DEFINE_OBJECT(object_utubo, OBJECT_UTUBO) +/* 0x1EE */ DEFINE_OBJECT(object_dora, OBJECT_DORA) +/* 0x1EF */ DEFINE_OBJECT(object_gi_loach, OBJECT_GI_LOACH) +/* 0x1F0 */ DEFINE_OBJECT(object_gi_seahorse, OBJECT_GI_SEAHORSE) +/* 0x1F1 */ DEFINE_OBJECT(object_bigpo, OBJECT_BIGPO) +/* 0x1F2 */ DEFINE_OBJECT(object_hariko, OBJECT_HARIKO) +/* 0x1F3 */ DEFINE_OBJECT(object_dnj, OBJECT_DNJ) +/* 0x1F4 */ DEFINE_OBJECT(object_sinkai_kabe, OBJECT_SINKAI_KABE) +/* 0x1F5 */ DEFINE_OBJECT(object_kin2_obj, OBJECT_KIN2_OBJ) +/* 0x1F6 */ DEFINE_OBJECT(object_ishi, OBJECT_ISHI) +/* 0x1F7 */ DEFINE_OBJECT(object_hakugin_demo, OBJECT_HAKUGIN_DEMO) +/* 0x1F8 */ DEFINE_OBJECT(object_jg, OBJECT_JG) +/* 0x1F9 */ DEFINE_OBJECT(object_gi_sword_2, OBJECT_GI_SWORD_2) +/* 0x1FA */ DEFINE_OBJECT(object_gi_sword_3, OBJECT_GI_SWORD_3) +/* 0x1FB */ DEFINE_OBJECT(object_gi_sword_4, OBJECT_GI_SWORD_4) +/* 0x1FC */ DEFINE_OBJECT(object_um, OBJECT_UM) +/* 0x1FD */ DEFINE_OBJECT(object_mask_gibudo, OBJECT_MASK_GIBUDO) +/* 0x1FE */ DEFINE_OBJECT(object_mask_json, OBJECT_MASK_JSON) +/* 0x1FF */ DEFINE_OBJECT(object_mask_kerfay, OBJECT_MASK_KERFAY) +/* 0x200 */ DEFINE_OBJECT(object_mask_bigelf, OBJECT_MASK_BIGELF) +/* 0x201 */ DEFINE_OBJECT(object_rb, OBJECT_RB) +/* 0x202 */ DEFINE_OBJECT(object_mbar_obj, OBJECT_MBAR_OBJ) +/* 0x203 */ DEFINE_OBJECT(object_ikana_obj, OBJECT_IKANA_OBJ) +/* 0x204 */ DEFINE_OBJECT(object_kz, OBJECT_KZ) +/* 0x205 */ DEFINE_OBJECT(object_tokei_turret, OBJECT_TOKEI_TURRET) +/* 0x206 */ DEFINE_OBJECT(object_zog, OBJECT_ZOG) +/* 0x207 */ DEFINE_OBJECT(object_rotlift, OBJECT_ROTLIFT) +/* 0x208 */ DEFINE_OBJECT(object_posthouse_obj, OBJECT_POSTHOUSE_OBJ) +/* 0x209 */ DEFINE_OBJECT(object_gi_mask09, OBJECT_GI_MASK09) +/* 0x20A */ DEFINE_OBJECT(object_gi_mask14, OBJECT_GI_MASK14) +/* 0x20B */ DEFINE_OBJECT(object_gi_mask15, OBJECT_GI_MASK15) +/* 0x20C */ DEFINE_OBJECT(object_inibs_object, OBJECT_INIBS_OBJECT) +/* 0x20D */ DEFINE_OBJECT(object_tree, OBJECT_TREE) +/* 0x20E */ DEFINE_OBJECT(object_kaizoku_obj, OBJECT_KAIZOKU_OBJ) +/* 0x20F */ DEFINE_OBJECT(object_gi_reserve_b_00, OBJECT_GI_RESERVE_B_00) +/* 0x210 */ DEFINE_OBJECT(object_gi_reserve_c_00, OBJECT_GI_RESERVE_C_00) +/* 0x211 */ DEFINE_OBJECT(object_zob, OBJECT_ZOB) +/* 0x212 */ DEFINE_OBJECT(object_milkbar, OBJECT_MILKBAR) +/* 0x213 */ DEFINE_OBJECT(object_dmask, OBJECT_DMASK) +/* 0x214 */ DEFINE_OBJECT(object_mask_kyojin, OBJECT_MASK_KYOJIN) +/* 0x215 */ DEFINE_OBJECT(object_gi_reserve_c_01, OBJECT_GI_RESERVE_C_01) +/* 0x216 */ DEFINE_OBJECT(object_zod, OBJECT_ZOD) +/* 0x217 */ DEFINE_OBJECT(object_kumo30, OBJECT_KUMO30) +/* 0x218 */ DEFINE_OBJECT(object_obj_yasi, OBJECT_OBJ_YASI) +/* 0x219 */ DEFINE_OBJECT(object_mask_romerny, OBJECT_MASK_ROMERNY) +/* 0x21A */ DEFINE_OBJECT(object_tanron1, OBJECT_TANRON1) +/* 0x21B */ DEFINE_OBJECT(object_tanron2, OBJECT_TANRON2) +/* 0x21C */ DEFINE_OBJECT(object_tanron3, OBJECT_TANRON3) +/* 0x21D */ DEFINE_OBJECT(object_gi_magicmushroom, OBJECT_GI_MAGICMUSHROOM) +/* 0x21E */ DEFINE_OBJECT(object_obj_chan, OBJECT_OBJ_CHAN) +/* 0x21F */ DEFINE_OBJECT(object_gi_mask10, OBJECT_GI_MASK10) +/* 0x220 */ DEFINE_OBJECT(object_zos, OBJECT_ZOS) +/* 0x221 */ DEFINE_OBJECT(object_mask_posthat, OBJECT_MASK_POSTHAT) +/* 0x222 */ DEFINE_OBJECT(object_f40_switch, OBJECT_F40_SWITCH) +/* 0x223 */ DEFINE_OBJECT(object_lodmoon, OBJECT_LODMOON) +/* 0x224 */ DEFINE_OBJECT(object_tro, OBJECT_TRO) +/* 0x225 */ DEFINE_OBJECT(object_gi_mask12, OBJECT_GI_MASK12) +/* 0x226 */ DEFINE_OBJECT(object_gi_mask23, OBJECT_GI_MASK23) +/* 0x227 */ DEFINE_OBJECT(object_gi_bottle_21, OBJECT_GI_BOTTLE_21) +/* 0x228 */ DEFINE_OBJECT(object_gi_camera, OBJECT_GI_CAMERA) +/* 0x229 */ DEFINE_OBJECT(object_kamejima, OBJECT_KAMEJIMA) +/* 0x22A */ DEFINE_OBJECT(object_harfgibud, OBJECT_HARFGIBUD) +/* 0x22B */ DEFINE_OBJECT(object_zov, OBJECT_ZOV) +/* 0x22C */ DEFINE_OBJECT(object_hgdoor, OBJECT_HGDOOR) +/* 0x22D */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_22D) +/* 0x22E */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_22E) +/* 0x22F */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_22F) +/* 0x230 */ DEFINE_OBJECT(object_dor01, OBJECT_DOR01) +/* 0x231 */ DEFINE_OBJECT(object_dor02, OBJECT_DOR02) +/* 0x232 */ DEFINE_OBJECT(object_dor03, OBJECT_DOR03) +/* 0x233 */ DEFINE_OBJECT(object_dor04, OBJECT_DOR04) +/* 0x234 */ DEFINE_OBJECT(object_last_obj, OBJECT_LAST_OBJ) +/* 0x235 */ DEFINE_OBJECT(object_redead_obj, OBJECT_REDEAD_OBJ) +/* 0x236 */ DEFINE_OBJECT(object_ikninside_obj, OBJECT_IKNINSIDE_OBJ) +/* 0x237 */ DEFINE_OBJECT(object_iknv_obj, OBJECT_IKNV_OBJ) +/* 0x238 */ DEFINE_OBJECT(object_pamera, OBJECT_PAMERA) +/* 0x239 */ DEFINE_OBJECT(object_hsstump, OBJECT_HSSTUMP) +/* 0x23A */ DEFINE_OBJECT(object_zm, OBJECT_ZM) +/* 0x23B */ DEFINE_OBJECT(object_big_fwall, OBJECT_BIG_FWALL) +/* 0x23C */ DEFINE_OBJECT(object_secom_obj, OBJECT_SECOM_OBJ) +/* 0x23D */ DEFINE_OBJECT(object_hunsui, OBJECT_HUNSUI) +/* 0x23E */ DEFINE_OBJECT(object_uch, OBJECT_UCH) +/* 0x23F */ DEFINE_OBJECT(object_tanron4, OBJECT_TANRON4) +/* 0x240 */ DEFINE_OBJECT(object_tanron5, OBJECT_TANRON5) +/* 0x241 */ DEFINE_OBJECT(object_dt, OBJECT_DT) +/* 0x242 */ DEFINE_OBJECT(object_gi_mask03, OBJECT_GI_MASK03) +/* 0x243 */ DEFINE_OBJECT(object_cha, OBJECT_CHA) +/* 0x244 */ DEFINE_OBJECT(object_obj_dinner, OBJECT_OBJ_DINNER) +/* 0x245 */ DEFINE_OBJECT(object_gi_reserve_b_01, OBJECT_GI_RESERVE_B_01) +/* 0x246 */ DEFINE_OBJECT(object_lastday, OBJECT_LASTDAY) +/* 0x247 */ DEFINE_OBJECT(object_bai, OBJECT_BAI) +/* 0x248 */ DEFINE_OBJECT(object_in2, OBJECT_IN2) +/* 0x249 */ DEFINE_OBJECT(object_ikn_demo, OBJECT_IKN_DEMO) +/* 0x24A */ DEFINE_OBJECT(object_yb, OBJECT_YB) +/* 0x24B */ DEFINE_OBJECT(object_rz, OBJECT_RZ) +/* 0x24C */ DEFINE_OBJECT(object_mask_zacho, OBJECT_MASK_ZACHO) +/* 0x24D */ DEFINE_OBJECT(object_gi_fieldmap, OBJECT_GI_FIELDMAP) +/* 0x24E */ DEFINE_OBJECT(object_mask_stone, OBJECT_MASK_STONE) +/* 0x24F */ DEFINE_OBJECT(object_bjt, OBJECT_BJT) +/* 0x250 */ DEFINE_OBJECT(object_taru, OBJECT_TARU) +/* 0x251 */ DEFINE_OBJECT(object_moonston, OBJECT_MOONSTON) +/* 0x252 */ DEFINE_OBJECT(object_mask_bree, OBJECT_MASK_BREE) +/* 0x253 */ DEFINE_OBJECT(object_gi_schedule, OBJECT_GI_SCHEDULE) +/* 0x254 */ DEFINE_OBJECT(object_gi_stonemask, OBJECT_GI_STONEMASK) +/* 0x255 */ DEFINE_OBJECT(object_zoraband, OBJECT_ZORABAND) +/* 0x256 */ DEFINE_OBJECT(object_kepn_koya, OBJECT_KEPN_KOYA) +/* 0x257 */ DEFINE_OBJECT(object_obj_usiyane, OBJECT_OBJ_USIYANE) +/* 0x258 */ DEFINE_OBJECT(object_gi_mask05, OBJECT_GI_MASK05) +/* 0x259 */ DEFINE_OBJECT(object_gi_mask11, OBJECT_GI_MASK11) +/* 0x25A */ DEFINE_OBJECT(object_gi_mask20, OBJECT_GI_MASK20) +/* 0x25B */ DEFINE_OBJECT(object_nnh, OBJECT_NNH) +/* 0x25C */ DEFINE_OBJECT(object_mask_gero, OBJECT_MASK_GERO) +/* 0x25D */ DEFINE_OBJECT(object_mask_yofukasi, OBJECT_MASK_YOFUKASI) +/* 0x25E */ DEFINE_OBJECT(object_mask_meoto, OBJECT_MASK_MEOTO) +/* 0x25F */ DEFINE_OBJECT(object_mask_dancer, OBJECT_MASK_DANCER) +/* 0x260 */ DEFINE_OBJECT(object_kzsaku, OBJECT_KZSAKU) +/* 0x261 */ DEFINE_OBJECT(object_obj_milk_bin, OBJECT_OBJ_MILK_BIN) +/* 0x262 */ DEFINE_OBJECT(object_random_obj, OBJECT_RANDOM_OBJ) +/* 0x263 */ DEFINE_OBJECT(object_kujiya, OBJECT_KUJIYA) +/* 0x264 */ DEFINE_OBJECT(object_kitan, OBJECT_KITAN) +/* 0x265 */ DEFINE_OBJECT(object_gi_mask06, OBJECT_GI_MASK06) +/* 0x266 */ DEFINE_OBJECT(object_gi_mask16, OBJECT_GI_MASK16) +/* 0x267 */ DEFINE_OBJECT(object_astr_obj, OBJECT_ASTR_OBJ) +/* 0x268 */ DEFINE_OBJECT(object_bsb, OBJECT_BSB) +/* 0x269 */ DEFINE_OBJECT(object_fall2, OBJECT_FALL2) +/* 0x26A */ DEFINE_OBJECT(object_sth, OBJECT_STH) +/* 0x26B */ DEFINE_OBJECT(object_gi_mssa, OBJECT_GI_MSSA) +/* 0x26C */ DEFINE_OBJECT(object_smtower, OBJECT_SMTOWER) +/* 0x26D */ DEFINE_OBJECT(object_gi_mask21, OBJECT_GI_MASK21) +/* 0x26E */ DEFINE_OBJECT(object_yado_obj, OBJECT_YADO_OBJ) +/* 0x26F */ DEFINE_OBJECT(object_syoten, OBJECT_SYOTEN) +/* 0x270 */ DEFINE_OBJECT(object_moonend, OBJECT_MOONEND) +/* 0x271 */ DEFINE_OBJECT(object_ob, OBJECT_OB) +/* 0x272 */ DEFINE_OBJECT(object_gi_bottle_04, OBJECT_GI_BOTTLE_04) +/* 0x273 */ DEFINE_OBJECT(object_obj_danpeilift, OBJECT_OBJ_DANPEILIFT) +/* 0x274 */ DEFINE_OBJECT(object_wdor01, OBJECT_WDOR01) +/* 0x275 */ DEFINE_OBJECT(object_wdor02, OBJECT_WDOR02) +/* 0x276 */ DEFINE_OBJECT(object_wdor03, OBJECT_WDOR03) +/* 0x277 */ DEFINE_OBJECT(object_stk3, OBJECT_STK3) +/* 0x278 */ DEFINE_OBJECT(object_kinsta1_obj, OBJECT_KINSTA1_OBJ) +/* 0x279 */ DEFINE_OBJECT(object_kinsta2_obj, OBJECT_KINSTA2_OBJ) +/* 0x27A */ DEFINE_OBJECT(object_bh, OBJECT_BH) +/* 0x27B */ DEFINE_OBJECT(object_wdor04, OBJECT_WDOR04) +/* 0x27C */ DEFINE_OBJECT(object_wdor05, OBJECT_WDOR05) +/* 0x27D */ DEFINE_OBJECT(object_gi_mask17, OBJECT_GI_MASK17) +/* 0x27E */ DEFINE_OBJECT(object_gi_mask22, OBJECT_GI_MASK22) +/* 0x27F */ DEFINE_OBJECT(object_lbfshot, OBJECT_LBFSHOT) +/* 0x280 */ DEFINE_OBJECT(object_fusen, OBJECT_FUSEN) +/* 0x281 */ DEFINE_OBJECT(object_ending_obj, OBJECT_ENDING_OBJ) +/* 0x282 */ DEFINE_OBJECT(object_gi_mask13, OBJECT_GI_MASK13) diff --git a/include/tha.h b/include/tha.h new file mode 100644 index 000000000..805d421f9 --- /dev/null +++ b/include/tha.h @@ -0,0 +1,28 @@ +#ifndef THA_H +#define THA_H + +#include "ultra64.h" +#include "libc/stdint.h" + +typedef struct TwoHeadArena { + /* 0x0 */ size_t size; + /* 0x4 */ void* start; + /* 0x8 */ void* head; + /* 0xC */ void* tail; +} TwoHeadArena; // size = 0x10 + +void* THA_GetHead(TwoHeadArena* tha); +void THA_SetHead(TwoHeadArena* tha, void* newHead); +void* THA_GetTail(TwoHeadArena* tha); +void* THA_AllocHead(TwoHeadArena* tha, size_t size); +void* THA_AllocHeadByte(TwoHeadArena* tha); +void* THA_AllocTail(TwoHeadArena* tha, size_t size); +void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size); +void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask); +s32 THA_GetRemaining(TwoHeadArena* tha); +u32 THA_IsCrash(TwoHeadArena* tha); +void THA_Reset(TwoHeadArena* tha); +void THA_Init(TwoHeadArena* tha, void* start, size_t size); +void THA_Destroy(TwoHeadArena* tha); + +#endif diff --git a/include/thga.h b/include/thga.h new file mode 100644 index 000000000..351c36407 --- /dev/null +++ b/include/thga.h @@ -0,0 +1,33 @@ +#ifndef THGA_H +#define THGA_H + +#include "tha.h" + +typedef union TwoHeadGfxArena { + struct { // Same as TwoHeadArena, with different types and field names for the head and tail pointers + /* 0x0 */ size_t size; + /* 0x4 */ void* start; + /* 0x8 */ Gfx* p; + /* 0xC */ void* d; + }; + /* 0x0 */ TwoHeadArena tha; +} TwoHeadGfxArena; // size = 0x10 + +void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size); +void THGA_Destroy(TwoHeadGfxArena* thga); +u32 THGA_IsCrash(TwoHeadGfxArena* thga); +void THGA_Reset(TwoHeadGfxArena* thga); +s32 THGA_GetRemaining(TwoHeadGfxArena* thga); +Gfx* THGA_GetHead(TwoHeadGfxArena* thga); +void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* newHead); +void* THGA_GetTail(TwoHeadGfxArena* thga); +Gfx* THGA_AllocDisplayList(TwoHeadGfxArena* thga, size_t num); +Gfx* THGA_AllocGfx(TwoHeadGfxArena* thga); +Gfx* THGA_AllocGfx2(TwoHeadGfxArena* thga); +void* THGA_AllocTail(TwoHeadGfxArena* thga, size_t size); +Mtx* THGA_AllocMtxArray(TwoHeadGfxArena* thga, size_t num); +Mtx* THGA_AllocMtx(TwoHeadGfxArena* thga); +Vtx* THGA_AllocVtxArray(TwoHeadGfxArena* thga, size_t num); +Vtx* THGA_AllocVtx(TwoHeadGfxArena* thga); + +#endif diff --git a/include/variables.h b/include/variables.h index af32d062e..745c019a8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -282,27 +282,12 @@ extern f64 D_800994C8; extern char gBuildTeam[]; extern char gBuildDate[]; extern char gBuildMakeOption[]; -// extern StackEntry sBootThreadInfo; -// extern OSThread sIdleThread; -// extern u8 sIdleThreadStack[0x400]; -// extern StackEntry sIdleThreadInfo; -// extern u8 sBootThreadStack[0x400]; + extern IrqMgr gIrqMgr; -// extern u8 sIrqMgrStack[0x500]; -// extern StackEntry sIrqMgrStackInfo; -// extern OSThread gMainThread; -// extern u8 sMainStack[0x900]; -// extern StackEntry sMainStackInfo; -// extern OSMesg sPiMgrCmdBuff[50]; -// extern OSMesgQueue gPiMgrCmdQ; + extern OSViMode gViConfigMode; extern u8 D_8009B290; -extern StackEntry sDmaMgrStackInfo; -extern u16 numDmaEntries; -extern OSMesgQueue sDmaMgrMsgQueue; -extern OSMesg sDmaMgrMsgs[32]; -extern OSThread sDmaMgrThread; -extern u8 sDmaMgrStack[0x500]; + extern u8 sYaz0DataBuffer[0x400]; extern u8* sYaz0CurDataEnd; extern u32 sYaz0CurRomStart; @@ -312,13 +297,9 @@ extern void* gYaz0DecompressDstEnd; // extern UNK_TYPE4 D_8009BE30; // extern UNK_TYPE4 D_8009BE34; // extern FaultClient romInfoFaultClient; -extern FaultThreadStruct* sFaultContext; -extern f32 D_8009BE54; -extern u32 faultCustomOptions; -extern u32 faultCopyToLog; -extern u8 sFaultStack[0x600]; -extern StackEntry sFaultThreadInfo; + extern FaultThreadStruct gFaultStruct; + extern FaultDrawer sFaultDrawerStruct; // extern UNK_TYPE4 D_8009CD10; extern u32 sRandFloat; @@ -333,10 +314,7 @@ extern UNK_TYPE1 D_8009CF60; extern OSThread __osThreadSave; extern OSPiHandle D_8009D130; extern OSPiHandle D_8009D1A8; -// extern OSThread D_8009D220; -// extern u8 piManagerStack[0x1000]; -// extern OSMesgQueue D_8009E3D0; -// extern OSMesg D_8009E3E8[1]; + extern OSMesg D_8009E3F0[1]; extern OSMesgQueue __osPiAccessQueue; extern __OSInode __osPfsInodeCache; @@ -348,13 +326,7 @@ extern u32 __osViIntrCount; extern u32 __osTimerCounter; extern OSPifRam __osPfsPifRam; extern OSPiHandle CartRomHandle; -extern OSThread viThread; -extern u8 viThreadStack[0x1000]; -extern OSMesgQueue viEventQueue; -// extern OSMesg viEventBuf[5]; -// extern OSIoMesg viRetraceMsg; -// extern OSIoMesg viCounterMsg; -extern u16 viRetrace; + extern DmaEntry dmadata[1568]; // extern UNK_TYPE1 D_80186028; extern u64 aspMainTextStart[]; @@ -406,24 +378,7 @@ extern EffectSsOverlay gParticleOverlayTable[39]; // extern s32 sEntryIndex; // extern u32 sCurrentBit; // extern s32 sTimer; -extern f32 actorMovementScale; -extern TargetRangeParams gTargetRanges[]; -extern s16 D_801AED48[8]; -extern Color_RGBA8 actorDefaultHitColor; -// extern UNK_TYPE1 D_801AED8C; -// extern UNK_TYPE4 D_801AED98; -// extern UNK_TYPE4 D_801AEDA4; -// extern UNK_TYPE1 D_801AEDB0; -// extern UNK_TYPE4 D_801AEDD4; -// extern UNK_TYPE4 D_801AEE28; -// extern UNK_TYPE4 D_801AEE30; -// extern UNK_TYPE4 D_801AEE38; -// extern UNK_TYPE2 D_801AEE4C; -extern Gfx D_801AEF88[]; -extern Gfx D_801AEFA0[]; -// extern UNK_TYPE1 D_801AEFB8; -// extern UNK_TYPE1 D_801AEFBC; -// extern UNK_TYPE1 D_801AEFC0; + extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; extern ActorId gMaxActorId; extern BgCheckSceneSubdivisionEntry sSceneSubdivisionList[]; @@ -479,9 +434,6 @@ extern EffectShieldParticleInit shieldParticleInitWood; extern u8 D_801BB12C; -// extern UNK_TYPE1 D_801BC210; -extern Gfx D_801BC240[9]; -extern Gfx D_801BC288[3]; // extern UNK_TYPE1 D_801BC41E; extern ActorCutscene actorCutscenesGlobalCutscenes[8]; extern s16 actorCutsceneCurrent; @@ -494,7 +446,7 @@ extern PlayState* actorCutscenesPlayState; extern s16 actorCutsceneReturnCamera; extern s16 D_801BD8C6; extern GameStateOverlay gGameStateOverlayTable[]; -extern s32 graphNumGameStates; +extern s32 gGraphNumGameStates; // extern UNK_TYPE2 D_801BDA70; // extern UNK_TYPE2 D_801BDA74; // extern UNK_TYPE2 D_801BDA78; @@ -640,8 +592,6 @@ extern Gfx gCullFrontDList[]; extern Gfx sSetupDL[438]; extern Gfx sFillSetupDL[12]; extern Gfx gEmptyDL[1]; -extern Vec3f D_801C1D10; -extern room_draw_func roomDrawFuncs[4]; extern u32 gBitFlags[32]; extern u16 gEquipMasks[]; extern u16 gEquipNegMasks[]; @@ -657,8 +607,11 @@ extern u8 gItemSlots[]; extern s16 gItemPrices[]; extern u16 gSceneIdsPerRegion[11][27]; extern u8 gPlayerFormItemRestrictions[PLAYER_FORM_MAX][114]; -extern s16 gPlayerFormObjectIndices[8]; -extern RomFile gObjectTable[643]; + +extern s16 gPlayerFormObjectIndices[PLAYER_FORM_MAX]; +extern ObjectId gObjectTableSize; +extern RomFile gObjectTable[OBJECT_ID_MAX]; + extern SceneTableEntry gSceneTable[]; extern UNK_PTR D_801C5C50; // extern UNK_TYPE1 D_801C5C9C; @@ -807,7 +760,6 @@ extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; // extern UNK_TYPE4 D_801D0BB0; // extern UNK_TYPE1 D_801D0C80; // extern UNK_TYPE1 D_801D0CB0; -extern Gfx D_801D0D00[]; extern s32 gDbgCamEnabled; // extern UNK_TYPE1 D_801D0D54; // extern UNK_TYPE2 sQuakeIndex; @@ -1043,14 +995,9 @@ extern u8 gSfxChannelLayout; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; -// extern UNK_TYPE1 D_801DB4C0; -// extern UNK_TYPE1 D_801DB4C4; -// extern UNK_TYPE1 D_801DB4C8; -// extern UNK_TYPE1 D_801DB4CC; extern u8 gAudioSpecId; -// extern UNK_TYPE1 D_801DB4D8; -// extern UNK_TYPE4 D_801DB4DC; -extern ReverbSettings* gReverbSettingsTable[]; +extern u8 gAudioHeapResetState; +extern ReverbSettings* gReverbSettingsTable[10]; extern AudioSpec gAudioSpecs[21]; // rodata @@ -2306,8 +2253,8 @@ extern f32 D_801ED8D0; // extern UNK_TYPE1 D_801ED8DC; extern Mtx D_801ED8E0; // extern UNK_TYPE1 D_801ED920; -extern FaultClient D_801ED930; -extern FaultAddrConvClient D_801ED940; +extern FaultClient sActorOverlayTableFaultClient; +extern FaultAddrConvClient sActorOverlayTableFaultAddrConvClient; extern char D_801ED950[80]; extern char D_801ED9A0[80]; extern Vec3f D_801ED9F0[3]; @@ -2383,7 +2330,7 @@ extern SaveContext gSaveContext; // extern UNK_TYPE1 D_801F3F42; // extern UNK_TYPE1 D_801F3F4A; // extern UNK_TYPE1 D_801F3F5A; -extern GameInfo* gGameInfo; + // extern UNK_TYPE1 D_801F3F80; // extern UNK_TYPE1 D_801F3F83; // extern UNK_TYPE1 D_801F48C8; @@ -2478,12 +2425,11 @@ extern s16 D_801F4E7A; // extern UNK_TYPE1 D_801F6B58; extern void (*sKaleidoScopeUpdateFunc)(PlayState* play); extern void (*sKaleidoScopeDrawFunc)(PlayState* play); -extern FaultAddrConvClient sKaleidoAreaFaultClient; +extern FaultAddrConvClient sKaleidoMgrFaultAddrConvClient; extern s16 sTransitionFillTimer; extern Input D_801F6C18; -extern FbDemoStruct sTrnsnUnk; -extern u16* D_801F6D0C; -extern s32 gTrnsnUnkState; +extern TransitionTile sTransitionTile; +extern s32 gTransitionTileState; extern VisMono sVisMono; extern Color_RGBA8_u32 gVisMonoColor; extern Struct_80140E80 D_801F6D38; @@ -2491,11 +2437,7 @@ extern Struct_80140E80* D_801F6D4C; extern BombersNotebook sBombersNotebook; extern u8 sBombersNotebookOpen; extern u8 sMotionBlurStatus; -extern SlowlyTask D_801F6E00; -extern s32 D_801F6FC0; -extern StackEntry slowlyStackEntry; -extern u8 slowlyStack[0x1000]; -extern UNK_TYPE1 D_801F7FE8; + extern UNK_TYPE1 D_801F7FF0; extern struct_801F8010 D_801F8010; extern struct_801F8020 D_801F8020; @@ -2506,24 +2448,12 @@ extern FaultClient sGraphFaultClient; extern GfxMasterList* gGfxMasterDL; extern CfbInfo sGraphCfbInfos[3]; extern OSTime sGraphTaskStartTime; -extern OSMesgQueue sSiIntMsgQ; -extern OSMesg sSiIntMsgBuf[1]; + extern u32 gSegments[NUM_SEGMENTS]; extern SchedContext gSchedContext; -extern IrqMgrClient irqClient; -extern OSMesgQueue irqMgrMsgQ; -extern OSMesg irqMgrMsgBuf[60]; -extern OSThread sGraphThread; -extern u8 sGraphStack[6144]; -extern u8 schedStack[1536]; -extern u8 audioStack[2048]; -extern u8 padmgrStack[1280]; -extern StackEntry sGraphStackInfo; -extern StackEntry schedStackEntry; -extern StackEntry audioStackEntry; -extern StackEntry padmgrStackEntry; -extern AudioMgr audioContext; -extern PadMgr D_801FB620; +extern OSThread gGraphThread; +extern PadMgr gPadMgr; + extern FaultClient sSchedFaultClient; extern OSTime sRSPGFXStartTime; extern OSTime sRSPAudioStartTime; @@ -2639,15 +2569,7 @@ extern Vec3f D_801FBDA4; extern Vec3f D_801FBDE8; extern MtxF* sMatrixStack; extern MtxF* sCurrentMatrix; -// extern UNK_TYPE1 D_801FBE10; -// extern UNK_TYPE1 D_801FBE28; -// extern UNK_TYPE1 D_801FBE2C; -// extern UNK_TYPE4 D_801FBE30; -extern u8 sys_flashromStack[0x1000]; -extern StackEntry sys_flashromStackEntry; -extern OSThread sys_flashromOSThread; -extern s80185D40 D_801FD008; -extern OSMesg D_801FD034; + extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD140; // extern UNK_TYPE1 D_801FD158; @@ -2742,55 +2664,20 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD5E8; // extern UNK_TYPE1 D_801FD608; // extern UNK_TYPE1 D_801FD610; -// extern UNK_TYPE1 sSfxPlayerBank; -// extern UNK_TYPE1 sSfxItemBank; -// extern UNK_TYPE1 sSfxEnvironmentBank; -// extern UNK_TYPE1 sSfxEnemyBank; -// extern UNK_TYPE1 sSfxSystemBank; -// extern UNK_TYPE1 sSfxOcarinaBank; -// extern UNK_TYPE1 sSfxVoiceBank; -// extern SfxRequest sSfxRequests[0x100]; -// extern UNK_TYPE1 sSfxBankListEnd; -// extern UNK_TYPE1 sSfxBankFreeListStart; -// extern UNK_TYPE1 sSfxBankUnused; extern ActiveSfx gActiveSfx[7][3]; -// extern UNK_TYPE1 sCurSfxPlayerChannelIndex; -// extern UNK_TYPE1 gSfxBankMuted; -// extern UNK_TYPE1 sUnusedBankLerp; -// extern UNK_TYPE1 D_801FFD00; -// extern UNK_TYPE1 D_801FFD34; -// extern UNK_TYPE1 D_801FFD40; -// extern UNK_TYPE1 D_80200000; -// extern UNK_TYPE1 D_80200002; -// extern UNK_TYPE1 D_80200004; -// extern UNK_TYPE1 D_80200008; -// extern UNK_TYPE1 D_8020001E; -// extern UNK_TYPE1 D_802000C9; -// extern UNK_TYPE1 D_802000D4; +extern SeqRequest sSeqRequests[][5]; +extern u8 sNumSeqRequests[5]; +extern u32 sAudioSeqCmds[0xB0]; extern ActiveSequence gActiveSeqs[]; -// extern UNK_TYPE1 D_8020034A; -// extern UNK_TYPE1 D_80200B88; -// extern UNK_TYPE1 D_80200BBA; -// extern UNK_TYPE1 D_80200BCC; -// extern UNK_TYPE1 D_80200BCE; -// extern UNK_TYPE1 D_80200BD0; +extern u8 sResetAudioHeapTimer; +extern u16 sResetAudioHeapFadeReverbVolume; +extern u16 sResetAudioHeapFadeReverbVolumeStep; extern AudioContext gAudioCtx; // at 0x80200C70 extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; extern AudioCustomSeqFunction gAudioCustomSeqFunction; extern AudioCustomReverbFunction gAudioCustomReverbFunction; extern AudioCustomSynthFunction gAudioCustomSynthFunction; -// post-code buffers -extern u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; -extern u8 gGfxSPTaskStack[0x400]; -extern GfxPool gGfxPools[2]; -extern u8 gAudioHeap[0x138000]; -extern u8 gSystemHeap[UNK_SIZE]; - -extern u8 gPictoPhotoI8[PICTO_PHOTO_SIZE]; -extern u8 D_80784600[0x56200]; -extern u16 gFramebuffer0[SCREEN_HEIGHT][SCREEN_WIDTH]; - // other segments extern GfxMasterList D_0E000000; extern Mtx D_01000000; diff --git a/include/z64.h b/include/z64.h index 1a6fcd1d3..b91333288 100644 --- a/include/z64.h +++ b/include/z64.h @@ -20,11 +20,14 @@ #include "color.h" #include "ichain.h" #include "sequence.h" +#include "seqcmd.h" #include "sfx.h" #include "message_data_static.h" #include "gfxprint.h" #include "sys_matrix.h" +#include "tha.h" +#include "thga.h" #include "z64actor.h" #include "z64animation.h" #include "z64audio.h" @@ -34,7 +37,10 @@ #include "z64curve.h" #include "z64cutscene.h" #include "z64dma.h" +#include "z64eff_footmark.h" #include "z64effect.h" +#include "z64frameadvance.h" +#include "z64game_over.h" #include "z64interface.h" #include "z64item.h" #include "z64light.h" @@ -48,6 +54,7 @@ #include "z64scene.h" #include "z64schedule.h" #include "z64skin.h" +#include "z64skybox.h" #include "z64subs.h" #include "z64transition.h" #include "z64view.h" @@ -112,80 +119,6 @@ typedef struct { /* 0x8 */ void* end; } PolygonType2; // size = 0xC -typedef struct { - /* 0x0 */ s16 x; - /* 0x2 */ s16 y; - /* 0x4 */ s16 z; - /* 0x6 */ s16 reserved; - /* 0x8 */ s16 s; - /* 0xA */ s16 t; - /* 0xC */ s8 r; - /* 0xD */ s8 g; - /* 0xE */ s8 b; - /* 0xF */ s8 a; -} F3DVertexColor; // size = 0x10 - -typedef struct { - /* 0x0 */ s16 x; - /* 0x2 */ s16 y; - /* 0x4 */ s16 z; - /* 0x6 */ s16 reserved; - /* 0x8 */ s16 s; - /* 0xA */ s16 t; - /* 0xC */ s8 normalX; - /* 0xD */ s8 normalY; - /* 0xE */ s8 normalZ; - /* 0xF */ s8 a; -} F3DVertexNormal; // size = 0x10 - -typedef struct { - /* 0x0 */ f32 size; - /* 0x4 */ f32 dynamicSizeStep; - /* 0x8 */ u8 state; - /* 0x9 */ u8 sizeGrowsCos2; - /* 0xA */ u8 colorsIndex; - /* 0xB */ u8 flags; - /* 0xC */ u8 lightParamsIndex; -} FireObjInitParams; // size = 0x10 - -typedef struct FireObjColors { - /* 0x0 */ Color_RGBA8 primColor; - /* 0x4 */ u8 lod; - /* 0x5 */ Color_RGB8 envColor; -} FireObjColors; // size = 0x8 - -typedef struct FireObjLightParams { - /* 0x0 */ s16 radius; - /* 0x2 */ Color_RGB8 color; - /* 0x5 */ Color_RGB8 maxColorAdj; -} FireObjLightParams; // size = 0x8 - -// Game Info aka. Static Context -// Data normally accessed through REG macros (see regs.h) -typedef struct { - /* 0x00 */ u8 unk_00; // regPage;? // 1 is first page - /* 0x01 */ u8 unk_01; // regGroup;? // "register" group (R, RS, RO, RP etc.) - /* 0x02 */ u8 unk_02; // regCur;? // selected register within page - /* 0x03 */ u8 unk_03; // dpadLast;? - /* 0x04 */ u32 unk_04; // repeat;? - /* 0x08 */ UNK_TYPE1 pad_08[0xC]; - /* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 entries -} GameInfo; // size = 0x15D4 - -typedef struct { - /* 0x0 */ u32 size; - /* 0x4 */ void* bufp; - /* 0x8 */ void* head; - /* 0xC */ void* tail; -} TwoHeadArena; // size = 0x10 - -typedef struct { - /* 0x0 */ u32 size; - /* 0x4 */ Gfx* bufp; - /* 0x8 */ Gfx* p; - /* 0xC */ Gfx* d; -} TwoHeadGfxArena; // size = 0x10 - typedef struct { /* 0x000 */ Gfx taskStart[9]; /* 0x048 */ Gfx clearZBuffer[8]; // original name: clear_zb_dl @@ -276,27 +209,6 @@ typedef struct { /* 0x10 */ OSTime resetTime; } NmiBuff; // size >= 0x18 -typedef void(*osCreateThread_func)(void*); - -typedef enum { - SLOWLY_CALLBACK_NO_ARGS, - SLOWLY_CALLBACK_ONE_ARG, - SLOWLY_CALLBACK_TWO_ARGS -} SlowlyCallbackArgCount; - -typedef struct { - /* 0x000 */ OSThread thread; - /* 0x1B0 */ u8 callbackArgCount; - /* 0x1B1 */ u8 status; - /* 0x1B4 */ union { - void (*callback0)(void); - void (*callback1)(void*); - void (*callback2)(void*, void*); - }; - /* 0x1B8 */ void* callbackArg0; - /* 0x1BC */ void* callbackArg1; -} SlowlyTask; // size = 0x1C0 - typedef struct { /* 0x00 */ int unk0; /* 0x04 */ void* unk4; @@ -306,41 +218,6 @@ typedef struct { /* 0x14 */ OSMesgQueue unk14; } s80185D40; // size = 0x2C -typedef struct { - /* 0x00 */ u32 unk0; - /* 0x04 */ u8 unk4; - /* 0x05 */ u8 unk5; - /* 0x06 */ u8 unk6; - /* 0x07 */ UNK_TYPE1 pad7[0x2]; - /* 0x09 */ u8 unk9; - /* 0x0A */ UNK_TYPE1 padA[0x2]; - /* 0x0C */ u32 unkC; - /* 0x10 */ u16 unk10; - /* 0x12 */ u16 unk12; - /* 0x14 */ u16 unk14; - /* 0x16 */ UNK_TYPE1 pad16[0x2]; - /* 0x18 */ u32 unk18; - /* 0x1C */ u32 unk1C; - /* 0x20 */ u32 unk20; - /* 0x24 */ u32 unk24; - /* 0x28 */ u32 unk28; - /* 0x2C */ u32 unk2C; - /* 0x30 */ u32 unk30; - /* 0x34 */ u32 unk34; -} s8018CFAC; // size = 0x38 - -typedef struct { - /* 0x00 */ Vec3f unk0; - /* 0x0C */ Vec3f unkC; - /* 0x18 */ s16 unk18; - /* 0x1A */ s16 unk1A; -} s80874650; // size = 0x1C - -typedef union { - F3DVertexColor color; - F3DVertexNormal normal; -} F3DVertex; // size = 0x10 - // End of RDRAM without the Expansion Pak installed #define NORMAL_RDRAM_END 0x80400000 // End of RDRAM with the Expansion Pak installed @@ -542,36 +419,6 @@ typedef struct { /* 0xFA */ u8 unk_FA[4]; } EnvironmentContext; // size = 0x100 -typedef struct { - /* 0x000 */ View view; - /* 0x168 */ void* staticSegments[4]; - /* 0x178 */ void* paletteStaticSegment; - /* 0x17C */ Gfx (*dListBuf)[150]; - /* 0x180 */ Gfx* roomDL; - /* 0x184 */ Vtx* roomVtx; - /* 0x188 */ DmaRequest unk188; - /* 0x1A8 */ DmaRequest unk1A8; - /* 0x1C8 */ DmaRequest unk1C8; - /* 0x1E8 */ OSMesgQueue loadQueue; - /* 0x200 */ OSMesg loadMsg; - /* 0x204 */ s16 skyboxShouldDraw; - /* 0x208 */ f32 rotX; - /* 0x20C */ f32 rotY; - /* 0x210 */ f32 rotZ; - /* 0x214 */ Vec3f eye; - /* 0x220 */ s16 angle; - /* 0x222 */ u8 primR; - /* 0x223 */ u8 primG; - /* 0x224 */ u8 primB; - /* 0x225 */ u8 envR; - /* 0x226 */ u8 envG; - /* 0x227 */ u8 envB; -} SkyboxContext; // size = 0x228 - -typedef enum { - /* 0x05 */ SKYBOX_CUTSCENE_MAP = 5 -} SkyboxId; - typedef struct ListAlloc { /* 0x0 */ struct ListAlloc* prev; /* 0x4 */ struct ListAlloc* next; @@ -698,13 +545,7 @@ typedef struct GameState { /* 0xA3 */ u8 unk_A3; } GameState; // size = 0xA4 -typedef struct { - /* 0x00 */ u32 resetting; - /* 0x04 */ u32 resetCount; - /* 0x08 */ OSTime duration; - /* 0x10 */ OSTime resetTime; -} PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused) - +struct PlayState; typedef s32 (*ColChkResetFunc)(struct PlayState*, Collider*); typedef void (*ColChkBloodFunc)(struct PlayState*, Collider*, Vec3f*); @@ -712,8 +553,6 @@ typedef void (*ColChkApplyFunc)(struct PlayState*, CollisionCheckContext*, Colli typedef void (*ColChkVsFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Collider*); typedef s32 (*ColChkLineFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); -typedef void(*room_draw_func)(struct PlayState* play, Room* room, u32 flags); - typedef struct { /* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc. /* 0x001 */ UNK_TYPE1 pad1[0x13]; @@ -753,12 +592,6 @@ typedef enum { STACK_STATUS_OVERFLOW = 2 } StackStatus; -typedef struct FireObjLight { - /* 0x00 */ LightNode* light; - /* 0x04 */ LightInfo lightInfo; - /* 0x12 */ u8 lightParamsIndex; -} FireObjLight; // size = 0x14 - #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 #define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c @@ -779,68 +612,11 @@ typedef struct { /* 0x130 */ OSThread thread; } AudioMgr; // size = 0x2E0 -typedef struct { - /* 0x00 */ MtxF displayMatrix; - /* 0x40 */ Actor* actor; - /* 0x44 */ Vec3f location; - /* 0x50 */ u8 flags; // bit 0 - footmark fades out - /* 0x51 */ u8 id; - /* 0x52 */ u8 red; - /* 0x53 */ u8 blue; - /* 0x54 */ u8 green; - /* 0x55 */ UNK_TYPE1 pad55[0x1]; - /* 0x56 */ u16 alpha; - /* 0x58 */ u16 alphaChange; - /* 0x5A */ u16 size; - /* 0x5C */ u16 fadeoutDelay; - /* 0x5E */ u16 age; -} EffFootmark; // size = 0x60 - -typedef struct FireObj { - /* 0x00 */ Vec3f position; - /* 0x0C */ f32 size; - /* 0x10 */ f32 sizeInv; - /* 0x14 */ f32 xScale; - /* 0x18 */ f32 yScale; - /* 0x1C */ f32 dynamicSize; - /* 0x20 */ f32 dynamicSizeStep; - /* 0x24 */ u8 state; // 0 - growing, 1 - shrinking, 2 - fully lit, 3 - not lit - /* 0x25 */ u8 sizeGrowsCos2; - /* 0x26 */ u8 unk26; - /* 0x27 */ u8 colorsIndex; - /* 0x28 */ u8 flags; // bit 0 - ?, bit 1 - ? - /* 0x29 */ UNK_TYPE1 pad29[0x1]; - /* 0x2A */ s16 ignitionDelay; - /* 0x2C */ ColliderCylinder collision; - /* 0x78 */ FireObjLight light; -} FireObj; // size = 0x8B - typedef struct { /* 0x0 */ u8 seqId; /* 0x1 */ u8 ambienceId; } SequenceContext; // size = 0x2 -typedef struct { - /* 0x0 */ s32 enabled; - /* 0x4 */ s32 timer; -} FrameAdvanceContext; // size = 0x8 - -typedef enum { - /* 0 */ GAMEOVER_INACTIVE, - /* 1 */ GAMEOVER_DEATH_START, - /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground - /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out - /* 20 */ GAMEOVER_REVIVE_START = 20, - /* 21 */ GAMEOVER_REVIVE_RUMBLE, - /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground - /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body - /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up -} GameOverState; - -typedef struct { - /* 0x0 */ u16 state; -} GameOverContext; // size = 0x2 - typedef struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneId; @@ -906,7 +682,7 @@ typedef struct PlayState { /* 0x18868 */ void* naviQuestHints; // leftover from OoT, system which processes this is removed /* 0x1886C */ AnimatedMaterial* sceneMaterialAnims; /* 0x18870 */ void* specialEffects; - /* 0x18874 */ u8 skyboxId; + /* 0x18874 */ u8 skyboxId; // @see SkyboxId enum /* 0x18875 */ s8 transitionTrigger; // "fade_direction" /* 0x18876 */ s16 worldCoverAlpha; /* 0x18878 */ s16 bgCoverAlpha; @@ -930,7 +706,7 @@ typedef struct PlayState { /* 0x18E5C */ TexturePtr pictoPhotoI8; /* 0x18E60 */ void* unk_18E60; /* 0x18E64 */ void* unk_18E64; - /* 0x18E68 */ void* unk_18E68; + /* 0x18E68 */ void* unk_18E68; // framebuffer related to Lens of Truth /* 0x18E6C */ char unk_18E6C[0x3EC]; } PlayState; // size = 0x19258 @@ -961,11 +737,6 @@ typedef enum { /* 3 */ PICTO_PHOTO_STATE_READY } PictoPhotoState; -// OoT's TransitionUnk -typedef struct { - /* 0x00 */ char unk_00[0xDC]; -} FbDemoStruct; // size = 0xDC - typedef struct { /* 0x00 */ u8 mode; /* 0x04 */ f32 scale; @@ -974,27 +745,6 @@ typedef struct { /* 0x10 */ Color_RGBA8_u32 envColor; } Struct_80140E80; // size = 0x14 -typedef struct { - /* 0x00 */ s32 unk0; - /* 0x04 */ s32 unk4; - /* 0x08 */ s32 unk8; - /* 0x0C */ s32 unkC; - /* 0x10 */ s32 unk10; -} struct_801C5F44; // size = 0x14 - -// From OoT's struct_80034A14_arg1 -typedef struct { - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ Vec3s unk_08; - /* 0x0E */ Vec3s unk_0E; - /* 0x14 */ f32 unk_14; - /* 0x18 */ Vec3f unk_18; // Usually setted to Player's position or Player's focus - /* 0x24 */ s16 unk_24; -} struct_800BD888_arg1; // size = 0x28 - typedef struct { /* 0x0 */ u32 type; /* 0x4 */ u32 setScissor; @@ -1018,21 +768,6 @@ typedef struct { /* 0x14 */ Gfx* dList; } VisMono; // size = 0x18 -typedef struct DebugDispObject { - /* 0x00 */ Vec3f pos; - /* 0x0C */ Vec3s rot; - /* 0x14 */ Vec3f scale; - /* 0x20 */ Color_RGBA8 color; - /* 0x24 */ s16 type; - /* 0x28 */ struct DebugDispObject* next; - /* 0x2C */ s32 pad; //Padding not in the OOT version -} DebugDispObject; // size = 0x30 - -typedef struct { - /* 0x0 */ f32 rangeSq; - /* 0x4 */ f32 leashScale; -} TargetRangeParams; // size = 0x8 - typedef struct { /* 0x0 */ u8* value; /* 0x4 */ const char* name; diff --git a/include/z64actor.h b/include/z64actor.h index 370b49e75..86ea6e22c 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -22,6 +22,8 @@ struct EnBox; struct EnTorch2; typedef void(*ActorFunc)(struct Actor* this, struct PlayState* play); +typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*); +typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*); typedef struct { /* 0x00 */ Vec3f pos; @@ -99,13 +101,13 @@ typedef struct { /* 0x1C */ ActorFunc draw; } ActorInit; // size = 0x20 -typedef enum { - ALLOCTYPE_NORMAL, - ALLOCTYPE_ABSOLUTE, - ALLOCTYPE_PERMANENT +typedef enum AllocType { + /* 0 */ ALLOCTYPE_NORMAL, + /* 1 */ ALLOCTYPE_ABSOLUTE, + /* 2 */ ALLOCTYPE_PERMANENT } AllocType; -typedef struct { +typedef struct ActorOverlay { /* 0x00 */ uintptr_t vromStart; /* 0x04 */ uintptr_t vromEnd; /* 0x08 */ void* vramStart; @@ -132,6 +134,20 @@ typedef struct { /* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa } ActorShape; // size = 0x30 +#define BGCHECKFLAG_GROUND (1 << 0) // Standing on the ground +#define BGCHECKFLAG_GROUND_TOUCH (1 << 1) // Has touched the ground (only active for 1 frame) +#define BGCHECKFLAG_GROUND_LEAVE (1 << 2) // Has left the ground (only active for 1 frame) +#define BGCHECKFLAG_WALL (1 << 3) // Touching a wall +#define BGCHECKFLAG_CEILING (1 << 4) // Touching a ceiling +#define BGCHECKFLAG_WATER (1 << 5) // In water +#define BGCHECKFLAG_WATER_TOUCH (1 << 6) // Has touched water (reset when leaving water) +#define BGCHECKFLAG_GROUND_STRICT (1 << 7) // Similar to BGCHECKFLAG_GROUND but with no velocity check and is cleared every frame +#define BGCHECKFLAG_CRUSHED (1 << 8) // Crushed between a floor and ceiling (triggers a void for player) +#define BGCHECKFLAG_PLAYER_WALL_INTERACT (1 << 9) // Only set/used by player, related to interacting with walls +#define BGCHECKFLAG_PLAYER_400 (1 << 10) // +#define BGCHECKFLAG_PLAYER_800 (1 << 11) // +#define BGCHECKFLAG_PLAYER_1000 (1 << 12) // + typedef struct Actor { /* 0x000 */ s16 id; // Actor ID /* 0x002 */ u8 category; // Actor category. Refer to the corresponding enum for values @@ -141,7 +157,7 @@ typedef struct Actor { /* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data" /* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank" /* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on - /* 0x020 */ s16 unk20; + /* 0x020 */ s16 halfDaysBits; // Bitmask indicating which half-days this actor is allowed to not be killed(?) (TODO: not sure how to word this). If the current halfDayBit is not part of this mask then the actor is killed when spawning the setup actors /* 0x024 */ PosRot world; // Position/rotation in the world /* 0x038 */ s8 cutscene; /* 0x039 */ u8 audioFlags; // Another set of flags? Seems related to sfx or bgm @@ -150,7 +166,7 @@ typedef struct Actor { /* 0x054 */ f32 targetArrowOffset; // Height offset of the target arrow relative to `focus` position /* 0x058 */ Vec3f scale; // Scale of the actor in each axis /* 0x064 */ Vec3f velocity; // Velocity of the actor in each axis - /* 0x070 */ f32 speedXZ; // How fast the actor is traveling along the XZ plane + /* 0x070 */ f32 speed; // Context dependent speed value. Can be used for XZ or XYZ depending on which move function is used /* 0x074 */ f32 gravity; // Acceleration due to gravity. Value is added to Y velocity every frame /* 0x078 */ f32 terminalVelocity; // Sets the lower bounds cap on velocity along the Y axis /* 0x07C */ struct CollisionPoly* wallPoly; // Wall polygon the actor is touching @@ -160,7 +176,7 @@ typedef struct Actor { /* 0x086 */ s16 wallYaw; // Y rotation of the wall polygon the actor is touching /* 0x088 */ f32 floorHeight; // Y position of the floor polygon directly below the actor /* 0x08C */ f32 depthInWater; // Directed distance to the surface of active waterbox. Negative value means water is below. - /* 0x090 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags + /* 0x090 */ u16 bgCheckFlags; // Flags indicating how the actor is interacting with collision /* 0x092 */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player /* 0x094 */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis /* 0x098 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane @@ -198,27 +214,12 @@ typedef enum { /* 1 */ FOOT_RIGHT } ActorFootIndex; -/** - * BgCheckFlags WIP documentation (logical masks): - * 0x001 : Standing on the ground - * 0x002 : Has touched the ground (only active for 1 frame) - * 0x004 : Has left the ground (only active for 1 frame) - * 0x008 : Touching a wall - * 0x010 : Touching a ceiling - * 0x020 : On or below water surface - * 0x040 : Has touched water (actor is responsible for unsetting this the frame it touches the water) - * 0x080 : Similar to & 0x1 but with no velocity check and is cleared every frame - * 0x100 : Crushed between a floor and ceiling (triggers a void for player) - * 0x200 : Only set/used by player, related to interacting with walls - */ - typedef struct { /* 0x000 */ Actor actor; /* 0x144 */ s32 bgId; /* 0x148 */ f32 pushForce; /* 0x14C */ f32 unk14C; /* 0x150 */ s16 yRotation; - /* 0x152 */ u16 unk152; /* 0x154 */ u32 flags; /* 0x158 */ u8 stateFlags; /* 0x15A */ s16 pad15A; @@ -365,6 +366,13 @@ typedef struct { /* 0xE */ s16 intensity; } TitleCardContext; // size = 0x10 +typedef struct ActorContext_unk_1F4 { + /* 0x00 */ u8 unk_00; + /* 0x01 */ u8 timer; + /* 0x04 */ f32 unk_04; + /* 0x08 */ Vec3f unk_08; +} ActorContext_unk_1F4; // size = 0x14 + typedef struct ActorContext_unk_20C { /* 0x0 */ s16 id; /* 0x2 */ s8 isDynamicallyInitialised; @@ -385,9 +393,31 @@ typedef struct ActorListEntry { /* 0x8 */ s32 unk_08; } ActorListEntry; // size = 0xC +typedef enum { + /* 0 */ LENS_MODE_HIDE_ACTORS, // lens actors are visible by default, and hidden by using lens (for example, fake walls) + /* 1 */ LENS_MODE_SHOW_ACTORS // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) +} LensMode; + +#define LENS_ACTOR_MAX 32 + // Target size when activated #define LENS_MASK_ACTIVE_SIZE 100 +#define HALFDAYBIT_DAY0_DAWN (1 << 9) +#define HALFDAYBIT_DAY0_NIGHT (1 << 8) +#define HALFDAYBIT_DAY1_DAWN (1 << 7) +#define HALFDAYBIT_DAY1_NIGHT (1 << 6) +#define HALFDAYBIT_DAY2_DAWN (1 << 5) +#define HALFDAYBIT_DAY2_NIGHT (1 << 4) +#define HALFDAYBIT_DAY3_DAWN (1 << 3) +#define HALFDAYBIT_DAY3_NIGHT (1 << 2) +#define HALFDAYBIT_DAY4_DAWN (1 << 1) +#define HALFDAYBIT_DAY4_NIGHT (1 << 0) + +#define HALFDAYBIT_DAWNS (HALFDAYBIT_DAY0_DAWN | HALFDAYBIT_DAY1_DAWN | HALFDAYBIT_DAY2_DAWN | HALFDAYBIT_DAY3_DAWN | HALFDAYBIT_DAY4_DAWN) +#define HALFDAYBIT_NIGHTS (HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY1_NIGHT | HALFDAYBIT_DAY2_NIGHT | HALFDAYBIT_DAY3_NIGHT | HALFDAYBIT_DAY4_NIGHT) +#define HALFDAYBIT_ALL (HALFDAYBIT_DAWNS | HALFDAYBIT_NIGHTS) + typedef struct ActorContext { /* 0x000 */ u8 freezeFlashTimer; /* 0x001 */ UNK_TYPE1 pad1; @@ -397,19 +427,15 @@ typedef struct ActorContext { /* 0x005 */ u8 flags; /* 0x006 */ UNK_TYPE1 pad6[0x5]; /* 0x00B */ s8 lensActorsDrawn; - /* 0x00C */ s16 unkC; + /* 0x00C */ s16 halfDaysBit; // A single bit indicating the current half-day. It is one of HALFDAYBIT_DAYX_ macro values /* 0x00E */ u8 totalLoadedActors; - /* 0x00F */ u8 undrawnActorCount; + /* 0x00F */ u8 numLensActors; /* 0x010 */ ActorListEntry actorLists[ACTORCAT_MAX]; - /* 0x0A0 */ Actor* undrawnActors[32]; // Records the first 32 actors drawn each frame + /* 0x0A0 */ Actor* lensActors[LENS_ACTOR_MAX]; // Draws up to LENS_ACTOR_MAX number of invisible actors /* 0x120 */ TargetContext targetContext; /* 0x1B8 */ ActorContextSceneFlags sceneFlags; /* 0x1E4 */ TitleCardContext titleCtxt; - /* 0x1F4 */ u8 unk1F4; - /* 0x1F5 */ u8 unk1F5; - /* 0x1F6 */ UNK_TYPE1 pad1F6[0x2]; - /* 0x1F8 */ f32 unk1F8; - /* 0x1FC */ Vec3f unk1FC; + /* 0x1F4 */ ActorContext_unk_1F4 unk_1F4; /* 0x208 */ UNK_TYPE1 unk_208[0x4]; /* 0x20C */ ActorContext_unk_20C unk_20C[8]; /* 0x24C */ UNK_TYPE1 unk_24C[0x4]; @@ -467,10 +493,10 @@ typedef enum { #define ACTOR_FLAG_20 (1 << 5) // #define ACTOR_FLAG_40 (1 << 6) -// Invisible -#define ACTOR_FLAG_80 (1 << 7) -// Related to talk -#define ACTOR_FLAG_100 (1 << 8) +// hidden or revealed by Lens of Truth (depending on room lensMode) +#define ACTOR_FLAG_REACT_TO_LENS (1 << 7) +// Player has requested to talk to the actor; Player uses this flag differently than every other actor +#define ACTOR_FLAG_TALK_REQUESTED (1 << 8) // #define ACTOR_FLAG_200 (1 << 9) // @@ -507,8 +533,8 @@ typedef enum { #define ACTOR_FLAG_2000000 (1 << 25) // #define ACTOR_FLAG_4000000 (1 << 26) -// -#define ACTOR_FLAG_8000000 (1 << 27) +// Prevents locking on with Z targeting an actor even if Tatl is floating over it +#define ACTOR_FLAG_CANT_LOCK_ON (1 << 27) // #define ACTOR_FLAG_10000000 (1 << 28) // @@ -518,6 +544,25 @@ typedef enum { // #define ACTOR_FLAG_80000000 (1 << 31) +#define DROPFLAG_NONE (0) +#define DROPFLAG_1 (1 << 0) +#define DROPFLAG_2 (1 << 1) +#define DROPFLAG_20 (1 << 5) + +#define COLORFILTER_GET_COLORFLAG(colorFilterParams) ((colorFilterParams) & 0xC000) +#define COLORFILTER_GET_COLORINTENSITY(colorFilterParams) (((colorFilterParams) & 0x1F00) >> 5) +#define COLORFILTER_GET_DURATION(colorFilterParams) ((colorFilterParams) & 0xFF) + +#define COLORFILTER_COLORFLAG_NONE 0xC000 +#define COLORFILTER_COLORFLAG_GRAY 0x8000 +#define COLORFILTER_COLORFLAG_RED 0x4000 +#define COLORFILTER_COLORFLAG_BLUE 0x0000 + +#define COLORFILTER_INTENSITY_FLAG 0x8000 + +#define COLORFILTER_BUFFLAG_XLU 0x2000 +#define COLORFILTER_BUFFLAG_OPA 0x0000 + typedef enum { /* 0x00 */ CLEAR_TAG_SMALL_EXPLOSION, /* 0x01 */ CLEAR_TAG_LARGE_EXPLOSION, @@ -633,4 +678,41 @@ typedef enum { /* 0xFF */ TATL_HINT_ID_NONE = 0xFF } TatlHintId; +typedef struct TargetRangeParams { + /* 0x0 */ f32 rangeSq; + /* 0x4 */ f32 leashScale; +} TargetRangeParams; // size = 0x8 + +typedef enum NpcTalkState { + /* 0 */ NPC_TALK_STATE_IDLE, // NPC not currently talking to player + /* 1 */ NPC_TALK_STATE_TALKING, // NPC is currently talking to player + /* 2 */ NPC_TALK_STATE_ACTION, // An NPC-defined action triggered in the conversation + /* 3 */ NPC_TALK_STATE_ITEM_GIVEN // NPC finished giving an item and text box is done +} NpcTalkState; + +typedef enum NpcTrackingMode { + /* 0 */ NPC_TRACKING_PLAYER_AUTO_TURN, // Determine tracking mode based on player position, see Npc_UpdateAutoTurn + /* 1 */ NPC_TRACKING_NONE, // Don't track the target (usually the player) + /* 2 */ NPC_TRACKING_HEAD_AND_TORSO, // Track target by turning the head and the torso + /* 3 */ NPC_TRACKING_HEAD, // Track target by turning the head + /* 4 */ NPC_TRACKING_FULL_BODY // Track target by turning the body, torso and head +} NpcTrackingMode; + +typedef struct NpcInteractInfo { + /* 0x00 */ s16 talkState; + /* 0x02 */ s16 trackingMode; + /* 0x04 */ s16 autoTurnTimer; + /* 0x06 */ s16 autoTurnState; + /* 0x08 */ Vec3s headRot; + /* 0x0E */ Vec3s torsoRot; + /* 0x14 */ f32 yOffset; // Y position offset to add to actor position when calculating angle to target + /* 0x18 */ Vec3f trackPos; + /* 0x24 */ UNK_TYPE1 unk_24[0x4]; +} NpcInteractInfo; // size = 0x28 + +extern TargetRangeParams gTargetRanges[]; +extern s16 D_801AED48[8]; +extern Gfx D_801AEF88[]; +extern Gfx D_801AEFA0[]; + #endif diff --git a/include/z64animation.h b/include/z64animation.h index 272a4fb84..0e8eb9fcb 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -1,5 +1,5 @@ -#ifndef Z64_ANIMATION_H -#define Z64_ANIMATION_H +#ifndef Z64ANIMATION_H +#define Z64ANIMATION_H #include "PR/ultratypes.h" #include "PR/gbi.h" diff --git a/include/z64audio.h b/include/z64audio.h index bfb66a23a..a37760566 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -1,5 +1,5 @@ -#ifndef Z64_AUDIO_H -#define Z64_AUDIO_H +#ifndef Z64AUDIO_H +#define Z64AUDIO_H #include "audiothread_cmd.h" @@ -11,6 +11,12 @@ #define SEQ_NUM_CHANNELS 16 #define SEQ_IO_VAL_NONE -1 +typedef enum { + /* 0 */ AUDIO_HEAP_RESET_STATE_NONE, + /* 1 */ AUDIO_HEAP_RESET_STATE_RESETTING, + /* 2 */ AUDIO_HEAP_RESET_STATE_RESETTING_ALT // Never set to +} AudioHeapResetState; + typedef enum { /* 0x00 */ AUDIO_CUSTOM_FUNCTION_SEQ_0, /* 0x01 */ AUDIO_CUSTOM_FUNCTION_SEQ_1, @@ -1090,50 +1096,50 @@ typedef struct { } AudioHeapInitSizes; // size = 0xC typedef struct { - /* 0x00 */ f32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_10; - /* 0x10 */ f32 unk_14; - /* 0x14 */ f32 unk_18; - /* 0x18 */ u16 unk_0C; - /* 0x1A */ u16 unk_1C; -} unk_50_s; // size = 0x1C + /* 0x00 */ f32 volCur; + /* 0x04 */ f32 volTarget; + /* 0x08 */ f32 volStep; + /* 0x0C */ f32 freqScaleCur; + /* 0x10 */ f32 freqScaleTarget; + /* 0x14 */ f32 freqScaleStep; + /* 0x18 */ u16 volTimer; + /* 0x1A */ u16 freqScaleTimer; +} ActiveSequenceChannelData; // size = 0x1C typedef struct { - /* 0x000 */ unk_50_s unk_50[0x10]; + /* 0x000 */ ActiveSequenceChannelData channelData[SEQ_NUM_CHANNELS]; /* 0x1C0 */ f32 volCur; /* 0x1C4 */ f32 volTarget; - /* 0x1C8 */ f32 unk_08; - /* 0x1CC */ u32 unk_14; - /* 0x1D0 */ f32 unk_1C; - /* 0x1D4 */ f32 unk_20; - /* 0x1D8 */ f32 unk_24; - /* 0x1DC */ u32 unk_2C[8]; - /* 0x1FC */ u32 unk_25C; - /* 0x200 */ u16 unk_0C; - /* 0x202 */ u16 unk_18; - /* 0x204 */ u16 unk_28; - /* 0x206 */ u16 unk_250; - /* 0x208 */ u16 unk_252; + /* 0x1C8 */ f32 volStep; + /* 0x1CC */ u32 tempoCmd; + /* 0x1D0 */ f32 tempoCur; + /* 0x1D4 */ f32 tempoTarget; + /* 0x1D8 */ f32 tempoStep; + /* 0x1DC */ u32 setupCmd[8]; // setup commands + /* 0x1FC */ u32 startAsyncSeqCmd; // temporarily stores the seqCmd used in SEQCMD_PLAY_SEQUENCE, to be called again once the font is reloaded in + /* 0x200 */ u16 volTimer; + /* 0x202 */ u16 tempoOriginal; + /* 0x204 */ u16 tempoTimer; + /* 0x206 */ u16 freqScaleChannelFlags; + /* 0x208 */ u16 volChannelFlags; /* 0x20A */ u16 seqId; - /* 0x20C */ u16 unk_256; - /* 0x20E */ u16 unk_258; - /* 0x210 */ u8 unk_260; - /* 0x211 */ u8 unk_261[0x1]; - /* 0x212 */ u8 volScales[0x4]; + /* 0x20C */ u16 prevSeqId; // last seqId played on a player + /* 0x20E */ u16 channelPortMask; + /* 0x210 */ u8 isWaitingForFonts; + /* 0x211 */ u8 fontId; + /* 0x212 */ u8 volScales[VOL_SCALE_INDEX_MAX]; /* 0x216 */ u8 volFadeTimer; /* 0x217 */ u8 fadeVolUpdate; - /* 0x218 */ u8 unk_4C; - /* 0x219 */ u8 unk_4D; - /* 0x21A */ u8 unk_4E; - /* 0x21B */ u8 unk_21B; + /* 0x218 */ u8 setupCmdTimer; + /* 0x219 */ u8 setupCmdNum; // number of setup commands + /* 0x21A */ u8 setupFadeTimer; + /* 0x21B */ u8 isSeqPlayerInit; } ActiveSequence; // size = 0x21C typedef struct { - /* 0x0 */ u8 unk_0; - /* 0x1 */ u8 unk_1; // importance? -} Struct_8016E320; // size = 0x02 + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 priority; +} SeqRequest; // size = 0x02 typedef enum { /* 0 */ BANK_PLAYER, diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index ad5d4c4fb..ad56599b5 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -1,5 +1,5 @@ -#ifndef Z64_BGCHECK_H -#define Z64_BGCHECK_H +#ifndef Z64BGCHECK_H +#define Z64BGCHECK_H struct PlayState; struct Actor; @@ -96,7 +96,10 @@ typedef struct { /* 0x00 */ Vec3s pos; /* 0x06 */ Vec3s rot; /* 0x0C */ s16 fov; - /* 0x0E */ s16 unk_0E; + /* 0x0E */ union { + s16 roomImageOverrideBgCamIndex; + s16 unk_0E; + }; /* 0x10 */ s16 unk_10; } BgCamFuncData; // size = 0x12 diff --git a/include/z64collision_check.h b/include/z64collision_check.h index 836fd3555..e5032584c 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -1,5 +1,5 @@ -#ifndef _Z_COLLISION_CHECK_H_ -#define _Z_COLLISION_CHECK_H_ +#ifndef Z64COLLISION_CHECK_H +#define Z64COLLISION_CHECK_H #include "PR/ultratypes.h" #include "z64math.h" diff --git a/include/z64curve.h b/include/z64curve.h index f4923e3bf..77174be5e 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -1,5 +1,5 @@ -#ifndef Z64_CURVE_H -#define Z64_CURVE_H +#ifndef Z64CURVE_H +#define Z64CURVE_H #include "PR/ultratypes.h" #include "z64math.h" diff --git a/include/z64debug_display.h b/include/z64debug_display.h new file mode 100644 index 000000000..885a3839c --- /dev/null +++ b/include/z64debug_display.h @@ -0,0 +1,25 @@ +#ifndef Z64DEBUG_DISPLAY_H +#define Z64DEBUG_DISPLAY_H + +#include "color.h" +#include "ultra64.h" +#include "z64math.h" + +struct GraphicsContext; +struct PlayState; + +typedef struct DebugDispObject { + /* 0x00 */ Vec3f pos; + /* 0x0C */ Vec3s rot; + /* 0x14 */ Vec3f scale; + /* 0x20 */ Color_RGBA8 color; + /* 0x24 */ s16 type; + /* 0x28 */ struct DebugDispObject* next; + /* 0x2C */ s32 pad; // Padding is not in the OoT version +} DebugDispObject; // size = 0x30 + +DebugDispObject* DebugDisplay_Init(void); +void DebugDisplay_DrawObjects(struct PlayState* play); +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, struct GraphicsContext* gfxCtx); + +#endif diff --git a/include/z64debug_text.h b/include/z64debug_text.h new file mode 100644 index 000000000..65595f99e --- /dev/null +++ b/include/z64debug_text.h @@ -0,0 +1,36 @@ +#ifndef Z64DEBUG_TEXT_H +#define Z64DEBUG_TEXT_H + +#include "ultra64.h" + +struct GraphicsContext; + +typedef enum { + /* 0 */ DEBUG_TEXT_BLACK, + /* 1 */ DEBUG_TEXT_BLUE, + /* 2 */ DEBUG_TEXT_RED, + /* 3 */ DEBUG_TEXT_PURPLE, + /* 4 */ DEBUG_TEXT_GREEN, + /* 5 */ DEBUG_TEXT_CYAN, + /* 6 */ DEBUG_TEXT_YELLOW, + /* 7 */ DEBUG_TEXT_WHITE +} DebugTextColor; + +typedef enum { + /* 0 */ DEBUG_CAM_TEXT_YELLOW, + /* 1 */ DEBUG_CAM_TEXT_PEACH, + /* 2 */ DEBUG_CAM_TEXT_BROWN, + /* 3 */ DEBUG_CAM_TEXT_ORANGE, + /* 4 */ DEBUG_CAM_TEXT_GOLD, + /* 5 */ DEBUG_CAM_TEXT_WHITE, + /* 6 */ DEBUG_CAM_TEXT_BLUE, + /* 7 */ DEBUG_CAM_TEXT_GREEN +} DebugCamTextColor; + +void Debug_ClearTextDrawFlags(void); +void Debug_ScreenText(s32 index, s32 colorIndex, const char* text); +void DebugCamera_ScreenText(u8 x, u8 y, u8 colorIndex, const char* text); +void Debug_DrawText(struct GraphicsContext* gfxCtx); + + +#endif diff --git a/include/z64dma.h b/include/z64dma.h index 92c0227f3..964be9c59 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -1,5 +1,5 @@ -#ifndef _Z64_DMA_H_ -#define _Z64_DMA_H_ +#ifndef Z64DMA_H +#define Z64DMA_H #include "ultra64.h" diff --git a/include/z64eff_footmark.h b/include/z64eff_footmark.h new file mode 100644 index 000000000..6d5fe3026 --- /dev/null +++ b/include/z64eff_footmark.h @@ -0,0 +1,33 @@ +#ifndef Z64EFF_FOOTMARK_H +#define Z64EFF_FOOTMARK_H + +#include "ultra64.h" +#include "z64math.h" + +struct PlayState; +struct Actor; + +typedef struct EffFootmark { + /* 0x00 */ MtxF mf; + /* 0x40 */ struct Actor* actor; + /* 0x44 */ Vec3f pos; + /* 0x50 */ u8 flags; // bit 0 - footmark fades out + /* 0x51 */ u8 id; + /* 0x52 */ u8 red; + /* 0x53 */ u8 blue; + /* 0x54 */ u8 green; + /* 0x56 */ u16 alpha; + /* 0x58 */ u16 alphaChange; + /* 0x5A */ u16 size; + /* 0x5C */ u16 fadeOutDelay; + /* 0x5E */ u16 age; +} EffFootmark; // size = 0x60 + +#define FOOTMARK_FLAG_1 (1 << 0) + +void EffFootmark_Init(struct PlayState* play); +void EffFootmark_Add(struct PlayState* play, MtxF* mf, struct Actor* actor, u8 id, Vec3f* pos, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeOutDelay); +void EffFootmark_Update(struct PlayState* play); +void EffFootmark_Draw(struct PlayState* play); + +#endif diff --git a/include/z64effect.h b/include/z64effect.h index 727bf04d2..d6ab8b3b5 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -1,7 +1,8 @@ -#ifndef _Z64EFFECT_H_ -#define _Z64EFFECT_H_ +#ifndef Z64EFFECT_H +#define Z64EFFECT_H #include "PR/ultratypes.h" +#include "libc/stdint.h" #include "color.h" #include "z64light.h" #include "z64math.h" @@ -9,6 +10,8 @@ struct GraphicsContext; struct PlayState; +struct Actor; +struct CollisionPoly; #define SPARK_COUNT 3 #define BLURE_COUNT 25 @@ -181,7 +184,7 @@ typedef struct { /* 0x08 */ Vec3s p2; /* 0x0E */ s16 life; /* 0x10 */ UNK_TYPE1 pad10[0x4]; - /* 0x14 */ CollisionPoly* colPoly; + /* 0x14 */ struct CollisionPoly* colPoly; } EffectTireMarkElement; // size = 0x18 typedef struct { @@ -265,7 +268,7 @@ typedef struct EffectSs { /* 0x28 */ EffectSsDrawFunc draw; /* 0x2C */ Vec3f vec; /* 0x38 */ void* gfx; - /* 0x3C */ Actor* actor; + /* 0x3C */ struct Actor* actor; /* 0x40 */ s16 regs[13]; // These are particle-specific /* 0x5A */ u16 flags; // bit 0: set if this entry is not considered free on a priority tie bit 1: ? bit 2: ? /* 0x5C */ s16 life; // -1 means this entry is free @@ -279,47 +282,15 @@ typedef struct { /* 0x8 */ s32 size; } EffectSsInfo; // size = 0xC -typedef enum { - /* 0x00 */ EFFECT_SS_DUST, - /* 0x01 */ EFFECT_SS_KIRAKIRA, - /* 0x02 */ EFFECT_SS_UNSET_02, // Deleted - /* 0x03 */ EFFECT_SS_BOMB2, - /* 0x04 */ EFFECT_SS_BLAST, - /* 0x05 */ EFFECT_SS_G_SPK, - /* 0x06 */ EFFECT_SS_D_FIRE, - /* 0x07 */ EFFECT_SS_BUBBLE, - /* 0x08 */ EFFECT_SS_UNSET_08, // Deleted - /* 0x09 */ EFFECT_SS_G_RIPPLE, - /* 0x0A */ EFFECT_SS_G_SPLASH, - /* 0x0B */ EFFECT_SS_UNSET_0B, - /* 0x0C */ EFFECT_SS_G_FIRE, - /* 0x0D */ EFFECT_SS_LIGHTNING, - /* 0x0E */ EFFECT_SS_DT_BUBBLE, - /* 0x0F */ EFFECT_SS_HAHEN, - /* 0x10 */ EFFECT_SS_STICK, - /* 0x11 */ EFFECT_SS_SIBUKI, - /* 0x12 */ EFFECT_SS_UNSET_12, // Deleted - /* 0x13 */ EFFECT_SS_UNSET_13, // Deleted - /* 0x14 */ EFFECT_SS_STONE1, - /* 0x15 */ EFFECT_SS_HITMARK, - /* 0x16 */ EFFECT_SS_FHG_FLASH, - /* 0x17 */ EFFECT_SS_K_FIRE, - /* 0x18 */ EFFECT_SS_SOLDER_SRCH_BALL, - /* 0x19 */ EFFECT_SS_KAKERA, - /* 0x1A */ EFFECT_SS_ICE_PIECE, - /* 0x1B */ EFFECT_SS_EN_ICE, - /* 0x1C */ EFFECT_SS_FIRE_TAIL, - /* 0x1D */ EFFECT_SS_EN_FIRE, - /* 0x1E */ EFFECT_SS_EXTRA, - /* 0x1F */ EFFECT_SS_UNSET_1F, // Deleted - /* 0x20 */ EFFECT_SS_DEAD_DB, - /* 0x21 */ EFFECT_SS_DEAD_DD, - /* 0x22 */ EFFECT_SS_DEAD_DS, - /* 0x23 */ EFFECT_SS_UNSET_23, // Deleted - /* 0x24 */ EFFECT_SS_ICE_SMOKE, - /* 0x25 */ EFFECT_EN_ICE_BLOCK, - /* 0x26 */ EFFECT_SS_SBN, +#define DEFINE_EFFECT_SS(_name, enumValue) enumValue, +#define DEFINE_EFFECT_SS_UNSET(enumValue) enumValue, + +typedef enum EffectSsType { + #include "tables/effect_ss_table.h" /* 0x27 */ EFFECT_SS_MAX } EffectSsType; +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET + #endif diff --git a/include/z64frameadvance.h b/include/z64frameadvance.h new file mode 100644 index 000000000..c0feaed59 --- /dev/null +++ b/include/z64frameadvance.h @@ -0,0 +1,16 @@ +#ifndef Z64FRAMEADVANCE_H +#define Z64FRAMEADVANCE_H + +#include "ultra64.h" +#include "io/controller.h" + +typedef struct FrameAdvanceContext { + /* 0x0 */ s32 enabled; + /* 0x4 */ s32 timer; +} FrameAdvanceContext; // size = 0x8 + + +void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); +s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); + +#endif diff --git a/include/z64game_over.h b/include/z64game_over.h new file mode 100644 index 000000000..240efdf41 --- /dev/null +++ b/include/z64game_over.h @@ -0,0 +1,30 @@ +#ifndef Z64GAME_OVER_H +#define Z64GAME_OVER_H + +#include "ultra64.h" + +struct PlayState; + + +typedef enum GameOverState { + /* 0 */ GAMEOVER_INACTIVE, + /* 1 */ GAMEOVER_DEATH_START, + /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground + /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out + /* 20 */ GAMEOVER_REVIVE_START = 20, + /* 21 */ GAMEOVER_REVIVE_RUMBLE, + /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground + /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body + /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up +} GameOverState; + +typedef struct GameOverContext { + /* 0x0 */ u16 state; +} GameOverContext; // size = 0x2 + + +void GameOver_Init(struct PlayState* play); +void GameOver_FadeLights(struct PlayState* play); +void GameOver_Update(struct PlayState* play); + +#endif diff --git a/include/z64interface.h b/include/z64interface.h index 385f80835..e01baa425 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -134,7 +134,7 @@ typedef struct { /* 0x218 */ f32 aButtonRoll; /* 0x21C */ s16 unk_21C; /* 0x21E */ s16 bButtonDoAction; - /* 0x220 */ s16 unk_220; + /* 0x220 */ s16 tatlCalling; /* 0x222 */ s16 unk_222; /* 0x224 */ s16 unk_224; /* 0x226 */ s16 lifeColorChange; diff --git a/include/z64jpeg.h b/include/z64jpeg.h index 38183bfa9..60797af98 100644 --- a/include/z64jpeg.h +++ b/include/z64jpeg.h @@ -1,5 +1,5 @@ -#ifndef Z64_JPEG_H -#define Z64_JPEG_H +#ifndef Z64JPEG_H +#define Z64JPEG_H #include "PR/ultratypes.h" #include "ultra64/message.h" diff --git a/include/z64light.h b/include/z64light.h index 8eaebca61..706df2f4d 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -4,6 +4,10 @@ #include "ultra64.h" #include "PR/gbi.h" #include "color.h" +#include "z64math.h" + +struct PlayState; + typedef struct { /* 0x00 */ u8 ambientColor[3]; diff --git a/include/z64math.h b/include/z64math.h index 70a115966..62b6432e8 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -104,11 +104,13 @@ typedef struct { #define LERPWEIGHT(val, prev, next) (((val) - (prev)) / ((next) - (prev))) #define F32_LERPWEIGHT(val, prev, next) (((f32)(val) - (f32)(prev)) / ((f32)(next) - (f32)(prev))) -#define VEC3F_LERPIMPDST(dst, v0, v1, t){ \ - (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ - (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ - (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ -} +#define VEC3F_LERPIMPDST(dst, v0, v1, t) \ + { \ + (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ + (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ + (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ + } \ + (void)0 #define IS_ZERO(f) (fabsf(f) < 0.008f) diff --git a/include/z64message.h b/include/z64message.h index 7d4723e7b..2b0387045 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -34,7 +34,7 @@ typedef enum TextState { #define FONT_CHAR_TEX_WIDTH 16 #define FONT_CHAR_TEX_HEIGHT 16 -//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` +//! TODO: Make this use `sizeof(AnyFontTextureSymbol)` #define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture // TODO: should Font be in its own header or is it fine to have it here? @@ -67,7 +67,7 @@ typedef struct MessageContext { /* 0x00168 */ Font font; /* 0x11EF8 */ UNK_PTR unk11EF8; /* 0x11EFC */ UNK_TYPE1 unk11EFC[0x4]; - /* 0x11F00 */ struct OcarinaStaff* unk11F00; + /* 0x11F00 */ struct OcarinaStaff* ocarinaStaff; /* 0x11F04 */ u16 currentTextId; /* 0x11F06 */ UNK_TYPE1 unk11F06[0x2]; /* 0x11F08 */ u16 unk11F08; diff --git a/include/z64object.h b/include/z64object.h index e800e9138..712826815 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -8,651 +8,17 @@ #define OBJECT_EXCHANGE_BANK_MAX 35 -typedef enum { - /* 0x000 */ OBJECT_UNSET_0, - /* 0x001 */ GAMEPLAY_KEEP, - /* 0x002 */ GAMEPLAY_FIELD_KEEP, - /* 0x003 */ GAMEPLAY_DANGEON_KEEP, - /* 0x004 */ OBJECT_NB, - /* 0x005 */ OBJECT_OKUTA, - /* 0x006 */ OBJECT_CROW, - /* 0x007 */ OBJECT_AH, - /* 0x008 */ OBJECT_DY_OBJ, - /* 0x009 */ OBJECT_WALLMASTER, - /* 0x00A */ OBJECT_DODONGO, - /* 0x00B */ OBJECT_FIREFLY, - /* 0x00C */ OBJECT_BOX, - /* 0x00D */ OBJECT_AL, - /* 0x00E */ OBJECT_BUBBLE, - /* 0x00F */ OBJECT_NIW, - /* 0x010 */ OBJECT_LINK_BOY, - /* 0x011 */ OBJECT_LINK_CHILD, - /* 0x012 */ OBJECT_TITE, - /* 0x013 */ OBJECT_TAB, - /* 0x014 */ OBJECT_PH, - /* 0x015 */ OBJECT_AND, - /* 0x016 */ OBJECT_MSMO, - /* 0x017 */ OBJECT_DINOFOS, - /* 0x018 */ OBJECT_DRS, - /* 0x019 */ OBJECT_ZL1, - /* 0x01A */ OBJECT_AN4, - /* 0x01B */ OBJECT_UNSET_1B, - /* 0x01C */ OBJECT_TEST3, - /* 0x01D */ OBJECT_FAMOS, - /* 0x01E */ OBJECT_UNSET_1E, - /* 0x01F */ OBJECT_UNSET_1F, - /* 0x020 */ OBJECT_ST, - /* 0x021 */ OBJECT_UNSET_21, - /* 0x022 */ OBJECT_THIEFBIRD, - /* 0x023 */ OBJECT_UNSET_23, - /* 0x024 */ OBJECT_UNSET_24, - /* 0x025 */ OBJECT_UNSET_25, - /* 0x026 */ OBJECT_UNSET_26, - /* 0x027 */ OBJECT_UNSET_27, - /* 0x028 */ OBJECT_UNSET_28, - /* 0x029 */ OBJECT_UNSET_29, - /* 0x02A */ OBJECT_BOMBF, - /* 0x02B */ OBJECT_UNSET_2B, - /* 0x02C */ OBJECT_UNSET_2C, - /* 0x02D */ OBJECT_UNSET_2D, - /* 0x02E */ OBJECT_UNSET_2E, - /* 0x02F */ OBJECT_UNSET_2F, - /* 0x030 */ OBJECT_AM, - /* 0x031 */ OBJECT_DEKUBABA, - /* 0x032 */ OBJECT_UNSET_32, - /* 0x033 */ OBJECT_UNSET_33, - /* 0x034 */ OBJECT_UNSET_34, - /* 0x035 */ OBJECT_UNSET_35, - /* 0x036 */ OBJECT_UNSET_36, - /* 0x037 */ OBJECT_UNSET_37, - /* 0x038 */ OBJECT_UNSET_38, - /* 0x039 */ OBJECT_UNSET_39, - /* 0x03A */ OBJECT_UNSET_3A, - /* 0x03B */ OBJECT_UNSET_3B, - /* 0x03C */ OBJECT_UNSET_3C, - /* 0x03D */ OBJECT_UNSET_3D, - /* 0x03E */ OBJECT_WARP1, - /* 0x03F */ OBJECT_B_HEART, - /* 0x040 */ OBJECT_DEKUNUTS, - /* 0x041 */ OBJECT_UNSET_41, - /* 0x042 */ OBJECT_UNSET_42, - /* 0x043 */ OBJECT_UNSET_43, - /* 0x044 */ OBJECT_UNSET_44, - /* 0x045 */ OBJECT_UNSET_45, - /* 0x046 */ OBJECT_UNSET_46, - /* 0x047 */ OBJECT_UNSET_47, - /* 0x048 */ OBJECT_UNSET_48, - /* 0x049 */ OBJECT_UNSET_49, - /* 0x04A */ OBJECT_UNSET_4A, - /* 0x04B */ OBJECT_UNSET_4B, - /* 0x04C */ OBJECT_UNSET_4C, - /* 0x04D */ OBJECT_UNSET_4D, - /* 0x04E */ OBJECT_UNSET_4E, - /* 0x04F */ OBJECT_UNSET_4F, - /* 0x050 */ OBJECT_UNSET_50, - /* 0x051 */ OBJECT_BB, - /* 0x052 */ OBJECT_DEATH, - /* 0x053 */ OBJECT_UNSET_53, - /* 0x054 */ OBJECT_UNSET_54, - /* 0x055 */ OBJECT_UNSET_55, - /* 0x056 */ OBJECT_UNSET_56, - /* 0x057 */ OBJECT_UNSET_57, - /* 0x058 */ OBJECT_UNSET_58, - /* 0x059 */ OBJECT_UNSET_59, - /* 0x05A */ OBJECT_UNSET_5A, - /* 0x05B */ OBJECT_UNSET_5B, - /* 0x05C */ OBJECT_F40_OBJ, - /* 0x05D */ OBJECT_PO_COMPOSER, - /* 0x05E */ OBJECT_UNSET_5E, - /* 0x05F */ OBJECT_HATA, - /* 0x060 */ OBJECT_UNSET_60, - /* 0x061 */ OBJECT_WOOD02, - /* 0x062 */ OBJECT_UNSET_62, - /* 0x063 */ OBJECT_UNSET_63, - /* 0x064 */ OBJECT_TRAP, - /* 0x065 */ OBJECT_UNSET_65, - /* 0x066 */ OBJECT_UNSET_66, - /* 0x067 */ OBJECT_UNSET_67, - /* 0x068 */ OBJECT_UNSET_68, - /* 0x069 */ OBJECT_UNSET_69, - /* 0x06A */ OBJECT_VM, - /* 0x06B */ OBJECT_UNSET_6B, - /* 0x06C */ OBJECT_UNSET_6C, - /* 0x06D */ OBJECT_UNSET_6D, - /* 0x06E */ OBJECT_UNSET_6E, - /* 0x06F */ OBJECT_UNSET_6F, - /* 0x070 */ OBJECT_EFC_STAR_FIELD, - /* 0x071 */ OBJECT_UNSET_71, - /* 0x072 */ OBJECT_UNSET_72, - /* 0x073 */ OBJECT_UNSET_73, - /* 0x074 */ OBJECT_UNSET_74, - /* 0x075 */ OBJECT_RD, - /* 0x076 */ OBJECT_YUKIMURA_OBJ, - /* 0x077 */ OBJECT_HEAVY_OBJECT, - /* 0x078 */ OBJECT_UNSET_78, - /* 0x079 */ OBJECT_UNSET_79, - /* 0x07A */ OBJECT_UNSET_7A, - /* 0x07B */ OBJECT_UNSET_7B, - /* 0x07C */ OBJECT_UNSET_7C, - /* 0x07D */ OBJECT_HORSE_LINK_CHILD, - /* 0x07E */ OBJECT_UNSET_7E, - /* 0x07F */ OBJECT_UNSET_7F, - /* 0x080 */ OBJECT_SYOKUDAI, - /* 0x081 */ OBJECT_UNSET_81, - /* 0x082 */ OBJECT_UNSET_82, - /* 0x083 */ OBJECT_UNSET_83, - /* 0x084 */ OBJECT_EFC_TW, - /* 0x085 */ OBJECT_UNSET_85, - /* 0x086 */ OBJECT_GI_KEY, - /* 0x087 */ OBJECT_MIR_RAY, - /* 0x088 */ OBJECT_CTOWER_ROT, - /* 0x089 */ OBJECT_UNSET_89, - /* 0x08A */ OBJECT_BDOOR, - /* 0x08B */ OBJECT_UNSET_8B, - /* 0x08C */ OBJECT_UNSET_8C, - /* 0x08D */ OBJECT_UNSET_8D, - /* 0x08E */ OBJECT_SB, - /* 0x08F */ OBJECT_GI_MELODY, - /* 0x090 */ OBJECT_GI_HEART, - /* 0x091 */ OBJECT_GI_COMPASS, - /* 0x092 */ OBJECT_GI_BOSSKEY, - /* 0x093 */ OBJECT_UNSET_93, - /* 0x094 */ OBJECT_GI_NUTS, - /* 0x095 */ OBJECT_UNSET_95, - /* 0x096 */ OBJECT_GI_HEARTS, - /* 0x097 */ OBJECT_GI_ARROWCASE, - /* 0x098 */ OBJECT_GI_BOMBPOUCH, - /* 0x099 */ OBJECT_IN, - /* 0x09A */ OBJECT_UNSET_9A, - /* 0x09B */ OBJECT_UNSET_9B, - /* 0x09C */ OBJECT_UNSET_9C, - /* 0x09D */ OBJECT_OS_ANIME, - /* 0x09E */ OBJECT_GI_BOTTLE, - /* 0x09F */ OBJECT_GI_STICK, - /* 0x0A0 */ OBJECT_GI_MAP, - /* 0x0A1 */ OBJECT_OF1D_MAP, - /* 0x0A2 */ OBJECT_RU2, - /* 0x0A3 */ OBJECT_UNSET_A3, - /* 0x0A4 */ OBJECT_GI_MAGICPOT, - /* 0x0A5 */ OBJECT_GI_BOMB_1, - /* 0x0A6 */ OBJECT_UNSET_A6, - /* 0x0A7 */ OBJECT_MA2, - /* 0x0A8 */ OBJECT_GI_PURSE, - /* 0x0A9 */ OBJECT_UNSET_A9, - /* 0x0AA */ OBJECT_UNSET_AA, - /* 0x0AB */ OBJECT_RR, - /* 0x0AC */ OBJECT_UNSET_AC, - /* 0x0AD */ OBJECT_UNSET_AD, - /* 0x0AE */ OBJECT_UNSET_AE, - /* 0x0AF */ OBJECT_GI_ARROW, - /* 0x0B0 */ OBJECT_GI_BOMB_2, - /* 0x0B1 */ OBJECT_UNSET_B1, - /* 0x0B2 */ OBJECT_UNSET_B2, - /* 0x0B3 */ OBJECT_GI_SHIELD_2, - /* 0x0B4 */ OBJECT_GI_HOOKSHOT, - /* 0x0B5 */ OBJECT_GI_OCARINA, - /* 0x0B6 */ OBJECT_GI_MILK, - /* 0x0B7 */ OBJECT_MA1, - /* 0x0B8 */ OBJECT_UNSET_B8, - /* 0x0B9 */ OBJECT_UNSET_B9, - /* 0x0BA */ OBJECT_UNSET_BA, - /* 0x0BB */ OBJECT_NY, - /* 0x0BC */ OBJECT_FR, - /* 0x0BD */ OBJECT_UNSET_BD, - /* 0x0BE */ OBJECT_UNSET_BE, - /* 0x0BF */ OBJECT_GI_BOW, - /* 0x0C0 */ OBJECT_GI_GLASSES, - /* 0x0C1 */ OBJECT_GI_LIQUID, - /* 0x0C2 */ OBJECT_ANI, - /* 0x0C3 */ OBJECT_GI_SHIELD_3, - /* 0x0C4 */ OBJECT_UNSET_C4, - /* 0x0C5 */ OBJECT_UNSET_C5, - /* 0x0C6 */ OBJECT_GI_BEAN, - /* 0x0C7 */ OBJECT_GI_FISH, - /* 0x0C8 */ OBJECT_UNSET_C8, - /* 0x0C9 */ OBJECT_UNSET_C9, - /* 0x0CA */ OBJECT_UNSET_CA, - /* 0x0CB */ OBJECT_GI_LONGSWORD, - /* 0x0CC */ OBJECT_UNSET_CC, - /* 0x0CD */ OBJECT_UNSET_CD, - /* 0x0CE */ OBJECT_UNSET_CE, - /* 0x0CF */ OBJECT_UNSET_CF, - /* 0x0D0 */ OBJECT_ZO, - /* 0x0D1 */ OBJECT_UNSET_D1, - /* 0x0D2 */ OBJECT_UMAJUMP, - /* 0x0D3 */ OBJECT_UNSET_D3, - /* 0x0D4 */ OBJECT_UNSET_D4, - /* 0x0D5 */ OBJECT_MASTERGOLON, - /* 0x0D6 */ OBJECT_MASTERZOORA, - /* 0x0D7 */ OBJECT_AOB, - /* 0x0D8 */ OBJECT_IK, - /* 0x0D9 */ OBJECT_AHG, - /* 0x0DA */ OBJECT_CNE, - /* 0x0DB */ OBJECT_UNSET_DB, - /* 0x0DC */ OBJECT_UNSET_DC, - /* 0x0DD */ OBJECT_AN3, - /* 0x0DE */ OBJECT_BJI, - /* 0x0DF */ OBJECT_BBA, - /* 0x0E0 */ OBJECT_AN2, - /* 0x0E1 */ OBJECT_UNSET_E1, - /* 0x0E2 */ OBJECT_AN1, - /* 0x0E3 */ OBJECT_BOJ, - /* 0x0E4 */ OBJECT_FZ, - /* 0x0E5 */ OBJECT_BOB, - /* 0x0E6 */ OBJECT_GE1, - /* 0x0E7 */ OBJECT_YABUSAME_POINT, - /* 0x0E8 */ OBJECT_UNSET_E8, - /* 0x0E9 */ OBJECT_UNSET_E9, - /* 0x0EA */ OBJECT_UNSET_EA, - /* 0x0EB */ OBJECT_UNSET_EB, - /* 0x0EC */ OBJECT_D_HSBLOCK, - /* 0x0ED */ OBJECT_D_LIFT, - /* 0x0EE */ OBJECT_MAMENOKI, - /* 0x0EF */ OBJECT_GOROIWA, - /* 0x0F0 */ OBJECT_TORYO, - /* 0x0F1 */ OBJECT_DAIKU, - /* 0x0F2 */ OBJECT_NWC, - /* 0x0F3 */ OBJECT_GM, - /* 0x0F4 */ OBJECT_MS, - /* 0x0F5 */ OBJECT_HS, - /* 0x0F6 */ OBJECT_UNSET_F6, - /* 0x0F7 */ OBJECT_LIGHTSWITCH, - /* 0x0F8 */ OBJECT_KUSA, - /* 0x0F9 */ OBJECT_TSUBO, - /* 0x0FA */ OBJECT_UNSET_FA, - /* 0x0FB */ OBJECT_UNSET_FB, - /* 0x0FC */ OBJECT_KANBAN, - /* 0x0FD */ OBJECT_OWL, - /* 0x0FE */ OBJECT_MK, - /* 0x0FF */ OBJECT_FU, - /* 0x100 */ OBJECT_GI_KI_TAN_MASK, - /* 0x101 */ OBJECT_UNSET_101, - /* 0x102 */ OBJECT_GI_MASK18, - /* 0x103 */ OBJECT_GI_RABIT_MASK, - /* 0x104 */ OBJECT_GI_TRUTH_MASK, - /* 0x105 */ OBJECT_UNSET_105, - /* 0x106 */ OBJECT_STREAM, - /* 0x107 */ OBJECT_MM, - /* 0x108 */ OBJECT_UNSET_108, - /* 0x109 */ OBJECT_UNSET_109, - /* 0x10A */ OBJECT_UNSET_10A, - /* 0x10B */ OBJECT_UNSET_10B, - /* 0x10C */ OBJECT_UNSET_10C, - /* 0x10D */ OBJECT_UNSET_10D, - /* 0x10E */ OBJECT_UNSET_10E, - /* 0x10F */ OBJECT_JS, - /* 0x110 */ OBJECT_CS, - /* 0x111 */ OBJECT_UNSET_111, - /* 0x112 */ OBJECT_UNSET_112, - /* 0x113 */ OBJECT_GI_SOLDOUT, - /* 0x114 */ OBJECT_UNSET_114, - /* 0x115 */ OBJECT_MAG, - /* 0x116 */ OBJECT_UNSET_116, - /* 0x117 */ OBJECT_UNSET_117, - /* 0x118 */ OBJECT_UNSET_118, - /* 0x119 */ OBJECT_GI_GOLONMASK, - /* 0x11A */ OBJECT_GI_ZORAMASK, - /* 0x11B */ OBJECT_UNSET_11B, - /* 0x11C */ OBJECT_UNSET_11C, - /* 0x11D */ OBJECT_KA, - /* 0x11E */ OBJECT_UNSET_11E, - /* 0x11F */ OBJECT_ZG, - /* 0x120 */ OBJECT_UNSET_120, - /* 0x121 */ OBJECT_GI_M_ARROW, - /* 0x122 */ OBJECT_DS2, - /* 0x123 */ OBJECT_UNSET_123, - /* 0x124 */ OBJECT_FISH, - /* 0x125 */ OBJECT_GI_SUTARU, - /* 0x126 */ OBJECT_UNSET_126, - /* 0x127 */ OBJECT_SSH, - /* 0x128 */ OBJECT_BIGSLIME, - /* 0x129 */ OBJECT_BG, - /* 0x12A */ OBJECT_BOMBIWA, - /* 0x12B */ OBJECT_HINTNUTS, - /* 0x12C */ OBJECT_RS, - /* 0x12D */ OBJECT_UNSET_12D, - /* 0x12E */ OBJECT_GLA, - /* 0x12F */ OBJECT_UNSET_12F, - /* 0x130 */ OBJECT_GELDB, - /* 0x131 */ OBJECT_UNSET_131, - /* 0x132 */ OBJECT_DOG, - /* 0x133 */ OBJECT_KIBAKO2, - /* 0x134 */ OBJECT_DNS, - /* 0x135 */ OBJECT_DNK, - /* 0x136 */ OBJECT_UNSET_136, - /* 0x137 */ OBJECT_GI_INSECT, - /* 0x138 */ OBJECT_UNSET_138, - /* 0x139 */ OBJECT_GI_GHOST, - /* 0x13A */ OBJECT_GI_SOUL, - /* 0x13B */ OBJECT_UNSET_13B, - /* 0x13C */ OBJECT_UNSET_13C, - /* 0x13D */ OBJECT_UNSET_13D, - /* 0x13E */ OBJECT_UNSET_13E, - /* 0x13F */ OBJECT_GI_RUPY, - /* 0x140 */ OBJECT_MU, - /* 0x141 */ OBJECT_WF, - /* 0x142 */ OBJECT_SKB, - /* 0x143 */ OBJECT_GS, - /* 0x144 */ OBJECT_PS, - /* 0x145 */ OBJECT_OMOYA_OBJ, - /* 0x146 */ OBJECT_COW, - /* 0x147 */ OBJECT_UNSET_147, - /* 0x148 */ OBJECT_GI_SWORD_1, - /* 0x149 */ OBJECT_UNSET_149, - /* 0x14A */ OBJECT_UNSET_14A, - /* 0x14B */ OBJECT_ZL4, - /* 0x14C */ OBJECT_LINK_GORON, - /* 0x14D */ OBJECT_LINK_ZORA, - /* 0x14E */ OBJECT_GRASSHOPPER, - /* 0x14F */ OBJECT_BOYO, - /* 0x150 */ OBJECT_UNSET_150, - /* 0x151 */ OBJECT_UNSET_151, - /* 0x152 */ OBJECT_UNSET_152, - /* 0x153 */ OBJECT_FWALL, - /* 0x154 */ OBJECT_LINK_NUTS, - /* 0x155 */ OBJECT_JSO, - /* 0x156 */ OBJECT_KNIGHT, - /* 0x157 */ OBJECT_ICICLE, - /* 0x158 */ OBJECT_SPDWEB, - /* 0x159 */ OBJECT_UNSET_159, - /* 0x15A */ OBJECT_BOSS01, - /* 0x15B */ OBJECT_BOSS02, - /* 0x15C */ OBJECT_BOSS03, - /* 0x15D */ OBJECT_BOSS04, - /* 0x15E */ OBJECT_BOSS05, - /* 0x15F */ OBJECT_BOSS06, - /* 0x160 */ OBJECT_BOSS07, - /* 0x161 */ OBJECT_RAF, - /* 0x162 */ OBJECT_FUNEN, - /* 0x163 */ OBJECT_RAILLIFT, - /* 0x164 */ OBJECT_NUMA_OBJ, - /* 0x165 */ OBJECT_FLOWERPOT, - /* 0x166 */ OBJECT_SPINYROLL, - /* 0x167 */ OBJECT_ICE_BLOCK, - /* 0x168 */ OBJECT_UNSET_168, - /* 0x169 */ OBJECT_KEIKOKU_DEMO, - /* 0x16A */ OBJECT_SLIME, - /* 0x16B */ OBJECT_PR, - /* 0x16C */ OBJECT_F52_OBJ, - /* 0x16D */ OBJECT_F53_OBJ, - /* 0x16E */ OBJECT_UNSET_16E, - /* 0x16F */ OBJECT_KIBAKO, - /* 0x170 */ OBJECT_SEK, - /* 0x171 */ OBJECT_GMO, - /* 0x172 */ OBJECT_BAT, - /* 0x173 */ OBJECT_SEKIHIL, - /* 0x174 */ OBJECT_SEKIHIG, - /* 0x175 */ OBJECT_SEKIHIN, - /* 0x176 */ OBJECT_SEKIHIZ, - /* 0x177 */ OBJECT_UNSET_177, - /* 0x178 */ OBJECT_WIZ, - /* 0x179 */ OBJECT_LADDER, - /* 0x17A */ OBJECT_MKK, - /* 0x17B */ OBJECT_UNSET_17B, - /* 0x17C */ OBJECT_UNSET_17C, - /* 0x17D */ OBJECT_UNSET_17D, - /* 0x17E */ OBJECT_KEIKOKU_OBJ, - /* 0x17F */ OBJECT_SICHITAI_OBJ, - /* 0x180 */ OBJECT_DEKUCITY_ANA_OBJ, - /* 0x181 */ OBJECT_RAT, - /* 0x182 */ OBJECT_WATER_EFFECT, - /* 0x183 */ OBJECT_UNSET_183, - /* 0x184 */ OBJECT_DBLUE_OBJECT, - /* 0x185 */ OBJECT_BAL, - /* 0x186 */ OBJECT_WARP_UZU, - /* 0x187 */ OBJECT_DRIFTICE, - /* 0x188 */ OBJECT_FALL, - /* 0x189 */ OBJECT_HANAREYAMA_OBJ, - /* 0x18A */ OBJECT_CRACE_OBJECT, - /* 0x18B */ OBJECT_DNO, - /* 0x18C */ OBJECT_OBJ_TOKEIDAI, - /* 0x18D */ OBJECT_EG, - /* 0x18E */ OBJECT_TRU, - /* 0x18F */ OBJECT_TRT, - /* 0x190 */ OBJECT_HAKUGIN_OBJ, - /* 0x191 */ OBJECT_HORSE_GAME_CHECK, - /* 0x192 */ OBJECT_STK, - /* 0x193 */ OBJECT_UNSET_193, - /* 0x194 */ OBJECT_UNSET_194, - /* 0x195 */ OBJECT_MNK, - /* 0x196 */ OBJECT_GI_BOTTLE_RED, - /* 0x197 */ OBJECT_TOKEI_TOBIRA, - /* 0x198 */ OBJECT_AZ, - /* 0x199 */ OBJECT_TWIG, - /* 0x19A */ OBJECT_DEKUCITY_OBJ, - /* 0x19B */ OBJECT_PO_FUSEN, - /* 0x19C */ OBJECT_RACETSUBO, - /* 0x19D */ OBJECT_HA, - /* 0x19E */ OBJECT_BIGOKUTA, - /* 0x19F */ OBJECT_OPEN_OBJ, - /* 0x1A0 */ OBJECT_FU_KAITEN, - /* 0x1A1 */ OBJECT_FU_MATO, - /* 0x1A2 */ OBJECT_MTORIDE, - /* 0x1A3 */ OBJECT_OSN, - /* 0x1A4 */ OBJECT_TOKEI_STEP, - /* 0x1A5 */ OBJECT_LOTUS, - /* 0x1A6 */ OBJECT_TL, - /* 0x1A7 */ OBJECT_DKJAIL_OBJ, - /* 0x1A8 */ OBJECT_VISIBLOCK, - /* 0x1A9 */ OBJECT_TSN, - /* 0x1AA */ OBJECT_DS2N, - /* 0x1AB */ OBJECT_FSN, - /* 0x1AC */ OBJECT_SHN, - /* 0x1AD */ OBJECT_BIGICICLE, - /* 0x1AE */ OBJECT_GI_BOTTLE_15, - /* 0x1AF */ OBJECT_TK, - /* 0x1B0 */ OBJECT_MARKET_OBJ, - /* 0x1B1 */ OBJECT_GI_RESERVE00, - /* 0x1B2 */ OBJECT_GI_RESERVE01, - /* 0x1B3 */ OBJECT_LIGHTBLOCK, - /* 0x1B4 */ OBJECT_TAKARAYA_OBJECTS, - /* 0x1B5 */ OBJECT_WDHAND, - /* 0x1B6 */ OBJECT_SDN, - /* 0x1B7 */ OBJECT_SNOWWD, - /* 0x1B8 */ OBJECT_GIANT, - /* 0x1B9 */ OBJECT_COMB, - /* 0x1BA */ OBJECT_HANA, - /* 0x1BB */ OBJECT_BOSS_HAKUGIN, - /* 0x1BC */ OBJECT_MEGANEANA_OBJ, - /* 0x1BD */ OBJECT_GI_NUTSMASK, - /* 0x1BE */ OBJECT_STK2, - /* 0x1BF */ OBJECT_SPOT11_OBJ, - /* 0x1C0 */ OBJECT_DANPEI_OBJECT, - /* 0x1C1 */ OBJECT_DHOUSE, - /* 0x1C2 */ OBJECT_HAKAISI, - /* 0x1C3 */ OBJECT_PO, - /* 0x1C4 */ OBJECT_SNOWMAN, - /* 0x1C5 */ OBJECT_PO_SISTERS, - /* 0x1C6 */ OBJECT_PP, - /* 0x1C7 */ OBJECT_GORONSWITCH, - /* 0x1C8 */ OBJECT_DELF, - /* 0x1C9 */ OBJECT_BOTIHASIRA, - /* 0x1CA */ OBJECT_GI_BIGBOMB, - /* 0x1CB */ OBJECT_PST, - /* 0x1CC */ OBJECT_BSMASK, - /* 0x1CD */ OBJECT_SPIDERTENT, - /* 0x1CE */ OBJECT_ZORAEGG, - /* 0x1CF */ OBJECT_KBT, - /* 0x1D0 */ OBJECT_GG, - /* 0x1D1 */ OBJECT_MARUTA, - /* 0x1D2 */ OBJECT_GHAKA, - /* 0x1D3 */ OBJECT_OYU, - /* 0x1D4 */ OBJECT_DNQ, - /* 0x1D5 */ OBJECT_DAI, - /* 0x1D6 */ OBJECT_KGY, - /* 0x1D7 */ OBJECT_FB, - /* 0x1D8 */ OBJECT_TAISOU, - /* 0x1D9 */ OBJECT_MASK_BU_SAN, - /* 0x1DA */ OBJECT_MASK_KI_TAN, - /* 0x1DB */ OBJECT_MASK_RABIT, - /* 0x1DC */ OBJECT_MASK_SKJ, - /* 0x1DD */ OBJECT_MASK_BAKURETU, - /* 0x1DE */ OBJECT_MASK_TRUTH, - /* 0x1DF */ OBJECT_GK, - /* 0x1E0 */ OBJECT_HAKA_OBJ, - /* 0x1E1 */ OBJECT_MASK_GORON, - /* 0x1E2 */ OBJECT_MASK_ZORA, - /* 0x1E3 */ OBJECT_MASK_NUTS, - /* 0x1E4 */ OBJECT_MASK_BOY, - /* 0x1E5 */ OBJECT_DNT, - /* 0x1E6 */ OBJECT_YUKIYAMA, - /* 0x1E7 */ OBJECT_ICEFLOE, - /* 0x1E8 */ OBJECT_GI_GOLD_DUST, - /* 0x1E9 */ OBJECT_GI_BOTTLE_16, - /* 0x1EA */ OBJECT_GI_BOTTLE_22, - /* 0x1EB */ OBJECT_BEE, - /* 0x1EC */ OBJECT_OT, - /* 0x1ED */ OBJECT_UTUBO, - /* 0x1EE */ OBJECT_DORA, - /* 0x1EF */ OBJECT_GI_LOACH, - /* 0x1F0 */ OBJECT_GI_SEAHORSE, - /* 0x1F1 */ OBJECT_BIGPO, - /* 0x1F2 */ OBJECT_HARIKO, - /* 0x1F3 */ OBJECT_DNJ, - /* 0x1F4 */ OBJECT_SINKAI_KABE, - /* 0x1F5 */ OBJECT_KIN2_OBJ, - /* 0x1F6 */ OBJECT_ISHI, - /* 0x1F7 */ OBJECT_HAKUGIN_DEMO, - /* 0x1F8 */ OBJECT_JG, - /* 0x1F9 */ OBJECT_GI_SWORD_2, - /* 0x1FA */ OBJECT_GI_SWORD_3, - /* 0x1FB */ OBJECT_GI_SWORD_4, - /* 0x1FC */ OBJECT_UM, - /* 0x1FD */ OBJECT_MASK_GIBUDO, - /* 0x1FE */ OBJECT_MASK_JSON, - /* 0x1FF */ OBJECT_MASK_KERFAY, - /* 0x200 */ OBJECT_MASK_BIGELF, - /* 0x201 */ OBJECT_RB, - /* 0x202 */ OBJECT_MBAR_OBJ, - /* 0x203 */ OBJECT_IKANA_OBJ, - /* 0x204 */ OBJECT_KZ, - /* 0x205 */ OBJECT_TOKEI_TURRET, - /* 0x206 */ OBJECT_ZOG, - /* 0x207 */ OBJECT_ROTLIFT, - /* 0x208 */ OBJECT_POSTHOUSE_OBJ, - /* 0x209 */ OBJECT_GI_MASK09, - /* 0x20A */ OBJECT_GI_MASK14, - /* 0x20B */ OBJECT_GI_MASK15, - /* 0x20C */ OBJECT_INIBS_OBJECT, - /* 0x20D */ OBJECT_TREE, - /* 0x20E */ OBJECT_KAIZOKU_OBJ, - /* 0x20F */ OBJECT_GI_RESERVE_B_00, - /* 0x210 */ OBJECT_GI_RESERVE_C_00, - /* 0x211 */ OBJECT_ZOB, - /* 0x212 */ OBJECT_MILKBAR, - /* 0x213 */ OBJECT_DMASK, - /* 0x214 */ OBJECT_MASK_KYOJIN, - /* 0x215 */ OBJECT_GI_RESERVE_C_01, - /* 0x216 */ OBJECT_ZOD, - /* 0x217 */ OBJECT_KUMO30, - /* 0x218 */ OBJECT_OBJ_YASI, - /* 0x219 */ OBJECT_MASK_ROMERNY, - /* 0x21A */ OBJECT_TANRON1, - /* 0x21B */ OBJECT_TANRON2, - /* 0x21C */ OBJECT_TANRON3, - /* 0x21D */ OBJECT_GI_MAGICMUSHROOM, - /* 0x21E */ OBJECT_OBJ_CHAN, - /* 0x21F */ OBJECT_GI_MASK10, - /* 0x220 */ OBJECT_ZOS, - /* 0x221 */ OBJECT_MASK_POSTHAT, - /* 0x222 */ OBJECT_F40_SWITCH, - /* 0x223 */ OBJECT_LODMOON, - /* 0x224 */ OBJECT_TRO, - /* 0x225 */ OBJECT_GI_MASK12, - /* 0x226 */ OBJECT_GI_MASK23, - /* 0x227 */ OBJECT_GI_BOTTLE_21, - /* 0x228 */ OBJECT_GI_CAMERA, - /* 0x229 */ OBJECT_KAMEJIMA, - /* 0x22A */ OBJECT_HARFGIBUD, - /* 0x22B */ OBJECT_ZOV, - /* 0x22C */ OBJECT_HGDOOR, - /* 0x22D */ OBJECT_UNSET_22D, - /* 0x22E */ OBJECT_UNSET_22E, - /* 0x22F */ OBJECT_UNSET_22F, - /* 0x230 */ OBJECT_DOR01, - /* 0x231 */ OBJECT_DOR02, - /* 0x232 */ OBJECT_DOR03, - /* 0x233 */ OBJECT_DOR04, - /* 0x234 */ OBJECT_LAST_OBJ, - /* 0x235 */ OBJECT_REDEAD_OBJ, - /* 0x236 */ OBJECT_IKNINSIDE_OBJ, - /* 0x237 */ OBJECT_IKNV_OBJ, - /* 0x238 */ OBJECT_PAMERA, - /* 0x239 */ OBJECT_HSSTUMP, - /* 0x23A */ OBJECT_ZM, - /* 0x23B */ OBJECT_BIG_FWALL, - /* 0x23C */ OBJECT_SECOM_OBJ, - /* 0x23D */ OBJECT_HUNSUI, - /* 0x23E */ OBJECT_UCH, - /* 0x23F */ OBJECT_TANRON4, - /* 0x240 */ OBJECT_TANRON5, - /* 0x241 */ OBJECT_DT, - /* 0x242 */ OBJECT_GI_MASK03, - /* 0x243 */ OBJECT_CHA, - /* 0x244 */ OBJECT_OBJ_DINNER, - /* 0x245 */ OBJECT_GI_RESERVE_B_01, - /* 0x246 */ OBJECT_LASTDAY, - /* 0x247 */ OBJECT_BAI, - /* 0x248 */ OBJECT_IN2, - /* 0x249 */ OBJECT_IKN_DEMO, - /* 0x24A */ OBJECT_YB, - /* 0x24B */ OBJECT_RZ, - /* 0x24C */ OBJECT_MASK_ZACHO, - /* 0x24D */ OBJECT_GI_FIELDMAP, - /* 0x24E */ OBJECT_MASK_STONE, - /* 0x24F */ OBJECT_BJT, - /* 0x250 */ OBJECT_TARU, - /* 0x251 */ OBJECT_MOONSTON, - /* 0x252 */ OBJECT_MASK_BREE, - /* 0x253 */ OBJECT_GI_SCHEDULE, - /* 0x254 */ OBJECT_GI_STONEMASK, - /* 0x255 */ OBJECT_ZORABAND, - /* 0x256 */ OBJECT_KEPN_KOYA, - /* 0x257 */ OBJECT_OBJ_USIYANE, - /* 0x258 */ OBJECT_GI_MASK05, - /* 0x259 */ OBJECT_GI_MASK11, - /* 0x25A */ OBJECT_GI_MASK20, - /* 0x25B */ OBJECT_NNH, - /* 0x25C */ OBJECT_MASK_GERO, - /* 0x25D */ OBJECT_MASK_YOFUKASI, - /* 0x25E */ OBJECT_MASK_MEOTO, - /* 0x25F */ OBJECT_MASK_DANCER, - /* 0x260 */ OBJECT_KZSAKU, - /* 0x261 */ OBJECT_OBJ_MILK_BIN, - /* 0x262 */ OBJECT_RANDOM_OBJ, - /* 0x263 */ OBJECT_KUJIYA, - /* 0x264 */ OBJECT_KITAN, - /* 0x265 */ OBJECT_GI_MASK06, - /* 0x266 */ OBJECT_GI_MASK16, - /* 0x267 */ OBJECT_ASTR_OBJ, - /* 0x268 */ OBJECT_BSB, - /* 0x269 */ OBJECT_FALL2, - /* 0x26A */ OBJECT_STH, - /* 0x26B */ OBJECT_GI_MSSA, - /* 0x26C */ OBJECT_SMTOWER, - /* 0x26D */ OBJECT_GI_MASK21, - /* 0x26E */ OBJECT_YADO_OBJ, - /* 0x26F */ OBJECT_SYOTEN, - /* 0x270 */ OBJECT_MOONEND, - /* 0x271 */ OBJECT_OB, - /* 0x272 */ OBJECT_GI_BOTTLE_04, - /* 0x273 */ OBJECT_OBJ_DANPEILIFT, - /* 0x274 */ OBJECT_WDOR01, - /* 0x275 */ OBJECT_WDOR02, - /* 0x276 */ OBJECT_WDOR03, - /* 0x277 */ OBJECT_STK3, - /* 0x278 */ OBJECT_KINSTA1_OBJ, - /* 0x279 */ OBJECT_KINSTA2_OBJ, - /* 0x27A */ OBJECT_BH, - /* 0x27B */ OBJECT_WDOR04, - /* 0x27C */ OBJECT_WDOR05, - /* 0x27D */ OBJECT_GI_MASK17, - /* 0x27E */ OBJECT_GI_MASK22, - /* 0x27F */ OBJECT_LBFSHOT, - /* 0x280 */ OBJECT_FUSEN, - /* 0x281 */ OBJECT_ENDING_OBJ, - /* 0x282 */ OBJECT_GI_MASK13, +#define DEFINE_OBJECT(_name, enumValue) enumValue, +#define DEFINE_OBJECT_UNSET(enumValue) enumValue, +#define DEFINE_OBJECT_SIZE_ZERO(_name, enumValue) enumValue, + +typedef enum ObjectId { + #include "tables/object_table.h" /* 0x283 */ OBJECT_ID_MAX -} ObjectID; +} ObjectId; + +#undef DEFINE_OBJECT +#undef DEFINE_OBJECT_UNSET +#undef DEFINE_OBJECT_SIZE_ZERO #endif diff --git a/include/z64player.h b/include/z64player.h index 96abf00c8..456eba3eb 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -990,7 +990,7 @@ typedef struct Player { /* 0xB5D */ u8 unk_B5D; /* 0xB5E */ u8 unk_B5E; /* 0xB5F */ u8 unk_B5F; - /* 0xB60 */ u16 unk_B60; // blast mask timer? + /* 0xB60 */ u16 blastMaskTimer; /* 0xB62 */ s16 unk_B62; /* 0xB64 */ u8 unk_B64; /* 0xB65 */ u8 shockTimer; diff --git a/include/z64save.h b/include/z64save.h index d3f538029..afabcce34 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -313,7 +313,7 @@ typedef struct SaveContext { /* 0x0000 */ Save save; /* 0x100C */ u8 eventInf[8]; // "event_inf" /* 0x1014 */ u8 unk_1014; // "stone_set_flag" - /* 0x1015 */ u8 unk_1015; + /* 0x1015 */ u8 bButtonStatus; /* 0x1016 */ u16 jinxTimer; /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" @@ -406,6 +406,14 @@ typedef enum SunsSongState { /* 3 */ SUNSSONG_SPECIAL // time does not advance, but signals the song was played. used for freezing redeads } SunsSongState; +typedef enum { + /* 0 */ GAMEMODE_NORMAL, + /* 1 */ GAMEMODE_TITLE_SCREEN, + /* 2 */ GAMEMODE_FILE_SELECT, + /* 3 */ GAMEMODE_END_CREDITS, + /* 4 */ GAMEMODE_OWL_SAVE +} GameMode; + // linkAge still exists in MM, but is always set to 0 (always adult) // There are remnants of these macros from OOT, but they are essentially useless #define LINK_IS_CHILD (gSaveContext.save.linkAge == 1) @@ -503,36 +511,43 @@ typedef enum SunsSongState { #define PACK_WEEKEVENTREG_FLAG(index, mask) (((index) << 8) | (mask)) #define WEEKEVENTREG_00_01 PACK_WEEKEVENTREG_FLAG(0, 0x01) -#define WEEKEVENTREG_00_02 PACK_WEEKEVENTREG_FLAG(0, 0x02) -#define WEEKEVENTREG_00_04 PACK_WEEKEVENTREG_FLAG(0, 0x04) -#define WEEKEVENTREG_00_08 PACK_WEEKEVENTREG_FLAG(0, 0x08) -#define WEEKEVENTREG_00_10 PACK_WEEKEVENTREG_FLAG(0, 0x10) -#define WEEKEVENTREG_00_20 PACK_WEEKEVENTREG_FLAG(0, 0x20) -#define WEEKEVENTREG_00_40 PACK_WEEKEVENTREG_FLAG(0, 0x40) -#define WEEKEVENTREG_00_80 PACK_WEEKEVENTREG_FLAG(0, 0x80) -#define WEEKEVENTREG_01_01 PACK_WEEKEVENTREG_FLAG(1, 0x01) -#define WEEKEVENTREG_01_02 PACK_WEEKEVENTREG_FLAG(1, 0x02) -#define WEEKEVENTREG_01_04 PACK_WEEKEVENTREG_FLAG(1, 0x04) -#define WEEKEVENTREG_01_08 PACK_WEEKEVENTREG_FLAG(1, 0x08) -#define WEEKEVENTREG_01_10 PACK_WEEKEVENTREG_FLAG(1, 0x10) -#define WEEKEVENTREG_01_20 PACK_WEEKEVENTREG_FLAG(1, 0x20) -#define WEEKEVENTREG_01_40 PACK_WEEKEVENTREG_FLAG(1, 0x40) -#define WEEKEVENTREG_01_80 PACK_WEEKEVENTREG_FLAG(1, 0x80) -#define WEEKEVENTREG_02_01 PACK_WEEKEVENTREG_FLAG(2, 0x01) -#define WEEKEVENTREG_02_02 PACK_WEEKEVENTREG_FLAG(2, 0x02) -#define WEEKEVENTREG_02_04 PACK_WEEKEVENTREG_FLAG(2, 0x04) -#define WEEKEVENTREG_02_08 PACK_WEEKEVENTREG_FLAG(2, 0x08) -#define WEEKEVENTREG_02_10 PACK_WEEKEVENTREG_FLAG(2, 0x10) -#define WEEKEVENTREG_02_20 PACK_WEEKEVENTREG_FLAG(2, 0x20) -#define WEEKEVENTREG_02_40 PACK_WEEKEVENTREG_FLAG(2, 0x40) -#define WEEKEVENTREG_02_80 PACK_WEEKEVENTREG_FLAG(2, 0x80) -#define WEEKEVENTREG_03_01 PACK_WEEKEVENTREG_FLAG(3, 0x01) -#define WEEKEVENTREG_03_02 PACK_WEEKEVENTREG_FLAG(3, 0x02) -#define WEEKEVENTREG_03_04 PACK_WEEKEVENTREG_FLAG(3, 0x04) -#define WEEKEVENTREG_03_08 PACK_WEEKEVENTREG_FLAG(3, 0x08) -#define WEEKEVENTREG_03_10 PACK_WEEKEVENTREG_FLAG(3, 0x10) -#define WEEKEVENTREG_03_20 PACK_WEEKEVENTREG_FLAG(3, 0x20) -#define WEEKEVENTREG_03_40 PACK_WEEKEVENTREG_FLAG(3, 0x40) + +/* Entrance cutscenes watched */ + +#define WEEKEVENTREG_ENTERED_TERMINA_FIELD PACK_WEEKEVENTREG_FLAG(0, 0x02) +#define WEEKEVENTREG_ENTERED_IKANA_GRAVEYARD PACK_WEEKEVENTREG_FLAG(0, 0x04) +#define WEEKEVENTREG_ENTERED_ROMANI_RANCH PACK_WEEKEVENTREG_FLAG(0, 0x08) +#define WEEKEVENTREG_ENTERED_GORMAN_TRACK PACK_WEEKEVENTREG_FLAG(0, 0x10) +#define WEEKEVENTREG_ENTERED_MOUNTAIN_VILLAGE_WINTER PACK_WEEKEVENTREG_FLAG(0, 0x20) +#define WEEKEVENTREG_ENTERED_GORON_SHRINE PACK_WEEKEVENTREG_FLAG(0, 0x40) +#define WEEKEVENTREG_ENTERED_SNOWHEAD PACK_WEEKEVENTREG_FLAG(0, 0x80) +#define WEEKEVENTREG_ENTERED_SOUTHERN_SWAMP_POISONED PACK_WEEKEVENTREG_FLAG(1, 0x01) +#define WEEKEVENTREG_ENTERED_WOODFALL PACK_WEEKEVENTREG_FLAG(1, 0x02) +#define WEEKEVENTREG_ENTERED_DEKU_PALACE PACK_WEEKEVENTREG_FLAG(1, 0x04) +#define WEEKEVENTREG_ENTERED_GREAT_BAY_COAST PACK_WEEKEVENTREG_FLAG(1, 0x08) +#define WEEKEVENTREG_ENTERED_PIRATES_FORTRESS PACK_WEEKEVENTREG_FLAG(1, 0x10) +#define WEEKEVENTREG_ENTERED_ZORA_HALL PACK_WEEKEVENTREG_FLAG(1, 0x20) +#define WEEKEVENTREG_ENTERED_WATERFALL_RAPIDS PACK_WEEKEVENTREG_FLAG(1, 0x40) +#define WEEKEVENTREG_ENTERED_IKANA_CANYON PACK_WEEKEVENTREG_FLAG(1, 0x80) +// Attached to the scene but unused. Entrance cutscene is instead triggered by `ACTOR_OBJ_DEMO` +#define WEEKEVENTREG_ENTERED_IKANA_CASTLE PACK_WEEKEVENTREG_FLAG(2, 0x01) +#define WEEKEVENTREG_ENTERED_STONE_TOWER PACK_WEEKEVENTREG_FLAG(2, 0x02) +#define WEEKEVENTREG_ENTERED_STONE_TOWER_INVERTED PACK_WEEKEVENTREG_FLAG(2, 0x04) +#define WEEKEVENTREG_ENTERED_EAST_CLOCK_TOWN PACK_WEEKEVENTREG_FLAG(2, 0x08) +#define WEEKEVENTREG_ENTERED_WEST_CLOCK_TOWN PACK_WEEKEVENTREG_FLAG(2, 0x10) +#define WEEKEVENTREG_ENTERED_NORTH_CLOCK_TOWN PACK_WEEKEVENTREG_FLAG(2, 0x20) +#define WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE PACK_WEEKEVENTREG_FLAG(2, 0x40) +#define WEEKEVENTREG_ENTERED_SNOWHEAD_TEMPLE PACK_WEEKEVENTREG_FLAG(2, 0x80) +// Attached to the scene but unused. Entrance cutscene is instead triggered by `ACTOR_OBJ_DEMO` +#define WEEKEVENTREG_ENTERED_PIRATES_FORTRESS_EXTERIOR PACK_WEEKEVENTREG_FLAG(3, 0x01) +#define WEEKEVENTREG_ENTERED_STONE_TOWER_TEMPLE PACK_WEEKEVENTREG_FLAG(3, 0x02) +#define WEEKEVENTREG_ENTERED_STONE_TOWER_TEMPLE_INVERTED PACK_WEEKEVENTREG_FLAG(3, 0x04) +// Unused as no cutscene is attached to this script +#define WEEKEVENTREG_ENTERED_THE_MOON PACK_WEEKEVENTREG_FLAG(3, 0x08) +#define WEEKEVENTREG_ENTERED_MOON_DEKU_TRIAL PACK_WEEKEVENTREG_FLAG(3, 0x10) +#define WEEKEVENTREG_ENTERED_MOON_GORON_TRIAL PACK_WEEKEVENTREG_FLAG(3, 0x20) +#define WEEKEVENTREG_ENTERED_MOON_ZORA_TRIAL PACK_WEEKEVENTREG_FLAG(3, 0x40) + #define WEEKEVENTREG_03_80 PACK_WEEKEVENTREG_FLAG(3, 0x80) #define WEEKEVENTREG_04_01 PACK_WEEKEVENTREG_FLAG(4, 0x01) #define WEEKEVENTREG_04_02 PACK_WEEKEVENTREG_FLAG(4, 0x02) @@ -565,14 +580,21 @@ typedef enum SunsSongState { #define WEEKEVENTREG_07_10 PACK_WEEKEVENTREG_FLAG(7, 0x10) #define WEEKEVENTREG_07_20 PACK_WEEKEVENTREG_FLAG(7, 0x20) #define WEEKEVENTREG_07_40 PACK_WEEKEVENTREG_FLAG(7, 0x40) -#define WEEKEVENTREG_07_80 PACK_WEEKEVENTREG_FLAG(7, 0x80) + +// Entrance cutscene watched to the prison where the deku princess is kept. Also set in door_warp1.c +#define WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON PACK_WEEKEVENTREG_FLAG(7, 0x80) + +// Related to Honey & Darling minigame #define WEEKEVENTREG_08_01 PACK_WEEKEVENTREG_FLAG(8, 0x01) #define WEEKEVENTREG_08_02 PACK_WEEKEVENTREG_FLAG(8, 0x02) #define WEEKEVENTREG_08_04 PACK_WEEKEVENTREG_FLAG(8, 0x04) #define WEEKEVENTREG_08_08 PACK_WEEKEVENTREG_FLAG(8, 0x08) #define WEEKEVENTREG_08_10 PACK_WEEKEVENTREG_FLAG(8, 0x10) #define WEEKEVENTREG_08_20 PACK_WEEKEVENTREG_FLAG(8, 0x20) + +// Related to final hours #define WEEKEVENTREG_08_40 PACK_WEEKEVENTREG_FLAG(8, 0x40) + #define WEEKEVENTREG_08_80 PACK_WEEKEVENTREG_FLAG(8, 0x80) #define WEEKEVENTREG_09_01 PACK_WEEKEVENTREG_FLAG(9, 0x01) #define WEEKEVENTREG_09_02 PACK_WEEKEVENTREG_FLAG(9, 0x02) @@ -614,9 +636,18 @@ typedef enum SunsSongState { #define WEEKEVENTREG_13_04 PACK_WEEKEVENTREG_FLAG(13, 0x04) #define WEEKEVENTREG_13_08 PACK_WEEKEVENTREG_FLAG(13, 0x08) #define WEEKEVENTREG_13_10 PACK_WEEKEVENTREG_FLAG(13, 0x10) -#define WEEKEVENTREG_13_20 PACK_WEEKEVENTREG_FLAG(13, 0x20) -#define WEEKEVENTREG_13_40 PACK_WEEKEVENTREG_FLAG(13, 0x40) -#define WEEKEVENTREG_13_80 PACK_WEEKEVENTREG_FLAG(13, 0x80) + +// This flag marks that the player has finished the Oceanside Spider House and has exited. +// Used to identify if EnSth should be moved deeper into the house. +// This does NOT flag: +// A) that the player has completed the house (Inventory_GetSkullTokenCount(play->sceneId)) +// B) that the player has collected a reward (WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD) +// C) that the player has collected the wallet (WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE) +#define WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN PACK_WEEKEVENTREG_FLAG(13, 0x20) + +#define WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE PACK_WEEKEVENTREG_FLAG(13, 0x40) +// You only get a wallet if completed on Day 1: repeat gets silver rupee, other days get less +#define WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD PACK_WEEKEVENTREG_FLAG(13, 0x80) // PlayedMilkMinigame // Attempted Cremia Cart Ride @@ -785,6 +816,9 @@ typedef enum SunsSongState { #define WEEKEVENTREG_31_10 PACK_WEEKEVENTREG_FLAG(31, 0x10) #define WEEKEVENTREG_31_20 PACK_WEEKEVENTREG_FLAG(31, 0x20) +//! @note: entrance cutscenes defined in `CutsceneEntry` can not use +//! any of the below weekEventFlags due to bitpacking + // Cremia asked the player to accompany her to town #define WEEKEVENTREG_31_40 PACK_WEEKEVENTREG_FLAG(31, 0x40) // Player is playing the Milk Run @@ -819,10 +853,10 @@ typedef enum SunsSongState { #define WEEKEVENTREG_34_02 PACK_WEEKEVENTREG_FLAG(34, 0x02) #define WEEKEVENTREG_34_04 PACK_WEEKEVENTREG_FLAG(34, 0x04) -#define WEEKEVENTREG_34_08 PACK_WEEKEVENTREG_FLAG(34, 0x08) +#define WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED PACK_WEEKEVENTREG_FLAG(34, 0x08) #define WEEKEVENTREG_34_10 PACK_WEEKEVENTREG_FLAG(34, 0x10) #define WEEKEVENTREG_34_20 PACK_WEEKEVENTREG_FLAG(34, 0x20) -#define WEEKEVENTREG_34_40 PACK_WEEKEVENTREG_FLAG(34, 0x40) +#define WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH PACK_WEEKEVENTREG_FLAG(34, 0x40) // Cremia did Milk Run alone. Player didn't interact or didn't accept the ride #define WEEKEVENTREG_34_80 PACK_WEEKEVENTREG_FLAG(34, 0x80) @@ -1070,8 +1104,12 @@ typedef enum SunsSongState { #define WEEKEVENTREG_62_20 PACK_WEEKEVENTREG_FLAG(62, 0x20) #define WEEKEVENTREG_62_40 PACK_WEEKEVENTREG_FLAG(62, 0x40) #define WEEKEVENTREG_62_80 PACK_WEEKEVENTREG_FLAG(62, 0x80) -#define WEEKEVENTREG_63_01 PACK_WEEKEVENTREG_FLAG(63, 0x01) -#define WEEKEVENTREG_63_02 PACK_WEEKEVENTREG_FLAG(63, 0x02) + +// See `EnTimeTag_KickOut_WaitForTime` and `EnTimeTag_KickOut_WaitForTrigger` +#define WEEKEVENTREG_KICKOUT_WAIT PACK_WEEKEVENTREG_FLAG(63, 0x01) +// See `EnTimeTag_KickOut_WaitForTime` and `EnTimeTag_KickOut_WaitForTrigger` +#define WEEKEVENTREG_KICKOUT_TIME_PASSED PACK_WEEKEVENTREG_FLAG(63, 0x02) + #define WEEKEVENTREG_63_04 PACK_WEEKEVENTREG_FLAG(63, 0x04) #define WEEKEVENTREG_63_08 PACK_WEEKEVENTREG_FLAG(63, 0x08) #define WEEKEVENTREG_63_10 PACK_WEEKEVENTREG_FLAG(63, 0x10) @@ -1218,7 +1256,10 @@ typedef enum SunsSongState { #define WEEKEVENTREG_80_01 PACK_WEEKEVENTREG_FLAG(80, 0x01) #define WEEKEVENTREG_80_02 PACK_WEEKEVENTREG_FLAG(80, 0x02) #define WEEKEVENTREG_80_04 PACK_WEEKEVENTREG_FLAG(80, 0x04) + +// Aveil has spotted Player #define WEEKEVENTREG_80_08 PACK_WEEKEVENTREG_FLAG(80, 0x08) + #define WEEKEVENTREG_80_10 PACK_WEEKEVENTREG_FLAG(80, 0x10) #define WEEKEVENTREG_80_20 PACK_WEEKEVENTREG_FLAG(80, 0x20) #define WEEKEVENTREG_80_40 PACK_WEEKEVENTREG_FLAG(80, 0x40) @@ -1237,13 +1278,17 @@ typedef enum SunsSongState { // check if already healed Kamaro the Dancing Ghost #define WEEKEVENTREG_82_04 PACK_WEEKEVENTREG_FLAG(82, 0x04) +// Related to Swordsman's log minigame #define WEEKEVENTREG_82_08 PACK_WEEKEVENTREG_FLAG(82, 0x08) #define WEEKEVENTREG_82_10 PACK_WEEKEVENTREG_FLAG(82, 0x10) #define WEEKEVENTREG_82_20 PACK_WEEKEVENTREG_FLAG(82, 0x20) #define WEEKEVENTREG_82_40 PACK_WEEKEVENTREG_FLAG(82, 0x40) #define WEEKEVENTREG_82_80 PACK_WEEKEVENTREG_FLAG(82, 0x80) #define WEEKEVENTREG_83_01 PACK_WEEKEVENTREG_FLAG(83, 0x01) + +// Knocked the Gerudo beehive down #define WEEKEVENTREG_83_02 PACK_WEEKEVENTREG_FLAG(83, 0x02) + #define WEEKEVENTREG_83_04 PACK_WEEKEVENTREG_FLAG(83, 0x04) #define WEEKEVENTREG_83_08 PACK_WEEKEVENTREG_FLAG(83, 0x08) #define WEEKEVENTREG_83_10 PACK_WEEKEVENTREG_FLAG(83, 0x10) @@ -1257,6 +1302,7 @@ typedef enum SunsSongState { #define WEEKEVENTREG_84_10 PACK_WEEKEVENTREG_FLAG(84, 0x10) // Unconfirmed: "Obtained Fierce Deity's Mask?" +// Also related to moon child #define WEEKEVENTREG_84_20 PACK_WEEKEVENTREG_FLAG(84, 0x20) #define WEEKEVENTREG_84_40 PACK_WEEKEVENTREG_FLAG(84, 0x40) @@ -1321,6 +1367,8 @@ typedef enum SunsSongState { #define WEEKEVENTREG_90_04 PACK_WEEKEVENTREG_FLAG(90, 0x04) #define WEEKEVENTREG_90_08 PACK_WEEKEVENTREG_FLAG(90, 0x08) #define WEEKEVENTREG_90_10 PACK_WEEKEVENTREG_FLAG(90, 0x10) + +// Related to Fishermans's jumping minigame #define WEEKEVENTREG_90_20 PACK_WEEKEVENTREG_FLAG(90, 0x20) #define WEEKEVENTREG_90_40 PACK_WEEKEVENTREG_FLAG(90, 0x40) #define WEEKEVENTREG_90_80 PACK_WEEKEVENTREG_FLAG(90, 0x80) @@ -1417,9 +1465,12 @@ typedef enum SunsSongState { #define GET_WEEKEVENTREG_RACE_FLAGS (WEEKEVENTREG(92) & WEEKEVENTREG_RACE_FLAGS) -#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ - WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ - WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)) +#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ + { \ + WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ + WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)); \ + } \ + (void)0 /** * gSaveContext.eventInf @@ -1457,11 +1508,15 @@ typedef enum SunsSongState { #define EVENTINF_32 0x32 #define EVENTINF_33 0x33 + +// Related to Deku playground minigame #define EVENTINF_34 0x34 #define EVENTINF_35 0x35 #define EVENTINF_36 0x36 #define EVENTINF_37 0x37 #define EVENTINF_40 0x40 + +// Related to swamp boat (non-minigame)? #define EVENTINF_41 0x41 #define EVENTINF_42 0x42 #define EVENTINF_43 0x43 diff --git a/include/z64scene.h b/include/z64scene.h index 41198af71..84b405b90 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -13,6 +13,9 @@ typedef struct { /* 0x4 */ uintptr_t vromEnd; } RomFile; // size = 0x8 +#define ROOM_DRAW_OPA (1 << 0) +#define ROOM_DRAW_XLU (1 << 1) + typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 data1; @@ -213,58 +216,132 @@ typedef struct { /* 0x4 */ void* segment; } SCmdMinimapChests; // size = 0x8 -typedef struct { - /* 0x0 */ Gfx* opaqueDl; - /* 0x4 */ Gfx* translucentDl; -} RoomMeshType0Params; // size = 0x8 - -// Fields TODO -typedef struct { - /* 0x0 */ u8 type; - /* 0x1 */ u8 format; // 1 = single, 2 = multi -} RoomMeshType1; // size = 0x2 - -// Size TODO -typedef struct { - /* 0x0 */ UNK_TYPE1 pad0[0x10]; -} RoomMeshType1Params; // size = 0x10 - -typedef struct { - /* 0x0 */ UNK_TYPE1 pad0[0x10]; -} RoomMeshType2Params; // size = 0x10 +typedef enum { + /* 0 */ ROOM_SHAPE_TYPE_NORMAL, + /* 1 */ ROOM_SHAPE_TYPE_IMAGE, + /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, + /* 3 */ ROOM_SHAPE_TYPE_NONE, + /* 4 */ ROOM_SHAPE_TYPE_MAX +} RoomShapeType; typedef struct { /* 0x0 */ u8 type; - /* 0x1 */ u8 count; - /* 0x2 */ UNK_TYPE1 pad2[0x2]; - /* 0x4 */ RoomMeshType0Params* paramsStart; - /* 0x8 */ RoomMeshType0Params* paramsEnd; -} RoomMeshType0; // size = 0xC +} RoomShapeBase; // size = 0x1 typedef struct { - /* 0x0 */ u8 type; - /* 0x1 */ u8 count; - /* 0x2 */ UNK_TYPE1 pad2[0x2]; - /* 0x4 */ RoomMeshType2Params* paramsStart; - /* 0x8 */ RoomMeshType2Params* paramsEnd; -} RoomMeshType2; // size = 0xC + /* 0x0 */ Gfx* opa; + /* 0x4 */ Gfx* xlu; +} RoomShapeDListsEntry; // size = 0x8 + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ RoomShapeDListsEntry* entries; + /* 0x8 */ RoomShapeDListsEntry* entriesEnd; +} RoomShapeNormal; // size = 0xC + +typedef enum { + /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, + /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI +} RoomShapeImageAmountType; + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 amountType; // uses `RoomShapeImageAmountType` + /* 0x4 */ RoomShapeDListsEntry* entry; +} RoomShapeImageBase; // size = 0x8 + +typedef struct { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ void* source; + /* 0x0C */ u32 unk_0C; + /* 0x10 */ void* tlut; + /* 0x14 */ u16 width; + /* 0x16 */ u16 height; + /* 0x18 */ u8 fmt; + /* 0x19 */ u8 siz; + /* 0x1A */ u16 tlutMode; + /* 0x1C */ u16 tlutCount; +} RoomShapeImageSingle; // size = 0x20 + +typedef struct { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u8 bgCamIndex; // the bg cam index this entry is for + /* 0x04 */ void* source; + /* 0x08 */ u32 unk_0C; + /* 0x0C */ void* tlut; + /* 0x10 */ u16 width; + /* 0x12 */ u16 height; + /* 0x14 */ u8 fmt; + /* 0x15 */ u8 siz; + /* 0x16 */ u16 tlutMode; + /* 0x18 */ u16 tlutCount; +} RoomShapeImageMultiBgEntry; // size = 0x1C + +typedef struct { + /* 0x0 */ RoomShapeImageBase base; + /* 0x8 */ u8 numBackgrounds; + /* 0xC */ RoomShapeImageMultiBgEntry* backgrounds; +} RoomShapeImageMulti; // size = 0x10 + +typedef struct { + /* 0x0 */ Vec3s boundsSphereCenter; + /* 0x6 */ s16 boundsSphereRadius; + /* 0x8 */ Gfx* opa; + /* 0xC */ Gfx* xlu; +} RoomShapeCullableEntry; // size = 0x10 + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ RoomShapeCullableEntry* entries; + /* 0x8 */ RoomShapeCullableEntry* entriesEnd; +} RoomShapeCullable; // size = 0xC typedef union { - RoomMeshType0 type0; - RoomMeshType1 type1; - RoomMeshType2 type2; -} RoomMesh; // size = 0xC + RoomShapeBase base; + RoomShapeNormal normal; + union { + RoomShapeImageBase base; + RoomShapeImageSingle single; + RoomShapeImageMulti multi; + } image; + RoomShapeCullable cullable; +} RoomShape; // "Ground Shape" + +// TODO: update ZAPD +#define SCENE_CMD_MESH SCENE_CMD_ROOM_SHAPE + +// TODO: Check which ones don't exist +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE1_0, + /* 1 */ ROOM_BEHAVIOR_TYPE1_1, + /* 2 */ ROOM_BEHAVIOR_TYPE1_2, + /* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused + /* 4 */ ROOM_BEHAVIOR_TYPE1_4, + /* 5 */ ROOM_BEHAVIOR_TYPE1_5 +} RoomBehaviorType1; + +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE2_0, + /* 1 */ ROOM_BEHAVIOR_TYPE2_1, + /* 2 */ ROOM_BEHAVIOR_TYPE2_2, + /* 3 */ ROOM_BEHAVIOR_TYPE2_HOT, + /* 4 */ ROOM_BEHAVIOR_TYPE2_4, + /* 5 */ ROOM_BEHAVIOR_TYPE2_5, + /* 6 */ ROOM_BEHAVIOR_TYPE2_6 +} RoomBehaviorType2; typedef struct { /* 0x00 */ s8 num; /* 0x01 */ u8 unk1; - /* 0x02 */ u8 unk2; // 3: Room is hot - /* 0x03 */ u8 unk3; + /* 0x02 */ u8 behaviorType2; + /* 0x03 */ u8 behaviorType1; /* 0x04 */ s8 echo; - /* 0x05 */ u8 unk5; + /* 0x05 */ u8 lensMode; /* 0x06 */ u8 enablePosLights; /* 0x07 */ UNK_TYPE1 pad7[0x1]; - /* 0x08 */ RoomMesh* mesh; + /* 0x08 */ RoomShape* roomShape; /* 0x0C */ void* segment; /* 0x10 */ UNK_TYPE1 pad10[0x4]; } Room; // size = 0x14 @@ -274,7 +351,7 @@ typedef struct { /* 0x14 */ Room prevRoom; /* 0x28 */ void* roomMemPages[2]; // In a scene with transitions, roomMemory is split between two pages that toggle each transition. This is one continuous range, as the second page allocates from the end /* 0x30 */ u8 activeMemPage; // 0 - First page in memory, 1 - Second page - /* 0x31 */ s8 unk31; + /* 0x31 */ s8 status; /* 0x32 */ UNK_TYPE1 pad32[0x2]; /* 0x34 */ void* activeRoomVram; /* 0x38 */ DmaRequest dmaRequest; @@ -286,15 +363,17 @@ typedef struct { /* 0x7A */ UNK_TYPE2 unk7A[3]; } RoomContext; // size = 0x80 -typedef struct { +typedef void(*RoomDrawHandler)(struct PlayState* play, Room* room, u32 flags); + +typedef struct TransitionActorEntry { struct { s8 room; // Room to switch to s8 bgCamIndex; // How the camera reacts during the transition. -2 for spiral staircase. -1 for generic door. 0+ will index scene CamData } /* 0x0 */ sides[2]; // 0 = front, 1 = back - /* 0x4 */ s16 id; + /* 0x4 */ s16 id; /* 0x6 */ Vec3s pos; - /* 0xC */ s16 rotY; - /* 0xE */ u16 params; + /* 0xC */ s16 rotY; + /* 0xE */ u16 params; } TransitionActorEntry; // size = 0x10 typedef struct { @@ -390,77 +469,6 @@ typedef struct { /* 0x00C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX]; } ObjectContext; // size = 0x958 -typedef struct { - /* 0x0 */ u8 headerType; -} MeshHeaderBase; // size = 0x1 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 numEntries; - /* 0x4 */ u32 dListStart; - /* 0x8 */ u32 dListEnd; -} MeshHeader0; // size = 0xC - -typedef struct { - /* 0x0 */ u32 opaqueDList; - /* 0x4 */ u32 translucentDList; -} MeshEntry0; // size = 0x8 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 format; - /* 0x4 */ u32 entryRecord; -} MeshHeader1Base; // size = 0x8 - -typedef struct { - /* 0x00 */ MeshHeader1Base base; - /* 0x08 */ u32 imagePtr; - /* 0x0C */ u32 unknown; - /* 0x10 */ u32 unknown2; - /* 0x14 */ u16 bgWidth; - /* 0x16 */ u16 bgHeight; - /* 0x18 */ u8 imageFormat; - /* 0x19 */ u8 imageSize; - /* 0x1A */ u16 imagePal; - /* 0x1C */ u16 imageFlip; -} MeshHeader1Single; // size = 0x20 - -typedef struct { - /* 0x0 */ MeshHeader1Base base; - /* 0x8 */ u8 bgCnt; - /* 0xC */ u32 bgRecordPtr; -} MeshHeader1Multi; // size = 0x10 - -typedef struct { - /* 0x00 */ u16 unknown; - /* 0x02 */ s8 bgID; - /* 0x04 */ u32 imagePtr; - /* 0x08 */ u32 unknown2; - /* 0x0C */ u32 unknown3; - /* 0x10 */ u16 bgWidth; - /* 0x12 */ u16 bgHeight; - /* 0x14 */ u8 imageFmt; - /* 0x15 */ u8 imageSize; - /* 0x16 */ u16 imagePal; - /* 0x18 */ u16 imageFlip; -} BackgroundRecord; // size = 0x1C - -typedef struct { - /* 0x0 */ s16 playerXMax; - /* 0x2 */ s16 playerZMax; - /* 0x4 */ s16 playerXMin; - /* 0x6 */ s16 playerZMin; - /* 0x8 */ u32 opaqueDList; - /* 0xC */ u32 translucentDList; -} MeshEntry2; // size = 0x10 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 numEntries; - /* 0x4 */ u32 dListStart; - /* 0x8 */ u32 dListEnd; -} MeshHeader2; // size = 0xC - typedef struct { /* 0x0 */ u8 count; // number of points in the path /* 0x1 */ u8 unk1; @@ -846,7 +854,7 @@ typedef enum { /* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES, /* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR, /* 0x09 */ SCENE_CMD_ID_UNK_09, - /* 0x0A */ SCENE_CMD_ID_MESH, + /* 0x0A */ SCENE_CMD_ID_ROOM_SHAPE, /* 0x0B */ SCENE_CMD_ID_OBJECT_LIST, /* 0x0C */ SCENE_CMD_ID_LIGHT_LIST, /* 0x0D */ SCENE_CMD_ID_PATH_LIST, @@ -905,8 +913,8 @@ typedef enum { #define SCENE_CMD_UNK_09() \ { SCENE_CMD_ID_UNK_09, 0, CMD_W(0) } -#define SCENE_CMD_MESH(meshHeader) \ - { SCENE_CMD_ID_MESH, 0, CMD_PTR(meshHeader) } +#define SCENE_CMD_ROOM_SHAPE(roomShape) \ + { SCENE_CMD_ID_ROOM_SHAPE, 0, CMD_PTR(roomShape) } #define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \ { SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) } diff --git a/include/z64shrink_window.h b/include/z64shrink_window.h index 2742fb602..bff11b939 100644 --- a/include/z64shrink_window.h +++ b/include/z64shrink_window.h @@ -18,6 +18,6 @@ s32 ShrinkWindow_Pillarbox_GetSize(void); void ShrinkWindow_Init(void); void ShrinkWindow_Destroy(void); void ShrinkWindow_Update(s32 framerateDivisor); -void ShrinkWindow_Draw(GraphicsContext* gfxCtx); +void ShrinkWindow_Draw(struct GraphicsContext* gfxCtx); #endif diff --git a/include/z64skin.h b/include/z64skin.h index 360e265e6..a9e2ebc01 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -1,5 +1,5 @@ -#ifndef Z64_SKIN_H -#define Z64_SKIN_H +#ifndef Z64SKIN_H +#define Z64SKIN_H #include "z64animation.h" diff --git a/include/z64skybox.h b/include/z64skybox.h new file mode 100644 index 000000000..0a981d23e --- /dev/null +++ b/include/z64skybox.h @@ -0,0 +1,62 @@ +#ifndef Z64SKYBOX_H +#define Z64SKYBOX_H + +#include "PR/ultratypes.h" +#include "PR/gbi.h" +#include "color.h" + +#include "z64dma.h" +#include "z64math.h" +#include "z64view.h" + +struct GraphicsContext; +struct GameState; +struct PlayState; + +typedef enum SkyboxId { + /* 0 */ SKYBOX_NONE, + /* 1 */ SKYBOX_NORMAL_SKY, + /* 2 */ SKYBOX_2, + /* 3 */ SKYBOX_3, + /* 5 */ SKYBOX_CUTSCENE_MAP = 5 +} SkyboxId; + +typedef struct SkyboxContext { + /* 0x000 */ View view; + /* 0x168 */ void* staticSegments[4]; + /* 0x178 */ void* paletteStaticSegment; + /* 0x17C */ Gfx (*dListBuf)[150]; + /* 0x180 */ Gfx* roomDL; + /* 0x184 */ Vtx* roomVtx; + /* 0x188 */ DmaRequest unk188; + /* 0x1A8 */ DmaRequest unk1A8; + /* 0x1C8 */ DmaRequest unk1C8; + /* 0x1E8 */ OSMesgQueue loadQueue; + /* 0x200 */ OSMesg loadMsg; + /* 0x204 */ s16 skyboxShouldDraw; + /* 0x208 */ Vec3f rot; + /* 0x214 */ Vec3f eye; + /* 0x220 */ s16 angle; + /* 0x222 */ Color_RGB8 prim; + /* 0x225 */ Color_RGB8 env; +} SkyboxContext; // size = 0x228 + +typedef struct struct_801C5F44 { + /* 0x00 */ s32 unk0; + /* 0x04 */ s32 unk4; + /* 0x08 */ s32 unk8; + /* 0x0C */ s32 unkC; + /* 0x10 */ s32 unk10; +} struct_801C5F44; // size = 0x14 + +s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8); +void func_80143148(SkyboxContext* skyboxCtx, s32 arg1); +void Skybox_Setup(struct GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId); +void func_80143324(struct PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId); +void Skybox_Init(struct GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId); +Mtx* Skybox_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z); +void Skybox_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB); +void Skybox_Draw(SkyboxContext* skyboxCtx, struct GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z); +void Skybox_Update(SkyboxContext* skyboxCtx); + +#endif diff --git a/include/z64snap.h b/include/z64snap.h index 4f9dca9d4..8bec78c3d 100644 --- a/include/z64snap.h +++ b/include/z64snap.h @@ -1,5 +1,5 @@ -#ifndef Z64_SNAP_H -#define Z64_SNAP_H +#ifndef Z64SNAP_H +#define Z64SNAP_H #include "PR/ultratypes.h" #include "z64actor.h" diff --git a/include/z64subs.h b/include/z64subs.h index ca90cb232..cc0e7ba2f 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -16,7 +16,7 @@ typedef enum { /* 2 */ SUBS_CUTSCENE_SET_FLAG } SubSCutsceneType; -//! @TODO: rename based on func_8013E748 and func_800B8500 +//! TODO: rename based on func_8013E748 and func_800B8500 typedef s32 (*func_8013E748_VerifyFunc)(struct PlayState*, Actor*, void*); typedef s32 (*VerifyActor)(struct PlayState*, Actor*, Actor*, void*); diff --git a/include/z64transition.h b/include/z64transition.h index 98720e9a7..741f344d7 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -1,14 +1,40 @@ -#ifndef Z64_TRANSITION_H -#define Z64_TRANSITION_H +#ifndef Z64TRANSITION_H +#define Z64TRANSITION_H #include "ultra64.h" - #include "overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h" #include "overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h" #include "overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h" #include "overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h" #include "overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h" +typedef enum { + /* 0 */ TRANS_TILE_OFF, // Inactive, do nothing + /* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers + /* 2 */ TRANS_TILE_PROCESS, // Initialize the transition + /* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame +} TransitionTileState; + +typedef struct { + /* 0x0 */ f32 x; + /* 0x4 */ f32 y; +} TransitionTileVtxData; // size = 0x8 + +typedef struct { + /* 0x00 */ s32 cols; + /* 0x04 */ s32 rows; + /* 0x08 */ s32 frame; + /* 0x0C */ TransitionTileVtxData* vtxData; + /* 0x10 */ Vtx* vtxFrame1; + /* 0x14 */ Vtx* vtxFrame2; + /* 0x18 */ Mtx projection; + /* 0x58 */ Mtx modelView; + /* 0x98 */ Mtx unk_98; + /* 0xD8 */ Gfx* gfx; // "gfxtbl" + /* 0xDC */ u16* zBuffer; +} TransitionTile; // size = 0xE0 + + #define TC_SET_PARAMS (1 << 7) typedef struct { @@ -39,14 +65,20 @@ typedef struct { /* 0x18 */ size_t size; } TransitionOverlay; -typedef struct { - /* 0x0 */ char unk_0[0xC]; -} TransitionFade; // size = 0xC - typedef enum { - /* 0 */ TRANSITION_CIRCLE_IN, - /* 1 */ TRANSITION_CIRCLE_OUT, -} TransitionCircleDirection; + /* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1, + /* 2 */ TRANS_INSTANCE_TYPE_FILL_IN, +} TransitionInstanceType; + +#define TRANS_INSTANCE_TYPE_FADE_FLASH 3 + +typedef struct { + /* 0x0 */ u8 type; + /* 0x1 */ u8 isDone; + /* 0x2 */ u8 direction; + /* 0x4 */ Color_RGBA8_u32 color; + /* 0x8 */ u16 timer; +} TransitionFade; // size = 0xC #define FBDEMO_CIRCLE_GET_MASK_TYPE(type) (type & 1) @@ -121,6 +153,7 @@ typedef enum { /* 22 */ TRANS_TYPE_WIPE5, // transition types 23 - 31 are unused // transition types 32 - 39 are Wipe4 TODO needs macro + /* 38 */ TRANS_TYPE_38 = 38, // transition types 40 - 63 are unused // transition types 64 - 127 are Wipe3 TODO needs macro /* 64 */ TRANS_TYPE_64 = 64, diff --git a/include/z_en_hy_code.h b/include/z_en_hy_code.h index 0620d35a0..1a2b7847e 100644 --- a/include/z_en_hy_code.h +++ b/include/z_en_hy_code.h @@ -1,5 +1,5 @@ -#ifndef Z_EN_HY_CODE_H -#define Z_EN_HY_CODE_H +#ifndef Z64ENHY_CODE_H +#define Z64ENHY_CODE_H #include "global.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" diff --git a/include/z_fireobj.h b/include/z_fireobj.h new file mode 100644 index 000000000..7bd58d80a --- /dev/null +++ b/include/z_fireobj.h @@ -0,0 +1,77 @@ +#ifndef Z_FIREOBJ_H +#define Z_FIREOBJ_H + +#include "ultra64.h" +#include "color.h" +#include "z64collision_check.h" +#include "z64light.h" +#include "z64math.h" + +struct PlayState; +struct Actor; + + +typedef struct FireObjInitParams { + /* 0x0 */ f32 size; + /* 0x4 */ f32 dynamicSizeStep; + /* 0x8 */ u8 state; + /* 0x9 */ u8 sizeGrowsCos2; + /* 0xA */ u8 colorsIndex; + /* 0xB */ u8 flags; + /* 0xC */ u8 lightParamsIndex; +} FireObjInitParams; // size = 0x10 + +typedef struct FireObjColors { + /* 0x0 */ Color_RGBA8 primColor; + /* 0x4 */ u8 lod; + /* 0x5 */ Color_RGB8 envColor; +} FireObjColors; // size = 0x8 + +typedef struct FireObjLightParams { + /* 0x0 */ s16 radius; + /* 0x2 */ Color_RGB8 color; + /* 0x5 */ Color_RGB8 maxColorAdj; +} FireObjLightParams; // size = 0x8 + +typedef struct FireObjLight { + /* 0x00 */ LightNode* light; + /* 0x04 */ LightInfo lightInfo; + /* 0x12 */ u8 lightParamsIndex; +} FireObjLight; // size = 0x14 + +typedef struct FireObj { + /* 0x00 */ Vec3f position; + /* 0x0C */ f32 size; + /* 0x10 */ f32 sizeInv; + /* 0x14 */ f32 xScale; + /* 0x18 */ f32 yScale; + /* 0x1C */ f32 dynamicSize; + /* 0x20 */ f32 dynamicSizeStep; + /* 0x24 */ u8 state; // @see FireState enum + /* 0x25 */ u8 sizeGrowsCos2; + /* 0x26 */ u8 timer; + /* 0x27 */ u8 colorsIndex; + /* 0x28 */ u8 flags; // @see FIRE_FLAG_ + /* 0x2A */ s16 ignitionDelay; + /* 0x2C */ ColliderCylinder collision; + /* 0x78 */ FireObjLight light; +} FireObj; // size = 0x8B + +typedef enum FireState { + /* 0 */ FIRE_STATE_GROWING, + /* 1 */ FIRE_STATE_SHRINKING, + /* 2 */ FIRE_STATE_FULLY_LIT, + /* 3 */ FIRE_STATE_NOT_LIT, +} FireState; + +#define FIRE_FLAG_WATER_EXTINGUISHABLE (1 << 0) +#define FIRE_FLAG_INTERACT_STICK (1 << 1) + +void FireObj_SetPosition(FireObj* fire, Vec3f* pos); +void FireObj_Draw(struct PlayState* play, FireObj* fire); +void FireObj_Init(struct PlayState* play, FireObj* fire, FireObjInitParams* init, struct Actor* actor); +void FireObj_Destroy(struct PlayState* play, FireObj* fire); +void FireObj_SetState2(FireObj* fire, f32 dynamicSizeStep, u8 newState); +void FireObj_Update(struct PlayState* play, FireObj* fire, struct Actor* actor); + +#endif diff --git a/include/z_prenmi.h b/include/z_prenmi.h index 1aa1e6f99..04c3f5f16 100644 --- a/include/z_prenmi.h +++ b/include/z_prenmi.h @@ -1,5 +1,5 @@ -#ifndef Z64_PRENMI_H -#define Z64_PRENMI_H +#ifndef Z64PRENMI_H +#define Z64PRENMI_H #include "global.h" diff --git a/include/z_title_setup.h b/include/z_title_setup.h index 41e3f52f8..3b299af97 100644 --- a/include/z_title_setup.h +++ b/include/z_title_setup.h @@ -1,5 +1,5 @@ -#ifndef Z64_TITLE_SETUP_H -#define Z64_TITLE_SETUP_H +#ifndef Z64TITLE_SETUP_H +#define Z64TITLE_SETUP_H #include "global.h" diff --git a/spec b/spec index 5db19f145..9b8ec1486 100644 --- a/spec +++ b/spec @@ -458,12 +458,9 @@ beginseg include "build/src/code/z_debug.o" include "build/src/code/z_debug_display.o" include "build/src/code/z_debug_mode.o" - include "build/data/code/z_debug_mode.data.o" - include "build/data/code/z_debug_mode.bss.o" include "build/src/code/z_demo.o" include "build/src/code/z_draw.o" include "build/src/code/z_eff_footmark.o" - include "build/data/code/z_eff_footmark.data.o" include "build/src/code/z_sound_source.o" include "build/src/code/z_elf_message.o" include "build/src/code/z_en_hy_code.o" @@ -508,12 +505,11 @@ beginseg include "build/src/code/z_rcp.o" pad_text include "build/src/code/z_room.o" - include "build/data/code/z_room.data.o" include "build/src/code/code_8012EC80.o" pad_text include "build/data/code/code_801C2410.data.o" include "build/src/code/z_scene.o" - include "build/data/code/code_801C2730.data.o" + include "build/src/code/object_table.o" include "build/src/code/z_scene_proc.o" include "build/src/code/z_scene_table.o" include "build/src/code/z_schedule.o" @@ -549,7 +545,6 @@ beginseg include "build/src/code/z_kaleido_scope_call.o" include "build/src/code/z_fbdemo_dlftbls.o" include "build/src/code/z_fbdemo.o" - include "build/data/code/z_fbdemo.data.o" include "build/src/code/z_fbdemo_fade.o" include "build/src/code/z_fbdemo_circle.o" include "build/src/code/z_overlay.o" @@ -560,8 +555,8 @@ beginseg include "build/data/code/PreRender.bss.o" include "build/src/code/TwoHeadGfxArena.o" include "build/src/code/TwoHeadArena.o" - include "build/src/code/code_80172BC0.o" - include "build/src/code/audioMgr.o" + include "build/src/code/audio_stop_all_sfx.o" + include "build/src/code/audio_thread_manager.o" include "build/src/code/title_setup.o" include "build/src/code/game.o" include "build/data/code/game.bss.o" @@ -602,34 +597,33 @@ beginseg pad_text pad_text pad_text - include "build/src/code/audio/audio_data.o" - include "build/src/code/audio/audio_synthesis.o" - include "build/src/code/audio/audio_heap.o" + include "build/src/audio/lib/data.o" + include "build/src/audio/lib/synthesis.o" + include "build/src/audio/lib/heap.o" include "build/data/code/audio_heap.bss.o" - include "build/src/code/audio/audio_load.o" - include "build/src/code/audio/audio_thread.o" - include "build/src/code/audio/audio_dcache.o" - include "build/src/code/audio/aisetnextbuf.o" - include "build/src/code/audio/audio_playback.o" - include "build/src/code/audio/audio_effects.o" - include "build/src/code/audio/audio_seqplayer.o" + include "build/src/audio/lib/load.o" + include "build/src/audio/lib/thread.o" + include "build/src/audio/lib/dcache.o" + include "build/src/audio/lib/aisetnextbuf.o" + include "build/src/audio/lib/playback.o" + include "build/src/audio/lib/effects.o" + include "build/src/audio/lib/seqplayer.o" include "build/data/code/audio_dramStack.data.o" include "build/asm/code/code_8019AE40.text.o" // handwritten pad_text include "build/asm/code/code_8019AEC0.text.o" // handwritten - include "build/src/code/audio/code_8019AF00.o" - include "build/src/code/audio/code_801A4EB0.o" - include "build/data/code/code_801A4EB0.data.o" - include "build/src/code/audio/code_801A51F0.o" - include "build/data/code/code_801A51F0.data.o" - include "build/data/code/code_801A51F0.bss.o" + include "build/src/audio/code_8019AF00.o" + include "build/src/audio/voice_external.o" + include "build/data/code/voice_external.data.o" + include "build/src/audio/voice_internal.o" + include "build/data/code/voice_internal.data.o" + include "build/data/code/voice_internal.bss.o" pad_text - include "build/src/code/audio/audio_sfx_params.o" - include "build/src/code/audio/code_801A5BD0.o" - include "build/src/code/audio/code_801A7B10.o" - include "build/data/code/code_801A7B10.data.o" - include "build/data/code/code_801A7B10.bss.o" - include "build/src/code/audio/audio_init_params.o" + include "build/src/audio/sfx_params.o" + include "build/src/audio/sfx.o" + include "build/src/audio/sequence.o" + include "build/data/code/sequence.bss.o" + include "build/src/audio/session_config.o" include "build/src/code/jpegutils.o" include "build/src/code/jpegdecoder.o" include_data_with_rodata "build/src/code/z_game_over.o" @@ -963,8 +957,7 @@ beginseg name "ovl_En_Dekubaba" compress include "build/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.o" - include "build/data/ovl_En_Dekubaba/ovl_En_Dekubaba.data.o" - include "build/data/ovl_En_Dekubaba/ovl_En_Dekubaba.reloc.o" + include "build/src/overlays/actors/ovl_En_Dekubaba/ovl_En_Dekubaba_reloc.o" endseg beginseg @@ -1006,7 +999,8 @@ beginseg name "ovl_Item_B_Heart" compress include "build/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.o" - include "build/src/overlays/actors/ovl_Item_B_Heart/ovl_Item_B_Heart_reloc.o" + include "build/data/ovl_Item_B_Heart/ovl_Item_B_Heart.data.o" + include "build/data/ovl_Item_B_Heart/ovl_Item_B_Heart.reloc.o" endseg beginseg @@ -1041,7 +1035,8 @@ beginseg name "ovl_Bg_Keikoku_Spr" compress include "build/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.o" - include "build/src/overlays/actors/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr_reloc.o" + include "build/data/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr.data.o" + include "build/data/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr.reloc.o" endseg beginseg @@ -1977,8 +1972,7 @@ beginseg name "ovl_En_Si" compress include "build/src/overlays/actors/ovl_En_Si/z_en_si.o" - include "build/data/ovl_En_Si/ovl_En_Si.data.o" - include "build/data/ovl_En_Si/ovl_En_Si.reloc.o" + include "build/src/overlays/actors/ovl_En_Si/ovl_En_Si_reloc.o" endseg beginseg @@ -2121,7 +2115,8 @@ beginseg name "ovl_Door_Spiral" compress include "build/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.o" - include "build/src/overlays/actors/ovl_Door_Spiral/ovl_Door_Spiral_reloc.o" + include "build/data/ovl_Door_Spiral/ovl_Door_Spiral.data.o" + include "build/data/ovl_Door_Spiral/ovl_Door_Spiral.reloc.o" endseg beginseg @@ -2149,7 +2144,8 @@ beginseg name "ovl_Obj_Boyo" compress include "build/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.o" - include "build/src/overlays/actors/ovl_Obj_Boyo/ovl_Obj_Boyo_reloc.o" + include "build/data/ovl_Obj_Boyo/ovl_Obj_Boyo.data.o" + include "build/data/ovl_Obj_Boyo/ovl_Obj_Boyo.reloc.o" endseg beginseg @@ -3340,7 +3336,8 @@ beginseg name "ovl_Bg_Lotus" compress include "build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o" - include "build/src/overlays/actors/ovl_Bg_Lotus/ovl_Bg_Lotus_reloc.o" + include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.data.o" + include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.reloc.o" endseg beginseg @@ -3427,8 +3424,7 @@ beginseg name "ovl_En_Stop_heishi" compress include "build/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.o" - include "build/data/ovl_En_Stop_heishi/ovl_En_Stop_heishi.data.o" - include "build/data/ovl_En_Stop_heishi/ovl_En_Stop_heishi.reloc.o" + include "build/src/overlays/actors/ovl_En_Stop_heishi/ovl_En_Stop_heishi_reloc.o" endseg beginseg @@ -3600,7 +3596,8 @@ beginseg name "ovl_Bg_Tobira01" compress include "build/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.o" - include "build/src/overlays/actors/ovl_Bg_Tobira01/ovl_Bg_Tobira01_reloc.o" + include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.data.o" + include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.reloc.o" endseg beginseg @@ -3818,7 +3815,9 @@ beginseg name "ovl_En_Invadepoh" compress include "build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o" - include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.data.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.bss.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.reloc.o" endseg beginseg @@ -4022,8 +4021,7 @@ beginseg name "ovl_En_Ge2" compress include "build/src/overlays/actors/ovl_En_Ge2/z_en_ge2.o" - include "build/data/ovl_En_Ge2/ovl_En_Ge2.data.o" - include "build/data/ovl_En_Ge2/ovl_En_Ge2.reloc.o" + include "build/src/overlays/actors/ovl_En_Ge2/ovl_En_Ge2_reloc.o" endseg beginseg diff --git a/src/code/audio/code_8019AF00.c b/src/audio/code_8019AF00.c similarity index 94% rename from src/code/audio/code_8019AF00.c rename to src/audio/code_8019AF00.c index 801e2b076..5af712e99 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -70,7 +70,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); void Audio_StartMorningSceneSequence(u16 seqId); void Audio_StartSceneSequence(u16 seqId); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void func_801A4428(u8 reverbIndex); void func_801A3038(void); void Audio_PlayAmbience(u8 ambienceId); @@ -2734,8 +2734,7 @@ void AudioOcarina_SetOcarinaDisableTimer(u8 unused, u8 timer) { void AudioOcarina_SetInstrument(u8 ocarinaInstrumentId) { if ((sOcarinaInstrumentId != ocarinaInstrumentId) || (ocarinaInstrumentId == OCARINA_INSTRUMENT_DEFAULT)) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | - ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(ocarinaInstrumentId)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_SFX, SFX_CHANNEL_OCARINA, 1, ocarinaInstrumentId); sOcarinaInstrumentId = ocarinaInstrumentId; if (ocarinaInstrumentId == OCARINA_INSTRUMENT_OFF) { @@ -3303,7 +3302,10 @@ s32 AudioOcarina_MemoryGameNextNote(void) { sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].length = 0; sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].pitch = OCARINA_PITCH_NONE; sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].length = 0; + + //! FAKE: if (1) {} + return false; } #undef OCARINA_SONG_MEMORY_GAME @@ -3407,8 +3409,7 @@ void AudioOcarina_SetCustomSequence(void) { // Called by unused function void AudioOcarina_PlayCustomSequence(void) { sRequestCustomSequence = true; - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | - (u32)(NA_BGM_DUNGEON_APPEAR)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, NA_BGM_DUNGEON_APPEAR); } // Unused @@ -3586,8 +3587,7 @@ s32 AudioOcarina_CreateCustomSequence(void) { void AudioOcarina_ResetInstrument(void) { if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | - ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(0)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_SFX, SFX_CHANNEL_OCARINA, 1, 0); sOcarinaInstrumentId = OCARINA_INSTRUMENT_OFF; AudioOcarina_ResetAndMute(); } @@ -3629,7 +3629,7 @@ void Audio_Noop3(void) { } void Audio_Update(void) { - if ((func_801A9768() == 0) && (func_801A982C() == 0)) { + if ((AudioSeq_UpdateAudioHeapReset() == 0) && !AudioSeq_ResetReverb()) { AudioOcarina_SetCustomSequence(); AudioOcarina_Update(); func_801A5118(); @@ -3646,9 +3646,9 @@ void Audio_Update(void) { func_801A1290(); Audio_ResetRequestedSceneSeqId(); AudioSfx_ProcessRequests(); - func_801A89D0(); + AudioSeq_ProcessSeqCmds(); AudioSfx_ProcessActiveSfx(); - func_801A8D5C(); + AudioSeq_UpdateActiveSequences(); AudioSfx_ProcessSfxSettings(); AudioThread_ScheduleProcessCmds(); } @@ -3660,7 +3660,14 @@ void Audio_Noop4(s32 arg0) { void Audio_Noop5(s32 arg0, s32 arg1) { } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E110.s") +/** + * Queues a bgm sequence directly to the internal audio queue system. + * Skips the external audio command process + * Unused + */ +void Audio_PlayMainBgm(s8 seqId) { + AUDIOCMD_GLOBAL_INIT_SEQPLAYER(SEQ_PLAYER_BGM_MAIN, (u8)seqId, 1); +} f32 AudioSfx_ComputeVolume(u8 bankId, u8 entryIndex) { SfxBankEntry* bankEntry = &gSfxBanks[bankId][entryIndex]; @@ -4290,13 +4297,23 @@ f32 sBigBellsVolume[8] = { }; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0124.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0184.s") +void Audio_SetBgmVolumeOff(void) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_FANFARE, 0, 10); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A01C4.s") +void Audio_SetBgmVolumeOn(void) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0x7F, 3); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_FANFARE, 0x7F, 3); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0204.s") +void func_801A0204(s8 seqId) { + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_BGM_MAIN, 2, (u8)seqId); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0238.s") +void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, targetVolume, volumeFadeTimer); +} /** * Unused remnant from OoT's EnRiverSound @@ -4338,7 +4355,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { if (sGanonsTowerVol != targetVolume) { // Sets the volume - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, targetVolume, 2); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, targetVolume, 2); // Sets the filter cutoff of the form (lowPassFilterCutoff << 4) | (highPassFilter & 0xF). highPassFilter is // always set to 0 @@ -4350,8 +4367,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { lowPassFilterCutoff = (((targetVolume - 0x40) >> 2) + 1) << 4; } - Audio_QueueSeqCmd((8 << 28) | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u8)(4) << 16) | ((u8)(15) << 8) | - (u8)(lowPassFilterCutoff)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_BGM_MAIN, 15, 4, lowPassFilterCutoff); // Sets the reverb for (channelIndex = 0; channelIndex < ARRAY_COUNT(gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels); @@ -4399,14 +4415,14 @@ void Audio_UpdateRiverSoundVolumes(void) { if (sRiverSoundMainBgmLower == true) { if (sRiverSoundMainBgmCurrentVol != sRiverSoundMainBgmVol) { // lowers the volume for 1 frame - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, sRiverSoundMainBgmVol, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, sRiverSoundMainBgmVol, 10); sRiverSoundMainBgmCurrentVol = sRiverSoundMainBgmVol; sRiverSoundMainBgmRestore = true; } sRiverSoundMainBgmLower = false; } else if ((sRiverSoundMainBgmRestore == true) && !sAudioIsWindowOpen) { // restores the volume every frame - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, 0x7F, 10); sRiverSoundMainBgmCurrentVol = 0x7F; sRiverSoundMainBgmRestore = false; } @@ -4488,10 +4504,9 @@ void func_801A09D4(Vec3f* pos, f32 xzDistToPlayer) { volumeRel = ((1.0f - ((sRiverSoundXZDistToPlayer - 120.0f) / 280.0f)) * 0.9f) + 0.1f; } - for (channelIndex = 0; channelIndex < 16; channelIndex++) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { if (channelIndex != 9) { - Audio_QueueSeqCmd(((u32)(6) << 28) | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 16) | - ((u32)(channelIndex) << 8) | ((u8)(127.0f * volumeRel))); + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, channelIndex, 2, (u8)(127.0f * volumeRel)); AUDIOCMD_CHANNEL_SET_PAN(SEQ_PLAYER_BGM_MAIN, channelIndex, pan); } } @@ -4527,8 +4542,8 @@ void Audio_SplitBgmChannels(s8 volumeSplit) { u8 i; u8 channelIndex; - if ((Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { for (i = 0; i < ARRAY_COUNT(sBgmPlayers); i++) { if (i == 0) { // Main Bgm SeqPlayer @@ -4556,7 +4571,7 @@ void Audio_SplitBgmChannels(s8 volumeSplit) { } } - Audio_QueueSeqCmd(0xA0000000 | ((u32)(sBgmPlayers[i]) << 24) | ((u32)(channelBits))); + SEQCMD_SET_CHANNEL_DISABLE_MASK(sBgmPlayers[i], channelBits); } } } @@ -4635,8 +4650,8 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { Audio_SplitBgmChannels(targetVolume); } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, targetVolume, 0); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - targetVolume, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, targetVolume, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F - targetVolume, 0); } /** @@ -4650,12 +4665,12 @@ void Audio_ClearSariaBgm2(void) { void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne) { Audio_StartMorningSceneSequence(seqId); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | (u32)(dayMinusOne)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 4, dayMinusOne); } void Audio_StartMorningSceneSequence(u16 seqId) { if (seqId != NA_BGM_AMBIENCE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_AMBIENCE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0); Audio_StartSceneSequence(seqId); Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); } else { @@ -4669,8 +4684,7 @@ void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne) { Audio_PlayAmbience(AMBIENCE_ID_08); } else if ((seqId != NA_BGM_FINAL_HOURS) || (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { Audio_StartSceneSequence(seqId); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | - (u32)(dayMinusOne)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 4, dayMinusOne); } sRequestedSceneSeqId = seqId; } @@ -4710,7 +4724,7 @@ void Audio_StartSceneSequence(u16 seqId) { } void Audio_UpdateSceneSequenceResumePoint(void) { - u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) { @@ -4723,55 +4737,95 @@ void Audio_UpdateSceneSequenceResumePoint(void) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A27E8.s") +// Unused +void Audio_PlayBgmForSongOfStorms(void) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_SONG_OF_STORMS) { + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_SONG_OF_STORMS | SEQ_FLAG_ASYNC); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A281C.s") +/** + * Specifically for SEQ_PLAYER_BGM_MAIN + */ +void Audio_ScaleTempoAndFreqForMainBgm(f32 freqTempoScale, u8 duration) { + if (freqTempoScale == 1.0f) { + SEQCMD_RESET_TEMPO(SEQ_PLAYER_BGM_MAIN, duration); + } else { + SEQCMD_SCALE_TEMPO(SEQ_PLAYER_BGM_MAIN, duration, freqTempoScale * 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A29D4.s") + SEQCMD_SET_SEQPLAYER_FREQ(SEQ_PLAYER_BGM_MAIN, duration, freqTempoScale * 1000.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2BB8.s") +void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration) { + if (freqTempoScale == 1.0f) { + SEQCMD_RESET_TEMPO(seqPlayerIndex, duration); + } else { + SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, freqTempoScale * 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C20.s") + SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqTempoScale * 1000.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C44.s") +void Audio_PlaySubBgm(u16 seqId) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0, seqId); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0, 5); + + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(SEQ_PLAYER_BGM_SUB, SEQ_PLAYER_BGM_MAIN, 3, 10); + SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, SEQ_PLAYER_BGM_MAIN, 0); +} + +void Audio_StopSubBgm(void) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0); +} + +// Unused remnant of OoT +void Audio_IncreaseTempoForTimedMinigame(void) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_TIMED_MINI_GAME) && + AudioSeq_IsSeqCmdNotQueued(SEQCMD_OP_PLAY_SEQUENCE << 28, SEQCMD_OP_MASK)) { + // Set tempo to be higher than the default tempo for th timed mini-game sequence + SEQCMD_SET_TEMPO(SEQ_PLAYER_BGM_MAIN, 5, 210); + } +} void Audio_PlaySequenceInCutscene(u16 seqId) { if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { Audio_PlayFanfare(seqId); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, seqId); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0, seqId); } else { Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, SEQ_IO_VAL_NONE); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0); - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0x7F, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } } void Audio_StopSequenceInCutscene(u16 seqId) { if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0); } else { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); } } s32 Audio_IsSequencePlaying(u8 seqId) { - u8 playerIndex = SEQ_PLAYER_BGM_MAIN; + u8 seqPlayerIndex = SEQ_PLAYER_BGM_MAIN; if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE) { - playerIndex = SEQ_PLAYER_FANFARE; + seqPlayerIndex = SEQ_PLAYER_FANFARE; } else if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - playerIndex = SEQ_PLAYER_FANFARE; + seqPlayerIndex = SEQ_PLAYER_FANFARE; } - if (seqId == (Audio_GetActiveSequence(playerIndex) & 0xFF)) { + if (seqId == (AudioSeq_GetActiveSeqId(seqPlayerIndex) & 0xFF)) { return true; } else { return false; @@ -4779,7 +4833,7 @@ s32 Audio_IsSequencePlaying(u8 seqId) { } void Audio_PlayBgm_StorePrevBgm(u16 seqId) { - u16 curSeqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 curSeqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if (curSeqId == NA_BGM_DISABLED) { curSeqId = NA_BGM_GENERAL_SFX; @@ -4793,7 +4847,7 @@ void Audio_PlayBgm_StorePrevBgm(u16 seqId) { sPrevMainBgmSeqId = curSeqId; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | (u32)(seqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, seqId + SEQ_FLAG_ASYNC); } } @@ -4801,16 +4855,15 @@ void Audio_PlayBgm_StorePrevBgm(u16 seqId) { * To be used in conjunction with Audio_PlayBgm_StorePrevBgm */ void Audio_RestorePrevBgm(void) { - if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && - (sSeqFlags[Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && + (sSeqFlags[AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) || (sPrevMainBgmSeqId == NA_BGM_GENERAL_SFX)) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); } else { if (sPrevMainBgmSeqId == NA_BGM_AMBIENCE) { sPrevMainBgmSeqId = sPrevAmbienceSeqId; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | - (u32)(sPrevMainBgmSeqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId + SEQ_FLAG_ASYNC); } sPrevMainBgmSeqId = NA_BGM_DISABLED; } @@ -4818,7 +4871,7 @@ void Audio_RestorePrevBgm(void) { // Unused void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { - u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if (seqId != NA_BGM_AMBIENCE) { sPrevMainBgmSeqId = seqId; @@ -4830,8 +4883,7 @@ void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { // Unused void Audio_ForceRestorePreviousBgm(void) { if (sPrevMainBgmSeqId != NA_BGM_DISABLED) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | - (u32)(sPrevMainBgmSeqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId + SEQ_FLAG_ASYNC); } sPrevMainBgmSeqId = NA_BGM_DISABLED; @@ -4847,16 +4899,16 @@ void Audio_ForceRestorePreviousBgm(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A31EC.s") -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { u16 flaggedSeqId; - Audio_QueueSeqCmd(0x70000000 | ((u32)(playerIndex) << 24) | ((u32)(ioPort) << 0x10) | (u32)(ioData)); + SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData); if ((seqId & 0xFF) < 2) { flaggedSeqId = seqId; } else { flaggedSeqId = seqId | 0x8000; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(playerIndex) << 24) | ((u32)(fadeInDuration) << 0x10) | (u32)(flaggedSeqId)); + SEQCMD_PLAY_SEQUENCE((u32)seqPlayerIndex, fadeInDuration, flaggedSeqId); } void Audio_SetSequenceMode(u8 seqMode) { @@ -4884,17 +4936,18 @@ void Audio_SetSequenceMode(u8 seqMode) { volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume; } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, volumeFadeInTimer); - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | - (u32)(NA_BGM_ENEMY | 0x800)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume, + volumeFadeInTimer); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); if (seqId >= NA_BGM_TERMINA_FIELD) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - sBgmEnemyVolume, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F - sBgmEnemyVolume, + 10); Audio_SplitBgmChannels(sBgmEnemyVolume); } } else if ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY) { // If only sPrevSeqMode = SEQ_MODE_ENEMY (End) - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((10) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10); if (seqMode == SEQ_MODE_IGNORE) { volumeFadeOutTimer = 0; @@ -4902,7 +4955,7 @@ void Audio_SetSequenceMode(u8 seqMode) { volumeFadeOutTimer = 10; } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, volumeFadeOutTimer); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, volumeFadeOutTimer); Audio_SplitBgmChannels(0); } @@ -4910,10 +4963,9 @@ void Audio_SetSequenceMode(u8 seqMode) { } else { if (seqMode == SEQ_MODE_ENEMY) { // If both seqMode = sPrevSeqMode = SEQ_MODE_ENEMY - if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && (seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_ENEMY)) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | - (u32)(NA_BGM_ENEMY | 0x800)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); sPrevSeqMode = seqMode + 0x80; } } @@ -4935,7 +4987,7 @@ void Audio_SetSequenceMode(u8 seqMode) { } sPrevSeqMode = seqMode; - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 0x10) | (u32)(seqMode)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 2, seqMode); } } } @@ -4956,10 +5008,10 @@ void Audio_UpdateEnemyBgmVolume(f32 dist) { } sBgmEnemyVolume = ((350.0f - adjDist) * 127.0f) / 350.0f; - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume, 10); if ((seqId >= NA_BGM_TERMINA_FIELD) && !(sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO)) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sBgmEnemyVolume), 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, (0x7F - sBgmEnemyVolume), 10); } } @@ -5032,7 +5084,8 @@ void Audio_ResetRequestedSceneSeqId(void) { sRequestedSceneSeqId = NA_BGM_DISABLED; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44D4.s") +void Audio_ResetData(void); +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_ResetData.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A46F8.s") @@ -5046,13 +5099,15 @@ void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { u8 lastChannelIndex; u8 channelIndex; - if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && func_801A8ABC(NA_BGM_AMBIENCE, 0xF00000FF)) { + if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && + AudioSeq_IsSeqCmdNotQueued((SEQCMD_OP_PLAY_SEQUENCE << 28) | NA_BGM_AMBIENCE, + SEQCMD_OP_MASK | SEQCMD_SEQID_MASK)) { return; } // channelIndexRange = 01 on ioPort 1 if ((((channelIndexRange << 8) + (u32)ioPort) == ((1 << 8) | (u32)1)) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { D_801FD3A8 = 0; } @@ -5064,38 +5119,33 @@ void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { } for (channelIndex = firstChannelIndex; channelIndex <= lastChannelIndex; channelIndex++) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | - ((u32)(channelIndex) << 8) | (u32)(ioData)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, ioPort, ioData); } } void Audio_StartAmbience(u16 initChannelMask, u16 initMuteChannelMask) { u8 channelIndex; - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_0) << 0x10) | - (u32)(1)); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_4) << 0x10) | - (u32)((u8)(initChannelMask >> 8))); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_5) << 0x10) | - (u32)((u8)(initChannelMask & 0xFF))); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_0, 1); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_4, (u8)(initChannelMask >> 8)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_5, (u8)(initChannelMask & 0xFF)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, 0x7F, 1); - if ((Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && - (Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { - Audio_StopSequence(SEQ_PLAYER_AMBIENCE, 0); + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { + AudioSeq_StopSequence(SEQ_PLAYER_AMBIENCE, 0); AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); } - if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 1); + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 1); } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(0) << 0x10) | (u32)(NA_BGM_AMBIENCE)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0, NA_BGM_AMBIENCE); - for (channelIndex = 0; channelIndex < 16; channelIndex++) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { if (!(initMuteChannelMask & (1 << channelIndex)) && (initChannelMask & (1 << channelIndex))) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_1) << 16) | - ((u32)(channelIndex) << 8) | (u32)(1)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, CHANNEL_IO_PORT_1, 1); } } } @@ -5119,12 +5169,10 @@ void Audio_PlayAmbience(u8 ambienceId) { channelIndex = sAmbienceData[ambienceId].channelProperties[i++]; ioPort = sAmbienceData[ambienceId].channelProperties[i++]; ioData = sAmbienceData[ambienceId].channelProperties[i++]; - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | - ((u32)(channelIndex) << 8) | (u32)(ioData)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, ioPort, ioData); } - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_7) << 16) | - ((u32)(AMBIENCE_CHANNEL_SOUND_MODE) << 8) | (u32)(sSoundMode)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, AMBIENCE_CHANNEL_SOUND_MODE, CHANNEL_IO_PORT_7, sSoundMode); } } @@ -5155,7 +5203,7 @@ void AudioSfx_Init(u16 fadeTimer) { u8 channelIndex; AudioThread_ScheduleProcessCmds(); - Audio_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0x70, fadeTimer); + AudioSeq_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0x70, fadeTimer); for (channelIndex = 0; channelIndex < ARRAY_COUNT(sSfxChannelState); channelIndex++) { AUDIOCMD_CHANNEL_SET_SFX_STATE(SEQ_PLAYER_SFX, channelIndex, &sSfxChannelState[channelIndex]); @@ -5165,12 +5213,52 @@ void AudioSfx_Init(u16 fadeTimer) { AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(AUDIO_CUSTOM_FUNCTION_SEQ_1, Audio_SetAmbienceRandomBend); } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D00.s") +void Audio_InitSound(void) { + Audio_ResetData(); + AudioOcarina_ResetStaffs(); + AudioSfx_ResetSfxChannelState(); + AudioSeq_ResetActiveSequencesAndVolume(); + AudioSfx_Reset(); + AudioVoice_ResetData(); + AudioSfx_Init(10); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D50.s") +void Audio_ResetForAudioHeapStep3(void) { + AudioSfx_Init(1); + AUDIOCMD_GLOBAL_UNMUTE(AUDIOCMD_ALL_SEQPLAYERS, true); + AudioThread_ScheduleProcessCmds(); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + sIsFinalHoursOrSoaring = false; + sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX; + sMuteOnlySfxAndAmbienceSeq = false; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4DA4.s") +void Audio_ResetForAudioHeapStep2(void) { + Audio_ResetForAudioHeapStep3(); + if (gAudioSpecId < ARRAY_COUNT(gReverbSettingsTable)) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA(1, REVERB_DATA_TYPE_SETTINGS, &gReverbSettingsTable[gAudioSpecId][1]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4DF4.s") +void Audio_ResetForAudioHeapStep1(s32 specId) { + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_RESETTING; + Audio_ResetData(); + AudioOcarina_ResetStaffs(); + AudioSfx_ResetSfxChannelState(); + AudioSeq_ResetActiveSequences(); + AudioSfx_Reset(); + func_801A4FD8(); + if (gAudioSpecId == 0xB) { + AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | + (1 << BANK_OCARINA) | (1 << BANK_VOICE)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4E64.s") +void Audio_UnusedReset(void) { + AudioSeq_ResetActiveSequences(); + AUDIOCMD_GLOBAL_UNMUTE(AUDIOCMD_ALL_SEQPLAYERS, true); + Audio_ResetData(); + AudioSfx_ResetSfxChannelState(); + AudioSfx_Init(1); + func_801A4FD8(); +} diff --git a/src/code/audio/aisetnextbuf.c b/src/audio/lib/aisetnextbuf.c similarity index 100% rename from src/code/audio/aisetnextbuf.c rename to src/audio/lib/aisetnextbuf.c diff --git a/src/code/audio/audio_data.c b/src/audio/lib/data.c similarity index 100% rename from src/code/audio/audio_data.c rename to src/audio/lib/data.c diff --git a/src/code/audio/audio_dcache.c b/src/audio/lib/dcache.c similarity index 100% rename from src/code/audio/audio_dcache.c rename to src/audio/lib/dcache.c diff --git a/src/code/audio/audio_effects.c b/src/audio/lib/effects.c similarity index 99% rename from src/code/audio/audio_effects.c rename to src/audio/lib/effects.c index 0dcdcda88..feddf73ca 100644 --- a/src/code/audio/audio_effects.c +++ b/src/audio/lib/effects.c @@ -64,7 +64,7 @@ void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer) { seqPlayer->fadeTimer--; if ((seqPlayer->fadeTimer == 0) && (seqPlayer->state == SEQPLAYER_STATE_FADE_OUT)) { - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); return; } } diff --git a/src/code/audio/audio_heap.c b/src/audio/lib/heap.c similarity index 99% rename from src/code/audio/audio_heap.c rename to src/audio/lib/heap.c index d767f7de3..0a64c0d1b 100644 --- a/src/code/audio/audio_heap.c +++ b/src/audio/lib/heap.c @@ -86,7 +86,7 @@ void AudioHeap_DiscardFont(s32 fontId) { AudioPlayback_NoteDisable(note); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, ¬e->listItem); + AudioScript_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, ¬e->listItem); } } } @@ -113,7 +113,7 @@ void AudioHeap_DiscardSequence(s32 seqId) { for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) { if (gAudioCtx.seqPlayers[i].enabled && gAudioCtx.seqPlayers[i].seqId == seqId) { - AudioSeq_SequencePlayerDisable(&gAudioCtx.seqPlayers[i]); + AudioScript_SequencePlayerDisable(&gAudioCtx.seqPlayers[i]); } } } @@ -857,7 +857,7 @@ s32 AudioHeap_ResetStep(void) { switch (gAudioCtx.resetStatus) { case 5: for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) { - AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[i]); + AudioScript_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[i]); } gAudioCtx.audioResetFadeOutFramesLeft = 2 / count; gAudioCtx.resetStatus--; @@ -1059,10 +1059,10 @@ void AudioHeap_Init(void) { } // Initialize sequence players - AudioSeq_InitSequencePlayers(); + AudioScript_InitSequencePlayers(); for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) { - AudioSeq_InitSequencePlayerChannels(i); - AudioSeq_ResetSequencePlayer(&gAudioCtx.seqPlayers[i]); + AudioScript_InitSequencePlayerChannels(i); + AudioScript_ResetSequencePlayer(&gAudioCtx.seqPlayers[i]); } // Initialize two additional caches on the audio heap to store individual audio samples diff --git a/src/code/audio/audio_load.c b/src/audio/lib/load.c similarity index 99% rename from src/code/audio/audio_load.c rename to src/audio/lib/load.c index 28c27d2cc..3a4f1c1e0 100644 --- a/src/code/audio/audio_load.c +++ b/src/audio/lib/load.c @@ -11,6 +11,7 @@ */ #include "global.h" +#include "buffers.h" /** * SoundFont Notes: @@ -583,7 +584,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) { return 0; } - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); if (1) {} fontId = 0xFF; @@ -601,7 +602,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) { return 0; } - AudioSeq_ResetSequencePlayer(seqPlayer); + AudioScript_ResetSequencePlayer(seqPlayer); seqPlayer->seqId = seqId; if (fontId != 0xFF) { diff --git a/src/code/audio/audio_playback.c b/src/audio/lib/playback.c similarity index 97% rename from src/code/audio/audio_playback.c rename to src/audio/lib/playback.c index 9f3c6f8ed..deb6e82b9 100644 --- a/src/code/audio/audio_playback.c +++ b/src/audio/lib/playback.c @@ -189,7 +189,7 @@ void AudioPlayback_ProcessNotes(void) { (playbackState->priority >= 1)) { // do nothing } else if (playbackState->parentLayer->channel->seqPlayer == NULL) { - AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel); + AudioScript_SequenceChannelDisable(playbackState->parentLayer->channel); playbackState->priority = 1; playbackState->status = PLAYBACK_STATUS_1; continue; @@ -224,13 +224,13 @@ void AudioPlayback_ProcessNotes(void) { AudioEffects_NoteVibratoInit(note); AudioEffects_NotePortamentoInit(note); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem); + AudioScript_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem); playbackState->wantedParentLayer = NO_LAYER; // don't skip } else { AudioPlayback_NoteDisable(note); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); + AudioScript_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); playbackState->wantedParentLayer = NO_LAYER; goto skip; } @@ -240,7 +240,7 @@ void AudioPlayback_ProcessNotes(void) { } AudioPlayback_NoteDisable(note); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); + AudioScript_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); continue; } } @@ -250,7 +250,7 @@ void AudioPlayback_ProcessNotes(void) { } AudioPlayback_NoteDisable(note); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); + AudioScript_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); continue; } @@ -669,7 +669,7 @@ void AudioPlayback_InitNoteFreeList(void) { for (i = 0; i < gAudioCtx.numNotes; i++) { gAudioCtx.notes[i].listItem.u.value = &gAudioCtx.notes[i]; gAudioCtx.notes[i].listItem.prev = NULL; - AudioSeq_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, &gAudioCtx.notes[i].listItem); + AudioScript_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, &gAudioCtx.notes[i].listItem); } } @@ -708,7 +708,7 @@ void AudioPlayback_NotePoolClear(NotePool* pool) { break; } AudioPlayback_AudioListRemove(cur); - AudioSeq_AudioListPushBack(dest, cur); + AudioScript_AudioListPushBack(dest, cur); } } } @@ -750,11 +750,11 @@ void AudioPlayback_NotePoolFill(NotePool* pool, s32 count) { } while (j < count) { - note = AudioSeq_AudioListPopBack(source); + note = AudioScript_AudioListPopBack(source); if (note == NULL) { break; } - AudioSeq_AudioListPushBack(dest, ¬e->listItem); + AudioScript_AudioListPushBack(dest, ¬e->listItem); j++; } } @@ -867,7 +867,8 @@ void AudioPlayback_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) } Note* AudioPlayback_AllocNoteFromDisabled(NotePool* pool, SequenceLayer* layer) { - Note* note = AudioSeq_AudioListPopBack(&pool->disabled); + Note* note = AudioScript_AudioListPopBack(&pool->disabled); + if (note != NULL) { AudioPlayback_NoteInitForLayer(note, layer); AudioPlayback_AudioListPushFront(&pool->active, ¬e->listItem); @@ -881,7 +882,7 @@ Note* AudioPlayback_AllocNoteFromDecaying(NotePool* pool, SequenceLayer* layer) if (note != NULL) { AudioPlayback_NoteReleaseAndTakeOwnership(note, layer); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(&pool->releasing, ¬e->listItem); + AudioScript_AudioListPushBack(&pool->releasing, ¬e->listItem); } return note; } @@ -912,7 +913,7 @@ Note* AudioPlayback_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer) { if (aPriority < rPriority) { AudioPlayback_AudioListRemove(&aNote->listItem); func_801963E8(aNote, layer); - AudioSeq_AudioListPushBack(&pool->releasing, &aNote->listItem); + AudioScript_AudioListPushBack(&pool->releasing, &aNote->listItem); aNote->playbackState.priority = layer->channel->notePriority; return aNote; } @@ -931,7 +932,7 @@ Note* AudioPlayback_AllocNote(SequenceLayer* layer) { note->playbackState.wantedParentLayer == NO_LAYER) { AudioPlayback_NoteReleaseAndTakeOwnership(note, layer); AudioPlayback_AudioListRemove(¬e->listItem); - AudioSeq_AudioListPushBack(¬e->listItem.pool->releasing, ¬e->listItem); + AudioScript_AudioListPushBack(¬e->listItem.pool->releasing, ¬e->listItem); return note; } } diff --git a/src/code/audio/audio_seqplayer.c b/src/audio/lib/seqplayer.c similarity index 86% rename from src/code/audio/audio_seqplayer.c rename to src/audio/lib/seqplayer.c index a8c54420a..270164972 100644 --- a/src/code/audio/audio_seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -29,15 +29,15 @@ typedef enum { /* 5 */ PORTAMENTO_MODE_5 } PortamentoMode; -u8 AudioSeq_ScriptReadU8(SeqScriptState* state); -s16 AudioSeq_ScriptReadS16(SeqScriptState* state); -u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state); -void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer); -s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample); -s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer); -s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd); -s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd); -u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr); +u8 AudioScript_ScriptReadU8(SeqScriptState* state); +s16 AudioScript_ScriptReadS16(SeqScriptState* state); +u16 AudioScript_ScriptReadCompressedU16(SeqScriptState* state); +void AudioScript_SeqLayerProcessScriptStep1(SequenceLayer* layer); +s32 AudioScript_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample); +s32 AudioScript_SeqLayerProcessScriptStep2(SequenceLayer* layer); +s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd); +s32 AudioScript_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd); +u8 AudioScript_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr); /** * sSeqInstructionArgsTable is a table for each sequence instruction @@ -172,7 +172,7 @@ u8 sSeqInstructionArgsTable[] = { * * @return the argument value for a control flow instruction, or 0 if there is no argument */ -u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { +u16 AudioScript_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { u8 highBits = sSeqInstructionArgsTable[cmd - 0xA0]; u8 lowBits = highBits & 3; u16 cmdArg = 0; @@ -180,9 +180,9 @@ u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { // only 1 argument if (lowBits == 1) { if (!(highBits & 0x80)) { - cmdArg = AudioSeq_ScriptReadU8(state); + cmdArg = AudioScript_ScriptReadU8(state); } else { - cmdArg = AudioSeq_ScriptReadS16(state); + cmdArg = AudioScript_ScriptReadS16(state); } } @@ -194,7 +194,7 @@ u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { * * @return number of frames until next instruction. -1 signals termination */ -s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* state, s32 cmd, s32 cmdArg) { +s32 AudioScript_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* state, s32 cmd, s32 cmdArg) { u32 depth; switch (cmd) { @@ -206,7 +206,7 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* break; case 0xFD: // delay n frames - return AudioSeq_ScriptReadCompressedU16(state); + return AudioScript_ScriptReadCompressedU16(state); case 0xFE: // delay 1 frame return 1; @@ -266,7 +266,7 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* return 0; } -void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { +void AudioScript_InitSequenceChannel(SequenceChannel* channel) { s32 i; if (channel == &gAudioCtx.sequenceChannelNone) { @@ -325,12 +325,12 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { channel->sfxState = NULL; } -s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { +s32 AudioScript_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { SequenceLayer* layer; s32 pad; if (channel->layers[layerIndex] == NULL) { - layer = AudioSeq_AudioListPopBack(&gAudioCtx.layerFreeList); + layer = AudioScript_AudioListPopBack(&gAudioCtx.layerFreeList); channel->layers[layerIndex] = layer; if (layer == NULL) { channel->layers[layerIndex] = NULL; @@ -382,7 +382,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { return 0; } -void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { +void AudioScript_SeqLayerDisable(SequenceLayer* layer) { if (layer != NULL) { if ((layer->channel != &gAudioCtx.sequenceChannelNone) && (layer->channel->seqPlayer->finished == true)) { AudioPlayback_SeqLayerNoteRelease(layer); @@ -394,30 +394,30 @@ void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { } } -void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { +void AudioScript_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { SequenceLayer* layer = channel->layers[layerIndex]; if (layer != NULL) { - AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &layer->listItem); - AudioSeq_SeqLayerDisable(layer); + AudioScript_AudioListPushBack(&gAudioCtx.layerFreeList, &layer->listItem); + AudioScript_SeqLayerDisable(layer); channel->layers[layerIndex] = NULL; } } -void AudioSeq_SequenceChannelDisable(SequenceChannel* channel) { +void AudioScript_SequenceChannelDisable(SequenceChannel* channel) { s32 i; channel->finished = true; for (i = 0; i < 4; i++) { - AudioSeq_SeqLayerFree(channel, i); + AudioScript_SeqLayerFree(channel, i); } AudioPlayback_NotePoolClear(&channel->notePool); channel->enabled = false; } -void AudioSeq_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channelBits) { +void AudioScript_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channelBits) { SequenceChannel* channel; s32 i; @@ -432,19 +432,19 @@ void AudioSeq_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channel } } -void AudioSeq_SequencePlayerDisableChannels(SequencePlayer* seqPlayer, u16 channelBitsUnused) { +void AudioScript_SequencePlayerDisableChannels(SequencePlayer* seqPlayer, u16 channelBitsUnused) { SequenceChannel* channel; s32 i; for (i = 0; i < SEQ_NUM_CHANNELS; i++) { channel = seqPlayer->channels[i]; if (IS_SEQUENCE_CHANNEL_VALID(channel) == 1) { - AudioSeq_SequenceChannelDisable(channel); + AudioScript_SequenceChannelDisable(channel); } } } -void AudioSeq_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, void* script) { +void AudioScript_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, void* script) { SequenceChannel* channel = seqPlayer->channels[channelIndex]; s32 i; @@ -456,18 +456,18 @@ void AudioSeq_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, for (i = 0; i < ARRAY_COUNT(channel->layers); i++) { if (channel->layers[i] != NULL) { - AudioSeq_SeqLayerFree(channel, i); + AudioScript_SeqLayerFree(channel, i); } } } -void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) { +void AudioScript_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) { seqPlayer->finished = true; - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); } -void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { - AudioSeq_SequencePlayerDisableChannels(seqPlayer, 0xFFFF); +void AudioScript_SequencePlayerDisable(SequencePlayer* seqPlayer) { + AudioScript_SequencePlayerDisableChannels(seqPlayer, 0xFFFF); AudioPlayback_NotePoolClear(&seqPlayer->notePool); if (!seqPlayer->enabled) { return; @@ -491,7 +491,7 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { } } -void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { +void AudioScript_AudioListPushBack(AudioListItem* list, AudioListItem* item) { if (item->prev == NULL) { list->prev->next = item; item->prev = list->prev; @@ -502,7 +502,7 @@ void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { } } -void* AudioSeq_AudioListPopBack(AudioListItem* list) { +void* AudioScript_AudioListPopBack(AudioListItem* list) { AudioListItem* item = list->prev; if (item == list) { @@ -517,7 +517,7 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) { return item->u.value; } -void AudioSeq_InitLayerFreelist(void) { +void AudioScript_InitLayerFreelist(void) { s32 i; gAudioCtx.layerFreeList.prev = &gAudioCtx.layerFreeList; @@ -528,22 +528,22 @@ void AudioSeq_InitLayerFreelist(void) { for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) { gAudioCtx.sequenceLayers[i].listItem.u.value = &gAudioCtx.sequenceLayers[i]; gAudioCtx.sequenceLayers[i].listItem.prev = NULL; - AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &gAudioCtx.sequenceLayers[i].listItem); + AudioScript_AudioListPushBack(&gAudioCtx.layerFreeList, &gAudioCtx.sequenceLayers[i].listItem); } } -u8 AudioSeq_ScriptReadU8(SeqScriptState* state) { +u8 AudioScript_ScriptReadU8(SeqScriptState* state) { return *(state->pc++); } -s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { +s16 AudioScript_ScriptReadS16(SeqScriptState* state) { s16 ret = *(state->pc++) << 8; ret = *(state->pc++) | ret; return ret; } -u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { +u16 AudioScript_ScriptReadCompressedU16(SeqScriptState* state) { u16 ret = *(state->pc++); if (ret & 0x80) { @@ -553,7 +553,7 @@ u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { return ret; } -void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { +void AudioScript_SeqLayerProcessScript(SequenceLayer* layer) { s32 cmd; if (!layer->enabled) { @@ -569,25 +569,25 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { return; } - AudioSeq_SeqLayerProcessScriptStep1(layer); + AudioScript_SeqLayerProcessScriptStep1(layer); do { - cmd = AudioSeq_SeqLayerProcessScriptStep2(layer); + cmd = AudioScript_SeqLayerProcessScriptStep2(layer); if (cmd == PROCESS_SCRIPT_END) { return; } - cmd = AudioSeq_SeqLayerProcessScriptStep3(layer, cmd); + cmd = AudioScript_SeqLayerProcessScriptStep3(layer, cmd); } while ((cmd == -1) && (layer->delay == 0)); if (cmd != PROCESS_SCRIPT_END) { // returns `sameTunedSample` instead of a command - cmd = AudioSeq_SeqLayerProcessScriptStep4(layer, cmd); + cmd = AudioScript_SeqLayerProcessScriptStep4(layer, cmd); } if (cmd != PROCESS_SCRIPT_END) { - AudioSeq_SeqLayerProcessScriptStep5(layer, cmd); + AudioScript_SeqLayerProcessScriptStep5(layer, cmd); } if (layer->muted == true) { @@ -597,7 +597,7 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { } } -void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { +void AudioScript_SeqLayerProcessScriptStep1(SequenceLayer* layer) { if (!layer->continuousNotes) { AudioPlayback_SeqLayerNoteDecay(layer); } else if ((layer->note != NULL) && (layer->note->playbackState.wantedParentLayer == layer)) { @@ -611,7 +611,7 @@ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { layer->notePropertiesNeedInit = true; } -s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) { +s32 AudioScript_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) { Note* note; if ((layer->continuousNotes == true) && (layer->bit1 == true)) { @@ -648,7 +648,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSampl return 0; } -s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { +s32 AudioScript_SeqLayerProcessScriptStep2(SequenceLayer* layer) { SequenceChannel* channel = layer->channel; SeqScriptState* state = &layer->scriptState; SequencePlayer* seqPlayer = channel->seqPlayer; @@ -658,22 +658,22 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { u16 velocity; while (true) { - cmd = AudioSeq_ScriptReadU8(state); + cmd = AudioScript_ScriptReadU8(state); // Note Commands - // To be processed in AudioSeq_SeqLayerProcessScriptStep3 + // To be processed in AudioScript_SeqLayerProcessScriptStep3 if (cmd <= 0xC0) { return cmd; } // Control Flow Commands if (cmd >= 0xF2) { - cmdArg16 = AudioSeq_GetScriptControlFlowArgument(state, cmd); + cmdArg16 = AudioScript_GetScriptControlFlowArgument(state, cmd); - if (AudioSeq_HandleScriptFlowControl(seqPlayer, state, cmd, cmdArg16) == 0) { + if (AudioScript_HandleScriptFlowControl(seqPlayer, state, cmd, cmdArg16) == 0) { continue; } - AudioSeq_SeqLayerDisable(layer); + AudioScript_SeqLayerDisable(layer); return PROCESS_SCRIPT_END; } @@ -710,12 +710,12 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { break; case 0xC3: // layer: set short note default delay - cmdArg16 = AudioSeq_ScriptReadCompressedU16(state); + cmdArg16 = AudioScript_ScriptReadCompressedU16(state); layer->shortNoteDefaultDelay = cmdArg16; break; case 0xC6: // layer: set instrument - cmd = AudioSeq_ScriptReadU8(state); + cmd = AudioScript_ScriptReadU8(state); if (cmd >= 0x7E) { if (cmd == 0x7E) { // Sfxs @@ -734,17 +734,17 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } } else { // Instrument - if ((layer->instOrWave = AudioSeq_GetInstrument(channel, cmd, &layer->instrument, &layer->adsr)) == - 0) { + if ((layer->instOrWave = + AudioScript_GetInstrument(channel, cmd, &layer->instrument, &layer->adsr)) == 0) { layer->instOrWave = 0xFF; } } break; case 0xC7: // layer: enable portamento - layer->portamento.mode = AudioSeq_ScriptReadU8(state); + layer->portamento.mode = AudioScript_ScriptReadU8(state); - cmd = AudioSeq_ScriptReadU8(state); + cmd = AudioScript_ScriptReadU8(state); cmd += channel->transposition; cmd += layer->transposition; cmd += seqPlayer->transposition; @@ -761,7 +761,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { break; } - cmdArg16 = AudioSeq_ScriptReadCompressedU16(state); + cmdArg16 = AudioScript_ScriptReadCompressedU16(state); layer->portamentoTime = cmdArg16; break; @@ -770,11 +770,11 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { break; case 0xCB: // layer: set envelope and decay index - cmdArg16 = AudioSeq_ScriptReadS16(state); + cmdArg16 = AudioScript_ScriptReadS16(state); layer->adsr.envelope = (EnvelopePoint*)(seqPlayer->seqData + cmdArg16); // fallthrough case 0xCF: // layer: set decay index - layer->adsr.decayIndex = AudioSeq_ScriptReadU8(state); + layer->adsr.decayIndex = AudioScript_ScriptReadU8(state); break; case 0xCC: // layer: ignore drum pan @@ -782,21 +782,21 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { break; case 0xCD: // layer: stereo effects - layer->stereoData.asByte = AudioSeq_ScriptReadU8(state); + layer->stereoData.asByte = AudioScript_ScriptReadU8(state); break; case 0xCE: // layer: bend pitch - cmdArg8 = AudioSeq_ScriptReadU8(state); + cmdArg8 = AudioScript_ScriptReadU8(state); layer->bend = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)]; break; case 0xF0: // layer: - cmdArg16 = AudioSeq_ScriptReadS16(state); + cmdArg16 = AudioScript_ScriptReadS16(state); layer->unk_0A.asByte &= (cmdArg16 ^ 0xFFFF); break; case 0xF1: // layer: - layer->surroundEffectIndex = AudioSeq_ScriptReadU8(state); + layer->surroundEffectIndex = AudioScript_ScriptReadU8(state); break; default: @@ -814,7 +814,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } } -s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { +s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { s32 sameTunedSample = true; s32 instOrWave; s32 speed; @@ -1025,7 +1025,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { return sameTunedSample; } -s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { +s32 AudioScript_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { SeqScriptState* state = &layer->scriptState; u16 delay; s32 velocity; @@ -1035,7 +1035,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { f32 floatDelta; if (cmd == 0xC0) { // layer: delay - layer->delay = AudioSeq_ScriptReadCompressedU16(state); + layer->delay = AudioScript_ScriptReadCompressedU16(state); layer->muted = true; layer->bit1 = false; return PROCESS_SCRIPT_END; @@ -1046,14 +1046,14 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { if (channel->largeNotes == true) { switch (cmd & 0xC0) { case 0x00: // layer: large note 0 - delay = AudioSeq_ScriptReadCompressedU16(state); + delay = AudioScript_ScriptReadCompressedU16(state); velocity = *(state->pc++); layer->gateTime = *(state->pc++); layer->lastDelay = delay; break; case 0x40: // layer: large note 1 - delay = AudioSeq_ScriptReadCompressedU16(state); + delay = AudioScript_ScriptReadCompressedU16(state); velocity = *(state->pc++); layer->gateTime = 0; layer->lastDelay = delay; @@ -1074,7 +1074,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { } else { switch (cmd & 0xC0) { case 0x00: // layer: small note 0 - delay = AudioSeq_ScriptReadCompressedU16(state); + delay = AudioScript_ScriptReadCompressedU16(state); layer->lastDelay = delay; break; @@ -1138,7 +1138,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { return cmd; } -void AudioSeq_SetChannelPriorities(SequenceChannel* channel, u8 priority) { +void AudioScript_SetChannelPriorities(SequenceChannel* channel, u8 priority) { if ((priority & 0xF) != 0) { channel->notePriority = priority & 0xF; } @@ -1149,7 +1149,7 @@ void AudioSeq_SetChannelPriorities(SequenceChannel* channel, u8 priority) { } } -u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr) { +u8 AudioScript_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr) { Instrument* inst = AudioPlayback_GetInstrumentInner(channel->fontId, instId); if (inst == NULL) { @@ -1169,7 +1169,7 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst return instId; } -void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { +void AudioScript_SetInstrument(SequenceChannel* channel, u8 instId) { if (instId >= 0x80) { // Synthetic Waves channel->instOrWave = instId; @@ -1184,7 +1184,7 @@ void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { channel->instrument = (Instrument*)2; // invalid pointer, never dereferenced } else { // Instruments - if ((channel->instOrWave = AudioSeq_GetInstrument(channel, instId, &channel->instrument, &channel->adsr)) == + if ((channel->instOrWave = AudioScript_GetInstrument(channel, instId, &channel->instrument, &channel->adsr)) == 0) { channel->hasInstrument = false; return; @@ -1194,11 +1194,11 @@ void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { channel->hasInstrument = true; } -void AudioSeq_SequenceChannelSetVolume(SequenceChannel* channel, u8 volume) { +void AudioScript_SequenceChannelSetVolume(SequenceChannel* channel, u8 volume) { channel->volume = (s32)volume / 127.0f; } -void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { +void AudioScript_SequenceChannelProcessScript(SequenceChannel* channel) { s32 i; u8* data; u32 rand; @@ -1225,7 +1225,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { u16 cmdArgU16; u32 cmdArgs[3]; s8 cmdArgS8; - u8 cmd = AudioSeq_ScriptReadU8(scriptState); + u8 cmd = AudioScript_ScriptReadU8(scriptState); u8 lowBits; u8 highBits; s32 delay; @@ -1244,19 +1244,19 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { // read in arguments for the instruction for (i = 0; i < lowBits; i++, highBits <<= 1) { if (!(highBits & 0x80)) { - cmdArgs[i] = AudioSeq_ScriptReadU8(scriptState); + cmdArgs[i] = AudioScript_ScriptReadU8(scriptState); } else { - cmdArgs[i] = AudioSeq_ScriptReadS16(scriptState); + cmdArgs[i] = AudioScript_ScriptReadS16(scriptState); } } // Control Flow Commands if (cmd >= 0xF2) { - delay = AudioSeq_HandleScriptFlowControl(seqPlayer, scriptState, cmd, cmdArgs[0]); + delay = AudioScript_HandleScriptFlowControl(seqPlayer, scriptState, cmd, cmdArgs[0]); if (delay != 0) { if (delay == PROCESS_SCRIPT_END) { - AudioSeq_SequenceChannelDisable(channel); + AudioScript_SequenceChannelDisable(channel); } else { channel->delay = delay; } @@ -1310,7 +1310,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { // fallthrough case 0xC1: // channel: set instrument cmd = (u8)cmdArgs[0]; - AudioSeq_SetInstrument(channel, cmd); + AudioScript_SetInstrument(channel, cmd); break; case 0xC3: // channel: large notes off @@ -1323,7 +1323,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0xDF: // channel: set volume cmd = (u8)cmdArgs[0]; - AudioSeq_SequenceChannelSetVolume(channel, cmd); + AudioScript_SequenceChannelSetVolume(channel, cmd); channel->changes.s.volume = true; break; @@ -1459,7 +1459,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0xCD: // channel: disable channel cmd = (u8)cmdArgs[0]; - AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmd]); + AudioScript_SequenceChannelDisable(seqPlayer->channels[cmd]); break; case 0xCA: // channel: set mute behavior @@ -1533,7 +1533,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->muteFlags = data[0]; data += 3; channel->noteAllocPolicy = data[-2]; - AudioSeq_SetChannelPriorities(channel, data[-1]); + AudioScript_SetChannelPriorities(channel, data[-1]); channel->transposition = (s8)data[0]; data += 4; channel->newPan = data[-3]; @@ -1548,12 +1548,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->muteFlags = cmdArgs[0]; channel->noteAllocPolicy = cmdArgs[1]; cmd = (u8)cmdArgs[2]; - AudioSeq_SetChannelPriorities(channel, cmd); - channel->transposition = (s8)AudioSeq_ScriptReadU8(scriptState); - channel->newPan = AudioSeq_ScriptReadU8(scriptState); - channel->panChannelWeight = AudioSeq_ScriptReadU8(scriptState); - channel->targetReverbVol = AudioSeq_ScriptReadU8(scriptState); - channel->reverbIndex = AudioSeq_ScriptReadU8(scriptState); + AudioScript_SetChannelPriorities(channel, cmd); + channel->transposition = (s8)AudioScript_ScriptReadU8(scriptState); + channel->newPan = AudioScript_ScriptReadU8(scriptState); + channel->panChannelWeight = AudioScript_ScriptReadU8(scriptState); + channel->targetReverbVol = AudioScript_ScriptReadU8(scriptState); + channel->reverbIndex = AudioScript_ScriptReadU8(scriptState); //! @bug: Not marking reverb state as changed channel->changes.s.pan = true; break; @@ -1579,7 +1579,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { break; case 0xE9: // channel: set note priority - AudioSeq_SetChannelPriorities(channel, (u8)cmdArgs[0]); + AudioScript_SetChannelPriorities(channel, (u8)cmdArgs[0]); break; case 0xED: // channel: set hilo gain @@ -1747,18 +1747,18 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { break; case 0x88: // channel: set layer - cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); - if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { + cmdArgU16 = AudioScript_ScriptReadS16(scriptState); + if (!AudioScript_SeqChannelSetLayer(channel, lowBits)) { channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16]; } break; case 0x90: // channel: free layer - AudioSeq_SeqLayerFree(channel, lowBits); + AudioScript_SeqLayerFree(channel, lowBits); break; case 0x98: // channel: dynset layer - if ((scriptState->value != -1) && (AudioSeq_SeqChannelSetLayer(channel, lowBits) != -1)) { + if ((scriptState->value != -1) && (AudioScript_SeqChannelSetLayer(channel, lowBits) != -1)) { data = (*channel->dynTable)[scriptState->value]; cmdArgU16 = (data[0] << 8) + data[1]; channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16]; @@ -1770,8 +1770,8 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { break; case 0x78: // channel: set layer relative - temp1 = AudioSeq_ScriptReadS16(scriptState); - if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { + temp1 = AudioScript_ScriptReadS16(scriptState); + if (!AudioScript_SeqChannelSetLayer(channel, lowBits)) { channel->layers[lowBits]->scriptState.pc = &scriptState->pc[temp1]; } break; @@ -1815,17 +1815,17 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { break; case 0x20: // channel: start channel - cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); - AudioSeq_SequenceChannelEnable(seqPlayer, lowBits, &seqPlayer->seqData[cmdArgU16]); + cmdArgU16 = AudioScript_ScriptReadS16(scriptState); + AudioScript_SequenceChannelEnable(seqPlayer, lowBits, &seqPlayer->seqData[cmdArgU16]); break; case 0x30: // channel: io write value 2 - cmd = AudioSeq_ScriptReadU8(scriptState); + cmd = AudioScript_ScriptReadU8(scriptState); seqPlayer->channels[lowBits]->seqScriptIO[cmd] = scriptState->value; break; case 0x40: // channel: io read value 2 - cmd = AudioSeq_ScriptReadU8(scriptState); + cmd = AudioScript_ScriptReadU8(scriptState); scriptState->value = seqPlayer->channels[lowBits]->seqScriptIO[cmd]; break; } @@ -1834,12 +1834,12 @@ exit_loop: for (i = 0; i < ARRAY_COUNT(channel->layers); i++) { if (channel->layers[i] != NULL) { - AudioSeq_SeqLayerProcessScript(channel->layers[i]); + AudioScript_SeqLayerProcessScript(channel->layers[i]); } } } -void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { +void AudioScript_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { u8 cmd; u8 cmdLowBits; SeqScriptState* seqScript = &seqPlayer->scriptState; @@ -1866,7 +1866,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { if (AudioLoad_IsSeqLoadComplete(seqPlayer->seqId)) {} if (AudioLoad_IsSeqLoadComplete(seqPlayer->defaultFont)) {} - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); return; } @@ -1903,16 +1903,16 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { seqPlayer->recalculateVolume = true; while (true) { - cmd = AudioSeq_ScriptReadU8(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); // 0xF2 and above are "flow control" commands, including termination. if (cmd >= 0xF2) { - delay = AudioSeq_HandleScriptFlowControl( - seqPlayer, seqScript, cmd, AudioSeq_GetScriptControlFlowArgument(&seqPlayer->scriptState, cmd)); + delay = AudioScript_HandleScriptFlowControl( + seqPlayer, seqScript, cmd, AudioScript_GetScriptControlFlowArgument(&seqPlayer->scriptState, cmd)); if (delay != 0) { if (delay == -1) { - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); } else { seqPlayer->delay = delay; } @@ -1926,7 +1926,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { switch (cmd) { case 0xF1: // seqPlayer: reserve notes AudioPlayback_NotePoolClear(&seqPlayer->notePool); - cmd = AudioSeq_ScriptReadU8(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); AudioPlayback_NotePoolFill(&seqPlayer->notePool, cmd); break; @@ -1938,11 +1938,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { seqPlayer->transposition = 0; // fallthrough case 0xDE: // seqPlayer: transpose relative - seqPlayer->transposition += (s8)AudioSeq_ScriptReadU8(seqScript); + seqPlayer->transposition += (s8)AudioScript_ScriptReadU8(seqScript); break; case 0xDD: // seqPlayer: set tempo - seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; + seqPlayer->tempo = AudioScript_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; if (seqPlayer->tempo > gAudioCtx.maxTempo) { seqPlayer->tempo = gAudioCtx.maxTempo; } @@ -1953,12 +1953,12 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xDC: // seqPlayer: add tempo - seqPlayer->tempoChange = (s8)AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; + seqPlayer->tempoChange = (s8)AudioScript_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; break; case 0xDA: // seqPlayer: change volume - cmd = AudioSeq_ScriptReadU8(seqScript); - temp = AudioSeq_ScriptReadS16(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); switch (cmd) { case SEQPLAYER_STATE_0: case SEQPLAYER_STATE_FADE_IN: @@ -1977,7 +1977,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xDB: // seqPlayer: set volume - value = AudioSeq_ScriptReadU8(seqScript); + value = AudioScript_ScriptReadU8(seqScript); switch (seqPlayer->state) { case SEQPLAYER_STATE_FADE_IN: seqPlayer->state = SEQPLAYER_STATE_0; @@ -1999,20 +1999,20 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xD9: // seqPlayer: set volume scale - seqPlayer->fadeVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; + seqPlayer->fadeVolumeScale = (s8)AudioScript_ScriptReadU8(seqScript) / 127.0f; break; case 0xD7: // seqPlayer: initialize channels - temp = AudioSeq_ScriptReadS16(seqScript); - AudioSeq_SequencePlayerSetupChannels(seqPlayer, temp); + temp = AudioScript_ScriptReadS16(seqScript); + AudioScript_SequencePlayerSetupChannels(seqPlayer, temp); break; case 0xD6: // seqPlayer: disable channels - AudioSeq_ScriptReadS16(seqScript); + AudioScript_ScriptReadS16(seqScript); break; case 0xD5: // seqPlayer: set mute scale - seqPlayer->muteVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; + seqPlayer->muteVolumeScale = (s8)AudioScript_ScriptReadU8(seqScript) / 127.0f; break; case 0xD4: // seqPlayer: mute @@ -2020,12 +2020,12 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xD3: // seqPlayer: set mute behavior - seqPlayer->muteFlags = AudioSeq_ScriptReadU8(seqScript); + seqPlayer->muteFlags = AudioScript_ScriptReadU8(seqScript); break; case 0xD1: // seqPlayer: set short note gatetime table case 0xD2: // seqPlayer: set short note velocity table - temp = AudioSeq_ScriptReadS16(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); data3 = &seqPlayer->seqData[temp]; if (cmd == 0xD2) { seqPlayer->shortNoteVelocityTable = data3; @@ -2035,11 +2035,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xD0: // seqPlayer: set note allocation policy - seqPlayer->noteAllocPolicy = AudioSeq_ScriptReadU8(seqScript); + seqPlayer->noteAllocPolicy = AudioScript_ScriptReadU8(seqScript); break; case 0xCE: // seqPlayer: random value - cmd = AudioSeq_ScriptReadU8(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); if (cmd == 0) { seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF; } else { @@ -2048,7 +2048,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xCD: // seqPlayer: dyncall - temp = AudioSeq_ScriptReadS16(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); if ((seqScript->value != -1) && (seqScript->depth != 3)) { data1 = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1)); seqScript->stack[seqScript->depth] = seqScript->pc; @@ -2059,26 +2059,26 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xCC: // seqPlayer: set value - seqScript->value = AudioSeq_ScriptReadU8(seqScript); + seqScript->value = AudioScript_ScriptReadU8(seqScript); break; case 0xC9: // seqPlayer: `bit and` -> set value - seqScript->value &= AudioSeq_ScriptReadU8(seqScript); + seqScript->value &= AudioScript_ScriptReadU8(seqScript); break; case 0xC8: // seqPlayer: subtract -> set value - seqScript->value -= AudioSeq_ScriptReadU8(seqScript); + seqScript->value -= AudioScript_ScriptReadU8(seqScript); break; case 0xC7: // seqPlayer: write into sequence script - cmd = AudioSeq_ScriptReadU8(seqScript); - temp = AudioSeq_ScriptReadS16(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); data2 = &seqPlayer->seqData[temp]; *data2 = (u8)seqScript->value + cmd; break; case 0xC2: // seqPlayer: - temp = AudioSeq_ScriptReadS16(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); if (seqScript->value != -1) { data4 = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1)); @@ -2092,16 +2092,16 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { return; case 0xC5: // seqPlayer: - seqPlayer->unk_16 = AudioSeq_ScriptReadS16(seqScript); + seqPlayer->unk_16 = AudioScript_ScriptReadS16(seqScript); break; case 0xEF: // seqPlayer: - AudioSeq_ScriptReadS16(seqScript); - AudioSeq_ScriptReadU8(seqScript); + AudioScript_ScriptReadS16(seqScript); + AudioScript_ScriptReadU8(seqScript); break; case 0xC4: // seqPlayer: start sequence - cmd = AudioSeq_ScriptReadU8(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); if (cmd == 0xFF) { cmd = seqPlayer->playerIndex; if (seqPlayer->state == SEQPLAYER_STATE_FADE_OUT) { @@ -2109,7 +2109,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } } - cmdLowBits = AudioSeq_ScriptReadU8(seqScript); + cmdLowBits = AudioScript_ScriptReadU8(seqScript); AudioLoad_SyncInitSeqPlayer(cmd, cmdLowBits, 0); if (cmd == (u8)seqPlayer->playerIndex) { return; @@ -2117,7 +2117,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0xC3: // seqPlayer: - temp = AudioSeq_ScriptReadS16(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); if (seqScript->value != -1) { new_var = (u16*)(seqPlayer->seqData + (u32)(temp + seqScript->value * 2)); temp = *new_var; @@ -2156,30 +2156,30 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { break; case 0x40: // seqPlayer: disable channel - AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmdLowBits]); + AudioScript_SequenceChannelDisable(seqPlayer->channels[cmdLowBits]); break; case 0x90: // seqPlayer: start channel - temp = AudioSeq_ScriptReadS16(seqScript); - AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqPlayer->seqData[temp]); + temp = AudioScript_ScriptReadS16(seqScript); + AudioScript_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqPlayer->seqData[temp]); break; case 0xA0: // seqPlayer: start channel relative - tempS = AudioSeq_ScriptReadS16(seqScript); - AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqScript->pc[tempS]); + tempS = AudioScript_ScriptReadS16(seqScript); + AudioScript_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqScript->pc[tempS]); break; case 0xB0: // seqPlayer: load sequence - cmd = AudioSeq_ScriptReadU8(seqScript); - temp = AudioSeq_ScriptReadS16(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); + temp = AudioScript_ScriptReadS16(seqScript); data2 = &seqPlayer->seqData[temp]; AudioLoad_SlowLoadSeq(cmd, data2, &seqPlayer->seqScriptIO[cmdLowBits]); break; case 0x60: // seqPlayer: async load - cmd = AudioSeq_ScriptReadU8(seqScript); + cmd = AudioScript_ScriptReadU8(seqScript); value = cmd; - temp = AudioSeq_ScriptReadU8(seqScript); + temp = AudioScript_ScriptReadU8(seqScript); AudioLoad_ScriptLoad(value, temp, &seqPlayer->seqScriptIO[cmdLowBits]); break; } @@ -2189,12 +2189,12 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { for (j = 0; j < SEQ_NUM_CHANNELS; j++) { channel = seqPlayer->channels[j]; if (channel->enabled) { - AudioSeq_SequenceChannelProcessScript(channel); + AudioScript_SequenceChannelProcessScript(channel); } } } -void AudioSeq_ProcessSequences(s32 arg0) { +void AudioScript_ProcessSequences(s32 arg0) { SequencePlayer* seqPlayer; u32 i; @@ -2203,7 +2203,7 @@ void AudioSeq_ProcessSequences(s32 arg0) { for (i = 0; i < (u32)gAudioCtx.audioBufferParameters.numSequencePlayers; i++) { seqPlayer = &gAudioCtx.seqPlayers[i]; if (seqPlayer->enabled == true) { - AudioSeq_SequencePlayerProcessSequence(seqPlayer); + AudioScript_SequencePlayerProcessSequence(seqPlayer); AudioEffects_SequencePlayerProcessSound(seqPlayer); } } @@ -2211,18 +2211,18 @@ void AudioSeq_ProcessSequences(s32 arg0) { AudioPlayback_ProcessNotes(); } -void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer) { +void AudioScript_SkipForwardSequence(SequencePlayer* seqPlayer) { while (seqPlayer->skipTicks > 0) { - AudioSeq_SequencePlayerProcessSequence(seqPlayer); + AudioScript_SequencePlayerProcessSequence(seqPlayer); AudioEffects_SequencePlayerProcessSound(seqPlayer); seqPlayer->skipTicks--; } } -void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { +void AudioScript_ResetSequencePlayer(SequencePlayer* seqPlayer) { s32 channelIndex; - AudioSeq_SequencePlayerDisable(seqPlayer); + AudioScript_SequencePlayerDisable(seqPlayer); seqPlayer->stopScript = false; seqPlayer->delay = 0; seqPlayer->state = SEQPLAYER_STATE_FADE_IN; @@ -2243,11 +2243,11 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { seqPlayer->muteVolumeScale = 0.5f; for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { - AudioSeq_InitSequenceChannel(seqPlayer->channels[channelIndex]); + AudioScript_InitSequenceChannel(seqPlayer->channels[channelIndex]); } } -void AudioSeq_InitSequencePlayerChannels(s32 seqPlayerIndex) { +void AudioScript_InitSequencePlayerChannels(s32 seqPlayerIndex) { SequenceChannel* channel; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[seqPlayerIndex]; s32 channelIndex; @@ -2267,11 +2267,11 @@ void AudioSeq_InitSequencePlayerChannels(s32 seqPlayerIndex) { } } - AudioSeq_InitSequenceChannel(seqPlayer->channels[channelIndex]); + AudioScript_InitSequenceChannel(seqPlayer->channels[channelIndex]); } } -void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { +void AudioScript_InitSequencePlayer(SequencePlayer* seqPlayer) { s32 i; s32 j; @@ -2294,13 +2294,13 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { seqPlayer->bend = 1.0f; AudioPlayback_InitNoteLists(&seqPlayer->notePool); - AudioSeq_ResetSequencePlayer(seqPlayer); + AudioScript_ResetSequencePlayer(seqPlayer); } -void AudioSeq_InitSequencePlayers(void) { +void AudioScript_InitSequencePlayers(void) { s32 i; - AudioSeq_InitLayerFreelist(); + AudioScript_InitLayerFreelist(); for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) { gAudioCtx.sequenceLayers[i].channel = NULL; @@ -2308,6 +2308,6 @@ void AudioSeq_InitSequencePlayers(void) { } for (i = 0; i < ARRAY_COUNT(gAudioCtx.seqPlayers); i++) { - AudioSeq_InitSequencePlayer(&gAudioCtx.seqPlayers[i]); + AudioScript_InitSequencePlayer(&gAudioCtx.seqPlayers[i]); } } diff --git a/src/code/audio/audio_synthesis.c b/src/audio/lib/synthesis.c similarity index 99% rename from src/code/audio/audio_synthesis.c rename to src/audio/lib/synthesis.c index 057668f37..71b6a2212 100644 --- a/src/code/audio/audio_synthesis.c +++ b/src/audio/lib/synthesis.c @@ -223,7 +223,7 @@ Acmd* AudioSynth_Update(Acmd* abiCmdStart, s32* numAbiCmds, s16* aiBufStart, s32 for (reverseUpdateIndex = gAudioCtx.audioBufferParameters.updatesPerFrame; reverseUpdateIndex > 0; reverseUpdateIndex--) { - AudioSeq_ProcessSequences(reverseUpdateIndex - 1); + AudioScript_ProcessSequences(reverseUpdateIndex - 1); AudioSynth_SyncSampleStates(gAudioCtx.audioBufferParameters.updatesPerFrame - reverseUpdateIndex); } diff --git a/src/code/audio/audio_thread.c b/src/audio/lib/thread.c similarity index 99% rename from src/code/audio/audio_thread.c rename to src/audio/lib/thread.c index 2b06281cc..082e77a67 100644 --- a/src/code/audio/audio_thread.c +++ b/src/audio/lib/thread.c @@ -212,13 +212,13 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { case AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS: AudioLoad_SyncInitSeqPlayerSkipTicks(cmd->arg0, cmd->arg1, cmd->asInt); AudioThread_SetFadeInTimer(cmd->arg0, 500); - AudioSeq_SkipForwardSequence(&gAudioCtx.seqPlayers[cmd->arg0]); + AudioScript_SkipForwardSequence(&gAudioCtx.seqPlayers[cmd->arg0]); break; case AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER: if (gAudioCtx.seqPlayers[cmd->arg0].enabled) { if (cmd->asInt == 0) { - AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[cmd->arg0]); + AudioScript_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[cmd->arg0]); } else { AudioThread_SetFadeOutTimer(cmd->arg0, cmd->asInt); } @@ -322,7 +322,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { if (flags == AUDIO_NOTE_RELEASE) { for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) { if (gAudioCtx.seqPlayers[i].enabled) { - AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[i]); + AudioScript_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[i]); } } } diff --git a/src/audio/sequence.c b/src/audio/sequence.c new file mode 100644 index 000000000..7d37a0ae9 --- /dev/null +++ b/src/audio/sequence.c @@ -0,0 +1,922 @@ +/** + * @file sequence.c + * + * This file implements a set of high-level audio sequence commands that allow sequences to be modified in real-time. + * These commands are intended to interface external to the audio library. + * + * These commands are generated using `AudioSeq_QueueSeqCmd`, and a user-friendly interface for this function + * can be found in `seqcmd.h` + * + * These commands change sequences by generating internal audio commands `AudioThread_QueueCmd` which allows these + * sequence requests to be passed onto the audio thread. It is worth noting all functions in this file are + * called from the graph thread. + * + * These commands are not to be confused with the sequence instructions used by the sequences themselves + * which are a midi-based scripting language. + * + * Nor are these commands to be confused with the internal audio commands used to transfer requests from + * the graph thread to the audio thread. + */ +#include "global.h" + +// Direct audio command (skips the queueing system) +#define SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, duration, volume) \ + AudioSeq_ProcessSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | ((u8)((volume)*127.0f))); + +u8 sSeqCmdWritePos = 0; +u8 sSeqCmdReadPos = 0; +u8 sStartSeqDisabled = 0; +u8 sSoundModeList[] = { + SOUNDMODE_STEREO, SOUNDMODE_HEADSET, SOUNDMODE_SURROUND_EXTERNAL, SOUNDMODE_MONO, SOUNDMODE_SURROUND, +}; +u8 gAudioSpecId = 0; +u8 gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; +u32 sResetAudioHeapSeqCmd = 0; + +void AudioSeq_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDuration) { + u8 channelIndex; + u16 skipTicks; + s32 pad; + + if (!sStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) { + seqArgs &= 0x7F; + if (seqArgs == 0x7F) { + // `fadeInDuration` interpreted as seconds, 60 is refresh rate and does not account for PAL + skipTicks = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame; + AUDIOCMD_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS(seqPlayerIndex, seqId, skipTicks); + } else { + // `fadeInDuration` interpreted as 1/30th of a second, does not account for change in refresh rate for PAL + AUDIOCMD_GLOBAL_INIT_SEQPLAYER(seqPlayerIndex, seqId, + (fadeInDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4); + } + + gActiveSeqs[seqPlayerIndex].seqId = seqId | (seqArgs << 8); + gActiveSeqs[seqPlayerIndex].prevSeqId = seqId | (seqArgs << 8); + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = true; + + if (gActiveSeqs[seqPlayerIndex].volCur != 1.0f) { + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].volCur); + } + + gActiveSeqs[seqPlayerIndex].tempoTimer = 0; + gActiveSeqs[seqPlayerIndex].tempoOriginal = 0; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; + + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur = 1.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer = 0; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur = 1.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer = 0; + } + + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].volChannelFlags = 0; + } +} + +void AudioSeq_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration) { + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(seqPlayerIndex, + (fadeOutDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4); + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; +} + +void AudioSeq_ProcessSeqCmd(u32 cmd) { + s32 priority; + s32 channelMaskEnable; + u16 channelMaskDisable; + u16 fadeTimer; + u16 val; + u8 oldSpecId; + u8 specId; + u8 fadeReverb; + u8 op; + u8 subOp; + u8 seqPlayerIndex; + u8 seqId; + u8 seqArgs; + u8 found; + u8 ioPort; + u8 duration; + u8 channelIndex; + u8 i; + f32 freqScaleTarget; + u32 outNumFonts; + + op = cmd >> 28; + seqPlayerIndex = (cmd & SEQCMD_SEQPLAYER_MASK) >> 24; + + switch (op) { + case SEQCMD_OP_PLAY_SEQUENCE: + // Play a new sequence + seqId = cmd & SEQCMD_SEQID_MASK; + seqArgs = (cmd & 0xFF00) >> 8; + // `fadeTimer` is only shifted 13 bits instead of 16 bits. + // `fadeTimer` continues to be scaled in `AudioSeq_StartSequence` + fadeTimer = (cmd & 0xFF0000) >> 13; + if (!gActiveSeqs[seqPlayerIndex].isWaitingForFonts && !sStartSeqDisabled) { + if (seqArgs < 0x80) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } else { + // Store the cmd to be called again once the fonts are loaded + // but changes the command so that next time, the (seqArgs < 0x80) case is taken + gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd = + (cmd & ~(SEQ_FLAG_ASYNC | SEQCMD_ASYNC_ACTIVE)) + SEQCMD_ASYNC_ACTIVE; + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = true; + gActiveSeqs[seqPlayerIndex].fontId = *AudioThread_GetFontsForSequence(seqId, &outNumFonts); + AudioSeq_StopSequence(seqPlayerIndex, 1); + + if (gActiveSeqs[seqPlayerIndex].prevSeqId != NA_BGM_DISABLED) { + if (*AudioThread_GetFontsForSequence(seqId, &outNumFonts) != + *AudioThread_GetFontsForSequence(gActiveSeqs[seqPlayerIndex].prevSeqId & 0xFF, + &outNumFonts)) { + // Discard Seq Fonts + AUDIOCMD_GLOBAL_DISCARD_SEQ_FONTS((s32)seqId); + } + } + + AUDIOCMD_GLOBAL_ASYNC_LOAD_FONT(*AudioThread_GetFontsForSequence(seqId, &outNumFonts), + (u8)((seqPlayerIndex + 1) & 0xFF)); + } + } + break; + + case SEQCMD_OP_STOP_SEQUENCE: + // Stop a sequence and disable the sequence player + fadeTimer = (cmd & 0xFF0000) >> 13; + AudioSeq_StopSequence(seqPlayerIndex, fadeTimer); + break; + + case SEQCMD_OP_QUEUE_SEQUENCE: + // Queue a sequence into `sSeqRequests` + seqId = cmd & SEQCMD_SEQID_MASK; + seqArgs = (cmd & 0xFF00) >> 8; + fadeTimer = (cmd & 0xFF0000) >> 13; + priority = seqArgs; + + // Checks if the requested sequence is first in the list of requests + // If it is already queued and first in the list, then play the sequence immediately + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + if (sSeqRequests[seqPlayerIndex][i].seqId == seqId) { + if (i == 0) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } + return; + } + } + + // Searches the sequence requests for the first request that does not have a higher priority + // than the current incoming request + found = sNumSeqRequests[seqPlayerIndex]; + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + if (priority >= sSeqRequests[seqPlayerIndex][i].priority) { + found = i; + i = sNumSeqRequests[seqPlayerIndex]; // "break;" + } + } + + // Check if the queue is full + if (sNumSeqRequests[seqPlayerIndex] < ARRAY_COUNT(sSeqRequests[seqPlayerIndex])) { + sNumSeqRequests[seqPlayerIndex]++; + } + + for (i = sNumSeqRequests[seqPlayerIndex] - 1; i != found; i--) { + // Move all requests of lower priority backwards 1 place in the queue + // If the queue is full, overwrite the entry with the lowest priority + sSeqRequests[seqPlayerIndex][i].priority = sSeqRequests[seqPlayerIndex][i - 1].priority; + sSeqRequests[seqPlayerIndex][i].seqId = sSeqRequests[seqPlayerIndex][i - 1].seqId; + } + + // Fill the newly freed space in the queue with the new request + sSeqRequests[seqPlayerIndex][found].priority = seqArgs; + sSeqRequests[seqPlayerIndex][found].seqId = seqId; + + // The sequence is first in queue, so start playing. + if (found == 0) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } + break; + + case SEQCMD_OP_UNQUEUE_SEQUENCE: + // Unqueue sequence + fadeTimer = (cmd & 0xFF0000) >> 13; + + found = sNumSeqRequests[seqPlayerIndex]; + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + seqId = cmd & SEQCMD_SEQID_MASK; + if (sSeqRequests[seqPlayerIndex][i].seqId == seqId) { + found = i; + i = sNumSeqRequests[seqPlayerIndex]; // "break;" + } + } + + if (found != sNumSeqRequests[seqPlayerIndex]) { + // Move all requests of lower priority forward 1 place in the queue + for (i = found; i < sNumSeqRequests[seqPlayerIndex] - 1; i++) { + sSeqRequests[seqPlayerIndex][i].priority = sSeqRequests[seqPlayerIndex][i + 1].priority; + sSeqRequests[seqPlayerIndex][i].seqId = sSeqRequests[seqPlayerIndex][i + 1].seqId; + } + sNumSeqRequests[seqPlayerIndex]--; + } + + // If the sequence was first in queue (it is currently playing), + // Then stop the sequence and play the next sequence in the queue. + if (found == 0) { + AudioSeq_StopSequence(seqPlayerIndex, fadeTimer); + if (sNumSeqRequests[seqPlayerIndex] != 0) { + AudioSeq_StartSequence(seqPlayerIndex, sSeqRequests[seqPlayerIndex][0].seqId, + sSeqRequests[seqPlayerIndex][0].priority, fadeTimer); + } + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_VOLUME: + // Transition volume to a target volume for an entire player + duration = (cmd & 0xFF0000) >> 15; + val = cmd & 0xFF; + if (duration == 0) { + duration++; + } + // Volume is scaled relative to 127 + gActiveSeqs[seqPlayerIndex].volTarget = (f32)val / 127.0f; + if (gActiveSeqs[seqPlayerIndex].volCur != gActiveSeqs[seqPlayerIndex].volTarget) { + gActiveSeqs[seqPlayerIndex].volStep = + (gActiveSeqs[seqPlayerIndex].volCur - gActiveSeqs[seqPlayerIndex].volTarget) / (f32)duration; + gActiveSeqs[seqPlayerIndex].volTimer = duration; + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_FREQ: + // Transition freq scale to a target freq for all channels + duration = (cmd & 0xFF0000) >> 15; + val = cmd & 0xFFFF; + if (duration == 0) { + duration++; + } + // Frequency is scaled relative to 1000 + freqScaleTarget = (f32)val / 1000.0f; + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleTarget = freqScaleTarget; + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleTimer = duration; + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleStep = + (gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleCur - freqScaleTarget) / (f32)duration; + } + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0xFFFF; + break; + + case SEQCMD_OP_SET_CHANNEL_FREQ: + // Transition freq scale to a target for a specific channel + duration = (cmd & 0xFF0000) >> 15; + channelIndex = (cmd & 0xF000) >> 12; + val = cmd & 0xFFF; + if (duration == 0) { + duration++; + } + // Frequency is scaled relative to 1000 + freqScaleTarget = (f32)val / 1000.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTarget = freqScaleTarget; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleStep = + (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur - freqScaleTarget) / (f32)duration; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer = duration; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags |= 1 << channelIndex; + break; + + case SEQCMD_OP_SET_CHANNEL_VOLUME: + // Transition volume to a target volume for a specific channel + duration = (cmd & 0xFF0000) >> 15; + channelIndex = (cmd & 0xF00) >> 8; + val = cmd & 0xFF; + if (duration == 0) { + duration++; + } + // Volume is scaled relative to 127 + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget = (f32)val / 127.0f; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur != + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volStep = + (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur - + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget) / + (f32)duration; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer = duration; + gActiveSeqs[seqPlayerIndex].volChannelFlags |= 1 << channelIndex; + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_IO: + // Set global io port + ioPort = (cmd & 0xFF0000) >> 16; + val = cmd & 0xFF; + AUDIOCMD_SEQPLAYER_SET_IO(seqPlayerIndex, ioPort, val); + break; + + case SEQCMD_OP_SET_CHANNEL_IO: + // Set io port if channel masked + channelIndex = (cmd & 0xF00) >> 8; + ioPort = (cmd & 0xFF0000) >> 16; + val = cmd & 0xFF; + if (!(gActiveSeqs[seqPlayerIndex].channelPortMask & (1 << channelIndex))) { + AUDIOCMD_CHANNEL_SET_IO(seqPlayerIndex, channelIndex, ioPort, val); + } + break; + + case SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK: + // Disable channel io specifically for `SEQCMD_OP_SET_CHANNEL_IO`. + // This can be bypassed by setting channel io through using `AUDIOCMD_CHANNEL_SET_IO` directly. + // This is accomplished by setting a channel mask. + gActiveSeqs[seqPlayerIndex].channelPortMask = cmd & 0xFFFF; + break; + + case SEQCMD_OP_SET_CHANNEL_DISABLE_MASK: + // Disable or Reenable channels + + // Disable channels + channelMaskDisable = cmd & 0xFFFF; + if (channelMaskDisable != 0) { + // Apply channel mask `channelMaskDisable` + AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, channelMaskDisable); + // Disable channels + AUDIOCMD_CHANNEL_SET_MUTE(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, true); + } + + // Reenable channels + channelMaskEnable = channelMaskDisable ^ 0xFFFF; + if (channelMaskEnable != 0) { + // Apply channel mask `channelMaskEnable` + AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, channelMaskEnable); + // Enable channels + AUDIOCMD_CHANNEL_SET_MUTE(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, false); + } + break; + + case SEQCMD_OP_TEMPO_CMD: + // Update a tempo using a sub-command system. + // Stores the cmd for processing elsewhere. + gActiveSeqs[seqPlayerIndex].tempoCmd = cmd; + break; + + case SEQCMD_OP_SETUP_CMD: + // Queue a sub-command to execute once the sequence is finished playing + subOp = (cmd & 0xF00000) >> 20; + if (subOp != SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS) { + // Ensure the maximum number of setup commands is not exceeded + if (gActiveSeqs[seqPlayerIndex].setupCmdNum < (ARRAY_COUNT(gActiveSeqs[seqPlayerIndex].setupCmd) - 1)) { + found = gActiveSeqs[seqPlayerIndex].setupCmdNum++; + if (found < ARRAY_COUNT(gActiveSeqs[seqPlayerIndex].setupCmd)) { + gActiveSeqs[seqPlayerIndex].setupCmd[found] = cmd; + // Adds a delay of 2 frames before executing any setup commands. + // This allows setup commands to be requested along with a new sequence on a seqPlayerIndex. + // This 2 frame delay ensures the player is enabled before its state is checked for + // the purpose of deciding if the setup commands should be run. + // Otherwise, the setup commands will be executed before the sequence starts, + // when the player is still disabled, instead of when the newly played sequence ends. + gActiveSeqs[seqPlayerIndex].setupCmdTimer = 2; + } + } + } else { + // `SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS` + // Discard all setup command requests on `seqPlayerIndex` + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + } + break; + + case SEQCMD_OP_GLOBAL_CMD: + // Apply a command that applies to all sequence players + subOp = (cmd & 0xF00) >> 8; + val = cmd & 0xFF; + switch (subOp) { + case SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE: + // Set sound mode + AUDIOCMD_GLOBAL_SET_SOUND_MODE(sSoundModeList[val]); + break; + + case SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES: + // Set sequence disabled in (sStartSeqDisabled & 1) bit + sStartSeqDisabled = (sStartSeqDisabled & (u8)~1) | (u8)(val & 1); + break; + + case SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2: + // Set sequence disabled in (sStartSeqDisabled & 2) bit + sStartSeqDisabled = (sStartSeqDisabled & (u8)~2) | (u8)((val & 1) << 1); + break; + } + break; + + case SEQCMD_OP_RESET_AUDIO_HEAP: + // Resets the audio heap based on the audio specifications, audio mode, and sfx channel layout + specId = cmd & 0xFF; + fadeReverb = (cmd & 0xFF0000) >> 16; + if (fadeReverb == 0) { + gSfxChannelLayout = (cmd & 0xFF00) >> 8; + oldSpecId = gAudioSpecId; + gAudioSpecId = specId; + AudioThread_ResetAudioHeap(specId); + Audio_ResetForAudioHeapStep1(oldSpecId); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + } else { + sResetAudioHeapSeqCmd = cmd; + sResetAudioHeapFadeReverbVolume = 0x7FFF; + sResetAudioHeapTimer = 20; + sResetAudioHeapFadeReverbVolumeStep = 0x666; + } + break; + } +} + +/** + * Add the sequence cmd to the `sAudioSeqCmds` queue + */ +void AudioSeq_QueueSeqCmd(u32 cmd) { + sAudioSeqCmds[sSeqCmdWritePos++] = cmd; +} + +void AudioSeq_ProcessSeqCmds(void) { + while (sSeqCmdWritePos != sSeqCmdReadPos) { + AudioSeq_ProcessSeqCmd(sAudioSeqCmds[sSeqCmdReadPos++]); + } +} + +u16 AudioSeq_GetActiveSeqId(u8 seqPlayerIndex) { + if (gActiveSeqs[seqPlayerIndex].isWaitingForFonts == true) { + return gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd & SEQCMD_SEQID_MASK; + } + + if (gActiveSeqs[seqPlayerIndex].seqId != NA_BGM_DISABLED) { + return gActiveSeqs[seqPlayerIndex].seqId; + } + + return NA_BGM_DISABLED; +} + +s32 AudioSeq_IsSeqCmdNotQueued(u32 cmdVal, u32 cmdMask) { + u8 i; + + for (i = sSeqCmdReadPos; i != sSeqCmdWritePos; i++) { + if ((sAudioSeqCmds[i] & cmdMask) == cmdVal) { + return false; + } + } + + return true; +} + +// Unused +void AudioSeq_ResetSequenceRequests(u8 seqPlayerIndex) { + sNumSeqRequests[seqPlayerIndex] = 0; +} + +/** + * Check if the setup command is queued. If it is, then replace the command + * with `SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME`. + * Unused + */ +void AudioSeq_ReplaceSeqCmdSetupOpVolRestore(u8 seqPlayerIndex, u8 setupOpDisabled) { + u8 i; + + for (i = 0; i < gActiveSeqs[seqPlayerIndex].setupCmdNum; i++) { + u8 setupOp = (gActiveSeqs[seqPlayerIndex].setupCmd[i] & 0xF00000) >> 20; + + if (setupOp == setupOpDisabled) { + gActiveSeqs[seqPlayerIndex].setupCmd[i] = 0xFF000000; + } + } +} + +void AudioSeq_SetVolumeScale(u8 seqPlayerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer) { + f32 volScale; + u8 i; + + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = targetVol & 0x7F; + + if (volFadeTimer != 0) { + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = true; + gActiveSeqs[seqPlayerIndex].volFadeTimer = volFadeTimer; + } else { + for (i = 0, volScale = 1.0f; i < VOL_SCALE_INDEX_MAX; i++) { + volScale *= gActiveSeqs[seqPlayerIndex].volScales[i] / 127.0f; + } + + SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, volFadeTimer, volScale); + } +} + +/** + * Update different commands and requests for active sequences + */ +void AudioSeq_UpdateActiveSequences(void) { + u32 tempoCmd; + u16 tempoPrev; + u16 seqId; + u16 channelMask; + u16 tempoTarget; + u8 setupOp; + u8 targetSeqPlayerIndex; + u8 setupVal2; + u8 setupVal1; + u8 tempoOp; + s32 pad[2]; + u32 retMsg; + f32 volume; + u8 tempoTimer; + u8 seqPlayerIndex; + u8 j; + u8 channelIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + + // The seqPlayer has finished initializing and is currently playing the active sequences + if (gActiveSeqs[seqPlayerIndex].isSeqPlayerInit && gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = false; + } + + // The seqPlayer is no longer playing the active sequences + if ((AudioSeq_GetActiveSeqId(seqPlayerIndex) != NA_BGM_DISABLED) && + !gAudioCtx.seqPlayers[seqPlayerIndex].enabled && (!gActiveSeqs[seqPlayerIndex].isSeqPlayerInit)) { + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; + } + + // Check if the requested sequences is waiting for fonts to load + if (gActiveSeqs[seqPlayerIndex].isWaitingForFonts) { + switch ((s32)AudioThread_GetExternalLoadQueueMsg(&retMsg)) { + case SEQ_PLAYER_BGM_MAIN + 1: + case SEQ_PLAYER_FANFARE + 1: + case SEQ_PLAYER_SFX + 1: + case SEQ_PLAYER_BGM_SUB + 1: + case SEQ_PLAYER_AMBIENCE + 1: + // The fonts have been loaded successfully. + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + // Queue the same command that was stored previously, but without the 0x8000 + AudioSeq_ProcessSeqCmd(gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd); + break; + case 0xFF: + // There was an error in loading the fonts + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + break; + } + } + + // Update global volume + if (gActiveSeqs[seqPlayerIndex].fadeVolUpdate) { + volume = 1.0f; + for (j = 0; j < VOL_SCALE_INDEX_MAX; j++) { + volume *= (gActiveSeqs[seqPlayerIndex].volScales[j] / 127.0f); + } + + SEQCMD_SET_SEQPLAYER_VOLUME((u8)(seqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + gActiveSeqs[seqPlayerIndex].volFadeTimer, (u8)(volume * 127.0f)); + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = false; + } + + if (gActiveSeqs[seqPlayerIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].volTimer--; + + if (gActiveSeqs[seqPlayerIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].volCur -= gActiveSeqs[seqPlayerIndex].volStep; + } else { + gActiveSeqs[seqPlayerIndex].volCur = gActiveSeqs[seqPlayerIndex].volTarget; + } + + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].volCur); + } + + // Process tempo + if (gActiveSeqs[seqPlayerIndex].tempoCmd != 0) { + tempoCmd = gActiveSeqs[seqPlayerIndex].tempoCmd; + tempoTimer = (tempoCmd & 0xFF0000) >> 15; + tempoTarget = tempoCmd & 0xFFF; + if (tempoTimer == 0) { + tempoTimer++; + } + + // Process tempo commands + if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + tempoPrev = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT; + tempoOp = (tempoCmd & 0xF000) >> 12; + switch (tempoOp) { + case SEQCMD_SUB_OP_TEMPO_SPEED_UP: + // Speed up tempo by `tempoTarget` amount + tempoTarget += tempoPrev; + break; + + case SEQCMD_SUB_OP_TEMPO_SLOW_DOWN: + // Slow down tempo by `tempoTarget` amount + if (tempoTarget < tempoPrev) { + tempoTarget = tempoPrev - tempoTarget; + } + break; + + case SEQCMD_SUB_OP_TEMPO_SCALE: + // Scale tempo by a multiplicative factor + tempoTarget = tempoPrev * (tempoTarget / 100.0f); + break; + + case SEQCMD_SUB_OP_TEMPO_RESET: + // Reset tempo to original tempo + tempoTarget = (gActiveSeqs[seqPlayerIndex].tempoOriginal != 0) + ? gActiveSeqs[seqPlayerIndex].tempoOriginal + : tempoPrev; + break; + + default: // `SEQCMD_SUB_OP_TEMPO_SET` + // `tempoTarget` is the new tempo + break; + } + + if (gActiveSeqs[seqPlayerIndex].tempoOriginal == 0) { + gActiveSeqs[seqPlayerIndex].tempoOriginal = tempoPrev; + } + + gActiveSeqs[seqPlayerIndex].tempoTarget = tempoTarget; + gActiveSeqs[seqPlayerIndex].tempoCur = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / 0x30; + gActiveSeqs[seqPlayerIndex].tempoStep = + (gActiveSeqs[seqPlayerIndex].tempoCur - gActiveSeqs[seqPlayerIndex].tempoTarget) / tempoTimer; + gActiveSeqs[seqPlayerIndex].tempoTimer = tempoTimer; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; + } + } + + // Step tempo to target + if (gActiveSeqs[seqPlayerIndex].tempoTimer != 0) { + gActiveSeqs[seqPlayerIndex].tempoTimer--; + if (gActiveSeqs[seqPlayerIndex].tempoTimer != 0) { + gActiveSeqs[seqPlayerIndex].tempoCur -= gActiveSeqs[seqPlayerIndex].tempoStep; + } else { + gActiveSeqs[seqPlayerIndex].tempoCur = gActiveSeqs[seqPlayerIndex].tempoTarget; + } + + AUDIOCMD_SEQPLAYER_SET_TEMPO(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].tempoCur); + } + + // Update channel volumes + if (gActiveSeqs[seqPlayerIndex].volChannelFlags != 0) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer--; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur -= + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volStep; + } else { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur = + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget; + gActiveSeqs[seqPlayerIndex].volChannelFlags ^= (1 << channelIndex); + } + + AUDIOCMD_CHANNEL_SET_VOL_SCALE(seqPlayerIndex, channelIndex, + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur); + } + } + } + + // Update frequencies + if (gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags != 0) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer--; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur -= + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleStep; + } else { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur = + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTarget; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags ^= (1 << channelIndex); + } + + AUDIOCMD_CHANNEL_SET_FREQ_SCALE(seqPlayerIndex, channelIndex, + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur); + } + } + } + + // Process setup commands + if (gActiveSeqs[seqPlayerIndex].setupCmdNum != 0) { + // If there is a SeqCmd to reset the audio heap queued, then drop all setup commands + if (!AudioSeq_IsSeqCmdNotQueued(SEQCMD_OP_RESET_AUDIO_HEAP << 28, SEQCMD_OP_MASK)) { + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + break; + } + + // Only process setup commands once the timer reaches zero + if (gActiveSeqs[seqPlayerIndex].setupCmdTimer != 0) { + gActiveSeqs[seqPlayerIndex].setupCmdTimer--; + continue; + } + + // Only process setup commands if `seqPlayerIndex` if no longer playing + // i.e. the `seqPlayer` is no longer enabled + if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + continue; + } + + for (j = 0; j < gActiveSeqs[seqPlayerIndex].setupCmdNum; j++) { + setupOp = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xF00000) >> 20; + targetSeqPlayerIndex = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xF0000) >> 16; + setupVal2 = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFF00) >> 8; + setupVal1 = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFF; + + switch (setupOp) { + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME: + // Restore `targetSeqPlayerIndex` volume back to normal levels + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED: + // Restore `targetSeqPlayerIndex` volume back to normal levels, + // but only if the number of sequence queue requests from `sSeqRequests` + // exactly matches the argument to the command + if (setupVal1 == sNumSeqRequests[seqPlayerIndex]) { + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, setupVal2); + } + break; + + case SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE: + // Unqueue `seqPlayerIndex` from sSeqRequests + //! @bug this command does not work as intended as unqueueing + //! the sequence relies on `gActiveSeqs[seqPlayerIndex].seqId` + //! However, `gActiveSeqs[seqPlayerIndex].seqId` is reset before the sequence on + //! `seqPlayerIndex` is requested to stop, i.e. before the sequence is disabled and setup + //! commands (including this command) can run. A simple fix would have been to unqueue based on + //! `gActiveSeqs[seqPlayerIndex].prevSeqId` instead + SEQCMD_UNQUEUE_SEQUENCE((u8)(seqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), 0, + gActiveSeqs[seqPlayerIndex].seqId); + break; + + case SEQCMD_SUB_OP_SETUP_RESTART_SEQ: + // Restart the currently active sequence on `targetSeqPlayerIndex` with full volume. + // Sequence on `targetSeqPlayerIndex` must still be active to play (can be muted) + SEQCMD_PLAY_SEQUENCE((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), 1, + gActiveSeqs[targetSeqPlayerIndex].seqId); + gActiveSeqs[targetSeqPlayerIndex].fadeVolUpdate = true; + gActiveSeqs[targetSeqPlayerIndex].volScales[1] = 0x7F; + break; + + case SEQCMD_SUB_OP_SETUP_TEMPO_SCALE: + // Scale tempo by a multiplicative factor + SEQCMD_SCALE_TEMPO((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal2, + setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_TEMPO_RESET: + // Reset tempo to previous tempo + SEQCMD_RESET_TEMPO((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_PLAY_SEQ: + // Play the requested sequence + // Uses the fade timer set by `SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER` + seqId = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFFFF; + SEQCMD_PLAY_SEQUENCE((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + gActiveSeqs[targetSeqPlayerIndex].setupFadeTimer, seqId); + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, 0); + gActiveSeqs[targetSeqPlayerIndex].setupFadeTimer = 0; + break; + + case SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER: + // A command specifically to support `SEQCMD_SUB_OP_SETUP_PLAY_SEQ` + // Sets the fade timer for the sequence requested in `SEQCMD_SUB_OP_SETUP_PLAY_SEQ` + gActiveSeqs[seqPlayerIndex].setupFadeTimer = setupVal2; + break; + + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX: + // Restore the volume back to default levels + // Allows a `scaleIndex` to be specified. + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, setupVal2, 0x7F, setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE: + // Discard audio data by popping one more audio caches from the audio heap + if (setupVal1 & (1 << SEQUENCE_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(SEQUENCE_TABLE); + } + if (setupVal1 & (1 << FONT_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(FONT_TABLE); + } + if (setupVal1 & (1 << SAMPLE_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(SAMPLE_TABLE); + } + break; + + case SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK: + // Disable (or reenable) specific channels of `targetSeqPlayerIndex` + channelMask = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFFFF; + SEQCMD_SET_CHANNEL_DISABLE_MASK((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + channelMask); + break; + + case SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ: + // Scale all channels of `targetSeqPlayerIndex` + SEQCMD_SET_SEQPLAYER_FREQ((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal2, + setupVal1 * 10); + break; + + default: + break; + } + } + + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + } + } +} + +u8 AudioSeq_UpdateAudioHeapReset(void) { + if (gAudioHeapResetState != AUDIO_HEAP_RESET_STATE_NONE) { + if (gAudioHeapResetState == AUDIO_HEAP_RESET_STATE_RESETTING) { + if (func_80193C5C() == 1) { + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep2(); + } + } else if (gAudioHeapResetState == AUDIO_HEAP_RESET_STATE_RESETTING_ALT) { + while (func_80193C5C() != 1) {} + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep2(); + } + } + + return gAudioHeapResetState; +} + +u8 AudioSeq_ResetReverb(void) { + u8 isReverbFading = false; + u8 fadeReverb = ((sResetAudioHeapSeqCmd & 0xFF0000) >> 16); + u8 reverbIndex = 0; + u8 specId; + + if (sResetAudioHeapSeqCmd != 0) { + if (sResetAudioHeapTimer--) { + while (fadeReverb != 0) { + if (fadeReverb & 1) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, REVERB_DATA_TYPE_VOLUME, + sResetAudioHeapFadeReverbVolume); + AudioThread_ScheduleProcessCmds(); + } + reverbIndex++; + fadeReverb = fadeReverb >> 1; + } + + sResetAudioHeapFadeReverbVolume -= sResetAudioHeapFadeReverbVolumeStep; + isReverbFading = true; + } else { + while (fadeReverb != 0) { + if (fadeReverb & 1) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA( + reverbIndex, REVERB_DATA_TYPE_SETTINGS, + (s32)(gReverbSettingsTable[(u8)(sResetAudioHeapSeqCmd & 0xFF)] + reverbIndex)); + AudioThread_ScheduleProcessCmds(); + } + reverbIndex++; + fadeReverb = fadeReverb >> 1; + } + + sResetAudioHeapSeqCmd = 0; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep3(); + } + } + + return isReverbFading; +} + +void AudioSeq_ResetActiveSequences(void) { + u8 seqPlayerIndex; + u8 scaleIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + sNumSeqRequests[seqPlayerIndex] = 0; + + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; + gActiveSeqs[seqPlayerIndex].prevSeqId = NA_BGM_DISABLED; + gActiveSeqs[seqPlayerIndex].tempoTimer = 0; + gActiveSeqs[seqPlayerIndex].tempoOriginal = 0; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; + gActiveSeqs[seqPlayerIndex].channelPortMask = 0; + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + gActiveSeqs[seqPlayerIndex].setupFadeTimer = 0; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].volChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = false; + + for (scaleIndex = 0; scaleIndex < VOL_SCALE_INDEX_MAX; scaleIndex++) { + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = 0x7F; + } + + gActiveSeqs[seqPlayerIndex].volFadeTimer = 1; + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = true; + } +} + +void AudioSeq_ResetActiveSequencesAndVolume(void) { + u8 seqPlayerIndex; + u8 scaleIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + gActiveSeqs[seqPlayerIndex].volCur = 1.0f; + gActiveSeqs[seqPlayerIndex].volTimer = 0; + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = false; + for (scaleIndex = 0; scaleIndex < VOL_SCALE_INDEX_MAX; scaleIndex++) { + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = 0x7F; + } + } + AudioSeq_ResetActiveSequences(); +} diff --git a/src/code/audio/audio_init_params.c b/src/audio/session_config.c similarity index 99% rename from src/code/audio/audio_init_params.c rename to src/audio/session_config.c index 6bba865e9..e0881913b 100644 --- a/src/code/audio/audio_init_params.c +++ b/src/audio/session_config.c @@ -1,4 +1,5 @@ #include "global.h" +#include "buffers.h" const s16 gAudioTatumInit[] = { 0x1C00, // unused diff --git a/src/code/audio/code_801A5BD0.c b/src/audio/sfx.c similarity index 99% rename from src/code/audio/code_801A5BD0.c rename to src/audio/sfx.c index 76597f5f3..537a9f394 100644 --- a/src/code/audio/code_801A5BD0.c +++ b/src/audio/sfx.c @@ -102,8 +102,8 @@ void AudioSfx_MuteBanks(u16 muteMask) { void AudioSfx_LowerBgmVolume(u8 channelIndex) { sSfxChannelLowVolumeFlag |= (1 << channelIndex); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x40, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x40, 0xF); } /** @@ -114,8 +114,8 @@ void AudioSfx_RestoreBgmVolume(u8 channelIndex) { sSfxChannelLowVolumeFlag &= ((1 << channelIndex) ^ 0xFFFF); if (sSfxChannelLowVolumeFlag == 0) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x7F, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x7F, 0xF); } } diff --git a/src/code/audio/audio_sfx_params.c b/src/audio/sfx_params.c similarity index 100% rename from src/code/audio/audio_sfx_params.c rename to src/audio/sfx_params.c diff --git a/src/audio/voice_external.c b/src/audio/voice_external.c new file mode 100644 index 000000000..eba2069d8 --- /dev/null +++ b/src/audio/voice_external.c @@ -0,0 +1,17 @@ +#include "global.h" + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4EB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4EB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A4FD8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5080.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A50C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5100.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A510C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_external/func_801A5118.s") diff --git a/src/audio/voice_internal.c b/src/audio/voice_internal.c new file mode 100644 index 000000000..055b66ed1 --- /dev/null +++ b/src/audio/voice_internal.c @@ -0,0 +1,42 @@ +#include "global.h" + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/D_801E0EC0.s") + +UNK_TYPE func_801A51F0(UNK_TYPE arg0) { + switch (arg0) { + case 1: + case 4: + case 5: + case 11: + case 13: + case 14: + case 15: + return -1; + default: + return 0; + } +} + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5228.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5390.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A53DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A53E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A541C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5488.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A54C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A54D0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5680.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5808.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/AudioVoice_ResetData.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5A1C.s") diff --git a/src/boot_O2_g3/CIC6105.c b/src/boot_O2_g3/CIC6105.c index 78eed1a77..4745ad5c8 100644 --- a/src/boot_O2_g3/CIC6105.c +++ b/src/boot_O2_g3/CIC6105.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" UNK_TYPE4 D_8009BE30; diff --git a/src/boot_O2_g3/boot_main.c b/src/boot_O2_g3/boot_main.c index 87bee5da4..061458a1d 100644 --- a/src/boot_O2_g3/boot_main.c +++ b/src/boot_O2_g3/boot_main.c @@ -1,21 +1,22 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "stack.h" -StackEntry sBootThreadInfo; +StackEntry sBootStackInfo; OSThread sIdleThread; -u8 sIdleThreadStack[0x400]; -StackEntry sIdleThreadInfo; -u8 sBootThreadStack[0x400]; +STACK(sIdleThreadStack, 0x400); +StackEntry sIdleStackInfo; +STACK(sBootThreadStack, 0x400); void bootproc(void) { - StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot"); + StackCheck_Init(&sBootStackInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot"); osMemSize = osGetMemSize(); func_800818F4(); osInitialize(); osUnmapTLBAll(); gCartHandle = osCartRomInit(); - StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle"); - osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), + StackCheck_Init(&sIdleStackInfo, sIdleThreadStack, STACK_TOP(sIdleThreadStack), 0, 0x100, "idle"); + osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, STACK_TOP(sIdleThreadStack), Z_PRIORITY_IDLE); osStartThread(&sIdleThread); } diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index e648275b6..134b120dc 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -1,7 +1,15 @@ #include "ultra64.h" #include "global.h" +#include "stack.h" #include "vt.h" +extern FaultThreadStruct* sFaultContext; +extern f32 D_8009BE54; +extern u32 faultCustomOptions; +extern u32 faultCopyToLog; +extern STACK(sFaultStack, 0x600); +extern StackEntry sFaultStackInfo; + // data const char* sCpuExceptions[] = { "Interrupt", @@ -759,9 +767,9 @@ void Fault_SetOptionsFromController3(void) { } if (faultCustomOptions) { - graphPC = sGraphThread.context.pc; - graphRA = sGraphThread.context.ra; - graphSP = sGraphThread.context.sp; + graphPC = gGraphThread.context.pc; + graphRA = gGraphThread.context.ra; + graphSP = gGraphThread.context.sp; if (CHECK_BTN_ALL(input3->cur.button, BTN_R)) { static u32 faultCopyToLog; @@ -889,8 +897,8 @@ void Fault_Start(void) { sFaultContext->faultActive = 0; gFaultStruct.faultHandlerEnabled = 1; osCreateMesgQueue(&sFaultContext->queue, sFaultContext->msg, ARRAY_COUNT(sFaultContext->msg)); - StackCheck_Init(&sFaultThreadInfo, sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault"); - osCreateThread(&sFaultContext->thread, 2, Fault_ThreadEntry, NULL, sFaultStack + sizeof(sFaultStack), 0x7F); + StackCheck_Init(&sFaultStackInfo, sFaultStack, STACK_TOP(sFaultStack), 0, 0x100, "fault"); + osCreateThread(&sFaultContext->thread, 2, Fault_ThreadEntry, NULL, STACK_TOP(sFaultStack), 0x7F); osStartThread(&sFaultContext->thread); } diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index da93f13fd..40bcf5d0e 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -1,5 +1,7 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "stack.h" +#include "buffers.h" u8 D_80096B20 = 1; vu8 gViConfigUseDefault = 1; @@ -9,10 +11,10 @@ f32 gViConfigXScale = 1.0f; f32 gViConfigYScale = 1.0f; IrqMgr gIrqMgr; -u8 sIrqMgrStack[0x500]; +STACK(sIrqMgrStack, 0x500); StackEntry sIrqMgrStackInfo; -OSThread gMainThread; -u8 sMainStack[0x900]; +OSThread sMainThread; +STACK(sMainStack, 0x900); StackEntry sMainStackInfo; OSMesg sPiMgrCmdBuff[50]; OSMesgQueue gPiMgrCmdQ; @@ -71,8 +73,8 @@ void Idle_InitCodeAndMemory(void) { } void Main_ThreadEntry(void* arg) { - StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr"); - IrqMgr_Init(&gIrqMgr, &sIrqMgrStackInfo, Z_PRIORITY_IRQMGR, 1); + StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr"); + IrqMgr_Init(&gIrqMgr, STACK_TOP(sIrqMgrStack), Z_PRIORITY_IRQMGR, 1); DmaMgr_Start(); Idle_InitCodeAndMemory(); Main(arg); @@ -108,10 +110,9 @@ void Idle_InitVideo(void) { void Idle_ThreadEntry(void* arg) { Idle_InitVideo(); osCreatePiManager(150, &gPiMgrCmdQ, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff)); - StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 0x400, "main"); - osCreateThread(&gMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), - Z_PRIORITY_MAIN); - osStartThread(&gMainThread); + StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x400, "main"); + osCreateThread(&sMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, STACK_TOP(sMainStack), Z_PRIORITY_MAIN); + osStartThread(&sMainThread); osSetThreadPri(NULL, 0); do { } while (true); } diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index b100f209d..152c69b89 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -163,6 +163,6 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) { osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D); osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount); - osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, (osCreateThread_func)IrqMgr_ThreadEntry, irqmgr, stack, pri); + osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, IrqMgr_ThreadEntry, irqmgr, stack, pri); osStartThread(&irqmgr->thread); } diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 8e9d83872..dd34d9e87 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "stack.h" u32 sDmaMgrDmaBuffSize = 0x2000; @@ -8,7 +9,7 @@ u16 numDmaEntries; OSMesgQueue sDmaMgrMsgQueue; OSMesg sDmaMgrMsgs[32]; OSThread sDmaMgrThread; -u8 sDmaMgrStack[0x500]; +STACK(sDmaMgrStack, 0x500); s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) { OSIoMesg ioMsg; @@ -226,8 +227,8 @@ void DmaMgr_Start(void) { } osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs)); - StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 0x100, "dmamgr"); - osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack), + StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, STACK_TOP(sDmaMgrStack), 0, 0x100, "dmamgr"); + osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, STACK_TOP(sDmaMgrStack), Z_PRIORITY_DMAMGR); osStartThread(&sDmaMgrThread); diff --git a/src/buffers/gfxpools.c b/src/buffers/gfxpools.c index a91c87bed..ff4934f11 100644 --- a/src/buffers/gfxpools.c +++ b/src/buffers/gfxpools.c @@ -1,3 +1,3 @@ -#include "global.h" +#include "buffers.h" GfxPool gGfxPools[2]; diff --git a/src/buffers/gfxstack.c b/src/buffers/gfxstack.c index 2b158d141..8864d58ef 100644 --- a/src/buffers/gfxstack.c +++ b/src/buffers/gfxstack.c @@ -1,3 +1,3 @@ -#include "global.h" +#include "buffers.h" -u8 gGfxSPTaskStack[0x400]; +STACK(gGfxSPTaskStack, 0x400); diff --git a/src/buffers/gfxyield.c b/src/buffers/gfxyield.c index 94a5f55c9..576cfc0bb 100644 --- a/src/buffers/gfxyield.c +++ b/src/buffers/gfxyield.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" -#include "global.h" +#include "buffers.h" u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; diff --git a/src/buffers/heaps.c b/src/buffers/heaps.c index 866d51c16..477eca03e 100644 --- a/src/buffers/heaps.c +++ b/src/buffers/heaps.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "buffers.h" u8 gAudioHeap[0x138000]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 599f4c8d3..075f941d4 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -1,4 +1,6 @@ #include "global.h" +#include "slowly.h" +#include "stack.h" /** * Assigns the "save" values in PreRender @@ -51,8 +53,8 @@ void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 ar flags = 0x1C; } - func_80172758(&gfx, buf, NULL, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, - 1.0f, 1.0f, flags); + Prerender_DrawBackground2D(&gfx, buf, NULL, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, + 0.0f, 0.0f, 1.0f, 1.0f, flags); gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); @@ -87,8 +89,8 @@ void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 en gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height); - func_80172758(&gfx, buf, 0, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, 1.0f, - 1.0f, 0xB); + Prerender_DrawBackground2D(&gfx, buf, 0, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, + 0.0f, 1.0f, 1.0f, 0xB); gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); @@ -410,19 +412,24 @@ void PreRender_ApplyFilters(PreRender* this) { } } +extern SlowlyMgr sSlowlyMgr; +extern s32 D_801F6FC0; +extern StackEntry sSlowlyStackInfo; +extern STACK(sSlowlyStack, 0x1000); + /** * Initializes `PreRender_ApplyFilters` onto a new "slowly" thread */ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) { if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { if (D_801F6FC0) { - StackCheck_Cleanup(&slowlyStackEntry); - Slowly_Stop(&D_801F6E00); + StackCheck_Cleanup(&sSlowlyStackInfo); + Slowly_Destroy(&sSlowlyMgr); } this->unk_4D = 1; - StackCheck_Init(&slowlyStackEntry, slowlyStack, &slowlyStack[4096], 0, 0x100, "slowly"); - Slowly_Start(&D_801F6E00, &D_801F7FE8, PreRender_ApplyFilters, this, NULL); + StackCheck_Init(&sSlowlyStackInfo, sSlowlyStack, STACK_TOP(sSlowlyStack), 0, 0x100, "slowly"); + Slowly_Init(&sSlowlyMgr, STACK_TOP(sSlowlyStack), (void*)PreRender_ApplyFilters, this, NULL); D_801F6FC0 = true; } } @@ -432,8 +439,8 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) { */ void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this) { if (D_801F6FC0) { - StackCheck_Cleanup(&slowlyStackEntry); - Slowly_Stop(&D_801F6E00); + StackCheck_Cleanup(&sSlowlyStackInfo); + Slowly_Destroy(&sSlowlyMgr); D_801F6FC0 = false; } } @@ -447,8 +454,8 @@ void func_801720C4(PreRender* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_801720FC.s") -void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, - f32 y, f32 xScale, f32 yScale, u32 flags) { +void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, + u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags) { PreRenderParams params; PreRenderParams* paramsp = ¶ms; diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c index 83d5be3d1..a476c3d74 100644 --- a/src/code/TwoHeadArena.c +++ b/src/code/TwoHeadArena.c @@ -1,79 +1,136 @@ -#include "global.h" +/** + * @file TwoHeadArena.c + * + * This file implements a simple general purpose double-ended stack allocator. + * + * A double-ended stack allocator accepts allocations at either the "head" or "tail" of its allotted memory region. + * While in general this type of allocator could accept deallocations on the most recently allocated block at either + * end, this implementation does not support any individual deallocations; the only provided way to deallocate anything + * is to reset the entire arena, deallocating everything. This scheme is most applicable to allocating similar data + * with identical lifetime. + */ + +#include "tha.h" +#include "alignment.h" +#include "functions.h" void* THA_GetHead(TwoHeadArena* tha) { return tha->head; } -void THA_SetHead(TwoHeadArena* tha, void* start) { - tha->head = start; +void THA_SetHead(TwoHeadArena* tha, void* newHead) { + tha->head = newHead; } void* THA_GetTail(TwoHeadArena* tha) { return tha->tail; } -void* THA_AllocStart(TwoHeadArena* tha, size_t size) { +/** + * Allocates to the head of the Two Head Arena. The allocation will not have any alignment guarantees. + */ +void* THA_AllocHead(TwoHeadArena* tha, size_t size) { void* start = tha->head; - tha->head = (u32)tha->head + size; + tha->head = (u8*)tha->head + size; return start; } -void* THA_AllocStart1(TwoHeadArena* tha) { - return THA_AllocStart(tha, 1); +void* THA_AllocHeadByte(TwoHeadArena* tha) { + return THA_AllocHead(tha, 1); } -void* THA_AllocEnd(TwoHeadArena* tha, size_t size) { - u32 mask; +/** + * Allocates to the tail end of the Two Head Arena. The allocation will be aligned based on the size of the allocation. + * All allocations of 16 bytes or more will be aligned to 16-bytes. Otherwise, the alignment will be the largest power + * of 2 for which the size is a multiple, in order to accommodate the alignment requirements of any data types that can + * fit within the allocation. + */ +void* THA_AllocTail(TwoHeadArena* tha, size_t size) { + uintptr_t mask; if (size >= 0x10) { - mask = ~0xF; + // Align 0x10 for allocations greater than 0x10 + mask = ALIGN_MASK(0x10); } else if (size & 1) { - mask = -1; + // No alignment for odd sizes + mask = ALIGN_MASK(1); } else if (size & 2) { - mask = ~0x1; + // Align 2 for multiples of 2 + mask = ALIGN_MASK(2); } else if (size & 4) { - mask = ~0x3; + // Align 4 for multiples of 4 + mask = ALIGN_MASK(4); + } else if (size & 8) { + // Align 8 for multiples of 8 + mask = ALIGN_MASK(8); } else { - mask = (size & 8) ? ~0x7 : -1; + mask = ALIGN_MASK(1); } - tha->tail = (((u32)tha->tail & mask) - size) & mask; + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size) { - u32 mask = ~0xF; +/** + * Allocates to the tail end of the Two Head Arena with guaranteed 16-byte alignment. + */ +void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size) { + uintptr_t mask = ALIGN_MASK(0x10); - tha->tail = (((u32)tha->tail & mask) - size) & mask; + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask) { - tha->tail = (((u32)tha->tail & mask) - size) & mask; +/** + * Allocates to the tail end of the Two Head Arena using the provided mask to align the allocated region. + * + * @param tha Arena to allocate to + * @param size Size of the allocation + * @param mask Mask to use to align the allocated region. To align to n-bytes where n is a power of 2, use the + * ALIGN_MASK(n) macro + * + * @return Pointer to the start of the allocated block + */ +void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask) { + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -s32 THA_GetSize(TwoHeadArena* tha) { - return (u32)tha->tail - (u32)tha->head; +/** + * Gets the remaining size of the Two Head Arena + * + * @return Remaining size. A negative number indicates an overflow. + */ +s32 THA_GetRemaining(TwoHeadArena* tha) { + return (s32)((u8*)tha->tail - (u8*)tha->head); } +/** + * @return true if the Two Head Arena has overflowed, false otherwise + */ u32 THA_IsCrash(TwoHeadArena* tha) { - return THA_GetSize(tha) < 0; + return THA_GetRemaining(tha) < 0; } -void THA_Init(TwoHeadArena* tha) { - tha->head = tha->bufp; - tha->tail = (u32)tha->bufp + tha->size; +void THA_Reset(TwoHeadArena* tha) { + tha->head = tha->start; + tha->tail = (u8*)tha->start + tha->size; } -void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size) { +/** + * Creates a new Two Head Arena at `start` with available size `size` + */ +void THA_Init(TwoHeadArena* tha, void* start, size_t size) { bzero(tha, sizeof(TwoHeadArena)); - tha->bufp = ptr; + tha->start = start; tha->size = size; - THA_Init(tha); + THA_Reset(tha); } -void THA_Dt(TwoHeadArena* tha) { +/** + * Destroys the Two Head Arena, no further allocations are possible + */ +void THA_Destroy(TwoHeadArena* tha) { bzero(tha, sizeof(TwoHeadArena)); } diff --git a/src/code/TwoHeadGfxArena.c b/src/code/TwoHeadGfxArena.c index 2f1629765..d40512efd 100644 --- a/src/code/TwoHeadGfxArena.c +++ b/src/code/TwoHeadGfxArena.c @@ -1,65 +1,105 @@ -#include "global.h" +/** + * @file TwoHeadGfxArena.c + * + * This file implements a particular use of the double-ended stack allocator from TwoHeadArena.c for graphics data. + * + * Display list commands are allocated from the head while other graphics data such as matrices and vertices are + * allocated from the tail end. + * + * @see TwoHeadArena.c + */ -void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size) { - THA_Ct((TwoHeadArena*)thga, start, size); +#include "thga.h" +#include "alignment.h" +#include "functions.h" + +void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size) { + THA_Init(&thga->tha, start, size); } -void THGA_Dt(TwoHeadGfxArena* thga) { - THA_Dt((TwoHeadArena*)thga); +void THGA_Destroy(TwoHeadGfxArena* thga) { + THA_Destroy(&thga->tha); } u32 THGA_IsCrash(TwoHeadGfxArena* thga) { - return THA_IsCrash((TwoHeadArena*)thga); + return THA_IsCrash(&thga->tha); } -void THGA_Init(TwoHeadGfxArena* thga) { - THA_Init((TwoHeadArena*)thga); +void THGA_Reset(TwoHeadGfxArena* thga) { + THA_Reset(&thga->tha); } -s32 THGA_GetSize(TwoHeadGfxArena* thga) { - return THA_GetSize((TwoHeadArena*)thga); +s32 THGA_GetRemaining(TwoHeadGfxArena* thga) { + return THA_GetRemaining(&thga->tha); } Gfx* THGA_GetHead(TwoHeadGfxArena* thga) { - return THA_GetHead((TwoHeadArena*)thga); + return THA_GetHead(&thga->tha); } -void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start) { - THA_SetHead((TwoHeadArena*)thga, start); +void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* newHead) { + THA_SetHead(&thga->tha, newHead); } -Gfx* THGA_GetTail(TwoHeadGfxArena* thga) { - return THA_GetTail((TwoHeadArena*)thga); +void* THGA_GetTail(TwoHeadGfxArena* thga) { + return THA_GetTail(&thga->tha); } -Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count) { - return THA_AllocStart((TwoHeadArena*)thga, count * 8); +/** + * Allocates a display list of `num` Gfx commands to the head of the Two Head Gfx Arena. + */ +Gfx* THGA_AllocDisplayList(TwoHeadGfxArena* thga, size_t num) { + return THA_AllocHead(&thga->tha, num * sizeof(Gfx)); } -Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga) { - return THGA_AllocStartArray8(thga, 1); +/** + * Allocates a single Gfx command to the head of the Two Head Gfx Arena. + */ +Gfx* THGA_AllocGfx(TwoHeadGfxArena* thga) { + return THGA_AllocDisplayList(thga, 1); } -Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) { - return THGA_AllocStart8(thga); +/** + * Identical to `THGA_AllocGfx` + * + * @see THGA_AllocGfx + */ +Gfx* THGA_AllocGfx2(TwoHeadGfxArena* thga) { + return THGA_AllocGfx(thga); } -Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size) { - return THA_AllocEnd((TwoHeadArena*)thga, size); +/** + * Allocates to the end of the Two Head Gfx Arena. Intended for data complementary to the display lists such as + * matrices and vertices that are only needed for a single graphics task. + */ +void* THGA_AllocTail(TwoHeadGfxArena* thga, size_t size) { + return THA_AllocTail(&thga->tha, size); } -Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count) { - return THGA_AllocEnd(thga, count * 0x40); +/** + * Allocates `num` matrices to the tail end of the Two Head Gfx Arena. + */ +Mtx* THGA_AllocMtxArray(TwoHeadGfxArena* thga, size_t num) { + return THGA_AllocTail(thga, num * sizeof(Mtx)); } -Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga) { - return THGA_AllocEnd(thga, 0x40); +/** + * Allocates a matrix to the tail end of the Two Head Gfx Arena. + */ +Mtx* THGA_AllocMtx(TwoHeadGfxArena* thga) { + return THGA_AllocTail(thga, sizeof(Mtx)); } -Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count) { - return THGA_AllocEnd(thga, count * 0x10); +/** + * Allocates `num` vertices to the tail end of the Two Head Gfx Arena. + */ +Vtx* THGA_AllocVtxArray(TwoHeadGfxArena* thga, u32 num) { + return THGA_AllocTail(thga, num * sizeof(Vtx)); } -Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga) { - return THGA_AllocEnd(thga, 0x10); +/** + * Allocates a vertex to the tail end of the Two Head Gfx Arena. + */ +Vtx* THGA_AllocVtx(TwoHeadGfxArena* thga) { + return THGA_AllocTail(thga, sizeof(Vtx)); } diff --git a/src/code/audio/code_801A4EB0.c b/src/code/audio/code_801A4EB0.c deleted file mode 100644 index d3461c8f5..000000000 --- a/src/code/audio/code_801A4EB0.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4EB8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A4FD8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5080.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A50C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5100.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A510C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A4EB0/func_801A5118.s") diff --git a/src/code/audio/code_801A51F0.c b/src/code/audio/code_801A51F0.c deleted file mode 100644 index 6a40bf23a..000000000 --- a/src/code/audio/code_801A51F0.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/D_801E0EC0.s") - -UNK_TYPE func_801A51F0(UNK_TYPE arg0) { - switch (arg0) { - case 1: - case 4: - case 5: - case 11: - case 13: - case 14: - case 15: - return -1; - default: - return 0; - } -} - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5228.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5390.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53DC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A53E8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A541C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5488.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54C4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A54D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5680.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5808.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A10.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A51F0/func_801A5A1C.s") diff --git a/src/code/audio/code_801A7B10.c b/src/code/audio/code_801A7B10.c deleted file mode 100644 index 3f8446036..000000000 --- a/src/code/audio/code_801A7B10.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D84.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_QueueSeqCmd.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A89D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8ABC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8B14.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8B2C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_SetVolumeScale.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8D5C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A9768.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A982C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A99B8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A9A74.s") diff --git a/src/code/code_80172BC0.c b/src/code/audio_stop_all_sfx.c similarity index 100% rename from src/code/code_80172BC0.c rename to src/code/audio_stop_all_sfx.c diff --git a/src/code/audioMgr.c b/src/code/audio_thread_manager.c similarity index 99% rename from src/code/audioMgr.c rename to src/code/audio_thread_manager.c index eca7ddd83..45fbcb87e 100644 --- a/src/code/audioMgr.c +++ b/src/code/audio_thread_manager.c @@ -80,7 +80,7 @@ void AudioMgr_ThreadEntry(void* arg) { Audio_Init(); AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); - func_801A4D00(); + Audio_InitSound(); osSendMesg(&audioMgr->lockMsgQ, NULL, OS_MESG_BLOCK); IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptMsgQ); diff --git a/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c index 7485f2d3a..93970cc6a 100644 --- a/src/code/code_800E8EA0.c +++ b/src/code/code_800E8EA0.c @@ -1,7 +1,7 @@ #include "global.h" void Actor_ContinueText(PlayState* play, Actor* actor, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); actor->textId = textId; } diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index fb6f0743d..d120da618 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -474,7 +474,7 @@ u16 gSceneIdsPerRegion[REGION_MAX][27] = { s32 Inventory_GetBtnBItem(PlayState* play) { if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { return ITEM_NONE; - } else if (gSaveContext.unk_1015 == ITEM_NONE) { + } else if (gSaveContext.bButtonStatus == BTN_DISABLED) { return ITEM_NONE; } else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) { if (play->interfaceCtx.unk_21C != 0) { diff --git a/src/code/game.c b/src/code/game.c index b7069d312..4a4be5291 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,5 +1,6 @@ #include "global.h" #include "system_malloc.h" +#include "z64debug_text.h" #include "z64rumble.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" @@ -90,7 +91,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { { s32 requiredScopeTemp; - func_800E9F78(gfxCtx); + Debug_DrawText(gfxCtx); } if (R_ENABLE_ARENA_DBG != 0) { @@ -157,11 +158,11 @@ void GameState_InitArena(GameState* gameState, size_t size) { void* buf = GameAlloc_Malloc(alloc, size); if (buf) { - THA_Ct(&gameState->heap, buf, size); + THA_Init(&gameState->heap, buf, size); return; } - THA_Ct(&gameState->heap, NULL, 0); + THA_Init(&gameState->heap, NULL, 0); __assert("../game.c", 1035); } @@ -173,9 +174,9 @@ void GameState_Realloc(GameState* gameState, size_t size) { size_t bytesAllocated; void* heapStart; - heapStart = gameState->heap.bufp; + heapStart = gameState->heap.start; alloc = &gameState->alloc; - THA_Dt(&gameState->heap); + THA_Destroy(&gameState->heap); GameAlloc_Free(alloc, heapStart); SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated); size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size); @@ -184,9 +185,9 @@ void GameState_Realloc(GameState* gameState, size_t size) { } if ((gameArena = GameAlloc_Malloc(alloc, size)) != NULL) { - THA_Ct(&gameState->heap, gameArena, size); + THA_Init(&gameState->heap, gameArena, size); } else { - THA_Ct(&gameState->heap, 0, 0); + THA_Init(&gameState->heap, 0, 0); __assert("../game.c", 1074); } } @@ -239,7 +240,7 @@ void GameState_Destroy(GameState* gameState) { func_801420F4(&D_801F8020); VisMono_Destroy(&sMonoColors); func_80140900(&D_801F8048); - THA_Dt(&gameState->heap); + THA_Destroy(&gameState->heap); GameAlloc_Cleanup(&gameState->alloc); } @@ -256,7 +257,7 @@ u32 GameState_IsRunning(GameState* gameState) { } s32 GameState_GetArenaSize(GameState* gameState) { - return THA_GetSize(&gameState->heap); + return THA_GetRemaining(&gameState->heap); } s32 func_80173B48(GameState* gameState) { diff --git a/src/code/graph.c b/src/code/graph.c index 1c29029b0..558f7d563 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,5 +1,5 @@ -#include "prevent_bss_reordering.h" #include "global.h" +#include "buffers.h" #include "system_malloc.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/gamestates/ovl_file_choose/z_file_choose.h" @@ -26,7 +26,7 @@ void Graph_FaultClient(void) { } void Graph_InitTHGA(TwoHeadGfxArena* arena, Gfx* buffer, s32 size) { - THGA_Ct(arena, buffer, size); + THGA_Init(arena, buffer, size); } void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) { @@ -91,21 +91,21 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { return NULL; } -void* Graph_FaultAddrConvFunc(void* address, void* param) { +void* Graph_FaultAddrConv(void* address, void* param) { uintptr_t addr = address; GameStateOverlay* gameStateOvl = &gGameStateOverlayTable[0]; - uintptr_t ramConv; + size_t ramConv; void* ramStart; - uintptr_t diff; + size_t diff; s32 i; - for (i = 0; i < graphNumGameStates; i++, gameStateOvl++) { + for (i = 0; i < gGraphNumGameStates; i++, gameStateOvl++) { diff = VRAM_PTR_SIZE(gameStateOvl); ramStart = gameStateOvl->loadedRamAddr; ramConv = (uintptr_t)gameStateOvl->vramStart - (uintptr_t)ramStart; if (ramStart != NULL) { - if (addr >= (uintptr_t)ramStart && addr < (uintptr_t)ramStart + diff) { + if ((addr >= (uintptr_t)ramStart) && (addr < (uintptr_t)ramStart + diff)) { return addr + ramConv; } } @@ -123,7 +123,7 @@ void Graph_Init(GraphicsContext* gfxCtx) { gfxCtx->yScale = gViConfigYScale; osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); - Fault_AddAddrConvClient(&sGraphFaultAddrConvClient, Graph_FaultAddrConvFunc, NULL); + Fault_AddAddrConvClient(&sGraphFaultAddrConvClient, Graph_FaultAddrConv, NULL); } void Graph_Destroy(GraphicsContext* gfxCtx) { diff --git a/src/code/main.c b/src/code/main.c index 59ffb6a32..c4a80f1ea 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -3,7 +3,29 @@ * reordering than just prevent_bss_reordering.h: there is too much of it to control, and it cannot be split into * separate files since most of it is at addresses ending in 8. */ + #include "global.h" +#include "buffers.h" +#include "stack.h" + +extern OSMesgQueue sSiIntMsgQ; +extern OSMesg sSiIntMsgBuf[1]; +extern u32 gSegments[NUM_SEGMENTS]; +extern SchedContext gSchedContext; +extern IrqMgrClient irqClient; +extern OSMesgQueue irqMgrMsgQ; +extern OSMesg irqMgrMsgBuf[60]; +extern OSThread gGraphThread; +extern STACK(sGraphStack, 0x1800); +extern STACK(sSchedStack, 0x600); +extern STACK(sAudioStack, 0x800); +extern STACK(sPadMgrStack, 0x500); +extern StackEntry sGraphStackInfo; +extern StackEntry sSchedStackInfo; +extern StackEntry sAudioStackInfo; +extern StackEntry sPadMgrStackInfo; +extern AudioMgr sAudioMgr; +extern PadMgr gPadMgr; void Main(void* arg) { intptr_t fb; @@ -24,7 +46,7 @@ void Main(void* arg) { startHeapSize = fb - sysHeap; SystemArena_Init(sysHeap, startHeapSize); - GameInfo_Init(); + Regs_Init(); R_ENABLE_ARENA_DBG = 0; @@ -33,25 +55,24 @@ void Main(void* arg) { osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf)); - StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched"); - Sched_Init(&gSchedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr); + StackCheck_Init(&sSchedStackInfo, sSchedStack, STACK_TOP(sSchedStack), 0, 0x100, "sched"); + Sched_Init(&gSchedContext, STACK_TOP(sSchedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr); CIC6105_AddRomInfoFaultPage(); IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ); - StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio"); - AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr); + StackCheck_Init(&sAudioStackInfo, sAudioStack, STACK_TOP(sAudioStack), 0, 0x100, "audio"); + AudioMgr_Init(&sAudioMgr, STACK_TOP(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr); - StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr"); - PadMgr_Init(&sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack)); + StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, STACK_TOP(sPadMgrStack), 0, 0x100, "padmgr"); + PadMgr_Init(&sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, STACK_TOP(sPadMgrStack)); - AudioMgr_Unlock(&audioContext); + AudioMgr_Unlock(&sAudioMgr); - StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph"); - osCreateThread(&sGraphThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, sGraphStack + sizeof(sGraphStack), - Z_PRIORITY_GRAPH); - osStartThread(&sGraphThread); + StackCheck_Init(&sGraphStackInfo, sGraphStack, STACK_TOP(sGraphStack), 0, 0x100, "graph"); + osCreateThread(&gGraphThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, STACK_TOP(sGraphStack), Z_PRIORITY_GRAPH); + osStartThread(&gGraphThread); exit = false; @@ -73,5 +94,5 @@ void Main(void* arg) { } IrqMgr_RemoveClient(&gIrqMgr, &irqClient); - osDestroyThread(&sGraphThread); + osDestroyThread(&gGraphThread); } diff --git a/src/code/object_table.c b/src/code/object_table.c new file mode 100644 index 000000000..aa73199b8 --- /dev/null +++ b/src/code/object_table.c @@ -0,0 +1,24 @@ +#include "global.h" + +s16 gPlayerFormObjectIndices[PLAYER_FORM_MAX] = { + OBJECT_LINK_BOY, // PLAYER_FORM_FIERCE_DEITY + OBJECT_LINK_GORON, // PLAYER_FORM_GORON + OBJECT_LINK_ZORA, // PLAYER_FORM_ZORA + OBJECT_LINK_NUTS, // PLAYER_FORM_DEKU + OBJECT_LINK_CHILD, // PLAYER_FORM_HUMAN +}; + +ObjectId gObjectTableSize = OBJECT_ID_MAX; + +// Object Table definition +#define DEFINE_OBJECT(name, _enumValue) { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }, +#define DEFINE_OBJECT_UNSET(_enumValue) { 0, 0 }, +#define DEFINE_OBJECT_SIZE_ZERO(name, _enumValue) { SEGMENT_ROM_START(name), SEGMENT_ROM_START(name) }, + +RomFile gObjectTable[] = { +#include "tables/object_table.h" +}; + +#undef DEFINE_OBJECT +#undef DEFINE_OBJECT_UNSET +#undef DEFINE_OBJECT_SIZE_ZERO diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 3f198ce8f..25d92227c 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -1,4 +1,5 @@ #include "global.h" +#include "buffers.h" #include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/func_80178750.s") diff --git a/src/code/sys_flashrom.c b/src/code/sys_flashrom.c index 8b6c2fa5c..e9ea6e21e 100644 --- a/src/code/sys_flashrom.c +++ b/src/code/sys_flashrom.c @@ -1,6 +1,17 @@ #include "global.h" +#include "stack.h" #include "system_malloc.h" +// extern UNK_TYPE1 D_801FBE10; +// extern UNK_TYPE1 D_801FBE28; +// extern UNK_TYPE1 D_801FBE2C; +// extern UNK_TYPE4 D_801FBE30; +extern STACK(sSysFlashromStack, 0x1000); +extern StackEntry sys_flashromStackEntry; +extern OSThread sys_flashromOSThread; +extern s80185D40 D_801FD008; +extern OSMesg D_801FD034; + #pragma GLOBAL_ASM("asm/non_matchings/code/sys_flashrom/func_801857C0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/sys_flashrom/func_801857D0.s") diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index f2ed19c38..63857676e 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -74,7 +74,7 @@ MtxF* sCurrentMatrix; //!< original name: "Matrix_now" * @remark original name: "new_Matrix" */ void Matrix_Init(GameState* gameState) { - sMatrixStack = THA_AllocEndAlign16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF)); + sMatrixStack = THA_AllocTailAlign16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF)); sCurrentMatrix = sMatrixStack; } diff --git a/src/code/sys_slowly.c b/src/code/sys_slowly.c index 415d5f297..29ac0db78 100644 --- a/src/code/sys_slowly.c +++ b/src/code/sys_slowly.c @@ -1,43 +1,58 @@ +/** + * @file sys_slowly.c + * + * This file implements a manager for running an asynchronous task on a thread with the lowest priority. + * + * The task callback is expected to have up to 2 void* arguments and have a void return. Setting `argCount` will adjust + * how many args the callback gets called with, but defaults to 2 and using the 2 argument callback. + * + * @note: `argCount` must be set manually, as this file implements no way to configure it. + */ +#include "slowly.h" #include "global.h" -#define SLOWLY_STATUS_DONE (1 << 0) -#define SLOWLY_STATUS_STARTED (1 << 1) - -void Slowly_Main(SlowlyTask* slowly) { +void Slowly_Main(SlowlyMgr* slowly) { slowly->status |= SLOWLY_STATUS_STARTED; - switch (slowly->callbackArgCount) { - case SLOWLY_CALLBACK_NO_ARGS: - slowly->callback0(); + switch (slowly->argCount) { + case 0: + slowly->callback.zero(); break; - case SLOWLY_CALLBACK_ONE_ARG: - slowly->callback1(slowly->callbackArg0); + + case 1: + slowly->callback.one(slowly->arg0); break; - case SLOWLY_CALLBACK_TWO_ARGS: - slowly->callback2(slowly->callbackArg0, slowly->callbackArg1); + + case 2: + slowly->callback.two(slowly->arg0, slowly->arg1); + break; + + default: break; } slowly->status |= SLOWLY_STATUS_DONE; } -void Slowly_ThreadEntry(SlowlyTask* slowly) { +void Slowly_ThreadEntry(void* arg) { + SlowlyMgr* slowly = (SlowlyMgr*)arg; + Slowly_Main(slowly); } -void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1) { - bzero(slowly, sizeof(SlowlyTask)); +void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1) { + bzero(slowly, sizeof(SlowlyMgr)); - slowly->callbackArgCount = SLOWLY_CALLBACK_TWO_ARGS; + slowly->argCount = 2; slowly->status = 0; - slowly->callback0 = callback; - slowly->callbackArg0 = callbackArg0; - slowly->callbackArg1 = callbackArg1; + slowly->callback.two = callback; + slowly->arg0 = arg0; + slowly->arg1 = arg1; osCreateThread(&slowly->thread, Z_THREAD_ID_SLOWLY, Slowly_ThreadEntry, slowly, stack, Z_PRIORITY_SLOWLY); osStartThread(&slowly->thread); } -void Slowly_Stop(SlowlyTask* slowly) { +void Slowly_Destroy(SlowlyMgr* slowly) { osDestroyThread(&slowly->thread); } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 2e2b8c5f8..8a516eb71 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -32,7 +32,7 @@ extern Mtx D_801ED8E0; // 1 func extern Actor* D_801ED920; // 2 funcs. 1 out of z_actor // Internal forward declarations -void func_800BA8B8(PlayState* play, ActorContext* actorCtx); +void Actor_KillAllOnHalfDayChange(PlayState* play, ActorContext* actorCtx); Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayState* play); Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play); void func_800BB8EC(GameState* gameState, ActorContext* actorCtx, Actor** arg2, Actor** arg3, Player* player); @@ -113,7 +113,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist, } void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) { - if (actor->bgCheckFlags & 0x400) { + if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) { func_800B4AEC(play, actor, 50.0f); } @@ -121,7 +121,7 @@ void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) { } void ActorShadow_DrawSquare(Actor* actor, Lights* lights, PlayState* play) { - if (actor->bgCheckFlags & 0x400) { + if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) { func_800B4AEC(play, actor, 50.0f); } @@ -129,9 +129,9 @@ void ActorShadow_DrawSquare(Actor* actor, Lights* lights, PlayState* play) { } void ActorShadow_DrawWhiteCircle(Actor* actor, Lights* lights, PlayState* play) { - static Color_RGBA8 color = { 255, 255, 255, 255 }; + static Color_RGBA8 sColor = { 255, 255, 255, 255 }; - ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &color); + ActorShadow_Draw(actor, lights, play, gCircleShadowDL, &sColor); } void ActorShadow_DrawHorse(Actor* actor, Lights* lights, PlayState* play) { @@ -195,7 +195,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { if (distToFloor < 200.0f) { MtxF sp13C; MtxF spFC; - CollisionPoly* spF8; + CollisionPoly* poly; s32 bgId; f32 floorHeight[2]; Light* firstLight = &mapper->l.l[0]; @@ -224,7 +224,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { for (i = 0; i < ARRAY_COUNT(floorHeight); i++, spB8 >>= 1) { feetPosPtr->y += 50.0f; - *floorHeightPtr = Play_GetFloorSurfaceImpl(play, &sp13C, &spF8, &bgId, feetPosPtr); + *floorHeightPtr = Play_GetFloorSurfaceImpl(play, &sp13C, &poly, &bgId, feetPosPtr); feetPosPtr->y -= 50.0f; distToFloor = feetPosPtr->y - *floorHeightPtr; @@ -235,7 +235,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { actor->shape.feetFloorFlags |= spB8; if ((actor->depthInWater < 0.0f) && (bgId == 0x32) && ((actor->shape.unk_17 & spB8) != 0)) { - if (func_800C9C24(&play->colCtx, spF8, bgId, 1) != 0) { + if (func_800C9C24(&play->colCtx, poly, bgId, 1)) { SkinMatrix_MtxFCopy(&sp13C, &spFC); SkinMatrix_MulYRotation(&spFC, actor->shape.rot.y); EffFootmark_Add(play, &spFC, actor, i, feetPosPtr, (actor->shape.shadowScale * 0.3f), @@ -285,7 +285,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { floorHeightPtr++; } - if (!(actor->bgCheckFlags & 1)) { + if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { actor->shape.feetFloorFlags = 0; } else if (actor->shape.feetFloorFlags == 3) { f32 footDistY = actor->shape.feetPos[FOOT_LEFT].y - actor->shape.feetPos[FOOT_RIGHT].y; @@ -336,7 +336,7 @@ void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) { Light* phi_s0; s32 lightNumMax; - if (actor->bgCheckFlags & 0x400) { + if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) { func_800B4AEC(play, actor, 50.0f); } @@ -560,7 +560,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { } actor = targetCtx->unk_94; - if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_8000000)) { + if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { TatlColor* color = &sTatlColorList[actor->category]; POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x07); @@ -907,39 +907,41 @@ s32 func_800B6434(PlayState* play, TitleCardContext* titleCtx) { return true; } +// ActorContext_1F4 Init void func_800B6468(PlayState* play) { - play->actorCtx.unk1F5 = 0; + play->actorCtx.unk_1F4.timer = 0; } +// ActorContext_1F4 Update void func_800B6474(PlayState* play) { - if (play->actorCtx.unk1F5 != 0) { - play->actorCtx.unk1F5--; - } + DECR(play->actorCtx.unk_1F4.timer); } -s32 func_800B648C(PlayState* play, s32 arg1, s32 arg2, f32 arg3, Vec3f* arg4) { - if ((play->actorCtx.unk1F5 != 0) && (arg3 < play->actorCtx.unk1F8)) { +// ActorContext_1F4 setter something +s32 func_800B648C(PlayState* play, s32 arg1, s32 timer, f32 arg3, Vec3f* arg4) { + if ((play->actorCtx.unk_1F4.timer != 0) && (arg3 < play->actorCtx.unk_1F4.unk_04)) { return false; } - play->actorCtx.unk1F4 = arg1; - play->actorCtx.unk1F5 = arg2; - play->actorCtx.unk1F8 = arg3; - Math_Vec3f_Copy(&play->actorCtx.unk1FC, arg4); + play->actorCtx.unk_1F4.unk_00 = arg1; + play->actorCtx.unk_1F4.timer = timer; + play->actorCtx.unk_1F4.unk_04 = arg3; + Math_Vec3f_Copy(&play->actorCtx.unk_1F4.unk_08, arg4); return true; } +// ActorContext_1F4 getter something f32 func_800B64FC(PlayState* play, f32 arg1, Vec3f* arg2, s32* arg3) { f32 temp_f8; - if ((play->actorCtx.unk1F5 == 0) || (arg1 == 0.0f)) { + if ((play->actorCtx.unk_1F4.timer == 0) || (arg1 == 0.0f)) { return -1.0f; } - temp_f8 = Math_Vec3f_DistXYZ(&play->actorCtx.unk1FC, arg2) / arg1; - *arg3 = play->actorCtx.unk1F4; - return play->actorCtx.unk1F8 - temp_f8; + temp_f8 = Math_Vec3f_DistXYZ(&play->actorCtx.unk_1F4.unk_08, arg2) / arg1; + *arg3 = play->actorCtx.unk_1F4.unk_00; + return play->actorCtx.unk_1F4.unk_04 - temp_f8; } /** @@ -1010,7 +1012,7 @@ void* func_800B6608(PlayState* play, s16 id) { * Retrieves the first pointer stored with the id `id`. * If there's no pointer stored with that id, NULL is returned. * - * Used only by EnLiftNuts. + * Used only by EnGamelupy. */ void* func_800B6680(PlayState* play, s16 id) { ActorContext_unk_20C* entry = play->actorCtx.unk_20C; @@ -1101,17 +1103,17 @@ void Actor_Destroy(Actor* actor, PlayState* play) { } } -f32 actorMovementScale = 1.0f; +f32 sActorMovementScale = 1.0f; void Actor_SetMovementScale(s32 scale) { - actorMovementScale = scale * 0.5f; + sActorMovementScale = scale * 0.5f; } /** * Update actor position using velocity and any push from z_collision_check. */ void Actor_UpdatePos(Actor* actor) { - f32 speedRate = actorMovementScale; + f32 speedRate = sActorMovementScale; actor->world.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x; actor->world.pos.y += (actor->velocity.y * speedRate) + actor->colChkInfo.displacement.y; @@ -1125,8 +1127,8 @@ void Actor_UpdatePos(Actor* actor) { * It is recommended to not call this function directly and use `Actor_MoveWithGravity` instead */ void Actor_UpdateVelocityWithGravity(Actor* actor) { - actor->velocity.x = actor->speedXZ * Math_SinS(actor->world.rot.y); - actor->velocity.z = actor->speedXZ * Math_CosS(actor->world.rot.y); + actor->velocity.x = actor->speed * Math_SinS(actor->world.rot.y); + actor->velocity.z = actor->speed * Math_CosS(actor->world.rot.y); actor->velocity.y += actor->gravity; if (actor->velocity.y < actor->terminalVelocity) { @@ -1150,11 +1152,11 @@ void Actor_MoveWithGravity(Actor* actor) { * It is recommended to not call this function directly and use `Actor_MoveWithoutGravity` instead */ void Actor_UpdateVelocityWithoutGravity(Actor* actor) { - f32 horizontalSpeed = Math_CosS(actor->world.rot.x) * actor->speedXZ; + f32 speedXZ = Math_CosS(actor->world.rot.x) * actor->speed; - actor->velocity.x = Math_SinS(actor->world.rot.y) * horizontalSpeed; - actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ; - actor->velocity.z = Math_CosS(actor->world.rot.y) * horizontalSpeed; + actor->velocity.x = Math_SinS(actor->world.rot.y) * speedXZ; + actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speed; + actor->velocity.z = Math_CosS(actor->world.rot.y) * speedXZ; } /** @@ -1174,11 +1176,11 @@ void Actor_MoveWithoutGravity(Actor* actor) { * It is recommended to not call this function directly and use `Actor_MoveWithoutGravityReverse` instead */ void Actor_UpdateVelocityWithoutGravityReverse(Actor* actor) { - f32 horizontalSpeed = Math_CosS(-actor->world.rot.x) * actor->speedXZ; + f32 speedXZ = Math_CosS(-actor->world.rot.x) * actor->speed; - actor->velocity.x = Math_SinS(actor->world.rot.y) * horizontalSpeed; - actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ; - actor->velocity.z = Math_CosS(actor->world.rot.y) * horizontalSpeed; + actor->velocity.x = Math_SinS(actor->world.rot.y) * speedXZ; + actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speed; + actor->velocity.z = Math_CosS(actor->world.rot.y) * speedXZ; } /** @@ -1193,7 +1195,7 @@ void Actor_MoveWithoutGravityReverse(Actor* actor) { * Sets horizontal speed and Y velocity using the `speed` argument and current pitch */ void Actor_SetSpeeds(Actor* actor, f32 speed) { - actor->speedXZ = Math_CosS(actor->world.rot.x) * speed; + actor->speed = Math_CosS(actor->world.rot.x) * speed; actor->velocity.y = -Math_SinS(actor->world.rot.x) * speed; } @@ -1207,44 +1209,44 @@ void Actor_UpdatePosFromSkelAnime(Actor* actor, SkelAnime* skelAnime) { actor->world.pos.z += pos.z * actor->scale.z; } -s16 Actor_YawBetweenActors(Actor* from, Actor* to) { - return Math_Vec3f_Yaw(&from->world.pos, &to->world.pos); +s16 Actor_WorldYawTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Yaw(&actorA->world.pos, &actorB->world.pos); } -s16 Actor_YawBetweenActorsTop(Actor* from, Actor* to) { - return Math_Vec3f_Yaw(&from->focus.pos, &to->focus.pos); +s16 Actor_FocusYawTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Yaw(&actorA->focus.pos, &actorB->focus.pos); } -s16 Actor_YawToPoint(Actor* actor, Vec3f* point) { - return Math_Vec3f_Yaw(&actor->world.pos, point); +s16 Actor_WorldYawTowardPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_Yaw(&actor->world.pos, refPoint); } -s16 Actor_PitchBetweenActors(Actor* from, Actor* to) { - return Math_Vec3f_Pitch(&from->world.pos, &to->world.pos); +s16 Actor_WorldPitchTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Pitch(&actorA->world.pos, &actorB->world.pos); } -s16 Actor_PitchBetweenActorsTop(Actor* from, Actor* to) { - return Math_Vec3f_Pitch(&from->focus.pos, &to->focus.pos); +s16 Actor_FocusPitchTowardActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_Pitch(&actorA->focus.pos, &actorB->focus.pos); } -s16 Actor_PitchToPoint(Actor* actor, Vec3f* point) { - return Math_Vec3f_Pitch(&actor->world.pos, point); +s16 Actor_WorldPitchTowardPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_Pitch(&actor->world.pos, refPoint); } -f32 Actor_DistanceBetweenActors(Actor* actor1, Actor* actor2) { - return Math_Vec3f_DistXYZ(&actor1->world.pos, &actor2->world.pos); +f32 Actor_WorldDistXYZToActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_DistXYZ(&actorA->world.pos, &actorB->world.pos); } -f32 Actor_DistanceToPoint(Actor* actor, Vec3f* point) { - return Math_Vec3f_DistXYZ(&actor->world.pos, point); +f32 Actor_WorldDistXYZToPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_DistXYZ(&actor->world.pos, refPoint); } -f32 Actor_XZDistanceBetweenActors(Actor* actor1, Actor* actor2) { - return Math_Vec3f_DistXZ(&actor1->world.pos, &actor2->world.pos); +f32 Actor_WorldDistXZToActor(Actor* actorA, Actor* actorB) { + return Math_Vec3f_DistXZ(&actorA->world.pos, &actorB->world.pos); } -f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point) { - return Math_Vec3f_DistXZ(&actor->world.pos, point); +f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint) { + return Math_Vec3f_DistXZ(&actor->world.pos, refPoint); } /** @@ -1302,12 +1304,16 @@ f32 Player_GetHeight(Player* player) { default: case PLAYER_FORM_FIERCE_DEITY: return extraHeight + 124.0f; + case PLAYER_FORM_GORON: return extraHeight + ((player->stateFlags3 & PLAYER_STATE3_1000) ? 34.0f : 80.0f); + case PLAYER_FORM_ZORA: return extraHeight + 68.0f; + case PLAYER_FORM_DEKU: return extraHeight + 36.0f; + case PLAYER_FORM_HUMAN: return extraHeight + 44.0f; } @@ -1338,7 +1344,7 @@ s32 func_800B715C(PlayState* play) { } void Actor_SetCameraHorseSetting(PlayState* play, Player* player) { - if ((play->roomCtx.curRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && (player->actor.id == ACTOR_PLAYER)) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { @@ -1416,7 +1422,7 @@ s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, PlayState* play) { * This function is unused in the original game. */ s32 Actor_ActorBIsFacingActorA(Actor* actorA, Actor* actorB, s16 maxAngleDiff) { - s16 angle = BINANG_ROT180(Actor_YawBetweenActors(actorA, actorB)); + s16 angle = BINANG_ROT180(Actor_WorldYawTowardActor(actorA, actorB)); s16 dist = angle - actorB->shape.rot.y; if (ABS_ALT(dist) < maxAngleDiff) { @@ -1444,7 +1450,7 @@ s32 Actor_IsFacingPlayer(Actor* actor, s16 angle) { * The maximum angle difference that qualifies as "facing" is specified by `maxAngleDiff`. */ s32 Actor_ActorAIsFacingActorB(Actor* actorA, Actor* actorB, s16 maxAngleDiff) { - s16 dist = Actor_YawBetweenActors(actorA, actorB) - actorA->shape.rot.y; + s16 dist = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y; if (ABS_ALT(dist) < maxAngleDiff) { return true; @@ -1477,8 +1483,8 @@ s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 maxAngleDiff) { * The maximum distance that qualifies as "nearby" is specified by `range`. */ s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 maxAngleDiff) { - if (Actor_DistanceBetweenActors(actorA, actorB) < range) { - s16 dist = Actor_YawBetweenActors(actorA, actorB) - actorA->shape.rot.y; + if (Actor_WorldDistXYZToActor(actorA, actorB) < range) { + s16 dist = Actor_WorldYawTowardActor(actorA, actorB) - actorA->shape.rot.y; if (ABS_ALT(dist) < maxAngleDiff) { return true; @@ -1497,9 +1503,9 @@ void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* } s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) { - if (actor->bgCheckFlags & 1) { - actor->bgCheckFlags &= ~1; - actor->bgCheckFlags |= 4; + if (actor->bgCheckFlags & BGCHECKFLAG_GROUND) { + actor->bgCheckFlags &= ~BGCHECKFLAG_GROUND; + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_LEAVE; if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) { actor->velocity.y = 0.0f; @@ -1517,21 +1523,22 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { pos->y += (flags & 0x800) ? 10.0f : 50.0f; actor->floorHeight = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &actor->floorPoly, &bgId, actor, pos); - actor->bgCheckFlags &= ~(0x80 | 0x04 | 0x02); + actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT); if (actor->floorHeight <= BGCHECK_Y_MIN) { return func_800B761C(actor, BGCHECK_Y_MIN, flags); } distToFloor = actor->floorHeight - actor->world.pos.y; actor->floorBgId = bgId; - if ((distToFloor >= 0.0f) || (((actor->bgCheckFlags & 1)) && !(actor->bgCheckFlags & 0x800) && - (distToFloor >= -11.0f) && (actor->velocity.y < 0.0f))) { - actor->bgCheckFlags |= 0x80; + if ((distToFloor >= 0.0f) || + (((actor->bgCheckFlags & BGCHECKFLAG_GROUND)) && !(actor->bgCheckFlags & BGCHECKFLAG_PLAYER_800) && + (distToFloor >= -11.0f) && (actor->velocity.y < 0.0f))) { + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_STRICT; - if (actor->bgCheckFlags & 0x10) { + if (actor->bgCheckFlags & BGCHECKFLAG_CEILING) { if (bgId != D_801ED8B4) { if (distToFloor > 15.0f) { - actor->bgCheckFlags |= 0x100; + actor->bgCheckFlags |= BGCHECKFLAG_CRUSHED; } } else { actor->world.pos.x = actor->prevPos.x; @@ -1542,15 +1549,15 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { actor->world.pos.y = actor->floorHeight; if (actor->velocity.y <= 0.0f) { - if (!(actor->bgCheckFlags & 1)) { - actor->bgCheckFlags |= 2; + if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH; } else if ((flags & 8) && (actor->gravity < 0.0f)) { actor->velocity.y = -4.0f; } else if (!(flags & 0x100)) { actor->velocity.y = 0.0f; } - actor->bgCheckFlags |= 1; + actor->bgCheckFlags |= BGCHECKFLAG_GROUND; BgCheck2_AttachToMesh(&play->colCtx, actor, (s32)actor->floorBgId); } } else { @@ -1566,14 +1573,14 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, s32 pad; Vec3f pos; - if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { + if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, actor->floorBgId, actor); } if (flags & 1) { s32 bgId; - actor->bgCheckFlags &= ~0x1000; + actor->bgCheckFlags &= ~BGCHECKFLAG_PLAYER_1000; if ((!(flags & 0x80) && (BgCheck_EntitySphVsWall3(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight))) || @@ -1582,18 +1589,18 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, &actor->wallPoly, &bgId, actor, wallCheckHeight)))) { CollisionPoly* sp7C = actor->wallPoly; - actor->bgCheckFlags |= 8; - if ((flags & 0x200) && (actor->bgCheckFlags & 0x1000) && ((s32)sp7C->normal.y > 0) && + actor->bgCheckFlags |= BGCHECKFLAG_WALL; + if ((flags & 0x200) && (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_1000) && ((s32)sp7C->normal.y > 0) && (sqrtf(SQXYZ(actor->colChkInfo.displacement)) < 10.0f)) { - actor->bgCheckFlags &= ~8; - } else if (actor->bgCheckFlags & 8) { + actor->bgCheckFlags &= ~BGCHECKFLAG_WALL; + } else if (actor->bgCheckFlags & BGCHECKFLAG_WALL) { Math_Vec3f_Copy(&actor->world.pos, &pos); } actor->wallYaw = Math_Atan2S_XY(sp7C->normal.z, sp7C->normal.x); actor->wallBgId = bgId; } else { - actor->bgCheckFlags &= ~8; + actor->bgCheckFlags &= ~BGCHECKFLAG_WALL; } } @@ -1605,10 +1612,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, pos.y = actor->prevPos.y + 4.0f; if (BgCheck_EntityCheckCeiling(&play->colCtx, &y, &pos, (ceilingCheckHeight + sp94) - 4.0f, &D_801ED8B0, &D_801ED8B4, actor)) { - actor->bgCheckFlags |= 0x10; + actor->bgCheckFlags |= BGCHECKFLAG_CEILING; actor->world.pos.y = (y + sp94) - 4.0f; } else { - actor->bgCheckFlags &= ~0x10; + actor->bgCheckFlags &= ~BGCHECKFLAG_CEILING; } } if (flags & 4) { @@ -1622,9 +1629,9 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &y, &waterbox)) { actor->depthInWater = y - actor->world.pos.y; if (actor->depthInWater <= 0.0f) { - actor->bgCheckFlags &= ~(0x40 | 0x20); - } else if (!(actor->bgCheckFlags & 0x20)) { - actor->bgCheckFlags |= (0x40 | 0x20); + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); + } else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) { + actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); if (!(flags & 0x40)) { Vec3f sp64; @@ -1637,10 +1644,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, EffectSsGRipple_Spawn(play, &sp64, 100, 500, 8); } } else { - actor->bgCheckFlags &= ~0x40; + actor->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; } } else { - actor->bgCheckFlags &= ~(0x40 | 0x20); + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); actor->depthInWater = BGCHECK_Y_MIN; } } @@ -1653,9 +1660,9 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, actor->depthInWater = y - actor->world.pos.y; if (actor->depthInWater < 0.0f) { - actor->bgCheckFlags &= ~(0x40 | 0x20); - } else if (!(actor->bgCheckFlags & 0x20)) { - actor->bgCheckFlags |= (0x40 | 0x20); + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); + } else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) { + actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); if (!(flags & 0x40)) { Vec3f sp50; @@ -1668,10 +1675,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, EffectSsGRipple_Spawn(play, &sp50, 100, 500, 8); } } else { - actor->bgCheckFlags &= ~0x40; + actor->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; } } else { - actor->bgCheckFlags &= ~(0x40 | 0x20); + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); actor->depthInWater = BGCHECK_Y_MIN; } } @@ -1784,7 +1791,7 @@ f32 func_800B82EC(Actor* actor, Player* player, s16 angle) { s16 yaw = ABS_ALT(temp_v0); if (player->targetedActor != NULL) { - if ((yaw > 0x4000) || ((actor->flags & ACTOR_FLAG_8000000))) { + if ((yaw > 0x4000) || ((actor->flags & ACTOR_FLAG_CANT_LOCK_ON))) { return FLT_MAX; } @@ -1812,7 +1819,7 @@ s32 func_800B83BC(Actor* actor, f32 arg1) { } s32 func_800B83F8(Actor* actor, Player* player, s32 flag) { - if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_1) || (actor->flags & ACTOR_FLAG_8000000)) { + if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_1) || (actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) { return true; } @@ -1834,24 +1841,34 @@ s32 func_800B83F8(Actor* actor, Player* player, s32 flag) { } s16 D_801AED48[] = { - 0x101, 0x141, 0x111, 0x151, 0x105, 0x145, 0x115, 0x155, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY1_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY2_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY1_NIGHT | HALFDAYBIT_DAY2_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY3_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY1_NIGHT | HALFDAYBIT_DAY3_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY2_NIGHT | HALFDAYBIT_DAY3_NIGHT | HALFDAYBIT_DAY4_NIGHT, + HALFDAYBIT_DAY0_NIGHT | HALFDAYBIT_DAY1_NIGHT | HALFDAYBIT_DAY2_NIGHT | HALFDAYBIT_DAY3_NIGHT | + HALFDAYBIT_DAY4_NIGHT, }; s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState) { - if (actor->flags & ACTOR_FLAG_100) { - actor->flags &= ~ACTOR_FLAG_100; + if (actor->flags & ACTOR_FLAG_TALK_REQUESTED) { + actor->flags &= ~ACTOR_FLAG_TALK_REQUESTED; return true; } return false; } -// Actor_PickUpExchange? Seems to be called with exchangeItemId -1 if the same actor used Actor_PickUp +// Actor_OfferTalk / Actor_OfferGetItemExchange? Seems to be called with PLAYER_IA_MINUS1 if the same actor used +// Actor_OfferGetItem. // This function is also used to toggle the "Speak" action on the A button s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, PlayerItemAction exchangeItemId) { Player* player = GET_PLAYER(play); - if ((player->actor.flags & ACTOR_FLAG_100) || ((exchangeItemId > PLAYER_IA_NONE) && Player_InCsMode(play)) || + if ((player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || + ((exchangeItemId > PLAYER_IA_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && ((fabsf(actor->playerHeightRel) > fabsf(yRange)) || (actor->xzDistToPlayer > player->talkActorDistance) || (xzRange < actor->xzDistToPlayer)))) { @@ -1882,7 +1899,7 @@ s32 func_800B863C(Actor* actor, PlayState* play) { s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - actor->flags &= ~ACTOR_FLAG_100; + actor->flags &= ~ACTOR_FLAG_TALK_REQUESTED; return true; } @@ -1899,7 +1916,7 @@ s32 Actor_ChangeFocus(Actor* actor1, PlayState* play, Actor* actor2) { talkActor = player->talkActor; - if ((player->actor.flags & ACTOR_FLAG_100) && (talkActor != NULL)) { + if ((player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) && (talkActor != NULL)) { player->talkActor = actor2; player->targetedActor = actor2; return true; @@ -1986,13 +2003,29 @@ s32 Actor_HasParent(Actor* actor, PlayState* play) { } /** - * Allows to pick up an item (GetItem or GI), lift an actor or catch various actors in bottles - * within the specified range. + * This function covers various interactions with the player actor, using Get Item IDs (see `GetItemID` enum). + * It is typically used to give items to the player, but also has other purposes. * - * GI_NONE is usually used as a special case to lift an actor - * GI_MAX is usually used to catch an actor in a bottle + * This function carries a get item request to the player actor if context allows it (e.g. the player is in range and + * not busy with certain things). The player actor performs the requested action itself. + * + * The following description of what the `getItemId` values can do is provided here for completeness, but these + * behaviors are entirely out of the scope of this function. All behavior is defined by the player actor. + * + * - Positive values (`GI_NONE < getItemId < GI_MAX`): + * Give an item to the player. The player may not get it immediately (for example if diving), but is expected to + * in the near future. + * - Negative values (`-GI_MAX < getItemId < GI_NONE`): + * Used by treasure chests to indicate the chest can be opened (by pressing A). + * The item gotten corresponds to the positive Get Item ID `abs(getItemId)`. + * - `GI_NONE`: + * Allows the player to pick up the actor (by pressing A), to carry it around. + * - `GI_MAX`: + * Allows the player to catch specific actors in a bottle. + * + * @return true If the player actor is capable of accepting the offer. */ -s32 Actor_PickUp(Actor* actor, PlayState* play, GetItemId getItemId, f32 xzRange, f32 yRange) { +s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 xzRange, f32 yRange) { Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & @@ -2026,16 +2059,16 @@ s32 Actor_PickUp(Actor* actor, PlayState* play, GetItemId getItemId, f32 xzRange return false; } -s32 Actor_PickUpNearby(Actor* actor, PlayState* play, GetItemId getItemId) { - return Actor_PickUp(actor, play, getItemId, 50.0f, 10.0f); +s32 Actor_OfferGetItemNearby(Actor* actor, PlayState* play, GetItemId getItemId) { + return Actor_OfferGetItem(actor, play, getItemId, 50.0f, 10.0f); } -s32 Actor_LiftActor(Actor* actor, PlayState* play) { - return Actor_PickUpNearby(actor, play, GI_NONE); +s32 Actor_OfferCarry(Actor* actor, PlayState* play) { + return Actor_OfferGetItemNearby(actor, play, GI_NONE); } -s32 Actor_PickUpFar(Actor* actor, PlayState* play, GetItemId getItemId) { - return Actor_PickUp(actor, play, getItemId, 9999.9f, 9999.9f); +s32 Actor_OfferGetItemFar(Actor* actor, PlayState* play, GetItemId getItemId) { + return Actor_OfferGetItem(actor, play, getItemId, 9999.9f, 9999.9f); } s32 Actor_HasNoParent(Actor* actor, PlayState* play) { @@ -2065,7 +2098,7 @@ void func_800B8C20(Actor* actorA, Actor* actorB, PlayState* play) { * Sets closest secret distance to the distance to the actor. Calling this function on `actor` is the way to make it a * 'secret' for that update cycle, i.e. something that the controller will rumble for. */ -void func_800B8C50(Actor* actor, PlayState* play) { +void Actor_SetClosestSecretDistance(Actor* actor, PlayState* play) { Player* player = GET_PLAYER(play); if (actor->xyzDistToPlayerSq < player->closestSecretDistSq) { @@ -2130,7 +2163,10 @@ void func_800B8E1C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) func_800B8DD4(play, actor, arg2, arg3, arg4, 0); } -void func_800B8E58(Player* player, u16 sfxId) { +/** + * Play a sound effect at the player's position + */ +void Player_PlaySfx(Player* player, u16 sfxId) { if (player->currentMask == PLAYER_MASK_GIANT) { func_8019F170(&player->actor.projectedPos, sfxId); } else { @@ -2140,16 +2176,16 @@ void func_800B8E58(Player* player, u16 sfxId) { } /** - * Plays the sound effect at the actor's position + * Play a sound effect at the actor's position */ -void Actor_PlaySfxAtPos(Actor* actor, u16 sfxId) { +void Actor_PlaySfx(Actor* actor, u16 sfxId) { Audio_PlaySfxAtPos(&actor->projectedPos, sfxId); } void func_800B8EF4(PlayState* play, Actor* actor) { u32 sfxId; - if (actor->bgCheckFlags & 0x20) { + if (actor->bgCheckFlags & BGCHECKFLAG_WATER) { if (actor->depthInWater < 20.0f) { sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { @@ -2226,14 +2262,14 @@ void Actor_DeactivateLens(PlayState* play) { } } -void func_800B9120(ActorContext* actorCtx) { - s32 phi_v0 = CURRENT_DAY * 2; +void Actor_InitHalfDaysBit(ActorContext* actorCtx) { + s32 halfDayCount = CURRENT_DAY * 2; - if (gSaveContext.save.time < CLOCK_TIME(6, 0) || gSaveContext.save.time > CLOCK_TIME(18, 0)) { - phi_v0++; + if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) || (gSaveContext.save.time > CLOCK_TIME(18, 0))) { + halfDayCount++; } - actorCtx->unkC = 0x200 >> phi_v0; + actorCtx->halfDaysBit = HALFDAYBIT_DAY0_DAWN >> halfDayCount; } void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) { @@ -2272,7 +2308,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto Actor_SpawnEntry(actorCtx, actorEntry, play); Actor_TargetContextInit(&actorCtx->targetContext, actorCtx->actorLists[ACTORCAT_PLAYER].first, play); - func_800B9120(actorCtx); + Actor_InitHalfDaysBit(actorCtx); Fault_AddClient(&sActorFaultClient, (void*)Actor_PrintLists, actorCtx, NULL); func_800B722C(&play->state, (Player*)actorCtx->actorLists[ACTORCAT_PLAYER].first); } @@ -2284,24 +2320,27 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto void Actor_SpawnSetupActors(PlayState* play, ActorContext* actorCtx) { if (play->numSetupActors > 0) { ActorEntry* actorEntry = play->setupActorList; - s32 temp_fp = actorCtx->unkC; - s32 temp_s1; - s32 phi_v0; + s32 prevHalfDaysBitValue = actorCtx->halfDaysBit; + s32 shiftedHalfDaysBit; + s32 actorEntryHalfDayBit; s32 i; - func_800B9120(actorCtx); - func_800BA8B8(play, &play->actorCtx); + Actor_InitHalfDaysBit(actorCtx); + Actor_KillAllOnHalfDayChange(play, &play->actorCtx); - temp_s1 = (actorCtx->unkC * 2) & 0x2FF; + // Shift to previous halfDay bit, but ignoring DAY0_NIGHT. + // In other words, if the current halfDay is DAY1_DAY then this logic is ignored and this variable is zero + shiftedHalfDaysBit = (actorCtx->halfDaysBit << 1) & (HALFDAYBIT_ALL & ~HALFDAYBIT_DAY0_NIGHT); for (i = 0; i < play->numSetupActors; i++) { - phi_v0 = ((actorEntry->rot.x & 7) << 7) | (actorEntry->rot.z & 0x7F); - if (phi_v0 == 0) { - phi_v0 = 0x3FF; + actorEntryHalfDayBit = ((actorEntry->rot.x & 7) << 7) | (actorEntry->rot.z & 0x7F); + if (actorEntryHalfDayBit == 0) { + actorEntryHalfDayBit = HALFDAYBIT_ALL; } - if (!(phi_v0 & temp_fp) && (phi_v0 & actorCtx->unkC) && - (!CHECK_EVENTINF(EVENTINF_17) || !(phi_v0 & temp_s1) || !(actorEntry->id & 0x800))) { + if (!(actorEntryHalfDayBit & prevHalfDaysBitValue) && (actorEntryHalfDayBit & actorCtx->halfDaysBit) && + (!CHECK_EVENTINF(EVENTINF_17) || !(actorEntryHalfDayBit & shiftedHalfDaysBit) || + !(actorEntry->id & 0x800))) { Actor_SpawnEntry(&play->actorCtx, actorEntry, play); } actorEntry++; @@ -2315,9 +2354,9 @@ void Actor_SpawnSetupActors(PlayState* play, ActorContext* actorCtx) { typedef struct { /* 0x00 */ PlayState* play; /* 0x04 */ Actor* actor; - /* 0x08 */ u32 unk_08; - /* 0x0C */ u32 unkC; - /* 0x10 */ Actor* unk10; + /* 0x08 */ u32 requiredActorFlag; + /* 0x0C */ u32 canFreezeCategory; + /* 0x10 */ Actor* talkActor; /* 0x14 */ Player* player; /* 0x18 */ u32 unk_18; // Bitmask of actor flags. The actor will only have main called if it has at least 1 // flag set that matches this bitmask @@ -2352,53 +2391,51 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { } else { if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); + } else if (((params->requiredActorFlag) && !(actor->flags & params->requiredActorFlag)) || + ((((!params->requiredActorFlag) != 0)) && + (!(actor->flags & ACTOR_FLAG_100000) || + ((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & PLAYER_STATE1_200))) && + params->canFreezeCategory && (actor != params->talkActor) && + ((actor != params->player->heldActor)) && (actor->parent != ¶ms->player->actor))) { + CollisionCheck_ResetDamage(&actor->colChkInfo); } else { - if (((params->unk_08) && !(actor->flags & params->unk_08)) || - ((((!params->unk_08) != 0)) && - (!(actor->flags & ACTOR_FLAG_100000) || - ((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & PLAYER_STATE1_200))) && - (params->unkC != 0) && (actor != params->unk10) && ((actor != params->player->heldActor)) && - (actor->parent != ¶ms->player->actor))) { - CollisionCheck_ResetDamage(&actor->colChkInfo); - } else { - Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos); - actor->xzDistToPlayer = Actor_XZDistanceBetweenActors(actor, ¶ms->player->actor); - actor->playerHeightRel = Actor_HeightDiff(actor, ¶ms->player->actor); - actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->playerHeightRel); + Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos); + actor->xzDistToPlayer = Actor_WorldDistXZToActor(actor, ¶ms->player->actor); + actor->playerHeightRel = Actor_HeightDiff(actor, ¶ms->player->actor); + actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->playerHeightRel); - actor->yawTowardsPlayer = Actor_YawBetweenActors(actor, ¶ms->player->actor); - actor->flags &= ~ACTOR_FLAG_1000000; + actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, ¶ms->player->actor); + actor->flags &= ~ACTOR_FLAG_1000000; - if ((DECR(actor->freezeTimer) == 0) && (actor->flags & params->unk_18)) { - if (actor == params->player->targetedActor) { - actor->isTargeted = true; - } else { - actor->isTargeted = false; - } - - if ((actor->targetPriority != 0) && (params->player->targetedActor == NULL)) { - actor->targetPriority = 0; - } - - Actor_SetObjectDependency(play, actor); - - if (actor->colorFilterTimer != 0) { - actor->colorFilterTimer--; - } - - actor->update(actor, play); - BgCheck_ResetFlagsIfLoadedActor(play, &play->colCtx.dyna, actor); + if ((DECR(actor->freezeTimer) == 0) && (actor->flags & params->unk_18)) { + if (actor == params->player->targetedActor) { + actor->isTargeted = true; + } else { + actor->isTargeted = false; } - CollisionCheck_ResetDamage(&actor->colChkInfo); + if ((actor->targetPriority != 0) && (params->player->targetedActor == NULL)) { + actor->targetPriority = 0; + } + + Actor_SetObjectDependency(play, actor); + + if (actor->colorFilterTimer != 0) { + actor->colorFilterTimer--; + } + + actor->update(actor, play); + BgCheck_ResetFlagsIfLoadedActor(play, &play->colCtx.dyna, actor); } + + CollisionCheck_ResetDamage(&actor->colChkInfo); } nextActor = actor->next; } return nextActor; } -u32 D_801AED58[ACTORCAT_MAX] = { +u32 sCategoryFreezeMasks[ACTORCAT_MAX] = { /* ACTORCAT_SWITCH */ PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, /* ACTORCAT_BG */ @@ -2433,7 +2470,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { s32 i; Actor* actor; Player* player = GET_PLAYER(play); - u32* tmp; + u32* categoryFreezeMaskP; s32 cat; Actor* next; ActorListEntry* entry; @@ -2454,22 +2491,23 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actorCtx->unk2--; } - tmp = D_801AED58; + categoryFreezeMaskP = sCategoryFreezeMasks; if (player->stateFlags2 & PLAYER_STATE2_8000000) { - params.unk_08 = 0x2000000; + params.requiredActorFlag = ACTOR_FLAG_2000000; } else { - params.unk_08 = 0; + params.requiredActorFlag = 0; } if ((player->stateFlags1 & PLAYER_STATE1_40) && ((player->actor.textId & 0xFF00) != 0x1900)) { - params.unk10 = player->talkActor; + params.talkActor = player->talkActor; } else { - params.unk10 = NULL; + params.talkActor = NULL; } - for (i = 0, entry = actorCtx->actorLists; i < ARRAY_COUNT(actorCtx->actorLists); entry++, tmp++, i++) { - params.unkC = *tmp & player->stateFlags1; + for (i = 0, entry = actorCtx->actorLists; i < ARRAY_COUNT(actorCtx->actorLists); + entry++, categoryFreezeMaskP++, i++) { + params.canFreezeCategory = *categoryFreezeMaskP & player->stateFlags1; params.actor = entry->first; while (params.actor != NULL) { @@ -2555,31 +2593,33 @@ void Actor_Draw(PlayState* play, Actor* actor) { gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment); if (actor->colorFilterTimer != 0) { - s32 temp_v0_2 = actor->colorFilterParams & 0xC000; + s32 colorFlag = COLORFILTER_GET_COLORFLAG(actor->colorFilterParams); Color_RGBA8 actorDefaultHitColor = { 0, 0, 0, 255 }; - if (temp_v0_2 == 0x8000) { + if (colorFlag == COLORFILTER_COLORFLAG_GRAY) { actorDefaultHitColor.r = actorDefaultHitColor.g = actorDefaultHitColor.b = - ((actor->colorFilterParams & 0x1F00) >> 5) | 7; - } else if (temp_v0_2 == 0x4000) { - actorDefaultHitColor.r = ((actor->colorFilterParams & 0x1F00) >> 5) | 7; - } else if (temp_v0_2 == 0xC000) { + COLORFILTER_GET_COLORINTENSITY(actor->colorFilterParams) | 7; + } else if (colorFlag == COLORFILTER_COLORFLAG_RED) { + actorDefaultHitColor.r = COLORFILTER_GET_COLORINTENSITY(actor->colorFilterParams) | 7; + } else if (colorFlag == COLORFILTER_COLORFLAG_NONE) { actorDefaultHitColor.b = actorDefaultHitColor.g = actorDefaultHitColor.r = 0; } else { - actorDefaultHitColor.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7; + actorDefaultHitColor.b = COLORFILTER_GET_COLORINTENSITY(actor->colorFilterParams) | 7; } - if (actor->colorFilterParams & 0x2000) { - func_800AE778(play, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + if (actor->colorFilterParams & COLORFILTER_BUFFLAG_XLU) { + func_800AE778(play, &actorDefaultHitColor, actor->colorFilterTimer, + COLORFILTER_GET_DURATION(actor->colorFilterParams)); } else { - func_800AE434(play, &actorDefaultHitColor, actor->colorFilterTimer, actor->colorFilterParams & 0xFF); + func_800AE434(play, &actorDefaultHitColor, actor->colorFilterTimer, + COLORFILTER_GET_DURATION(actor->colorFilterParams)); } } actor->draw(actor, play); if (actor->colorFilterTimer != 0) { - if (actor->colorFilterParams & 0x2000) { + if (actor->colorFilterParams & COLORFILTER_BUFFLAG_XLU) { func_800AE8EC(play); } else { func_800AE5A0(play); @@ -2623,18 +2663,18 @@ void func_800B9D1C(Actor* actor) { } } -void Actor_DrawAllSetup(PlayState* play) { - play->actorCtx.undrawnActorCount = 0; +void Actor_ResetLensActors(PlayState* play) { + play->actorCtx.numLensActors = 0; play->actorCtx.lensActorsDrawn = false; } -s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) { - if (play->actorCtx.undrawnActorCount >= 32) { +s32 Actor_AddToLensActors(PlayState* play, Actor* actor) { + if (play->actorCtx.numLensActors >= LENS_ACTOR_MAX) { return false; } - play->actorCtx.undrawnActors[play->actorCtx.undrawnActorCount] = actor; - play->actorCtx.undrawnActorCount++; + play->actorCtx.lensActors[play->actorCtx.numLensActors] = actor; + play->actorCtx.numLensActors++; return true; } @@ -2643,125 +2683,126 @@ void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) { ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f); } -void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invisibleActors) { +void Actor_DrawLensActors(PlayState* play, s32 numLensActors, Actor** lensActors) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + Actor** lensActor; + s32 i; + Gfx* gfx; + Gfx* gfxTemp; + void* zbuffer; + void* spA4; s32 dbgVar1; s32 dbgVar2; - s32 spB4; - Actor** invisibleActor; - Gfx* spAC; - void* spA8; - void* spA4; - GraphicsContext* gfxCtx = play->state.gfxCtx; - Gfx* tmp; s32 pad[2]; + // Remnant of debug dbgVar1 = true; dbgVar2 = true; if (dbgVar1) { - dbgVar1 = numInvisibleActors > 0; + dbgVar1 = (numLensActors > 0); } OPEN_DISPS(gfxCtx); if (dbgVar1) { - tmp = POLY_XLU_DISP; - spA8 = gfxCtx->zbuffer; + gfx = POLY_XLU_DISP; + zbuffer = gfxCtx->zbuffer; spA4 = play->unk_18E68; if (dbgVar2) { - PreRender_SetValues(&play->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, spA8); + PreRender_SetValues(&play->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, zbuffer); - spAC = tmp; - func_80170200(&play->pauseBgPreRender, &spAC, spA8, spA4); - tmp = spAC; + gfxTemp = gfx; + func_80170200(&play->pauseBgPreRender, &gfxTemp, zbuffer, spA4); + gfx = gfxTemp; } - gDPPipeSync(tmp++); - gDPSetPrimDepth(tmp++, 0, 0); + gDPPipeSync(gfx++); + gDPSetPrimDepth(gfx++, 0, 0); - gDPSetOtherMode(tmp++, + gDPSetOtherMode(gfx++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); - gDPSetPrimColor(tmp++, 0, 0, 0, 0, 0, 255); + gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 255); - if (play->roomCtx.curRoom.unk5 == 0) { - gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, + if (play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { + gDPSetCombineLERP(gfx++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0); } else { - gDPSetCombineMode(tmp++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); } - spAC = tmp; - Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); - tmp = Play_SetFog(play, spAC); + gfxTemp = gfx; + Actor_DrawLensOverlay(&gfxTemp, play->actorCtx.lensMaskSize); + gfx = Play_SetFog(play, gfxTemp); - for (spB4 = 0, invisibleActor = invisibleActors; spB4 < numInvisibleActors; spB4++, invisibleActor++) { - POLY_XLU_DISP = tmp; - Actor_Draw(play, *invisibleActor); - tmp = POLY_XLU_DISP; + for (i = 0, lensActor = lensActors; i < numLensActors; i++, lensActor++) { + POLY_XLU_DISP = gfx; + Actor_Draw(play, *lensActor); + gfx = POLY_XLU_DISP; } if (dbgVar2) { - gDPPipeSync(tmp++); + gDPPipeSync(gfx++); - gDPSetOtherMode(tmp++, + gDPSetOtherMode(gfx++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_WRAP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1) | GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_1)); - gDPSetBlendColor(tmp++, 255, 255, 255, 0); - gDPSetPrimColor(tmp++, 0, 0xFF, 0, 0, 0, 32); + gDPSetBlendColor(gfx++, 255, 255, 255, 0); + gDPSetPrimColor(gfx++, 0, 0xFF, 0, 0, 0, 32); - if (play->roomCtx.curRoom.unk5 == 0) { - gDPSetCombineMode(tmp++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + if (play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) { + gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); } else { - gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, + gDPSetCombineLERP(gfx++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0); } - gDPSetColorImage(tmp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, spA4); + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, spA4); - spAC = tmp; - Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); - tmp = spAC; + gfxTemp = gfx; + Actor_DrawLensOverlay(&gfxTemp, play->actorCtx.lensMaskSize); + gfx = gfxTemp; - gDPPipeSync(tmp++); - gDPSetBlendColor(tmp++, 255, 255, 255, 8); + gDPPipeSync(gfx++); + gDPSetBlendColor(gfx++, 255, 255, 255, 8); - gDPSetColorImage(tmp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, + gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, play->pauseBgPreRender.width, play->pauseBgPreRender.fbuf); - spAC = tmp; - func_8016FDB8(&play->pauseBgPreRender, &spAC, (void*)spA4, spA8, 1); - tmp = spAC; + gfxTemp = gfx; + func_8016FDB8(&play->pauseBgPreRender, &gfxTemp, spA4, zbuffer, 1); + gfx = gfxTemp; } - POLY_XLU_DISP = tmp; + POLY_XLU_DISP = gfx; } - tmp = OVERLAY_DISP; + gfx = OVERLAY_DISP; - gDPPipeSync(tmp++); + gDPPipeSync(gfx++); - gDPSetOtherMode(tmp++, + gDPSetOtherMode(gfx++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2); - gDPSetCombineLERP(tmp++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, + gDPSetCombineLERP(gfx++, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0, 1, TEXEL0, PRIMITIVE, 0); - gDPSetPrimColor(tmp++, 0, 0, 74, 0, 0, 74); + gDPSetPrimColor(gfx++, 0, 0, 74, 0, 0, 74); - spAC = tmp; - Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize); - OVERLAY_DISP = spAC; + gfxTemp = gfx; + Actor_DrawLensOverlay(&gfxTemp, play->actorCtx.lensMaskSize); + OVERLAY_DISP = gfxTemp; CLOSE_DISPS(gfxCtx); } @@ -2817,7 +2858,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { OPEN_DISPS(play->state.gfxCtx); - Actor_DrawAllSetup(play); + Actor_ResetLensActors(play); sp58 = POLY_XLU_DISP; POLY_XLU_DISP = &sp58[1]; @@ -2841,10 +2882,11 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & actorFlags)) { - if ((actor->flags & ACTOR_FLAG_80) && - ((play->roomCtx.curRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || + if ((actor->flags & ACTOR_FLAG_REACT_TO_LENS) && + ((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || + (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || (actor->room != play->roomCtx.curRoom.num))) { - if (Actor_RecordUndrawnActor(play, actor)) {} + if (Actor_AddToLensActors(play, actor)) {} } else { Actor_Draw(play, actor); } @@ -2870,9 +2912,10 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { } else { Math_StepToC(&play->actorCtx.lensMaskSize, 0, 10); } + if (play->actorCtx.lensMaskSize != 0) { play->actorCtx.lensActorsDrawn = true; - Actor_DrawLensActors(play, play->actorCtx.undrawnActorCount, play->actorCtx.undrawnActors); + Actor_DrawLensActors(play, play->actorCtx.numLensActors, play->actorCtx.lensActors); } tmp2 = POLY_XLU_DISP; @@ -2890,9 +2933,9 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { } /** - * Kills every actor which its object is not loaded + * Kill every actor which depends on an object that is not loaded. */ -void func_800BA6FC(PlayState* play, ActorContext* actorCtx) { +void Actor_KillAllWithMissingObject(PlayState* play, ActorContext* actorCtx) { Actor* actor; s32 i; @@ -2942,15 +2985,19 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) { play->msgCtx.unk_12030 = 0; } -void func_800BA8B8(PlayState* play, ActorContext* actorCtx) { +/** + * Kill every actor which does not have the current halfDayBit enabled + */ +void Actor_KillAllOnHalfDayChange(PlayState* play, ActorContext* actorCtx) { s32 i; for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) { Actor* actor = actorCtx->actorLists[i].first; while (actor != NULL) { - if (!(actor->unk20 & actorCtx->unkC)) { + if (!(actor->halfDaysBits & actorCtx->halfDaysBit)) { func_80123590(play, actor); + if (!actor->isDrawn) { actor = Actor_Delete(actorCtx, actor, play); } else { @@ -3078,8 +3125,8 @@ void Actor_FreeOverlay(ActorOverlay* entry) { Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) { - return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, 0x3FF, - NULL); + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, + HALFDAYBIT_ALL, NULL); } ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { @@ -3123,7 +3170,7 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { } Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, - s16 rotY, s16 rotZ, s32 params, u32 cutscene, s32 arg11, Actor* parent) { + s16 rotY, s16 rotZ, s32 params, u32 cutscene, u32 halfDaysBits, Actor* parent) { s32 pad; Actor* actor; ActorInit* actorInit; @@ -3195,10 +3242,10 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 actor->cutscene = -1; } - if (arg11 != 0) { - actor->unk20 = arg11; + if (halfDaysBits != 0) { + actor->halfDaysBits = halfDaysBits; } else { - actor->unk20 = 0x3FF; + actor->halfDaysBits = HALFDAYBIT_ALL; } Actor_AddToCategory(actorCtx, actor, actorInit->type); @@ -3216,7 +3263,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) { return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, - parent->unk20, parent); + parent->halfDaysBits, parent); } void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { @@ -3232,13 +3279,13 @@ void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { (transitionActorList->sides[1].room >= 0 && (play->roomCtx.curRoom.num == transitionActorList->sides[1].room || play->roomCtx.prevRoom.num == transitionActorList->sides[1].room))) { - s16 rotY = ((transitionActorList->rotY >> 7) & 0x1FF) * (0x10000 / 360.0f); + s16 rotY = DEG_TO_BINANG((transitionActorList->rotY >> 7) & 0x1FF); if (Actor_SpawnAsChildAndCutscene(actorCtx, play, transitionActorList->id & 0x1FFF, transitionActorList->pos.x, transitionActorList->pos.y, transitionActorList->pos.z, 0, rotY, 0, (i << 0xA) + (transitionActorList->params & 0x3FF), - transitionActorList->rotY & 0x7F, 0x3FF, 0) != NULL) { + transitionActorList->rotY & 0x7F, HALFDAYBIT_ALL, 0) != NULL) { transitionActorList->id = -transitionActorList->id; } numTransitionActors = play->doorCtx.numTransitionActors; @@ -3253,19 +3300,19 @@ Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, PlayStat s16 rotZ = (actorEntry->rot.z >> 7) & 0x1FF; if (!(actorEntry->id & 0x8000)) { - rotY *= 0x10000 / 360.0f; + rotY = DEG_TO_BINANG(rotY); } else if (rotY > 180) { rotY -= 360; } if (!(actorEntry->id & 0x4000)) { - rotX *= 0x10000 / 360.0f; + rotX = DEG_TO_BINANG(rotX); } else if (rotX > 180) { rotX -= 360; } if (!(actorEntry->id & 0x2000)) { - rotZ *= 0x10000 / 360.0f; + rotZ = DEG_TO_BINANG(rotZ); } else if (rotZ > 180) { rotZ -= 360; } @@ -3490,16 +3537,16 @@ s16 func_800BBC20(s16 arg0[2], s16 arg1, s16 arg2, s16 arg3) { return arg0[0]; } -void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 arg2, Gfx** dList) { - EnPart* part; - Actor* spawnedPart; - MtxF* currentMatrix; - +void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 partParams, Gfx** dList) { if (*dList != NULL) { - currentMatrix = Matrix_GetCurrent(); + EnPart* part; + Actor* spawnedPart; + MtxF* currentMatrix = Matrix_GetCurrent(); + spawnedPart = Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, currentMatrix->mf[3][0], - currentMatrix->mf[3][1], currentMatrix->mf[3][2], 0, 0, actor->objBankIndex, arg2); + currentMatrix->mf[3][1], currentMatrix->mf[3][2], 0, 0, actor->objBankIndex, partParams); + if (spawnedPart != NULL) { part = (EnPart*)spawnedPart; @@ -3568,21 +3615,29 @@ void func_800BC154(PlayState* play, ActorContext* actorCtx, Actor* actor, u8 act } // Damage flags for EnArrow -s32 D_801AEDB0[] = { - 0x800, 0x20, 0x20, 0x800, 0x1000, 0x2000, 0x1, 0x10000, 0x1, +u32 sArrowDmgFlags[] = { + DMG_FIRE_ARROW, // ENARROW_0 + DMG_NORMAL_ARROW, // ENARROW_1 + DMG_NORMAL_ARROW, // ENARROW_2 + DMG_FIRE_ARROW, // ENARROW_3 + DMG_ICE_ARROW, // ENARROW_4 + DMG_LIGHT_ARROW, // ENARROW_5 + DMG_DEKU_NUT, // ENARROW_6 + DMG_DEKU_BUBBLE, // ENARROW_7 + DMG_DEKU_NUT, // ENARROW_8 }; -s32 func_800BC188(s32 index) { - if ((index < 0) || (index >= ARRAY_COUNT(D_801AEDB0))) { +u32 Actor_GetArrowDmgFlags(s32 params) { + if ((params < 0) || (params >= ARRAY_COUNT(sArrowDmgFlags))) { return 0; } - return D_801AEDB0[index]; + return sArrowDmgFlags[params]; } -s32 func_800BC1B4(Actor* actor, Actor* arg1, f32 arg2, f32 arg3) { - if ((arg3 > 0.0f) && (Actor_DistanceBetweenActors(arg1, actor) < ((arg3 * 2.5f) + arg2))) { - s16 temp_v1 = BINANG_SUB(Actor_YawBetweenActors(arg1, actor), arg1->world.rot.y); +s32 func_800BC1B4(Actor* actor, Actor* projectile, f32 distance, f32 speed) { + if ((speed > 0.0f) && (Actor_WorldDistXYZToActor(projectile, actor) < ((speed * 2.5f) + distance))) { + s16 temp_v1 = BINANG_SUB(Actor_WorldYawTowardActor(projectile, actor), projectile->world.rot.y); if (ABS_ALT(temp_v1) < 0x1400) { return true; @@ -3592,36 +3647,36 @@ s32 func_800BC1B4(Actor* actor, Actor* arg1, f32 arg2, f32 arg3) { return false; } -Actor* func_800BC270(PlayState* play, Actor* actor, f32 arg2, s32 arg3) { +Actor* func_800BC270(PlayState* play, Actor* actor, f32 distance, u32 dmgFlags) { Actor* itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; while (itemAction != NULL) { - if (((itemAction->id == ACTOR_ARMS_HOOK) && (arg3 & 0x80)) || - ((itemAction->id == ACTOR_EN_BOOM) && (arg3 & 0x10)) || - ((itemAction->id == ACTOR_EN_ARROW) && (func_800BC188(itemAction->params) & arg3))) { - f32 speedXZ; + if (((itemAction->id == ACTOR_ARMS_HOOK) && (dmgFlags & DMG_HOOKSHOT)) || + ((itemAction->id == ACTOR_EN_BOOM) && (dmgFlags & DMG_ZORA_BOOMERANG)) || + ((itemAction->id == ACTOR_EN_ARROW) && (Actor_GetArrowDmgFlags(itemAction->params) & dmgFlags))) { + f32 speed; - if ((itemAction->speedXZ <= 0.0f) && (GET_PLAYER(play)->unk_D57 != 0)) { + if ((itemAction->speed <= 0.0f) && (GET_PLAYER(play)->unk_D57 != 0)) { if (itemAction->id == ACTOR_ARMS_HOOK) { - speedXZ = 20.0f; + speed = 20.0f; } else if (itemAction->id == ACTOR_EN_BOOM) { - speedXZ = 12.0f; + speed = 12.0f; } else { - s32 temp_v0_3 = func_800BC188(itemAction->params); + u32 arrowDmgFlags = Actor_GetArrowDmgFlags(itemAction->params); - if (temp_v0_3 == 1) { - speedXZ = 80.0f; - } else if (temp_v0_3 == 0x10000) { - speedXZ = 60.0f; + if (arrowDmgFlags == DMG_DEKU_NUT) { + speed = 80.0f; + } else if (arrowDmgFlags == DMG_DEKU_BUBBLE) { + speed = 60.0f; } else { - speedXZ = 150.0f; + speed = 150.0f; } } } else { - speedXZ = itemAction->speedXZ; + speed = itemAction->speed; } - if (func_800BC1B4(actor, itemAction, arg2, speedXZ)) { + if (func_800BC1B4(actor, itemAction, distance, speed)) { break; } } @@ -3632,13 +3687,13 @@ Actor* func_800BC270(PlayState* play, Actor* actor, f32 arg2, s32 arg3) { return itemAction; } -Actor* func_800BC444(PlayState* play, Actor* actor, f32 arg2) { +Actor* func_800BC444(PlayState* play, Actor* actor, f32 distance) { Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { if (((explosive->id == ACTOR_EN_BOM) || (explosive->id == ACTOR_EN_BOM_CHU) || (explosive->id == ACTOR_EN_BOMBF))) { - if (func_800BC1B4(actor, explosive, arg2, explosive->speedXZ)) { + if (func_800BC1B4(actor, explosive, distance, explosive->speed)) { break; } } @@ -3674,7 +3729,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, 4); Math_Vec3f_Copy(&actor->world.pos, &actorPos); - ret = actor->bgCheckFlags & 1; + ret = actor->bgCheckFlags & BGCHECKFLAG_GROUND; actor->bgCheckFlags = bgCheckFlags; @@ -3707,29 +3762,30 @@ s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { return false; } -void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { - MtxF sp58; - f32 sp54; - Vec3f sp48; - CollisionPoly* sp44; +void func_800BC620(Vec3f* pos, Vec3f* scale, u8 alpha, PlayState* play) { + MtxF mf; + f32 yIntersect; + Vec3f adjustedPos; + CollisionPoly* poly; OPEN_DISPS(play->state.gfxCtx); POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); - sp48.x = arg0->x; - sp48.y = arg0->y + 1.0f; - sp48.z = arg0->z; + adjustedPos.x = pos->x; + adjustedPos.y = pos->y + 1.0f; + adjustedPos.z = pos->z; - sp54 = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp44, &sp48); - if (sp44 != NULL) { - func_800C0094(sp44, arg0->x, sp54, arg0->z, &sp58); - Matrix_Put(&sp58); + yIntersect = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &adjustedPos); + if (poly != NULL) { + func_800C0094(poly, pos->x, yIntersect, pos->z, &mf); + Matrix_Put(&mf); } else { - Matrix_Translate(arg0->x, arg0->y, arg0->z, MTXMODE_NEW); + Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_NEW); } - Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); + + Matrix_Scale(scale->x, 1.0f, scale->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++, gCircleShadowDL); @@ -3834,12 +3890,12 @@ void Actor_SpawnShieldParticlesMetal(PlayState* play, Vec3f* pos) { CollisionCheck_SpawnShieldParticlesMetal(play, pos); } -void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration) { - if ((colorFlag == 0x8000) && !(colorIntensityMax & 0x8000)) { - Actor_PlaySfxAtPos(actor, NA_SE_EN_LIGHT_ARROW_HIT); +void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 bufFlag, u16 duration) { + if ((colorFlag == COLORFILTER_COLORFLAG_GRAY) && !(colorIntensityMax & COLORFILTER_INTENSITY_FLAG)) { + Actor_PlaySfx(actor, NA_SE_EN_LIGHT_ARROW_HIT); } - actor->colorFilterParams = colorFlag | xluFlag | ((colorIntensityMax & 0xF8) << 5) | duration; + actor->colorFilterParams = colorFlag | bufFlag | ((colorIntensityMax & 0xF8) << 5) | duration; actor->colorFilterTimer = duration; } @@ -4008,170 +4064,285 @@ void Actor_GetClosestPosOnPath(Vec3s* points, s32 numPoints, Vec3f* srcPos, Vec3 } } -// unused -s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*textIdCallback)(PlayState*, Actor*), - s16 (*arg5)(PlayState*, Actor*)) { +/** + * Updates NPC talking state. Checks for a talk request and updates + * the talkState parameter when a dialog is ongoing. Otherwise checks if + * the actor is onscreen, advertises the interaction in a range and sets + * the current text id if necessary. + * + * The talk state values are defined in the NpcTalkState enum. + * + * @see NpcTalkState + * + * @param[in,out] talkState Talk state + * @param interactRange The interact (talking) range for the actor + * @param getTextId Callback for getting the next text id + * @param updateTalkState Callback for getting the next talkState value + * @return True if a new dialog was started (player talked to the actor). False otherwise. + */ +s32 Npc_UpdateTalking(PlayState* play, Actor* actor, s16* talkState, f32 interactRange, NpcGetTextIdFunc getTextId, + NpcUpdateTalkStateFunc updateTalkState) { if (Actor_ProcessTalkRequest(actor, &play->state)) { - *arg2 = true; + *talkState = NPC_TALK_STATE_TALKING; return true; - } else if (*arg2) { - *arg2 = arg5(play, actor); - return false; - } else if (!Actor_OnScreen(play, actor)) { - return false; - } else if (!func_800B8614(actor, play, arg3)) { - return false; - } else { - actor->textId = textIdCallback(play, actor); + } + + if (*talkState != NPC_TALK_STATE_IDLE) { + *talkState = updateTalkState(play, actor); return false; } + + if (!Actor_OnScreen(play, actor)) { + return false; + } + + if (!func_800B8614(actor, play, interactRange)) { + return false; + } + + actor->textId = getTextId(play, actor); + + return false; } typedef struct { - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ s16 unk_08; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ u8 unk_0C; -} struct_801AEE38_0; // size = 0x10 + /* 0x0 */ s16 maxHeadYaw; + /* 0x2 */ s16 minHeadPitch; + /* 0x4 */ s16 maxHeadPitch; + /* 0x6 */ s16 maxTorsoYaw; + /* 0x8 */ s16 minTorsoPitch; + /* 0xA */ s16 maxTorsoPitch; + /* 0xC */ u8 rotateYaw; +} NpcTrackingRotLimits; // size = 0x10 typedef struct { - /* 0x00 */ struct_801AEE38_0 sub_00; - /* 0x10 */ f32 unk_10; - /* 0x14 */ s16 unk_14; -} struct_801AEE38; // size = 0x18 + /* 0x00 */ NpcTrackingRotLimits rotLimits; + // Fields specific to NPC_TRACKING_PLAYER_AUTO_TURN mode + /* 0x10 */ f32 autoTurnDistanceRange; // Max distance to player to enable tracking and auto-turn + /* 0x14 */ s16 maxYawForPlayerTracking; // Player is tracked if within this yaw +} NpcTrackingParams; // size = 0x18 -struct_801AEE38 D_801AEE38[] = { - { { 0x1C20, 0xE390, 0x1C70, 0x1554, 0x0000, 0x0000, 0x0000 }, 170.0f, 0x3FFC }, - { { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, 0x0001 }, 170.0f, 0x3FFC }, - { { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, 0x0001 }, 170.0f, 0x3FFC }, - { { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, 0x0001 }, 170.0f, 0x3FFC }, - { { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, 0x0001 }, 170.0f, 0x3FFC }, - { { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, 0x0001 }, 170.0f, 0x3FFC }, - { { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0001 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 0x0001 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 0x0001 }, 0.0f, 0x0000 }, - { { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 0x0001 }, 0.0f, 0x0000 }, - { { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 0x0001 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 0x0001 }, 0.0f, 0x0000 }, - { { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0001 }, 0.0f, 0x0000 }, - { { 0x2A6C, 0xE390, 0x1C70, 0x1554, 0x0000, 0x0000, 0x0000 }, 170.0f, 0x3FFC }, +/** + * Npc tracking angle limit presets to use with Npc_TrackPoint. + * + * @see Npc_TrackPoint + */ +NpcTrackingParams sNpcTrackingPresets[] = { + { { 0x1C20, 0xE390, 0x1C70, 0x1554, 0x0000, 0x0000, false }, 170.0f, 0x3FFC }, + { { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, true }, 170.0f, 0x3FFC }, + { { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, true }, 170.0f, 0x3FFC }, + { { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, true }, 170.0f, 0x3FFC }, + { { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, true }, 170.0f, 0x3FFC }, + { { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, true }, 170.0f, 0x3FFC }, + { { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, true }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, true }, 0.0f, 0x0000 }, + { { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, true }, 0.0f, 0x0000 }, + { { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, true }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, true }, 0.0f, 0x0000 }, + { { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, true }, 0.0f, 0x0000 }, + { { 0x2A6C, 0xE390, 0x1C70, 0x1554, 0x0000, 0x0000, false }, 170.0f, 0x3FFC }, }; -void func_800BD384(Actor* actor, struct_800BD888_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, - u8 arg8) { - s16 sp46; - s16 sp44; - s16 temp2; - s16 sp40; - s16 temp1; - Vec3f sp30; +/** + * Smoothly turns the actor's whole body and updates torso and head rotations in + * NpcInteractInfo so that the actor tracks the point specified in NpcInteractInfo.trackPos. + * Rotations are limited to specified angles. + * + * Head and torso rotation angles are determined by calculating the pitch and yaw + * from the actor position to the given target position. + * + * The y position of the actor is offset by NpcInteractInfo.yOffset + * before calculating the angles. It can be used to configure the height difference + * between the actor and the target. + * + * @param maxHeadYaw maximum head yaw difference from neutral position + * @param maxHeadPitch maximum head pitch angle + * @param minHeadPitch minimum head pitch angle + * @param maxTorsoYaw maximum torso yaw difference from neutral position + * @param maxTorsoPitch maximum torso pitch angle + * @param minTorsoPitch minimum torso pitch angle + * @param rotateYaw if true, the actor's yaw (shape.rot.y) is updated to turn the actor's whole body + */ +void Npc_TrackPointWithLimits(Actor* actor, NpcInteractInfo* interactInfo, s16 maxHeadYaw, s16 maxHeadPitch, + s16 minHeadPitch, s16 maxTorsoYaw, s16 maxTorsoPitch, s16 minTorsoPitch, u8 rotateYaw) { + s16 pitchTowardsTarget; + s16 yawTowardsTarget; + s16 torsoPitch; + s16 bodyYawDiff; + s16 temp; + Vec3f offsetActorPos; - sp30.x = actor->world.pos.x; - sp30.y = actor->world.pos.y + arg1->unk_14; - sp30.z = actor->world.pos.z; + offsetActorPos.x = actor->world.pos.x; + offsetActorPos.y = actor->world.pos.y + interactInfo->yOffset; + offsetActorPos.z = actor->world.pos.z; - sp46 = Math_Vec3f_Pitch(&sp30, &arg1->unk_18); - sp44 = Math_Vec3f_Yaw(&sp30, &arg1->unk_18); - sp40 = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18) - actor->shape.rot.y; + pitchTowardsTarget = Math_Vec3f_Pitch(&offsetActorPos, &interactInfo->trackPos); + yawTowardsTarget = Math_Vec3f_Yaw(&offsetActorPos, &interactInfo->trackPos); + bodyYawDiff = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos) - actor->shape.rot.y; - temp1 = CLAMP(sp40, -arg2, arg2); - Math_SmoothStepToS(&arg1->unk_08.y, temp1, 6, 2000, 1); + temp = CLAMP(bodyYawDiff, -maxHeadYaw, maxHeadYaw); + Math_SmoothStepToS(&interactInfo->headRot.y, temp, 6, 0x7D0, 1); - temp1 = (ABS_ALT(sp40) >= 0x8000) ? 0 : ABS_ALT(sp40); - arg1->unk_08.y = CLAMP(arg1->unk_08.y, -temp1, temp1); + temp = (ABS_ALT(bodyYawDiff) >= 0x8000) ? 0 : ABS_ALT(bodyYawDiff); + interactInfo->headRot.y = CLAMP(interactInfo->headRot.y, -temp, temp); - sp40 -= arg1->unk_08.y; + bodyYawDiff -= interactInfo->headRot.y; - temp1 = CLAMP(sp40, -arg5, arg5); - Math_SmoothStepToS(&arg1->unk_0E.y, temp1, 6, 2000, 1); + temp = CLAMP(bodyYawDiff, -maxTorsoYaw, maxTorsoYaw); + Math_SmoothStepToS(&interactInfo->torsoRot.y, temp, 6, 0x7D0, 1); - temp1 = (ABS_ALT(sp40) >= 0x8000) ? 0 : ABS_ALT(sp40); - arg1->unk_0E.y = CLAMP(arg1->unk_0E.y, -temp1, temp1); + temp = (ABS_ALT(bodyYawDiff) >= 0x8000) ? 0 : ABS_ALT(bodyYawDiff); + interactInfo->torsoRot.y = CLAMP(interactInfo->torsoRot.y, -temp, temp); - if (arg8) { - Math_SmoothStepToS(&actor->shape.rot.y, sp44, 6, 2000, 1); + if (rotateYaw) { + Math_SmoothStepToS(&actor->shape.rot.y, yawTowardsTarget, 6, 0x7D0, 1); } - temp1 = CLAMP(sp46, arg4, (s16)(u16)arg3); - Math_SmoothStepToS(&arg1->unk_08.x, temp1, 6, 2000, 1); + temp = CLAMP(pitchTowardsTarget, minHeadPitch, (s16)(u16)maxHeadPitch); + Math_SmoothStepToS(&interactInfo->headRot.x, temp, 6, 2000, 1); - temp2 = sp46 - arg1->unk_08.x; + torsoPitch = pitchTowardsTarget - interactInfo->headRot.x; - temp1 = CLAMP(temp2, arg7, arg6); - Math_SmoothStepToS(&arg1->unk_0E.x, temp1, 6, 2000, 1); + temp = CLAMP(torsoPitch, minTorsoPitch, maxTorsoPitch); + Math_SmoothStepToS(&interactInfo->torsoRot.x, temp, 6, 0x7D0, 1); } // unused -s16 func_800BD6B8(s16 arg0) { - return D_801AEE38[arg0].unk_14; +s16 Npc_GetTrackingPresetMaxPlayerYaw(s16 presetIndex) { + return sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking; } -s16 func_800BD6E4(Actor* actor, struct_800BD888_arg1* arg1, f32 arg2, s16 arg3, s16 flag) { +/** + * Handles NPC tracking modes and auto-turning towards the player when + * NPC_TRACKING_PLAYER_AUTO_TURN tracking mode is used. + * + * Returns a tracking mode that will determine which actor limbs + * will be rotated towards the target. + * + * When the player is behind the actor (i.e. not in the yaw range in front of the actor + * defined by maxYawForPlayerTracking), the actor will start an auto-turn sequence: + * - look forward for 30-60 frames + * - turn head to look at the player for 10-20 frames + * - look forward for 30-60 frames + * - turn the entire body to face the player + * + * @param distanceRange Max distance to player that tracking and auto-turning will be active for + * @param maxYawForPlayerTracking Maximum angle for tracking the player. + * @param trackingMode The tracking mode selected by the actor. If this is not + * NPC_TRACKING_PLAYER_AUTO_TURN this function does nothing + * + * @return The tracking mode (NpcTrackingMode) to use for the current frame. + */ +s16 Npc_UpdateAutoTurn(Actor* actor, NpcInteractInfo* interactInfo, f32 distanceRange, s16 maxYawForPlayerTracking, + s16 trackingMode) { s32 pad; + s16 yaw; + s16 yawDiff; - if (flag) { - return flag; - } else if (arg1->unk_00 != 0) { - return 4; - } else if (arg2 < Math_Vec3f_DistXYZ(&actor->world.pos, &arg1->unk_18)) { - arg1->unk_04 = 0; - arg1->unk_06 = 0; - return 1; - } else { - s16 yaw = Math_Vec3f_Yaw(&actor->world.pos, &arg1->unk_18); - s16 phi_a0 = ABS_ALT(BINANG_SUB(yaw, actor->shape.rot.y)); + if (trackingMode != NPC_TRACKING_PLAYER_AUTO_TURN) { + return trackingMode; + } - if (arg3 >= phi_a0) { - arg1->unk_04 = 0; - arg1->unk_06 = 0; - return 2; - } else if (DECR(arg1->unk_04) != 0) { - return arg1->unk_02; - } else { - switch (arg1->unk_06) { - case 0: - case 2: - arg1->unk_04 = Rand_S16Offset(30, 30); - arg1->unk_06++; - return 1; + if (interactInfo->talkState != NPC_TALK_STATE_IDLE) { + // When talking, always fully turn to face the player + return NPC_TRACKING_FULL_BODY; + } - case 1: - arg1->unk_04 = Rand_S16Offset(10, 10); - arg1->unk_06++; - return 3; + if (distanceRange < Math_Vec3f_DistXYZ(&actor->world.pos, &interactInfo->trackPos)) { + // Player is too far away, do not track + interactInfo->autoTurnTimer = 0; + interactInfo->autoTurnState = 0; + return NPC_TRACKING_NONE; + } - default: - return 4; - } - } + yaw = Math_Vec3f_Yaw(&actor->world.pos, &interactInfo->trackPos); + yawDiff = ABS_ALT(BINANG_SUB(yaw, actor->shape.rot.y)); + + if (maxYawForPlayerTracking >= yawDiff) { + // Player is in front of the actor, track with the head and the torso + interactInfo->autoTurnTimer = 0; + interactInfo->autoTurnState = 0; + return NPC_TRACKING_HEAD_AND_TORSO; + } + + // Player is behind the actor, run the auto-turn sequence. + + if (DECR(interactInfo->autoTurnTimer) != 0) { + // While the timer is still running, return the previous tracking mode + return interactInfo->trackingMode; + } + + switch (interactInfo->autoTurnState) { + case 0: + case 2: + // Just stand still, not tracking the player + interactInfo->autoTurnTimer = Rand_S16Offset(30, 30); + interactInfo->autoTurnState++; + return NPC_TRACKING_NONE; + + case 1: + // Glance at the player by only turning the head + interactInfo->autoTurnTimer = Rand_S16Offset(10, 10); + interactInfo->autoTurnState++; + return NPC_TRACKING_HEAD; + + default: + // Auto-turn sequence complete, turn towards the player + return NPC_TRACKING_FULL_BODY; } } -// This function is very similar to OoT's func_80034A14 -void func_800BD888(Actor* actor, struct_800BD888_arg1* arg1, s16 arg2, s16 arg3) { - struct_801AEE38_0 sp38; +/** + * Rotates the actor's whole body, torso and head tracking the point specified in NpcInteractInfo.trackPos. + * Uses angle limits from a preset selected from from sNpcTrackingPresets. + * + * The trackingMode parameter controls whether the head and torso are turned towards the target. + * If not, they are smoothly turned towards zero. Setting the parameter to NPC_TRACKING_FULL_BODY + * causes the actor's whole body to be rotated to face the target. + * + * If NPC_TRACKING_PLAYER_AUTO_TURN is used, the actor will track the player with its head and torso as long + * as the player is in front of the actor (within a yaw angle specified in the option preset). + * If the player is outside of this angle, the actor will turn to face the player after a while. + * + * @see Npc_UpdateAutoTurn + * @see sNpcTrackingPresets + * @see NpcTrackingMode + * + * @param presetIndex The index to a preset in sNpcTrackingPresets + * @param trackingMode A value from NpcTrackingMode enum + */ +void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex, s16 trackingMode) { + NpcTrackingRotLimits rotLimits; - arg1->unk_02 = func_800BD6E4(actor, arg1, D_801AEE38[arg2].unk_10, D_801AEE38[arg2].unk_14, arg3); - sp38 = D_801AEE38[arg2].sub_00; + interactInfo->trackingMode = + Npc_UpdateAutoTurn(actor, interactInfo, sNpcTrackingPresets[presetIndex].autoTurnDistanceRange, + sNpcTrackingPresets[presetIndex].maxYawForPlayerTracking, trackingMode); - switch (arg1->unk_02) { - case 1: - sp38.unk_00 = 0; - sp38.unk_04 = 0; - sp38.unk_02 = 0; - case 3: - sp38.unk_06 = 0; - sp38.unk_0A = 0; - sp38.unk_08 = 0; - case 2: - sp38.unk_0C = 0; + rotLimits = sNpcTrackingPresets[presetIndex].rotLimits; + + switch (interactInfo->trackingMode) { + case NPC_TRACKING_NONE: + rotLimits.maxHeadYaw = 0; + rotLimits.maxHeadPitch = 0; + rotLimits.minHeadPitch = 0; + // fallthrough + case NPC_TRACKING_HEAD: + rotLimits.maxTorsoYaw = 0; + rotLimits.maxTorsoPitch = 0; + rotLimits.minTorsoPitch = 0; + // fallthrough + case NPC_TRACKING_HEAD_AND_TORSO: + rotLimits.rotateYaw = false; + break; + + default: + break; } - func_800BD384(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, sp38.unk_06, sp38.unk_0A, sp38.unk_08, - sp38.unk_0C); + Npc_TrackPointWithLimits(actor, interactInfo, rotLimits.maxHeadYaw, rotLimits.maxHeadPitch, rotLimits.minHeadPitch, + rotLimits.maxTorsoYaw, rotLimits.maxTorsoPitch, rotLimits.minTorsoPitch, + rotLimits.rotateYaw); } Gfx D_801AEF88[] = { @@ -4293,7 +4464,7 @@ Actor* Actor_FindNearby(PlayState* play, Actor* inActor, s16 actorId, u8 actorCa continue; } - if (Actor_DistanceBetweenActors(inActor, actor) <= distance) { + if (Actor_WorldDistXYZToActor(inActor, actor) <= distance) { return actor; } @@ -4330,15 +4501,15 @@ void Actor_SetDropFlag(Actor* actor, ColliderInfo* colInfo) { ColliderInfo* acHitInfo = colInfo->acHitInfo; if (acHitInfo == NULL) { - actor->dropFlag = 0; - } else if (acHitInfo->toucher.dmgFlags & 0x800) { // DMG_FIRE_ARROW - actor->dropFlag = 1; - } else if (acHitInfo->toucher.dmgFlags & 0x1000) { // DMG_ICE_ARROW - actor->dropFlag = 2; - } else if (acHitInfo->toucher.dmgFlags & 0x2000) { // DMG_LIGHT_ARROW - actor->dropFlag = 0x20; + actor->dropFlag = DROPFLAG_NONE; + } else if (acHitInfo->toucher.dmgFlags & DMG_FIRE_ARROW) { + actor->dropFlag = DROPFLAG_1; + } else if (acHitInfo->toucher.dmgFlags & DMG_ICE_ARROW) { + actor->dropFlag = DROPFLAG_2; + } else if (acHitInfo->toucher.dmgFlags & DMG_LIGHT_ARROW) { + actor->dropFlag = DROPFLAG_20; } else { - actor->dropFlag = 0; + actor->dropFlag = DROPFLAG_NONE; } } @@ -4348,23 +4519,23 @@ void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSphere) { ColliderInfo* acHitInfo; s32 flag; - actor->dropFlag = 0; + actor->dropFlag = DROPFLAG_NONE; for (i = jntSphere->count - 1; i >= 0; i--) { jntElement = &jntSphere->elements[i]; acHitInfo = jntElement->info.acHitInfo; if (acHitInfo == NULL) { - flag = 0; + flag = DROPFLAG_NONE; } else { s32 dmgFlags = acHitInfo->toucher.dmgFlags; - if (dmgFlags & 0x800) { - flag = 1; - } else if (dmgFlags & 0x1000) { - flag = 2; + if (dmgFlags & DMG_FIRE_ARROW) { + flag = DROPFLAG_1; + } else if (dmgFlags & DMG_ICE_ARROW) { + flag = DROPFLAG_2; } else { - flag = (dmgFlags & 0x2000) ? 0x20 : 0; + flag = (dmgFlags & DMG_LIGHT_ARROW) ? DROPFLAG_20 : DROPFLAG_NONE; } } @@ -4372,19 +4543,19 @@ void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSphere) { } } -void func_800BE33C(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3) { +void func_800BE33C(Vec3f* arg0, Vec3f* arg1, Vec3s* dst, s32 arg3) { f32 xDiff = arg1->x - arg0->x; f32 zDiff = arg1->z - arg0->z; f32 yDiff = arg3 ? (arg1->y - arg0->y) : (arg0->y - arg1->y); - arg2->y = Math_Atan2S_XY(zDiff, xDiff); - arg2->x = Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), yDiff); + dst->y = Math_Atan2S_XY(zDiff, xDiff); + dst->x = Math_Atan2S_XY(sqrtf(SQ(xDiff) + SQ(zDiff)), yDiff); } void func_800BE3D0(Actor* actor, s16 angle, Vec3s* arg2) { - f32 sp44; - f32 sp40; - f32 sp3C; + f32 floorPolyNormalX; + f32 floorPolyNormalY; + f32 floorPolyNormalZ; f32 sp38; f32 sp34; f32 sp30; @@ -4394,17 +4565,17 @@ void func_800BE3D0(Actor* actor, s16 angle, Vec3s* arg2) { if (actor->floorPoly != NULL) { CollisionPoly* floorPoly = actor->floorPoly; - sp44 = COLPOLY_GET_NORMAL(floorPoly->normal.x); - sp40 = COLPOLY_GET_NORMAL(floorPoly->normal.y); - sp3C = COLPOLY_GET_NORMAL(floorPoly->normal.z); + floorPolyNormalX = COLPOLY_GET_NORMAL(floorPoly->normal.x); + floorPolyNormalY = COLPOLY_GET_NORMAL(floorPoly->normal.y); + floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z); sp38 = Math_SinS(angle); sp34 = Math_CosS(angle); - arg2->x = (s16)-Math_Atan2S((-(sp44 * sp38) - (sp3C * sp34)) * sp40, 1.0f); + arg2->x = (s16)-Math_Atan2S((-(floorPolyNormalX * sp38) - (floorPolyNormalZ * sp34)) * floorPolyNormalY, 1.0f); sp2C = Math_SinS(angle - 0x3FF7); sp30 = Math_CosS(angle - 0x3FF7); - arg2->z = (s16)-Math_Atan2S((-(sp44 * sp2C) - (sp3C * sp30)) * sp40, 1.0f); + arg2->z = (s16)-Math_Atan2S((-(floorPolyNormalX * sp2C) - (floorPolyNormalZ * sp30)) * floorPolyNormalY, 1.0f); } } @@ -4413,7 +4584,7 @@ void func_800BE504(Actor* actor, ColliderCylinder* collider) { if ((collider->info.acHitInfo->toucher.dmgFlags & (0x10000 | 0x2000 | 0x1000 | 0x800 | 0x20))) { actor->world.rot.y = collider->base.ac->shape.rot.y; } else { - actor->world.rot.y = Actor_YawBetweenActors(collider->base.ac, actor); + actor->world.rot.y = Actor_WorldYawTowardActor(collider->base.ac, actor); } } @@ -4421,7 +4592,7 @@ void func_800BE568(Actor* actor, ColliderSphere* collider) { if (collider->info.acHitInfo->toucher.dmgFlags & (0x10000 | 0x2000 | 0x1000 | 0x800 | 0x20)) { actor->world.rot.y = collider->base.ac->shape.rot.y; } else { - actor->world.rot.y = Actor_YawBetweenActors(collider->base.ac, actor); + actor->world.rot.y = Actor_WorldYawTowardActor(collider->base.ac, actor); } } @@ -4430,7 +4601,7 @@ void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex) { (0x10000 | 0x2000 | 0x1000 | 0x800 | 0x20)) { actor->world.rot.y = collider->base.ac->shape.rot.y; } else { - actor->world.rot.y = Actor_YawBetweenActors(collider->base.ac, actor); + actor->world.rot.y = Actor_WorldYawTowardActor(collider->base.ac, actor); } } @@ -4473,13 +4644,13 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 // Apply sfx along with damage effect if ((actor != NULL) && (effectAlpha > 0.05f) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { if (type == ACTOR_DRAW_DMGEFF_FIRE) { - Actor_PlaySfxAtPos(actor, NA_SE_EV_BURN_OUT - SFX_FLAG); + Actor_PlaySfx(actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } else if (type == ACTOR_DRAW_DMGEFF_BLUE_FIRE) { - Actor_PlaySfxAtPos(actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx(actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else if (type == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { - Actor_PlaySfxAtPos(actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx(actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } else if ((type == ACTOR_DRAW_DMGEFF_LIGHT_ORBS) || (type == ACTOR_DRAW_DMGEFF_BLUE_LIGHT_ORBS)) { - Actor_PlaySfxAtPos(actor, NA_SE_EN_COMMON_DEADLIGHT - SFX_FLAG); + Actor_PlaySfx(actor, NA_SE_EN_COMMON_DEADLIGHT - SFX_FLAG); } } @@ -4730,7 +4901,7 @@ void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s32 l SoundSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 30, NA_SE_EV_ICE_BROKEN); for (i = 0; i < limbPosCount; i++) { - yaw = Actor_YawToPoint(actor, limbPos); + yaw = Actor_WorldYawTowardPoint(actor, limbPos); for (j = 0; j < effectsPerLimb; j++) { randomYaw = ((s32)Rand_Next() >> 0x13) + yaw; diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 5d7f30ea8..1008cceab 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -38,45 +38,44 @@ ActorOverlay gActorOverlayTable[] = { ActorId gMaxActorId = 0; -FaultClient D_801ED930; -FaultAddrConvClient D_801ED940; +FaultClient sActorOverlayTableFaultClient; +FaultAddrConvClient sActorOverlayTableFaultAddrConvClient; -void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { +void ActorOverlayTable_FaultClient(void* arg0, void* arg1) { ActorOverlay* overlayEntry; u32 overlaySize; - ActorId i; + ActorId actorId; FaultDrawer_SetCharPad(-2, 0); FaultDrawer_Printf("actor_dlftbls %u\n", gMaxActorId); FaultDrawer_Printf("No. RamStart- RamEnd cn Name\n"); - for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxActorId; i++, overlayEntry++) { + for (actorId = 0, overlayEntry = &gActorOverlayTable[0]; actorId < gMaxActorId; actorId++, overlayEntry++) { overlaySize = VRAM_PTR_SIZE(overlayEntry); if (overlayEntry->loadedRamAddr != NULL) { - FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr, + FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", actorId, overlayEntry->loadedRamAddr, (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded, ""); } } } -void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1) { - u8* ptr = arg0; - ActorOverlay* overlayEntry = &gActorOverlayTable[0]; - ActorId i; - u8* ramStart; - u8* ramEnd; - size_t size; - u32 offset; +void* ActorOverlayTable_FaultAddrConv(void* address, void* param) { + uintptr_t addr = address; + ActorOverlay* actorOvl = &gActorOverlayTable[0]; + size_t ramConv; + void* ramStart; + size_t diff; + ActorId actorId; + + for (actorId = 0; actorId < gMaxActorId; actorId++, actorOvl++) { + diff = VRAM_PTR_SIZE(actorOvl); + ramStart = actorOvl->loadedRamAddr; + ramConv = (uintptr_t)actorOvl->vramStart - (uintptr_t)ramStart; - for (i = 0; i < gMaxActorId; i++, overlayEntry++) { - size = VRAM_PTR_SIZE(overlayEntry); - ramStart = overlayEntry->loadedRamAddr; - ramEnd = ramStart + size; - offset = (u8*)overlayEntry->vramStart - ramStart; if (ramStart != NULL) { - if (ptr >= ramStart && ptr < ramEnd) { - return ptr + offset; + if ((addr >= (uintptr_t)ramStart) && (addr < (uintptr_t)ramStart + diff)) { + return addr + ramConv; } } } @@ -85,12 +84,12 @@ void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1) { void ActorOverlayTable_Init(void) { gMaxActorId = ACTOR_ID_MAX; - Fault_AddClient(&D_801ED930, &ActorOverlayTable_FaultPrint, NULL, NULL); - Fault_AddAddrConvClient(&D_801ED940, &ActorOverlayTable_FaultAddrConv, NULL); + Fault_AddClient(&sActorOverlayTableFaultClient, ActorOverlayTable_FaultClient, NULL, NULL); + Fault_AddAddrConvClient(&sActorOverlayTableFaultAddrConvClient, ActorOverlayTable_FaultAddrConv, NULL); } void ActorOverlayTable_Cleanup(void) { - Fault_RemoveClient(&D_801ED930); - Fault_RemoveAddrConvClient(&D_801ED940); + Fault_RemoveClient(&sActorOverlayTableFaultClient); + Fault_RemoveAddrConvClient(&sActorOverlayTableFaultAddrConvClient); gMaxActorId = 0; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index eda6437af..ad04236fe 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "vt.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" @@ -140,7 +139,7 @@ void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) { } void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) { - list->tbl = (SSNode*)THA_AllocEndAlign(&play->state.heap, numNodes * sizeof(SSNode), -2); + list->tbl = (SSNode*)THA_AllocTailAlign(&play->state.heap, numNodes * sizeof(SSNode), -2); list->maxNodes = numNodes; list->count = 0; } @@ -1591,7 +1590,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader colCtx->subdivAmount.z = 16; } } - colCtx->lookupTbl = THA_AllocEndAlign( + colCtx->lookupTbl = THA_AllocTailAlign( &play->state.heap, colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); if (colCtx->lookupTbl == NULL) { @@ -1955,7 +1954,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul } posResult->z = posIntersect.z; if (actor != NULL) { - actor->bgCheckFlags |= 0x1000; + actor->bgCheckFlags |= BGCHECKFLAG_PLAYER_1000; } } // poly is wall @@ -2001,7 +2000,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul result = true; if (poly->normal.y * COLPOLY_NORMAL_FRAC > 0.5f) { if (actor != NULL) { - actor->bgCheckFlags |= 0x1000; + actor->bgCheckFlags |= BGCHECKFLAG_PLAYER_1000; } } } else { @@ -2478,8 +2477,8 @@ void SSNodeList_Init(SSNodeList* this) { void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) { this->max = tblMax; this->count = 0; - this->tbl = THA_AllocEndAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); - this->polyCheckTbl = THA_AllocEndAlign16(&play->state.heap, numPolys * sizeof(u8)); + this->tbl = THA_AllocTailAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); + this->polyCheckTbl = THA_AllocTailAlign16(&play->state.heap, numPolys * sizeof(u8)); if (this->polyCheckTbl == NULL) { sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n"); @@ -2621,7 +2620,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { * Allocate dyna.polyList */ void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { - *polyList = THA_AllocEndAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2); + *polyList = THA_AllocTailAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2); } /** @@ -2635,7 +2634,7 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { * Allocate dyna.vtxList */ void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { - *vtxList = THA_AllocEndAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2); + *vtxList = THA_AllocTailAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2); } /** @@ -2650,7 +2649,7 @@ void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList) { * Allocate dyna.waterBoxList */ void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) { - waterBoxList->boxes = THA_AllocEndAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2); + waterBoxList->boxes = THA_AllocTailAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2); } /** diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 0e36f1c54..6ecbd617a 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -3837,7 +3837,7 @@ void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v) { 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 1, }; s32 effectIndex; @@ -3892,7 +3892,7 @@ void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* p 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 0, }; s32 effectIndex; diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 46649a4ce..058d896a4 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,20 +1,21 @@ -#include "global.h" +#include "regs.h" #include "system_malloc.h" +#include "macros.h" -GameInfo* gGameInfo; +RegEditor* gRegEditor; -void GameInfo_Init(void) { +void Regs_Init(void) { s32 i; - gGameInfo = SystemArena_Malloc(sizeof(GameInfo)); + gRegEditor = SystemArena_Malloc(sizeof(RegEditor)); if (1) {} - gGameInfo->unk_00 = 0; - gGameInfo->unk_01 = 0; - gGameInfo->unk_02 = 0; - gGameInfo->unk_04 = 0; - gGameInfo->unk_03 = 0; + gRegEditor->regPage = 0; + gRegEditor->regGroup = 0; + gRegEditor->regCur = 0; + gRegEditor->inputRepeatTimer = 0; + gRegEditor->dPadInputPrev = 0; - for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) { - gGameInfo->data[i] = 0; + for (i = 0; i < ARRAY_COUNT(gRegEditor->data); i++) { + gRegEditor->data[i] = 0; } } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index f98b8636e..d9f20d72b 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -1,13 +1,14 @@ +#include "z64debug_display.h" #include "global.h" DebugDispObject* sDebugObjectListHead; typedef struct { - /* 0x00 */ s16 drawType; // indicates which draw function to use when displaying the object - /* 0x04 */ void* drawArg; // segment address (display list or texture) passed to the draw funciton when called -} DebugDispObjectInfo; // size = 0x8 + /* 0x0 */ s16 drawType; // indicates which draw function to use when displaying the object + /* 0x4 */ void* drawArg; // segment address (display list or texture) passed to the draw funciton when called +} DebugDispObjectInfo; // size = 0x8 -typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, void*, PlayState*); +typedef void (*DebugDispObjectDrawFunc)(DebugDispObject*, void*, PlayState*); void DebugDisplay_DrawSpriteI8(DebugDispObject*, void*, PlayState*); void DebugDisplay_DrawPolygon(DebugDispObject*, void*, PlayState*); @@ -44,12 +45,12 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, #include "code/debug_display/debug_display.c" -DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = { DebugDisplay_DrawSpriteI8, DebugDisplay_DrawPolygon }; +DebugDispObjectDrawFunc sDebugObjectDrawFuncTable[] = { DebugDisplay_DrawSpriteI8, DebugDisplay_DrawPolygon }; DebugDispObjectInfo sDebugObjectInfoTable[] = { { 0, sDebugDisplayCircleTex }, { 0, sDebugDisplayCrossTex }, { 0, sDebugDisplayBallTex }, - { 0, sDebugDisplayCursorTex }, { 1, &sDebugDisplay1DL }, { 1, &sDebugDisplay3DL }, - { 1, &sDebugDisplay2DL }, + { 0, sDebugDisplayCursorTex }, { 1, sDebugDisplay1DL }, { 1, sDebugDisplay3DL }, + { 1, sDebugDisplay2DL }, }; void DebugDisplay_DrawObjects(PlayState* play) { @@ -86,7 +87,7 @@ void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, PlayStat Lights1 sDebugDisplayLight1 = gdSPDefLights1(128, 128, 128, 255, 255, 255, 73, 73, 73); -void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, PlayState* play) { +void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dList, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C588(play->state.gfxCtx); @@ -99,7 +100,7 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* arg1, PlayState* p Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, arg1); + gSPDisplayList(POLY_XLU_DISP++, dList); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/code/z_debug_mode.c b/src/code/z_debug_mode.c index 0682b3693..a40bd29bd 100644 --- a/src/code/z_debug_mode.c +++ b/src/code/z_debug_mode.c @@ -1,13 +1,160 @@ +#include "z64debug_text.h" #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9C90.s") +typedef struct { + /* 0x0 */ u8 colorIndex; + /* 0x1 */ char text[11]; +} DebugTextBufferEntry; // size = 0xC -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9CA0.s") +typedef struct { + /* 0x0 */ u8 x; + /* 0x1 */ u8 y; + /* 0x2 */ u8 colorIndex; + /* 0x3 */ char text[41]; +} DebugCamTextBufferEntry; // size = 0x2C -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9CFC.s") +#define DEBUG_TEXT_DRAW_TEXT (1 << 0) +#define DEBUG_TEXT_DRAW_CAM_TEXT (1 << 1) -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9DBC.s") +s32 sDebugTextDrawFlags = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9E94.s") +DebugTextBufferEntry sDebugTextBuffer[] = { + { DEBUG_TEXT_BLACK, " " }, { DEBUG_TEXT_BLACK, " " }, { DEBUG_TEXT_BLACK, " " }, + { DEBUG_TEXT_BLACK, " " }, { DEBUG_TEXT_BLACK, " " }, { DEBUG_TEXT_BLACK, " " }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug_mode/func_800E9F78.s") +Color_RGBA8 sDebugTextColors[] = { + { 0, 0, 0, 64 }, // DEBUG_TEXT_BLACK + { 0, 0, 255, 64 }, // DEBUG_TEXT_BLUE + { 255, 0, 0, 64 }, // DEBUG_TEXT_RED + { 255, 0, 255, 64 }, // DEBUG_TEXT_PURPLE + { 0, 255, 0, 64 }, // DEBUG_TEXT_GREEN + { 0, 255, 255, 64 }, // DEBUG_TEXT_CYAN + { 255, 255, 0, 64 }, // DEBUG_TEXT_YELLOW + { 255, 255, 255, 64 }, // DEBUG_TEXT_WHITE +}; + +DebugCamTextBufferEntry sDebugCamTextBuffer[80]; + +s16 sDebugCamTextEntryCount = 0; + +Color_RGBA8 sDebugCamTextColors[] = { + { 255, 255, 32, 192 }, // DEBUG_CAM_TEXT_YELLOW + { 255, 150, 128, 192 }, // DEBUG_CAM_TEXT_PEACH + { 128, 96, 0, 64 }, // DEBUG_CAM_TEXT_BROWN + { 192, 128, 16, 128 }, // DEBUG_CAM_TEXT_ORANGE + { 255, 192, 32, 128 }, // DEBUG_CAM_TEXT_GOLD + { 230, 230, 220, 64 }, // DEBUG_CAM_TEXT_WHITE + { 128, 150, 255, 128 }, // DEBUG_CAM_TEXT_BLUE + { 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN +}; + +void Debug_ClearTextDrawFlags(void) { + sDebugTextDrawFlags = 0; +} + +void Debug_ScreenText(s32 index, s32 colorIndex, const char* text) { + DebugTextBufferEntry* entry = &sDebugTextBuffer[index]; + char* textDest = entry->text; + + sDebugTextDrawFlags |= DEBUG_TEXT_DRAW_TEXT; + entry->colorIndex = colorIndex; + + do { + *textDest++ = *text; + } while (*text++ != '\0'); +} + +void Debug_DrawScreenText(GfxPrint* printer) { + DebugTextBufferEntry* entry; + Color_RGBA8* color; + s32 y; + + entry = sDebugTextBuffer; + for (y = 20; y < 20 + ARRAY_COUNT(sDebugTextBuffer); y++) { + GfxPrint_SetPos(printer, 26, y); + color = &sDebugTextColors[entry->colorIndex]; + GfxPrint_SetColor(printer, color->r, color->g, color->b, color->a); + GfxPrint_Printf(printer, "%s", entry->text); + *entry->text = '\0'; + entry++; + } +} + +void DebugCamera_ScreenText(u8 x, u8 y, u8 colorIndex, const char* text) { + DebugCamTextBufferEntry* entry = &sDebugCamTextBuffer[sDebugCamTextEntryCount]; + char* textDest; + s16 charCount; + + sDebugTextDrawFlags |= DEBUG_TEXT_DRAW_CAM_TEXT; + if (sDebugCamTextEntryCount < ARRAY_COUNT(sDebugCamTextBuffer)) { + entry->x = x; + entry->y = y; + entry->colorIndex = colorIndex; + + // Copy text into the entry, truncating if needed + charCount = 0; + textDest = entry->text; + + while ((*textDest++ = *text++) != '\0') { + if (charCount++ >= ARRAY_COUNT(entry->text)) { + break; + } + } + + *textDest = '\0'; + + sDebugCamTextEntryCount++; + } +} + +void DebugCamera_DrawScreenText(GfxPrint* printer) { + DebugCamTextBufferEntry* entry; + Color_RGBA8* color; + s32 i; + + for (i = 0; i < sDebugCamTextEntryCount; i++) { + entry = &sDebugCamTextBuffer[i]; + color = &sDebugCamTextColors[entry->colorIndex]; + + GfxPrint_SetColor(printer, color->r, color->g, color->b, color->a); + GfxPrint_SetPos(printer, entry->x, entry->y); + GfxPrint_Printf(printer, "%s", entry->text); + } +} + +void Debug_DrawText(GraphicsContext* gfxCtx) { + Gfx* gfx; + Gfx* gfxHead; + GfxPrint printer; + + if (THGA_GetRemaining(&gfxCtx->polyOpa) >= 0x2800) { + GfxPrint_Init(&printer); + + OPEN_DISPS(gfxCtx); + + gfxHead = POLY_OPA_DISP; + gfx = Graph_GfxPlusOne(gfxHead); + gSPDisplayList(DEBUG_DISP++, gfx); + + GfxPrint_Open(&printer, gfx); + + if (sDebugTextDrawFlags & DEBUG_TEXT_DRAW_CAM_TEXT) { + DebugCamera_DrawScreenText(&printer); + } + sDebugCamTextEntryCount = 0; + + if (sDebugTextDrawFlags & DEBUG_TEXT_DRAW_TEXT) { + Debug_DrawScreenText(&printer); + } + + gfx = GfxPrint_Close(&printer); + gSPEndDisplayList(gfx++); + Graph_BranchDlist(gfxHead, gfx); + POLY_OPA_DISP = gfx; + + CLOSE_DISPS(gfxCtx); + + GfxPrint_Destroy(&printer); + } +} diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 7d0c1ade3..08d56de69 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "z64quake.h" #include "z64rumble.h" @@ -396,9 +395,9 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm u8 fadeTimer = cmd->endFrame - cmd->startFrame; if (cmd->type == 2) { - Audio_QueueSeqCmd((fadeTimer << 0x10) | 0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, fadeTimer); } else { - Audio_QueueSeqCmd((fadeTimer << 0x10) | NA_BGM_STOP); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, fadeTimer); } } } @@ -471,7 +470,7 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { break; case 7: - seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); break; case 8: @@ -492,7 +491,7 @@ void Cutscene_Command_FadeAmbienceSequence(PlayState* play, CutsceneContext* csC if (csCtx->frames == cmd->startFrame && csCtx->frames < cmd->endFrame) { u8 fadeTimer = cmd->endFrame - cmd->startFrame; - Audio_QueueSeqCmd((fadeTimer << 0x10) | 0x140000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, fadeTimer); } } @@ -559,7 +558,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* Audio_SetCutsceneFlag(false); gSaveContext.cutsceneTransitionControl = 1; - if ((gSaveContext.gameMode != 0) && (csCtx->frames != cmd->startFrame)) { + if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->frames != cmd->startFrame)) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; } @@ -568,7 +567,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* play->nextEntrance = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntrance; gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; - if (gSaveContext.gameMode != 1) { + if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { Scene_SetExitFade(play); } else { D_801BB12C++; @@ -1035,7 +1034,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } if (cmd->textId1 != 0xFFFF) { - func_80151938(play, cmd->textId1); + Message_ContinueTextbox(play, cmd->textId1); if (cmd->type == CS_TEXTBOX_TYPE_3) { D_801BB160 = CS_TEXTBOX_TYPE_3; if (cmd->textId2 != 0xFFFF) { @@ -1043,7 +1042,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } } } else { - func_801477B4(play); + Message_CloseTextbox(play); csCtx->frames++; } } else { @@ -1052,7 +1051,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } if (cmd->textId2 != 0xFFFF) { - func_80151938(play, cmd->textId2); + Message_ContinueTextbox(play, cmd->textId2); if (cmd->type == CS_TEXTBOX_TYPE_3) { D_801BB160 = CS_TEXTBOX_TYPE_3; if (cmd->textId1 != 0xFFFF) { @@ -1060,7 +1059,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } } } else { - func_801477B4(play); + Message_CloseTextbox(play); csCtx->frames++; } } @@ -1417,7 +1416,7 @@ void func_800EDA04(PlayState* play, CutsceneContext* csCtx) { } gSaveContext.save.cutscene = 0; - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; ActorCutscene_Stop(0x7F); Audio_SetCutsceneFlag(false); csCtx->state = CS_STATE_0; @@ -1470,7 +1469,8 @@ void func_800EDBE0(PlayState* play) { SceneTableEntry* sp24; s32 temp_v0_3; - if (((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 1)) && (gSaveContext.respawnFlag <= 0)) { + if (((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_TITLE_SCREEN)) && + (gSaveContext.respawnFlag <= 0)) { sp2A = func_800F21CC(); if (sp2A != -1) { temp_v0_3 = func_800F2138(sp2A); diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c index 1dc3d7237..bcf6ff824 100644 --- a/src/code/z_eff_footmark.c +++ b/src/code/z_eff_footmark.c @@ -1,14 +1,19 @@ -#include "global.h" +#include "z64eff_footmark.h" +#include "z64.h" +#include "macros.h" +#include "functions.h" + +#include "assets/code/eff_footmark/eff_footmark.c" void EffFootmark_Init(PlayState* play) { EffFootmark* footmark; s32 i; - for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < ARRAY_COUNT(play->footprintInfo); i++, footmark++) { footmark->actor = NULL; - footmark->location.x = 0; - footmark->location.y = 0; - footmark->location.z = 0; + footmark->pos.x = 0; + footmark->pos.y = 0; + footmark->pos.z = 0; footmark->flags = 0; footmark->id = 0; footmark->alpha = 0; @@ -16,47 +21,45 @@ void EffFootmark_Init(PlayState* play) { } } -void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, - u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) { +void EffFootmark_Add(PlayState* play, MtxF* mf, Actor* actor, u8 id, Vec3f* pos, u16 size, u8 red, u8 green, u8 blue, + u16 alpha, u16 alphaChange, u16 fadeOutDelay) { s32 i; EffFootmark* footmark; EffFootmark* destination = NULL; EffFootmark* oldest = NULL; - s32 isNew = 1; + s32 isNew = true; - for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { - if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) { - if (fabsf((footmark->location).x - location->x) <= 1) { - if (fabsf((footmark->location).z - location->z) <= 1) { - isNew = 0; + for (footmark = play->footprintInfo, i = 0; i < ARRAY_COUNT(play->footprintInfo); i++, footmark++) { + if (((actor == footmark->actor) && (footmark->id == id)) && !(footmark->flags & FOOTMARK_FLAG_1)) { + if (fabsf(footmark->pos.x - pos->x) <= 1) { + if (fabsf(footmark->pos.z - pos->z) <= 1) { + isNew = false; break; } } - // This footmark is being re-added at a new location. Let's mark this one to start fading out. - footmark->flags = 1; + // This footmark is being re-added at a new pos. Let's mark this one to start fading out. + footmark->flags = FOOTMARK_FLAG_1; } if (footmark->actor == NULL) { destination = footmark; - } else { - if (destination == NULL) { - if ((oldest != NULL && footmark->age > oldest->age) || (oldest == NULL)) { - oldest = footmark; - } + } else if (destination == NULL) { + if (((oldest != NULL) && (footmark->age > oldest->age)) || (oldest == NULL)) { + oldest = footmark; } } } - if ((isNew) && ((destination != NULL || (oldest != NULL)))) { + if (isNew && ((destination != NULL) || (oldest != NULL))) { if (destination == NULL) { destination = oldest; } - Matrix_MtxFCopy(&destination->displayMatrix, displayMatrix); + Matrix_MtxFCopy(&destination->mf, mf); destination->actor = actor; - destination->location.x = location->x; - destination->location.y = location->y; - destination->location.z = location->z; + destination->pos.x = pos->x; + destination->pos.y = pos->y; + destination->pos.z = pos->z; destination->flags = 0; destination->id = id; destination->red = red; @@ -65,7 +68,7 @@ void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, destination->alpha = alpha; destination->alphaChange = alphaChange; destination->size = size; - destination->fadeoutDelay = fadeoutDelay; + destination->fadeOutDelay = fadeOutDelay; destination->age = 0; } } @@ -74,22 +77,24 @@ void EffFootmark_Update(PlayState* play) { EffFootmark* footmark; s32 i; - for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { - if (footmark->actor != NULL) { - if ((footmark->flags & 1) == 1) { - if ((u32)footmark->age < UINT16_MAX) { - footmark->age++; - } + for (footmark = play->footprintInfo, i = 0; i < ARRAY_COUNT(play->footprintInfo); i++, footmark++) { + if (footmark->actor == NULL) { + continue; + } - if (footmark->fadeoutDelay == 0) { - if (footmark->alpha >= footmark->alphaChange + 0x1000) { - footmark->alpha -= footmark->alphaChange; - } else { - footmark->actor = NULL; - } - } else if (footmark->fadeoutDelay > 0) { - footmark->fadeoutDelay--; + if (CHECK_FLAG_ALL(footmark->flags, FOOTMARK_FLAG_1)) { + if ((u32)footmark->age < UINT16_MAX) { + footmark->age++; + } + + if (footmark->fadeOutDelay == 0) { + if (footmark->alpha >= footmark->alphaChange + 0x1000) { + footmark->alpha -= footmark->alphaChange; + } else { + footmark->actor = NULL; } + } else if (footmark->fadeOutDelay > 0) { + footmark->fadeOutDelay--; } } } @@ -102,11 +107,11 @@ void EffFootmark_Draw(PlayState* play) { func_8012C448(play->state.gfxCtx); - gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240); + gSPDisplayList(gfxCtx->polyXlu.p++, gEffFootprintMaterialDL); - for (footmark = play->footprintInfo, i = 0; i < 100; i++, footmark++) { + for (footmark = play->footprintInfo, i = 0; i < ARRAY_COUNT(play->footprintInfo); i++, footmark++) { if (footmark->actor != NULL) { - Matrix_Put(&footmark->displayMatrix); + Matrix_Put(&footmark->mf); Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY); gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); @@ -114,7 +119,7 @@ void EffFootmark_Draw(PlayState* play) { gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8); - gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC288); + gSPDisplayList(gfxCtx->polyXlu.p++, gEffFootprintModelDL); } } } diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index ea8a546d6..775b68f01 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -8,7 +8,7 @@ void EffectSS_Init(PlayState* play, s32 numEntries) { EffectSs* effectsSs; EffectSsOverlay* overlay; - sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&play->state.heap, numEntries * sizeof(EffectSs)); + sEffectSsInfo.data_table = (EffectSs*)THA_AllocTailAlign16(&play->state.heap, numEntries * sizeof(EffectSs)); sEffectSsInfo.searchIndex = 0; sEffectSsInfo.size = numEntries; diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c index e215cdee9..fff77feff 100644 --- a/src/code/z_effect_soft_sprite_dlftbls.c +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -1,56 +1,34 @@ -#include "global.h" -#include "initvars.h" +#include "z64effect.h" +#include "segment_symbols.h" -#define EFFECT_SS_OVERLAY(name) \ - { \ - SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \ - SEGMENT_END(ovl_##name), NULL, &name##_InitVars, 1, \ - } +// Init Vars and linker symbol declarations (used in the table below) +#define DEFINE_EFFECT_SS(name, _enumValue) \ + extern EffectSsInit name##_InitVars; \ + DECLARE_OVERLAY_SEGMENT(name) -#define EFFECT_SS_OVERLAY_INTERNAL(name) \ - { 0, 0, NULL, NULL, NULL, &name##_InitVars, 1 } +#define DEFINE_EFFECT_SS_UNSET(_enumValue) -#define EFFECT_SS_OVERLAY_UNSET \ - { 0 } +#include "tables/effect_ss_table.h" + +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET + +#define DEFINE_EFFECT_SS(name, _enumValue) \ + { \ + SEGMENT_ROM_START(ovl_##name), \ + SEGMENT_ROM_END(ovl_##name), \ + SEGMENT_START(ovl_##name), \ + SEGMENT_END(ovl_##name), \ + NULL, \ + &name##_InitVars, \ + 1, \ + }, + +#define DEFINE_EFFECT_SS_UNSET(_enumValue) { 0 }, EffectSsOverlay gParticleOverlayTable[] = { - EFFECT_SS_OVERLAY(Effect_Ss_Dust), - EFFECT_SS_OVERLAY(Effect_Ss_Kirakira), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Bomb2), - EFFECT_SS_OVERLAY(Effect_Ss_Blast), - EFFECT_SS_OVERLAY(Effect_Ss_G_Spk), - EFFECT_SS_OVERLAY(Effect_Ss_D_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Bubble), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_G_Ripple), - EFFECT_SS_OVERLAY(Effect_Ss_G_Splash), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_G_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Lightning), - EFFECT_SS_OVERLAY(Effect_Ss_Dt_Bubble), - EFFECT_SS_OVERLAY(Effect_Ss_Hahen), - EFFECT_SS_OVERLAY(Effect_Ss_Stick), - EFFECT_SS_OVERLAY(Effect_Ss_Sibuki), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Stone1), - EFFECT_SS_OVERLAY(Effect_Ss_Hitmark), - EFFECT_SS_OVERLAY(Effect_Ss_Fhg_Flash), - EFFECT_SS_OVERLAY(Effect_Ss_K_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Solder_Srch_Ball), - EFFECT_SS_OVERLAY(Effect_Ss_Kakera), - EFFECT_SS_OVERLAY(Effect_Ss_Ice_Piece), - EFFECT_SS_OVERLAY(Effect_Ss_En_Ice), - EFFECT_SS_OVERLAY(Effect_Ss_Fire_Tail), - EFFECT_SS_OVERLAY(Effect_Ss_En_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Extra), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Db), - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Dd), - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Ds), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Ice_Smoke), - EFFECT_SS_OVERLAY(Effect_En_Ice_Block), - EFFECT_SS_OVERLAY(Effect_Ss_Sbn), +#include "tables/effect_ss_table.h" }; + +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 4f24651d1..0b08f4dd0 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -805,7 +805,7 @@ void EffectSsEnIce_SpawnFlying(PlayState* play, Actor* actor, Vec3f* pos, Color_ initParams.scale = scale; if (actor != NULL) { - Actor_PlaySfxAtPos(actor, NA_SE_PL_FREEZE_S); + Actor_PlaySfx(actor, NA_SE_PL_FREEZE_S); } EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 80, &initParams); @@ -897,7 +897,7 @@ void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 sc initParams.bodyPart = bodyPart; if (actor != NULL) { - Actor_PlaySfxAtPos(actor, NA_SE_EV_FLAME_IGNITION); + Actor_PlaySfx(actor, NA_SE_EV_FLAME_IGNITION); } EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); @@ -917,7 +917,7 @@ void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 sc initParams.bodyPart = bodyPart; if (actor != NULL) { - Actor_PlaySfxAtPos(actor, NA_SE_EV_FLAME_IGNITION); + Actor_PlaySfx(actor, NA_SE_EV_FLAME_IGNITION); } EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 01ec9eca3..2f508bb94 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -69,7 +69,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { do { doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); door = (EnDoor*)doorIter; - dist = Actor_DistanceBetweenActors(actor, &door->dyna.actor); + dist = Actor_WorldDistXYZToActor(actor, &door->dyna.actor); if (!isSetup || (dist < minDist)) { nearestDoor = door; minDist = dist; @@ -207,8 +207,8 @@ s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) { s32 reachedEnd = false; Vec3f curPointPos; - Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); - rotStep = enHy->actor.speedXZ * 400.0f; + Math_SmoothStepToF(&enHy->actor.speed, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = enHy->actor.speed * 400.0f; if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &curPointPos) && SubS_MoveActorToPoint(&enHy->actor, &curPointPos, rotStep)) { enHy->curPoint++; @@ -225,8 +225,8 @@ s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) { s32 reachedEnd = false; Vec3f curPointPos; - Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); - rotStep = enHy->actor.speedXZ * 400.0f; + Math_SmoothStepToF(&enHy->actor.speed, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = enHy->actor.speed * 400.0f; if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &curPointPos) && SubS_MoveActorToPoint(&enHy->actor, &curPointPos, rotStep)) { enHy->curPoint--; @@ -254,7 +254,7 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) { u16 sfxId; u8 isFootOnGround; - if (enHy->actor.bgCheckFlags & 0x20) { + if (enHy->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (enHy->actor.depthInWater < 20.0f) { waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { @@ -267,12 +267,12 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) { enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->leftFootPos, distAboveThreshold); if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) { - Actor_PlaySfxAtPos(&enHy->actor, sfxId); + Actor_PlaySfx(&enHy->actor, sfxId); } enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->rightFootPos, distAboveThreshold); if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) { - Actor_PlaySfxAtPos(&enHy->actor, sfxId); + Actor_PlaySfx(&enHy->actor, sfxId); } return false; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index f450db014..3d78f00df 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -219,7 +219,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { this->unk152 = 15; this->unk14C = 35; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; @@ -299,7 +299,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { } if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) { - Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 50.0f, 20.0f); } this->actionFunc = func_800A6A40; @@ -346,7 +346,7 @@ void func_800A640C(EnItem00* this, PlayState* play) { this->actor.shape.yOffset = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + 850.0f; } - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); if (this->unk14C == 0) { if ((this->actor.params != ITEM00_SMALL_KEY) && (this->actor.params != ITEM00_HEART_PIECE) && @@ -362,7 +362,7 @@ void func_800A640C(EnItem00* this, PlayState* play) { } } - if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 1)) { + if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actionFunc = func_800A6650; } } @@ -387,12 +387,12 @@ void func_800A6650(EnItem00* this, PlayState* play) { EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (this->actor.velocity.y > -2.0f) { this->actionFunc = func_800A640C; } else { this->actor.velocity.y = this->actor.velocity.y * -0.8f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } } @@ -406,7 +406,7 @@ void func_800A6780(EnItem00* this, PlayState* play) { if (this->actor.params == ITEM00_RECOVERY_HEART) { if (this->actor.velocity.y < 0.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -0.4f; if (this->actor.velocity.y < -1.5f) { this->actor.velocity.y = -1.5f; @@ -444,10 +444,10 @@ void func_800A6780(EnItem00* this, PlayState* play) { EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor); } - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actionFunc = func_800A640C; this->actor.shape.rot.z = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -456,7 +456,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) { if (this->getItemId != GI_NONE) { if (!Actor_HasParent(&this->actor, play)) { - Actor_PickUp(&this->actor, play, this->getItemId, 50.0f, 80.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 50.0f, 80.0f); this->unk152++; } else { this->getItemId = GI_NONE; @@ -646,7 +646,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { if (getItemId != GI_NONE) { if (!Actor_HasParent(&this->actor, play)) { - Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 50.0f, 20.0f); } } @@ -684,7 +684,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { this->unk152 = 15; this->unk14C = 35; this->actor.shape.rot.z = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; @@ -951,7 +951,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { } else { spawnedActor->velocity.y = -2.0f; } - spawnedActor->speedXZ = 2.0f; + spawnedActor->speed = 2.0f; spawnedActor->gravity = -0.9f; spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000); Actor_SetScale(spawnedActor, 0.0f); @@ -1002,7 +1002,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { if (spawnedActor != NULL) { if (param8000 == 0) { spawnedActor->velocity.y = 0.0f; - spawnedActor->speedXZ = 0.0f; + spawnedActor->speed = 0.0f; if (param10000 != 0) { spawnedActor->gravity = 0.0f; } else { @@ -1128,16 +1128,17 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP if (fromActor != NULL) { dropFlag = fromActor->dropFlag; - if (dropFlag != 0) { - if (fromActor->dropFlag & 1) { + + if (dropFlag != DROPFLAG_NONE) { + if (fromActor->dropFlag & DROPFLAG_1) { params = 0x10; dropId = ITEM00_ARROWS_30; dropQuantity = 1; - } else if (fromActor->dropFlag & 2) { + } else if (fromActor->dropFlag & DROPFLAG_2) { params = 0x10; dropId = ITEM00_RECOVERY_HEART; dropQuantity = 1; - } else if (fromActor->dropFlag & 0x20) { + } else if (fromActor->dropFlag & DROPFLAG_20) { dropId = ITEM00_RUPEE_PURPLE; dropQuantity = 1; } @@ -1195,7 +1196,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP spawnPos->y, spawnPos->z, 0, 0, 0, dropId); if ((spawnedActor != 0) && (dropId != (u8)ITEM00_NO_DROP)) { spawnedActor->actor.velocity.y = 8.0f; - spawnedActor->actor.speedXZ = 2.0f; + spawnedActor->actor.speed = 2.0f; spawnedActor->actor.gravity = -0.9f; spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f; Actor_SetScale(&spawnedActor->actor, 0.0f); diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index c145087a2..441af901e 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -1,20 +1,223 @@ +/** + * @file z_fbdemo.c + * + * This file implements an unused transition system that takes the current screen, partitions it into large tiles, and + * can apply an effect to them. + * + * The screen is divided into 7 rows and 10 columns of tiles. (`gScreenWidth`/ 10 = `gScreenHeight` / 7 = 0x20) + * + * @note The only coded effect has a visual effect to blend the tiles to a single point, which looks like the screen + * gets sucked into. + */ #include "global.h" #include "system_malloc.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80163DC0.s") +Gfx sTransTileSetupDL[] = { + gsDPPipeSync(), + gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON), + gsSPLoadGeometryMode(G_TEXTURE_ENABLE), + gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB), + gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE | G_PM_1PRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_AA_OPA_SURF | G_RM_AA_OPA_SURF2), + gsSPEndDisplayList(), +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_8016418C.s") +void TransitionTile_InitGraphics(TransitionTile* this) { + s32 frame; + s32 col; + s32 col2; + s32 colTex; + Vtx* vtx; + s32 row; + s32 rowTex; + Gfx* gfx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Destroy.s") + guMtxIdent(&this->modelView); + guMtxIdent(&this->unk_98); + guOrtho(&this->projection, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -1000.0f, 1000.0f, 1.0f); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Init.s") + for (frame = 0; frame < 2; frame++) { + this->frame = frame; + vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; + for (rowTex = 0, row = 0; row < (this->rows + 1); row++, rowTex += 0x20) { + for (colTex = 0, col = 0; col < (this->cols + 1); col++, colTex += 0x20) { + Vtx_tn* vtxn = &vtx->n; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164438.s") + // clang-format off + vtx++; \ + vtxn->tc[0] = colTex << 6; \ + vtxn->ob[0] = col * 0x20; \ + vtxn->ob[1] = row * 0x20; \ + vtxn->ob[2] = -5; \ + vtxn->flag = 0; \ + vtxn->tc[1] = rowTex << 6; \ + vtxn->n[0] = 0; \ + vtxn->n[1] = 0; \ + vtxn->n[2] = 120; \ + vtxn->a = 255; + // clang-format on + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Draw.s") + gfx = this->gfx; + for (rowTex = 0, row = 0; row < this->rows; row++, rowTex += 0x20) { + gSPVertex(gfx++, SEGMENT_ADDR(0xA, (u32)row * (this->cols + 1) * sizeof(Vtx)), 2 * (this->cols + 1), 0); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164678.s") + colTex = 0; + col2 = 0; + col = 0; + while (col < this->cols) { + gDPPipeSync(gfx++); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_801647AC.s") + gDPLoadTextureTile(gfx++, SEGMENT_ADDR(0xB, 0), G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, SCREEN_HEIGHT, + colTex, rowTex, colTex + 0x20, rowTex + 0x20, 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); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_801647B8.s") + gSP1Quadrangle(gfx++, col, col + 1, col2 + this->cols + 2, this->cols + col2 + 1, 0); + + colTex += 0x20; + col2++; + col++; + } + } + + gDPPipeSync(gfx++); + gSPEndDisplayList(gfx++); +} + +void TransitionTile_InitVtxData(TransitionTile* this) { + s32 row; + s32 col; + + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { + (this->vtxData + col + row * (this->cols + 1))->x = col * 0x20; + (this->vtxData + col + row * (this->cols + 1))->y = row * 0x20; + } + } +} + +void TransitionTile_Destroy(TransitionTile* this) { + Sleep_Msec(100); + + if (this->vtxData != NULL) { + SystemArena_Free(this->vtxData); + this->vtxData = NULL; + } + if (this->vtxFrame1 != NULL) { + SystemArena_Free(this->vtxFrame1); + this->vtxFrame1 = NULL; + } + if (this->vtxFrame2 != NULL) { + SystemArena_Free(this->vtxFrame2); + this->vtxFrame2 = NULL; + } + if (this->gfx != NULL) { + SystemArena_Free(this->gfx); + this->gfx = NULL; + } +} + +TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows) { + s32 gridSize; + + bzero(this, sizeof(TransitionTile)); + this->frame = 0; + this->cols = cols; + this->rows = rows; + gridSize = (cols + 1) * (rows + 1); + this->vtxData = SystemArena_Malloc(gridSize * sizeof(TransitionTileVtxData)); + this->vtxFrame1 = SystemArena_Malloc(gridSize * sizeof(Vtx)); + this->vtxFrame2 = SystemArena_Malloc(gridSize * sizeof(Vtx)); + this->gfx = SystemArena_Malloc(((cols * 9 + 1) * rows + 2) * sizeof(Gfx)); + + if ((this->vtxData == NULL) || (this->vtxFrame1 == NULL) || (this->vtxFrame2 == NULL) || (this->gfx == NULL)) { + if (this->vtxData != NULL) { + SystemArena_Free(this->vtxData); + this->vtxData = NULL; + } + if (this->vtxFrame1 != NULL) { + SystemArena_Free(this->vtxFrame1); + this->vtxFrame1 = NULL; + } + if (this->vtxFrame2 != NULL) { + SystemArena_Free(this->vtxFrame2); + this->vtxFrame2 = NULL; + } + if (this->gfx != NULL) { + SystemArena_Free(this->gfx); + this->gfx = NULL; + } + return NULL; + } + + TransitionTile_InitGraphics(this); + TransitionTile_InitVtxData(this); + this->frame = 0; + + return this; +} + +void TransitionTile_SetVtx(TransitionTile* this) { + s32 row; + s32 col; + Vtx* vtx; + + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { + vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; + (vtx + col + row * (this->cols + 1))->n.ob[0] = (this->vtxData + col + row * (this->cols + 1))->x; + + vtx = (this->frame == 0) ? this->vtxFrame1 : this->vtxFrame2; + (vtx + col + row * (this->cols + 1))->n.ob[1] = (this->vtxData + col + row * (this->cols + 1))->y; + } + } +} + +void TransitionTile_Draw(TransitionTile* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; + + gSPDisplayList(gfx++, sTransTileSetupDL); + TransitionTile_SetVtx(this); + gSPMatrix(gfx++, &this->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gfx++, &this->modelView, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(gfx++, 0xA, this->frame == 0 ? this->vtxFrame1 : this->vtxFrame2); + gSPSegment(gfx++, 0xB, this->zBuffer); + gSPDisplayList(gfx++, sTransTileSetupDL); + gSPDisplayList(gfx++, this->gfx); + gDPPipeSync(gfx++); + this->frame ^= 1; + *gfxP = gfx; +} + +void TransitionTile_Suck(TransitionTile* this) { + s32 row; + s32 col; + f32 diffX; + f32 diffY; + f32 scale; + + for (row = 0; row < this->rows + 1; row++) { + for (col = 0; col < this->cols + 1; col++) { + diffX = (this->vtxData + col + row * (this->cols + 1))->x - (this->vtxData + 5 + 4 * (this->cols + 1))->x; + diffY = (this->vtxData + col + row * (this->cols + 1))->y - (this->vtxData + 5 + 4 * (this->cols + 1))->y; + scale = (SQ(diffX) + SQ(diffY)) / SQ(10.0f); + if (scale != 0.0f) { + if (scale < 1.0f) { + scale = 1.0f; + } + (this->vtxData + col + row * (this->cols + 1))->x -= diffX / scale; + (this->vtxData + col + row * (this->cols + 1))->y -= diffY / scale; + } + } + } +} + +void TransitionTile_Update(TransitionTile* this) { +} + +s32 func_801647B8(TransitionTile* this) { + return 0; +} diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 2a8144ea4..bc07df883 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,6 +1,11 @@ #include "global.h" -Gfx D_801D0D00[] = { +typedef enum { + /* 0 */ TRANS_CIRCLE_DIR_IN, + /* 1 */ TRANS_CIRCLE_DIR_OUT, +} TransitionCircleDirection; + +Gfx sTransCircleSetupDL[] = { gsDPPipeSync(), gsDPSetOtherMode(G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, @@ -23,7 +28,7 @@ void TransitionCircle_Start(void* thisx) { TransitionCircle* this = (TransitionCircle*)thisx; this->stepValue = 0.1f; - if (this->direction == TRANSITION_CIRCLE_IN) { + if (this->direction == TRANS_CIRCLE_DIR_IN) { this->targetRadius = 0.0f; this->startingRadius = 1.0f; } else { @@ -67,10 +72,10 @@ void TransitionCircle_SetType(void* thisx, s32 type) { if (type & TC_SET_PARAMS) { this->maskType = FBDEMO_CIRCLE_GET_MASK_TYPE(type); - } else if (type == 1) { - this->direction = TRANSITION_CIRCLE_OUT; + } else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->direction = TRANS_CIRCLE_DIR_OUT; } else { - this->direction = TRANSITION_CIRCLE_IN; + this->direction = TRANS_CIRCLE_DIR_IN; } } @@ -121,7 +126,7 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxp) { TransitionCircle* this = (TransitionCircle*)thisx; gDPPipeSync(gfx++); - gSPDisplayList(gfx++, &D_801D0D00); + gSPDisplayList(gfx++, sTransCircleSetupDL); gDPSetPrimColor(gfx++, 0, this->color.a, this->color.r, this->color.g, this->color.b, 1); if (this->maskType == 0) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, TEXEL0, 0, diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index a0d9f1eae..a9ab37d48 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,17 +1,150 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Start.s") +#define THIS ((TransitionFade*)thisx) -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Init.s") +typedef enum { + /* 0 */ TRANS_FADE_DIR_IN, + /* 1 */ TRANS_FADE_DIR_OUT +} TransitionFadeDirection; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Destroy.s") +typedef enum { + /* 0 */ TRANS_FADE_TYPE_NONE, + /* 1 */ TRANS_FADE_TYPE_ONE_WAY, + /* 2 */ TRANS_FADE_TYPE_FLASH +} TransitionFadeType; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Update.s") +static Gfx sTransFadeSetupDL[] = { + gsDPPipeSync(), + gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | + G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), + gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_BAYER | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_1PRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_CLD_SURF2), + gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE), + gsSPEndDisplayList(), +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Draw.s") +TransitionInit TransitionFade_InitVars = { + TransitionFade_Init, TransitionFade_Destroy, TransitionFade_Update, TransitionFade_Draw, + TransitionFade_Start, TransitionFade_SetType, TransitionFade_SetColor, NULL, + TransitionFade_IsDone, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_IsDone.s") +void TransitionFade_Start(void* thisx) { + TransitionFade* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_SetColor.s") + switch (this->type) { + case TRANS_FADE_TYPE_NONE: + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_fade/TransitionFade_SetType.s") + case TRANS_FADE_TYPE_ONE_WAY: + this->timer = 0; + this->color.a = (this->direction != TRANS_FADE_DIR_IN) ? 255 : 0; + break; + + case TRANS_FADE_TYPE_FLASH: + this->color.a = 0; + break; + + default: + break; + } + this->isDone = false; +} + +void* TransitionFade_Init(void* thisx) { + TransitionFade* this = THIS; + + bzero(this, sizeof(TransitionFade)); + return this; +} + +void TransitionFade_Destroy(void* thisx) { +} + +void TransitionFade_Update(void* thisx, s32 updateRate) { + s32 alpha; + s16 newAlpha; + TransitionFade* this = THIS; + + switch (this->type) { + case TRANS_FADE_TYPE_NONE: + break; + + case TRANS_FADE_TYPE_ONE_WAY: + //! FAKE: + THIS->timer += updateRate; + + if (this->timer >= ((void)0, gSaveContext.transFadeDuration)) { + this->timer = ((void)0, gSaveContext.transFadeDuration); + this->isDone = true; + } + + alpha = (255.0f * this->timer) / ((void)0, gSaveContext.transFadeDuration); + this->color.a = (this->direction != TRANS_FADE_DIR_IN) ? 255 - alpha : alpha; + break; + + case TRANS_FADE_TYPE_FLASH: + newAlpha = this->color.a; + if (R_TRANS_FADE_FLASH_ALPHA_STEP != 0) { + if (R_TRANS_FADE_FLASH_ALPHA_STEP < 0) { + if (Math_StepToS(&newAlpha, 255, 255)) { + R_TRANS_FADE_FLASH_ALPHA_STEP = 150; + } + } else { + Math_StepToS(&R_TRANS_FADE_FLASH_ALPHA_STEP, 20, 60); + if (Math_StepToS(&newAlpha, 0, R_TRANS_FADE_FLASH_ALPHA_STEP)) { + R_TRANS_FADE_FLASH_ALPHA_STEP = 0; + this->isDone = true; + } + } + } + this->color.a = newAlpha; + break; + + default: + break; + } +} + +void TransitionFade_Draw(void* thisx, Gfx** gfxP) { + TransitionFade* this = THIS; + Gfx* gfx; + Color_RGBA8_u32* color = &this->color; + + if (color->a != 0) { + gfx = *gfxP; + gSPDisplayList(gfx++, sTransFadeSetupDL); + gDPSetPrimColor(gfx++, 0, 0, color->r, color->g, color->b, color->a); + gSPDisplayList(gfx++, D_0E000000.fillRect); + *gfxP = gfx; + } +} + +s32 TransitionFade_IsDone(void* thisx) { + TransitionFade* this = THIS; + + return this->isDone; +} + +void TransitionFade_SetColor(void* thisx, u32 color) { + TransitionFade* this = THIS; + + this->color.rgba = color; +} + +void TransitionFade_SetType(void* thisx, s32 type) { + TransitionFade* this = THIS; + + if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { + this->type = TRANS_FADE_TYPE_ONE_WAY; + this->direction = TRANS_FADE_DIR_OUT; + } else if (type == TRANS_INSTANCE_TYPE_FILL_IN) { + this->type = TRANS_FADE_TYPE_ONE_WAY; + this->direction = TRANS_FADE_DIR_IN; + } else if (type == TRANS_INSTANCE_TYPE_FADE_FLASH) { + this->type = TRANS_FADE_TYPE_FLASH; + } else { + this->type = TRANS_FADE_TYPE_NONE; + } +} diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index e4f014ffa..114e62cc7 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -1,14 +1,7 @@ -#include "global.h" +#include "z_fireobj.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "objects/gameplay_keep/gameplay_keep.h" -typedef enum { - FIRE_STATE_0, - FIRE_STATE_1, - FIRE_STATE_2, - FIRE_STATE_3, -} FireState; - ColliderCylinderInit sFireObjCollisionInit = { { COLTYPE_NONE, @@ -48,17 +41,17 @@ void FireObj_InitWithParams(PlayState* play, FireObj* fire, FireObjInitParams* i fire->xScale = 0.0f; fire->yScale = 0.0f; fire->dynamicSize = 0.0f; - fire->unk26 = Rand_ZeroOne() * 20.0f; + fire->timer = Rand_ZeroOne() * 20.0f; fire->ignitionDelay = -1; } void FireObj_SetState(FireObj* fire, f32 dynamicSizeStep, u8 newState) { fire->state = newState; - if (fire->state == FIRE_STATE_3) { + if (fire->state == FIRE_STATE_NOT_LIT) { fire->yScale = 0.0f; fire->xScale = 0.0f; fire->dynamicSize = 0.0f; - } else if (fire->state == FIRE_STATE_2) { + } else if (fire->state == FIRE_STATE_FULLY_LIT) { fire->xScale = fire->yScale = fire->size; fire->dynamicSize = 1.0f; } @@ -70,15 +63,16 @@ void FireObj_SetPosition(FireObj* fire, Vec3f* pos) { } void FireObj_StepSize(FireObj* fire) { - if (fire->state == FIRE_STATE_0) { - if (Math_StepToF(&fire->dynamicSize, 1.0f, fire->dynamicSizeStep) != 0) { - FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_2); + if (fire->state == FIRE_STATE_GROWING) { + if (Math_StepToF(&fire->dynamicSize, 1.0f, fire->dynamicSizeStep)) { + FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_FULLY_LIT); } - } else if ((fire->state == FIRE_STATE_1) && (Math_StepToF(&fire->dynamicSize, 0.0f, fire->dynamicSizeStep) != 0)) { - FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_3); + } else if ((fire->state == FIRE_STATE_SHRINKING) && + (Math_StepToF(&fire->dynamicSize, 0.0f, fire->dynamicSizeStep))) { + FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_NOT_LIT); } if (fire->sizeGrowsCos2 == 1) { - if ((fire->state == FIRE_STATE_0) || (fire->state == FIRE_STATE_1)) { + if ((fire->state == FIRE_STATE_GROWING) || (fire->state == FIRE_STATE_SHRINKING)) { fire->xScale = (1.0f - Math_CosS(SQ(fire->dynamicSize) * 0x4000)) * fire->size; fire->yScale = fire->dynamicSize * fire->size; } else { @@ -101,39 +95,41 @@ void FireObj_UpdateStateTransitions(PlayState* play, FireObj* fire) { Vec3f dist; FireObj_StepSize(fire); - fire->unk26++; + fire->timer++; if (fire->ignitionDelay > 0) { fire->ignitionDelay--; } else if (fire->ignitionDelay == 0) { fire->ignitionDelay = -1; - if ((fire->state == FIRE_STATE_3) || (fire->state == FIRE_STATE_1)) { - nextState = FIRE_STATE_0; + if ((fire->state == FIRE_STATE_NOT_LIT) || (fire->state == FIRE_STATE_SHRINKING)) { + nextState = FIRE_STATE_GROWING; } else { - nextState = FIRE_STATE_1; + nextState = FIRE_STATE_SHRINKING; } FireObj_SetState(fire, fire->dynamicSizeStep, nextState); } - if ((fire->flags & 1) && (fire->state != FIRE_STATE_3) && + + if ((fire->flags & FIRE_FLAG_WATER_EXTINGUISHABLE) && (fire->state != FIRE_STATE_NOT_LIT) && WaterBox_GetSurface1_2(play, &play->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) && (waterY - fire->position.y > 6500.0f * fire->yScale)) { - FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_3); + FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_NOT_LIT); } - if ((fire->flags & 2) && (player->heldItemAction == PLAYER_IA_STICK)) { + if ((fire->flags & FIRE_FLAG_INTERACT_STICK) && (player->heldItemAction == PLAYER_IA_STICK)) { Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &fire->position, &dist); - if (Math3D_LengthSquared(&dist) < 400.0f) { + if (Math3D_LengthSquared(&dist) < SQ(20.0f)) { sp40 = true; } } + if (sp40) { - if (fire->state == FIRE_STATE_3) { + if (fire->state == FIRE_STATE_NOT_LIT) { if (player->unk_B28 > 0) { - FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_0); + FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_GROWING); } } else if (player->unk_B28 == 0) { - player->unk_B28 = 0xD2; + player->unk_B28 = 210; SoundSource_PlaySfxAtFixedWorldPos(play, &fire->position, 20, NA_SE_EV_FLAME_IGNITION); - } else if (player->unk_B28 < 0xC8) { - player->unk_B28 = 0xC8; + } else if (player->unk_B28 < 200) { + player->unk_B28 = 200; } } } @@ -142,13 +138,13 @@ void FireObj_Draw(PlayState* play, FireObj* fire) { s32 pad; FireObjColors* fireColors = &sFireObjColors[fire->colorsIndex]; - if (fire->state != FIRE_STATE_3) { + if (fire->state != FIRE_STATE_NOT_LIT) { Vec3s vec; OPEN_DISPS(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->unk26 * -20) & 511, 32, 128)); + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->timer * -20) % 512U, 32, 128)); gDPSetPrimColor(POLY_XLU_DISP++, 0, fireColors->lod, fireColors->primColor.r, fireColors->primColor.g, fireColors->primColor.b, fireColors->primColor.a); @@ -185,7 +181,7 @@ void FireObj_UpdateLight(PlayState* play, FireObjLight* light, FireObj* fire) { FireObjLightParams* lightParams = &sFireObjLightParams[light->lightParamsIndex]; s16 radius; - if (fire->state == FIRE_STATE_3) { + if (fire->state == FIRE_STATE_NOT_LIT) { Lights_PointSetColorAndRadius(&light->lightInfo, 0, 0, 0, -1); } else { radius = (fire->yScale * 140.0f * fire->sizeInv) + 60.0f; @@ -225,14 +221,15 @@ void FireObj_Update(PlayState* play, FireObj* fire, Actor* actor) { EnArrow* arrow = (EnArrow*)fire->collision.base.ac; FireObj_UpdateStateTransitions(play, fire); - if (fire->state == FIRE_STATE_3) { - if ((fire->collision.base.acFlags & AC_HIT) && (fire->collision.info.acHitInfo->toucher.dmgFlags & 0x800)) { - FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_0); + if (fire->state == FIRE_STATE_NOT_LIT) { + if ((fire->collision.base.acFlags & AC_HIT) && + (fire->collision.info.acHitInfo->toucher.dmgFlags & DMG_FIRE_ARROW)) { + FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_GROWING); } } else if ((fire->collision.base.acFlags & AC_HIT) && (arrow->actor.update != NULL) && (arrow->actor.id == ACTOR_EN_ARROW)) { arrow->actor.params = 0; - arrow->collider.info.toucher.dmgFlags = 0x800; + arrow->collider.info.toucher.dmgFlags = DMG_FIRE_ARROW; } fire->collision.dim.pos.x = fire->position.x; fire->collision.dim.pos.y = fire->position.y; diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 11d390a28..1b82705f5 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -24,4 +24,4 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY(daytelop, DayTelop_Init, DayTelop_Destroy, sizeof(DayTelopState)), }; -s32 graphNumGameStates = ARRAY_COUNT(gGameStateOverlayTable); +s32 gGraphNumGameStates = ARRAY_COUNT(gGameStateOverlayTable); diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 1e87a6a17..4e24eb72e 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "z64game_over.h" #include "z64rumble.h" #include "z64shrink_window.h" +#include "z64.h" +#include "functions.h" +#include "variables.h" +#include "macros.h" void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; @@ -23,7 +27,7 @@ void GameOver_Update(PlayState* play) { switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: - func_801477B4(play); + Message_CloseTextbox(play); for (timerId = 0; timerId < TIMER_ID_MAX; timerId++) { gSaveContext.timerStates[timerId] = TIMER_STATE_OFF; @@ -67,8 +71,9 @@ void GameOver_Update(PlayState* play) { Rumble_Request(0.0f, 126, 124, 63); gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; + case GAMEOVER_DEATH_FADE_OUT: - if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; @@ -83,31 +88,36 @@ void GameOver_Update(PlayState* play) { Rumble_StateReset(); } break; + case GAMEOVER_REVIVE_START: - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_RUMBLE sGameOverTimer = 0; Kankyo_InitGameOverLights(play); ShrinkWindow_Letterbox_SetSizeTarget(32); break; + case GAMEOVER_REVIVE_RUMBLE: sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_GROUND Rumble_Request(0.0f, 126, 124, 63); break; + case GAMEOVER_REVIVE_WAIT_GROUND: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 64; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_FAIRY } break; + case GAMEOVER_REVIVE_WAIT_FAIRY: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_FADE_OUT } break; + case GAMEOVER_REVIVE_FADE_OUT: Kankyo_FadeOutGameOverLights(play); sGameOverTimer--; diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 48e8e2ad6..0d9f30a08 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -14,24 +14,23 @@ KaleidoMgrOverlay gKaleidoMgrOverlayTable[] = { void* sKaleidoAreaPtr = NULL; KaleidoMgrOverlay* gKaleidoMgrCurOvl = NULL; -FaultAddrConvClient sKaleidoAreaFaultClient; +FaultAddrConvClient sKaleidoMgrFaultAddrConvClient; -void* KaleidoManager_FaultAddrConvFunc(void* address, void* param) { - u8* ptr = address; - KaleidoMgrOverlay* ovl = &gKaleidoMgrCurOvl[0]; - u8* ramStart; - u8* ramEnd; - size_t size; - uintptr_t offset; +void* KaleidoManager_FaultAddrConv(void* address, void* param) { + uintptr_t addr = address; + KaleidoMgrOverlay* kaleidoMgrOvl = gKaleidoMgrCurOvl; + size_t ramConv; + void* ramStart; + size_t diff; + + if (kaleidoMgrOvl != NULL) { + diff = VRAM_PTR_SIZE(kaleidoMgrOvl); + ramStart = kaleidoMgrOvl->loadedRamAddr; + ramConv = (uintptr_t)kaleidoMgrOvl->vramStart - (uintptr_t)ramStart; - if (ovl != NULL) { - size = VRAM_PTR_SIZE(ovl); - ramStart = ovl->loadedRamAddr; - ramEnd = ramStart + size; - offset = (u8*)ovl->vramStart - ramStart; if (ramStart != NULL) { - if (ptr >= ramStart && ptr < ramEnd) { - return ptr + offset; + if ((addr >= (uintptr_t)ramStart) && (addr < (uintptr_t)ramStart + diff)) { + return addr + ramConv; } } } @@ -66,13 +65,13 @@ void KaleidoManager_Init(PlayState* play) { } } - sKaleidoAreaPtr = THA_AllocEndAlign16(&play->state.heap, largestSize); + sKaleidoAreaPtr = THA_AllocTailAlign16(&play->state.heap, largestSize); gKaleidoMgrCurOvl = NULL; - Fault_AddAddrConvClient(&sKaleidoAreaFaultClient, KaleidoManager_FaultAddrConvFunc, NULL); + Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL); } void KaleidoManager_Destroy() { - Fault_RemoveAddrConvClient(&sKaleidoAreaFaultClient); + Fault_RemoveAddrConvClient(&sKaleidoMgrFaultAddrConvClient); if (gKaleidoMgrCurOvl != NULL) { KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index b123baab6..06dd1a0c7 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index ac78d1229..381387c5e 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -180,7 +180,7 @@ void Map_Init(PlayState* play) { func_80105C40(play->roomCtx.curRoom.num); interfaceCtx->unk_278 = -1; interfaceCtx->dungeonOrBossAreaMapIndex = -1; - interfaceCtx->mapSegment = THA_AllocEndAlign16(&play->state.heap, 0x1000); + interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.heap, 0x1000); if (func_8010A2AC(play)) { gSaveContext.mapIndex = func_8010A238(play); return; diff --git a/src/code/z_message.c b/src/code/z_message.c index 97db5e72d..01e4a366d 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -99,7 +99,7 @@ s32 Message_ShouldAdvanceSilent(PlayState* play) { } } -void func_801477B4(PlayState* play) { +void Message_CloseTextbox(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; if (play->msgCtx.msgLength != 0) { @@ -309,7 +309,7 @@ void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor) { play->msgCtx.ocarinaMode = 0; } -void func_80151938(PlayState* play, u16 textId) { +void Message_ContinueTextbox(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; @@ -395,7 +395,7 @@ u32 func_80151C9C(PlayState* play) { SET_WEEKEVENTREG(D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]); if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - func_80151938(play, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); + Message_ContinueTextbox(play, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]); play_sound(NA_SE_SY_SCHEDULE_WRITE); return true; } @@ -572,7 +572,7 @@ void Message_Init(PlayState* play) { messageCtx->ocarinaAction = messageCtx->unk11FF2 = 0; messageCtx->unk1201E = 0xFF; View_Init(&messageCtx->view, play->state.gfxCtx); - messageCtx->unk11EF8 = THA_AllocEndAlign16(&play->state.heap, 0x13C00); + messageCtx->unk11EF8 = THA_AllocTailAlign16(&play->state.heap, 0x13C00); font = &play->msgCtx.font; Font_LoadOrderedFont(&play->msgCtx.font); font->unk_11D88 = 0; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f3bfb530f..be5cc01bc 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64snap.h" #include "z64view.h" #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" @@ -7,6 +8,8 @@ #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "overlays/actors/ovl_En_Mm3/z_en_mm3.h" +extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex + typedef enum { /* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph /* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph @@ -14,6 +17,11 @@ typedef enum { /* 3 */ PICTO_BOX_STATE_PHOTO } PictoBoxState; +// TODO extract this information from the texture definitions themselves +#define DO_ACTION_TEX_WIDTH 48 +#define DO_ACTION_TEX_HEIGHT 16 +#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex)) + typedef struct { /* 0x00 */ u8 scene; /* 0x01 */ u8 flags1; @@ -1021,7 +1029,7 @@ void Interface_SetHudVisibility(u16 hudVisibility) { void Interface_UpdateButtonAlphasByStatus(PlayState* play, s16 risingAlpha) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.bButtonStatus == BTN_DISABLED)) { if (interfaceCtx->bAlpha != 70) { interfaceCtx->bAlpha = 70; } @@ -1393,7 +1401,8 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { interfaceCtx->aAlpha = risingAlpha; } - if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || + (gSaveContext.bButtonStatus == ITEM_NONE)) { if (interfaceCtx->bAlpha != 70) { interfaceCtx->bAlpha = 70; } @@ -1767,15 +1776,741 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { break; } - if ((play->roomCtx.curRoom.unk3 == 1) && (interfaceCtx->minimapAlpha >= 255)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { interfaceCtx->minimapAlpha = 255; } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80110038.s") +/** + * A continuation of the if-else chain from Interface_UpdateButtonsPart1 + * Also used directly when opening the pause menu i.e. skips part 1 + */ +void Interface_UpdateButtonsPart2(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + s16 i; + s16 restoreHudVisibility = false; -void func_80111CB4(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80111CB4.s") + if (CHECK_EVENTINF(EVENTINF_41)) { + // Related to swamp boat (non-minigame)? + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX) || (msgCtx->msgMode != 0)) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (sPictoState == PICTO_BOX_STATE_OFF) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_20)) { + // Fishermans's jumping minigame + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_08)) { + // Swordsman's log minigame + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_20)) { + // Related to moon child + if (player->currentMask == PLAYER_MASK_FIERCE_DEITY) { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK))) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } + } + } else { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_ZORA)) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + } + } else if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 6)) { + // Unknown cutscene + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (CHECK_EVENTINF(EVENTINF_34)) { + // Deku playground minigame + if (player->stateFlags3 & PLAYER_STATE3_1000000) { + if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + if (restoreHudVisibility || (gSaveContext.hudVisibility != HUD_VISIBILITY_A_B_MINIMAP)) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + restoreHudVisibility = false; + } + } else if (player->stateFlags3 & PLAYER_STATE3_1000000) { + // Nuts on B (from flying as Deku Link) + if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NUT) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_ENABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + + if (restoreHudVisibility) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } + } else if (!gSaveContext.save.playerData.isMagicAcquired && (CUR_FORM == PLAYER_FORM_DEKU) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NUT)) { + // Nuts on B (as Deku Link) + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_FD; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } else if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && + (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) { + // Swimming underwater + if (CUR_FORM != PLAYER_FORM_ZORA) { + if ((player->currentMask == PLAYER_MASK_BLAST) && (player->blastMaskTimer == 0)) { + if (gSaveContext.bButtonStatus == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.bButtonStatus = BTN_ENABLED; + } else if ((interfaceCtx->bButtonDoAction == DO_ACTION_EXPLODE) && + (player->currentMask == PLAYER_MASK_BLAST)) { + if (gSaveContext.bButtonStatus != BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_MASK_ZORA) { + if (Player_GetEnvironmentalHazard(play) == PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK))) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_ENABLED; + restoreHudVisibility = true; + } + } + + if (restoreHudVisibility) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + } + + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + if (ActorCutscene_GetCurrentIndex() == -1) { + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } + } else if (player->stateFlags1 & PLAYER_STATE1_200000) { + // First person view + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_LENS) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->stateFlags1 & PLAYER_STATE1_2000) { + // Hanging from a ledge + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + restoreHudVisibility = true; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else { + // End of special event cases + + // B button + if ((interfaceCtx->bButtonDoAction == DO_ACTION_EXPLODE) && (player->currentMask == PLAYER_MASK_BLAST) && + (player->blastMaskTimer != 0)) { + // Cooldown period for blast mask + if (gSaveContext.bButtonStatus != BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + // default to enabled + if (gSaveContext.bButtonStatus == BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_ENABLED; + restoreHudVisibility = true; + } + + // Apply B button restriction + if (interfaceCtx->restrictions.bButton == 0) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU)) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_ENABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = + ITEM_SWORD_KOKIRI + GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) - EQUIP_VALUE_SWORD_KOKIRI; + } + + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + restoreHudVisibility = true; + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (interfaceCtx->bButtonDoAction != 0) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } + } else if (interfaceCtx->restrictions.bButton != 0) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU)) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + restoreHudVisibility = true; + } + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } + } + + // C buttons + if (gSaveContext.save.playerForm == player->transformation) { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + // Individual C button + if (!gPlayerFormItemRestrictions[(void)0, gSaveContext.save.playerForm][GET_CUR_FORM_BTN_ITEM(i)]) { + // Item not usable in current playerForm + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->actor.id != ACTOR_PLAYER) { + // Currently not playing as the main player + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->currentMask == PLAYER_MASK_GIANT) { + // Currently wearing Giant's Mask + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_MASK_GIANT) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_GIANT) { + // Giant's Mask is equipped + if (play->sceneId != SCENE_INISIE_BS) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) { + // Fierce Deity's Mask is equipped + if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) && + (play->sceneId != SCENE_SEA_BS) && (play->sceneId != SCENE_INISIE_BS) && + (play->sceneId != SCENE_LAST_BS)) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + // End of special item cases. Apply restrictions to buttons + if (interfaceCtx->restrictions.tradeItems != 0) { + if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || + (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.tradeItems == 0) { + if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || + (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.masks != 0) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) { + if (!gSaveContext.buttonStatus[i]) { // == BTN_ENABLED + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.masks == 0) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.pictoBox != 0) { + if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_PICTO_BOX) { + if (!gSaveContext.buttonStatus[i]) { // == BTN_ENABLED + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.pictoBox == 0) { + if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_PICTO_BOX) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.all != 0) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX)) { + + if ((gSaveContext.buttonStatus[i] == BTN_ENABLED)) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + } else if (interfaceCtx->restrictions.all == 0) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX)) { + + if ((gSaveContext.buttonStatus[i] == BTN_DISABLED)) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + } + } + } + } + } + + if (restoreHudVisibility && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF)) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } +} + +void Interface_UpdateButtonsPart1(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + s32 pad; + s32 restoreHudVisibility = false; + + if (gSaveContext.save.cutscene < 0xFFF0) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || + (!(CHECK_EVENTINF(EVENTINF_41)) && (play->unk_1887C >= 2))) { + // Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat + // (non-minigame?) + if ((player->stateFlags1 & PLAYER_STATE1_800000) && (player->currentMask == PLAYER_MASK_BLAST) && + (gSaveContext.bButtonStatus == BTN_DISABLED)) { + // Riding Epona with blast mask? + restoreHudVisibility = true; + gSaveContext.bButtonStatus = BTN_ENABLED; + } + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + if ((player->transformation == PLAYER_FORM_DEKU) && CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; + if (play->sceneId == SCENE_BOWLING) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + } + + Interface_SetHudVisibility(HUD_VISIBILITY_B_MAGIC); + } else { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOW) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOMB) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOMBCHU)) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + if (play->sceneId == SCENE_BOWLING) { + if (CURRENT_DAY == 1) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; + } else if (CURRENT_DAY == 2) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMB; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + + if (play->unk_1887C >= 2) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } else { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE); + } + } + + if (play->transitionMode != TRANS_MODE_OFF) { + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (CHECK_EVENTINF(EVENTINF_35))) { + Interface_SetHudVisibility(HUD_VISIBILITY_B_MINIMAP); + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_82_08) && + (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (play->unk_1887C >= 2) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + } + } else { + if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + + if (play->sceneId == SCENE_BOWLING) { + if (CURRENT_DAY == 1) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; + } else if (CURRENT_DAY == 2) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMB; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + + if (play->unk_1887C >= 2) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } else { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE); + + if (play->transitionMode != TRANS_MODE_OFF) { + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (play->unk_1887C >= 2) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + } + } else if (sPictoState != PICTO_BOX_STATE_OFF) { + // Related to pictograph + if (sPictoState == PICTO_BOX_STATE_LENS) { + if (!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) { + Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + (u8*)((void)0, gSaveContext.pictoPhotoI5), + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + sPictoState = PICTO_BOX_STATE_OFF; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + sPictoState = PICTO_BOX_STATE_OFF; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) { + if (!(CHECK_EVENTINF(EVENTINF_41)) || + ((CHECK_EVENTINF(EVENTINF_41)) && (ActorCutscene_GetCurrentIndex() == -1))) { + play_sound(NA_SE_SY_CAMERA_SHUTTER); + SREG(89) = 1; + play->haltAllActors = true; + sPictoState = PICTO_BOX_STATE_SETUP_PHOTO; + sPictoPhotoBeingTaken = true; + } + } + } else if ((sPictoState >= PICTO_BOX_STATE_SETUP_PHOTO) && (Message_GetState(&play->msgCtx) == 4) && + Message_ShouldAdvance(play)) { + play->haltAllActors = false; + player->stateFlags1 &= ~PLAYER_STATE1_200; + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex != 0) { + func_8019F230(); + func_80115844(play, DO_ACTION_STOP); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B); + sPictoState = PICTO_BOX_STATE_LENS; + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); + } else { + func_8019F208(); + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + sPictoState = PICTO_BOX_STATE_OFF; + if (sPictoPhotoBeingTaken) { + Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + (u8*)((void)0, gSaveContext.pictoPhotoI5), + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + Snap_RecordPictographedActors(play); + } + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; + SET_QUEST_ITEM(QUEST_PICTOGRAPH); + sPictoPhotoBeingTaken = false; + } + } + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 1)) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + // Beaver race minigame + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if ((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + // Goron race minigame + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP); + } else if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { + // Related to pictograph + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { + func_80115844(play, DO_ACTION_STOP); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B); + sPictoState = PICTO_BOX_STATE_LENS; + } else { + Play_DecompressI5ToI8((u8*)((void)0, gSaveContext.pictoPhotoI5), + (play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + play->haltAllActors = true; + sPictoState = PICTO_BOX_STATE_SETUP_PHOTO; + } + } else { + // Continue processing the remaining cases + Interface_UpdateButtonsPart2(play); + } + } + + if (restoreHudVisibility) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } +} void Interface_SetSceneRestrictions(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; @@ -1823,7 +2558,40 @@ void Interface_InitMinigame(PlayState* play) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112C0C.s") +/** + * @param play PlayState + * @param flag 0 for default update, 1 for simplified update + */ +void Interface_UpdateButtonsAlt(PlayState* play, u16 flag) { + if (flag) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_FISHING_ROD) || + (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED)) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_FISHING_ROD)) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED); + } else { + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + Interface_UpdateButtonsPart1(play); + } +} s16 sAmmoRefillCounts[] = { 5, 10, 20, 30 }; // Sticks, nuts, bombs s16 sArrowRefillCounts[] = { 10, 30, 40, 50 }; @@ -2933,7 +3701,7 @@ void Magic_Update(PlayState* play) { // Add magic until magicFillTarget is reached gSaveContext.save.playerData.magic += 0x10; - if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneLayer < 4)) { + if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.sceneLayer < 4)) { play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG); } @@ -3146,49 +3914,500 @@ void Magic_DrawMeter(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116FD8.s") +void Interface_SetPerspectiveView(PlayState* play, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Vec3f eye; + Vec3f at; + Vec3f up; -void func_801170B8(InterfaceContext* interfaceCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801170B8.s") + eye.x = eye.y = eye.z = 0.0f; + at.x = at.y = 0.0f; + at.z = -1.0f; + up.x = up.z = 0.0f; + up.y = 1.0f; -TexturePtr cUpLabelTextures[] = { - gTatlCUpENGTex, gTatlCUpENGTex, gTatlCUpGERTex, gTatlCUpFRATex, gTatlCUpESPTex, -}; -s16 startButtonLeftPos[] = { - // Remnant of OoT - 130, 136, 136, 136, 136, -}; -s16 D_801BFAF4[] = { 0x1D, 0x1B }; -s16 D_801BFAF8[] = { 0x1B, 0x1B }; + View_LookAt(&interfaceCtx->view, &eye, &at, &up); -void func_80117100(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117100.s") + interfaceCtx->viewport.topY = topY; + interfaceCtx->viewport.bottomY = bottomY; + interfaceCtx->viewport.leftX = leftX; + interfaceCtx->viewport.rightX = rightX; + View_SetViewport(&interfaceCtx->view, &interfaceCtx->viewport); -s16 D_801BFAFC[] = { 30, 24, 24, 24 }; + View_SetPerspective(&interfaceCtx->view, 60.0f, 10.0f, 60.0f); + View_ApplyPerspectiveToOverlay(&interfaceCtx->view); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117A20.s") +void Interface_SetOrthoView(InterfaceContext* interfaceCtx) { + SET_FULLSCREEN_VIEWPORT(&interfaceCtx->view); + View_ApplyOrthoToOverlay(&interfaceCtx->view); +} + +void Interface_DrawItemButtons(PlayState* play) { + static TexturePtr cUpLabelTextures[] = { + gTatlCUpENGTex, gTatlCUpENGTex, gTatlCUpGERTex, gTatlCUpFRATex, gTatlCUpESPTex, + }; + static s16 startButtonLeftPos[] = { + // Remnant of OoT + 130, 136, 136, 136, 136, + }; + static s16 D_801BFAF4[] = { 0x1D, 0x1B }; + static s16 D_801BFAF8[] = { 0x1B, 0x1B }; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + s16 temp; // Used as both an alpha value and a button index + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + // B Button Color & Texture + OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadow(OVERLAY_DISP, gButtonBackgroundTex, 0x20, 0x20, D_801BF9D4[0], + D_801BF9DC[0], D_801BFAF4[0], D_801BFAF4[0], D_801BF9E4[0] * 2, + D_801BF9E4[0] * 2, 100, 255, 120, interfaceCtx->bAlpha); + if (1) {} + gDPPipeSync(OVERLAY_DISP++); + + // C-Left Button Color & Texture + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D4[1], D_801BF9DC[1], D_801BFAF4[1], D_801BFAF4[1], + D_801BF9E4[1] * 2, D_801BF9E4[1] * 2, 255, 240, 0, interfaceCtx->cLeftAlpha); + // C-Down Button Color & Texture + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D8[0], D_801BF9E0[0], D_801BFAF8[0], D_801BFAF8[0], + D_801BF9E4[2] * 2, D_801BF9E4[2] * 2, 255, 240, 0, interfaceCtx->cDownAlpha); + // C-Right Button Color & Texture + OVERLAY_DISP = + Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D8[1], D_801BF9E0[1], D_801BFAF8[1], D_801BFAF8[1], + D_801BF9E4[3] * 2, D_801BF9E4[3] * 2, 255, 240, 0, interfaceCtx->cRightAlpha); + + if (!IS_PAUSE_STATE_GAMEOVER) { + if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, 0x88, 0x11, 0x16, 0x16, 0x5B6, 0x5B6, 0xFF, 0x82, 0x3C, + interfaceCtx->startAlpha); + // Start Button Texture, Color & Label + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 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); + gSPTextureRectangle(OVERLAY_DISP++, 0x01F8, 0x0054, 0x02D4, 0x009C, G_TX_RENDERTILE, 0, 0, 0x04A6, 0x04A6); + } + } + + if (interfaceCtx->tatlCalling && (play->pauseCtx.state == PAUSE_STATE_OFF) && + (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == 0) && + (sPictoState == PICTO_BOX_STATE_OFF)) { + if (sCUpInvisible == 0) { + // C-Up Button Texture, Color & Label (Tatl Text) + gDPPipeSync(OVERLAY_DISP++); + + if ((gSaveContext.hudVisibility == HUD_VISIBILITY_NONE) || + (gSaveContext.hudVisibility == HUD_VISIBILITY_NONE_ALT) || + (gSaveContext.hudVisibility == HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE) || + (msgCtx->msgMode != 0)) { + temp = 0; + } else if (player->stateFlags1 & PLAYER_STATE1_200000) { + temp = 70; + } else { + temp = interfaceCtx->aAlpha; + } + + OVERLAY_DISP = + Gfx_DrawRect_DropShadow(OVERLAY_DISP, 0xFE, 0x10, 0x10, 0x10, 0x800, 0x800, 0xFF, 0xF0, 0, temp); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, temp); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, cUpLabelTextures[gSaveContext.options.language], G_IM_FMT_IA, 32, 12, + 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); + gSPTextureRectangle(OVERLAY_DISP++, 0x03DC, 0x0048, 0x045C, 0x0078, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + } + + sCUpTimer--; + if (sCUpTimer == 0) { + sCUpInvisible ^= 1; + sCUpTimer = 10; + } + } + + gDPPipeSync(OVERLAY_DISP++); + + // Empty C Button Arrows + for (temp = EQUIP_SLOT_C_LEFT; temp <= EQUIP_SLOT_C_RIGHT; temp++) { + if (GET_CUR_FORM_BTN_ITEM(temp) > 0xF0) { + if (temp == EQUIP_SLOT_C_LEFT) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cLeftAlpha); + } else if (temp == EQUIP_SLOT_C_DOWN) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cDownAlpha); + } else { // EQUIP_SLOT_C_RIGHT + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cRightAlpha); + } + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex + ((32 * 32) * (temp + 1))), + 0x20, 0x20, D_801BF9D4[temp], D_801BF9DC[temp], D_801BFAF4[temp], + D_801BFAF4[temp], D_801BF9E4[temp] * 2, D_801BF9E4[temp] * 2); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawItemIconTexture(PlayState* play, TexturePtr texture, s16 button) { + static s16 D_801BFAFC[] = { 30, 24, 24, 24 }; + + OPEN_DISPS(play->state.gfxCtx); + + gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(OVERLAY_DISP++, D_801BF9D4[button] << 2, D_801BF9DC[button] << 2, + (D_801BF9D4[button] + D_801BFAFC[button]) << 2, (D_801BF9DC[button] + D_801BFAFC[button]) << 2, + G_TX_RENDERTILE, 0, 0, D_801BF9BC[button] << 1, D_801BF9BC[button] << 1); + + CLOSE_DISPS(play->state.gfxCtx); +} s16 D_801BFB04[] = { 0xA2, 0xE4, 0xFA, 0x110 }; s16 D_801BFB0C[] = { 0x23, 0x23, 0x33, 0x23 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117BD0.s") +void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { + u8 i; + u16 ammo; -void func_80118084(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118084.s") + OPEN_DISPS(play->state.gfxCtx); -void func_80118890(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118890.s") + i = ((void)0, GET_CUR_FORM_BTN_ITEM(button)); -void func_80118BA4(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118BA4.s") + if ((i == ITEM_STICK) || (i == ITEM_NUT) || (i == ITEM_BOMB) || (i == ITEM_BOW) || + ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) || (i == ITEM_BOMBCHU) || (i == ITEM_POWDER_KEG) || + (i == ITEM_MAGIC_BEANS) || (i == ITEM_PICTO_BOX)) { -extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex -s16 D_801BFB14[] = { 255, 100, 255, 0 }; // magicArrowEffectsR -s16 D_801BFB1C[] = { 0, 100, 255, 0 }; // magicArrowEffectsG -s16 D_801BFB24[] = { 0, 255, 100, 0 }; // magicArrowEffectsB + if ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) { + i = ITEM_BOW; + } -void func_80119030(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80119030.s") + ammo = AMMO(i); + + if (i == ITEM_PICTO_BOX) { + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { + ammo = 0; + } else { + ammo = 1; + } + } + + gDPPipeSync(OVERLAY_DISP++); + + if ((button == EQUIP_SLOT_B) && (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { + ammo = play->interfaceCtx.minigameAmmo; + } else if ((button == EQUIP_SLOT_B) && (play->unk_1887C > 1)) { + ammo = play->unk_1887C - 1; + } else if (((i == ITEM_BOW) && (AMMO(i) == CUR_CAPACITY(UPG_QUIVER))) || + ((i == ITEM_BOMB) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((i == ITEM_STICK) && (AMMO(i) == CUR_CAPACITY(UPG_STICKS))) || + ((i == ITEM_NUT) && (AMMO(i) == CUR_CAPACITY(UPG_NUTS))) || + ((i == ITEM_BOMBCHU) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((i == ITEM_POWDER_KEG) && (ammo == 1)) || ((i == ITEM_PICTO_BOX) && (ammo == 1)) || + ((i == ITEM_MAGIC_BEANS) && (ammo == 20))) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, alpha); + } + + if ((u32)ammo == 0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, alpha); + } + + for (i = 0; ammo >= 10; i++) { + ammo -= 10; + } + + // Draw upper digit (tens) + if ((u32)i != 0) { + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * i)), 8, 8, + D_801BFB04[button], D_801BFB0C[button], 8, 8, 1 << 10, 1 << 10); + } + + // Draw lower digit (ones) + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * ammo)), 8, 8, + D_801BFB04[button] + 6, D_801BFB0C[button], 8, 8, 1 << 10, 1 << 10); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawBButtonIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + if ((interfaceCtx->unk_222 == 0) && (player->stateFlags3 & PLAYER_STATE3_1000000)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); + } + } else if ((!interfaceCtx->unk_21C && (interfaceCtx->unk_222 == 0)) || + ((interfaceCtx->unk_21C && + ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) < ITEM_SWORD_KOKIRI) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) > ITEM_SWORD_GILDED)) && + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NUT))) { + if ((player->transformation == PLAYER_FORM_FIERCE_DEITY) || (player->transformation == PLAYER_FORM_HUMAN)) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || + (play->unk_1887C >= 2)) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + if ((play->sceneId != SCENE_SYATEKI_MIZU) && (play->sceneId != SCENE_SYATEKI_MORI) && + (play->sceneId != SCENE_BOWLING) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || + (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0))) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || !(CHECK_EVENTINF(EVENTINF_35))) && + (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80) || (play->unk_1887C != 100))) { + Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); + } + } + } + } + } else if (interfaceCtx->unk_222 != 0) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x480, G_IM_FMT_IA, 48, 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); + + D_801BF9B0 = 1024.0f / (D_801BF9B4[gSaveContext.options.language] / 100.0f); + + gSPTextureRectangle( + OVERLAY_DISP++, (D_801BF9C4[gSaveContext.options.language] * 4), + (D_801BF9C8[gSaveContext.options.language] * 4), ((D_801BF9C4[gSaveContext.options.language] + 0x30) << 2), + ((D_801BF9C8[gSaveContext.options.language] + 0x10) << 2), G_TX_RENDERTILE, 0, 0, D_801BF9B0, D_801BF9B0); + } else if (interfaceCtx->bButtonDoAction != DO_ACTION_NONE) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x600, G_IM_FMT_IA, 48, 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); + + D_801BF9B0 = 1024.0f / (D_801BF9B4[gSaveContext.options.language] / 100.0f); + + gSPTextureRectangle( + OVERLAY_DISP++, (D_801BF9C4[gSaveContext.options.language] * 4), + (D_801BF9C8[gSaveContext.options.language] * 4), ((D_801BF9C4[gSaveContext.options.language] + 0x30) << 2), + ((D_801BF9C8[gSaveContext.options.language] + 0x10) << 2), G_TX_RENDERTILE, 0, 0, D_801BF9B0, D_801BF9B0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draws the icons and ammo for each of the C buttons + */ +void Interface_DrawCButtonIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + + // C-Left Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x1000, EQUIP_SLOT_C_LEFT); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_LEFT, interfaceCtx->cLeftAlpha); + } + + gDPPipeSync(OVERLAY_DISP++); + + // C-Down Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x2000, EQUIP_SLOT_C_DOWN); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_DOWN, interfaceCtx->cDownAlpha); + } + + gDPPipeSync(OVERLAY_DISP++); + + // C-Right Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x3000, EQUIP_SLOT_C_RIGHT); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_RIGHT, interfaceCtx->cRightAlpha); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawAButton(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + s16 aAlpha; + + OPEN_DISPS(play->state.gfxCtx); + + aAlpha = interfaceCtx->aAlpha; + + if (aAlpha > 100) { + aAlpha = 100; + } + + func_8012C8D4(play->state.gfxCtx); + + Interface_SetPerspectiveView(play, 25 + R_A_BTN_Y_OFFSET, 70 + R_A_BTN_Y_OFFSET, 192, 237); + + gSPClearGeometryMode(OVERLAY_DISP++, G_CULL_BOTH); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD); + + Matrix_Translate(0.0f, 0.0f, -38.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateXFApply(interfaceCtx->aButtonRoll / 10000.0f); + + // Draw A button Shadow + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(OVERLAY_DISP++); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, aAlpha); + + OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, 0); + + // Draw A Button Colored + gDPPipeSync(OVERLAY_DISP++); + Interface_SetPerspectiveView(play, 23 + R_A_BTN_Y_OFFSET, 68 + R_A_BTN_Y_OFFSET, 190, 235); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 200, 255, interfaceCtx->aAlpha); + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); + + // Draw A Button Do-Action + gDPPipeSync(OVERLAY_DISP++); + Interface_SetPerspectiveView(play, 23 + R_A_BTN_Y_OFFSET, 68 + R_A_BTN_Y_OFFSET, 190, 235); + gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + + Matrix_Translate(0.0f, 0.0f, D_801BF9CC[gSaveContext.options.language] / 10.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateXFApply(interfaceCtx->aButtonRoll / 10000.0f); + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[8], 4, 0); + + // Draw Action Label + if (((interfaceCtx->aButtonState <= A_BTN_STATE_1) || (interfaceCtx->aButtonState == A_BTN_STATE_3))) { + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment, 3, DO_ACTION_TEX_WIDTH, + DO_ACTION_TEX_HEIGHT, 0); + } else { + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, 3, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +static s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; +static s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; +static s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; + +void Interface_DrawPauseMenuEquippingIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; + s16 temp; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + + // This is needed as `Interface_DrawPauseMenuEquippingIcons` is call immediately + // after `Interface_DrawAButton`, which sets the view to perspective mode + Interface_SetOrthoView(interfaceCtx); + + if ((pauseCtx->state == PAUSE_STATE_MAIN) && ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_MASK))) { + // Inventory Equip Effects + gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); + func_8012C8D4(play->state.gfxCtx); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10; + pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] + (pauseCtx->equipAnimScale / 10); + pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = pauseCtx->equipAnimY / 10; + pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] - (pauseCtx->equipAnimScale / 10); + + if (pauseCtx->equipTargetItem < 0xB5) { + // Normal Equip (icon goes from the inventory slot to the C button when equipping it) + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->equipAnimAlpha); + gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); + gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->equipTargetItem], G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, + 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } else { + // Magic Arrow Equip Effect + temp = pauseCtx->equipTargetItem - 0xB5; + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicArrowEffectsR[temp], sMagicArrowEffectsG[temp], + sMagicArrowEffectsB[temp], pauseCtx->equipAnimAlpha); + + if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) { + temp = (pauseCtx->equipAnimAlpha / 8) / 2; + pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] - temp; + pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] + temp * 2 + 32; + pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] + temp; + pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] - temp * 2 - 32; + } + + gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); + gDPLoadTextureBlock(OVERLAY_DISP++, &D_08095AC0, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } + + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} /** * Draws either the analog three-day clock or the digital final-hours clock @@ -3263,7 +4482,7 @@ void Interface_DrawClock(PlayState* play) { if (R_TIME_SPEED != 0) { if ((msgCtx->msgMode == 0) || ((play->actorCtx.flags & ACTORCTX_FLAG_1) && !Play_InCsMode(play)) || (msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || - (gSaveContext.gameMode == 3)) { + (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) { if (!FrameAdvance_IsEnabled(&play->state) && !Environment_IsTimeStopped() && (gSaveContext.save.day < 4)) { /** * Changes Clock's transparancy depending if Player is moving or not and possibly other things @@ -4324,7 +5543,7 @@ void Interface_DrawPerfectLetters(PlayState* play) { void Interface_StartMoonCrash(PlayState* play) { if (play->actorCtx.flags & ACTORCTX_FLAG_1) { - Audio_QueueSeqCmd(0xE0000100); + SEQCMD_DISABLE_PLAY_SEQUENCES(false); } gSaveContext.save.day = 4; @@ -5083,7 +6302,7 @@ void Interface_Draw(PlayState* play) { if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { Interface_SetVertices(play); - func_801170B8(interfaceCtx); + Interface_SetOrthoView(interfaceCtx); // Draw Grandma's Story if (interfaceCtx->storyDmaStatus == STORY_DMA_DONE) { @@ -5096,8 +6315,9 @@ void Interface_Draw(PlayState* play) { // Load in Grandma's Story gSPLoadUcodeL(OVERLAY_DISP++, gspS2DEX2_fifo); gfx = OVERLAY_DISP; - func_80172758(&gfx, sStoryTextures[interfaceCtx->storyType], sStoryTLUTs[interfaceCtx->storyType], - SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); + Prerender_DrawBackground2D(&gfx, sStoryTextures[interfaceCtx->storyType], + sStoryTLUTs[interfaceCtx->storyType], SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, + 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); OVERLAY_DISP = gfx; gSPLoadUcode(OVERLAY_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); @@ -5299,16 +6519,16 @@ void Interface_Draw(PlayState* play) { func_8012C654(play->state.gfxCtx); - func_80117100(play); + Interface_DrawItemButtons(play); if (player->transformation == ((void)0, gSaveContext.save.playerForm)) { - func_80118084(play); + Interface_DrawBButtonIcons(play); } - func_80118890(play); + Interface_DrawCButtonIcons(play); - func_80118BA4(play); + Interface_DrawAButton(play); - func_80119030(play); + Interface_DrawPauseMenuEquippingIcons(play); // Draw either the minigame countdown or the three-day clock if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { @@ -5515,7 +6735,7 @@ void Interface_Update(PlayState* play) { // Update buttons if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { - func_80111CB4(play); + Interface_UpdateButtonsPart1(play); } } @@ -6005,16 +7225,16 @@ void Interface_Init(PlayState* play) { interfaceCtx->healthTimer = 200; parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static); - interfaceCtx->parameterSegment = THA_AllocEndAlign16(&play->state.heap, parameterStaticSize); + interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.heap, parameterStaticSize); DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize); - interfaceCtx->doActionSegment = THA_AllocEndAlign16(&play->state.heap, 0xC90); + interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.heap, 0xC90); DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300); DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180); Interface_NewDay(play, CURRENT_DAY); - interfaceCtx->iconItemSegment = THA_AllocEndAlign16(&play->state.heap, 0x4000); + interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.heap, 0x4000); if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); diff --git a/src/code/z_pause.c b/src/code/z_pause.c index bb5b33cf2..5f212b7ae 100644 --- a/src/code/z_pause.c +++ b/src/code/z_pause.c @@ -18,7 +18,9 @@ * * Note2: Controllers 2-4's inputs are normally zeroed out, so this would also need to be fixed to use frame advance */ -#include "global.h" + +#include "z64frameadvance.h" +#include "macros.h" void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { frameAdvCtx->timer = 0; diff --git a/src/code/z_play.c b/src/code/z_play.c index b33b449d2..08309b32f 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,4 +1,6 @@ #include "global.h" +#include "buffers.h" +#include "z64debug_display.h" #include "z64quake.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -13,9 +15,8 @@ u8 D_801D0D54 = false; s16 sTransitionFillTimer; Input D_801F6C18; -FbDemoStruct sTrnsnUnk; -u16* D_801F6D0C; -s32 gTrnsnUnkState; +TransitionTile sTransitionTile; +s32 gTransitionTileState; VisMono sVisMono; Color_RGBA8_u32 gVisMonoColor; Struct_80140E80 D_801F6D38; @@ -389,9 +390,9 @@ void Play_Destroy(GameState* thisx) { EffectSS_Clear(this); CollisionCheck_DestroyContext(this, &this->colChkCtx); - if (gTrnsnUnkState == 3) { - TransitionUnk_Destroy(&sTrnsnUnk); - gTrnsnUnkState = 0; + if (gTransitionTileState == TRANS_TILE_READY) { + TransitionTile_Destroy(&sTransitionTile); + gTransitionTileState = TRANS_TILE_OFF; } if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) || D_801D0D54) { @@ -571,7 +572,7 @@ void Play_UpdateTransition(PlayState* this) { ((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) || ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20))) && (!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) || - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { func_801A4058(20); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; @@ -584,7 +585,7 @@ void Play_UpdateTransition(PlayState* this) { } if (func_800FE590(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { func_801A41C8(20); } } @@ -669,7 +670,8 @@ void Play_UpdateTransition(PlayState* this) { } this->transitionCtx.setType(&this->transitionCtx.instanceData, - (this->transitionTrigger == TRANS_TRIGGER_END) ? 1 : 2); + (this->transitionTrigger == TRANS_TRIGGER_END) ? TRANS_INSTANCE_TYPE_FILL_OUT + : TRANS_INSTANCE_TYPE_FILL_IN); this->transitionCtx.start(&this->transitionCtx.instanceData); if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) { @@ -687,10 +689,10 @@ void Play_UpdateTransition(PlayState* this) { D_801D0D54 = false; } - if (gSaveContext.gameMode == 4) { + if (gSaveContext.gameMode == GAMEMODE_OWL_SAVE) { STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState)); - } else if (gSaveContext.gameMode != 2) { + } else if (gSaveContext.gameMode != GAMEMODE_FILE_SELECT) { STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState)); gSaveContext.save.entrance = this->nextEntrance; @@ -698,7 +700,7 @@ void Play_UpdateTransition(PlayState* this) { if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { gSaveContext.minigameStatus = MINIGAME_STATUS_END; } - } else { // 2 + } else { // GAMEMODE_FILE_SELECT STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, FileSelect_Init, sizeof(FileSelectState)); } @@ -710,9 +712,9 @@ void Play_UpdateTransition(PlayState* this) { Play_ClearTransition(this); } this->transitionMode = TRANS_MODE_OFF; - if (gTrnsnUnkState == 3) { - TransitionUnk_Destroy(&sTrnsnUnk); - gTrnsnUnkState = 0; + if (gTransitionTileState == TRANS_TILE_READY) { + TransitionTile_Destroy(&sTransitionTile); + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); } } @@ -759,7 +761,7 @@ void Play_UpdateTransition(PlayState* this) { this->envCtx.screenFillColor[3] = (1.0f - (sTransitionFillTimer / 20.0f)) * 255.0f; if (sTransitionFillTimer >= 20) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -793,7 +795,7 @@ void Play_UpdateTransition(PlayState* this) { this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; } else { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -822,7 +824,7 @@ void Play_UpdateTransition(PlayState* this) { func_8019F128(NA_SE_EV_SAND_STORM - SFX_FLAG); if (this->transitionTrigger == TRANS_TRIGGER_END) { if (this->envCtx.sandstormPrimA < 110) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -858,7 +860,7 @@ void Play_UpdateTransition(PlayState* this) { if (this->transitionTrigger == TRANS_TRIGGER_END) { if (this->envCtx.sandstormPrimA <= 0) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -881,7 +883,7 @@ void Play_UpdateTransition(PlayState* this) { this->envCtx.screenFillColor[3] = gSaveContext.cutsceneTransitionControl; if (gSaveContext.cutsceneTransitionControl <= 100) { - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; Game_SetFramerateDivisor(&this->state, 3); this->transitionTrigger = TRANS_TRIGGER_OFF; this->transitionMode = TRANS_MODE_OFF; @@ -922,26 +924,29 @@ void Play_UpdateMain(PlayState* this) { this->transitionMode = TRANS_MODE_SETUP; } - if (gTrnsnUnkState != 0) { - switch (gTrnsnUnkState) { - case 2: - if (TransitionUnk_Init(&sTrnsnUnk, 10, 7) == NULL) { - gTrnsnUnkState = 0; + if (gTransitionTileState != TRANS_TILE_OFF) { + switch (gTransitionTileState) { + case TRANS_TILE_PROCESS: + if (TransitionTile_Init(&sTransitionTile, 10, 7) == NULL) { + gTransitionTileState = TRANS_TILE_OFF; } else { - D_801F6D0C = gZBufferPtr; - gTrnsnUnkState = 3; + sTransitionTile.zBuffer = gZBufferPtr; + gTransitionTileState = TRANS_TILE_READY; Game_SetFramerateDivisor(&this->state, 1); } break; - case 3: - func_801647AC(&sTrnsnUnk); + case TRANS_TILE_READY: + TransitionTile_Update(&sTransitionTile); + break; + + default: break; } } Play_UpdateTransition(this); - if (gTrnsnUnkState != 3) { - if ((gSaveContext.gameMode == 0) && + if (gTransitionTileState != TRANS_TILE_READY) { + if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (((this->msgCtx.msgMode == 0)) || ((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == 0x42) && (this->msgCtx.unk12020 == 0x41)) || @@ -987,9 +992,9 @@ void Play_UpdateMain(PlayState* this) { Rumble_SetUpdateEnabled(false); } - Room_nop8012D510(this, &this->roomCtx.curRoom, &input[1], 0); - Room_nop8012D510(this, &this->roomCtx.prevRoom, &input[1], 1); - SkyboxDraw_Update(&this->skyboxCtx); + Room_Noop(this, &this->roomCtx.curRoom, &input[1], 0); + Room_Noop(this, &this->roomCtx.prevRoom, &input[1], 1); + Skybox_Update(&this->skyboxCtx); if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { KaleidoScopeCall_Update(this); @@ -1071,7 +1076,7 @@ void Play_PostWorldDraw(PlayState* this) { KaleidoScopeCall_Draw(this); } - if (gSaveContext.gameMode == 0) { + if (gSaveContext.gameMode == GAMEMODE_NORMAL) { Interface_Draw(this); } @@ -1121,8 +1126,8 @@ void Play_DrawMain(PlayState* this) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF; } - if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTrnsnUnkState < 2)) { - if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.mesh->type0.type == 1)) { + if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { + if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.roomShape->base.type == ROOM_SHAPE_TYPE_IMAGE)) { func_8012CF0C(gfxCtx, false, true, 0, 0, 0); } else { func_8012CF0C(gfxCtx, true, true, this->lightCtx.fogColor.r, this->lightCtx.fogColor.g, @@ -1226,10 +1231,10 @@ void Play_DrawMain(PlayState* this) { POLY_OPA_DISP = sp218; } - if (gTrnsnUnkState == 3) { + if (gTransitionTileState == TRANS_TILE_READY) { Gfx* sp90 = POLY_OPA_DISP; - TransitionUnk_Draw(&sTrnsnUnk, &sp90); + TransitionTile_Draw(&sTransitionTile, &sp90); POLY_OPA_DISP = sp90; sp25B = true; goto PostWorldDraw; @@ -1262,14 +1267,14 @@ void Play_DrawMain(PlayState* this) { if (this->unk_18844 == 0) { if (1) { - if (this->skyboxId && !this->envCtx.skyboxDisabled) { - if ((this->skyboxId == 1) || (this->skyboxId == 3)) { + if ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) { + if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_3)) { Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); - SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.unk_13, - this->view.eye.x, this->view.eye.y, this->view.eye.z); + Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.unk_13, this->view.eye.x, + this->view.eye.y, this->view.eye.z); } else if (!this->skyboxCtx.skyboxShouldDraw) { - SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, - this->view.eye.y, this->view.eye.z); + Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, this->view.eye.y, + this->view.eye.z); } } @@ -1300,8 +1305,8 @@ void Play_DrawMain(PlayState* this) { if (1) {} Camera_GetQuakeOffset(&sp78, GET_ACTIVE_CAM(this)); - SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp78.x, - this->view.eye.y + sp78.y, this->view.eye.z + sp78.z); + Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp78.x, + this->view.eye.y + sp78.y, this->view.eye.z + sp78.z); } // envCtx.precipitation[PRECIP_RAIN_CUR] @@ -1362,7 +1367,8 @@ void Play_DrawMain(PlayState* this) { Play_DrawMotionBlur(this); - if (((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || (gTrnsnUnkState == 1)) || + if (((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || + (gTransitionTileState == TRANS_TILE_SETUP)) || (R_PICTO_PHOTO_STATE == PICTO_PHOTO_STATE_SETUP)) { Gfx* sp74; Gfx* sp70 = POLY_OPA_DISP; @@ -1380,7 +1386,7 @@ void Play_DrawMain(PlayState* this) { this->pauseBgPreRender.fbufSave = gfxCtx->zbuffer; this->pauseBgPreRender.cvgSave = this->unk_18E58; } else { - gTrnsnUnkState = 2; + gTransitionTileState = TRANS_TILE_PROCESS; this->pauseBgPreRender.fbufSave = gfxCtx->zbuffer; this->pauseBgPreRender.cvgSave = NULL; } @@ -1411,8 +1417,8 @@ void Play_DrawMain(PlayState* this) { Camera_Update(&sp4C, GET_ACTIVE_CAM(this)); View_UpdateViewingMatrix(&this->view); this->view.unk164 = 0; - if ((this->skyboxId != 0) && !this->envCtx.skyboxDisabled) { - SkyboxDraw_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z); + if ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) { + Skybox_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z); } } @@ -1539,7 +1545,7 @@ void Play_GetFloorSurface(PlayState* this, MtxF* mtx, Vec3f* pos) { void* Play_LoadFile(PlayState* this, RomFile* entry) { size_t size = entry->vromEnd - entry->vromStart; - void* allocp = THA_AllocEndAlign16(&this->state.heap, size); + void* allocp = THA_AllocTailAlign16(&this->state.heap, size); DmaMgr_SendRequest0(allocp, entry->vromStart, size); @@ -1567,7 +1573,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { Door_InitContext(&this->state, &this->doorCtx); Room_Init(this, &this->roomCtx); gSaveContext.worldMapArea = 0; - Scene_ProcessHeader(this, this->sceneSegment); + Scene_ExecuteCommands(this, this->sceneSegment); Play_InitEnvironment(this, this->skyboxId); } @@ -1934,11 +1940,10 @@ void func_80169FDC(GameState* thisx) { func_80169F78(thisx); } -// Used by Kankyo to determine how to change the lighting, e.g. for game over. -s32 func_80169FFC(GameState* thisx) { +s32 Play_CamIsNotFixed(GameState* thisx) { PlayState* this = (PlayState*)thisx; - return this->roomCtx.curRoom.mesh->type0.type != 1; + return this->roomCtx.curRoom.roomShape->base.type != ROOM_SHAPE_TYPE_IMAGE; } s32 FrameAdvance_IsEnabled(GameState* thisx) { @@ -2197,7 +2202,8 @@ void Play_Init(GameState* thisx) { func_800EDDB0(this); - if (((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 1)) || (gSaveContext.save.cutscene >= 0xFFF0)) { + if (((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN)) || + (gSaveContext.save.cutscene >= 0xFFF0)) { gSaveContext.unk_3DC0 = 0; Magic_Reset(this); gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1; @@ -2241,7 +2247,7 @@ void Play_Init(GameState* thisx) { this->unk_18E68 = D_80784600; this->unk_18E58 = D_80784600; this->unk_18E60 = D_80784600; - gTrnsnUnkState = 0; + gTransitionTileState = TRANS_TILE_OFF; this->transitionMode = TRANS_MODE_OFF; D_801D0D54 = false; @@ -2258,7 +2264,7 @@ void Play_Init(GameState* thisx) { this->haltAllActors = false; this->unk_18844 = false; - if (gSaveContext.gameMode != 1) { + if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) { this->transitionType = (Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + sceneLayer) >> 7) & 0x7F; @@ -2290,15 +2296,16 @@ void Play_Init(GameState* thisx) { D_801F6D4C->envColor.b = 0; D_801F6D4C->envColor.a = 0; EnvFlags_UnsetAll(this); - THA_GetSize(&this->state.heap); - zAllocSize = THA_GetSize(&this->state.heap); - zAlloc = (uintptr_t)THA_AllocEndAlign16(&this->state.heap, zAllocSize); + THA_GetRemaining(&this->state.heap); + zAllocSize = THA_GetRemaining(&this->state.heap); + zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize); ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s Actor_InitContext(this, &this->actorCtx, this->linkActorEntry); while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {} - if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.unk3 == 1) || (this->roomCtx.curRoom.unk3 == 5))) { + if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) || + (this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_5))) { Actor_Spawn(&this->actorCtx, this, ACTOR_EN_TEST4, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0); } diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index a4ceeba95..bdc124708 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #define FLAGS \ diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 51b25268b..a7004ad3c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1,3 +1,5 @@ +#include "prevent_bss_reordering.h" + #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -441,7 +443,7 @@ void func_80123140(PlayState* play, Player* player) { IREG(69) = bootRegs[16]; MREG(95) = bootRegs[17]; - if (play->roomCtx.curRoom.unk3 == 2) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { R_RUN_SPEED_LIMIT = 500; } @@ -492,10 +494,11 @@ s32 Player_IsGoronOrDeku(Player* player) { s32 func_801234D4(PlayState* play) { Player* player = GET_PLAYER(play); - return (player->stateFlags2 & PLAYER_STATE2_8) || player->actor.speedXZ != 0.0f || + return (player->stateFlags2 & PLAYER_STATE2_8) || (player->actor.speed != 0.0f) || ((player->transformation != PLAYER_FORM_ZORA) && (player->stateFlags1 & PLAYER_STATE1_8000000)) || ((player->transformation == PLAYER_FORM_ZORA) && (player->stateFlags1 & PLAYER_STATE1_8000000) && - (!(player->actor.bgCheckFlags & 1) || (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER))); + (!(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER))); } s32 func_80123590(PlayState* play, Actor* actor) { @@ -1274,7 +1277,7 @@ void func_80123DA4(Player* player) { } void func_80123DC0(Player* player) { - if ((player->actor.bgCheckFlags & 1) || + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & (PLAYER_STATE1_200000 | PLAYER_STATE1_800000 | PLAYER_STATE1_8000000)) || (!(player->stateFlags1 & (PLAYER_STATE1_40000 | PLAYER_STATE1_80000)) && ((player->actor.world.pos.y - player->actor.floorHeight) < 100.0f))) { @@ -1455,13 +1458,13 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { EnvHazardTextTriggerEntry* triggerEntry; s32 envHazard; - if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot + if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_HOT) { envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1; } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) { envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1; } else if (player->stateFlags1 & PLAYER_STATE1_8000000) { if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) && - (player->actor.bgCheckFlags & 1)) { + (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1; } else { envHazard = PLAYER_ENV_HAZARD_SWIMMING - 1; @@ -2168,15 +2171,15 @@ void Player_DrawBlastMask(PlayState* play, Player* player) { OPEN_DISPS(play->state.gfxCtx); - if (player->unk_B60 != 0) { + if (player->blastMaskTimer != 0) { s32 alpha; gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment); AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_bakuretu_Matanimheader_0011F8)); - if (player->unk_B60 < 11) { - alpha = (player->unk_B60 / 10.0f) * 255; + if (player->blastMaskTimer <= 10) { + alpha = (player->blastMaskTimer / 10.0f) * 255; } else { alpha = 255; } diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 7e15a9bde..b4bb6ea7d 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1299,7 +1299,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g } void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { - if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTrnsnUnkState < 2)) { + if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { func_8012CF0C(gfxCtx, true, true, r, g, b); } else { func_8012CF0C(gfxCtx, false, false, r, g, b); diff --git a/src/code/z_room.c b/src/code/z_room.c index eb615c409..369b2b0e5 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,62 +1,481 @@ #include "global.h" -void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) { +void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3) { } -void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags) { +void Room_DrawNone(PlayState* play, Room* room, u32 flags) { } -void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags) { - RoomMeshType0* mesh; +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + +void Room_DrawNormal(PlayState* play, Room* room, u32 flags) { + RoomShapeNormal* roomShape; + RoomShapeDListsEntry* entry; s32 i; - RoomMeshType0Params* meshParams; - GraphicsContext* gfxCtx; - UNK_TYPE4 pad; - gfxCtx = play->state.gfxCtx; - if (flags & 1) { - func_800BCBF4(&D_801C1D10, play); - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + OPEN_DISPS(play->state.gfxCtx); + + if (flags & ROOM_DRAW_OPA) { + func_800BCBF4(&sZeroVec, play); + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); func_8012C268(play); - gSPMatrix(gfxCtx->polyOpa.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } - if (flags & 2) { - func_800BCC68(&D_801C1D10, play); - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + if (flags & ROOM_DRAW_XLU) { + func_800BCC68(&sZeroVec, play); + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); func_8012C2DC(play->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } - mesh = &room->mesh->type0; - meshParams = Lib_SegmentedToVirtual(mesh->paramsStart); - for (i = 0; i < mesh->count; i++) { - if ((flags & 1) && (meshParams->opaqueDl != NULL)) { - gSPDisplayList(gfxCtx->polyOpa.p++, meshParams->opaqueDl); + roomShape = &room->roomShape->normal; + entry = Lib_SegmentedToVirtual(roomShape->entries); + for (i = 0; i < roomShape->numEntries; i++) { + if ((flags & ROOM_DRAW_OPA) && (entry->opa != NULL)) { + gSPDisplayList(POLY_OPA_DISP++, entry->opa); } - if ((flags & 2) && (meshParams->translucentDl != NULL)) { - gSPDisplayList(gfxCtx->polyXlu.p++, meshParams->translucentDl); + if ((flags & ROOM_DRAW_XLU) && (entry->xlu != NULL)) { + gSPDisplayList(POLY_XLU_DISP++, entry->xlu); } - meshParams++; + entry++; } + + CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_DrawType2Mesh.s") +typedef enum { + /* 0 */ ROOM_CULL_DEBUG_MODE_OFF, + /* 1 */ ROOM_CULL_DEBUG_MODE_UP_TO_TARGET, + /* 2 */ ROOM_CULL_DEBUG_MODE_ONLY_TARGET +} RoomCullableDebugMode; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012DEE8.s") +typedef struct RoomShapeCullableEntryLinked { + /* 0x00 */ RoomShapeCullableEntry* entry; + /* 0x04 */ f32 boundsNearZ; + /* 0x08 */ struct RoomShapeCullableEntryLinked* prev; + /* 0x0C */ struct RoomShapeCullableEntryLinked* next; +} RoomShapeCullableEntryLinked; // size = 0x10 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E254.s") +// TODO: 127 is an arbitrarily chosen number to make the stack sorta work +#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 127 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E32C.s") +#ifdef NON_MATCHING +// Small regalloc, likely related to temp usage and scoping +void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { + RoomShapeCullable* roomShape; + RoomShapeCullableEntry* roomShapeCullableEntry; + RoomShapeCullableEntry* roomShapeCullableEntries; + RoomShapeCullableEntry* roomShapeCullableEntryIter; + Gfx* displayList; + f32 entryBoundsNearZ; + RoomShapeCullableEntryLinked linkedEntriesBuffer[ROOM_SHAPE_CULLABLE_MAX_ENTRIES]; + RoomShapeCullableEntryLinked* head = NULL; + RoomShapeCullableEntryLinked* tail = NULL; + s32 var_a1; + RoomShapeCullableEntryLinked* iter; + RoomShapeCullableEntryLinked* insert; + f32 var_fv1; + s32 i; + Vec3f pos; + Vec3f projectedPos; + s32 pad2; -void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { - RoomMeshType1* mesh = &room->mesh->type1; - if (mesh->format == 1) { - func_8012DEE8(play, room, flags); - } else if (mesh->format == 2) { - func_8012E32C(play, room, flags); + OPEN_DISPS(play->state.gfxCtx); + + if (flags & ROOM_DRAW_OPA) { + func_800BCBF4(&sZeroVec, play); + + //! TODO: Fake + if (1) {} + if (1) {} + if (1) {} + + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + if (play->roomCtx.unk74 != NULL) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->roomCtx.unk74); + } + func_8012C268(play); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + } + + if (flags & ROOM_DRAW_XLU) { + func_800BCC68(&sZeroVec, play); + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + if (play->roomCtx.unk74 != NULL) { + gSPSegment(POLY_XLU_DISP++, 0x06, play->roomCtx.unk74); + } + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + } + + if ((room->enablePosLights != 0) || (MREG(93) != 0)) { + gSPSetGeometryMode(POLY_OPA_DISP++, G_LIGHTING_POSITIONAL); + gSPSetGeometryMode(POLY_XLU_DISP++, G_LIGHTING_POSITIONAL); + } + + roomShape = &room->roomShape->cullable; + roomShapeCullableEntry = Lib_SegmentedToVirtual(roomShape->entries); + insert = linkedEntriesBuffer; + + roomShapeCullableEntries = roomShapeCullableEntry; + + if (play->roomCtx.unk78 < 0) { + for (i = 0; i < roomShape->numEntries; i++, roomShapeCullableEntry++) { + if (R_ROOM_CULL_DEBUG_MODE != 0) { + if (((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_UP_TO_TARGET) && + (i <= R_ROOM_CULL_DEBUG_TARGET)) || + ((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) && (i == R_ROOM_CULL_DEBUG_TARGET))) { + if (flags & ROOM_DRAW_OPA) { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + + if (flags & ROOM_DRAW_XLU) { + displayList = roomShapeCullableEntry->xlu; + if (displayList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } else { + if (flags & ROOM_DRAW_OPA) { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + + if (flags & ROOM_DRAW_XLU) { + displayList = roomShapeCullableEntry->xlu; + if (displayList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } + } else { + f32 var_fa1 = 1.0f / play->projectionMtxFDiagonal.z; // sp54 + s32 pad5; + + // Pick and sort entries by depth + for (i = 0; i < roomShape->numEntries; i++, roomShapeCullableEntry++) { + + // Project the entry position, to get the depth it is at. + pos.x = roomShapeCullableEntry->boundsSphereCenter.x; + pos.y = roomShapeCullableEntry->boundsSphereCenter.y; + pos.z = roomShapeCullableEntry->boundsSphereCenter.z; + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &pos, &projectedPos); + + projectedPos.z *= var_fa1; + + var_fv1 = ABS_ALT(roomShapeCullableEntry->boundsSphereRadius); + + // If the entry bounding sphere isn't fully before the rendered depth range + if (-var_fv1 < projectedPos.z) { + + // Compute the depth of the nearest point in the entry's bounding sphere + entryBoundsNearZ = projectedPos.z - var_fv1; + + // If the entry bounding sphere isn't fully beyond the rendered depth range + if (entryBoundsNearZ < play->lightCtx.zFar) { + + // This entry will be rendered + insert->entry = roomShapeCullableEntry; + + if (roomShapeCullableEntry->boundsSphereRadius < 0) { + insert->boundsNearZ = FLT_MAX; + } else { + insert->boundsNearZ = entryBoundsNearZ; + } + + // Insert into the linked list, ordered by ascending depth of the nearest point in the bounding + // sphere + iter = head; + if (iter == NULL) { + head = tail = insert; + insert->prev = insert->next = NULL; + } else { + do { + if (insert->boundsNearZ < iter->boundsNearZ) { + break; + } + iter = iter->next; + } while (iter != NULL); + + if (iter == NULL) { + insert->prev = tail; + insert->next = NULL; + tail->next = insert; + tail = insert; + } else { + insert->prev = iter->prev; + if (insert->prev == NULL) { + head = insert; + } else { + insert->prev->next = insert; + } + iter->prev = insert; + insert->next = iter; + } + } + + insert++; + } + } + } + + //! FAKE: Similar trick used in OoT + R_ROOM_CULL_NUM_ENTRIES = roomShape->numEntries & 0xFFFF & 0xFFFF & 0xFFFF; + + // Draw entries, from nearest to furthest + i = 1; + + if (flags & ROOM_DRAW_OPA) { + for (; head != NULL; head = head->next, i++) { + s32 pad3; + RoomShapeCullableEntry* roomShapeCullableEntry; + + roomShapeCullableEntry = head->entry; + + if (R_ROOM_CULL_DEBUG_MODE != ROOM_CULL_DEBUG_MODE_OFF) { + // Debug mode drawing + + if (((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_UP_TO_TARGET) && + (i <= R_ROOM_CULL_DEBUG_TARGET)) || + ((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) && + (i == R_ROOM_CULL_DEBUG_TARGET))) { + + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + } else { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + } + } + + if (flags & ROOM_DRAW_XLU) { + for (; head != NULL; head = head->prev) { + f32 temp_fv0; + f32 temp_fv1; + + roomShapeCullableEntry = head->entry; + displayList = roomShapeCullableEntry->xlu; + + if (displayList != NULL) { + if (roomShapeCullableEntry->boundsSphereRadius & 1) { + + temp_fv0 = head->boundsNearZ - (f32)(iREG(93) + 0xBB8); + temp_fv1 = iREG(94) + 0x7D0; + + if (temp_fv0 < temp_fv1) { + if (temp_fv0 < 0.0f) { + var_a1 = 255; + } else { + var_a1 = 255 - (s32)((temp_fv0 / temp_fv1) * 255.0f); + } + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, var_a1); + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } else { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } + + R_ROOM_CULL_USED_ENTRIES = i - 1; + } + + CLOSE_DISPS(play->state.gfxCtx); +} +#else +void Room_DrawCullable(PlayState* play, Room* room, u32 flags); +#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_DrawCullable.s") +#endif + +#define ROOM_IMAGE_NODRAW_BACKGROUND (1 << 0) +#define ROOM_IMAGE_NODRAW_OPA (1 << 1) +#define ROOM_IMAGE_NODRAW_XLU (1 << 2) + +void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { + Camera* activeCam; + Gfx* gfx; + RoomShapeImageSingle* roomShape; + RoomShapeDListsEntry* entry; + u32 isFixedCamera; + u32 drawBackground; + u32 drawOpa; + u32 drawXlu; + + OPEN_DISPS(play->state.gfxCtx); + + activeCam = GET_ACTIVE_CAM(play); + isFixedCamera = false; // Condition is inferred from OoT + roomShape = &room->roomShape->image.single; + entry = Lib_SegmentedToVirtual(roomShape->base.entry); + drawBackground = (flags & ROOM_DRAW_OPA) && isFixedCamera && (roomShape->source != NULL) && + !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_BACKGROUND); + drawOpa = (flags & ROOM_DRAW_OPA) && (entry->opa != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_OPA); + drawXlu = (flags & ROOM_DRAW_XLU) && (entry->xlu != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_XLU); + + if (drawOpa || drawBackground) { + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + + if (drawOpa) { + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, entry->opa); + } + + if (drawBackground) { + gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2_fifo); + + gfx = POLY_OPA_DISP; + + { + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, activeCam); + + Prerender_DrawBackground2D( + &gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height, roomShape->fmt, + roomShape->siz, roomShape->tlutMode, roomShape->tlutCount, + (quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f, + quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f, 1.0f, 1.0f, 0); + } + + POLY_OPA_DISP = gfx; + + gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + } + } + + if (drawXlu) { + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_XLU_DISP++, entry->xlu); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomShapeImageMulti, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); + s32 bgCamIndex = activeCam->bgCamDataId; + s16 overrideBgCamIndex; + Player* player; + RoomShapeImageMultiBgEntry* bgEntry; + s32 i; + + overrideBgCamIndex = ((BgCamFuncData*)BgCheck_GetBgCamFuncDataImpl(&play->colCtx, bgCamIndex, BGCHECK_SCENE)) + ->roomImageOverrideBgCamIndex; + if (overrideBgCamIndex >= 0) { + bgCamIndex = overrideBgCamIndex; + } + + player = GET_PLAYER(play); + player->actor.params = (player->actor.params & 0xFF00) | bgCamIndex; + + bgEntry = Lib_SegmentedToVirtual(roomShapeImageMulti->backgrounds); + for (i = 0; i < roomShapeImageMulti->numBackgrounds; i++) { + if (bgEntry->bgCamIndex == bgCamIndex) { + return bgEntry; + } + bgEntry++; + } + + __assert("../z_room.c", 849); + + return NULL; +} + +void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) { + Camera* activeCam; + Gfx* gfx; + RoomShapeImageMulti* roomShape; + RoomShapeImageMultiBgEntry* bgEntry; + RoomShapeDListsEntry* dListsEntry; + u32 isFixedCamera; + u32 drawBackground; + u32 drawOpa; + u32 drawXlu; + + OPEN_DISPS(play->state.gfxCtx); + + activeCam = GET_ACTIVE_CAM(play); + isFixedCamera = false; // Condition is inferred from OoT + roomShape = &room->roomShape->image.multi; + dListsEntry = Lib_SegmentedToVirtual(roomShape->base.entry); + + bgEntry = Room_GetImageMultiBgEntry(roomShape, play); + + drawBackground = (flags & ROOM_DRAW_OPA) && isFixedCamera && (bgEntry->source != NULL) && + !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_BACKGROUND); + drawOpa = + (flags & ROOM_DRAW_OPA) && (dListsEntry->opa != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_OPA); + drawXlu = + (flags & ROOM_DRAW_XLU) && (dListsEntry->xlu != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_XLU); + + if (drawOpa || drawBackground) { + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + + if (drawOpa) { + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, dListsEntry->opa); + } + + if (drawBackground) { + gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2_fifo); + + gfx = POLY_OPA_DISP; + + { + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, activeCam); + Prerender_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height, + bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount, + (quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f, + quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f, 1.0f, 1.0f, + 0); + } + + POLY_OPA_DISP = gfx; + + gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + } + } + + if (drawXlu) { + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_XLU_DISP++, dListsEntry->xlu); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Room_DrawImage(PlayState* play, Room* room, u32 flags) { + RoomShapeImageBase* roomShape = &room->roomShape->image.base; + + if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_SINGLE) { + Room_DrawImageSingle(play, room, flags); + } else if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_MULTI) { + Room_DrawImageMulti(play, room, flags); } else { __assert("../z_room.c", 965); } @@ -64,31 +483,96 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { void Room_Init(PlayState* play, RoomContext* roomCtx) { s32 i; + roomCtx->curRoom.num = -1; roomCtx->curRoom.segment = NULL; roomCtx->unk78 = 1; roomCtx->unk79 = 0; - for (i = 0; i < 3; i++) { + for (i = 0; i < ARRAY_COUNT(roomCtx->unk7A); i++) { roomCtx->unk7A[i] = 0; } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_AllocateAndLoad.s") +size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) { + size_t maxRoomSize = 0; + size_t roomSize; + s32 i; + s32 j; + s32 frontRoom; + s32 backRoom; + size_t frontRoomSize; + size_t backRoomSize; + size_t cumulRoomSize; + s32 pad[2]; + + { + RomFile* roomList = play->roomList; + + for (i = 0; i < play->numRooms; i++) { + roomSize = roomList[i].vromEnd - roomList[i].vromStart; + maxRoomSize = MAX(roomSize, maxRoomSize); + } + } + + if ((u32)play->doorCtx.numTransitionActors != 0) { + RomFile* roomList = play->roomList; + TransitionActorEntry* transitionActor = &play->doorCtx.transitionActorList[0]; + + for (j = 0; j < play->doorCtx.numTransitionActors; j++) { + frontRoom = transitionActor->sides[0].room; + backRoom = transitionActor->sides[1].room; + frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; + backRoomSize = (backRoom < 0) ? 0 : roomList[backRoom].vromEnd - roomList[backRoom].vromStart; + cumulRoomSize = (frontRoom != backRoom) ? frontRoomSize + backRoomSize : frontRoomSize; + + maxRoomSize = MAX(cumulRoomSize, maxRoomSize); + transitionActor++; + } + } + + roomCtx->roomMemPages[0] = THA_AllocTailAlign16(&play->state.heap, maxRoomSize); + if (roomCtx->roomMemPages[0] == NULL) { + __assert("../z_room.c", 1078); + } + roomCtx->roomMemPages[1] = (void*)((uintptr_t)roomCtx->roomMemPages[0] + maxRoomSize); + roomCtx->activeMemPage = 0; + roomCtx->status = 0; + + if ((gSaveContext.respawnFlag != 0) && (gSaveContext.respawnFlag != -2) && (gSaveContext.respawnFlag != -7)) { + s32 respawnMode; + + if ((gSaveContext.respawnFlag == -8) || (gSaveContext.respawnFlag == -5) || (gSaveContext.respawnFlag == -4) || + ((gSaveContext.respawnFlag < 0) && (gSaveContext.respawnFlag != -1) && (gSaveContext.respawnFlag != -6))) { + respawnMode = RESPAWN_MODE_DOWN; + } else if (gSaveContext.respawnFlag < 0) { + respawnMode = RESPAWN_MODE_TOP; + } else { + respawnMode = gSaveContext.respawnFlag - 1; + } + frontRoom = gSaveContext.respawn[respawnMode].roomIndex; + } else { + frontRoom = play->setupEntranceList[play->curSpawn].room; + } + + Room_StartRoomTransition(play, roomCtx, frontRoom); + + return maxRoomSize; +} s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { - if (roomCtx->unk31 == 0) { - s32 size; + if (roomCtx->status == 0) { + size_t size; roomCtx->prevRoom = roomCtx->curRoom; roomCtx->curRoom.num = index; roomCtx->curRoom.segment = NULL; - roomCtx->unk31 = 1; + roomCtx->status = 1; size = play->roomList[index].vromEnd - play->roomList[index].vromStart; - roomCtx->activeRoomVram = (void*)(ALIGN16((u32)roomCtx->roomMemPages[roomCtx->activeMemPage] - + roomCtx->activeRoomVram = (void*)(ALIGN16((uintptr_t)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage - 7)); - osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1); + osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, ARRAY_COUNT(roomCtx->loadMsg)); DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0, &roomCtx->loadQueue, NULL); roomCtx->activeMemPage ^= 1; @@ -100,14 +584,13 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { } s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { - if (roomCtx->unk31 == 1) { - if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { - roomCtx->unk31 = 0; + if (roomCtx->status == 1) { + if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { + roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->activeRoomVram; - // TODO: Segment number enum - gSegments[0x03] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); + gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment); + Scene_ExecuteCommands(play, roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); @@ -127,11 +610,17 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { return 1; } +RoomDrawHandler sRoomDrawHandlers[] = { + Room_DrawNormal, // ROOM_SHAPE_TYPE_NORMAL + Room_DrawImage, // ROOM_SHAPE_TYPE_IMAGE + Room_DrawCullable, // ROOM_SHAPE_TYPE_CULLABLE + Room_DrawNone, // ROOM_SHAPE_TYPE_NONE +}; + void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { - // TODO: Segment number enum - gSegments[0x03] = VIRTUAL_TO_PHYSICAL(room->segment); - roomDrawFuncs[room->mesh->type0.type](play, room, flags); + gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); + sRoomDrawHandlers[room->roomShape->base.type](play, room, flags); } return; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 48c360107..1fa3ed54a 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -48,7 +48,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; } // clang-format on - objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&gameState->heap, spaceSize); + objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocTailAlign16(&gameState->heap, spaceSize); objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP); @@ -141,7 +141,7 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) { } // SceneTableEntry Header Command 0x00: Spawn List -void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { s32 loadedCount; s16 playerObjectId; void* nextObject; @@ -168,19 +168,19 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x01: Actor List -void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) { play->numSetupActors = cmd->actorList.num; play->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment); - play->actorCtx.unkC = 0; + play->actorCtx.halfDaysBit = 0; } // SceneTableEntry Header Command 0x02: List of camera data for actor cutscenes -void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { play->actorCsCamList = Lib_SegmentedToVirtual(cmd->actorCsCamList.segment); } // SceneTableEntry Header Command 0x03: Collision Header -void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { +void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) { CollisionHeader* colHeaderTemp; CollisionHeader* colHeader; @@ -205,18 +205,18 @@ void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x04: Room List -void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) { play->numRooms = cmd->roomList.num; play->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment); } // SceneTableEntry Header Command 0x06: Entrance List -void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) { play->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment); } // SceneTableEntry Header Command 0x07: Special Files -void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { // @note These quest hint files are identical to OoT's. // They are not relevant in this game and the system to process these scripts has been removed. static RomFile naviQuestHintFiles[2] = { @@ -236,22 +236,22 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x08: Room Behavior -void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { - play->roomCtx.curRoom.unk3 = cmd->roomBehavior.gpFlag1; - play->roomCtx.curRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; - play->roomCtx.curRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 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.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; play->roomCtx.curRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1; } // SceneTableEntry Header Command 0x0A: Mesh Header -void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) { - play->roomCtx.curRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); +void Scene_CommandMesh(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.roomShape = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List -void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -277,7 +277,7 @@ void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { } play->objectCtx.num = i; - func_800BA6FC(play, &play->actorCtx); + Actor_KillAllWithMissingObject(play, &play->actorCtx); continue; } @@ -304,7 +304,7 @@ void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0C: Light List -void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = Lib_SegmentedToVirtual(cmd->lightList.segment); @@ -315,12 +315,12 @@ void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0D: Path List -void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { play->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment); } // SceneTableEntry Header Command 0x0E: Transition Actor List -void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandTransiActorList(PlayState* play, SceneCmd* cmd) { play->doorCtx.numTransitionActors = cmd->transiActorList.num; play->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); func_80105818(play, play->doorCtx.numTransitionActors, play->doorCtx.transitionActorList); @@ -332,7 +332,7 @@ void Door_InitContext(GameState* state, DoorContext* doorCtx) { } // SceneTableEntry Header Command 0x0F: Environment Light Settings List -void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEnvLightSettings(PlayState* play, SceneCmd* cmd) { play->envCtx.numLightSettings = cmd->lightSettingList.num; play->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment); } @@ -357,13 +357,13 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) { size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart; if (size != 0) { - play->roomCtx.unk74 = THA_AllocEndAlign16(&play->state.heap, size); + play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.heap, size); DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size); } } // SceneTableEntry Header Command 0x11: Skybox Settings -void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) { play->skyboxId = cmd->skyboxSettings.skyboxId & 3; play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk5; play->envCtx.unk_1E = cmd->skyboxSettings.unk6; @@ -371,13 +371,13 @@ void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x12: Skybox Disables -void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) { play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4; play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5; } // SceneTableEntry Header Command 0x10: Time Settings -void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.save.time = CLOCK_TIME_ALT2_F(cmd->timeSettings.hour, cmd->timeSettings.min); @@ -418,7 +418,7 @@ void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x05: Wind Settings -void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) { s8 temp1 = cmd->windSettings.west; s8 temp2 = cmd->windSettings.vertical; s8 temp3 = cmd->windSettings.south; @@ -430,32 +430,32 @@ void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x13: Exit List -void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) { play->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment); } // SceneTableEntry Header Command 0x09: Undefined -void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) { +void Scene_Command09(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x15: Sound Settings= -void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) { play->sequenceCtx.seqId = cmd->soundSettings.seqId; play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId; if (gSaveContext.seqId == (u8)NA_BGM_DISABLED || - Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { + AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { Audio_SetSpec(cmd->soundSettings.specId); } } // SceneTableEntry Header Command 0x16: Echo Setting -void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEchoSetting(PlayState* play, SceneCmd* cmd) { play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } // SceneTableEntry Header Command 0x18: Alternate Header List= -void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; @@ -464,40 +464,40 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { altHeader = altHeaderList[gSaveContext.sceneLayer - 1]; if (altHeader != NULL) { - Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader)); + Scene_ExecuteCommands(play, Lib_SegmentedToVirtual(altHeader)); (cmd + 1)->base.code = 0x14; } } } // SceneTableEntry Header Command 0x17: Cutscene List -void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount; play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List -void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd) { ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); } // SceneTableEntry Header Command 0x1C: Mini Maps -void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd) { func_80104CF4(play); func_8010549C(play, cmd->minimapSettings.segment); } // SceneTableEntry Header Command 0x1D: Undefined -void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd) { +void Scene_Command1D(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info -void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); } // SceneTableEntry Header Command 0x19: Sets Region Visited Flag -void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -525,7 +525,7 @@ void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1A: Material Animations -void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd) { +void Scene_CommandAnimatedMaterials(PlayState* play, SceneCmd* cmd) { play->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment); } @@ -536,57 +536,58 @@ void Scene_SetExitFade(PlayState* play) { play->transitionType = Entrance_GetTransitionFlags(play->nextEntrance) & 0x7F; } +void (*sSceneCmdHandlers[])(PlayState*, SceneCmd*) = { + Scene_CommandSpawnList, + Scene_CommandActorList, + Scene_CommandActorCutsceneCamList, + Scene_CommandCollisionHeader, + Scene_CommandRoomList, + Scene_CommandWindSettings, + Scene_CommandEntranceList, + Scene_CommandSpecialFiles, + Scene_CommandRoomBehavior, + Scene_Command09, + Scene_CommandMesh, + Scene_CommandObjectList, + Scene_CommandLightList, + Scene_CommandPathList, + Scene_CommandTransiActorList, + Scene_CommandEnvLightSettings, + Scene_CommandTimeSettings, + Scene_CommandSkyboxSettings, + Scene_CommandSkyboxDisables, + Scene_CommandExitList, + NULL, + Scene_CommandSoundSettings, + Scene_CommandEchoSetting, + Scene_CommandCutsceneList, + Scene_CommandAltHeaderList, + Scene_CommandSetRegionVisitedFlag, + Scene_CommandAnimatedMaterials, + Scene_CommandActorCutsceneList, + Scene_CommandMiniMap, + Scene_Command1D, + Scene_CommandMiniMapCompassInfo, +}; + /** * Executes all of the commands in a scene or room header. */ -s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { - static void (*sceneCmdHandlers[])(PlayState*, SceneCmd*) = { - Scene_HeaderCmdSpawnList, - Scene_HeaderCmdActorList, - Scene_HeaderCmdActorCutsceneCamList, - Scene_HeaderCmdColHeader, - Scene_HeaderCmdRoomList, - Scene_HeaderCmdWindSettings, - Scene_HeaderCmdEntranceList, - Scene_HeaderCmdSpecialFiles, - Scene_HeaderCmdRoomBehavior, - Scene_HeaderCmd09, - Scene_HeaderCmdMesh, - Scene_HeaderCmdObjectList, - Scene_HeaderCmdLightList, - Scene_HeaderCmdPathList, - Scene_HeaderCmdTransiActorList, - Scene_HeaderCmdEnvLightSettings, - Scene_HeaderCmdTimeSettings, - Scene_HeaderCmdSkyboxSettings, - Scene_HeaderCmdSkyboxDisables, - Scene_HeaderCmdExitList, - NULL, - Scene_HeaderCmdSoundSettings, - Scene_HeaderCmdEchoSetting, - Scene_HeaderCmdCutsceneList, - Scene_HeaderCmdAltHeaderList, - Scene_HeaderCmdSetRegionVisitedFlag, - Scene_HeaderCmdAnimatedMaterials, - Scene_HeaderCmdActorCutsceneList, - Scene_HeaderCmdMiniMap, - Scene_HeaderCmd1D, - Scene_HeaderCmdMiniMapCompassInfo, - }; +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) { u32 cmdId; while (true) { - cmdId = header->base.code; + cmdId = sceneCmd->base.code; if (cmdId == SCENE_CMD_ID_END) { break; } if (cmdId < SCENE_CMD_MAX) { - sceneCmdHandlers[cmdId](play, header); + sSceneCmdHandlers[cmdId](play, sceneCmd); } - header++; + sceneCmd++; } return 0; diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index c899b4d83..6ec3f2b80 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" s32 sMatAnimStep; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 318f49809..9890f4741 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #define ANIM_INTERP 1 @@ -629,7 +630,8 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount frameTable->x = jointIndices->x >= staticIndexMax ? dynamicData[jointIndices->x] : frameData[jointIndices->x]; frameTable->y = jointIndices->y >= staticIndexMax ? dynamicData[jointIndices->y] : frameData[jointIndices->y]; frameTable->z = jointIndices->z >= staticIndexMax ? dynamicData[jointIndices->z] : frameData[jointIndices->z]; - jointIndices++, frameTable++; + jointIndices++; + frameTable++; } } @@ -1576,7 +1578,7 @@ void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHead skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount); // Debug prints here, required to match. - if (1) {}; + if (1) {} if (animation != NULL) { Animation_PlayLoop(skelAnime, animation); diff --git a/src/code/z_skin.c b/src/code/z_skin.c index 0d3e0bf85..9bfd8d566 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64skin.h" diff --git a/src/code/z_snap.c b/src/code/z_snap.c index d64cfbe6e..e9663b02f 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -42,9 +42,8 @@ s32 Snap_RecordPictographedActors(PlayState* play) { break; } - if (actor->id) { - ; // Needed to match - } + //! FAKE: + if (1) {} // Actors which may be pictographed anywhere switch (actor->id) { diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 94d0e69c3..c32a76d76 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "overlays/gamestates/ovl_file_choose/z_file_choose.h" @@ -1599,7 +1600,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { if (gSaveContext.unk_3F3F) { - sramCtx->saveBuf = THA_AllocEndAlign16(&gameState->heap, SAVE_BUFFER_SIZE); + sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->heap, SAVE_BUFFER_SIZE); sramCtx->status = 0; } } diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 8f412364d..6650f41a7 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -517,7 +517,7 @@ Actor* SubS_FindNearestActor(Actor* actor, PlayState* play, u8 actorCategory, s1 actorIter = actorTmp; if (actorIter != actor) { - dist = Actor_DistanceBetweenActors(actor, actorIter); + dist = Actor_WorldDistXYZToActor(actor, actorIter); if (!isSetup || dist < minDist) { closestActor = actorIter; minDist = dist; @@ -762,7 +762,7 @@ s32 SubS_WeightPathing_Move(Actor* actor, Path* path, s32* waypoint, f32* progre } while (true) { if (!SubS_WeightPathing_ComputePoint(path, *waypoint, &point, *progress, direction) || - ((s32)(actor->speedXZ * 10000.0f) == 0)) { + ((s32)(actor->speed * 10000.0f) == 0)) { return false; } dist = Math_Vec3f_DistXZ(&actor->world.pos, &point); @@ -828,7 +828,7 @@ s32 func_8013C964(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 it case 1: yRange = fabsf(actor->playerHeightRel) + 1.0f; xzRange = actor->xzDistToPlayer + 1.0f; - ret = Actor_PickUp(actor, play, itemId, xzRange, yRange); + ret = Actor_OfferGetItem(actor, play, itemId, xzRange, yRange); break; case 2: @@ -1522,7 +1522,7 @@ s32 func_8013E748(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 ex s32 SubS_ActorAndPlayerFaceEachOther(PlayState* play, Actor* actor, void* data) { Player* player = GET_PLAYER(play); Vec3s* yawTols = (Vec3s*)data; - s16 playerYaw = ABS(BINANG_SUB(Actor_YawBetweenActors(&player->actor, actor), player->actor.shape.rot.y)); + s16 playerYaw = ABS(BINANG_SUB(Actor_WorldYawTowardActor(&player->actor, actor), player->actor.shape.rot.y)); s16 actorYaw = ABS(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); s32 areFacing = false; s32 actorYawTol = ABS(yawTols->y); diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index f42e66a25..911e3e757 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -188,10 +188,10 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) size_t size; void* segment; - skyboxCtx->rotZ = 0.0f; + skyboxCtx->rot.z = 0.0f; switch (skyboxId) { - case 1: + case SKYBOX_NORMAL_SKY: // Send a DMA request for the cloudy sky texture skyboxCtx->staticSegments[0] = &D_80025D00; size = SEGMENT_ROM_SIZE(d2_cloud_static); @@ -210,21 +210,21 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) segment = (void*)ALIGN8((uintptr_t)segment + size); DmaMgr_SendRequest0(skyboxCtx->paletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size); - skyboxCtx->primR = 145; - skyboxCtx->primG = 120; - skyboxCtx->primB = 155; + skyboxCtx->prim.r = 145; + skyboxCtx->prim.g = 120; + skyboxCtx->prim.b = 155; - skyboxCtx->envR = 40; - skyboxCtx->envG = 0; - skyboxCtx->envB = 40; + skyboxCtx->env.r = 40; + skyboxCtx->env.g = 0; + skyboxCtx->env.b = 40; // Inverted Stone Tower Temple and Inverted Stone Tower if ((play->sceneId == SCENE_F41) || (play->sceneId == SCENE_INISIE_R)) { - skyboxCtx->rotZ = 3.15f; + skyboxCtx->rot.z = 3.15f; } break; - case 2: + case SKYBOX_2: break; default: @@ -236,7 +236,7 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { size_t size; switch (skyboxId) { - case 1: + case SKYBOX_NORMAL_SKY: osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); if (play->envCtx.unk_10 == 0) { @@ -289,20 +289,20 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) { skyboxCtx->skyboxShouldDraw = false; - skyboxCtx->rotX = skyboxCtx->rotY = skyboxCtx->rotZ = 0.0f; + skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f; Skybox_Setup(gameState, skyboxCtx, skyboxId); - if (skyboxId != 0) { - skyboxCtx->dListBuf = THA_AllocEndAlign16(&gameState->heap, 0x3840); + if (skyboxId != SKYBOX_NONE) { + skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->heap, 0x3840); - if (skyboxId == 5) { + if (skyboxId == SKYBOX_CUTSCENE_MAP) { // Allocate enough space for the vertices for a 6 sided skybox (cube) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6); + skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6); func_80143148(skyboxCtx, 6); } else { // Allocate enough space for the vertices for a 5 sided skybox (bottom is missing) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5); + skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5); func_80143148(skyboxCtx, 5); } } diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index e0884e270..489f596e5 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -2,25 +2,25 @@ Mtx* sSkyboxDrawMatrix; -Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) { +Mtx* Skybox_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) { Matrix_Translate(x, y, z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateXFApply(skyboxCtx->rotX); - Matrix_RotateYF(skyboxCtx->rotY, MTXMODE_APPLY); - Matrix_RotateZF(skyboxCtx->rotZ, MTXMODE_APPLY); + Matrix_RotateXFApply(skyboxCtx->rot.x); + Matrix_RotateYF(skyboxCtx->rot.y, MTXMODE_APPLY); + Matrix_RotateZF(skyboxCtx->rot.z, MTXMODE_APPLY); return Matrix_ToMtx(sSkyboxDrawMatrix); } -void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { - skyboxCtx->primR = primR; - skyboxCtx->primG = primG; - skyboxCtx->primB = primB; - skyboxCtx->envR = envR; - skyboxCtx->envG = envG; - skyboxCtx->envB = envB; +void Skybox_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { + skyboxCtx->prim.r = primR; + skyboxCtx->prim.g = primG; + skyboxCtx->prim.b = primB; + skyboxCtx->env.r = envR; + skyboxCtx->env.g = envG; + skyboxCtx->env.b = envB; } -void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) { +void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z) { OPEN_DISPS(gfxCtx); func_8012C6AC(gfxCtx); @@ -32,9 +32,9 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb Matrix_Translate(x, y, z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateXFApply(skyboxCtx->rotX); - Matrix_RotateYF(skyboxCtx->rotY, MTXMODE_APPLY); - Matrix_RotateZF(skyboxCtx->rotZ, MTXMODE_APPLY); + Matrix_RotateXFApply(skyboxCtx->rot.x); + Matrix_RotateYF(skyboxCtx->rot.y, MTXMODE_APPLY); + Matrix_RotateZF(skyboxCtx->rot.z, MTXMODE_APPLY); Matrix_ToMtx(sSkyboxDrawMatrix); gSPMatrix(POLY_OPA_DISP++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -45,8 +45,8 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb gDPSetTextureConvert(POLY_OPA_DISP++, G_TC_FILT); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, TEXEL0, PRIMITIVE_ALPHA, TEXEL0, TEXEL1, TEXEL0, PRIMITIVE, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, skyboxCtx->primR, skyboxCtx->primG, skyboxCtx->primB, blend); - gDPSetEnvColor(POLY_OPA_DISP++, skyboxCtx->envR, skyboxCtx->envG, skyboxCtx->envB, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, skyboxCtx->prim.r, skyboxCtx->prim.g, skyboxCtx->prim.b, blend); + gDPSetEnvColor(POLY_OPA_DISP++, skyboxCtx->env.r, skyboxCtx->env.g, skyboxCtx->env.b, 0); gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[0]); gSPDisplayList(POLY_OPA_DISP++, &skyboxCtx->dListBuf[2]); @@ -63,5 +63,5 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb CLOSE_DISPS(gfxCtx); } -void SkyboxDraw_Update(SkyboxContext* skyboxCtx) { +void Skybox_Update(SkyboxContext* skyboxCtx) { } diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 163756e07..061c01b0a 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -34,7 +34,7 @@ void osContGetReadData(OSContPad* data) { data->stick_x = readformat.stick_x; data->stick_y = readformat.stick_y; } - }; + } } void __osPackReadData() { diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c index 3d618de74..fefffd653 100644 --- a/src/libultra/io/pimgr.c +++ b/src/libultra/io/pimgr.c @@ -1,9 +1,10 @@ #include "global.h" +#include "stack.h" OSPiHandle D_8009D130; OSPiHandle D_8009D1A8; -OSThread D_8009D220; -u8 piManagerStack[0x1000]; +OSThread sPiMgrThread; +STACK(sPiMgrStack, 0x1000); OSMesgQueue D_8009E3D0; OSMesg D_8009E3E8[1]; @@ -27,14 +28,14 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC } savedMask = __osDisableInt(); __osPiDevMgr.active = 1; - __osPiDevMgr.thread = &D_8009D220; + __osPiDevMgr.thread = &sPiMgrThread; __osPiDevMgr.cmdQueue = cmdQ; __osPiDevMgr.evtQueue = &D_8009E3D0; __osPiDevMgr.acsQueue = &__osPiAccessQueue; __osPiDevMgr.piDmaCallback = __osPiRawStartDma; __osPiDevMgr.epiDmaCallback = __osEPiRawStartDma; - osCreateThread(&D_8009D220, 0, __osDevMgrMain, (void*)&__osPiDevMgr, &piManagerStack[4096], pri); - osStartThread(&D_8009D220); + osCreateThread(&sPiMgrThread, 0, __osDevMgrMain, &__osPiDevMgr, STACK_TOP(sPiMgrStack), pri); + osStartThread(&sPiMgrThread); __osRestoreInt(savedMask); if (oldPri != -1) { osSetThreadPri(NULL, oldPri); diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index aeaaf0f82..8445f53b0 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -3,7 +3,8 @@ #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ ptr = (void*)osVirtualToPhysical(ptr); \ - } + } \ + (void)0 static OSTask sTmpTask; diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index 07babf351..ad9cbffd8 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -1,8 +1,9 @@ #include "global.h" +#include "stack.h" #include "osint.h" OSThread viThread; -u8 viThreadStack[0x1000]; +STACK(sViStack, 0x1000); OSMesgQueue viEventQueue; OSMesg viEventBuf[6]; OSIoMesg viRetraceMsg; @@ -45,7 +46,7 @@ void osCreateViManager(OSPri pri) { __osViDevMgr.piDmaCallback = NULL; __osViDevMgr.epiDmaCallback = NULL; - osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack + sizeof(viThreadStack), pri); + osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, STACK_TOP(sViStack), pri); __osViInit(); osStartThread(&viThread); __osRestoreInt(prevInt); diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 9fbf5ff64..776191227 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -39,12 +39,9 @@ void osInitialize(void) { __osSetFpcCsr(0x01000800); __osSetWatchLo(0x04900000); - while (__osSiRawReadIo(0x1FC007FC, &pifdata)) { - ; - } - while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) { - ; - } + while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {} + + while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {} *(struct_exceptionPreamble*)0x80000000 = *((struct_exceptionPreamble*)__osExceptionPreamble); *(struct_exceptionPreamble*)0x80000080 = *((struct_exceptionPreamble*)__osExceptionPreamble); @@ -72,9 +69,7 @@ void osInitialize(void) { } if (__osGetCause() & 0x1000) { - while (1) { - ; - } + while (true) {} } HW_REG(AI_CONTROL_REG, u32) = 1; diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index c6de3c3e4..77f568a02 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -21,9 +21,9 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes saveMask = __osDisableInt(); if (__osTimerList->next != __osTimerList) { - if (0) { - ; - } + //! FAKE: + if (1) {} + spC = __osTimerList->next; sp14 = osGetCount(); sp10 = sp14 - __osTimerCounter; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 87f7129df..6b112e952 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -29,7 +29,7 @@ void __osTimerInterrupt(void) { if (__osTimerList->next == __osTimerList) { return; } - while (1) { + while (true) { t = __osTimerList->next; if (t == __osTimerList) { __osSetCompare(0); @@ -84,9 +84,8 @@ OSTime __osInsertTimer(OSTimer* t) { savedMask = __osDisableInt(); for (timep = __osTimerList->next, tim = t->value; timep != __osTimerList && tim > timep->value; - tim -= timep->value, timep = timep->next) { - ; - } + tim -= timep->value, timep = timep->next) {} + t->value = tim; if (timep != __osTimerList) { timep->value -= tim; diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index d8e7edb67..a3608277f 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -14,9 +14,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { if (ret != CONT_ERR_CONTRFAIL) { __osContPifRam.status = CONT_CMD_READ_BUTTON; - for (i = 0; i < port; i++, *ptr++ = 0) { - ; - } + for (i = 0; i < port; i++, *ptr++ = 0) {} *ptr++ = 1; *ptr++ = 3; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index e3ac3e753..e271449b5 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -109,7 +109,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) { Player* player = (Player*)this->actor.parent; if (Player_IsHoldingHookshot(player)) { - if ((player->itemAction != player->heldItemAction) || (player->actor.flags & ACTOR_FLAG_100) || + if ((player->itemAction != player->heldItemAction) || (player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_4000000))) { this->timer = 0; ArmsHook_DetachHookFromActor(this); @@ -168,7 +168,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { grabbed = NULL; this->grabbed = NULL; } else if (this->actor.child != NULL) { - f32 sp94 = Actor_DistanceBetweenActors(&this->actor, grabbed); + f32 sp94 = Actor_WorldDistXYZToActor(&this->actor, grabbed); f32 sp90 = sqrtf(SQXYZ(this->unk1FC)); Math_Vec3f_Diff(&grabbed->world.pos, &this->unk1FC, &this->actor.world.pos); @@ -238,7 +238,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff); Math_Vec3f_Sum(&this->unk1E0, &prevFrameDiff, &this->unk1E0); - this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speedXZ, -this->actor.velocity.y); + this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speed, -this->actor.velocity.y); sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x); sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y); sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z); diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 41a3f25ec..971b778be 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -186,7 +186,7 @@ void FireArrow_Fly(ArrowFire* this, PlayState* play) { FireArrow_Lerp(&this->firedPos, &this->actor.world.pos, 0.05f); if (arrow->unk_261 & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_EXPLOSION_FRAME); + Actor_PlaySfx(&this->actor, NA_SE_IT_EXPLOSION_FRAME); ArrowFire_SetupAction(this, FireArrow_Hit); this->timer = 32; this->alpha = 255; diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 5c5cd0c87..62c97ccde 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -160,7 +160,7 @@ void ArrowIce_Fly(ArrowIce* this, PlayState* play) { ArrowIce_LerpFiredPosition(&this->firedPos, &this->actor.world.pos, 0.05f); if (arrow->unk_261 & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_EXPLOSION_ICE); + Actor_PlaySfx(&this->actor, NA_SE_IT_EXPLOSION_ICE); ArrowIce_SetupAction(this, ArrowIce_Hit); this->timer = 32; this->alpha = 255; diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index b7918b5b4..360afa4ac 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -154,7 +154,7 @@ void ArrowLight_Fly(ArrowLight* this, PlayState* play) { ArrowLight_Lerp(&this->firedPos, &this->actor.world.pos, 0.05f); if (arrow->unk_261 & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_EXPLOSION_LIGHT); + Actor_PlaySfx(&this->actor, NA_SE_IT_EXPLOSION_LIGHT); ArrowLight_SetupAction(this, ArrowLight_Hit); this->timer = 32; this->alpha = 255; diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index dcf37d848..647fabf73 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -184,7 +184,7 @@ void func_80C0A458(BgAstrBombwall* this, PlayState* play) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80C0A120(this, play); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80C0A4BC; } diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index 032091293..ef2ca5273 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -343,7 +343,7 @@ void BgCraceMovebg_ClosingDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* pl this->targetDoorHeight = 0.0f; this->doorHeight = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); this->actionFunc = BgCraceMovebg_ClosingDoor_DoNothing; } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 68b2d77d2..533ce6292 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -108,7 +108,7 @@ void BgCtowerGear_Splash(BgCtowerGear* this, PlayState* play) { } } } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WATERWHEEL_LEVEL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WATERWHEEL_LEVEL); } } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index 85dcb0aca..5cc9d4b8d 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -99,7 +99,7 @@ void BgCtowerRot_DoorDoNothing(BgCtowerRot* this, PlayState* play) { void BgCtowerRot_DoorClose(BgCtowerRot* this, PlayState* play) { if (!Math_SmoothStepToF(&this->timer, 0.0f, 0.1f, 15.0f, 0.1f)) { if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); ActorCutscene_Stop(this->dyna.actor.cutscene); } this->actionFunc = BgCtowerRot_DoorDoNothing; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index c962cf8ef..064b14f7b 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -485,7 +485,7 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { this->unk_178 *= -0.6f; this->unk_17C++; if (this->unk_182) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_WATER_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SEESAW_WATER_BOUND); sp5C = this->unk_15C; Matrix_Push(); Matrix_RotateYS(BINANG_SUB(this->dyna.actor.shape.rot.y, 0x4000), MTXMODE_NEW); @@ -498,7 +498,7 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { func_80B8296C(play, &sp50, 70.0f); } else { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); } } else { this->dyna.actor.shape.rot.z = 0x1C72; @@ -510,7 +510,7 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { this->unk_178 *= -0.6f; this->unk_17C++; if (this->unk_182) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_WATER_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SEESAW_WATER_BOUND); sp3C = this->unk_160; Matrix_Push(); Matrix_RotateYS(BINANG_ADD(this->dyna.actor.shape.rot.y, 0x4000), MTXMODE_NEW); @@ -523,7 +523,7 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { func_80B8296C(play, &sp30, 47.0f); } else { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SEESAW_BOUND); } } else { this->dyna.actor.shape.rot.z = -0x1C72; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 45b42942b..63c61e82f 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -4,6 +4,7 @@ * Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools */ +#include "prevent_bss_reordering.h" #include "z_bg_dblue_movebg.h" #include "objects/object_dblue_object/object_dblue_object.h" #include "overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h" @@ -218,7 +219,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { } else { this->unk_18C = 0; } - this->dyna.actor.shape.rot.y += (s16)((this->unk_18C / 10.0f) * (0x10000 / 360.0f)); + this->dyna.actor.shape.rot.y += DEG_TO_BINANG(this->unk_18C / 10.0f); this->actionFunc = func_80A2A714; break; @@ -244,7 +245,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { this->dyna.actor.draw = func_80A2B308; this->unk_17E = 0; this->unk_184 = 0.0f; - this->dyna.actor.shape.rot.y += (s16)((this->unk_18C / 10.0f) * (0x10000 / 360.0f)); + this->dyna.actor.shape.rot.y += DEG_TO_BINANG(this->unk_18C / 10.0f); this->actionFunc = func_80A2A32C; break; @@ -422,7 +423,7 @@ void func_80A2A444(BgDblueMovebg* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_10; this->dyna.pushForce = 0.0f; Flags_SetSwitch(play, this->unk_1C0); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); if (func_80A29A80(play, this->unk_1C8, this->unk_1C4)) { this->unk_172 |= 1; @@ -524,7 +525,7 @@ void func_80A2A7F8(BgDblueMovebg* this, PlayState* play) { this->unk_18A = 0; this->unk_17E = 0; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); if (func_80A29A80(play, this->unk_1C8, this->unk_1C4)) { this->unk_172 |= 1; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c index b4c97fdde..3ba003ee5 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c @@ -223,7 +223,7 @@ void func_80B841A0(BgDblueWaterfall* this, PlayState* play) { EffectSsGSplash_Spawn(play, &sp94, NULL, NULL, 0, 250); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_REFLECTION_WATER); + Actor_PlaySfx(&this->actor, NA_SE_IT_REFLECTION_WATER); } } diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c index 6ec845e2c..124469557 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c @@ -164,7 +164,7 @@ void BgDkjailIvy_BeginCutscene(BgDkjailIvy* this, PlayState* play) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); Flags_SetSwitch(play, BG_DKJAIL_GET_SWITCH(&this->dyna.actor)); BgDkjailIvy_IvyCutEffects(this, play); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_GRASS_WALL_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GRASS_WALL_BROKEN); BgDkjailIvy_SetupFadeOut(this); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index 71aa958dc..e6b18c220 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -148,7 +148,7 @@ s32 func_80BC3B00(BgF40Block* this) { } } - if (Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &sp28, this->dyna.actor.speedXZ) <= 0.0f) { + if (Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &sp28, this->dyna.actor.speed) <= 0.0f) { this->unk_168 = 6; this->unk_160 = this->unk_164; return true; @@ -182,26 +182,26 @@ s32 func_80BC3D08(BgF40Block* this, PlayState* play, s32 arg2) { if (arg2 != 0) { sp48.x = - (D_80BC4620[this->unk_168].x * ((800.0f * this->dyna.actor.scale.x) - (this->dyna.actor.speedXZ * 0.5f))) + + (D_80BC4620[this->unk_168].x * ((800.0f * this->dyna.actor.scale.x) - (this->dyna.actor.speed * 0.5f))) + this->dyna.actor.world.pos.x; sp48.y = - (D_80BC4620[this->unk_168].y * ((800.0f * this->dyna.actor.scale.y) - (this->dyna.actor.speedXZ * 0.5f))) + + (D_80BC4620[this->unk_168].y * ((800.0f * this->dyna.actor.scale.y) - (this->dyna.actor.speed * 0.5f))) + this->dyna.actor.world.pos.y; sp48.z = - (D_80BC4620[this->unk_168].z * ((800.0f * this->dyna.actor.scale.z) - (this->dyna.actor.speedXZ * 0.5f))) + + (D_80BC4620[this->unk_168].z * ((800.0f * this->dyna.actor.scale.z) - (this->dyna.actor.speed * 0.5f))) + this->dyna.actor.world.pos.z; - sp3C.x = (D_80BC4620[this->unk_168].x * this->dyna.actor.speedXZ) + sp48.x; - sp3C.y = (D_80BC4620[this->unk_168].y * this->dyna.actor.speedXZ) + sp48.y; - sp3C.z = (D_80BC4620[this->unk_168].z * this->dyna.actor.speedXZ) + sp48.z; + sp3C.x = (D_80BC4620[this->unk_168].x * this->dyna.actor.speed) + sp48.x; + sp3C.y = (D_80BC4620[this->unk_168].y * this->dyna.actor.speed) + sp48.y; + sp3C.z = (D_80BC4620[this->unk_168].z * this->dyna.actor.speed) + sp48.z; } else { sp3C.x = (D_80BC4620[this->unk_168].x * 800.0f * this->dyna.actor.scale.x) + this->dyna.actor.world.pos.x; sp3C.y = (D_80BC4620[this->unk_168].y * 800.0f * this->dyna.actor.scale.y) + this->dyna.actor.world.pos.y; sp3C.z = (D_80BC4620[this->unk_168].z * 800.0f * this->dyna.actor.scale.z) + this->dyna.actor.world.pos.z; - sp48.x = sp3C.x - (D_80BC4620[this->unk_168].x * this->dyna.actor.speedXZ * 1.5f); - sp48.y = sp3C.y - (D_80BC4620[this->unk_168].y * this->dyna.actor.speedXZ * 1.5f); - sp48.z = sp3C.z - (D_80BC4620[this->unk_168].z * this->dyna.actor.speedXZ * 1.5f); + sp48.x = sp3C.x - (D_80BC4620[this->unk_168].x * this->dyna.actor.speed * 1.5f); + sp48.y = sp3C.y - (D_80BC4620[this->unk_168].y * this->dyna.actor.speed * 1.5f); + sp48.z = sp3C.z - (D_80BC4620[this->unk_168].z * this->dyna.actor.speed * 1.5f); } if (BgCheck_AnyLineTest1(&play->colCtx, &sp48, &sp3C, &sp30, &sp54, true)) { @@ -240,11 +240,11 @@ void BgF40Block_Init(Actor* thisx, PlayState* play) { if (this->path != NULL) { if (Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCHFLAG(&this->dyna.actor))) { this->actionFunc = func_80BC4530; - this->dyna.actor.speedXZ = 40.0f; + this->dyna.actor.speed = 40.0f; func_80BC3A2C(this, play); } else { this->actionFunc = func_80BC4380; - this->dyna.actor.speedXZ = 20.0f; + this->dyna.actor.speed = 20.0f; func_80BC3980(this, play); } } else { @@ -272,20 +272,20 @@ void func_80BC41AC(BgF40Block* this, PlayState* play) { void func_80BC4228(BgF40Block* this, PlayState* play) { if (func_80BC3B00(this)) { - this->dyna.actor.speedXZ = 20.0f; + this->dyna.actor.speed = 20.0f; if (this->unk_160 < (this->path->count - 1)) { this->unk_164 = this->unk_160 + 1; } else { this->actionFunc = func_80BC4530; ActorCutscene_Stop(this->dyna.actor.cutscene); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); } } if (func_80BC3D08(this, play, 0)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->actionFunc = func_80BC41AC; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); return; } @@ -332,20 +332,20 @@ void func_80BC43CC(BgF40Block* this, PlayState* play) { void func_80BC4448(BgF40Block* this, PlayState* play) { if (func_80BC3B00(this)) { - this->dyna.actor.speedXZ = 40.0f; + this->dyna.actor.speed = 40.0f; if (this->unk_160 > 0) { this->unk_164 = this->unk_160 - 1; } else { this->actionFunc = func_80BC4380; ActorCutscene_Stop(this->dyna.actor.cutscene); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); } } if (func_80BC3D08(this, play, 0)) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->actionFunc = func_80BC43CC; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); } } diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c index 3a7916e7d..558c77064 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c @@ -129,7 +129,7 @@ void BgF40Switch_Destroy(Actor* thisx, PlayState* play) { void BgF40Switch_Unpress(BgF40Switch* this, PlayState* play) { this->dyna.actor.scale.y += 0.0495f; if (this->dyna.actor.scale.y >= 0.165f) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); this->actionFunc = BgF40Switch_IdleUnpressed; this->dyna.actor.scale.y = 0.165f; } @@ -144,7 +144,7 @@ void BgF40Switch_IdlePressed(BgF40Switch* this, PlayState* play) { void BgF40Switch_Press(BgF40Switch* this, PlayState* play) { this->dyna.actor.scale.y -= 0.0495f; if (this->dyna.actor.scale.y <= 0.0165f) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); if (this->isInitiator) { ActorCutscene_Stop(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index cfd9003ec..c9020349c 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -91,8 +91,8 @@ void func_80B401F8(BgGoronOyu* this, PlayState* play) { if (dist.x >= 0.0f && dist.x <= this->waterBoxXLength && dist.z >= 0.0f && dist.z <= this->waterBoxZLength && fabsf(dist.y) < 100.0f && player->actor.depthInWater > 12.0f) { - Actor_PickUp(&this->dyna.actor, play, GI_MAX, this->dyna.actor.xzDistToPlayer, - fabsf(this->dyna.actor.playerHeightRel)); + Actor_OfferGetItem(&this->dyna.actor, play, GI_MAX, this->dyna.actor.xzDistToPlayer, + fabsf(this->dyna.actor.playerHeightRel)); } } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c index 0b8d2490b..42a7c4e05 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c @@ -68,7 +68,7 @@ void func_80ABD92C(BgHakuginElvpole* this, PlayState* play) { sp28 = true; } else if (this->unk_15E > 0) { if (this->unk_15E == 100) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); } this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 120.0f; //! FAKE: @@ -83,7 +83,7 @@ void func_80ABD92C(BgHakuginElvpole* this, PlayState* play) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 320.0f; Flags_UnsetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor)); this->unk_15E = -1; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); } } else if ((BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor) != 0x7F) && Flags_GetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor))) { diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 7f77b6645..d4d7e1724 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -839,7 +839,7 @@ void func_80A9CE1C(BgHakuginPost* this, PlayState* play) { temp = (s16)(this->dyna.actor.yawTowardsPlayer + 0x58F0); D_80A9E028.unk_0000[i].unk_28 = ((s16)(player->actor.shape.rot.y - temp) / 3) + temp; D_80A9E028.unk_0000[i].unk_34 = 2; - func_800B8E58(player, NA_SE_IT_HAMMER_HIT); + Player_PlaySfx(player, NA_SE_IT_HAMMER_HIT); func_8019F128(NA_SE_EV_SLIDE_DOOR_OPEN); Flags_SetSwitch(play, D_80A9E028.unk_0000[i].unk_2E); this->unk_178 = 20; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c index aa22dd8af..3f7379d34 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c @@ -102,7 +102,7 @@ static InitChainEntry sInitChain2[] = { void func_80B15790(BgHakuginSwitch* this, u16 sfxId) { if (this->unk_1B2 <= 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, sfxId); + Actor_PlaySfx(&this->dyna.actor, sfxId); } } diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index 265490e52..27e5d2fee 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -86,7 +86,7 @@ void func_80AC4A80(BgIcefloe* this, PlayState* play) { this->timer = 20; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->dyna.actor.world.pos, &this->dyna.actor.projectedPos, &this->dyna.actor.projectedW); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_ICE_STAND_APPEAR); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ICE_STAND_APPEAR); this->actionFunc = BgIcefloe_Grow; } @@ -133,7 +133,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) { void func_80AC4CF0(BgIcefloe* this) { this->timer = 50; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_ICE_MELT_LEVEL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ICE_MELT_LEVEL); this->actionFunc = func_80AC4D2C; } diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index 743213652..5a16e6845 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -142,7 +142,7 @@ void BgIcicle_Shiver(BgIcicle* this, PlayState* play) { } if (!(this->shiverTimer % 4)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_ICE_SWING); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ICE_SWING); } if (this->shiverTimer == 0) { @@ -163,9 +163,9 @@ void BgIcicle_Shiver(BgIcicle* this, PlayState* play) { } void BgIcicle_Fall(BgIcicle* this, PlayState* play) { - if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & 1)) { + if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->collider.base.atFlags &= ~AT_HIT; - this->dyna.actor.bgCheckFlags &= ~1; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c index 9d249314a..b6206ecb7 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c @@ -294,7 +294,7 @@ void func_80B7F290(BgIkanaBlock* this, PlayState* play) { Player* player = GET_PLAYER(play); if (!func_80B7EB94(this, play)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } player->stateFlags2 &= ~PLAYER_STATE2_10; @@ -334,10 +334,10 @@ void func_80B7F398(BgIkanaBlock* this, PlayState* play) { this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (func_80B7EE70(this, play)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Actor_PlaySfxAtPos(&this->dyna.actor, - SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, + SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + + SFX_FLAG); func_80B7F0A4(this); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index 678080ae1..9fa7077f8 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -116,10 +116,10 @@ void BgIkanaDharma_Init(Actor* thisx, PlayState* play2) { segmentY, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, BGIKANADHARMA_PARAMS(0, true, 0), this->dyna.actor.cutscene, - this->dyna.actor.unk20, NULL); + this->dyna.actor.halfDaysBits, NULL); } - this->dyna.actor.bgCheckFlags |= 1; + this->dyna.actor.bgCheckFlags |= BGCHECKFLAG_GROUND; } BgIkanaDharma_SetupWaitForHit(this); @@ -137,7 +137,7 @@ void BgIkanaDharma_Destroy(Actor* thisx, PlayState* play) { void BgIkanaDharma_SetupWaitForHit(BgIkanaDharma* this) { this->actionFunc = BgIkanaDharma_WaitForHit; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { @@ -157,8 +157,8 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { tempAngle1 = BINANG_ADD(this->dyna.actor.yawTowardsPlayer, 0x8000); tempAngle2 = (BINANG_SUB(player->actor.shape.rot.y, tempAngle1) >> 1); this->dyna.actor.world.rot.y = tempAngle1 + tempAngle2 + 0xF000; - this->dyna.actor.speedXZ = 20.0f; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); + this->dyna.actor.speed = 20.0f; + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); BgIkanaDharma_SetupStartCutscene(this); } else if ((this->dyna.actor.flags & ACTOR_FLAG_40) == ACTOR_FLAG_40 && sFirstHitBgIkanaDharma == NULL && this->dyna.actor.xzDistToPlayer < 420.0f) { @@ -227,14 +227,14 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { if (actorBelow == NULL) { Actor_MoveWithGravity(&this->dyna.actor); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 21536); Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); Quake_SetCountdown(quakeIndex, 12); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { if (actorBelow->actor.id == ACTOR_BG_IKANA_DHARMA) { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 4561d4049..27ca91c95 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -179,7 +179,7 @@ void func_80B80440(BgIkanaRotaryroom* this, PlayState* play) { this->unk_204.unk_00 = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_BG_IKANA_BLOCK, sp50.x, sp50.y, sp50.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, -1, - ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene), this->dyna.actor.unk20, NULL); + ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene), this->dyna.actor.halfDaysBits, NULL); Matrix_Pop(); } @@ -647,10 +647,10 @@ void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play) { Player* player = GET_PLAYER(play); if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { - if (player->actor.bgCheckFlags & 0x100) { - func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset); + if (player->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) { + Player_PlaySfx(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset); func_80169EFC(&play->state); - func_800B8E58(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->voiceSfxIdOffset); + Player_PlaySfx(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->voiceSfxIdOffset); play->haltAllActors = true; play_sound(NA_SE_OC_ABYSS); this->actionFunc = NULL; diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index f9a9fcc37..a9070cb8b 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -156,7 +156,7 @@ void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) { if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { func_80C0A86C(this, play, 4, 14, 1); Flags_UnsetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor)); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); func_80C0AC74(this); } else { func_800B9010(&this->dyna.actor, NA_SE_EV_ICE_PILLAR_FALL - SFX_FLAG); @@ -230,7 +230,7 @@ void BgIkninSusceil_Update(Actor* thisx, PlayState* play) { (player->unk_B48 > 1000.0f)) { this->unk168 = 2; if ((func_80C0A95C(this, play) != 0) && (this->actionFunc != func_80C0AE5C)) { - func_800B8E58(player, NA_SE_PL_BODY_HIT); + Player_PlaySfx(player, NA_SE_PL_BODY_HIT); func_80C0AE3C(this); } } diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index ba65baca4..2651c52bc 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -149,7 +149,7 @@ s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, PlayState* play) { func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); return false; } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); return true; } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 4bfa17c1c..c1cc4daa6 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -207,7 +207,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { this->actionFunc = func_809542A0; } } else if ((ActorCutscene_GetCurrentIndex() == -1) && (this->timePath != NULL)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CRUISER - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CRUISER - SFX_FLAG); func_80953BEC(this); } } @@ -228,7 +228,7 @@ void func_809541B8(BgIngate* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->unk160 & 0x4) { - if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & 1) && + if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->dyna.actor.xzDistToPlayer < 40.0f)) { if (this->dyna.actor.playerHeightRel > 15.0f) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); @@ -276,7 +276,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { switch (this->dyna.actor.textId) { case 0x9E4: this->dyna.actor.textId = 0x9E5; - func_80151938(play, this->dyna.actor.textId); + Message_ContinueTextbox(play, this->dyna.actor.textId); break; case 0x9E5: if (play->msgCtx.choiceIndex == 0) { @@ -293,7 +293,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_8019F230(); } - func_801477B4(play); + Message_CloseTextbox(play); break; case 0x9E6: if (play->msgCtx.choiceIndex == 0) { @@ -307,7 +307,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { Environment_StartTime(); func_8019F230(); } - func_801477B4(play); + Message_CloseTextbox(play); break; } } diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c index 12bfc0f3c..282a43925 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.c @@ -61,10 +61,10 @@ void func_80A5389C(BgKeikokuSaku* this, PlayState* play) { } void func_80A538E0(BgKeikokuSaku* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); this->dyna.actor.world.pos.z -= 2.0f + BREG(8); if (this->dyna.actor.world.pos.z < (BREG(9) + 2660.0f)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); this->timer = 30; this->actionFunc = func_80A53994; } diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c index 8afd5d730..8246a0298 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c @@ -1,9 +1,3 @@ -/* - * File: z_bg_keikoku_spr.c - * Overlay: ovl_Bg_Keikoku_Spr - * Description: Termina Field Fountain Water - */ - #include "z_bg_keikoku_spr.h" #include "objects/object_keikoku_obj/object_keikoku_obj.h" @@ -16,7 +10,8 @@ void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play); void BgKeikokuSpr_Update(Actor* thisx, PlayState* play); void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play); -ActorInit Bg_Keikoku_Spr_InitVars = { +/* +const ActorInit Bg_Keikoku_Spr_InitVars = { ACTOR_BG_KEIKOKU_SPR, ACTORCAT_PROP, FLAGS, @@ -25,38 +20,14 @@ ActorInit Bg_Keikoku_Spr_InitVars = { (ActorFunc)BgKeikokuSpr_Init, (ActorFunc)BgKeikokuSpr_Destroy, (ActorFunc)BgKeikokuSpr_Update, - (ActorFunc)BgKeikokuSpr_Draw, + (ActorFunc)BgKeikokuSpr_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Init.s") -void BgKeikokuSpr_Init(Actor* thisx, PlayState* play) { - Actor_ProcessInitChain(thisx, sInitChain); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Destroy.s") -void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play) { -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Update.s") -void BgKeikokuSpr_Update(Actor* thisx, PlayState* play) { -} - -void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play) { - s32 pad; - - OPEN_DISPS(play->state.gfxCtx); - - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0001F8)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000100); - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0003F8)); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000300); - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0005F8)); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000500); - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c index 5892376ba..7bc3e8544 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c @@ -207,7 +207,7 @@ void BgKin2Picture_Wait(BgKin2Picture* this, PlayState* play) { } else { // Gold Skulltula can be heard behind Skullkid's painting. if (this->skulltulaNoiseTimer >= 0) { if (this->skulltulaNoiseTimer == 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->skulltulaNoiseTimer = Rand_S16Offset(40, 80); @@ -283,7 +283,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { Actor_MoveWithGravity(&this->dyna.actor); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); - if (this->dyna.actor.bgCheckFlags & 1) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToS(&this->step, 0x7D0, 0x78); if (this->landTimer < 3) { @@ -297,7 +297,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { } if (this->landTimer < 3) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SMALL_WOODPLATE_BOUND_0); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SMALL_WOODPLATE_BOUND_0); } } } @@ -318,7 +318,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { } func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); BgKin2Picture_SetupDoNothing(this); } else { this->dyna.actor.shape.yOffset = Math_SinS(this->dyna.actor.shape.rot.x) * 40.0f; diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c index f766fef78..144351614 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c @@ -100,7 +100,7 @@ void BgLadder_StartCutscene(BgLadder* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); this->dyna.actor.draw = BgLadder_Draw; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SECRET_LADDER_APPEAR); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SECRET_LADDER_APPEAR); this->action = BgLadder_FadeIn; } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index d704adf86..521e14d63 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -248,7 +248,7 @@ void func_80C188C4(BgLastBwall* this, PlayState* play) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80C184EC(this, play); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = BgLastBwall_DoNothing; } diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index 20be54a2f..765b58dbd 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -1,9 +1,3 @@ -/* - * File: z_bg_lotus.c - * Overlay: ovl_Bg_Lotus - * Description: Southern Swamp Lilypads - */ - #include "z_bg_lotus.h" #include "objects/object_lotus/object_lotus.h" @@ -16,11 +10,8 @@ void BgLotus_Destroy(Actor* thisx, PlayState* play); void BgLotus_Update(Actor* thisx, PlayState* play); void BgLotus_Draw(Actor* thisx, PlayState* play); -void BgLotus_Wait(BgLotus* this, PlayState* play); -void BgLotus_Sink(BgLotus* this, PlayState* play); -void BgLotus_WaitToAppear(BgLotus* this, PlayState* play); - -ActorInit Bg_Lotus_InitVars = { +/* +const ActorInit Bg_Lotus_InitVars = { ACTOR_BG_LOTUS, ACTORCAT_BG, FLAGS, @@ -29,147 +20,22 @@ ActorInit Bg_Lotus_InitVars = { (ActorFunc)BgLotus_Init, (ActorFunc)BgLotus_Destroy, (ActorFunc)BgLotus_Update, - (ActorFunc)BgLotus_Draw, + (ActorFunc)BgLotus_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Init.s") -void BgLotus_Init(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; - s32 pad; - s32 bgId; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Destroy.s") - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(play, &this->dyna, &gLilyPadCol); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &thisx->floorPoly, &bgId, - &this->dyna.actor, &this->dyna.actor.world.pos); - this->timer2 = 96; - this->dyna.actor.world.rot.y = (s32)Rand_Next() >> 0x10; - this->actionFunc = BgLotus_Wait; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6830.s") -void BgLotus_Destroy(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD68DC.s") - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6A88.s") -void BgLotus_SetScaleXZ(BgLotus* this) { - f32 scale; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6B68.s") - if (this->dyna.actor.params == 0) { - scale = sin_rad(this->timer * 0.7853982f) * ((0.014f * ((f32)this->timer / 8)) + 0.01f); - this->dyna.actor.scale.x = (1.0f + scale) * 0.1f; - this->dyna.actor.scale.z = (1.0f - scale) * 0.1f; - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Update.s") -void BgLotus_Wait(BgLotus* this, PlayState* play) { - f32 moveDist; // distance for the xz position of the lilypad to move - - this->timer2--; - - moveDist = sin_rad(this->timer2 * 0.06544985f) * 6.0f; - - if (this->dyna.actor.params == 0) { - this->dyna.actor.world.pos.x = - (Math_SinS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = - (Math_CosS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.z; - - if (this->timer2 == 0) { - this->timer2 = 96; - this->dyna.actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x12); - } - } - - if (this->height < this->dyna.actor.floorHeight) { - this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - } else { - this->dyna.actor.world.pos.y = this->height; - - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { - if (this->hasSpawnedRipples == 0) { - EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 0); - EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 8); - this->timer = 40; - } - if (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) { - this->timer = 40; - this->dyna.actor.flags |= ACTOR_FLAG_10; - this->actionFunc = BgLotus_Sink; - return; - } - - this->hasSpawnedRipples = 1; - } else { - this->hasSpawnedRipples = 0; - } - } - - if (this->timer > 0) { - this->timer--; - } - - BgLotus_SetScaleXZ(this); -} - -void BgLotus_Sink(BgLotus* this, PlayState* play) { - if (this->height < this->dyna.actor.world.pos.y) { - this->dyna.actor.world.pos.y = this->height; - } - - this->dyna.actor.world.pos.y -= 1.0f; - - if (this->dyna.actor.world.pos.y <= this->dyna.actor.floorHeight) { - this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - this->timer = 0; - } - - if (this->timer > 0) { - this->timer--; - BgLotus_SetScaleXZ(this); - } else { - if (Math_StepToF(&this->dyna.actor.scale.x, 0, 0.0050000003539f)) { - this->dyna.actor.draw = NULL; - this->timer = 100; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); - this->actionFunc = BgLotus_WaitToAppear; - } - - this->dyna.actor.scale.z = this->dyna.actor.scale.x; - } -} - -void BgLotus_WaitToAppear(BgLotus* this, PlayState* play) { - if (this->timer > 0) { - this->timer--; - } else if ((this->dyna.actor.xzDistToPlayer > 100.0f) && (this->dyna.actor.projectedPos.z < 0.0f)) { - this->dyna.actor.draw = BgLotus_Draw; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); - Actor_SetScale(&this->dyna.actor, 0.1f); - this->dyna.actor.world.pos.y = CLAMP_MIN(this->height, this->dyna.actor.floorHeight); - this->dyna.actor.flags &= ~ACTOR_FLAG_10; - this->timer2 = 96; - this->actionFunc = BgLotus_Wait; - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; - } -} - -void BgLotus_Update(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; - s32 pad; - WaterBox* waterBox; - - WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, - &this->height, &waterBox); - this->actionFunc(this, play); -} - -void BgLotus_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, gLilyPadDL); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h index 540c21b0e..61d340a49 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h @@ -5,15 +5,9 @@ struct BgLotus; -typedef void (*BgLotusActionFunc)(struct BgLotus*, PlayState*); - typedef struct BgLotus { - /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ BgLotusActionFunc actionFunc; - /* 0x160 */ f32 height; - /* 0x164 */ u8 hasSpawnedRipples; - /* 0x166 */ s16 timer; - /* 0x168 */ s16 timer2; + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0x28]; } BgLotus; // size = 0x16C #endif // Z_BG_LOTUS_H diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index 497ed10ab..f4f6a6c00 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -63,7 +63,7 @@ static ColliderCylinderInit sCylinderInit = { }; static FireObjInitParams sFireObjInit = { - 0.00405000010505f, 0.0500000007451f, 3, 1, 0, 0, 0, + 0.00405f, 1.0f / 20.0f, FIRE_STATE_NOT_LIT, 1, 0, 0, 0, }; static s16 sInitialAnglePerPetal[] = { 0x0000, 0x2AAA, 0x5555, 0x8000, 0xAAAA, 0xD555 }; @@ -175,7 +175,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play) { this->flowerRotationalVelocity = 0x147; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 210.0f; - FireObj_SetState2(&this->fire, 0.05f, 2); + FireObj_SetState2(&this->fire, 0.05f, FIRE_STATE_FULLY_LIT); Flags_SetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupOpenedIdle(this); } else { @@ -215,8 +215,8 @@ void BgNumaHana_SetupClosedIdle(BgNumaHana* this) { * the cutscene where the petals unfold. */ void BgNumaHana_ClosedIdle(BgNumaHana* this, PlayState* play) { - if (this->fire.state != 3) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); + if (this->fire.state != FIRE_STATE_NOT_LIT) { + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); SET_WEEKEVENTREG(WEEKEVENTREG_12_01); @@ -247,7 +247,7 @@ void BgNumaHana_UnfoldInnerPetals(BgNumaHana* this, PlayState* play) { this->settleZRotation = 0; this->settleAngle = 0; this->settleScale = 420.0f; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); } this->transitionTimer++; } @@ -279,7 +279,7 @@ void BgNumaHana_UnfoldOuterPetals(BgNumaHana* this, PlayState* play) { this->settleZRotation = 0; this->settleAngle = 0x5120; this->settleScale = 130.0f; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FLOWERPETAL_STOP); } this->transitionTimer++; } diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h index fd71577cd..0e377f539 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.h @@ -2,6 +2,7 @@ #define Z_BG_NUMA_HANA_H #include "global.h" +#include "z_fireobj.h" #define BG_NUMA_HANA_GET_TYPE(thisx) ((thisx)->params & 1) #define BG_NUMA_HANA_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x7F) diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index c264b9775..3f7e45f67 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -111,7 +111,7 @@ void func_80ACAD88(BgOpenShutter* this, PlayState* play) { if (this->unk_15C != 0) { Player* player = GET_PLAYER(play); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); Camera_ChangeDoorCam(play->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->unk_3BA, 0.0f, 12, 15, 10); this->unk_164 = 0; this->actionFunc = func_80ACAE5C; @@ -136,7 +136,7 @@ void func_80ACAE5C(BgOpenShutter* this, PlayState* play) { this->unk_164++; } if (this->unk_164 >= 10) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); this->actionFunc = func_80ACAEF0; } } @@ -149,7 +149,7 @@ void func_80ACAEF0(BgOpenShutter* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y; Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 60.0f, 10, 8.0f, 500, 10, true); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -32536); @@ -172,14 +172,14 @@ void BgOpenShutter_Update(Actor* thisx, PlayState* play2) { index = Cutscene_GetActorActionIndex(play, 0x7C); if (play->csCtx.actorActions[index]->action == BGOPENSHUTTER_DOOR_OPEN) { if (this->actionFunc == func_80ACAD88) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80ACAE5C; this->dyna.actor.velocity.y = 0.0f; } this->unk_164 = 0; } else if (play->csCtx.actorActions[index]->action == BGOPENSHUTTER_DOOR_CLOSED) { if (this->actionFunc == func_80ACAE5C) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); this->actionFunc = func_80ACAEF0; } } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c index 2ec37cb7e..41ecaa19e 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c @@ -100,7 +100,7 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { if (shouldSpawnSeahorse) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, pos.x, pos.y, pos.z, 0, this->dyna.actor.shape.rot.y, 0, 0x4000, this->dyna.actor.cutscene, - this->dyna.actor.unk20, NULL); + this->dyna.actor.halfDaysBits, NULL); } Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index fb8d464c8..a1bd0d65d 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -314,7 +314,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; this->unk_161 = 1; } - } else if (player->actor.speedXZ != 0.0f) { + } else if (player->actor.speed != 0.0f) { this->unk_164 = CLAMP_MIN(this->unk_164, 2.0f); } } @@ -336,7 +336,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { } } else if (this->unk_162 == 11) { if (this->unk_164 > 3.0f) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WEB_VIBRATION); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WEB_VIBRATION); } else { AudioSfx_StopById(NA_SE_EV_WEB_VIBRATION); } diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index d6617ef1c..17722bda2 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -16,7 +16,8 @@ void BgTobira01_Destroy(Actor* thisx, PlayState* play); void BgTobira01_Update(Actor* thisx, PlayState* play); void BgTobira01_Draw(Actor* thisx, PlayState* play); -ActorInit Bg_Tobira01_InitVars = { +/* +const ActorInit Bg_Tobira01_InitVars = { ACTOR_BG_TOBIRA01, ACTORCAT_PROP, FLAGS, @@ -27,85 +28,14 @@ ActorInit Bg_Tobira01_InitVars = { (ActorFunc)BgTobira01_Update, (ActorFunc)BgTobira01_Draw, }; +*/ -void BgTobira01_Open(BgTobira01* this, PlayState* play) { - Player* player = GET_PLAYER(play); - s16 cutsceneId = this->dyna.actor.cutscene; - s16 prevTimer; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/func_80B12430.s") - if (this->playCutscene) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - } else if (ActorCutscene_GetCanPlayNext(cutsceneId)) { - ActorCutscene_StartAndSetUnkLinkFields(cutsceneId, &this->dyna.actor); - SET_WEEKEVENTREG(WEEKEVENTREG_88_40); - this->playCutscene = false; - } else { - ActorCutscene_SetIntentToPlay(cutsceneId); - } - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && (this->timer == 0) && (play->actorCtx.unk1F5 != 0) && - (play->actorCtx.unk1F4 == 0) && - (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { - this->playCutscene = true; - this->unk_16C = 0; // this variable is not used anywhere else - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Init.s") - prevTimer = this->timer; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Destroy.s") - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40)) { - this->timer++; - } else { - this->timer--; - }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Update.s") - this->timer = CLAMP(this->timer, 0, 60); - - if (this->timer != prevTimer) { - if (1) {} - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); - this->dyna.actor.world.pos.y = (this->yOffset = (this->timer * (5.0f / 3.0f)) + this->dyna.actor.home.pos.y); - this->timer2 = 180; - } - - if (!(player->stateFlags1 & PLAYER_STATE1_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && - (DECR(this->timer2) == 0)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); - } -} - -void BgTobira01_Init(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_spot11_obj_Colheader_0011C0); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); - Actor_SetScale(&this->dyna.actor, 1.0f); - this->timer2 = gSaveContext.save.isNight; - this->timer = 0; - this->actionFunc = BgTobira01_Open; -} - -void BgTobira01_Destroy(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); -} - -void BgTobira01_Update(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - this->actionFunc(this, play); -} - -void BgTobira01_Draw(Actor* thisx, PlayState* play) { - OPEN_DISPS(play->state.gfxCtx); - - func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_spot11_obj_DL_000088); - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h index 14a5e1b8e..9ddd0233d 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h @@ -5,16 +5,9 @@ struct BgTobira01; -typedef void (*BgTobira01ActionFunc)(struct BgTobira01*, struct PlayState*); - typedef struct BgTobira01 { - /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ BgTobira01ActionFunc actionFunc; - /* 0x160 */ s16 timer; - /* 0x162 */ s16 timer2; - /* 0x164 */ f32 yOffset; - /* 0x168 */ s32 playCutscene; - /* 0x16C */ s32 unk_16C; // unused besides being set to 0 + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0x2C]; } BgTobira01; // size = 0x170 #endif // Z_BG_TOBIRA01_H diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index e5505e92a..003ba32e9 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -4,7 +4,6 @@ * Description: Twinmold */ -#include "prevent_bss_reordering.h" #include "z_boss_02.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -710,10 +709,10 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0168 = 2000.0f; if (this->unk_0195 != 0) { - this->actor.speedXZ = this->unk_01A8 * D_809DF5B0 * 1.25f; + this->actor.speed = this->unk_01A8 * D_809DF5B0 * 1.25f; this->skelAnime.playSpeed = 2.0f; } else { - this->actor.speedXZ = this->unk_01A8 * D_809DF5B0; + this->actor.speed = this->unk_01A8 * D_809DF5B0; } Actor_UpdateVelocityWithoutGravity(&this->actor); @@ -732,7 +731,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0170 = this->unk_017C; this->unk_0170.y = temp_f0; this->unk_016C = 120; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); } this->actor.flags &= ~ACTOR_FLAG_1; @@ -941,13 +940,13 @@ void func_809DAB78(Boss02* this, PlayState* play) { sTwinmoldStatic->subCamAtVel = 0.0f; play_sound(NA_SE_EN_INBOSS_DEAD_PRE2_OLD); } else if (!(this->unk_0146[1] & 0xF) && (Rand_ZeroOne() < 0.5f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); } return; case 21: this->unk_01A8 = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_0146[0] == 0) { this->unk_0146[0] = 3; @@ -969,20 +968,20 @@ void func_809DAB78(Boss02* this, PlayState* play) { spCC = player->actor.world.pos.x - this->actor.world.pos.x; spC4 = player->actor.world.pos.z - this->actor.world.pos.z; if (sqrtf(SQ(spCC) + SQ(spC4)) < (400.0f * D_809DF5B0)) { - this->actor.speedXZ = 15.0f * D_809DF5B0; + this->actor.speed = 15.0f * D_809DF5B0; } spCC = this->actor.world.pos.x; spC4 = this->actor.world.pos.z; if (sqrtf(SQ(spCC) + SQ(spC4)) < (400.0f * D_809DF5B0)) { - this->actor.speedXZ = 15.0f * D_809DF5B0; + this->actor.speed = 15.0f * D_809DF5B0; } if (otherTwinmold->unk_0144 >= 10) { - Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD); } } return; @@ -996,9 +995,9 @@ void func_809DAB78(Boss02* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_0144 = 23; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_0170 = this->unk_017C; this->unk_016C = 30; this->unk_0170.y = this->actor.floorHeight; @@ -1075,7 +1074,7 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->unk_0156 = 15; if (i == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); this->unk_015C = 1; } else { Audio_PlaySfxAtPos(&this->unk_167C, NA_SE_EN_INBOSS_DAMAGE_OLD); @@ -1105,7 +1104,7 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->unk_0144 = 20; if (otherTwinmold->unk_0144 >= 10) { - Audio_QueueSeqCmd(0x100100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } else { otherTwinmold->unk_0195 = 1; } @@ -1201,9 +1200,9 @@ void Boss02_Twinmold_Update(Actor* thisx, PlayState* play) { if (this->unk_016C != 0) { if ((this->unk_016C == 60) && (this->unk_0144 < 20)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_ROAR_OLD); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_SAND_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_SAND_OLD - SFX_FLAG); if (this->unk_0144 > 20) { sp3C.x = randPlusMinusPoint5Scaled(100.0f * D_809DF5B0) + this->unk_0170.x; @@ -1288,17 +1287,17 @@ void Boss02_Static_Update(Actor* thisx, PlayState* play) { this->unk_1D74 = KREG(23) + -15.0f; D_801F4E30 = 0; play->envCtx.lightSettingOverride = 1; - play->skyboxId = 1; + play->skyboxId = SKYBOX_NORMAL_SKY; } else if (!sIsInGiantMode) { this->unk_1D74 = 0.0f; D_801F4E30 = this->unk_1D7C; play->envCtx.lightSettingOverride = 0; - play->skyboxId = 2; + play->skyboxId = SKYBOX_2; } else { this->unk_1D74 = KREG(23) + -15.0f; D_801F4E30 = ((KREG(24) * 0.1f) + 1.0f) * this->unk_1D7C; play->envCtx.lightSettingOverride = 1; - play->skyboxId = 1; + play->skyboxId = SKYBOX_NORMAL_SKY; } Math_ApproachS(&this->unk_1D7C, this->unk_1D7E, 1, 3); @@ -1311,7 +1310,7 @@ void Boss02_Static_Update(Actor* thisx, PlayState* play) { if (sMusicStartTimer != 0) { sMusicStartTimer--; if (sMusicStartTimer == 0) { - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); } } } @@ -1958,7 +1957,7 @@ void func_809DD934(Boss02* this, PlayState* play) { temp_a0_5->world.pos.x *= phi_f0_2; temp_a0_5->world.pos.z *= phi_f0_2; - temp_a0_5->speedXZ *= phi_f0_2; + temp_a0_5->speed *= phi_f0_2; temp_a0_5->velocity.x *= phi_f0_2; temp_a0_5->velocity.y *= phi_f0_2; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index f51c94458..4dd27f211 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -518,7 +518,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_56)) { this->actionFunc = func_809E344C; D_809E9842 = false; - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } else { Boss03_SetupIntroCutscene(this, play); D_809E9842 = true; @@ -581,10 +581,10 @@ void func_809E34B8(Boss03* this, PlayState* play) { Math_ApproachS(&this->bodyYRot, bodyYRotTarget, 5, 0x100); Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); - Math_ApproachF(&this->actor.speedXZ, this->unk_278, 1.0f, this->unk_27C); + Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); - if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & 8)) { + if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { Matrix_MultVecZ(-500.0f, &this->unk_268); this->unk_268.y = Rand_ZeroFloat(100.0f) + 150.0f; this->workTimer[WORK_TIMER_UNK2_A] = 60; @@ -618,7 +618,7 @@ void func_809E34B8(Boss03* this, PlayState* play) { if (this->workTimer[WORK_TIMER_UNK1_A] == 0) { // Player is above water && Player is standing on ground - if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { + if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Boss03_SetupPrepareCharge(this, play); } else if ((player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU)) { if (KREG(70) == 0) { @@ -669,7 +669,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) { Math_ApproachS(&this->bodyYRot, bodyYRotTarget, 5, 0x100); Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); - Math_ApproachF(&this->actor.speedXZ, this->unk_278, 1.0f, this->unk_27C); + Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); @@ -678,7 +678,8 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) { // If either (Player is standing on ground && Player is above water) or (WORK_TIMER_CURRENT_ACTION timer runs out), // then stop chasing - if (((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[0].y >= WATER_HEIGHT + 8.0f)) || + if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (player->actor.shape.feetPos[0].y >= WATER_HEIGHT + 8.0f)) || (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0)) { if (&this->actor == player->actor.parent) { player->unk_AE8 = 101; @@ -765,7 +766,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) { -0.5f, 5, 0x100); Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); - Math_ApproachF(&this->actor.speedXZ, this->unk_278, 1.0f, this->unk_27C); + Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); Math_ApproachS(&this->actor.shape.rot.x, this->actor.world.rot.x, 2, this->unk_274 * 2); @@ -773,7 +774,8 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) { // If either (Player is standing on ground && Player is above water) or (WORK_TIMER_CURRENT_ACTION timer runs out) // then stop trying to catch Player - if (((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) || + if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) || (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0)) { if (&this->actor == player->actor.parent) { player->unk_AE8 = 101; @@ -873,7 +875,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) { switch (this->unk_242) { case 0: - Math_ApproachF(&this->actor.speedXZ, 10.0f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, 10.0f, 1.0f, 1.0f); if (sqrtf(SQ(xDiff) + SQ(zDiff)) < 100.0f) { this->unk_242 = 1; Animation_MorphToLoop(&this->skelAnime, &gGyorgBackingUpAnim, -15.0f); @@ -881,7 +883,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) { break; case 1: - Math_ApproachF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, 0.0f, 1.0f, 0.5f); Math_ApproachF(&this->actor.world.pos.y, 200.0f, 0.05f, 5.0f); break; } @@ -985,7 +987,7 @@ void Boss03_PrepareCharge(Boss03* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); // Player is above water && Player is standing on ground - if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { + if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0) { Boss03_SetupCharge(this, play); } @@ -995,7 +997,7 @@ void Boss03_PrepareCharge(Boss03* this, PlayState* play) { } // Turns back slowly - Math_ApproachF(&this->actor.speedXZ, -3.0f, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, -3.0f, 1.0f, 0.5f); Actor_MoveWithoutGravityReverse(&this->actor); } @@ -1032,11 +1034,11 @@ void Boss03_Charge(Boss03* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; - Math_ApproachF(&this->actor.speedXZ, 25.0f, 1.0f, 3.0f); + Math_ApproachF(&this->actor.speed, 25.0f, 1.0f, 3.0f); Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); - if (this->actor.speedXZ >= 20.0f) { + if (this->actor.speed >= 20.0f) { // Jump over platform if (this->unk_242 == 1) { if (sqrtf(SQXZ(this->actor.world.pos)) < 700.0f) { @@ -1046,14 +1048,14 @@ void Boss03_Charge(Boss03* this, PlayState* play) { } // Attack platform - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); func_800BC848(&this->actor, play, 20, 15); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96, ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE); // Player is above water && Player is standing on ground - if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { + if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_800B8D50(play, NULL, 7.0f, Math_Atan2S_XY(player->actor.world.pos.z, player->actor.world.pos.x), 7.0f, 0); } @@ -1068,7 +1070,7 @@ void Boss03_SetupJumpOverPlatform(Boss03* this, PlayState* play) { this->actionFunc = Boss03_JumpOverPlatform; this->actor.gravity = -2.0f; this->actor.velocity.y = 30.0f; - this->actor.speedXZ = 25.0f; + this->actor.speed = 25.0f; Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_JUMP_OLD); } @@ -1171,7 +1173,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { case 1: player->actor.world.pos.z = 0.0f; player->actor.world.pos.x = 0.0f; - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; this->subCamEye.x = 100.0f; this->subCamEye.y = 540.0f; @@ -1190,7 +1192,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->subCamFov = 80.0f; case 2: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_DEMO_MOVE_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_DEMO_MOVE_OLD - SFX_FLAG); xDiff = D_809E9104[this->unk_242].x - this->actor.world.pos.x; yDiff = D_809E9104[this->unk_242].y - this->actor.world.pos.y; @@ -1206,11 +1208,11 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { } if ((this->csTimer == 40) || (this->csTimer == (u32)(KREG(91) + 270))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_WATER_DEEP); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_WATER_DEEP); } if (this->csTimer > 50) { - Math_ApproachF(&this->actor.speedXZ, this->unk_278, 1.0f, 0.1f); + Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, 0.1f); } if (this->unk_242 < 2) { @@ -1225,15 +1227,15 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { } else { this->unk_278 = 0.0f; bubblesToSpawnNum = 1; - if ((this->actor.speedXZ == 0.0f) && (this->csTimer > 230)) { + if ((this->actor.speed == 0.0f) && (this->csTimer > 230)) { this->csState = 3; this->csTimer = 0; } if (this->csTimer == 165) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_WATER_MID); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_WATER_MID); } if (this->csTimer == 180) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_WATER_DEEP); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_WATER_DEEP); } } } @@ -1243,7 +1245,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { case 3: Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_PREATTACK_OLD - SFX_FLAG); sp5A = 0x1970; - Math_ApproachF(&this->actor.speedXZ, 15.0f, 1.0f, 2.0f); + Math_ApproachF(&this->actor.speed, 15.0f, 1.0f, 2.0f); if (this->csTimer > 20) { this->csState = 4; this->csTimer = 0; @@ -1276,14 +1278,14 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->csState = 5; this->csTimer = 0; this->unk_2D5 = false; - this->actor.speedXZ = -200.0f; + this->actor.speed = -200.0f; Actor_MoveWithoutGravityReverse(&this->actor); this->actor.world.pos.y = this->waterHeight - 150.0f; Play_DisableMotionBlur(); case 5: SkelAnime_Update(&this->skelAnime); - this->actor.speedXZ = 20.0f; + this->actor.speed = 20.0f; Actor_MoveWithoutGravityReverse(&this->actor); player->actor.shape.rot.y = -0x1470; player->actor.world.rot.y = player->actor.shape.rot.y; @@ -1301,17 +1303,17 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->csState = 6; this->csTimer = 0; this->actor.gravity = -1.5f; - this->actor.speedXZ = 20.0f; + this->actor.speed = 20.0f; - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_OLD); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_JUMP_OLD); this->skelAnime.playSpeed = 1.0f; } } break; case 6: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); if (this->csTimer == 30) { TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, @@ -1326,7 +1328,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->bubbleEffectSpawnCount = 2; this->actor.gravity = 0.0f; Math_ApproachZeroF(&this->actor.velocity.y, 1.0f, 1.0f); - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.5f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.5f); } else { if (1) {} if (1) {} @@ -1382,7 +1384,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { if ((this->csState == 2) || (this->csState == 3)) { Actor_MoveWithoutGravityReverse(&this->actor); - phi_f2 = this->actor.speedXZ * 0.02f; + phi_f2 = this->actor.speed * 0.02f; phi_f2 = CLAMP_MAX(phi_f2, 0.12f); sp5C = Math_SinS(this->unk_240 * sp5A) * phi_f2; @@ -1413,7 +1415,7 @@ void Boss03_SetupDeathCutscene(Boss03* this, PlayState* play) { this->actionFunc = Boss03_DeathCutscene; Animation_MorphToLoop(&this->skelAnime, &gGyorgFloppingAnim, -10.0f); this->floppingAnimLastFrame = Animation_GetLastFrame(&gGyorgFloppingAnim); - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); this->workTimer[WORK_TIMER_UNK0_C] = 0; this->unk_242 = 0; this->csState = 0; @@ -1451,7 +1453,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { this->unk_2BE = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x); // Player is above water && Player is standing on ground - if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) { + if ((this->waterHeight < player->actor.world.pos.y) && + (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { player->actor.world.pos.x = 0.0f; player->actor.world.pos.z = -200.0f; } @@ -1514,10 +1517,10 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, sp84.z, 0.1f, 5.0f); if (Animation_OnFrame(&this->skelAnime, this->floppingAnimLastFrame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_DEAD_JUMP2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_DEAD_JUMP2_OLD); } if (Animation_OnFrame(&this->skelAnime, this->floppingAnimLastFrame * 0.5f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_DEAD_JUMP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_DEAD_JUMP_OLD); } if ((this->workTimer[WORK_TIMER_UNK0_C] == 0) && ((this->waterHeight - 100.0f) < this->actor.world.pos.y)) { @@ -1544,10 +1547,10 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { this->unk_242 = 1; this->actor.gravity = -2.0f; this->actor.velocity.y = 25.0f; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->actor.world.rot.y = this->unk_2BE + 0x8000; this->unk_240 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_DEAD_JUMP2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_DEAD_JUMP2_OLD); } } Math_ApproachF(&this->unk_56C, 0.01f, 1.0f, 0.0005f); @@ -1555,7 +1558,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { case 1: if (this->unk_240 == 0x96) { - Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC); } Math_ApproachF(&this->unk_56C, 0.01f, 1.0f, 0.0005f); Math_ApproachF(&this->actor.scale.x, 0.01f, 0.05f, 0.001f); @@ -1565,7 +1568,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { if (this->actor.world.pos.y < PLATFORM_HEIGHT + (100.0f * sp64)) { this->actor.world.pos.y = PLATFORM_HEIGHT + (100.0f * sp64); this->actor.velocity.y = ((Rand_ZeroFloat(10.0f) + 7.5f) * sp64) + 7.5f; - this->actor.speedXZ = ((Rand_ZeroFloat(5.0f) + 2.5f) * sp64) + 2.5f; + this->actor.speed = ((Rand_ZeroFloat(5.0f) + 2.5f) * sp64) + 2.5f; if (Rand_ZeroOne() < 0.5f) { this->shapeRotTargetX = @@ -1704,7 +1707,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { this->numSpawnedSmallFish++; } if ((this->csTimer % 8) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_MINI_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_MINI_APPEAR); } } } @@ -1768,7 +1771,7 @@ void Boss03_Stunned(Boss03* this, PlayState* play) { if ((this->waterHeight + 30.0f) < this->actor.world.pos.y) { this->actor.gravity = -2.0f; Actor_MoveWithGravity(&this->actor); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { play_sound(NA_SE_IT_WALL_HIT_HARD); func_800BC848(&this->actor, play, 10, 10); } @@ -1778,7 +1781,7 @@ void Boss03_Stunned(Boss03* this, PlayState* play) { this->actor.shape.rot.x = this->actor.world.rot.x; Math_ApproachF(&this->actor.world.pos.y, 100.0f, 0.05f, 5.0f); - Math_ApproachF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f); + Math_ApproachF(&this->actor.speed, 0.0f, 1.0f, 1.5f); Actor_MoveWithoutGravityReverse(&this->actor); } @@ -2003,7 +2006,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { ((this->waterHeight - 50.0f < this->actor.world.pos.y) && (this->actor.prevPos.y <= this->waterHeight - 50.0f))) { if ((this->actor.velocity.y < 0.0f) && (this->actionFunc != Boss03_DeathCutscene)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_SINK_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_SINK_OLD); } Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight, @@ -2081,7 +2084,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { if (D_809E9841 != 0) { D_809E9841--; if (D_809E9841 == 0) { - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); } } @@ -2095,7 +2098,8 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { } // Player is standing on ground && Player is above water - if ((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) { if (this->wetSpotEffectSpawnCount != 0) { this->wetSpotEffectSpawnCount--; @@ -2511,13 +2515,13 @@ void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) { yDiff = player->actor.world.pos.y - this->seaweedSegmentPositions[i].y; zDiff = player->actor.world.pos.z - this->seaweedSegmentPositions[i].z; distanceBetweenSeaweedAndDisturbance = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)); - disturbanceFactor = player->actor.speedXZ * 3.0f + 70.0f; + disturbanceFactor = player->actor.speed * 3.0f + 70.0f; // Player is standing on ground - if (player->actor.bgCheckFlags & 1) { + if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { maxBendSpeed = 0; } else { - maxBendSpeed = player->actor.speedXZ * 16.0f; + maxBendSpeed = player->actor.speed * 16.0f; if (maxBendSpeed > 0x1000) { maxBendSpeed = 0x1000; } else if (maxBendSpeed < 0x100) { @@ -2550,8 +2554,8 @@ void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) { break; } - maxBendSpeed = sGyorgBossInstance->actor.speedXZ * 16.0f; - disturbanceFactor = sGyorgBossInstance->actor.speedXZ * 5.0f + 150.0f; + maxBendSpeed = sGyorgBossInstance->actor.speed * 16.0f; + disturbanceFactor = sGyorgBossInstance->actor.speed * 5.0f + 150.0f; if (maxBendSpeed > 0x1000) { maxBendSpeed = 0x1000; } else if (maxBendSpeed < 0x100) { diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 00892063c..709ef43f8 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -289,7 +289,7 @@ void func_809EC568(Boss04* this, PlayState* play) { case 10: if (this->unk_704 == 3) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEMO_EYE); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEMO_EYE); this->unk_74A = 1; } this->unk_2D0 = 10000.0f; @@ -319,11 +319,11 @@ void func_809EC568(Boss04* this, PlayState* play) { } case 12: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.5f, 1000.0f); Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y, 0.5f, 1000.0f); Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.5f, 1000.0f); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); this->unk_6F4 = 15; this->unk_708 = 13; @@ -331,7 +331,7 @@ void func_809EC568(Boss04* this, PlayState* play) { this->unk_2DA = 10; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SPLASH); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); this->subCamAtOscillator = 20; } break; @@ -431,7 +431,7 @@ void func_809ECD18(Boss04* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 10, 0x200); this->actor.world.pos.y = (this->actor.floorHeight + KREG(17) + 160.0f) + (Math_SinS(this->unk_1F4 * 512) * 10.0f); - Math_ApproachF(&this->actor.speedXZ, this->unk_6D4, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, this->unk_6D4, 1.0f, 0.5f); if (this->unk_1F8 == 0) { this->unk_1F8 = Rand_ZeroFloat(100.0f) + 50.0f; @@ -460,14 +460,14 @@ void func_809ECEF4(Boss04* this) { this->unk_1F8 = 0; this->unk_1F6 = 1; this->unk_1FA = 60; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -3.0f; } void func_809ECF58(Boss04* this, PlayState* play) { Vec3f sp3C; - if ((this->unk_1FE == 14) || ((this->actor.bgCheckFlags & 8) && (this->unk_1F8 == 0))) { + if ((this->unk_1FE == 14) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->unk_1F8 == 0))) { this->unk_1F8 = 20; if ((Rand_ZeroOne() < 0.2f) && (this->unk_1FE == 0)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -477,9 +477,9 @@ void func_809ECF58(Boss04* this, PlayState* play) { this->actor.world.rot.y = BINANG_ROT180((s16)Rand_ZeroFloat(8000.0f) + this->actor.world.rot.y); } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); func_800BC848(&this->actor, play, 15, 10); this->unk_6F4 = 15; @@ -496,12 +496,12 @@ void func_809ECF58(Boss04* this, PlayState* play) { if (this->unk_6F4 == 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 5, 0x1000); if (this->unk_1FA == 0) { - Math_ApproachF(&this->actor.speedXZ, 20.0f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, 20.0f, 1.0f, 1.0f); sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.floorHeight + 2.0f; sp3C.z = this->actor.world.pos.z; EffectSsGRipple_Spawn(play, &sp3C, 1400, 500, 0); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); } } @@ -517,10 +517,10 @@ void func_809ED224(Boss04* this) { this->actionFunc = func_809ED2A0; this->unk_1F8 = 60; this->unk_1FA = 100; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2D0 = 10000.0f; this->unk_2C8 = 200; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_ME_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; Audio_RestorePrevBgm(); this->unk_1F6 = 10; @@ -569,7 +569,7 @@ void func_809ED45C(Boss04* this, PlayState* play) { if ((this->unk_1FE == 0) && (this->collider1.elements[0].info.bumperFlags & BUMP_HIT)) { this->collider1.elements[0].info.bumperFlags &= ~BUMP_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_ME_DAMAGE); damage = this->actor.colChkInfo.damage; this->actor.colChkInfo.health = this->actor.colChkInfo.health - damage; if ((s8)this->actor.colChkInfo.health <= 0) { @@ -765,7 +765,7 @@ void Boss04_Update(Actor* thisx, PlayState* play2) { } if (this->unk_74A != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_EXIST - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_ME_EXIST - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 83a920b50..13908ec4d 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -4,6 +4,7 @@ * Description: Igos du Ikana window - curtains and ray effects */ +#include "prevent_bss_reordering.h" #include "z_boss_06.h" #include "z64shrink_window.h" #include "overlays/actors/ovl_En_Knight/z_en_knight.h" diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.c b/src/overlays/actors/ovl_Boss_07/z_boss_07.c index 2506010f0..54a5e241b 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.c +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.c @@ -243,30 +243,30 @@ typedef enum { } Boss07StaticCsState; #if 1 // function prototypes -void Boss07_RandVec3fXZ(Vec3f* arg0, f32 arg1); +void Boss07_RandVec3fXZ(Vec3f* dst, f32 length); void Boss07_Incarnation_AvoidPlayer(Boss07* this); void Boss07_Mask_ClearBeam(Boss07* this); -void Boss07_Init(Actor* thisx, PlayState* play); -void Boss07_Destroy(Actor* thisx, PlayState* play); +void Boss07_Init(Actor* thisx, PlayState* play2); +void Boss07_Destroy(Actor* thisx, PlayState* play2); -void Boss07_Wrath_Update(Actor* thisx, PlayState* play); -void Boss07_Static_Update(Actor* thisx, PlayState* play); -void Boss07_Remains_Update(Actor* thisx, PlayState* play); -void Boss07_Top_Update(Actor* thisx, PlayState* play); -void Boss07_Projectile_Update(Actor* thisx, PlayState* play); -void Boss07_Mask_Update(Actor* thisx, PlayState* play); -void Boss07_Incarnation_Update(Actor* thisx, PlayState* play); -void Boss07_Afterimage_Update(Actor* thisx, PlayState* play); +void Boss07_Wrath_Update(Actor* thisx, PlayState* play2); +void Boss07_Static_Update(Actor* thisx, PlayState* play2); +void Boss07_Remains_Update(Actor* thisx, PlayState* play2); +void Boss07_Top_Update(Actor* thisx, PlayState* play2); +void Boss07_Projectile_Update(Actor* thisx, PlayState* play2); +void Boss07_Mask_Update(Actor* thisx, PlayState* play2); +void Boss07_Incarnation_Update(Actor* thisx, PlayState* play2); +void Boss07_Afterimage_Update(Actor* thisx, PlayState* play2); -void Boss07_Wrath_Draw(Actor* thisx, PlayState* play); -void Boss07_Static_Draw(Actor* thisx, PlayState* play); -void Boss07_Remains_Draw(Actor* thisx, PlayState* play); -void Boss07_Top_Draw(Actor* thisx, PlayState* play); -void Boss07_Projectile_Draw(Actor* thisx, PlayState* play); -void Boss07_Mask_Draw(Actor* thisx, PlayState* play); -void Boss07_Incarnation_Draw(Actor* thisx, PlayState* play); -void Boss07_Afterimage_Draw(Actor* thisx, PlayState* play); +void Boss07_Wrath_Draw(Actor* thisx, PlayState* play2); +void Boss07_Static_Draw(Actor* thisx, PlayState* play2); +void Boss07_Remains_Draw(Actor* thisx, PlayState* play2); +void Boss07_Top_Draw(Actor* thisx, PlayState* play2); +void Boss07_Projectile_Draw(Actor* thisx, PlayState* play2); +void Boss07_Mask_Draw(Actor* thisx, PlayState* play2); +void Boss07_Incarnation_Draw(Actor* thisx, PlayState* play2); +void Boss07_Afterimage_Draw(Actor* thisx, PlayState* play2); void Boss07_Wrath_SetupIntro(Boss07* this, PlayState* play); void Boss07_Wrath_Intro(Boss07* this, PlayState* play); @@ -280,7 +280,7 @@ void Boss07_Wrath_SetupDamaged(Boss07* this, PlayState* play, u8 damage, u8 dmgE void Boss07_Wrath_Damaged(Boss07* this, PlayState* play); void Boss07_Wrath_ThrowPlayer(Boss07* this, PlayState* play); -void Boss07_Wrath_Dodge(Boss07* this, PlayState* play, u8 arg2); +void Boss07_Wrath_Dodge(Boss07* this, PlayState* play, u8 canCancel); void Boss07_Wrath_SetupSidestep(Boss07* this, PlayState* play); void Boss07_Wrath_SetupShock(Boss07* this, PlayState* play); void Boss07_Wrath_SetupGrab(Boss07* this, PlayState* play); @@ -400,7 +400,7 @@ static s32 sSeed1; static s32 sSeed2; void Boss07_Remains_DamageSfx(Boss07* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FOLLOWERS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FOLLOWERS_DAMAGE); } void Boss07_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) { @@ -462,9 +462,9 @@ s32 Boss07_IsFacingPlayer(Boss07* this, PlayState* play) { } void Boss07_SmoothStop(Boss07* this, f32 maxStep) { - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, maxStep); + Math_ApproachZeroF(&this->actor.speed, 1.0f, maxStep); if (this->actor.bgCheckFlags & 0x18) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -478,7 +478,7 @@ void Boss07_Incarnation_SpawnDust(Boss07* this, PlayState* play, u8 spawnInterva static Color_RGBA8 sDarkRed = { 40, 30, 30, 255 }; u8 i; - if (!(this->actionTimer & spawnInterval) && ((spawnInterval == 0) || (this->actor.speedXZ > 1.0f))) { + if (!(this->actionTimer & spawnInterval) && ((spawnInterval == 0) || (this->actor.speed > 1.0f))) { for (i = 0; i < 2; i++) { Vec3f pos; Vec3f vel; @@ -795,7 +795,7 @@ void Boss07_Init(Actor* thisx, PlayState* play2) { } else { Boss07_Wrath_SetupIdle(this, play, 50); this->whipScale = 1.0f; - Audio_QueueSeqCmd(NA_BGM_MAJORAS_WRATH | 0x8000); + AudioSeq_QueueSeqCmd(NA_BGM_MAJORAS_WRATH | 0x8000); } SkelAnime_InitFlex(play, &this->skelAnime, &gMajorasWrathSkel, &gMajorasWrathIdleAnim, this->jointTable, this->morphTable, MAJORAS_WRATH_LIMB_MAX); @@ -862,7 +862,7 @@ void Boss07_Wrath_Intro(Boss07* this, PlayState* play) { } if (this->timer_ABC8 > 20) { if (this->timer_ABC8 == 21) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_GROW_HEAD_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_GROW_HEAD_OLD); } Math_ApproachS(&this->csHeadRot.x, 0, 5, 0x1000); this->csHeadRot.y = Math_SinS(this->timer_ABC8 * 0x1000) * this->unk_17E8; @@ -894,7 +894,7 @@ void Boss07_Wrath_Intro(Boss07* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gMajorasWrathIntroAnim, -15.0f); this->animEndFrame = Animation_GetLastFrame(&gMajorasWrathIntroAnim); func_8019FE1C(&this->actor.projectedPos, NA_SE_EV_ICE_PILLAR_RISING, 1.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_SHOUT); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_SHOUT); } if (this->timer_ABC8 >= 110) { Math_ApproachF(&this->whipScale, 1.0f, 1.0f, 0.05f); @@ -905,12 +905,12 @@ void Boss07_Wrath_Intro(Boss07* this, PlayState* play) { this->whipScale = 1.0f; } if (this->timer_ABC8 == 120) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP2_OLD); Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_KICK_OLD); func_8019FE74(&gSfxVolume, 0.0f, 0x3C); } if (this->timer_ABC8 == 112) { - Audio_QueueSeqCmd(NA_BGM_MAJORAS_WRATH | 0x8000); + AudioSeq_QueueSeqCmd(NA_BGM_MAJORAS_WRATH | 0x8000); } if (this->timer_ABC8 == 137) { TitleCard_InitBossName(&play->state, &play->actorCtx.titleCtxt, @@ -951,7 +951,7 @@ void Boss07_Wrath_Intro(Boss07* this, PlayState* play) { void Boss07_Wrath_SetupDeath(Boss07* this, PlayState* play) { s32 i; - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + AudioSeq_QueueSeqCmd(0xFF | 0x10010000); Boss07_MovePlayer(play); this->actionFunc = Boss07_Wrath_Death; this->leftWhip.mobility = this->rightWhip.mobility = 0.7f; @@ -990,7 +990,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { this->subCamIndex = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamIndex, CAM_STATUS_ACTIVE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_DEAD_ROD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_DEAD_ROD); case MAJORAS_WRATH_DEATH_STATE_1: this->timer_ABC8 = 0; this->csState = MAJORAS_WRATH_DEATH_STATE_2; @@ -1056,7 +1056,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { spA4 = 200.0f; spA0 = 1.0f; } - if (this->timer_ABC8 >= (sREG(15) + 140)) { + if (this->timer_ABC8 >= (u32)(sREG(15) + 140)) { this->csState = MAJORAS_WRATH_DEATH_STATE_4; this->subCamEyeModY = sREG(16) + 270.0f + 50.0f; Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_DEAD_FLOAT); @@ -1064,7 +1064,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { break; } case MAJORAS_WRATH_DEATH_STATE_4: - if ((this->timer_ABC8 >= (sREG(90) + 260)) && (this->timer_ABC8 < (sREG(91) + 370))) { + if ((this->timer_ABC8 >= (u32)(sREG(90) + 260)) && (this->timer_ABC8 < (u32)(sREG(91) + 370))) { spC0 = KREG(14) + 1; this->subCamRotY = this->actor.shape.rot.y * M_PI / 0x8000; spB4.x = 0.0f; @@ -1126,7 +1126,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { if (this->timer_ABC8 == 400) { func_8019FE74(&gSfxVolume, 0.0f, 90); } - if (this->timer_ABC8 == (KREG(94) + 440)) { + if (this->timer_ABC8 == (u32)(KREG(94) + 440)) { play->nextEntrance = 0x5400; gSaveContext.nextCutsceneIndex = 0xFFF7; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1149,7 +1149,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { this->subCamRotVel = 0.02f; } - if (this->timer_ABC8 >= (sREG(93) + 180)) { + if (this->timer_ABC8 >= (u32)(sREG(93) + 180)) { Vec3f sp84 = { 0.0f, 10.0f, 0.0f }; Vec3f sp78 = { 0.0f, -0.5f, 0.0f }; Vec3f sp6C; @@ -1171,7 +1171,7 @@ void Boss07_Wrath_Death(Boss07* this, PlayState* play) { EffectSsHahen_Spawn(play, &sp6C, &sp84, &sp78, 0, Rand_ZeroFloat(5.0f) + 20.0f, -1, 10, NULL); } } - if (this->timer_ABC8 >= (sREG(94) + 290)) { + if (this->timer_ABC8 >= (u32)(sREG(94) + 290)) { this->bodyDecayRate = KREG(86) + 25; Math_ApproachZeroF(&this->whipScale, 1.0f, 0.015f); } @@ -1260,12 +1260,12 @@ void Boss07_Wrath_StartJump(Boss07* this, PlayState* play) { this->actor.velocity.y = 35.0f; this->actor.world.rot.y = Math_Atan2F_XY(-this->actor.world.pos.z, -this->actor.world.pos.x) * (0x8000 / M_PI); this->actionFunc = Boss07_Wrath_Jump; - this->actor.speedXZ = 20.0f; + this->actor.speed = 20.0f; } } void Boss07_Wrath_Jump(Boss07* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG); if (this->actionTimer == 13) { Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_LAUGH_OLD); } @@ -1303,11 +1303,11 @@ void Boss07_Wrath_SetupFlip(Boss07* this, PlayState* play) { dz = sp30.z - this->actor.world.pos.z; this->actor.world.rot.y = Math_Atan2F_XY(dz, dx) * (0x8000 / M_PI); this->actionTimer = 0; - this->actor.speedXZ = 17.0f; + this->actor.speed = 17.0f; } void Boss07_Wrath_Flip(Boss07* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_MIBOSS_JUMP2 - SFX_FLAG); SkelAnime_Update(&this->skelAnime); this->leftWhip.mobility = this->rightWhip.mobility = 0.7f; this->leftWhip.drag = this->rightWhip.drag = 2.0f; @@ -1321,7 +1321,7 @@ void Boss07_Wrath_Flip(Boss07* this, PlayState* play) { Boss07_Wrath_Dodge(this, play, true); } else { Boss07_Wrath_SetupIdle(this, play, 1); - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; } this->jumpSfxTimer = 5; } @@ -1359,7 +1359,7 @@ void Boss07_Wrath_SetupSidestep(Boss07* this, PlayState* play) { void Boss07_Wrath_Sidestep(Boss07* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionTimer == 20) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_KICK_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_KICK_OLD); } this->timer_ABCC++; if ((this->timer_ABCC % 16) == 0) { @@ -1463,10 +1463,10 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { this->whipCrackTimer = 11; } if (this->actionTimer == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); } if (this->actionTimer == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); } break; case MAJORAS_WRATH_FLURRY: @@ -1479,7 +1479,7 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { play_sound(NA_SE_EN_LAST3_ROD_FLOOR_OLD); } if ((this->actionTimer % 4) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); } @@ -1496,10 +1496,10 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { this->whipCrackTimer = 11; } if (this->actionTimer == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); } if (this->actionTimer == 32) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); } break; case MAJORAS_WRATH_LONG_WHIP: @@ -1515,10 +1515,10 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { Math_ApproachF(&this->unk_184, -0.1f, 0.5f, 0.1f); Math_ApproachF(&this->unk_188, 0.3f, 0.5f, 0.1f); if (this->actionTimer == 5) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); } if (this->actionTimer == 30) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); } break; case MAJORAS_WRATH_SPIN_ATTACK: @@ -1527,7 +1527,7 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { if ((this->actionTimer % 8) == 0) { Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_KOMA_OLD); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_DANCE_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_DANCE_OLD - SFX_FLAG); Math_ApproachF(&this->actor.world.pos.x, this->moveTarget.x, 0.1f, this->vel_170); Math_ApproachF(&this->actor.world.pos.z, this->moveTarget.z, 0.1f, this->vel_170); Math_ApproachF(&this->vel_170, 20.0f, 1.0f, 4.0f); @@ -1538,7 +1538,7 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { case MAJORAS_WRATH_KICK: this->canDodge = false; if (this->actionTimer == 3) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_KICK_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_KICK_OLD); } break; case MAJORAS_WRATH_TAUNT: @@ -1562,14 +1562,14 @@ void Boss07_Wrath_Attack(Boss07* this, PlayState* play) { } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); if (this->actionTimer == 20) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP_OLD); Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_ROD_OLD); } if (this->actionTimer == 5) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_HOP2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_HOP2_OLD); } if (this->actionTimer == 41) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_ROD_OLD); } break; @@ -1751,7 +1751,7 @@ void Boss07_Wrath_SetupStunned(Boss07* this, PlayState* play) { this->animEndFrame = Animation_GetLastFrame(&gMajorasWrathStunAnim); } this->unk_158 = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE_OLD); } void Boss07_Wrath_SetupSpawnTop(Boss07* this, PlayState* play) { @@ -1775,10 +1775,10 @@ void Boss07_Wrath_SpawnTop(Boss07* this, PlayState* play) { } if (1) {} if (this->actionTimer == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_ROD_WIND_OLD); } if (this->actionTimer == (s16)(KREG(40) + 18)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_KOMA_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_KOMA_OLD); } if ((this->actionTimer < (s16)(KREG(40) + 14)) || ((s16)(KREG(41) + 17) < this->actionTimer)) { SkelAnime_Update(&this->skelAnime); @@ -1827,12 +1827,12 @@ void Boss07_Wrath_SetupDamaged(Boss07* this, PlayState* play, u8 damage, u8 dmgE if (KREG(19) != 0) { Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST3_VOICE_DEAD_OLD); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_DEAD_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_DEAD_OLD); } this->startDeath = true; Enemy_StartFinishingBlow(play, &this->actor); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST3_VOICE_DAMAGE2_OLD); if (this->actionFunc != Boss07_Wrath_Damaged) { Animation_MorphToPlayOnce(&this->skelAnime, &gMajorasWrathDamageAnim, -10.0f); this->actionFunc = Boss07_Wrath_Damaged; @@ -1852,7 +1852,7 @@ void Boss07_Wrath_Damaged(Boss07* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->timer_ABCC++; if ((this->timer_ABCC % 16) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); } Boss07_SmoothStop(this, 2.0f); this->leftWhip.mobility = this->rightWhip.mobility = 0.7f; @@ -1988,7 +1988,7 @@ void Boss07_Wrath_CollisionCheck(Boss07* this, PlayState* play) { break; case MAJORAS_WRATH_DMGEFF_A: this->unk_1805 = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); break; case MAJORAS_WRATH_DMGEFF_9: this->unk_1805 = 30; @@ -2249,7 +2249,7 @@ void Boss07_Wrath_Update(Actor* thisx, PlayState* play2) { } Boss07_DamageEffects(this, play); if ((this->jumpSfxTimer == 1) || (this->jumpSfxTimer == 4)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); } if ((player->actor.world.pos.y > 100.0f) && (player->actor.world.pos.z < KREG(82) + -850.0f)) { player->actor.world.pos.z = KREG(82) + -850.0f; @@ -2553,8 +2553,6 @@ typedef enum { // /* -1 */ MAJORAS_WRATH_LIMB_MAX // } MajorasWrathLimbs; - - void Boss07_Wrath_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 sLimbColliderIndex[30] = { -1, -1, 2, -1, 7, -1, 8, -1, -1, 9, -1, 10, -1, -1, 1, -1, 5, -1, 6, -1, -1, 3, -1, 4, -1, -1, 0, -1, -1, -1, @@ -2964,7 +2962,7 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { if (this->timer_ABC8 >= 20) { if (this->timer_ABC8 == 20) { this->unk_17C8[3] = 1.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_TRANSFORM); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_TRANSFORM); } Math_ApproachF(&this->unk_17B8[3], 1.0f + (this->unk_17C8[3] * sp58), 1.0f, 0.5f); } @@ -2983,21 +2981,21 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { if (this->timer_ABC8 >= 20) { if (this->timer_ABC8 == 20) { this->unk_17C8[2] = 1.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_TRANSFORM); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_TRANSFORM); } Math_ApproachF(&this->unk_17B8[2], 1.0f + (this->unk_17C8[2] * sp58), 1.0f, 0.5f); } if (this->timer_ABC8 >= 50) { if (this->timer_ABC8 == 50) { this->unk_17C8[1] = 1.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_TRANSFORM); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_TRANSFORM); } Math_ApproachF(&this->unk_17B8[1], 1.0f + (this->unk_17C8[1] * sp58), 1.0f, 0.5f); } if (this->timer_ABC8 >= 60) { if (this->timer_ABC8 == 60) { this->unk_17C8[0] = 1.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_TRANSFORM); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_TRANSFORM); } Math_ApproachF(&this->unk_17B8[0], 1.0f + (this->unk_17C8[0] * sp58), 1.0f, 0.5f); } @@ -3017,7 +3015,7 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { if (this->timer_ABC8 >= 10) { if (this->timer_ABC8 == 10) { this->unk_17C8[3] = 1.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); } Math_ApproachS(&this->csHeadRot.x, (this->unk_17C8[3] * sp58) * 0x6000, 1, 0x4000); } @@ -3036,15 +3034,15 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { } if (this->timer_ABC8 >= 20) { sREG(28) = this->timer_ABC8; - if ((this->timer_ABC8 == (KREG(16) + 28)) || (this->timer_ABC8 == (KREG(17) + 60))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO2_OLD); + if ((this->timer_ABC8 == (u32)(KREG(16) + 28)) || (this->timer_ABC8 == (u32)(KREG(17) + 60))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO2_OLD); } - if ((this->timer_ABC8 == (KREG(18) + 38)) || (this->timer_ABC8 == (KREG(19) + 48)) || - (this->timer_ABC8 == (KREG(20) + 68)) || (this->timer_ABC8 == (KREG(21) + 78))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_GYM_B_OLD); + if ((this->timer_ABC8 == (u32)(KREG(18) + 38)) || (this->timer_ABC8 == (u32)(KREG(19) + 48)) || + (this->timer_ABC8 == (u32)(KREG(20) + 68)) || (this->timer_ABC8 == (u32)(KREG(21) + 78))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_GYM_B_OLD); } - if (this->timer_ABC8 == (KREG(38) + 93)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_UAUOO_OLD); + if (this->timer_ABC8 == (u32)(KREG(38) + 93)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_UAUOO_OLD); } } if (this->timer_ABC8 == 45) { @@ -3053,7 +3051,7 @@ void Boss07_Incarnation_Intro(Boss07* this, PlayState* play) { 0x28); } if (this->timer_ABC8 == 20) { - Audio_QueueSeqCmd(NA_BGM_MAJORAS_INCARNATION | 0x8000); + AudioSeq_QueueSeqCmd(NA_BGM_MAJORAS_INCARNATION | 0x8000); this->envEffectOn = 1; play->envCtx.lightBlend = 0.0f; } @@ -3107,16 +3105,16 @@ void Boss07_Incarnation_Taunt(Boss07* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->actionState < MAJORAS_INCARNATION_STATE_2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_WAIT_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_WAIT_OLD - SFX_FLAG); } else if ((this->actionState == MAJORAS_INCARNATION_STATE_2) && Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_JUMP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_JUMP_OLD); } SkelAnime_Update(&this->skelAnime); Boss07_SmoothStop(this, 2.0f); Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x2000); if ((this->timers[0] == 0) || (player->unk_D57 == 4) || (this->actor.xzDistToPlayer <= 300.0f)) { Boss07_Incarnation_SetupRun(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); } Boss07_Incarnation_SpawnDust(this, play, 1, false); } @@ -3137,14 +3135,14 @@ void Boss07_Incarnation_Stunned(Boss07* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Boss07_SmoothStop(this, 1.0f); if (this->timers[1] == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_LAND); } if (Animation_OnFrame(&this->skelAnime, this->animEndFrame)) { Animation_MorphToLoop(&this->skelAnime, &gMajorasIncarnationFallOverLoopAnim, -5.0f); this->animEndFrame = 1000.0f; } if (this->animEndFrame == 1000.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_BIRD_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_BIRD_OLD - SFX_FLAG); } if (this->timers[0] == 0) { Boss07_Incarnation_SetupTaunt(this, play); @@ -3169,7 +3167,7 @@ void Boss07_Incarnation_SetupDamaged(Boss07* this, PlayState* play, u8 damage, u if (this->actor.colChkInfo.health != 0) { this->actor.colChkInfo.health -= damage; if ((s8)this->actor.colChkInfo.health <= 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_DEAD_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_DEAD_OLD); this->startDeath = true; this->invincibilityTimer = 100; this->unk_158 = 100; @@ -3177,11 +3175,11 @@ void Boss07_Incarnation_SetupDamaged(Boss07* this, PlayState* play, u8 damage, u return; } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_DAMAGE2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_DAMAGE2_OLD); } void Boss07_Incarnation_Damaged(Boss07* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_BIRD2_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_BIRD2_OLD - SFX_FLAG); SkelAnime_Update(&this->skelAnime); Boss07_SmoothStop(this, 2.0f); if (Animation_OnFrame(&this->skelAnime, this->animEndFrame)) { @@ -3202,16 +3200,16 @@ void Boss07_Incarnation_Run(Boss07* this, PlayState* play) { f32 sp30; s32 sp2C; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_WALK_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_WALK_OLD - SFX_FLAG); this->timer_AB40++; if (this->timer_AB40 >= 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_WALK2_OLD); this->timer_AB40 = 0; } SkelAnime_Update(&this->skelAnime); if ((func_800B64FC(play, 5.0f, &this->actor.world.pos, &sp2C) >= 0.0f) && (sp2C == 0)) { Boss07_Incarnation_SetupStunned(this, play, 50); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_DAMAGE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_DAMAGE_OLD); } else { sp34 = this->moveTarget.x - this->actor.world.pos.x; sp30 = this->moveTarget.z - this->actor.world.pos.z; @@ -3238,7 +3236,7 @@ void Boss07_Incarnation_Run(Boss07* this, PlayState* play) { } Math_ApproachS(&this->actor.world.rot.y, Math_Atan2S(sp34, sp30), 5, this->vel_170); Math_ApproachF(&this->vel_170, 0xFA0, 1.0f, 0x1F4); - Math_ApproachF(&this->actor.speedXZ, 25.0f, 1.0f, 20.0f); + Math_ApproachF(&this->actor.speed, 25.0f, 1.0f, 20.0f); if (this->timers[0] == 0) { Boss07_Incarnation_SetupTaunt(this, play); } @@ -3289,14 +3287,14 @@ void Boss07_Incarnation_Hopak(Boss07* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { if ((this->timer_ABC8 % 2) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO1_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO1_OLD); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_UAUOO2_OLD); } Audio_PlaySfxAtPos(&sSfxPoint, NA_SE_EN_LAST2_JUMP_OLD); this->timer_ABC8++; } - Math_ApproachF(&this->actor.speedXZ, KREG(67) + 10.0f, 1.0f, 3.0f); + Math_ApproachF(&this->actor.speed, KREG(67) + 10.0f, 1.0f, 3.0f); if (this->timers[1] == 0) { if ((this->actionTimer == 0) && (Rand_ZeroOne() < 0.7f)) { if (Rand_ZeroOne() < 0.75f) { @@ -3314,7 +3312,7 @@ void Boss07_Incarnation_Hopak(Boss07* this, PlayState* play) { if ((this->timers[0] == 0) || (this->actor.xzDistToPlayer <= 200.0f)) { Boss07_Incarnation_SetupRun(this, play); if (this->timers[0] != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); } } Boss07_Incarnation_SpawnDust(this, play, 7, false); @@ -3328,9 +3326,9 @@ void Boss07_Incarnation_SetupMoonwalk(Boss07* this, PlayState* play) { } void Boss07_Incarnation_Moonwalk(Boss07* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_MOONWALK_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_MOONWALK_OLD - SFX_FLAG); SkelAnime_Update(&this->skelAnime); - Math_ApproachF(&this->actor.speedXZ, KREG(69) + -10.0f, 1.0f, 3.0f); + Math_ApproachF(&this->actor.speed, KREG(69) + -10.0f, 1.0f, 3.0f); if (this->timers[1] == 0) { if ((this->actionTimer == 0) && (Rand_ZeroOne() < 0.5f)) { if (Rand_ZeroOne() < 0.75f) { @@ -3359,9 +3357,9 @@ void Boss07_Incarnation_SetupPirouette(Boss07* this, PlayState* play) { } void Boss07_Incarnation_Pirouette(Boss07* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_BALLET_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_BALLET_OLD - SFX_FLAG); SkelAnime_Update(&this->skelAnime); - Math_ApproachF(&this->actor.speedXZ, KREG(69) + 10.0f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, KREG(69) + 10.0f, 1.0f, 1.0f); if (this->timers[1] == 0) { if (((this->actionTimer % 0x40) == 0) && (Rand_ZeroOne() < 0.5f)) { if (Rand_ZeroOne() < 0.75f) { @@ -3379,7 +3377,7 @@ void Boss07_Incarnation_Pirouette(Boss07* this, PlayState* play) { if ((this->timers[0] == 0) || (this->actor.xzDistToPlayer <= 200.0f)) { Boss07_Incarnation_SetupRun(this, play); if (this->timers[0] != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_VOICE_SURPRISED_OLD); } } this->actor.shape.rot.y += 0x2000; @@ -3455,7 +3453,7 @@ void Boss07_Incarnation_Death(Boss07* this, PlayState* play) { player->actor.world.pos.x = this->actor.world.pos.x; player->actor.world.pos.z = this->actor.world.pos.z + 300.0f; player->actor.world.rot.y = player->actor.shape.rot.y = -0x8000; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); } break; case MAJORAS_INCARNATION_DEATH_STATE_2: @@ -3472,7 +3470,7 @@ void Boss07_Incarnation_Death(Boss07* this, PlayState* play) { this->subCamNextAt.z = -20.0f; this->unk_17E8 = 1.0f; this->unk_17EC = 0.4f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); } break; case MAJORAS_INCARNATION_DEATH_STATE_3: @@ -3489,14 +3487,14 @@ void Boss07_Incarnation_Death(Boss07* this, PlayState* play) { this->subCamNextAt.z = 0.0f; this->unk_17E8 = 1.0f; this->unk_17EC = 0.4f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); } break; case MAJORAS_INCARNATION_DEATH_STATE_4: sHeartbeatTimer = 5; sp4B = 2; if (this->timer_ABC8 == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_PUMP_UP_OLD); } if (this->timer_ABC8 == 40) { Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_07, this->actor.world.pos.x, this->actor.world.pos.y, @@ -3554,7 +3552,7 @@ void Boss07_Incarnation_CollisionCheck(Boss07* this, PlayState* play) { break; case MAJORAS_INCARNATION_DMGEFF_A: this->unk_1805 = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); break; case MAJORAS_INCARNATION_DMGEFF_9: this->unk_1805 = 30; @@ -3573,7 +3571,7 @@ void Boss07_Incarnation_CollisionCheck(Boss07* this, PlayState* play) { } else { this->invincibilityTimer = 15; Boss07_Incarnation_SetupStunned(this, play, 150); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_DAMAGE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_DAMAGE_OLD); } break; } @@ -3633,7 +3631,7 @@ void Boss07_Incarnation_Update(Actor* thisx, PlayState* play2) { if (this->startDeath || KREG(88)) { KREG(88) = false; this->startDeath = false; - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + AudioSeq_QueueSeqCmd(0xFF | 0x10010000); Boss07_Incarnation_SetupDeath(this, play); } } @@ -3695,7 +3693,7 @@ s32 Boss07_Incarnation_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dL // #define MAP_OUT // #define MAP_END(a,b,...) b -// #define MAP_NULL(...) +// #define MAP_NULL(...) // #define END_TEST(com) 0 , com // #define GET_SECOND(a, b, ...) b // #define GET_COMMAND(com, ecom, a, b, ...) GET_SECOND MAP_OUT (END_TEST b (ecom) , com) @@ -3704,11 +3702,12 @@ s32 Boss07_Incarnation_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dL // #define VALIDATE_ARR(val, ...) (GET_COMMAND (CHECK_ARR_VAL_R, MAP_END, __VA_ARGS__, ) (val, __VA_ARGS__)) // #define CHECK_ARR_VAL(val, ...) CHECK_ARR_VAL_R(val, __VA_ARGS__, -1) -// #define INVERT_ARRAY_R(vals, n, b, ...) CHECK_ARR_VAL(n, IDENTITY vals) , VALIDATE_INVERSE MAP_OUT (vals, n b, __VA_ARGS__) -// #define VALIDATE_INVERSE(vals, n, ...) GET_COMMAND (INVERT_ARRAY_R, MAP_NULL, __VA_ARGS__, ) (vals, n, __VA_ARGS__) -// #define INVERT_ARRAY(count, ...) INVERT_ARRAY_R((__VA_ARGS__), 0, +1, COUNTER_##count) +// #define INVERT_ARRAY_R(vals, n, b, ...) CHECK_ARR_VAL(n, IDENTITY vals) , VALIDATE_INVERSE MAP_OUT (vals, n b, +// __VA_ARGS__) #define VALIDATE_INVERSE(vals, n, ...) GET_COMMAND (INVERT_ARRAY_R, MAP_NULL, __VA_ARGS__, ) (vals, n, +// __VA_ARGS__) #define INVERT_ARRAY(count, ...) INVERT_ARRAY_R((__VA_ARGS__), 0, +1, COUNTER_##count) -// #define COUNTER_30 +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1 +// #define COUNTER_30 +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +// +1, +1, +1, +1, +1, +1 void Boss07_Incarnation_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static s8 sLimbColliderIndex[30] = { @@ -3724,10 +3723,8 @@ void Boss07_Incarnation_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList { 4000.0f, 0.0f, 0.0f }, { 4000.0f, 0.0f, 0.0f }, { 4000.0f, 0.0f, 0.0f }, { 4000.0f, 0.0f, 0.0f }, { 4000.0f, 0.0f, 0.0f }, }; - static s8 sLimbBodyPartIndex[32] = { - -1, -1, -1, 1, 2, 9, -1, 10, 11, -1, 6, -1, 7, 8, 1, 3, - -1, 4, 5, -1, 12, -1, 13, 14, 0, -1, -1, -1, -1, -1 - }; + static s8 sLimbBodyPartIndex[32] = { -1, -1, -1, 1, 2, 9, -1, 10, 11, -1, 6, -1, 7, 8, 1, + 3, -1, 4, 5, -1, 12, -1, 13, 14, 0, -1, -1, -1, -1, -1 }; Boss07* this = THIS; Vec3f sp28; @@ -3822,7 +3819,7 @@ void Boss07_Mask_Idle(Boss07* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG); if (this->timers[0] == 0) { if (this->timers[2] == 0) { if (((s8)this->actor.colChkInfo.health <= 8) && (player->transformation != PLAYER_FORM_FIERCE_DEITY) && @@ -3851,7 +3848,7 @@ void Boss07_Mask_Idle(Boss07* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, sp34, 0xA, this->vel_170); Math_ApproachS(&this->actor.world.rot.x, sp36, 5, this->vel_170); Math_ApproachF(&this->vel_170, 0x7D0, 1.0f, 0x64); - Math_ApproachF(&this->actor.speedXZ, this->flySpeedTarget, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, this->flySpeedTarget, 1.0f, 1.0f); if (this->timers[1] != 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x3000); } else if (this->flySpeedTarget < 7.0f) { @@ -3867,7 +3864,7 @@ void Boss07_Mask_Idle(Boss07* this, PlayState* play) { if (this->startDeath || KREG(88)) { KREG(88) = false; this->startDeath = false; - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + AudioSeq_QueueSeqCmd(0xFF | 0x10010000); Boss07_Mask_SetupDeath(this, play); } } @@ -3878,7 +3875,7 @@ void Boss07_Mask_SetupSpin(Boss07* this, PlayState* play) { this->csState = 0; this->timers[0] = 30; this->spinVel = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_ATTACK_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_ATTACK_OLD); } void Boss07_Mask_Spin(Boss07* this, PlayState* play) { @@ -3914,7 +3911,7 @@ void Boss07_Mask_Spin(Boss07* this, PlayState* play) { this->moveTarget.y = player->actor.world.pos.y + 10.0f; this->moveTarget.z = player->actor.world.pos.z; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_ROLLING_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_ROLLING_OLD - SFX_FLAG); } sp30 = this->moveTarget.x - this->actor.world.pos.x; sp2C = this->moveTarget.y - this->actor.world.pos.y; @@ -3925,7 +3922,7 @@ void Boss07_Mask_Spin(Boss07* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, sp34, 0xA, this->vel_170); Math_ApproachS(&this->actor.world.rot.x, sp36, 0xA, this->vel_170); Math_ApproachF(&this->vel_170, 0xBB8, 1.0f, 0x64); - Math_ApproachF(&this->actor.speedXZ, 20.0f, 1.0f, 2.0f); + Math_ApproachF(&this->actor.speed, 20.0f, 1.0f, 2.0f); if (((this->csState == 0) && (sp24 < 100.0f)) || (this->timers[0] == 0)) { if (Rand_ZeroOne() < 0.25f) { this->actionState = MAJORAS_MASK_SPIN_END; @@ -3935,7 +3932,7 @@ void Boss07_Mask_Spin(Boss07* this, PlayState* play) { this->moveTarget.y = Rand_ZeroFloat(100.0f) + 100.0f; if (Rand_ZeroOne() < 0.3f) { this->timers[1] = 20; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_ATTACK_2ND_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_ATTACK_2ND_OLD); this->csState = 1; } else { this->timers[1] = 0; @@ -3970,7 +3967,7 @@ void Boss07_Mask_Stunned(Boss07* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.x, -0x1000 + 0x4B0 * Math_SinS(this->actionTimer * 0xBB8), 5, 0x800); Math_ApproachS(&this->actor.shape.rot.z, -0x1000 + 0x3E8 * Math_SinS(this->actionTimer * 0x9C4), 5, 0x800); if (this->actor.world.pos.y > 51.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_FALL_OLD - SFX_FLAG); } Math_ApproachF(&this->actor.world.pos.y, 50.0f + 10.0f * Math_SinS(this->actionTimer * 0x5DC), 0.1f, this->vel_170); Math_ApproachF(&this->vel_170, 15.0f, 1.0f, 1.0f); @@ -3990,15 +3987,15 @@ void Boss07_Mask_SetupDamaged(Boss07* this, PlayState* play, u8 damage, Actor* h this->actionFunc = Boss07_Mask_Damaged; this->timers[0] = 40; if (damage) { - this->actor.speedXZ = 30.0f; + this->actor.speed = 30.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; this->spinVel = 0x1500; } else { if (player->stateFlags3 & PLAYER_STATE3_200) { - this->actor.speedXZ = 20.0f; + this->actor.speed = 20.0f; this->actor.velocity.y = 20.0f; } else { - this->actor.speedXZ = 13.0f; + this->actor.speed = 13.0f; this->actor.velocity.y = 10.0f; if (hitActor != NULL) { this->actor.world.rot.y = hitActor->world.rot.y; @@ -4036,7 +4033,7 @@ void Boss07_Mask_Damaged(Boss07* this, PlayState* play) { this->startDeath = true; Enemy_StartFinishingBlow(play, &this->actor); AudioSfx_StopByPos(&this->actor.projectedPos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DEAD_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEAD_OLD); } else { this->moveTarget.x = this->actor.world.pos.x; this->moveTarget.y = 200.0f; @@ -4220,7 +4217,7 @@ void Boss07_Mask_Beam(Boss07* this, PlayState* play) { this->invincibilityTimer = 50; this->dmgFogEffectTimer = 15; AudioSfx_StopByPos(&this->actor.projectedPos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DAMAGE2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DAMAGE2_OLD); Boss07_Mask_SetupDamaged(this, play, 2, NULL); Boss07_Mask_ClearBeam(this); for (phi_s0_2 = 0; phi_s0_2 < 20; phi_s0_2++) { @@ -4278,7 +4275,7 @@ void Boss07_Mask_Beam(Boss07* this, PlayState* play) { } else { sBossRemains[sp178]->actionState = MAJORAS_REMAINS_DEATH; sBossRemains[sp178]->timer_18D6 = 60; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FOLLOWERS_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FOLLOWERS_DEAD); for (pad = 0; pad < 20; pad++) { spE0.x = sBossRemains[sp178]->actor.world.pos.x + randPlusMinusPoint5Scaled(50.0f); @@ -4326,7 +4323,7 @@ void Boss07_Mask_Beam(Boss07* this, PlayState* play) { player->flameTimers[pad2] = Rand_S16Offset(0, 200); } player->isBurning = true; - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DEMO_DAMAGE); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DEMO_DAMAGE); } } if (sp14B) { @@ -4491,7 +4488,7 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { Boss07_Remains_SetupFly(sBossRemains[REMAINS_TWINMOLD], play); this->subCamSpeedMod = 0.0f; sMajoraStatic->introOrbScale = 0.0f; - Audio_QueueSeqCmd(NA_BGM_STOP | 0xA0000); + AudioSeq_QueueSeqCmd(0xFF | 0x100A0000); } } break; @@ -4502,7 +4499,7 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { } if (this->timer_ABC8 >= 55) { if (this->timer_ABC8 == 55) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_PAMET_BREAK); } this->maskEyeState = 0; } @@ -4513,7 +4510,7 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { Vec3f sp60; if (this->timer_ABC8 == 75) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DEMO_WALL); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_WALL); } sp8C = 2.0f * (this->timer_ABC8 % 2); if ((this->timer_ABC8 % 2) != 0) { @@ -4544,10 +4541,10 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { if (this->timer_ABC8 >= 10) { Math_ApproachS(&this->motionBlurAlpha, KREG(72), 1, KREG(73) + 2); if (this->timer_ABC8 == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK); } SkelAnime_Update(&this->skelAnime); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_FLOAT_OLD - SFX_FLAG); Math_ApproachF(&this->tentLengthScale, 1.0f, 1.0f, 0.02f); Math_ApproachF(&this->actor.world.pos.z, -642.5f, 0.05f, 30.0f); Math_ApproachF(&this->actor.world.pos.y, 350.0f, 0.03f, 2.0f); @@ -4556,7 +4553,7 @@ void Boss07_Mask_Intro(Boss07* this, PlayState* play) { Lib_SegmentedToVirtual(&gMajorasMaskTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); } if (this->timer_ABC8 == 30) { - Audio_QueueSeqCmd(NA_BGM_MAJORAS_MASK | 0x8000); + AudioSeq_QueueSeqCmd(NA_BGM_MAJORAS_MASK | 0x8000); } if (this->timer_ABC8 > 100) { Math_ApproachF(&this->subCamEye.x, player->actor.world.pos.x + 40.0f, 0.1f, @@ -4724,12 +4721,12 @@ void Boss07_Mask_CollisionCheck(Boss07* this, PlayState* play) { this->invincibilityTimer = 50; this->dmgFogEffectTimer = 15; AudioSfx_StopByPos(&this->actor.projectedPos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DAMAGE2_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DAMAGE2_OLD); Boss07_Mask_SetupDamaged(this, play, damage, hitActor); } else { this->invincibilityTimer = 15; AudioSfx_StopByPos(&this->actor.projectedPos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DAMAGE1_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DAMAGE1_OLD); Boss07_Mask_SetupStunned(this, play); } } @@ -4752,7 +4749,7 @@ void Boss07_Mask_Update(Actor* thisx, PlayState* play2) { if (sMusicStartTimer != 0) { sMusicStartTimer--; if (sMusicStartTimer == 0) { - Audio_QueueSeqCmd(NA_BGM_MAJORAS_MASK | 0x8000); + AudioSeq_QueueSeqCmd(NA_BGM_MAJORAS_MASK | 0x8000); } } Math_Vec3f_Copy(&sSfxPoint, &this->actor.projectedPos); @@ -5154,7 +5151,7 @@ void Boss07_Projectile_Update(Actor* thisx, PlayState* play2) { this->actionTimer++; if (this->actor.params == MAJORAS_REMAINS_SHOT) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FOLLOWERS_BEAM - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_FOLLOWERS_BEAM - SFX_FLAG); } if (KREG(63) == 0) { Actor_SetScale(&this->actor, 3.5f); @@ -5167,10 +5164,10 @@ void Boss07_Projectile_Update(Actor* thisx, PlayState* play2) { pad = sqrtf(SQ(sp58) + SQ(sp50)); this->actor.world.rot.x = Math_Atan2S(sp54, pad); this->actionState = MAJORAS_PROJECTILE_STATE_1; - this->actor.speedXZ = 30.0f; + this->actor.speed = 30.0f; func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); if (this->actor.params == MAJORAS_INCARNATION_SHOT) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST2_FIRE_OLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST2_FIRE_OLD); } } for (i = 0; i < ARRAY_COUNT(this->timers); i++) { @@ -5233,7 +5230,7 @@ void Boss07_Remains_CollisionCheck(Boss07* this, PlayState* play) { this->actionState = MAJORAS_REMAINS_DEATH; this->readyDeath = true; Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FOLLOWERS_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FOLLOWERS_DEAD); } else { this->actionState = MAJORAS_REMAINS_DAMAGED; this->timers[0] = 15; @@ -5315,7 +5312,7 @@ void Boss07_Remains_Intro(Boss07* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, sp30, 5, this->vel_170); Math_ApproachS(&this->actor.world.rot.x, sp32, 5, this->vel_170); Math_ApproachF(&this->vel_170, sp40, 1.0f, sp3C); - Math_ApproachF(&this->actor.speedXZ, sp38, 1.0f, sp34); + Math_ApproachF(&this->actor.speed, sp38, 1.0f, sp34); Actor_UpdateVelocityWithoutGravity(&this->actor); Actor_UpdatePos(&this->actor); this->actor.shape.rot = this->actor.world.rot; @@ -5323,7 +5320,7 @@ void Boss07_Remains_Intro(Boss07* this, PlayState* play) { case MAJORAS_REMAINS_CS_ATTACH_WAIT: Actor_SetScale(&this->actor, 0.0f); this->eyeBeamsZscale = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.pos.x = sRemainsEnd[this->actor.params - MAJORAS_REMAINS].x * 0.6f; this->actor.world.pos.y = 370.0f; this->actor.world.pos.z = sRemainsEnd[this->actor.params - MAJORAS_REMAINS].z * 0.6f; @@ -5333,7 +5330,7 @@ void Boss07_Remains_Intro(Boss07* this, PlayState* play) { case MAJORAS_REMAINS_CS_ATTACH: this->timer_ABCC++; if (this->timer_ABCC == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FOLLOWERS_STAY); + Actor_PlaySfx(&this->actor, NA_SE_EN_FOLLOWERS_STAY); } Actor_SetScale(&this->actor, 0.03f); Math_ApproachF(&this->actor.world.pos.x, sRemainsEnd[this->actor.params - MAJORAS_REMAINS].x, 0.5f, 40.0f); @@ -5364,21 +5361,21 @@ void Boss07_Remains_Fly(Boss07* this, PlayState* play) { switch (this->actionState) { case MAJORAS_REMAINS_ACTIVATE: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_FOLLOWERS_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_MUJURA_FOLLOWERS_FLY - SFX_FLAG); this->timers[0] = 80; this->timers[2] = 100.0f + Rand_ZeroFloat(100.0f); this->flySpeedTarget = 5.0f; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->moveTarget = gZeroVec3f; this->actor.world.rot.y = Math_Atan2S(-this->actor.world.pos.x, -this->actor.world.pos.z); this->actionState = MAJORAS_REMAINS_FLY; this->noclipTimer = 100; this->spawnCollider.base.colType = COLTYPE_HIT3; this->actor.flags |= (ACTOR_FLAG_200 | ACTOR_FLAG_1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_DEMO_BREAK); break; case MAJORAS_REMAINS_FLY: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_FOLLOWERS_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_MUJURA_FOLLOWERS_FLY - SFX_FLAG); if (this->timers[2] == 0) { this->readyShot = true; this->timers[2] = Rand_ZeroFloat(200.0f) + 100.0f; @@ -5404,7 +5401,7 @@ void Boss07_Remains_Fly(Boss07* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, sp7C, 0xA, this->vel_170); Math_ApproachS(&this->actor.world.rot.x, sp7E, 5, this->vel_170); Math_ApproachF(&this->vel_170, 0x7D0, 1.0f, 0x64); - Math_ApproachF(&this->actor.speedXZ, this->flySpeedTarget, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, this->flySpeedTarget, 1.0f, 1.0f); if ((this->flySpeedTarget < 8.0f) && !Play_InCsMode(play)) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x1000); } else { @@ -5472,7 +5469,7 @@ void Boss07_Remains_Fly(Boss07* this, PlayState* play) { sp48.y = 0.03f; sp60.y = Rand_ZeroFloat(10.0f) + this->actor.world.pos.y; EffectSsKFire_Spawn(play, &sp60, &gZeroVec3f, &sp48, Rand_ZeroFloat(30.0f) + 30.0f, 0); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); } else { sp60.y = (Rand_ZeroFloat(30.0f) + this->actor.world.pos.y) - 15.0f; sp54.x = 0.0f; @@ -5482,7 +5479,7 @@ void Boss07_Remains_Fly(Boss07* this, PlayState* play) { sp48.y = sp54.y * -0.05f; sp48.z = sp54.z * -0.05f; Boss07_SpawnEffect(play, &sp60, &sp54, &sp48, Rand_ZeroFloat(10.0f) + 25.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } } } @@ -5490,7 +5487,7 @@ void Boss07_Remains_Fly(Boss07* this, PlayState* play) { void Boss07_Remains_SetupStunned(Boss07* this, PlayState* play) { this->actionFunc = Boss07_Remains_Stunned; this->timers[0] = 50; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void Boss07_Remains_Stunned(Boss07* this, PlayState* play) { @@ -5589,9 +5586,9 @@ void Boss07_Top_Thrown(Boss07* this, PlayState* play) { Boss07_Top_SetupGround(this, play); } else if (this->actor.bgCheckFlags & 8) { Boss07_Top_SetupGround(this, play); - this->actor.speedXZ = -15.0f; + this->actor.speed = -15.0f; CollisionCheck_SpawnShieldParticles(play, &this->actor.focus.pos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); } } @@ -5605,7 +5602,7 @@ void Boss07_Top_SetupGround(Boss07* this, PlayState* play) { this->timers[0] = sREG(47) + 300; this->timers[1] = sREG(77) + 370; this->actor.velocity.y = (sREG(43) * 0.1f) + 15.0f; - this->actor.speedXZ = (sREG(44) * 0.1f) + -3.0f; + this->actor.speed = (sREG(44) * 0.1f) + -3.0f; } this->actor.world.rot.y = (sREG(45) * 0x1000) + sMajorasWrath->actor.shape.rot.y; this->actor.shape.rot.z = Rand_ZeroFloat((f32)(sREG(29) + 10) * 0x100); @@ -5624,28 +5621,28 @@ void Boss07_Top_Ground(Boss07* this, PlayState* play) { this->unk_158 = 10; if (this->topSpinRate > 0.01f) { if (this->topSpinRate < 0.45f) { - this->actor.speedXZ *= -1.0f; + this->actor.speed *= -1.0f; } else { - this->actor.speedXZ = -10.0f; + this->actor.speed = -10.0f; } CollisionCheck_SpawnShieldParticles(play, &this->actor.focus.pos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); } } if (this->actor.bgCheckFlags & 1) { if (this->timers[0] < (s16)(sREG(24) + 70)) { if (this->timers[0] >= (s16)(sREG(25) + 35)) { - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, (sREG(17) * 0.01f) + 0.1f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, (sREG(17) * 0.01f) + 0.1f); Math_ApproachS(&this->actor.shape.rot.z, (sREG(19) * 0x800) + 0x2000, 1, sREG(18) + 0x1A0); Math_ApproachZeroF(&this->topSpinRate, 1.0f, (sREG(16) * 0.0001f) + 0.005f); Math_ApproachS(&this->unk_180, (sREG(20) * 0x800) + 0x2000, 1, (sREG(21) * 16) + 0xC0); } else if (this->timers[0] == 0) { - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, (sREG(26) * 0.01f) + 0.5f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, (sREG(26) * 0.01f) + 0.5f); Math_ApproachS(&this->actor.shape.rot.z, (sREG(19) * 0x800) + 0x2000, 1, 0x800); Math_ApproachZeroF(&this->topSpinRate, 1.0f, (sREG(27) * 0.001f) + 0.024f); Math_ApproachS(&this->unk_180, 0, 2, sREG(28) + 106); } else { - Math_ApproachF(&this->actor.speedXZ, sREG(22) + 10.0f, 1.0f, (sREG(23) * 0.01f) + 0.6f); + Math_ApproachF(&this->actor.speed, sREG(22) + 10.0f, 1.0f, (sREG(23) * 0.01f) + 0.6f); Math_ApproachS(&this->actor.shape.rot.z, (sREG(19) * 0x800) + 0x2000, 1, sREG(18) + 0x410); Math_ApproachZeroF(&this->topSpinRate, 1.0f, (sREG(16) * 0.0001f) + 0.005f); Math_ApproachS(&this->unk_180, (sREG(29) * 0x800) - 0x800, 1, (sREG(30) * 16) + 0x340); @@ -5653,16 +5650,16 @@ void Boss07_Top_Ground(Boss07* this, PlayState* play) { this->actor.world.rot.y += this->unk_180; } else { Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x300); - Math_ApproachF(&this->actor.speedXZ, (sREG(48) * 0.1f) + 2.0f + 8.0f, 1.0f, + Math_ApproachF(&this->actor.speed, (sREG(48) * 0.1f) + 2.0f + 8.0f, 1.0f, (sREG(46) * 0.01f) + 0.100000024f + 0.2f); } Math_ApproachZeroF(&this->xRecoil, 1.0f, 1.0f); Math_ApproachZeroF(&this->zRecoil, 1.0f, 1.0f); if (this->actor.velocity.y < (sREG(40) + -2.0f)) { this->actor.velocity.y *= -(0.5f + (sREG(41) * 0.01f)); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); CollisionCheck_SpawnShieldParticles(play, &this->actor.world.pos); - this->actor.speedXZ *= 0.5f + (sREG(57) * 0.01f); + this->actor.speed *= 0.5f + (sREG(57) * 0.01f); } else { this->actor.velocity.y = -0.5f; } @@ -5677,8 +5674,9 @@ void Boss07_Top_Ground(Boss07* this, PlayState* play) { } this->actor.shape.rot.y = this->actor.world.rot.y; if (this->timers[1] == 0) { - EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y + 25.0f, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + EnBom* bomb = + (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y + 25.0f, this->actor.world.pos.z, 0, 0, 0, BOMB_TYPE_BODY); if (bomb != NULL) { bomb->timer = 0; @@ -5711,16 +5709,16 @@ void Boss07_Top_Collide(Boss07* this, PlayState* play) { this->actor.world.rot.y = Math_Atan2S(dx, dz); top->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; if (this->timers[0] > 0) { - this->actor.speedXZ = -10.0f; + this->actor.speed = -10.0f; } else { - this->actor.speedXZ = -5.0f; + this->actor.speed = -5.0f; this->topSpinRate = (sREG(89) * 0.01f) + 0.2f; this->unk_180 = 0x800; } if (top->timers[0] > 0) { - top->actor.speedXZ = -10.0f; + top->actor.speed = -10.0f; } else { - top->actor.speedXZ = -5.0f; + top->actor.speed = -5.0f; top->topSpinRate = (sREG(89) * 0.01f) + 0.2f; top->unk_180 = 0x800; } @@ -5740,7 +5738,7 @@ void Boss07_Top_Collide(Boss07* this, PlayState* play) { DECR(top->timers[1]); } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); break; } } @@ -5768,27 +5766,27 @@ void Boss07_Top_CollisionCheck(Boss07* this, PlayState* play) { if (this->timers[0] > 40) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { - this->actor.speedXZ = -30.0f; + this->actor.speed = -30.0f; this->actor.velocity.y = 10.0f; if ((s16)(sREG(47) + 100) < this->timers[0]) { this->timers[0] = sREG(47) + 100; this->timers[1] = sREG(77) + 170; } } else if (this->actor.colChkInfo.damageEffect == MAJORAS_TOP_DMGEFF_A) { - this->actor.speedXZ = -15.0f; + this->actor.speed = -15.0f; } else { - this->actor.speedXZ = -7.0f; + this->actor.speed = -7.0f; } } } else if (this->actor.colChkInfo.damageEffect == MAJORAS_TOP_DMGEFF_C) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.speedXZ = 2.0f * -player->actor.speedXZ; + this->actor.speed = 2.0f * -player->actor.speed; sp38 = true; } else if (this->actor.colChkInfo.damageEffect == MAJORAS_TOP_DMGEFF_B) { this->actor.world.rot.y = Math_Atan2S(this->spawnCollider.base.ac->world.pos.x - this->actor.world.pos.x, this->spawnCollider.base.ac->world.pos.z - this->actor.world.pos.z); - this->actor.speedXZ = -20.0f; + this->actor.speed = -20.0f; this->actor.velocity.y = sREG(55) + 15.0f; sp38 = true; } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index c1303efab..f499b7e20 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -444,7 +444,8 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->effects); i++) { this->effects[i].state = DEMO_KANKYO_STATE_INIT; } // clang-format on - if (1) {}; + //! FAKE: + if (1) {} switch (this->actor.params) { case DEMO_KANKYO_TYPE_LOSTWOODS: diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 60f9e898b..b1d5c7128 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -226,7 +226,7 @@ void func_80C16A74(DemoSyoten* this, PlayState* play) { if ((play->csCtx.frames >= 160) && (play->csCtx.frames < 322)) { func_800B9010(&this->actor, NA_SE_EV_IKANA_SOUL_LV - SFX_FLAG); } else if (play->csCtx.frames == 322) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_IKANA_SOUL_TRANSFORM); + Actor_PlaySfx(&this->actor, NA_SE_EV_IKANA_SOUL_TRANSFORM); } temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; @@ -313,7 +313,7 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) { break; case 4: - this->actor.speedXZ = + this->actor.speed = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->urot.z * 0.005493164f; if (this->unk_3EC < this->unk_3E8->count) { if (func_80C16818(this)) { @@ -344,7 +344,7 @@ void func_80C16DD4(DemoSyoten* this, PlayState* play) { case 2: this->actor.draw = DemoSyoten_Draw; this->unk_3E6 = -6; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); + Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); break; } } diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 43cc62603..997004fea 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -157,15 +157,15 @@ void func_80AA561C(DmChar00* this, PlayState* play) { case 1222: case 1682: case 2194: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 1858: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_ATTACK); break; case 2043: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; } } else { @@ -177,11 +177,11 @@ void func_80AA561C(DmChar00* this, PlayState* play) { case 1687: case 2194: case 2210: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; case 2043: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONDO_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONDO_SURPRISE); break; } } @@ -189,7 +189,7 @@ void func_80AA561C(DmChar00* this, PlayState* play) { void func_80AA5720(DmChar00* this, PlayState* play) { if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 505)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPOT_LIGHT_OPEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SPOT_LIGHT_OPEN); } } @@ -207,51 +207,51 @@ void func_80AA575C(DmChar00* this, PlayState* play) { case 877: case 882: case 887: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_ATTACK); break; case 520: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_SPIT); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_SPIT); break; case 774: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; case 904: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_SIGH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_SIGH); break; case 813: case 972: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_BRAKE); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_BRAKE); break; } } else if (play->csCtx.frames == 660) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONDO_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONDO_SURPRISE); } } void func_80AA5890(DmChar00* this, PlayState* play) { if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 20)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } void func_80AA58CC(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { if (play->csCtx.frames == 568) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { switch (play->csCtx.frames) { case 375: case 479: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; case 534: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_ATTACK); break; } } @@ -263,17 +263,17 @@ void func_80AA5950(DmChar00* this, PlayState* play) { void func_80AA5960(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { if (play->csCtx.frames == 280) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { switch (play->csCtx.frames) { case 87: case 190: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; case 244: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_ATTACK); break; } } @@ -283,16 +283,16 @@ void func_80AA59E4(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { switch (play->csCtx.frames) { case 125: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 1832: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } } else if (play->csCtx.frames == 125) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } @@ -300,16 +300,16 @@ void func_80AA5A6C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { switch (play->csCtx.frames) { case 44: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 891: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } } else if (play->csCtx.frames == 44) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } @@ -318,31 +318,31 @@ void func_80AA5AF4(DmChar00* this, PlayState* play) { switch (play->csCtx.frames) { case 352: case 401: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 440: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 550: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_BRAKE); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_BRAKE); break; } } else { switch (play->csCtx.frames) { case 362: case 401: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; case 454: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; } if ((play->csCtx.frames >= 500) && (play->csCtx.frames < 602)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SHIVER - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SHIVER - SFX_FLAG); } } } @@ -351,32 +351,32 @@ void func_80AA5BF8(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { switch (play->csCtx.frames) { case 762: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_SHOT_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_SHOT_DASH); break; case 797: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; } } else { switch (play->csCtx.frames) { case 762: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_SHOT_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_SHOT_DASH); break; case 797: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; } } if ((this->unk_261 == 53) && Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } void func_80AA5CD4(DmChar00* this, PlayState* play) { if ((DMCHAR00_GET(&this->actor) != DMCHAR00_0) && (play->csCtx.frames == 467)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } @@ -384,11 +384,11 @@ void func_80AA5D10(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { switch (play->csCtx.frames) { case 8: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; case 130: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_NAVY_VANISH); + Actor_PlaySfx(&this->actor, NA_SE_EV_NAVY_VANISH); break; } } @@ -399,11 +399,11 @@ void func_80AA5D6C(DmChar00* this, PlayState* play) { switch (play->csCtx.frames) { case 2: case 166: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 31: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; } } @@ -415,11 +415,11 @@ void func_80AA5DC8(DmChar00* this, PlayState* play) { case 233: case 415: case 593: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 130: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_NAVY_VANISH); + Actor_PlaySfx(&this->actor, NA_SE_EV_NAVY_VANISH); break; } } @@ -429,19 +429,19 @@ void func_80AA5E2C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_1) { switch (play->csCtx.frames) { case 32: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; case 42: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); break; case 192: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_BRAKE); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_BRAKE); break; case 215: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WEED); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WEED); break; } } diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 069d829c1..dab5b3c08 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -3,7 +3,7 @@ * Overlay: ovl_Dm_Char01 * Description: Woodfall scene objects (temple, water, walls, etc) */ - +#include "prevent_bss_reordering.h" #include "z_dm_char01.h" #include "objects/object_mtoride/object_mtoride.h" #include "overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h" @@ -201,7 +201,7 @@ void func_80AA88A8(DmChar01* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 135)) { if (play->csCtx.frames == play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]->startFrame) { D_80AAAE24 = 1; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FORT_RISING); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FORT_RISING); } } else { D_80AAAE24 = 0; @@ -277,7 +277,7 @@ void func_80AA8C28(DmChar01* this, PlayState* play) { switch (this->unk_346) { case 0: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WATER_PURIFICATION); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WATER_PURIFICATION); D_80AAAE22 = -2200; D_80AAAE20 = 100; this->unk_346++; diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index b618281c2..56c02526b 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -63,13 +63,13 @@ void DmChar02_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animationInfo, u16 void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) { switch (play->csCtx.frames) { case 95: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OCARINA_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_OCARINA_BOUND_0); break; case 101: case 105: case 112: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OCARINA_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_OCARINA_BOUND_1); break; } } @@ -148,7 +148,7 @@ void DmChar02_Update(Actor* thisx, PlayState* play) { this->unk_2F0 = this->unk_2F0; this->actionFunc(this, play); if (!Actor_HasParent(&this->actor, play)) { - Actor_PickUp(&this->actor, play, GI_OCARINA, 30.0f, 80.0f); + Actor_OfferGetItem(&this->actor, play, GI_OCARINA, 30.0f, 80.0f); } else { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c index 714913231..b960ce698 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -130,10 +130,10 @@ void func_80AAB710(DmChar03* this, PlayState* play) { void func_80AAB838(DmChar03* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_0); } else if ((Animation_OnFrame(&this->skelAnime, 10.0f)) || (Animation_OnFrame(&this->skelAnime, 18.0f)) || (Animation_OnFrame(&this->skelAnime, 30.0f)) || (Animation_OnFrame(&this->skelAnime, 38.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_1); } } diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 7e368b9e3..77c7c5dab 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -493,21 +493,21 @@ void func_80AACF04(DmChar05* this, PlayState* play) { void func_80AAD3F8(DmChar05* this, PlayState* play) { if (play->csCtx.frames == 490) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } if (play->csCtx.frames > 550) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } void func_80AAD450(DmChar05* this, PlayState* play) { if (play->csCtx.frames == 262) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } if (play->csCtx.frames > 318) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } @@ -516,31 +516,31 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 109) && (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action == 3)) { if (Animation_OnFrame(&this->skelAnime, 14.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_0); } else if (Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_1); } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_1) { if (Cutscene_CheckActorAction(play, 473)) { if ((play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action == 3) && Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_SAND); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_SAND); } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_2) { if (Cutscene_CheckActorAction(play, 518) && (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action == 2)) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_0); } if (Animation_OnFrame(&this->skelAnime, 14.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_1); } if (Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_1); } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { @@ -555,10 +555,10 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { } else if (play->sceneId == SCENE_SPOT00) { if (gSaveContext.sceneLayer == 9) { if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } } else if ((gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 115)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); + Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); } } } diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index 4129adfbe..66d4a7f86 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -422,7 +422,7 @@ void func_80AAFCCC(DmChar08* this, PlayState* play) { case 2: if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_206 = 0; } break; @@ -509,7 +509,7 @@ void func_80AAFE88(DmChar08* this, PlayState* play) { break; case 14: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIG_TORTOISE_ROLL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIG_TORTOISE_ROLL); this->animIndex = TURTLE_ANIM_FLOAT; break; } @@ -896,11 +896,11 @@ void func_80AB096C(DmChar08* this, PlayState* play) { if ((play->csCtx.state != 0) && (play->sceneId == SCENE_31MISAKI) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) { if ((play->csCtx.frames >= 890) && (play->csCtx.frames < 922)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); } } if ((this->animIndex == TURTLE_ANIM_SWIM) && Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIG_TORTOISE_SWIM); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIG_TORTOISE_SWIM); } } diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 654bc6c07..442058677 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -90,15 +90,15 @@ void func_80AB1FDC(DmChar09* this, PlayState* play) { phi_fv0 = this->speed; phi_fa0 = this->speed * 0.16f; } - Math_StepToF(&thisx->speedXZ, phi_fv0, phi_fa0); - if ((thisx->speedXZ + 0.05f) < sp54) { - Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / sp54); + Math_StepToF(&thisx->speed, phi_fv0, phi_fa0); + if ((thisx->speed + 0.05f) < sp54) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speed / sp54); thisx->world.pos.x += thisx->velocity.x; thisx->world.pos.y += thisx->velocity.y; thisx->world.pos.z += thisx->velocity.z; } else { this->unk_21C += this->unk_220; - thisx->speedXZ *= 0.4f; + thisx->speed *= 0.4f; phi_a1 = true; if (((this->unk_21C >= this->unk_218) && (this->unk_220 > 0)) || ((this->unk_21C <= 0) && (this->unk_220 < 0))) { @@ -203,7 +203,7 @@ void DmChar09_Update(Actor* thisx, PlayState* play) { func_80AB2268(this, play); func_80AB24BC(this, play); if ((play->csCtx.state != 0) && this->unk_22E && DMCHAR09_GET_100(thisx)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK + SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK + SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index 25fee11db..cd6890505 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -32,7 +32,7 @@ void DmRavine_Init(Actor* thisx, PlayState* play) { s32 pad; DmRavine* this = THIS; - if (CHECK_WEEKEVENTREG_ALT(WEEKEVENTREG_00_10) | cREG(0)) { + if (CHECK_WEEKEVENTREG_ALT(WEEKEVENTREG_ENTERED_GORMAN_TRACK) | cREG(0)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 8233bb0cb..423c70fc5 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -338,7 +338,7 @@ void DmStk_ChangeAnim(DmStk* this, PlayState* play, SkelAnime* skelAnime, Animat void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { switch (play->csCtx.frames + 20) { case 1195: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); break; case 1232: @@ -346,48 +346,48 @@ void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { case 1252: case 1255: case 1257: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); break; case 1285: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); break; case 1343: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 1410: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); break; case 1603: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_WALK); break; case 1610: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_REVERSE); break; case 2095: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_SURPRISED); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_SURPRISED); break; case 2190: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_JUMP); break; case 2212: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_ONGND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_ONGND); break; case 2214: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL02_LAUGH_SHORT); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL02_LAUGH_SHORT); break; case 2250: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL06_SURPRISED); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL06_SURPRISED); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); break; case 2255: @@ -416,7 +416,7 @@ void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { case 2508: case 2519: case 2530: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; } } @@ -455,11 +455,11 @@ void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, PlayState* play) { case 232: case 243: case 254: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; case 173: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); break; } } @@ -471,15 +471,15 @@ void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, PlayState* play) { void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 18: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_GASAGOSO); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_GASAGOSO); break; case 90: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); break; case 142: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); + Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); break; } } @@ -501,11 +501,11 @@ void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, PlayState* play) { break; case 560: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL02_LAUGH_SHORT); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL02_LAUGH_SHORT); break; case 890: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL21_PSYCHO_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL21_PSYCHO_VOICE); break; } } @@ -524,7 +524,7 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 71: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_BODY); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_BODY); break; case 365: @@ -536,30 +536,30 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 265: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL03_LAUGH_BIG); break; case 126: - Actor_PlaySfxAtPos(&player->actor, NA_SE_VO_DUMMY_150); + Actor_PlaySfx(&player->actor, NA_SE_VO_DUMMY_150); break; case 197: - Actor_PlaySfxAtPos(&player->actor, NA_SE_VO_DUMMY_134); + Actor_PlaySfx(&player->actor, NA_SE_VO_DUMMY_134); break; case 207: - Actor_PlaySfxAtPos(&player->actor, NA_SE_VO_DUMMY_135); + Actor_PlaySfx(&player->actor, NA_SE_VO_DUMMY_135); break; case 217: - Actor_PlaySfxAtPos(&player->actor, NA_SE_VO_DUMMY_136); + Actor_PlaySfx(&player->actor, NA_SE_VO_DUMMY_136); break; } if (player) {} if ((play->csCtx.frames >= 263) && (play->csCtx.frames < 698)) { - Actor_PlaySfxAtPos(&player->actor, NA_SE_EN_STALKIDS_BODY_LEV - SFX_FLAG); + Actor_PlaySfx(&player->actor, NA_SE_EN_STALKIDS_BODY_LEV - SFX_FLAG); } } @@ -577,37 +577,37 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla break; case 258: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_TURN); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_TURN); break; case 524: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_TURN); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL04_ANGER); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_TURN); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL04_ANGER); break; case 534: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); break; case 678: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_STRETCH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_STRETCH); break; } if ((this->animIndex == SK_ANIM_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { if (Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); } else if (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA2); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA2); } } if (play->csCtx.frames >= 700) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON); } else if ((sMoonCallTimer & 0x1F) == 16) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON2); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON2); } sMoonCallTimer++; @@ -622,8 +622,8 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla */ void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, PlayState* play) { if (play->csCtx.frames == 3) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL06_SURPRISED); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL06_SURPRISED); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); } } @@ -632,7 +632,7 @@ void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, PlayState* play) { */ void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, PlayState* play) { if ((play->csCtx.frames >= 642) && (play->csCtx.frames < 845)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_NE_STAL23_COLD - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_NE_STAL23_COLD - SFX_FLAG); } } @@ -648,16 +648,16 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { case 72: case 77: case 79: - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_WATER2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER2); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_WALK); break; case 186: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); break; case 230: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL22_LAUGH_KID_L); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL22_LAUGH_KID_L); break; } } @@ -674,7 +674,7 @@ void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { break; case 660: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); break; } } @@ -692,39 +692,39 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 45: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; case 93: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 245: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; case 269: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL11_LAUGH_SHY2); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL11_LAUGH_SHY2); break; case 327: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_SHAKEHEAD); break; case 455: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; case 1730: - Audio_QueueSeqCmd(0x141400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 20); break; case 1395: - func_800B8E58(player, NA_SE_VO_DUMMY_34); + Player_PlaySfx(player, NA_SE_VO_DUMMY_34); break; case 1850: - Audio_QueueSeqCmd(0x42320000); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_SFX, 50, 0); break; case 2000: @@ -735,20 +735,20 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { if (this->animIndex == SK_ANIM_SHAKE_HEAD) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } if (Animation_OnFrame(&this->skelAnime, 28.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); } } else if (this->animIndex == SK_ANIM_LAUGH_AFTER_SNIFF) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } } else if ((this->animIndex == SK_ANIM_SNIFF) && (Animation_OnFrame(&this->skelAnime, 16.0f) || Animation_OnFrame(&this->skelAnime, 23.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_NOSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_NOSE); } } @@ -766,25 +766,25 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, PlayState* pla break; case 234: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_TURN); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL04_ANGER); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_TURN); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL04_ANGER); break; case 244: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); break; case 388: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_STRETCH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_STRETCH); break; } if (play->csCtx.frames >= 408) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON); } else if ((sMoonCallTimer & 0x1F) == 16) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL20_CALL_MOON2); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON2); } sMoonCallTimer++; @@ -812,19 +812,19 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla case 332: case 335: case 344: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 367: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); break; case 470: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_HEADACHE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_HEADACHE); break; case 486: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); Audio_PlaySfxAtPos(&this->oathToOrderCutsceneVoicePos, NA_SE_EN_STAL08_CRY_BIG); break; @@ -833,11 +833,11 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla break; case 590: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 592: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_RIDE); break; case 594: @@ -849,16 +849,16 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla if ((play->csCtx.frames >= 62) && (play->csCtx.frames < 273)) { if ((Rand_ZeroOne() < 0.75f) && ((play->state.frames % 2) != 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_EARTHQUAKE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_EARTHQUAKE); } } if ((play->csCtx.frames >= 498) && (play->csCtx.frames < 577)) { if ((play->state.frames % 4) == 0) { if ((play->state.frames & 4) != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } } } @@ -876,16 +876,16 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 551: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_PULLED); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; case 711: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 716: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_ONGND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_ONGND); break; } } @@ -898,16 +898,16 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, PlayState* play) { void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 311: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_PULLED); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; case 365: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); break; case 372: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_ONGND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_MASK_ON); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_ONGND); break; } } @@ -984,24 +984,24 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { if (this->animIndex == SK_ANIM_WALK) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_WALK); } } else if (this->animIndex == SK_ANIM_SEARCH_LINK) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 20.0f) || Animation_OnFrame(&this->skelAnime, 27.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_CALM_HIT); + Actor_PlaySfx(&this->actor, NA_SE_PL_CALM_HIT); } } else if (this->animIndex == SK_ANIM_PICK_UP_OCARINA_AND_START_PLAYING) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PUT_OUT_ITEM); + Actor_PlaySfx(&this->actor, NA_SE_PL_PUT_OUT_ITEM); } } else if (this->animIndex == SK_ANIM_PLAY_OCARINA_AND_LAUGH) { if (Animation_OnFrame(&this->skelAnime, 14.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_UNSKILLFUL_OCARINA); + Actor_PlaySfx(&this->actor, NA_SE_EV_UNSKILLFUL_OCARINA); } if (Animation_OnFrame(&this->skelAnime, 45.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STAL01_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STAL01_LAUGH); } } } @@ -1225,7 +1225,7 @@ void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(10)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DAMAGE); ActorCutscene_Start(10, &this->actor); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; @@ -1254,7 +1254,7 @@ void DmStk_ClockTower_AdjustHeightAndRotation(DmStk* this, PlayState* play) { sin = Math_SinS(this->bobPhase) * 10.0f; Math_SmoothStepToF(&this->actor.world.pos.y, 160.0f + sin, 0.2f, 1.0f, 0.0001f); - this->actor.world.rot.y = Actor_YawBetweenActors(&this->actor, &player->actor); + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &player->actor); this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.world.rot.x = 0x1B58; @@ -1280,7 +1280,7 @@ void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play) { this->animIndex = SK_ANIM_DEFLECT_ATTACK; DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); this->actionFunc = DmStk_ClockTower_WaitForDeflectionToEnd; } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 9086a052d..1e2a59b76 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -122,7 +122,7 @@ void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { play_sound(NA_SE_SY_CORRECT_CHIME); } - func_800B8C50(&this->actor, play); + Actor_SetClosestSecretDistance(&this->actor, play); } void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index db564f3f2..8a9d26a4d 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -346,9 +346,9 @@ void func_808A1090(DoorShutter* this, PlayState* play) { Flags_SetSwitch(play, DOORSHUTTER_GET_7F(&this->actor)); if (this->doorType != 5) { gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B); } } } else { @@ -416,7 +416,7 @@ s32 func_808A1340(DoorShutter* this, PlayState* play) { if (this->actor.velocity.y == 0.0f) { func_808A1288(this, play); if (this->unk_163 != 7) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIDE_DOOR_OPEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SLIDE_DOOR_OPEN); } } @@ -449,9 +449,9 @@ s32 func_808A1478(DoorShutter* this, PlayState* play, f32 arg2) { if (temp == this->unk_168) { if (arg2 == 1.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_METALDOOR_CLOSE); + Actor_PlaySfx(&this->actor, NA_SE_EV_METALDOOR_CLOSE); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_METALDOOR_OPEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_METALDOOR_OPEN); } if ((this->unk_160 != -1) && (ActorCutscene_GetCurrentIndex() == this->unk_160)) { @@ -498,7 +498,7 @@ void func_808A1618(DoorShutter* this, PlayState* play) { void func_808A1684(DoorShutter* this, PlayState* play) { f32 phi_f0; - if ((DECR(this->unk_166) == 0) && (play->roomCtx.unk31 == 0) && func_808A1340(this, play)) { + if ((DECR(this->unk_166) == 0) && (play->roomCtx.status == 0) && func_808A1340(this, play)) { if (this->doorType == 5) { phi_f0 = 20.0f; } else { @@ -512,7 +512,7 @@ void func_808A1684(DoorShutter* this, PlayState* play) { if (DoorShutter_SetupDoor(this, play)) { this->actor.velocity.y = 30.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIDE_DOOR_CLOSE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SLIDE_DOOR_CLOSE); } DoorShutter_SetupAction(this, func_808A1B48); } @@ -608,7 +608,7 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { this->actor.floorHeight = this->actor.home.pos.y; Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BIGWALL_BOUND); quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -32536); @@ -652,7 +652,7 @@ s32 func_808A1D68(DoorShutter* this, PlayState* play) { return true; } - temp_a0 = BINANG_SUB(Actor_YawToPoint(&this->actor, &play->view.eye), this->actor.shape.rot.y); + temp_a0 = BINANG_SUB(Actor_WorldYawTowardPoint(&this->actor, &play->view.eye), this->actor.shape.rot.y); temp_a1 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); temp_a0 = ABS_ALT(temp_a0); diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 541e3de23..6c7d32152 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -16,58 +16,13 @@ #define THIS ((DoorSpiral*)thisx) -typedef enum { - /* 0 */ SPIRAL_OVERWORLD, // does not display anything as there is not a DL in GAMEPLAY_KEEP for it - /* 1 */ SPIRAL_DUNGEON, - /* 2 */ SPIRAL_WOODFALL_TEMPLE, - /* 3 */ SPIRAL_WOODFALL_TEMPLE_ALT, // SPIRAL_WOODFALL_TEMPLE but with positional lights enabled? - /* 4 */ SPIRAL_SNOWHEAD_TEMPLE, - /* 5 */ SPIRAL_STONE_TOWER, - /* 6 */ SPIRAL_IKANA_CASTLE, - /* 7 */ SPIRAL_DAMPES_HOUSE -} SpiralType; - -typedef enum { - /* 0 */ SPIRAL_OBJECT_OVERWORLD, - /* 1 */ SPIRAL_OBJECT_DUNGEON, - /* 2 */ SPIRAL_OBJECT_WOODFALL, - /* 3 */ SPIRAL_OBJECT_SNOWHEAD, - /* 4 */ SPIRAL_OBJECT_STONE_TOWER, - /* 5 */ SPIRAL_OBJECT_DAMPES_HOUSE, - /* 6 */ SPIRAL_OBJECT_IKANA_CASTLE -} SpiralObjectType; - -typedef struct { - /* 0x00 */ Gfx* spiralDL[2]; // one displaylist for downward spiral, and one for upward - /* 0x08 */ s32 unk8; // unused - /* 0x0C */ u8 unkC; // unused - /* 0x0D */ u8 unkD; // unused - /* 0x0E */ u8 spiralWidth; - /* 0x0F */ u8 spiralHeight; -} SpiralInfo; - -// Maps SpiralObjectType to SpiralType -typedef struct { - /* 0x00 */ s16 objectBankId; - /* 0x02 */ u8 spiralType; -} SpiralObjectInfo; - -// Maps scenes to SpiralObjectType -typedef struct { - /* 0x00 */ s16 sceneId; - /* 0x02 */ u8 objectType; -} SpiralSceneInfo; - void DoorSpiral_Init(Actor* thisx, PlayState* play); void DoorSpiral_Destroy(Actor* thisx, PlayState* play); void DoorSpiral_Update(Actor* thisx, PlayState* play); void DoorSpiral_Draw(Actor* thisx, PlayState* play); -void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play); -void DoorSpiral_Wait(DoorSpiral* this, PlayState* play); -void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play); - -ActorInit Door_Spiral_InitVars = { +/* +const ActorInit Door_Spiral_InitVars = { ACTOR_DOOR_SPIRAL, ACTORCAT_DOOR, FLAGS, @@ -76,257 +31,30 @@ ActorInit Door_Spiral_InitVars = { (ActorFunc)DoorSpiral_Init, (ActorFunc)DoorSpiral_Destroy, (ActorFunc)DoorSpiral_Update, - (ActorFunc)DoorSpiral_Draw, + (ActorFunc)DoorSpiral_Draw }; +*/ -// Parameters for each staircase, indexed with SpiralType -static SpiralInfo sSpiralInfo[] = { - { { NULL, NULL }, 0, 130, 12, 50, 15 }, // SPIRAL_OVERWORLD - { { gameplay_dangeon_keep_DL_0219E0, gameplay_dangeon_keep_DL_01D980 }, 0, 130, 12, 50, 15 }, // SPIRAL_DUNGEON - { { object_numa_obj_DL_004448, object_numa_obj_DL_0007A8 }, 0, 130, 12, 50, 15 }, // SPIRAL_WOODFALL_TEMPLE - { { object_numa_obj_DL_0051B8, object_numa_obj_DL_0014C8 }, 0, 130, 12, 50, 15 }, // SPIRAL_WOODFALL_TEMPLE_ALT - { { object_hakugin_obj_DL_009278, object_hakugin_obj_DL_006128 }, 0, 130, 12, 50, 15 }, // SPIRAL_SNOWHEAD_TEMPLE - { { object_ikana_obj_DL_013EA8, object_ikana_obj_DL_012B70 }, 0, 130, 12, 50, 15 }, // SPIRAL_STONE_TOWER - { { object_ikninside_obj_DL_000EA0, object_ikninside_obj_DL_000590 }, 0, 130, 12, 50, 15 }, // SPIRAL_IKANA_CASTLE - { { object_danpei_object_DL_002110, object_danpei_object_DL_0012C0 }, 0, 130, 12, 50, 15 }, // SPIRAL_DAMPES_HOUSE -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2B60.s") -// Defines which object bank a staircase should use, and its index to `sSpiralInfo` -static SpiralObjectInfo sSpiralObjectInfo[] = { - { GAMEPLAY_KEEP, SPIRAL_OVERWORLD }, { GAMEPLAY_DANGEON_KEEP, SPIRAL_DUNGEON }, - { OBJECT_NUMA_OBJ, SPIRAL_WOODFALL_TEMPLE }, { OBJECT_HAKUGIN_OBJ, SPIRAL_SNOWHEAD_TEMPLE }, - { OBJECT_IKANA_OBJ, SPIRAL_STONE_TOWER }, { OBJECT_DANPEI_OBJECT, SPIRAL_DAMPES_HOUSE }, - { OBJECT_IKNINSIDE_OBJ, SPIRAL_IKANA_CASTLE }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2B70.s") -/** - * Sets the actor's action function - */ -void DoorSpiral_SetupAction(DoorSpiral* this, DoorSpiralActionFunc actionFunc) { - this->actionFunc = actionFunc; - this->unk14A = 0; // set but never used -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2BF8.s") -/** - * Sets this->spiralType, which is derived from `sSpiralObjectInfo`, and is used as an index to `sSpiralInfo`. - */ -s32 DoorSpiral_SetSpiralType(DoorSpiral* this, PlayState* play) { - SpiralObjectInfo* doorObjectInfo = &sSpiralObjectInfo[this->objectType]; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Init.s") - this->spiralType = doorObjectInfo->spiralType; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Destroy.s") - if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.curRoom.enablePosLights)) { - if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { - this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2DB0.s") - this->actor.flags |= ACTOR_FLAG_10000000; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2E08.s") - DoorSpiral_SetupAction(this, DoorSpiral_Wait); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2EA0.s") - return 0; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2FF8.s") -/** - * Gets the object type to be used as an index to `sSpiralObjectInfo`. - * It first checks `sSpiralSceneInfo`, but if the current scene is not found it will fall back to the default spiral - * (overworld or dungeon). - */ -s32 DoorSpiral_GetObjectType(PlayState* play) { - // Defines which object type should be used for specific scenes - static SpiralSceneInfo spiralSceneInfo[] = { - { SCENE_MITURIN, SPIRAL_OBJECT_WOODFALL }, { SCENE_HAKUGIN, SPIRAL_OBJECT_SNOWHEAD }, - { SCENE_INISIE_N, SPIRAL_OBJECT_STONE_TOWER }, { SCENE_INISIE_R, SPIRAL_OBJECT_STONE_TOWER }, - { SCENE_DANPEI2TEST, SPIRAL_OBJECT_DAMPES_HOUSE }, { SCENE_IKNINSIDE, SPIRAL_OBJECT_IKANA_CASTLE }, - { SCENE_CASTLE, SPIRAL_OBJECT_IKANA_CASTLE }, - }; - SpiralSceneInfo* sceneInfo = spiralSceneInfo; - s32 i; - s32 type; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A3098.s") - for (i = 0; i < ARRAY_COUNT(spiralSceneInfo); sceneInfo++, i++) { - if (play->sceneId == sceneInfo->sceneId) { - break; - } - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Update.s") - type = i; - - if (type < ARRAY_COUNT(spiralSceneInfo)) { - type = sceneInfo->objectType; - } else { - // Set the type based on if link is in a dungeon scene, or the overworld - type = (Object_GetIndex(&play->objectCtx, GAMEPLAY_DANGEON_KEEP) >= 0) ? SPIRAL_OBJECT_DUNGEON - : SPIRAL_OBJECT_OVERWORLD; - } - - return type; -} - -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), -}; - -void DoorSpiral_Init(Actor* thisx, PlayState* play) { - DoorSpiral* this = THIS; - s32 pad; - s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); - s8 objBankId; - - if (this->actor.room != play->doorCtx.transitionActorList[transition].sides[0].room) { - Actor_Kill(&this->actor); - return; - } - - Actor_ProcessInitChain(&this->actor, sInitChain); - this->unk145 = DOORSPIRAL_GET_UNK145(thisx); // set but never used - this->orientation = DOORSPIRAL_GET_ORIENTATION(thisx); - this->objectType = DoorSpiral_GetObjectType(play); - objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId); - this->bankIndex = objBankId; - - if (objBankId < 0) { - Actor_Kill(&this->actor); - return; - } - - DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); - Actor_SetFocus(&this->actor, 60.0f); -} - -void DoorSpiral_Destroy(Actor* thisx, PlayState* play) { - s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); - - play->doorCtx.transitionActorList[transition].id *= -1; -} - -/** - * Waits for the required object to be loaded. - */ -void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - DoorSpiral_SetSpiralType(this, play); - } -} - -/** - * Finds the distance between the stairs and the player. - */ -f32 DoorSpiral_GetDistFromPlayer(PlayState* play, DoorSpiral* this, f32 yOffset, f32 spiralWidth, f32 spiralHeight) { - Player* player = GET_PLAYER(play); - Vec3f target; - Vec3f offset; - - target.x = player->actor.world.pos.x; - target.y = player->actor.world.pos.y + yOffset; - target.z = player->actor.world.pos.z; - - Actor_OffsetOfPointInActorCoords(&this->actor, &offset, &target); - - if ((spiralWidth < fabsf(offset.x)) || (spiralHeight < fabsf(offset.y))) { - return FLT_MAX; - } - - return offset.z; -} - -/** - * Checks if the player should climb the stairs. - */ -s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, PlayState* play) { - Player* player = GET_PLAYER(play); - - if (!Player_InCsMode(play)) { - SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; - f32 dist = DoorSpiral_GetDistFromPlayer(play, this, 0.0f, spiralInfo->spiralWidth, spiralInfo->spiralHeight); - - if (fabsf(dist) < 64.0f) { - s16 angle = player->actor.shape.rot.y - this->actor.shape.rot.y; - - if (dist > 0.0f) { - angle = 0x8000 - angle; - } - - if (ABS_ALT(angle) < 0x3000) { - return (dist >= 0.0f) ? 1.0f : -1.0f; - } - } - } - - return 0; -} - -/** - * Wait for the player to interact with the stairs. - */ -void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) { - Player* player; - s32 transition; - - if (this->shouldClimb) { - DoorSpiral_SetupAction(this, DoorSpiral_PlayerClimb); - } else if (DoorSpiral_PlayerShouldClimb(this, play)) { - player = GET_PLAYER(play); - - player->doorType = PLAYER_DOORTYPE_STAIRCASE; - player->doorDirection = this->orientation; - player->doorActor = &this->actor; - transition = DOORSPIRAL_GET_TRANSITION_ID(&this->actor); - player->doorNext = ((u16)play->doorCtx.transitionActorList[transition].params) >> 10; - - func_80122F28(player); - } -} - -/** - * Player is climbing the stairs. - */ -void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play) { - Player* player = GET_PLAYER(play); - - if (!(player->stateFlags1 & PLAYER_STATE1_20000000)) { - DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); - this->shouldClimb = 0; - } -} - -void DoorSpiral_Update(Actor* thisx, PlayState* play) { - DoorSpiral* this = THIS; - s32 pad; - Player* player = GET_PLAYER(play); - - if (!(player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || - (this->actionFunc == DoorSpiral_WaitForObject)) { - this->actionFunc(this, play); - } -} - -void DoorSpiral_Draw(Actor* thisx, PlayState* play) { - s32 pad; - DoorSpiral* this = THIS; - - if (this->actor.objBankIndex == this->bankIndex) { - SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; - Gfx* dList; - - // Set the model to render based on the orientation of the stairs (upward or downward) - dList = spiralInfo->spiralDL[this->orientation]; - - if (dList != NULL) { - OPEN_DISPS(play->state.gfxCtx); - - func_8012C28C(play->state.gfxCtx); - - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, spiralInfo->spiralDL[this->orientation]); - - CLOSE_DISPS(play->state.gfxCtx); - } - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Draw.s") diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h index 0f3e32a39..701b38639 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h @@ -5,22 +5,9 @@ struct DoorSpiral; -#define DOORSPIRAL_GET_ORIENTATION(thisx) (((thisx)->params >> 7) & 0x1) -#define DOORSPIRAL_GET_UNK145(thisx) (((thisx)->params >> 8) & 0x3) -#define DOORSPIRAL_GET_TRANSITION_ID(thisx) ((u16)(thisx)->params >> 10) - -typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*); - typedef struct DoorSpiral { /* 0x000 */ Actor actor; - /* 0x144 */ u8 shouldClimb; // Flag used to determine if the player should climb the stairs - /* 0x145 */ u8 unk145; - /* 0x146 */ u8 orientation; // Upward or downward staircase - /* 0x147 */ u8 objectType; // Index to list of objects - /* 0x148 */ u8 spiralType; // Type of skin the staircase should use - /* 0x149 */ s8 bankIndex; // Object bank to use - /* 0x14A */ s8 unk14A; - /* 0x14C */ DoorSpiralActionFunc actionFunc; + /* 0x144 */ char unk_144[0xC]; } DoorSpiral; // size = 0x150 #endif // Z_DOOR_SPIRAL_H diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 7ec2245d7..57fa310e1 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -4,6 +4,7 @@ * Description: Blue warp portal and crystal, and the Majora's Mask-shaped boss warp platform */ +#include "prevent_bss_reordering.h" #include "z_door_warp1.h" #include "objects/object_warp1/object_warp1.h" @@ -328,7 +329,7 @@ void func_808B90CC(DoorWarp1* this, PlayState* play) { DoorWarp1_SetupAction(this, func_808B921C); } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE_ENERGY - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WARP_HOLE_ENERGY - SFX_FLAG); } void func_808B921C(DoorWarp1* this, PlayState* play) { @@ -349,7 +350,7 @@ void func_808B921C(DoorWarp1* this, PlayState* play) { DoorWarp1_SetupAction(this, func_808B93A0); } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } void func_808B93A0(DoorWarp1* this, PlayState* play) { @@ -357,7 +358,7 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (play->msgCtx.choiceIndex == 0) { func_8019F208(); func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_9); @@ -372,7 +373,7 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { } } func_808BB8D4(this, play, 1); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } void func_808B94A4(DoorWarp1* this, PlayState* play) { @@ -380,7 +381,7 @@ void func_808B94A4(DoorWarp1* this, PlayState* play) { DoorWarp1_SetupAction(this, func_808B921C); } func_808BB8D4(this, play, 1); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BOSS_WARP_HOLE - SFX_FLAG); } void func_808B9524(DoorWarp1* this, PlayState* play) { @@ -415,14 +416,14 @@ void func_808B958C(DoorWarp1* this, PlayState* play) { } Math_SmoothStepToF(&this->unk_1A8, 6.0f, 0.2f, 0.02f, 0.01f); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_LINK_WARP - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_LINK_WARP - SFX_FLAG); } void func_808B96A0(DoorWarp1* this, PlayState* play) { } void func_808B96B0(DoorWarp1* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->unk_1B0, 255.0f, 0.4f, 10.0f, 0.01f); Math_SmoothStepToF(&this->unk_1B4, 255.0f, 0.4f, 10.0f, 0.01f); @@ -442,7 +443,7 @@ void func_808B96B0(DoorWarp1* this, PlayState* play) { } void func_808B977C(DoorWarp1* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); if (func_808B866C(this, play) && !Play_InCsMode(play)) { Player* player = GET_PLAYER(play); @@ -515,7 +516,7 @@ void func_808B9B30(DoorWarp1* this, PlayState* play) { } void func_808B9BE8(DoorWarp1* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); Math_SmoothStepToF(&this->unk_1B0, 255.0f, 0.2f, 2.0f, 0.1f); Math_SmoothStepToF(&this->unk_1B4, 255.0f, 0.2f, 2.0f, 0.1f); if (this->unk_1C4 < 10) { @@ -547,7 +548,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { } if (!Actor_HasParent(&this->dyna.actor, play)) { - Actor_PickUp(&this->dyna.actor, play, (GI_REMAINS_ODOLWA - 1) + func_808B849C(this, play), 30.0f, 80.0f); + Actor_OfferGetItem(&this->dyna.actor, play, (GI_REMAINS_ODOLWA - 1) + func_808B849C(this, play), 30.0f, 80.0f); return; } @@ -594,7 +595,7 @@ void func_808B9ED8(DoorWarp1* this, PlayState* play) { } void func_808B9F10(DoorWarp1* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); if ((this->unk_203 == 0) && func_808B866C(this, play) && !Play_InCsMode(play) && (this->unk_203 == 0)) { Player* player = GET_PLAYER(play); @@ -652,7 +653,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { if (this->unk_202 != 0) { if (phi_v0_2 > 0) { - SET_WEEKEVENTREG(WEEKEVENTREG_07_80); + SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON); } switch (phi_v0_2) { @@ -711,7 +712,8 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { switch (phi_v0_2) { case 0: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { - SET_WEEKEVENTREG(WEEKEVENTREG_07_80); + // Skips the entrance cutscene as this flag is attached to `ENTRANCE(WOODFALL_TEMPLE, 1)` + SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON); play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c index 75ff275a1..0ebb5139d 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c @@ -90,7 +90,7 @@ void func_80BCEC6C(EffKamejimaWave* this, PlayState* play) { this->actor.draw = EffKamejimaWave_Draw; sVtxAlpha = 255; this->actor.shape.rot.x = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORTOISE_WAKE_UP); + Actor_PlaySfx(&this->actor, NA_SE_EV_TORTOISE_WAKE_UP); } } else { this->actor.draw = NULL; diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c index 0041f1e99..015e9e715 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c @@ -195,7 +195,7 @@ void func_80BEBF78(EffLastday* this, PlayState* play) { case EFFLASTDAY_ACTION_2: if (!this->actor.home.rot.z) { this->actor.home.rot.z = true; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_COMING_FIRE); + Actor_PlaySfx(&this->actor, NA_SE_EV_COMING_FIRE); } this->actor.draw = EffLastday_Draw; if (this->alpha < 255) { diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c index 0ffb5c758..1507da5e2 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c @@ -278,7 +278,7 @@ void func_80BA1CF8(ElfMsg6* this, PlayState* play) { if ((this->actor.textId == 0x224) && CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actor.textId = 0x25B; - } else if (func_80BA1C00(this) && (player->actor.speedXZ > 1.0f)) { + } else if (func_80BA1C00(this) && (player->actor.speed > 1.0f)) { player->tatlTextId = -this->actor.textId; ActorCutscene_SetIntentToPlay(0x7C); sp20->elfMsg = &this->actor; @@ -319,7 +319,7 @@ void func_80BA1E30(ElfMsg6* this, PlayState* play) { return; } - if (func_80BA1C00(this) && (player->actor.speedXZ > 1.0f)) { + if (func_80BA1C00(this) && (player->actor.speed > 1.0f)) { player->tatlTextId = -this->actor.textId; ActorCutscene_SetIntentToPlay(0x7C); sp20->elfMsg = &this->actor; diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index d2bdf0cee..d22c2d258 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -129,10 +129,10 @@ static InitChainEntry sInitChain[] = { }; void func_80BECBE0(EnAkindonuts* this, s16 arg1) { - f32 sp24 = Math_CosS(this->actor.world.rot.x) * this->actor.speedXZ; + f32 sp24 = Math_CosS(this->actor.world.rot.x) * this->actor.speed; this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * sp24; - this->actor.velocity.y = Math_SinS(this->actor.world.rot.x) * this->actor.speedXZ; + this->actor.velocity.y = Math_SinS(this->actor.world.rot.x) * this->actor.speed; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * sp24; if (arg1) { @@ -1084,10 +1084,10 @@ void func_80BEE73C(EnAkindonuts* this, PlayState* play) { this->unk_33C = player->actor.textId; this->actionFunc = func_80BEF18C; } - func_801477B4(play); + Message_CloseTextbox(play); } else if (itemAction <= PLAYER_IA_MINUS1) { this->unk_33C = D_80BF04AC[params]; - func_80151938(play, this->unk_33C); + Message_ContinueTextbox(play, this->unk_33C); this->actionFunc = func_80BEF18C; } } @@ -1173,7 +1173,7 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { } if (phi_v0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80BEEDC0; this->unk_338 = 3; this->collider.dim.height = 64; @@ -1186,12 +1186,12 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { if ((this->unk_338 == 4) || (this->unk_338 == 18)) { this->unk_338 = 17; this->collider.dim.height = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_338 == 2) { this->unk_338 = 16; this->collider.dim.height = 32; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_338 == 17) { phi_v0 = DECR(this->unk_33A); @@ -1330,19 +1330,19 @@ void func_80BEF360(EnAkindonuts* this, PlayState* play) { this->unk_32C &= ~0x40; this->actionFunc = func_80BEF450; } else { - Actor_PickUp(&this->actor, play, func_80BED034(this), 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, func_80BED034(this), 300.0f, 300.0f); } } else if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; this->actionFunc = func_80BEF450; } else { - Actor_PickUp(&this->actor, play, func_80BECFBC(this), 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, func_80BECFBC(this), 300.0f, 300.0f); } } void func_80BEF450(EnAkindonuts* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_80BEF4B8; } } @@ -1352,7 +1352,7 @@ void func_80BEF4B8(EnAkindonuts* this, PlayState* play) { this->unk_2DC(this, play); this->actionFunc = func_80BEEFA8; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -1433,7 +1433,7 @@ void func_80BEF518(EnAkindonuts* this, PlayState* play) { this->unk_33E = 3; this->unk_338 = 19; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_32C &= ~2; this->unk_32C |= 0x80; this->unk_358 = this->actor.world.pos.y; @@ -1492,7 +1492,7 @@ void func_80BEF83C(EnAkindonuts* this, PlayState* play) { this->unk_34C = 0.3f; this->unk_338 = 9; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80BEF9F0; } } @@ -1529,7 +1529,7 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { if (this->path != NULL) { sp34 = func_80BECEAC(this->path, this->unk_334, &this->actor.world.pos, &sp38); - if (this->actor.bgCheckFlags & 0x8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp38.y = this->actor.wallYaw; } @@ -1561,9 +1561,9 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { if (this->unk_334 >= 3) { sp32 = true; } - Math_ApproachF(&this->actor.speedXZ, 1.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.5f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.2f, 1.0f); } func_80BECBE0(this, sp32); diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index da1cc7d7e..443065633 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -257,7 +257,7 @@ s32 func_80BDE4E0(EnAl* this, s16* arg1, s16 arg2) { } if (arg2 == *arg1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); func_80BDE27C(this, 3); this->unk_4E8 = 0; (*arg1)++; @@ -292,7 +292,7 @@ s32 func_80BDE678(EnAl* this, s16* arg1, s16 arg2) { } if (arg2 == *arg1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); func_80BDE27C(this, 4); this->unk_4E8 = 0; (*arg1)++; diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index f76ebc4f3..73d9ffc57 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -198,7 +198,7 @@ void EnAm_SpawnEffects(EnAm* this, PlayState* play) { effectPos.z = randPlusMinusPoint5Scaled(65.0f) + this->actor.world.pos.z; EffectSsKirakira_SpawnSmall(play, &effectPos, &sVelocity, &sAccel, &D_808B1118, &D_808B111C); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 4.0f, 3, 8.0f, 300, 15, 0); } @@ -231,8 +231,8 @@ void EnAm_RemoveEnemyTexture(EnAm* this, PlayState* play) { } void EnAm_WakeUp(EnAm* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_WAVE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_WAVE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_VOICE); this->returnHomeTimer = 300; this->actionFunc = EnAm_ApplyEnemyTexture; } @@ -265,22 +265,22 @@ void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play) { void func_808B0208(EnAm* this, PlayState* play) { // If the armos is against a wall, rotate and turn away from it - if ((this->actor.speedXZ > 0.0f) && (this->actor.bgCheckFlags & 8)) { + if ((this->actor.speed > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->actor.world.rot.y = (this->actor.wallYaw * 2) - this->actor.world.rot.y; - this->actor.world.pos.x += this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); - this->actor.world.pos.z += this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); + this->actor.world.pos.x += this->actor.speed * Math_SinS(this->actor.world.rot.y); + this->actor.world.pos.z += this->actor.speed * Math_CosS(this->actor.world.rot.y); } SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 8.0f) != 0) { - this->actor.speedXZ = this->speed; + this->actor.speed = this->speed; this->actor.velocity.y = 12.0f; } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11.0f; } else { Math_ScaledStepToS(&this->actor.world.rot.y, this->armosYaw, 0x1F40); - this->actor.speedXZ = 0.0f; - if (this->actor.bgCheckFlags & 2) { + this->actor.speed = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { EnAm_SpawnEffects(this, play); } } @@ -293,7 +293,7 @@ void func_808B0208(EnAm* this, PlayState* play) { void func_808B0358(EnAm* this) { Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f); this->explodeTimer = 3; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->speed = 6.0f; this->actionFunc = func_808B03C0; @@ -302,12 +302,12 @@ void func_808B0358(EnAm* this) { void func_808B03C0(EnAm* this, PlayState* play) { this->armosYaw = this->actor.yawTowardsPlayer; func_808B0208(this, play); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->explodeTimer--; } if (this->explodeTimer == 0) { func_808B0640(this); - } else if ((this->returnHomeTimer == 0) || Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 240.0f) { + } else if ((this->returnHomeTimer == 0) || Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 240.0f) { func_808B0460(this); } } @@ -315,7 +315,7 @@ void func_808B03C0(EnAm* this, PlayState* play) { void func_808B0460(EnAm* this) { this->actor.world.rot.y = this->actor.shape.rot.y; this->speed = 0.0f; - this->armosYaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->armosYaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->actionFunc = func_808B04A8; } @@ -334,7 +334,7 @@ void func_808B04E4(EnAm* this) { void func_808B0508(EnAm* this, PlayState* play) { func_808B0208(this, play); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 2.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 2.0f); } @@ -345,15 +345,15 @@ void func_808B0508(EnAm* this, PlayState* play) { void func_808B057C(EnAm* this) { this->speed = 6.0f; - this->armosYaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->armosYaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->explodeTimer = 1; this->actionFunc = func_808B05C8; } void func_808B05C8(EnAm* this, PlayState* play) { - this->armosYaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->armosYaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); func_808B0208(this, play); - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 8.0f) { + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 8.0f) { func_808B04E4(this); } } @@ -372,7 +372,7 @@ void func_808B066C(EnAm* this, PlayState* play) { this->armosYaw = this->actor.yawTowardsPlayer; func_808B0208(this, play); if (this->armosYaw == this->actor.shape.rot.y) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_VOICE); func_808B0358(this); } } @@ -382,16 +382,17 @@ void EnAm_TakeDamage(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosTakeDamageAnim, 1.0f, 4.0f, Animation_GetLastFrame(&gArmosTakeDamageAnim) - 6, ANIMMODE_ONCE, 0.0f); func_800BE504(&this->actor, &this->enemyCollider); - this->actor.speedXZ = 6.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, Animation_GetLastFrame(&gArmosTakeDamageAnim) - 10); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); + this->actor.speed = 6.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, + Animation_GetLastFrame(&gArmosTakeDamageAnim) - 10); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); this->enemyCollider.base.acFlags &= ~AC_ON; this->textureBlend = 255; this->actionFunc = func_808B07A8; } void func_808B07A8(EnAm* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { func_808B0820(this); @@ -407,7 +408,7 @@ void func_808B0820(EnAm* this) { this->explodeTimer = 64; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.flags |= ACTOR_FLAG_10; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->speed = 6.0f; this->actionFunc = func_808B0894; } @@ -426,7 +427,7 @@ void func_808B0894(EnAm* this, PlayState* play) { if (bomb != NULL) { bomb->timer = 0; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEAD); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); for (i = 0; i < 8; i++) { @@ -440,7 +441,7 @@ void func_808B0894(EnAm* this, PlayState* play) { Actor_Kill(&this->actor); return; } else if (!(this->explodeTimer & 3)) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 4); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 4); } if (this->actor.world.rot.z < 0x1F40) { this->actor.world.rot.z += 0x320; @@ -451,12 +452,12 @@ void func_808B0894(EnAm* this, PlayState* play) { void func_808B0AD0(EnAm* this, PlayState* play) { Animation_Change(&this->skelAnime, &gArmosPushedBackAnim, 1.0f, 0.0f, 8.0f, ANIMMODE_ONCE, 0.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; this->actionFunc = func_808B0B4C; } void func_808B0B4C(EnAm* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { func_808B0358(this); } diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 8e98ae8a3..b2a6456bc 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -211,7 +211,7 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) { s32 pad; s16 quakeIndex; - if (this->actor.bgCheckFlags & 1) { // hit the ground + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.flags &= ~ACTOR_FLAG_10; this->actionFunc = EnAni_LandOnFoot; this->actor.velocity.x = 0.0f; @@ -225,7 +225,7 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) { Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); Quake_SetCountdown(quakeIndex, 20); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HAMMER_HIT); + Actor_PlaySfx(&this->actor, NA_SE_IT_HAMMER_HIT); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2, 0x7D0, 0x100); diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 84feccbd8..97bc517c9 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -130,7 +130,7 @@ void func_809C11EC(EnAob01* this, PlayState* play) { this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_DG, D_809C384C[i].unk_00.x, D_809C384C[i].unk_00.y, D_809C384C[i].unk_00.z, - 0, D_809C384C[i].unk_04 * 182.04445f, 0, enDgParams, 0xFFFF, this->actor.unk20, NULL); + 0, DEG_TO_BINANG(D_809C384C[i].unk_04), 0, enDgParams, 0xFFFF, this->actor.halfDaysBits, NULL); } } @@ -140,7 +140,7 @@ void func_809C1304(EnAob01* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->unk_3F8); i++) { this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_RACEDOG, (i * 15.0f) + -3897.0f, 130.0f, 1290.0f - (i * 10.0f), 0, 0x1555, - 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), 0xFFFF, this->actor.unk20, NULL); + 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), 0xFFFF, this->actor.halfDaysBits, NULL); } } @@ -414,8 +414,8 @@ void func_809C16DC(EnAob01* this, PlayState* play) { void func_809C1C9C(EnAob01* this, PlayState* play) { if (gSaveContext.rupeeAccumulator == 0) { - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->unk_2D2 |= 0x20; func_800FD750(0x40); play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); @@ -673,7 +673,7 @@ void func_809C2730(EnAob01* this, PlayState* play) { void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; if (func_809C25E4(this, play)) { - if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; play->transitionType = TRANS_TYPE_64; @@ -770,9 +770,9 @@ void func_809C2A64(EnAob01* this, PlayState* play) { this->actionFunc = func_809C2BE4; } } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_20)) { - Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); } } } @@ -781,16 +781,16 @@ void func_809C2BE4(EnAob01* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); } this->unk_210 = 0; - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); gSaveContext.eventInf[0] &= (u8)~7; this->actionFunc = func_809C2C9C; } @@ -799,10 +799,10 @@ void func_809C2BE4(EnAob01* this, PlayState* play) { void func_809C2C9C(EnAob01* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_210 = 0x354C; - func_80151938(play, this->unk_210); + Message_ContinueTextbox(play, this->unk_210); this->actionFunc = func_809C1D64; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -835,12 +835,12 @@ void func_809C2D0C(EnAob01* this, PlayState* play) { this->unk_434 = 0; this->actor.shape.rot.y = this->actor.world.rot.y; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); } this->unk_210 = 0x354C; @@ -969,7 +969,7 @@ void EnAob01_Destroy(Actor* thisx, PlayState* play) { EnAob01* this = THIS; if (!(this->unk_2D2 & 0x20)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); } Collider_DestroyCylinder(play, &this->collider); } @@ -1034,8 +1034,8 @@ void EnAob01_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnAob01_Draw(Actor* thisx, PlayState* play) { s32 pad; EnAob01* this = THIS; - Vec3f sp5C; - Vec3f sp50; + Vec3f pos; + Vec3f scale; OPEN_DISPS(play->state.gfxCtx); @@ -1051,11 +1051,11 @@ void EnAob01_Draw(Actor* thisx, PlayState* play) { if (this->actor.draw != NULL) { func_8012C2DC(play->state.gfxCtx); - sp5C = this->actor.world.pos; - sp50.x = 0.5f; - sp50.y = 0.5f; - sp50.z = 0.5f; - func_800BC620(&sp5C, &sp50, 0xFF, play); + pos = this->actor.world.pos; + scale.x = 0.5f; + scale.y = 0.5f; + scale.z = 0.5f; + func_800BC620(&pos, &scale, 255, play); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index b07e65de3..c7077e56e 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -78,9 +78,9 @@ void EnArrow_Init(Actor* thisx, PlayState* play) { EnArrow* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - if (this->actor.params == ENARROW_MINUS8) { + if (this->actor.params == -ENARROW_8) { this->unk_263 = 1; - this->actor.params = 8; + this->actor.params = ENARROW_8; } if (this->actor.params < ENARROW_6) { @@ -113,7 +113,7 @@ void EnArrow_Init(Actor* thisx, PlayState* play) { if (this->actor.params < ENARROW_0) { this->collider.base.atFlags = (AT_TYPE_ENEMY | AT_ON); } else { - this->collider.info.toucher.dmgFlags = func_800BC188(this->actor.params); + this->collider.info.toucher.dmgFlags = Actor_GetArrowDmgFlags(this->actor.params); if (this->actor.params == ENARROW_8) { this->collider.info.toucher.damage = 1; } @@ -176,22 +176,22 @@ void func_8088A594(EnArrow* this, PlayState* play) { switch (this->actor.params) { case ENARROW_6: - func_800B8E58(player, NA_SE_IT_SLING_SHOT); + Player_PlaySfx(player, NA_SE_IT_SLING_SHOT); break; case ENARROW_0: case ENARROW_1: case ENARROW_2: - func_800B8E58(player, NA_SE_IT_ARROW_SHOT); + Player_PlaySfx(player, NA_SE_IT_ARROW_SHOT); break; case ENARROW_3: case ENARROW_4: case ENARROW_5: - func_800B8E58(player, NA_SE_IT_MAGIC_ARROW_SHOT); + Player_PlaySfx(player, NA_SE_IT_MAGIC_ARROW_SHOT); case ENARROW_7: - func_800B8E58(player, NA_SE_PL_DEKUNUTS_FIRE); + Player_PlaySfx(player, NA_SE_PL_DEKUNUTS_FIRE); break; } @@ -225,7 +225,7 @@ void func_8088A7D8(PlayState* play, EnArrow* this) { this->actionFunc = func_8088B6B0; Animation_PlayOnce(&this->arrow.skelAnime, &gameplay_keep_Anim_012860); this->actor.world.rot.y += (s32)(0x6000 * (Rand_ZeroOne() - 0.5f)) + 0x8000; - this->actor.speedXZ *= 0.02f + (0.02f * Rand_ZeroOne()); + this->actor.speed *= 0.02f + (0.02f * Rand_ZeroOne()); this->actor.gravity = -1.5f; this->unk_260 = 50; this->unk_263 = 1; @@ -273,8 +273,8 @@ void func_8088AA98(EnArrow* this, PlayState* play) { f32 temp_f0; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && - (this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & 0x20)) { - this->actor.bgCheckFlags |= 0x20; + (this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { + this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.home.pos, &sp44); @@ -289,7 +289,7 @@ void func_8088AA98(EnArrow* this, PlayState* play) { EffectSsGSplash_Spawn(play, &sp44, NULL, NULL, 0, 300); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); EffectSsGRipple_Spawn(play, &sp44, 100, 500, 0); EffectSsGRipple_Spawn(play, &sp44, 100, 500, 4); @@ -373,9 +373,9 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { } if (this->actor.params == ENARROW_8) { - iREG(50) = -1; + R_TRANS_FADE_FLASH_ALPHA_STEP = -1; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_M_FIRE1, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, this->actor.speedXZ == 0.0f); + this->actor.world.pos.z, 0, 0, 0, this->actor.speed == 0.0f); sp82 = NA_SE_IT_DEKU; } else { sp82 = NA_SE_IT_SLING_REFLECT; @@ -396,14 +396,14 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { Math_Vec3f_Diff(&sp7C->world.pos, &this->actor.world.pos, &this->unk_268); sp7C->flags |= ACTOR_FLAG_8000; this->collider.base.atFlags &= ~AT_HIT; - this->actor.speedXZ *= 0.5f; + this->actor.speed *= 0.5f; this->actor.velocity.y *= 0.5f; } else { this->unk_261 |= 1; this->unk_261 |= 2; Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); func_8088A7D8(play, this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HOOKSHOT_STICK_CRE); + Actor_PlaySfx(&this->actor, NA_SE_IT_HOOKSHOT_STICK_CRE); } } else if (this->unk_262 != 0) { this->actionFunc = func_8088B630; @@ -416,7 +416,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { if ((this->actor.params >= ENARROW_3) && (this->actor.params < ENARROW_6)) { this->actor.draw = NULL; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_ARROW_STICK_OBJ); + Actor_PlaySfx(&this->actor, NA_SE_IT_ARROW_STICK_OBJ); this->unk_261 |= 1; } } @@ -424,9 +424,9 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { func_8088AA98(this, play); if (this->actor.params == ENARROW_7) { if (this->bubble.unk_149 == 0) { - sp78 = sqrtf(SQ(this->actor.speedXZ) + SQ(this->actor.velocity.y)); - sp74 = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; - temp_f12_2 = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + sp78 = sqrtf(SQ(this->actor.speed) + SQ(this->actor.velocity.y)); + sp74 = Math_SinS(this->actor.world.rot.y) * this->actor.speed; + temp_f12_2 = Math_CosS(this->actor.world.rot.y) * this->actor.speed; this->actor.prevPos.x = this->actor.world.pos.x - (sp74 * (10.0f / sp78)); this->actor.prevPos.y = this->actor.world.pos.y - (this->actor.velocity.y * (10.0f / sp78)); @@ -456,7 +456,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_228, &this->actor.world.pos); - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { this->actor.velocity.y -= 1.0f; if (this->actor.velocity.y < this->actor.terminalVelocity) { this->actor.velocity.y = this->actor.terminalVelocity; @@ -474,7 +474,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { } if (this->actor.params < ENARROW_6) { - this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speedXZ, -this->actor.velocity.y); + this->actor.shape.rot.x = Math_Atan2S_XY(this->actor.speed, -this->actor.velocity.y); } } @@ -641,7 +641,7 @@ void EnArrow_Draw(Actor* thisx, PlayState* play) { &this->actor, this->actor.projectedPos.z < 160.0f ? 0 : 1); } else if (this->actor.params == ENARROW_7) { s32 spA4 = 255 - (s32)(this->bubble.unk_144 * 4.0f); - f32 spA0 = (this->actor.speedXZ * 0.1f) + 1.0f; + f32 spA0 = (this->actor.speed * 0.1f) + 1.0f; f32 sp9C = (1.0f / spA0); OPEN_DISPS(play->state.gfxCtx); @@ -659,7 +659,7 @@ void EnArrow_Draw(Actor* thisx, PlayState* play) { MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 460.0f, MTXMODE_APPLY); - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { func_800B8118(&this->actor, play, MTXMODE_NEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_06F380); @@ -674,7 +674,7 @@ void EnArrow_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_06F9F0); } else { - func_800B8050(&this->actor, play, MTXMODE_NEW); + func_800B8050(&this->actor, play, 0); gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06F380); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, 0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, @@ -687,7 +687,7 @@ void EnArrow_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); return; - } else if (this->actor.speedXZ != 0.0f) { + } else if (this->actor.speed != 0.0f) { u8 sp63 = (Math_CosS(this->unk_260 * 5000) * 127.5f) + 127.5f; f32 sp5C; @@ -710,7 +710,7 @@ void EnArrow_Draw(Actor* thisx, PlayState* play) { Matrix_Push(); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { phi_v0 = 0; } else { phi_v0 = (play->gameplayFrames % 256) * 4000; diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h index d16dbd380..313dd86bb 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.h @@ -8,16 +8,15 @@ struct EnArrow; typedef void (*EnArrowActionFunc)(struct EnArrow*, PlayState*); enum { - /* -8 */ ENARROW_MINUS8 = -8, - /* 0 */ ENARROW_0 = 0, - /* 1 */ ENARROW_1, - /* 2 */ ENARROW_2, - /* 3 */ ENARROW_3, - /* 4 */ ENARROW_4, - /* 5 */ ENARROW_5, - /* 6 */ ENARROW_6, - /* 7 */ ENARROW_7, - /* 8 */ ENARROW_8, + /* 0 */ ENARROW_0, // Lit arrow + /* 1 */ ENARROW_1, // Horse arrow + /* 2 */ ENARROW_2, // Normal arrow + /* 3 */ ENARROW_3, // Fire arrow + /* 4 */ ENARROW_4, // Ice arrow + /* 5 */ ENARROW_5, // Light arrow + /* 6 */ ENARROW_6, // ? + /* 7 */ ENARROW_7, // Deku bubble + /* 8 */ ENARROW_8, // Deku Nut }; typedef struct { diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index b4501ffa0..630d0e599 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -213,7 +213,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { Vec3f flightTarget; s32 pad; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; // randomTargetCenterOffset is set in _Init, only needs to be set once // but the view is moving, so now we need to re-calculate the spot in space @@ -236,7 +236,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { Actor_SetFocus(&this->actor, this->targetHeight); Actor_GetScreenPos(play, &this->actor, &posX, &posY); - if (this->actor.bgCheckFlags & 8) { // touching a wall + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->targetRotY = this->actor.yawTowardsPlayer; this->targetRotX = this->actor.world.rot.x - 3000.0f; this->hopTimer = 0; @@ -255,7 +255,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { } else if (((this->actor.projectedPos.z > 0.0f) && (fabsf(flightTarget.x - this->actor.world.pos.x) < 50.0f) && (fabsf(flightTarget.y - this->actor.world.pos.y) < 50.0f) && (fabsf(flightTarget.z - this->actor.world.pos.z) < 50.0f)) || - (this->actor.bgCheckFlags & 1)) { // touching ground or with close distance of target + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { // reset state this->hopTimer = 0; this->unkTimer250 = this->hopTimer; @@ -286,7 +286,7 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 1) { // touching floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->hopTimer == 0) { this->hopTimer = 3; this->actor.velocity.y = 3.5f; @@ -314,19 +314,18 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 2, this->rotStep, 0); Math_SmoothStepToS(&this->actor.world.rot.x, this->targetRotX, 2, this->rotStep, 0); Math_ApproachF(&this->rotStep, 10000.0f, 1.0f, 1000.0f); - Math_ApproachF(&this->actor.speedXZ, this->targetXZSpeed, 0.9f, 1.0f); + Math_ApproachF(&this->actor.speed, this->targetXZSpeed, 0.9f, 1.0f); - if (this->actor.gravity == -2.0f && this->unkTimer25A == 0 && - (this->actor.bgCheckFlags & 8 || this->randomAngleChangeTimer == 0)) { + if ((this->actor.gravity == -2.0f) && (this->unkTimer25A == 0) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->randomAngleChangeTimer == 0))) { this->targetXZSpeed = 0.0f; this->actor.gravity = 0.0f; this->rotStep = 0.0f; this->targetRotX = this->actor.world.rot.x - 5000.0f; this->actionFunc = EnAttackNiw_FlyAway; - } else if (this->actor.bgCheckFlags & 1) { // touching floor + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_SLOW_FORFLAPPING); - } else { EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } @@ -380,8 +379,7 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { return; } - if ((this->actor.bgCheckFlags & 0x20) && // on or below water - (this->actionFunc != EnAttackNiw_FlyAway)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != EnAttackNiw_FlyAway)) { Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); splashPos.y += this->actor.depthInWater; EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, 400); @@ -408,12 +406,12 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { if (this->crySfxTimer == 0) { this->crySfxTimer = 30; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_A); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_A); } if (this->flutterSfxTimer == 0) { this->flutterSfxTimer = 7; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); } } } diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index e87bf9d62..ff865d99f 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -274,7 +274,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { this->collider.dim.yShift *= 1.2f; } Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 5); - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 22.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 22.0f)) { this->unk_374 |= 0x100; this->unk_376 |= 0x100; } @@ -437,9 +437,9 @@ s32 func_80A95534(PlayState* play, ActorPathing* actorPathing) { this->unk_36C = actorPathing->distSqToCurPointXZ; } } - Math_SmoothStepToF(&this->actor.speedXZ, this->unk_36C, 0.8f, 2.0f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, this->unk_36C, 0.8f, 2.0f, 0.0f); actorPathing->moveFunc = SubS_ActorPathing_MoveWithGravity; - if (actorPathing->distSqToCurPointXZ <= this->actor.speedXZ) { + if (actorPathing->distSqToCurPointXZ <= this->actor.speed) { ret = true; } return ret; @@ -454,11 +454,11 @@ s32 func_80A9565C(PlayState* play, ActorPathing* actorPathing) { actorPathing->moveFunc = func_80A94A90; this->unk_374 |= 0x2000; temp_f0 = func_80A954AC(this); - if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speedXZ)) || (temp_f0 <= 0.0f)) { + if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speed)) || (temp_f0 <= 0.0f)) { ret = true; } else { this->unk_39E = this->actor.world.rot.x = - Math_Atan2S(-this->actor.velocity.y, Math_CosS(-this->actor.world.rot.x) * this->actor.speedXZ); + Math_Atan2S(-this->actor.velocity.y, Math_CosS(-this->actor.world.rot.x) * this->actor.speed); } return ret; } @@ -474,10 +474,10 @@ s32 func_80A95730(PlayState* play, ActorPathing* actorPathing) { this->actor.gravity = 0.0f; temp_f0 = func_80A954AC(this); - if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speedXZ)) || (temp_f0 <= 0.0f)) { + if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speed)) || (temp_f0 <= 0.0f)) { ret = true; } else { - sp40 = SQ(this->actor.speedXZ) / actorPathing->distSqToCurPoint; + sp40 = SQ(this->actor.speed) / actorPathing->distSqToCurPoint; sp34 = ABS(actorPathing->rotToCurPoint.x - this->actor.world.rot.x); sp3C = (s32)(sp34 * sp40) + 0xAAA; @@ -521,12 +521,12 @@ s32 func_80A958B0(PlayState* play, ActorPathing* actorPathing) { } else { Math_SmoothStepToF(&this->unk_36C, 26.0f, 0.5f, 1.0f, 0.01f); } - Math_SmoothStepToF(&this->actor.speedXZ, this->unk_36C, 0.8f, 2.0f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, this->unk_36C, 0.8f, 2.0f, 0.0f); temp1 = func_80A954AC(this); - if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speedXZ)) || (temp1 <= 0.0f)) { + if ((actorPathing->distSqToCurPointXZ < SQ(this->actor.speed)) || (temp1 <= 0.0f)) { ret = true; } else { - sp3C = SQ(this->actor.speedXZ) / actorPathing->distSqToCurPoint; + sp3C = SQ(this->actor.speed) / actorPathing->distSqToCurPoint; sp30 = ABS(actorPathing->rotToCurPoint.x - this->actor.world.rot.x); sp2C = (s32)(sp30 * sp3C) + 0xAAA; sp30 = ABS(actorPathing->rotToCurPoint.y - this->actor.world.rot.y); @@ -560,7 +560,7 @@ s32 func_80A95B34(PlayState* play, ActorPathing* actorPathing) { } else { ret = func_80A958B0(play, actorPathing); } - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_374 & 8) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_WALK, &this->animIndex); this->unk_374 &= ~8; @@ -578,22 +578,22 @@ void func_80A95C5C(EnAz* this, PlayState* play) { this->actor.gravity = -1.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.bgCheckFlags &= ~0x21; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER); this->unk_3C0 = 0; this->actionFunc = func_80A95CEC; } void func_80A95CEC(EnAz* this, PlayState* play) { if (this->unk_374 & 0x8000) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.draw = EnAz_Draw; Actor_MoveWithGravity(&this->actor); func_800B9010(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); } else { - if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } if (SubS_StartActorCutscene(&this->actor, 0x7C, this->unk_3D0[0], SUBS_CUTSCENE_NORMAL)) { func_80A97C0C(this, play); @@ -608,12 +608,12 @@ void func_80A95DA0(EnAz* this, PlayState* play) { SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, sp40, play->setupPathList, BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 1); this->unk_36C = 4.0f; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->actor.gravity = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL, &this->animIndex); this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.bgCheckFlags &= ~0x21; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER); this->unk_374 |= 0x1000; Math_Vec3f_Copy(&this->actor.world.pos, &sp40->curPoint); this->actionFunc = func_80A95E88; @@ -625,7 +625,7 @@ void func_80A95E88(EnAz* this, PlayState* play) { if (this->actor.depthInWater > 8.0f) { if (this->unk_374 & 2) { if ((this->skelAnime.curFrame < this->skelAnime.playSpeed) && (this->skelAnime.curFrame >= 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BEAVER_SWIM_HAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BEAVER_SWIM_HAND); } } else { func_800B9010(&this->actor, NA_SE_EV_BEAVER_SWIM_MOTOR - SFX_FLAG); @@ -641,7 +641,7 @@ void func_80A95E88(EnAz* this, PlayState* play) { } void func_80A95F94(EnAz* this, PlayState* play) { - func_800BE33C(&this->actor.world.pos, &this->actor.home.pos, &this->actor.world.rot, 0); + func_800BE33C(&this->actor.world.pos, &this->actor.home.pos, &this->actor.world.rot, false); this->unk_39E = 0; this->actor.shape.rot.y = this->actor.world.rot.y; this->actionFunc = func_80A95FE8; @@ -654,9 +654,9 @@ void func_80A95FE8(EnAz* this, PlayState* play) { } else { ActorCutscene_SetIntentToPlay(this->unk_3D0[0]); } - if (Actor_DistanceToPoint(&this->actor, &this->actor.home.pos) > 20.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) > 20.0f) { func_800B9010(&this->actor, NA_SE_EV_BEAVER_SWIM_MOTOR - SFX_FLAG); - func_800BE33C(&this->actor.world.pos, &this->actor.home.pos, &this->actor.world.rot, 0); + func_800BE33C(&this->actor.world.pos, &this->actor.home.pos, &this->actor.world.rot, false); Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 3, 0xE38, 0x38E); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0xE38, 0x38E); this->actor.shape.rot.z = 0; @@ -665,10 +665,10 @@ void func_80A95FE8(EnAz* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex); this->unk_374 &= ~0x1000; this->actor.gravity = -1.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 3, 0x1000, 0x100); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1038, 0x100); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.shape.rot.x = 0; this->actor.gravity = 0.0f; func_80A97C0C(this, play); @@ -1293,7 +1293,7 @@ void func_80A97410(EnAz* this, PlayState* play) { } } if (this->unk_378 == 3) { - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_378 = 2; } else if (this->unk_378 == 5) { Message_StartTextbox(play, this->actor.textId, &this->actor); @@ -1309,8 +1309,8 @@ void func_80A97410(EnAz* this, PlayState* play) { this->unk_378 = 0; } } else { - Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, - this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, + this->actor.playerHeightRel); } } if (this->unk_378 == 9) { @@ -1370,7 +1370,7 @@ void func_80A97410(EnAz* this, PlayState* play) { } else { Actor_GetScreenPos(play, &this->actor, &sp56, &sp54); if ((sp56 >= 0) && (sp56 <= SCREEN_WIDTH) && (sp54 >= 0) && (sp54 <= SCREEN_HEIGHT) && - func_800B8500(&this->actor, play, 120.0f, 120.0f, 0)) { + func_800B8500(&this->actor, play, 120.0f, 120.0f, PLAYER_IA_NONE)) { this->unk_3D2 = func_80A97274(this, play); if ((this->unk_3D2 == 0x10CE) || (this->unk_3D2 == 0x10D4)) { this->actor.textId = 0; @@ -1420,7 +1420,7 @@ void func_80A97AB4(EnAz* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x10D7: - func_80151938(play, 0x10D8); + Message_ContinueTextbox(play, 0x10D8); break; case 0x10D8: if (play->msgCtx.choiceIndex == 0) { @@ -1434,7 +1434,7 @@ void func_80A97AB4(EnAz* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_24_04); } - func_80151938(play, 0x10D9); + Message_ContinueTextbox(play, 0x10D9); } break; case 0x10D9: @@ -1510,14 +1510,14 @@ void func_80A97EAC(EnAz* this, PlayState* play) { SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, &this->unk_300, play->setupPathList, BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 0); this->unk_36C = 8.0f; - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 6.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL, &this->animIndex); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actor.bgCheckFlags &= ~0x21; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER); this->unk_374 |= 0x1000; this->unk_3C2 = 0; this->unk_3C4 = 0; @@ -1554,7 +1554,7 @@ void func_80A97F9C(EnAz* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80A979DC(this, play); } else { if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) { @@ -1574,7 +1574,7 @@ void func_80A97F9C(EnAz* this, PlayState* play) { if (this->actor.depthInWater > 8.0f) { if (this->unk_374 & 2) { if ((this->skelAnime.curFrame < this->skelAnime.playSpeed) && (this->skelAnime.curFrame >= 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BEAVER_SWIM_HAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BEAVER_SWIM_HAND); } } else { func_800B9010(&this->actor, NA_SE_EV_BEAVER_SWIM_MOTOR - SFX_FLAG); @@ -1589,7 +1589,7 @@ void func_80A982E0(PlayState* play, ActorPathing* actorPathing) { Vec3f sp28; actorPathing->curPoint.x = actorPathing->points[actorPathing->curPointIndex].x; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { actorPathing->curPoint.y = actorPathing->points[actorPathing->curPointIndex].y; } else { actorPathing->curPoint.y = actorPathing->points[actorPathing->curPointIndex].y - this->unk_3A4; @@ -1615,7 +1615,7 @@ void func_80A98414(EnAz* this, PlayState* play) { if ((fish->actor.params < 0) && (fish->actor.room == this->actor.room) && (Math3D_Vec3fDistSq(&this->actor.world.pos, &fish->actor.world.pos) < SQ(200.0f))) { fish->unk_276 = 0x14; - fish->unk_274 = Actor_YawBetweenActors(&fish->actor, &this->actor); + fish->unk_274 = Actor_WorldYawTowardActor(&fish->actor, &this->actor); } } itemAction = itemAction->next; @@ -1627,7 +1627,7 @@ void EnAz_Update(Actor* thisx, PlayState* play2) { EnAz* this = THIS; this->unk_374 &= ~0x100; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 22.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 22.0f)) { if (!(this->unk_376 & 0x100)) { this->unk_374 |= 0x200; } @@ -1638,10 +1638,10 @@ void EnAz_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); Actor_SetFocus(&this->actor, 40.0f); if (this->unk_374 & 0x200) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER); } if (this->unk_374 & 0x400) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_JUMP_OUT_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_OUT_WATER); } this->unk_37E++; if (this->unk_37E >= 4) { @@ -1798,7 +1798,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); } OPEN_DISPS(play->state.gfxCtx); - if ((this->actor.depthInWater >= 28.0f) && (this->actor.speedXZ > 0.5f)) { + if ((this->actor.depthInWater >= 28.0f) && (this->actor.speed > 0.5f)) { Matrix_Translate(this->unk_3B4.x, this->unk_3B4.y, this->unk_3B4.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 6040076f4..3aad703de 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -320,8 +320,8 @@ s32 EnBaba_MoveForward(EnBaba* this, f32 speedTarget) { s32 reachedEnd = false; Vec3f point; - Math_SmoothStepToF(&this->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); - rotStep = this->actor.speedXZ * 400.0f; + Math_SmoothStepToF(&this->actor.speed, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = this->actor.speed * 400.0f; if (SubS_CopyPointFromPath(this->path, this->waypoint, &point) && SubS_MoveActorToPoint(&this->actor, &point, rotStep)) { this->waypoint++; @@ -485,7 +485,7 @@ void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) { this->animIndex = BOMB_SHOP_LADY_ANIM_KNOCKED_OVER; // Ouch this->textId = 0x2A30; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Enemy_StartFinishingBlow(play, &this->actor); this->stateFlags |= BOMB_SHOP_LADY_STATE_KNOCKED_OVER; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); @@ -638,7 +638,7 @@ void EnBaba_GiveBlastMask(EnBaba* this, PlayState* play) { this->stateFlags |= BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK; this->actionFunc = EnBaba_GaveBlastMask; } else { - Actor_PickUp(&this->actor, play, GI_MASK_BLAST, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_BLAST, 300.0f, 300.0f); } } @@ -690,7 +690,7 @@ void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { if (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_BBVO00); + Actor_PlaySfx(&this->actor, NA_SE_VO_BBVO00); } if (curFrame == endFrame) { @@ -699,7 +699,7 @@ void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { } } else { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40) && (DECR(this->sakonDeadTimer) == 0)) { - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { Actor_MoveWithGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c index 9017e0f89..9a71c1864 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -144,7 +144,7 @@ void EnBaguo_Init(Actor* thisx, PlayState* play) { this->actor.shape.yOffset = -3000.0f; this->actor.gravity = -3.0f; this->actor.colChkInfo.damageTable = &sDamageTable; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->collider.base.acFlags |= AC_HARD; this->actionFunc = EnBaguo_UndergroundIdle; @@ -160,10 +160,10 @@ void EnBaguo_UndergroundIdle(EnBaguo* this, PlayState* play) { this->action = NEJIRON_ACTION_INACTIVE; if (this->actor.xzDistToPlayer < 200.0f && Player_GetMask(play) != PLAYER_MASK_STONE) { this->actor.draw = EnBaguo_DrawBody; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_APPEAR); this->actor.world.rot.z = 0; this->actor.world.rot.x = this->actor.world.rot.z; - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags |= ACTOR_FLAG_1; this->actionFunc = EnBaguo_EmergeFromUnderground; } @@ -205,7 +205,7 @@ void EnBaguo_Idle(EnBaguo* this, PlayState* play) { if ((play->gameplayFrames % 8) == 0) { Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_VOICE); } } } @@ -244,17 +244,17 @@ void EnBaguo_Roll(EnBaguo* this, PlayState* play) { this->timer = 100; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnBaguo_Idle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (!this->bouncedFlag && this->collider.base.atFlags & AT_BOUNCED) { this->zRollDirection ^= 1; this->bouncedFlag = 1; - this->actor.speedXZ = -7.0f; + this->actor.speed = -7.0f; } Math_ApproachF(&this->currentRotation.x, this->targetRotation.x, 0.2f, 1000.0f); Math_ApproachF(&this->currentRotation.z, this->targetRotation.z, 0.2f, 1000.0f); - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 0.5f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 0.5f); this->actor.world.rot.x += (s16)this->currentRotation.x; if (this->currentRotation.z != 0.0f) { @@ -265,14 +265,14 @@ void EnBaguo_Roll(EnBaguo* this, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_ROLL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_ROLL - SFX_FLAG); } } void EnBaguo_SetupRetreatUnderground(EnBaguo* this) { this->action = NEJIRON_ACTION_RETREATING; this->actionFunc = EnBaguo_RetreatUnderground; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnBaguo_RetreatUnderground(EnBaguo* this, PlayState* play) { @@ -290,8 +290,8 @@ void EnBaguo_RetreatUnderground(EnBaguo* this, PlayState* play) { this->actor.shape.yOffset = -3000.0f; this->actor.draw = EnBaguo_DrawBody; Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_APPEAR); - this->actor.flags |= ACTOR_FLAG_8000000; + Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_APPEAR); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->actionFunc = EnBaguo_UndergroundIdle; } @@ -316,21 +316,23 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, PlayState* play) { // the Nejiron should forcibly explode and as a loop index. i = false; if (this->action != NEJIRON_ACTION_EXPLODING && this->action != NEJIRON_ACTION_RETREATING) { - if (!(this->actor.bgCheckFlags & 1) && this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f)) { // Force a detonation if we're off the ground and have fallen // below our home position (e.g., we rolled off a ledge). i = true; } - if (this->actor.bgCheckFlags & 0x60 && this->actor.depthInWater >= 40.0f) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) && + (this->actor.depthInWater >= 40.0f)) { // Force a detonation if we're too far below the water's surface. i = true; } if ((this->collider.base.acFlags & AC_HIT || i)) { this->collider.base.acFlags &= ~AC_HIT; if (i || this->actor.colChkInfo.damageEffect == NEJIRON_DMGEFF_KILL) { - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->action = NEJIRON_ACTION_EXPLODING; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.shadowScale = 0.0f; for (i = 0; i < ARRAY_COUNT(this->effects); i++) { @@ -346,11 +348,11 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_POP); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BAKUO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_DEAD); this->timer = 30; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.0f); this->collider.elements->dim.scale = 3.0f; diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 8812ae6d3..3021ffbd2 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -221,10 +221,10 @@ void func_80BE8AAC(EnBaisen* this, PlayState* play) { } } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->textIdIndex++; if (this->textIdIndex < 6) { - func_80151938(play, sTextIds[this->textIdIndex]); + Message_ContinueTextbox(play, sTextIds[this->textIdIndex]); if ((this->textIdIndex % 2) == 0) { this->unk2A4 = this->heishiPointer; } else { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index cee109c70..61b060110 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -4,6 +4,7 @@ * Description: Bad Bat */ +#include "prevent_bss_reordering.h" #include "z_en_bat.h" #include "objects/object_bat/object_bat.h" @@ -164,8 +165,8 @@ void EnBat_Init(Actor* thisx, PlayState* play) { &play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + randPlusMinusPoint5Scaled(200.0f), thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), thisx->world.pos.z + randPlusMinusPoint5Scaled(200.0f), randPlusMinusPoint5Scaled(0x2000), - 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), -1, thisx->unk20, - NULL); + 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), -1, + thisx->halfDaysBits, NULL); BAD_BAT_GET_NUMBER_TO_SPAWN(thisx)--; } } @@ -193,7 +194,7 @@ void EnBat_StepAnimation(EnBat* this, s32 frameStep) { this->animationFrame -= ARRAY_COUNT(sWingsDLs); } if ((prevFrame < BAD_BAT_FLAP_FRAME) && (this->animationFrame >= BAD_BAT_FLAP_FRAME)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_FLY); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_FLY); } } @@ -203,7 +204,7 @@ void EnBat_SetupPerch(EnBat* this) { this->collider.dim.worldSphere.center.x = this->actor.focus.pos.x; this->collider.dim.worldSphere.center.y = this->actor.focus.pos.y; this->collider.dim.worldSphere.center.z = this->actor.focus.pos.z; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnBat_Perch; } @@ -214,7 +215,7 @@ void EnBat_Perch(EnBat* this, PlayState* play) { void EnBat_SetupFlyIdle(EnBat* this) { this->timer = 100; this->collider.base.acFlags |= AC_ON; - this->actor.speedXZ = 3.5f; + this->actor.speed = 3.5f; this->actionFunc = EnBat_FlyIdle; } @@ -225,12 +226,12 @@ void EnBat_FlyIdle(EnBat* this, PlayState* play) { finishedRotStep = Math_ScaledStepToS(&this->actor.shape.rot.y, this->yawTarget, 0x300); - if (this->actor.bgCheckFlags & 8) { - this->actor.bgCheckFlags &= ~8; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->yawTarget = this->actor.wallYaw; } else if (Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z) > SQ(300.0f)) { - this->yawTarget = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->yawTarget = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } else if (finishedRotStep && (Rand_ZeroOne() < 0.015f)) { this->yawTarget = this->actor.shape.rot.y + (((s32)(0x1000 * Rand_ZeroOne()) + 0x1000) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)); @@ -238,7 +239,7 @@ void EnBat_FlyIdle(EnBat* this, PlayState* play) { finishedRotStep = Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); - if ((this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > -40.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.depthInWater > -40.0f)) { this->pitchTarget = -0x1000; } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f)) { this->pitchTarget = -((s32)(0x800 * Rand_ZeroOne()) + 0x800); @@ -262,7 +263,7 @@ void EnBat_FlyIdle(EnBat* this, PlayState* play) { void EnBat_SetupDiveAttack(EnBat* this) { this->collider.base.atFlags |= AT_ON; this->timer = 300; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; sNumberAttacking++; this->actionFunc = EnBat_DiveAttack; } @@ -282,7 +283,7 @@ void EnBat_DiveAttack(EnBat* this, PlayState* play) { preyPos.y = player->actor.world.pos.y + 20.0f; preyPos.z = player->actor.world.pos.z; - pitchTarget = Actor_PitchToPoint(&this->actor, &preyPos); + pitchTarget = Actor_WorldPitchTowardPoint(&this->actor, &preyPos); pitchTarget = CLAMP(pitchTarget, -0x3000, 0x3000); Math_SmoothStepToS(&this->actor.shape.rot.x, pitchTarget, 2, 0x400, 0x40); } else { @@ -295,20 +296,20 @@ void EnBat_DiveAttack(EnBat* this, PlayState* play) { this->timer--; if ((this->timer == 0) || (this->collider.base.atFlags & AT_HIT) || (Player_GetMask(play) == PLAYER_MASK_STONE) || - (this->actor.bgCheckFlags & 1) || (player->stateFlags1 & PLAYER_STATE1_800000) || + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_800000) || (this->actor.depthInWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_ATTACK); } this->collider.base.atFlags &= ~AT_ON; sNumberAttacking--; EnBat_SetupFlyIdle(this); - } else if ((this->actor.bgCheckFlags & 8) && + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(BINANG_SUB(this->actor.wallYaw, this->actor.yawTowardsPlayer)) > 0x6800)) { sNumberAttacking--; this->collider.base.atFlags &= ~AT_ON; - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->yawTarget = this->actor.wallYaw; EnBat_SetupFlyIdle(this); } @@ -317,10 +318,10 @@ void EnBat_DiveAttack(EnBat* this, PlayState* play) { void EnBat_SetupDie(EnBat* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; Enemy_StartFinishingBlow(play, &this->actor); - this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); - this->actor.bgCheckFlags &= ~1; + this->actor.speed *= Math_CosS(this->actor.world.rot.x); + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_ICE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; @@ -340,10 +341,10 @@ void EnBat_SetupDie(EnBat* this, PlayState* play) { this->drawDmgEffScale = 0.45f; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); if (this->actor.flags & ACTOR_FLAG_8000) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->collider.base.acFlags &= ~AC_ON; @@ -352,7 +353,7 @@ void EnBat_SetupDie(EnBat* this, PlayState* play) { } void EnBat_Die(EnBat* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; if (!(this->actor.flags & ACTOR_FLAG_8000)) { // Carried by arrow @@ -361,7 +362,7 @@ void EnBat_Die(EnBat* this, PlayState* play) { this->actor.shape.rot.z += 0x1780; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Actor_SpawnIceEffects(play, &this->actor, this->bodyPartPoss, ARRAY_COUNT(this->bodyPartPoss), 2, 0.2f, 0.2f); @@ -397,17 +398,18 @@ void EnBat_SetupStunned(EnBat* this) { if (this->actionFunc != EnBat_Stunned) { this->actor.shape.yOffset = 700.0f; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.pos.y += 13.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, this->timer); + + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, this->timer); this->actionFunc = EnBat_Stunned; } void EnBat_Stunned(EnBat* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if (this->timer != 0) { this->timer--; } diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index c5657e385..c58344400 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -171,14 +171,14 @@ void EnBb_Destroy(Actor* thisx, PlayState* play) { void EnBb_CheckForWall(EnBb* this) { s16 yawDiff; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yawDiff = this->actor.shape.rot.y - this->actor.wallYaw; if (ABS_ALT(yawDiff) > 0x4000) { this->actor.shape.rot.y = ((this->actor.wallYaw * 2) - this->actor.shape.rot.y) - 0x8000; } this->targetYRotation = this->actor.shape.rot.y; - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } } @@ -189,7 +189,7 @@ void EnBb_Freeze(EnBb* this) { this->timer = 80; this->drawDmgEffAlpha = 1.0f; this->actor.flags &= ~ACTOR_FLAG_200; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void EnBb_Thaw(EnBb* this, PlayState* play) { @@ -216,7 +216,7 @@ void EnBb_UpdateStateForFlying(EnBb* this) { Math_StepToF(&this->flameScaleY, 0.8f, 0.1f); Math_StepToF(&this->flameScaleX, 1.0f, 0.1f); EnBb_CheckForWall(this); - Math_StepToF(&this->actor.speedXZ, this->maxSpeed, 0.5f); + Math_StepToF(&this->actor.speed, this->maxSpeed, 0.5f); Math_ApproachS(&this->actor.shape.rot.y, this->targetYRotation, 5, 0x3E8); this->actor.world.rot.y = this->actor.shape.rot.y; } @@ -236,10 +236,10 @@ void EnBb_SetupFlyIdle(EnBb* this) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->flyHeightMod = (Math_CosS(this->bobPhase) * 10.0f) + 30.0f; - this->targetYRotation = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->targetYRotation = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); if ((this->actor.xzDistToPlayer < (this->attackRange + 120.0f)) || - (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 300.0f)) { + (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 300.0f)) { this->targetYRotation += (s16)((s32)Rand_Next() >> 0x11); } @@ -255,9 +255,9 @@ void EnBb_FlyIdle(EnBb* this, PlayState* play) { EnBb_UpdateStateForFlying(this); if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_WING); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_WING); } else if ((Animation_OnFrame(&this->skelAnime, 0.0f)) && (Rand_ZeroOne() < 0.1f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_LAUGH); } DECR(this->attackWaitTimer); @@ -288,18 +288,18 @@ void EnBb_Attack(EnBb* this, PlayState* play) { EnBb_UpdateStateForFlying(this); if ((Animation_OnFrame(&this->skelAnime, 0.0f)) || (Animation_OnFrame(&this->skelAnime, 5.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_MOUTH); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_MOUTH); } else if ((Animation_OnFrame(&this->skelAnime, 2.0f)) || (Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_WING); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_WING); } else if ((Animation_OnFrame(&this->skelAnime, 0.0f)) && (Rand_ZeroOne() < 0.1f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_LAUGH); } this->timer--; if (((this->attackRange + 120.0f) < this->actor.xzDistToPlayer) || (this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_STONE) || - (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 400.0f)) { + (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 400.0f)) { EnBb_SetupFlyIdle(this); } } @@ -309,11 +309,11 @@ void EnBb_SetupDown(EnBb* this) { this->collider.base.atFlags |= AT_ON; this->timer = 140; this->collider.base.acFlags |= AC_ON; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->flameScaleY = 0.0f; this->flameScaleX = 0.0f; this->actor.gravity = -2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_DOWN); this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnBb_Down; } @@ -325,10 +325,10 @@ void EnBb_Down(EnBb* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnBb_CheckForWall(this); - if (this->actor.bgCheckFlags & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); if (this->timer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_UP); EnBb_SetupFlyIdle(this); return; } @@ -339,14 +339,14 @@ void EnBb_Down(EnBb* this, PlayState* play) { this->actor.velocity.y = 10.0f; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(this->actor.yawTowardsPlayer, 0x8000), 0xBB8); } this->actor.world.rot.y = this->actor.shape.rot.y; if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_WING); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_WING); } if (this->timer > 0) { @@ -363,11 +363,11 @@ void EnBb_SetupDead(EnBb* this, PlayState* play) { func_800BE568(&this->actor, &this->collider); this->timer = 15; this->actor.shape.rot.x += 0x4E20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->bodyPartDrawStatus = BB_BODY_PART_DRAW_STATUS_DEAD; this->actor.gravity = -1.5f; @@ -412,22 +412,22 @@ void EnBb_Dead(EnBb* this, PlayState* play) { void EnBb_SetupDamage(EnBb* this) { this->collider.base.acFlags &= ~AC_ON; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_DAMAGE); func_800BE568(&this->actor, &this->collider); if (this->actor.colChkInfo.damageEffect == EN_BB_DMGEFF_ZORA_MAGIC) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffScale = 0.4f; } else if (this->actor.colChkInfo.damageEffect == EN_BB_DMGEFF_STUN) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 20); - this->actor.speedXZ = 0.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 0.0f; } else if (this->actor.colChkInfo.damageEffect == EN_BB_DMGEFF_HOOKSHOT) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); - this->actor.speedXZ = 7.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 7.0f; } this->actor.gravity = -1.0f; @@ -435,14 +435,14 @@ void EnBb_SetupDamage(EnBb* this) { } void EnBb_Damage(EnBb* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ < 0.1f)) { + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed < 0.1f)) { EnBb_SetupDown(this); } } void EnBb_SetupFrozen(EnBb* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -472,7 +472,7 @@ void EnBb_SetupWaitForRevive(EnBb* this) { this->actor.shape.rot.x = 0; this->actor.world.pos.y += 50.0f; this->timer = 200; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; this->actionFunc = EnBb_WaitForRevive; @@ -565,7 +565,7 @@ void EnBb_UpdateDamage(EnBb* this, PlayState* play) { this->collider.base.atFlags &= ~AT_HIT; this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_BITE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_BITE); if (this->flameScaleX > 0.0f) { gSaveContext.jinxTimer = 1200; diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 1dfc74a22..9b04d1e80 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -194,7 +194,7 @@ void EnBbfall_Freeze(EnBbfall* this) { this->timer = 80; this->drawDmgEffAlpha = 1.0f; this->actor.flags &= ~ACTOR_FLAG_200; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void EnBbfall_Thaw(EnBbfall* this, PlayState* play) { @@ -223,7 +223,7 @@ s32 EnBbfall_IsTouchingLava(EnBbfall* this, PlayState* play) { void EnBbfall_PlaySfx(EnBbfall* this) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_MOUTH); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_MOUTH); } func_800B9010(&this->actor, NA_SE_EN_BUBLEFALL_FIRE - SFX_FLAG); @@ -237,14 +237,14 @@ void EnBbfall_PlaySfx(EnBbfall* this) { void EnBbfall_CheckForWall(EnBbfall* this) { s16 yawDiff; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yawDiff = this->actor.shape.rot.y - this->actor.wallYaw; if (ABS_ALT(yawDiff) > 0x4000) { this->actor.shape.rot.y = ((this->actor.wallYaw * 2) - this->actor.shape.rot.y) - 0x8000; } - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } } @@ -273,7 +273,7 @@ void EnBbfall_SetupWaitForPlayer(EnBbfall* this) { this->actor.colChkInfo.health = sColChkInfoInit.health; this->actor.colorFilterTimer = 0; this->isBgCheckCollisionEnabled = false; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); @@ -283,7 +283,7 @@ void EnBbfall_SetupWaitForPlayer(EnBbfall* this) { this->flamePos[i].y -= 47.0f; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.flags &= ~ACTOR_FLAG_1; this->actionFunc = EnBbfall_WaitForPlayer; } @@ -306,7 +306,7 @@ void EnBbfall_SetupEmerge(EnBbfall* this) { this->actor.velocity.y = 17.0f; EnBbfall_EnableColliders(this); this->actor.flags |= ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEFALL_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLEFALL_APPEAR); this->actionFunc = EnBbfall_Emerge; } @@ -322,8 +322,8 @@ void EnBbfall_Emerge(EnBbfall* this, PlayState* play) { void EnBbfall_SetupFly(EnBbfall* this) { this->flameOpacity = 255; this->isBgCheckCollisionEnabled = true; - this->actor.bgCheckFlags &= ~1; - this->actor.speedXZ = 5.0f; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + this->actor.speed = 5.0f; this->actor.gravity = -1.0f; this->actionFunc = EnBbfall_Fly; } @@ -333,7 +333,7 @@ void EnBbfall_Fly(EnBbfall* this, PlayState* play) { Math_StepToF(&this->flameScaleY, 0.8f, 0.1f); Math_StepToF(&this->flameScaleX, 1.0f, 0.1f); EnBbfall_CheckForWall(this); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); } else { @@ -343,7 +343,7 @@ void EnBbfall_Fly(EnBbfall* this, PlayState* play) { this->actor.shape.rot.y += (s16)randPlusMinusPoint5Scaled(73728.0f); } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } this->actor.world.rot.y = this->actor.shape.rot.y; @@ -372,11 +372,11 @@ void EnBbfall_SetupDown(EnBbfall* this) { this->timer = 200; this->flameOpacity = 0; this->collider.base.acFlags |= AC_ON; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->flameScaleY = 0.0f; this->flameScaleX = 0.0f; this->actor.gravity = -2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_DOWN); this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnBbfall_Down; } @@ -385,15 +385,15 @@ void EnBbfall_Down(EnBbfall* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnBbfall_CheckForWall(this); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); return; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); if (this->timer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_UP); EnBbfall_EnableColliders(this); this->actor.velocity.y = 8.0f; EnBbfall_SetupFly(this); @@ -406,14 +406,14 @@ void EnBbfall_Down(EnBbfall* this, PlayState* play) { this->actor.velocity.y = 10.0f; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, 0); Math_ScaledStepToS(&this->actor.shape.rot.y, BINANG_ADD(this->actor.yawTowardsPlayer, 0x8000), 0xBB8); } this->actor.world.rot.y = this->actor.shape.rot.y; if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_WING); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_WING); } if (this->timer > 0) { @@ -430,11 +430,11 @@ void EnBbfall_SetupDead(EnBbfall* this, PlayState* play) { func_800BE5CC(&this->actor, &this->collider, 0); this->timer = 15; this->actor.shape.rot.x += 0x4E20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BUBLE_DEAD); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70); this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->bodyPartDrawStatus = BBFALL_BODY_PART_DRAW_STATUS_DEAD; this->actor.gravity = -1.5f; @@ -478,30 +478,30 @@ void EnBbfall_Dead(EnBbfall* this, PlayState* play) { void EnBbfall_SetupDamage(EnBbfall* this) { this->collider.base.acFlags &= ~AC_ON; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLE_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_DAMAGE); func_800BE5CC(&this->actor, &this->collider, 0); if (this->actor.colChkInfo.damageEffect == EN_BBFALL_DMGEFF_ZORA_MAGIC) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffScale = 0.4f; } else if (this->actor.colChkInfo.damageEffect == EN_BBFALL_DMGEFF_STUN) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 20); - this->actor.speedXZ = 0.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 0.0f; } else if (this->actor.colChkInfo.damageEffect == EN_BBFALL_DMGEFF_HOOKSHOT) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); - this->actor.speedXZ = 7.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 7.0f; } this->actionFunc = EnBbfall_Damage; } void EnBbfall_Damage(EnBbfall* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ < 0.1f)) { + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed < 0.1f)) { if (EnBbfall_IsTouchingLava(this, play)) { EnBbfall_SetupSinkIntoLava(this); } else { @@ -511,7 +511,7 @@ void EnBbfall_Damage(EnBbfall* this, PlayState* play) { } void EnBbfall_SetupFrozen(EnBbfall* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index cf8c5f68a..ad45c3a66 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -173,7 +173,7 @@ void EnBee_FlyIdle(EnBee* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &nextPos), 1, 0x7D0, 0); - Math_ApproachF(&this->actor.speedXZ, 3.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.0f, 0.3f, 1.0f); if ((this->attackDelayTimer == 0) && (this->actor.params != BEE_BEHAVIOR_IDLE)) { EnBee_SetupAttack(this); @@ -227,7 +227,7 @@ void EnBee_Attack(EnBee* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &nextPos), 1, 0x1388, 0); Math_ApproachF(&this->actor.world.pos.y, nextPos.y, 0.3f, 3.0f); - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 1.0f); } void EnBee_UpdateDamage(EnBee* this, PlayState* play) { @@ -238,7 +238,7 @@ void EnBee_UpdateDamage(EnBee* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { Enemy_StartFinishingBlow(play, &this->actor); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_CUTBODY); this->actor.colChkInfo.health = 0; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_EXTINCT); @@ -262,7 +262,7 @@ void EnBee_Update(Actor* thisx, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BEE_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BEE_FLY - SFX_FLAG); EnBee_UpdateDamage(this, play); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); Actor_SetFocus(&this->actor, 0.0f); diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.c b/src/overlays/actors/ovl_En_Bh/z_en_bh.c index 2aff9891d..da6bc06a3 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.c +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.c @@ -52,7 +52,7 @@ void func_80C22DEC(EnBh* this, PlayState* play) { s16 yRot; s16 zRot; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; xDiff = this->pos.x - this->actor.world.pos.x; yDiff = this->pos.y - this->actor.world.pos.y; zDiff = this->pos.z - this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 1f037a8a8..2ffe6c8ef 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -133,7 +133,7 @@ void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* su this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); Play_SetCameraAtEye(play, this->subCamId, subCamAt, subCamEye); - angle = BINANG_SUB(Actor_YawToPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); + angle = BINANG_SUB(Actor_WorldYawTowardPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); if (angle > 0) { angle = BINANG_ADD(this->picto.actor.home.rot.y, 0x1800); } else { @@ -237,7 +237,7 @@ void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play) { EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, Rand_S16Offset(1000, 200)); angle = BINANG_ADD(angle, 0x2000); } - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_LAND); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_DAIOCTA_LAND); this->actionFunc = EnBigokuta_RiseOutOfWater; } @@ -259,7 +259,7 @@ void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 0x1000); if ((this->picto.actor.xzDistToPlayer > 400.0f) || (this->picto.actor.playerHeightRel > 200.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_SINK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_DAIOCTA_SINK); EnBigokuta_SetupIdle(this); } else if ((this->picto.actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { EnBigokuta_SetupSuckInPlayer(this, play); @@ -295,7 +295,7 @@ void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play) { this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; this->playerHoldPos.z = (Math_CosS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.z; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_SLIME_DEAD); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_SLIME_DEAD); this->actionFunc = EnBigokuta_SuckInPlayer; } @@ -347,7 +347,7 @@ void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play) { if (this->timer == 0) { EnBigokuta_ShootPlayer(this, play); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_REVERSE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_DAIOCTA_REVERSE); } } else if (this->timer == -24) { EnBigokuta_SetupIdleAboveWater(this); @@ -396,7 +396,7 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { void EnBigokuta_SetupDeathEffects(EnBigokuta* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBigOctoDeathAnim, -5.0f); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_DEAD2); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_DAIOCTA_DEAD2); this->picto.actor.flags &= ~1; this->timer = 10; this->actionFunc = EnBigokuta_PlayDeathEffects; @@ -422,7 +422,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { dustPos.z = this->picto.actor.world.pos.z; func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_80AC45B0, &D_80AC45B4, 1200, 20); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_OCTAROCK_DEAD2); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_OCTAROCK_DEAD2); } } else { this->picto.actor.world.pos.y -= 0.2f; @@ -475,7 +475,7 @@ s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { this->picto.actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); if ((this->picto.actor.child != NULL) && - (Actor_XZDistanceBetweenActors(&this->picto.actor, this->picto.actor.child) < 250.0f)) { + (Actor_WorldDistXZToActor(&this->picto.actor, this->picto.actor.child) < 250.0f)) { return true; } else { return false; @@ -506,7 +506,8 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { } this->bodyCollider.base.acFlags &= ~AC_HIT; - Actor_SetColorFilter(&this->picto.actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); + Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, + Animation_GetLastFrame(&gBigOctoDeathAnim)); EnBigokuta_ShootPlayer(this, play); EnBigokuta_SetupDeathCutscene(this); } diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 2c27a1801..74fbbfc51 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -219,7 +219,7 @@ void func_80A2778C(EnBigpamet* this) { ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_PAMET_BREAK); } void func_80A27970(EnBigpamet* this, PlayState* play2) { @@ -295,7 +295,7 @@ void func_80A27B58(EnBigpamet* this) { ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_PAMET_BREAK); } void func_80A27DD8(EnBigpamet* this, PlayState* play) { @@ -408,7 +408,7 @@ void func_80A282C8(EnBigpamet* this, PlayState* play) { void func_80A28378(EnBigpamet* this) { this->actor.parent->params = GEKKO_INIT_SNAPPER; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80A283A0; } @@ -421,7 +421,7 @@ void func_80A283A0(EnBigpamet* this, PlayState* play) { void func_80A283F0(EnBigpamet* this) { Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_00823C); - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.params = ENBIGPAMET_1; this->actionFunc = func_80A2844C; @@ -431,10 +431,11 @@ void func_80A2844C(EnBigpamet* this, PlayState* play) { SkelAnime_Update(&this->skelAnime2); if (this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->actor.parent), 0x400); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, this->actor.parent), + 0x400); this->actor.world.rot.y = this->actor.shape.rot.y; } else if (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if (this->actor.parent->params == GEKKO_ON_SNAPPER) { func_80A28E40(this); } @@ -445,9 +446,9 @@ void func_80A284E4(EnBigpamet* this) { this->unk_29E = 0; this->unk_2A8 = 1.0f; this->unk_2A4 = 1.0f; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_VOICE); - Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_FROG_VOICE1); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_B_PAMET_VOICE); + Actor_PlaySfx(this->actor.parent, NA_SE_EN_FROG_VOICE1); this->actionFunc = func_80A2855C; } @@ -467,8 +468,8 @@ void func_80A2855C(EnBigpamet* this, PlayState* play) { void func_80A28618(EnBigpamet* this) { this->actor.draw = func_80A2966C; this->unk_2A8 = 0.5f; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); this->actionFunc = func_80A2866C; } @@ -498,11 +499,11 @@ void func_80A28708(EnBigpamet* this, PlayState* play) { } void func_80A28760(EnBigpamet* this) { - this->actor.speedXZ = 15.0f; - if (this->actor.bgCheckFlags & 8) { + this->actor.speed = 15.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.wallYaw; - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; if (temp_v1 > 0x3C00) { this->actor.world.rot.y = this->actor.wallYaw + 0x3C00; @@ -538,7 +539,7 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) { func_80A27FE8(this, play); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); this->actor.velocity.y = this->unk_29E * 0.375f; @@ -556,11 +557,11 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) { } void func_80A28970(EnBigpamet* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); this->actor.shape.rot.z = 0; this->collider.base.atFlags &= ~AT_ON; this->collider.info.bumper.dmgFlags = 0xF7CFFFFF; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80A289C8; } @@ -617,16 +618,16 @@ void func_80A28B98(EnBigpamet* this, PlayState* play) { this->collider.base.acFlags &= ~AC_ON; this->actor.velocity.y = 22.0f; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; if ((this->actor.draw == func_80A2966C) && (this->actionFunc != func_80A28DC0)) { this->actor.draw = EnBigpamet_Draw; } else if (this->collider.base.ac != NULL) { - this->actor.world.rot.y = BINANG_ROT180(Actor_YawBetweenActors(&this->actor, this->collider.base.ac)); + this->actor.world.rot.y = BINANG_ROT180(Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac)); } this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.params = ENBIGPAMET_0; @@ -638,17 +639,17 @@ void func_80A28B98(EnBigpamet* this, PlayState* play) { collectible = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); if (collectible != NULL) { collectible->velocity.y = 15.0f; - collectible->world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + collectible->world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_PAMET_REVERSE); this->actionFunc = func_80A28D0C; } void func_80A28D0C(EnBigpamet* this, PlayState* play) { SkelAnime_Update(&this->skelAnime2); - if (this->actor.bgCheckFlags & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_LAND); func_80A27FE8(this, play); func_80A28D80(this); } @@ -658,7 +659,7 @@ void func_80A28D0C(EnBigpamet* this, PlayState* play) { void func_80A28D80(EnBigpamet* this) { this->actor.draw = func_80A2966C; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->unk_2A8 = 0.0f; @@ -680,7 +681,7 @@ void func_80A28DC0(EnBigpamet* this, PlayState* play) { void func_80A28E40(EnBigpamet* this) { Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_000440, -2.0f); this->actor.flags |= ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80A28E98; } diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 5398418f2..db124dc97 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -206,7 +206,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { } ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 45.0f); - thisx->bgCheckFlags |= 0x400; + thisx->bgCheckFlags |= BGCHECKFLAG_PLAYER_400; this->savedHeight = thisx->home.pos.y + 100.0f; this->mainColor.r = 255; this->mainColor.g = 255; @@ -259,7 +259,7 @@ void EnBigpo_UpdateSpin(EnBigpo* this) { this->actor.shape.rot.y += this->rotVelocity; if ((oldYaw < 0) && (this->actor.shape.rot.y > 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); // spinning sfx during spin attack + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); // spinning sfx during spin attack } } @@ -395,7 +395,7 @@ void EnBigpo_SpawnCutsceneStage5(EnBigpo* this) { Animation_PlayLoop(&this->skelAnime, &gBigpoAwakenStretchAnim); this->actor.draw = EnBigpo_DrawMainBigpo; Actor_SetScale(&this->actor, 0.014f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); this->actionFunc = EnBigpo_SpawnCutsceneStage6; } @@ -482,8 +482,8 @@ void EnBigpo_SetupWarpOut(EnBigpo* this) { this->rotVelocity = 0x2000; this->idleTimer = 32; this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DISAPPEAR); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DISAPPEAR); this->actionFunc = EnBigpo_WarpingOut; } @@ -505,7 +505,7 @@ void EnBigpo_SetupWarpIn(EnBigpo* this, PlayState* play) { f32 distance = CLAMP_MIN(this->actor.xzDistToPlayer, 200.0f); s16 randomYaw = ((s32)Rand_Next() >> 0x14) + this->actor.yawTowardsPlayer; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); Animation_PlayLoop(&this->skelAnime, &gBigpoAwakenStretchAnim); this->rotVelocity = 0x2000; this->actor.world.pos.x = (Math_SinS(randomYaw) * distance) + player->actor.world.pos.x; @@ -556,10 +556,10 @@ void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) { this->hoverHeightCycleTimer = (this->hoverHeightCycleTimer == 0) ? 40 : (this->hoverHeightCycleTimer - 1); Math_StepToF(&this->savedHeight, player->actor.world.pos.y + 100.0f, 1.5f); this->actor.world.pos.y = (sin_rad(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight; - Math_StepToF(&this->actor.speedXZ, 3.0f, 0.2f); + Math_StepToF(&this->actor.speed, 3.0f, 0.2f); func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { - this->unk208 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { + this->unk208 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk208, 0x200) && (Rand_ZeroOne() < 0.075f)) { @@ -580,7 +580,7 @@ void EnBigpo_SetupSpinUp(EnBigpo* this) { this->collider.base.atFlags |= AT_ON; this->rotVelocity = 0x800; this->actionFunc = EnBigpo_SpinningUp; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnBigpo_SpinningUp(EnBigpo* this, PlayState* play) { @@ -603,7 +603,7 @@ void EnBigpo_SpinAttack(EnBigpo* this, PlayState* play) { s16 yawDiff; SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.speedXZ, 10.0f, 1.0f); + Math_StepToF(&this->actor.speed, 10.0f, 1.0f); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 0.3f, 7.5f, 1.0f); EnBigpo_UpdateSpin(this); yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; @@ -628,7 +628,7 @@ void EnBigpo_SpinningDown(EnBigpo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 100.0f, 0.3f, 5.0f, 1.0f); - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); if (Math_ScaledStepToS(&this->rotVelocity, 0, 0x200)) { // spin down complete, re-allow hittable this->collider.base.colType = COLTYPE_HIT3; @@ -645,18 +645,18 @@ void EnBigpo_SpinningDown(EnBigpo* this, PlayState* play) { */ void EnBigpo_HitStun(EnBigpo* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBigpoShockAnim, -6.0f); - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); this->collider.base.acFlags &= ~AC_ON; func_800BE504(&this->actor, &this->collider); this->actionFunc = EnBigpo_CheckHealth; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; } /* * check if just damaged or dead */ void EnBigpo_CheckHealth(EnBigpo* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health == 0) { EnBigpo_SetupDeath(this); @@ -668,7 +668,7 @@ void EnBigpo_CheckHealth(EnBigpo* this, PlayState* play) { void EnBigpo_SetupDeath(EnBigpo* this) { this->idleTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.hintId = TATL_HINT_ID_NONE; this->collider.base.ocFlags1 &= ~OC1_ON; @@ -725,7 +725,7 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); // burning sfx } if (this->idleTimer == 18) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); } } @@ -744,12 +744,12 @@ void EnBigpo_SetupLanternDrop(EnBigpo* this, PlayState* play) { this->actor.world.pos.y -= 15.0f; func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); // targetable OFF, enemy music OFF - this->actor.bgCheckFlags &= ~0x400; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_400; this->actionFunc = EnBigpo_LanternFalling; } void EnBigpo_LanternFalling(EnBigpo* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1 || this->actor.floorHeight == BGCHECK_Y_MIN) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND || this->actor.floorHeight == BGCHECK_Y_MIN) { if (this->switchFlags != 0xFF) { Flags_SetSwitch(play, this->switchFlags); } @@ -795,7 +795,7 @@ void EnBigpo_SpawnScoopSoul(EnBigpo* this) { this->actor.scale.x = 0.0f; this->actor.scale.y = 0.0f; this->savedHeight = this->actor.world.pos.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_METAL_BOX_BOUND); // misnamed? + Actor_PlaySfx(&this->actor, NA_SE_EV_METAL_BOX_BOUND); // misnamed? this->actionFunc = EnBigpo_ScoopSoulAppearing; } @@ -824,10 +824,10 @@ void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) { if (this->idleTimer == 0) { // took too long, soul is leaving - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); EnBigpo_SetupScoopSoulLeaving(this); } else { - Actor_PickUp(&this->actor, play, GI_MAX, 35.0f, 60.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f); this->actor.world.pos.y = (sin_rad(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight; } } @@ -1123,13 +1123,13 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) { if (Actor_ApplyDamage(&this->actor) == 0) { this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD); Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type Audio_RestorePrevBgm(); } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DAMAGE); } // light arrows @@ -1164,7 +1164,7 @@ void EnBigpo_Update(Actor* thisx, PlayState* play) { this->unk20C = 0; } if (this->unk20C == 40) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); EnBigpo_SetupWarpOut(this); } } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 9cf4b425b..803aafc3b 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -536,47 +536,47 @@ void EnBigslime_CheckRoomBoundaries(EnBigslime* this, Vec3f* vtxMax, Vec3f* vtxM f32 vtxMaxZ; f32 vtxMinZ; - this->actor.bgCheckFlags &= ~(0x2 | 0x8 | 0x10); + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); if ((this->actor.world.pos.y + vtxMax->y) > GBT_ROOM_5_MAX_Y) { this->actor.world.pos.y = GBT_ROOM_5_MAX_Y - vtxMax->y; - this->actor.bgCheckFlags |= 0x10; + this->actor.bgCheckFlags |= BGCHECKFLAG_CEILING; } if ((this->actor.world.pos.y + vtxMin->y) <= GBT_ROOM_5_MIN_Y) { this->actor.world.pos.y = GBT_ROOM_5_MIN_Y - vtxMin->y; - if (!(this->actor.bgCheckFlags & 1)) { - this->actor.bgCheckFlags |= 2; + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH; } - this->actor.bgCheckFlags |= 1; + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; } else { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } - if ((this->actionFunc != EnBigslime_Freeze) || !(this->actor.bgCheckFlags & 1)) { + if ((this->actionFunc != EnBigslime_Freeze) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { worldPosX = this->actor.world.pos.x; vtxMaxX = vtxMax->x; if (GBT_ROOM_5_MAX_X < (worldPosX + vtxMaxX)) { - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; this->actor.world.pos.x = GBT_ROOM_5_MAX_X - vtxMaxX; } else { vtxMinX = vtxMin->x; if ((worldPosX + vtxMinX) < GBT_ROOM_5_MIN_X) { this->actor.world.pos.x = GBT_ROOM_5_MIN_X - vtxMinX; - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; } } worldPosZ = this->actor.world.pos.z; vtxMaxZ = vtxMax->z; if (GBT_ROOM_5_MAX_Z < (worldPosZ + vtxMaxZ)) { - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; this->actor.world.pos.z = GBT_ROOM_5_MAX_Z - vtxMaxZ; } else { vtxMinZ = vtxMin->z; if ((worldPosZ + vtxMinZ) < GBT_ROOM_5_MIN_Z) { this->actor.world.pos.z = GBT_ROOM_5_MIN_Z - vtxMinZ; - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; } } } @@ -769,10 +769,10 @@ void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) { this->actor.hintId = TATL_HINT_ID_GEKKO_GIANT_SLIME; this->gekkoRot.x = 0; this->gekkoRot.y = 0; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->formBigslimeTimer = 2; EnBigslime_AddIceShardEffect(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_BREAK); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_BREAK); EnBigslime_SetupJumpGekko(this); } @@ -1020,11 +1020,11 @@ void EnBigslime_SetupMoveOnCeiling(EnBigslime* this) { this->actor.velocity.y = 20.0f; if (this->subCamId != SUB_CAM_ID_DONE) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->ceilingMoveTimer = 20; } else { this->ceilingMoveTimer = 320; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; } this->wavySurfaceTimer = 0; @@ -1051,7 +1051,7 @@ void EnBigslime_MoveOnCeiling(EnBigslime* this, PlayState* play) { } else if ((this->actor.xzDistToPlayer < 250.0f) || (this->ceilingMoveTimer == 0)) { EnBigslime_SetupDrop(this); } else { - this->actor.speedXZ = (fabsf(Math_SinS(pitch)) * 3.0f) + 5.0f; + this->actor.speed = (fabsf(Math_SinS(pitch)) * 3.0f) + 5.0f; Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 10, 0x800, 0x80); this->gekkoRot.y = this->actor.world.rot.y; } @@ -1060,7 +1060,7 @@ void EnBigslime_MoveOnCeiling(EnBigslime* this, PlayState* play) { void EnBigslime_SetupDrop(EnBigslime* this) { this->actor.velocity.y = 0.0f; this->ceilingDropTimer = 30; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnBigslime_Drop; } @@ -1083,7 +1083,7 @@ void EnBigslime_Drop(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_DOWN); this->rotation = 0; } - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnBigslime_SetupSquishFlat(this); } else { Math_StepToF(&this->actor.scale.x, 0.15f, 0.0025f); @@ -1213,7 +1213,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) { } void EnBigslime_SetupSquishFlat(EnBigslime* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_JUMP2); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_JUMP2); this->squishFlatTimer = 20; this->actor.scale.x = 0.2f; this->actor.scale.z = 0.2f; @@ -1412,7 +1412,7 @@ void EnBigslime_SetupRise(EnBigslime* this) { Animation_PlayLoop(&this->skelAnime, &gGekkoSwimForwardAnim); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_JUMP_ABOVE); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_UTSUBO_APPEAR_TRG); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_JUMP1); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_JUMP1); this->riseCounter = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; this->actor.gravity = 0.0f; @@ -1500,7 +1500,7 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, PlayState* play) { this->grabPlayerTimer = 15; this->wavySurfaceTimer = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; - this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.world.rot.y; if (yaw > 0x4000) { @@ -1515,7 +1515,7 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, PlayState* play) { this->subCamYawGrabPlayer += this->actor.world.rot.y; Animation_PlayLoop(&this->skelAnime, &gGekkoBoxingStanceAnim); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_EAT); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_EAT); this->actionFunc = EnBigslime_CutsceneGrabPlayer; } @@ -1624,7 +1624,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { } play->damagePlayer(play, -4); - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); this->gekkoRot.y += (s16)(Rand_S16Offset(0x4000, 0x4000) * (Rand_ZeroOne() < 0.5f ? -1 : 1)); this->gekkoPosOffset.x = Math_SinS(this->gekkoRot.y) * -50.0f; this->gekkoPosOffset.z = Math_CosS(this->gekkoRot.y) * -50.0f; @@ -1701,7 +1701,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { this->gekkoPosOffset.z = Math_CosS(this->gekkoRot.y) * -50.0f; } else { if (this->windupPunchTimer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_REVERSE); EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_PUNCH1); } @@ -1818,9 +1818,9 @@ void EnBigslime_SetupFreeze(EnBigslime* this) { s32 i; s32 j; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->freezeTimer = 40; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; } else if ((this->actionFunc == EnBigslime_Rise) && (this->riseCounter < 2)) { @@ -1898,7 +1898,7 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) { } func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->freezeTimer == 0) { EnBigslime_BreakIntoMinislime(this, play); } else { @@ -1907,7 +1907,7 @@ void EnBigslime_Freeze(EnBigslime* this, PlayState* play) { EnBigslime_SetupSquishFlat(this); } } else if (this->freezeTimer == 0) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnBigslime_SetupFrozenFall(this); } else { EnBigslime_SetupFrozenGround(this); @@ -2019,14 +2019,14 @@ void EnBigslime_FrozenFall(EnBigslime* this, PlayState* play) { func_800B8D50(play, &this->actor, 7.0f, this->actor.yawTowardsPlayer, 5.0f, 0x10); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnBigslime_BreakIntoMinislime(this, play); } } void EnBigslime_SetupJumpGekko(EnBigslime* this) { Animation_PlayLoop(&this->skelAnime, &gGekkoJumpForwardAnim); - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; this->jumpTimer = 100; this->actor.world.rot.y = this->gekkoRot.y; this->gekkoYaw = this->actor.yawTowardsPlayer + 0x8000; @@ -2037,7 +2037,7 @@ void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play) { s16 yaw; s16 yawDiff; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->gekkoCollider.base.acFlags |= AC_ON; this->actor.flags |= ACTOR_FLAG_1; } @@ -2049,15 +2049,16 @@ void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EV_WALK_WATER); } - if (!(this->actor.bgCheckFlags & 1) || ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { - this->actor.speedXZ = 8.0f; + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { + this->actor.speed = 8.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (Math_SmoothStepToS(&this->actor.world.rot.y, this->gekkoYaw, 5, 0x1000, 0x80) == 0) { - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 240.0f) { - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 240.0f) { + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); yawDiff = yaw - (s16)(this->actor.yawTowardsPlayer + 0x8000); this->gekkoYaw = ABS_ALT(yawDiff) < 0x3000 ? yaw : (yawDiff / 2) + (s16)(this->actor.yawTowardsPlayer + 0x8000); @@ -2087,8 +2088,8 @@ void EnBigslime_JumpGekko(EnBigslime* this, PlayState* play) { void EnBigslime_SetupIdleLookAround(EnBigslime* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoNervousIdleAnim); this->idleTimer = 60; - this->actor.speedXZ = 0.0f; - if (BINANG_SUB(Actor_YawToPoint(&this->actor, &this->actor.home.pos), this->gekkoRot.y) > 0) { + this->actor.speed = 0.0f; + if (BINANG_SUB(Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), this->gekkoRot.y) > 0) { this->gekkoYaw = this->gekkoRot.y + (Rand_Next() >> 20) + 0x2000; } else { this->gekkoYaw = this->gekkoRot.y - (Rand_Next() >> 20) - 0x2000; @@ -2110,7 +2111,7 @@ void EnBigslime_IdleLookAround(EnBigslime* this, PlayState* play) { if ((this->skelAnime.animation == &gGekkoNervousIdleAnim) && Math_ScaledStepToS(&this->gekkoRot.y, this->gekkoYaw, 0x400)) { - if (BINANG_SUB(Actor_YawToPoint(&this->actor, &this->actor.home.pos), this->gekkoRot.y) > 0) { + if (BINANG_SUB(Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), this->gekkoRot.y) > 0) { this->gekkoYaw = this->gekkoRot.y + (Rand_Next() >> 20) + 0x2000; } else { this->gekkoYaw = this->gekkoRot.y - (Rand_Next() >> 20) - 0x2000; @@ -2144,7 +2145,7 @@ void EnBigslime_IdleNoticePlayer(EnBigslime* this, PlayState* play) { void EnBigslime_SetupThrowMinislime(EnBigslime* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoWindupPunchAnim); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_HOLD_SLIME); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnBigslime_ThrowMinislime; } @@ -2168,7 +2169,7 @@ void EnBigslime_SetupDamageGekko(EnBigslime* this, s32 isNotFrozen) { Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoDamagedAnim, -3.0f); this->gekkoCollider.base.acFlags &= ~AC_ON; this->damageSpinTimer = 20; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->actor.gravity = -2.0f; this->actor.velocity.y = 0.0f; if (isNotFrozen) { @@ -2192,7 +2193,7 @@ void EnBigslime_DamageGekko(EnBigslime* this, PlayState* play) { this->damageSpinTimer--; damageSpinTimer = CLAMP_MAX(this->damageSpinTimer, 10); this->gekkoRot.y += 0x300 * damageSpinTimer; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (this->damageSpinTimer == 0) { EnBigslime_SetupCutscene(this); } @@ -2205,7 +2206,7 @@ void EnBigslime_SetupStunGekko(EnBigslime* this) { } this->actionFunc = EnBigslime_StunGekko; this->skelAnime.playSpeed = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnBigslime_StunGekko(EnBigslime* this, PlayState* play) { @@ -2224,10 +2225,10 @@ void EnBigslime_StunGekko(EnBigslime* this, PlayState* play) { void EnBigslime_SetupCutsceneFormBigslime(EnBigslime* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoJumpUpAnim); this->gekkoCollider.base.acFlags &= ~AC_ON; - this->actor.world.rot.x = -Actor_PitchToPoint(&this->actor, &this->actor.home.pos); - this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.x = -Actor_WorldPitchTowardPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->actionFunc = EnBigslime_CutsceneFormBigslime; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnBigslime_CutsceneFormBigslime(EnBigslime* this, PlayState* play) { @@ -2245,7 +2246,7 @@ void EnBigslime_SetupFormBigslime(EnBigslime* this) { this->gekkoRot.x = 0x4000 - this->actor.world.rot.x; this->formBigslimeTimer = 0; this->wavySurfaceTimer = 0; - this->actor.speedXZ = 25.0f; + this->actor.speed = 25.0f; this->gekkoRot.y = this->actor.world.rot.y; this->formBigslimeCutsceneTimer = 2; @@ -2281,10 +2282,10 @@ void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_PlayLoop(&this->skelAnime, &gGekkoSwimForwardAnim); this->formBigslimeCutsceneTimer--; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_COMBINE); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_COMBINE); } else if (this->isAnimUpdate) { this->formBigslimeCutsceneTimer--; if (this->formBigslimeCutsceneTimer == 0) { @@ -2324,7 +2325,7 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { Animation_GetLastFrame(&gGekkoDamagedAnim.common), ANIMMODE_ONCE_INTERP, 0.0f); this->gekkoCollider.base.acFlags &= ~AC_ON; this->defeatTimer = 60; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->actor.gravity = -2.0f; this->actor.velocity.y = 0.0f; EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_DEAD); @@ -2334,7 +2335,7 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { subCamAt.y = this->actor.world.pos.y + 40.0f; subCamAt.z = this->actor.world.pos.z; - if (BINANG_SUB(Actor_YawToPoint(&this->actor, &this->actor.home.pos), this->actor.world.rot.y) > 0) { + if (BINANG_SUB(Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), this->actor.world.rot.y) > 0) { yawOffset = this->actor.world.rot.y + 0x4000; } else { yawOffset = this->actor.world.rot.y - 0x4000; @@ -2363,7 +2364,7 @@ void EnBigslime_CutsceneDefeat(EnBigslime* this, PlayState* play) { this->defeatTimer--; defeatTimer = CLAMP_MAX(this->defeatTimer, 10); this->gekkoRot.y += 0x300 * defeatTimer; - if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f)) { + if (Math_StepToF(&this->actor.speed, 0.0f, 0.5f)) { EnBigslime_SetupGekkoDespawn(this, play); } else { // Continue for the camera to follow Gekko as it spins in defeat @@ -2533,7 +2534,7 @@ void EnBigslime_SetupCutscene(EnBigslime* this) { ActorCutscene_SetIntentToPlay(this->cutscene); this->actionFuncStored = this->actionFunc; this->actionFunc = EnBigslime_PlayCutscene; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { @@ -2644,7 +2645,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { EnBigslime_SetupCutscene(this); } else if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_ELECTRIC_STUN) { this->stunTimer = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->gekkoDrawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->gekkoDrawDmgEffScale = 0.75f; this->gekkoDrawDmgEffAlpha = 2.0f; @@ -2652,7 +2653,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { } else if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_STUN || this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_DEKU_STUN) { this->stunTimer = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); EnBigslime_SetupStunGekko(this); } else if (this->actor.colChkInfo.damageEffect == BIGSLIME_DMGEFF_ICE) { EnBigslime_GekkoFreeze(this); @@ -2722,7 +2723,7 @@ void EnBigslime_AddIceShardEffect(EnBigslime* this, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_BROKEN); EnBigslime_InitShockwave(this, play); } diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index ed7b8c194..b0c4102c2 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -208,21 +208,21 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_801477B4(play); + Message_CloseTextbox(play); func_809CD634(this, play); break; case 1: func_8019F230(); switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: - func_80151938(play, 0x5F0); + Message_ContinueTextbox(play, 0x5F0); break; case PLAYER_FORM_HUMAN: - func_80151938(play, 0x5F8); + Message_ContinueTextbox(play, 0x5F8); break; case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: - func_80151938(play, 0x5E1); + Message_ContinueTextbox(play, 0x5E1); break; } break; @@ -235,16 +235,16 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x5DE: SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 3, &this->animIndex); - func_80151938(play, 0x5DF); + Message_ContinueTextbox(play, 0x5DF); break; case 0x5E4: - func_80151938(play, 0x5E7); + Message_ContinueTextbox(play, 0x5E7); break; case 0x5E5: - func_80151938(play, 0x5E0); + Message_ContinueTextbox(play, 0x5E0); break; case 0x5E7: - func_80151938(play, 0x5E5); + Message_ContinueTextbox(play, 0x5E5); break; case 0x5DC: case 0x5DD: @@ -254,11 +254,11 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { case 0x5EE: case 0x5F2: case 0x5F5: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x5F0: case 0x5F6: - func_80151938(play, 0x5EF); + Message_ContinueTextbox(play, 0x5EF); break; case 0x5E1: case 0x5E8: @@ -270,7 +270,7 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { case 0x5F4: case 0x5F7: case 0x5F8: - func_801477B4(play); + Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; func_809CCE98(this, play); @@ -292,7 +292,7 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { void func_809CD634(EnBji01* this, PlayState* play) { AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); - Audio_QueueSeqCmd(0xE0000101); + SEQCMD_DISABLE_PLAY_SEQUENCES(true); play->nextEntrance = ENTRANCE(TERMINA_FIELD, 10); /* Telescope entrance */ gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = play->nextEntrance; func_80169EFC(&play->state); /* Load new entrance? */ @@ -346,13 +346,15 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { this->actor.params = SHIKASHI_TYPE_DEFAULT; func_809CCE98(this, play); break; + case ENTRANCE(ASTRAL_OBSERVATORY, 2): /* Telescope entrance */ this->actor.flags |= ACTOR_FLAG_10000; AudioSfx_MuteBanks(0); - Audio_QueueSeqCmd(0xE0000100); + SEQCMD_DISABLE_PLAY_SEQUENCES(false); this->actor.params = SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE; func_809CCE98(this, play); break; + default: Actor_Kill(&this->actor); break; diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index 08070b61d..5ebfca40f 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -182,7 +182,7 @@ s32 EnBjt_Appear(EnBjt* this) { s32 finished = false; if (!this->playedSfx) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_HAND_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EV_TOILET_HAND_APPEAR); this->playedSfx = true; } @@ -207,7 +207,7 @@ s32 EnBjt_Vanish(EnBjt* this) { s32 finished = false; if (!this->playedSfx) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_HAND_VANISH); + Actor_PlaySfx(&this->actor, NA_SE_EV_TOILET_HAND_VANISH); this->playedSfx = true; } @@ -292,7 +292,7 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { this->playedSfx = false; this->behaviour++; } else if (this->timer == 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_TOILET_WATER); } break; @@ -363,7 +363,7 @@ void EnBjt_Talk(EnBjt* this, PlayState* play) { s16 yaw = this->actor.yawTowardsPlayer; if (func_8010BF58(&this->actor, play, sMsgEventScript, this->msgEventCallback, &this->msgEventArg4)) { - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; SubS_UpdateFlags(&this->stateFlags, 3, 7); this->stateFlags &= ~TOILET_HAND_STATE_TALKING; this->msgEventArg4 = 0; @@ -406,7 +406,7 @@ void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { } this->scheduleResult = scheduleOutput.result; } else { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; Actor_SetScale(&this->actor, 0.0f); this->stateFlags = 0; this->msgEventCallback = NULL; @@ -426,7 +426,7 @@ void EnBjt_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; Actor_SetScale(&this->actor, 0.0f); this->scheduleResult = TOILET_HAND_SCH_NONE; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index a25a33904..bdc59540b 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -17,11 +17,12 @@ void EnBom_Destroy(Actor* thisx, PlayState* play); void EnBom_Update(Actor* thisx, PlayState* play); void EnBom_Draw(Actor* thisx, PlayState* play); -void func_80871058(EnBom* this, PlayState* play); -void func_808714D4(EnBom* this, PlayState* play); +void EnBom_Move(EnBom* this, PlayState* play); +void EnBom_WaitForRelease(EnBom* this, PlayState* play); + void func_80872648(PlayState* play, Vec3f* arg1); void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4); -void func_80872BC0(PlayState* play, s32 arg1); +void EnBom_DrawKeg(PlayState* play, s32 arg1); typedef struct { /* 0x00 */ Vec3f pos; @@ -30,7 +31,7 @@ typedef struct { /* 0x1A */ s16 rotX; } PowderKegFuseSegment; // size = 0x1C -static PowderKegFuseSegment sPowderKegFuseSegments[16]; +PowderKegFuseSegment sPowderKegFuseSegments[16]; ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, @@ -173,11 +174,11 @@ void EnBom_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_100000; if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_808714D4; + this->actionFunc = EnBom_WaitForRelease; this->actor.room = -1; Actor_SetScale(&this->actor, enBomScales[this->isPowderKeg]); } else { - this->actionFunc = func_80871058; + this->actionFunc = EnBom_Move; gSaveContext.powderKegTimer = 0; } } @@ -192,24 +193,26 @@ void EnBom_Destroy(Actor* thisx, PlayState* play) { } } -void func_80871058(EnBom* this, PlayState* play) { +void EnBom_Move(EnBom* this, PlayState* play) { static Vec3f D_80872E68[] = { { 2.0f, -6.0f, -0.3f }, { 1.5f, -5.0f, -0.6f }, { 0.2f, -6.0f, -0.1f }, }; + // if bomb has a parent actor, the bomb hasnt been released yet if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_808714D4; + this->actionFunc = EnBom_WaitForRelease; this->actor.room = -1; return; } - if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & 0x10)) { + if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { this->actor.velocity.y = -this->actor.velocity.y; } - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + // rebound bomb off the wall it hits + if ((this->actor.speed != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { s16 yDiff = BINANG_SUB(this->actor.wallYaw, this->actor.world.rot.y); if (ABS_ALT(yDiff) > 0x4000) { @@ -217,14 +220,14 @@ void func_80871058(EnBom* this, PlayState* play) { BINANG_SUB(this->actor.wallYaw - this->actor.world.rot.y + this->actor.wallYaw, 0x8000); } - Actor_PlaySfxAtPos(&this->actor, this->isPowderKeg ? NA_SE_EV_PUT_DOWN_WOODBOX : NA_SE_EV_BOMB_BOUND); + Actor_PlaySfx(&this->actor, this->isPowderKeg ? NA_SE_EV_PUT_DOWN_WOODBOX : NA_SE_EV_BOMB_BOUND); Actor_MoveWithGravity(&this->actor); - this->actor.speedXZ *= 0.7f; - this->actor.bgCheckFlags &= ~8; + this->actor.speed *= 0.7f; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (!(this->actor.bgCheckFlags & 1)) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.08f); + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Math_StepToF(&this->actor.speed, 0.0f, 0.08f); } else { Vec3f* sp58; u32 sp54 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -251,64 +254,65 @@ void func_80871058(EnBom* this, PlayState* play) { Math_ApproachF(&this->actor.shape.yOffset, 700.0f, 1.0f, 700.0f); } - sp40 = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; - sp3C = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + sp40 = Math_SinS(this->actor.world.rot.y) * this->actor.speed; + sp3C = Math_CosS(this->actor.world.rot.y) * this->actor.speed; Actor_GetSlopeDirection(this->actor.floorPoly, &slopeNormal, &downwardSlopeYaw); sp40 += 3.0f * slopeNormal.x; sp3C += 3.0f * slopeNormal.z; sp38 = sqrtf(SQ(sp40) + SQ(sp3C)); - if ((sp38 < this->actor.speedXZ) || + if ((sp38 < this->actor.speed) || (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { if (sp38 > 16.0f) { - this->actor.speedXZ = 16.0f; + this->actor.speed = 16.0f; } else { - this->actor.speedXZ = sp38; + this->actor.speed = sp38; } this->actor.world.rot.y = Math_Atan2S_XY(sp3C, sp40); } - if (!Math_StepToF(&this->actor.speedXZ, 0.0f, sp58->x)) { + if (!Math_StepToF(&this->actor.speed, 0.0f, sp58->x)) { s16 temp = this->actor.world.rot.y; s32 pad; if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, this->actor.shape.rot.y)) > 0x4000) { temp = BINANG_ROT180(temp); } - Math_ScaledStepToS(&this->actor.shape.rot.y, temp, this->actor.speedXZ * 100.0f); - this->unk_1FA += (s16)(this->actor.speedXZ * 800.0f); + Math_ScaledStepToS(&this->actor.shape.rot.y, temp, this->actor.speed * 100.0f); + this->unk_1FA += (s16)(this->actor.speed * 800.0f); } - if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, this->isPowderKeg ? NA_SE_EV_TRE_BOX_BOUND : NA_SE_EV_BOMB_BOUND); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, this->isPowderKeg ? NA_SE_EV_TRE_BOX_BOUND : NA_SE_EV_BOMB_BOUND); if (this->actor.velocity.y < sp58->y) { if ((sp54 == 4) || (sp54 == 14) || (sp54 == 15)) { this->actor.velocity.y = 0.0f; } else { this->actor.velocity.y = this->actor.velocity.y * sp58->z; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } else if (this->timer >= 4) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } Actor_MoveWithGravity(&this->actor); } -void func_808714D4(EnBom* this, PlayState* play) { +void EnBom_WaitForRelease(EnBom* this, PlayState* play) { + // if parent is NULL bomb has been released if (Actor_HasNoParent(&this->actor, play)) { - this->actionFunc = func_80871058; + this->actionFunc = EnBom_Move; this->actor.room = play->roomCtx.curRoom.num; this->actor.flags &= ~ACTOR_FLAG_100000; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; } - func_80871058(this, play); + EnBom_Move(this, play); } else { Math_Vec3f_ToVec3s(&this->actor.home.rot, &this->actor.parent->world.pos); if (this->isPowderKeg) { @@ -318,7 +322,7 @@ void func_808714D4(EnBom* this, PlayState* play) { Math_ScaledStepToS(&this->unk_1FA, 0, 2000); } -void func_808715B8(EnBom* this, PlayState* play) { +void EnBom_Explode(EnBom* this, PlayState* play) { static s16 D_80872E8C[] = { 100, 200 }; static Color_RGBA8 D_80872E90 = { 185, 140, 70, 255 }; static Color_RGBA8 D_80872E94 = { 255, 255, 255, 255 }; @@ -347,7 +351,7 @@ void func_808715B8(EnBom* this, PlayState* play) { this->collider2.base.atFlags &= ~OC1_TYPE_1; } - if (this->actor.params == ENBOM_1) { + if (this->actor.params == BOMB_TYPE_EXPLOSION) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } @@ -423,12 +427,12 @@ static s16 D_80872E98[] = { 3, 5 }; static s16 D_80872E9C[] = { 10, 15 }; void EnBom_Update(Actor* thisx, PlayState* play) { - Vec3f spA4 = { 0.0f, 0.0f, 0.0f }; - Vec3f sp98 = { 0.0f, 0.1f, 0.0f }; - Vec3f sp8C = { 0.0f, 0.0f, 0.0f }; - Vec3f sp80; - Vec3f sp74 = { 0.0f, 0.6f, 0.0f }; - Color_RGBA8 sp70 = { 255, 255, 255, 255 }; + Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; + Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; // unused + Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; + Vec3f dustAccel = { 0.0f, 0.6f, 0.0f }; + Color_RGBA8 dustColor = { 255, 255, 255, 255 }; EnBom* this = THIS; s32 pad; Player* player = GET_PLAYER(play); @@ -444,7 +448,7 @@ void EnBom_Update(Actor* thisx, PlayState* play) { if (this->unk_1FC != 0) { this->unk_1FC--; - Math_ApproachZeroF(&thisx->speedXZ, 1.0f, 1.0f); + Math_ApproachZeroF(&thisx->speed, 1.0f, 1.0f); Actor_MoveWithGravity(thisx); Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 4); if (this->unk_1FC == 0) { @@ -456,13 +460,13 @@ void EnBom_Update(Actor* thisx, PlayState* play) { } else { thisx->gravity = -1.2f; if (this->timer != 0) { - if (!this->isPowderKeg || (func_808715B8 == this->actionFunc) || !Play_InCsMode(play)) { + if (!this->isPowderKeg || (EnBom_Explode == this->actionFunc) || !Play_InCsMode(play)) { this->timer--; } } if ((!this->isPowderKeg && (this->timer == 67)) || (this->isPowderKeg && (this->timer <= 2400))) { - Actor_PlaySfxAtPos(thisx, NA_SE_PL_TAKE_OUT_SHIELD); + Actor_PlaySfx(thisx, NA_SE_PL_TAKE_OUT_SHIELD); Actor_SetScale(thisx, enBomScales[this->isPowderKeg]); } @@ -473,17 +477,18 @@ void EnBom_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 0x1F); - if (thisx->params == ENBOM_0) { + if (thisx->params == BOMB_TYPE_BODY) { static Vec3us D_80872ED4[] = { { 40, 20, 100 }, { 300, 60, 600 }, }; Vec3us* sp60 = &D_80872ED4[this->isPowderKeg]; - sp74.y = 0.2f; - Math_Vec3f_Copy(&sp80, &thisx->home.pos); + // spawn spark effect on even frames + dustAccel.y = 0.2f; + Math_Vec3f_Copy(&effPos, &thisx->home.pos); if ((play->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(play, thisx, &sp80, &spA4, &sp8C); + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } if (this->isPowderKeg) { func_801A0810(&thisx->projectedPos, NA_SE_IT_BIG_BOMB_IGNIT - SFX_FLAG, @@ -491,25 +496,30 @@ void EnBom_Update(Actor* thisx, PlayState* play) { : (this->flashSpeedScale == 3) ? 1 : 2); } else { - Actor_PlaySfxAtPos(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); + Actor_PlaySfx(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); } - sp80.y += 3.0f; - func_800B0DE0(play, &sp80, &spA4, &sp74, &sp70, &sp70, 50, 5); + effPos.y += 3.0f; + func_800B0DE0(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); if ((this->collider1.base.acFlags & AC_HIT) || ((this->collider1.base.ocFlags1 & OC1_HIT) && ((this->collider1.base.oc->category == ACTORCAT_ENEMY) || (this->collider1.base.oc->category == ACTORCAT_BOSS)))) { this->timer = 0; thisx->shape.rot.z = 0; - } else if ((this->timer > 100) && (Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f))) { - this->timer = 100; + } else { + // if a lit stick touches the bomb, set timer to 100 + // these bombs never have a timer over 70, so this isn't used + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { + this->timer = 100; + } } - sp74.y = 0.2f; - sp80 = thisx->world.pos; - sp80.y += 10.0f; + dustAccel.y = 0.2f; + effPos = thisx->world.pos; + effPos.y += 10.0f; + // double bomb flash speed and adjust red color at certain times during the countdown if ((this->timer == sp60->x) || (this->timer == sp60->y) || (this->timer == 3)) { thisx->shape.rot.z = 0; this->flashSpeedScale >>= 1; @@ -526,12 +536,12 @@ void EnBom_Update(Actor* thisx, PlayState* play) { } if (this->timer == 0) { - sp80 = thisx->world.pos; - sp80.y += 10.0f; + effPos = thisx->world.pos; + effPos.y += 10.0f; if (Actor_HasParent(thisx, play)) { - sp80.y += 30.0f; + effPos.y += 30.0f; } - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp80.x, sp80.y - 10.0f, sp80.z, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y - 10.0f, effPos.z, 0, 0, 0, this->isPowderKeg); func_800BC848(thisx, play, D_80872E98[this->isPowderKeg], D_80872E9C[this->isPowderKeg]); play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = @@ -539,30 +549,32 @@ void EnBom_Update(Actor* thisx, PlayState* play) { play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = play->envCtx.lightSettings.ambientColor[2] = 250; Camera_AddQuake(&play->mainCamera, 2, 11, 8); - thisx->params = ENBOM_1; + thisx->params = BOMB_TYPE_EXPLOSION; this->timer = 10; thisx->flags |= (ACTOR_FLAG_20 | ACTOR_FLAG_100000); - this->actionFunc = func_808715B8; + this->actionFunc = EnBom_Explode; if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; - Actor_PlaySfxAtPos(thisx, NA_SE_IT_BIG_BOMB_EXPLOSION); + Actor_PlaySfx(thisx, NA_SE_IT_BIG_BOMB_EXPLOSION); } else { - Actor_PlaySfxAtPos(thisx, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(thisx, NA_SE_IT_BOMB_EXPLOSION); } } } Actor_SetFocus(thisx, 20.0f); - if (thisx->params <= ENBOM_0) { + if (thisx->params <= BOMB_TYPE_BODY) { Collider_UpdateCylinder(thisx, &this->collider1); + + // if link is not holding the bomb anymore and bump conditions are met, subscribe to OC if (!Actor_HasParent(thisx, play) && (this->unk_1F8 != 0)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } - if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != ENBOM_1)) { + if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != BOMB_TYPE_EXPLOSION)) { if (thisx->depthInWater >= 20.0f) { Vec3f sp54; @@ -579,9 +591,9 @@ void EnBom_Update(Actor* thisx, PlayState* play) { thisx->velocity.y = (KREG(83) * 0.1f) + -2.0f; thisx->gravity = (KREG(84) * 0.1f) + -0.5f; this->unk_1FC = KREG(81) + 10; - } else if (thisx->bgCheckFlags & 0x40) { - thisx->bgCheckFlags &= ~0x40; - Actor_PlaySfxAtPos(thisx, NA_SE_EV_BOMB_DROP_WATER); + } else if (thisx->bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + thisx->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; + Actor_PlaySfx(thisx, NA_SE_EV_BOMB_DROP_WATER); } } } @@ -600,7 +612,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (this->actor.params == ENBOM_0) { + if (this->actor.params == BOMB_TYPE_BODY) { func_8012C28C(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider2); @@ -644,7 +656,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gPowderKegGoronSkullDL); func_808726DC(play, &this->actor.home.pos, &sp58, &sp4C, this->timer); - func_80872BC0(play, this->timer); + EnBom_DrawKeg(play, this->timer); } } @@ -768,7 +780,7 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a Math_Vec3f_Copy(arg1, &fuseSegmentPtr->pos); } -void func_80872BC0(PlayState* play, s32 arg1) { +void EnBom_DrawKeg(PlayState* play, s32 arg1) { s32 temp_s5; s32 i; PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index 23218a183..bf568cd6a 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -11,10 +11,10 @@ typedef void (*EnBomActionFunc)(struct EnBom*, PlayState*); #define ENBOM_GETZ_80(thisx) ((thisx)->shape.rot.z & 0x80) #define ENBOM_GETZ_FF00(thisx) (((thisx)->shape.rot.z & 0xFF00) >> 8) -enum { - /* 0 */ ENBOM_0, - /* 1 */ ENBOM_1, -}; +typedef enum { + /* 0 */ BOMB_TYPE_BODY, + /* 1 */ BOMB_TYPE_EXPLOSION, +} BombType; typedef struct EnBom { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index da6e8d6d0..8481b88a9 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -123,27 +123,27 @@ void func_809C49CC(EnBomBowlMan* this) { if ((this->unk_2F8 == 5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2F8 == 0xB) && (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2F8 == 0x12) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2F8 == 0xF) && Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } if ((this->unk_2F8 == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -242,7 +242,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { s32 pad; s32 sp28 = false; - func_801477B4(play); + Message_CloseTextbox(play); switch (this->unk_2C0) { case 0: @@ -319,9 +319,9 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { if (!sp28) { if (player->transformation == PLAYER_FORM_HUMAN) { - func_80151938(play, D_809C618C[this->unk_2C0]); + Message_ContinueTextbox(play, D_809C618C[this->unk_2C0]); } else { - func_80151938(play, D_809C6198[this->unk_2C0]); + Message_ContinueTextbox(play, D_809C6198[this->unk_2C0]); } } } @@ -351,7 +351,7 @@ void func_809C51B4(EnBomBowlMan* this, PlayState* play) { void func_809C52B4(EnBomBowlMan* this) { this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.world.pos.x = 1340.0f; this->actor.world.pos.z = -1795.0f; @@ -411,7 +411,7 @@ void func_809C5524(EnBomBowlMan* this, PlayState* play) { void func_809C5598(EnBomBowlMan* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if ((this->actor.textId == 0x72F) || (this->actor.textId == 0x730)) { this->actor.textId = 0x731; } else if (this->actor.textId == 0x731) { @@ -439,7 +439,7 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C5738; return; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } @@ -496,7 +496,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } void func_809C59A4(EnBomBowlMan* this, PlayState* play) { - Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); this->unk_29C = 1; this->actionFunc = func_809C59F0; } @@ -513,7 +513,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) { func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_809C5AA4; } else { - Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); } } @@ -579,7 +579,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { if (D_809C6100 > 5) { Player* player = GET_PLAYER(play); - func_801477B4(play); + Message_CloseTextbox(play); Camera_SetTargetActor(subCam, &this->unk_2D8[0]->actor); func_809C493C(this, 13, 1.0f); D_809C6100 = 0; diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index cbcc40211..40e93b861 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -184,7 +184,7 @@ void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { func_800B8EF4(play, &this->actor); this->isMoving = true; - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; this->movingSpeed = 8.0f; EnBomChu_SetupMove(this); } @@ -233,7 +233,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) { bgIdUpDown = bgIdSide = BGCHECK_SCENE; isFloorPolyValid = false; - this->actor.speedXZ = this->movingSpeed; + this->actor.speed = this->movingSpeed; lineLength = 2.0f * this->movingSpeed; if ((this->timer == 0) || (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { @@ -259,7 +259,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) { isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polySide, play); Math_Vec3f_Copy(&this->actor.world.pos, &posSide); this->actor.floorBgId = bgIdSide; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (this->actor.floorPoly != polyUpDown) { isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, polyUpDown, play); @@ -269,7 +269,7 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) { this->actor.floorBgId = bgIdUpDown; } } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; lineLength *= 3.0f; Math_Vec3f_Copy(&posA, &posB); @@ -316,8 +316,8 @@ void EnBomChu_Move(EnBomChu* this, PlayState* play) { func_800B8F98(&this->actor, NA_SE_IT_BOMBCHU_MOVE - SFX_FLAG); } - if (this->actor.speedXZ != 0.0f) { - this->movingSpeed = this->actor.speedXZ; + if (this->actor.speed != 0.0f) { + this->movingSpeed = this->actor.speed; } } @@ -336,7 +336,7 @@ void EnBomChu_Explode(EnBomChu* this, PlayState* play) { } this->timer = 1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.depthInWater > 0.0f) { for (i = 0; i < 40; i++) { @@ -441,7 +441,7 @@ void EnBomChu_HandleNonSceneCollision(EnBomChu* this, PlayState* play) { isFloorPolyValid = EnBomChu_UpdateFloorPoly(this, poly, play); Math_Vec3f_Copy(&this->actor.world.pos, &originalWorldPos); this->actor.floorBgId = bgId; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (isFloorPolyValid) { EnBomChu_UpdateRotation(this); @@ -512,23 +512,23 @@ void EnBomChu_Update(Actor* thisx, PlayState* play) { this->actor.depthInWater = waterY - this->actor.world.pos.y; if (this->actor.depthInWater < 0.0f) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { EnBomChu_SpawnRipplesAndSplashes(this, play, waterY, true); } - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; return; } - if (!(this->actor.bgCheckFlags & 0x20) && (this->timer != 120)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->timer != 120)) { EnBomChu_SpawnRipplesAndSplashes(this, play, waterY, true); } else { EffectSsBubble_Spawn(play, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); } - this->actor.bgCheckFlags |= 0x20; + this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; } else { - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; this->actor.depthInWater = BGCHECK_Y_MIN; } } diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index bcb7cb534..cccddedfd 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -136,7 +136,7 @@ void func_80C05C44(EnBombal* this, PlayState* play) { } SET_WEEKEVENTREG(WEEKEVENTREG_83_04); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); this->timer = 30; this->isPopped = true; this->actionFunc = func_80C05DE8; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 2ca62ef0a..f96809878 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -165,13 +165,13 @@ void func_80C038B4(EnBombers* this) { if ((this->unk_2C4 == 2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2C4 == 15) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } } @@ -338,7 +338,7 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { if ((this->unk_2A6 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { sp2A = 0; - func_801477B4(play); + Message_CloseTextbox(play); this->unk_2A6 = TEXT_STATE_5; if ((this->actor.textId == 0x73D) || (this->actor.textId == 0x73E) || (this->actor.textId == 0x73F)) { @@ -420,7 +420,7 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { break; case 1: - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; } } @@ -449,7 +449,7 @@ void func_80C04354(EnBombers* this, PlayState* play) { void func_80C043C8(EnBombers* this, PlayState* play) { Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x3E8, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80C042F8(this); } } diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 74575628f..d479e0745 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -233,15 +233,15 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { if (correctDigits >= 5) { this->textIdIndex = 6; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(play, this->actor.textId); - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); + Message_ContinueTextbox(play, this->actor.textId); + Actor_PlaySfx(&this->actor, NA_SE_SY_PIECE_OF_HEART); this->talkState = TEXT_STATE_5; return; } } if (Text_GetFaceReaction(play, 0x15) != 0) { this->unk_28E = 0; - func_801477B4(play); + Message_CloseTextbox(play); func_80C04B40(this); } else { s32 j; @@ -252,13 +252,13 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { case 5: case 7: this->unk_28E = 0; - func_801477B4(play); + Message_CloseTextbox(play); func_80C04B40(this); break; case 2: this->textIdIndex = 3; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_15; break; case 3: @@ -266,15 +266,15 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { this->correctDigitSlots[j] = false; } this->textIdIndex = 4; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); + Actor_PlaySfx(&this->actor, NA_SE_SY_ERROR); this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; case 4: this->textIdIndex = 5; this->actor.textId = sTextIds[this->textIdIndex]; - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; case 6: @@ -322,9 +322,9 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { if ((fabsf(this->unk_29C.x - this->actor.world.pos.x) < 3.0f) && (fabsf(this->unk_29C.z - this->actor.world.pos.z) < 3.0f)) { this->unk_2B6 = this->actor.yawTowardsPlayer; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (fabsf(this->actor.world.rot.y - this->actor.yawTowardsPlayer) < 100.0f) { - func_801477B4(play); + Message_CloseTextbox(play); this->talkState = TEXT_STATE_5; this->textIdIndex = 7; EnBombers2_ChangeAnim(this, 6, 1.0f); @@ -357,7 +357,7 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { if ((this->animIndex == 2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } this->actor.shape.rot.y = this->actor.world.rot.y; if (this->unk_2C0 != 2) { diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 0b5ffff54..ea9ab2e22 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -156,7 +156,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { func_800B8C20(&this->actor, &bombf->actor, play); this->timer = 180; this->unk_204 = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PULL_UP_ROCK); + Actor_PlaySfx(&this->actor, NA_SE_PL_PULL_UP_ROCK); this->actor.flags &= ~ACTOR_FLAG_1; } else { player->actor.child = NULL; @@ -168,7 +168,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { } else if ((this->colliderCylinder.base.acFlags & AC_HIT) && ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x13828) || ((this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0x200) && - (player->transformation == PLAYER_FORM_GORON) && (player->actor.speedXZ > 15.0f)))) { + (player->transformation == PLAYER_FORM_GORON) && (player->actor.speed > 15.0f)))) { this->colliderCylinder.base.acFlags &= ~AC_HIT; if (this->colliderCylinder.base.ac->category != ACTORCAT_BOSS) { bombf = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x, @@ -193,7 +193,7 @@ void func_808AEAE0(EnBombf* this, PlayState* play) { } } else { if (!Actor_HasParent(&this->actor, play)) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); return; } player->actor.child = NULL; @@ -232,27 +232,27 @@ void func_808AEE3C(EnBombf* this, PlayState* play) { } this->unk_204 = 1.0f; - if (!(this->actor.bgCheckFlags & 1)) { - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.025f, 0.0f); + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.025f, 0.0f); return; } - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); - if (this->actor.bgCheckFlags & 2) { + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { func_800B8EF4(play, &this->actor); if (this->actor.velocity.y < -6.0f) { this->actor.velocity.y *= -0.3f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } else if (this->timer >= 4) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } void func_808AEF68(EnBombf* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { EnBombf_SetupAction(this, func_808AEE3C); - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; func_808AEE3C(this, play); } else { this->actor.velocity.y = 0.0f; @@ -341,24 +341,24 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { } if (ENBOMBF_GET(&this->actor) == ENBOMBF_0) { - if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & 0x10)) { + if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { this->actor.velocity.y = -this->actor.velocity.y; } - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + if ((this->actor.speed != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { s16 yDiff = BINANG_SUB(this->actor.wallYaw, this->actor.world.rot.y); if (ABS_ALT(yDiff) > 0x4000) { this->actor.world.rot.y = BINANG_SUB(this->actor.wallYaw - this->actor.world.rot.y + this->actor.wallYaw, 0x8000); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_BOUND); Actor_MoveWithGravity(&this->actor); DREG(6) = 1; Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; - this->actor.speedXZ *= 0.7f; - this->actor.bgCheckFlags &= ~8; + this->actor.speed *= 0.7f; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } if ((this->colliderCylinder.base.acFlags & AC_HIT) || @@ -378,7 +378,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { if ((play->gameplayFrames % 2) == 0) { EffectSsGSpk_SpawnFuse(play, &this->actor, &sp68, &sp8C, &sp74); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); sp68.y += 3.0f; func_800B0DE0(play, &sp68, &sp8C, &sp5C, &sp58, &sp58, 0x32, 5); } @@ -407,7 +407,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp68.x, sp68.y, sp68.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = play->envCtx.lightSettings.diffuseColor1[2] = 250; @@ -443,9 +443,9 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 0x40) { - this->actor.bgCheckFlags &= ~0x40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); } } } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index b17079b6e..8f3b4d3f3 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -219,21 +219,21 @@ void func_80BFE524(EnBomjima* this) { if ((this->animIndex == 5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->animIndex == 18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -409,7 +409,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos); if (Animation_OnFrame(&this->skelAnime, 19.0f)) { this->unk_2C0 = 5; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_SHOT_BREATH); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_SHOT_BREATH); } if (this->unk_2C0 == 1) { @@ -580,7 +580,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) { Actor_ChangeFocus(&this->actor, play, &bombal->actor); CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); func_80BFE65C(this); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BFEA94; } } @@ -594,7 +594,7 @@ void func_80BFF4F4(EnBomjima* this) { void func_80BFF52C(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (play->msgCtx.choiceIndex == 0) { Player* player = GET_PLAYER(play); @@ -608,7 +608,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { } else { this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); play_sound(NA_SE_SY_FOUND); func_80BFE494(this, 15, 1.0f); this->action = EN_BOMJIMA_ACTION_5; @@ -626,7 +626,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { this->actor.textId = D_80C00A70[this->unk_2C8]; this->unk_2EA = 1; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); func_80C00234(this); } } @@ -637,7 +637,7 @@ void func_80BFF6CC(EnBomjima* this, PlayState* play) { if (this->animLastFrame <= curFrame) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80BFE494(this, 1, 1.0f); this->actionFunc = func_80BFF754; } @@ -735,14 +735,14 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { } else { this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_80BFFB40; } } void func_80BFFB40(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80BFE494(this, 15, 1.0f); D_80C009F0 = 100; this->unk_2DC = 0; @@ -768,7 +768,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->unk_290, this->unk_2DC, 1, 5000, 0); if (D_80C009F0 >= 104) { D_80C009F0 = 0; - func_801477B4(play); + Message_CloseTextbox(play); play->nextEntrance = Entrance_CreateFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -848,7 +848,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { if (this->animIndex == 8) { if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); D_80C009F4 = 2; } @@ -944,13 +944,13 @@ void func_80C00284(EnBomjima* this, PlayState* play) { func_80BFF3F0(this); } else { func_80BFE65C(this); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BFEA94; } return; } - func_801477B4(play); + Message_CloseTextbox(play); switch (this->unk_2CA) { case 0: @@ -984,7 +984,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { } this->actor.textId = D_80C00A70[this->unk_2C8]; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); if ((this->unk_2C8 == 7) || (this->unk_2C8 == 12)) { func_80BFF4F4(this); } @@ -993,7 +993,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { case 3: this->unk_2C8++; this->actor.textId = D_80C00A8C[this->unk_2C8]; - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); if (this->unk_2C8 >= 2) { func_80BFE494(this, 17, 1.0f); } diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 7e07ed9d6..c8de769c7 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -185,20 +185,20 @@ void func_80C011CC(EnBomjimb* this) { if ((this->unk_2DC == 5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2DC == 19) && (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } if ((this->unk_2DC == 18) && Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } if ((this->unk_2DC == 7) && Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -215,7 +215,7 @@ s32 func_80C012FC(EnBomjimb* this, PlayState* play) { if (!Play_InCsMode(play) && (this->actor.xzDistToPlayer < 40.0f) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 50.0f) && (play->msgCtx.msgLength == 0)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80C02740(this, play); return true; } @@ -368,7 +368,7 @@ void func_80C01A24(EnBomjimb* this, PlayState* play) { if ((this->unk_2E4 != NULL) && (this->unk_2E4->update != NULL)) { ((EnNiw*)this->unk_2E4)->unk2BC.z = 90000.0f; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2E4 = NULL; this->actor.gravity = -2.0f; func_80C02108(this); @@ -380,10 +380,10 @@ void func_80C01A24(EnBomjimb* this, PlayState* play) { } if (this->unk_2C0 != 0) { - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.5f, 2.0f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.5f, 2.0f); } - if ((this->unk_2C0 != 0) && !(this->actor.bgCheckFlags & 1)) { + if ((this->unk_2C0 != 0) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80C01B40(this); } } @@ -395,13 +395,13 @@ void func_80C01B40(EnBomjimb* this) { } void func_80C01B74(EnBomjimb* this, PlayState* play) { - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.5f, 2.0f); - if ((this->collider.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { + Math_ApproachF(&this->actor.speed, 6.0f, 0.5f, 2.0f); + if ((this->collider.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->collider.base.acFlags &= ~AC_HIT; if ((this->unk_2E4 != NULL) && (this->unk_2E4->update != NULL)) { ((EnNiw*)this->unk_2E4)->unk2BC.z = 90000.0f; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2E4 = NULL; this->actor.gravity = -2.0f; func_80C02108(this); @@ -419,7 +419,7 @@ void func_80C01C18(EnBomjimb* this, PlayState* play) { this->unk_294.z = this->unk_2E4->world.pos.z; } } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2CA = 2; this->actionFunc = func_80C01CD0; } @@ -450,8 +450,8 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { this->actor.draw = NULL; } - if ((this->unk_2C0 == 0) && (this->unk_2E4->bgCheckFlags & 1)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); + if ((this->unk_2C0 == 0) && (this->unk_2E4->bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor_PlaySfx(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); this->unk_2C0 = 1; } @@ -553,7 +553,7 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { return; } - Math_ApproachF(&this->actor.speedXZ, 8.0f, 0.5f, 2.0f); + Math_ApproachF(&this->actor.speed, 8.0f, 0.5f, 2.0f); Math_Vec3f_Copy(&sp74, &this->actor.world.pos); sp74.x += Math_SinS(this->actor.world.rot.y) * 50.0f; @@ -611,7 +611,7 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { void func_80C0250C(EnBomjimb* this) { func_80C0113C(this, 15, 1.0f); this->unk_2D4 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); func_80C012E0(this); this->unk_2CA = 6; @@ -640,7 +640,7 @@ void func_80C02570(EnBomjimb* this, PlayState* play) { void func_80C0267C(EnBomjimb* this) { func_80C012E0(this); func_80C0113C(this, 8, 1.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->unk_2AE = 40; this->unk_2C2 = 0; @@ -693,7 +693,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { if (gSaveContext.save.bombersCaughtNum > 4) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); + Actor_PlaySfx(&this->actor, NA_SE_SY_PIECE_OF_HEART); } switch (this->unk_2C8) { @@ -749,7 +749,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { player->actor.freezeTimer = 3; if (this->unk_2E0 == 0) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); this->unk_2E0 = 1; } } @@ -760,7 +760,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if ((this->unk_2CA == 8) && (gSaveContext.save.bombersCaughtNum >= 5)) { func_80C02CA4(this, play); } else { @@ -779,7 +779,7 @@ void func_80C02BCC(EnBomjimb* this, PlayState* play) { if (this->unk_2C0 == 0) { player->actor.freezeTimer = 3; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_2C0 = 1; player->stateFlags1 &= ~PLAYER_STATE1_10000000; } @@ -840,7 +840,7 @@ void EnBomjimb_Update(Actor* thisx, PlayState* play2) { if (this->unk_2CA == 0) { if ((this->unk_2E4 != NULL) && (this->unk_2E4->update != NULL)) { Math_Vec3f_Copy(&this->unk_2E4->world.pos, &this->actor.world.pos); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_2E4->world.pos.y = this->actor.world.pos.y + 35.0f; } else { this->unk_2E4->world.pos.y = this->actor.world.pos.y + 25.0f; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 33af85b3e..4abfad7b1 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -63,22 +63,23 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) { void func_808A24DC(EnBoom* this, PlayState* play) { WaterBox* sp54; f32 sp50 = this->actor.world.pos.y; - u16 sp4E = this->actor.bgCheckFlags & 0x20; + u16 sp4E = this->actor.bgCheckFlags & BGCHECKFLAG_WATER; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && (this->actor.world.pos.y < sp50)) { Vec3f sp40; - this->actor.bgCheckFlags |= 0x20; + this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; sp40.x = this->actor.world.pos.x; sp40.y = this->actor.world.pos.y - 20.0f; sp40.z = this->actor.world.pos.z; EffectSsBubble_Spawn(play, &sp40, 20.0f, 10.0f, 20.0f, 0.13f); } else { - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; } - if ((this->actor.bgCheckFlags & 0x40) && ((this->actor.bgCheckFlags & 0x20) != sp4E)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) != sp4E)) { Vec3f sp34; Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &sp34); @@ -95,14 +96,14 @@ void func_808A24DC(EnBoom* this, PlayState* play) { EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 300); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); EffectSsGRipple_Spawn(play, &sp34, 100, 500, 0); EffectSsGRipple_Spawn(play, &sp34, 100, 500, 4); EffectSsGRipple_Spawn(play, &sp34, 100, 500, 8); } - this->actor.bgCheckFlags |= 0x40; + this->actor.bgCheckFlags |= BGCHECKFLAG_WATER_TOUCH; } void EnBoom_Init(Actor* thisx, PlayState* play) { @@ -177,9 +178,9 @@ void func_808A2918(EnBoom* this, PlayState* play) { sp7C = this->player; if (sp7C != NULL) { - sp72 = Actor_YawToPoint(&this->actor, &sp7C->focus.pos); + sp72 = Actor_WorldYawTowardPoint(&this->actor, &sp7C->focus.pos); sp70 = this->actor.world.rot.y - sp72; - sp6E = Actor_PitchToPoint(&this->actor, &sp7C->focus.pos); + sp6E = Actor_WorldPitchTowardPoint(&this->actor, &sp7C->focus.pos); sp6C = this->actor.world.rot.x - sp6E; sp64 = (200.0f - Math_Vec3f_DistXYZ(&this->actor.world.pos, &sp7C->focus.pos)) * 0.005f; @@ -262,7 +263,7 @@ void func_808A2918(EnBoom* this, PlayState* play) { Math_Vec3f_Copy(&sp7C->world.pos, &player->actor.world.pos); if (sp7C->id == ACTOR_EN_ITEM00) { sp7C->gravity = -0.9f; - sp7C->bgCheckFlags &= ~3; + sp7C->bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); } else { sp7C->flags &= ~ACTOR_FLAG_2000; } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 33dd4f69f..4e6d3ae3a 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -265,7 +265,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->dyna.actor.flags |= ACTOR_FLAG_10; } else { if ((this->type == ENBOX_TYPE_BIG_INVISIBLE) || (this->type == ENBOX_TYPE_SMALL_INVISIBLE)) { - this->dyna.actor.flags |= ACTOR_FLAG_80; + this->dyna.actor.flags |= ACTOR_FLAG_REACT_TO_LENS; } EnBox_SetupAction(this, EnBox_WaitOpen); this->movementFlags |= ENBOX_MOVE_IMMOBILE; @@ -345,7 +345,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) { this->alpha = 255; this->movementFlags &= ~ENBOX_MOVE_IMMOBILE; - if (this->dyna.actor.bgCheckFlags & 1) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->movementFlags |= ENBOX_MOVE_UNUSED; if (this->movementFlags & ENBOX_MOVE_FALL_ANGLE_SIDE) { this->movementFlags &= ~ENBOX_MOVE_FALL_ANGLE_SIDE; @@ -374,7 +374,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) { } void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { - func_800B8C50(&this->dyna.actor, play); + Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (this->unk_1A0 >= 0) { EnBox_SetupAction(this, EnBox_Fall); func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); @@ -386,7 +386,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { } void EnBox_AppearSwitchFlag(EnBox* this, PlayState* play) { - func_800B8C50(&this->dyna.actor, play); + Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (Flags_GetSwitch(play, this->switchFlag)) { if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); @@ -399,7 +399,7 @@ void EnBox_AppearSwitchFlag(EnBox* this, PlayState* play) { } void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { - func_800B8C50(&this->dyna.actor, play); + Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (Flags_GetClearTemp(play, this->dyna.actor.room)) { if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); @@ -508,7 +508,7 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { if ((this->getItemId == GI_MASK_GIANT) && (INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT)) { this->getItemId = GI_RECOVERY_HEART; } - Actor_PickUpNearby(&this->dyna.actor, play, -this->getItemId); + Actor_OfferGetItemNearby(&this->dyna.actor, play, -this->getItemId); } if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { EnBox_SetupAction(this, EnBox_Open); @@ -519,7 +519,7 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { void EnBox_Open(EnBox* this, PlayState* play) { s32 pad; - this->dyna.actor.flags &= ~ACTOR_FLAG_80; + this->dyna.actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_1EC > 0) { @@ -698,7 +698,7 @@ void EnBox_Draw(Actor* thisx, PlayState* play) { } if (((this->alpha == 255) && (this->type != ENBOX_TYPE_BIG_INVISIBLE) && (this->type != ENBOX_TYPE_SMALL_INVISIBLE)) || - (!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_80) && + (!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_REACT_TO_LENS) && ((this->type == ENBOX_TYPE_BIG_INVISIBLE) || (this->type == ENBOX_TYPE_SMALL_INVISIBLE)))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index cbf9e9f3c..db6019b99 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -247,10 +247,10 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { this->velocityFromBounce.y = this->bounceDirection.y * bounceSpeed; this->velocityFromBounce.z = this->bounceDirection.z * bounceSpeed; this->yVelocity = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_AWA_BOUND); this->modelRotSpeed = 128.0f; this->modelEllipticity = 0.48f; - } else if ((this->actor.bgCheckFlags & 0x20) && (bounceDirection.y < 0.0f)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (bounceDirection.y < 0.0f)) { normal.x = normal.z = 0.0f; normal.y = 1.0f; EnBubble_Vec3fNormalizedReflect(&bounceDirection, &normal, &bounceDirection); @@ -266,7 +266,7 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { this->velocityFromBounce.y = (this->bounceDirection.y * bounceSpeed); this->velocityFromBounce.z = (this->bounceDirection.z * bounceSpeed); this->yVelocity = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_AWA_BOUND); this->modelRotSpeed = 128.0f; this->modelEllipticity = 0.48f; } diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index eb3365b83..05072da72 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -241,7 +241,7 @@ void func_8091C794(EnButte* this, PlayState* play) { s16 yaw; func_8091C524(this); - Math_SmoothStepToF(&this->actor.speedXZ, sp4C->unk_04, sp4C->unk_08, sp4C->unk_0C, 0.0f); + Math_SmoothStepToF(&this->actor.speed, sp4C->unk_04, sp4C->unk_08, sp4C->unk_0C, 0.0f); if (this->unk_24F == 1) { distSq = SQ(100.0f); @@ -276,9 +276,8 @@ void func_8091C794(EnButte* this, PlayState* play) { func_8091C6B4(this); - playSpeed = - (((this->actor.speedXZ * 0.5f) + (Rand_ZeroOne() * 0.2f)) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + - ((1.0f - Math_SinS(this->unk_256)) * 0.3f) + sp38; + playSpeed = (((this->actor.speed * 0.5f) + (Rand_ZeroOne() * 0.2f)) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + + ((1.0f - Math_SinS(this->unk_256)) * 0.3f) + sp38; this->skelAnime.playSpeed = CLAMP(playSpeed, 0.2f, 1.5f); SkelAnime_Update(&this->skelAnime); @@ -318,7 +317,7 @@ void func_8091CBB4(EnButte* this, PlayState* play) { s16 yaw; func_8091C5EC(this); - Math_SmoothStepToF(&this->actor.speedXZ, sp5C->unk_04, sp5C->unk_08, sp5C->unk_0C, 0.0f); + Math_SmoothStepToF(&this->actor.speed, sp5C->unk_04, sp5C->unk_08, sp5C->unk_0C, 0.0f); sp40 = 0.0f; if ((this->unk_24E != 0) && (this->unk_24C < 12)) { @@ -344,7 +343,7 @@ void func_8091CBB4(EnButte* this, PlayState* play) { func_8091C6B4(this); - playSpeed = ((this->actor.speedXZ * 0.5f) + (Rand_ZeroOne() * 0.2f) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + + playSpeed = ((this->actor.speed * 0.5f) + (Rand_ZeroOne() * 0.2f) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + ((1.0f - Math_SinS(this->unk_256)) * 0.3f) + sp40; this->skelAnime.playSpeed = CLAMP(playSpeed, 0.2f, 1.5f); SkelAnime_Update(&this->skelAnime); @@ -356,7 +355,7 @@ void func_8091CBB4(EnButte* this, PlayState* play) { distSq = Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, this->actor.home.pos.z); - if ((player->heldItemAction != PLAYER_IA_STICK) || !(fabsf(player->actor.speedXZ) < 1.8f) || (this->unk_252 > 0) || + if ((player->heldItemAction != PLAYER_IA_STICK) || !(fabsf(player->actor.speed) < 1.8f) || (this->unk_252 > 0) || !(distSq < SQ(320.0f))) { func_8091C748(this); } else if ((distSq > SQ(240.0f)) && diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index d32fe32ac..92030934f 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -84,12 +84,12 @@ void EnCha_Ring(EnCha* this, PlayState* play) { void EnCha_Idle(EnCha* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_60_04)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); + Actor_PlaySfx(&this->actor, NA_SE_EV_DOOR_BELL); CLEAR_WEEKEVENTREG(WEEKEVENTREG_60_04); this->actor.home.rot.z = 0x7D0; } if (this->collider.base.acFlags & AC_HIT) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DOOR_BELL); + Actor_PlaySfx(&this->actor, NA_SE_EV_DOOR_BELL); this->actor.home.rot.z = 0x7D0; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_51_04)) { SET_WEEKEVENTREG(WEEKEVENTREG_51_04); diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index bfc828194..e75d11bc6 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -468,7 +468,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { EnClearTag_CreateFlashEffect(this, &pos, sFlashMaxScale[thisx->params], this->actor.floorHeight); // Is not underwater - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if (thisx->params < 10) { pos.y = this->actor.world.pos.y - 40.0f; @@ -549,7 +549,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { player->actor.world.pos.z = -950.0f; } - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; if (this->activeTimer == 0) { this->cameraState = 1; } @@ -578,7 +578,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { player->actor.world.pos.z = -950.0f; } - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index b3038dd60..13ff0ce10 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -114,13 +114,13 @@ void func_80AFDD60(EnColMan* this) { } void func_80AFDE00(EnColMan* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.params == EN_COL_MAN_HEART_PIECE) { this->actor.params = EN_COL_MAN_RECOVERY_HEART; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actor.velocity.y = 8.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_02)) { @@ -131,9 +131,9 @@ void func_80AFDE00(EnColMan* this, PlayState* play) { this->actor.draw = NULL; this->actionFunc = EnColMan_SetHeartPieceCollectedAndKill; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_02)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 40.0f, 40.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 40.0f, 40.0f); } else { - Actor_PickUp(&this->actor, play, GI_RECOVERY_HEART, 40.0f, 40.0f); + Actor_OfferGetItem(&this->actor, play, GI_RECOVERY_HEART, 40.0f, 40.0f); } } @@ -161,13 +161,13 @@ void func_80AFDFB4(EnColMan* this, PlayState* play) { this->scale = (BREG(55) / 10000.0f) + 0.0015f; - if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) { if (!this->hasSetRandomValues) { this->actor.world.rot.y = randPlusMinusPoint5Scaled(30000.0f); - this->actor.speedXZ = 2.0f + BREG(56) + Rand_ZeroFloat(2.0f); + this->actor.speed = 2.0f + BREG(56) + Rand_ZeroFloat(2.0f); this->actor.velocity.y = 12.0f + BREG(57) + Rand_ZeroFloat(5.0f); this->hasSetRandomValues = true; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ANSATSUSYA_ROCK); + Actor_PlaySfx(&this->actor, NA_SE_EN_ANSATSUSYA_ROCK); return; } @@ -210,7 +210,7 @@ void func_80AFE25C(EnColMan* this, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 4e9040d83..1de5d137e 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -202,7 +202,7 @@ void EnCow_UpdateAnimation(EnCow* this, PlayState* play) { void EnCow_TalkEnd(EnCow* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnCow_Idle; } } @@ -219,26 +219,26 @@ void EnCow_GiveMilkWait(EnCow* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnCow_GiveMilkEnd; } else { - Actor_PickUp(&this->actor, play, GI_MILK, 10000.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } void EnCow_GiveMilk(EnCow* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnCow_GiveMilkWait; - Actor_PickUp(&this->actor, play, GI_MILK, 10000.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 10000.0f, 100.0f); } } void EnCow_CheckForEmptyBottle(EnCow* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { - func_80151938(play, 0x32C9); // Text to give milk. + Message_ContinueTextbox(play, 0x32C9); // Text to give milk. this->actionFunc = EnCow_GiveMilk; } else { - func_80151938(play, 0x32CA); // Text if you don't have an empty bottle. + Message_ContinueTextbox(play, 0x32CA); // Text if you don't have an empty bottle. this->actionFunc = EnCow_TalkEnd; } } @@ -344,7 +344,7 @@ void EnCow_Update(Actor* thisx, PlayState* play2) { if (SkelAnime_Update(&this->skelAnime)) { if (this->skelAnime.animation == &gCowChewAnim) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_COW_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_COW_CRY); Animation_Change(&this->skelAnime, &gCowMooAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCowMooAnim), ANIMMODE_ONCE, 1.0f); } else { diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index b9e1071fe..2bbee66d5 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -163,36 +163,36 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); onInitialAnimFrame = Animation_OnFrame(&this->skelAnime, 0.0f); - this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 3.0f; + this->actor.speed = (Rand_ZeroOne() * 1.5f) + 3.0f; if ((this->actor.parent != NULL) && (this->actor.parent->home.rot.z == 0)) { this->actor.home.pos.x = this->actor.parent->world.pos.x; this->actor.home.pos.z = this->actor.parent->world.pos.z; - dist = Actor_XZDistanceToPoint(&this->actor, &this->actor.parent->world.pos); + dist = Actor_WorldDistXZToPoint(&this->actor, &this->actor.parent->world.pos); } else { dist = 450.0f; this->actor.flags |= ACTOR_FLAG_1; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->yawTarget = this->actor.wallYaw; - } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { - this->yawTarget = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { + this->yawTarget = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->yawTarget, 5, 0x300, 0x10) == 0) && onInitialAnimFrame && (Rand_ZeroOne() < 0.1f)) { - yaw = (Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y); + yaw = (Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y); if (yaw > 0) { this->yawTarget += Rand_S16Offset(0x1000, 0x1000); } else { this->yawTarget -= Rand_S16Offset(0x1000, 0x1000); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } - if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->pitchTarget = -0x1000; } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 50.0f)) { this->pitchTarget = -Rand_S16Offset(0x800, 0x800); @@ -211,7 +211,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { this->pitchTarget = CLAMP(this->pitchTarget, -0x1000, 0x1000); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x100, 0x400); } @@ -233,7 +233,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { void EnCrow_SetupDiveAttack(EnCrow* this) { this->timer = 300; this->actionFunc = EnCrow_DiveAttack; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->skelAnime.playSpeed = 2.0f; } @@ -258,27 +258,28 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { } targetPos.x = this->actor.child->world.pos.x; targetPos.z = this->actor.child->world.pos.z; - pitchTarget = Actor_PitchToPoint(&this->actor, &targetPos); + pitchTarget = Actor_WorldPitchTowardPoint(&this->actor, &targetPos); pitchTarget = CLAMP(pitchTarget, -0x3000, 0x3000); Math_SmoothStepToS(&this->actor.shape.rot.x, pitchTarget, 2, 0x400, 0x40); } else { Math_SmoothStepToS(&this->actor.shape.rot.x, -0x800, 2, 0x100, 0x10); } - if (isFacingActor || (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) > 80.0f)) { - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->actor.child), 4, 0xC00, - 0xC0); + if (isFacingActor || (Actor_WorldDistXZToActor(&this->actor, this->actor.child) > 80.0f)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, this->actor.child), 4, + 0xC00, 0xC0); } if (((this->timer == 0) || ((&player->actor != this->actor.child) && (this->actor.child->home.rot.z != 0)) || ((&player->actor == this->actor.child) && ((Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags1 & PLAYER_STATE1_800000))) || - ((this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9))) || + ((this->collider.base.atFlags & AT_HIT) || + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)))) || (this->actor.depthInWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_ATTACK); } EnCrow_SetupFlyIdle(this); } @@ -295,15 +296,15 @@ void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play) { void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { f32 scale; - this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); + this->actor.speed *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gGuayFlyAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); this->actor.shape.yOffset = 0.0f; this->actor.targetArrowOffset = 0.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; scale = (this->actor.scale.x * 100.0f); this->actor.world.pos.y += 20.0f * scale; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_DEAD); if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_ICE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; @@ -323,9 +324,9 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { this->drawDmgEffFrozenSteamScale = 0.5f; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); if (this->actor.flags & ACTOR_FLAG_8000) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->collider.base.acFlags &= ~AC_ON; @@ -335,7 +336,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { } void EnCrow_Damaged(EnCrow* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; if (!(this->actor.flags & ACTOR_FLAG_8000)) { @@ -343,7 +344,7 @@ void EnCrow_Damaged(EnCrow* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { EnCrow_CheckIfFrozen(this, play); func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, this->actor.scale.x * 10000.0f, 0, 0); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); @@ -385,22 +386,22 @@ void EnCrow_Die(EnCrow* this, PlayState* play) { void EnCrow_SetupTurnAway(EnCrow* this) { this->timer = 100; this->pitchTarget = -0x1000; - this->actor.speedXZ = 3.5f; + this->actor.speed = 3.5f; this->yawTarget = this->actor.yawTowardsPlayer + 0x8000; this->skelAnime.playSpeed = 2.0f; if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_STUN) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); } else { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = EnCrow_TurnAway; } void EnCrow_TurnAway(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->yawTarget = this->actor.wallYaw; } else { this->yawTarget = this->actor.yawTowardsPlayer + 0x8000; @@ -528,7 +529,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, height); if ((this->actor.colChkInfo.health != 0) && (Animation_OnFrame(&this->skelAnime, 3.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } if (this->drawDmgEffAlpha > 0.0f) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 2f2496f57..fbd829212 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -291,7 +291,7 @@ s32 func_80B3E96C(EnDai* this, PlayState* play) { break; case 1: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SNOWSTORM_HARD); + Actor_PlaySfx(&this->actor, NA_SE_EV_SNOWSTORM_HARD); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WEATHER_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0x1388, 0x708, 0x3E8, 0); func_80B3E5DC(this, 3); @@ -351,8 +351,8 @@ s32 func_80B3EC84(EnDai* this) { }; static Vec3f D_80B3FD7C[] = { - { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8, 0.8 }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, - { 1.0f, 0.8, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8, 0.9f }, { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8f, 0.8f }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, + { 1.0f, 0.8f, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8f, 0.9f }, { 1.0f, 1.0f, 1.0f }, }; s32 i; @@ -379,7 +379,10 @@ s32 func_80B3ED88(EnDai* this) { static s16 D_80B3FE00[] = { 1, 2, 3 }; static Vec3f D_80B3FE08[] = { - 1.0f, 1.0f, 1.0f, 1.0f, 1.2f, 1.2f, 1.0f, 0.7f, 0.8f, 1.0f, 1.0f, 1.0f, + { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.2f, 1.2f }, + { 1.0f, 0.7f, 0.8f }, + { 1.0f, 1.0f, 1.0f }, }; s32 i; @@ -456,7 +459,7 @@ void func_80B3F044(EnDai* this, PlayState* play) { break; case 2: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROLL_AND_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_ROLL_AND_FALL); break; case 3: @@ -479,27 +482,27 @@ void func_80B3F044(EnDai* this, PlayState* play) { case 2: if (play->csCtx.frames == 360) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIGOLON_SLEEP3 - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIGOLON_SLEEP3 - SFX_FLAG); } if (Animation_OnFrame(&this->skelAnime, 43.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_BOUND_1); } this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); break; case 3: if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIGOLON_SLEEP1); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIGOLON_SLEEP1); } this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); break; case 4: if (Animation_OnFrame(&this->skelAnime, 30.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIGOLON_SLEEP2); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIGOLON_SLEEP2); } if (Animation_OnFrame(&this->skelAnime, 35.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_BOUND_0); } this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); break; @@ -642,7 +645,7 @@ void func_80B3F78C(EnDai* this, PlayState* play) { if (play->actorCtx.lensActorsDrawn) { this->unk_1CE |= 0x40; } else { - Actor_RecordUndrawnActor(play, &this->actor); + Actor_AddToLensActors(play, &this->actor); this->unk_1CE &= ~0x40; } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 263b22ada..b68634f81 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -87,7 +87,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { this->collider.dim.radius = 30; this->collider.dim.height = 60; this->collider.dim.yShift = 0; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_80) || ((gSaveContext.save.day == 3) && gSaveContext.save.isNight)) { Actor_Kill(&this->actor); } @@ -244,7 +244,7 @@ void func_80943BDC(EnDaiku* this, PlayState* play) { } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80943820(this); } } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index fa161e9fd..4a3c9b444 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -7,8 +7,8 @@ struct EnDaiku; typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); -#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF); -#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { /* 0x0 */ ENDAIKU_PARAMS_FF_0, diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 0e5e7a3ea..e93cf4493 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -234,7 +234,7 @@ void func_80BE66E4(EnDaiku2* this, PlayState* play) { func_800B8614(&this->actor, play, 80.0f); if ((this->unk_276 == 8) && Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROCK_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ROCK_BROKEN); for (i = 0; i < 10; i++) { Math_Vec3f_Copy(&sp70, &this->actor.world.pos); @@ -297,7 +297,7 @@ void func_80BE6BC0(EnDaiku2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { s32 day = gSaveContext.save.day - 1; - func_801477B4(play); + Message_CloseTextbox(play); if (this->unk_288 == 2) { this->actionFunc = func_80BE6D40; @@ -305,7 +305,7 @@ void func_80BE6BC0(EnDaiku2* this, PlayState* play) { this->actionFunc = func_80BE6EF0; } else if ((this->unk_28A == 0) || (this->unk_28A == 2)) { this->unk_28A++; - func_80151938(play, sTextIds[this->unk_28A]); + Message_ContinueTextbox(play, sTextIds[this->unk_28A]); } else { switch (day) { case 0: diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index f13b89611..130a06a23 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -7,9 +7,9 @@ struct EnDaiku2; typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); -#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F); -#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F); -#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1); +#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F) +#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F) +#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1) enum { /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 93d495267..d38f23224 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -5,6 +5,8 @@ */ #include "z_en_dekubaba.h" +#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_400) @@ -15,23 +17,31 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play); void EnDekubaba_Update(Actor* thisx, PlayState* play); void EnDekubaba_Draw(Actor* thisx, PlayState* play); -void func_808B1B14(EnDekubaba* this, PlayState* play); -void func_808B1CF0(EnDekubaba* this, PlayState* play); -void func_808B2240(EnDekubaba* this, PlayState* play); -void func_808B2660(EnDekubaba* this, PlayState* play); -void func_808B28B4(EnDekubaba* this, PlayState* play); -void func_808B29C4(EnDekubaba* this, PlayState* play); -void func_808B2CB8(EnDekubaba* this, PlayState* play); -void func_808B3078(EnDekubaba* this, PlayState* play); -void func_808B3280(EnDekubaba* this, PlayState* play); -void func_808B3404(EnDekubaba* this, PlayState* play); -void func_808B37E8(EnDekubaba* this, PlayState* play); -void func_808B3B48(EnDekubaba* this, PlayState* play); -void func_808B3C50(EnDekubaba* this, PlayState* play); -void func_808B3DA8(EnDekubaba* this, PlayState* play); -void func_808B3EE8(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupWait(EnDekubaba* this); +void EnDekubaba_Wait(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupGrow(EnDekubaba* this); +void EnDekubaba_Grow(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupRetract(EnDekubaba* this); +void EnDekubaba_Retract(EnDekubaba* this, PlayState* play); +void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupPrepareLunge(EnDekubaba* this); +void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupLunge(EnDekubaba* this); +void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupPullBack(EnDekubaba* this); +void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play); +void EnDekubaba_Recover(EnDekubaba* this, PlayState* play); +void EnDekubaba_Hit(EnDekubaba* this, PlayState* play); +void EnDekubaba_PrunedSomersaultDie(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupShrinkDie(EnDekubaba* this); +void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupStunnedVertical(EnDekubaba* this); +void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play); +void EnDekubaba_Sway(EnDekubaba* this, PlayState* play); +void EnDekubaba_Frozen(EnDekubaba* this, PlayState* play); +void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, PlayState* play); +void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play); -#if 0 ActorInit En_Dekubaba_InitVars = { ACTOR_EN_DEKUBABA, ACTORCAT_ENEMY, @@ -44,188 +54,1333 @@ ActorInit En_Dekubaba_InitVars = { (ActorFunc)EnDekubaba_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[7] = { -static ColliderJntSphElementInit D_808B4D60[7] = { +static ColliderJntSphElementInit sJntSphElementsInit[7] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x08 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_HARD, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 100, 1000 }, 15 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 51, { { 0, 0, 1500 }, 8 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 52, { { 0, 0, 500 }, 8 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 53, { { 0, 0, 1500 }, 8 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 54, { { 0, 0, 500 }, 8 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 55, { { 0, 0, 1500 }, 8 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 56, { { 0, 0, 500 }, 8 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_808B4E5C = { - { COLTYPE_HIT6, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_808B4D60, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT6, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_808B4E6C = { 2, 25, 25, MASS_IMMOVABLE }; +static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 25, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_808B4E74 = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(3, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0xF), - /* Normal arrow */ DMG_ENTRY(3, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xD), - /* Goron punch */ DMG_ENTRY(2, 0x0), - /* Sword */ DMG_ENTRY(1, 0xF), - /* Goron pound */ DMG_ENTRY(4, 0x0), - /* Fire arrow */ DMG_ENTRY(1, 0x2), - /* Ice arrow */ DMG_ENTRY(3, 0x3), - /* Light arrow */ DMG_ENTRY(3, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0xF), - /* Deku bubble */ DMG_ENTRY(3, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0xF), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), +typedef enum { + /* 0x0 */ DEKUBABA_DMGEFF_NONE, + /* 0x1 */ DEKUBABA_DMGEFF_NUT, + /* 0x2 */ DEKUBABA_DMGEFF_FIRE, + /* 0x3 */ DEKUBABA_DMGEFF_ICE, + /* 0x4 */ DEKUBABA_DMGEFF_LIGHT, + /* 0x5 */ DEKUBABA_DMGEFF_ELECTRIC, + /* 0xD */ DEKUBABA_DMGEFF_HOOKSHOT = 0xD, + /* 0xF */ DEKUBABA_DMGEFF_CUT = 0xF +} DekuBabaDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NUT), + /* Deku Stick */ DMG_ENTRY(3, DEKUBABA_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, DEKUBABA_DMGEFF_CUT), + /* Normal arrow */ DMG_ENTRY(3, DEKUBABA_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(0, DEKUBABA_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(2, DEKUBABA_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, DEKUBABA_DMGEFF_CUT), + /* Goron pound */ DMG_ENTRY(4, DEKUBABA_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(1, DEKUBABA_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(3, DEKUBABA_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(3, DEKUBABA_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, DEKUBABA_DMGEFF_CUT), + /* Deku bubble */ DMG_ENTRY(3, DEKUBABA_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, DEKUBABA_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NUT), + /* Zora barrier */ DMG_ENTRY(0, DEKUBABA_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, DEKUBABA_DMGEFF_CUT), + /* Sword beam */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DEKUBABA_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, DEKUBABA_DMGEFF_NONE), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_808B4E94[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_STOP), }; -#endif +void EnDekubaba_Init(Actor* thisx, PlayState* play) { + EnDekubaba* this = THIS; + s32 i; -extern ColliderJntSphElementInit D_808B4D60[7]; -extern ColliderJntSphInit D_808B4E5C; -extern CollisionCheckInfoInit D_808B4E6C; -extern DamageTable D_808B4E74; -extern InitChainEntry D_808B4E94[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); + SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, + DEKUBABA_LIMB_MAX); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); -extern UNK_TYPE D_06000208; -extern UNK_TYPE D_060002B8; -extern UNK_TYPE D_060010F0; -extern UNK_TYPE D_06001330; -extern UNK_TYPE D_06001828; + if (this->actor.params == DEKUBABA_BIG) { + this->size = 2.5f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/EnDekubaba_Init.s") + for (i = 0; i < sJntSphInit.count; i++) { + this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius = + (sJntSphElementsInit[i].dim.modelSphere.radius * 2.50f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/EnDekubaba_Destroy.s") + this->actor.colChkInfo.health = 4; + // Big Deku Baba hint does not exist in MM + this->actor.hintId = TATL_HINT_ID_BIO_DEKU_BABA; + this->actor.targetMode = 2; + } else { + this->size = 1.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1530.s") + for (i = 0; i < sJntSphInit.count; i++) { + this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; + } + this->actor.hintId = TATL_HINT_ID_DEKU_BABA; + this->actor.targetMode = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B15B8.s") + EnDekubaba_SetupWait(this); + this->timer = 0; + this->boundFloor = NULL; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B16BC.s") +void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { + EnDekubaba* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1798.s") + Collider_DestroyJntSph(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1814.s") +void EnDekubaba_DisableHitboxes(EnDekubaba* this) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B18A8.s") + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { + this->collider.elements[i].info.bumperFlags &= ~BUMP_ON; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1B14.s") +void EnDekubaba_UpdateHeadPosition(EnDekubaba* this) { + f32 horizontalHeadShift = (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1]) + + Math_CosS(this->stemSectionAngle[2])) * + 20.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1BC0.s") + this->actor.world.pos.x = + this->actor.home.pos.x + Math_SinS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); + this->actor.world.pos.y = + this->actor.home.pos.y - (Math_SinS(this->stemSectionAngle[0]) + Math_SinS(this->stemSectionAngle[1]) + + Math_SinS(this->stemSectionAngle[2])) * + 20.0f * this->size; + this->actor.world.pos.z = + this->actor.home.pos.z + Math_CosS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B1CF0.s") +void EnDekubaba_SetFireLightEffects(EnDekubaba* this, PlayState* play, s32 index) { + ColliderJntSphElement* sphElement; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2158.s") + if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_FIRE) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->drawDmgEffScale = 0.75f; + this->drawDmgEffAlpha = 4.0f; + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_LIGHT) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + this->drawDmgEffScale = 0.75f; + this->drawDmgEffAlpha = 4.0f; + sphElement = &this->collider.elements[index]; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sphElement->info.bumper.hitPos.x, + sphElement->info.bumper.hitPos.y, sphElement->info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_SMALL_LIGHT_RAYS); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2240.s") +void EnDekubaba_SetFrozenEffects(EnDekubaba* this) { + this->drawDmgEffScale = 0.75f; + this->drawDmgEffFrozenSteamScale = 1.125f; + this->drawDmgEffAlpha = 1.0f; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->collider.base.colType = COLTYPE_HIT3; + this->timer = 80; + this->actor.flags &= ~ACTOR_FLAG_400; + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2608.s") +void EnDekubaba_SpawnIceEffects(EnDekubaba* this, PlayState* play) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->collider.base.colType = COLTYPE_HIT6; + this->drawDmgEffAlpha = 0.0f; + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 4, + this->size * 0.3f, this->size * 0.2f); + this->actor.flags |= ACTOR_FLAG_400; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2660.s") +void EnDekubaba_SetupWait(EnDekubaba* this) { + s32 i; + ColliderJntSphElement* element; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2890.s") + this->actor.shape.rot.x = -0x4000; + this->stemSectionAngle[0] = this->stemSectionAngle[1] = this->stemSectionAngle[2] = this->actor.shape.rot.x; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B28B4.s") + this->actor.world.pos.x = this->actor.home.pos.x; + this->actor.world.pos.z = this->actor.home.pos.z; + this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2980.s") + Actor_SetScale(&this->actor, this->size * 0.01f * 0.5f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B29C4.s") + this->collider.base.colType = COLTYPE_HARD; + this->collider.base.acFlags |= AC_HARD; + this->timer = 45; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2C40.s") + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { + element = &this->collider.elements[i]; + element->dim.worldSphere.center.x = this->actor.world.pos.x; + element->dim.worldSphere.center.y = (s32)this->actor.world.pos.y - 7; + element->dim.worldSphere.center.z = this->actor.world.pos.z; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B2CB8.s") + this->actionFunc = EnDekubaba_Wait; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3044.s") +void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3078.s") + this->actor.world.pos.x = this->actor.home.pos.x; + this->actor.world.pos.z = this->actor.home.pos.z; + this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3170.s") + if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f * this->size) && + (fabsf(this->actor.playerHeightRel) < 30.0f * this->size)) { + EnDekubaba_SetupGrow(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3280.s") +void EnDekubaba_SetupGrow(EnDekubaba* this) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3390.s") + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, + Animation_GetLastFrame(&gDekuBabaFastChompAnim) * (1.0f / 15), 0.0f, + Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_ONCE, 0.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3404.s") + this->timer = 15; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3768.s") + for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { + this->collider.elements[i].info.ocElemFlags |= OCELEM_ON; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B37E8.s") + this->collider.base.colType = COLTYPE_HIT6; + this->collider.base.acFlags &= ~AC_HARD; + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_WAKEUP); + this->actionFunc = EnDekubaba_Grow; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B39AC.s") +void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 headDistHorizontal; + f32 headDistVertical; + f32 headShiftX; + f32 headShiftZ; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3B48.s") + if (this->timer != 0) { + this->timer--; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3BE4.s") + SkelAnime_Update(&this->skelAnime); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3C50.s") + this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = + this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f); + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3D74.s") + headDistVertical = sin_rad(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3DA8.s") + if (this->actor.shape.rot.x < -0x38E3) { + headDistHorizontal = 0.0f; + } else if (this->actor.shape.rot.x < -0x238E) { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x38E); + headDistHorizontal = Math_CosS(this->stemSectionAngle[0]) * 20.0f; + } else if (this->actor.shape.rot.x < -0xE38) { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x5555, 0x38E); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5555, 0x222); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3E40.s") + headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + + (headDistVertical - + 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * + Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + } else { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x31C7, 0x222); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5555, 0x222); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3EE8.s") + headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + + (headDistVertical - + 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * + Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B3F50.s") + if (this->timer < 10) { + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, + 0xE38); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/EnDekubaba_Update.s") + this->actor.world.pos.y = this->actor.home.pos.y + (headDistVertical * this->size); + //! FAKE: + headShiftX = headDistHorizontal; + headShiftX = headShiftX * this->size * Math_SinS(this->actor.shape.rot.y); + headShiftZ = headDistHorizontal; + headShiftZ = headShiftZ * this->size * Math_CosS(this->actor.shape.rot.y); + this->actor.world.pos.x = this->actor.home.pos.x + headShiftX; + this->actor.world.pos.z = this->actor.home.pos.z + headShiftZ; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B4548.s") + 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); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B465C.s") + if (this->timer == 0) { + if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 240.0f * this->size) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupRetract(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B48FC.s") +void EnDekubaba_SetupRetract(EnDekubaba* this) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B49C8.s") + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -1.5f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), + 0.0f, ANIMMODE_ONCE, -3.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/func_808B4ABC.s") + this->timer = 15; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dekubaba/EnDekubaba_Draw.s") + for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { + this->collider.elements[i].info.ocElemFlags &= ~OCELEM_ON; + } + + this->actionFunc = EnDekubaba_Retract; +} + +void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { + f32 headDistHorizontal; + f32 headDistVertical; + f32 xShift; + f32 zShift; + + if (this->timer != 0) { + this->timer--; + } + + SkelAnime_Update(&this->skelAnime); + + this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = + this->size * 0.01f * (0.5f + this->timer * (1.0f / 30)); + Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); + + headDistVertical = (sin_rad(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; + + if (this->actor.shape.rot.x < -0x38E3) { + headDistHorizontal = 0.0f; + } else if (this->actor.shape.rot.x < -0x238E) { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0x4000, 0x555); + headDistHorizontal = Math_CosS(this->stemSectionAngle[0]) * 20.0f; + } else if (this->actor.shape.rot.x < -0xE38) { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4000, 0x555); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0x333); + + headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + + (headDistVertical - + 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * + Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + } else { + Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x5555, 0x333); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0x333); + + headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + + (headDistVertical - + 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * + Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + } + + this->actor.world.pos.y = this->actor.home.pos.y + (headDistVertical * this->size); + xShift = headDistHorizontal * this->size * Math_SinS(this->actor.shape.rot.y); + zShift = headDistHorizontal * this->size * Math_CosS(this->actor.shape.rot.y); + this->actor.world.pos.x = this->actor.home.pos.x + xShift; + this->actor.world.pos.z = this->actor.home.pos.z + zShift; + + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, + 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + if (this->timer == 0) { + EnDekubaba_SetupWait(this); + } +} + +void EnDekubaba_SetupDecideLunge(EnDekubaba* this) { + this->timer = Animation_GetLastFrame(&gDekuBabaFastChompAnim) * 2; + Animation_MorphToLoop(&this->skelAnime, &gDekuBabaFastChompAnim, -3.0f); + this->actionFunc = EnDekubaba_DecideLunge; +} + +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)) { + if (this->actor.params == DEKUBABA_BIG) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); + } + } + + if (this->timer != 0) { + this->timer--; + } + + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, + (this->timer % 5) * 0x222); + + if (this->timer < 10) { + this->stemSectionAngle[0] += 0x16C; + this->stemSectionAngle[1] += 0x16C; + this->stemSectionAngle[2] += 0xB6; + this->actor.shape.rot.x += 0x222; + } else if (this->timer < 20) { + this->stemSectionAngle[0] -= 0x16C; + this->stemSectionAngle[1] += 0x111; + this->actor.shape.rot.x += 0x16C; + } else if (this->timer < 30) { + this->stemSectionAngle[1] -= 0x111; + this->actor.shape.rot.x -= 0xB6; + } else { + this->stemSectionAngle[1] -= 0xB6; + this->stemSectionAngle[2] += 0xB6; + this->actor.shape.rot.x -= 0x16C; + } + + EnDekubaba_UpdateHeadPosition(this); + + if ((240.0f * this->size) < Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos)) { + EnDekubaba_SetupRetract(this); + } else if ((this->timer == 0) || (this->actor.xzDistToPlayer < (80.0f * this->size))) { + EnDekubaba_SetupPrepareLunge(this); + } +} + +void EnDekubaba_SetupPrepareLunge(EnDekubaba* this) { + this->timer = 8; + this->skelAnime.playSpeed = 0.0f; + this->actionFunc = EnDekubaba_PrepareLunge; +} + +void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + if (this->timer != 0) { + this->timer--; + } + + Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 2, 0xE38, 0x71C); + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, 0xE38); + Math_ScaledStepToS(this->stemSectionAngle, 0xAAA, 0x444); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4718, 0x888); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x6AA4, 0x888); + + if (this->timer == 0) { + EnDekubaba_SetupLunge(this); + } + + EnDekubaba_UpdateHeadPosition(this); +} + +void EnDekubaba_SetupLunge(EnDekubaba* this) { + Animation_PlayOnce(&this->skelAnime, &gDekuBabaPauseChompAnim); + this->timer = 0; + this->actionFunc = EnDekubaba_Lunge; +} + +void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play) { + static Color_RGBA8 sDustPrimColor = { 105, 255, 105, 255 }; + static Color_RGBA8 sDustEnvColor = { 150, 250, 150, 0 }; + s32 allStepsDone; + s16 curFrame10; + Vec3f velocity; + + SkelAnime_Update(&this->skelAnime); + + if (this->timer == 0) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { + if (this->actor.params == DEKUBABA_BIG) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_ATTACK); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA1_ATTACK); + } + } + + Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x222); + + curFrame10 = (s32)(this->skelAnime.curFrame * 10.0f); + + allStepsDone = true; + allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[0], -0xE38, curFrame10 + 0x38E); + allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[1], -0xE38, curFrame10 + 0x71C); + allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[2], -0xE38, curFrame10 + 0xE38); + if (allStepsDone) { + Animation_PlayLoopSetSpeed(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f); + velocity.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; + velocity.y = 0.0f; + velocity.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; + func_800B0DE0(play, &this->actor.world.pos, &velocity, &gZeroVec3f, &sDustPrimColor, &sDustEnvColor, 1, + (s32)(this->size * 100.0f)); + this->timer = 1; + } + } else if (this->timer > 10) { + EnDekubaba_SetupPullBack(this); + } else { + this->timer++; + + if ((this->timer >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { + Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xF, 0x71C); + } + + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { + if (this->actor.params == DEKUBABA_BIG) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); + } + } + } + + EnDekubaba_UpdateHeadPosition(this); +} + +void EnDekubaba_SetupPullBack(EnDekubaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaPauseChompAnim, 1.0f, 15.0f, + Animation_GetLastFrame(&gDekuBabaPauseChompAnim), ANIMMODE_ONCE, -3.0f); + this->timer = 0; + this->actionFunc = EnDekubaba_PullBack; +} + +void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play) { + Vec3f dustPos; + f32 xIncr; + f32 zIncr; + s32 i; + + SkelAnime_Update(&this->skelAnime); + + if (this->timer == 0) { + Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x38E); + Math_ScaledStepToS(&this->stemSectionAngle[0], -0x888, 0x16C); + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x888, 0x16C); + + if (Math_ScaledStepToS(&this->stemSectionAngle[2], -0x888, 0x16C)) { + xIncr = Math_SinS(this->actor.shape.rot.y) * 30.0f * this->size; + zIncr = Math_CosS(this->actor.shape.rot.y) * 30.0f * this->size; + dustPos = this->actor.home.pos; + + for (i = 0; i < 3; i++) { + func_800B1210(play, &dustPos, &gZeroVec3f, &gZeroVec3f, (s32)(this->size * 500.0f), + (s32)(this->size * 50.0f)); + dustPos.x += xIncr; + dustPos.z += zIncr; + } + + this->timer = 1; + } + } else if (this->timer == 11) { + Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x200); + Math_ScaledStepToS(this->stemSectionAngle, -0xAAA, 0x200); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x200); + + if (Math_ScaledStepToS(&this->stemSectionAngle[1], 0x238C, 0x200)) { + this->timer = 12; + } + } else if (this->timer == 18) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x2AA8, 0xAAA); + + if (Math_ScaledStepToS(&this->stemSectionAngle[0], 0x1554, 0x5B0)) { + this->timer = 25; + } + + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x38E3, 0xAAA); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x2D8); + } else if (this->timer == 25) { + Math_ScaledStepToS(&this->actor.shape.rot.x, -0x5550, 0xAAA); + + if (Math_ScaledStepToS(&this->stemSectionAngle[0], -0x6388, 0x93E)) { + this->timer = 26; + } + + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x3FFC, 0x4FA); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x238C, 0x444); + } else if (this->timer == 26) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x93E); + + if (Math_ScaledStepToS(&this->stemSectionAngle[0], -0x1555, 0x71C)) { + this->timer = 27; + } + + Math_ScaledStepToS(&this->stemSectionAngle[1], -0x38E3, 0x2D8); + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x5B0); + } else if (this->timer >= 27) { + this->timer++; + if (this->timer > 30) { + if (this->actor.xzDistToPlayer < (80.0f * this->size)) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupDecideLunge(this); + } + } + } else { + this->timer++; + if (this->timer == 10) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_SCRAPE); + } + + if (this->timer >= 12) { + Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x88); + } + } + + EnDekubaba_UpdateHeadPosition(this); +} + +void EnDekubaba_SetupRecover(EnDekubaba* this) { + this->timer = 9; + this->collider.base.acFlags |= AC_ON; + this->skelAnime.playSpeed = -1.0f; + this->actionFunc = EnDekubaba_Recover; +} + +void EnDekubaba_Recover(EnDekubaba* this, PlayState* play) { + s32 anyStepsDone; + + SkelAnime_Update(&this->skelAnime); + + if (this->timer > 8) { + anyStepsDone = Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); + anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[0], -0x1555, 1, 0xAAA, 0x71C); + anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[1], -0x38E3, 1, 0xE38, 0x71C); + anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[2], -0x5C71, 1, 0x11C6, 0x71C); + if (!anyStepsDone) { + this->timer = 8; + } + } else { + if (this->timer != 0) { + this->timer--; + } + + if (this->timer == 0) { + EnDekubaba_SetupDecideLunge(this); + } + } + + EnDekubaba_UpdateHeadPosition(this); +} + +typedef enum { + /* 0 */ DEKUBABA_HIT_NO_STUN, + /* 1 */ DEKUBABA_HIT_STUN_OTHER, + /* 2 */ DEKUBABA_HIT_STUN_NUT, + /* 3 */ DEKUBABA_HIT_STUN_ELECTRIC +} DekuBabaHitType; + +void EnDekubaba_SetupHit(EnDekubaba* this, s32 hitType) { + Animation_MorphToPlayOnce(&this->skelAnime, &gDekuBabaPauseChompAnim, -5.0f); + this->timer = hitType; + this->collider.base.acFlags &= ~AC_ON; + Actor_SetScale(&this->actor, this->size * 0.01f); + + if (hitType == DEKUBABA_HIT_STUN_NUT) { + Actor_SetColorFilter(&this->actor, 0, 155, 0, 42); + } else if (hitType == DEKUBABA_HIT_STUN_ELECTRIC) { + Actor_SetColorFilter(&this->actor, 0, 155, 0, 42); + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; + this->drawDmgEffScale = 0.75f; + this->drawDmgEffAlpha = 2.0f; + } else { + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 42); + } + this->actionFunc = EnDekubaba_Hit; +} + +/** + * Hit by a weapon or hit something when lunging. + */ +void EnDekubaba_Hit(EnDekubaba* this, PlayState* play) { + s32 allStepsDone; + + SkelAnime_Update(&this->skelAnime); + allStepsDone = true; + allStepsDone &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); + allStepsDone &= Math_ScaledStepToS(this->stemSectionAngle, -0x4000, 0xE38); + allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4000, 0xE38); + allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0xE38); + if (allStepsDone) { + if (this->actor.colChkInfo.health == 0) { + EnDekubaba_SetupShrinkDie(this); + } else { + this->collider.base.acFlags |= AC_ON; + + if (this->timer == DEKUBABA_HIT_NO_STUN) { + if (this->actor.xzDistToPlayer < (80.0f * this->size)) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupRecover(this); + } + } else { + EnDekubaba_SetupStunnedVertical(this); + } + } + } + + EnDekubaba_UpdateHeadPosition(this); +} + +void EnDekubaba_SetupPrunedSomersaultDie(EnDekubaba* this) { + this->timer = 0; + this->skelAnime.playSpeed = 0.0f; + this->actor.gravity = -0.8f; + this->actor.velocity.y = 4.0f; + this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; + this->actor.speed = this->size * 3.0f; + this->collider.base.acFlags &= ~AC_ON; + this->actor.flags |= ACTOR_FLAG_10 | ACTOR_FLAG_20; + this->actionFunc = EnDekubaba_PrunedSomersaultDie; +} + +void EnDekubaba_PrunedSomersaultDie(EnDekubaba* this, PlayState* play) { + s32 i; + Vec3f dustPos; + f32 deltaX; + f32 deltaY; + f32 deltaZ; + + Math_StepToF(&this->actor.speed, 0.0f, this->size * 0.1f); + + if (this->timer == 0) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); + Math_ScaledStepToS(this->stemSectionAngle, 0x4800, 0x71C); + Math_ScaledStepToS(&this->stemSectionAngle[1], 0x4800, 0x71C); + + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, (s32)(this->size * 12.0f), + (s32)(this->size * 5.0f), 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + + if ((this->actor.scale.x > 0.005f) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { + this->actor.scale.z = 0.0f; + this->actor.scale.y = 0.0f; + this->actor.scale.x = 0.0f; + this->actor.speed = 0.0f; + this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, (s32)(this->size * 12.0f), + (s32)(this->size * 5.0f), 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + } + + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + this->timer = 1; + } + } else if (this->timer == 1) { + dustPos = this->actor.world.pos; + + deltaY = 20.0f * Math_SinS(this->actor.shape.rot.x); + deltaX = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y); + deltaZ = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); + + for (i = 0; i < 4; i++) { + func_800B1210(play, &dustPos, &gZeroVec3f, &gZeroVec3f, 500, 50); + dustPos.x += deltaX; + dustPos.y += deltaY; + dustPos.z += deltaZ; + } + + func_800B1210(play, &this->actor.home.pos, &gZeroVec3f, &gZeroVec3f, (s32)(this->size * 500.0f), + (s32)(this->size * 100.0f)); + EnDekubaba_SetupDeadStickDrop(this, play); + } +} + +void EnDekubaba_SetupShrinkDie(EnDekubaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -1.5f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), + 0.0f, ANIMMODE_ONCE, -3.0f); + this->collider.base.acFlags &= ~AC_ON; + this->actionFunc = EnDekubaba_ShrinkDie; +} + +/** + * Die and drop Deku Nuts (Deku Stick drop is handled elsewhere). + */ +void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play) { + Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->size * 5.0f); + + if (Math_StepToF(&this->actor.scale.x, this->size * 0.1f * 0.01f, this->size * 0.1f * 0.01f)) { + func_800B1210(play, &this->actor.home.pos, &gZeroVec3f, &gZeroVec3f, (s32)(this->size * 500.0f), + (s32)(this->size * 100.0f)); + + if (!this->actor.dropFlag) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + if (this->actor.params == DEKUBABA_BIG) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); + } + } else { + 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(play, &this->actor.home.pos, this->size * 3.0f, 0, (s32)(this->size * 12.0f), + (s32)(this->size * 5.0f), 1, HAHEN_OBJECT_DEFAULT, 10, NULL); +} + +void EnDekubaba_SetupStunnedVertical(EnDekubaba* this) { + s32 i; + + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { + this->collider.elements[i].info.bumperFlags |= BUMP_ON; + } + + if (this->timer == 1) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, + Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); + this->timer = 0x28; + } else { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 0.0f, 0.0f, + Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); + if (this->timer == 2) { + this->timer = 40; + } else { + this->timer = 40; + } + } + + this->actor.world.pos.x = this->actor.home.pos.x; + this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * this->size); + this->actor.world.pos.z = this->actor.home.pos.z; + this->actionFunc = EnDekubaba_StunnedVertical; +} + +void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + + if (this->timer != 0) { + this->timer--; + } + + if (this->timer == 0) { + EnDekubaba_DisableHitboxes(this); + + if (this->actor.xzDistToPlayer < (80.0f * this->size)) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupRecover(this); + } + } +} + +void EnDekubaba_SetupSway(EnDekubaba* this) { + this->targetSwayAngle = -0x6000; + this->stemSectionAngle[2] = -0x5000; + this->stemSectionAngle[1] = -0x4800; + EnDekubaba_DisableHitboxes(this); + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 35); + this->collider.base.acFlags &= ~AC_ON; + this->actionFunc = EnDekubaba_Sway; +} + +/** + * Sway back and forth with decaying amplitude until close enough to vertical. + */ +void EnDekubaba_Sway(EnDekubaba* this, PlayState* play) { + s16 angleToVertical; + + SkelAnime_Update(&this->skelAnime); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->stemSectionAngle[0], 0x71C); + Math_ScaledStepToS(this->stemSectionAngle, this->stemSectionAngle[1], 0x71C); + Math_ScaledStepToS(&this->stemSectionAngle[1], this->stemSectionAngle[2], 0x71C); + if (Math_ScaledStepToS(&this->stemSectionAngle[2], this->targetSwayAngle, 0x71C) != 0) { + this->targetSwayAngle = -0x4000 - (s32)((this->targetSwayAngle + 0x4000) * 0.8f); + } + + angleToVertical = this->targetSwayAngle + 0x4000; + + if (ABS_ALT(angleToVertical) < 0x100) { + this->collider.base.acFlags |= AC_ON; + if (this->actor.xzDistToPlayer < (80.0f * this->size)) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupRecover(this); + } + } + EnDekubaba_UpdateHeadPosition(this); +} + +void EnDekubaba_SetupFrozen(EnDekubaba* this) { + EnDekubaba_SetFrozenEffects(this); + this->actionFunc = EnDekubaba_Frozen; +} + +void EnDekubaba_Frozen(EnDekubaba* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + EnDekubaba_SpawnIceEffects(this, play); + + if (this->actor.colChkInfo.health == 0) { + EnDekubaba_SetupShrinkDie(this); + } else if (this->actor.xzDistToPlayer < (80.0f * this->size)) { + EnDekubaba_SetupPrepareLunge(this); + } else { + EnDekubaba_SetupRecover(this); + } + } +} + +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; + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); + this->actor.flags &= ~ACTOR_FLAG_20; + this->timer = 200; + this->drawDmgEffAlpha = 0.0f; + this->actionFunc = EnDekubaba_DeadStickDrop; +} + +void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } + + if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { + Actor_Kill(&this->actor); + return; + } + + Actor_OfferGetItemNearby(&this->actor, play, GI_STICKS_1); +} + +/* Update and associated functions */ + +void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { + s32 newHealth; + s32 i; + ColliderJntSphElement* sphElement; + + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->collider); + + if ((this->collider.base.colType != COLTYPE_HARD) && + (this->actor.colChkInfo.damageEffect != DEKUBABA_DMGEFF_HOOKSHOT)) { + sphElement = &this->collider.elements[0]; + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++, sphElement++) { + if (sphElement->info.bumperFlags & BUMP_HIT) { + break; + } + } + + if ((i != ARRAY_COUNT(this->colliderElements)) && + ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || + (!(sphElement->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { + EnDekubaba_SpawnIceEffects(this, play); + newHealth = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; + + if (this->actionFunc != EnDekubaba_StunnedVertical) { + if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_ICE) { + EnDekubaba_SetupFrozen(this); + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_ELECTRIC) { + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_ELECTRIC); + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_NUT) { + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_NUT); + } else { + EnDekubaba_SetFireLightEffects(this, play, i); + + if (this->actionFunc == EnDekubaba_PullBack) { + if (newHealth <= 0) { + newHealth = 1; + } + + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_OTHER); + } else { + EnDekubaba_SetupHit(this, DEKUBABA_HIT_NO_STUN); + } + } + } else { + if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_CUT) { + if (newHealth > 0) { + EnDekubaba_SetupSway(this); + } else { + EnDekubaba_SetupPrunedSomersaultDie(this); + } + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_ELECTRIC) { + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_ELECTRIC); + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_NUT) { + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_NUT); + } else if (this->actor.colChkInfo.damageEffect == DEKUBABA_DMGEFF_ICE) { + EnDekubaba_SetupFrozen(this); + } else { + EnDekubaba_SetFireLightEffects(this, play, i); + EnDekubaba_SetupHit(this, DEKUBABA_HIT_NO_STUN); + } + } + + if (newHealth < 0) { + this->actor.colChkInfo.health = 0; + } else { + this->actor.colChkInfo.health = newHealth; + } + } else { + return; + } + } else { + return; + } + } else if ((play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f)) && + (this->collider.base.colType != COLTYPE_HARD) && (this->actionFunc != EnDekubaba_StunnedVertical) && + (this->actionFunc != EnDekubaba_Hit) && (this->actor.colChkInfo.health != 0)) { + this->actor.colChkInfo.health--; + this->actor.dropFlag = 0; + EnDekubaba_SetupHit(this, DEKUBABA_HIT_STUN_OTHER); + } else { + return; + } + + if (this->actor.colChkInfo.health != 0) { + if ((this->timer == 2) || (this->timer == 3)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DAMAGE); + } + } else { + Enemy_StartFinishingBlow(play, &this->actor); + + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + this->timer = 3; + this->collider.base.acFlags &= ~AC_ON; + } else if (this->drawDmgEffAlpha > 1.5f) { + this->drawDmgEffAlpha = 1.5f; + } + + if (this->actor.params == DEKUBABA_BIG) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DEAD); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); + } + } +} + +void EnDekubaba_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnDekubaba* this = THIS; + + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + EnDekubaba_SetupRecover(this); + } + + EnDekubaba_UpdateDamage(this, play); + this->actionFunc(this, play); + + if (this->actionFunc == EnDekubaba_PrunedSomersaultDie) { + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, 5); + } else if (this->actionFunc != EnDekubaba_DeadStickDrop) { + 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(play, &play->colChkCtx, &this->collider.base); + this->actor.flags |= ACTOR_FLAG_1000000; + } + + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + if (this->actionFunc != EnDekubaba_DeadStickDrop) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + + if (this->drawDmgEffAlpha > 0.0f) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); + this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f; + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f); + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) { + func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } + } +} + +/* Draw functions */ + +void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { + f32 horizontalScale; + s32 i; + + OPEN_DISPS(play->state.gfxCtx); + + horizontalScale = this->size * 0.01f; + + Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->size), this->actor.home.pos.z, + 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(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); + + for (i = 1; i < ARRAY_COUNT(this->bodyPartsPos); i++) { + Matrix_MultZero(&this->bodyPartsPos[i]); + } + + Actor_SetFocus(&this->actor, 0.0f); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { + static Gfx* sStemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; + MtxF mf; + s32 i; + f32 scale; + f32 horizontalStepSize; + s32 stemSections; + + OPEN_DISPS(play->state.gfxCtx); + + if (this->actionFunc == EnDekubaba_PrunedSomersaultDie) { + stemSections = 2; + } else { + stemSections = 3; + } + + scale = this->size * 0.01f; + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_Get(&mf); + + for (i = 0; i < stemSections; i++) { + mf.yw += 20.0f * Math_SinS(this->stemSectionAngle[i]) * this->size; + horizontalStepSize = Math_CosS(this->stemSectionAngle[i]) * 20.0f * this->size; + mf.xw -= horizontalStepSize * Math_SinS(this->actor.shape.rot.y); + mf.zw -= horizontalStepSize * Math_CosS(this->actor.shape.rot.y); + + Matrix_Put(&mf); + Matrix_RotateZYX(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sStemDLists[i]); + + Collider_UpdateSpheres(51 + 2 * i, &this->collider); + Collider_UpdateSpheres(52 + 2 * i, &this->collider); + + if (i == 0) { + if (this->actionFunc != EnDekubaba_Sway) { + this->actor.focus.pos.x = mf.xw; + this->actor.focus.pos.y = mf.yw; + this->actor.focus.pos.z = mf.zw; + } else { + this->actor.focus.pos.x = this->actor.home.pos.x; + this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->size); + this->actor.focus.pos.z = this->actor.home.pos.z; + } + } + + Matrix_MultZero(&this->bodyPartsPos[i + 1]); + } + + CLOSE_DISPS(play->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(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); + + Matrix_MultZero(&this->bodyPartsPos[3]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnDekubaba_DrawShadow(EnDekubaba* this, PlayState* play) { + MtxF mf; + f32 horizontalScale; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C448(play->state.gfxCtx); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); + + func_800C0094(this->boundFloor, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &mf); + Matrix_Mult(&mf, MTXMODE_NEW); + horizontalScale = this->size * 0.15f; + Matrix_Scale(horizontalScale, 1.0f, horizontalScale, MTXMODE_APPLY); + 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(play->state.gfxCtx); +} + +void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnDekubaba* this = THIS; + + if (limbIndex == DEKUBABA_LIMB_ROOT) { + Collider_UpdateSpheres(limbIndex, &this->collider); + } +} + +void EnDekubaba_Draw(Actor* thisx, PlayState* play) { + EnDekubaba* this = THIS; + f32 scale; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + Math_Vec3f_Copy(&this->bodyPartsPos[0], &this->actor.world.pos); + + if (this->actionFunc != EnDekubaba_DeadStickDrop) { + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, + &this->actor); + if (this->actionFunc == EnDekubaba_Wait) { + EnDekubaba_DrawStemRetracted(this, play); + } else { + 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_RotateYS(this->actor.home.rot.y, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + 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_PrunedSomersaultDie) { + EnDekubaba_DrawStemBasePruned(this, play); + } + if (this->boundFloor != NULL) { + EnDekubaba_DrawShadow(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(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); + } + + CLOSE_DISPS(play->state.gfxCtx); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + this->drawDmgEffScale * this->size, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, + this->drawDmgEffType); +} diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index 848f056bf..b1c7f98bc 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -2,16 +2,35 @@ #define Z_EN_DEKUBABA_H #include "global.h" +#include "objects/object_dekubaba/object_dekubaba.h" struct EnDekubaba; typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); +typedef enum { + /* 0 */ DEKUBABA_NORMAL, + /* 1 */ DEKUBABA_BIG +} DekuBabaType; + typedef struct EnDekubaba { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnDekubabaActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x290]; + /* 0x18C */ u8 drawDmgEffType; + /* 0x18E */ s16 timer; + /* 0x190 */ s16 targetSwayAngle; + /* 0x192 */ s16 stemSectionAngle[3]; + /* 0x198 */ Vec3s jointTable[DEKUBABA_LIMB_MAX]; + /* 0x1C8 */ Vec3s morphTable[DEKUBABA_LIMB_MAX]; + /* 0x1F8 */ f32 size; + /* 0x1FC */ f32 drawDmgEffAlpha; + /* 0x200 */ f32 drawDmgEffScale; + /* 0x204 */ f32 drawDmgEffFrozenSteamScale; + /* 0x208 */ Vec3f bodyPartsPos[4]; + /* 0x238 */ CollisionPoly* boundFloor; + /* 0x23C */ ColliderJntSph collider; + /* 0x25C */ ColliderJntSphElement colliderElements[7]; } EnDekubaba; // size = 0x41C #endif // Z_EN_DEKUBABA_H diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 6bc0fd8d1..b9e48e6db 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -153,7 +153,7 @@ void func_808BD348(EnDekunuts* this) { this->drawDmgEffAlpha = 1.0f; this->collider.base.colType = COLTYPE_HIT3; this->unk_190 = 80; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_808BD3B4(EnDekunuts* this, PlayState* play) { @@ -188,7 +188,7 @@ void func_808BD49C(EnDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 9.0f)) { this->collider.base.acFlags |= AC_ON; } else if (Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); } this->collider.dim.height = (s32)((CLAMP(this->skelAnime.curFrame, 9.0f, 12.0f) - 9.0f) * 9.0f) + 5; @@ -299,7 +299,7 @@ void func_808BDA4C(EnDekunuts* this, PlayState* play) { sp58.x = player->actor.world.pos.x; sp58.z = player->actor.world.pos.z; sp58.y = player->actor.world.pos.y + 40.0f; - pitch = Actor_PitchToPoint(&this->actor, &sp58); + pitch = Actor_WorldPitchTowardPoint(&this->actor, &sp58); pitch = CLAMP(pitch, -0x3800, -0x2000); if (this->skelAnime.curFrame < 7.0f) { Math_ScaledStepToS(&this->actor.world.rot.x, pitch, 0x800); @@ -320,7 +320,7 @@ void func_808BDA4C(EnDekunuts* this, PlayState* play) { if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NUTSBALL, pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.shape.rot.y, 0, params) != NULL) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_THROW); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_THROW); } } else if ((this->unk_190 >= 2) && Animation_OnFrame(&this->skelAnime, 12.0f)) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubSpitAnim, -3.0f); @@ -333,7 +333,7 @@ void func_808BDA4C(EnDekunuts* this, PlayState* play) { void func_808BDC9C(EnDekunuts* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubBurrowAnim, -5.0f); this->unk_190 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->actionFunc = func_808BDD54; } @@ -341,7 +341,7 @@ void func_808BDCF0(EnDekunuts* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubBurrowAnim, -5.0f); this->collider.base.acFlags &= ~AC_ON; this->unk_190 = 80; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->actionFunc = func_808BDD54; } @@ -369,7 +369,7 @@ void func_808BDE7C(EnDekunuts* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubUnburrowAnim, -3.0f); this->collider.dim.height = 37; this->actor.colChkInfo.mass = 50; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DAMAGE); this->actor.world.rot.x = 0; this->actor.flags |= ACTOR_FLAG_20; this->collider.base.acFlags &= ~AC_ON; @@ -405,20 +405,20 @@ void func_808BDFB8(EnDekunuts* this, PlayState* play) { } if (this->unk_18C != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); this->unk_18C = 0; } else { this->unk_18C = 1; } - Math_StepToF(&this->actor.speedXZ, 7.5f, 1.0f); + Math_StepToF(&this->actor.speed, 7.5f, 1.0f); if (!Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_192, 1, 0xE38, 0xB6)) { - if (this->actor.bgCheckFlags & 0x20) { - this->unk_192 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); - } else if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else if (this->unk_18D == 0) { - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); yaw2 = yaw - this->actor.yawTowardsPlayer; if (ABS_ALT(yaw2) > 0x2000) { this->unk_192 = yaw; @@ -431,11 +431,11 @@ void func_808BDFB8(EnDekunuts* this, PlayState* play) { } this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); - if ((this->unk_18D == 0) && (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 20.0f) && + if ((this->unk_18D == 0) && (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 20.0f) && (fabsf(this->actor.world.pos.y - this->actor.home.pos.y) < 2.0f)) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.flags &= ~ACTOR_FLAG_20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_808BDC9C(this); } else if (this->unk_190 == 0) { func_808BE1CC(this); @@ -445,7 +445,7 @@ void func_808BDFB8(EnDekunuts* this, PlayState* play) { void func_808BE1CC(EnDekunuts* this) { Animation_PlayLoop(&this->skelAnime, &gDekuScrubPantingAnim); this->unk_190 = 3; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_18D != 0) { this->unk_18D--; } @@ -468,7 +468,7 @@ void func_808BE22C(EnDekunuts* this, PlayState* play) { void func_808BE294(EnDekunuts* this, s32 arg1) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubDamageAnim, -3.0f); if (this->actor.params == ENDEKUNUTS_GET_FF00_0) { - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; if (arg1 != 0) { func_800BE504(&this->actor, &this->collider); } @@ -477,20 +477,21 @@ void func_808BE294(EnDekunuts* this, s32 arg1) { this->actor.world.rot.x = 0; this->collider.base.acFlags &= ~AC_ON; this->actionFunc = func_808BE358; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_CUTBODY); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&gDekuScrubDamageAnim)); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_CUTBODY); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, + Animation_GetLastFrame(&gDekuScrubDamageAnim)); } void func_808BE358(EnDekunuts* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); if (SkelAnime_Update(&this->skelAnime)) { func_808BE484(this); } } void func_808BE3A8(EnDekunuts* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -520,8 +521,8 @@ void func_808BE3FC(EnDekunuts* this, PlayState* play) { void func_808BE484(EnDekunuts* this) { Animation_PlayOnce(&this->skelAnime, &gDekuScrubDieAnim); this->actionFunc = func_808BE4D4; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DEAD); } void func_808BE4D4(EnDekunuts* this, PlayState* play) { @@ -593,8 +594,8 @@ void func_808BE73C(EnDekunuts* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 1) { this->unk_190 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_808BE3A8(this); return; } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index c6672b06e..59b6677a0 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -8,13 +8,13 @@ struct EnDekunuts; typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); -#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { - /* 0x0 */ ENDEKUNUTS_GET_FF00_0, - /* 0x1 */ ENDEKUNUTS_GET_FF00_1, - /* 0x2 */ ENDEKUNUTS_GET_FF00_2, - /* 0xFF*/ ENDEKUNUTS_GET_FF00_FF = 0xFF, + /* 0x00 */ ENDEKUNUTS_GET_FF00_0, + /* 0x01 */ ENDEKUNUTS_GET_FF00_1, + /* 0x02 */ ENDEKUNUTS_GET_FF00_2, + /* 0xFF */ ENDEKUNUTS_GET_FF00_FF = 0xFF }; typedef struct EnDekunuts { diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c index 2a4eb1553..0d7de9cf1 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c @@ -125,7 +125,7 @@ void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play) { s32 absYawDiff; s16 yawDiff; - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; absYawDiff = ABS_ALT(yawDiff); @@ -143,7 +143,7 @@ void EnDemoheishi_SetupTalk(EnDemoheishi* this) { void EnDemoheishi_Talk(EnDemoheishi* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); EnDemoheishi_SetupIdle(this); } } diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index d9bebb404..9b513ef67 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -322,7 +322,7 @@ void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { if (this->path != NULL) { yRotation = EnDg_GetYRotation(this->path, this->currentPoint, &this->actor.world.pos, &distSq); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yRotation = this->actor.wallYaw; } @@ -338,15 +338,15 @@ void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { - Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.0f, 0.2f, 1.0f); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } else if (play->sceneId == SCENE_CLOCKTOWER) { - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { - Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.0f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } } else { Actor_Kill(&this->actor); @@ -355,7 +355,7 @@ void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { void EnDg_SpawnFloorDustRing(EnDg* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; + s16 mod = (this->actor.speed > 6.0f) ? 2 : 3; Vec3f pos; if (((this->index + curFrame) % mod) == 0) { @@ -368,36 +368,36 @@ void EnDg_SpawnFloorDustRing(EnDg* this, PlayState* play) { void EnDg_PlaySfxWalk(EnDg* this) { if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONKEY_WALK); } } void EnDg_PlaySfxBark(EnDg* this, f32 frame) { if (Animation_OnFrame(&this->skelAnime, frame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_BARK); } } void EnDg_PlaySfxAngryBark(EnDg* this, f32 frame) { if (Animation_OnFrame(&this->skelAnime, frame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } } void EnDg_PlaySfxWhine(EnDg* this) { if (Animation_OnFrame(&this->skelAnime, 23.0f) || Animation_OnFrame(&this->skelAnime, 28.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_WHINE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_WHINE); } } void EnDg_PlaySfxGrowl(EnDg* this, f32 frame) { if (Animation_OnFrame(&this->skelAnime, frame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } } void EnDg_SetupIdleMove(EnDg* this, PlayState* play) { - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); @@ -473,26 +473,26 @@ void EnDg_StartTextBox(EnDg* this, PlayState* play) { */ void EnDg_TryPickUp(EnDg* this, PlayState* play) { if (sIsAnyDogHeld && !(this->dogFlags & DOG_FLAG_HELD)) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->dogFlags |= DOG_FLAG_HELD; } else if (!sIsAnyDogHeld && (this->dogFlags & DOG_FLAG_HELD)) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->dogFlags &= ~DOG_FLAG_HELD; } if (Actor_HasParent(&this->actor, play)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_BARK); this->grabState = DOG_GRAB_STATE_HELD; sSelectedRacetrackDogInfo = sRacetrackDogInfo[this->index]; if (!sIsAnyDogHeld) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; sIsAnyDogHeld = true; this->dogFlags |= DOG_FLAG_HELD; } EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SIT_DOWN); this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 100.0f); @@ -501,7 +501,7 @@ void EnDg_TryPickUp(EnDg* this, PlayState* play) { this->actionFunc = EnDg_Held; } } else { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } @@ -562,7 +562,7 @@ void EnDg_CheckForBremenMaskMarch(EnDg* this, PlayState* play) { } else if ((this->actionFunc == EnDg_ApproachPlayer) || (this->actionFunc == EnDg_SitNextToPlayer)) { if (DECR(this->bremenBarkTimer) == 0) { this->bremenBarkTimer = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_BARK); } } } @@ -608,7 +608,7 @@ s32 EnDg_ShouldReactToNonHumanPlayer(EnDg* this, PlayState* play) { void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { switch (player->transformation) { case PLAYER_FORM_HUMAN: if (this->behavior != DOG_BEHAVIOR_HUMAN) { @@ -620,7 +620,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { case PLAYER_FORM_ZORA: this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; - if ((this->behavior != DOG_BEHAVIOR_ZORA) && (player->actor.speedXZ > 1.0f)) { + if ((this->behavior != DOG_BEHAVIOR_ZORA) && (player->actor.speed > 1.0f)) { this->behavior = DOG_BEHAVIOR_ZORA; EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_ApproachPlayer; @@ -634,7 +634,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { case PLAYER_FORM_GORON: this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; - if ((this->behavior != DOG_BEHAVIOR_GORON) && (player->actor.speedXZ > 1.0f)) { + if ((this->behavior != DOG_BEHAVIOR_GORON) && (player->actor.speed > 1.0f)) { this->behavior = DOG_BEHAVIOR_GORON; EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); this->timer = 50; @@ -649,7 +649,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { case PLAYER_FORM_DEKU: this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; - if ((this->behavior != DOG_BEHAVIOR_DEKU) && (player->actor.speedXZ > 1.0f)) { + if ((this->behavior != DOG_BEHAVIOR_DEKU) && (player->actor.speed > 1.0f)) { this->behavior = DOG_BEHAVIOR_DEKU; EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_ApproachPlayerToAttack; @@ -680,7 +680,7 @@ void EnDg_IdleMove(EnDg* this, PlayState* play) { EnDg_CheckForBremenMaskMarch(this, play); EnDg_PlaySfxWalk(this); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actionFunc = EnDg_Fall; } @@ -704,7 +704,7 @@ void EnDg_IdleBark(EnDg* this, PlayState* play) { EnDg_PlaySfxBark(this, 13.0f); EnDg_PlaySfxBark(this, 19.0f); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actionFunc = EnDg_Fall; } @@ -728,12 +728,12 @@ void EnDg_BackAwayFromGoron(EnDg* this, PlayState* play) { this->actionFunc = EnDg_RunAwayFromGoron; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.shape.rot.y = this->actor.wallYaw; } this->actor.world.rot.y = this->actor.shape.rot.y; - Math_ApproachF(&this->actor.speedXZ, -1.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, -1.5f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } @@ -752,7 +752,7 @@ void EnDg_RunAwayFromGoron(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 250.0f) { Math_ApproachS(&this->actor.shape.rot.y, -this->actor.yawTowardsPlayer, 4, 0xC00); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yRotation = this->actor.wallYaw; } else { yRotation = 0; @@ -760,27 +760,27 @@ void EnDg_RunAwayFromGoron(EnDg* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.world.rot.y = this->actor.shape.rot.y; - if (player->actor.speedXZ != 0.0f) { - Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 0.2f, 1.0f); + if (player->actor.speed != 0.0f) { + Math_ApproachF(&this->actor.speed, player->actor.speed, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } } else { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK); this->actionFunc = EnDg_BarkAtGoron; } - if (this->actor.speedXZ > 7.0f) { - this->actor.speedXZ = 7.0f; + if (this->actor.speed > 7.0f) { + this->actor.speed = 7.0f; } Actor_MoveWithGravity(&this->actor); EnDg_PlaySfxWalk(this); if (Animation_OnFrame(&this->skelAnime, 3.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_CRY); } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONKEY_WALK); } } @@ -805,13 +805,13 @@ void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.shape.rot.y = this->actor.wallYaw; } this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 70.0f) { - Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 1.0f); + Math_ApproachZeroF(&this->actor.speed, 0.2f, 1.0f); if (Animation_OnFrame(&this->skelAnime, 7.0f)) { s16 yawDiff = ABS_ALT(player->actor.shape.rot.y - this->actor.shape.rot.y); @@ -827,7 +827,7 @@ void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play) { } } else { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 1.0f); } Actor_MoveWithGravity(&this->actor); @@ -841,7 +841,7 @@ void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play) { */ void EnDg_RunAfterAttacking(EnDg* this, PlayState* play) { this->dogFlags &= ~DOG_FLAG_BOUNCED; - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.1f, 0.5f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.1f, 0.5f); Actor_MoveWithGravity(&this->actor); if (DECR(this->attackTimer) == 0) { this->attackTimer = 20; @@ -859,7 +859,7 @@ void EnDg_RunAfterAttacking(EnDg* this, PlayState* play) { void EnDg_SitNextToPlayer(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actionFunc = EnDg_Fall; } @@ -893,7 +893,7 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; this->dogFlags |= DOG_FLAG_BOUNCED; this->collider.base.atFlags &= ~AT_BOUNCED; - this->actor.speedXZ *= -1.0f; + this->actor.speed *= -1.0f; EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_RunAfterAttacking; return; @@ -919,9 +919,9 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = 1.2f; this->actor.velocity.y = 2.0f * rand + 3.0f; - this->actor.speedXZ = 8.0f + rand; + this->actor.speed = 8.0f + rand; } else if (curFrame > 20) { - Math_ApproachF(&this->actor.speedXZ, 2.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.5f, 0.2f, 1.0f); } if (curFrame > 23) { @@ -949,7 +949,7 @@ void EnDg_WalkToPlayer(EnDg* this, PlayState* play) { } else { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); this->actor.world.rot.y = this->actor.shape.rot.y; - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } @@ -960,13 +960,13 @@ void EnDg_WalkToPlayer(EnDg* this, PlayState* play) { void EnDg_SetupBremenMaskApproachPlayer(EnDg* this, PlayState* play) { if (func_801A46F8() == 1) { this->bremenBarkTimer = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_BARK); this->actionFunc = EnDg_ApproachPlayer; } } void EnDg_Fall(EnDg* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_IdleMove; } @@ -996,12 +996,12 @@ void EnDg_ApproachPlayer(EnDg* this, PlayState* play) { this->actionFunc = EnDg_SitNextToPlayer; } else if (player->stateFlags3 & PLAYER_STATE3_20000000) { if ((this->actor.xzDistToPlayer > 40.0f) && (player->linearVelocity == 0.0f)) { - Math_ApproachF(&this->actor.speedXZ, 1.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.5f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, player->actor.speed, 0.2f, 1.0f); } } else { - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } EnDg_CheckForBremenMaskMarch(this, play); @@ -1026,14 +1026,14 @@ void EnDg_SlowlyBackUpBeforeAttacking(EnDg* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.shape.rot.y = this->actor.wallYaw; EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_JUMP_ATTACK); this->actionFunc = EnDg_JumpAttack; } this->actor.world.rot.y = this->actor.shape.rot.y; - Math_ApproachF(&this->actor.speedXZ, -1.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, -1.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); EnDg_PlaySfxWalk(this); EnDg_PlaySfxGrowl(this, 4.0f); @@ -1054,17 +1054,17 @@ void EnDg_BackAwayFromPlayer(EnDg* this, PlayState* play) { this->actionFunc = EnDg_BarkAtPlayer; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.shape.rot.y = this->actor.wallYaw; } this->actor.world.rot.y = this->actor.shape.rot.y; - Math_ApproachF(&this->actor.speedXZ, -2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, -2.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } EnDg_PlaySfxWalk(this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } /** @@ -1106,11 +1106,11 @@ void EnDg_SetupSwim(EnDg* this, PlayState* play) { this->actor.gravity = 0.0f; this->actor.velocity.y = -3.0f; this->swimTimer = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->actionFunc = EnDg_Swim; } - Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } @@ -1138,7 +1138,7 @@ void EnDg_Swim(EnDg* this, PlayState* play) { if (DECR(this->swimTimer) == 0) { if (!(this->dogFlags & DOG_FLAG_SWIMMING)) { this->dogFlags |= DOG_FLAG_SWIMMING; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); } this->swimTimer = 5; @@ -1158,7 +1158,7 @@ void EnDg_Swim(EnDg* this, PlayState* play) { // over. For example, if the player throws the dog at a tall wall next to some water, // this code will make the dog "skip" along the water's surface, assuming the floor // height is low enough to make it try to jump out. - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (!WaterBox_GetSurface1(play, &play->colCtx, pos.x, pos.z, &waterSurface, &waterBox)) { if (floorHeight > -100.0f) { this->dogFlags &= ~DOG_FLAG_SWIMMING; @@ -1176,20 +1176,20 @@ void EnDg_Swim(EnDg* this, PlayState* play) { } else { yRotation = this->actor.wallYaw; } - } else if ((this->actor.bgCheckFlags & 1) && !(this->actor.bgCheckFlags & 0x20)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.gravity = -3.0f; this->dogFlags &= ~DOG_FLAG_SWIMMING; this->behavior = DOG_BEHAVIOR_DEFAULT; this->timer = Rand_S16Offset(60, 60); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); this->actionFunc = EnDg_IdleMove; } Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.5f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } @@ -1216,23 +1216,23 @@ void EnDg_JumpOutOfWater(EnDg* this, PlayState* play) { this->actor.velocity.y = -1.0f; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.pos.y = pos.y; this->actor.velocity.y = 10.0f; EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 800); } - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->behavior = DOG_BEHAVIOR_DEFAULT; this->actor.velocity.y = 10.0f; this->actor.gravity = -3.0f; this->timer = Rand_S16Offset(60, 60); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_IdleMove; - Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 3.5f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.5f, 0.2f, 1.0f); } Actor_MoveWithGravity(&this->actor); @@ -1243,7 +1243,7 @@ void EnDg_Held(EnDg* this, PlayState* play) { this->grabState = DOG_GRAB_STATE_THROWN_OR_SITTING_AFTER_THROW; this->actor.flags |= ACTOR_FLAG_1; if (sIsAnyDogHeld) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; sIsAnyDogHeld = false; this->dogFlags &= ~DOG_FLAG_HELD; } @@ -1260,13 +1260,13 @@ void EnDg_Held(EnDg* this, PlayState* play) { void EnDg_Thrown(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->dogFlags & DOG_FLAG_THROWN) { this->dogFlags &= ~DOG_FLAG_THROWN; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONKEY_WALK); } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -3.0f; if (player->transformation == PLAYER_FORM_HUMAN) { EnDg_TryPickUp(this, play); @@ -1350,7 +1350,7 @@ void EnDg_Update(Actor* thisx, PlayState* play) { EnDg_SetupIdleMove(this, play); } - if ((this->actor.bgCheckFlags & 0x40) && Actor_HasNoParent(&this->actor, play)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) && Actor_HasNoParent(&this->actor, play)) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SWIM); this->actionFunc = EnDg_SetupSwim; } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 643c167f0..9c9c46e07 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -382,7 +382,7 @@ void func_8089AC70(EnDinofos* this) { this->drawDmgEffAlpha = 1.0f; this->unk_290 = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_8089ACEC(EnDinofos* this, PlayState* play) { @@ -415,20 +415,20 @@ s32 func_8089AE00(EnDinofos* this, PlayState* play) { temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); if (temp_v0 != NULL) { - temp_v1 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; + temp_v1 = (Actor_WorldYawTowardActor(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; if (ABS_ALT(temp_v1) < 0x3000) { func_8089D11C(this, temp_v1 + this->unk_28E); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WARAU); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } } temp_v0 = func_800BC444(play, &this->actor, 80.0f); if ((temp_v0 != NULL) && (temp_v0->id == ACTOR_EN_BOM_CHU)) { - temp_v1_2 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; + temp_v1_2 = (Actor_WorldYawTowardActor(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; if (ABS_ALT(temp_v1_2) < 0x3000) { func_8089C024(this, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WARAU); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } } @@ -445,7 +445,7 @@ s32 func_8089AE00(EnDinofos* this, PlayState* play) { } else { func_8089C024(this, 3); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WARAU); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } @@ -496,7 +496,7 @@ void func_8089B288(EnDinofos* this, PlayState* play) { void func_8089B320(EnDinofos* this) { this->actor.gravity = -2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.x; this->unk_2BC.y = this->actor.floorHeight + 6.0f; this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.z; @@ -523,7 +523,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { } Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8089B4A4(this); } } @@ -536,7 +536,7 @@ void func_8089B4A4(EnDinofos* this) { this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; this->unk_2BC.y = this->actor.floorHeight + 11.0f; this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); this->unk_290 = 0; this->unk_292 = -1; this->actionFunc = func_8089B580; @@ -578,7 +578,7 @@ void func_8089B6E8(EnDinofos* this) { void func_8089B72C(EnDinofos* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } if (SkelAnime_Update(&this->skelAnime)) { @@ -593,7 +593,7 @@ void func_8089B7B0(EnDinofos* this) { Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_002E40, -4.0f); this->unk_290 = (s32)Rand_ZeroFloat(20.0f) + 40; this->unk_292 = 30; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; func_8089AD70(this); this->actionFunc = func_8089B834; @@ -625,9 +625,9 @@ void func_8089B8B0(EnDinofos* this, PlayState* play) { phi_f0 = 70.0f; } if (this->actor.xzDistToPlayer <= phi_f0) { - this->actor.speedXZ = -3.5f; + this->actor.speed = -3.5f; } else { - this->actor.speedXZ = 3.5f; + this->actor.speed = 3.5f; } } @@ -650,9 +650,9 @@ void func_8089B98C(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer <= phi_f0) { - Math_StepToF(&this->actor.speedXZ, -7.0f, 0.5f); + Math_StepToF(&this->actor.speed, -7.0f, 0.5f); } else { - Math_StepToF(&this->actor.speedXZ, 7.0f, 0.5f); + Math_StepToF(&this->actor.speed, 7.0f, 0.5f); } if (this->actor.xzDistToPlayer < 80.0f) { @@ -666,7 +666,7 @@ void func_8089B98C(EnDinofos* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } } @@ -674,7 +674,7 @@ void func_8089B98C(EnDinofos* this, PlayState* play) { void func_8089BAC0(EnDinofos* this) { if (this->actionFunc != func_8089BB60) { Animation_MorphToLoop(&this->skelAnime, &object_dinofos_Anim_000580, -4.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y) > 0) { this->unk_28C = BINANG_ADD(this->actor.shape.rot.y, 0x4000); @@ -701,20 +701,20 @@ void func_8089BBB4(EnDinofos* this, PlayState* play) { s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y; if (ABS_ALT(rotY) > 0x7800) { if (Rand_ZeroOne() < 0.5f) { - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else { - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; } } else if (rotY >= 0) { - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else { - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; } if (this->actionFunc == func_8089D1E0) { - this->skelAnime.playSpeed = this->actor.speedXZ * 0.166666671634f; + this->skelAnime.playSpeed = this->actor.speed * 0.166666671634f; } else { - Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speedXZ * 0.166666671634f, 0.0f, + Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speed * 0.166666671634f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); } @@ -733,8 +733,8 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); if (!func_8089AE00(this, play)) { - if (this->actor.bgCheckFlags & 8) { - if (this->actor.speedXZ >= 0.0f) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->actor.speed >= 0.0f) { phi_v0 = BINANG_ADD(this->actor.shape.rot.y, 0x4000); } else { phi_v0 = BINANG_SUB(this->actor.shape.rot.y, 0x4000); @@ -742,23 +742,23 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { phi_v0 = this->actor.wallYaw - phi_v0; if (ABS_ALT(phi_v0) > 0x4000) { - this->actor.speedXZ *= -0.8f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ -= 0.5f; + this->actor.speed *= -0.8f; + if (this->actor.speed < 0.0f) { + this->actor.speed -= 0.5f; } else { - this->actor.speedXZ += 0.5f; + this->actor.speed += 0.5f; } } } phi_v0 = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); if ((phi_v0 >= 0) && (phi_v0 < 0x7800)) { - this->actor.speedXZ += 0.125f; + this->actor.speed += 0.125f; } else if ((phi_v0 < 0) && (phi_v0 > -0x7800)) { - this->actor.speedXZ -= 0.125f; + this->actor.speed -= 0.125f; } - if (this->actor.speedXZ > 0.0f) { + if (this->actor.speed > 0.0f) { this->skelAnime.playSpeed = 1.0f; } else { this->skelAnime.playSpeed = -1.0f; @@ -787,7 +787,7 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } } @@ -804,7 +804,7 @@ void func_8089C024(EnDinofos* this, s32 arg1) { } } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_290 = arg1; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8089C0DC; @@ -825,33 +825,33 @@ void func_8089C0DC(EnDinofos* this, PlayState* play) { void func_8089C164(EnDinofos* this) { if (this->unk_290 == 2) { - this->actor.speedXZ = -10.0f; + this->actor.speed = -10.0f; this->actor.velocity.y = 9.0f; this->colliderJntSph.base.acFlags |= AC_ON; } else { this->actor.velocity.y = 12.5f; if (this->unk_290 == 0) { - this->actor.speedXZ = 4.5f; + this->actor.speed = 4.5f; } } - this->actor.bgCheckFlags &= ~1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_JUMP); + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->actionFunc = func_8089C1F8; } void func_8089C1F8(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8089C398(this); } } void func_8089C244(EnDinofos* this) { - this->actor.bgCheckFlags &= ~1; - this->actor.speedXZ = 8.0f; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + this->actor.speed = 8.0f; this->actor.velocity.y = 16.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->unk_290 = 0; this->unk_292 = -1; this->actionFunc = func_8089C2A8; @@ -867,7 +867,7 @@ void func_8089C2A8(EnDinofos* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_dinofos_Anim_0025B4, 1.0f, 7.0f, 13.0f, ANIMMODE_ONCE, -2.0f); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->colliderQuad.base.atFlags &= ~AT_ON; func_8089C398(this); } @@ -880,15 +880,15 @@ void func_8089C398(EnDinofos* this) { this->skelAnime.endFrame = Animation_GetLastFrame(&object_dinofos_Anim_0025B4); } - if (this->actor.speedXZ < 0.0f) { + if (this->actor.speed < 0.0f) { this->unk_290 = 1; } else { this->unk_290 = 0; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_8089AD70(this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); this->actionFunc = func_8089C44C; } @@ -906,10 +906,10 @@ void func_8089C44C(EnDinofos* this, PlayState* play) { void func_8089C4F8(EnDinofos* this) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0025B4); this->colliderQuad.base.atFlags &= ~AT_BOUNCED; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->unk_290 = 0; this->unk_292 = -1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8089C56C; } @@ -928,7 +928,7 @@ void func_8089C56C(EnDinofos* this, PlayState* play) { } else if (Animation_OnFrame(&this->skelAnime, 13.0f)) { this->colliderQuad.base.atFlags &= ~AT_ON; } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } else if (this->skelAnime.curFrame < 7.0f) { func_8089AE00(this, play); } @@ -941,14 +941,14 @@ void func_8089C690(EnDinofos* this) { if (this->actionFunc != func_8089C2A8) { this->actor.world.rot.y = this->actor.shape.rot.y; } else { - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; } this->actionFunc = func_8089C724; } void func_8089C724(EnDinofos* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); } if (SkelAnime_Update(&this->skelAnime)) { @@ -957,7 +957,7 @@ void func_8089C724(EnDinofos* this, PlayState* play) { } void func_8089C784(EnDinofos* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -989,20 +989,20 @@ void func_8089C87C(EnDinofos* this, s32 arg1) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00D21C); func_800BE5CC(&this->actor, &this->colliderJntSph, arg1); this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } this->unk_28E = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); this->colliderJntSph.base.acFlags &= ~AC_ON; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 18); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 18); this->actionFunc = func_8089C938; } void func_8089C938(EnDinofos* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); + if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { if (this->actor.cutscene == -1) { func_8089CFAC(this); @@ -1021,18 +1021,18 @@ void func_8089C938(EnDinofos* this, PlayState* play) { void func_8089CA14(EnDinofos* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_dinofos_Anim_001040, -5.0f); this->colliderJntSph.base.acFlags |= AC_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8089CA74; } void func_8089CA74(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { func_8089CB10(this, play); } else if (!func_8089AE00(this, play) && Animation_OnFrame(&this->skelAnime, 12.0f)) { - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; } } @@ -1042,7 +1042,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &object_dinofos_Anim_0013C0); this->unk_290 = 20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->colliderJntSph.base.atFlags |= AT_ON; func_8089AD70(this); @@ -1129,8 +1129,8 @@ void func_8089CF70(EnDinofos* this, PlayState* play) { void func_8089CFAC(EnDinofos* this) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00ABD0); this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_DEAD); - this->actor.speedXZ = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8089D018; } @@ -1157,17 +1157,17 @@ void func_8089D018(EnDinofos* this, PlayState* play) { this->actor.shape.shadowAlpha = this->unk_288; } else if (Animation_OnFrame(&this->skelAnime, 26.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } } void func_8089D11C(EnDinofos* this, s16 arg1) { if (arg1 >= 0) { - this->actor.speedXZ = -15.0f; + this->actor.speed = -15.0f; } else { - this->actor.speedXZ = 15.0f; + this->actor.speed = 15.0f; } - Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speedXZ * (1.0f / 7.5f), 0.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_dinofos_Anim_00D62C, this->actor.speed * (1.0f / 7.5f), 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); this->unk_292 = 10; @@ -1178,10 +1178,10 @@ void func_8089D11C(EnDinofos* this, s16 arg1) { void func_8089D1E0(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); - Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f); + Math_StepToF(&this->actor.speed, 0.0f, 2.0f); this->skelAnime.playSpeed = - (1.0f + fabsf(this->actor.speedXZ * (1.0f / 15.0f))) * ((this->actor.speedXZ >= 0.0f) ? 1.0f : -1.0f); + (1.0f + fabsf(this->actor.speed * (1.0f / 15.0f))) * ((this->actor.speed >= 0.0f) ? 1.0f : -1.0f); this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); SkelAnime_Update(&this->skelAnime); if (this->unk_292 != 0) { @@ -1191,7 +1191,7 @@ void func_8089D1E0(EnDinofos* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } @@ -1303,19 +1303,19 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 1) { this->unk_290 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_8089C784(this); return true; } if (this->actor.colChkInfo.damageEffect == 5) { this->unk_290 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_8089C784(this); return true; } diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 615383a27..7a8bc5ddb 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -8,7 +8,7 @@ #include "objects/object_hanareyama_obj/object_hanareyama_obj.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnDnb*)thisx) @@ -275,7 +275,9 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { } Matrix_Push(); - if (1) {}; + //! FAKE: + if (1) {} + arg0->unk_24 = (arg0->unk_01 / (f32)arg0->unk_02) * 255.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)arg0->unk_24); diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index ee035f06b..fd60eca75 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -433,11 +433,11 @@ void func_80A52074(EnDnk* this, PlayState* play) { break; case 438: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKNUTS_DANCE_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKNUTS_DANCE_BIG); break; case 493: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); break; } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 12e048955..aad29992a 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -311,7 +311,7 @@ void func_80A71B68(EnDno* this, PlayState* play) { if (!(this->unk_3B0 & 0x20)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, &this->animIndex); - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->unk_460); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, this->unk_460); } } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); @@ -347,8 +347,8 @@ void func_80A71C3C(EnDno* this, PlayState* play) { } case EN_DNO_ANIM_PRAYER_LOOP: - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->unk_460), 2, 0xE38, - 0x222); + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, this->unk_460), 2, + 0xE38, 0x222); break; } @@ -436,12 +436,12 @@ void func_80A71F18(EnDno* this, PlayState* play) { &this->animIndex); } Math_ScaledStepToS(&this->actor.shape.rot.y, - Actor_YawBetweenActors(&this->actor, this->unk_460), 0x71C); + Actor_WorldYawTowardActor(&this->actor, this->unk_460), 0x71C); break; case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - func_801477B4(play); + Message_CloseTextbox(play); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); func_80A71B68(this, play); @@ -474,7 +474,7 @@ void func_80A71F18(EnDno* this, PlayState* play) { case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - func_801477B4(play); + Message_CloseTextbox(play); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); func_80A71B68(this, play); @@ -485,13 +485,13 @@ void func_80A71F18(EnDno* this, PlayState* play) { case 0x80C: if (Message_ShouldAdvance(play)) { - func_80151938(play, 0x80D); + Message_ContinueTextbox(play, 0x80D); } break; case 0x80D: if (Message_ShouldAdvance(play)) { - func_80151938(play, 0x80E); + Message_ContinueTextbox(play, 0x80E); } break; @@ -505,21 +505,21 @@ void func_80A71F18(EnDno* this, PlayState* play) { &this->animIndex); } } else if ((this->animIndex == EN_DNO_ANIM_IDLE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80A71B68(this, play); } break; case 0x80F: if (Message_ShouldAdvance(play)) { - func_80151938(play, 0x810); + Message_ContinueTextbox(play, 0x810); } break; case 0x810: if (Message_ShouldAdvance(play)) { this->unk_3B0 |= 0x20; - func_801477B4(play); + Message_CloseTextbox(play); func_80A71B68(this, play); break; } @@ -541,7 +541,7 @@ void func_80A71F18(EnDno* this, PlayState* play) { case 0x811: if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80A71B68(this, play); } break; @@ -637,7 +637,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { if (this->skelAnime.curFrame <= 23.0f) { this->unk_452 = 3; if (Animation_OnFrame(&this->skelAnime, 23.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OPEN_AMBRELLA); + Actor_PlaySfx(&this->actor, NA_SE_EV_OPEN_AMBRELLA); } } else if (this->skelAnime.curFrame <= 24.0f) { this->unk_452 = 4; @@ -675,8 +675,8 @@ void func_80A725F8(EnDno* this, PlayState* play) { } else { this->getItemId = GI_MASK_SCENTS; } - Actor_PickUp(&this->actor, play, this->getItemId, 60.0f, 60.0f); - func_801477B4(play); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 60.0f, 60.0f); + Message_CloseTextbox(play); func_80A72B84(this, play); } break; @@ -699,14 +699,14 @@ void func_80A725F8(EnDno* this, PlayState* play) { } } else if ((this->animIndex == EN_DNO_ANIM_GREETING_WITH_CANDLE) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80A72438(this, play); } break; case 0x806: if (Message_ShouldAdvance(play)) { - func_80151938(play, 0x800); + Message_ContinueTextbox(play, 0x800); } break; @@ -741,13 +741,13 @@ void func_80A72BA4(EnDno* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80A72598; } else { - Actor_PickUp(&this->actor, play, this->getItemId, 60.0f, 60.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 60.0f, 60.0f); } } void func_80A72C04(EnDno* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_START_RACE_START, &this->animIndex); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Math_Vec3f_Copy(&this->unk_334, &this->actor.world.pos); SubS_ActorPathing_Init(play, &this->unk_334, &this->actor, &this->actorPath, play->setupPathList, @@ -779,21 +779,21 @@ s32 EnDno_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) thisx->gravity = 0.0f; temp_v0 = thisx->yawTowardsPlayer - thisx->world.rot.y; if ((temp_v0 <= 0x4000) && (temp_v0 >= -0x4000)) { - Math_SmoothStepToF(&thisx->speedXZ, 15.0f, 0.8f, 1.0f, 0.01f); + Math_SmoothStepToF(&thisx->speed, 15.0f, 0.8f, 1.0f, 0.01f); } else { if (thisx->xzDistToPlayer <= 80.0f) { - Math_SmoothStepToF(&thisx->speedXZ, 8.0f, 0.5f, 0.5f, 0.01f); + Math_SmoothStepToF(&thisx->speed, 8.0f, 0.5f, 0.5f, 0.01f); } else if (thisx->xzDistToPlayer <= 360.0f) { - Math_SmoothStepToF(&thisx->speedXZ, 7.0f, 0.5f, 0.5f, 0.01f); + Math_SmoothStepToF(&thisx->speed, 7.0f, 0.5f, 0.5f, 0.01f); } else { - Math_SmoothStepToF(&thisx->speedXZ, 3.5f, 0.5f, 0.5f, 0.01f); + Math_SmoothStepToF(&thisx->speed, 3.5f, 0.5f, 0.5f, 0.01f); } } - if (actorPath->distSqToCurPoint < SQ(thisx->speedXZ)) { + if (actorPath->distSqToCurPoint < SQ(thisx->speed)) { ret = true; } else { - sp38 = thisx->speedXZ / sqrtf(actorPath->distSqToCurPointXZ); + sp38 = thisx->speed / sqrtf(actorPath->distSqToCurPointXZ); sp2C = ABS(actorPath->rotToCurPoint.x - thisx->world.rot.x); temp_v0_2 = sp2C; temp_v0_2 *= sp38; @@ -810,11 +810,11 @@ s32 EnDno_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) s32 EnDno_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; EnDno* this = (EnDno*)thisx; - f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ; + f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speed; f32 sp20 = gFramerateDivisorHalf; thisx->velocity.x = Math_SinS(thisx->world.rot.y) * sp24; - thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speedXZ; + thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speed; thisx->velocity.z = Math_CosS(thisx->world.rot.y) * sp24; this->unk_334.x += (this->actor.velocity.x * sp20) + this->actor.colChkInfo.displacement.x; @@ -864,7 +864,7 @@ void func_80A730A0(EnDno* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_BUTLER_FRY - SFX_FLAG); if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_PERMANENT) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actorPath.curPoint); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.z = 0.0f; @@ -873,10 +873,10 @@ void func_80A730A0(EnDno* this, PlayState* play) { } void func_80A73244(EnDno* this, PlayState* play) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->unk_328 = 2; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Flags_UnsetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor)); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->unk_44E = 0; @@ -903,7 +903,7 @@ void func_80A732C8(EnDno* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOSE_AMBRELLA); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOSE_AMBRELLA); this->unk_452 = 4; } else if (Animation_OnFrame(&this->skelAnime, 5.0f)) { this->unk_452 = 3; @@ -945,7 +945,9 @@ void func_80A73408(EnDno* this, PlayState* play) { if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->animIndex == EN_DNO_ANIM_SHOCK_START)) { - if (0) {}; + //! FAKE: + if (1) {} + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_SHOCK_LOOP, &this->animIndex); } } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index b504e9a11..11240f27b 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -133,37 +133,38 @@ s32 func_80B3CA20(EnDnp* this) { if ((this->animIndex == EN_DNP_ANIM_CUTSCENE_HURRY) || (this->animIndex == EN_DNP_ANIM_RUN)) { if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_TURN); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } } else if ((this->animIndex == EN_DNP_ANIM_GLARE_START) || (this->animIndex == EN_DNP_ANIM_TURN_AROUND)) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_TURN); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_TURN); } } else if (this->animIndex == EN_DNP_ANIM_GREETING) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_GREET); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_GREET2); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } } else if (this->animIndex == EN_DNP_ANIM_BOW) { if (Animation_OnFrame(&this->skelAnime, 9.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_GREET); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET); } if (Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_GREET2); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } } else if ((this->animIndex == EN_DNP_ANIM_UNUSED_WALK) && (this->animIndex == EN_DNP_ANIM_WALK)) { + //! @bug: Impossible to reach, && should be an || if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } } else if (this->animIndex == EN_DNP_ANIM_JUMP) { if (Animation_OnFrame(&this->skelAnime, 17.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } } else if (this->animIndex == EN_DNP_ANIM_BOUNCE_LOOP) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKUHIME_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } } @@ -217,7 +218,8 @@ s32 func_80B3CDA4(EnDnp* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp3C, &sp30); //! FAKE - if (1) {}; + if (1) {} + Math_SmoothStepToS(&this->unk_330, pitch, 3, 0x2AA8, 0x1); return 1; @@ -311,7 +313,7 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { } if (this->animIndex == EN_DNP_ANIM_ANGRY_START) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_DHVO04); + Actor_PlaySfx(&this->actor, NA_SE_VO_DHVO04); } if (this->animIndex == EN_DNP_ANIM_GLARE_START) { @@ -370,7 +372,7 @@ void func_80B3D3F8(EnDnp* this, PlayState* play) { } void func_80B3D47C(EnDnp* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.scale.x, 0.0085f, 0.1f, 0.01f, 0.001f); if ((s32)(this->actor.scale.x * 10000.0f) >= 85) { this->actor.flags |= ACTOR_FLAG_1; @@ -459,7 +461,7 @@ void EnDnp_Update(Actor* thisx, PlayState* play) { sp2C = this->collider.dim.radius + 50; sp28 = this->collider.dim.height + 30; if ((this->unk_322 & 0x400) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { - Actor_PickUp(&this->actor, play, GI_MAX, sp2C, sp28); + Actor_OfferGetItem(&this->actor, play, GI_MAX, sp2C, sp28); } func_8013C964(&this->actor, play, sp2C, sp28, PLAYER_IA_NONE, this->unk_322 & 7); Actor_SetFocus(&this->actor, 30.0f); diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 4b1087311..131a27d74 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -403,7 +403,7 @@ void func_80A53038(EnDnq* this, PlayState* play) { } if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_KINGNUTS_DAMAGE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_KINGNUTS_DAMAGE); } if (((this->unk_398 == 3) || (this->unk_398 == 6)) && diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index a8a94d9a4..d21448217 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -92,7 +92,7 @@ void func_8092C5C0(EnDns* this) { if (((this->animIndex == EN_DNS_ANIM_WALK_1) || (this->animIndex == EN_DNS_ANIM_WALK_2) || (this->animIndex == EN_DNS_ANIM_RUN_START) || (this->animIndex == EN_DNS_ANIM_RUN_LOOP)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 3.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } } @@ -272,7 +272,8 @@ s32 func_8092CC68(PlayState* play) { s32 ret = false; s16 bgId; - if (!Play_InCsMode(play) && (player->actor.bgCheckFlags & 1) && (player->transformation != PLAYER_FORM_DEKU)) { + if (!Play_InCsMode(play) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (player->transformation != PLAYER_FORM_DEKU)) { bgId = player->actor.floorBgId; if (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, bgId) != 4) { ret = true; @@ -315,7 +316,7 @@ s32 func_8092CE38(EnDns* this) { this->unk_2C6 &= ~0x200; this->skelAnime.curFrame = 0.0f; if (this->unk_2D2 == 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_JUMP); } this->unk_2D2++; if (this->unk_2D2 >= 3) { @@ -328,7 +329,7 @@ s32 func_8092CE38(EnDns* this) { this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y); this->unk_2E4 = 0.0f; this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_JUMP); } else if (this->skelAnime.curFrame < 13.0f) { frame = this->skelAnime.curFrame; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -339,7 +340,7 @@ s32 func_8092CE38(EnDns* this) { } else { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } if (this->skelAnime.curFrame > 7.0f) { diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index d1ec4ea70..52870a787 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -420,7 +420,7 @@ void func_80876CAC(EnDodongo* this) { this->drawDmgEffAlpha = 1.0f; this->timer = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_80876D28(EnDodongo* this, PlayState* play) { @@ -536,7 +536,7 @@ s32 func_80877278(EnDodongo* this, PlayState* play) { void func_808773C4(EnDodongo* this) { Animation_MorphToLoop(&this->skelAnime, &object_dodongo_Anim_004C20, -4.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->timer = Rand_S16Offset(30, 50); this->actionFunc = func_80877424; } @@ -556,7 +556,7 @@ void func_80877424(EnDodongo* this, PlayState* play) { void func_80877494(EnDodongo* this) { Animation_MorphToLoop(&this->skelAnime, &object_dodongo_Anim_008B1C, -4.0f); - this->actor.speedXZ = this->unk_334 * 1.5f; + this->actor.speed = this->unk_334 * 1.5f; this->timer = Rand_S16Offset(50, 70); this->actionFunc = func_80877500; } @@ -568,13 +568,13 @@ void func_80877500(EnDodongo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_WALK); sp30.x = this->collider1Elements[2].dim.worldSphere.center.x; sp30.y = this->collider1Elements[2].dim.worldSphere.center.y; sp30.z = this->collider1Elements[2].dim.worldSphere.center.z; func_80876930(this, play, &sp30); } else if (Animation_OnFrame(&this->skelAnime, 39.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_WALK); sp30.x = this->collider1Elements[1].dim.worldSphere.center.x; sp30.y = this->collider1Elements[1].dim.worldSphere.center.y; sp30.z = this->collider1Elements[1].dim.worldSphere.center.z; @@ -592,9 +592,10 @@ void func_80877500(EnDodongo* this, PlayState* play) { } } } else { - if ((Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 150.0f) || + if ((Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 150.0f) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { - Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x1F4); + Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x1F4); } this->timer--; @@ -615,7 +616,7 @@ void func_808777A8(EnDodongo* this) { Sphere16* sph; Animation_MorphToPlayOnce(&this->skelAnime, &object_dodongo_Anim_0028F0, -4.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; for (i = 0; i < ARRAY_COUNT(this->collider3Elements); i++) { sph = &this->collider3.elements[i].dim.worldSphere; @@ -640,7 +641,7 @@ void func_8087784C(EnDodongo* this, PlayState* play) { f32 temp_f12; if (Animation_OnFrame(&this->skelAnime, 24.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_CRY); } if (func_8087721C(this)) { @@ -695,7 +696,7 @@ void func_80877DE0(EnDodongo* this) { this->actor.flags |= ACTOR_FLAG_10; this->timer = 25; this->actionFunc = func_80877E60; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80877E60(EnDodongo* this, PlayState* play) { @@ -727,7 +728,7 @@ void func_80877E60(EnDodongo* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 28.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_EAT); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_EAT); if (this->actor.child != NULL) { Actor_Kill(this->actor.child); this->actor.child = NULL; @@ -750,14 +751,14 @@ void func_80877E60(EnDodongo* this, PlayState* play) { this->unk_334 * 10.0f, 10); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); if (this->actor.colChkInfo.health <= 4) { this->actor.colChkInfo.health = 0; Enemy_StartFinishingBlow(play, &this->actor); } else { this->actor.colChkInfo.health -= 4; } - Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 120, COLORFILTER_BUFFLAG_OPA, 8); } } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { this->timer--; @@ -809,7 +810,7 @@ void func_80878354(EnDodongo* this) { sp18 = &object_dodongo_Anim_003B14; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_TAIL); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_TAIL); Animation_PlayOnceSetSpeed(&this->skelAnime, sp18, 2.0f); this->timer = 0; this->collider1.base.atFlags |= AT_ON; @@ -848,7 +849,7 @@ void func_80878424(EnDodongo* this, PlayState* play) { void func_80878594(EnDodongo* this) { this->actionFunc = func_808785B0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_808785B0(EnDodongo* this, PlayState* play) { @@ -870,11 +871,11 @@ void func_808785B0(EnDodongo* this, PlayState* play) { void func_8087864C(EnDodongo* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_dodongo_Anim_001A44, -4.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_DAMAGE); this->timer = 0; this->unk_304 = 0; - this->actor.speedXZ = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + this->actor.speed = 0.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->actionFunc = func_808786C8; } @@ -892,10 +893,10 @@ void func_80878724(EnDodongo* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_dodongo_Anim_0013C4, -8.0f); this->timer = 0; this->unk_304 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_J_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + this->actor.speed = 0.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->actionFunc = func_808787B0; } @@ -907,7 +908,7 @@ void func_808787B0(EnDodongo* this, PlayState* play) { func_80876DC4(this, play); } } else if (this->actor.colorFilterTimer == 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 4); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 120, COLORFILTER_BUFFLAG_OPA, 4); } if (SkelAnime_Update(&this->skelAnime)) { @@ -920,7 +921,7 @@ void func_808787B0(EnDodongo* this, PlayState* play) { this->timer = 8; } } else if (Animation_OnFrame(&this->skelAnime, 52.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } if (this->timer != 0) { @@ -993,13 +994,13 @@ void EnDodongo_UpdateDamage(EnDodongo* this, PlayState* play) { } } else if (this->actor.colChkInfo.damageEffect == 1) { this->timer = 40; - Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_80878594(this); } else if (this->actor.colChkInfo.damageEffect == 5) { this->timer = 40; - Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 2.0f; @@ -1024,8 +1025,8 @@ void EnDodongo_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); - if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 3d7e79a3d..478f071b3 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -457,7 +457,7 @@ void func_80866A5C(EnDoor* this, PlayState* play) { this->unk_1A6 = 10; } } else if ((this->unk_1A4 == 4) && - (Actor_XZDistanceBetweenActors(&this->dyna.actor, &GET_PLAYER(play)->actor) > 120.0f)) { + (Actor_WorldDistXZToActor(&this->dyna.actor, &GET_PLAYER(play)->actor) > 120.0f)) { this->actionFunc = func_8086704C; this->dyna.actor.world.rot.y = -0x1800; } @@ -467,12 +467,6 @@ void func_80866A5C(EnDoor* this, PlayState* play) { void func_80866B20(EnDoor* this, PlayState* play) { static s32 D_80867BC0; Player* player = GET_PLAYER(play); - Vec3f playerPosRelToDoor; - s16 temp_a2; - s16 yawDiff; - s32 temp_a1_2; - s32 temp_t0; - u8 temp_a1; if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state) && (this->dyna.actor.textId == 0x1821)) { D_80867BC0 = true; @@ -484,16 +478,19 @@ void func_80866B20(EnDoor* this, PlayState* play) { if (this->unk_1A6 != 0) { gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; Flags_SetSwitch(play, this->switchFlag); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } } else if (this->unk_1A7 != 0) { this->actionFunc = func_80866F94; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DOOR_OPEN); } else if (!Player_InCsMode(play)) { + Vec3f playerPosRelToDoor; + Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &playerPosRelToDoor, &player->actor.world.pos); if (D_80867BC0 || ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (fabsf(playerPosRelToDoor.z) < 50.0f))) { - yawDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; + s16 yawDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y; + if (playerPosRelToDoor.z > 0.0f) { yawDiff = (0x8000 - yawDiff); } @@ -512,15 +509,14 @@ void func_80866B20(EnDoor* this, PlayState* play) { player->doorType = PLAYER_DOORTYPE_TALKING; this->dyna.actor.textId = 0x1800; } else if ((this->unk_1A4 == 0) || (this->unk_1A4 == 2) || (this->unk_1A4 == 3)) { - s32 textIdOffset; + s32 halfDaysDayBit = (play->actorCtx.halfDaysBit & HALFDAYBIT_DAWNS) >> 1; + s32 halfDaysNightBit = play->actorCtx.halfDaysBit & HALFDAYBIT_NIGHTS; + s16 temp_a2 = D_801AED48[this->switchFlag & 7]; + s32 textIdOffset = (this->switchFlag >> 3) & 0xF; - temp_t0 = (play->actorCtx.unkC & 0x2AA) >> 1; - temp_a2 = D_801AED48[this->switchFlag & 7]; - temp_a1_2 = play->actorCtx.unkC & 0x155; - textIdOffset = (this->switchFlag >> 3) & 0xF; - if (((this->unk_1A4 == 0) && (((temp_t0 | temp_a1_2) & temp_a2) == 0)) || - ((this->unk_1A4 == 2) && ((temp_a2 & temp_a1_2) == 0)) || - ((this->unk_1A4 == 3) && ((temp_a2 & temp_t0) == 0))) { + if (((this->unk_1A4 == 0) && !((halfDaysDayBit | halfDaysNightBit) & temp_a2)) || + ((this->unk_1A4 == 2) && !(halfDaysNightBit & temp_a2)) || + ((this->unk_1A4 == 3) && !(halfDaysDayBit & temp_a2))) { s16 baseTextId = 0x182D; if (this->unk_1A4 == 3) { @@ -532,10 +528,10 @@ void func_80866B20(EnDoor* this, PlayState* play) { this->dyna.actor.textId = baseTextId + textIdOffset; } } else if ((this->unk_1A4 == 5) && (playerPosRelToDoor.z > 0.0f)) { - ScheduleOutput sp30; + ScheduleOutput scheduleOutput; - if (Schedule_RunScript(play, D_8086778C[this->switchFlag], &sp30)) { - this->dyna.actor.textId = sp30.result + 0x1800; + if (Schedule_RunScript(play, D_8086778C[this->switchFlag], &scheduleOutput)) { + this->dyna.actor.textId = scheduleOutput.result + 0x1800; player->doorType = ((this->dyna.actor.textId == 0x1821) && D_80867BC0) ? PLAYER_DOORTYPE_PROXIMITY @@ -545,7 +541,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { func_80122F28(player); } } else if ((this->unk_1A4 == 4) && (this->dyna.actor.xzDistToPlayer > 240.0f)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DOOR_OPEN); this->actionFunc = func_80867080; } } @@ -566,7 +562,7 @@ void func_80866F94(EnDoor* this, PlayState* play) { } else { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, 0, 0x7D0)) { this->actionFunc = func_80866B20; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_AUTO_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_AUTO_DOOR_CLOSE); } } } @@ -587,7 +583,7 @@ void func_80867080(EnDoor* this, PlayState* play) { void func_808670F0(EnDoor* this, PlayState* play) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, 0, 0x700)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE); this->actionFunc = func_80866B20; } } @@ -601,7 +597,7 @@ void func_80867144(EnDoor* this, PlayState* play) { this->actionFunc = func_80866B20; this->unk_1A1 = 0; } else if (Animation_OnFrame(&this->skelAnime, sAnimOpenFrames[this->animIndex])) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_OC_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_OC_DOOR_OPEN); if (this->skelAnime.playSpeed < 1.5f) { numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; for (i = 0; i < numEffects; i++) { @@ -609,7 +605,7 @@ void func_80867144(EnDoor* this, PlayState* play) { } } } else if (Animation_OnFrame(&this->skelAnime, sAnimCloseFrames[this->animIndex])) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE); } } } diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index 18917926a..13c467613 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -244,7 +244,7 @@ void EnDragon_Init(Actor* thisx, PlayState* play) { this->action = DEEP_PYTHON_ACTION_IDLE; this->actor.hintId = TATL_HINT_ID_DEEP_PYTHON; this->scale = 0.5f; - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; EnDragon_SetupRetreatOrIdle(this); } @@ -345,9 +345,9 @@ void EnDragon_RetreatOrIdle(EnDragon* this, PlayState* play) { EnDragon_SetupExtend(this); } else if ((this->timer != 0) && (fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 101.0f) && (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 101.0f)) { - this->actor.speedXZ = -100.0f; + this->actor.speed = -100.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 4.0f) && (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 4.0f)) { @@ -362,7 +362,7 @@ void EnDragon_RetreatOrIdle(EnDragon* this, PlayState* play) { void EnDragon_SetupExtend(EnDragon* this) { this->state = 0; this->behindJawRetreatTimer = this->state; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_APPEAR_TRG); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_APPEAR_TRG); this->retreatTimer = 250; this->actionFunc = EnDragon_Extend; } @@ -375,25 +375,25 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { EnDragon_SpawnBubbles(this, play, this->jawPos); if (this->action >= DEEP_PYTHON_ACTION_DAMAGE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BACK); EnDragon_SetupRetreatOrIdle(this); } else if (this->retreatTimer == 0) { this->action = DEEP_PYTHON_ACTION_RETREAT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BACK); EnDragon_SetupRetreatOrIdle(this); } else if (this->state == DEEP_PYTHON_EXTEND_STATE_NOT_FULLY_EXTENDED) { Vec3f extendedPos; Math_Vec3f_Copy(&extendedPos, &this->burrowEntrancePos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_APPEAR - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_APPEAR - SFX_FLAG); extendedPos.x += Math_SinS(this->actor.world.rot.y) * -530.0f; extendedPos.z += Math_CosS(this->actor.world.rot.y) * -530.0f; - this->actor.speedXZ = 40.0f; + this->actor.speed = 40.0f; Math_SmoothStepToS(&this->jawZRotation, 0xFA0, 5, 0xBB8, 0x14); if ((fabsf(this->actor.world.pos.x - extendedPos.x) < 51.0f) && (fabsf(this->actor.world.pos.z - extendedPos.z) < 51.0f)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_ApproachF(&this->actor.world.pos.x, extendedPos.x, 0.3f, 50.0f); Math_ApproachF(&this->actor.world.pos.z, extendedPos.z, 0.3f, 50.0f); if ((fabsf(this->actor.world.pos.x - extendedPos.x) < 4.0f) && @@ -439,7 +439,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { this->behindJawRetreatTimer++; if (this->behindJawRetreatTimer > 60) { this->action = DEEP_PYTHON_ACTION_RETREAT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BACK); EnDragon_SetupRetreatOrIdle(this); } } @@ -513,7 +513,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { pos.z += Math_CosS(this->actor.world.rot.y) * -930.0f; Math_Vec3f_Copy(&this->actor.world.pos, &pos); this->jawZRotation = 0x1450; - this->actor.speedXZ = 60.0f; + this->actor.speed = 60.0f; } this->grabTimer++; @@ -543,7 +543,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { player->actor.parent = &this->actor; player->unk_AE8 = 50; this->action = DEEP_PYTHON_ACTION_GRAB; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_EAT); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_EAT); EnDragon_SetupAttack(this); } } @@ -572,8 +572,8 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the skelAnime - func_800B8E58((Player*)this, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BITE); + Player_PlaySfx((Player*)&this->actor, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BITE); CollisionCheck_GreenBlood(play, NULL, &player->actor.world.pos); } @@ -603,7 +603,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, pos.z, 0.3f, 200.0f); if ((this->state <= DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BITE); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_BITE); if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } @@ -655,7 +655,7 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { if ((this->timer != 0) && (fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 121.0f) && (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 121.0f)) { - this->actor.speedXZ = -120.0f; + this->actor.speed = -120.0f; if (((this->pythonIndex & 1) == 0) && (Rand_ZeroOne() < 0.5f)) { //! @bug: !play->gameplayFrames is 0 essentially all the time, so this code never runs. if (((!play->gameplayFrames) & 0x1F)) { @@ -667,7 +667,7 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { return; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 20.0f) && (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 20.0f)) { Math_ApproachF(&this->actor.world.pos.x, this->actor.home.pos.x, 0.3f, 300.0f); @@ -683,7 +683,7 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { seahorsePos.z += (Math_CosS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.cutscene, - this->actor.unk20, NULL)) { + this->actor.halfDaysBits, NULL)) { SET_WEEKEVENTREG(WEEKEVENTREG_13_01); switch (this->pythonIndex) { case 0: @@ -735,14 +735,14 @@ void EnDragon_UpdateDamage(EnDragon* this, PlayState* play) { (this->collider.elements[6].info.bumperFlags & BUMP_HIT) || (this->collider.elements[7].info.bumperFlags & BUMP_HIT)) { Actor_ApplyDamage(&this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); if (this->actor.colChkInfo.health > 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_DAMAGE); this->action = DEEP_PYTHON_ACTION_DAMAGE; } else { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_DEAD); - this->actor.flags |= ACTOR_FLAG_8000000; + Actor_PlaySfx(&this->actor, NA_SE_EN_UTSUBO_DEAD); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_100000; this->action = DEEP_PYTHON_ACTION_SETUP_DEAD; @@ -754,7 +754,7 @@ void EnDragon_UpdateDamage(EnDragon* this, PlayState* play) { if ((this->action == DEEP_PYTHON_ACTION_EXTEND) && (this->grabWaitTimer == 0) && (player->invincibilityTimer == 0) && (this->collider.elements[0].info.ocElemFlags & OCELEM_HIT) && (!(func_800B64FC(play, 1000.0f, &this->actor.world.pos, &sp30) >= 0.0f) || (sp30 != 1))) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->action = DEEP_PYTHON_ACTION_GRAB; this->actor.flags |= ACTOR_FLAG_100000; this->actionFunc = EnDragon_SetupGrab; diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index dfd97196a..b25e4eb47 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -80,7 +80,7 @@ void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = THIS; DECR(this->unk14C); - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c index de26515fa..509e4fa9a 100644 --- a/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c +++ b/src/overlays/actors/ovl_En_Egblock/z_en_egblock.c @@ -7,7 +7,7 @@ #include "z_en_egblock.h" #include "objects/object_eg/object_eg.h" -#define FLAGS (ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnEgblock*)thisx) diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index f115ada7c..21ce6d52e 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -331,7 +331,7 @@ void EnEgol_FootstepEffects(EnEgol* this, PlayState* play, f32 leftFootFrame, f3 s32 quakeSize; s32 pad; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_WALK); quakeSize = 4 - (s32)(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) * 0.02f); if (quakeSize > 4) { quakeSize = 4; @@ -384,7 +384,7 @@ void EnEgol_DestroyBlocks(EnEgol* this, PlayState* play, Vec3f pos1, Vec3f pos2) dist2 = sqrtf(SQ(blockTo2.y)); if ((dist1 < 40.0f) || (dist2 < 40.0f)) { prop->colChkInfo.health = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_WALL_BROKEN); break; } } @@ -476,7 +476,7 @@ void EnEgol_Destroy(Actor* thisx, PlayState* play) { } void EnEgol_SetupWait(EnEgol* this) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->action = EYEGORE_ACTION_WAIT; this->actionFunc = EnEgol_Wait; } @@ -493,9 +493,9 @@ void EnEgol_Wait(EnEgol* this, PlayState* play) { void EnEgol_SetupStand(EnEgol* this) { EnEgol_ChangeAnim(this, EYEGORE_ANIM_STAND); - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->action = EYEGORE_ACTION_STAND; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_STAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_STAND); this->actionFunc = EnEgol_Stand; } @@ -741,7 +741,7 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { this->laserCount++; } } else if (this->laserState >= EYEGORE_LASER_FIRE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_BEAM - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_BEAM - SFX_FLAG); if (this->laserState != EYEGORE_LASER_OFF) { EnEgol_DestroyBlocks(this, play, this->laserCollider.dim.quad[0], this->laserCollider.dim.quad[1]); } @@ -782,7 +782,7 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { if (player->stateFlags3 != PLAYER_STATE3_1000000) { func_800BC848(&this->actor, play, quakeSize, 2); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); func_800B31BC(play, &hitPos, 40, -2, 255, 20); func_800BBFB0(play, &hitPos, 6.0f, 2, 120, 20, true); @@ -855,7 +855,7 @@ void EnEgol_Stop(EnEgol* this, PlayState* play) { this->isRetreating ^= true; if (!this->isRetreating) { EnEgol_ChangeAnim(this, EYEGORE_ANIM_SIT); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_SIT); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_SIT); this->laserCount = 0; this->actionFunc = EnEgol_Wait; } else { @@ -882,7 +882,7 @@ void EnEgol_Slam(EnEgol* this, PlayState* play) { f32 dyToPlayer = fabsf(player->actor.world.pos.y - this->actor.world.pos.y); s32 quakeSize; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); quakeSize = 4 - (s32)(dyToPlayer * 0.02f); if (quakeSize > 4) { quakeSize = 4; @@ -1033,8 +1033,8 @@ void EnEgol_Damaged(EnEgol* this, PlayState* play) { EnEgol_SetupWalk(this); } else { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEAD); - this->actor.flags |= ACTOR_FLAG_8000000; + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEAD); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_100000; this->actionFunc = EnEgol_StartDeathCutscene; @@ -1079,7 +1079,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { Actor_Kill(&this->actor); } else { if (Animation_OnFrame(&this->skelAnime, 46.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); func_800BC848(&this->actor, play, 10, 5); } if ((curFrame >= this->animEndFrame) && (this->action != EYEGORE_ACTION_DEAD)) { @@ -1088,7 +1088,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); this->waitTimer = 30; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); this->action = EYEGORE_ACTION_DEAD; for (i = 0; i < 20; i++) { EnEgol_SpawnEffect(this, &this->actor.world.pos, &gZeroVec3s, 10.0f + Rand_ZeroFloat(20.0f), @@ -1145,8 +1145,9 @@ void EnEgol_CollisionCheck(EnEgol* this, PlayState* play) { Math_Vec3f_Copy(&this->laserCollider.dim.quad[3], &this->laserBase); Math_Vec3f_Copy(&this->laserCollider.dim.quad[0], &this->laserBase); Math_Vec3f_Copy(&this->laserCollider.dim.quad[2], &this->laserBase); - Actor_SetColorFilter(&this->actor, 0, 120, false, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, + 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); EnEgol_SetupStunned(this); } } @@ -1167,8 +1168,8 @@ void EnEgol_CollisionCheck(EnEgol* this, PlayState* play) { CollisionCheck_BlueBlood(play, NULL, &this->eyePos); CollisionCheck_BlueBlood(play, NULL, &this->eyePos); CollisionCheck_BlueBlood(play, NULL, &this->eyePos); - Actor_SetColorFilter(&this->actor, 0x4000, 255, false, 25); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); EnEgol_SetupDamaged(this); } else if (reaction == EYEGORE_HIT_IMMUNE) { Vec3f hitPos; @@ -1176,7 +1177,7 @@ void EnEgol_CollisionCheck(EnEgol* this, PlayState* play) { hitPos.x = this->eyeCollider.elements[0].info.bumper.hitPos.x; hitPos.y = this->eyeCollider.elements[0].info.bumper.hitPos.y; hitPos.z = this->eyeCollider.elements[0].info.bumper.hitPos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_BOUND); EffectSsHitmark_SpawnFixedScale(play, EFFECT_HITMARK_METAL, &hitPos); CollisionCheck_SpawnShieldParticlesMetal(play, &hitPos); } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 54d5c3210..13075fd55 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -233,7 +233,7 @@ void func_8088C9CC(EnElf* this, PlayState* play) { this->unk_244 = 2; this->unk_248 = 0x400; this->unk_254 = 2.0f; - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; this->unk_26C = func_8088C920; this->unk_25C = (s32)Rand_ZeroFloat(8.0f) + 4; } else { @@ -558,9 +558,9 @@ void func_8088D9BC(EnElf* this, PlayState* play) { Vec3f* vec = &this->unk_224; if (this->fairyFlags & 0x4000) { - Math_SmoothStepToF(&this->actor.speedXZ, 5.0f, 0.5f, 1.0f, 0.01f); + Math_SmoothStepToF(&this->actor.speed, 5.0f, 0.5f, 1.0f, 0.01f); } else { - Math_SmoothStepToF(&this->actor.speedXZ, this->unk_254, 0.2f, 0.5f, 0.01f); + Math_SmoothStepToF(&this->actor.speed, this->unk_254, 0.2f, 0.5f, 0.01f); } switch (this->unk_244) { @@ -606,7 +606,7 @@ void func_8088DB4C(EnElf* this, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { xzVelocity = sqrtf(SQ(xVelTarget) + SQ(zVelTarget)); clampedXZ = CLAMP(xzVelocity, arg2, arg3); - this->actor.speedXZ = clampedXZ; + this->actor.speed = clampedXZ; if ((xzVelocity != clampedXZ) && (xzVelocity != 0.0f)) { xzVelocity = clampedXZ / xzVelocity; @@ -700,7 +700,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { } if (this->fairyFlags & 0x2000) { - Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 60.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 60.0f); } } @@ -768,7 +768,7 @@ void func_8088E0F0(EnElf* this, PlayState* play) { this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); func_8088F5F4(this, play, 32); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } void func_8088E304(EnElf* this, PlayState* play) { @@ -802,7 +802,7 @@ void func_8088E304(EnElf* this, PlayState* play) { func_8088D7F8(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); func_8088F5F4(this, play, 0x20); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } void func_8088E484(EnElf* this, PlayState* play) { @@ -827,7 +827,7 @@ void func_8088E484(EnElf* this, PlayState* play) { Actor_SetScale(&this->actor, (1.0f - (SQ(this->unk_250) * SQ(1.0f / 9.0f))) * 0.008f); this->unk_258 = Math_Atan2S_XY(this->actor.velocity.z, this->actor.velocity.x); func_8088F5F4(this, play, 32); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } void func_8088E5A8(EnElf* this, PlayState* play) { @@ -906,12 +906,12 @@ void func_8088E850(EnElf* this, PlayState* play) { if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0) && ((play->csCtx.frames == 149) || (play->csCtx.frames == 381) || (play->csCtx.frames == 591))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } if ((play->sceneId == SCENE_SECOM) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 4) && (play->csCtx.frames == 95)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } else { this->actor.shape.rot.x = 0; @@ -976,7 +976,7 @@ void func_8088E850(EnElf* this, PlayState* play) { if (arrowPointedActor != NULL) { func_8088DB4C(this, &nextPos, 0.0f, 30.0f, 0.2f); - if (this->actor.speedXZ >= 5.0f) { + if (this->actor.speed >= 5.0f) { func_8088F5F4(this, play, 0x10); } } else { @@ -994,7 +994,7 @@ void func_8088E850(EnElf* this, PlayState* play) { if (distFromLinksHead > 100.0f) { this->fairyFlags |= 2; if (this->unk_269 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); } this->unk_25C = 100; } @@ -1064,7 +1064,7 @@ void func_8088EFA4(EnElf* this, PlayState* play) { this->unk_268 = 0; this->unk_238 = 1.0f; if (!this->unk_269) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); } } else if (this->unk_268 == 0) { if ((arrayPointerActor == NULL) || @@ -1093,7 +1093,7 @@ void func_8088EFA4(EnElf* this, PlayState* play) { u16 targetSfxId = this->unk_269 == 0 ? NA_SE_PL_WALK_GROUND - SFX_FLAG : NA_SE_PL_WALK_GROUND - SFX_FLAG; if (!temp) { - Actor_PlaySfxAtPos(&this->actor, targetSfxId); + Actor_PlaySfx(&this->actor, targetSfxId); } this->fairyFlags |= 1; } @@ -1149,7 +1149,7 @@ void func_8088F214(EnElf* this, PlayState* play) { sp34 = 0; } else if (!(player->stateFlags1 & PLAYER_STATE1_40)) { if (this->unk_269 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_NAVY_VANISH); + Actor_PlaySfx(&this->actor, NA_SE_EV_NAVY_VANISH); } sp34 = 5; } else { @@ -1198,7 +1198,7 @@ void func_8088F214(EnElf* this, PlayState* play) { if (!(player->stateFlags2 & PLAYER_STATE2_100000)) { sp34 = 5; if (this->unk_269 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_NAVY_VANISH); + Actor_PlaySfx(&this->actor, NA_SE_EV_NAVY_VANISH); } } break; @@ -1208,7 +1208,7 @@ void func_8088F214(EnElf* this, PlayState* play) { sp34 = 9; this->unk_25C = 0x2A; if (this->unk_269 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); + Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); } } else if (player->stateFlags1 & PLAYER_STATE1_40) { player->stateFlags2 |= PLAYER_STATE2_100000; @@ -1299,7 +1299,7 @@ void func_8088FA38(EnElf* this, PlayState* play) { refPos = this->actor.focus.pos; func_8088DB4C(this, &refPos, 0, 30.0f, 0.2f); - if (this->actor.speedXZ >= 5.0f) { + if (this->actor.speed >= 5.0f) { func_8088F5F4(this, play, 0x10); } @@ -1376,11 +1376,11 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(play, play->msgCtx.currentTextId - 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId - 1); break; case 1: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; } } @@ -1390,7 +1390,7 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x240: - func_80151938(play, 0x245); + Message_ContinueTextbox(play, 0x245); break; case 0x21D: @@ -1407,28 +1407,28 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { case 0x244: switch (CURRENT_DAY) { case 1: - func_80151938(play, 0x246); + Message_ContinueTextbox(play, 0x246); break; case 2: - func_80151938(play, 0x247); + Message_ContinueTextbox(play, 0x247); break; case 3: if (!gSaveContext.save.isNight) { - func_80151938(play, 0x248); + Message_ContinueTextbox(play, 0x248); } else if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20)) { - func_80151938(play, 0x225); + Message_ContinueTextbox(play, 0x225); } else { - func_80151938(play, 0x249); + Message_ContinueTextbox(play, 0x249); } break; } break; default: - func_801477B4(play); + Message_CloseTextbox(play); func_8088FDCC(this); break; } @@ -1482,7 +1482,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { thisx->update = func_8088FE64; func_8088C51C(this, 3); if (this->elfMsg != NULL) { - this->elfMsg->flags |= ACTOR_FLAG_100; + this->elfMsg->flags |= ACTOR_FLAG_TALK_REQUESTED; thisx->cutscene = this->elfMsg->cutscene; if (thisx->cutscene != -1) { func_8088FD04(this); diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index 169d56fdd..2189bba99 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -486,7 +486,7 @@ void func_80A3A610(EnElfgrp* this, PlayState* play) { if (this->unk_144 > 0) { player->actor.freezeTimer = 100; player->stateFlags1 |= PLAYER_STATE1_20000000; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_GROUP_HEAL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_GROUP_HEAL - SFX_FLAG); } else { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_20000000; @@ -579,7 +579,7 @@ void EnElfgrp_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->unk_14A & 8) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_GROUP_FRY - SFX_FLAG); } if (this->unk_144 != 0) { diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 803a66ac4..65cc04d84 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { }; void EnElforg_InitializeParams(EnElforg* this) { - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->targetSpeedXZ = 1.0f; this->actor.velocity.y = 0.0f; this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x10000); @@ -189,22 +189,22 @@ void EnElforg_SpawnSparkles(EnElforg* this, PlayState* play, s32 life) { void EnElforg_ApproachTargetYPosition(EnElforg* this, Vec3f* targetPos) { f32 yDifference = targetPos->y - this->actor.world.pos.y; - if (fabsf(yDifference) < this->actor.speedXZ) { + if (fabsf(yDifference) < this->actor.speed) { this->actor.world.pos.y = targetPos->y; } else if (yDifference > 0.0f) { - this->actor.world.pos.y += this->actor.speedXZ; + this->actor.world.pos.y += this->actor.speed; } else { - this->actor.world.pos.y -= this->actor.speedXZ; + this->actor.world.pos.y -= this->actor.speed; } } void EnElforg_ApproachTargetSpeedXZ(EnElforg* this) { - if (this->actor.speedXZ > this->targetSpeedXZ) { - this->actor.speedXZ *= 0.9f; - } else if (this->actor.speedXZ < (this->targetSpeedXZ - 0.1f)) { - this->actor.speedXZ += 0.1f; + if (this->actor.speed > this->targetSpeedXZ) { + this->actor.speed *= 0.9f; + } else if (this->actor.speed < (this->targetSpeedXZ - 0.1f)) { + this->actor.speed += 0.1f; } else { - this->actor.speedXZ = this->targetSpeedXZ; + this->actor.speed = this->targetSpeedXZ; } } @@ -292,7 +292,7 @@ void EnElforg_TurnInFairy(EnElforg* this, PlayState* play) { // flying towards the fountain's center. SkelAnime_Update(&this->skelAnime); this->actor.shape.yOffset *= 0.9f; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; EnElforg_ApproachTargetYPosition(this, &player->bodyPartsPos[PLAYER_BODYPART_WAIST]); xzDistToPlayer = this->actor.xzDistToPlayer; @@ -539,7 +539,7 @@ void EnElforg_TrappedByEnemy(EnElforg* this, PlayState* play) { EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloating; this->actor.draw = EnElforg_Draw; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHIBI_FAIRY_SAVED); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHIBI_FAIRY_SAVED); } else { // The enemy is still alive, so have the Stray Fairy // track the enemy in case it's moving around. @@ -573,7 +573,7 @@ void EnElforg_HiddenByCollider(EnElforg* this, PlayState* play) { this->actor.draw = EnElforg_Draw; this->actor.world.pos.y += 40.0f; this->actor.home.pos.y += 40.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHIBI_FAIRY_SAVED); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHIBI_FAIRY_SAVED); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 2e6a44b64..a39a03567 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -6,7 +6,7 @@ #include "z_en_encount1.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnEncount1*)thisx) diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 656ec7936..33a819b20 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -113,7 +113,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.targetMode = 6; this->dyna.actor.colChkInfo.health = 1; - this->scale = 0.1; + this->scale = 0.1f; this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor); if (this->switchFlag == 0x7F) { @@ -171,7 +171,7 @@ void EnEncount2_Popped(EnEncount2* this, PlayState* play) { EnEncount2_InitEffects(this, &curPos, 10); } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); this->deathTimer = 30; this->actionFunc = EnEncount2_Die; } diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c index 869d8681e..b2d172cfc 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c @@ -6,7 +6,7 @@ #include "z_en_encount3.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnEncount3*)thisx) diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c index 311668bfe..8d9a18cf1 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.c @@ -6,7 +6,7 @@ #include "z_en_encount4.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnEncount4*)thisx) diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index 6cdf54d70..1786380ac 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -71,13 +71,13 @@ void EnEndingHero_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -static TexturePtr D_80C1E970[] = { - object_dt_Tex_007350, object_dt_Tex_009590, object_dt_Tex_009F90, object_dt_Tex_00A790, object_dt_Tex_00AB90, +static TexturePtr sEyeTextures[] = { + gDotourEyeShockTex, gDotourEyeOpenTex, gDotourEyeClosedTex, gDotourEyeLookDownTex, gDotourEyeSquintTex, }; -static TexturePtr D_80C1E984[] = { - object_dt_Tex_007750, - object_dt_Tex_00A390, - object_dt_Tex_00A490, +static TexturePtr sEyebrowTextures[] = { + gDotourEyebrowHighTex, + gDotourEyebrowMidTex, + gDotourEyebrowLowTex, }; void EnEndingHero_Draw(Actor* thisx, PlayState* play) { @@ -88,13 +88,13 @@ void EnEndingHero_Draw(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1E970[this->unk242])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->unk242])); if (this->unk242 < 3) { index = this->unk242; } - gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1E984[index])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyebrowTextures[index])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index 8f19fe9f8..06f973265 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -121,9 +121,9 @@ void EnEndingHero6_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { - static TexturePtr D_80C24280[] = { object_dt_Tex_007350, object_dt_Tex_009590, object_dt_Tex_009F90, - object_dt_Tex_00A790, object_dt_Tex_00AB90 }; - static TexturePtr D_80C24294[] = { object_dt_Tex_007750, object_dt_Tex_00A390, object_dt_Tex_00A490 }; + static TexturePtr sEyeTextures[] = { gDotourEyeShockTex, gDotourEyeOpenTex, gDotourEyeClosedTex, + gDotourEyeLookDownTex, gDotourEyeSquintTex }; + static TexturePtr sEyebrowTextures[] = { gDotourEyebrowHighTex, gDotourEyebrowMidTex, gDotourEyebrowLowTex }; s32 pad; EnEndingHero6* this = THIS; s32 index = 0; @@ -156,13 +156,13 @@ void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { } if (this->npcIndex == 0) { - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C24280[this->eyeState])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); if (this->eyeState < 3) { index = this->eyeState; } - gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C24294[index])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyebrowTextures[index])); } SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c index c55ab5272..72ac311a7 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -71,12 +71,12 @@ void EnEstone_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.params == ENESTONE_TYPE_LARGE) { - this->actor.speedXZ = Rand_ZeroFloat(5.0f) + 2.0f; + this->actor.speed = Rand_ZeroFloat(5.0f) + 2.0f; this->scale = (Rand_ZeroFloat(1.0f) * 0.005f) + 0.005f; this->actor.velocity.y = Rand_ZeroFloat(10.0f) + 15.0f; this->actor.gravity = -2.0f; } else { - this->actor.speedXZ = Rand_ZeroFloat(3.0f) + 1.0f; + this->actor.speed = Rand_ZeroFloat(3.0f) + 1.0f; this->scale = (Rand_ZeroFloat(1.0f) * 0.003f) + 0.003f; this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 7.0f; this->actor.gravity = -1.0f; @@ -121,8 +121,9 @@ void EnEstone_Active(EnEstone* this, PlayState* play) { Actor_Kill(&this->actor); return; } - if (((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) || (this->collider.base.atFlags & 4)) { - this->collider.base.atFlags &= ~4; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) || + (this->collider.base.atFlags & AT_BOUNCED)) { + this->collider.base.atFlags &= ~AT_BOUNCED; if (this->actor.params == ENESTONE_TYPE_LARGE) { for (i = 0; i < 2; i++) { accel.x = 2.0f * (Rand_ZeroOne() - 0.5f); @@ -139,11 +140,11 @@ void EnEstone_Active(EnEstone* this, PlayState* play) { velocity.y = this->actor.floorHeight; Actor_SpawnFloorDustRing(play, &this->actor, &velocity, 0.0f, 10, 6.0f, 50, 30, true); this->actor.velocity.y = this->actor.gravity = 0.0f; - this->actor.speedXZ *= 0.3f; + this->actor.speed *= 0.3f; this->actor.shape.shadowScale = 0.0f; this->inactive = true; this->timer = 50; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = EnEstone_Inactive; } else { //! FAKE: https://decomp.me/scratch/YiPVN diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index ea76ef074..b83799ea6 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -380,7 +380,7 @@ void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action) { case 3: if (this->eyeGlowIntensity == 0.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MOON_EYE_FLASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_EYE_FLASH); } this->eyeGlowIntensity += 1 / 30.0f; if (this->eyeGlowIntensity > 1.0f) { @@ -413,15 +413,15 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 0: switch (play->csCtx.frames) { case 1060: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MOON_SCREAM1); + Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM1); break; case 1089: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MOON_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_CRY); break; case 1303: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIP_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; } if (play->csCtx.frames >= 1145) { @@ -432,15 +432,15 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat case 1: switch (play->csCtx.frames) { case 561: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MOON_SCREAM1); + Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM1); break; case 590: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MOON_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_CRY); break; case 737: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SLIP_MOON); + Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; } if (play->csCtx.frames >= 650) { @@ -499,7 +499,7 @@ void EnFall_MoonsTear_Initialize(EnFall* this) { } this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); this->actor.world.rot.x = Math_Vec3f_Pitch(&this->actor.world.pos, &this->actor.home.pos); - this->actor.speedXZ = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos) / 82.0f; + this->actor.speed = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos) / 82.0f; this->actor.shape.rot.x = this->actor.world.rot.x; this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -516,8 +516,8 @@ void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play) { } if (this->actor.draw != NULL) { - if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, this->actor.speedXZ) <= 0.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_BOUND_1); + if (Math_Vec3f_StepTo(&this->actor.world.pos, &this->actor.home.pos, this->actor.speed) <= 0.0f) { + Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_BOUND_1); SET_WEEKEVENTREG(WEEKEVENTREG_74_80); SET_WEEKEVENTREG(WEEKEVENTREG_74_20); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TEST, this->actor.world.pos.x, @@ -575,7 +575,7 @@ void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 2)) { - play->skyboxCtx.rotY -= 0.05f; + play->skyboxCtx.rot.y -= 0.05f; } if (Cutscene_CheckActorAction(play, 450)) { @@ -702,7 +702,7 @@ void EnFall_FireRing_Update(Actor* thisx, PlayState* play) { if (Cutscene_CheckActorAction(play, 450) && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 450)]->action == 5) { if (!(this->flags & FLAG_FIRE_RING_APPEARS)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } this->flags |= FLAG_FIRE_RING_APPEARS; } @@ -798,7 +798,7 @@ void EnFall_LodMoon_DrawWithoutLerp(Actor* thisx, PlayState* play) { * to be 9000 units away before drawing it. */ void EnFall_LodMoon_DrawWithLerp(Actor* thisx, PlayState* play) { - f32 distanceToEye = Actor_DistanceToPoint(thisx, &play->view.eye); + f32 distanceToEye = Actor_WorldDistXYZToPoint(thisx, &play->view.eye); f32 scale; Vec3f translation; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 27dcabc23..932d937ee 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -273,7 +273,7 @@ void EnFamos_SetupDeathDebris(EnFamos* this) { s32 EnFamos_IsPlayerSeen(EnFamos* this, PlayState* play) { if ((Player_GetMask(play) != PLAYER_MASK_STONE) && - (Actor_XZDistanceToPoint(&GET_PLAYER(play)->actor, &this->calmPos) < this->aggroDistance) && + (Actor_WorldDistXZToPoint(&GET_PLAYER(play)->actor, &this->calmPos) < this->aggroDistance) && Actor_IsFacingPlayer(&this->actor, 0x5000)) { return true; } else { @@ -308,12 +308,12 @@ void EnFamos_UpdateFlipStatus(EnFamos* this) { if (this->hasFinishedRotating == true) { if (this->animatedMaterialIndex != FAMOS_ANIMATED_MAT_NORMAL) { this->animatedMaterialIndex = FAMOS_ANIMATED_MAT_NORMAL; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FAMOS_REVERSE2); + Actor_PlaySfx(&this->actor, NA_SE_EN_FAMOS_REVERSE2); } else { this->animatedMaterialIndex = FAMOS_ANIMATED_MAT_FLIPPED; this->flippedTimer = 100; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FAMOS_REVERSE1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FAMOS_REVERSE1); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DAMAGE); } this->hasFinishedRotating = false; } @@ -322,7 +322,7 @@ void EnFamos_UpdateFlipStatus(EnFamos* this) { this->flippedTimer--; if (this->flippedTimer == 0) { if (this->animatedMaterialIndex != FAMOS_ANIMATED_MAT_NORMAL) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FAMOS_REVERSE2); + Actor_PlaySfx(&this->actor, NA_SE_EN_FAMOS_REVERSE2); } this->animatedMaterialIndex = FAMOS_ANIMATED_MAT_NORMAL; @@ -347,7 +347,7 @@ void EnFamos_UpdateFlipStatus(EnFamos* this) { */ void EnFamos_SetupStillIdle(EnFamos* this) { this->actionFunc = EnFamos_StillIdle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_StillIdle(EnFamos* this, PlayState* play) { @@ -374,9 +374,9 @@ void EnFamos_SetupPathingIdle(EnFamos* this) { } Math_Vec3s_ToVec3f(&this->targetDest, &this->pathPoints[this->currentPathNode]); - this->targetYaw = Actor_YawToPoint(&this->actor, &this->targetDest); + this->targetYaw = Actor_WorldYawTowardPoint(&this->actor, &this->targetDest); this->actionFunc = EnFamos_PathingIdle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_PathingIdle(EnFamos* this, PlayState* play) { @@ -396,10 +396,10 @@ void EnFamos_PathingIdle(EnFamos* this, PlayState* play) { * Famos lost player; Turning to face back toward home. */ void EnFamos_SetupTurnHome(EnFamos* this) { - this->targetYaw = Actor_YawToPoint(&this->actor, &this->calmPos); + this->targetYaw = Actor_WorldYawTowardPoint(&this->actor, &this->calmPos); Math_Vec3f_Copy(&this->targetDest, &this->calmPos); this->actionFunc = EnFamos_TurnHome; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_TurnHome(EnFamos* this, PlayState* play) { @@ -416,14 +416,14 @@ void EnFamos_TurnHome(EnFamos* this, PlayState* play) { */ void EnFamos_SetupReturnHome(EnFamos* this) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->actor.world.rot.x = -Actor_PitchToPoint(&this->actor, &this->targetDest); + this->actor.world.rot.x = -Actor_WorldPitchTowardPoint(&this->actor, &this->targetDest); this->actionFunc = EnFamos_ReturnHome; } void EnFamos_ReturnHome(EnFamos* this, PlayState* play) { - f32 distanceToHome = Actor_XZDistanceToPoint(&this->actor, &this->targetDest); + f32 distanceToHome = Actor_WorldDistXZToPoint(&this->actor, &this->targetDest); - this->actor.shape.rot.y = Actor_YawToPoint(&this->actor, &this->targetDest); + this->actor.shape.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->targetDest); this->actor.world.rot.y = this->actor.shape.rot.y; EnFamos_UpdateBobbingHeight(this); if (this->isCalm) { @@ -439,9 +439,9 @@ void EnFamos_ReturnHome(EnFamos* this, PlayState* play) { EnFamos_SetupStillIdle(this); } } else if (distanceToHome < 40.0f) { - Math_StepToF(&this->actor.speedXZ, 0.5f, 0.3f); + Math_StepToF(&this->actor.speed, 0.5f, 0.3f); } else { - Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); + Math_StepToF(&this->actor.speed, 3.0f, 0.3f); } } @@ -451,7 +451,7 @@ void EnFamos_ReturnHome(EnFamos* this, PlayState* play) { void EnFamos_SetupAlert(EnFamos* this) { this->actor.world.rot.y = this->actor.shape.rot.y; this->stateTimer = 8; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->isCalm == true) { this->isCalm = false; @@ -497,8 +497,8 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { abovePlayerPos.x = player->actor.world.pos.x; abovePlayerPos.y = player->actor.world.pos.y + 100.0f; abovePlayerPos.z = player->actor.world.pos.z; - this->actor.world.rot.x = -Actor_PitchToPoint(&this->actor, &abovePlayerPos); - Math_StepToF(&this->actor.speedXZ, 6.0f, 0.5f); + this->actor.world.rot.x = -Actor_WorldPitchTowardPoint(&this->actor, &abovePlayerPos); + Math_StepToF(&this->actor.speed, 6.0f, 0.5f); surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough @@ -506,7 +506,7 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { EnFamos_SetupAttackAim(this); } else if ((Player_GetMask(play) == PLAYER_MASK_STONE) || - (this->aggroDistance < Actor_XZDistanceToPoint(&GET_PLAYER(play)->actor, &this->calmPos)) || + (this->aggroDistance < Actor_WorldDistXZToPoint(&GET_PLAYER(play)->actor, &this->calmPos)) || !Actor_IsFacingPlayer(&this->actor, 0x6000)) { EnFamos_SetupScanForPlayer(this); } @@ -514,8 +514,8 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { void EnFamos_SetupAttackAim(EnFamos* this) { Animation_PlayOnce(&this->skelAnime, &gFamosShakeAnim); - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AMOS_VOICE); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_AMOS_VOICE); this->actionFunc = EnFamos_AttackAim; } @@ -537,14 +537,14 @@ void EnFamos_Attack(EnFamos* this, PlayState* play) { s32 hitFloor; u32 surfaceType; - Math_StepToF(&this->actor.speedXZ, 20.0f, 2.0f); + Math_StepToF(&this->actor.speed, 20.0f, 2.0f); this->stateTimer--; if (this->stateTimer == 0) { this->emblemCollider.base.acFlags &= ~AC_ON; } surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - hitFloor = this->actor.bgCheckFlags & 1; + hitFloor = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; if (hitFloor || (this->actor.floorHeight == BGCHECK_Y_MIN) || (surfaceType == 0xC) || (surfaceType == 0xD)) { this->collider1.base.atFlags &= ~AT_ON; this->collider2.base.atFlags |= AT_ON; @@ -585,8 +585,8 @@ void EnFamos_SetupFinishAttack(EnFamos* this) { SkelAnime_Update(&this->skelAnime); this->emblemCollider.base.acFlags |= AC_ON; this->stateTimer = 3; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_EXPLOSION); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); this->actionFunc = EnFamos_FinishAttack; } @@ -604,12 +604,12 @@ void EnFamos_FinishAttack(EnFamos* this, PlayState* play) { void EnFamos_SetupAttackRebound(EnFamos* this) { this->actor.world.rot.x = 0x4000; this->actionFunc = EnFamos_AttackRebound; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_AttackRebound(EnFamos* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 5.0f, 0.3f); - if (this->actor.speedXZ > 1.0f) { + Math_StepToF(&this->actor.speed, 5.0f, 0.3f); + if (this->actor.speed > 1.0f) { if (ABS_ALT(this->flipRot) > 0x4000) { func_800B9010(&this->actor, NA_SE_EN_FAMOS_FLOAT_REVERSE - SFX_FLAG); } else { @@ -617,8 +617,8 @@ void EnFamos_AttackRebound(EnFamos* this, PlayState* play) { } } - if ((this->baseHeight < this->actor.world.pos.y) || (this->actor.bgCheckFlags & 0x10)) { // touching ceiling - this->actor.speedXZ = 0.0f; + if ((this->baseHeight < this->actor.world.pos.y) || (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { + this->actor.speed = 0.0f; EnFamos_SetupChase(this); } } @@ -629,7 +629,7 @@ void EnFamos_AttackRebound(EnFamos* this, PlayState* play) { void EnFamos_SetupScanForPlayer(EnFamos* this) { this->stateTimer = 60; this->actionFunc = EnFamos_ScanForPlayer; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_ScanForPlayer(EnFamos* this, PlayState* play) { @@ -651,11 +651,11 @@ void EnFamos_ScanForPlayer(EnFamos* this, PlayState* play) { void EnFamos_SetupDeathSlam(EnFamos* this) { this->emblemCollider.base.acFlags &= ~AC_ON; this->stateTimer = 20; - this->actor.speedXZ = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); + this->actor.speed = 0.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); this->flippedTimer = -1; this->actor.world.pos.y = this->actor.floorHeight - 60.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEAD); this->actionFunc = EnFamos_DeathSlam; } @@ -673,7 +673,7 @@ void EnFamos_DeathSlam(EnFamos* this, PlayState* play) { void EnFamos_SetupDeathExplosion(EnFamos* this) { this->actor.world.rot.x = 0x4000; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, false, 4); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 4); this->stateTimer = 25; Math_Vec3f_Copy(&this->targetDest, &this->actor.world.pos); this->actor.flags |= ACTOR_FLAG_10; @@ -681,9 +681,9 @@ void EnFamos_SetupDeathExplosion(EnFamos* this) { } void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); + Math_StepToF(&this->actor.speed, 3.0f, 0.3f); if (this->actor.colorFilterTimer == 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, false, 4); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 4); } this->actor.world.pos.x = randPlusMinusPoint5Scaled(5.0f) + this->targetDest.x; @@ -691,7 +691,7 @@ void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { if (this->stateTimer == 1) { EnBom* explosion = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, BOMB_TYPE_BODY); if (explosion != NULL) { explosion->timer = 0; // instant explosion } @@ -712,7 +712,7 @@ void EnFamos_SetupDeathFade(EnFamos* this) { this->actor.flags &= ~ACTOR_FLAG_1; this->actor.shape.shadowDraw = NULL; this->actionFunc = EnFamos_DeathFade; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnFamos_DeathFade(EnFamos* this, PlayState* play) { @@ -768,7 +768,7 @@ void EnFamos_Update(Actor* thisx, PlayState* play) { if (this->flippedTimer >= 0) { Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 80.0f, 0x1F); if ((this->actionFunc == EnFamos_Attack) && (this->animatedMaterialIndex != FAMOS_ANIMATED_MAT_NORMAL) && - (this->actor.bgCheckFlags & 1)) { // touch floor + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.pos.y -= 60.0f; } } diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 6a4c357d9..90f90cf74 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -178,7 +178,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { switch (EnFg_GetDamageEffect(this)) { case FG_DMGEFFECT_DEKUSTICK: this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_CRY_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_1); this->skelAnime.playSpeed = 0.0f; this->actor.shape.shadowDraw = NULL; this->actor.scale.x *= 1.5f; @@ -204,7 +204,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { break; case FG_DMGEFFECT_EXPLOSION: this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_CRY_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); if (1) {} this->actor.params = FG_BLACK; this->skelAnime.playSpeed = 0.0f; @@ -212,7 +212,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); this->actor.shape.rot = this->actor.world.rot; this->actor.velocity.y = 10.0f; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actor.gravity = -0.8f; this->bounceCounter = 1; this->timer = 0; @@ -220,7 +220,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { break; default: if (DECR(this->timer) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); EnFg_ChangeAnim(&this->skelAnime, 3); this->actor.velocity.y = 10.0f; this->timer = Rand_S16Offset(30, 30); @@ -255,7 +255,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { break; case FG_DMGEFFECT_EXPLOSION: this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_CRY_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_CRY_0); EnFg_ChangeAnim(&this->skelAnime, 0); this->actor.params = FG_BLACK; this->skelAnime.playSpeed = 0.0f; @@ -263,7 +263,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { this->actor.world.rot.y = Math_Vec3f_Yaw(&ac->world.pos, &this->actor.world.pos); this->actor.shape.rot = this->actor.world.rot; this->actor.velocity.y = 10.0f; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actor.gravity = -0.8f; this->bounceCounter = 1; this->timer = 0; @@ -275,7 +275,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { this->skelAnime.playSpeed = 0.0f; } - if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnFg_ChangeAnim(&this->skelAnime, 0); this->actionFunc = EnFg_Idle; this->actor.velocity.y = 0.0f; @@ -289,7 +289,7 @@ void EnFg_DoNothing(EnFg* this, PlayState* play) { } void EnFg_Knockback(EnFg* this, PlayState* play) { - if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->bounceCounter++; if (this->bounceCounter < 4) { this->actor.shape.rot.x += 0x1000; @@ -298,7 +298,7 @@ void EnFg_Knockback(EnFg* this, PlayState* play) { this->actionFunc = EnFg_DoNothing; } } else { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.wallYaw; this->actor.shape.rot = this->actor.world.rot; } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 5cdcd99fe..357887c97 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -140,7 +140,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (this->actor.params & KEESE_INVISIBLE) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; this->actor.params = KEESE_GET_MAIN_TYPE(thisx); this->isInvisible = true; } @@ -208,19 +208,20 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, PlayState* play) { return false; } - if (Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos) > 300.0f) { - distFromHome = Actor_DistanceToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 300.0f) { + distFromHome = Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos); if (distFromHome < 5.0f) { EnFirefly_SetupPerch(this); } else { if (distFromHome * 0.05f < 1.0f) { - this->actor.speedXZ *= distFromHome * 0.05f; + this->actor.speed *= distFromHome * 0.05f; } - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x300); Math_ScaledStepToS(&this->actor.shape.rot.x, - Actor_PitchToPoint(&this->actor, &this->actor.home.pos) + 0x1554, 0x100); + Actor_WorldPitchTowardPoint(&this->actor, &this->actor.home.pos) + 0x1554, 0x100); } return true; @@ -242,7 +243,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { while (findTorch != NULL) { if ((findTorch->actor.id == ACTOR_OBJ_SYOKUDAI) && (findTorch->snuffTimer != OBJ_SYOKUDAI_SNUFF_OUT)) { - currentDist = Actor_DistanceBetweenActors(&this->actor, &findTorch->actor); + currentDist = Actor_WorldDistXYZToActor(&this->actor, &findTorch->actor); if (currentDist < currentMinDist) { currentMinDist = currentDist; closestTorch = findTorch; @@ -256,12 +257,13 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { flamePos.y = closestTorch->actor.world.pos.y + 52.0f + 30.0f; flamePos.z = closestTorch->actor.world.pos.z; - if (Actor_DistanceToPoint(&this->actor, &flamePos) < 15.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &flamePos) < 15.0f) { EnFirefly_Ignite(this); } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, &closestTorch->actor), + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &closestTorch->actor), 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &flamePos) + 0x1554, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &flamePos) + 0x1554, + 0x100); } return true; @@ -272,8 +274,8 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { void EnFirefly_SetupFlyIdle(EnFirefly* this) { this->timer = Rand_S16Offset(70, 100); - this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300); + this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); this->pitchTarget = ((this->maxAltitude < this->actor.world.pos.y) ? 0xC00 : -0xC00) + 0x1554; this->skelAnime.playSpeed = 1.0f; this->actionFunc = EnFirefly_FlyIdle; @@ -289,15 +291,15 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { } isSkelAnimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); - this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; + this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; if (!EnFirefly_ReturnToPerch(this, play) && !EnFirefly_SeekTorch(this, play)) { if (isSkelAnimeUpdated) { rand = Rand_ZeroOne(); if (rand < 0.5f) { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), - 0x300); + Math_ScaledStepToS(&this->actor.shape.rot.y, + Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); } else if (rand < 0.8f) { this->actor.shape.rot.y += (s16)randPlusMinusPoint5Scaled(1536.0f); } @@ -315,9 +317,10 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { this->pitchTarget = 0x2154; } } else { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->pitchTarget = 0x954; - } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || + (this->maxAltitude < this->actor.world.pos.y)) { this->pitchTarget = 0x2154; } } @@ -325,7 +328,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } @@ -338,13 +341,13 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { this->timer = 40; this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &object_firefly_Anim_00017C, 0.0f, 6.0f, 6.0f, ANIMMODE_ONCE, 0.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); this->actor.flags |= ACTOR_FLAG_10; if (this->isInvisible) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0x2000, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_XLU, 40); } else { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); } if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_ICE) { @@ -370,7 +373,7 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { } if (this->actor.flags & ACTOR_FLAG_8000) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->actionFunc = EnFirefly_Fall; @@ -379,7 +382,7 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { // Fall to the ground after being hit void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.colorFilterTimer = 40; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (!(this->actor.flags & ACTOR_FLAG_8000)) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -387,7 +390,7 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.shape.rot.y -= 0x300; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { EnFirefly_SpawnIceEffects(this, play); EnFirefly_SetupDie(this); } @@ -396,7 +399,7 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { void EnFirefly_SetupDie(EnFirefly* this) { this->timer = 15; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnFirefly_Die; } @@ -432,9 +435,9 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { this->timer--; } - Math_StepToF(&this->actor.speedXZ, 4.0f, 0.5f); + Math_StepToF(&this->actor.speed, 4.0f, 0.5f); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } else if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { @@ -447,19 +450,19 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { preyPos.x = player->actor.world.pos.x; preyPos.y = player->actor.world.pos.y + 20.0f; preyPos.z = player->actor.world.pos.z; - Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &preyPos) + 0x1554, 2, 0x400, - 0x100); + Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &preyPos) + 0x1554, 2, + 0x400, 0x100); } else { this->skelAnime.playSpeed = 1.5f; if (this->actor.xzDistToPlayer > 80.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->pitchTarget = 0x954; } - if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { this->pitchTarget = 0x2154; } else { this->pitchTarget = 0x954; @@ -478,7 +481,7 @@ void EnFirefly_SetupRebound(EnFirefly* this) { this->actor.world.rot.x = 0x7000; this->timer = 18; this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 2.5f; + this->actor.speed = 2.5f; this->actionFunc = EnFirefly_Rebound; } @@ -487,7 +490,7 @@ 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); - if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.15f)) { + if (Math_StepToF(&this->actor.speed, 0.0f, 0.15f)) { if (this->timer != 0) { this->timer--; } @@ -519,20 +522,21 @@ void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { return; } - Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); + Math_StepToF(&this->actor.speed, 3.0f, 0.3f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->pitchTarget = 0x954; - } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { this->pitchTarget = 0x2154; } else { this->pitchTarget = 0x954; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x300); } Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); @@ -540,24 +544,24 @@ void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { void EnFirefly_SetupStunned(EnFirefly* this) { if (this->isInvisible) { - Actor_SetColorFilter(&this->actor, 0, 255, 0x2000, this->timer); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, this->timer); } else { - Actor_SetColorFilter(&this->actor, 0, 255, 0, this->timer); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, this->timer); } if (this->actionFunc != EnFirefly_Stunned) { this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->auraType = KEESE_AURA_NONE; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = EnFirefly_Stunned; } void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { if (this->timer != 0) { this->timer--; } @@ -583,7 +587,7 @@ void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { void EnFirefly_SetupPerch(EnFirefly* this) { this->timer = 1; this->actionFunc = EnFirefly_Perch; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } // When perching, sit on collision and flap at random intervals @@ -608,7 +612,7 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->actor.shape.rot.x = 0x1554; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->timer = 50; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actionFunc = EnFirefly_DisturbDiveAttack; } @@ -627,7 +631,8 @@ void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play) { preyPos.x = player->actor.world.pos.x; preyPos.y = player->actor.world.pos.y + 20.0f; preyPos.z = player->actor.world.pos.z; - Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &preyPos) + 0x1554, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &preyPos) + 0x1554, + 0x100); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x300); } @@ -672,7 +677,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_ATTACK); if (this->currentType != KEESE_NORMAL) { EnFirefly_Extinguish(this); @@ -712,7 +717,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { this->actor.world.rot.y = this->actor.shape.rot.y; if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_FLY); + Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_FLY); } } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 5f9bbb2da..2f54e4dcb 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -278,12 +278,12 @@ void func_8091DF68(Actor* thisx, PlayState* play) { EnFish* this = THIS; func_8091DD48(this); - Math_SmoothStepToF(&thisx->speedXZ, 0.0f, 0.05f, 0.3f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 0.0f, 0.05f, 0.3f, 0.0f); - if ((thisx->speedXZ * 1.4f) + 0.8f > 2.0f) { + if ((thisx->speed * 1.4f) + 0.8f > 2.0f) { this->skelAnime.playSpeed = 2.0f; } else { - this->skelAnime.playSpeed = (thisx->speedXZ * 1.4f) + 0.8f; + this->skelAnime.playSpeed = (thisx->speed * 1.4f) + 0.8f; } this->unk_270 >>= 1; @@ -327,7 +327,7 @@ void func_8091E128(Actor* thisx, PlayState* play) { EnFish* this = THIS; func_8091DD48(this); - Math_SmoothStepToF(&thisx->speedXZ, 1.8f, 0.08f, 0.4f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 1.8f, 0.08f, 0.4f, 0.0f); if ((func_8091D630(&thisx->world.pos, &thisx->home.pos) > SQ(80.0f)) || (this->unk_240 < 4)) { this->unk_270 = this->unk_264; @@ -342,10 +342,10 @@ void func_8091E128(Actor* thisx, PlayState* play) { this->unk_24C = 0.0f; } - if ((thisx->speedXZ * 1.5f) + 0.8f > 4.0f) { + if ((thisx->speed * 1.5f) + 0.8f > 4.0f) { this->skelAnime.playSpeed = 4.0f; } else { - this->skelAnime.playSpeed = (thisx->speedXZ * 1.5f) + 0.8f; + this->skelAnime.playSpeed = (thisx->speed * 1.5f) + 0.8f; } if (this->unk_240 <= 0) { @@ -378,7 +378,7 @@ void func_8091E34C(Actor* thisx, PlayState* play2) { s32 pad; func_8091DD48(this); - Math_SmoothStepToF(&thisx->speedXZ, 4.2f, 0.08f, 1.4f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 4.2f, 0.08f, 1.4f, 0.0f); if (func_8091D630(&thisx->world.pos, &thisx->home.pos) > SQ(160.0f)) { this->unk_270 = this->unk_264; @@ -418,10 +418,10 @@ void func_8091E34C(Actor* thisx, PlayState* play2) { this->unk_24C = 0.0f; } - if ((thisx->speedXZ * 1.5f) + 0.8f > 4.0f) { + if ((thisx->speed * 1.5f) + 0.8f > 4.0f) { this->skelAnime.playSpeed = 4.0f; } else { - this->skelAnime.playSpeed = (thisx->speedXZ * 1.5f) + 0.8f; + this->skelAnime.playSpeed = (thisx->speed * 1.5f) + 0.8f; } if ((this->unk_240 <= 0) || (!sp3C && (sp38 == 0))) { @@ -453,7 +453,7 @@ void func_8091E658(Actor* thisx, PlayState* play) { s16 sp32; func_8091DD48(this); - Math_SmoothStepToF(&thisx->speedXZ, 1.8f, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 1.8f, 0.1f, 0.5f, 0.0f); if (func_8091D630(&thisx->world.pos, &thisx->home.pos) > SQ(80.0f)) { this->unk_270 = this->unk_264; @@ -475,10 +475,10 @@ void func_8091E658(Actor* thisx, PlayState* play) { this->unk_24C = 1.2f; } - if ((thisx->speedXZ * 1.5f) + 0.8f > 4.0f) { + if ((thisx->speed * 1.5f) + 0.8f > 4.0f) { this->skelAnime.playSpeed = 4.0f; } else { - this->skelAnime.playSpeed = (thisx->speedXZ * 1.5f) + 0.8f; + this->skelAnime.playSpeed = (thisx->speed * 1.5f) + 0.8f; } if (this->unk_240 <= 0) { @@ -502,16 +502,16 @@ void func_8091E810(EnFish* this) { void func_8091E880(Actor* thisx, PlayState* play) { EnFish* this = THIS; - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.1f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.1f, 0.0f); this->unk_26E = 0x43; this->unk_272 = 0x43; this->unk_268 = 0x4000; this->unk_26C = -0x4000; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_240 = 400; func_8091E9A4(this); - } else if (this->actor.bgCheckFlags & 0x20) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); func_8091D840(thisx, play, 10, 15.0f); if (func_8091DA14(this, play)) { func_8091EF30(this); @@ -554,7 +554,7 @@ void func_8091E9A4(EnFish* this) { this->unk_248 = 5; this->unk_24C = 0.0f; if (sp24 && (this->actor.draw != NULL)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FISH_LEAP); + Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } } @@ -563,7 +563,7 @@ void func_8091EAF0(Actor* thisx, PlayState* play) { s32 sp40 = play->state.frames; s16 phi_v1; - Math_SmoothStepToF(&this->actor.speedXZ, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); phi_v1 = (s16)((((sp40 >> 5) & 2) | ((sp40 >> 2) & 1)) << 0xB) * 0.3f; if (sp40 & 4) { phi_v1 *= -1; @@ -592,13 +592,13 @@ void func_8091EAF0(Actor* thisx, PlayState* play) { } else { this->actor.draw = NULL; } - } else if (this->actor.bgCheckFlags & 0x20) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (func_8091DA14(this, play)) { func_8091EF30(this); } else { func_8091ECF4(this); } - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8091E9A4(this); } } @@ -625,12 +625,12 @@ void func_8091ED70(Actor* thisx, PlayState* play) { func_8091D840(thisx, play, 2, 25.0f); } - Math_SmoothStepToF(&thisx->speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 2.8f, 0.1f, 0.4f, 0.0f); - if ((thisx->bgCheckFlags & 8) || !(thisx->bgCheckFlags & 0x20)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) || !(thisx->bgCheckFlags & BGCHECKFLAG_WATER)) { sp2E = Math_Vec3f_Yaw(&thisx->world.pos, &thisx->home.pos); thisx->home.rot.y = Rand_S16Offset(-100, 100) + sp2E; - thisx->speedXZ *= 0.5f; + thisx->speed *= 0.5f; } this->unk_268 = 0; @@ -640,7 +640,7 @@ void func_8091ED70(Actor* thisx, PlayState* play) { this->unk_270 = 2000; this->unk_272 = 0x29B; - if (thisx->bgCheckFlags & 1) { + if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 4.0f, 2.0f); } else { Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 10.0f, 2.0f); @@ -651,10 +651,10 @@ void func_8091ED70(Actor* thisx, PlayState* play) { func_8091D728(this); } - if ((thisx->speedXZ * 1.5f) + 1.0f > 4.8f) { + if ((thisx->speed * 1.5f) + 1.0f > 4.8f) { this->skelAnime.playSpeed = 4.8f; } else { - this->skelAnime.playSpeed = (thisx->speedXZ * 1.5f) + 1.0f; + this->skelAnime.playSpeed = (thisx->speed * 1.5f) + 1.0f; } if (this->unk_240 <= 0) { @@ -700,18 +700,19 @@ void func_8091EFE8(Actor* thisx, PlayState* play) { } if (this->unk_277 == 0) { - Math_SmoothStepToF(&this->actor.speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 2.8f, 0.1f, 0.4f, 0.0f); if (this->unk_240 < 6) { - this->actor.speedXZ *= 0.75f; + this->actor.speed *= 0.75f; } } - if ((this->actor.bgCheckFlags & 8) && !(this->actor.bgCheckFlags & 0x20)) { - this->actor.speedXZ *= 0.5f; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { + this->actor.speed *= 0.5f; } - if (((Rand_Next() >> 0x1B) == 0) || ((this->actor.bgCheckFlags & 8) && ((Rand_Next() >> 0x1E) == 0)) || - !(this->actor.bgCheckFlags & 0x20)) { + if (((Rand_Next() >> 0x1B) == 0) || + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && ((Rand_Next() >> 0x1E) == 0)) || + !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { temp_f0 = Rand_ZeroOne(); sp34 = (1.0f - SQ(temp_f0)) * sp3C->home.rot.x; sp30 = Rand_ZeroOne() * sp3C->home.rot.z; @@ -760,10 +761,10 @@ void func_8091EFE8(Actor* thisx, PlayState* play) { } this->actor.velocity.y *= 0.8f; - if ((this->actor.speedXZ * 1.5f) + 1.0f > 4.8f) { + if ((this->actor.speed * 1.5f) + 1.0f > 4.8f) { this->skelAnime.playSpeed = 4.8f; } else { - this->skelAnime.playSpeed = (this->actor.speedXZ * 1.5f) + 1.0f; + this->skelAnime.playSpeed = (this->actor.speed * 1.5f) + 1.0f; } } @@ -804,7 +805,7 @@ void func_8091F3BC(Actor* thisx, PlayState* play) { func_8091DD48(this); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 2.0f); - Math_SmoothStepToF(&this->actor.speedXZ, sp3C->x, sp3C->y, sp3C->z, 0.0f); + Math_SmoothStepToF(&this->actor.speed, sp3C->x, sp3C->y, sp3C->z, 0.0f); this->unk_24C = 0.0f; if (func_8091D630(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f)) { @@ -820,7 +821,7 @@ void func_8091F3BC(Actor* thisx, PlayState* play) { phi_f0 = 0.0f; } - temp_f2 = this->actor.speedXZ + 0.4f + phi_f0; + temp_f2 = this->actor.speed + 0.4f + phi_f0; this->skelAnime.playSpeed = CLAMP(temp_f2, 0.5f, 1.6f); if (this->unk_240 <= 0) { @@ -887,7 +888,7 @@ void func_8091F5A4(Actor* thisx, PlayState* play) { func_8091D904(this); } else if (func_8091DDF4(this, play)) { - Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 25.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 25.0f); } } } diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index c7dd18369..a53393284 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -211,7 +211,7 @@ void EnFish2_Init(Actor* thisx, PlayState* play) { } else if (this->actor.params != 0) { this->unk_2B4 = 10; this->actor.draw = NULL; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actionFunc = func_80B2A01C; } } @@ -235,7 +235,7 @@ void func_80B287F4(EnFish2* this, s32 arg1) { if (arg1 == 0) { this->unk_338 = 410.0f - this->unk_2C4; } - Math_ApproachF(&this->unk_350->speedXZ, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); + Math_ApproachF(&this->unk_350->speed, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); } Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); this->unk_34A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp2C); @@ -377,14 +377,14 @@ void func_80B28C14(EnFish2* this, PlayState* play) { } if (this->unk_2B4 == 0) { - Math_ApproachF(&this->actor.speedXZ, (D_80B2B380[0] - this->unk_330) * 400.0f, 0.3f, 0.3f); - if (this->actor.speedXZ > 3.0f) { - this->actor.speedXZ = 3.0f; - } else if (this->actor.speedXZ < 1.5f) { - this->actor.speedXZ = 1.5f; + Math_ApproachF(&this->actor.speed, (D_80B2B380[0] - this->unk_330) * 400.0f, 0.3f, 0.3f); + if (this->actor.speed > 3.0f) { + this->actor.speed = 3.0f; + } else if (this->actor.speed < 1.5f) { + this->actor.speed = 1.5f; } } else { - Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 0.3f); + Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f); } if ((D_80B2B2E8 == 0) && (D_80B2B2E0 != 2)) { @@ -404,7 +404,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { } else if ((itemAction->update != NULL) && (itemAction->params == 0) && (fabsf(itemAction->world.pos.x - this->actor.world.pos.x) < 100.0f) && (fabsf(itemAction->world.pos.z - this->actor.world.pos.z) < 100.0f) && - (itemAction->bgCheckFlags & 0x20)) { + (itemAction->bgCheckFlags & BGCHECKFLAG_WATER)) { this->unk_350 = itemAction; if (D_80B2B2E0 == 0) { EnFish2* fish; @@ -436,7 +436,7 @@ void func_80B29128(EnFish2* this) { void func_80B2913C(EnFish2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80B28B5C(this); } } @@ -448,7 +448,7 @@ void func_80B29194(EnFish2* this) { } this->unk_2C4 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_2C8 == 0) { this->unk_34C = 400; Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_324); @@ -463,12 +463,12 @@ void func_80B29194(EnFish2* this) { void func_80B29250(EnFish2* this, PlayState* play) { if (!func_80B28478(this)) { - Math_ApproachF(&this->actor.speedXZ, (D_80B2B380[0] - this->unk_330) * 1000.0f, 0.3f, 0.3f); + Math_ApproachF(&this->actor.speed, (D_80B2B380[0] - this->unk_330) * 1000.0f, 0.3f, 0.3f); - if (this->actor.speedXZ > 4.0f) { - this->actor.speedXZ = 4.0f; - } else if (this->actor.speedXZ < 2.0f) { - this->actor.speedXZ = 2.0f; + if (this->actor.speed > 4.0f) { + this->actor.speed = 4.0f; + } else if (this->actor.speed < 2.0f) { + this->actor.speed = 2.0f; } func_80B287F4(this, 0); @@ -492,12 +492,12 @@ void func_80B293C4(EnFish2* this, PlayState* play) { if (func_80B28478(this) == 0) { func_80B287F4(this, 1); - Math_ApproachF(&this->actor.speedXZ, (*D_80B2B380 - this->unk_330) * 1000.0f, 0.3f, 0.3f); + Math_ApproachF(&this->actor.speed, (*D_80B2B380 - this->unk_330) * 1000.0f, 0.3f, 0.3f); - if (this->actor.speedXZ > 3.0f) { - this->actor.speedXZ = 3.0f; - } else if (this->actor.speedXZ < 1.0f) { - this->actor.speedXZ = 1.0f; + if (this->actor.speed > 3.0f) { + this->actor.speed = 3.0f; + } else if (this->actor.speed < 1.0f) { + this->actor.speed = 1.0f; } if (this->unk_2CC <= currentFrame) { @@ -526,11 +526,11 @@ void func_80B2951C(EnFish2* this) { } this->unk_2B4 = 10; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; Actor_Kill(this->unk_350); this->unk_350 = NULL; D_80B2B2F4 = &this->actor; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DODO_M_EAT); + Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_EAT); this->actionFunc = func_80B295A4; } @@ -542,7 +542,7 @@ void func_80B295A4(EnFish2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &play->view.eye), 1, 0x1388, 0); - Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 0.3f); + Math_ApproachZeroF(&this->actor.speed, 0.3f, 0.3f); if (this->unk_2B4 != 0) { Math_Vec3f_Copy(&sp60, &this->unk_318); sp60.x += randPlusMinusPoint5Scaled(100.0f); @@ -576,7 +576,7 @@ void func_80B29778(EnFish2* this) { } this->actionFunc = func_80B297FC; this->unk_324.y = this->unk_2D4; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80B297FC(EnFish2* this, PlayState* play) { @@ -605,7 +605,7 @@ void func_80B297FC(EnFish2* this, PlayState* play) { if ((fabsf(this->actor.world.pos.x - this->unk_324.x) < 2.0f) && (this->actor.world.pos.y < (this->unk_2D4 + 3.0f)) && (fabsf(this->actor.world.pos.z - this->unk_324.z) < 2.0f)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_34A = BINANG_ROT180(this->actor.home.rot.y); this->unk_2C4++; this->actor.velocity.y = 0.0f; @@ -638,7 +638,7 @@ void func_80B297FC(EnFish2* this, PlayState* play) { } this->unk_2B6 = 4; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FISH_GROW_UP); + Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_GROW_UP); this->unk_2C4++; } break; @@ -770,8 +770,8 @@ void func_80B29EE4(EnFish2* this, PlayState* play) { this->unk_2C4++; } this->unk_338 = 410.0f - this->unk_2C4; - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.3f, 0.3f); - Math_ApproachF(&this->unk_350->speedXZ, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.3f, 0.3f); + Math_ApproachF(&this->unk_350->speed, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); func_80B289DC(this, play); Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); this->unk_34A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp2C); @@ -887,9 +887,9 @@ void func_80B2A498(EnFish2* this, PlayState* play) { temp_v0 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_COL_MAN, sp80.x, sp80.y, sp80.z, 0, this->actor.world.rot.y, 0, 0); if (temp_v0 != NULL) { - temp_v0->speedXZ = 4.0f; + temp_v0->speed = 4.0f; temp_v0->velocity.y = 15.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); + Actor_PlaySfx(&this->actor, NA_SE_SY_PIECE_OF_HEART); CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_10); CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_20); CLEAR_WEEKEVENTREG(WEEKEVENTREG_81_40); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index a64e8a947..31d884c4d 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -3,7 +3,7 @@ * Overlay: ovl_En_Fishing * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ -#include "prevent_bss_reordering.h" + #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -850,7 +850,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { D_809171FC = 0; D_809171F6 = 10; - Audio_QueueSeqCmd(0x100100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); if (sLinkAge == 1) { if (gSaveContext.save.unk_EE4 & 0x7F) { @@ -945,7 +945,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { return; } - thisx->bgCheckFlags |= 0x800; // Added in MM + thisx->bgCheckFlags |= BGCHECKFLAG_PLAYER_800; // Added in MM if ((thisx->params < 115) || (thisx->params == 200)) { SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); @@ -1130,7 +1130,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { if (Message_ShouldAdvance(play) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { - func_801477B4(play); + Message_CloseTextbox(play); Rupees_ChangeBy(-50); effect->unk_2C = -1; } @@ -1573,7 +1573,7 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_NEW); - if ((player->actor.speedXZ == 0.0f) && (D_809101B4 == 0.0f)) { + if ((player->actor.speed == 0.0f) && (D_809101B4 == 0.0f)) { Math_ApproachF(&sLureHookRotY[hookIndex], ry, 0.1f, 0.3f); } else { sLureHookRotY[hookIndex] = ry; @@ -1784,7 +1784,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) sLurePos = sReelLinePos[LINE_SEG_COUNT - 1]; sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; - if ((player->actor.speedXZ == 0.0f) && (D_80917200 == 0)) { + if ((player->actor.speed == 0.0f) && (D_80917200 == 0)) { Math_ApproachF(&sLureRot.y, sReelLineRot[LINE_SEG_COUNT - 2].y, 0.1f, 0.2f); } else { sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y; @@ -2159,7 +2159,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { if (D_80917204 == 0) { if ((D_80917200 == 0) && (player->unk_B28 == 1)) { D_80917204 = 37; - func_801477B4(play); + Message_CloseTextbox(play); } } else { sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; @@ -2233,10 +2233,10 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); this->actor.world.pos = sp80; - if (this->actor.bgCheckFlags & 0x10) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { D_80917238.y = -0.5f; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (D_80917238.y > 0.0f) { D_80917238.y = 0.0f; } @@ -2788,7 +2788,7 @@ void func_80903C60(EnFishing* this, u8 arg1) { } } - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { @@ -2870,9 +2870,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.uncullZoneScale = 50.0f; if (this->unk_148 == 0) { - sp118 = (player->actor.speedXZ * 0.15f) + 0.25f; + sp118 = (player->actor.speed * 0.15f) + 0.25f; } else { - sp118 = (player->actor.speedXZ * 0.3f) + 0.25f; + sp118 = (player->actor.speed * 0.3f) + 0.25f; } if ((D_80917200 != 0) || (sSubCamId != SUB_CAM_ID_DONE) || @@ -3017,7 +3017,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { case 10: this->unk_1AC = this->actor.home.pos; - Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 0.5f); Math_ApproachF(&this->unk_1A8, 4096.0f, 1.0f, 256.0f); if (sp124 < 40.0f) { @@ -3039,7 +3039,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { case 11: this->unk_1AC = this->actor.home.pos; - Math_ApproachF(&this->actor.speedXZ, 0.0f, 1.0f, 0.05f); + Math_ApproachF(&this->actor.speed, 0.0f, 1.0f, 0.05f); Math_ApproachF(&this->unk_1A8, 0.0f, 1.0f, 256.0f); if (sp124 >= 40.0f) { @@ -3069,7 +3069,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { break; case 0: - Math_ApproachF(&this->actor.speedXZ, 1.0f, 1.0f, 0.05f); + Math_ApproachF(&this->actor.speed, 1.0f, 1.0f, 0.05f); Math_ApproachF(&this->unk_1A8, 0.0f, 1.0f, 256.0f); if (this->unk_172[0] == 0) { @@ -3106,14 +3106,14 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_172[1] != 0)) { Math_ApproachF(&this->unk_1A8, 8192.0f, 1.0f, 768.0f); - Math_ApproachF(&this->actor.speedXZ, 4.2f, 1.0f, 0.75); + Math_ApproachF(&this->actor.speed, 4.2f, 1.0f, 0.75); this->unk_188 = 1.2f; this->unk_18C = 4000.0f; this->unk_172[0] = 20; } else { this->unk_188 = 1.0f; this->unk_18C = 2000.0f; - Math_ApproachF(&this->actor.speedXZ, 1.5f, 1.0f, 0.1f); + Math_ApproachF(&this->actor.speed, 1.5f, 1.0f, 0.1f); } if ((this->unk_172[0] == 0) || (sp124 < 50.0f)) { @@ -3135,7 +3135,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->unk_15E, 0, 0x14, 0x20); if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_172[1] != 0)) { - Math_ApproachF(&this->actor.speedXZ, 3.0f, 1.0f, 0.75); + Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.75); this->unk_188 = 1.0f; this->unk_172[0] = 20; this->unk_18C = 4000.0f; @@ -3149,12 +3149,12 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else if (sp124 > 50.0f) { this->unk_188 = 0.8f; this->unk_18C = 1500.0f; - Math_ApproachF(&this->actor.speedXZ, 1.0f, 1.0f, 0.1f); + Math_ApproachF(&this->actor.speed, 1.0f, 1.0f, 0.1f); Math_ApproachF(&this->unk_1A8, 2048.0f, 1.0f, 128.0f); } else { this->unk_188 = 0.4f; this->unk_18C = 500.0f; - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.02f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.02f); Math_ApproachF(&this->unk_1A8, 0.0f, 1.0f, 256.0f); } @@ -3183,11 +3183,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->unk_15E, -0x1000, 0x14, 0x100); if (this->actor.world.pos.y < (WATER_SURFACE_Y(play) - 20.0f)) { - Math_ApproachF(&this->actor.speedXZ, 0.5f, 1.0f, 0.1f); + Math_ApproachF(&this->actor.speed, 0.5f, 1.0f, 0.1f); } else { - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.01f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.01f); - if ((this->actor.speedXZ == 0.0f) || (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 5.0f))) { + if ((this->actor.speed == 0.0f) || (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 5.0f))) { this->unk_1AC.x = Rand_ZeroFloat(300.0f); this->unk_1AC.z = Rand_ZeroFloat(300.0f); this->unk_1AC.y = this->actor.floorHeight + 10.0f; @@ -3201,7 +3201,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &spB8, 30.0f, 400.0f, 150, 90); - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_CATCH_BOOMERANG); + Actor_PlaySfx(&this->actor, NA_SE_PL_CATCH_BOOMERANG); break; } } @@ -3221,7 +3221,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (sp124 > 40.0f) { this->unk_188 = 0.7f; this->unk_18C = 1200.0f; - Math_ApproachF(&this->actor.speedXZ, 0.5f, 1.0f, 0.01f); + Math_ApproachF(&this->actor.speed, 0.5f, 1.0f, 0.01f); Math_ApproachF(&this->unk_1A8, 2048.0f, 1.0f, 128.0f); } else { this->unk_150 = -1; @@ -3284,7 +3284,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_18C = 500.0f; this->unk_172[0] = Rand_ZeroFloat(10.0f) + 2.0f; } - Math_ApproachF(&this->actor.speedXZ, -0.2f, 1.0f, 0.1f); + Math_ApproachF(&this->actor.speed, -0.2f, 1.0f, 0.1f); this->unk_156 = 1; } else { if (this->unk_156 != 0) { @@ -3292,7 +3292,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_1A8 = 0.0f; this->unk_18C = 3000.0f; } - Math_ApproachF(&this->actor.speedXZ, 3.0f, 1.0f, 0.15f); + Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.15f); this->unk_156 = 0; } @@ -3376,7 +3376,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_1AC.z = sLurePos.z + sp100.z; this->unk_1AC.y = sLurePos.y - 10.0f; this->unk_1A8 = 4096.0f; - Math_ApproachF(&this->actor.speedXZ, this->unk_180 * 0.8f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, this->unk_180 * 0.8f, 1.0f, 1.0f); if ((D_8090CD14 != 3) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { @@ -3401,7 +3401,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_149 = 50; sp134 = 2; this->unk_1AC = sLurePos; - Math_ApproachF(&this->actor.speedXZ, this->unk_180, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, this->unk_180, 1.0f, 1.0f); if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { @@ -3466,7 +3466,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { case -3: this->unk_149 = 50; this->unk_1AC = sLurePos; - Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 1.0f); if ((D_8090CD14 != 3) || (this->unk_172[0] == 0) || (sLurePos.y > (WATER_SURFACE_Y(play) + 5.0f)) || (sqrtf(SQ(sLurePos.x) + SQ(sLurePos.z)) > 800.0f)) { @@ -3477,7 +3477,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_18C = 2000.0f; } else if (sp124 < 10.0f) { if (sLurePos.y > (WATER_SURFACE_Y(play) - 10.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_JUMP_OUT_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_OUT_WATER); play_sound(NA_SE_PL_CATCH_BOOMERANG); } @@ -3539,7 +3539,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_190 = 1.7f; this->unk_194 = 7000.0f; D_80917274 = 1; - Audio_QueueSeqCmd(0x881A); // Changed from 0x81A in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); D_809171F6 = 0; if (this->unk_148 == 1) { @@ -3640,17 +3640,17 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { D_8091726C = 0.0f; this->unk_188 = 1.6f; this->unk_18C = 6000.0f; - Math_ApproachF(&this->actor.speedXZ, 7.5f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, 7.5f, 1.0f, 1.0f); Math_ApproachS(&this->unk_168, 0x4E20, 2, 0xFA0); } else { if ((D_80917274 == 0) && (D_80917206 == 2)) { this->unk_188 = 1.0f; this->unk_18C = 2000.0f; - Math_ApproachF(&this->actor.speedXZ, 3.0f, 1.0f, 0.2f); + Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.2f); } else { this->unk_188 = 1.4f; this->unk_18C = 5000.0f; - Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, 5.0f, 1.0f, 0.5f); } if (this->unk_148 == 0) { @@ -3675,7 +3675,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { D_8091726C = 1.3f - (this->unk_1A4 * 0.00899f * 1.4f); } - Math_ApproachF(&this->actor.speedXZ, 2.0f, 1.0f, 0.5f); + Math_ApproachF(&this->actor.speed, 2.0f, 1.0f, 0.5f); if (this->unk_172[1] == 0) { this->unk_14A = 0; @@ -3696,7 +3696,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (D_80917274 || (D_80917206 != 2)) { - if (this->actor.speedXZ < 3.0f) { + if (this->actor.speed < 3.0f) { if (D_809171FE & 8) { sp100.x = -0.8f; } else { @@ -3719,11 +3719,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((SQ(sp10C.x) + SQ(sp10C.y) + SQ(sp10C.z)) > SQ(20.0f)) { Math_ApproachF(&this->actor.world.pos.x, sReelLinePos[LINE_SEG_COUNT - 2].x, 0.2f, - 2.0f * (this->actor.speedXZ * 1.5f)); + 2.0f * (this->actor.speed * 1.5f)); Math_ApproachF(&this->actor.world.pos.y, sReelLinePos[LINE_SEG_COUNT - 2].y, 0.2f, - 2.0f * (this->actor.speedXZ * 1.5f) * 5.0f * 0.1f); + 2.0f * (this->actor.speed * 1.5f) * 5.0f * 0.1f); Math_ApproachF(&this->actor.world.pos.z, sReelLinePos[LINE_SEG_COUNT - 2].z, 0.2f, - 2.0f * (this->actor.speedXZ * 1.5f)); + 2.0f * (this->actor.speed * 1.5f)); } if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (input->rel.stick_y < -30)) { @@ -3750,7 +3750,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else { // Assignment of OoT's D_80B7E086 here removed in MM Rumble_Override(0.0f, 1, 3, 1); - Audio_QueueSeqCmd(0x100A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10); } this->unk_150 = this->unk_152 = 0; @@ -3818,7 +3818,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (this->unk_172[0] == 90) { - Audio_QueueSeqCmd(0x8924); // changed from 0x924 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GET_HEART | 0x900 | SEQ_FLAG_ASYNC); D_8090CCFC = 40; if (this->unk_148 == 0) { @@ -3862,7 +3862,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (play->msgCtx.choiceIndex == 0) { if (D_8090CCF0 == 0.0f) { D_8090CCF0 = this->unk_1A4; @@ -3894,7 +3894,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (play->msgCtx.choiceIndex != 0) { f32 temp1 = D_8090CCF0; s16 temp2 = D_809171D0; @@ -3932,7 +3932,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { D_809101C4 = 520.0f; D_809101C0 = 195.0f; - Audio_QueueSeqCmd(0x100A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10); D_809171F6 = 20; D_8090CD4C = 3; } @@ -3954,7 +3954,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { D_8090CF18 = 3; } - Math_ApproachF(&this->actor.speedXZ, 5.0f, 1.0f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 1.0f, 1.0f); if (sp124 < 20.0f) { Math_ApproachS(&this->unk_168, 0x4E20, 2, 0xFA0); @@ -4013,7 +4013,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { spF6 = -0x1F40; } - if (this->actor.speedXZ >= 3.2f) { + if (this->actor.speed >= 3.2f) { Math_ApproachS(&this->unk_166, spF6, 2, 0x4E20); } else { Math_ApproachS(&this->unk_166, spF6, 3, 0xBB8); @@ -4049,7 +4049,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->unk_15A, this->unk_160, spF0, spEE); Math_ApproachS(&this->unk_15C, this->unk_162, spFA, 0x2000); - if (this->actor.speedXZ <= 0.5f) { + if (this->actor.speed <= 0.5f) { Math_ApproachS(&this->actor.shape.rot.x, 0, 10, this->unk_170); Math_ApproachS(&this->unk_170, 0x500, 1, 0x20); } else { @@ -4080,14 +4080,14 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((this->actor.world.pos.y < WATER_SURFACE_Y(play)) && (this->actor.world.pos.y > (WATER_SURFACE_Y(play) - 10.0f)) && !(this->unk_154 & 1) && - (this->actor.speedXZ > 0.0f)) { + (this->actor.speed > 0.0f)) { Vec3f pos = this->actor.world.pos; pos.y = WATER_SURFACE_Y(play); EnFishing_SpawnRipple(&this->actor.projectedPos, play->specialEffects, &pos, 80.0f, 500.0f, 150, 90); } - if ((this->actor.speedXZ > 0.0f) || (this->unk_150 == 5)) { + if ((this->actor.speed > 0.0f) || (this->unk_150 == 5)) { f32 velocityY = this->actor.velocity.y; spD8 = this->unk_1A4 * 0.1f; @@ -4103,17 +4103,17 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.velocity.y = velocityY; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_198 = 20; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { this->unk_17C = Rand_ZeroFloat(3.0f) + 3.0f; this->actor.velocity.x = this->actor.world.pos.x * -0.003f; this->actor.velocity.z = this->actor.world.pos.z * -0.003f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FISH_LEAP); + Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); func_809036BC(this, play); if (Rand_ZeroOne() < 0.5f) { @@ -4714,7 +4714,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 1: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: @@ -4725,15 +4725,15 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } else { this->actor.textId = 0x407D; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_154 = 2; } else { - func_80151938(play, 0x407E); + Message_ContinueTextbox(play, 0x407E); this->unk_154 = 3; } break; case 1: - func_80151938(play, 0x2D); + Message_ContinueTextbox(play, 0x2D); this->unk_154 = 3; break; } @@ -4742,15 +4742,15 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 2: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); - func_80151938(play, 0x407F); + Message_CloseTextbox(play); + Message_ContinueTextbox(play, 0x407F); this->unk_154 = 4; } break; case 3: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_154 = 0; } if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { @@ -4760,16 +4760,16 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 4: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: D_8090CCF8 = D_809171CC; - func_80151938(play, 0x4080); + Message_ContinueTextbox(play, 0x4080); this->unk_154 = 5; break; case 1: - func_80151938(play, 0x407F); + Message_ContinueTextbox(play, 0x407F); break; } } @@ -4777,7 +4777,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 5: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); play->interfaceCtx.unk_27E = 1; play->startPlayerFishing(play); @@ -4794,11 +4794,11 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 10: if (D_8090CD0C != 0) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(play, 0x40B2); + Message_ContinueTextbox(play, 0x40B2); D_8090CD08 = 1; D_8090CD0C = 0; this->unk_154 = 20; @@ -4810,7 +4810,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } } else { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: @@ -4834,12 +4834,12 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { this->actor.textId = 0x409B; this->unk_154 = 11; } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); break; case 1: if (D_8090CD00 > 36000) { D_8090CD00 = 30000; - func_80151938(play, 0x4088); + Message_ContinueTextbox(play, 0x4088); } else { if (D_809171CA == 0) { if (D_809171D6 == 0) { @@ -4848,9 +4848,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } if ((D_80917206 == 2) && (D_8090D638[D_809171D6] == 0x408D)) { - func_80151938(play, 0x40AF); + Message_ContinueTextbox(play, 0x40AF); } else { - func_80151938(play, D_8090D638[D_809171D6]); + Message_ContinueTextbox(play, D_8090D638[D_809171D6]); } D_809171D6++; @@ -4869,9 +4869,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 2: if (D_809171D8 == 0) { - func_80151938(play, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == 1) { - func_80151938(play, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_154 = 22; break; @@ -4886,7 +4886,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { Message_ShouldAdvance(play)) { s32 getItemId; - func_801477B4(play); + Message_CloseTextbox(play); if (D_809171D0 == 0) { D_809171CC = D_8090CCF0; @@ -4952,21 +4952,21 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } this->actor.parent = NULL; - Actor_PickUp(&this->actor, play, getItemId, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); this->unk_154 = 23; } break; case 20: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_154 = 0; } break; case 21: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: @@ -4974,9 +4974,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 1: if (D_809171D8 == 0) { - func_80151938(play, 0x4085); + Message_ContinueTextbox(play, 0x4085); } else if (sLinkAge == 1) { - func_80151938(play, 0x4092); + Message_ContinueTextbox(play, 0x4092); } this->unk_154 = 22; break; @@ -5001,7 +5001,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->unk_154 = 24; } else { - Actor_PickUp(&this->actor, play, GI_SKULL_TOKEN, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, GI_SKULL_TOKEN, 2000.0f, 1000.0f); } break; @@ -5132,7 +5132,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { if ((D_809171FC != 0) && (D_8090CD4C == 0) && (player->actor.world.pos.z > 1360.0f) && (fabsf(player->actor.world.pos.x) < 25.0f)) { player->actor.world.pos.z = 1360.0f; - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; if (D_8090CD50 == 0) { D_8090CD4C = 10; @@ -5147,7 +5147,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_8090CD4C = 20; Rumble_Override(0.0f, 150, 10, 10); play_sound(NA_SE_SY_TRE_BOX_APPEAR); - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } if (D_8090CD50 != 0) { @@ -5305,7 +5305,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { // fallthrough case 11: player->actor.world.pos.z = 1360.0f; - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); @@ -5355,7 +5355,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 22: if (D_8090CD50 == 30) { - Audio_QueueSeqCmd(0x8922); // changed from 0x922 to 0x8922 in MM + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GET_ITEM | 0x900 | SEQ_FLAG_ASYNC); } D_8090CD54 = 1; @@ -5406,7 +5406,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { if (Message_ShouldAdvance(play)) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - func_801477B4(play); + Message_CloseTextbox(play); if (play->msgCtx.choiceIndex == 0) { D_80917206 = 2; D_809171D6 = 0; @@ -5454,7 +5454,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } 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) && + (player->actor.world.pos.y < (player->actor.floorHeight + 3.0f)) && (player->actor.speed > 1.0f) && ((play->gameplayFrames % 2) == 0)) { Vec3f pos; @@ -5465,7 +5465,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if ((player->actor.floorHeight < WATER_SURFACE_Y(play)) && - (player->actor.floorHeight > (WATER_SURFACE_Y(play) - 10.0f)) && (player->actor.speedXZ >= 4.0f) && + (player->actor.floorHeight > (WATER_SURFACE_Y(play) - 10.0f)) && (player->actor.speed >= 4.0f) && ((play->gameplayFrames % 4) == 0)) { s16 i; @@ -5637,15 +5637,15 @@ void EnFishing_DrawOwner(Actor* thisx, PlayState* play) { if (D_809171F6 == 0) { if (sLinkAge != 1) { - Audio_QueueSeqCmd(0x8019); // Changed from 0x19 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_EVENT | SEQ_FLAG_ASYNC); } else { - Audio_QueueSeqCmd(0x8027); // Changed from 0x27 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_MUSIC_BOX_HOUSE | SEQ_FLAG_ASYNC); } if (sLinkAge != 1) { - Audio_QueueSeqCmd(0x8019); // Changed from 0x19 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_EVENT | SEQ_FLAG_ASYNC); } else { - Audio_QueueSeqCmd(0x8027); // Changed from 0x27 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_MUSIC_BOX_HOUSE | SEQ_FLAG_ASYNC); } } } diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 3ad6809dc..c99a1680c 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -163,7 +163,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { this->actor.params = ENFLOORMAS_GET_7FFF(&this->actor); if (params != 0) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; this->actor.draw = func_808D3754; } @@ -176,7 +176,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { this->actor.parent = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, params + 0x10, -1, this->actor.unk20, NULL); + this->actor.world.pos.z, 0, 0, 0, params + 0x10, -1, this->actor.halfDaysBits, NULL); if (this->actor.parent == NULL) { Actor_Kill(&this->actor); return; @@ -184,7 +184,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { this->actor.child = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - params + 0x10, -1, this->actor.unk20, NULL); + params + 0x10, -1, this->actor.halfDaysBits, NULL); if (this->actor.child == NULL) { Actor_Kill(this->actor.parent); Actor_Kill(&this->actor); @@ -224,7 +224,7 @@ void func_808D0930(EnFloormas* this, PlayState* play) { func_808D19D4((EnFloormas*)this->actor.child); func_808D19D4((EnFloormas*)this->actor.parent); func_808D19D4(this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_HIDE); } else { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); func_808D1ED4(this, play); @@ -239,7 +239,7 @@ void func_808D09CC(EnFloormas* this) { this->collider.base.colType = COLTYPE_HIT3; this->unk_18E = 80; this->actor.flags &= ~(ACTOR_FLAG_200 | ACTOR_FLAG_400); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_808D0A48(EnFloormas* this, PlayState* play) { @@ -259,7 +259,7 @@ void func_808D0A48(EnFloormas* this, PlayState* play) { void func_808D0B08(EnFloormas* this) { Animation_PlayOnce(&this->skelAnime, &gWallmasterIdleAnim); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_808D0B50; } @@ -301,7 +301,7 @@ void func_808D0CE4(EnFloormas* this) { } this->unk_18E = Rand_S16Offset(2, 4); - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; this->actionFunc = func_808D0D70; } @@ -316,12 +316,12 @@ void func_808D0D70(EnFloormas* this, PlayState* play) { if ((temp_v0 != 0) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_WALK); } if ((this->actor.xzDistToPlayer < 320.0f) && Actor_IsFacingPlayer(&this->actor, 0x4000)) { func_808D0F50(this); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_190 = this->actor.wallYaw; func_808D108C(this); } else if ((this->actor.xzDistToPlayer < 400.0f) && !Actor_IsFacingPlayer(&this->actor, 0x4000)) { @@ -334,7 +334,7 @@ void func_808D0D70(EnFloormas* this, PlayState* play) { void func_808D0ECC(EnFloormas* this) { Animation_PlayOnce(&this->skelAnime, &gWallmasterStopWalkAnim); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_808D0F14; } @@ -346,7 +346,7 @@ void func_808D0F14(EnFloormas* this, PlayState* play) { void func_808D0F50(EnFloormas* this) { this->unk_18E = 0; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->skelAnime.playSpeed = 3.0f; this->actionFunc = func_808D0F80; } @@ -355,12 +355,12 @@ void func_808D0F80(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 24.0f) || Animation_OnFrame(&this->skelAnime, 36.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_WALK); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C); if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000) && - !(this->actor.bgCheckFlags & 8)) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { func_808D1380(this, play); } else if (this->actor.xzDistToPlayer > 400.0f) { func_808D0CE4(this); @@ -370,7 +370,7 @@ void func_808D0F80(EnFloormas* this, PlayState* play) { void func_808D108C(EnFloormas* this) { s16 sp36 = this->unk_190 - this->actor.shape.rot.y; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (sp36 > 0) { Animation_MorphToPlayOnce(&this->skelAnime, &gFloormasterTurnAnim, -3.0f); } else { @@ -400,9 +400,9 @@ void func_808D11BC(EnFloormas* this, PlayState* play) { if (((this->skelAnime.playSpeed > 0.0f) && Animation_OnFrame(&this->skelAnime, 21.0f)) || ((this->skelAnime.playSpeed < 0.0f) && Animation_OnFrame(&this->skelAnime, 6.0f))) { if (this->actor.scale.x > 0.009f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_WALK); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } } @@ -419,11 +419,11 @@ void func_808D11BC(EnFloormas* this, PlayState* play) { void func_808D1380(EnFloormas* this, PlayState* play) { Animation_Change(&this->skelAnime, &gWallmasterHoverAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gWallmasterHoverAnim), ANIMMODE_ONCE, -3.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = 0.0f; func_808D08D0(this); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_ATTACK); this->actionFunc = func_808D1458; } @@ -460,7 +460,7 @@ void func_808D14DC(EnFloormas* this, PlayState* play) { void func_808D161C(EnFloormas* this) { this->unk_18E = 25; this->actor.gravity = -0.15f; - this->actor.speedXZ = 0.5f; + this->actor.speed = 0.5f; this->actionFunc = func_808D1650; } @@ -471,7 +471,7 @@ void func_808D1650(EnFloormas* this, PlayState* play) { this->unk_18E--; } - Math_StepToF(&this->actor.speedXZ, 15.0f, SQ(this->actor.speedXZ) * (1.0f / 3.0f)); + Math_StepToF(&this->actor.speed, 15.0f, SQ(this->actor.speed) * (1.0f / 3.0f)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x1680, 0x140); temp_f0_2 = this->actor.world.pos.y - this->actor.floorHeight; @@ -485,14 +485,14 @@ void func_808D1650(EnFloormas* this, PlayState* play) { func_808D14DC(this, play); } - if ((this->actor.bgCheckFlags & 8) || (this->unk_18E == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_18E == 0)) { func_808D1740(this); } } void func_808D1740(EnFloormas* this) { Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 1.0f, 41.0f, 42.0f, ANIMMODE_ONCE, 5.0f); - if ((this->actor.speedXZ < 0.0f) || (this->actionFunc != func_808D1650)) { + if ((this->actor.speed < 0.0f) || (this->actionFunc != func_808D1650)) { this->unk_18E = 30; } else { this->unk_18E = 45; @@ -502,31 +502,31 @@ void func_808D1740(EnFloormas* this) { } void func_808D17EC(EnFloormas* this, PlayState* play) { - s32 sp24 = this->actor.bgCheckFlags & 1; + s32 sp24 = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->actor.params != ENFLOORMAS_GET_7FFF_40) { func_808D0908(this); } if (this->actor.velocity.y < -4.0f) { if (this->actor.scale.x > 0.009f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_LAND); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); } } } - if (this->actor.bgCheckFlags & 8) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed = 0.0f; } if (sp24 != 0) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f); + Math_StepToF(&this->actor.speed, 0.0f, 2.0f); } - if ((this->actor.speedXZ > 0.0f) && ((this->actor.world.pos.y - this->actor.floorHeight) < 12.0f)) { + if ((this->actor.speed > 0.0f) && ((this->actor.world.pos.y - this->actor.floorHeight) < 12.0f)) { func_808D14DC(this, play); } @@ -558,7 +558,7 @@ void func_808D19D4(EnFloormas* this) { this->drawDmgEffAlpha = 0.0f; Actor_SetScale(&this->actor, 0.004f); this->actor.flags |= ACTOR_FLAG_10; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { this->actor.draw = func_808D3754; } else { this->actor.draw = EnFloormas_Draw; @@ -575,28 +575,28 @@ void func_808D19D4(EnFloormas* this) { this->actor.flags &= ~ACTOR_FLAG_400; this->actor.flags |= ACTOR_FLAG_200; this->actor.colChkInfo.health = 1; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->actor.velocity.y = 7.0f; this->actionFunc = func_808D1B44; } void func_808D1B44(EnFloormas* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_1; this->unk_194 = 50; func_808D0C14(this); } - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); } - if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); } } void func_808D1BCC(EnFloormas* this) { Animation_PlayLoopSetSpeed(&this->skelAnime, &gWallmasterWalkAnim, 4.5f); - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actionFunc = func_808D1C1C; } @@ -607,12 +607,12 @@ void func_808D1C1C(EnFloormas* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } if (this->unk_194 == 0) { func_808D1D0C(this); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_190 = this->actor.wallYaw; func_808D108C(this); } else if (this->actor.xzDistToPlayer < 120.0f) { @@ -624,7 +624,7 @@ void func_808D1D0C(EnFloormas* this) { if (this->actionFunc != func_808D1C1C) { Animation_PlayLoopSetSpeed(&this->skelAnime, &gWallmasterWalkAnim, 4.5f); } - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actionFunc = func_808D1D6C; } @@ -634,10 +634,10 @@ void func_808D1D6C(EnFloormas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } - flags = this->actor.bgCheckFlags & 8; + flags = this->actor.bgCheckFlags & BGCHECKFLAG_WALL; if (flags) { this->unk_190 = this->actor.wallYaw; func_808D108C(this); @@ -651,9 +651,9 @@ void func_808D1D6C(EnFloormas* this, PlayState* play) { return; } - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, sp2C), 0x38E); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, sp2C), 0x38E); - if (Actor_XZDistanceBetweenActors(&this->actor, sp2C) < 80.0f) { + if (Actor_WorldDistXZToActor(&this->actor, sp2C) < 80.0f) { func_808D2484(this); } } else { @@ -667,7 +667,7 @@ void func_808D1D6C(EnFloormas* this, PlayState* play) { void func_808D1ED4(EnFloormas* this, PlayState* play) { Vec3f sp34; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; sp34.x = this->actor.world.pos.x; sp34.y = this->actor.world.pos.y + 15.0f; @@ -686,7 +686,7 @@ void func_808D1F7C(EnFloormas* this, PlayState* play) { void func_808D1FD4(EnFloormas* this) { Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 2.0f, 0.0f, 41.0f, ANIMMODE_ONCE, 0.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_808D2040; } @@ -697,12 +697,12 @@ void func_808D2040(EnFloormas* this, PlayState* play) { if (this->skelAnime.curFrame < 20.0f) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); } else if (Animation_OnFrame(&this->skelAnime, 20.0f)) { - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.velocity.y = 7.0f; - } else if (this->actor.bgCheckFlags & 2) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->unk_18E = 50; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); func_808D1740(this); } else if ((this->actor.playerHeightRel < -10.0f) && (this->collider.base.ocFlags1 & OC1_HIT) && (&player->actor == this->collider.base.oc)) { @@ -716,7 +716,7 @@ void func_808D217C(EnFloormas* this, Player* player) { Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 1.0f, 36.0f, 45.0f, ANIMMODE_ONCE, -3.0f); this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_808D08D0(this); ptr = &D_808D3900[GET_PLAYER_FORM]; @@ -759,18 +759,18 @@ void func_808D22C8(EnFloormas* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.velocity.y = 6.0f; this->actor.flags |= ACTOR_FLAG_1; - this->actor.speedXZ = -3.0f; + this->actor.speed = -3.0f; func_808D1740(this); } else if ((this->unk_190 % 20) == 0) { - func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset); + Player_PlaySfx(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset); play->damagePlayer(play, -4); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_STICK - SFX_FLAG); } void func_808D2484(EnFloormas* this) { Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 2.0f, 0.0f, 41.0f, ANIMMODE_ONCE, 0.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_808D24F0; } @@ -783,7 +783,7 @@ void func_808D24F0(EnFloormas* this, PlayState* play) { } else if (this->actor.child->params == ENFLOORMAS_GET_7FFF_40) { phi_s1 = this->actor.child; } else { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.params = ENFLOORMAS_GET_7FFF_10; func_808D1740(this); } @@ -791,24 +791,24 @@ void func_808D24F0(EnFloormas* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 20.0f)) { - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.velocity.y = 7.0f; } else if (this->skelAnime.curFrame < 20.0f) { - Math_ApproachS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, phi_s1), 2, 0xE38); + Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, phi_s1), 2, 0xE38); } else if (((phi_s1->world.pos.y - this->actor.world.pos.y) < -10.0f) && (fabsf(this->actor.world.pos.x - phi_s1->world.pos.x) < 10.0f) && (fabsf(this->actor.world.pos.z - phi_s1->world.pos.z) < 10.0f)) { func_808D2A20(this); this->collider.base.ocFlags1 |= OC1_ON; - } else if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); func_808D1740(this); } if ((fabsf(this->actor.world.pos.x - phi_s1->world.pos.x) < 5.0f) && (fabsf(this->actor.world.pos.z - phi_s1->world.pos.z) < 5.0f)) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f); + Math_StepToF(&this->actor.speed, 0.0f, 2.0f); } } @@ -817,7 +817,7 @@ void func_808D2700(EnFloormas* this) { this->unk_18E = 0; this->unk_194 = 1500; this->actor.params = ENFLOORMAS_GET_7FFF_40; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_808D08D0(this); this->actionFunc = func_808D2764; } @@ -862,7 +862,7 @@ void func_808D2764(EnFloormas* this, PlayState* play) { this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; if (((temp_f2 == 0.007f) || (temp_f2 == 0.004f)) && (temp_f2 != this->actor.scale.x)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_EXPAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_EXPAND); } this->collider.dim.radius = sCylinderInit.dim.radius * 100.0f * this->actor.scale.x; @@ -923,8 +923,8 @@ void func_808D2AF4(EnFloormas* this, PlayState* play) { void func_808D2B18(EnFloormas* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterDamageAnim, -3.0f); func_800BE504(&this->actor, &this->collider); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); - this->actor.speedXZ = 5.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 5.0f; this->actor.velocity.y = 5.5f; if (this->actor.params == ENFLOORMAS_GET_7FFF_40) { EnFloormas* parent = (EnFloormas*)this->actor.parent; @@ -944,7 +944,7 @@ void func_808D2B18(EnFloormas* this) { } void func_808D2C08(EnFloormas* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { func_808D0930(this, play); } else { @@ -954,18 +954,18 @@ void func_808D2C08(EnFloormas* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 13.0f)) { if (this->actor.scale.x > 0.009f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } } - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); } void func_808D2CDC(EnFloormas* this) { Animation_PlayOnce(&this->skelAnime, &gWallmasterRecoverFromDamageAnim); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_808D2D30; @@ -978,7 +978,7 @@ void func_808D2D30(EnFloormas* this, PlayState* play) { } void func_808D2D6C(EnFloormas* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -1022,14 +1022,14 @@ void func_808D2E34(EnFloormas* this, PlayState* play) { if (this->collider.base.colType != COLTYPE_HARD) { if (!Actor_ApplyDamage(&this->actor)) { if (this->actor.scale.x > 0.009f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FLOORMASTER_SM_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FLOORMASTER_SM_DEAD); } Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; } else if (this->actor.colChkInfo.damage != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_DAMAGE); } func_808D0A48(this, play); @@ -1044,13 +1044,15 @@ void func_808D2E34(EnFloormas* this, PlayState* play) { func_808D2D6C(this); } else if (this->actor.colChkInfo.damageEffect == 1) { this->unk_18E = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, + 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_808D2D6C(this); } else if (this->actor.colChkInfo.damageEffect == 5) { this->unk_18E = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, + 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; @@ -1085,8 +1087,8 @@ void EnFloormas_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_808D2AA8) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - this->actor.speedXZ *= -0.5f; - this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, -5.0f); + this->actor.speed *= -0.5f; + this->actor.speed = CLAMP_MAX(this->actor.speed, -5.0f); this->actor.velocity.y = 5.0f; func_808D1740(this); } diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 0fa23e71a..c9844abb6 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -417,7 +417,7 @@ s32 EnFsn_TestEndInteraction(EnFsn* this, PlayState* play, Input* input) { s32 EnFsn_TestCancelOption(EnFsn* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); return true; } return false; @@ -468,7 +468,7 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, PlayState* play, Input* input) { if (EnFsn_TestItemSelected(play)) { if (!this->items[this->cursorIndex]->isOutOfStock) { this->prevActionFunc = this->actionFunc; - func_80151938(play, this->items[this->cursorIndex]->choiceTextId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -766,7 +766,7 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { if (this->animIndex == FSN_ANIM_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); + Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); } if (this->flags & ENFSN_CALM_DOWN) { this->flags &= ~ENFSN_CALM_DOWN; @@ -783,7 +783,7 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { if (Animation_OnFrame(&this->skelAnime, 28.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); + Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); } return; } @@ -933,7 +933,7 @@ void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_StartBuying; } this->actor.textId = player->actor.textId; - func_801477B4(play); + Message_CloseTextbox(play); } else if (itemAction <= PLAYER_IA_MINUS1) { if (CURRENT_DAY == 3) { this->actor.textId = 0x29DF; @@ -1001,9 +1001,9 @@ void EnFsn_GiveItem(EnFsn* this, PlayState* play) { } this->actionFunc = EnFsn_SetupResumeInteraction; } else if (this->isSelling == true) { - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, this->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 300.0f, 300.0f); } } @@ -1082,7 +1082,7 @@ void EnFsn_LookToShelf(EnFsn* this, PlayState* play) { this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; EnFsn_UpdateCursorPos(this, play); this->actionFunc = EnFsn_BrowseShelf; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -1108,7 +1108,7 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { EnFsn_CursorLeftRight(this); if (this->cursorIndex != prevCursorIdx) { play_sound(NA_SE_SY_CURSOR); - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } } @@ -1131,7 +1131,7 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) { this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; this->actor.textId = 0x29D6; - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = EnFsn_FaceShopkeeperSelling; } else { ActorCutscene_SetIntentToPlay(this->cutscene); @@ -1154,7 +1154,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { func_8019F208(); item = this->items[this->cursorIndex]; item->buyFanfareFunc(play, item); - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); @@ -1173,12 +1173,12 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { break; case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); - func_80151938(play, 0x29F0); + Message_ContinueTextbox(play, 0x29F0); this->actionFunc = EnFsn_PlayerCannotBuy; break; case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); - func_80151938(play, 0x29DD); + Message_ContinueTextbox(play, 0x29DD); this->actionFunc = EnFsn_PlayerCannotBuy; break; } @@ -1214,7 +1214,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) { case 1: func_8019F230(); this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } } @@ -1223,7 +1223,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) { void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index f43d24432..df3beb13b 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -12,7 +12,7 @@ #include "objects/object_mu/object_mu.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnFu*)thisx) @@ -229,7 +229,7 @@ void EnFu_Init(Actor* thisx, PlayState* play) { void EnFu_Destroy(Actor* thisx, PlayState* play) { EnFu* this = THIS; - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); Collider_DestroyCylinder(play, &this->collider); } @@ -254,7 +254,7 @@ void func_80961D7C(PlayState* play) { Actor* explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVES].first; while (explosive != NULL) { - if ((explosive->id == ACTOR_EN_BOM) && (explosive->bgCheckFlags & 1)) { + if ((explosive->id == ACTOR_EN_BOM) && (explosive->bgCheckFlags & BGCHECKFLAG_GROUND)) { EnBom* bomb = (EnBom*)explosive; if (bomb->actor.floorBgId != BGCHECK_SCENE) { @@ -532,13 +532,13 @@ void func_80962660(EnFu* this, PlayState* play) { break; case 0x287D: - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); - func_801477B4(play); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); + Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; this->unk_53C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { func_80961EC8(play); @@ -560,7 +560,7 @@ void func_80962660(EnFu* this, PlayState* play) { case 0x287E: case 0x2880: case 0x2883: - func_801477B4(play); + Message_CloseTextbox(play); func_80963540(this); func_80963560(this, play); break; @@ -605,8 +605,8 @@ void func_809628D0(EnFu* this, PlayState* play) { case 0x2884: case 0x2887: case 0x288A: - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); func_809622FC(this); break; @@ -776,7 +776,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { } if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) && - (player->actor.bgCheckFlags & 1)) || + (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) || (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) { player->stateFlags3 &= ~PLAYER_STATE3_400000; func_80961E88(play); @@ -789,14 +789,14 @@ void func_80962F4C(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x2888, &this->actor); this->unk_552 = 0x2888; } - func_801A2C20(); + Audio_StopSubBgm(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_548 = 0; func_809632D0(this); } else { this->unk_548 = 0; - func_801A2C20(); + Audio_StopSubBgm(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); @@ -843,7 +843,7 @@ void func_80963350(EnFu* this, PlayState* play) { if ((this->unk_54A == 0) && (((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) || ((Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) && (play->msgCtx.stateTimer == 1)))) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_54A = 2; D_80964C24 = 1; } @@ -879,9 +879,9 @@ void func_80963560(EnFu* this, PlayState* play) { this->actor.parent = NULL; func_80963610(this); } else if ((this->unk_552 == 0x2880) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_80)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } this->actor.child->freezeTimer = 10; } @@ -1176,7 +1176,7 @@ void func_80963FF8(EnFu* this, PlayState* play) { if (player->stateFlags1 & PLAYER_STATE1_100000) { play->actorCtx.unk268 = 1; - play->actorCtx.unk_26C.press.button = 0x8000; + play->actorCtx.unk_26C.press.button = BTN_A; } else { play->actorCtx.unk268 = 1; } diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c index b232210f5..e79348366 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c @@ -136,7 +136,7 @@ s32 func_80ACF8B8(EnFuKago* this, PlayState* play) { return false; } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); return true; } else { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); @@ -227,7 +227,7 @@ void func_80ACFA78(EnFuKago* this, PlayState* play) { this->unk_338 = 60; this->unk_33A = 1; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODBOX_BREAK); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODBOX_BREAK); func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AD0028; } diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 6f9706a2b..88a2c63b2 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -156,7 +156,7 @@ void func_80ACE51C(EnFuMato* this, PlayState* play) { } } - this->dyna.actor.speedXZ = 2.0f; + this->dyna.actor.speed = 2.0f; this->dyna.actor.shape.rot.y = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.parent->world.pos); Actor_MoveWithGravity(&this->dyna.actor); @@ -174,7 +174,7 @@ void func_80ACE680(EnFuMato* this) { this->unk_2FC.y = Rand_Next() & 0xFFF; this->unk_2FC.z = Rand_Next() & 0xFFF; this->unk_302 = 3; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODPLATE_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODPLATE_BOUND); this->actionFunc = func_80ACE718; } @@ -187,7 +187,7 @@ void func_80ACE718(EnFuMato* this, PlayState* play) { Actor_UpdatePos(&this->dyna.actor); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); - if ((this->dyna.actor.bgCheckFlags & 1) || (this->dyna.actor.world.pos.y < -500.0f)) { + if ((this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->dyna.actor.world.pos.y < -500.0f)) { Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; Vec3f sp30 = { 0.0f, 2.0f, 0.0f }; @@ -241,7 +241,7 @@ void func_80ACE850(EnFuMato* this, PlayState* play) { this->dyna.actor.freezeTimer = 2; EffectSsHahen_SpawnBurst(play, &this->dyna.actor.world.pos, 13.0f, 0, 7, 8, 20, HAHEN_OBJECT_DEFAULT, 10, NULL); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); this->actionFunc = func_80ACECFC; } @@ -330,7 +330,7 @@ void func_80ACECFC(EnFuMato* this, PlayState* play) { if (this->unk_302 == 1) { Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); - if (this->dyna.actor.bgCheckFlags & 1) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80ACEB2C(this); } } @@ -368,7 +368,7 @@ s32 func_80ACF04C(EnFuMato* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; this->collider.base.ocFlags1 &= ~OC1_HIT; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR); fu->unk_548++; if ((fu->unk_542 == 2) || (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index f7d1d7cd1..f9ee51391 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -188,7 +188,7 @@ void EnFz_Init(Actor* thisx, PlayState* play) { this->unk_BCE = 0; this->unk_BD7 = 1; this->unk_BD8 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.uncullZoneScale = 400.0f; this->unk_BAC = this->actor.world.pos.y; this->unk_BB4 = this->actor.world.pos.y; @@ -359,12 +359,12 @@ void func_80932C98(EnFz* this, PlayState* play) { Vec3f sp3C; if (this->unk_BCD != 0) { - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, 60.0f, this->actor.world.rot.y)) { - this->actor.bgCheckFlags &= ~0x8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->unk_BCD = 0; this->unk_BBC = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -375,8 +375,8 @@ void func_80932C98(EnFz* this, PlayState* play) { if ((parent->update == NULL) || (parent->colChkInfo.health <= 0)) { this->actor.colChkInfo.health = 0; this->unk_BC4 = 5; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FREEZAD_DEAD); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EN_FREEZAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_BROKEN); sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; @@ -388,8 +388,8 @@ void func_80932C98(EnFz* this, PlayState* play) { if ((this->actor.colChkInfo.health != 0) && (this->unk_BC4 == 1)) { this->actor.colChkInfo.health = 0; this->unk_BC4 = 5; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FREEZAD_DEAD); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EN_FREEZAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_BROKEN); sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; @@ -405,7 +405,7 @@ void func_80932C98(EnFz* this, PlayState* play) { this->unk_BCD = 0; this->unk_BBC = 0.0f; this->collider1.base.acFlags &= ~AC_HIT; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_BCA = 10; func_809330D4(this); } else if (this->collider2.base.acFlags & AC_BOUNCED) { @@ -420,9 +420,9 @@ void func_80932C98(EnFz* this, PlayState* play) { case 15: Actor_ApplyDamage(&this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_XLU, 8); if (this->actor.colChkInfo.health != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FREEZAD_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FREEZAD_DAMAGE); sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; @@ -430,8 +430,8 @@ void func_80932C98(EnFz* this, PlayState* play) { this->unk_BCF++; break; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FREEZAD_DEAD); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EN_FREEZAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_BROKEN); sp3C.x = this->actor.world.pos.x; sp3C.y = this->actor.world.pos.y; sp3C.z = this->actor.world.pos.z; @@ -440,7 +440,7 @@ void func_80932C98(EnFz* this, PlayState* play) { break; case 2: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FREEZAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FREEZAD_DEAD); func_80933790(this); break; } @@ -572,7 +572,7 @@ void func_809333D8(EnFz* this, PlayState* play) { void func_80933414(EnFz* this) { this->unk_BD6 = 1; this->unk_BBC = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_BCA = 40; this->actionFunc = func_80933444; } @@ -649,7 +649,7 @@ void func_809336C0(EnFz* this, PlayState* play) { this->unk_BBC = 0.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_BCC = 1; this->unk_BCE = 0; this->unk_BD8 = 1; @@ -672,7 +672,7 @@ void func_80933790(EnFz* this) { this->unk_BCE = 0; this->unk_BD8 = 1; this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_BBC = 0.0f; this->actionFunc = func_809337D4; } @@ -821,7 +821,7 @@ void EnFz_Update(Actor* thisx, PlayState* play) { } } - Math_StepToF(&this->actor.speedXZ, this->unk_BBC, 0.2f); + Math_StepToF(&this->actor.speed, this->unk_BBC, 0.2f); Actor_MoveWithGravity(&this->actor); if (this->unk_BCC != 0) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index 55dc23737..b4542956c 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -210,7 +210,7 @@ void EnGakufu_GiveReward(EnGakufu* this, PlayState* play) { play_sound(NA_SE_SY_CORRECT_CHIME); - hour = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F + hour = TIME_TO_HOURS_F(gSaveContext.save.time); for (i = 0; i < 3; i++) { Item_DropCollectible(play, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); } diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index 40c3d5c05..8882ab94e 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -126,7 +126,7 @@ void func_80AF6994(EnGamelupy* this) { void func_80AF69A8(EnGamelupy* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { - *this->unk_198 += 0x32; + *this->unk_198 += 50; if (this->rupeeIndex == 1) { Rupees_ChangeBy(5); } else { @@ -140,7 +140,7 @@ void func_80AF69A8(EnGamelupy* this, PlayState* play) { void func_80AF6A38(EnGamelupy* this) { this->unk_19C = 0; this->actor.gravity = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_GET_RUPY); + Actor_PlaySfx(&this->actor, NA_SE_SY_GET_RUPY); this->actionFunc = func_80AF6A78; } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index d6643dbeb..3d75c729c 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -632,7 +632,7 @@ void func_80B10924(EnGb2* this, PlayState* play) { } this->actionFunc = func_80B109DC; } else { - Actor_PickUp(&this->actor, play, sp24, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, sp24, 300.0f, 300.0f); } } @@ -641,7 +641,7 @@ void func_80B109DC(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); this->actionFunc = func_80B10634; } else { - func_800B85E0(&this->actor, play, 300.0f, -1); + func_800B85E0(&this->actor, play, 300.0f, PLAYER_IA_MINUS1); } } @@ -832,7 +832,7 @@ void func_80B111AC(EnGb2* this, PlayState* play) { this->actor.world.pos.x = D_80B11A00[index][0]; this->actor.world.pos.y = D_80B11A00[index][1]; this->actor.world.pos.z = D_80B11A00[index][2]; - this->actor.world.rot.y = D_80B11A00[index][3] * 182.04445f; + this->actor.world.rot.y = DEG_TO_BINANG(D_80B11A00[index][3]); this->actor.shape.rot.y = this->actor.world.rot.y; this->actionFunc = func_80B11268; } diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 3d4f4bd3d..d94267b38 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -189,19 +189,20 @@ void EnGe1_SetupPath(EnGe1* this, PlayState* play) { Vec3s* point; Vec3f nextPoint; - this->curPoint = 0; + this->curPointIndex = 0; + if (GERUDO_WHITE_GET_PATH(&this->picto.actor) != 0x3F) { this->path = &play->setupPathList[GERUDO_WHITE_GET_PATH(&this->picto.actor)]; if (this->path != NULL) { point = Lib_SegmentedToVirtual(this->path->points); Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, point); - this->curPoint++; + this->curPointIndex++; point++; Math_Vec3s_ToVec3f(&nextPoint, point); this->picto.actor.world.rot.y = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &nextPoint); this->picto.actor.world.rot.x = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &nextPoint); - this->picto.actor.speedXZ = 15.0f; + this->picto.actor.speed = 15.0f; } } else { this->path = NULL; @@ -214,7 +215,7 @@ void EnGe1_SetupPath(EnGe1* this, PlayState* play) { s32 EnGe1_FollowPath(EnGe1* this) { s32 pad; Path* path = this->path; - Vec3s* points; + Vec3s* curPoint; Vec3f point; s16 yawTarget; s16 pitchTarget; @@ -223,10 +224,10 @@ s32 EnGe1_FollowPath(EnGe1* this) { return true; } - points = Lib_SegmentedToVirtual(this->path->points); - points += this->curPoint; + curPoint = Lib_SegmentedToVirtual(this->path->points); + curPoint += this->curPointIndex; - Math_Vec3s_ToVec3f(&point, points); + Math_Vec3s_ToVec3f(&point, curPoint); yawTarget = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &point); pitchTarget = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &point); Math_SmoothStepToS(&this->picto.actor.world.rot.y, yawTarget, 0xA, 0x3E8, 0x64); @@ -242,9 +243,9 @@ s32 EnGe1_FollowPath(EnGe1* this) { void EnGe1_Scream(EnGe1* this) { if ((s32)Rand_ZeroFloat(2.0f) == 0) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO00); + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO00); } else { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO01); + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO01); } } @@ -260,9 +261,9 @@ void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_STIFF_SHIVERING, ANIMMODE_LOOP, 0.0f); } - if (Cutscene_CheckActorAction(play, 0x79)) { + if (Cutscene_CheckActorAction(play, 121)) { this->picto.actor.draw = EnGe1_Draw; - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x79)]->action; + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 121)]->action; switch (csAction) { case 8: this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; @@ -329,32 +330,37 @@ void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { if ((this->animIndex == GERUDO_WHITE_ANIM_TRUDGING_OFF) && (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 25.0f))) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_PIRATE_WALK); } if ((this->animIndex == GERUDO_WHITE_ANIM_SALUTE) && Animation_OnFrame(&this->skelAnime, 14.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_PIRATE_WALK); } } else { this->picto.actor.draw = NULL; } - if (this->csAction == 9) { - if ((this->curPoint < this->path->count) && EnGe1_FollowPath(this)) { - this->curPoint++; - } + switch (this->csAction) { + case 9: + if ((this->curPointIndex < this->path->count) && EnGe1_FollowPath(this)) { + this->curPointIndex++; + } - // Tumble in the air - this->picto.actor.shape.rot.x += 0x3E8; - this->picto.actor.shape.rot.y += 0x7D0; - this->picto.actor.shape.rot.z += 0x1F4; + // Tumble in the air + this->picto.actor.shape.rot.x += 0x3E8; + this->picto.actor.shape.rot.y += 0x7D0; + this->picto.actor.shape.rot.z += 0x1F4; - if (this->screamTimer > 0) { - this->screamTimer--; - } else { - this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); - EnGe1_Scream(this); - } + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe1_Scream(this); + } + break; + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index 5388a1186..1cf716b0f 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -29,7 +29,7 @@ typedef struct EnGe1 { /* 0x2A4 */ Vec3s headRot; /* 0x2AA */ Vec3s torsoRot; /* 0x2B0 */ Path* path; - /* 0x2B4 */ s32 curPoint; + /* 0x2B4 */ s32 curPointIndex; /* 0x2B8 */ s16 eyeIndex; /* 0x2BA */ s16 blinkTimer; /* 0x2BC */ u16 stateFlags; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 4659c4aa9..54836f071 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -15,18 +15,14 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play); void EnGe2_Update(Actor* thisx, PlayState* play); void EnGe2_Draw(Actor* thisx, PlayState* play); -void func_80B8BCEC(EnGe2* this, PlayState* play); -void func_80B8BD38(EnGe2* this, PlayState* play); -void func_80B8BE08(EnGe2* this, PlayState* play); -void func_80B8BF04(EnGe2* this, PlayState* play); -void func_80B8C048(EnGe2* this, PlayState* play); -void func_80B8C0B0(EnGe2* this, PlayState* play); -void func_80B8C45C(EnGe2* this, PlayState* play); -void func_80B8C59C(EnGe2* this, PlayState* play); -void func_80B8C644(EnGe2* this, PlayState* play); -void func_80B8C9B8(EnGe2* this, PlayState* play); +s32 EnGe2_SetupPath(EnGe2* this, PlayState* play); + +void EnGe2_LookAround(EnGe2* this, PlayState* play); +void EnGe2_Walk(EnGe2* this, PlayState* play); +void EnGe2_GuardStationary(EnGe2* this, PlayState* play); + +s32 EnGe2_ValidatePictograph(PlayState* play, Actor* thisx); -#if 0 ActorInit En_Ge2_InitVars = { ACTOR_EN_GE2, ACTORCAT_NPC, @@ -39,78 +35,741 @@ ActorInit En_Ge2_InitVars = { (ActorFunc)EnGe2_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B8CE40 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x038BFBB3, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +typedef enum { + /* 0 */ GERUDO_PURPLE_DETECTION_UNDETECTED, + /* 1 */ GERUDO_PURPLE_DETECTION_HEARD, + /* 2 */ GERUDO_PURPLE_DETECTION_PROXIMITY //!< Higher priority +} GerudoPurpleDetection; + +typedef enum { + /* 0 */ GERUDO_PURPLE_PATHSTATUS_NORMAL, //!< not near waypoint + /* 1 */ GERUDO_PURPLE_PATHSTATUS_AT_POINT, //!< no path or new waypoint + /* 2 */ GERUDO_PURPLE_PATHSTATUS_END //!< reached end of path +} GerudoPurplePathStatus; + +#define GERUDO_PURPLE_STATE_PATH_REVERSE (1 << 0) //!< Follow path backwards instead of forwards. +#define GERUDO_PURPLE_STATE_KO (1 << 1) +#define GERUDO_PURPLE_STATE_STUNNED (1 << 2) //!< Specifically by Deku Nuts +#define GERUDO_PURPLE_STATE_DISABLE_MOVEMENT \ + (1 << 3) //!< Disable normal movement to let pathing function control it completely. +#define GERUDO_PURPLE_STATE_CAPTURING (1 << 5) //!< Set but not used + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x038BFBB3, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 30, 60, 0, { 0, 0, 0 } }, }; -#endif +void EnGe2_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnGe2* this = THIS; -extern ColliderCylinderInit D_80B8CE40; + ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, + GERUDO_PURPLE_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim); -extern UNK_TYPE D_06008DD8; -extern UNK_TYPE D_060091D0; -extern UNK_TYPE D_06009D1C; -extern UNK_TYPE D_0600A344; + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); + this->picto.actor.uncullZoneForward = 1200.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/EnGe2_Init.s") + if (this->picto.actor.world.rot.z == 0) { + this->verticalDetectRange = 40.0f; + } else { + this->verticalDetectRange = fabsf(this->picto.actor.world.rot.z * 20.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/EnGe2_Destroy.s") + this->picto.actor.world.rot.x = this->picto.actor.shape.rot.x = 0; + this->picto.actor.world.rot.z = this->picto.actor.shape.rot.z = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B514.s") + this->picto.actor.targetMode = 6; + this->stateFlags = 0; + this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; + this->csAction = -1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B5AC.s") + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.gravity = -1.0f; + this->picto.actor.speed = 1.5f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B6B4.s") + this->actionFunc = EnGe2_Walk; + this->picto.validationFunc = EnGe2_ValidatePictograph; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B7A8.s") + EnGe2_SetupPath(this, play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B848.s") + this->picto.actor.flags |= ACTOR_FLAG_10; + if (play->actorCtx.flags & ACTORCTX_FLAG_1) { + this->picto.actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8B90C.s") + switch (GERUDO_PURPLE_GET_TYPE(&this->picto.actor)) { + case GERUDO_PURPLE_TYPE_BOAT_SENTRY: + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, 0.0f); + this->actionFunc = EnGe2_GuardStationary; + this->picto.actor.speed = 0.0f; + this->picto.actor.uncullZoneForward = 4000.0f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BA40.s") + case GERUDO_PURPLE_TYPE_AVEIL_GUARD: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_83_02)) { + Actor_Kill(&this->picto.actor); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BB3C.s") + default: + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BC1C.s") +void EnGe2_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BC78.s") +// Detect Player through hearing or proximity +GerudoPurpleDetection EnGe2_DetectPlayer(PlayState* play, EnGe2* this) { + if (this->picto.actor.xzDistToPlayer > 250.0f) { + return GERUDO_PURPLE_DETECTION_UNDETECTED; + } else if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->picto.actor.xzDistToPlayer < 50.0f)) { + return GERUDO_PURPLE_DETECTION_PROXIMITY; + } else if (func_800B715C(play)) { + return GERUDO_PURPLE_DETECTION_HEARD; + } else { + return GERUDO_PURPLE_DETECTION_UNDETECTED; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BCEC.s") +/** + * Spotted Player with line-of-sight + * + * @param play PlayState + * @param thisx Actor to use for range and angle checks + * @param pos Position to check from + * @param yaw Center of yaw range to check + * @param yawRange Spread of angles from `yaw` to check. If 0, do not check yaw + * @param xzRange Horizontal range to check + * @param yRange Vertical range to check + * @return true if Player is visible with these settings + */ +s32 EnGe2_LookForPlayer(PlayState* play, Actor* actor, Vec3f* pos, s16 yaw, s16 yawRange, f32 xzRange, f32 yRange) { + s16 yawToPlayer; + Vec3f posResult; + CollisionPoly* outPoly; + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BD38.s") + if (Player_GetMask(play) == PLAYER_MASK_STONE) { + return false; + } + if (actor->xzDistToPlayer > xzRange) { + return false; + } + if (fabsf(actor->playerHeightRel) > yRange) { + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BD90.s") + yawToPlayer = actor->yawTowardsPlayer - yaw; + if ((yawRange > 0) && (yawRange < ABS_ALT(yawToPlayer))) { + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BE08.s") + if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[7], &posResult, &outPoly, false)) { + return false; + } else { + return true; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BF04.s") +/* Path functions */ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8BFC8.s") +/** + * Set up the path if it exists, choose the end and direction + * + * @return true if path is set up in reverse + */ +s32 EnGe2_SetupPath(EnGe2* this, PlayState* play) { + if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { + this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; + if (this->path != NULL) { + Path* path = this->path; + Vec3s* points = Lib_SegmentedToVirtual(path->points); + f32 diffX = points[0].x - this->picto.actor.world.pos.x; + f32 diffZ = points[0].z - this->picto.actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C048.s") + if ((SQ(diffX) + SQ(diffZ)) < SQ(10.0f)) { + this->curPointIndex = 0; + this->stateFlags &= ~GERUDO_PURPLE_STATE_PATH_REVERSE; + } else { + this->curPointIndex = path->count - 1; + this->stateFlags |= GERUDO_PURPLE_STATE_PATH_REVERSE; + return true; + } + } + } else { + this->path = NULL; + this->curPointIndex = 0; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C0B0.s") +void EnGe2_GetNextPath(EnGe2* this, PlayState* play) { + Path* curPath; + Path* nextPath; + Vec3s* points; + u8 unk1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C13C.s") + this->curPointIndex = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C45C.s") + if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { + curPath = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; + unk1 = curPath->unk1; + nextPath = &play->setupPathList[unk1]; + this->path = nextPath; + points = Lib_SegmentedToVirtual(nextPath->points); + this->picto.actor.world.pos.x = points[0].x; + this->picto.actor.world.pos.z = points[0].z; + } else { + this->path = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C59C.s") +void EnGe2_SetupBlownAwayPath(EnGe2* this, PlayState* play) { + s32 pad; + Vec3s* points; + Vec3f nextPoint; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C644.s") + this->curPointIndex = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8C9B8.s") + if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { + this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; + if (this->path != NULL) { + points = Lib_SegmentedToVirtual(this->path->points); + Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, points); + this->curPointIndex++; + points++; + Math_Vec3s_ToVec3f(&nextPoint, points); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/EnGe2_Update.s") + this->picto.actor.world.rot.y = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.world.rot.x = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.speed = 15.0f; + } + } else { + this->path = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8CC0C.s") +GerudoPurplePathStatus EnGe2_FollowPath(EnGe2* this) { + Path* path = this->path; + Vec3s* curPoint; + f32 diffX; + f32 diffZ; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8CCB4.s") + if (path == NULL) { + return GERUDO_PURPLE_PATHSTATUS_AT_POINT; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/func_80B8CCFC.s") + curPoint = (Vec3s*)Lib_SegmentedToVirtual(path->points); + curPoint += this->curPointIndex; + diffX = curPoint->x - this->picto.actor.world.pos.x; + diffZ = curPoint->z - this->picto.actor.world.pos.z; + this->picto.actor.world.rot.y = Math_Atan2S(diffX, diffZ); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 2, 0x7D0, 0xC8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge2/EnGe2_Draw.s") + if ((SQ(diffX) + SQ(diffZ)) < SQ(10.0f)) { + if (this->stateFlags & GERUDO_PURPLE_STATE_PATH_REVERSE) { + this->curPointIndex--; + if (this->curPointIndex < 0) { + return GERUDO_PURPLE_PATHSTATUS_END; + } + } else { + this->curPointIndex++; + if (this->curPointIndex >= path->count) { + return GERUDO_PURPLE_PATHSTATUS_END; + } + } + return GERUDO_PURPLE_PATHSTATUS_AT_POINT; + } + + return GERUDO_PURPLE_PATHSTATUS_NORMAL; +} + +/** + * Used for Blown Away cutscene path. + */ +s32 EnGe2_FollowPathWithoutGravity(EnGe2* this) { + s32 pad; + Vec3s* curPoint; + Path* path = this->path; + Vec3f point; + s16 yawTarget; + s16 pitchTarget; + + if (this->path == NULL) { + return true; + } + + curPoint = Lib_SegmentedToVirtual(path->points); + curPoint += this->curPointIndex; + + Math_Vec3s_ToVec3f(&point, curPoint); + yawTarget = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &point); + pitchTarget = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &point); + Math_SmoothStepToS(&this->picto.actor.world.rot.y, yawTarget, 0xA, 0x3E8, 0x64); + Math_SmoothStepToS(&this->picto.actor.world.rot.x, pitchTarget, 6, 0x7D0, 0xC8); + this->picto.actor.speed = 15.0f; + + Actor_MoveWithoutGravityReverse(&this->picto.actor); + + if (Math_Vec3f_DistXYZ(&this->picto.actor.world.pos, &point) < 40.0f) { + return true; + } else { + return false; + } +} + +/* Action and helper functions */ + +void EnGe2_SpawnEffects(EnGe2* this, PlayState* play) { + static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f }; + static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; + static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 }; + static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 }; + s16 effectAngle = play->state.frames * 0x2800; + Vec3f effectPos; + + effectPos.x = (Math_CosS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.x; + effectPos.y = this->picto.actor.focus.pos.y + 10.0f; + effectPos.z = (Math_SinS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.z; + EffectSsKirakira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor, + 1000, 16); +} + +void EnGe2_Scream(EnGe2* this) { + if ((s32)Rand_ZeroFloat(2.0f) == 0) { + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO00); + } else { + Actor_PlaySfx(&this->picto.actor, NA_SE_VO_FPVO01); + } +} + +/** + * Wait for timer to finish, then set up the captured/thrown out transition. + */ +void EnGe2_ThrowPlayerOut(EnGe2* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + } else if (play->nextEntrance != play->setupExitList[GERUDO_PURPLE_GET_EXIT(&this->picto.actor)]) { + play->nextEntrance = play->setupExitList[GERUDO_PURPLE_GET_EXIT(&this->picto.actor)]; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_38; + } +} + +/** + * Used if Aveil spots Player. + */ +void EnGe2_TurnToPlayerFast(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x1000, 0x200); +} + +void EnGe2_CapturePlayer(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x400, 0x100); + EnGe2_ThrowPlayerOut(this, play); +} + +void EnGe2_SetupCapturePlayer(EnGe2* this) { + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_CapturePlayer; + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); +} + +void EnGe2_Charge(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x400, 0x100); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; + + if (this->picto.actor.xzDistToPlayer < 50.0f) { + EnGe2_SetupCapturePlayer(this); + } else if (!(this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + this->picto.actor.world.pos = this->picto.actor.prevPos; + EnGe2_SetupCapturePlayer(this); + } + + if (this->timer > 0) { + this->timer--; + } else { + EnGe2_ThrowPlayerOut(this, play); + } + + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } +} + +void EnGe2_SetupCharge(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x400, 0x100); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; + + if (this->picto.actor.shape.rot.y == this->picto.actor.yawTowardsPlayer) { + Animation_Change(&this->skelAnime, &gGerudoPurpleChargingAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleChargingAnim), 0, -8.0f); + this->timer = 50; + this->picto.actor.speed = 4.0f; + this->actionFunc = EnGe2_Charge; + } +} + +void EnGe2_SetupLookAround(EnGe2* this) { + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + this->timer = 60; + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_LookAround; +} + +void EnGe2_Stunned(EnGe2* this, PlayState* play) { + if (this->picto.actor.colorFilterTimer == 0) { + EnGe2_SetupLookAround(this); + this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + this->stateFlags &= ~GERUDO_PURPLE_STATE_STUNNED; + } +} + +void EnGe2_KnockedOut(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnGe2_SpawnEffects(this, play); + + if (this->timer > 0) { + this->timer--; + } else { + EnGe2_SetupLookAround(this); + this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + this->stateFlags &= ~GERUDO_PURPLE_STATE_KO; + this->picto.actor.flags |= ACTOR_FLAG_1; + } +} + +/** + * Carries out various patrol functions: + * - Turning to Player if being arrested + * - Turning to Player if spotted by Aveil + * - Looking for Player + * - Managing collisions and collider + */ +void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 visionRange = gSaveContext.save.isNight ? 200.0f : 280.0f; + + if (player->csMode == 0x1A) { + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_SetupCharge; + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + this->stateFlags |= GERUDO_PURPLE_STATE_CAPTURING; + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_80_08)) { + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_TurnToPlayerFast; + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + } else if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos, + this->picto.actor.shape.rot.y, 0x1800, visionRange, this->verticalDetectRange)) { + if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { + this->picto.actor.speed = 0.0f; + func_800B7298(play, &this->picto.actor, 0x1A); + func_801000A4(NA_SE_SY_FOUND); + Message_StartTextbox(play, 0x1194, &this->picto.actor); + this->actionFunc = EnGe2_SetupCharge; + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + } + } else if (this->collider.base.acFlags & AC_HIT) { + if ((this->collider.info.acHitInfo != NULL) && + (this->collider.info.acHitInfo->toucher.dmgFlags & DMG_DEKU_NUT)) { + Actor_SetColorFilter(&this->picto.actor, 0, 120, 0, 400); + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_Stunned; + this->stateFlags |= GERUDO_PURPLE_STATE_STUNNED; + } else { + Animation_Change(&this->skelAnime, &gGerudoPurpleFallingToGroundAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), 2, -8.0f); + this->timer = 200; + this->picto.actor.speed = 0.0f; + this->actionFunc = EnGe2_KnockedOut; + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); + this->picto.actor.flags &= ~ACTOR_FLAG_1; + this->stateFlags |= GERUDO_PURPLE_STATE_KO; + } + } else if (this->picto.actor.home.rot.x == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } +} + +void EnGe2_LookAround(EnGe2* this, PlayState* play) { + u8 detectedStatus; + + SkelAnime_Update(&this->skelAnime); + + detectedStatus = EnGe2_DetectPlayer(play, this); + if (detectedStatus != GERUDO_PURPLE_DETECTION_UNDETECTED) { + this->timer = 100; + this->yawTarget = this->picto.actor.yawTowardsPlayer; + + if (this->detectedStatus < detectedStatus) { + this->detectedStatus = detectedStatus; + } + } + + if (this->timer > 0) { + this->timer--; + } else { + this->actionFunc = EnGe2_Walk; + Animation_Change(&this->skelAnime, &gGerudoPurpleWalkingAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), 0, -8.0f); + this->headRot.y = 0; + this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; + } + + switch (this->detectedStatus) { + case GERUDO_PURPLE_DETECTION_HEARD: + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->yawTarget, 2, 0x3E8, 0x1F4); + break; + + case GERUDO_PURPLE_DETECTION_PROXIMITY: + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->yawTarget, 2, 0xBB8, 0x3E8); + break; + + default: + break; + } + + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; + EnGe2_PatrolDuties(this, play); +} + +void EnGe2_Walk(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + this->picto.actor.speed = 1.5f; + + switch (EnGe2_FollowPath(this)) { + case GERUDO_PURPLE_PATHSTATUS_END: + EnGe2_SetupPath(this, play); + break; + + case GERUDO_PURPLE_PATHSTATUS_AT_POINT: + EnGe2_SetupLookAround(this); + this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; + break; + + default: // GERUDO_PURPLE_PATHSTATUS_NORMAL + break; + } + + this->detectedStatus = EnGe2_DetectPlayer(play, this); + if (this->detectedStatus != GERUDO_PURPLE_DETECTION_UNDETECTED) { + EnGe2_SetupLookAround(this); + this->yawTarget = this->picto.actor.yawTowardsPlayer; + } + EnGe2_PatrolDuties(this, play); +} + +void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (Cutscene_CheckActorAction(play, 476)) { + s16 csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 476)]->action; + if (this->csAction != csAction) { + this->csAction = csAction; + + switch (csAction) { + case ENGE2_CSACTION_BEEHIVE_PATROL: + Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); + EnGe2_GetNextPath(this, play); + break; + + case ENGE2_CSACTION_BEEHIVE_RUN_AWAY: + Animation_Change(&this->skelAnime, &gGerudoPurpleRunningAwayCutsceneAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), 0, -5.0f); + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + break; + + case ENGE2_CSACTION_BEEHIVE_EXIT: + Actor_Kill(&this->picto.actor); + break; + + case ENGE2_CSACTION_GBT_ENTR_STAND_STILL: + Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f); + break; + + case ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY: + Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, 2, 0.0f); + EnGe2_SetupBlownAwayPath(this, play); + this->stateFlags |= GERUDO_PURPLE_STATE_DISABLE_MOVEMENT; + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + break; + + default: + break; + } + } + } + + switch (this->csAction) { + case ENGE2_CSACTION_BEEHIVE_RUN_AWAY: + EnGe2_FollowPath(this); + this->picto.actor.speed = 5.0f; + + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe2_Scream(this); + } + break; + + case ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY: + if ((this->curPointIndex < this->path->count) && EnGe2_FollowPathWithoutGravity(this)) { + this->curPointIndex++; + } + + // Tumble in the air + this->picto.actor.shape.rot.x += 0x3E8; + this->picto.actor.shape.rot.y += 0x7D0; + this->picto.actor.shape.rot.z += 0x1F4; + + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe2_Scream(this); + } + break; + + default: + break; + } +} + +// Used for those on boats +void EnGe2_GuardStationary(EnGe2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos, this->picto.actor.shape.rot.y, + 0x4000, 720.0f, this->verticalDetectRange)) { + if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) { + func_800B7298(play, &this->picto.actor, 0x1A); + func_801000A4(NA_SE_SY_FOUND); + Message_StartTextbox(play, 0x1194, &this->picto.actor); + this->timer = 50; + EnGe2_SetupCapturePlayer(this); + } + } + + if (this->picto.actor.playerHeightRel < -150.0f) { + this->picto.actor.draw = NULL; + } else { + this->picto.actor.draw = EnGe2_Draw; + } +} + +void EnGe2_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnGe2* this = THIS; + + if (!(this->stateFlags & GERUDO_PURPLE_STATE_DISABLE_MOVEMENT)) { + Actor_MoveWithGravity(&this->picto.actor); + } + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, 5); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + + if (Cutscene_CheckActorAction(play, 476)) { + this->actionFunc = EnGe2_PerformCutsceneActions; + this->stateFlags &= ~GERUDO_PURPLE_STATE_KO; + this->stateFlags &= ~GERUDO_PURPLE_STATE_PATH_REVERSE; + this->picto.actor.flags |= ACTOR_FLAG_20; + this->picto.actor.speed = 0.0f; + } + + this->actionFunc(this, play); + + // Blinking + if (this->stateFlags & GERUDO_PURPLE_STATE_KO) { + this->eyeIndex = 2; + } else if (!(this->stateFlags & GERUDO_PURPLE_STATE_STUNNED)) { + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); + } + this->eyeIndex = this->blinkTimer; + if (this->eyeIndex >= 3) { + this->eyeIndex = 0; + } + } +} + +s32 EnGe2_ValidatePictograph(PlayState* play, Actor* thisx) { + s32 ret = Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 400.0f, -1); + + ret |= Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 1200.0f, -1); + return ret; +} + +s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnGe2* this = THIS; + + if (limbIndex == GERUDO_PURPLE_NECK_LIMB) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; + } + return false; +} + +void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f }; + + if (limbIndex == GERUDO_PURPLE_HEAD_LIMB) { + Matrix_MultVec3f(&sFocusOffset, &thisx->focus.pos); + } +} + +void EnGe2_Draw(Actor* thisx, PlayState* play) { + static TexturePtr sEyeTextures[] = { + gGerudoPurpleEyeOpenTex, + gGerudoPurpleEyeHalfTex, + gGerudoPurpleEyeClosedTex, + }; + s32 pad; + EnGe2* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C5B0(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); + func_800B8050(&this->picto.actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, &this->picto.actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 0558166db..739e94277 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -2,14 +2,58 @@ #define Z_EN_GE2_H #include "global.h" +#include "z64snap.h" +#include "objects/object_gla/object_gla.h" struct EnGe2; typedef void (*EnGe2ActionFunc)(struct EnGe2*, PlayState*); +#define GERUDO_PURPLE_GET_EXIT(thisx) (((thisx)->params) & 0x1F) //!< Exit to send Player to when caught +#define GERUDO_PURPLE_GET_TYPE(thisx) (((thisx)->params & 0xE0) >> 5) +#define GERUDO_PURPLE_GET_PATH(thisx) ((((thisx)->params) & 0xFC00) >> 10) + +#define GERUDO_PURPLE_PARAMS(path, type, exit) (((path) & 0x1F) | (((type) & 7) << 5) | (((exit) & 0x3F) << 10)) + +#define GERUDO_PURPLE_EXIT_NONE 0x1F +#define GERUDO_PURPLE_PATH_NONE 0x3F + +typedef enum { + /* 0 */ GERUDO_PURPLE_TYPE_CUTSCENE, + /* 1 */ GERUDO_PURPLE_TYPE_BOAT_SENTRY, //!< on boats + /* 2 */ GERUDO_PURPLE_TYPE_AVEIL_GUARD, + /* 7 */ GERUDO_PURPLE_TYPE_FORTRESS = 7 //!< In both courtyard and rooms +} GerudoPurpleType; + +//! TODO: work out where to put this +typedef enum { + /* 1 */ ENGE2_CSACTION_BEEHIVE_PATROL = 1, + /* 2 */ ENGE2_CSACTION_BEEHIVE_RUN_AWAY, + /* 3 */ ENGE2_CSACTION_BEEHIVE_EXIT, + /* 4 */ ENGE2_CSACTION_GBT_ENTR_STAND_STILL, + /* 5 */ ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY +} EnGe2CsAction; + typedef struct EnGe2 { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x1C4]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ ColliderCylinder collider; + /* 0x194 */ SkelAnime skelAnime; + /* 0x1D8 */ Vec3s jointTable[GERUDO_PURPLE_LIMB_MAX]; + /* 0x25C */ Vec3s morphTable[GERUDO_PURPLE_LIMB_MAX]; + /* 0x2E0 */ s16 eyeIndex; + /* 0x2E2 */ s16 blinkTimer; + /* 0x2E4 */ Vec3s headRot; + /* 0x2E8 */ Vec3s torsoRot; // unused, inferred from similar usage in other actors + /* 0x2F0 */ Path* path; + /* 0x2F4 */ s32 curPointIndex; + /* 0x2F8 */ u16 stateFlags; + /* 0x2FA */ s16 yawTarget; //!< used when Player detected to fix the yaw to turn to + /* 0x2FC */ f32 verticalDetectRange; //!< vertical range to look for the player within + /* 0x300 */ u8 timer; + /* 0x301 */ u8 detectedStatus; + /* 0x302 */ s16 csAction; + /* 0x304 */ s16 unk304; // unused + /* 0x306 */ s16 screamTimer; /* 0x308 */ EnGe2ActionFunc actionFunc; } EnGe2; // size = 0x30C diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index 1da6c1a61..04353d954 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -222,13 +222,13 @@ void func_80BB178C(EnGeg* this, PlayState* play) { } s32 func_80BB18FC(EnGeg* this, Actor* actor) { - if (actor->bgCheckFlags & 1) { + if (actor->bgCheckFlags & BGCHECKFLAG_GROUND) { f32 sp24 = Math_Vec3f_DistXZ(&this->actor.world.pos, &actor->world.pos); f32 sp20 = Math_Vec3f_DiffY(&this->actor.world.pos, &actor->world.pos); if ((sp24 < 150.0f) && (fabsf(sp20) < 5.0f)) { this->unk_230 |= 0x20; - actor->speedXZ = 0.0f; + actor->speed = 0.0f; actor->velocity.y = 0.0f; this->actor.child = actor; actor->parent = &this->actor; @@ -624,7 +624,7 @@ void func_80BB2944(EnGeg* this, PlayState* play) { this->actionFunc = func_80BB2520; } else { this->unk_496 = func_80BB16D0(this); - func_80151938(play, this->unk_496); + Message_ContinueTextbox(play, this->unk_496); } } } @@ -663,7 +663,7 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { this->unk_230 |= 0x10; ActorCutscene_StartAndSetFlag(this->unk_498, &this->actor); this->unk_496 = 0xD68; - func_80151938(play, this->unk_496); + Message_ContinueTextbox(play, this->unk_496); this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); if (this->unk_248 >= 0) { this->unk_4AC = 13; @@ -716,7 +716,7 @@ void func_80BB2E00(EnGeg* this, PlayState* play) { func_80BB2020(this, play); this->actionFunc = func_80BB30B4; } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_STAND_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_STAND_IMT); } } else if (this->unk_4AC == 4) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -729,7 +729,7 @@ void func_80BB2E00(EnGeg* this, PlayState* play) { this->actionFunc = func_80BB3318; } } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT); } } } @@ -739,24 +739,24 @@ void func_80BB2F7C(EnGeg* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->actor.xzDistToPlayer < 150.0f) && (fabsf(this->actor.playerHeightRel) < 10.0f) && - (this->actor.bgCheckFlags & 1)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_4AC = 2; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_230 &= ~1; this->actor.shape.yOffset = 0.0f; func_80BB2020(this, play); this->actionFunc = func_80BB2E00; } else { - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; Actor_MoveWithGravity(&this->actor); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_230 & 0x80) { func_800B9010(&this->actor, NA_SE_EN_GOLON_SIRLOIN_ROLL - SFX_FLAG); } else { this->unk_230 |= 0x80; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } } } @@ -804,7 +804,7 @@ void func_80BB31B8(EnGeg* this, PlayState* play) { } this->actionFunc = func_80BB32AC; } else { - Actor_PickUp(&this->actor, play, getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 300.0f, 300.0f); } } @@ -813,7 +813,7 @@ void func_80BB32AC(EnGeg* this, PlayState* play) { Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB27D4; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -841,7 +841,7 @@ void func_80BB3318(EnGeg* this, PlayState* play) { func_800AEF44(Effect_GetByIndex(this->unk_4DC)); Actor_Kill(&this->actor); } else { - Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 10.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } @@ -1058,7 +1058,7 @@ void func_80BB3BE0(EnGeg* this, PlayState* play) { } void func_80BB3CB4(EnGeg* this, PlayState* play) { - f32 sp24 = play->state.frames * this->actor.speedXZ * 1400.0f; + f32 sp24 = play->state.frames * this->actor.speed * 1400.0f; OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index a6c2a31ec..a2ece1010 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -8,7 +8,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_gg/object_gg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnGg*)thisx) @@ -129,7 +129,7 @@ s32 func_80B34FB4(EnGg* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp34, &sp40); if ((this->actor.xzDistToPlayer < 250.0f) && (this->actor.xzDistToPlayer > 50.0f) && - (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80))) { + (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) || CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80))) { Math_SmoothStepToS(&this->unk_2E8, pitch, 4, 0x2AA8, 1); } else { Math_SmoothStepToS(&this->unk_2E8, 0, 4, 0x2AA8, 1); @@ -230,7 +230,7 @@ void func_80B35450(EnGg* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { Actor_DeactivateLens(play); } this->unk_308 = 1; @@ -239,7 +239,7 @@ void func_80B35450(EnGg* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { func_800B863C(&this->actor, play); this->actor.textId = 0xCEE; - } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { func_800B863C(&this->actor, play); this->actor.textId = 0xCE5; } @@ -252,7 +252,7 @@ void func_80B3556C(EnGg* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->unk_308 = 0; - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; func_80B35250(this); } else { this->actor.textId = func_80B357F0(this); @@ -652,7 +652,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - this->actor.bgCheckFlags |= 0x400; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, this->morphTable, 20); @@ -663,7 +663,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04); CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08); CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->unk_310 = this->actor.home.pos.y; this->unk_2DC = this->actor.cutscene; this->actor.flags |= ACTOR_FLAG_2000000; @@ -683,10 +683,10 @@ void EnGg_Update(Actor* thisx, PlayState* play) { EnGg* this = THIS; if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; this->actor.flags |= ACTOR_FLAG_1; } else { - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->actor.flags &= ~ACTOR_FLAG_1; } @@ -709,7 +709,7 @@ void EnGg_Update(Actor* thisx, PlayState* play) { } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10) && - (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || + (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80) || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) || (this->unk_308 == 1))) { SET_WEEKEVENTREG(WEEKEVENTREG_91_10); } @@ -797,7 +797,7 @@ void EnGg_Draw(Actor* thisx, PlayState* play) { POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGg_OverrideLimbDraw, EnGg_PostLimbDraw, &this->actor, POLY_OPA_DISP); - } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_308 == 1)) { + } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) || (this->unk_308 == 1)) { func_8012C2DC(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B36DFC[this->unk_2E2])); diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 6da3b1378..d30dd6bd8 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -7,7 +7,7 @@ #include "z_en_gg2.h" #include "objects/object_gg/object_gg.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnGg2*)thisx) @@ -89,7 +89,7 @@ s32 func_80B3AC94(EnGg2* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp34, &sp40); if ((this->actor.xzDistToPlayer < 250.0f) && (this->actor.xzDistToPlayer > 50.0f) && - CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { Math_SmoothStepToS(&this->unk_2F4, pitch, 4, 0x2AA8, 1); } else { Math_SmoothStepToS(&this->unk_2F4, 0, 4, 0x2AA8, 1); @@ -159,14 +159,14 @@ void func_80B3AFB0(EnGg2* this, PlayState* play) { this->unk_2F0 = 1; this->actionFunc = func_80B3AE60; } else if ((this->actor.xzDistToPlayer < 100.0f) && (this->actor.xzDistToPlayer > 50.0f) && - CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { func_800B863C(&this->actor, play); this->actor.textId = 0xCE4; } } void func_80B3B05C(EnGg2* this, PlayState* play) { - if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { this->actionFunc = func_80B3B5D4; } } @@ -192,18 +192,18 @@ void func_80B3B120(EnGg2* this, PlayState* play) { if (func_80B3B648(this, this->unk_1D8, this->unk_1DC) != 0) { if (this->unk_1DC >= (this->unk_1D8->count - 2)) { this->actionFunc = func_80B3AE60; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { this->unk_1DC++; } } - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 1.0f); } } void func_80B3B21C(EnGg2* this, PlayState* play) { - this->actor.speedXZ = 0.0f; - if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + this->actor.speed = 0.0f; + if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { this->unk_2E4 = ActorCutscene_GetAdditionalCutscene(this->unk_2E4); this->actionFunc = func_80B3B5D4; } @@ -256,7 +256,7 @@ void func_80B3B294(EnGg2* this, PlayState* play) { } } } - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 1.0f); } void func_80B3B4B0(EnGg2* this, PlayState* play) { @@ -366,11 +366,11 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - this->actor.bgCheckFlags |= 0x400; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, this->morphTable, 20); this->unk_1D8 = SubS_GetPathByIndex(play, ENGG2_GET_FC00(&this->actor), 0x3F); - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->unk_2F0 = 0; this->unk_2F1 = 0; this->unk_2F2 = 0; @@ -422,13 +422,13 @@ void EnGg2_Update(Actor* thisx, PlayState* play) { EnGg2* this = THIS; if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; this->actor.flags |= ACTOR_FLAG_1; if ((this->unk_2EE == 5) && (this->unk_2EE == 7)) { this->actor.flags &= ~ACTOR_FLAG_1; } } else { - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->actor.flags &= ~ACTOR_FLAG_1; } @@ -481,7 +481,7 @@ void EnGg2_Draw(Actor* thisx, PlayState* play) { func_8012C2DC(play->state.gfxCtx); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_2F0 == 1)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) || (this->unk_2F0 == 1)) { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3C0AC[this->unk_2EA])); POLY_XLU_DISP = diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index dbd180359..078c136b9 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -371,10 +371,10 @@ void EnGiant_PlaySound(EnGiant* this) { if (this->actor.draw != NULL && this->alpha > 0) { if (this->animIndex == GIANT_ANIM_WALKING_LOOP && (Animation_OnFrame(&this->skelAnime, 40.0f) || Animation_OnFrame(&this->skelAnime, 100.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_WALK); } if (this->animIndex == GIANT_ANIM_FALLING_OVER && Animation_OnFrame(&this->skelAnime, 40.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_VOICE_FAIL); + Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_VOICE_FAIL); } if (this->sfxId != 0xFFFF && ((this->animIndex == GIANT_ANIM_BIG_CALL_START && this->skelAnime.curFrame >= 18.0f) || diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index 88d55dc14..350ce734c 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -199,7 +199,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { case 0x45C: // given 1000 reward case 0x45D: // given 5000 reward this->isStampChecked = false; - func_801477B4(play); + Message_CloseTextbox(play); EnGinkoMan_SetupBankAward(this); EnGinkoMan_BankAward(this, play); break; @@ -270,7 +270,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { break; case 0x470: // "Is that so? Come back and deposit some after saving up a bunch!" if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->isStampChecked = false; EnGinkoMan_SetupIdle(this); // change to waiting for approach } @@ -510,7 +510,7 @@ void EnGinkoMan_Dialogue(EnGinkoMan* this, PlayState* play) { if ((this->skelAnime.animation == &object_boj_Anim_0008C0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BANK_MAN_HAND_HIT); + Actor_PlaySfx(&this->actor, NA_SE_EV_BANK_MAN_HAND_HIT); } } @@ -525,16 +525,16 @@ void EnGinkoMan_BankAward(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupBankAward2(this); } else if (this->curTextId == 0x45B) { // "Whats this, you already saved up 200?" if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_10_08)) { - Actor_PickUp(&this->actor, play, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_WALLET_ADULT + CUR_UPG_VALUE(UPG_WALLET), 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } } else if (this->curTextId == 0x45C) { // "Whats this, you already saved up 5000?" - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_08)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 500.0f, 100.0f); } } @@ -579,7 +579,7 @@ void EnGinkoMan_SetupStamp(EnGinkoMan* this) { void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play) { if ((this->curTextId == 0x464) // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt." && (Animation_OnFrame(&this->skelAnime, 10.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); // "stamp" + Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); // "stamp" } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 65df46284..28267a485 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -159,8 +159,8 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc action) { void EnGirlA_InitObjIndex(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; - //! @bug: Condition is impossible, && should be an || if ((params >= SI_MAX) && (params < SI_POTION_RED_1)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 9704d6204..3c4ea82f0 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -268,7 +268,7 @@ s32 func_80B50854(EnGk* this, PlayState* play) { void func_80B50954(EnGk* this) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLONKID_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLONKID_WALK); } } @@ -511,7 +511,7 @@ void func_80B51410(EnGk* this, PlayState* play) { } if (ActorCutscene_GetCanPlayNext(this->unk_318)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLONKID_SOB_TALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLONKID_SOB_TALK); ActorCutscene_Start(this->unk_318, &this->actor); this->unk_1E4 &= ~0x20; return; @@ -816,12 +816,12 @@ void func_80B51EA4(EnGk* this, PlayState* play) { } } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp38.y = this->actor.wallYaw; } if (ABS_ALT(sp36) < 0x2AAA) { - Math_ApproachF(&this->actor.speedXZ, 3.0f, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, 3.0f, 0.2f, 0.5f); } Actor_MoveWithGravity(&this->actor); } @@ -897,7 +897,7 @@ void func_80B5227C(EnGk* this, PlayState* play) { if (!(this->unk_1E4 & 0x80)) { SET_WEEKEVENTREG(WEEKEVENTREG_22_04); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT); this->unk_350 = 0x4000; this->actionFunc = func_80B52654; } @@ -968,7 +968,7 @@ void func_80B5253C(EnGk* this, PlayState* play) { } this->actionFunc = func_80B525E0; } else { - Actor_PickUp(&this->actor, play, sp24, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, sp24, 300.0f, 300.0f); } } @@ -978,7 +978,7 @@ void func_80B525E0(EnGk* this, PlayState* play) { Message_StartTextbox(play, this->unk_31C, &this->actor); this->actionFunc = func_80B52430; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -993,7 +993,7 @@ void func_80B52654(EnGk* this, PlayState* play) { this->actor.scale.z = 0.006f - this->unk_354; this->actor.scale.x = 0.006f + this->unk_354; if (this->unk_350 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLONKID_SNORE); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLONKID_SNORE); } } @@ -1226,8 +1226,8 @@ TexturePtr D_80B533E4[] = { void EnGk_Draw(Actor* thisx, PlayState* play) { s32 pad; EnGk* this = THIS; - Vec3f sp5C; - Vec3f sp50; + Vec3f pos; + Vec3f scale; OPEN_DISPS(play->state.gfxCtx); @@ -1242,12 +1242,12 @@ void EnGk_Draw(Actor* thisx, PlayState* play) { func_8012C2DC(play->state.gfxCtx); - sp5C = this->actor.world.pos; - sp50.x = 0.2f; - sp50.y = 0.2f; - sp50.z = 0.2f; + pos = this->actor.world.pos; + scale.x = 0.2f; + scale.y = 0.2f; + scale.z = 0.2f; - func_800BC620(&sp5C, &sp50, 255, play); + func_800BC620(&pos, &scale, 255, play); } else { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B533E4[this->unk_2E0])); @@ -1259,20 +1259,21 @@ void EnGk_Draw(Actor* thisx, PlayState* play) { func_8012C2DC(play->state.gfxCtx); if ((this->unk_2E4 == 0) || (this->unk_2E4 == 1) || (this->unk_2E4 == 2) || (this->unk_2E4 == 3) || (this->unk_2E4 == 4)) { - sp5C.x = this->actor.world.pos.x - 15.0f; - sp5C.y = this->actor.world.pos.y; - sp5C.z = this->actor.world.pos.z; + pos.x = this->actor.world.pos.x - 15.0f; + pos.y = this->actor.world.pos.y; + pos.z = this->actor.world.pos.z; - sp50.x = 0.2f; - sp50.y = 0.2f; - sp50.z = 0.2f; + scale.x = 0.2f; + scale.y = 0.2f; + scale.z = 0.2f; } else { - sp5C = this->actor.world.pos; - sp50.x = 0.2f; - sp50.y = 0.2f; - sp50.z = 0.2f; + pos = this->actor.world.pos; + scale.x = 0.2f; + scale.y = 0.2f; + scale.z = 0.2f; } - func_800BC620(&sp5C, &sp50, 255, play); + + func_800BC620(&pos, &scale, 255, play); } } diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 01146c0cf..4c0dd92d9 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -328,7 +328,7 @@ s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { s32 func_8094E0F8(EnGm* this, PlayState* play) { s32 ret = false; - if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.unk31 == 0)) { + if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.status == 0)) { this->unk_260 = play->roomCtx.curRoom.num; this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); this->actor.draw = NULL; @@ -500,7 +500,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { switch (this->unk_3E0) { case 0: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); func_8094E054(this, play, 2); this->unk_3E2 = 0; this->unk_3E0++; @@ -552,7 +552,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { break; case 8: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); ActorCutscene_Stop(sp4A); this->unk_3E2 = 0; this->unk_3E0++; @@ -637,7 +637,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) { ret = true; break; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); func_8094E054(this, play, 2); this->unk_3E2 = 0; this->unk_3E0++; @@ -657,7 +657,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) { break; case 2: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); this->unk_3E2 = 0; this->unk_3E0++; @@ -965,7 +965,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) && Animation_OnFrame(&this->skelAnime, 20.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); + Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); } return false; @@ -1427,7 +1427,7 @@ s32 func_80950690(EnGm* this, PlayState* play) { case 7: this->unk_3D0 += 992; if (DECR(this->unk_3B8) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_GO_SLEEP); + Actor_PlaySfx(&this->actor, NA_SE_VO_GO_SLEEP); this->unk_3B8 = 30; } break; @@ -1465,7 +1465,7 @@ s32 func_80950804(EnGm* this, PlayState* play) { Lib_Vec3f_TranslateAndRotateY(&this->unk_278, this->actor.world.rot.y, &sp38, &this->actor.world.pos); this->unk_3BA += this->timePathTimeSpeed; if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PIRATE_WALK); } } @@ -1521,7 +1521,7 @@ s32 func_8095097C(EnGm* this, PlayState* play) { this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; } else if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PIRATE_WALK); } return false; } @@ -1641,7 +1641,7 @@ void func_80950F2C(EnGm* this, PlayState* play) { sp2C = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 526)]->action; if (this->unk_259 != (sp2C & 0xFF)) { if (sp2C == 3) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHAIR_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); } this->unk_259 = sp2C; func_8094E054(this, play, sp50[sp2C]); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e1250dbc6..3f6fee765 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -759,19 +759,19 @@ s32 func_80A12B78(EnGo* this, PlayState* play) { if (play->csCtx.state == 0) { if (this->unk_3DC == 4) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_CIRCLE); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE); } if (Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT); } } else if ((this->unk_3DC == 2) || (this->unk_3DC == 3)) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_CIRCLE_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE_OFF); } if (Animation_OnFrame(&this->skelAnime, 24.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_STAND_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_STAND_IMT); } } } @@ -1012,7 +1012,7 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) { f32 temp_f14 = this->actor.velocity.y + this->actor.gravity; s32 ret; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { ret = true; } else { if (temp_f14 > 0.0f) { @@ -1165,7 +1165,7 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { case 3: this->unk_3C2++; if (this->unk_3C2 >= 10) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_JUMP); this->actor.velocity.y = 10.0f; this->actor.gravity = -1.0f; this->unk_3C4++; @@ -1174,7 +1174,7 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { case 4: if (func_80A13564(this, 10.0f, 0.004f, 6)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_LAND_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_LAND_BIG); func_80A13728(this, play); this->unk_3C4++; this->unk_3C2 = 0; @@ -1242,7 +1242,7 @@ s32 func_80A13E80(EnGo* this, PlayState* play) { case 2: if (Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_HAND_HIT); + Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_HAND_HIT); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -1515,7 +1515,7 @@ void func_80A149B0(EnGo* this, PlayState* play) { s16 sp26 = this->actor.world.rot.y; if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); } else if (ENGO_GET_F(&this->actor) != ENGO_F_8) { if (func_80A1222C(this, play)) { SubS_UpdateFlags(&this->unk_390, 0, 7); @@ -1582,7 +1582,7 @@ void func_80A14B30(EnGo* this, PlayState* play) { } else { sfxId = NA_SE_EN_GOLON_SNORE2; } - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } this->unk_3AE += 0x400; this->actor.shape.yOffset = (this->actor.scale.y / this->unk_3A4) * 14.0f; @@ -1620,7 +1620,7 @@ void func_80A14EB0(EnGo* this, PlayState* play) { EnGo* sp24 = (EnGo*)this->actor.child; if ((s32)(this->unk_39C * 3.0f) != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); Math_ApproachF(&this->unk_39C, 0.0f, 0.02f, 1.0f); this->unk_3A0 = (this->unk_39C / 0.9f) * 100.0f; func_80A139E4(this); @@ -1696,7 +1696,7 @@ void func_80A14FC8(EnGo* this, PlayState* play) { case 6: if ((s32)(this->unk_39C * 3.0f) != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); Math_ApproachF(&this->unk_39C, 0.0f, 0.02f, 1.0f); this->unk_3A0 = (this->unk_39C / 0.9f) * 100.0f; func_80A139E4(this); @@ -1711,42 +1711,42 @@ void func_80A14FC8(EnGo* this, PlayState* play) { case 55: case 100: case 130: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_COLD); break; case 185: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_WAKE_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WAKE_UP); break; case 250: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_EYE_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_EYE_BIG); break; case 465: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IWAIGORON_SOLO); + Actor_PlaySfx(&this->actor, NA_SE_EN_IWAIGORON_SOLO); break; case 490: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_VOICE_EATFULL); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_VOICE_EATFULL); break; } } else if (actorActionCmd == 129) { switch (play->csCtx.frames) { case 360: case 390: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_COLD); break; case 430: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_WAKE_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WAKE_UP); break; case 450: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_EYE_BIG); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_EYE_BIG); break; case 480: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_VOICE_EATFULL); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_VOICE_EATFULL); break; } } @@ -1763,16 +1763,16 @@ void func_80A153FC(EnGo* this, PlayState* play) { Vec3f sp44; if ((this->unk_390 & 0x1000) && (this->actor.colChkInfo.damageEffect == 0xF)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); this->actor.flags &= ~ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; func_80A118F8(this->unk_3F8, this->actor.world.pos); this->actor.shape.rot.x = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_COLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_COLD); if (gSaveContext.save.day == 3) { func_80A141D4(this, play); @@ -1783,7 +1783,7 @@ void func_80A153FC(EnGo* this, PlayState* play) { } } else if (this->unk_284 != NULL) { if (this->unk_390 & 0x800) { - func_800B8E58(GET_PLAYER(play), NA_SE_PL_BODY_HIT); + Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); } @@ -1801,16 +1801,16 @@ void func_80A153FC(EnGo* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp50, &sp44), 4, 0x38E); this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->actor.bgCheckFlags & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Actor_PlaySfx(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG); func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_3E8), &this->actor.world.pos, 18.0f, this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } else { func_800AEF44(Effect_GetByIndex(this->unk_3E8)); } - this->actor.speedXZ = 4.0f; - this->actor.shape.rot.x += (s16)(this->actor.speedXZ * 546.0f); + this->actor.speed = 4.0f; + this->actor.shape.rot.x += (s16)(this->actor.speed * 546.0f); Actor_MoveWithGravity(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 98d27f735..312e1a9d9 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -358,7 +358,7 @@ s32 func_8093F34C(EnGoroiwa* this) { f32 x; f32 z; - Math_StepToF(&this->actor.speedXZ, D_80942DFC[this->unk_1E4], 0.3f); + Math_StepToF(&this->actor.speed, D_80942DFC[this->unk_1E4], 0.3f); Actor_UpdateVelocityWithGravity(&this->actor); temp_v0 = &this->unk_1D0[this->unk_1D8]; this->actor.velocity.y *= 0.97f; @@ -368,7 +368,7 @@ s32 func_8093F34C(EnGoroiwa* this) { tempX = x - this->actor.world.pos.x; tempZ = z - this->actor.world.pos.z; - if (SQ(this->actor.speedXZ + 1.0f) < (SQ(tempX) + SQ(tempZ))) { + if (SQ(this->actor.speed + 1.0f) < (SQ(tempX) + SQ(tempZ))) { 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; @@ -393,12 +393,12 @@ s32 func_8093F498(EnGoroiwa* this) { sp2C.y = temp_v0->y; sp2C.z = temp_v0->z; - Math_StepToF(&this->actor.speedXZ, D_80942DFC[this->unk_1E4], 0.3f); + Math_StepToF(&this->actor.speed, D_80942DFC[this->unk_1E4], 0.3f); Math_Vec3f_Diff(&sp2C, &this->actor.world.pos, &this->actor.velocity); temp_f0 = Math3D_Vec3fMagnitude(&this->actor.velocity); - if ((this->actor.speedXZ + 1.0f) < temp_f0) { - Math_Vec3f_Scale(&this->actor.velocity, this->actor.speedXZ / temp_f0); + if ((this->actor.speed + 1.0f) < temp_f0) { + Math_Vec3f_Scale(&this->actor.velocity, this->actor.speed / temp_f0); 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; @@ -483,7 +483,7 @@ s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { func_8093EF54(play, &sp48, &D_80942E30[ENGOROIWA_GET_C000(&this->actor)], &D_80942E3C[ENGOROIWA_GET_C000(&this->actor)], this->actor.scale.x); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGBALL_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_BIGBALL_BOUND); } } } @@ -894,7 +894,7 @@ void func_80940E38(EnGoroiwa* this, PlayState* play) { if (this->actor.flags & ACTOR_FLAG_40) { if (this->actor.xzDistToPlayer < 1000.0f) { - sp5C = (1000.0f - this->actor.xzDistToPlayer) * 0.0012f * (this->actor.speedXZ * 0.1f); + sp5C = (1000.0f - this->actor.xzDistToPlayer) * 0.0012f * (this->actor.speed * 0.1f); if (Rand_ZeroOne() < sp5C) { this->unk_1CE += 20000; sp46 = (s32)Rand_ZeroFloat(20000.0f) + this->unk_1CE; @@ -1049,7 +1049,7 @@ s32 func_8094156C(EnGoroiwa* this, PlayState* play) { temp2 = Math_SinS(ptr->unk_1E); temp3 = Math_SinS(this->actor.world.rot.y); - ptr->unk_0C = ((1.0f / D_80942DFC[this->unk_1E4]) * (temp3 * 14.0f * this->actor.speedXZ)) + + ptr->unk_0C = ((1.0f / D_80942DFC[this->unk_1E4]) * (temp3 * 14.0f * this->actor.speed)) + (temp2 * (temp + 5.0f)); ptr->unk_10 = (Rand_ZeroOne() * 11.0f) + 20.0f; @@ -1057,7 +1057,7 @@ s32 func_8094156C(EnGoroiwa* this, PlayState* play) { temp = Rand_ZeroOne(); temp2 = Math_CosS(ptr->unk_1E); temp3 = Math_CosS(this->actor.world.rot.y); - ptr->unk_14 = ((1.0f / D_80942DFC[this->unk_1E4]) * ((temp3 * 14.0f) * this->actor.speedXZ)) + + ptr->unk_14 = ((1.0f / D_80942DFC[this->unk_1E4]) * ((temp3 * 14.0f) * this->actor.speed)) + (temp2 * (temp + 5.0f)); ptr->unk_1C = 0; @@ -1168,7 +1168,7 @@ void func_80941A10(EnGoroiwa* this, PlayState* play) { func_80941DB4(this); } - func_800B8E58(player, NA_SE_PL_BODY_HIT); + Player_PlaySfx(player, NA_SE_PL_BODY_HIT); if ((sp34 == 1) || (sp34 == 2)) { this->unk_1CC = 50; @@ -1207,8 +1207,8 @@ void func_80941A10(EnGoroiwa* this, PlayState* play) { } } - if (this->actor.bgCheckFlags & 1) { - Actor_PlaySfxAtPos(&this->actor, D_80942E9C[this->unk_1E4][this->actor.home.rot.x & 1]); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Actor_PlaySfx(&this->actor, D_80942E9C[this->unk_1E4][this->actor.home.rot.x & 1]); } } } @@ -1218,14 +1218,14 @@ void func_80941DB4(EnGoroiwa* this) { func_8093EAB0(this, 6); this->actor.gravity = -0.86f; this->actor.terminalVelocity = -15.0f; - this->actor.speedXZ *= 0.15f; + this->actor.speed *= 0.15f; this->actor.velocity.y = 5.0f; this->unk_1C4 = 1.0f; } void func_80941E28(EnGoroiwa* this, PlayState* play) { func_8093F34C(this); - if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) { if ((this->unk_1E5 & 8) && ((this->actor.home.rot.z & 3) == 1)) { func_8093EDB0(this); } @@ -1237,7 +1237,7 @@ void func_80941EB4(EnGoroiwa* this) { static s16 D_80942EAC[] = { 20, 6, 20 }; this->actionFunc = func_80941F10; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_8093EAB0(this, 6); this->unk_1C8 = D_80942EAC[this->actor.home.rot.z & 3]; this->unk_1C4 = 0.0f; @@ -1257,7 +1257,7 @@ void func_80941F54(EnGoroiwa* this) { this->actionFunc = func_80941FA4; func_8093EAB0(this, 7); this->unk_1C4 = 0.0f; - this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f; + this->actor.velocity.y = fabsf(this->actor.speed) * 0.1f; } void func_80941FA4(EnGoroiwa* this, PlayState* play) { @@ -1266,14 +1266,14 @@ void func_80941FA4(EnGoroiwa* this, PlayState* play) { if (func_8094156C(this, play) == 0) { if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & PLAYER_STATE3_80000)) { func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); - func_800B8E58(player, NA_SE_PL_BODY_HIT); + Player_PlaySfx(player, NA_SE_PL_BODY_HIT); if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { this->unk_1CC = 50; } } else if (func_8093F5EC(this)) { func_8093FC00(this); func_809419D0(this); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } } @@ -1283,7 +1283,7 @@ void func_80942084(EnGoroiwa* this) { func_8093EAB0(this, 7); this->unk_1C4 = 0.3f; this->unk_1CA = 0; - this->actor.velocity.y = fabsf(this->actor.speedXZ) * -0.3f; + this->actor.velocity.y = fabsf(this->actor.speed) * -0.3f; this->unk_1E5 |= 0x10; this->unk_1E5 &= ~0x20; } @@ -1294,7 +1294,7 @@ void func_809420F0(EnGoroiwa* this, PlayState* play) { if (func_8094156C(this, play) == 0) { if ((this->collider.base.atFlags & AT_HIT) && !(player->stateFlags3 & PLAYER_STATE3_80000)) { func_800B8D50(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); - func_800B8E58(player, NA_SE_PL_BODY_HIT); + Player_PlaySfx(player, NA_SE_PL_BODY_HIT); if (((this->actor.home.rot.z & 3) == 1) || ((this->actor.home.rot.z & 3) == 2)) { this->unk_1CC = 50; } @@ -1302,7 +1302,7 @@ void func_809420F0(EnGoroiwa* this, PlayState* play) { func_8093FC00(this); func_809419D0(this); this->unk_1E5 &= ~0x10; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } } @@ -1440,8 +1440,8 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { this->unk_1CC--; } - if ((ENGOROIWA_GET_3000(&this->actor) == ENGOROIWA_3000_2) && (this->actor.bgCheckFlags & 1) && - (this->actionFunc == func_80941A10) && (this->actor.speedXZ > 2.0f)) { + if ((ENGOROIWA_GET_3000(&this->actor) == ENGOROIWA_3000_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->actionFunc == func_80941A10) && (this->actor.speed > 2.0f)) { Math_StepToF(&this->actor.scale.x, 0.16f, (this->actor.xzDistToPlayer < 400.0f) ? this->unk_1E0 * 1.4f : this->unk_1E0); @@ -1497,12 +1497,12 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.floorBgId = bgId; if (this->actor.world.pos.y <= (this->actor.floorHeight + 2.0f)) { - this->actor.bgCheckFlags |= 1; + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; } else { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } else { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.floorBgId = 50; } break; diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index eb7948ffb..a67c6475d 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -354,7 +354,7 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { f32 targetSpeed; Vec3f collisionCheckPos; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); diffX = this->flyingHomePos.x - this->actor.world.pos.x; diffZ = this->flyingHomePos.z - this->actor.world.pos.z; if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && @@ -397,11 +397,11 @@ void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); this->targetRot.z *= 0.8f; if (this->waitTimer != 0) { - Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 0.5f); + Math_ApproachZeroF(&this->actor.speed, 0.2f, 0.5f); } else { this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; targetSpeed = (this->index * 0.1f) + 4.0f; - Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.7f); + Math_ApproachF(&this->actor.speed, targetSpeed, 0.4f, 0.7f); Math_ApproachF(&this->rotationalVelocity, 2000.0f, 1.0f, 50.0f); Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); if (this->timer == 0) { @@ -430,7 +430,7 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { Vec3f collisionCheckPos; Player* player = GET_PLAYER(play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); if (Player_GetMask(play) == PLAYER_MASK_STONE) { EnGrasshopper_SetupFly(this); } else { @@ -450,7 +450,8 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { collisionCheckPos.y = this->actor.world.pos.y; collisionCheckPos.z = (Math_CosS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.z; - if ((this->actor.bgCheckFlags & 8) || BgCheck_SphVsFirstPoly(&play->colCtx, &collisionCheckPos, 10.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + BgCheck_SphVsFirstPoly(&play->colCtx, &collisionCheckPos, 10.0f)) { EnGrasshopper_SetupBank(this); } else if (player->stateFlags1 & PLAYER_STATE1_8000000) { this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); @@ -464,7 +465,7 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { rotationSpeed = this->index + 70; targetSpeed = (this->index * 0.05f) + 4.0f; this->targetRot.y = Math_Atan2S(diffX, diffZ); - Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.8f); + Math_ApproachF(&this->actor.speed, targetSpeed, 0.4f, 0.8f); Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, rotationSpeed, 0xFA0, 0xA); } } @@ -474,11 +475,11 @@ void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { * Unused in the final game. */ void EnGrasshopper_SetupBank(EnGrasshopper* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); this->targetBankRot.y = this->actor.world.rot.y + 0x8000; this->action = EN_GRASSHOPPER_ACTION_BANK; this->bankState = EN_GRASSHOPPER_BANK_STATE_BANKING; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actionFunc = EnGrasshopper_Bank; } @@ -487,7 +488,7 @@ void EnGrasshopper_SetupBank(EnGrasshopper* this) { * it flies forward for 100 frames. */ void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); switch (this->bankState) { case EN_GRASSHOPPER_BANK_STATE_BANKING: Math_SmoothStepToS(&this->actor.world.rot.y, this->targetBankRot.y, 0x64, 0x3E8, 0x3E8); @@ -529,9 +530,9 @@ void EnGrasshopper_SetupBounced(EnGrasshopper* this) { void EnGrasshopper_Bounced(EnGrasshopper* this, PlayState* play) { f32 targetSpeed; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); targetSpeed = (this->index * 0.05f) + 7.0f; - Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.8f); + Math_ApproachF(&this->actor.speed, targetSpeed, 0.4f, 0.8f); Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); this->targetRot.z *= 0.8f; Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); @@ -564,7 +565,7 @@ void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) { WaterBox* waterBox; Vec3f splashPos; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); this->bobPhase += 0xAF0; this->targetApproachPos.y = (Math_SinS(this->bobPhase) * 10.0f) + (player->actor.world.pos.y + 120.0f); @@ -603,11 +604,11 @@ void EnGrasshopper_SetupAttack(EnGrasshopper* this) { EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_ATTACK); this->approachSpeed = 0.0f; Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->baseFlyHeight = this->actor.world.pos.y; this->collider.elements[0].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); this->collider.elements[1].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_ATTACK); this->action = EN_GRASSHOPPER_ACTION_ATTACK; this->actionFunc = EnGrasshopper_Attack; } @@ -675,7 +676,7 @@ void EnGrasshopper_SetupWaitAfterAttack(EnGrasshopper* this) { Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); this->action = EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK; this->waitTimer = 20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); this->actionFunc = EnGrasshopper_WaitAfterAttack; } @@ -697,7 +698,7 @@ void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { Vec3f damagedVelocity; EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DAMAGE); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.flags |= ACTOR_FLAG_1; this->approachSpeed = 0.0f; this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); @@ -712,7 +713,7 @@ void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->action = EN_GRASSHOPPER_ACTION_DAMAGED; this->actionFunc = EnGrasshopper_Damaged; } @@ -726,8 +727,8 @@ void EnGrasshopper_Damaged(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DEAD); - this->actor.flags |= ACTOR_FLAG_8000000; - this->actor.speedXZ = 0.0f; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + this->actor.speed = 0.0f; this->approachSpeed = 0.0f; this->actor.velocity.y = 5.0f; this->actor.gravity = -0.5f; @@ -737,9 +738,9 @@ void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_DEAD); this->action = EN_GRASSHOPPER_ACTION_DEAD; this->actionFunc = EnGrasshopper_Dead; } @@ -768,7 +769,7 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) { void EnGrasshopper_SetupFall(EnGrasshopper* this) { EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FALL); this->action = EN_GRASSHOPPER_ACTION_FALL; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->approachSpeed = 0.0f; this->actionFunc = EnGrasshopper_Fall; } @@ -874,7 +875,7 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { return; } } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_LIGHT_ORB) { - Actor_SetColorFilter(&this->actor, 0x8000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, 255, COLORFILTER_BUFFLAG_OPA, 25); this->drawDmgEffTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, @@ -887,7 +888,7 @@ void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { if (attackDealsDamage) { Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health > 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BATTA_DAMAGE); EnGrasshopper_SetupDamaged(this, play); } else { EnGrasshopper_SetupDead(this, play); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 08133cc63..aea9d4ac3 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -249,7 +249,7 @@ void func_80997E4C(EnGs* this, PlayState* play) { this->unk_210 = this->unk_195 + 0x20F7; break; } - func_80151938(play, this->unk_210); + Message_ContinueTextbox(play, this->unk_210); break; default: @@ -281,7 +281,7 @@ void func_8099807C(EnGs* this, PlayState* play) { if (!Flags_GetSwitch(play, this->unk_196)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); Flags_SetSwitch(play, this->unk_196); } break; @@ -290,7 +290,7 @@ void func_8099807C(EnGs* this, PlayState* play) { if (!Flags_GetSwitch(play, this->unk_196)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, 7); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); + Actor_PlaySfx(&this->actor, NA_SE_EV_BUTTERFRY_TO_FAIRY); Flags_SetSwitch(play, this->unk_196); } break; @@ -411,7 +411,7 @@ void func_809985B8(EnGs* this, PlayState* play) { void func_80998704(EnGs* this, PlayState* play) { this->unk_19D = 0; this->unk_19A &= ~(0x100 | 0x4); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_G_STONE_CHANGE_COLOR); + Actor_PlaySfx(&this->actor, NA_SE_EV_G_STONE_CHANGE_COLOR); this->actionFunc = func_8099874C; } @@ -500,7 +500,7 @@ void func_8099874C(EnGs* this, PlayState* play) { } void func_809989B4(EnGs* this, PlayState* play) { - Actor_PickUp(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809989F4; } @@ -509,7 +509,7 @@ void func_809989F4(EnGs* this, PlayState* play) { this->actor.parent = NULL; func_80997D14(this, play); } else { - Actor_PickUp(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } @@ -518,7 +518,7 @@ s32 func_80998A48(EnGs* this, PlayState* play) { if (this->unk_19D == 0) { this->unk_216 = 200; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_1D4 = 0; this->unk_19A |= 1; @@ -536,7 +536,7 @@ s32 func_80998A48(EnGs* this, PlayState* play) { if ((this->actor.params != ENGS_0) && !Play_InCsMode(play) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_216 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIVE_LUPY_COUNT); + Actor_PlaySfx(&this->actor, NA_SE_EV_FAIVE_LUPY_COUNT); Message_StartTextbox(play, 0x20D2, NULL); } this->unk_19A &= ~1; @@ -551,7 +551,7 @@ s32 func_80998BBC(EnGs* this, PlayState* play) { if (this->unk_19D == 0) { this->unk_216 = 200; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_1DC = 0.3f; this->unk_1E0 = 0.0f; @@ -563,7 +563,7 @@ s32 func_80998BBC(EnGs* this, PlayState* play) { this->unk_197 &= 0xF; this->unk_19D = 1; } else if (this->unk_19D == 1) { - this->unk_19E[0].z = (this->unk_1D4 % 8) * 0.125f * 360.0f * (0x10000 / 360.0f); + this->unk_19E[0].z = DEG_TO_BINANG((this->unk_1D4 % 8) * 0.125f * 360.0f); this->unk_19E[1].z = -this->unk_19E[0].z; if (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.005f, 0.001f, 7, 0) == 0.0f) { @@ -582,7 +582,7 @@ s32 func_80998D44(EnGs* this, PlayState* play) { this->unk_216 = 200; this->unk_1DC = this->unk_1B0[0].y - 1.0f; this->unk_1E0 = -0.8f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_G_STONE_CRUSH); + Actor_PlaySfx(&this->actor, NA_SE_EV_G_STONE_CRUSH); this->unk_19A |= 1; this->unk_21C = 40; this->unk_21E = 11; @@ -613,7 +613,7 @@ s32 func_80998D44(EnGs* this, PlayState* play) { this->unk_21C = 10; this->unk_21E = 10; this->unk_1DC = 0.5f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_19D += 1; } } else if ((this->unk_19D == 4) && (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 1.0f, @@ -662,7 +662,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { this->unk_1E0 = 1.5f; this->unk_1E4 = this->unk_1B0[1].y - 1.0f; this->unk_1E8 = -0.3f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_STONE_GROW_UP); + Actor_PlaySfx(&this->actor, NA_SE_EV_STONE_GROW_UP); this->unk_19D = 3; } } @@ -712,7 +712,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { this->unk_1E8 = 0.0f; this->unk_1F0 = 0.0f; this->unk_1EC = 0.5f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_21C = 20; this->unk_21E = 2; this->unk_19D = 6; @@ -735,7 +735,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { } if ((u16)this->unk_19E[0].y < sp3A) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_STONE_ROLLING); + Actor_PlaySfx(&this->actor, NA_SE_EV_STONE_ROLLING); } return sp4C; @@ -843,13 +843,13 @@ s32 func_809995A4(EnGs* this, PlayState* play) { if (this->unk_19D == 4) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 3); - if (this->actor.bgCheckFlags & (0x10 | 0x8)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { Vec3f sp54; sp54.x = this->actor.world.pos.x; sp54.y = this->actor.world.pos.y; sp54.z = this->actor.world.pos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); EffectSsBomb2_SpawnLayered(play, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20); this->unk_1D4 = 10; this->unk_19A |= 8; diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index b13bca1dd..56ad07592 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -232,7 +232,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (D_80ABBE38[this->guardTextIndex] != 1) { if (D_80ABBE38[this->guardTextIndex] == 2) { - func_801477B4(play); + Message_CloseTextbox(play); D_80ABBE20 = 2; SET_WEEKEVENTREG(WEEKEVENTREG_12_40); EnGuardNuts_Burrow(this, play); @@ -247,11 +247,11 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { } else if (this->guardTextIndex != 3) { this->targetHeadPos.x = 0; this->targetHeadPos.y = this->targetHeadPos.x; - func_801477B4(play); + Message_CloseTextbox(play); this->state = GUARD_NUTS_UNK_STATE; this->actionFunc = EnGuardNuts_Unburrow; } else { - func_801477B4(play); + Message_CloseTextbox(play); EnGuardNuts_SetupWait(this); } } @@ -276,10 +276,10 @@ void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play) { digPos.y = this->actor.floorHeight; EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); this->targetHeadPos.y = 0; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->targetHeadPos.x = this->targetHeadPos.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); this->actionFunc = EnGuardNuts_SetupUnburrow; } @@ -306,12 +306,12 @@ void EnGuardNuts_Unburrow(EnGuardNuts* this, PlayState* play) { Math_Vec3f_Copy(&digPos, &this->actor.world.pos); digPos.y = this->actor.floorHeight; EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); D_80ABBE20 = 0; if (this->guardTextIndex == 9) { this->hasCompletedConversation = true; } - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; EnGuardNuts_SetupWait(this); } } @@ -329,7 +329,7 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) { } if ((this->animIndex == WALK_ANIM) && ((Animation_OnFrame(&this->skelAnime, 1.0f)) || (Animation_OnFrame(&this->skelAnime, 5.0f)))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index f7eddbe6f..d2aacf748 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -83,7 +83,7 @@ void EnGuruguru_Init(Actor* thisx, PlayState* play) { if (this->actor.params == 0) { func_80BC6E10(this); } else if (this->actor.params == 2) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; this->actionFunc = EnGuruguru_DoNothing; @@ -208,7 +208,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { } } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->headZRotTarget = 0; if ((this->textIdIndex == 13) || (this->textIdIndex == 14)) { func_80151BB4(play, 0x13); @@ -257,11 +257,11 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { } if ((this->unk268 != 0) && (this->textIdIndex >= 7)) { this->skelAnime.playSpeed = 2.0f; - func_801A29D4(3, 1.18921f, 2); + Audio_SetSeqTempoAndFreq(3, 1.18921f, 2); func_801A3B48(0); } else { if (this->skelAnime.playSpeed == 2.0f) { - func_801A29D4(3, 1.0f, 2); + Audio_SetSeqTempoAndFreq(3, 1.0f, 2); } if (this->unk268 == 0) { func_801A3B48(1); @@ -271,7 +271,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; } this->unk266 = 1; - func_80151938(play, textIDs[this->textIdIndex]); + Message_ContinueTextbox(play, textIDs[this->textIdIndex]); return; } func_801A3B48(0); @@ -300,7 +300,7 @@ void func_80BC7440(EnGuruguru* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_38_40); this->actionFunc = func_80BC7520; } else { - Actor_PickUp(&this->actor, play, GI_MASK_BREMEN, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_BREMEN, 300.0f, 300.0f); } } diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index 0e1d2f050..dc5610896 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -165,7 +165,7 @@ void func_80B21EA4(EnHakurock* this, s32 arg1) { } void func_80B21FFC(EnHakurock* this) { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->collider.base.atFlags &= ~AT_HIT; this->collider.base.ocFlags1 &= ~OC1_HIT; this->actor.draw = NULL; @@ -186,7 +186,7 @@ void func_80B22040(EnHakurock* this, PlayState* play) { void func_80B220A8(EnHakurock* this) { this->actor.params = EN_HAKUROCK_TYPE_BOULDER; this->actor.draw = func_80B228F4; - this->actor.speedXZ = Rand_ZeroFloat(3.5f) + 2.5f; + this->actor.speed = Rand_ZeroFloat(3.5f) + 2.5f; this->actor.velocity.y = Rand_ZeroFloat(4.5f) + 18.0f; Actor_SetScale(&this->actor, (Rand_ZeroFloat(5.0f) + 15.0f) * 0.001f); this->actor.world.rot.y = ((s32)Rand_Next() >> 0x12) + this->actor.parent->shape.rot.y + 0x8000; @@ -210,8 +210,8 @@ void func_80B221E8(EnHakurock* this, PlayState* play) { this->actor.shape.rot.z += 0xB00; if ((this->collider.base.atFlags & AT_HIT) || ((this->counter == 0) && (this->collider.base.ocFlags1 & OC1_HIT)) || - ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROCK_BROKEN); + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f))) { + Actor_PlaySfx(&this->actor, NA_SE_EV_ROCK_BROKEN); func_80B21EA4(this, 0); func_80B21FFC(this); } @@ -244,9 +244,9 @@ void func_80B2242C(EnHakurock* this, PlayState* play) { if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.oc == this->actor.parent)) { func_80B21EA4(this, 1); func_80B21FFC(this); - } else if ((this->actor.bgCheckFlags & 1)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80B21EA4(this, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OBJECT_STICK); + Actor_PlaySfx(&this->actor, NA_SE_EV_OBJECT_STICK); func_80B224C0(this); } } diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 507bf9deb..8eaa6b444 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -297,7 +297,7 @@ void func_80B236C8(EnHanabi* this, PlayState* play) { this->actor.home.rot.y += (s16)((Rand_ZeroFloat(40.0f) + 80.0f) * 256.0f); this->unk_144 = (s32)Rand_ZeroFloat(5.0f) + 20; - Actor_PlaySfxAtPos(&this->actor, NA_SE_OC_FIREWORKS); + Actor_PlaySfx(&this->actor, NA_SE_OC_FIREWORKS); func_80B235CC(this, &sp34, sp28); } } @@ -332,7 +332,7 @@ void func_80B23934(EnHanabi* this, PlayState* play) { if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7) && (play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 610)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_GROAN); + Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_GROAN); } } diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index 756f37eb8..f4e40b6c8 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -87,7 +87,7 @@ void EnHeishi_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 6; this->actor.gravity = -3.0f; Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; EnHeishi_SetupIdle(this); } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index e100a2de3..eb41fc045 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -177,7 +177,7 @@ void EnHg_Wait(EnHg* this, PlayState* play) { } if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0) && ((play->csCtx.frames == 20) || (play->csCtx.frames == 60))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HALF_REDEAD_SURPRISE); + Actor_PlaySfx(&this->actor, NA_SE_EN_HALF_REDEAD_SURPRISE); } } } @@ -191,7 +191,7 @@ void EnHg_ChasePlayer(EnHg* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - this->actor.speedXZ = 1.6f; + this->actor.speed = 1.6f; if (!(player->stateFlags2 & PLAYER_STATE2_8000000) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) || ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) { diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index f7a9df82a..af801ebd4 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -268,7 +268,7 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) { break; case 0x15A7: - func_801477B4(play); + Message_CloseTextbox(play); EnHgo_SetupTalk(this); break; } @@ -322,7 +322,7 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { this->isInCutscene = true; if ((gSaveContext.sceneLayer == 0) && ((play->csCtx.currentCsIndex == 2) || (play->csCtx.currentCsIndex == 4))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_GBVO02); + Actor_PlaySfx(&this->actor, NA_SE_VO_GBVO02); } } break; diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index d8df99887..fa14a3cdb 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -145,7 +145,7 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 i; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); if (player->stateFlags2 & PLAYER_STATE2_8000000) { if (this->unk_20A == 0) { @@ -202,7 +202,7 @@ void func_80BDB580(EnHiddenNuts* this) { void func_80BDB59C(EnHiddenNuts* this, PlayState* play) { s32 i; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG); if (this->unk_218 == 0) { Vec3f sp98 = { 0.0f, 0.0f, 0.0f }; @@ -226,16 +226,16 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) { } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80BDB268(this); } } void func_80BDB788(EnHiddenNuts* this) { this->actor.flags |= ACTOR_FLAG_10; - this->actor.flags |= ACTOR_FLAG_8000000; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DEAD); this->unk_21A = 2; this->actionFunc = func_80BDB7E8; } @@ -262,7 +262,7 @@ void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) { EffectSsHahen_SpawnBurst(play, &sp3C, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); func_80BDB1B4(this, 7); this->actionFunc = func_80BDB8F4; } @@ -287,7 +287,7 @@ void func_80BDB978(EnHiddenNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUT_FAINT); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUT_FAINT); } if (this->unk_22C <= curFrame) { @@ -309,14 +309,14 @@ void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { EffectSsHahen_SpawnBurst(play, &sp44, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); this->unk_208 = 1; if ((this->path != NULL) && !SubS_CopyPointFromPath(this->path, this->unk_208, &this->unk_20C)) { Actor_Kill(&this->actor); } - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actor.gravity = -2.0f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C); @@ -345,14 +345,14 @@ void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 10.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER); sp4E = 1; } } if ((sp4E != 0) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 10.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C), 1, 0x1388, 0); @@ -360,7 +360,7 @@ void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { if (this->unk_220 == 2) { if (this->unk_22C <= sp58) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_80BDB1B4(this, 6); } @@ -400,7 +400,7 @@ void func_80BDBED4(EnHiddenNuts* this, PlayState* play) { Math_Vec3f_Copy(&sp38, &this->actor.world.pos); sp38.y = this->actor.floorHeight; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); EffectSsHahen_SpawnBurst(play, &sp38, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index c07bbc5da..6e1f3b90c 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -182,13 +182,13 @@ void func_80C1FE20(EnHintSkb* this, PlayState* play) { void func_80C1FE30(EnHintSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); - this->actor.speedXZ = 1.6f; + this->actor.speed = 1.6f; this->actionFunc = func_80C1FE80; } void func_80C1FE80(EnHintSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 750, 0); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -199,7 +199,7 @@ void func_80C1FE80(EnHintSkb* this, PlayState* play) { void func_80C1FF30(EnHintSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80C1FF88; } @@ -211,7 +211,7 @@ void func_80C1FF88(EnHintSkb* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 3.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -241,23 +241,23 @@ void func_80C200B8(EnHintSkb* this, PlayState* play) { } void func_80C2011C(EnHintSkb* this) { - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_80C2016C; } void func_80C2016C(EnHintSkb* this, PlayState* play) { - if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; - } else if (this->actor.bgCheckFlags & 1) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.05f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.05f; } } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); @@ -276,40 +276,41 @@ void func_80C20274(EnHintSkb* this) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->actor.gravity = -1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -4.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -4.0f; } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->actionFunc = func_80C20334; } void func_80C20334(EnHintSkb* this, PlayState* play) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { s32 i; for (i = 0; i < 10; i++) { func_80C215E4(play, this, &this->actor.world.pos); } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & 1) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.05f; - } else if (this->actor.speedXZ != 0.0f) { - this->actor.speedXZ -= 0.05f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.05f; + } else if (this->actor.speed != 0.0f) { + this->actor.speed -= 0.05f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 2500, 0); } Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 16, 2000, 100); - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.bgCheckFlags & 1)) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.rot = this->actor.shape.rot; func_80C1FE30(this); } @@ -318,8 +319,8 @@ void func_80C20334(EnHintSkb* this, PlayState* play) { void func_80C20484(EnHintSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->unk_3E8 |= 4; - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -6.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -6.0f; } this->actionFunc = func_80C204F0; } @@ -334,10 +335,10 @@ void func_80C204F0(EnHintSkb* this, PlayState* play) { } void func_80C20540(EnHintSkb* this) { - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_80C20590; } @@ -347,9 +348,9 @@ void func_80C20590(EnHintSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); } else { @@ -362,8 +363,8 @@ void func_80C20590(EnHintSkb* this, PlayState* play) { } void func_80C2066C(EnHintSkb* this) { - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } this->actionFunc = func_80C2069C; } @@ -374,9 +375,9 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); } else { @@ -388,7 +389,7 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) { void func_80C2075C(EnHintSkb* this) { this->unk_3E0 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80C2077C; } @@ -401,7 +402,7 @@ void func_80C2077C(EnHintSkb* this, PlayState* play) { this->unk_3E6 = 0x1147; if (this->skelAnime.animation == &object_skb_Anim_00697C) { play->msgCtx.msgMode = 0x44; - this->actor.speedXZ = 2.4f; + this->actor.speed = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); @@ -452,10 +453,10 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { } if (this->unk_3E6 == 0x1147) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { s32 i; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; for (i = 0; i < 10; i++) { func_80C215E4(play, this, &this->actor.world.pos); @@ -470,7 +471,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { } } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 5, 0x71C, 0xB6); this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -569,7 +570,7 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { break; case 0x1151: - func_801477B4(play); + Message_CloseTextbox(play); if (this->unk_3E8 & 0x10) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); @@ -611,7 +612,8 @@ void func_80C20D64(EnHintSkb* this, PlayState* play) { void func_80C20E90(EnHintSkb* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->actor.bgCheckFlags & 0x60) && (this->actor.depthInWater >= 40.0f)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) && + (this->actor.depthInWater >= 40.0f)) { this->actor.colChkInfo.health = 0; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_STALKID_DEAD); func_80C20484(this); @@ -661,12 +663,12 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffTimer = 40; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80C2011C(this); break; case 1: - Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80C2011C(this); break; @@ -675,14 +677,14 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); break; case 3: if (this->actor.colChkInfo.health != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->drawDmgEffTimer = 80; } else { this->drawDmgEffTimer = 3; @@ -690,7 +692,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); func_80C20540(this); break; case 4: @@ -698,8 +700,8 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80C2066C(this); break; @@ -717,8 +719,8 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { } case 13: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80C20274(this); break; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index e7615d25f..e2d4792ca 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -151,13 +151,15 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { f32 playerDistFromCentralPlane; if (this->type == EN_HOLL_TYPE_DEFAULT) { - u32 actorCtxBitmask = (play->actorCtx.unkC & 0x2AA) >> 1 | (play->actorCtx.unkC & 0x155); + u32 halfDaysBit = + ((play->actorCtx.halfDaysBit & HALFDAYBIT_DAWNS) >> 1) | (play->actorCtx.halfDaysBit & HALFDAYBIT_NIGHTS); u32 zActorBitmask = D_801AED48[EN_HOLL_GET_Z_ACTOR_BITMASK_INDEX(&this->actor)]; - if (!(actorCtxBitmask & zActorBitmask)) { + if (!(halfDaysBit & zActorBitmask)) { Actor_Kill(&this->actor); return; } + if (this == sInstancePlayingSound) { func_800B9010(&this->actor, NA_SE_EV_INVISIBLE_MONKEY - SFX_FLAG); } @@ -180,7 +182,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { u32 enHollId = EN_HOLL_GET_ID(&this->actor); if (sLoadingPlaneDistance < playerDistFromCentralPlane) { - if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.unk31 == 0)) { + if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.status == 0)) { this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide].room; if (play->roomCtx.prevRoom.num == this->actor.room) { EnHoll_ChangeRooms(play); @@ -296,7 +298,7 @@ void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { } void EnHoll_RoomTransitionIdle(EnHoll* this, PlayState* play) { - if (play->roomCtx.unk31 == 0) { + if (play->roomCtx.status == 0) { func_8012EBF8(play, &play->roomCtx); if (play->bgCoverAlpha == 0) { this->bgCoverAlphaActive = false; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 5ffc364c3..6d3e01952 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -345,7 +345,7 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { func_8017D7C0(this->actor.world.pos.x, this->actor.world.pos.z, sp80.x, sp80.z, sp8C.x, sp8C.z, &sp70); - if ((this->actor.bgCheckFlags & 8) || (this->unk_1EC & 4)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_1EC & 4)) { EnHorse_RotateToPoint(this, play, &sp8C, 0xC80); if (this->unk_1EC & 4) { this->unk_1EC &= ~4; @@ -402,81 +402,81 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { this->unk_58C = 0x2B; } this->unk_58C--; - if (this->actor.speedXZ > 5.0f) { - this->actor.speedXZ -= 0.5f; + if (this->actor.speed > 5.0f) { + this->actor.speed -= 0.5f; } } else if (this->unk_590 > 0) { if (this->unk_590 == 0x1F4) { if (this->rider != NULL) { - Actor_PlaySfxAtPos(&this->rider->actor, NA_SE_VO_IN_CRY_0); + Actor_PlaySfx(&this->rider->actor, NA_SE_VO_IN_CRY_0); } } this->unk_590--; - if (this->actor.speedXZ < this->unk_398) { - this->actor.speedXZ += 1.0f; + if (this->actor.speed < this->unk_398) { + this->actor.speed += 1.0f; } else { - this->actor.speedXZ -= 0.5f; + this->actor.speed -= 0.5f; } } else if (this->actor.params == ENHORSE_5) { s16 sp4A; if (sp68 >= this->curRaceWaypoint) { - if (this->actor.speedXZ < this->unk_398) { - this->actor.speedXZ += 0.5f; + if (this->actor.speed < this->unk_398) { + this->actor.speed += 0.5f; } else { - this->actor.speedXZ -= 0.5f; + this->actor.speed -= 0.5f; } this->unk_394 |= 1; return; } - sp4A = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + sp4A = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((fabsf(Math_SinS(sp4A)) < 0.9f) && (Math_CosS(sp4A) > 0.0f)) { - if (this->actor.speedXZ < this->unk_398) { - this->actor.speedXZ += 0.5f; + if (this->actor.speed < this->unk_398) { + this->actor.speed += 0.5f; } else { - this->actor.speedXZ -= 0.25f; + this->actor.speed -= 0.25f; } this->unk_394 |= 1; } else { - if (this->actor.speedXZ < 13.0f) { - this->actor.speedXZ += 0.4f; + if (this->actor.speed < 13.0f) { + this->actor.speed += 0.4f; } else { - this->actor.speedXZ -= 0.2f; + this->actor.speed -= 0.2f; } this->unk_394 &= ~1; } } else if (sp68 >= this->curRaceWaypoint) { - if (this->actor.speedXZ < this->unk_398) { - this->actor.speedXZ += 0.5f; + if (this->actor.speed < this->unk_398) { + this->actor.speed += 0.5f; } else { - this->actor.speedXZ -= 0.5f; + this->actor.speed -= 0.5f; } this->unk_394 |= 1; } else if ((sp68 + 1) == this->curRaceWaypoint) { - s16 sp48 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + s16 sp48 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((fabsf(Math_SinS(sp48)) < 0.9f) && (Math_CosS(sp48) > 0.0f)) { - if (this->actor.speedXZ < this->unk_398) { - this->actor.speedXZ += 0.5f; + if (this->actor.speed < this->unk_398) { + this->actor.speed += 0.5f; } else { - this->actor.speedXZ -= 0.25f; + this->actor.speed -= 0.25f; } this->unk_394 |= 1; } else { - if (this->actor.speedXZ < 12.0f) { - this->actor.speedXZ += 0.4f; + if (this->actor.speed < 12.0f) { + this->actor.speed += 0.4f; } else { - this->actor.speedXZ -= 0.2f; + this->actor.speed -= 0.2f; } this->unk_394 &= ~1; } } else { - if (this->actor.speedXZ < 13.0f) { - this->actor.speedXZ += 0.4f; + if (this->actor.speed < 13.0f) { + this->actor.speed += 0.4f; } else { - this->actor.speedXZ -= 0.2f; + this->actor.speed -= 0.2f; } this->unk_394 &= ~1; } @@ -622,7 +622,7 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { this->actor.world.pos.z = spawnPos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = 0; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); spawn = true; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); @@ -648,7 +648,7 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { this->actor.world.pos.z = spawnPos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = 0; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); spawn = true; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); @@ -672,7 +672,7 @@ s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { if ((player->stateFlags1 & PLAYER_STATE1_1) || (func_800B7128(GET_PLAYER(play)) == true) || (player->stateFlags1 & PLAYER_STATE1_100000) || (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || - (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_100) || + (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_0) || (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != PLAYER_CSMODE_0)) { return false; @@ -800,7 +800,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { thisx->gravity = -3.5f; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawHorse, 20.0f); this->action = ENHORSE_ACTION_IDLE; - thisx->speedXZ = 0.0f; + thisx->speed = 0.0f; if (this->type == HORSE_TYPE_2) { sJntSphInit.elements[0].dim.limb = 13; @@ -989,7 +989,7 @@ void EnHorse_Freeze(EnHorse* this, PlayState* play) { } void EnHorse_Frozen(EnHorse* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->noInputTimer--; if (this->noInputTimer < 0) { this->colliderCylinder1.base.ocFlags1 |= OC1_ON; @@ -1004,7 +1004,7 @@ void EnHorse_Frozen(EnHorse* this, PlayState* play) { if (play->csCtx.state != CS_STATE_0) { EnHorse_StartMountedIdle(this); } else { - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; EnHorse_StartGalloping(this); } } else if (this->prevAction == ENHORSE_ACTION_IDLE) { @@ -1035,10 +1035,10 @@ void EnHorse_UpdateSpeed(EnHorse* this, PlayState* play, f32 brakeDecel, f32 bra f32 temp_f12; if (!EnHorse_PlayerCanMove(this, play)) { - if (this->actor.speedXZ > 8.0f) { - this->actor.speedXZ -= decel; - } else if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + if (this->actor.speed > 8.0f) { + this->actor.speed -= decel; + } else if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } return; } @@ -1047,63 +1047,62 @@ void EnHorse_UpdateSpeed(EnHorse* this, PlayState* play, f32 brakeDecel, f32 bra EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (Math_CosS(stickAngle) <= brakeAngle) { - this->actor.speedXZ -= brakeDecel; - this->actor.speedXZ = CLAMP_MIN(this->actor.speedXZ, 0.0f); + this->actor.speed -= brakeDecel; + this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f); return; } if (stickMag < minStickMag) { this->stateFlags &= ~ENHORSE_BOOST; this->stateFlags &= ~ENHORSE_BOOST_DECEL; - this->actor.speedXZ -= decel; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed -= decel; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } return; } if (this->stateFlags & ENHORSE_BOOST) { if ((16 - this->boostTimer) > 0) { - this->actor.speedXZ = - (((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) - this->actor.speedXZ) / - (16.0f - this->boostTimer)) + - this->actor.speedXZ; + this->actor.speed = (((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) - this->actor.speed) / + (16.0f - this->boostTimer)) + + this->actor.speed; } else { - this->actor.speedXZ = EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed; + this->actor.speed = EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed; } - if ((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) <= this->actor.speedXZ) { + if ((EnHorse_SlopeSpeedMultiplier(this, play) * this->boostSpeed) <= this->actor.speed) { this->stateFlags &= ~ENHORSE_BOOST; this->stateFlags |= ENHORSE_BOOST_DECEL; } } else if (this->stateFlags & ENHORSE_BOOST_DECEL) { - if (this->actor.speedXZ > baseSpeed) { - this->actor.speedXZ -= 0.06f; - } else if (this->actor.speedXZ < baseSpeed) { - this->actor.speedXZ = baseSpeed; + if (this->actor.speed > baseSpeed) { + this->actor.speed -= 0.06f; + } else if (this->actor.speed < baseSpeed) { + this->actor.speed = baseSpeed; this->stateFlags &= ~ENHORSE_BOOST_DECEL; } } else { - if (this->actor.speedXZ <= (baseSpeed * (1.0f / 54.0f) * stickMag)) { + if (this->actor.speed <= (baseSpeed * (1.0f / 54.0f) * stickMag)) { phi_f0 = 1.0f; } else { phi_f0 = -1.0f; } - this->actor.speedXZ += phi_f0 * 50.0f * 0.01f; + this->actor.speed += phi_f0 * 50.0f * 0.01f; - if (this->actor.speedXZ > baseSpeed) { - this->actor.speedXZ -= decel; - if (this->actor.speedXZ < baseSpeed) { - this->actor.speedXZ = baseSpeed; + if (this->actor.speed > baseSpeed) { + this->actor.speed -= decel; + if (this->actor.speed < baseSpeed) { + this->actor.speed = baseSpeed; } } } temp_f12 = stickAngle * (1 / 32236.f); - turn = stickAngle * temp_f12 * temp_f12 * (2.2f - (this->actor.speedXZ * (1.0f / this->boostSpeed))); - turn = CLAMP(turn, -turnSpeed * (2.2f - (1.7f * this->actor.speedXZ * (1.0f / this->boostSpeed))), - turnSpeed * (2.2f - (1.7f * this->actor.speedXZ * (1.0f / this->boostSpeed)))); + turn = stickAngle * temp_f12 * temp_f12 * (2.2f - (this->actor.speed * (1.0f / this->boostSpeed))); + turn = CLAMP(turn, -turnSpeed * (2.2f - (1.7f * this->actor.speed * (1.0f / this->boostSpeed))), + turnSpeed * (2.2f - (1.7f * this->actor.speed * (1.0f / this->boostSpeed)))); this->actor.world.rot.y += turn; this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -1141,7 +1140,7 @@ void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { f32 mag; s16 angle = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_StickDirection(&this->curStick, &mag, &angle); if (mag > 10.0f) { if (EnHorse_PlayerCanMove(this, play) == true) { @@ -1188,7 +1187,7 @@ void EnHorse_MountedIdleWhinnying(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); if (stickMag > 10.0f) { if (EnHorse_PlayerCanMove(this, play) == true) { @@ -1222,7 +1221,7 @@ void EnHorse_MountedTurn(EnHorse* this, PlayState* play) { s16 clampedYaw; s16 stickAngle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_PlayWalkingSound(this); if (EnHorse_PlayerCanMove(this, play) == true) { EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); @@ -1300,15 +1299,15 @@ void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { ((this->noInputTimer > 0) && (this->noInputTimer < (this->noInputTimerMax - 20)))) { EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 3.0f, 0x320); } else { - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; } - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { this->stateFlags &= ~ENHORSE_FLAG_9; EnHorse_StartMountedIdleResetAnim(this); this->noInputTimer = 0; this->noInputTimerMax = 0; - } else if (this->actor.speedXZ > 3.0f) { + } else if (this->actor.speed > 3.0f) { this->stateFlags &= ~ENHORSE_FLAG_9; EnHorse_StartTrotting(this); this->noInputTimer = 0; @@ -1324,9 +1323,9 @@ void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { if (this->waitTimer <= 0) { this->stateFlags &= ~ENHORSE_FLAG_9; - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; - if ((SkelAnime_Update(&this->skin.skelAnime) || (this->actor.speedXZ == 0.0f)) && (this->noInputTimer <= 0)) { - if (this->actor.speedXZ > 3.0f) { + this->skin.skelAnime.playSpeed = this->actor.speed * 0.75f; + if ((SkelAnime_Update(&this->skin.skelAnime) || (this->actor.speed == 0.0f)) && (this->noInputTimer <= 0)) { + if (this->actor.speed > 3.0f) { EnHorse_StartTrotting(this); this->noInputTimer = 0; this->noInputTimerMax = 0; @@ -1340,7 +1339,7 @@ void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { } } else { this->waitTimer--; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -1363,18 +1362,18 @@ void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 6.0f, 800); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); - if (this->actor.speedXZ < 3.0f) { + if (this->actor.speed < 3.0f) { EnHorse_StartWalkingInterruptable(this); } - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.375f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C178(this); Rumble_Request(0.0f, 60, 8, 255); - if (this->actor.speedXZ >= 6.0f) { + if (this->actor.speed >= 6.0f) { EnHorse_StartGallopingInterruptable(this); - } else if (this->actor.speedXZ < 3.0f) { + } else if (this->actor.speed < 3.0f) { EnHorse_StartWalkingInterruptable(this); } else { EnHorse_MountedTrotReset(this); @@ -1428,14 +1427,14 @@ void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { EnHorse_UpdateSpeed(this, play, 0.3f, -0.5f, 10.0f, 0.06f, 8.0f, 800); } else if (this->noInputTimer > 0) { this->noInputTimer--; - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; } - if (this->actor.speedXZ < 6.0f) { + if (this->actor.speed < 6.0f) { EnHorse_StartTrotting(this); } - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.3f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); @@ -1443,7 +1442,7 @@ void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { if (EnHorse_PlayerCanMove(this, play) == true) { if ((stickMag >= 10.0f) && (Math_CosS(stickAngle) <= -0.5f)) { EnHorse_StartBraking(this, play); - } else if (this->actor.speedXZ < 6.0f) { + } else if (this->actor.speed < 6.0f) { EnHorse_StartTrotting(this); } else { EnHorse_MountedGallopReset(this); @@ -1491,7 +1490,7 @@ void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; @@ -1560,15 +1559,15 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { } void EnHorse_Stopping(EnHorse* this, PlayState* play) { - if (this->actor.speedXZ > 0.0f) { - this->actor.speedXZ -= 0.6f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + if (this->actor.speed > 0.0f) { + this->actor.speed -= 0.6f; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } } if ((this->stateFlags & ENHORSE_STOPPING_NEIGH_SOUND) && (this->skin.skelAnime.curFrame > 29.0f)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((Rand_ZeroOne() > 0.5f) && ((gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0)) || (Cutscene_GetSceneLayer(play) == 0))) { if (this->stateFlags & ENHORSE_DRAW) { @@ -1586,9 +1585,9 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { } if (this->skin.skelAnime.curFrame > 29.0f) { - this->actor.speedXZ = 0.0f; - } else if ((this->actor.speedXZ > 3.0f) && (this->stateFlags & ENHORSE_FORCE_REVERSING)) { - this->actor.speedXZ = 3.0f; + this->actor.speed = 0.0f; + } else if ((this->actor.speed > 3.0f) && (this->stateFlags & ENHORSE_FORCE_REVERSING)) { + this->actor.speed = 3.0f; } if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -1630,29 +1629,29 @@ void EnHorse_Reverse(EnHorse* this, PlayState* play) { ((this->noInputTimer > 0) && (this->noInputTimer < (this->noInputTimerMax - 20)))) { if ((stickMag < 10.0f) && (this->noInputTimer <= 0)) { EnHorse_StartMountedIdleResetAnim(this); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; return; } else if (stickMag < 10.0f) { stickAngle = -0x7FFF; } else if (Math_CosS(stickAngle) > -0.5f) { this->noInputTimerMax = 0; EnHorse_StartMountedIdleResetAnim(this); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; return; } } else if (stickMag < 10.0f) { stickAngle = -0x7FFF; } - } else if ((player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != CS_STATE_0) || + } else if ((player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_0) || (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & PLAYER_STATE1_20)) { EnHorse_StartMountedIdleResetAnim(this); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; return; } else { stickAngle = -0x7FFF; } - this->actor.speedXZ = -2.0f; + this->actor.speed = -2.0f; turnAmount = -0x8000 - stickAngle; turnAmount = CLAMP(turnAmount, -2400.0f, 2400.0f); this->actor.world.rot.y += turnAmount; @@ -1665,7 +1664,7 @@ void EnHorse_Reverse(EnHorse* this, PlayState* play) { } } - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.5f * 1.5f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.5f * 1.5f; if (SkelAnime_Update(&this->skin.skelAnime) && (this->noInputTimer <= 0) && (EnHorse_PlayerCanMove(this, play) == true)) { @@ -1724,8 +1723,8 @@ void EnHorse_LowJump(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_JUMPING; - if (this->actor.speedXZ < 12.0f) { - this->actor.speedXZ = 12.0f; + if (this->actor.speed < 12.0f) { + this->actor.speed = 12.0f; } if (this->actor.floorHeight != BGCHECK_Y_MIN) { @@ -1822,8 +1821,8 @@ void EnHorse_HighJump(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_JUMPING; - if (this->actor.speedXZ < 13.0f) { - this->actor.speedXZ = 13.0f; + if (this->actor.speed < 13.0f) { + this->actor.speed = 13.0f; } if (this->actor.floorHeight != BGCHECK_Y_MIN) { @@ -1908,7 +1907,7 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) { void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { this->action = ENHORSE_ACTION_IDLE; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNY) && (anim != ENHORSE_ANIM_REARING)) { anim = ENHORSE_ANIM_IDLE; @@ -1963,7 +1962,7 @@ void EnHorse_StartIdleRidable(EnHorse* this) { } void EnHorse_Idle(EnHorse* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_IdleAnimSounds(this, play); if ((D_801BDAA4 != 0) && (this->type == HORSE_TYPE_2)) { @@ -2026,7 +2025,7 @@ void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { s32 anim = ENHORSE_ANIM_WALK; - f32 distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (distToPlayer > 400.0f) { anim = ENHORSE_ANIM_GALLOP; @@ -2063,7 +2062,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; D_801BDAA4 = 0; - distToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (((this->playerDir == PLAYER_DIR_BACK_R) || (this->playerDir == PLAYER_DIR_BACK_L)) && (distToPlayer > 300.0f) && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER)) { @@ -2071,7 +2070,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { this->animIndex = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; - this->angleToPlayer = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); angleDiff = (f32)this->angleToPlayer - this->actor.world.rot.y; if (angleDiff > 0x7FFF) { @@ -2102,18 +2101,18 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { } if (this->animIndex == ENHORSE_ANIM_GALLOP) { - this->actor.speedXZ = 8.0f; - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; + this->actor.speed = 8.0f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.3f; } else { if (this->animIndex == ENHORSE_ANIM_TROT) { - this->actor.speedXZ = 6.0f; - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; + this->actor.speed = 6.0f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.375f; } else if (this->animIndex == ENHORSE_ANIM_WALK) { - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; EnHorse_PlayWalkingSound(this); - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.75f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->skin.skelAnime.playSpeed = 1.0f; } } @@ -2152,7 +2151,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { void EnHorse_InitIngoHorse(EnHorse* this) { this->curRaceWaypoint = 0; this->soundTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_UpdateIngoHorseAnim(this); if (this->stateFlags & ENHORSE_DRAW) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); @@ -2177,17 +2176,17 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { this->action = ENHORSE_ACTION_INGO_RACE; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } this->animIndex = ENHORSE_ANIM_IDLE; - } else if (this->actor.speedXZ <= 3.0f) { + } else if (this->actor.speed <= 3.0f) { if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } this->animIndex = ENHORSE_ANIM_WALK; - } else if (this->actor.speedXZ <= 6.0f) { + } else if (this->actor.speed <= 6.0f) { if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } @@ -2200,16 +2199,16 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { } if (this->animIndex == ENHORSE_ANIM_WALK) { - animSpeed = this->actor.speedXZ * 0.5f; + animSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - animSpeed = this->actor.speedXZ * 0.25f; + animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - animSpeed = this->actor.speedXZ * 0.2f; + animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { @@ -2240,26 +2239,26 @@ void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { } if (!this->inRace) { - this->actor.speedXZ = 0.0f; - this->rider->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; + this->rider->actor.speed = 0.0f; if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateIngoHorseAnim(this); } } if (this->animIndex == ENHORSE_ANIM_WALK) { - playSpeed = this->actor.speedXZ * 0.5f; + playSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - playSpeed = this->actor.speedXZ * 0.25f; + playSpeed = this->actor.speed * 0.25f; } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - playSpeed = this->actor.speedXZ * 0.2f; + playSpeed = this->actor.speed * 0.2f; } else { playSpeed = 1.0f; } this->skin.skelAnime.playSpeed = playSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speed != 0.0f))) { EnHorse_UpdateIngoHorseAnim(this); } } @@ -2296,8 +2295,8 @@ void func_80881398(EnHorse* this, PlayState* play) { f32 curFrame; this->stateFlags |= ENHORSE_JUMPING; - if (this->actor.speedXZ < 14.0f) { - this->actor.speedXZ = 14.0f; + if (this->actor.speed < 14.0f) { + this->actor.speed = 14.0f; } animeUpdated = SkelAnime_Update(&this->skin.skelAnime); @@ -2352,7 +2351,7 @@ void func_8088159C(EnHorse* this, PlayState* play) { void func_80881634(EnHorse* this) { this->curRaceWaypoint = 0; this->soundTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_8088168C(this); if (this->stateFlags & ENHORSE_DRAW) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_IT_INGO_HORSE_NEIGH); @@ -2367,17 +2366,17 @@ void func_8088168C(EnHorse* this) { this->action = ENHORSE_ACTION_5; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } this->animIndex = ENHORSE_ANIM_IDLE; - } else if (this->actor.speedXZ <= 3.0f) { + } else if (this->actor.speed <= 3.0f) { if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } this->animIndex = ENHORSE_ANIM_WALK; - } else if (this->actor.speedXZ <= 6.0f) { + } else if (this->actor.speed <= 6.0f) { if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } @@ -2390,16 +2389,16 @@ void func_8088168C(EnHorse* this) { } if (this->animIndex == ENHORSE_ANIM_WALK) { - animSpeed = this->actor.speedXZ * 0.5f; + animSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - animSpeed = this->actor.speedXZ * 0.25f; + animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - animSpeed = this->actor.speedXZ * 0.2f; + animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { @@ -2434,8 +2433,8 @@ void func_808819D8(EnHorse* this, PlayState* play) { } if (!this->inRace) { - this->actor.speedXZ = 0.0f; - this->rider->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; + this->rider->actor.speed = 0.0f; if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateIngoHorseAnim(this); } @@ -2450,25 +2449,25 @@ void func_808819D8(EnHorse* this, PlayState* play) { } if (!this->inRace) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->animIndex != ENHORSE_ANIM_IDLE) { func_8088168C(this); } } if (this->animIndex == ENHORSE_ANIM_WALK) { - animSpeed = this->actor.speedXZ * 0.5f; + animSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - animSpeed = this->actor.speedXZ * 0.25f; + animSpeed = this->actor.speed * 0.25f; } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - animSpeed = this->actor.speedXZ * 0.2f; + animSpeed = this->actor.speed * 0.2f; } else { animSpeed = 1.0f; } this->skin.skelAnime.playSpeed = animSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speed != 0.0f))) { func_8088168C(this); } @@ -2484,7 +2483,7 @@ void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action this->animIndex = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], - this->actor.speedXZ * 0.2f * 1.5f); + this->actor.speed * 0.2f * 1.5f); } void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { @@ -2497,18 +2496,18 @@ void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* act if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { EnHorse_RotateToPoint(this, play, &endPos, 0x320); - this->actor.speedXZ = 8.0f; - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; + this->actor.speed = 8.0f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.3f; } else { this->actor.world.pos = endPos; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); Rumble_Request(0.0f, 120, 8, 255); Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], - this->actor.speedXZ * 0.3f); + this->actor.speed * 0.3f); } } @@ -2562,7 +2561,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } curFrame = this->skin.skelAnime.curFrame; - this->actor.speedXZ = 13.0f; + this->actor.speed = 13.0f; this->stateFlags |= ENHORSE_JUMPING; if (curFrame > 19.0f) { @@ -2626,7 +2625,7 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* act } void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; @@ -2665,7 +2664,7 @@ void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* acti this->animIndex = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 4; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], - this->actor.speedXZ * 0.3f); + this->actor.speed * 0.3f); } void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { @@ -2678,18 +2677,18 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { EnHorse_RotateToPoint(this, play, &endPos, 0x320); - this->actor.speedXZ = 8.0f; - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; + this->actor.speed = 8.0f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.3f; } else { this->actor.world.pos = endPos; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); Rumble_Request(0.0f, 120, 8, 255); Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], - this->actor.speedXZ * 0.3f); + this->actor.speed * 0.3f); } } @@ -2719,7 +2718,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* } void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; @@ -2750,7 +2749,7 @@ void EnHorse_InitCutscene(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACTION_CS_UPDATE; this->cutsceneAction = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { @@ -2829,12 +2828,12 @@ s32 EnHorse_UpdateHbaRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo } this->actor.shape.rot.y = this->actor.world.rot.y; - if ((this->actor.speedXZ < raceInfo->waypoints[this->curRaceWaypoint].speed) && !(this->hbaFlags & 1)) { - this->actor.speedXZ += 0.4f; + if ((this->actor.speed < raceInfo->waypoints[this->curRaceWaypoint].speed) && !(this->hbaFlags & 1)) { + this->actor.speed += 0.4f; } else { - this->actor.speedXZ -= 0.4f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed -= 0.4f; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } } return false; @@ -2845,7 +2844,7 @@ void EnHorse_InitHorsebackArchery(EnHorse* this) { this->soundTimer = 0; this->curRaceWaypoint = 0; this->hbaTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnHorse_UpdateHbaAnim(this); } @@ -2854,17 +2853,17 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { f32 animSpeed; this->action = ENHORSE_ACTION_HBA; - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } this->animIndex = ENHORSE_ANIM_IDLE; - } else if (this->actor.speedXZ <= 3.0f) { + } else if (this->actor.speed <= 3.0f) { if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } this->animIndex = ENHORSE_ANIM_WALK; - } else if (this->actor.speedXZ <= 6.0f) { + } else if (this->actor.speed <= 6.0f) { if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } @@ -2877,9 +2876,9 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } if (this->animIndex == ENHORSE_ANIM_WALK) { - animSpeed = this->actor.speedXZ * 0.5f; + animSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - animSpeed = this->actor.speedXZ * 0.25f; + animSpeed = this->actor.speed * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { @@ -2887,7 +2886,7 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } Rumble_Request(0.0f, 60, 8, 255); } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - animSpeed = this->actor.speedXZ * 0.2f; + animSpeed = this->actor.speed * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { @@ -2935,29 +2934,29 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (((play->interfaceCtx.minigameAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { this->hbaFlags &= ~4; - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); } if (this->hbaStarted == 0) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateHbaAnim(this); } } if (this->animIndex == ENHORSE_ANIM_WALK) { - playSpeed = this->actor.speedXZ * 0.5f; + playSpeed = this->actor.speed * 0.5f; } else if (this->animIndex == ENHORSE_ANIM_TROT) { - playSpeed = this->actor.speedXZ * 0.25f; + playSpeed = this->actor.speed * 0.25f; } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { - playSpeed = this->actor.speedXZ * 0.2f; + playSpeed = this->actor.speed * 0.2f; } else { playSpeed = 1.0f; } this->skin.skelAnime.playSpeed = playSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speed != 0.0f))) { EnHorse_UpdateHbaAnim(this); } } @@ -2986,36 +2985,36 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { if (playerDistToHome > 300.0f) { if (distToHome > 150.0f) { - this->actor.speedXZ += 0.4f; - if (this->actor.speedXZ > 8.0f) { - this->actor.speedXZ = 8.0f; + this->actor.speed += 0.4f; + if (this->actor.speed > 8.0f) { + this->actor.speed = 8.0f; } } else { - this->actor.speedXZ -= 0.5f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed -= 0.5f; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } } } else if (distToPlayer < 300.0f) { - this->actor.speedXZ += 0.4f; - if (this->actor.speedXZ > 8.0f) { - this->actor.speedXZ = 8.0f; + this->actor.speed += 0.4f; + if (this->actor.speed > 8.0f) { + this->actor.speed = 8.0f; } } else { - this->actor.speedXZ -= 0.5f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed -= 0.5f; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } } - if (this->actor.speedXZ >= 6.0f) { - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; + if (this->actor.speed >= 6.0f) { + this->skin.skelAnime.playSpeed = this->actor.speed * 0.3f; nextAnimIndex = ENHORSE_ANIM_GALLOP; - } else if (this->actor.speedXZ >= 3.0f) { - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; + } else if (this->actor.speed >= 3.0f) { + this->skin.skelAnime.playSpeed = this->actor.speed * 0.375f; nextAnimIndex = ENHORSE_ANIM_TROT; - } else if (this->actor.speedXZ > 0.1f) { - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; + } else if (this->actor.speed > 0.1f) { + this->skin.skelAnime.playSpeed = this->actor.speed * 0.75f; nextAnimIndex = ENHORSE_ANIM_WALK; EnHorse_PlayWalkingSound(this); } else { @@ -3032,7 +3031,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { (nextAnimIndex == ENHORSE_ANIM_WALK)) { if (playerDistToHome < 300.0f) { yaw = player->actor.shape.rot.y; - yaw += ((Actor_YawBetweenActors(&this->actor, &player->actor) > 0) ? 1 : -1) * 0x3FFF; + yaw += ((Actor_WorldYawTowardActor(&this->actor, &player->actor) > 0) ? 1 : -1) * 0x3FFF; } else { yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y; } @@ -3283,7 +3282,7 @@ void func_808846F0(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACTION_21; this->unk_3E0 = -1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80884718(EnHorse* this, PlayState* play) { @@ -3329,9 +3328,9 @@ void func_808848C8(EnHorse* this, PlayState* play) { Vec3f sp24 = { -1916.0f, -106.0f, -523.0f }; EnHorse_PlayWalkingSound(this); - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; func_800F415C(&this->actor, &sp24, 2000); - this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; + this->skin.skelAnime.playSpeed = this->actor.speed * 0.75f; SkelAnime_Update(&this->skin.skelAnime); if (Math3D_Distance(&sp24, &this->actor.world.pos) < 30.0f) { this->stateFlags &= ~ENHORSE_UNRIDEABLE; @@ -3383,12 +3382,12 @@ void func_80884A40(EnHorse* this, PlayState* play) { } if ((this->unk_538 == OBJ_UM_ANIM_TROT) || (this->unk_538 == OBJ_UM_ANIM_GALLOP)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_RUN); + Actor_PlaySfx(&this->actor, NA_SE_EV_HORSE_RUN); } else if (this->unk_538 == OBJ_UM_ANIM_IDLE) { if (this->animIndex == ENHORSE_ANIM_IDLE) { EnHorse_IdleAnimSounds(this, play); } else if (this->animIndex == ENHORSE_ANIM_WHINNY) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_GROAN); + Actor_PlaySfx(&this->actor, NA_SE_EV_HORSE_GROAN); } } } @@ -3397,12 +3396,12 @@ void func_80884A40(EnHorse* this, PlayState* play) { void func_80884D04(EnHorse* this, PlayState* play) { f32 playSpeed; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->action = ENHORSE_ACTION_25; this->unk_540 = this->actor.world.pos; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_INGO_HORSE_NEIGH); + Actor_PlaySfx(&this->actor, NA_SE_IT_INGO_HORSE_NEIGH); this->animIndex = ENHORSE_ANIM_GALLOP; - playSpeed = this->actor.speedXZ * 0.2f; + playSpeed = this->actor.speed * 0.2f; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], sPlaybackSpeeds[this->animIndex] * playSpeed * 2.5f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); @@ -3493,13 +3492,13 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, if ((this->action == ENHORSE_ACTION_5) || (this->action == ENHORSE_ACTION_6)) { this->actor.world.pos = this->actor.prevPos; this->actor.world.rot.y -= 0x640; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.rot.y = this->actor.world.rot.y; this->unk_1EC |= 4; } else if (this->action == ENHORSE_ACTION_25) { this->unk_1EC |= 0x80; this->actor.world.pos = this->actor.prevPos; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if ((play->sceneId != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { this->unk_1EC &= ~2; this->actor.world.pos = this->lastPos; @@ -3539,7 +3538,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { f32 nx; f32 ny; f32 nz; - s32 galloping = this->actor.speedXZ > 8.0f; + s32 galloping = this->actor.speed > 8.0f; s32 status; f32 waterHeight; WaterBox* waterbox; @@ -3600,7 +3599,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { pos.y = this->yFront; dist = Math3D_DistPlaneToPos(nx, ny, nz, this->actor.floorPoly->dist, &pos); - if ((frontFloor != this->actor.floorPoly) && (this->actor.speedXZ >= 0.0f) && + if ((frontFloor != this->actor.floorPoly) && (this->actor.speed >= 0.0f) && ((!(this->stateFlags & ENHORSE_JUMPING) && (dist < -40.0f)) || ((this->stateFlags & ENHORSE_JUMPING) && (dist < -200.0f)))) { EnHorse_ObstructMovement(this, play, 4, galloping); @@ -3611,7 +3610,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { pos.y = this->yBack; dist = Math3D_DistPlaneToPos(nx, ny, nz, this->actor.floorPoly->dist, &pos); - if ((backFloor != this->actor.floorPoly) && (this->actor.speedXZ <= 0.0f) && + if ((backFloor != this->actor.floorPoly) && (this->actor.speed <= 0.0f) && ((!(this->stateFlags & ENHORSE_JUMPING) && (dist < -40.0f)) || ((this->stateFlags & ENHORSE_JUMPING) && (dist < -200.0f)))) { EnHorse_ObstructMovement(this, play, 5, galloping); @@ -3621,7 +3620,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { if ((ny < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || (func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7)) { - if (this->actor.speedXZ >= 0.0f) { + if (this->actor.speed >= 0.0f) { EnHorse_ObstructMovement(this, play, 4, galloping); } else { EnHorse_ObstructMovement(this, play, 5, galloping); @@ -3745,9 +3744,10 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, 0x1C); } - if ((this->actor.bgCheckFlags & 8) && (Math_CosS(this->actor.wallYaw - this->actor.world.rot.y) < -0.3f)) { - if (this->actor.speedXZ > 4.0f) { - this->actor.speedXZ -= 1.0f; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + (Math_CosS(this->actor.wallYaw - this->actor.world.rot.y) < -0.3f)) { + if (this->actor.speed > 4.0f) { + this->actor.speed -= 1.0f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { @@ -3763,8 +3763,8 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { ((horseJump->actor.params & 0xFF) == 5)) { this->stateFlags |= ENHORSE_FLAG_28; this->unk_3E8 += ((-10.0f / this->actor.scale.y) - this->unk_3E8) * 0.5f; - if (this->actor.speedXZ > 2.0f) { - this->actor.speedXZ -= 1.0f; + if (this->actor.speed > 2.0f) { + this->actor.speed -= 1.0f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { @@ -3777,13 +3777,13 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { } } - if ((this->stateFlags & ENHORSE_JUMPING) || (this->stateFlags & ENHORSE_FLAG_28) || (this->actor.speedXZ < 0.0f) || + if ((this->stateFlags & ENHORSE_JUMPING) || (this->stateFlags & ENHORSE_FLAG_28) || (this->actor.speed < 0.0f) || (this->action == ENHORSE_ACTION_STOPPING) || (this->action == ENHORSE_ACTION_MOUNTED_REARING)) { return; } - if (this->actor.speedXZ > 8.0f) { - if (this->actor.speedXZ < 12.8f) { + if (this->actor.speed > 8.0f) { + if (this->actor.speed < 12.8f) { intersectDist = 160.0f; movingFast = false; } else { @@ -3973,9 +3973,9 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { EnHorse_Stub1(this); this->postDrawFunc = EnHorse_LowJumpInit; } else if ((movingFast == true) && - (((this->actor.speedXZ < 13.8f) && ((19.0f * temp_f0) < obstacleHeight) && + (((this->actor.speed < 13.8f) && ((19.0f * temp_f0) < obstacleHeight) && (obstacleHeight <= (72.0f * temp_f0))) || - ((this->actor.speedXZ > 13.8f) && (obstacleHeight <= (112.0f * temp_f0))))) { + ((this->actor.speed > 13.8f) && (obstacleHeight <= (112.0f * temp_f0))))) { EnHorse_Stub2(this); this->postDrawFunc = EnHorse_HighJumpInit; } @@ -4069,7 +4069,7 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 angle = Actor_YawBetweenActors(&this->actor, &player->actor) - this->actor.world.rot.y; + s16 angle = Actor_WorldYawTowardActor(&this->actor, &player->actor) - this->actor.world.rot.y; f32 s = Math_SinS(angle); f32 c = Math_CosS(angle); @@ -4096,7 +4096,7 @@ void EnHorse_TiltBody(EnHorse* this, PlayState* play) { s32 targetRoll; s16 turnVel; - speed = this->actor.speedXZ / this->boostSpeed; + speed = this->actor.speed / this->boostSpeed; turnVel = this->actor.shape.rot.y - this->lastYaw; targetRoll = -((s16)((2730.0f * speed) * (turnVel / 960.00006f))); rollDiff = targetRoll - this->actor.world.rot.z; @@ -4224,7 +4224,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } if (ActorCutscene_GetCurrentIndex() != -1) { - thisx->speedXZ = 0.0f; + thisx->speed = 0.0f; } if (this->action != ENHORSE_ACTION_25) { @@ -4252,8 +4252,8 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } if (this->colliderJntSph.elements->info.ocElemFlags & OCELEM_HIT) { - if (thisx->speedXZ > 10.0f) { - thisx->speedXZ -= 1.0f; + if (thisx->speed > 10.0f) { + thisx->speed -= 1.0f; } } @@ -4351,13 +4351,13 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } } - if ((thisx->speedXZ == 0.0f) && !(this->stateFlags & ENHORSE_FLAG_19)) { + if ((thisx->speed == 0.0f) && !(this->stateFlags & ENHORSE_FLAG_19)) { thisx->colChkInfo.mass = MASS_IMMOVABLE; } else { thisx->colChkInfo.mass = MASS_HEAVY; } - if (thisx->speedXZ >= 5.0f) { + if (thisx->speed >= 5.0f) { this->colliderCylinder1.base.atFlags |= AT_ON; } else { this->colliderCylinder1.base.atFlags &= ~AT_ON; @@ -4399,7 +4399,7 @@ s32 EnHorse_PlayerDirToMountSide(EnHorse* this, PlayState* play, Player* player) s32 EnHorse_MountSideCheck(EnHorse* this, PlayState* play, Player* player) { s32 mountSide; - if (Actor_XZDistanceBetweenActors(&this->actor, &player->actor) > 75.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &player->actor) > 75.0f) { return 0; } @@ -4407,7 +4407,7 @@ s32 EnHorse_MountSideCheck(EnHorse* this, PlayState* play, Player* player) { return 0; } - if (Math_CosS(Actor_YawBetweenActors(&player->actor, &this->actor) - player->actor.world.rot.y) < + if (Math_CosS(Actor_WorldYawTowardActor(&player->actor, &this->actor) - player->actor.world.rot.y) < 0.17364818f) { // cos(80 degrees) return 0; } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index e650ef6d3..5e7619cd2 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -248,7 +248,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { } if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -281,7 +281,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x4000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x40000)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -314,7 +314,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x200000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x02000000)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x02000000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -343,7 +343,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x80) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x800)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x800; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index a10504720..0335085bd 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -120,11 +120,11 @@ f32 func_808DE728(EnHorseLinkChild* this) { f32 phi_fv1; if (this->unk_148 == 2) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speedXZ * (1.0f / 2.0f); + phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 2.0f); } else if (this->unk_148 == 3) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speedXZ * (1.0f / 3.0f); + phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 3.0f); } else if (this->unk_148 == 4) { - phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speedXZ * (1.0f / 5.0f); + phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 5.0f); } else { phi_fv1 = D_808DFF18[this->unk_148]; } @@ -142,7 +142,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f); this->unk_144 = 1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; @@ -186,7 +186,7 @@ void func_808DE9A8(EnHorseLinkChild* this) { } void func_808DEA0C(EnHorseLinkChild* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (SkelAnime_Update(&this->skin.skelAnime)) { func_808DE9A8(this); } @@ -194,7 +194,7 @@ void func_808DEA0C(EnHorseLinkChild* this, PlayState* play) { void func_808DEA54(EnHorseLinkChild* this, s32 arg1) { this->unk_144 = 2; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((arg1 != 0) && (arg1 != 1)) { arg1 = 0; @@ -208,7 +208,7 @@ void func_808DEA54(EnHorseLinkChild* this, s32 arg1) { } void func_808DEB14(EnHorseLinkChild* this, PlayState* play) { - f32 sp44 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + f32 sp44 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); s32 phi_v0; if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -237,7 +237,7 @@ void func_808DEB14(EnHorseLinkChild* this, PlayState* play) { void func_808DECA0(EnHorseLinkChild* this) { this->unk_144 = 1; this->unk_148 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } @@ -248,7 +248,7 @@ void func_808DED40(EnHorseLinkChild* this, PlayState* play) { s32 phi_v0; if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) { - temp_a0 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + temp_a0 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if (temp_a0 > 0x12C) { this->actor.world.rot.y += 0x12C; } else if (temp_a0 < -0x12C) { @@ -260,7 +260,7 @@ void func_808DED40(EnHorseLinkChild* this, PlayState* play) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - temp_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + temp_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); if (temp_fv0 > 1000.0f) { func_808DEA54(this, 0); return; @@ -268,14 +268,14 @@ void func_808DED40(EnHorseLinkChild* this, PlayState* play) { if ((temp_fv0 < 1000.0f) && (temp_fv0 >= 300.0f)) { phi_v0 = 4; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else if ((temp_fv0 < 300.0f) && (temp_fv0 >= 150.0f)) { phi_v0 = 3; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else if ((temp_fv0 < 150.0f) && (temp_fv0 >= 70.0f)) { phi_v0 = 2; this->unk_1E8 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } else { func_808DEA54(this, 1); return; @@ -295,7 +295,7 @@ void func_808DED40(EnHorseLinkChild* this, PlayState* play) { void func_808DEFE8(EnHorseLinkChild* this) { this->unk_144 = 3; this->unk_148 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } @@ -309,7 +309,7 @@ void func_808DF088(EnHorseLinkChild* this, PlayState* play) { if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) { sp32 = player->actor.shape.rot.y; - if (Actor_YawBetweenActors(&this->actor, &player->actor) > 0) { + if (Actor_WorldYawTowardActor(&this->actor, &player->actor) > 0) { phi_v0 = 1; } else { phi_v0 = -1; @@ -340,28 +340,29 @@ void func_808DF194(EnHorseLinkChild* this, PlayState* play) { func_808DF088(this, play); player = GET_PLAYER(play); - sp50 = Actor_XZDistanceBetweenActors(&this->actor, &player->actor); + sp50 = Actor_WorldDistXZToActor(&this->actor, &player->actor); sp48 = this->unk_148; sp4C = SkelAnime_Update(&this->skin.skelAnime); if ((sp4C != 0) || (this->unk_148 == 1) || (this->unk_148 == 0)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_01_20)) { + // The carry-over of this flag from OoT was not done correctly + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_ZORA_HALL)) { f32 sp44 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); s32 pad; if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) > 250.0f) { if (sp44 >= 300.0f) { sp48 = 4; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else if ((sp44 < 300.0f) && (sp44 >= 150.0f)) { sp48 = 3; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else if ((sp44 < 150.0f) && (sp44 >= 70.0f)) { sp48 = 2; this->unk_1E8 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_148 == 0) { sp48 = (sp4C == 1) ? 1 : 0; } else { @@ -370,16 +371,16 @@ void func_808DF194(EnHorseLinkChild* this, PlayState* play) { } } else if (sp50 < 200.0f) { sp48 = 4; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else if (sp50 < 300.0f) { sp48 = 3; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else if (sp50 < 400.0f) { sp48 = 2; this->unk_1E8 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_148 == 0) { sp48 = (sp4C == 1) ? 1 : 0; } else { @@ -387,7 +388,7 @@ void func_808DF194(EnHorseLinkChild* this, PlayState* play) { } } } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_148 == 0) { sp48 = (sp4C == 1) ? 1 : 0; } else { @@ -431,8 +432,8 @@ void func_808DF620(EnHorseLinkChild* this, PlayState* play) { return; } - this->actor.speedXZ = 0.0f; - sp36 = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + this->actor.speed = 0.0f; + sp36 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; if ((Math_CosS(sp36) < 0.7071f) && (this->unk_148 == 2)) { func_800F415C(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C); @@ -454,7 +455,7 @@ void func_808DF788(EnHorseLinkChild* this) { this->unk_144 = 4; this->unk_148 = 2; this->unk_1E0 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f, Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f); } @@ -479,7 +480,7 @@ void func_808DF838(EnHorseLinkChild* this, PlayState* play) { if (SkelAnime_Update(&this->skin.skelAnime)) { if (this->unk_1E0 == 0) { - phi_fv0 = Actor_XZDistanceBetweenActors(&this->actor, &GET_PLAYER(play)->actor); + phi_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); } else { phi_fv0 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos); } @@ -487,25 +488,25 @@ void func_808DF838(EnHorseLinkChild* this, PlayState* play) { if (this->unk_1E0 == 0) { if (phi_fv0 >= 300.0f) { phi_v0 = 4; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else if (phi_fv0 >= 150.0f) { phi_v0 = 3; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else { phi_v0 = 2; this->unk_1E8 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } } else if (phi_fv0 >= 300.0f) { phi_v0 = 4; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else if (phi_fv0 >= 150.0f) { phi_v0 = 3; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else if (phi_fv0 >= 70.0f) { phi_v0 = 2; this->unk_1E8 = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } else { func_808DF560(this); return; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 2eb1c71a6..6f3a192c2 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -150,7 +150,7 @@ void func_80952FE0(EnHs* this, PlayState* play) { } else { this->actionFunc = func_80953180; this->stateFlags &= ~4; - func_80151938(play, 0x33F6); + Message_ContinueTextbox(play, 0x33F6); func_80952DFC(play); } this->stateTimer++; @@ -166,9 +166,9 @@ void func_80953098(EnHs* this, PlayState* play) { } else { this->stateFlags |= 8; if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { - Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 10000.0f, 50.0f); } else { - Actor_PickUp(&this->actor, play, GI_MASK_BUNNY, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_BUNNY, 10000.0f, 50.0f); } } } @@ -178,20 +178,20 @@ void func_80953180(EnHs* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x33F4: // text: laughing that they are all roosters (!) case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_8095345C; break; case 0x33F7: // text: notice his chicks are grown up, happy, wants to give you bunny hood this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80953098; func_80953098(this, play); break; case 0x33F9: // text: laughing that they are all roosters (.) this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_8095345C; break; @@ -204,7 +204,7 @@ void func_80953180(EnHs* this, PlayState* play) { break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_8095345C; break; } diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 2468e5961..43f39a4b9 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -750,7 +750,7 @@ s32 func_80BF2470(EnIg* this, PlayState* play) { Lib_Vec3f_TranslateAndRotateY(&this->unk_2B0, this->actor.world.rot.y, &sp38, &this->actor.world.pos); this->unk_3E2 += this->timePathTimeSpeed; if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PIRATE_WALK); } } return false; @@ -804,7 +804,7 @@ s32 func_80BF25E8(EnIg* this, PlayState* play) { this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; } else if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PIRATE_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PIRATE_WALK); } return false; } @@ -816,9 +816,9 @@ s32 func_80BF2890(EnIg* this, PlayState* play) { if (!(this->unk_3D0 & 0x100) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->unk_408 != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE1); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SNORE1); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE2); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SNORE2); } this->unk_408 ^= 1; } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 4188f44c4..fb9267e8e 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -300,7 +300,7 @@ void EnIk_Freeze(EnIk* this) { this->drawDmgEffAlpha = 1.0f; this->timer = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void EnIk_Thaw(EnIk* this, PlayState* play) { @@ -375,7 +375,7 @@ void EnIk_SetupIdle(EnIk* this) { Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, frameCount, frameCount, ANIMMODE_ONCE, this->timer); this->actionFunc = EnIk_Idle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnIk_Idle(EnIk* this, PlayState* play) { @@ -386,7 +386,7 @@ void EnIk_Idle(EnIk* this, PlayState* play) { EnIk_CheckActions(this, play); } } else if (this->colliderCylinder.base.acFlags & AC_HIT) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); this->actor.hintId = TATL_HINT_ID_IRON_KNUCKLE; this->colliderCylinder.base.acFlags &= ~AC_HIT; @@ -397,7 +397,7 @@ void EnIk_Idle(EnIk* this, PlayState* play) { void EnIk_SetupWalk(EnIk* this) { Animation_MorphToLoop(&this->skelAnime, &gIronKnuckleWalkAnim, -4.0f); - this->actor.speedXZ = 0.9f; + this->actor.speed = 0.9f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnIk_WalkTowardsPlayer; } @@ -407,10 +407,10 @@ void EnIk_WalkTowardsPlayer(EnIk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_WALK); } yawDiff = this->actor.wallYaw - this->actor.shape.rot.y; - if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(yawDiff) >= 0x4000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(yawDiff) >= 0x4000)) { yawDiff = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; Math_ScaledStepToS(&this->actor.shape.rot.y, yawDiff, 0x320); } else { @@ -424,8 +424,8 @@ void EnIk_WalkTowardsPlayer(EnIk* this, PlayState* play) { void EnIk_SetupRun(EnIk* this) { Animation_MorphToLoop(&this->skelAnime, &gIronKnuckleRunAnim, -4.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TWINROBA_SHOOT_VOICE); - this->actor.speedXZ = 2.5f; + Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_SHOOT_VOICE); + this->actor.speed = 2.5f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnIk_RunTowardsPlayer; } @@ -435,10 +435,10 @@ void EnIk_RunTowardsPlayer(EnIk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 9.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_WALK); } yawDiff = this->actor.wallYaw - this->actor.shape.rot.y; - if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(yawDiff) >= 0x4000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(yawDiff) >= 0x4000)) { yawDiff = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; Math_ScaledStepToS(&this->actor.shape.rot.y, yawDiff, 0x4B0); } else { @@ -454,7 +454,7 @@ void EnIk_SetupVerticalAttack(EnIk* this) { s32 pad; f32 playbackSpeed; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->drawArmorFlags) { playbackSpeed = 1.5f; } else { @@ -473,13 +473,13 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { this->timer++; if (!(this->skelAnime.curFrame < 7.0f) || !EnIk_IsChangingAction(this, play)) { if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) { particlePos.x = (Math_SinS((this->actor.shape.rot.y + 0x6A4)) * 70.0f) + this->actor.world.pos.x; particlePos.z = (Math_CosS((this->actor.shape.rot.y + 0x6A4)) * 70.0f) + this->actor.world.pos.z; particlePos.y = this->actor.world.pos.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); Camera_AddQuake(GET_ACTIVE_CAM(play), 2, 25, 5); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); CollisionCheck_SpawnShieldParticles(play, &particlePos); @@ -488,11 +488,11 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { this->colliderQuad.base.atFlags |= AT_ON; if (this->drawArmorFlags) { - this->actor.speedXZ = sin_rad((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; + this->actor.speed = sin_rad((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; } } else { this->colliderQuad.base.atFlags &= ~AT_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if ((this->drawArmorFlags) && (this->skelAnime.curFrame < 13.0f)) { @@ -508,7 +508,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { void EnIk_SetupTakeOutAxe(EnIk* this) { Animation_PlayOnce(&this->skelAnime, &gIronKnuckleEndVerticalAttackAnim); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_PULLOUT); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_PULLOUT); this->actionFunc = EnIk_TakeOutAxe; } @@ -525,7 +525,7 @@ void EnIk_TakeOutAxe(EnIk* this, PlayState* play) { } void EnIk_SetupHorizontalDoubleAttack(EnIk* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_Change(&this->skelAnime, &gIronKnuckleHorizontalAttackAnim, (this->drawArmorFlags) ? 1.3f : 1.0f, 0.0f, Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim.common), ANIMMODE_ONCE_INTERP, (this->drawArmorFlags) ? 4.0f : 10.0f); @@ -539,7 +539,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { this->timer++; if ((Animation_OnFrame(&this->skelAnime, 1.0f)) || (Animation_OnFrame(&this->skelAnime, 13.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } if (((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 9.0f)) || ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f))) { @@ -551,12 +551,12 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { } else { phi_f2 = this->skelAnime.curFrame - 1.0f; } - this->actor.speedXZ = sin_rad((M_PI / 8) * phi_f2) * 4.5f; + this->actor.speed = sin_rad((M_PI / 8) * phi_f2) * 4.5f; } this->colliderQuad.base.atFlags |= AT_ON; } else { this->colliderQuad.base.atFlags &= ~AT_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (SkelAnime_Update(&this->skelAnime)) { EnIk_SetupEndHorizontalAttack(this); @@ -566,7 +566,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { void EnIk_SetupSingleHorizontalAttack(EnIk* this) { f32 playSpeed; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->drawArmorFlags) { this->actor.world.rot.z = 0x1000; playSpeed = 1.3f; @@ -584,7 +584,7 @@ void EnIk_SetupSingleHorizontalAttack(EnIk* this) { void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play) { this->timer++; if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } if ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f)) { this->colliderQuad.base.atFlags |= AT_ON; @@ -611,7 +611,7 @@ void EnIk_EndHorizontalAttack(EnIk* this, PlayState* play) { } void EnIk_SetupBlock(EnIk* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_Change(&this->skelAnime, &gIronKnuckleBlockAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gIronKnuckleBlockAnim), ANIMMODE_ONCE, -2.0f); this->timer = 20; @@ -634,7 +634,7 @@ void EnIk_SetupReactToAttack(EnIk* this, s32 arg1) { if (arg1) { func_800BE504(&this->actor, &this->colliderCylinder); } - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; temp_v0 = (this->actor.world.rot.y - this->actor.shape.rot.y) + 0x8000; if (ABS_ALT(temp_v0) <= 0x4000) { Animation_MorphToPlayOnce(&this->skelAnime, &gIronKnuckleFrontHitAnim, -4.0f); @@ -645,7 +645,7 @@ void EnIk_SetupReactToAttack(EnIk* this, s32 arg1) { } void EnIk_ReactToAttack(EnIk* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); if (this->subCamId != SUB_CAM_ID_DONE) { Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); } @@ -664,10 +664,10 @@ void EnIk_ReactToAttack(EnIk* this, PlayState* play) { } void EnIk_SetupDie(EnIk* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_MorphToPlayOnce(&this->skelAnime, &gIronKnuckleDeathAnim, -4.0f); this->timer = 24; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DEAD); this->actionFunc = EnIk_Die; } @@ -698,14 +698,14 @@ void EnIk_Die(EnIk* this, PlayState* play) { } } } else if (Animation_OnFrame(&this->skelAnime, 23.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_WALK); } } void EnIk_SetupFrozen(EnIk* this) { this->invincibilityFrames = 0; this->actionFunc = EnIk_Frozen; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void EnIk_Frozen(EnIk* this, PlayState* play) { @@ -724,7 +724,7 @@ void EnIk_Frozen(EnIk* this, PlayState* play) { void EnIk_SetupCutscene(EnIk* this) { ActorCutscene_SetIntentToPlay(this->actor.cutscene); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.colChkInfo.health != 0) { func_800BE504(&this->actor, &this->colliderCylinder); } @@ -776,7 +776,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { if ((this->actor.colChkInfo.damageEffect != DMG_EFF_IMMUNE) && ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || (!(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 12); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 12); this->invincibilityFrames = 12; EnIk_Thaw(this, play); this->colliderQuad.base.atFlags &= ~AT_ON; @@ -793,7 +793,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->drawArmorFlags = 1; this->colliderCylinder.base.colType = 3; this->actor.colChkInfo.damageTable = &sDamageTableNoArmor; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); EnIk_SetupCutscene(this); } else if (this->drawArmorFlags) { if (this->actor.colChkInfo.damageEffect == DMG_EFF_ICE) { @@ -811,7 +811,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { } else if (this->actor.colChkInfo.damageEffect == DMG_EFF_LIGHT_SPARKS) { EnIk_HitArmor(this, play); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); if (this->actor.colChkInfo.health != 0) { EnIk_SetupReactToAttack(this, true); } else { @@ -819,8 +819,8 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { } } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); if (this->actor.colChkInfo.damageEffect == 4) { EnIk_HitArmor(this, play); } @@ -1064,7 +1064,7 @@ void EnIk_UpdateArmorDraw(EnIk* this, PlayState* play) { } void EnIk_Draw(Actor* thisx, PlayState* play) { - static Vec3f D_8092C200 = { 0.53f, 0.53f, 0.53f }; + static Vec3f sScale = { 0.53f, 0.53f, 0.53f }; EnIk* this = THIS; Gfx* gfx; Gfx** gfxArmorType; @@ -1091,7 +1091,7 @@ void EnIk_Draw(Actor* thisx, PlayState* play) { if (this->actor.colorFilterTimer != 0) { func_800AE5A0(play); } - func_800BC620(&this->actor.focus.pos, &D_8092C200, 255, play); + func_800BC620(&this->actor.focus.pos, &sScale, 255, play); Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 3a83564e5..bf7552947 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -170,11 +170,11 @@ s32 func_808F3178(EnIn* this, PlayState* play) { this->unk260 = tmp = SubS_IsFloorAbove(play, &this->unk248, -6.0f); if (this->unk260 != 0 && prevUnk260 == 0 && tmp) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_CONCRETE); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE); } this->unk261 = tmp = SubS_IsFloorAbove(play, &this->unk254, -6.0f); if (this->unk261 != 0 && prevUnk261 == 0 && tmp) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_CONCRETE); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE); } return 0; @@ -214,7 +214,7 @@ s32 func_808F3334(EnIn* this, PlayState* play) { if (this->colliderJntSph.base.atFlags & AT_BOUNCED) { return 0; } - Actor_PlaySfxAtPos(&player->actor, NA_SE_PL_BODY_HIT); + Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); func_800B8D98(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 6.0f); } return 1; @@ -287,8 +287,8 @@ void func_808F3690(EnIn* this, PlayState* play) { s16 sp36; Vec3f sp28; - Math_SmoothStepToF(&this->actor.speedXZ, 1.0f, 0.4f, 1000.0f, 0.0f); - sp36 = this->actor.speedXZ * 400.0f; + Math_SmoothStepToF(&this->actor.speed, 1.0f, 0.4f, 1000.0f, 0.0f); + sp36 = this->actor.speed * 400.0f; if (SubS_CopyPointFromPath(this->path, this->unk244, &sp28) && SubS_MoveActorToPoint(&this->actor, &sp28, sp36)) { this->unk244++; if (this->unk244 >= this->path->count) { @@ -313,7 +313,7 @@ void func_808F374C(EnIn* this, PlayState* play) { } } if (this->skelAnime.animation == &object_in_Anim_0198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_CRY_0); + Actor_PlaySfx(&this->actor, NA_SE_VO_IN_CRY_0); } if (SkelAnime_Update(&this->skelAnime)) { this->unk488 %= ARRAY_COUNT(sAnimations); @@ -376,9 +376,9 @@ void func_808F39DC(EnIn* this, PlayState* play) { this->actor.textId = textId; this->actionFunc = func_808F395C; if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST); + Actor_PlaySfx(&this->actor, NA_SE_VO_IN_LOST); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0); + Actor_PlaySfx(&this->actor, NA_SE_VO_IN_JOY0); } } @@ -402,7 +402,7 @@ void func_808F3B40(EnIn* this, PlayState* play) { textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4; this->actor.textId = textId; } else { - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); } } @@ -426,7 +426,7 @@ void func_808F3C40(EnIn* this, PlayState* play) { textId = gSaveContext.save.day != 3 ? 0x346A : 0x3492; this->actor.textId = textId; } else { - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); } } @@ -450,7 +450,7 @@ void func_808F3D40(EnIn* this, PlayState* play) { this->actor.textId = textId; this->actor.flags |= ACTOR_FLAG_10000; } else { - Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); } } @@ -750,7 +750,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); Rupees_ChangeBy(-play->msgCtx.unk1206C); ret = true; } else { @@ -896,7 +896,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_808F35D8(this, play); if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3B40; - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; } else { Actor_ContinueText(play, &this->actor, 0x347F); @@ -920,7 +920,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x347C: this->actionFunc = func_808F3D40; - Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); func_808F35D8(this, play); ret = true; break; @@ -1002,7 +1002,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); Rupees_ChangeBy(-play->msgCtx.unk1206C); ret = true; } else { @@ -1085,7 +1085,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x349F: this->actionFunc = func_808F3D40; - Actor_PickUp(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); func_808F35D8(this, play); ret = true; break; @@ -1100,7 +1100,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_808F35D8(this, play); if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3B40; - Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; } else { Actor_ContinueText(play, &this->actor, 0x34A2); @@ -1188,7 +1188,7 @@ s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { case TEXT_STATE_CHOICE: case TEXT_STATE_5: if (Message_ShouldAdvance(play) && func_808F4414(play, this, arg2)) { - func_801477B4(play); + Message_CloseTextbox(play); ret = true; } break; @@ -1210,7 +1210,7 @@ s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { return 0; } if (*arg3 == 3) { - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); *arg3 = 1; return 0; } @@ -1335,9 +1335,9 @@ void func_808F5C98(EnIn* this, PlayState* play) { } if (this->unk4A8 == 2) { if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST); + Actor_PlaySfx(&this->actor, NA_SE_VO_IN_LOST); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0); + Actor_PlaySfx(&this->actor, NA_SE_VO_IN_JOY0); } this->unk4A8 = 3; } else if (this->unk4A8 < 3) { diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 9eae19437..65696795b 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -112,7 +112,7 @@ void func_8091A9E4(EnInsect* this) { return; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MUSI_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_MUSI_WALK); this->unk_316 = 3.0f / CLAMP_MIN(this->skelAnime.playSpeed, 0.1f); if (this->unk_316 < 2) { @@ -181,9 +181,9 @@ void func_8091AC78(EnInsect* this) { void func_8091ACC4(EnInsect* this, PlayState* play) { f32 temp_f2; - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.5f, 0.0f); - temp_f2 = (Rand_ZeroOne() * 0.8f) + (this->actor.speedXZ * 1.2f); + temp_f2 = (Rand_ZeroOne() * 0.8f) + (this->actor.speed * 1.2f); if (temp_f2 < 0.0f) { this->skelAnime.playSpeed = 0.0f; } else { @@ -201,7 +201,7 @@ void func_8091ACC4(EnInsect* this, PlayState* play) { if ((this->unk_30C & 4) && (this->unk_314 <= 0)) { func_8091B3D0(this); - } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_8091B618(this); } else if (this->actor.xzDistToPlayer < 40.0f) { func_8091B030(this); @@ -218,7 +218,7 @@ void func_8091AE5C(EnInsect* this, PlayState* play) { s32 pad; f32 temp_f0; - Math_SmoothStepToF(&this->actor.speedXZ, 1.5f, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 1.5f, 0.1f, 0.5f, 0.0f); if ((EnInsect_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(40.0f)) || (this->unk_312 < 4)) { @@ -231,7 +231,7 @@ void func_8091AE5C(EnInsect* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; - temp_f0 = this->actor.speedXZ * 1.4f; + temp_f0 = this->actor.speed * 1.4f; this->skelAnime.playSpeed = CLAMP(temp_f0, 0.7f, 1.9f); SkelAnime_Update(&this->skelAnime); @@ -241,7 +241,7 @@ void func_8091AE5C(EnInsect* this, PlayState* play) { if ((this->unk_30C & 4) && (this->unk_314 <= 0)) { func_8091B3D0(this); - } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_8091B618(this); } else if (this->actor.xzDistToPlayer < 40.0f) { func_8091B030(this); @@ -261,7 +261,7 @@ void func_8091B07C(EnInsect* this, PlayState* play) { s16 yaw; s32 sp38 = this->actor.xzDistToPlayer < 40.0f; - Math_SmoothStepToF(&this->actor.speedXZ, 1.8f, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.1f, 0.5f, 0.0f); if ((EnInsect_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) || (this->unk_312 < 4)) { @@ -284,13 +284,13 @@ void func_8091B07C(EnInsect* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; - speed = this->actor.speedXZ * 1.6f; + speed = this->actor.speed * 1.6f; this->skelAnime.playSpeed = CLAMP(speed, 0.8f, 1.9f); SkelAnime_Update(&this->skelAnime); if ((this->unk_312 <= 0) || !sp38) { func_8091AC78(this); - } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_30C & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_8091B618(this); } } @@ -299,7 +299,7 @@ void func_8091B274(EnInsect* this) { this->unk_312 = 200; Actor_SetScale(&this->actor, 0.001f); this->actor.draw = NULL; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->skelAnime.playSpeed = 0.3f; this->actionFunc = func_8091B2D8; this->unk_30C &= ~0x100; @@ -325,7 +325,7 @@ void func_8091B2D8(EnInsect* this, PlayState* play) { void func_8091B3D0(EnInsect* this) { this->unk_312 = 60; this->skelAnime.playSpeed = 1.9f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTURA_BOUND); Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); this->actionFunc = func_8091B440; this->unk_30C &= ~0x100; @@ -336,7 +336,7 @@ void func_8091B440(EnInsect* this, PlayState* play) { s32 pad[2]; Vec3f sp34; - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.5f, 0.0f); Math_StepToS(&this->actor.shape.rot.x, 0x2AAA, 0x160); Actor_SetScale(&this->actor, CLAMP_MIN(this->actor.scale.x - 0.0002f, 0.001f)); @@ -373,9 +373,9 @@ void func_8091B670(EnInsect* this, PlayState* play) { Vec3f sp40; if (this->unk_312 > 80) { - Math_StepToF(&this->actor.speedXZ, 0.6f, 0.08f); + Math_StepToF(&this->actor.speed, 0.6f, 0.08f); } else { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.02f); + Math_StepToF(&this->actor.speed, 0.0f, 0.02f); } this->actor.velocity.y = 0.0f; @@ -409,7 +409,7 @@ void func_8091B670(EnInsect* this, PlayState* play) { if ((this->unk_312 <= 0) || ((this->unk_30C & 4) && (this->unk_314 <= 0))) { func_8091B928(this); - } else if (!(this->actor.bgCheckFlags & 0x40)) { + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_8091AC78(this); } } @@ -417,7 +417,7 @@ void func_8091B670(EnInsect* this, PlayState* play) { void func_8091B928(EnInsect* this) { this->unk_312 = 100; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.terminalVelocity = -0.8f; this->actor.gravity = -0.04f; this->unk_30C &= ~1; @@ -462,7 +462,7 @@ void EnInsect_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (this->unk_30C & 0x100) { if (this->unk_30C & 1) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8091A9E4(this); } } else { @@ -494,7 +494,7 @@ void EnInsect_Update(Actor* thisx, PlayState* play) { } if (!(this->unk_30C & 8) && (D_8091BD60 < 4) && EnInsect_InBottleRange(this, play) && - Actor_PickUp(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { + Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { D_8091BD60++; } } diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index f1ebe1bb2..e29a91b4b 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,17 +1,4 @@ -/* - * File: z_en_invadepoh.c - * Overlay: ovl_En_Invadepoh - * Description: Ranch nighttime actors - */ -#include "prevent_bss_reordering.h" #include "z_en_invadepoh.h" -#include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_ma1/object_ma1.h" -#include "objects/object_ma2/object_ma2.h" -#include "objects/object_dog/object_dog.h" -#include "objects/object_cow/object_cow.h" -#include "objects/object_uch/object_uch.h" #define FLAGS (ACTOR_FLAG_10) @@ -21,164 +8,8 @@ void EnInvadepoh_Init(Actor* thisx, PlayState* play); void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); void EnInvadepoh_Update(Actor* thisx, PlayState* play); -void func_80B46DA8(EnInvadepoh* this); -void func_80B46DC8(EnInvadepoh* this, PlayState* play); -void func_80B46E20(EnInvadepoh* this); -void func_80B46E44(EnInvadepoh* this, PlayState* play); -void func_80B46EC0(EnInvadepoh* this); -void func_80B46EE8(EnInvadepoh* this, PlayState* play); -void func_80B46F88(EnInvadepoh* this); -void func_80B46FA8(EnInvadepoh* this, PlayState* play); -void func_80B47064(EnInvadepoh* this); -void func_80B47084(EnInvadepoh* this, PlayState* play); -void func_80B470E0(EnInvadepoh* this); -void func_80B47108(EnInvadepoh* this, PlayState* play); -void func_80B471C0(EnInvadepoh* this); -void func_80B471E0(EnInvadepoh* this, PlayState* play); -void func_80B47248(EnInvadepoh* this); -void func_80B47268(EnInvadepoh* this, PlayState* play); -void func_80B47298(EnInvadepoh* this, PlayState* play); -void func_80B47304(EnInvadepoh* this); -void func_80B47324(EnInvadepoh* this, PlayState* play); -void func_80B473E4(EnInvadepoh* this, PlayState* play); -void func_80B474DC(EnInvadepoh* this, PlayState* play); -void func_80B47600(EnInvadepoh* this, PlayState* play); -void func_80B477B4(EnInvadepoh* this, PlayState* play); -void func_80B48324(EnInvadepoh* this, PlayState* play); -void func_80B4ACF0(EnInvadepoh* this, PlayState* play); -void func_80B4AD3C(EnInvadepoh* this); -void func_80B4AD60(EnInvadepoh* this, PlayState* play); -void func_80B4ADB8(EnInvadepoh* this); -void func_80B4ADCC(EnInvadepoh* this, PlayState* play); -void func_80B4AEC0(EnInvadepoh* this); -void func_80B4AEDC(EnInvadepoh* this, PlayState* play); -void func_80B4AF80(EnInvadepoh* this); -void func_80B4AF94(EnInvadepoh* this, PlayState* play); -void func_80B4B024(EnInvadepoh* this); -void func_80B4B048(EnInvadepoh* this, PlayState* play); -void func_80B4B484(EnInvadepoh* this, PlayState* play); -void func_80B4B510(EnInvadepoh* this); -void func_80B4B564(EnInvadepoh* this, PlayState* play); -void func_80B4B724(EnInvadepoh* this); -void func_80B4B768(EnInvadepoh* this, PlayState* play); -void func_80B4B820(EnInvadepoh* this); -void func_80B4B864(EnInvadepoh* this, PlayState* play); -void func_80B48374(EnInvadepoh* this); -void func_80B483CC(EnInvadepoh* this, PlayState* play); -void func_80B49A00(EnInvadepoh* this, PlayState* play); -void func_80B4994C(EnInvadepoh* this, PlayState* play); -void func_80B497EC(EnInvadepoh* this, PlayState* play); -void func_80B49628(EnInvadepoh* this); -void func_80B49670(EnInvadepoh* this, PlayState* play); -void func_80B49454(EnInvadepoh* this, PlayState* play); -void func_80B4934C(EnInvadepoh* this, PlayState* play); -void func_80B491EC(EnInvadepoh* this); -void func_80B49228(EnInvadepoh* this, PlayState* play); -void func_80B49C38(EnInvadepoh* this, PlayState* play); -void func_80B49DFC(EnInvadepoh* this, PlayState* play); -void func_80B4A350(EnInvadepoh* this, PlayState* play); -void func_80B4A5E4(EnInvadepoh* this, PlayState* play); -void func_80B4A67C(EnInvadepoh* this, PlayState* play); -void func_80B4A81C(EnInvadepoh* this, PlayState* play); -void func_80B4BC4C(EnInvadepoh* this, PlayState* play); -void func_80B4C058(EnInvadepoh* this, PlayState* play); -void func_80B4C218(EnInvadepoh* this, PlayState* play); -void func_80B4C730(EnInvadepoh* this, PlayState* play); -void func_80B4CB0C(EnInvadepoh* this, PlayState* play); -void func_80B4CCCC(EnInvadepoh* this, PlayState* play); -void func_80B4D480(EnInvadepoh* this, PlayState* play); -void func_80B47568(EnInvadepoh* this); -void func_80B478F4(EnInvadepoh* this, PlayState* play); -void func_80B47938(EnInvadepoh* this); -void func_80B479E8(EnInvadepoh* this, PlayState* play); -void func_80B4843C(EnInvadepoh* this); -void func_80B484EC(EnInvadepoh* this, PlayState* play); -void func_80B48588(EnInvadepoh* this); -void func_80B48610(EnInvadepoh* this, PlayState* play); -void func_80B48848(EnInvadepoh* this, PlayState* play); -void func_80B47278(EnInvadepoh* this); -void func_80B48AD4(EnInvadepoh* this, PlayState* play); -void func_80B48E4C(EnInvadepoh* this, PlayState* play); -void func_80B49404(EnInvadepoh* this); -void func_80B4A570(EnInvadepoh* this); -void func_80B4C1BC(EnInvadepoh* this); -void func_80B4D290(EnInvadepoh* this, PlayState* play); -void func_80B4CC70(EnInvadepoh* this); -void func_80B4770C(EnInvadepoh* this); -void func_80B48948(EnInvadepoh* this); -void func_80B49904(EnInvadepoh* this); -void func_80B499BC(EnInvadepoh* this); -void func_80B492FC(EnInvadepoh* this); -void func_80B4627C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play); -void func_80B468B4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play); -void func_80B46BB0(EnInvadepoh* this, PlayState* play); -void func_80B46BC0(EnInvadepoh* this, PlayState* play); -void func_80B46C08(EnInvadepoh* this, PlayState* play); -void func_80B46C34(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C7C(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C94(EnInvadepoh* this, PlayState* play); -void func_80B46CC0(EnInvadepoh* this, PlayState* play); -void func_80B46CF4(EnInvadepoh* this, PlayState* play); -void func_80B46D28(EnInvadepoh* this, PlayState* play); -void func_80B4D670(Actor* thisx, PlayState* play); -void func_80B47BAC(Actor* thisx, PlayState* play); -void func_80B47D30(Actor* thisx, PlayState* play); -void func_80B47FA8(Actor* thisx, PlayState* play); -void func_80B48060(Actor* thisx, PlayState* play); -void func_80B481C4(Actor* thisx, PlayState* play); -void func_80B4827C(Actor* thisx, PlayState* play); -void func_80B48620(Actor* thisx, PlayState* play); -void func_80B48FB0(Actor* thisx, PlayState* play); -void func_80B49F88(Actor* thisx, PlayState* play); -void func_80B4A9C8(Actor* thisx, PlayState* play); -void func_80B4B0C4(Actor* thisx, PlayState* play); -void func_80B4CE54(Actor* thisx, PlayState* play); -void func_80B4B8BC(Actor* thisx, PlayState* play); -void func_80B4C3A0(Actor* thisx, PlayState* play); -void func_80B49B1C(Actor* thisx, PlayState* play); -void func_80B4E158(Actor* thisx, PlayState* play); -void func_80B4E3F0(Actor* thisx, PlayState* play); -void func_80B4D9B4(Actor* thisx, PlayState* play); -void func_80B4E1B0(Actor* thisx, PlayState* play); -void func_80B4E324(Actor* thisx, PlayState* play); -void func_80B4BA84(Actor* thisx, PlayState* play); -void func_80B4E660(Actor* thisx, PlayState* play); -void func_80B4C5C0(Actor* thisx, PlayState* play); -void func_80B4E7BC(Actor* thisx, PlayState* play); -void func_80B4A1B8(Actor* thisx, PlayState* play); -void func_80B4ABDC(Actor* thisx, PlayState* play); -void func_80B4D054(Actor* thisx, PlayState* play); -void func_80B4DB14(Actor* thisx, PlayState* play); -void func_80B4D760(Actor* thisx, PlayState* play); -void func_80B4A168(Actor* thisx, PlayState* play); -void func_80B4873C(Actor* thisx, PlayState* play); -void func_80B490F0(Actor* thisx, PlayState* play); -void func_80B4AB8C(Actor* thisx, PlayState* play); -void func_80B4B218(Actor* thisx, PlayState* play); -void func_80B4BA30(Actor* thisx, PlayState* play); -void func_80B4C568(Actor* thisx, PlayState* play); -void func_80B4CFFC(Actor* thisx, PlayState* play); -void func_80B46184(unkStruct80B50350* unkStruct); -s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed); -s32 func_80B4516C(EnInvadepoh* this); -void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u); -void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u); -void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u); - -extern s32 D_801BDA9C; - -ActorInit En_Invadepoh_InitVars = { +/* +const ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, FLAGS, @@ -189,4414 +20,492 @@ ActorInit En_Invadepoh_InitVars = { (ActorFunc)EnInvadepoh_Update, (ActorFunc)NULL, }; +*/ -static ColliderCylinderInit sCylinderInitAlien = { - { - COLTYPE_HIT3, - AT_ON | AT_TYPE_ENEMY, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK4, - { 0xF7CFFFFF, 0x00, 0x04 }, - { 0x00003820, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, - OCELEM_ON, - }, - { 40, 95, 10, { 0, 0, 0 } }, -}; - -static ColliderCylinderInit sCylinderInitRomaniAndCremia = { - { - COLTYPE_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, - OCELEM_ON, - }, - { 18, 46, 0, { 0, 0, 0 } }, -}; - -static ColliderCylinderInit sCylinderInitDog = { - { - COLTYPE_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK1, - { 0x00000000, 0x00, 0x00 }, - { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, - OCELEM_ON, - }, - { 13, 19, 0, { 0, 0, 0 } }, -}; - -static Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; - -static s32 D_80B4E940 = 0; - -static TexturePtr sRomaniEyeTextures[] = { - gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, -}; - -static TexturePtr sRomaniMouthTextures[] = { - gRomaniMouthHappyTex, - gRomaniMouthFrownTex, - gRomaniMouthHangingOpenTex, - gRomaniMouthSmileTex, -}; - -static s8 D_80B4E968 = 0; - -static TexturePtr sCremiaEyeTextures[] = { - gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, -}; - -static TexturePtr sCremiaMouthTextures[] = { - gCremiaMouthNormalTex, - gCremiaMouthSlightSmileTex, - gCremiaMouthFrownTex, - gCremiaMouthHangingOpenTex, -}; - -static s8 D_80B4E994 = 0; - -static s8 D_80B4E998 = 0; - -static s8 D_80B4E99C[] = { 0 }; - -static s8 D_80B4E9A0[] = { 0, 1, 2, 0 }; - -static s8 D_80B4E9A4[] = { 0, 1, 2, 1, 0 }; - -static s8 D_80B4E9AC[] = { 0, 1, 2, 2, 1, 0 }; - -static s8 D_80B4E9B4[] = { - 0, 1, 2, 1, 0, 1, 2, 0, -}; - -static s8 D_80B4E9BC[] = { 1 }; - -static s8 D_80B4E9C0[] = { 3 }; - -static unkstructInvadepoh0 D_80B4E9C4 = { D_80B4E99C, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B439B0.s") -static unkstructInvadepoh0 D_80B4E9CC = { D_80B4E9A0, 4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A24.s") -static unkstructInvadepoh0 D_80B4E9D4 = { D_80B4E9A4, 5 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A74.s") -static unkstructInvadepoh0 D_80B4E9DC = { D_80B4E9AC, 6 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A9C.s") -static unkstructInvadepoh0 D_80B4E9E4 = { D_80B4E9B4, 8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AB0.s") -static unkstructInvadepoh0 D_80B4E9EC = { D_80B4E9BC, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AF0.s") -static unkstructInvadepoh0 D_80B4E9F4 = { D_80B4E9C0, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43B80.s") -static unkstructInvadepoh2 D_80B4E9FC = { 0, &D_80B4E9C4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43BC8.s") -static unkstructInvadepoh1 D_80B4EA04[] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.97f }, - { 5, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43DD4.s") -static unkstructInvadepoh1 D_80B4EA24[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43E6C.s") -static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F0C.s") -static unkstructInvadepoh3 D_80B4EA40 = { - 1, - &D_80B4E9CC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F70.s") -static unkstructInvadepoh3 D_80B4EA50 = { - 1, - &D_80B4E9D4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44024.s") -static unkstructInvadepoh3 D_80B4EA60 = { - 1, - &D_80B4E9DC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4407C.s") -static unkstructInvadepoh3 D_80B4EA70 = { - 1, - &D_80B4E9E4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B440B8.s") -static unkstructInvadepoh2 D_80B4EA80 = { - 0, - &D_80B4E9EC, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44234.s") -static unkstructInvadepoh2 D_80B4EA88 = { - 0, - &D_80B4E9F4, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B442E4.s") -static void* D_80B4EA90[] = { - &D_80B4E9FC, &D_80B4EA2C, &D_80B4EA40, &D_80B4EA50, &D_80B4EA60, &D_80B4EA70, &D_80B4EA80, &D_80B4EA88, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B443A0.s") -static s8 D_80B4EAB0[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444BC.s") -static s8 D_80B4EAB4[] = { 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444F4.s") -static s8 D_80B4EAB8[] = { 2 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44514.s") -static s8 D_80B4EABC[] = { 3 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44540.s") -static unkstructInvadepoh0 D_80B4EAC0 = { D_80B4EAB0, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44570.s") -static unkstructInvadepoh0 D_80B4EAC8 = { D_80B4EAB4, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44620.s") -static unkstructInvadepoh0 D_80B4EAD0 = { D_80B4EAB8, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44640.s") -static unkstructInvadepoh0 D_80B4EAD8 = { D_80B4EABC, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44664.s") -static unkstructInvadepoh2 D_80B4EAE0 = { 0, &D_80B4EAC0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44690.s") -static unkstructInvadepoh2 D_80B4EAE8 = { 0, &D_80B4EAC8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B446D0.s") -static unkstructInvadepoh2 D_80B4EAF0 = { 0, &D_80B4EAD0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44700.s") -static unkstructInvadepoh2 D_80B4EAF8 = { 0, &D_80B4EAD8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B447C0.s") -static void* D_80B4EB00[] = { - &D_80B4EAE0, - &D_80B4EAE8, - &D_80B4EAF0, - &D_80B4EAF8, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44A90.s") -static s8 D_80B4EB10[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B78.s") -static s8 D_80B4EB14[] = { 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B84.s") -static s8 D_80B4EB18[] = { 0, 1, 2, 1, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C24.s") -static s8 D_80B4EB20[] = { 0, 1, 2, 2, 1, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C80.s") -static s8 D_80B4EB28[] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44E90.s") -static unkstructInvadepoh0 D_80B4EB30 = { D_80B4EB10, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44EFC.s") -static unkstructInvadepoh0 D_80B4EB38 = { D_80B4EB14, 4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44F58.s") -static unkstructInvadepoh0 D_80B4EB40 = { D_80B4EB18, 5 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44FEC.s") -static unkstructInvadepoh0 D_80B4EB48 = { D_80B4EB20, 6 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45080.s") -static unkstructInvadepoh0 D_80B4EB50 = { D_80B4EB28, 8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B450C0.s") -static unkstructInvadepoh2 D_80B4EB58 = { 0, &D_80B4EB30 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4516C.s") -static unkstructInvadepoh1 D_80B4EB60[] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.95f }, - { 5, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B451A0.s") -static unkstructInvadepoh1 D_80B4EB80[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B452EC.s") -static unkstructInvadepoh4 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 0x28, 0x3C }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B453F4.s") -static unkstructInvadepoh3 D_80B4EB9C = { - 1, - &D_80B4EB38, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45460.s") -static unkstructInvadepoh3 D_80B4EBAC = { - 1, - &D_80B4EB40, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B454BC.s") -static unkstructInvadepoh3 D_80B4EBBC = { - 1, - &D_80B4EB48, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45518.s") -static unkstructInvadepoh3 D_80B4EBCC = { - 1, - &D_80B4EB50, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45550.s") -static void* D_80B4EBDC[] = { - &D_80B4EB58, &D_80B4EB88, &D_80B4EB9C, &D_80B4EBAC, &D_80B4EBBC, &D_80B4EBCC, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4560C.s") -static s8 D_80B4EBF4[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45648.s") -static unkstructInvadepoh0 D_80B4EBF8 = { D_80B4EBF4, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B456A8.s") -static unkstructInvadepoh2 D_80B4EC00 = { 0, &D_80B4EBF8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B457A0.s") -static void* D_80B4EC08[] = { &D_80B4EC00 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B458D8.s") -static void (*D_80B4EC0C[])(struct EnInvadePohStruct*, unkstructInvadepoh4** arg1) = { - func_80B45A4C, - func_80B45A94, - func_80B45B1C, -}; - -static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; - -static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; - -static void (*D_80B4EC20[])(struct unkStruct80B50350*) = { func_80B46184 }; - -static InitChainEntry D_80B4EC24[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainParentCow[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainChildCow[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainRomani[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry D_80B4EC68[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_CONTINUE), - ICHAIN_F32(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainDog[] = { - ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 50, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 50, ICHAIN_CONTINUE), - ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainCremia[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static EnInvadepohInitFunc D_80B4ECB0[] = { - func_80B4627C, - EnInvadepoh_InitAlien, - EnInvadepoh_InitParentCow, - EnInvadepoh_InitChildCow, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - func_80B468B4, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - EnInvadepoh_InitDog, - EnInvadepoh_InitCremia, - EnInvadepoh_InitRomani, - EnInvadepoh_InitAlien, -}; - -static EnInvadepohDestroyFunc D_80B4ECE8[] = { - func_80B46BB0, func_80B46BC0, func_80B46C08, func_80B46C34, func_80B46C50, func_80B46C50, func_80B46C7C, - func_80B46C50, func_80B46C50, func_80B46C50, func_80B46C94, func_80B46CC0, func_80B46CF4, func_80B46D28, -}; - -static s16 D_80B4ED20[] = { - 130, 125, 115, 100, 80, 78, 76, 74, -}; - -static Vec3f D_80B4ED30[] = { - { 0.01f, 0.01f, 0.01f }, { 0.02f, 0.01f, 0.005f }, { -0.01f, 0.0f, 0.0f }, - { 0.01f, 0.01f, 0.01f }, { 0.005f, 0.01f, 0.02f }, -}; - -static Vec3f D_80B4ED6C[] = { - { 0.0005f, 0.0279999990016f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { -0.01f, 0.0f, 0.0f }, - { 0.016f, 0.0004f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { 0.0005f, 0.0005f, 0.0005f }, - { 0.0002f, 0.0002f, 0.0002f }, -}; - -static s16 D_80B4EDC0[] = { 0xE0C0, 0xE890, 0xD508 }; - -static s16 D_80B4EDC8[] = { - -1800, - -1000, - 0, - 2000, -}; - -static Vec3f D_80B4EDD0[] = { - { -1813.0f, 374.0f, 1900.0f }, { 2198.0f, 153.0f, 3365.0f }, { -1434.0f, 262.0f, 3365.0f }, - { -393.0f, 396.0f, 1084.0f }, { 0.0f, 1500.0f, 0.0f }, -}; - -static unkstruct80B4EE0C D_80B4EE0C[] = { - { 0.08f, 0x02BC, 0xFFF6 }, - { 0.09f, 0x012C, 0xFFFB }, - { 0.05f, 0x0190, 0x0000 }, -}; - -static Vec3f D_80B4EE24 = { - 2000.0f, - 1000.0f, - 0.0f, -}; - -static Vec3f D_80B4EE30 = { - 400.0f, - 270.0f, - 0.0f, -}; - -MtxF D_80B502A0; -MtxF D_80B502E0; -EnInvadepoh* D_80B50320[8]; -u8 D_80B50340[8]; -UNK_TYPE1 D_80B50348; -unkStruct80B50350 D_80B50350[10]; -EnInvadepoh* D_80B503F0; -EnInvadepoh* D_80B503F4; -EnInvadepoh* D_80B503F8; -AnimatedMaterial* sAlienEyeBeamTexAnim; -AnimatedMaterial* sAlienEmptyTexAnim; -s16 D_80B50404[3]; -EnInvadepoh* D_80B5040C; - -void func_80B439B0(s32 arg0, s32 arg1) { - arg1 -= 0x1AAA; - if (arg1 < 0) { - arg1 = 0; - } - - if (!(arg0 & 1)) { - gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); - } else { - gSaveContext.save.unk_E88[arg0 >> 1] = - (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); - } -} - -s32 func_80B43A24(s32 arg0) { - u32 phi_v1; - - if ((arg0 & 1) == 0) { - phi_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; - } else { - phi_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; - } - return phi_v1 + 0x1AAA; -} - -void func_80B43A74(s32 arg0) { - gSaveContext.save.unk_E88[4] = (gSaveContext.save.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); -} - -s32 func_80B43A9C(void) { - return (gSaveContext.save.unk_E88[4] >> 0) & 0xFF; -} - -s32 func_80B43AB0(void) { - s32 retVal = func_80B43A9C(); - - if (retVal < 0xC) { - retVal++; - func_80B43A74(retVal); - } - return retVal; -} - -void func_80B43AF0(s32 arg0) { - s32 currentTime = gSaveContext.save.time; - - if (((CURRENT_DAY == 1) && (currentTime >= CLOCK_TIME(2, 30))) && (currentTime < CLOCK_TIME(5, 15))) { - s32 adjustment = (0xC - func_80B43A9C()) * 25.0f; - - func_80B439B0(arg0, currentTime + adjustment); - } -} - -s32 func_80B43B80(EnInvadepoh* this) { - s32 i; - s32 temp = this->endPoint - 1; - - for (i = 0; i < temp; i++) { - if (this->unk37C[i] > this->clockTime) { - break; - } - } - - return i; -} - -void func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { - s32 temp_s5 = this->endPoint; - f32 pathTotalDistInv = 1.0f / this->pathTotalDist; - Vec3s* phi_s0 = &this->pathPoints[1]; - Vec3s* phi_s1 = &this->pathPoints[0]; - f32 new_var; - Vec3f sp70; - s32 phi_s2; - f32 temp_f0; - f32 temp_f12; - f32 temp_f14; - f32 temp_f6; - f32 phi_f20 = 0.0f; - f32 phi_f24 = 0.0f; - - for (phi_s2 = 0; phi_s2 < temp_s5; phi_s2++) { - sp70.x = phi_s0->x - phi_s1->x; - sp70.y = phi_s0->y - phi_s1->y; - sp70.z = phi_s0->z - phi_s1->z; - new_var = Math3D_Vec3fMagnitude(&sp70); - temp_f14 = phi_f20 + new_var; - temp_f12 = temp_f14 * pathTotalDistInv; - - if (this->clockTime <= temp_f12) { - temp_f6 = temp_f12 - phi_f24; - *arg1 = phi_s2; - temp_f0 = (this->clockTime - phi_f24) / temp_f6; - arg2->x = (temp_f0 * sp70.x) + phi_s1->x; - arg2->y = (temp_f0 * sp70.y) + phi_s1->y; - arg2->z = (temp_f0 * sp70.z) + phi_s1->z; - return; - } - - phi_s1 = phi_s0; - phi_s0++; - phi_f20 = temp_f14; - phi_f24 = temp_f12; - } - - *arg1 = temp_s5; - arg2->x = this->pathPoints[temp_s5].x; - arg2->y = this->pathPoints[temp_s5].y; - arg2->z = this->pathPoints[temp_s5].z; -} - -void func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp30; - Vec3f sp24; - - if (this->pathIndex != this->endPoint) { - Math_Vec3s_ToVec3f(&sp30, &arr[0]); - Math_Vec3s_ToVec3f(&sp24, &arr[1]); - Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); - } -} - -void func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp38; - Vec3f sp2C; - - if (this->pathIndex != this->endPoint) { - Math_Vec3s_ToVec3f(&sp38, &arr[0]); - Math_Vec3s_ToVec3f(&sp2C, &arr[1]); - Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp38, &sp2C), arg1, arg2, arg3); - } -} - -void func_80B43F0C(EnInvadepoh* this) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp28; - Vec3f sp1C; - - Math_Vec3s_ToVec3f(&sp28, &arr[0]); - Math_Vec3s_ToVec3f(&sp1C, &arr[1]); - this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp28, &sp1C); -} - -f32 EnInvadepoh_GetTotalPathLength(EnInvadepoh* this) { - f32 distance; - s32 pad; - Vec3f sp54; - Vec3f pathPointF; - Vec3s* pathPoint; - f32 totalDistance; - s32 i; - s32 temp_s4; - - temp_s4 = this->endPoint + 1; - pathPoint = this->pathPoints; - totalDistance = 0.0f; - Math_Vec3s_ToVec3f(&pathPointF, pathPoint); - pathPoint++; - for (i = 1; i < temp_s4; i++) { - Math_Vec3f_Copy(&sp54, &pathPointF); - Math_Vec3s_ToVec3f(&pathPointF, pathPoint); - distance = Math3D_Distance(&sp54, &pathPointF); - pathPoint++; - totalDistance += distance; - } - - return totalDistance; -} - -void func_80B44024(EnInvadepoh* this, PlayState* play) { - Path* path = &play->setupPathList[(this->actor.params >> 8) & 0x7F]; - - this->endPoint = path->count - 1; - this->pathPoints = Lib_SegmentedToVirtual(path->points); -} - -void EnInvadepoh_SetPathPointToWorldPos(EnInvadepoh* this, s32 pathIndex) { - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[pathIndex]); -} - -s32 func_80B440B8(EnInvadepoh* this, f32 arg1, f32 arg2) { - Vec3s* temp_a3 = &this->pathPoints[this->pathIndex + 1]; - Vec3s* sp48 = &this->pathPoints[this->pathIndex]; - f32 new_var; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 temp_f12_2; - s32 pad1; - s32 pad2; - s16 sp1E; - - if (this->pathIndex >= this->endPoint) { - return false; - } - - sp40 = temp_a3->x - sp48->x; - sp3C = temp_a3->z - sp48->z; - sp1E = Math_Atan2S_XY(sp3C, sp40); - sp38 = Math_CosS(sp1E); - sp34 = Math_SinS(sp1E); - sp30 = this->actor.world.pos.x - sp48->x; - sp2C = this->actor.world.pos.z - sp48->z; - - if ((arg1 - arg2) < fabsf((sp30 * sp38) - (sp2C * sp34))) { - return false; - } - - temp_f12_2 = (sp2C * sp38) + (sp30 * sp34); - new_var = Math3D_XZLength(sp40, sp3C); - - if ((temp_f12_2 < 0.0f) || (new_var < temp_f12_2)) { - return false; - } - - return true; -} - -s32 func_80B44234(EnInvadepoh* this, Vec3f* vec) { - f32 distance; - s8 temp_s3 = this->endPoint; - f32 min = FLT_MAX; - Vec3f sp48; - s32 i; - s32 ret = 0; - Vec3s* arr; - - for (i = 0, arr = this->pathPoints; i < temp_s3; i++, arr++) { - Math_Vec3s_ToVec3f(&sp48, arr); - distance = Math3D_Vec3fDistSq(&sp48, vec); - if (distance < min) { - min = distance; - ret = i; - } - } - - return ret; -} - -void func_80B442E4(EnInvadepoh* this) { - s32 temp_v1_2 = ((void)0, (s32)gSaveContext.save.time) - func_80B43A24(this->actor.params & 7); - - if (D_80B4E940 == 1) { - this->clockTime = 0.0f; - } else if (D_80B4E940 == 2) { - if (temp_v1_2 < 0) { - this->clockTime = 0.0f; - } else { - this->clockTime = temp_v1_2 * 0.00027777779f; - if (this->clockTime > 1.0f) { - this->clockTime = 1.0f; - } - } - } - - this->pathIndex = func_80B43B80(this); -} - -void func_80B443A0(EnInvadepoh* this) { - f32 pathTotalDistInv; - s8 temp_s5; - Vec3s* phi_s1; - Vec3f sp70; - Vec3f sp64; - f32* phi_s0; - f32 phi_f20; - s32 i; - - temp_s5 = this->endPoint; - pathTotalDistInv = 1.0f / this->pathTotalDist; - phi_f20 = 0.0f; - phi_s1 = this->pathPoints; - Math_Vec3s_ToVec3f(&sp64, phi_s1); - phi_s1++; - phi_s0 = this->unk37C; - - for (i = 1; i < temp_s5; i++, phi_s1++, phi_s0++) { - Math_Vec3f_Copy(&sp70, &sp64); - Math_Vec3s_ToVec3f(&sp64, phi_s1); - phi_f20 += Math3D_Distance(&sp70, &sp64); - *phi_s0 = phi_f20 * pathTotalDistInv; - if (*phi_s0 < 0.0f) { - *phi_s0 = 0.0f; - } else if (*phi_s0 > 1.0f) { - *phi_s0 = 1.0f; - } - } -} - -void func_80B444BC(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); - func_80B443A0(this); -} - -void func_80B444F4(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44514(EnInvadepoh* this) { - this->pathIndex++; - if (this->pathIndex >= this->endPoint) { - this->pathIndex = 0; - } -} - -void func_80B44540(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44570(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.time; - - if ((currentTime < CLOCK_TIME(2, 0)) || (currentTime >= CLOCK_TIME(6, 0))) { - this->clockTime = 0.0f; - } else if ((currentTime >= CLOCK_TIME(2, 15)) && (currentTime < CLOCK_TIME(6, 0))) { - this->clockTime = 1.0f; - } else { - f32 new_var = (currentTime - 0x1555) * 0.0014641288f; - - this->clockTime = new_var; - this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); - } -} - -void func_80B44620(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44640(EnInvadepoh* this) { - if (this->pathIndex < this->endPoint) { - this->pathIndex++; - } -} - -void func_80B44664(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->direction = DIRECTION_FORWARD; -} - -void func_80B44690(EnInvadepoh* this) { - this->pathIndex += this->direction; - if (this->pathIndex >= this->endPoint) { - this->pathIndex = 0; - } else if (this->pathIndex < 0) { - this->pathIndex = this->endPoint - 1; - } -} - -void func_80B446D0(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44700(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.time; - s32 new_var4 = 0xFFFF2AAB; - - if ((currentTime < CLOCK_TIME(20, 0)) && (currentTime >= CLOCK_TIME(6, 0))) { - this->clockTime = 0.0f; - } else if ((currentTime > 0xD7E0) || (currentTime < CLOCK_TIME(6, 0))) { - this->clockTime = 1.0f; - } else { - f32 new_var = 0.00153374229558f; - - this->clockTime = (currentTime + new_var4) * new_var; - this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); - } -} - -void func_80B447C0(EnInvadepoh* this, PlayState* play) { - s32 pad1; - Vec3s* sp60; - s32 pad2; - Vec3f sp50; - Vec3f sp44; - f32 sp40 = this->actor.world.pos.y; - f32 sp3C; - s32 pad3; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 phi_f2; - - sp60 = &this->pathPoints[this->pathIndex]; - if (this->pathIndex <= 0) { - sp3C = 0.0f; - } else { - sp3C = this->unk37C[this->pathIndex - 1]; - } - - if (this->pathIndex < (this->endPoint - 1)) { - phi_f2 = this->unk37C[this->pathIndex]; - } else { - phi_f2 = 1.0f; - } - - if ((phi_f2 - sp3C) < 0.001f) { - Math_Vec3s_ToVec3f(&this->curPathPos, sp60); - } else { - sp34 = this->clockTime - sp3C; - sp30 = phi_f2 - this->clockTime; - sp2C = 1.0f / (phi_f2 - sp3C); - Math_Vec3s_ToVec3f(&sp50, &sp60[0]); - Math_Vec3s_ToVec3f(&sp44, &sp60[1]); - this->curPathPos.x = ((sp50.x * sp30) + (sp44.x * sp34)) * sp2C; - this->curPathPos.y = ((sp50.y * sp30) + (sp44.y * sp34)) * sp2C; - this->curPathPos.z = ((sp50.z * sp30) + (sp44.z * sp34)) * sp2C; - } - - Math_Vec3f_Copy(&this->actor.world.pos, &this->curPathPos); - func_800B4AEC(play, &this->actor, 0.0f); - if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { - if (sp40 < this->actor.floorHeight) { - if (this->actor.velocity.y < 0.0f) { - this->actor.velocity.y = 0.0f; - } else { - this->actor.velocity.y += 2.0f; - this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 30.0f); - } - this->actor.world.pos.y = this->actor.velocity.y + sp40; - if (this->actor.world.pos.y > this->actor.floorHeight) { - this->actor.world.pos.y = this->actor.floorHeight; - } - } else { - if (this->actor.velocity.y > 0.0f) { - this->actor.velocity.y = 0.0f; - } else { - this->actor.velocity.y -= 2.0f; - } - - this->actor.world.pos.y = this->actor.velocity.y + sp40; - if (this->actor.world.pos.y < this->actor.floorHeight) { - this->actor.world.pos.y = this->actor.floorHeight; - this->actor.velocity.y = CLAMP_MIN(this->actor.velocity.y, -30.0f); - } - } - } else { - this->actor.world.pos.y = sp40; - } -} - -void func_80B44A90(EnInvadepoh* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { - this->actor.velocity.y *= 0.3f; - this->actor.speedXZ *= 0.8f; - } else if (this->actor.bgCheckFlags & 8) { - this->actor.velocity.y *= 0.8f; - this->actor.speedXZ *= 0.3f; - } else { - this->actor.velocity.y *= 0.8f; - this->actor.speedXZ *= 0.8f; - } - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); -} - -void func_80B44B78(EnInvadepoh* this) { -} - -s32 func_80B44B84(EnInvadepoh* this, PlayState* play, f32 speed, f32 arg3) { - s32 pad; - Vec3s* pathPoint = &this->pathPoints[this->pathIndex + 1]; - s32 retVal = func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, pathPoint->x, pathPoint->z, speed); - - func_800B4AEC(play, &this->actor, arg3); - func_80B4516C(this); - return retVal; -} - -void func_80B44C24(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 worldPosY = this->actor.world.pos.y; - - func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); - this->actor.world.pos.y = worldPosY; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -s32 func_80B44C80(EnInvadepoh* this, PlayState* play) { - s32 pad[6]; - Vec3s* temp_a2 = &this->pathPoints[this->pathIndex]; - f32 temp_f0; - Vec3f sp6C; - Vec3f sp60; - f32 temp_f0_2; - Vec3s* temp_v0_2; - f32 temp_f0_3; - f32 temp_f12; - f32 temp_f2; - f32 temp_f14; - f32 sp44; - s32 sp40 = 0; - s32 temp_v1 = this->pathIndex + this->direction; - s32 phi_v0; - - if (temp_v1 >= this->endPoint) { - temp_v1 = 0; - } else if (temp_v1 < 0) { - temp_v1 = this->endPoint - 1; - } - - temp_v0_2 = &this->pathPoints[temp_v1]; - - temp_f0 = temp_a2->x; - temp_f2 = temp_a2->z; - temp_f12 = temp_v0_2->x; - temp_f14 = temp_v0_2->z; - sp6C.x = temp_f12 - temp_f0; - sp6C.y = 0.0f; - sp6C.z = temp_f14 - temp_f2; - sp60.x = temp_f12 - this->actor.world.pos.x; - sp60.y = 0.0f; - sp60.z = temp_f14 - this->actor.world.pos.z; - temp_f0_3 = temp_f0 - this->actor.world.pos.x; - temp_f0_2 = temp_f2 - this->actor.world.pos.z; - - if (this->actor.speedXZ > 0.0f) { - if (Math3D_AngleBetweenVectors(&sp6C, &sp60, &sp44) != 0) { - sp40 = 1; - } else if (sp44 <= 0.0f) { - sp40 = 1; - } - } - - Math_SmoothStepToS(&this->actor.world.rot.y, - Math_Atan2S_XY(((sp60.z + temp_f0_2) * 0.9f) + sp6C.z, ((sp60.x + temp_f0_3) * 0.9f) + sp6C.x), - 4, 0xFA0, 0x64); - Actor_MoveWithGravity(&this->actor); - if (func_80B440B8(this, 50.0f, 15.0f)) { - phi_v0 = 4; - } else { - phi_v0 = 5; - } - - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, phi_v0); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); - return sp40; -} - -void func_80B44E90(EnInvadepoh* this, PlayState* play) { - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, 5); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); -} - -void func_80B44EFC(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 worldPosY = this->actor.world.pos.y; - - func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); - this->actor.world.pos.y = worldPosY; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -void func_80B44F58(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E968) { - D_80B4E968 = true; - for (i = 0, iter = sRomaniEyeTextures; i < ARRAY_COUNT(sRomaniEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sRomaniMouthTextures; i < ARRAY_COUNT(sRomaniMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B44FEC(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E994) { - D_80B4E994 = true; - for (i = 0, iter = sCremiaEyeTextures; i < ARRAY_COUNT(sCremiaEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sCremiaMouthTextures; i < ARRAY_COUNT(sCremiaMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B45080(void) { - sAlienEmptyTexAnim = Lib_SegmentedToVirtual(gAlienEmptyTexAnim); - sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); -} - -s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed) { - f32 deltaX = x2 - *x1; - f32 deltaZ = z2 - *z1; - f32 temp_f0 = Math3D_XZLength(deltaX, deltaZ); - - if (speed < temp_f0) { - f32 temp_f2 = speed / temp_f0; - *x1 += (temp_f2 * deltaX); - *z1 += (temp_f2 * deltaZ); - return false; - } else { - *x1 = x2; - *z1 = z2; - return true; - } -} - -s32 func_80B4516C(EnInvadepoh* this) { - if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { - this->actor.world.pos.y = this->actor.floorHeight; - return true; - } - return false; -} - -void func_80B451A0(EnInvadepoh* this, PlayState* play) { - s32 currentTime; - s32 temp_v0_2; - s32 i; - s32 phi_s1_3; - - if (D_80B4E940 == 0) { - if (CURRENT_DAY <= 0) { - D_80B4E940 = 1; - } else if (CURRENT_DAY == 1) { - currentTime = gSaveContext.save.time; - if ((currentTime < CLOCK_TIME(2, 30)) || (currentTime >= CLOCK_TIME(6, 0))) { - D_80B4E940 = 1; - } else if (currentTime < CLOCK_TIME(5, 15)) { - phi_s1_3 = CLOCK_TIME(5, 15); - for (i = 0; i < this->unk379; i++) { - temp_v0_2 = func_80B43A24(i); - if (temp_v0_2 < phi_s1_3) { - phi_s1_3 = temp_v0_2; - } - } - - if (currentTime < (phi_s1_3 + 0xE11)) { - D_80B4E940 = 2; - } - - if (i) {} // required - } - } - - if (D_80B4E940 == 0) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - D_80B4E940 = 3; - } else { - D_80B4E940 = 4; - } - } - } -} - -void func_80B452EC(EnInvadepoh* this, PlayState* play) { - s32 phi_s2 = (this->actor.params >> 8) & 0x7F; - s32 i; - - for (i = 0; i < this->unk379; i++) { - D_80B50320[i] = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - (i & 7) | ((phi_s2 << 8) & 0x7F00) | 0x10); - if (phi_s2 != 0xFF) { - Path* path = &play->setupPathList[phi_s2]; - phi_s2 = path->unk1; - } - } -} - -void func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); -} - -void func_80B45460(EnInvadepoh* this, PlayState* play) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x40); -} - -void func_80B454BC(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x60); -} - -void EnInvadepoh_SetSysMatrix(Vec3f* vec) { - MtxF* sysMatrix = Matrix_GetCurrent(); - - sysMatrix->xw = vec->x; - sysMatrix->yw = vec->y; - sysMatrix->zw = vec->z; -} - -s32 func_80B45550(EnInvadepoh* this, PlayState* play, f32 range, s32 arg3) { - s32 pad; - Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_DOOR].first; - s32 retVal = false; - - while (actorIterator != NULL) { - if ((actorIterator->id == ACTOR_EN_DOOR) && (actorIterator->update != NULL) && - (actorIterator->room == this->actor.room) && - Math3D_Vec3fDistSq(&actorIterator->world.pos, &this->actor.world.pos) < range) { - ((EnDoor*)actorIterator)->unk_1A7 = arg3; - retVal = true; - break; - } - actorIterator = actorIterator->next; - } - return retVal; -} - -void EnInvadepoh_SetTextID(EnInvadepoh* this, PlayState* play, u16 arg2) { - this->textId = arg2; - Message_StartTextbox(play, arg2, &this->actor); -} - -void func_80B45648(EnInvadepoh* this) { - s32 i; - s16 cs = this->actor.cutscene; - - for (i = 0; i < 3; i++) { - D_80B50404[i] = cs; - cs = ActorCutscene_GetAdditionalCutscene(cs); - } -} - -s32 func_80B456A8(PlayState* play, Vec3f* worldPos) { - Vec3f projectedPos; - f32 invW; - - Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); - if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { - s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); - s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); - s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; - s32 zBuf = func_80178A94(screenPosX, screenPosY); - if (wZ < zBuf) { - return true; - } - } - - return false; -} - -void func_80B457A0(EnInvadepoh* this) { - f32 distanceSquared; - f32 phi_f20 = FLT_MAX; - s32 i; - s32 phi_s5 = -1; - - for (i = 0; i < this->unk379; i++) { - if ((D_80B50320[i] != NULL) && D_80B50320[i]->drawAlien) { - distanceSquared = Math3D_Vec3fDistSq(&D_80B50320[i]->actor.world.pos, &this->actor.world.pos); - if (distanceSquared < phi_f20) { - phi_f20 = distanceSquared; - phi_s5 = i; - } - } - D_80B50340[i] &= ~2; - } - - D_80B50348 = 0; - if (phi_f20 <= SQ(2000.0f)) { - D_80B50340[phi_s5] |= 2; - if (phi_f20 <= SQ(340.0f)) { - D_80B50348 = 1; - } - } -} - -EnInvadepoh* func_80B458D8(void) { - s32 i; - - for (i = 0; i < 8; i++) { - if (D_80B50340[i] & 2) { - return D_80B50320[i]; - } - } - - return NULL; -} - -s8 func_80B45980(unkstructInvadepoh1* arg0, s32 arg1) { - f32 rand = Rand_ZeroOne(); - s32 i; - unkstructInvadepoh1* ptr = arg0; - - arg1--; - for (i = 0; i < arg1; i++, ptr++) { - if (ptr->unk04 >= rand) { - break; - } - } - - return (arg0 + i)->unk00; -} - -void func_80B459E8(EnInvadePohStruct* s, unkstructInvadepoh4* u) { - s->unk4 = u->unk00; - s->unk8 = u; - s->unkE = 0; - s->unkF = *u->unk04->unk00; - if (s->unk4 == 2) { - s->unkC = Rand_S16Offset(u->unk10, u->unk12); - } -} - -void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh4* new_var = s->unk8; - unkstructInvadepoh0* temp_v1 = new_var->unk04; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } -} - -void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh0* temp_v1 = s->unk8->unk04; - unkstructInvadepoh1* temp_a0; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } else { - func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); - } -} - -void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh0* temp_v1 = s->unk8->unk04; - unkstructInvadepoh1* temp_a0; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } else if (s->unkC > 0) { - s->unkC--; - } else { - func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); - } -} - -void func_80B45BB8(EnInvadePohStruct* s) { - if ((s->unk0 != 0) && (s->unk8 != 0)) { - D_80B4EC0C[s->unk4](s, (unkstructInvadepoh4**)s->unk0); - } -} - -void func_80B45C04(AlienBehaviorInfo* substruct, void* arg1[], s32 arg2, void* arg3[], s32 arg4, Vec3s* arg5, s16 arg6, - f32 arg7, f32 arg8, f32 arg9) { - unkstructInvadepoh4* temp_v0; - - Math_Vec3s_Copy(&substruct->unk26, arg5); - substruct->unk2C = arg6; - substruct->unk30 = arg7; - substruct->unk38 = arg8; - substruct->unk3C = arg9; - if (arg1 != NULL) { - temp_v0 = arg1[arg2]; - substruct->unk0.unk0 = (unkstructInvadepoh4*)arg1; - substruct->unk0.unk4 = temp_v0->unk00; - substruct->unk0.unkC = 0; - substruct->unk0.unkE = 0; - substruct->unk0.unk8 = temp_v0; - substruct->unk0.unkF = *temp_v0->unk04->unk00; - } - if (arg3 != NULL) { - temp_v0 = arg3[arg4]; - substruct->unk10.unk0 = (unkstructInvadepoh4*)arg3; - substruct->unk10.unk4 = temp_v0->unk00; - substruct->unk10.unkC = 0; - substruct->unk10.unkE = 0; - substruct->unk10.unk8 = temp_v0; - substruct->unk10.unkF = *temp_v0->unk04->unk00; - } -} - -void func_80B45CE0(AlienBehaviorInfo* substruct) { - Vec3f sp3C; - Vec3s sp34; - s16 step; - - sp34.x = substruct->unk26.x - substruct->unk20.x; - sp34.y = substruct->unk26.y - substruct->unk20.y; - sp34.z = substruct->unk26.z - substruct->unk20.z; - Math_Vec3s_ToVec3f(&sp3C, &sp34); - Math_Vec3f_Scale(&sp3C, substruct->unk30); - Math_Vec3f_ToVec3s(&sp34, &sp3C); - sp34.x = ABS(sp34.x); - sp34.y = ABS(sp34.y); - sp34.z = ABS(sp34.z); - sp34.x = CLAMP_MAX(sp34.x, substruct->unk2C); - sp34.y = CLAMP_MAX(sp34.y, substruct->unk2C); - sp34.z = CLAMP_MAX(sp34.z, substruct->unk2C); - Math_ScaledStepToS(&substruct->unk20.x, substruct->unk26.x, sp34.x); - Math_ScaledStepToS(&substruct->unk20.y, substruct->unk26.y, sp34.y); - Math_ScaledStepToS(&substruct->unk20.z, substruct->unk26.z, sp34.z); - Math_StepToF(&substruct->unk34, substruct->unk38, substruct->unk3C); - - if (substruct->unk40 != substruct->unk42) { - step = substruct->unk42 - substruct->unk40; - step *= substruct->unk44; - step = ABS(step); - step = CLAMP(step, 100, substruct->unk48); - Math_ScaledStepToS(&substruct->unk40, substruct->unk42, step); - } - func_80B45BB8(&substruct->unk0); - func_80B45BB8(&substruct->unk10); -} - -void func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { - s16 phi_s0 = 0; - Vec3f spA8; - Vec3f sp9C; - Vec3f sp90; - f32 temp_f20; - s32 i; - - for (i = 0; i < arg2; i++) { - phi_s0 += (s16)(65536.0f / arg2); - - temp_f20 = (Rand_ZeroOne() * 0.5f) + 0.5f; - spA8.x = Math_SinS(phi_s0) * temp_f20; - spA8.z = Math_CosS(phi_s0) * temp_f20; - - sp9C.x = ((Rand_ZeroOne() * 16.0f) + (spA8.x * 30.0f)) - 8.0f; - sp9C.y = -8.0f; - sp9C.z = ((Rand_ZeroOne() * 16.0f) + (spA8.z * 30.0f)) - 8.0f; - - sp90.x = sp9C.x * -0.025f; - sp90.y = sp9C.y * -0.025f; - sp90.z = sp9C.z * -0.025f; - - spA8.x = (spA8.x * 100.0f) + this->actor.world.pos.x; - spA8.y = ((Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y) - 90.0f; - spA8.z = (spA8.z * 100.0f) + this->actor.world.pos.z; - - EffectSsKirakira_SpawnDispersed(play, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); - } -} - -s32 func_80B46118(Vec3f* actorPos) { - unkStruct80B50350* phi_v1; - s32 i; - - for (phi_v1 = D_80B50350, i = 0; i < 10; phi_v1++, i++) { - if (phi_v1->unk1 <= 0) { - phi_v1->unk0 = 0; - phi_v1->unk1 = 40; - Math_Vec3f_Copy(&phi_v1->unk4, actorPos); - phi_v1->unk2 = 0; - return true; - } - } - return false; -} - -void func_80B46184(unkStruct80B50350* unkStruct) { - if (unkStruct->unk1 > 20) { - if (unkStruct->unk2 < 125) { - unkStruct->unk2 += 10; - } else { - unkStruct->unk2 = 135; - } - } else if (unkStruct->unk2 > 13) { - unkStruct->unk2 -= 13; - - } else { - unkStruct->unk2 = 0; - } -} - -s32 func_80B461DC(void) { - s32 phi_s4 = false; - unkStruct80B50350* phi_s0; - s32 i; - - for (phi_s0 = D_80B50350, i = 0; i < 10; phi_s0++, i++) { - if (phi_s0->unk1 > 0) { - D_80B4EC20[phi_s0->unk0](phi_s0); - phi_s0->unk1--; - phi_s4 = true; - } - } - return phi_s4; -} - -void func_80B4627C(EnInvadepoh* this, PlayState* play) { - s32 invadepohType; - s32 i; - - this->actor.flags |= ACTOR_FLAG_20; - invadepohType = (this->actor.params >> 8) & 0x7F; - - for (i = 1; i < 8; i++) { - Path* path = &play->setupPathList[invadepohType]; - invadepohType = path->unk1; - if (invadepohType == 0xFF) { - break; - } - } - - this->unk379 = i; - func_80B451A0(this, play); - func_80B45648(this); - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_SWITCH); - - if (D_80B4E940 == 1) { - func_80B46DA8(this); - } else if (D_80B4E940 == 2) { - if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { - func_80B46DA8(this); - } else { - func_80B454BC(this, play); - func_80B452EC(this, play); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); - func_80B46F88(this); - } - } else if (D_80B4E940 == 3) { - if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { - func_80B471C0(this); - - } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { - func_80B47248(this); - } else { - func_80B47248(this); - } - } else if (D_80B4E940 == 4) { - func_80B47304(this); - } -} - -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, D_80B4EC24); - Collider_InitCylinder(play, &this->collider); - ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); - this->actor.shape.shadowAlpha = 140; - this->actor.flags = (ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000); - if (INVADEPOH_TYPE(&this->actor) == TYPE_ALIEN_CARRYING_COW) { - this->actor.update = func_80B4D670; - this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; - } else { - this->actor.update = func_80B47BAC; - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitAlien); - this->actor.colChkInfo.mass = 40; - } - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_UCH); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainParentCow); - this->actor.update = func_80B47FA8; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainChildCow); - this->actor.update = func_80B481C4; - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 temp = INVADEPOH_TYPE(&this->actor); - - Actor_ProcessInitChain(&this->actor, sInitChainRomani); - - this->actor.targetMode = (temp == 7 || temp == 0xC) ? 3 : 6; - - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - if (temp != 4) { - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - } - if (temp == 4) { - this->actor.update = func_80B48620; - } else if (temp == 5) { - this->actor.update = func_80B48FB0; - this->actor.flags = (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10); - } else if (temp == 7) { - this->actor.update = func_80B49F88; - } else if (temp == 8) { - this->actor.update = func_80B4A9C8; - } else if (temp == 9) { - this->actor.update = func_80B4B0C4; - } else { - this->actor.update = func_80B4CE54; - } - - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA1); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } - - if (temp == 5) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp == 7) { - if (gSaveContext.save.time < CLOCK_TIME(6, 0) && gSaveContext.save.time >= CLOCK_TIME(2, 15)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp != 8) { - if (temp == 9) { - if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp == 0xC) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - } - D_80B503F4 = this; - } - } -} - -void func_80B468B4(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, D_80B4EC68); - this->actor.update = func_80B49B1C; - this->actor.draw = func_80B4E3F0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { - this->actor.world.pos.x += D_80B4E934.x; - this->actor.world.pos.y += D_80B4E934.y + 3000.0f; - this->actor.world.pos.z += D_80B4E934.z; - func_80B491EC(this); - } else if (D_80B4E940 == 2) { - this->actor.world.pos.y += 1500.0f; - func_80B49628(this); - } else { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainDog); - this->actor.update = func_80B4B8BC; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDog); - this->actor.colChkInfo.mass = 80; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DOG); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainCremia); - this->actor.update = func_80B4C3A0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); - this->actor.colChkInfo.mass = MASS_HEAVY; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA2); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - } - D_80B503F8 = this; -} - -void EnInvadepoh_Init(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECB0[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46BB0(EnInvadepoh* this, PlayState* play) { -} - -void func_80B46BC0(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 invadepohType = this->actor.params & 7; - - Collider_DestroyCylinder(play, &this->collider); - D_80B50320[invadepohType] = 0; -} - -void func_80B46C08(EnInvadepoh* this, PlayState* play) { - if (this->actor.parent != NULL) { - this->actor.parent->child = NULL; - } - - if (this->actor.child != NULL) { - this->actor.child->parent = NULL; - } -} - -void func_80B46C34(EnInvadepoh* this, PlayState* play) { - if (this->actor.parent != NULL) { - this->actor.parent->child = NULL; - } -} - -void func_80B46C50(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46C7C(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = NULL; -} - -void func_80B46C94(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46CC0(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F8 = NULL; -} - -void func_80B46CF4(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F4 = NULL; -} - -void func_80B46D28(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - if (!this) {} // required to match - if (this->actor.child != NULL) { - this->actor.child->parent = NULL; - } -} - -void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECE8[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46DA8(EnInvadepoh* this) { - D_80B4E940 = 1; - this->actionFunc = func_80B46DC8; -} - -void func_80B46DC8(EnInvadepoh* this, PlayState* play) { - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { - func_80B454BC(this, play); - func_80B452EC(this, play); - func_80B46E20(this); - } -} - -void func_80B46E20(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionTimer = 2; - this->actionFunc = func_80B46E44; -} - -void func_80B46E44(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer > 0) { - this->actionTimer--; - } else if (ActorCutscene_GetCanPlayNext(D_80B50404[0])) { - ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[0], &this->actor); - func_80B46EC0(this); - } else { - ActorCutscene_SetIntentToPlay(D_80B50404[0]); - } -} - -void func_80B46EC0(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionTimer = 160; - this->actionFunc = func_80B46EE8; -} - -void func_80B46EE8(EnInvadepoh* this, PlayState* play) { - s32 i; - - for (i = 0; i < 8; i++) { - if (this->actionTimer == D_80B4ED20[i]) { - D_80B50340[i] |= 1; - } - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - ActorCutscene_Stop(D_80B50404[0]); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); - func_80B46F88(this); - } -} - -void func_80B46F88(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionFunc = func_80B46FA8; -} - -void func_80B46FA8(EnInvadepoh* this, PlayState* play) { - s32 i; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - SET_WEEKEVENTREG(WEEKEVENTREG_22_01); - func_80B47064(this); - } else { - func_80B457A0(this); - for (i = 0; i < this->unk379; i++) { - if ((D_80B50320[i] != NULL) && (D_80B50320[i]->unk38A != 0)) { - func_80B47278(this); - break; - } - } - } -} - -void func_80B47064(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B47084; -} - -void func_80B47084(EnInvadepoh* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(D_80B50404[1])) { - ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[1], &this->actor); - func_80B470E0(this); - } else { - ActorCutscene_SetIntentToPlay(D_80B50404[1]); - } -} - -void func_80B470E0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionTimer = 110; - this->actionFunc = func_80B47108; -} - -void func_80B47108(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 100) { - Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); - } - this->actionTimer--; - if (this->actionTimer <= 0) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_73; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - D_801BDAA0 = 1; - D_801BDA9C = 0; - func_80B47248(this); - } -} - -void func_80B471C0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B471E0; -} - -void func_80B471E0(EnInvadepoh* this, PlayState* play) { - if (D_80B4E998) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - func_80B47248(this); - } -} - -void func_80B47248(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B47268; -} - -void func_80B47268(EnInvadepoh* this, PlayState* play) { -} - -void func_80B47278(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47298; -} - -void func_80B47298(EnInvadepoh* this, PlayState* play) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); - gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - SET_WEEKEVENTREG(WEEKEVENTREG_89_10); - func_80B47304(this); -} - -void func_80B47304(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47324; -} - -void func_80B47324(EnInvadepoh* this, PlayState* play) { -} - -void EnInvadepoh_Update(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (func_80B461DC()) { - this->actor.draw = func_80B4D9B4; - } else { - this->actor.draw = NULL; - } -} - -void func_80B47380(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - this->alienAlpha = 0; - this->actor.draw = NULL; - this->drawAlien = false; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionFunc = func_80B473E4; -} - -void func_80B473E4(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - if (D_80B50340[this->actor.params & 7] & 1) { - Actor_SetScale(&this->actor, 0.01f); - func_80B4516C(this); - func_80B46118(&this->actor.world.pos); - func_80B47568(this); - } -} - -void func_80B47478(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - this->alienAlpha = 0; - this->actor.draw = NULL; - this->drawAlien = false; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionFunc = func_80B474DC; -} - -void func_80B474DC(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - if (this->clockTime > 0.0f) { - Actor_SetScale(&this->actor, 0.01f); - func_80B4516C(this); - func_80B46118(&this->actor.world.pos); - func_80B47568(this); - } -} - -void func_80B47568(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->alienAlpha = 0; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B47600; -} - -void func_80B47600(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->clockTime >= 0.9999f) { - this->unk38A = 1; - } - if (this->alienAlpha > 248) { - this->alienAlpha = 255; - } else { - this->alienAlpha += 6; - } - if (this->alienAlpha > 128) { - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - } - if (this->alienAlpha == 255) { - if (this->alienBeamAlpha >= 245) { - this->alienBeamAlpha = 255; - func_80B4770C(this); - } else { - this->alienBeamAlpha += 10; - } - } -} - -void func_80B4770C(EnInvadepoh* this) { - if (this->skelAnime.animation != &gAlienFloatAnim) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - } - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B477B4; -} - -void func_80B477B4(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->clockTime >= 0.9999f) { - this->unk38A = 1; - } -} - -void func_80B47830(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionTimer = 8; - this->counter = 0; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B478F4; -} - -void func_80B478F4(EnInvadepoh* this, PlayState* play) { - func_80B44A90(this, play); - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B47938(this); - } -} - -void func_80B47938(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); - this->actor.flags &= ~ACTOR_FLAG_1; - this->actionTimer = 10; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B479E8; -} - -void func_80B479E8(EnInvadepoh* this, PlayState* play) { - s16 unk2F2; - u32 index; - - func_80B44B78(this); - if (this->counter < 5) { - if (D_80B4ED30[this->counter].x > 0.0f) { - this->drawAlien = true; - this->alienBeamAlpha = 255; - Math_Vec3f_Copy(&this->actor.scale, &D_80B4ED30[this->counter]); - } else { - this->drawAlien = false; - this->alienBeamAlpha = 0; - } - } else { - this->drawAlien = false; - this->alienBeamAlpha = 0; - } - - unk2F2 = this->counter; - if ((unk2F2 >= 2) && (unk2F2 < 9)) { - index = unk2F2 - 2; - if (D_80B4ED6C[index].x > 0.0f) { - this->drawAlienDeathEffect = true; - Math_Vec3f_Copy(&this->alienDeathEffectScale, &D_80B4ED6C[index]); - } else { - this->drawAlienDeathEffect = false; - } - } else { - this->drawAlienDeathEffect = false; - } - - this->counter++; - if (this->actionTimer == 8) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, - this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); - } - - if (this->actionTimer == 8) { - Enemy_StartFinishingBlow(play, &this->actor); - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B43AF0(this->actor.params & 7); - func_80B43AB0(); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_30); - func_80B47478(this); - } -} - -void func_80B47BAC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, - ALIEN_LIMB_MAX); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.125f; - func_80B444BC(this, play); - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { - func_80B47380(this); - } else if (D_80B4E940 == 2) { - if (this->clockTime >= 0.0001f) { - func_80B4770C(this); - } else { - func_80B47568(this); - } - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B47D30(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (D_80B4E940 == 3) { - if ((this->actionFunc == func_80B477B4) || (this->actionFunc == func_80B47600)) { - thisx->speedXZ = 0.0f; - thisx->velocity.y = 0.0f; - thisx->gravity = 0.0f; - func_80B47830(this); - } else if ((this->actionFunc == func_80B474DC) || (this->actionFunc == func_80B473E4)) { - Actor_Kill(&this->actor); - return; - } - } else if (this->collider.base.acFlags & AC_HIT) { - Actor* acAttached = this->collider.base.ac; - - thisx->speedXZ = acAttached->speedXZ * 0.5f; - thisx->speedXZ = CLAMP(thisx->speedXZ, -60.0f, 60.0f); - thisx->world.rot.y = acAttached->world.rot.y; - thisx->gravity = 0.0f; - thisx->velocity.y = acAttached->velocity.y * 0.5f; - thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); - SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); - func_80B47830(this); - } - - this->actionFunc(this, play); - if (thisx->draw != NULL) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - } - - Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.atFlags &= ~AT_HIT; - } - - if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.acFlags &= ~AC_HIT; - } - - if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.ocFlags1 &= ~OC1_HIT; - } -} - -void func_80B47FA8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, thisx); - this->actor.update = func_80B48060; - this->actor.draw = func_80B4E158; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); - } -} - -void func_80B48060(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - s32 temp; - s32 pad2; - MtxF unkMtx; - - if (D_80B503F0 == NULL || this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - - temp = this->actor.params & 7; - SkelAnime_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[temp], 0x32); - if (this->actor.child != NULL) { - Matrix_Push(); - Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - &this->actor.shape.rot); - Matrix_Translate(0, 57.0f, -36.0f, MTXMODE_APPLY); - Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); - Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); - Matrix_MultZero(&this->actor.child->world.pos); - Matrix_Get(&unkMtx); - Matrix_MtxFToYXZRot(&unkMtx, &this->actor.child->shape.rot, false); - Matrix_Pop(); - } -} - -void func_80B481C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - this->actor.update = func_80B4827C; - this->actor.draw = func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, - COW_TAIL_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); - } -} - -void func_80B4827C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B503F0 == NULL || this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - - SkelAnime_Update(&this->skelAnime); -} - -void func_80B482D4(EnInvadepoh* this) { - this->actionTimer = 40; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = NULL; - this->actionFunc = func_80B48324; -} - -void func_80B48324(EnInvadepoh* this, PlayState* play) { - this->actionTimer--; - if (this->actionTimer <= 0) { - EnInvadepoh_SetTextID(this, play, 0x332F); - this->actor.draw = func_80B4E324; - func_80B48374(this); - } -} - -void func_80B48374(EnInvadepoh* this) { - this->actionTimer = 60; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B483CC; -} - -void func_80B483CC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 20) { - f32 unkFloat = 0.1f; - - this->behaviorInfo.unk26.x = 2000; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = unkFloat; - this->behaviorInfo.unk2C = 1000; - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B4843C(this); - } -} - -void func_80B4843C(EnInvadepoh* this) { - this->behaviorInfo.unk26.x = 3000; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = 0.24f; - this->behaviorInfo.unk2C = 3000; - this->behaviorInfo.unk42 = 15000; - this->behaviorInfo.unk44 = 0.1f; - this->behaviorInfo.unk48 = 2000; - this->actionTimer = 50; - Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B484EC; -} - -void func_80B484EC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 40) { - this->behaviorInfo.unk26.y = 7000; - } else if (this->actionTimer == 30) { - this->behaviorInfo.unk26.y = -7000; - } else if (this->actionTimer == 20) { - this->behaviorInfo.unk26.y = 7000; - } else if (this->actionTimer == 10) { - this->behaviorInfo.unk26.y = 0; - } - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B48588(this); - } -} - -void func_80B48588(EnInvadepoh* this) { - this->behaviorInfo.unk26.x = 0; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = 0.24f; - this->behaviorInfo.unk2C = 5000; - this->behaviorInfo.unk42 = 0; - this->behaviorInfo.unk44 = 0.28f; - this->behaviorInfo.unk48 = 7000; - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B48610; -} - -void func_80B48610(EnInvadepoh* this, PlayState* play) { -} - -void func_80B48620(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 5000, 0.05f, 0.3f, 0.12f); - Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); - func_80B482D4(this); - } -} - -void func_80B4873C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if (this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - this->actionFunc(this, play); - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(substruct); - if (substruct->unk40 != 0) { - this->actor.shape.rot.x = -substruct->unk40; - } -} - -void func_80B487B4(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - u32 new_var; - - this->actionTimer = Rand_S16Offset(150, 250); - new_var = Rand_Next(); - substruct->unk26.x = D_80B4EDC8[new_var >> 0x1E]; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - this->actionFunc = func_80B48848; -} - -void func_80B48848(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speedXZ, 1.6f, 0.1f); - if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { - func_80B44514(this); - this->behaviorInfo.unk4C = 0xC8; - this->actor.speedXZ *= 0.25f; - } else { - Math_StepToS(&this->behaviorInfo.unk4C, 0x7D0, 0x46); - } - func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x46); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B48948(this); - } -} - -void func_80B48948(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - f32 rand = Rand_ZeroOne(); - - this->actionTimer = Rand_S16Offset(150, 150); - if (rand < 0.5f) { - this->rand = 0; - Math_Vec3s_Copy(&substruct->unk26, &gZeroVec3s); - substruct->unk30 = 0.1f; - substruct->unk2C = 1000; - } else if (rand < 0.75f) { - this->rand = 1; - substruct->unk26.x = Rand_S16Offset(0, 2000); - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.06f; - substruct->unk2C = 1000; - } else if (rand < 0.8f) { - this->rand = 2; - substruct->unk26.x = Rand_S16Offset(-2000, 2000); - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.05f; - substruct->unk2C = 1000; - } else { - this->rand = 3; - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = Rand_S16Offset(-2500, 5000); - substruct->unk30 = 0.04f; - substruct->unk2C = 1000; - } - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B48AD4; -} - -void func_80B48AD4(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player; - s16 new_var3; - s16 temp_v1; - s32 temp_v1_3; - - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); - if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { - func_80B44514(this); - } - - if (this->rand == 0) { - s32 requiredScopeTemp; - - if ((this->actor.xzDistToPlayer < 350.0f) && ((play->gameplayFrames & 0x60) != 0)) { - player = GET_PLAYER(play); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -2500, 2500); - new_var3 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = new_var3 * 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - } - } else { - substruct->unk26.x = 0; - substruct->unk26.y = 0; - } - - if (this->actionTimer > 0) { - temp_v1_3 = this->actionTimer & 0x1F; - if ((temp_v1_3 == 0) && (Rand_ZeroOne() < 0.3f)) { - temp_v1_3 = (s32)Rand_Next() % 4; - if (temp_v1_3 != this->rand) { - this->rand = temp_v1_3; - if (this->rand == 0) { - Math_Vec3s_Copy(&substruct->unk26, &gZeroVec3s); - substruct->unk30 = 0.07f; - } else if (this->rand == 1) { - substruct->unk26.x = Rand_S16Offset(1000, 1000); - substruct->unk26.y = Rand_S16Offset(-1000, 2000); - substruct->unk26.z = Rand_S16Offset(-800, 1600); - substruct->unk30 = 0.06f; - } else if (this->rand == 2) { - substruct->unk26.x = Rand_S16Offset(-2000, 1000); - substruct->unk26.y = Rand_S16Offset(-1000, 2000); - substruct->unk26.z = Rand_S16Offset(-800, 1600); - substruct->unk30 = 0.05f; - } else { - substruct->unk26.x = Rand_S16Offset(-1000, 2000); - substruct->unk26.y = Rand_S16Offset(-2000, 4000); - substruct->unk26.z = Rand_S16Offset(-2000, 4000); - substruct->unk30 = 0.04f; - } - } - } - - this->actionTimer--; - } else { - func_80B487B4(this); - } -} - -void func_80B48DE4(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - this->actor.speedXZ = 0.0f; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - substruct->unk30 = 0.05f; - substruct->unk2C = 1200; - this->actionFunc = func_80B48E4C; -} - -void func_80B48E4C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 50); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 35); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff * 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B48948(this); - } -} - -void func_80B48FB0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B490F0; - this->actor.draw = func_80B4E324; - this->actor.textId = 0x3330; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B444F4(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B487B4(this); - } -} - -void func_80B490F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B48DE4(this); - } - this->actionFunc(this, play); - if (sp2C) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B491EC(EnInvadepoh* this) { - this->scaleFactorAdj = 0.0f; - this->scaleStep = 0.0f; - this->unk3AA = 0; - this->actor.gravity = -15.0f; - this->scaleTarget = 1.0f; - this->actionFunc = func_80B49228; -} - -void func_80B49228(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 temp_f0; - - Actor_UpdateVelocityWithGravity(&this->actor); - this->actor.velocity.y *= 0.97f; - temp_f0 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + D_80B4E934.y + 300.0f, 0.7f, - fabsf(this->actor.velocity.y), 1.0f); - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - if (fabsf(temp_f0) < 1.0f) { - func_80B45EC8(this, play, 50); - func_80B492FC(this); - } -} - -void func_80B492FC(EnInvadepoh* this) { - this->actor.velocity.y *= 0.1f; - this->actionTimer = 20; - this->scaleTarget = 0.3f; - this->scaleStep = 0.03f; - this->unk3AA = 3000; - this->actionFunc = func_80B4934C; -} - -void func_80B4934C(EnInvadepoh* this, PlayState* play) { - f32 temp = this->actor.home.pos.y + D_80B4E934.y + 300.0f; - - if (this->actor.world.pos.y < temp) { - this->actor.gravity = 3.0f; - } else { - this->actor.gravity = -2.0f; - } - this->actor.velocity.y *= 0.96f; - Actor_MoveWithGravity(&this->actor); - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B49404(this); - } -} - -void func_80B49404(EnInvadepoh* this) { - this->actionTimer = 120; - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->unk3AC = 0; - this->counter = 0; - this->actor.gravity = 33.0f; - this->actionFunc = func_80B49454; -} - -void func_80B49454(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - s32 pad2; - - if (this->counter < 25) { - this->counter++; - } else { - this->counter = 0; - this->unk3AC++; - this->unk3AC = CLAMP_MAX(this->unk3AC, 4); - this->actor.gravity = 33.0f; - func_80B45EC8(this, play, 20); - } - - Math_Vec3f_Sum(&D_80B4EDD0[this->unk3AC], &this->actor.home.pos, &sp30); - if (Math3D_Vec3fDistSq(&this->actor.world.pos, &sp30) < SQ(400.0f)) { - this->actor.speedXZ *= 0.8f; - } else { - Math_StepToF(&this->actor.speedXZ, 170.0f, 21.0f); - this->actor.speedXZ *= 0.98f; - } - if (func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, this->actor.speedXZ)) { - this->actor.speedXZ = 0.0f; - } - if (sp30.y < this->actor.world.pos.y) { - Math_StepToF(&this->actor.gravity, -12.0f, 7.0f); - } else { - Math_StepToF(&this->actor.gravity, 5.0f, 4.0f); - } - this->actor.velocity.y += this->actor.gravity; - this->actor.velocity.y *= 0.97f; - this->actor.world.pos.y += this->actor.velocity.y; - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B49628(this); - } -} - -void func_80B49628(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actor.velocity.y *= 0.8f; - this->actionFunc = func_80B49670; -} - -void func_80B49670(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x; - sp30.y = this->actor.home.pos.y + 1500.0f; - sp30.z = this->actor.home.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 0xA, 0xBB8, 0x64); - if ((play->gameplayFrames % 64) < 14) { - Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); - } else { - this->actor.speedXZ *= 0.97f; - } - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -0.5f; - } else { - this->actor.gravity = 2.0f; - } - this->actor.velocity.y *= 0.97f; - Actor_MoveWithGravity(&this->actor); - if (D_80B4E940 == 3) { - func_80B499BC(this); - } -} - -void func_80B497A4(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actionTimer = 35; - this->actor.gravity = -1.5f; - this->actionFunc = func_80B497EC; -} - -void func_80B497EC(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x + D_80B4E934.x; - sp30.y = this->actor.home.pos.y + D_80B4E934.y + 400.0f; - sp30.z = this->actor.home.pos.z + D_80B4E934.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); - Math_StepToF(&this->actor.speedXZ, 70.0f, 3.0f); - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -2.0f; - } else { - this->actor.gravity = 2.0f; - } - this->actor.velocity.y *= 0.97f; - Actor_MoveWithGravity(&this->actor); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B49904(this); - } -} - -void func_80B49904(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actionTimer = 60; - this->actor.gravity = 1.0f; - this->actionFunc = func_80B4994C; -} - -void func_80B4994C(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 150.0f, 4.0f); - this->actor.velocity.y *= 0.95f; - Actor_MoveWithGravity(&this->actor); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - Actor_Kill(&this->actor); - } -} - -void func_80B499BC(EnInvadepoh* this) { - this->actionTimer = 40; - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actor.speedXZ = 0.0f; - this->actionFunc = func_80B49A00; -} - -void func_80B49A00(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x; - sp30.y = this->actor.home.pos.y + 800.0f; - sp30.z = this->actor.home.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); - Math_StepToF(&this->actor.speedXZ, 30.0f, 3.0f); - this->actor.velocity.y *= 0.98f; - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -0.5f; - } else { - this->actor.gravity = 2.0f; - } - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B497A4(this); - } -} - -void func_80B49B1C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - f32 scale; - - this->actionFunc(this, play); - this->scaleAdjAngle += this->unk3AA; - Math_StepToF(&this->scaleFactorAdj, this->scaleTarget, this->scaleStep); - scale = Math_SinS(this->scaleAdjAngle) * this->scaleFactorAdj + 1.0f; - Actor_SetScale(&this->actor, 0.27f * scale); - Math_StepToS(&this->unk306, 600, 8); - this->actor.world.rot.y += this->unk306; - this->unk304 += 600; -} - -void func_80B49BD0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actionFunc = func_80B49C38; -} - -void func_80B49C38(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 temp_v0_2; - - func_80B44570(this); - func_80B44C24(this, play); - func_80B43E6C(this, 6, 2000, 100); - if (1) {} - if (this->pathIndex == 0 || (this->pathIndex + 1) == this->endPoint) { - if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (R_TIME_SPEED * -16.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->clockTime >= 0.9999f) { - Actor_Kill(&this->actor); - } -} - -void func_80B49DA0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B49DFC; -} - -void func_80B49DFC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - SET_WEEKEVENTREG(WEEKEVENTREG_54_10); - this->actor.textId = 0x332E; - } - func_80B49BD0(this); - } -} - -void func_80B49F88(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B44540(this, play); - func_80B44570(this); - func_80B44C24(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { - this->actor.textId = 0x332E; - } else { - this->actor.textId = 0x332D; - } - - } else { - this->actor.textId = 0x332C; - } - - if (sp38 >= CLOCK_TIME(18, 0) || sp38 < CLOCK_TIME(2, 0)) { - this->actor.update = func_80B4A168; - this->actor.draw = NULL; - } else if ((sp38 < CLOCK_TIME(6, 0)) && (sp38 >= CLOCK_TIME(2, 0)) && (sp38 < CLOCK_TIME(2, 15))) { - this->actor.update = func_80B4A1B8; - this->actor.draw = func_80B4E324; - func_80B49BD0(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4A168(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 0))) { - this->actor.update = func_80B4A1B8; - this->actor.draw = func_80B4E324; - func_80B49BD0(this); - } -} - -void func_80B4A1B8(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B49DA0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4A2C0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 1500; - this->actionTimer = Rand_S16Offset(200, 200); - this->unk304 = this->actor.shape.rot.y; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A350; -} - -void func_80B4A350(EnInvadepoh* this, PlayState* play) { - s16 temp_v0; - s16 temp_v1_2; - s16 diff; - Vec3f sp44; - s16 sp42; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if ((play->gameplayFrames % 256) == 0) { - Math_Vec3s_ToVec3f(&sp44, this->pathPoints); - sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); - temp_v0 = Rand_S16Offset(-0x1F40, 0x3E80); - this->unk304 = temp_v0 + sp42; - this->behaviorInfo.unk4C = 0; - } - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40); - if (this->actor.xzDistToPlayer < 300.0f) { - Player* player = GET_PLAYER(play); - - temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1_2 *= 0.85f; - temp_v1_2 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_2, -0x9C4, 0x9C4); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1_2 = diff; - temp_v1_2 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_2, -0x1F40, 0x1F40); - if ((play->gameplayFrames % 256) == 0) { - substruct->unk26.z = Rand_S16Offset(-0x5DC, 0xBB8); - } - } else { - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - } - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B4A570(this); - } -} - -void func_80B4A570(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A5E4; -} - -void func_80B4A5E4(EnInvadepoh* this, PlayState* play) { - if (this->animPlayFlag) { - func_80B4A2C0(this); - } -} - -void func_80B4A614(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actionFunc = func_80B4A67C; -} - -void func_80B4A67C(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speedXZ, 5.0f, 1.0f); - if (func_80B44B84(this, play, this->actor.speedXZ, 50.0f)) { - func_80B44640(this); - this->behaviorInfo.unk4C = 0x5DC; - this->actor.speedXZ *= 0.5f; - } else { - Math_StepToS(&this->behaviorInfo.unk4C, 0x190, 0x32); - } - func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x32); - if (this->pathIndex == 0) { - if (this->unk378 == 0) { - this->unk378 = func_80B45550(this, play, SQ(80.0f), -0xF); - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->pathIndex == this->endPoint) { - func_80B4A2C0(this); - } -} - -void func_80B4A7C0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - this->actionFunc = func_80B4A81C; -} - -void func_80B4A81C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - SET_WEEKEVENTREG(WEEKEVENTREG_54_10); - this->actor.textId = 0x332E; - } - if (this->pathIndex == this->endPoint) { - func_80B4A2C0(this); - } else { - func_80B4A614(this); - } - } -} - -void func_80B4A9C8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad[2]; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B44620(this, play); - if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) { - this->pathIndex = 0; - this->actor.update = func_80B4AB8C; - } else { - this->pathIndex = this->endPoint; - this->actor.update = func_80B4ABDC; - this->actor.draw = func_80B4E324; - func_80B4A2C0(this); - } - - EnInvadepoh_SetPathPointToWorldPos(this, this->pathIndex); - func_80B43F0C(this); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { - this->actor.textId = 0x332E; - } else { - this->actor.textId = 0x332D; - } - } else { - this->actor.textId = 0x332C; - } - } -} - -void func_80B4AB8C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { - this->actor.update = func_80B4ABDC; - this->actor.draw = func_80B4E324; - func_80B4A614(this); - } -} - -void func_80B4ABDC(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4A7C0(this); - } - this->actionFunc(this, play); - if (sp2C) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4ACDC(EnInvadepoh* this) { - this->actionFunc = func_80B4ACF0; -} - -void func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - this->actor.draw = func_80B4E324; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80B4AD3C(this); - } -} - -void func_80B4AD3C(EnInvadepoh* this) { - this->actor.flags |= ACTOR_FLAG_10000; - this->actionFunc = func_80B4AD60; -} - -void func_80B4AD60(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3331); - func_80B4ADB8(this); - } else { - func_800B8614(&this->actor, play, 2000.0f); - } -} - -void func_80B4ADB8(EnInvadepoh* this) { - this->actionFunc = func_80B4ADCC; -} - -void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - if (this->textId == 0x3331) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - return; - } - EnInvadepoh_SetTextID(this, play, 0x3333); - return; - } - if (this->textId == 0x3333) { - func_80B4AEC0(this); - } else if (this->textId == 0x3334) { - func_801477B4(play); - func_80B4B024(this); - } - } -} - -void func_80B4AEC0(EnInvadepoh* this) { - this->actionTimer = 2; - this->actionFunc = func_80B4AEDC; -} - -void func_80B4AEDC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer > 0) { - this->actionTimer--; - if (this->actionTimer == 0) { - func_801477B4(play); - } - } - if (Actor_HasParent(&this->actor, play)) { - this->actor.parent = NULL; - SET_WEEKEVENTREG(WEEKEVENTREG_22_02); - func_80B4AF80(this); - } else { - Actor_PickUp(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); - } -} - -void func_80B4AF80(EnInvadepoh* this) { - this->actionFunc = func_80B4AF94; -} - -void func_80B4AF94(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1E); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - func_80B4ADB8(this); - } else { - func_800B85E0(&this->actor, play, 2000.0f, PLAYER_IA_MINUS1); - } -} - -void func_80B4B024(EnInvadepoh* this) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4B048; -} - -void func_80B4B048(EnInvadepoh* this, PlayState* play) { - if (play->msgCtx.unk120B1 == 0) { - if (play->msgCtx.msgMode == 0) { - D_80B4E998 = 1; - } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || - (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { - D_80B4E998 = 1; - } - } -} - -void func_80B4B0C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - AlienBehaviorInfo* substruct; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - substruct = &this->behaviorInfo; - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 2000, 0.08f, 0.3f, 0.03f); - substruct->unk30 = 0.08f; - substruct->unk2C = 0x7D0; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B4ACDC(this); - } -} - -void func_80B4B218(Actor* thisx, PlayState* play) { - s16 diff; - EnInvadepoh* this = THIS; - s16 temp_v1; - s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - Player* player; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - this->actionFunc(this, play); - if (sp38 && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - player = GET_PLAYER(play); - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - func_80B45CE0(substruct); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4B3DC(EnInvadepoh* this) { - s32 pad; - - if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); - } -} - -void func_80B4B430(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 80); - this->actionFunc = func_80B4B484; -} - -void func_80B4B484(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 1.1f, 0.5f); - if (func_80B44C80(this, play)) { - func_80B44690(this); - } - func_80B4B3DC(this); - if (this->unk3BC >= 0) { - this->actionTimer = 0; - } - - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B4B510(this); - } -} - -void func_80B4B510(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 200); - this->actionFunc = func_80B4B564; -} - -void func_80B4B564(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp28; - f32 temp_f0; - - Math_StepToF(&this->actor.speedXZ, 3.8f, 0.45f); - - if (this->unk3BC >= 0) { - Math_Vec3s_ToVec3f(&sp28, &this->pathPoints[this->unk3BC]); - temp_f0 = Math3D_Vec3fDistSq(&this->actor.world.pos, &sp28); - if (temp_f0 < SQ(80.0f)) { - this->actor.speedXZ *= 0.85f; - } else if (temp_f0 < SQ(150.0f)) { - this->actor.speedXZ *= 0.93f; - } else if (temp_f0 < SQ(250.0f)) { - this->actor.speedXZ *= 0.96f; - } - if (this->pathIndex == this->unk3BC || temp_f0 < SQ(50.0f)) { - this->actionTimer = 0; - } - } - func_80B4B3DC(this); - if (func_80B44C80(this, play)) { - func_80B44690(this); - } - - if (this->actionTimer > 0) { - this->actionTimer--; - } else if (this->unk3BC >= 0) { - if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); - } - func_80B4B724(this); - } else { - func_80B4B430(this); - } -} - -void func_80B4B724(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogBarkAnim, -6.0f); - this->actionFunc = func_80B4B768; -} - -void func_80B4B768(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); - Math_SmoothStepToS(&this->actor.world.rot.y, Actor_YawBetweenActors(&this->actor, &D_80B5040C->actor), 5, 0x1388, - 0x64); - func_80B44E90(this, play); - if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); - } - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B820(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogJumpAnim, -6.0f); - this->actionFunc = func_80B4B864; -} - -void func_80B4B864(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.5f, 1.0f); - func_80B44E90(this, play); - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B8BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, - DOG_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &gZeroVec3s, 3000, 0.1f, 0.0f, 0.0f); - func_80B44664(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - Math_Vec3f_Copy(&this->curPathPos, &this->actor.world.pos); - if (D_80B4E940 == 2) { - this->actor.update = func_80B4BA84; - this->actor.draw = func_80B4E660; - this->actor.flags |= ACTOR_FLAG_1; - func_80B4B430(this); - } else if (D_80B4E940 == 1) { - this->actor.update = func_80B4BA30; - } else { - Actor_Kill(&this->actor); - if (!this) {} - } - } -} - -void func_80B4BA30(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B4E940 == 2) { - this->actor.update = func_80B4BA84; - this->actor.draw = func_80B4E660; - this->actor.flags |= ACTOR_FLAG_1; - func_80B4B430(this); - } -} - -void func_80B4BA84(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 temp_v0_3; - s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 temp_v1_2; - s32 sp2C; - s32 temp_v0_2; - s32 phi_v0; - - D_80B5040C = func_80B458D8(); - if (D_80B5040C == NULL) { - temp_v0_2 = this->unk3BC >= 0; - this->unk3BC = -1; - if (temp_v0_2) { - func_80B4B820(this); - } - } else { - sp2C = this->unk3BC; - this->unk3BC = func_80B44234(this, &D_80B5040C->actor.world.pos); - if (sp2C != this->unk3BC) { - phi_v0 = this->unk3BC - this->pathIndex; - if (phi_v0 < 0) { - phi_v0 += this->endPoint; - } - - if ((this->endPoint >> 1) < phi_v0) { - this->direction = DIRECTION_BACKWARD; - } else if (phi_v0 < (this->endPoint >> 1)) { - this->direction = DIRECTION_FORWARD; - } - } - } - - this->actionFunc(this, play); - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - if (sp34 && (this->actor.update != NULL)) { - func_80B45CE0(&this->behaviorInfo); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4BBE0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4BC4C; -} - -void func_80B4BC4C(EnInvadepoh* this, PlayState* play) { - s8 temp_v0; - s16 diff; - EnInvadepoh* temp_t6 = D_80B503F4; - s16 temp_v1_2; - s32 temp_v1; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - s16 temp_a0; - s16 sp40; - - if (temp_t6 != NULL) { - temp_v0 = temp_t6->pathIndex; - if (temp_v0 == 0) { - this->xzPosAdjFactor = 40.0f; - this->unk304 = -0x8000; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - - } else if (temp_v0 < (temp_t6->endPoint - 1)) { - this->xzPosAdjFactor = 40.0f; - Math_ScaledStepToS(&this->unk304, -0x4800, 0xC8); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - Math_StepToF(&this->xzPosAdjFactor, 5.0f, 3.0f); - Math_ScaledStepToS(&this->unk304, -0x8000, 0x12C); - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - temp_a0 = this->unk304 + temp_t6->actor.world.rot.y; - this->actor.world.pos.x = (Math_SinS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.x; - this->actor.world.pos.y = temp_t6->actor.world.pos.y; - this->actor.world.pos.z = (Math_CosS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.z; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - Math_StepToS(&this->behaviorInfo.unk4C, 0xBB8, 0x1F5); - if (Math3D_Vec3fDistSq(&this->actor.prevPos, &this->actor.world.pos) > SQ(0.01f)) { - Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.prevPos, &this->actor.world.pos), - 3, this->behaviorInfo.unk4C, 0x1F4); - } - temp_v1 = (play->gameplayFrames + 0x14) % 128; - if ((temp_v1 & 0x40) != 0) { - sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &temp_t6->actor.world.pos); - if (temp_v1 == 64) { - this->behaviorInfo.unk4C = 0; - } - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->behaviorInfo.unk4C, 40); - temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &temp_t6->actor.focus.pos); - temp_v1_2 *= 0.85f; - temp_v1_2 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_2, -3000, 3000); - diff = BINANG_SUB(sp40, this->actor.shape.rot.y); - temp_v1_2 = diff; - temp_v1_2 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_2, -8000, 8000); - } - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { - Actor_Kill(&this->actor); - } else if ((temp_t6 != NULL) && (temp_t6->actionFunc == func_80B4CB0C)) { - func_80B4C1BC(this); - } -} - -void func_80B4BFFC(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C058; -} - -void func_80B4C058(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2500, 450); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4BBE0(this); - } -} - -void func_80B4C1BC(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C218; -} - -void func_80B4C218(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - Actor* temp_v0; - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (D_80B503F4 == NULL) { - func_80B4BBE0(this); - } else if ((D_80B503F4 != NULL) && (D_80B503F4->actionFunc != func_80B4CB0C)) { - func_80B4BBE0(this); - } -} - -void func_80B4C3A0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - s32 pad[2]; - s32 currentTime = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, - CREMIA_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - this->actor.textId = 0x33CD; - if (currentTime < 0xD5A0) { - this->unk304 = -0x8000; - this->xzPosAdjFactor = 40.0f; - } else if (currentTime >= 0xD7D4) { - this->unk304 = -0x4800; - this->xzPosAdjFactor = 20.0f; - } else { - this->unk304 = -0x8000; - this->xzPosAdjFactor = 40.0f; - } - - if ((currentTime >= CLOCK_TIME(6, 0)) && (currentTime < 0xD573)) { - this->actor.update = func_80B4C568; - this->actor.draw = NULL; - } else if ((currentTime >= 0xD573) && (currentTime < CLOCK_TIME(20, 15))) { - this->actor.update = func_80B4C5C0; - this->actor.draw = func_80B4E7BC; - func_80B4BBE0(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4C568(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { - this->actor.update = func_80B4C5C0; - this->actor.draw = func_80B4E7BC; - func_80B4BBE0(this); - } -} - -void func_80B4C5C0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 6); - func_80B4BFFC(this); - } - this->actionFunc(this, play); - if (sp2C && (this->actor.update != NULL)) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4C6C8(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 0x320; - this->actionFunc = func_80B4C730; -} - -void func_80B4C730(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - EnInvadepoh* sp68 = D_80B503F8; - s32 phi_a2; - s32 temp_v1_3; - s16 temp_v1_4; - s32 temp_v0_2; - Vec3f sp4C; - Vec3f sp40; - s16 diff; - s16 pad; - s16 sp3A; - s16 pad2; - - func_80B44700(this); - func_80B44EFC(this, play); - func_80B43E6C(this, 6, 2000, 100); - phi_a2 = ((this->pathIndex < this->endPoint) ? this->pathIndex : this->endPoint - 1); - - Math_Vec3s_ToVec3f(&sp4C, &this->pathPoints[phi_a2]); - Math_Vec3s_ToVec3f(&sp40, &this->pathPoints[phi_a2 + 1]); - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40), 5, 0x7D0, 0x64); - if ((this->pathIndex == 0) || ((this->pathIndex + 1) == this->endPoint)) { - if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (R_TIME_SPEED * -23.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - temp_v1_3 = play->gameplayFrames % 128; - if ((temp_v1_3 & 0x40) != 0) { - sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); - if (temp_v1_3 == 64) { - this->behaviorInfo.unk4C = 0; - } - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->behaviorInfo.unk4C, 40); - temp_v1_4 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos); - temp_v1_4 *= 0.85f; - temp_v1_4 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_4, -3000, 3000); - diff = BINANG_SUB(sp3A, this->actor.shape.rot.y); - temp_v1_4 = diff; - temp_v1_4 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_4, -8000, 8000); - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); - } - - if (this->clockTime >= 0.9999f) { - Actor_Kill(&this->actor); - return; - } - - if ((sp68 != NULL) && (sp68->actionFunc == func_80B4C058)) { - func_80B4CC70(this); - } -} - -void func_80B4CAB0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 4000; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CB0C; -} - -void func_80B4CB0C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 3000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos)); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4C6C8(this); - } -} - -void func_80B4CC70(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CCCC; -} - -void func_80B4CCCC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (D_80B503F8 == NULL) { - func_80B4C6C8(this); - } else if ((D_80B503F8 != NULL) && (D_80B503F8->actionFunc != func_80B4C058)) { - func_80B4C6C8(this); - } -} - -void func_80B4CE54(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B446D0(this, play); - this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44700(this); - func_80B44EFC(this, play); - func_80B43F0C(this); - func_80B4516C(this); - this->actor.textId = 0x33CE; - if ((sp38 >= CLOCK_TIME(6, 0)) && (sp38 < CLOCK_TIME(20, 0))) { - this->actor.update = func_80B4CFFC; - this->actor.draw = NULL; - } else if ((sp38 >= 0xD555) && (sp38 < 0xD7E1)) { - this->actor.update = func_80B4D054; - this->actor.draw = func_80B4E324; - func_80B4C6C8(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4CFFC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (gSaveContext.save.time < 0xD7E1)) { - this->actor.update = func_80B4D054; - this->actor.draw = func_80B4E324; - func_80B4C6C8(this); - } -} - -void func_80B4D054(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4CAB0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) { - func_800B8614(thisx, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4D15C(EnInvadepoh* this) { - s32 pad; - s32 temp_v1 = this->actor.params & 7; - unkstruct80B4EE0C* temp_v0; - - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = ((this->actor.params & 7) * this->skelAnime.endFrame) * 0.25f; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - temp_v0 = &D_80B4EE0C[temp_v1]; - this->velocityStep = temp_v0->unk00; - this->unk304 = temp_v1 * 0x5555; - this->actor.world.pos.x = this->actor.home.pos.x + (Math_SinS(this->unk304) * 80.0f); - this->actor.world.pos.y = this->actor.home.pos.y; - this->actor.world.pos.z = this->actor.home.pos.z + (Math_CosS(this->unk304) * 80.0f); - this->actor.shape.rot.y = this->unk304 + 0x4000; - this->behaviorInfo.unk4C = temp_v0->unk04; - this->behaviorInfo.unk4E = temp_v0->unk06; - this->actionFunc = func_80B4D290; - this->actor.velocity.y = 0.0f; -} - -void func_80B4D290(EnInvadepoh* this, PlayState* play) { - Actor* temp_v1; - f32 sp28; - - if (D_80B503F0 == NULL) { - Actor_Kill(&this->actor); - return; - } - - Math_StepToF(&this->actor.velocity.y, 15.0f, this->velocityStep); - sp28 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, this->actor.velocity.y, - 0.01f); - this->unk304 += 0x2BC; - this->actor.world.pos.x = this->actor.home.pos.x + Math_SinS(this->unk304) * 80.0f; - this->actor.world.pos.z = this->actor.home.pos.z + Math_CosS(this->unk304) * 80.0f; - this->behaviorInfo.unk4C += this->behaviorInfo.unk4E; - this->actor.shape.rot.y += this->behaviorInfo.unk4C; - temp_v1 = this->actor.child; - - if (this->actor.child != NULL) { - this->actor.child->world.pos.x = this->actor.world.pos.x; - temp_v1->world.pos.y = this->actor.world.pos.y - 38.0f; - temp_v1->world.pos.z = this->actor.world.pos.z; - temp_v1->shape.rot.y = this->actor.shape.rot.y; - } - - if (sp28 < 5.0f) { - Actor_Kill(&this->actor); - } -} - -void func_80B4D3E4(EnInvadepoh* this) { - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; - this->alienAlpha = 255; - this->actor.draw = NULL; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->unk306 = 400; - this->unk304 = 0; - this->actionTimer = 200; - this->actor.velocity.y = 0.0f; - this->actionFunc = func_80B4D480; -} - -void func_80B4D480(EnInvadepoh* this, PlayState* play) { - f32 target; - s32 pad2; - s32 sp2C = false; - f32 new_var3; - - if (this->actionTimer > 0) { - this->actionTimer--; - } - - if (this->actionTimer > 160) { - this->actor.draw = NULL; - } else { - this->actor.draw = func_80B4DB14; - if (1) {} - if ((this->actionTimer < 105) && (this->actionTimer >= 100)) { - this->actor.gravity = -1.0f; - Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); - } else { - this->actor.gravity = 0.7f; - Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 8, 0x320, 0x28); - } - - this->actor.velocity.y += this->actor.gravity; - this->actor.velocity.y *= 0.92f; - if (this->actionTimer > 80) { - this->actor.world.pos.y += this->actor.velocity.y; - } else { - target = (this->actor.home.pos.y + 850.0f); - sp2C = Math_StepToF(&this->actor.world.pos.y, target, fabsf(this->actor.velocity.y)); - } - - new_var3 = (this->unk304 * -0.06f + this->unk306); - new_var3 *= 0.98f; - this->unk306 = new_var3; - this->actor.shape.rot.y += this->unk306; - - if (this->actor.child != NULL) { - Actor* temp_v1 = this->actor.child; - - temp_v1->world.pos.x = this->actor.world.pos.x; - temp_v1->world.pos.y = this->actor.world.pos.y - 30.0f; - temp_v1->world.pos.z = this->actor.world.pos.z; - temp_v1->shape.rot.y = this->actor.shape.rot.y; - } - } - - if ((this->actionTimer <= 0) || sp2C) { - Actor_Kill(&this->actor); - } -} - -void func_80B4D670(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 invadepohType; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - invadepohType = this->actor.params & 7; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B4D760; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, - this->morphTable, ALIEN_LIMB_MAX); - if (invadepohType < 3) { - func_80B453F4(this, play, invadepohType); - func_80B4D15C(this); - } else { - func_80B45460(this, play); - func_80B4D3E4(this); - } - } -} - -void func_80B4D760(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - } -} - -void func_80B4D7B8(PlayState* play) { - u32 temp_s5; - u32 temp_s6; - unkStruct80B50350* phi_s2; - s32 i; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - for (phi_s2 = D_80B50350, i = 0; i < 10; phi_s2++, i++) { - if (phi_s2->unk1 > 0) { - temp_s5 = (play->gameplayFrames + ((0x10 * i) & 0xFF)) & 0x7F; - temp_s6 = (u8)(play->gameplayFrames * -0xF); - Matrix_Translate(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW); - Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, phi_s2->unk2); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_02E510); - } - } - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4D9B4(Actor* thisx, PlayState* play) { - func_80B4D7B8(play); -} - -s32 func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { - return false; -} - -void func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - EnInvadepoh* this = THIS; - - if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x3830, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502A0); - Matrix_Pop(); - } else if ((limbIndex == 13) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502E0); - Matrix_Pop(); - } - if (limbIndex == 11) { - Matrix_MultVec3f(&D_80B4EE24, &this->actor.focus.pos); - } -} - -void func_80B4DB14(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - Gfx* gfx; - GraphicsContext* spCC = play->state.gfxCtx; - - OPEN_DISPS(spCC); - func_8012C2DC(spCC); - Matrix_Push(); - if (this->drawAlien) { - Gfx* new_var6; - Gfx* spBC; - GraphicsContext* spB8; - - if (this->alienAlpha == 255) { - func_8012C28C(play->state.gfxCtx); - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 0, 1); - gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255); - spCC->polyOpa.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyOpa.p); - } else { - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 1, 2); - gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha); - spCC->polyXlu.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyXlu.p); - } - - if (this->alienBeamAlpha != 0) { - AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); - spB8 = play->state.gfxCtx; - gfx = spBC = spB8->polyXlu.p; - gDPPipeSync(spBC++); - gDPSetPrimColor(spBC++, 0, 255, 240, 180, 100, 60); - gDPSetEnvColor(spBC++, 255, 255, 255, this->alienBeamAlpha * (150.0f / 255.0f)); - Matrix_Mult(&D_80B502A0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - Matrix_Mult(&D_80B502E0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - spB8->polyXlu.p = spBC; - } - } - - if (this->drawAlienDeathEffect) { - Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f, this->actor.world.pos.z, - &this->actor.shape.rot); - Matrix_Scale(this->alienDeathEffectScale.x, this->alienDeathEffectScale.y, this->alienDeathEffectScale.z, - MTXMODE_APPLY); - gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spCC->polyXlu.p++, gAlienDeathFlashDL); - } - - if (this->drawAlien) { - Vec3f sp80; - Vec3f sp74; - s32 alpha2; - GraphicsContext* sp6C = play->state.gfxCtx; - u32 pad; - - gfx = sp6C->polyXlu.p; - gfx = func_8012C868(gfx); - gDPSetDither(gfx++, G_CD_NOISE); - gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, - 0); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(60.0f, &sp80); - sp74.x = thisx->world.pos.x + sp80.x; - sp74.y = thisx->world.pos.y + sp80.y + 68.0f; - sp74.z = thisx->world.pos.z + sp80.z; - Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); - Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); - alpha2 = this->alienAlpha * (100.0f / 255.0f); - gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); - gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, alpha2); - gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); - sp6C->polyXlu.p = gfx; - if ((this->alienAlpha > 128) && func_80B456A8(play, &sp74)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); - } - } - - Matrix_Pop(); - CLOSE_DISPS(spCC); -} - -s32 func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 5) { - EnInvadepoh* this = THIS; - rot->x -= this->actor.shape.rot.x; - } - return false; -} - -void func_80B4E158(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E120, NULL, &this->actor); -} - -void func_80B4E1B0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); -} - -s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == ROMANI_LIMB_HEAD) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += this->behaviorInfo.unk20.y; - rot->y += this->behaviorInfo.unk20.z; - rot->z += this->behaviorInfo.unk20.x; - } else if (limbIndex == ROMANI_LIMB_TORSO) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); - rot->z += this->behaviorInfo.unk40; - } - return false; -} - -void func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == ROMANI_LIMB_LEFT_HAND) { - OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); - CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == ROMANI_LIMB_HEAD) { - Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); - } -} - -void func_80B4E324(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E200, func_80B4E2AC, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4E3F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - Vec3f sp5C; - - Matrix_Push(); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(200.0f, &sp5C); - Matrix_Pop(); - sp5C.x += thisx->world.pos.x; - sp5C.y += thisx->world.pos.y; - sp5C.z += thisx->world.pos.z; - EnInvadepoh_SetSysMatrix(&sp5C); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_RotateZS(this->unk304, MTXMODE_APPLY); - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - if (func_80B456A8(play, &sp5C)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); - } - - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || - (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { - EnInvadepoh* this = THIS; - - rot->x += this->behaviorInfo.unk20.x; - rot->y += this->behaviorInfo.unk20.y; - rot->z += this->behaviorInfo.unk20.z; - } - - return false; -} - -void func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == DOG_LIMB_HEAD) { - Matrix_MultVecY(20.0f, &this->actor.focus.pos); - } -} - -void func_80B4E660(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E5B0, func_80B4E61C, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 9) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += this->behaviorInfo.unk20.y; - rot->y += this->behaviorInfo.unk20.z; - rot->z += this->behaviorInfo.unk20.x; - } else if (limbIndex == 2) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); - } - return false; -} - -void func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == 9) { - Matrix_MultZero(&this->actor.focus.pos); - } -} - -void func_80B4E7BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E6E4, func_80B4E784, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45980.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B459E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45B1C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45BB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45C04.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45CE0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45EC8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46118.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46184.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B461DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4627C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46414.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46520.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B465CC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46644.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B468B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B469C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46A80.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Init.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C08.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C34.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C50.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C7C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CF4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46D28.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Destroy.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DC8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E20.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E44.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EE8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46F88.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46FA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47064.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47084.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B470E0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47108.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471E0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47248.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47268.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47278.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47298.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47304.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Update.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47380.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B473E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47478.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B474DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47568.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47600.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4770C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B477B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47830.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B478F4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47938.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B479E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47BAC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47D30.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47FA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48060.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B481C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4827C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B482D4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48374.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B483CC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4843C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B484EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48588.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48610.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48620.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4873C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B487B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48848.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48948.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48AD4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48DE4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48E4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48FB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B490F0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B491EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49228.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B492FC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4934C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49404.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49454.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49628.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49670.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497A4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49904.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4994C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B499BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49A00.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49B1C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49BD0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49C38.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DA0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49F88.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A168.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A1B8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A2C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A350.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A570.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A5E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A614.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A67C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A7C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A81C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A9C8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AB8C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ABDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACF0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD3C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD60.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADCC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF80.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B024.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B048.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B0C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B218.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B3DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B430.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B484.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B510.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B564.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B724.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B768.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B820.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B864.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B8BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA30.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA84.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BBE0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BC4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BFFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C058.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C1BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C218.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C3A0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C568.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C5C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C6C8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C730.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CAB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CB0C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CC70.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CCCC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CE54.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CFFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D054.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D15C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D290.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D3E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D480.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D670.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D760.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D7B8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9D8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9F4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4DB14.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E120.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E158.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E1B0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E200.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E2AC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E3F0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E5B0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E61C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E660.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E6E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E784.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E7BC.s") diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h index 061d9c326..54253ad03 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -5,151 +5,9 @@ struct EnInvadepoh; -typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, PlayState*); - -#define INVADEPOH_TYPE(thisx) (((thisx)->params >> 4) & 0xF) - -typedef enum{ - /* 0 */ TYPE_UNK0, - /* 1 */ TYPE_ALIEN, - /* 2 */ TYPE_PARENT_COW, - /* 3 */ TYPE_CHILD_COW, - /* 4 */ TYPE_ROMANI, - /* 5 */ TYPE_ROMANI1, - /* 6 */ TYPE_UNK6, - /* 7 */ TYPE_ROMANI2, - /* 8 */ TYPE_ROMANI3, - /* 9 */ TYPE_ROMANI4, - /* 10 */ TYPE_DOG, - /* 11 */ TYPE_CREMIA, - /* 12 */ TYPE_ROMANI5, - /* 13 */ TYPE_ALIEN_CARRYING_COW -} EnInvadepohType; - -typedef enum { - /* -1 */ DIRECTION_BACKWARD = -1, - /* 1 */ DIRECTION_FORWARD = 1, -} EnInvadepohDirection; - -typedef struct unkStruct80B50350 { - /* 0x0 */ s8 unk0; - /* 0x1 */ s8 unk1; - /* 0x2 */ u8 unk2; - /* 0x4 */ Vec3f unk4; -} unkStruct80B50350; // size = 0x10; - -typedef struct { - /* 0x0 */ s8* unk00; - /* 0x4 */ s8 unk04; -} unkstructInvadepoh0; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ f32 unk04; -} unkstructInvadepoh1; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ unkstructInvadepoh0* unk04; -} unkstructInvadepoh2; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk0; - /* 0x4 */ unkstructInvadepoh0* unk4; - /* 0x8 */ s8 unk8; - /* 0xC */ unkstructInvadepoh1* unkC; -} unkstructInvadepoh3; // size = 0x10 - -typedef struct { - /* 0x00 */ s8 unk00; - /* 0x04 */ unkstructInvadepoh0* unk04; - /* 0x08 */ s8 unk08; - /* 0x0C */ unkstructInvadepoh1* unk0C; - /* 0x10 */ s16 unk10; - /* 0x12 */ s16 unk12; -} unkstructInvadepoh4; // size = 0x14 - -typedef struct { - /* 0x0 */ f32 unk00; - /* 0x4 */ s16 unk04; - /* 0x6 */ s16 unk06; -} unkstruct80B4EE0C; // size = 0x8 - -typedef struct EnInvadePohStruct { - /* 0x0 */ unkstructInvadepoh4* unk0; - /* 0x4 */ s8 unk4; - /* 0x8 */ unkstructInvadepoh4* unk8; - /* 0xC */ s16 unkC; - /* 0xE */ s8 unkE; - /* 0xF */ s8 unkF; -} EnInvadePohStruct; // size = 0x10; - -typedef struct AlienBehaviorInfo { - /* 0x00 */ EnInvadePohStruct unk0; - /* 0x10 */ EnInvadePohStruct unk10; - /* 0x20 */ Vec3s unk20; - /* 0x26 */ Vec3s unk26; - /* 0x2C */ s16 unk2C; - /* 0x2E */ u16 unk2E; - /* 0x30 */ f32 unk30; - /* 0x34 */ f32 unk34; - /* 0x38 */ f32 unk38; - /* 0x3C */ f32 unk3C; - /* 0x40 */ s16 unk40; - /* 0x42 */ s16 unk42; - /* 0x44 */ f32 unk44; - /* 0x48 */ s16 unk48; - /* 0x4A */ UNK_TYPE1 unk4A[0x2]; - /* 0x4C */ s16 unk4C; - /* 0x4E */ s16 unk4E; -} AlienBehaviorInfo; // size = 0x50 - typedef struct EnInvadepoh { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[23]; - /* 0x212 */ Vec3s morphTable[23]; - /* 0x29C */ s8 animPlayFlag; - /* 0x2A0 */ ColliderCylinder collider; - /* 0x2EC */ EnInvadepohActionFunc actionFunc; - /* 0x2F0 */ s16 actionTimer; - /* 0x2F2 */ s16 counter; // general counter variable - /* 0x2F4 */ s8 bankIndex; - /* 0x2F8 */ f32 xzPosAdjFactor; - /* 0x2FC */ UNK_TYPE unk2FC; // unused - /* 0x300 */ f32 velocityStep; - /* 0x304 */ s16 unk304; // angle of some sort - /* 0x306 */ s16 unk306; - /* 0x308 */ s8 endPoint; - /* 0x309 */ s8 pathIndex; - /* 0x30A */ s8 direction; // only ever 1 or -1 - /* 0x30C */ Vec3s* pathPoints; - /* 0x310 */ f32 pathTotalDist; - /* 0x314 */ Vec3f curPathPos; - /* 0x320 */ f32 clockTime; - /* 0x324 */ AlienBehaviorInfo behaviorInfo; - /* 0x374 */ s8 rand; - /* 0x376 */ u16 textId; - /* 0x378 */ s8 unk378; - /* 0x379 */ s8 unk379; - /* 0x37C */ f32 unk37C[3]; - /* 0x388 */ s8 unk388; // unused - /* 0x389 */ u8 alienAlpha; - /* 0x38A */ s8 unk38A; // bool - /* 0x38B */ s8 drawAlien; - /* 0x38C */ s8 drawAlienDeathEffect; - /* 0x38D */ u8 alienBeamAlpha; - /* 0x390 */ Vec3f alienDeathEffectScale; - /* 0x39C */ f32 scaleFactorAdj; - /* 0x3A0 */ f32 scaleTarget; - /* 0x3A4 */ f32 scaleStep; - /* 0x3A8 */ s16 scaleAdjAngle; - /* 0x3AA */ s16 unk3AA; - /* 0x3AC */ s8 unk3AC; // index for D_80B4EDD0 - /* 0x3AD */ UNK_TYPE1 unk3AD[0xF]; - /* 0x3BC */ s8 unk3BC; + /* 0x144 */ char unk_144[0x27C]; } EnInvadepoh; // size = 0x3C0 #endif // Z_EN_INVADEPOH_H diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c index 70f77b18a..489431bdf 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c @@ -60,7 +60,7 @@ void func_80C258A0(EnInvisibleRuppe* this, PlayState* play) { void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { - switch (INVISIBLERUPPE_GET_3(this)) { + switch (INVISIBLERUPPE_GET_3(&this->actor)) { case 0: play_sound(NA_SE_SY_GET_RUPY); Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN); @@ -93,7 +93,7 @@ void EnInvisibleRuppe_Init(Actor* thisx, PlayState* play) { s32 pad; EnInvisibleRuppe* this = THIS; - this->unk_190 = INVISIBLERUPPE_GET_1FC(this); + this->unk_190 = INVISIBLERUPPE_GET_1FC(&this->actor); if (this->unk_190 == 0x7F) { this->unk_190 = -1; diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h index 5b6f6ca64..d703a3511 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.h @@ -7,8 +7,8 @@ struct EnInvisibleRuppe; typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, PlayState*); -#define INVISIBLERUPPE_GET_3(thisx) ((thisx)->actor.params & 3) -#define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->actor.params & 0x1FC) >> 2) +#define INVISIBLERUPPE_GET_3(thisx) ((thisx)->params & 3) +#define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->params & 0x1FC) >> 2) typedef struct EnInvisibleRuppe { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index f911bc4f4..040081b5c 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -191,11 +191,11 @@ void func_8095D804(Actor* thisx, PlayState* play) { spB8.z = ((Rand_ZeroOne() - 0.5f) * 8.0f) + this->actor.world.pos.z; Math_Vec3f_Copy(&spC4, &this->actor.velocity); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { spC4.x *= 0.6f; spC4.y *= -0.3f; spC4.z *= 0.6f; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { spC4.x *= -0.5f; spC4.y *= 0.5f; spC4.z *= -0.5f; @@ -230,11 +230,11 @@ void func_8095DABC(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&spD8, &this->actor.velocity); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { spD8.x *= 0.9f; spD8.y *= -0.8f; spD8.z *= 0.9f; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { spD8.x *= -0.9f; spD8.y *= 0.8f; spD8.z *= -0.9f; @@ -265,11 +265,11 @@ void func_8095DDA8(EnIshi* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sp2C.x += 2.0f * this->actor.velocity.x; sp2C.y -= 2.0f * this->actor.velocity.y; sp2C.z += 2.0f * this->actor.velocity.z; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp2C.x -= 2.0f * this->actor.velocity.x; sp2C.y += 2.0f * this->actor.velocity.y; sp2C.z -= 2.0f * this->actor.velocity.z; @@ -281,11 +281,11 @@ void func_8095DE9C(EnIshi* this, PlayState* play) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sp2C.x += 2.0f * this->actor.velocity.x; sp2C.y -= 2.0f * this->actor.velocity.y; sp2C.z += 2.0f * this->actor.velocity.z; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp2C.x -= 2.0f * this->actor.velocity.x; sp2C.y += 2.0f * this->actor.velocity.y; sp2C.z -= 2.0f * this->actor.velocity.z; @@ -354,7 +354,7 @@ void func_8095E204(EnIshi* this, PlayState* play) { for (i = 0; i < 3; i++) { if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.cutscene, this->actor.unk20, NULL) == NULL) { + this->actor.cutscene, this->actor.halfDaysBits, NULL) == NULL) { break; } } @@ -513,9 +513,9 @@ void func_8095E660(EnIshi* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 90.0f) && (sp30 == 0)) { if (sp38 == 1) { - Actor_PickUp(&this->actor, play, GI_NONE, 80.0f, 20.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 80.0f, 20.0f); } else { - Actor_PickUp(&this->actor, play, GI_NONE, 50.0f, 10.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 50.0f, 10.0f); } } } @@ -554,8 +554,8 @@ void func_8095E95C(EnIshi* this, PlayState* play) { void func_8095EA70(EnIshi* this) { f32 sp24; - this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; - this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; + this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; if (!ENISHI_GET_1(&this->actor)) { sp24 = Rand_ZeroOne() - 0.9f; D_8095F690 = sp24 * 11000.0f; @@ -585,11 +585,11 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { this->unk_194--; - if ((this->actor.bgCheckFlags & 9) || temp_v0 || (this->unk_194 <= 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || temp_v0 || (this->unk_194 <= 0)) { func_8095DF90(this, play); D_8095F6D8[sp70](&this->actor, play); - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, D_8095F6D4[sp70], D_8095F6D0[sp70]); D_8095F6E0[sp70](this, play); } @@ -608,7 +608,7 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { if (sp70 == 0) { sp58.x = this->actor.world.pos.x; sp58.y = this->actor.world.pos.y + this->actor.depthInWater; @@ -639,7 +639,7 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { D_8095F694 >>= 2; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 2.0f); diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 03cc41f20..05855bb20 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -93,7 +93,7 @@ s32 EnJcMato_CheckForHit(EnJcMato* this, PlayState* play) { this->collider.dim.worldSphere.center.z = this->pos.z; if ((this->collider.base.acFlags & AC_HIT) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { this->collider.base.acFlags &= ~AC_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); play->interfaceCtx.minigamePoints = 1; this->hitFlag = true; return 1; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index e7c2ad78d..f2f2569c4 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -434,7 +434,7 @@ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { this->actionFunc = EnJg_Walk; } } else if (this->animIndex == EN_JG_ANIM_WALK) { - Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.0f, 0.2f, 1.0f); EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, play); } } @@ -445,7 +445,7 @@ void EnJg_Walk(EnJg* this, PlayState* play) { if (this->path != NULL) { yRotation = EnJg_GetWalkingYRotation(this->path, this->currentPoint, &this->actor.world.pos, &distSQ); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yRotation = this->actor.wallYaw; } @@ -459,10 +459,10 @@ void EnJg_Walk(EnJg* this, PlayState* play) { this->actionFunc = EnJg_AlternateTalkOrWalkInPlace; } else { this->currentPoint++; - Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.5f, 0.2f, 1.0f); } } else { - Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.5f, 0.2f, 1.0f); } } @@ -687,7 +687,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { this->drum = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_OBJ_JG_GAKKI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, - this->actor.params, this->actor.cutscene, this->actor.unk20, NULL); + this->actor.params, this->actor.cutscene, this->actor.halfDaysBits, NULL); } if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) { @@ -903,7 +903,7 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->flags |= FLAG_LOOKING_AT_PLAYER; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->textId == 0xDAC) { this->action = EN_JG_ACTION_FIRST_THAW; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 2db753d01..8b3ec5956 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -189,11 +189,12 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { func_800B8614(&this->actor, play, 80.0f); } - if ((player->actor.bgCheckFlags & 1) && !(player->stateFlags1 & PLAYER_STATE1_2000) && (this->unk_2FE == 0) && - (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && func_80C149B0(play, &this->unk_1F8)) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(player->stateFlags1 & PLAYER_STATE1_2000) && + (this->unk_2FE == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) && + func_80C149B0(play, &this->unk_1F8)) { this->unk_2FE = 1; func_80C13E6C(this); - } else if (!(player->actor.bgCheckFlags & 1)) { + } else if (!(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_2FE = 0; } @@ -283,7 +284,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { Player* player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; - func_801A2BB8(0x25); + Audio_PlaySubBgm(0x25); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; Interface_InitMinigame(play); SET_WEEKEVENTREG(WEEKEVENTREG_90_20); @@ -334,21 +335,22 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_2FC++; - if ((player->actor.bgCheckFlags & 2) && func_80C149B0(play, &this->unk_200)) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && func_80C149B0(play, &this->unk_200)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x109F, &this->actor); this->unk_300 = 0x109F; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); - } else if ((player->actor.bgCheckFlags & 0x40) || (player->actor.bgCheckFlags & 0x20)) { + } else if ((player->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) || + (player->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x10A0, &this->actor); this->unk_300 = 0x10A0; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); } @@ -357,7 +359,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x10A1; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); } } @@ -384,9 +386,9 @@ void func_80C14554(EnJgameTsn* this, PlayState* play) { } func_80C145FC(this); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_10)) { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } } @@ -400,7 +402,7 @@ void func_80C14610(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x10A4; func_80C14030(this); } else { - func_800B85E0(&this->actor, play, 200.0f, -1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } @@ -469,7 +471,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); } - func_801477B4(play); + Message_CloseTextbox(play); func_80C1476C(this, play); func_80C1410C(this, play); break; @@ -477,7 +479,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { case 0x109F: case 0x10A0: case 0x10A1: - func_801477B4(play); + Message_CloseTextbox(play); gSaveContext.minigameStatus = MINIGAME_STATUS_END; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_20); @@ -485,7 +487,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { break; case 0x10A3: - func_801477B4(play); + Message_CloseTextbox(play); func_80C14540(this); func_80C14554(this, play); break; @@ -549,7 +551,7 @@ s32 func_80C14BCC(EnJgameTsn* this, PlayState* play) { s32 i; s32 phi_s3 = -1; - if (player->actor.bgCheckFlags & 2) { + if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { for (i = 0; i < ARRAY_COUNT(this->unk_1D8); i++) { if (func_80C149B0(play, &this->unk_1D8[i])) { phi_s3 = i; @@ -561,19 +563,19 @@ s32 func_80C14BCC(EnJgameTsn* this, PlayState* play) { } if (phi_s3 == this->unk_218) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_CORRECT; play->interfaceCtx.minigamePoints = 1; return true; } if (*this->unk_208[phi_s3] & OBJLUPYGAMELIFT_IGNITE_FIRE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_CORRECT; play->interfaceCtx.minigamePoints = 1; } else { *this->unk_208[phi_s3] |= OBJLUPYGAMELIFT_DISPLAY_INCORRECT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); + Actor_PlaySfx(&this->actor, NA_SE_SY_ERROR); } } diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index ecfaa6b8b..371757e44 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -254,7 +254,7 @@ s32 func_80968CB8(EnJs* this) { return true; } - Math_StepToF(&this->actor.speedXZ, this->unk_2B4, 0.5f); + Math_StepToF(&this->actor.speed, this->unk_2B4, 0.5f); return false; } @@ -475,20 +475,20 @@ void func_80969400(s32 arg0) { void func_80969494(EnJs* this, PlayState* play) { func_80968A5C(this); - func_801477B4(play); - this->actor.flags &= ~ACTOR_FLAG_100; + Message_CloseTextbox(play); + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_80969B5C; } void func_809694E8(EnJs* this, PlayState* play) { - func_801477B4(play); - this->actor.flags &= ~ACTOR_FLAG_100; + Message_CloseTextbox(play); + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_8096A104; } void func_80969530(EnJs* this, PlayState* play) { - func_801477B4(play); - this->actor.flags &= ~ACTOR_FLAG_100; + Message_CloseTextbox(play); + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_8096A6F4; if ((this->actor.home.rot.y == this->actor.shape.rot.y) && (this->unk_2B8 & 0x10)) { Animation_Change(&this->skelAnime, &gMoonChildGettingUpAnim, -1.0f, @@ -542,7 +542,7 @@ void func_80969748(EnJs* this, PlayState* play) { this->actionFunc = func_80969898; } if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); if ((itemAction >= PLAYER_IA_MASK_TRUTH) && (itemAction <= PLAYER_IA_MASK_GIANT)) { EnJs_TakeMask(itemAction, ENJS_GET_TYPE(&this->actor)); Inventory_UnequipItem(itemAction - 4); @@ -559,7 +559,7 @@ void func_80969748(EnJs* this, PlayState* play) { } if (itemAction <= PLAYER_IA_MINUS1) { - func_80151938(play, 0x2216); + Message_ContinueTextbox(play, 0x2216); } } } @@ -577,11 +577,11 @@ void func_80969898(EnJs* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0x2217); + Message_ContinueTextbox(play, 0x2217); break; case 1: func_8019F230(); - func_80151938(play, 0x2216); + Message_ContinueTextbox(play, 0x2216); break; } } @@ -592,24 +592,24 @@ void func_80969898(EnJs* this, PlayState* play) { case 0x220C: this->unk_2B8 |= 1; if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) { - func_80151938(play, 0x220F); + Message_ContinueTextbox(play, 0x220F); break; } - func_80151938(play, 0x220D); + Message_ContinueTextbox(play, 0x220D); break; case 0x220D: case 0x2213: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x220E: - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969748; break; case 0x2210: case 0x2211: case 0x2212: player->exchangeItemId = PLAYER_IA_NONE; - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969748; break; case 0x2214: @@ -667,7 +667,7 @@ void func_80969B5C(EnJs* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80969898; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2B4 = 0.0f; func_80969AA0(this, play); } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { @@ -691,7 +691,7 @@ void func_80969C54(EnJs* this, PlayState* play) { } if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); if ((itemAction >= PLAYER_IA_MASK_TRUTH) && (itemAction <= PLAYER_IA_MASK_GIANT)) { EnJs_TakeMask(itemAction, ENJS_GET_TYPE(&this->actor)); Inventory_UnequipItem(itemAction - 4); @@ -708,7 +708,7 @@ void func_80969C54(EnJs* this, PlayState* play) { } if (itemAction <= PLAYER_IA_MINUS1) { - func_80151938(play, 0x221E); + Message_ContinueTextbox(play, 0x221E); } } } @@ -734,7 +734,7 @@ void func_80969DA4(EnJs* this, PlayState* play) { break; case 1: func_8019F230(); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; } } @@ -744,16 +744,16 @@ void func_80969DA4(EnJs* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x221B: if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) { - func_80151938(play, 0x2219); + Message_ContinueTextbox(play, 0x2219); break; } - func_80151938(play, 0x221C); + Message_ContinueTextbox(play, 0x221C); break; case 0x2224: case 0x2226: case 0x2228: case 0x222A: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x2225: case 0x2227: @@ -766,33 +766,33 @@ void func_80969DA4(EnJs* this, PlayState* play) { break; case 0x2222: player->exchangeItemId = PLAYER_IA_NONE; - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x2223: switch (ENJS_GET_TYPE(&this->actor)) { case 5: - func_80151938(play, 0x2224); + Message_ContinueTextbox(play, 0x2224); break; case 6: - func_80151938(play, 0x2226); + Message_ContinueTextbox(play, 0x2226); break; case 7: - func_80151938(play, 0x2228); + Message_ContinueTextbox(play, 0x2228); break; case 8: - func_80151938(play, 0x222A); + Message_ContinueTextbox(play, 0x222A); break; } break; case 0x221C: - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969C54; break; case 0x221D: case 0x2220: case 0x2221: player->exchangeItemId = PLAYER_IA_NONE; - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80969C54; break; default: @@ -872,7 +872,7 @@ void func_8096A2C0(EnJs* this, PlayState* play) { this->actionFunc = func_8096A1E8; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - Actor_PickUp(&this->actor, play, GI_MASK_FIERCE_DEITY, 10000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_FIERCE_DEITY, 10000.0f, 1000.0f); } } @@ -898,12 +898,12 @@ void func_8096A38C(EnJs* this, PlayState* play) { case 0x21FC: switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(play, 0x21FE); + Message_ContinueTextbox(play, 0x21FE); Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f); this->unk_2B8 |= 0x10; break; case 1: - func_80151938(play, 0x21FD); + Message_ContinueTextbox(play, 0x21FD); break; } break; @@ -911,11 +911,11 @@ void func_8096A38C(EnJs* this, PlayState* play) { case 0x21FE: switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(play, 0x2200); + Message_ContinueTextbox(play, 0x2200); func_809696EC(this, 0); break; case 1: - func_80151938(play, 0x21FF); + Message_ContinueTextbox(play, 0x21FF); break; } break; @@ -923,12 +923,12 @@ void func_8096A38C(EnJs* this, PlayState* play) { case 0x2203: switch (play->msgCtx.choiceIndex) { case 0: - func_80151938(play, 0x2205); + Message_ContinueTextbox(play, 0x2205); Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f); this->unk_2B8 |= 0x10; break; case 1: - func_80151938(play, 0x2204); + Message_ContinueTextbox(play, 0x2204); break; } } @@ -941,21 +941,21 @@ void func_8096A38C(EnJs* this, PlayState* play) { case 0x2205: case 0x2206: case 0x2209: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x2200: case 0x2208: func_809696EC(this, 1); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x2207: if (INV_CONTENT(ITEM_MASK_FIERCE_DEITY) == ITEM_MASK_FIERCE_DEITY) { - func_80151938(play, 0x2208); + Message_ContinueTextbox(play, 0x2208); func_809696EC(this, 0); } else { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_8096A2C0; func_8096A2C0(this, play); } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 70ca7313a..fca1afc51 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -284,7 +284,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { blureInit.calcMode = 2; Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); Actor_SetScale(&this->picto.actor, 0.0125f); - this->picto.actor.flags |= ACTOR_FLAG_8000000; + this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags &= ~ACTOR_FLAG_1; if (this->switchFlag == 127) { this->switchFlag = -1; @@ -371,7 +371,7 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { } } else if (func_800BE184(play, &this->picto.actor, 100.0f, 0x5DC0, 0x2AA8, this->picto.actor.shape.rot.y)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - if ((this->picto.actor.bgCheckFlags & 8) && (ABS_ALT(sp32) < 0x2EE0) && + if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(sp32) < 0x2EE0) && (this->picto.actor.xzDistToPlayer < 90.0f)) { if (this->action != KAIZOKU_ACTION_6) { func_80B87C7C(this); @@ -393,9 +393,10 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { if (explosiveActor != NULL) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - if (((this->picto.actor.bgCheckFlags & 8) && (sp32 < 0x2EE0)) || (explosiveActor->id == ACTOR_EN_BOM_CHU)) { + if (((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (sp32 < 0x2EE0)) || + (explosiveActor->id == ACTOR_EN_BOM_CHU)) { if ((explosiveActor->id == ACTOR_EN_BOM_CHU) && - (Actor_DistanceBetweenActors(&this->picto.actor, explosiveActor) < 80.0f) && + (Actor_WorldDistXYZToActor(&this->picto.actor, explosiveActor) < 80.0f) && (BINANG_ADD(this->picto.actor.shape.rot.y - explosiveActor->world.rot.y, 0x8000) < 0x4000)) { if (this->action != KAIZOKU_ACTION_6) { func_80B87C7C(this); @@ -492,7 +493,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { player->actor.world.pos.z = this->picto.actor.home.pos.z - 30.0f; } - player->actor.speedXZ = 0.0f; + player->actor.speed = 0.0f; this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; Message_StartTextbox(play, D_80B8A8D0[sp54], &this->picto.actor); @@ -505,7 +506,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->subCamUp.x = -0.11f; this->picto.actor.draw = EnKaizoku_Draw; this->unk_598 = 0; - func_801A0238(0, 0xA); + Audio_SetMainBgmVolume(0, 0xA); this->unk_59C++; case 1: @@ -522,7 +523,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_11); this->unk_598 = 0; this->unk_59C++; @@ -531,7 +532,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { break; case 2: - if (this->picto.actor.bgCheckFlags & 1) { + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_2D8 != 0) { this->unk_2D8 = 0; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; @@ -539,7 +540,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { func_800B7298(play, &this->picto.actor, 4); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_ONGND); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ONGND); } if (curFrame >= 11.0f) { @@ -571,10 +572,10 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 4: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->unk_598 = 0; this->unk_59C++; - func_801A0238(0x7F, 0); + Audio_SetMainBgmVolume(0x7F, 0); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_13); } @@ -583,7 +584,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 5: Math_ApproachF(&this->unk_5E0, 2.0f, 0.2f, 1.0f); if (Animation_OnFrame(&this->skelAnime, 20.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_BOSU_SWORD); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_BOSU_SWORD); } if (curFrame >= 30.0f) { this->unk_598 = 0; @@ -612,7 +613,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_59C = 0; this->subCamId = 0; this->picto.actor.flags &= ~ACTOR_FLAG_100000; - this->picto.actor.flags &= ~ACTOR_FLAG_8000000; + this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags |= ACTOR_FLAG_1; func_80B872A4(this); } @@ -681,7 +682,7 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; this->action = KAIZOKU_ACTION_0; this->actionFunc = func_80B868B8; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; } void func_80B868B8(EnKaizoku* this, PlayState* play) { @@ -713,7 +714,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); textId = this->unk_2CA * 4 + this->unk_2C8; Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); this->unk_598 = 0; this->unk_59C++; } @@ -721,7 +722,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { case 2: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_800B7298(play, &this->picto.actor, 6); ActorCutscene_Stop(this->unk_2D6); this->subCamId = 0; @@ -785,15 +786,15 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { case 1: if (this->frameCount <= curFrame) { if (this->unk_2D9 == 0) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); this->unk_2D9 = 1; } else { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_18); func_800B7298(play, &this->picto.actor, 0x85); this->unk_5A0 = 0; @@ -820,7 +821,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { if (this->unk_5A0 == 0x12) { Actor* temp_v0_2; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_SHOUT); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_SHOUT); temp_v0_2 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->picto.actor.world.pos.x, this->picto.actor.world.pos.y + 10.0f, this->picto.actor.world.pos.z, this->picto.actor.shape.rot.x, this->picto.actor.shape.rot.y, @@ -888,7 +889,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { } void func_80B872A4(EnKaizoku* this) { - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_0); this->action = KAIZOKU_ACTION_1; this->actionFunc = func_80B872F4; @@ -928,13 +929,13 @@ void func_80B874D8(EnKaizoku* this, PlayState* play) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); if (Math_SinS(player->actor.shape.rot.y - this->picto.actor.shape.rot.y) > 0.0f) { - this->picto.actor.speedXZ = -10.0f; + this->picto.actor.speed = -10.0f; } else if (Math_SinS(player->actor.shape.rot.y - this->picto.actor.shape.rot.y) < 0.0f) { - this->picto.actor.speedXZ = 10.0f; + this->picto.actor.speed = 10.0f; } else if (Rand_ZeroOne() > 0.5f) { - this->picto.actor.speedXZ = 10.0f; + this->picto.actor.speed = 10.0f; } else { - this->picto.actor.speedXZ = -10.0f; + this->picto.actor.speed = -10.0f; } this->skelAnime.playSpeed = 1.0f; @@ -951,18 +952,18 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { s32 temp_ft1; this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer + 0x3A98; - if ((this->picto.actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->picto.actor, play, this->picto.actor.speedXZ, + if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->picto.actor, play, this->picto.actor.speed, this->picto.actor.shape.rot.y + 0x4000)) { - if (this->picto.actor.bgCheckFlags & 8) { - if (this->picto.actor.speedXZ >= 0.0f) { + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->picto.actor.speed >= 0.0f) { var_v0 = this->picto.actor.shape.rot.y + 0x4000; } else { var_v0 = this->picto.actor.shape.rot.y - 0x4000; } var_v0 = this->picto.actor.wallYaw - var_v0; } else { - this->picto.actor.speedXZ *= -0.8f; + this->picto.actor.speed *= -0.8f; var_v0 = 0; } @@ -989,11 +990,11 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { temp_ft0 = this->skelAnime.curFrame - this->skelAnime.playSpeed; temp_ft1 = this->skelAnime.curFrame + this->skelAnime.playSpeed; if (this->skelAnime.curFrame != 0.0f && ((temp_ft0 < 0 && temp_ft1 > 0) || (temp_ft0 < 5 && temp_ft1 >= 6))) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } if (!(play->gameplayFrames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } if (this->unk_2B2 == 0) { @@ -1006,7 +1007,7 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { } } } else { - if (this->picto.actor.speedXZ >= 0.0f) { + if (this->picto.actor.speed >= 0.0f) { this->picto.actor.shape.rot.y += 0x4000; } else { this->picto.actor.shape.rot.y -= 0x4000; @@ -1021,7 +1022,7 @@ void func_80B87900(EnKaizoku* this) { this->swordState = -1; } this->unk_2D8 = 0; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; this->unk_2B2 = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags |= AC_HARD; this->lookTimer = 12; @@ -1089,9 +1090,9 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { void func_80B87C7C(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); - this->picto.actor.speedXZ = 6.5f; + this->picto.actor.speed = 6.5f; this->picto.actor.velocity.y = 15.0f; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->bodyCollider.info.elemType = ELEMTYPE_UNK4; this->bodyCollider.base.colType = COLTYPE_NONE; @@ -1120,13 +1121,14 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { } this->unk_2D8 = 0; - if ((this->frameCount <= curFrame) && (this->picto.actor.bgCheckFlags & 3)) { + if ((this->frameCount <= curFrame) && + (this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; this->swordCollider.info.elemType = ELEMTYPE_UNK2; this->picto.actor.shape.rot.x = 0; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; this->picto.actor.velocity.y = 0.0f; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; func_80B87F70(this); @@ -1135,8 +1137,8 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { void func_80B87E28(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); - this->picto.actor.speedXZ = -8.0f; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_TEKU_JUMP); + this->picto.actor.speed = -8.0f; + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); this->bodyCollider.info.elemType = ELEMTYPE_UNK4; this->bodyCollider.base.colType = COLTYPE_NONE; this->swordCollider.info.elemType = ELEMTYPE_UNK4; @@ -1158,7 +1160,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { } } if (!(play->state.frames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } } @@ -1166,7 +1168,7 @@ void func_80B87F70(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_9); this->unk_2D0 = 0; this->swordCollider.base.atFlags &= ~AT_BOUNCED; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); this->action = KAIZOKU_ACTION_9; this->actionFunc = func_80B87FDC; @@ -1182,10 +1184,10 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { curFrame = this->skelAnime.curFrame; sp2E = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); sp2C = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); this->swordState = 1; } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) { this->swordState = -1; @@ -1233,9 +1235,9 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { void func_80B88214(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); this->unk_2B2 = 0; - this->picto.actor.speedXZ = 10.0f; + this->picto.actor.speed = 10.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); this->action = KAIZOKU_ACTION_5; this->actionFunc = func_80B88278; } @@ -1245,7 +1247,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; if (this->frameCount <= curFrame) { - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; @@ -1254,7 +1256,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { } } if (!(play->gameplayFrames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } } @@ -1274,11 +1276,11 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x2EE, 0); this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; if (this->picto.actor.xzDistToPlayer <= 40.0f) { - Math_ApproachF(&this->picto.actor.speedXZ, -8.0f, 1.0f, 1.5f); + Math_ApproachF(&this->picto.actor.speed, -8.0f, 1.0f, 1.5f); } else if (this->picto.actor.xzDistToPlayer > 55.0f) { - Math_ApproachF(&this->picto.actor.speedXZ, 8.0f, 1.0f, 1.5f); + Math_ApproachF(&this->picto.actor.speed, 8.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->picto.actor.speedXZ, 2.0f, 6.65f); + Math_ApproachZeroF(&this->picto.actor.speed, 2.0f, 6.65f); } this->skelAnime.playSpeed = 1.0f; @@ -1325,11 +1327,11 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } if (!(play->gameplayFrames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } if ((this->skelAnime.curFrame != 0.0f) && ((sp30 < 0 && sp2C > 0) || (sp30 < 4 && sp2C >= 5))) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } } @@ -1364,7 +1366,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { } } if (!(play->gameplayFrames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } } } @@ -1375,7 +1377,7 @@ void func_80B88910(EnKaizoku* this) { this->unk_2D0 = 0; this->action = KAIZOKU_ACTION_11; this->actionFunc = func_80B88964; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; } void func_80B88964(EnKaizoku* this, PlayState* play) { @@ -1400,10 +1402,10 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0); Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0); this->swordState = 1; - this->picto.actor.speedXZ = 10.0f; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); + this->picto.actor.speed = 10.0f; + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK); } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) { - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; } else if (Animation_OnFrame(&this->skelAnime, 24.0f)) { this->swordState = -1; } @@ -1453,7 +1455,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { void func_80B88CD8(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); - this->picto.actor.speedXZ = randPlusMinusPoint5Scaled(12.0f); + this->picto.actor.speed = randPlusMinusPoint5Scaled(12.0f); this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->unk_2B2 = Rand_ZeroOne() * 30.0f + 30.0f; @@ -1474,39 +1476,39 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y + 0x4000; sp2A = player->actor.shape.rot.y + 0x8000; if (Math_SinS(sp2A - this->picto.actor.shape.rot.y) >= 0.0f) { - this->picto.actor.speedXZ -= 0.25f; - if (this->picto.actor.speedXZ < -8.0f) { - this->picto.actor.speedXZ = -8.0f; + this->picto.actor.speed -= 0.25f; + if (this->picto.actor.speed < -8.0f) { + this->picto.actor.speed = -8.0f; } } else if (Math_SinS((sp2A - this->picto.actor.shape.rot.y)) < 0.0f) { - this->picto.actor.speedXZ += 0.25f; - if (this->picto.actor.speedXZ > 8.0f) { - this->picto.actor.speedXZ = 8.0f; + this->picto.actor.speed += 0.25f; + if (this->picto.actor.speed > 8.0f) { + this->picto.actor.speed = 8.0f; } } - if ((this->picto.actor.bgCheckFlags & 8) || - !Actor_TestFloorInDirection(&this->picto.actor, play, this->picto.actor.speedXZ, + if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->picto.actor, play, this->picto.actor.speed, this->picto.actor.shape.rot.y + 0x4000)) { - if (this->picto.actor.bgCheckFlags & 8) { - if (this->picto.actor.speedXZ >= 0.0f) { + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->picto.actor.speed >= 0.0f) { yaw = this->picto.actor.shape.rot.y + 0x4000; } else { yaw = this->picto.actor.shape.rot.y - 0x4000; } yaw = this->picto.actor.wallYaw - yaw; } else { - this->picto.actor.speedXZ *= -0.8f; + this->picto.actor.speed *= -0.8f; yaw = 0; } if (ABS_ALT(yaw) > 0x4000) { - this->picto.actor.speedXZ *= -0.8f; - if (this->picto.actor.speedXZ < 0.0f) { - this->picto.actor.speedXZ -= 0.5f; + this->picto.actor.speed *= -0.8f; + if (this->picto.actor.speed < 0.0f) { + this->picto.actor.speed -= 0.5f; } else { - this->picto.actor.speedXZ += 0.5f; + this->picto.actor.speed += 0.5f; } } } @@ -1528,12 +1530,12 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { temp_ft5 = this->skelAnime.curFrame + this->skelAnime.playSpeed; if (this->skelAnime.curFrame != 0.0f) { if (((temp_ft4 < 0 && temp_ft5 > 0) || (temp_ft4 < 5 && temp_ft5 > 5))) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } if (!(play->gameplayFrames & 0x5F)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } if (this->picto.actor.xzDistToPlayer <= 65.0f) { @@ -1550,8 +1552,8 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { // EnKaizoku_SetupStunned void func_80B891B8(EnKaizoku* this) { - if (this->picto.actor.bgCheckFlags & 1) { - this->picto.actor.speedXZ = 0.0f; + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->picto.actor.speed = 0.0f; } if (this->action == KAIZOKU_ACTION_11) { @@ -1565,7 +1567,7 @@ void func_80B891B8(EnKaizoku* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_COMMON_FREEZE); this->unk_2D8 = 1; if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && @@ -1585,18 +1587,18 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { } } - if (this->picto.actor.bgCheckFlags & 2) { - this->picto.actor.speedXZ = 0.0f; + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->picto.actor.speed = 0.0f; } - if (this->picto.actor.bgCheckFlags & 1) { - if (this->picto.actor.speedXZ < 0.0f) { - this->picto.actor.speedXZ += 0.05f; + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->picto.actor.speed < 0.0f) { + this->picto.actor.speed += 0.05f; } } if ((this->unk_2B6 == 0) && (this->unk_2B8 == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && - (this->picto.actor.bgCheckFlags & 1)) { + (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_2D8 = 0; func_80B85A00(this, play, true); @@ -1619,7 +1621,7 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_3C4, &sp34); this->lookTimer = 0; this->unk_2D8 = 0; - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_5); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1632,7 +1634,7 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { this->picto.actor.flags |= ACTOR_FLAG_400; } - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_DAMAGE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMAGE); this->action = KAIZOKU_ACTION_14; this->actionFunc = func_80B894C0; } @@ -1644,7 +1646,7 @@ void func_80B894C0(EnKaizoku* this, PlayState* play) { if (!func_80B85858(this, play) && !func_80B85A00(this, play, false) && (this->unk_3C4.x < 1.0f) && (this->unk_3C4.z < 1.0f)) { temp_v0 = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; - if (this->picto.actor.bgCheckFlags & 8) { + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS_ALT(temp_v0) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { func_80B87C7C(this); return; @@ -1674,12 +1676,12 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { (this->unk_2B8 == 0)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - this->picto.actor.speedXZ = 0.0f; + this->picto.actor.speed = 0.0f; this->unk_2D8 = 1; func_800B7298(play, &this->picto.actor, 0x7B); Enemy_StartFinishingBlow(play, &this->picto.actor); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); - this->picto.actor.flags |= ACTOR_FLAG_8000000; + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); + this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags &= ~ACTOR_FLAG_1; this->picto.actor.flags &= ~ACTOR_FLAG_400; this->unk_598 = 0; @@ -1692,12 +1694,12 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Player* player; - if (this->picto.actor.bgCheckFlags & 2) { - this->picto.actor.speedXZ = 0.0f; + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->picto.actor.speed = 0.0f; } - if (this->picto.actor.bgCheckFlags & 1) { - Math_SmoothStepToF(&this->picto.actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Math_SmoothStepToF(&this->picto.actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); } if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1753,7 +1755,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; func_80B86B58(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); } } @@ -1809,7 +1811,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } } - if ((this->picto.actor.bgCheckFlags & 8) && (this->picto.actor.wallBgId != BG_ACTOR_MAX) && + if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->picto.actor.wallBgId != BG_ACTOR_MAX) && ((this->action == KAIZOKU_ACTION_2) || (this->action == KAIZOKU_ACTION_3) || (this->action == KAIZOKU_ACTION_4) || (this->action == KAIZOKU_ACTION_1))) { func_80B87F70(this); @@ -1834,7 +1836,8 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || this->unk_2B8 == 0) { - Actor_SetColorFilter(&this->picto.actor, 0, 120, 0, 40); + Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, + 40); this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; this->swordCollider.info.elemType = ELEMTYPE_UNK2; @@ -1906,7 +1909,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } if (sp64) { - Actor_SetColorFilter(&this->picto.actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ApplyDamage(&this->picto.actor); if (this->picto.actor.colChkInfo.health <= 0) { func_80B8960C(this, play); @@ -1940,7 +1943,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } this->bodyCollider.base.acFlags &= ~AC_HIT; - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_IT_SHIELD_BOUND); + Actor_PlaySfx(&this->picto.actor, NA_SE_IT_SHIELD_BOUND); EffectSsHitmark_SpawnFixedScale(play, 3, &pos); CollisionCheck_SpawnShieldParticlesMetal(play, &pos); } @@ -2015,7 +2018,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { } } - if (this->picto.actor.bgCheckFlags & 1) { + if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Matrix_RotateYS(this->picto.actor.shape.rot.y + this->unk_2F4, 0); Matrix_MultVecZ(this->unk_2F0, &sp34); this->picto.actor.world.pos.x += this->unk_3C4.x + sp34.x; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 3ef617aec..d35e767c0 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -210,24 +210,24 @@ s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { void EnKakasi_CheckAnimationSfx(EnKakasi* this) { if (this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING || this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL) { if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } if (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR || this->animIndex == ENKAKASI_ANIM_SLOWROLL) { if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 9.0f) || Animation_OnFrame(&this->skelanime, 16.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); + Actor_PlaySfx(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); } if (Animation_OnFrame(&this->skelanime, 18.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } if (this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER || this->animIndex == ENKAKASI_ANIM_TWIRL) { if (Animation_OnFrame(&this->skelanime, 1.0f)) { - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); + Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } } } @@ -414,7 +414,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } if ((this->talkState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (this->talkState == TEXT_STATE_5) { // bad song input if (this->unkState196 == 2 && this->picto.actor.textId == 0x1647) { @@ -440,7 +440,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->picto.actor.textId = 0x1645; } - func_80151938(play, this->picto.actor.textId); + Message_ContinueTextbox(play, this->picto.actor.textId); return; } else if (this->picto.actor.textId == 0x165D || this->picto.actor.textId == 0x165F || @@ -538,7 +538,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } } } - func_80151938(play, this->picto.actor.textId); + Message_ContinueTextbox(play, this->picto.actor.textId); } } @@ -620,7 +620,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { this->unk190 = 0; this->unkCounter1A4 = 0; ActorCutscene_Stop(this->actorCutscenes[0]); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_YASE_DEAD); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; this->subCamId = SUB_CAM_ID_DONE; @@ -674,7 +674,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&player->actor.shape.rot.y, this->picto.actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); if (this->unk190 == 0) { - func_801477B4(play); + Message_CloseTextbox(play); func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_86); this->picto.actor.textId = 0x1648; Message_StartTextbox(play, (this->picto.actor.textId), &this->picto.actor); @@ -735,7 +735,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { if ((this->unkState1A8 != 0) && (Message_GetState(&play->msgCtx) == this->talkState) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (this->talkState == TEXT_STATE_5) { this->unk190++; @@ -778,7 +778,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->picto.actor.textId = 0x1661; } } - func_80151938(play, this->picto.actor.textId); + Message_ContinueTextbox(play, this->picto.actor.textId); } } @@ -800,7 +800,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { - func_801A2BB8(NA_BGM_SARIAS_SONG); + Audio_PlaySubBgm(NA_BGM_SARIAS_SONG); EnKakasi_SetupDanceNightAway(this); } } @@ -934,7 +934,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { func_80169EFC(&play->state); //! FAKE - if (0) {} + if (1) {} if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { gSaveContext.save.time = CLOCK_TIME(6, 0); @@ -1007,7 +1007,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { } else { Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, this->picto.actor.shape.shadowScale - 20.0f, 5, 4.0f, 200, 10, 1); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } } @@ -1025,7 +1025,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { void EnKakasi_SetupIdleUnderground(EnKakasi* this) { this->picto.actor.shape.yOffset = -7000.0; this->picto.actor.draw = NULL; - this->picto.actor.flags |= ACTOR_FLAG_8000000; + this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->unkState196 = 5; this->actionFunc = EnKakasi_IdleUnderground; } @@ -1033,7 +1033,7 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && this->picto.actor.xzDistToPlayer < this->songSummonDist && (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { - this->picto.actor.flags &= ~ACTOR_FLAG_8000000; + this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; play->msgCtx.ocarinaMode = 4; this->actionFunc = EnKakasi_SetupRiseOutOfGround; } @@ -1056,7 +1056,7 @@ void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->picto.actor); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); this->picto.actor.draw = EnKakasi_Draw; this->unkState196 = 6; this->actionFunc = EnKakasi_RisingOutOfGround; @@ -1073,7 +1073,7 @@ void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { if ((play->gameplayFrames % 8) == 0) { Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, this->picto.actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); - Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } Math_ApproachF(&this->picto.actor.shape.yOffset, 0.0f, 0.5f, 200.0f); } else { @@ -1102,7 +1102,7 @@ void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); EnKakasi_SetupIdleRisen(this); } } diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index 6e021186f..b508adecf 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -170,7 +170,7 @@ void func_80AD6F9C(EnKame* this) { this->collider.base.colType = COLTYPE_HIT3; this->unk_2A2 = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_80AD7018(EnKame* this, PlayState* play) { @@ -185,7 +185,7 @@ void func_80AD7018(EnKame* this, PlayState* play) { void func_80AD70A0(EnKame* this) { Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_004210, -5.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80AD70EC; } @@ -193,7 +193,7 @@ void func_80AD70EC(EnKame* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Animation_OnFrame(&this->skelAnime1, 10.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_VOICE); this->unk_2A0 = 40; } @@ -207,7 +207,7 @@ void func_80AD70EC(EnKame* this, PlayState* play) { void func_80AD71B4(EnKame* this) { Animation_MorphToLoop(&this->skelAnime1, &object_tl_Anim_00823C, -5.0f); - this->actor.speedXZ = 0.5f; + this->actor.speed = 0.5f; this->unk_29E = Animation_GetLastFrame(&object_tl_Anim_00823C) * ((s32)Rand_ZeroFloat(5.0f) + 3); this->unk_2A4 = this->actor.shape.rot.y; this->collider.base.acFlags |= (AC_HARD | AC_ON); @@ -229,15 +229,15 @@ void func_80AD7254(EnKame* this, PlayState* play) { if (this->unk_2A4 != this->actor.shape.rot.y) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_2A4, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 40.0f) { - this->unk_2A4 = Actor_YawToPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 40.0f) { + this->unk_2A4 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); } this->unk_29E--; if (this->unk_29E == 0) { func_80AD70A0(this); } else if (Animation_OnFrame(&this->skelAnime1, 0.0f) || Animation_OnFrame(&this->skelAnime1, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_WALK); } } @@ -246,9 +246,9 @@ void func_80AD73A8(EnKame* this) { this->unk_29E = 0; this->unk_2AC = 1.0f; this->unk_2A8 = 1.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_2A0 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_VOICE); } this->actionFunc = func_80AD7424; } @@ -278,7 +278,7 @@ void func_80AD7424(EnKame* this, PlayState* play) { } void func_80AD7568(EnKame* this) { - this->actor.speedXZ = this->unk_2A6 * (5.0f / 7552); + this->actor.speed = this->unk_2A6 * (5.0f / 7552); this->actor.shape.rot.z = this->unk_2A6 * 0.11016949f; } @@ -287,7 +287,7 @@ void func_80AD75A8(EnKame* this, PlayState* play) { static Color_RGBA8 D_80AD8E58 = { 180, 180, 180, 255 }; static Vec3f D_80AD8E5C = { 0.0f, 0.75f, 0.0f }; - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ >= 3.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed >= 3.0f)) { if ((play->gameplayFrames % 2) == 0) { u32 temp_v0 = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -312,11 +312,11 @@ void func_80AD76CC(EnKame* this) { this->unk_2AC = 0.5f; func_80AD7568(this); this->unk_29E = 15; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); this->unk_2BC.y = this->actor.home.pos.y - 100.0f; } else { - this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); Math_Vec3f_Copy(&this->unk_2BC, &this->actor.home.pos); this->unk_29E = 0; } @@ -363,12 +363,12 @@ void func_80AD7948(EnKame* this, PlayState* play) { func_80AD75A8(this, play); if (this->unk_29E == -1) { - s16 temp_v0 = Actor_YawToPoint(&this->actor, &this->unk_2BC) - this->actor.world.rot.y; + s16 temp_v0 = Actor_WorldYawTowardPoint(&this->actor, &this->unk_2BC) - this->actor.world.rot.y; temp_v1 = ABS_ALT(temp_v0); - if ((this->actor.bgCheckFlags & 8) || (temp_v1 > 0x3000) || - (Actor_XZDistanceToPoint(&this->actor, &this->unk_2BC) < 50.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (temp_v1 > 0x3000) || + (Actor_WorldDistXZToPoint(&this->actor, &this->unk_2BC) < 50.0f)) { s8 pad; if (this->unk_2BC.y < this->actor.home.pos.y) { @@ -383,7 +383,7 @@ void func_80AD7948(EnKame* this, PlayState* play) { if (Math_ScaledStepToS(&this->unk_2A6, this->unk_29E, (s32)(this->unk_2A6 * 0.09f) + 45)) { if (this->unk_29E == 0) { if (this->unk_2AC >= 1.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); } this->unk_2AC -= 0.1f; this->collider.base.atFlags &= ~AT_ON; @@ -401,7 +401,7 @@ void func_80AD7948(EnKame* this, PlayState* play) { void func_80AD7B18(EnKame* this) { this->actor.draw = EnKame_Draw; Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_0031DC, -3.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2AC = 0.1f; this->unk_2A8 = 1.0f; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -434,13 +434,13 @@ void func_80AD7C54(EnKame* this) { } this->actor.draw = EnKame_Draw; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->collider.base.acFlags &= ~AC_ON; this->collider.base.atFlags &= ~AT_ON; this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); this->actor.flags &= ~ACTOR_FLAG_10; this->actor.shape.rot.z = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_REVERSE); this->actionFunc = func_80AD7D40; } @@ -460,7 +460,7 @@ void func_80AD7DA4(EnKame* this) { this->collider.base.acFlags |= AC_ON; this->collider.base.acFlags &= ~AC_HARD; this->collider.base.colType = COLTYPE_HIT6; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80AD7E0C; } @@ -472,7 +472,7 @@ void func_80AD7E0C(EnKame* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime1, &object_tl_Anim_0027D8); } else { Animation_PlayOnce(&this->skelAnime1, &object_tl_Anim_002F88); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_ROAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_ROAR); } } } else { @@ -482,7 +482,7 @@ void func_80AD7E0C(EnKame* this, PlayState* play) { void func_80AD7EC0(EnKame* this) { Animation_MorphToPlayOnce(&this->skelAnime1, &object_tl_Anim_002510, -3.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_WAKEUP); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_WAKEUP); this->actionFunc = func_80AD7F10; } @@ -498,7 +498,7 @@ void func_80AD7F10(EnKame* this, PlayState* play) { } void func_80AD7FA4(EnKame* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -523,11 +523,11 @@ void func_80AD7FF8(EnKame* this, PlayState* play) { } void func_80AD8060(EnKame* this) { - s16 sp36 = Animation_GetLastFrame(&object_tl_Anim_0008B4); + s16 lastFrame = Animation_GetLastFrame(&object_tl_Anim_0008B4); - Animation_Change(&this->skelAnime1, &object_tl_Anim_0008B4, 1.0f, 0.0f, sp36, ANIMMODE_ONCE, -3.0f); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, sp36); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_DAMAGE); + Animation_Change(&this->skelAnime1, &object_tl_Anim_0008B4, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -3.0f); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, lastFrame); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DAMAGE); this->collider.base.acFlags &= ~AC_ON; this->actionFunc = func_80AD810C; } @@ -540,12 +540,12 @@ void func_80AD810C(EnKame* this, PlayState* play) { void func_80AD8148(EnKame* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime1, &object_tl_Anim_000AF4); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); this->collider.base.acFlags &= ~AC_ON; this->collider.base.atFlags &= ~AT_ON; this->collider.base.atFlags &= ~(AC_HARD | AC_HIT); this->actor.velocity.y = 15.0f; - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; if (play != NULL) { Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.draw == func_80AD8D64) { @@ -554,24 +554,24 @@ void func_80AD8148(EnKame* this, PlayState* play) { func_800BE504(&this->actor, &this->collider); } } - this->actor.bgCheckFlags &= ~0x1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DEAD); this->unk_29E = 0; this->actionFunc = func_80AD825C; } void func_80AD825C(EnKame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime1); - if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y < 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y < 0.0f)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_LAND); func_80AD8364(this); } else { if (this->unk_29E == 1) { this->actor.colorFilterTimer = 100; } else if (this->actor.colorFilterTimer == 0) { - Actor_SetColorFilter(&this->actor, 0xC000, 255, 0, 100); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_NONE, 255, COLORFILTER_BUFFLAG_OPA, 100); } this->actor.shape.rot.x += Rand_S16Offset(0x700, 0x1400); this->actor.shape.rot.y += (s16)Rand_ZeroFloat(5120.0f); @@ -581,7 +581,7 @@ void func_80AD825C(EnKame* this, PlayState* play) { void func_80AD8364(EnKame* this) { this->unk_29E = 20; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80AD8388; } @@ -643,16 +643,16 @@ void func_80AD84C0(EnKame* this, PlayState* play) { } else if (!(this->collider.base.acFlags & AC_HARD)) { if (this->actor.colChkInfo.damageEffect == 5) { this->unk_2A2 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffScale = 0.6f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; func_80AD7FA4(this); } else if (this->actor.colChkInfo.damageEffect == 1) { this->unk_2A2 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_80AD7FA4(this); } else if (this->actor.colChkInfo.damageEffect == 3) { func_80AD6F9C(this); @@ -706,7 +706,7 @@ void EnKame_Update(Actor* thisx, PlayState* play) { if ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.atFlags & AT_BOUNCED)) { this->collider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); func_80AD76CC(this); - if (Actor_XZDistanceToPoint(&this->actor, &this->unk_2BC) < 50.0f) { + if (Actor_WorldDistXZToPoint(&this->actor, &this->unk_2BC) < 50.0f) { this->collider.base.atFlags &= ~AT_ON; } this->unk_2A6 = 0x3B00; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 54df1bcd7..ba1cf165c 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -359,10 +359,10 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { if ((hitItem->toucher.dmgFlags & 0x10) || (hitItem->toucher.dmgFlags & 8) || (hitItem->toucher.dmgFlags & 0x80000000)) { piece->actor.velocity.y = Rand_ZeroFloat(3.0f) + 6.0f; - piece->actor.speedXZ = Rand_ZeroFloat(4.0f) + 6.0f; + piece->actor.speed = Rand_ZeroFloat(4.0f) + 6.0f; } else { piece->actor.velocity.y = Rand_ZeroFloat(2.0f) + 3.0f; - piece->actor.speedXZ = Rand_ZeroFloat(2.0f) + 3.0f; + piece->actor.speed = Rand_ZeroFloat(2.0f) + 3.0f; } if (piece->partCount >= 4) { @@ -384,7 +384,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { piece->actor.flags &= ~ACTOR_FLAG_1; piece->actor.flags |= ACTOR_FLAG_2000000; this->cutMarkTimer = 5; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SWORD_STRIKE); + Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_STRIKE); } } } @@ -423,7 +423,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { f32 tempY; f32 tempZ; f32 tempWaterDepth; - u16 tempBgFlags; + u16 bgCheckFlags; u8 onGround; if (this->unk_198 != 0) { @@ -438,7 +438,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { tempX = this->actor.world.pos.x; tempY = this->actor.world.pos.y; tempZ = this->actor.world.pos.z; - tempBgFlags = this->actor.bgCheckFlags; + bgCheckFlags = this->actor.bgCheckFlags; tempWaterDepth = this->actor.depthInWater; this->actor.world.pos.z += ((this->actor.world.pos.y - this->actor.floorHeight) * -50.0f) / 100.0f; @@ -448,12 +448,12 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->actor.world.pos.x = tempX; this->actor.world.pos.y = tempY; this->actor.world.pos.z = tempZ; - this->actor.bgCheckFlags = tempBgFlags; + this->actor.bgCheckFlags = bgCheckFlags; this->actor.depthInWater = tempWaterDepth; if (1) {} - onGround = (this->actor.bgCheckFlags & 1); + onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); if (this->spinXFlag != 0) { this->spinRot.x += this->spinVel.x; @@ -495,16 +495,16 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->spinVel.z = -0xC00; } - if (this->actor.bgCheckFlags & 8) { - if (!(this->actor.bgCheckFlags & 1)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); } - this->actor.speedXZ *= -0.5f; + this->actor.speed *= -0.5f; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { this->actionState = ENKANBAN_WATER; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->bounceX = this->bounceZ = 0; this->actor.world.pos.y += this->actor.depthInWater; EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); @@ -539,12 +539,12 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { if (this->unk_197 != 0) { if (this->unk_197 > 0) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if ((this->floorRot.x > 0.1f) || (this->floorRot.z > 0.1f)) { this->airTimer = 10; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actionState = ENKANBAN_GROUND; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; goto nextCase; } else { Vec3f spC8; @@ -556,14 +556,14 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { Math_ApproachF(&this->actor.velocity.z, spC8.z, 0.5f, (KREG(21) * 0.01f) + 0.3f); this->actor.world.rot.y = Math_Atan2S(spC8.x, spC8.z); this->unk_198 = 1; - this->actor.speedXZ = sqrtf(SQXZ(this->actor.velocity)); + this->actor.speed = sqrtf(SQXZ(this->actor.velocity)); } } else { this->unk_198 = 0; - Math_ApproachZeroF(&this->actor.speedXZ, 1, 0.1f); + Math_ApproachZeroF(&this->actor.speed, 1, 0.1f); } } else { - this->actor.speedXZ *= 0.7f; + this->actor.speed *= 0.7f; } if (this->spinRot.x == 0) { @@ -622,9 +622,9 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { if (bounced) { if (this->unk_197 > 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_SNOW); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SNOW); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); } } @@ -687,38 +687,38 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { s16 rippleDelay; s32 rippleScale; - if ((player->actor.speedXZ > 0.0f) && (player->actor.world.pos.y < this->actor.world.pos.y) && + if ((player->actor.speed > 0.0f) && (player->actor.world.pos.y < this->actor.world.pos.y) && (this->actor.xyzDistToPlayerSq < SQ(50.0f))) { - Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 1.0f, 0.2f); - if (this->actor.speedXZ > 1.0f) { - this->actor.speedXZ = 1.0f; + Math_ApproachF(&this->actor.speed, player->actor.speed, 1.0f, 0.2f); + if (this->actor.speed > 1.0f) { + this->actor.speed = 1.0f; } if (Math_SmoothStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 1, 0x1000, 0) > 0) { - this->spinVel.y = this->actor.speedXZ * 1000.0f; + this->spinVel.y = this->actor.speed * 1000.0f; } else { - this->spinVel.y = this->actor.speedXZ * -1000.0f; + this->spinVel.y = this->actor.speed * -1000.0f; } } - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } Actor_MoveWithGravity(&this->actor); - if (this->actor.speedXZ != 0.0f) { + if (this->actor.speed != 0.0f) { Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 5); - if (this->actor.bgCheckFlags & 8) { - this->actor.speedXZ *= -0.5f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed *= -0.5f; if (this->spinVel.y > 0) { this->spinVel.y = -2000; } else { this->spinVel.y = 2000; } } - Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.15f); + Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.15f); } this->actor.shape.rot.y += this->spinVel.y; Math_ApproachS(&this->spinVel.y, 0, 1, 0x3A); @@ -728,9 +728,9 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { Math_ApproachZeroF(&this->floorRot.x, 0.5f, 0.2f); Math_ApproachZeroF(&this->floorRot.z, 0.5f, 0.2f); - if (fabsf(this->actor.speedXZ) > 1.0f) { + if (fabsf(this->actor.speed) > 1.0f) { rippleDelay = 0; - } else if (fabsf(this->actor.speedXZ) > 0.5f) { + } else if (fabsf(this->actor.speed) > 0.5f) { rippleDelay = 3; } else { rippleDelay = 7; @@ -756,12 +756,12 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->bounceX = Rand_ZeroFloat(10.0f) + 6.0f; this->bounceZ = Rand_ZeroFloat(10.0f) + 6.0f; this->actor.velocity.y = 2.0f + hammerStrength; - this->actor.speedXZ = Rand_ZeroFloat(1.0f); + this->actor.speed = Rand_ZeroFloat(1.0f); } else { this->bounceX = Rand_ZeroFloat(7.0f) + 3.0f; this->bounceZ = Rand_ZeroFloat(7.0f) + 3.0f; this->actor.velocity.y = 3.0f + hammerStrength; - this->actor.speedXZ = Rand_ZeroFloat(1.5f); + this->actor.speed = Rand_ZeroFloat(1.5f); } this->spinVel.y = randPlusMinusPoint5Scaled(0x1800); @@ -801,12 +801,12 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { this->bounceX = Rand_ZeroFloat(10.0f) + 6.0f; this->bounceZ = Rand_ZeroFloat(10.0f) + 6.0f; this->actor.velocity.y = 2.5f + bombStrength; - this->actor.speedXZ = 3.0f + bombStrength; + this->actor.speed = 3.0f + bombStrength; } else { this->bounceX = Rand_ZeroFloat(7.0f) + 3.0f; this->bounceZ = Rand_ZeroFloat(7.0f) + 3.0f; this->actor.velocity.y = 5.0f + bombStrength; - this->actor.speedXZ = 4.0f + bombStrength; + this->actor.speed = 4.0f + bombStrength; } this->spinVel.y = randPlusMinusPoint5Scaled(0x1800); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 46ad2c30b..80e5ca0fc 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -1,13 +1,12 @@ /* * File: z_en_karebaba.c * Overlay: ovl_En_Karebaba - * Description: Wilted Deku Baba + * Description: Wilted Deku Baba and Mini Baba */ #include "z_en_karebaba.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_dekubaba/object_dekubaba.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -18,27 +17,26 @@ void EnKarebaba_Destroy(Actor* thisx, PlayState* play); void EnKarebaba_Update(Actor* thisx, PlayState* play2); void EnKarebaba_Draw(Actor* thisx, PlayState* play); -void func_808F155C(EnKarebaba* this); -void func_808F15B0(EnKarebaba* this, PlayState* play); -void func_808F1648(EnKarebaba* this); -void func_808F169C(EnKarebaba* this, PlayState* play); -void func_808F16FC(EnKarebaba* this); -void func_808F1778(EnKarebaba* this, PlayState* play); -void func_808F1878(EnKarebaba* this); -void func_808F190C(EnKarebaba* this, PlayState* play); -void func_808F1A3C(EnKarebaba* this); -void func_808F1A58(EnKarebaba* this, PlayState* play); -void func_808F1BF8(EnKarebaba* this); -void func_808F1C84(EnKarebaba* this, PlayState* play); -void func_808F1FAC(EnKarebaba* this); -void func_808F200C(EnKarebaba* this, PlayState* play); -void func_808F20FC(EnKarebaba* this, PlayState* play); -void func_808F21A4(EnKarebaba* this, PlayState* play); -void func_808F220C(EnKarebaba* this); -void func_808F228C(EnKarebaba* this, PlayState* play); -void func_808F238C(EnKarebaba* this); -void func_808F241C(EnKarebaba* this, PlayState* play); -void func_808F254C(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupGrow(EnKarebaba* this); +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupIdle(EnKarebaba* this); +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupAwaken(EnKarebaba* this); +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupUpright(EnKarebaba* this); +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupSpin(EnKarebaba* this); +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupDying(EnKarebaba* this); +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupShrinkDie(EnKarebaba* this); +void EnKarebaba_ShrinkDie(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, PlayState* play); +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupRetract(EnKarebaba* this); +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play); +void EnKarebaba_SetupDead(EnKarebaba* this); +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play); ActorInit En_Karebaba_InitVars = { ACTOR_EN_KAREBABA, @@ -52,7 +50,7 @@ ActorInit En_Karebaba_InitVars = { (ActorFunc)EnKarebaba_Draw, }; -static ColliderCylinderInit sCylinderInit1 = { +static ColliderCylinderInit sHurtCylinderInit = { { COLTYPE_HARD, AT_NONE, @@ -72,7 +70,7 @@ static ColliderCylinderInit sCylinderInit1 = { { 7, 25, 0, { 0, 0, 0 } }, }; -static ColliderCylinderInit sCylinderInit2 = { +static ColliderCylinderInit sAttackCylinderInit = { { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, @@ -94,39 +92,47 @@ static ColliderCylinderInit sCylinderInit2 = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 80, MASS_HEAVY }; +typedef enum { + /* 0x0 */ KAREBABA_DMGEFF_NONE, + /* 0x2 */ KAREBABA_DMGEFF_FIRE = 2, + /* 0x3 */ KAREBABA_DMGEFF_ICE, + /* 0x4 */ KAREBABA_DMGEFF_LIGHT, + /* 0x5 */ KAREBABA_DMGEFF_ELECTRIC, +} DekuBabaDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x0), - /* Deku Stick */ DMG_ENTRY(3, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0x0), - /* Goron punch */ DMG_ENTRY(2, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(1, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), - /* Zora barrier */ DMG_ENTRY(1, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), + /* Deku Nut */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Deku Stick */ DMG_ENTRY(3, KAREBABA_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(2, KAREBABA_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(1, KAREBABA_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, KAREBABA_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, KAREBABA_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, KAREBABA_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Zora barrier */ DMG_ENTRY(1, KAREBABA_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, KAREBABA_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, KAREBABA_DMGEFF_NONE), }; static InitChainEntry sInitChain[] = { @@ -134,444 +140,441 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 1, ICHAIN_STOP), }; -Color_RGBA8 D_808F2E28 = { 0, 0, 0, 0 }; - -Gfx* D_808F2E2C[] = { object_dekubaba_DL_001330, object_dekubaba_DL_001628, object_dekubaba_DL_001828 }; - void EnKarebaba_Init(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, - this->morphTable, 8); + SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, + DEKUBABA_LIMB_MAX); - Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit1); - Collider_UpdateCylinder(&this->actor, &this->collider2); - Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit2); - Collider_UpdateCylinder(&this->actor, &this->collider1); + Collider_InitAndSetCylinder(play, &this->hurtCollider, &this->actor, &sHurtCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->hurtCollider); + Collider_InitAndSetCylinder(play, &this->attackCollider, &this->actor, &sAttackCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->attackCollider); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->unk_22C = NULL; - if (this->actor.params == ENKAREBABA_2) { + this->boundFloor = NULL; + if (this->actor.params == KAREBABA_MINI) { this->actor.hintId = TATL_HINT_ID_MINI_BABA; } else { this->actor.hintId = TATL_HINT_ID_WILTED_DEKU_BABA; } if (this->actor.params == ENKAREBABA_0) { - func_808F155C(this); + EnKarebaba_SetupGrow(this); } else { - func_808F1648(this); + EnKarebaba_SetupIdle(this); } } void EnKarebaba_Destroy(Actor* thisx, PlayState* play) { EnKarebaba* this = THIS; - Collider_DestroyCylinder(play, &this->collider2); - Collider_DestroyCylinder(play, &this->collider1); + Collider_DestroyCylinder(play, &this->hurtCollider); + Collider_DestroyCylinder(play, &this->attackCollider); } -void func_808F1374(EnKarebaba* this, PlayState* play) { - s32 phi_a3; +void EnKarebaba_SpawnIceEffects(EnKarebaba* this, PlayState* play) { + s32 limbPosCount; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - if (this->actor.params == ENKAREBABA_2) { - phi_a3 = 1; + + if (this->actor.params == KAREBABA_MINI) { + limbPosCount = 1; } else { - phi_a3 = 4; + limbPosCount = 4; } - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, phi_a3, 4, 0.3f, 0.2f); + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, limbPosCount, 4, 0.3f, 0.2f); } } -void func_808F13FC(EnKarebaba* this, PlayState* play) { - if (this->actor.colChkInfo.damageEffect == 2) { +void EnKarebaba_SetDamageEffects(EnKarebaba* this, PlayState* play) { + if (this->actor.colChkInfo.damageEffect == KAREBABA_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 3.0f; - } else if (this->actor.colChkInfo.damageEffect == 4) { + } else if (this->actor.colChkInfo.damageEffect == KAREBABA_DMGEFF_LIGHT) { this->drawDmgEffScale = 0.75f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 3.0f; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider2.info.bumper.hitPos.x, - this->collider2.info.bumper.hitPos.y, this->collider2.info.bumper.hitPos.z, 0, 0, 0, + + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->hurtCollider.info.bumper.hitPos.x, + this->hurtCollider.info.bumper.hitPos.y, this->hurtCollider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); - } else if (this->actor.colChkInfo.damageEffect == 3) { + } else if (this->actor.colChkInfo.damageEffect == KAREBABA_DMGEFF_ICE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffFrozenSteamScale = 1.125f; - } else if (this->actor.colChkInfo.damageEffect == 5) { + } else if (this->actor.colChkInfo.damageEffect == KAREBABA_DMGEFF_ELECTRIC) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 3.0f; } } -void func_808F152C(EnKarebaba* this) { - this->collider2.dim.radius = 7; - this->collider2.dim.height = 25; - this->collider2.base.colType = COLTYPE_HARD; - this->collider2.base.acFlags |= AC_HARD; - this->collider1.dim.height = 25; +void EnKarebaba_ResetColliders(EnKarebaba* this) { + this->hurtCollider.dim.radius = 7; + this->hurtCollider.dim.height = 25; + this->hurtCollider.base.colType = COLTYPE_HARD; + this->hurtCollider.base.acFlags |= AC_HARD; + this->attackCollider.dim.height = 25; } -void func_808F155C(EnKarebaba* this) { +void EnKarebaba_SetupGrow(EnKarebaba* this) { Actor_SetScale(&this->actor, 0.0f); this->actor.shape.rot.x = -0x4000; - this->unk_1EE = 0; + this->timer = 0; this->actor.world.pos.y = this->actor.home.pos.y + 14.0f; - this->actionFunc = func_808F15B0; + this->actionFunc = EnKarebaba_Grow; } -void func_808F15B0(EnKarebaba* this, PlayState* play) { - f32 sp1C; +void EnKarebaba_Grow(EnKarebaba* this, PlayState* play) { + f32 scale; - this->unk_1EE++; - sp1C = this->unk_1EE * 0.05f; - Actor_SetScale(&this->actor, 0.005f * sp1C); - this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * sp1C); - if (this->unk_1EE == 20) { - func_808F1648(this); + this->timer++; + scale = this->timer * 0.05f; + Actor_SetScale(&this->actor, 0.005f * scale); + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * scale); + if (this->timer == 20) { + EnKarebaba_SetupIdle(this); } } -void func_808F1648(EnKarebaba* this) { +void EnKarebaba_SetupIdle(EnKarebaba* this) { Actor_SetScale(&this->actor, 0.005f); this->actor.shape.rot.x = -0x4000; this->actor.world.pos.y = this->actor.home.pos.y + 14.0f; - this->actionFunc = func_808F169C; + this->actionFunc = EnKarebaba_Idle; } -void func_808F169C(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Idle(EnKarebaba* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 200.0f) && (fabsf(this->actor.playerHeightRel) < 30.0f)) { - func_808F16FC(this); + EnKarebaba_SetupAwaken(this); } } -void func_808F16FC(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_WAKEUP); - this->actionFunc = func_808F1778; +void EnKarebaba_SetupAwaken(EnKarebaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, + Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_WAKEUP); + this->actionFunc = EnKarebaba_Awaken; } -void func_808F1778(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Awaken(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f) && (this->actor.params == ENKAREBABA_2)) { - func_808F1878(this); + if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.0005f) && (this->actor.params == KAREBABA_MINI)) { + EnKarebaba_SetupUpright(this); } - this->actor.scale.z = this->actor.scale.x; - this->actor.scale.y = this->actor.scale.x; + this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; if ((this->actor.params == ENKAREBABA_1) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 5.0f)) { - func_808F1878(this); + EnKarebaba_SetupUpright(this); } - this->actor.shape.rot.y += 0x1999; + this->actor.shape.rot.y += 0x10000 / 10; EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void func_808F1878(EnKarebaba* this) { - if (this->actionFunc != func_808F1A58) { +void EnKarebaba_SetupUpright(EnKarebaba* this) { + if (this->actionFunc != EnKarebaba_Spin) { Actor_SetScale(&this->actor, 0.01f); - this->collider2.base.colType = COLTYPE_HIT6; - this->collider2.base.acFlags &= ~AC_HARD; - this->collider2.dim.radius = 15; + this->hurtCollider.base.colType = COLTYPE_HIT6; + this->hurtCollider.base.acFlags &= ~AC_HARD; + this->hurtCollider.dim.radius = 15; if (this->actor.params == ENKAREBABA_1) { - this->collider2.dim.height = 80; - this->collider1.dim.height = 80; + this->hurtCollider.dim.height = 80; + this->attackCollider.dim.height = 80; } else { - this->collider2.dim.height = 35; - this->collider1.dim.height = 35; + this->hurtCollider.dim.height = 35; + this->attackCollider.dim.height = 35; } } - this->unk_1EE = 40; - this->actionFunc = func_808F190C; + this->timer = 40; + this->actionFunc = EnKarebaba_Upright; } -void func_808F190C(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Upright(EnKarebaba* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (this->unk_1EE != 0) { - this->unk_1EE--; + if (this->timer != 0) { + this->timer--; } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); } - if (this->collider2.base.acFlags & AC_HIT) { - func_808F13FC(this, play); + if (this->hurtCollider.base.acFlags & AC_HIT) { + EnKarebaba_SetDamageEffects(this, play); if (this->actor.params == ENKAREBABA_1) { - func_808F1BF8(this); + EnKarebaba_SetupDying(this); } else { - func_808F1FAC(this); + EnKarebaba_SetupShrinkDie(this); } Enemy_StartFinishingBlow(play, &this->actor); } else if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 240.0f) { - func_808F220C(this); - } else if ((this->unk_1EE == 0) && (this->actor.params == ENKAREBABA_1)) { - func_808F1A3C(this); + EnKarebaba_SetupRetract(this); + } else if ((this->timer == 0) && (this->actor.params == ENKAREBABA_1)) { + EnKarebaba_SetupSpin(this); } } -void func_808F1A3C(EnKarebaba* this) { - this->unk_1EE = 40; - this->actionFunc = func_808F1A58; +void EnKarebaba_SetupSpin(EnKarebaba* this) { + this->timer = 40; + this->actionFunc = EnKarebaba_Spin; } -void func_808F1A58(EnKarebaba* this, PlayState* play) { - s32 phi_v0; - f32 sp28; +void EnKarebaba_Spin(EnKarebaba* this, PlayState* play) { + s32 temp; // Used for cylinder radius and shape rotations + f32 headDistHorizontal; - if (this->unk_1EE != 0) { - this->unk_1EE--; + if (this->timer != 0) { + this->timer--; } SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA1_MOUTH); } - phi_v0 = 20 - this->unk_1EE; - phi_v0 = 20 - ABS_ALT(phi_v0); - if (phi_v0 > 10) { - phi_v0 = 10; + temp = 20 - this->timer; + temp = 20 - ABS_ALT(temp); + if (temp > 10) { + temp = 10; } - this->collider1.dim.radius = sCylinderInit2.dim.radius + (phi_v0 * 2); - this->actor.shape.rot.x = 0xC000 - (phi_v0 << 8); - this->actor.shape.rot.y += phi_v0 * 0x2C0; + this->attackCollider.dim.radius = sAttackCylinderInit.dim.radius + (temp * 2); + this->actor.shape.rot.x = 0xC000 - temp * 0x100; + this->actor.shape.rot.y += temp * 0x2C0; this->actor.world.pos.y = (Math_SinS(this->actor.shape.rot.x) * -60.0f) + this->actor.home.pos.y; - sp28 = Math_CosS(this->actor.shape.rot.x) * 60.0f; - this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y) * sp28) + this->actor.home.pos.x; - this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * sp28) + this->actor.home.pos.z; + headDistHorizontal = Math_CosS(this->actor.shape.rot.x) * 60.0f; + this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y) * headDistHorizontal) + this->actor.home.pos.x; + this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * headDistHorizontal) + this->actor.home.pos.z; - if (this->collider2.base.acFlags & AC_HIT) { - func_808F13FC(this, play); - func_808F1BF8(this); + if (this->hurtCollider.base.acFlags & AC_HIT) { + EnKarebaba_SetDamageEffects(this, play); + EnKarebaba_SetupDying(this); Enemy_StartFinishingBlow(play, &this->actor); - } else if (this->unk_1EE == 0) { - func_808F1878(this); + } else if (this->timer == 0) { + EnKarebaba_SetupUpright(this); } } -void func_808F1BF8(EnKarebaba* this) { +void EnKarebaba_SetupDying(EnKarebaba* this) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - this->unk_1EE = 0; + this->timer = 0; this->actor.gravity = -0.8f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; } else { - this->unk_1EE = 3; + this->timer = 3; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_JR_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); - this->actionFunc = func_808F1C84; + this->actionFunc = EnKarebaba_Dying; } -void func_808F1C84(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Dying(EnKarebaba* this, PlayState* play) { s32 i; - Vec3f sp78; - f32 temp_f20; - f32 temp_f22; - f32 temp_f24; + Vec3f dustPos; + f32 xIncr; + f32 zIncr; + f32 yIncr; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - this->unk_1EE--; - if (this->unk_1EE == 0) { + this->timer--; + if (this->timer == 0) { this->actor.gravity = -0.8f; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); - func_808F1374(this, play); + EnKarebaba_SpawnIceEffects(this, play); } } else { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f); + Math_StepToF(&this->actor.speed, 0.0f, 0.1f); - if (this->unk_1EE == 0) { + if (this->timer == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); 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))) { + if ((this->actor.scale.x > 0.005f) && ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->actor.scale.z = 0.0f; this->actor.scale.y = 0.0f; this->actor.scale.x = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_4); EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } - if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); - this->unk_1EE = 1; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + this->timer = 1; } - } else if (this->unk_1EE == 1) { - Math_Vec3f_Copy(&sp78, &this->actor.world.pos); + } else if (this->timer == 1) { + Math_Vec3f_Copy(&dustPos, &this->actor.world.pos); - temp_f24 = Math_SinS(this->actor.shape.rot.x) * 20.0f; - temp_f20 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_SinS(this->actor.shape.rot.y); - temp_f22 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_CosS(this->actor.shape.rot.y); + yIncr = Math_SinS(this->actor.shape.rot.x) * 20.0f; + xIncr = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y); + zIncr = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 4; i++) { - func_800B1210(play, &sp78, &gZeroVec3f, &gZeroVec3f, 500, 50); - sp78.x += temp_f20; - sp78.y += temp_f24; - sp78.z += temp_f22; + func_800B1210(play, &dustPos, &gZeroVec3f, &gZeroVec3f, 500, 50); + dustPos.x += xIncr; + dustPos.y += yIncr; + dustPos.z += zIncr; } func_800B1210(play, &this->actor.home.pos, &gZeroVec3f, &gZeroVec3f, 500, 100); - func_808F20FC(this, play); + EnKarebaba_SetupDeadItemDrop(this, play); } } } -void func_808F1FAC(EnKarebaba* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_JR_DEAD); +void EnKarebaba_SetupShrinkDie(EnKarebaba* this) { + Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); this->actor.flags &= ~ACTOR_FLAG_1; if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - this->unk_1EE = 3; + this->timer = 3; } - this->actionFunc = func_808F200C; + this->actionFunc = EnKarebaba_ShrinkDie; } -void func_808F200C(EnKarebaba* this, PlayState* play) { +void EnKarebaba_ShrinkDie(EnKarebaba* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - this->unk_1EE--; - if (this->unk_1EE == 0) { - func_808F1374(this, play); + this->timer--; + if (this->timer == 0) { + EnKarebaba_SpawnIceEffects(this, play); } } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS_1); - func_808F238C(this); + EnKarebaba_SetupDead(this); } else { EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 1.0f); } - this->actor.scale.y = this->actor.scale.x; - this->actor.scale.z = this->actor.scale.x; + + this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; } } -void func_808F20FC(EnKarebaba* this, PlayState* play) { +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; - func_800BC154(play, &play->actorCtx, &this->actor, 8); - this->unk_1EE = 200; + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); + this->timer = 200; this->actor.flags &= ~ACTOR_FLAG_20; this->drawDmgEffAlpha = 0.0f; - this->actionFunc = func_808F21A4; + this->actionFunc = EnKarebaba_DeadItemDrop; } -void func_808F21A4(EnKarebaba* this, PlayState* play) { - if (this->unk_1EE != 0) { - this->unk_1EE--; +void EnKarebaba_DeadItemDrop(EnKarebaba* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } - if (Actor_HasParent(&this->actor, play) || (this->unk_1EE == 0)) { - func_808F238C(this); + if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { + EnKarebaba_SetupDead(this); } else { - Actor_PickUpNearby(&this->actor, play, GI_STICKS_1); + Actor_OfferGetItemNearby(&this->actor, play, GI_STICKS_1); } } -void func_808F220C(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -3.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); - func_808F152C(this); - this->actionFunc = func_808F228C; +void EnKarebaba_SetupRetract(EnKarebaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -3.0f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), + 0.0f, ANIMMODE_ONCE, -3.0f); + EnKarebaba_ResetColliders(this); + this->actionFunc = EnKarebaba_Retract; } -void func_808F228C(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Retract(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f) && (this->actor.params == ENKAREBABA_2)) { - func_808F1648(this); + if (Math_StepToF(&this->actor.scale.x, 0.005f, 0.0005f) && (this->actor.params == KAREBABA_MINI)) { + EnKarebaba_SetupIdle(this); } - this->actor.scale.z = this->actor.scale.x; - this->actor.scale.y = this->actor.scale.x; + this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; if ((this->actor.params == ENKAREBABA_1) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 14.0f, 5.0f)) { - func_808F1648(this); + EnKarebaba_SetupIdle(this); } - this->actor.shape.rot.y += 0x1999; + this->actor.shape.rot.y += 0x10000 / 10; EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); } -void func_808F238C(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); - func_808F152C(this); +void EnKarebaba_SetupDead(EnKarebaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + EnKarebaba_ResetColliders(this); this->actor.shape.rot.x = -0x4000; - this->unk_1EE = 200; + this->timer = 200; this->actor.parent = NULL; this->actor.shape.shadowScale = 0.0f; this->drawDmgEffAlpha = 0.0f; Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); - this->actionFunc = func_808F254C; + this->actionFunc = EnKarebaba_Dead; } -void func_808F241C(EnKarebaba* this, PlayState* play) { - f32 sp1C; +void EnKarebaba_Regrow(EnKarebaba* this, PlayState* play) { + f32 scale; - this->unk_1EE++; - sp1C = this->unk_1EE * 0.05f; - Actor_SetScale(&this->actor, 0.005f * sp1C); - this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * sp1C); + this->timer++; + scale = this->timer * 0.05f; + Actor_SetScale(&this->actor, 0.005f * scale); + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * scale); - if (this->unk_1EE == 20) { + if (this->timer == 20) { this->actor.flags &= ~ACTOR_FLAG_10; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); if (this->actor.params == ENKAREBABA_1) { - func_800BC154(play, &play->actorCtx, &this->actor, 5); + func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } - func_808F1648(this); + EnKarebaba_SetupIdle(this); } } -void func_808F24F8(EnKarebaba* this) { +void EnKarebaba_SetupRegrow(EnKarebaba* this) { this->actor.shape.yOffset = 0.0f; this->actor.shape.shadowScale = 22.0f; - this->collider1.dim.radius = sCylinderInit2.dim.radius; + this->attackCollider.dim.radius = sAttackCylinderInit.dim.radius; Actor_SetScale(&this->actor, 0.0f); - this->actionFunc = func_808F241C; + this->actionFunc = EnKarebaba_Regrow; } -void func_808F254C(EnKarebaba* this, PlayState* play) { +void EnKarebaba_Dead(EnKarebaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_1EE != 0) { - this->unk_1EE--; + if (this->timer != 0) { + this->timer--; } - if (this->unk_1EE == 0) { - func_808F24F8(this); + if (this->timer == 0) { + EnKarebaba_SetupRegrow(this); } } @@ -591,30 +594,30 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) { } else { this->drawDmgEffScale = this->drawDmgEffScale; } - } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) { + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) { func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } - if (this->actionFunc != func_808F254C) { - if (this->actionFunc == func_808F1C84) { + if (this->actionFunc != EnKarebaba_Dead) { + if (this->actionFunc == EnKarebaba_Dying) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 10.0f, 5); } else { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->unk_22C == 0) { - this->unk_22C = this->actor.floorPoly; + if (this->boundFloor == 0) { + this->boundFloor = this->actor.floorPoly; } } - if ((this->actionFunc != func_808F1C84) && (this->actionFunc != func_808F200C) && - (this->actionFunc != func_808F21A4)) { - if ((this->actionFunc != func_808F241C) && (this->actionFunc != func_808F15B0)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); + if ((this->actionFunc != EnKarebaba_Dying) && (this->actionFunc != EnKarebaba_ShrinkDie) && + (this->actionFunc != EnKarebaba_DeadItemDrop)) { + if ((this->actionFunc != EnKarebaba_Regrow) && (this->actionFunc != EnKarebaba_Grow)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->attackCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hurtCollider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->attackCollider.base); Actor_SetFocus(&this->actor, (this->actor.scale.x * 10.0f) / 0.01f); max = this->actor.home.pos.y + 40.0f; @@ -625,8 +628,8 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) { } } -void func_808F280C(EnKarebaba* this, PlayState* play) { - MtxF sp40; +void EnKarebaba_DrawShadow(EnKarebaba* this, PlayState* play) { + MtxF mf; OPEN_DISPS(play->state.gfxCtx); @@ -634,10 +637,9 @@ void func_808F280C(EnKarebaba* this, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); - func_800C0094(this->unk_22C, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &sp40); - Matrix_Mult(&sp40, MTXMODE_NEW); + func_800C0094(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(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); @@ -645,53 +647,53 @@ void func_808F280C(EnKarebaba* this, PlayState* play) { } void EnKarebaba_Draw(Actor* thisx, PlayState* play) { + static Color_RGBA8 sFogColor = { 0, 0, 0, 0 }; + static Gfx* sStemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; EnKarebaba* this = THIS; s32 i; - s32 sp94; + s32 stemSections; s16 limbCount; - f32 sp8C = 0.01f; + f32 scale = 0.01f; OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - Math_Vec3f_Copy(this->limbPos, &this->actor.world.pos); + Math_Vec3f_Copy(this->bodyPartsPos, &this->actor.world.pos); - if (this->actionFunc == func_808F21A4) { - if ((this->unk_1EE > 40) || (this->unk_1EE & 1)) { + if (this->actionFunc == EnKarebaba_DeadItemDrop) { + if ((this->timer > 40) || (this->timer & 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); + gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } - } else if (this->actionFunc != func_808F254C) { - func_800AE2A0(play, &D_808F2E28, 1, 2); + } else if (this->actionFunc != EnKarebaba_Dead) { + func_800AE2A0(play, &sFogColor, 1, 2); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - if ((this->actionFunc == func_808F241C) || (this->actionFunc == func_808F200C) || - (this->actionFunc == func_808F15B0)) { - sp8C = this->unk_1EE * 0.0005f; + if ((this->actionFunc == EnKarebaba_Regrow) || (this->actionFunc == EnKarebaba_ShrinkDie) || + (this->actionFunc == EnKarebaba_Grow)) { + scale = this->timer * 0.0005f; } - Matrix_Scale(sp8C, sp8C, sp8C, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, 0, MTXMODE_APPLY); - if (this->actor.params == ENKAREBABA_2) { - sp94 = 1; - } else if (this->actionFunc == func_808F1C84) { - sp94 = 2; + if (this->actor.params == KAREBABA_MINI) { + stemSections = 1; + } else if (this->actionFunc == EnKarebaba_Dying) { + stemSections = 2; } else { - sp94 = 3; + stemSections = 3; } - for (i = 0; i < sp94; i++) { + for (i = 0; i < stemSections; i++) { Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, D_808F2E2C[i]); + gSPDisplayList(POLY_OPA_DISP++, sStemDLists[i]); - Matrix_MultZero(&this->limbPos[1 + i]); - if ((i == 0) && (this->actionFunc == func_808F1C84)) { + Matrix_MultZero(&this->bodyPartsPos[1 + i]); + if ((i == 0) && (this->actionFunc == EnKarebaba_Dying)) { Matrix_MultZero(&this->actor.focus.pos); } } @@ -699,41 +701,39 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { func_800AE5A0(play); } - func_800AE2A0(play, &D_808F2E28, 1, 2); + func_800AE2A0(play, &sFogColor, 1, 2); Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); - if (this->actionFunc != func_808F15B0) { - sp8C = 0.01f; + if (this->actionFunc != EnKarebaba_Grow) { + scale = 0.01f; } - Matrix_Scale(sp8C, sp8C, sp8C, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateYS(this->actor.home.rot.y, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); + gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL); - if (this->actionFunc == func_808F1C84) { + if (this->actionFunc == EnKarebaba_Dying) { Matrix_RotateZYX(-0x4000, this->actor.shape.rot.y - this->actor.home.rot.y, 0, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); + gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); - Matrix_MultZero(&this->limbPos[3]); + Matrix_MultZero(&this->bodyPartsPos[3]); } func_800AE5A0(play); - if (this->actor.params == ENKAREBABA_2) { + if (this->actor.params == KAREBABA_MINI) { limbCount = 1; } else { - limbCount = ARRAY_COUNT(this->limbPos); + limbCount = ARRAY_COUNT(this->bodyPartsPos); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, limbCount, this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, limbCount, this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - if (this->unk_22C != 0) { - func_808F280C(this, play); + if (this->boundFloor != 0) { + EnKarebaba_DrawShadow(this, play); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index 5063a8dbe..aa05aec0a 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -2,32 +2,33 @@ #define Z_EN_KAREBABA_H #include "global.h" +#include "objects/object_dekubaba/object_dekubaba.h" struct EnKarebaba; typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, PlayState*); -enum { - /* 0 */ ENKAREBABA_0, - /* 1 */ ENKAREBABA_1, - /* 2 */ ENKAREBABA_2, -}; +typedef enum { + /* 0 */ ENKAREBABA_0, // Unused, always shrinks and drops a Deku Nut + /* 1 */ ENKAREBABA_1, // Drops sticks (Only type OoT has) + /* 2 */ KAREBABA_MINI, +} KarebabaType; typedef struct EnKarebaba { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnKarebabaActionFunc actionFunc; - /* 0x18C */ Vec3s jointTable[8]; - /* 0x1BC */ Vec3s morphTable[8]; + /* 0x18C */ Vec3s jointTable[DEKUBABA_LIMB_MAX]; + /* 0x1BC */ Vec3s morphTable[DEKUBABA_LIMB_MAX]; /* 0x1EC */ u8 drawDmgEffType; - /* 0x1EE */ s16 unk_1EE; + /* 0x1EE */ s16 timer; /* 0x1F0 */ f32 drawDmgEffAlpha; /* 0x1F4 */ f32 drawDmgEffScale; /* 0x1F8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x1FC */ Vec3f limbPos[4]; - /* 0x22C */ CollisionPoly* unk_22C; - /* 0x230 */ ColliderCylinder collider1; - /* 0x27C */ ColliderCylinder collider2; + /* 0x1FC */ Vec3f bodyPartsPos[4]; + /* 0x22C */ CollisionPoly* boundFloor; + /* 0x230 */ ColliderCylinder attackCollider; + /* 0x27C */ ColliderCylinder hurtCollider; } EnKarebaba; // size = 0x2C8 #endif // Z_EN_KAREBABA_H diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index c02b00b5a..efce38ad8 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Maruta/z_en_maruta.h" #include "objects/object_js/object_js.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnKendoJs*)thisx) @@ -193,7 +193,8 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { } else if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) { u16 sp2E = Player_GetMask(play) + 0x273C; - if (0) {} + //! FAKE: + if (1) {} Message_StartTextbox(play, sp2E, &this->actor); this->unk_288 = sp2E; @@ -280,13 +281,13 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) { break; case 0x2719: - func_801477B4(play); + Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; func_80B2701C(this); break; case 0x271A: - func_801477B4(play); + Message_CloseTextbox(play); func_80B2714C(this); break; @@ -296,14 +297,14 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) { break; case 0x273B: - func_801477B4(play); + Message_CloseTextbox(play); Interface_InitMinigame(play); player->stateFlags1 |= PLAYER_STATE1_20; func_80B273D0(this); break; case 0x272D: - func_801477B4(play); + Message_CloseTextbox(play); gSaveContext.minigameStatus = MINIGAME_STATUS_END; func_80B276C4(this); func_80B276D8(this, play); @@ -523,7 +524,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); } this->unk_286 = 2; - func_801477B4(play); + Message_CloseTextbox(play); player->stateFlags1 &= ~PLAYER_STATE1_20; } } else if (this->unk_286 == 2) { @@ -534,13 +535,13 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { switch (func_80B26BF8(this, play)) { case 0: this->unk_286 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); player->stateFlags1 |= PLAYER_STATE1_20; func_80B26EB4(this, play); break; case 1: - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); + Actor_PlaySfx(&this->actor, NA_SE_SY_ERROR); this->unk_286 = 0; player->stateFlags1 |= PLAYER_STATE1_20; Message_StartTextbox(play, 0x2729, &this->actor); @@ -634,7 +635,7 @@ void func_80B274BC(EnKendoJs* this, PlayState* play) { } else { play->interfaceCtx.minigamePoints = 1; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); this->unk_28E = 0; } func_80B2783C(this, play); @@ -649,9 +650,9 @@ void func_80B276D8(EnKendoJs* this, PlayState* play) { this->actor.parent = NULL; func_80B27760(this); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_20)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 800.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 800.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 800.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 800.0f, 100.0f); } } @@ -674,7 +675,7 @@ void func_80B27774(EnKendoJs* this, PlayState* play) { func_80B26AE8(this); player->stateFlags1 &= ~PLAYER_STATE1_20; } else { - func_800B85E0(&this->actor, play, 1000.0f, -1); + func_800B85E0(&this->actor, play, 1000.0f, PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index f188e1df0..356af73f7 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -203,7 +203,7 @@ s32 func_80B40E54(EnKgy* this) { } void func_80B40E74(EnKgy* this, PlayState* play, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); this->actor.textId = textId; func_80B40E18(this, this->actor.textId); } @@ -250,7 +250,7 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { } if (((temp_f0 < 0.15f) && (temp_f0 > -0.15f)) || (this->unk_2E6 == 0)) { - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); this->unk_29C &= ~0x2; func_80B40E18(this, this->actor.textId); @@ -443,7 +443,7 @@ void func_80B4163C(EnKgy* this, PlayState* play) { this->lightInfo.params.point.y = this->unk_2C0.y; this->lightInfo.params.point.z = this->unk_2C0.z; this->unk_300 = 200; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SWORD_FORGE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SWORD_FORGE); break; } @@ -456,9 +456,9 @@ void func_80B4163C(EnKgy* this, PlayState* play) { void func_80B417B8(EnKgy* this, PlayState* play) { func_80B4163C(this, play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80B413C8(this); - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_80B419B0; func_80B40E18(this, 7); } @@ -481,12 +481,12 @@ void func_80B418C4(EnKgy* this, PlayState* play) { if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play) && ((play->msgCtx.currentTextId == 0xC4E) || (play->msgCtx.currentTextId == 0xC4F))) { - func_801477B4(play); + Message_CloseTextbox(play); this->actor.textId = 0xC4F; func_80B413C8(this); ActorCutscene_SetIntentToPlay(this->unk_2D4[5]); this->actionFunc = func_80B41858; - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; } func_80B40EE8(this, play); } @@ -529,7 +529,7 @@ void func_80B41ACC(EnKgy* this, PlayState* play) { } if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); if (itemAction == PLAYER_IA_BOTTLE_GOLD_DUST) { if (this->unk_29C & 0x10) { this->actor.textId = 0xC55; @@ -573,7 +573,7 @@ void func_80B41C54(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = func_80B41C30; - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; } func_80B40EE8(this, play); } @@ -597,7 +597,7 @@ void func_80B41D64(EnKgy* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - Actor_PickUp(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); } func_80B40EE8(this, play); } @@ -678,7 +678,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC39: case 0xC52: case 0xC54: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B425A0; func_80B413C8(this); func_80B40E18(this, 5); @@ -698,7 +698,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { break; case 0xC3D: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC3E; func_80B413C8(this); @@ -734,7 +734,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC57: this->unk_29C &= ~0x8; - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC58; func_80B413C8(this); @@ -780,7 +780,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC4A: case 0xC4B: func_80B40BC0(this, 4); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC4B; func_80B413C8(this); @@ -795,10 +795,10 @@ void func_80B41E18(EnKgy* this, PlayState* play) { this->unk_2EA = 56; this->actor.textId = 0xC51; } - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41D64; func_80B413C8(this); - Actor_PickUp(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); break; case 0xC51: @@ -810,7 +810,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { break; case 0xC56: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41C54; this->actor.textId = 0xC56; func_80B413C8(this); @@ -855,9 +855,9 @@ void func_80B42660(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); func_80B413C8(this); - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_80B42714; func_80B40E18(this, 7); } @@ -918,7 +918,7 @@ void func_80B427C8(EnKgy* this, PlayState* play) { break; case 0xC34: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B41C54; func_80B413C8(this); func_80B40E18(this, 6); @@ -1032,7 +1032,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { case 0xC2C: case 0xC2F: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B42D28; func_80B413C8(this); func_80B40E18(this, 1); @@ -1134,7 +1134,7 @@ void func_80B43074(EnKgy* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - func_800B8050(&this->actor, play, MTXMODE_NEW); + func_800B8050(&this->actor, play, 0); Matrix_Push(); Matrix_Translate(-800.0f, 3100.0f, 8400.0f, MTXMODE_APPLY); Matrix_RotateXS(0x4000, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 511a5dc46..1de7fc728 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -9,7 +9,7 @@ #include "z_en_kujiya.h" #include "objects/object_kujiya/object_kujiya.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnKujiya*)thisx) @@ -147,7 +147,7 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) { case 0x2B60: EnKujiya_SetBoughtTicket(); - func_801477B4(play); + Message_CloseTextbox(play); EnKujiya_SetupTurnToClosed(this); break; @@ -169,7 +169,7 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) { break; case 0x2B66: - func_801477B4(play); + Message_CloseTextbox(play); EnKujiya_SetupGivePrize(this); EnKujiya_GivePrize(this, play); break; @@ -218,7 +218,7 @@ void EnKujiya_GivePrize(EnKujiya* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { EnKujiya_SetupFinishGivePrize(this); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 39d55f7f8..1f411bd39 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -329,7 +329,7 @@ void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { for (numBugs = 0; numBugs < 3; numBugs++) { Actor* bug = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.cutscene, this->actor.unk20, 0); + this->actor.cutscene, this->actor.halfDaysBits, 0); if (bug == NULL) { break; @@ -490,7 +490,7 @@ void EnKusa_WaitForInteract(EnKusa* this, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { if (KUSA_GET_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } } @@ -512,8 +512,8 @@ 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); + this->actor.velocity.x = this->actor.speed * Math_SinS(this->actor.world.rot.y); + this->actor.velocity.z = this->actor.speed * Math_CosS(this->actor.world.rot.y); this->actor.colChkInfo.mass = 80; this->actor.gravity = -0.1f; EnKusa_UpdateVelY(this); @@ -552,8 +552,9 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { this->collider.base.atFlags &= ~AT_HIT; } this->timer++; - if ((this->actor.bgCheckFlags & 0xB) || wasHit || (this->timer >= 100)) { - if (!(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || wasHit || + (this->timer >= 100)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } EnKusa_SpawnFragments(this, play); @@ -571,7 +572,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { } } else { - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { contactPos.y = this->actor.world.pos.y + this->actor.depthInWater; for (angleOffset = 0, i = 0; i < 4; i++, angleOffset += 0x4000) { contactPos.x = @@ -593,7 +594,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { rotSpeedXtarget >>= 1; rotSpeedY >>= 1; rotSpeedYtarget >>= 1; - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } EnKusa_UpdateVelY(this); @@ -683,7 +684,8 @@ void EnKusa_Update(Actor* thisx, PlayState* play2) { } else { this->actor.shape.yOffset = 0.0f; } - if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { + if ((kusaGameplayFrames != play->gameplayFrames) && + (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0)) { EnKusa_Sway(); kusaGameplayFrames = play->gameplayFrames; } @@ -695,8 +697,9 @@ void EnKusa_DrawBush(Actor* thisx, PlayState* play2) { if ((this->actor.projectedPos.z <= 1200.0f) || ((this->isInWater & 1) && (this->actor.projectedPos.z < 1300.0f))) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && - (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && + (this->actionFunc == EnKusa_WaitForInteract) && (this->actor.projectedPos.z > -150.0f) && + (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } @@ -724,7 +727,8 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { if (this->isCut) { Gfx_DrawDListOpa(play, gKusaStump); } else { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && + (this->actionFunc == EnKusa_WaitForInteract)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 0f95122d4..49fa4a98a 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -100,9 +100,10 @@ void func_80A5B160(EnKusa2* this, PlayState* play) { if (this->unk_194[0] == NULL) { ptr = this->unk_194; - actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( - &play->actorCtx, play, ACTOR_EN_KUSA2, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, Rand_Next() >> 0x10, 0, 1, this->actor.cutscene, this->actor.unk20, NULL); + actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_KUSA2, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, + Rand_Next() >> 0x10, 0, 1, this->actor.cutscene, + this->actor.halfDaysBits, NULL); *ptr = actor; if (*ptr != NULL) { @@ -118,7 +119,7 @@ void func_80A5B160(EnKusa2* this, PlayState* play) { actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_KUSA2, (Math_SinS(temp_s1) * 80.0f) + this->actor.world.pos.x, this->actor.world.pos.y, (Math_CosS(temp_s1) * 80.0f) + this->actor.world.pos.z, 0, Rand_Next() >> 0x10, - 0, 1, this->actor.cutscene, this->actor.unk20, NULL); + 0, 1, this->actor.cutscene, this->actor.halfDaysBits, NULL); *ptr = actor; if (*ptr != NULL) { (*ptr)->actor.room = this->actor.room; @@ -159,7 +160,8 @@ void func_80A5B3BC(EnKusa2* this) { void func_80A5B490(EnKusa2* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_KITAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - ENKUSA2_GET_7F00(&this->actor) << 9, this->actor.cutscene, this->actor.unk20, NULL); + ENKUSA2_GET_7F00(&this->actor) << 9, this->actor.cutscene, this->actor.halfDaysBits, + NULL); } void func_80A5B508(void) { @@ -701,7 +703,7 @@ void func_80A5CB74(EnKusa2* this) { sp3E = Rand_S16Offset(-10000, 20000) + this->actor.world.rot.y; if (this->unk_1C0 != NULL) { - sp36 = Actor_YawBetweenActors(&this->actor, &this->unk_1C0->actor); + sp36 = Actor_WorldYawTowardActor(&this->actor, &this->unk_1C0->actor); sp3C = Rand_S16Offset(-4000, 8000) + sp36; } else { sp3C = 0; @@ -976,12 +978,12 @@ void func_80A5D7C4(EnKusa2* this, PlayState* play) { if ((this->unk_1C0 != NULL) && (this->unk_1C0->unk_1BE != 0)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; if (this2->unk_1C0 != NULL) { - sp2A = Actor_YawBetweenActors(&this->unk_1C0->actor, &this->actor); + sp2A = Actor_WorldYawTowardActor(&this->unk_1C0->actor, &this->actor); this->actor.home.rot.y = Rand_S16Offset(-1500, 3000) + sp2A; } this->unk_1C8 = Rand_S16Offset(72, 16); this->actor.velocity.y = 8.8f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); func_80A5DC70(this); } @@ -990,7 +992,7 @@ void func_80A5D7C4(EnKusa2* this, PlayState* play) { if (this->actor.xzDistToPlayer < 400.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } } @@ -1038,7 +1040,7 @@ void func_80A5D9C8(EnKusa2* this, PlayState* play) { this->actor.colChkInfo.mass = 80; this->actor.home.rot.y = this->actor.world.rot.y; this->actor.velocity.y = 12.5f; - this->actor.speedXZ += 3.0f; + this->actor.speed += 3.0f; Actor_MoveWithGravity(&this->actor); func_80A5BAFC(this, play); func_80A5CD0C(this); @@ -1055,7 +1057,7 @@ void func_80A5D9C8(EnKusa2* this, PlayState* play) { this->unk_1D0--; if (this->unk_1D0 <= 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); this->unk_1D0 = (Rand_Next() >> 0x1D) + 14; } @@ -1087,12 +1089,12 @@ void func_80A5DC98(EnKusa2* this, PlayState* play) { func_80A5BF38(this, 4); func_80A5BF84(this, play); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80A5CD0C(this); func_80A5BB40(this, play, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); func_80A5DE18(this); - } else if (this->actor.bgCheckFlags & 0x20) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { func_80A5BDB0(this, play); func_80A5E418(this); } else if (this->unk_1CA > 0) { @@ -1122,14 +1124,14 @@ void func_80A5DEB4(EnKusa2* this, PlayState* play) { if (this->unk_1D0 > 0) { this->unk_1D0--; if (this->unk_1D0 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); } } if (this->unk_1D1 > 0) { this->unk_1D1--; if (this->unk_1D1 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); } } @@ -1137,10 +1139,10 @@ void func_80A5DEB4(EnKusa2* this, PlayState* play) { Math_StepToF(&this->actor.scale.x, 0.4f, 0.032f); this->unk_1C4 += 0x4650; this->actor.scale.z = this->actor.scale.x; - this->actor.speedXZ = fabsf(Math_CosS(this->unk_1C4) + 0.5f) * 1.5f; + this->actor.speed = fabsf(Math_CosS(this->unk_1C4) + 0.5f) * 1.5f; - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ = 0.0f; + if (this->actor.speed < 0.0f) { + this->actor.speed = 0.0f; } Actor_MoveWithGravity(&this->actor); @@ -1157,7 +1159,7 @@ void func_80A5DEB4(EnKusa2* this, PlayState* play) { func_80A5CD0C(this); } - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { func_80A5BDB0(this, play); func_80A5E418(this); } else { @@ -1165,16 +1167,16 @@ void func_80A5DEB4(EnKusa2* this, PlayState* play) { if (this->unk_1C8 <= 0) { func_80A5CD0C(this); func_80A5BB40(this, play, 4); - this->actor.speedXZ += 4.0f; + this->actor.speed += 4.0f; this->actor.velocity.y = (Rand_ZeroOne() * 4.0f) + 15.0f; func_80A5E1D8(this); - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_1CA--; if (this->unk_1CA <= 0) { func_80A5CD0C(this); func_80A5BB40(this, play, 2); this->actor.velocity.y = (Rand_ZeroOne() * 6.0f) + 7.0f; - this->actor.speedXZ += 2.0f; + this->actor.speed += 2.0f; if (this->actor.yawTowardsPlayer < this->actor.world.rot.y) { sp20 = 10000; } else { @@ -1200,9 +1202,9 @@ void func_80A5E1D8(EnKusa2* this) { void func_80A5E210(EnKusa2* this, PlayState* play) { Math_StepToF(&this->actor.gravity, -4.0f, 0.5f); - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ *= 0.4f; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed *= 0.4f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { func_80A5D178(this); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_KUSAMUSHI_HIDE); } @@ -1229,7 +1231,7 @@ void func_80A5E210(EnKusa2* this, PlayState* play) { if (this->actor.velocity.y > 1.0f) { Math_StepToF(&this->actor.scale.y, 0.24000001f, 0.080000006f); Math_StepToF(&this->actor.scale.x, 0.32000002f, 0.040000003f); - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToF(&this->actor.scale.y, 0.0f, 0.120000005f); Math_StepToF(&this->actor.scale.x, 0.48000002f, 0.120000005f); } else { @@ -1253,7 +1255,7 @@ void func_80A5E418(EnKusa2* this) { this->actor.velocity.y *= 0.25f; this->actor.velocity.z *= 0.1f; this->actor.draw = func_80A5EA48; - this->actor.speedXZ *= 0.1f; + this->actor.speed *= 0.1f; this->actor.gravity *= 0.25f; this->unk_1CC = Rand_S16Offset(-800, 1600); this->actionFunc = func_80A5E4BC; @@ -1269,7 +1271,8 @@ void func_80A5E4BC(EnKusa2* this, PlayState* play) { this->actor.shape.rot.x -= 0x5DC; this->actor.shape.rot.y += this->unk_1CC; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 5.0f) && (Rand_ZeroOne() < 0.8f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 5.0f) && + (Rand_ZeroOne() < 0.8f)) { EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 10.0f, 20.0f, (Rand_ZeroOne() * 0.08f) + 0.04f); } @@ -1290,7 +1293,7 @@ void func_80A5E604(Actor* thisx, PlayState* play) { } else { this->actor.draw = func_80A5E6F0; - if (play->roomCtx.curRoom.unk3 == 0) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) { func_80A5B508(); } func_80A5CAF4(&D_80A5F1C0); @@ -1353,7 +1356,7 @@ void EnKusa2_Draw(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->actor.projectedPos.z <= 1200.0f) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A5B954(&D_80A60908[this->unk_1CE], 0.0015f); } diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index aafc12b51..38fc47610 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -284,7 +284,7 @@ void func_80AE9FC8(EnLiftNuts* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80AEA044; } @@ -301,7 +301,7 @@ void func_80AEA0B4(EnLiftNuts* this) { this->actionFunc = func_80AEA1A0; } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80AEA128; } } @@ -511,7 +511,7 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { break; case 0x27E5: - func_801477B4(play); + Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; func_80AEAEAC(this); break; @@ -544,7 +544,7 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { break; case 0x27FA: - func_801477B4(play); + Message_CloseTextbox(play); player->stateFlags1 &= ~PLAYER_STATE1_20; func_80AEB114(this); break; @@ -556,7 +556,7 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { break; case 0x27EF: - func_801477B4(play); + Message_CloseTextbox(play); func_80AEB584(this); func_80AEB598(this, play); break; @@ -573,13 +573,13 @@ void func_80AEA910(EnLiftNuts* this, PlayState* play) { break; case 0x27F4: - func_801477B4(play); + Message_CloseTextbox(play); func_80AEB584(this); func_80AEB598(this, play); break; case 0x27F5: - func_801477B4(play); + Message_CloseTextbox(play); func_80AE9B4C(1, 0); player->stateFlags1 &= ~PLAYER_STATE1_20; func_80AE9FC8(this); @@ -598,7 +598,7 @@ void func_80AEABF0(EnLiftNuts* this) { if (this->actionFunc != func_80AEB698) { if (func_80AE9B4C(0, 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 16); } @@ -674,7 +674,7 @@ void func_80AEACF8(EnLiftNuts* this, PlayState* play) { } void func_80AEAEAC(EnLiftNuts* this) { - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); func_80AE9AC4(this, 1); func_80AE9B4C(1, 1); @@ -685,7 +685,7 @@ void func_80AEAF14(EnLiftNuts* this, PlayState* play) { f32 dist; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 10, 0x1000, 0x500); - dist = Math_Vec3f_StepTo(&this->actor.world.pos, &this->vec_1D8, this->actor.speedXZ); + dist = Math_Vec3f_StepTo(&this->actor.world.pos, &this->vec_1D8, this->actor.speed); this->actor.world.pos.y += this->actor.gravity; if (dist == 0.0f) { @@ -731,7 +731,7 @@ void func_80AEAFA0(EnLiftNuts* this, PlayState* play) { } void func_80AEB114(EnLiftNuts* this) { - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); this->actionFunc = func_80AEB148; } @@ -739,17 +739,17 @@ void func_80AEB148(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags3 & PLAYER_STATE3_200) { - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; SET_EVENTINF(EVENTINF_34); Interface_StartTimer(4, 0); func_80AE9B4C(1, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); + Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); func_80AEB280(this); } } void func_80AEB1C8(EnLiftNuts* this) { - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; SET_EVENTINF(EVENTINF_34); Interface_StartTimer(4, 0); func_80AE9B4C(1, 2); @@ -772,7 +772,7 @@ void func_80AEB280(EnLiftNuts* this) { void func_80AEB294(EnLiftNuts* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (((player->actor.bgCheckFlags & 1) && (player->actor.floorBgId == BG_ACTOR_MAX) && + if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (player->actor.floorBgId == BG_ACTOR_MAX) && player->actor.world.pos.y < 20.0f) || gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= 0x2EE0) { player->stateFlags1 |= PLAYER_STATE1_20; @@ -839,9 +839,9 @@ void func_80AEB598(EnLiftNuts* this, PlayState* play) { } func_80AEB684(this); } else if ((this->textId == 0x27F4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_14_80)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } @@ -882,7 +882,7 @@ void func_80AEB698(EnLiftNuts* this, PlayState* play) { break; } } else { - func_800B85E0(&this->actor, play, 200.0f, -1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index b988fcce3..830484996 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -52,7 +52,7 @@ void EnLight_Init(Actor* thisx, PlayState* play) { EnLight* this = THIS; if (!ENLIGHT_GET_4000(&this->actor)) { - if ((gSaveContext.gameMode == 3) || ENLIGHT_GET_2000(&this->actor)) { + if ((gSaveContext.gameMode == GAMEMODE_END_CREDITS) || ENLIGHT_GET_2000(&this->actor)) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, ((this->actor.params < 0) ? 1 : 40) + (s32)this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 180, -1); @@ -112,7 +112,7 @@ void EnLight_Update(Actor* thisx, PlayState* play) { func_80865BF8(this, play); if ((this->actor.params >= 0) && !ENLIGHT_GET_4000(&this->actor)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } @@ -156,7 +156,7 @@ void func_80865F38(Actor* thisx, PlayState* play) { func_80865BF8(this, play); if ((this->actor.params >= 0) && (sp2C == true)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index ac376bb16..7cd1c3369 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -111,7 +111,7 @@ void EnLookNuts_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 1; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->pathLocation = LOOKNUTS_GET_PATROL_LOCATION(&this->actor); this->switchFlag = LOOKNUTS_GET_SCENE_FLAG(&this->actor); this->spawnIndex = LOOKNUTS_GET_SPAWN_INDEX(&this->actor); @@ -151,17 +151,17 @@ void EnLookNuts_Patrol(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Play_InCsMode(play)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; return; } - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } if (D_80A6862C != 0) { - Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 1.0f); + Math_ApproachZeroF(&this->actor.speed, 0.3f, 1.0f); return; } @@ -207,7 +207,7 @@ void EnLookNuts_StandAndWait(EnLookNuts* this, PlayState* play) { s16 randOffset; SkelAnime_Update(&this->skelAnime); - Math_ApproachZeroF(&this->actor.speedXZ, 0.3f, 1.0f); + Math_ApproachZeroF(&this->actor.speed, 0.3f, 1.0f); if (!Play_InCsMode(play) && (D_80A6862C == 0) && (this->eventTimer == 0)) { this->eventTimer = 10; switch (this->waitTimer) { @@ -273,13 +273,13 @@ void EnLookNuts_DetectedPlayer(EnLookNuts* this, PlayState* play) { void EnLookNuts_RunToPlayer(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK); } - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); if ((this->actor.xzDistToPlayer < 70.0f) || (this->eventTimer == 0)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnLookNuts_SetupSendPlayerToSpawn(this); } } @@ -295,7 +295,7 @@ void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); play->nextEntrance = Entrance_CreateFromSpawn(this->spawnIndex); gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 973e91553..69bcf41b3 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -142,19 +142,21 @@ void EnMa4_ChangeAnim(EnMa4* this, s32 animIndex) { void func_80ABDD9C(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 flag; + s16 trackingMode; - if (this->unk_1D8.unk_00 == 0 && + if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && ((this->skelAnime.animation == &gRomaniRunAnim) || (this->skelAnime.animation == &gRomaniLookAroundAnim) || (this->skelAnime.animation == &gRomaniShootBowAnim))) { - flag = 1; + trackingMode = NPC_TRACKING_NONE; } else { - flag = (this->type == MA4_TYPE_ALIENS_WON && this->actionFunc != EnMa4_DialogueHandler) ? 1 : 0; + trackingMode = ((this->type == MA4_TYPE_ALIENS_WON) && (this->actionFunc != EnMa4_DialogueHandler)) + ? NPC_TRACKING_NONE + : NPC_TRACKING_PLAYER_AUTO_TURN; } - this->unk_1D8.unk_18 = player->actor.world.pos; - this->unk_1D8.unk_18.y -= -10.0f; - func_800BD888(&this->actor, &this->unk_1D8, 0, flag); + this->interactInfo.trackPos = player->actor.world.pos; + this->interactInfo.trackPos.y -= -10.0f; + Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode); } void EnMa4_InitPath(EnMa4* this, PlayState* play) { @@ -192,7 +194,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; - this->unk_1D8.unk_00 = 0; + this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->unk_334 = 0; this->hasBow = true; this->mouthTexIndex = 0; @@ -260,14 +262,14 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { sAnimIndex = 13; } } else { - this->actor.speedXZ = 2.7f; + this->actor.speed = 2.7f; EnMa4_ChangeAnim(this, 9); sAnimIndex = 9; } } if (sAnimIndex == 13 && Animation_OnFrame(&this->skelAnime, 37.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK); + Actor_PlaySfx(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK); } sp34.x = this->pathPoints[this->pathIndex].x; @@ -279,7 +281,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp2E, 5, 0x3000, 0x100); } else { if ((D_80AC0254 == 0) && ((Rand_Next() % 4) == 0)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; D_80AC0254 = 2; EnMa4_ChangeAnim(this, 3); sAnimIndex = 3; @@ -300,7 +302,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (this->skelAnime.animation == &gRomaniRunAnim) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); } } } @@ -309,14 +311,14 @@ void EnMa4_SetupWait(EnMa4* this) { if ((this->state != MA4_STATE_AFTERHORSEBACKGAME) && (this->state != MA4_STATE_AFTERDESCRIBETHEMCS)) { if (this->type != MA4_TYPE_ALIENS_WON) { EnMa4_ChangeAnim(this, 9); - this->actor.speedXZ = 2.7f; + this->actor.speed = 2.7f; } else { EnMa4_ChangeAnim(this, 15); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } else { EnMa4_ChangeAnim(this, 1); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->actor.gravity = -0.2f; @@ -449,7 +451,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { // "Try again?" if (play->msgCtx.choiceIndex == 0) { // Yes func_8019F208(); - func_801477B4(play); + Message_CloseTextbox(play); EnMa4_SetupBeginHorsebackGame(this); } else { // No if (this->type == MA4_TYPE_ALIENS_DEFEATED) { @@ -492,7 +494,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (this->textId) { case 0x2390: - func_801477B4(play); + Message_CloseTextbox(play); EnMa4_SetupBeginHorsebackGame(this); break; @@ -527,7 +529,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { break; case 0x333E: - func_801477B4(play); + Message_CloseTextbox(play); EnMa4_SetupBeginDescribeThemCs(this); break; @@ -564,7 +566,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { break; case 0x334A: - func_801477B4(play); + Message_CloseTextbox(play); EnMa4_SetupBeginHorsebackGame(this); break; @@ -595,7 +597,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; } else { - func_801477B4(play); + Message_CloseTextbox(play); player->stateFlags1 |= PLAYER_STATE1_20; EnMa4_SetupBeginEponasSongCs(this); EnMa4_BeginEponasSongCs(this, play); @@ -728,8 +730,8 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { void EnMa4_SetupHorsebackGameEnd(EnMa4* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); this->actionFunc = EnMa4_HorsebackGameEnd; - Audio_QueueSeqCmd(NA_BGM_STOP); - Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); } void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) { @@ -1027,17 +1029,17 @@ void EnMa4_Update(Actor* thisx, PlayState* play) { s32 EnMa4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMa4* this = THIS; - Vec3s sp4; + Vec3s limbRot; if (limbIndex == ROMANI_LIMB_HEAD) { - sp4 = this->unk_1D8.unk_08; - rot->x = rot->x + sp4.y; - rot->z = rot->z + sp4.x; + limbRot = this->interactInfo.headRot; + rot->x += limbRot.y; + rot->z += limbRot.x; } if (limbIndex == ROMANI_LIMB_TORSO) { - sp4 = this->unk_1D8.unk_0E; - rot->x = rot->x - sp4.y; - rot->z = rot->z - sp4.x; + limbRot = this->interactInfo.torsoRot; + rot->x -= limbRot.y; + rot->z -= limbRot.x; } return false; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h index 3ac405b00..91876c938 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h @@ -13,7 +13,7 @@ typedef struct EnMa4 { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnMa4ActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; + /* 0x1D8 */ NpcInteractInfo interactInfo; /* 0x200 */ Vec3s* pathPoints; /* 0x204 */ Vec3s jointTable[ROMANI_LIMB_MAX]; /* 0x28E */ UNK_TYPE1 unk28E[0x6]; diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index fb10d9311..9117e55a3 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -944,7 +944,7 @@ void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, PlayState* play) { break; case 0x33C2: - func_801477B4(play); + Message_CloseTextbox(play); EnMaYto_SetupPostMilkRunGiveReward(this); EnMaYto_PostMilkRunGiveReward(this, play); break; @@ -960,10 +960,10 @@ void EnMaYto_PostMilkRunGiveReward(EnMaYto* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { EnMaYto_SetupPostMilkRunExplainReward(this); } else if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) { - Actor_PickUp(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); this->unk310 = 2; } else { - Actor_PickUp(&this->actor, play, GI_MASK_ROMANI, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_ROMANI, 500.0f, 100.0f); this->unk310 = 1; } } @@ -1069,7 +1069,7 @@ void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE || Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == TEXT_STATE_5) { func_800B7298(play, &this->actor, PLAYER_CSMODE_7); - func_801477B4(play); + Message_CloseTextbox(play); } } @@ -1268,29 +1268,29 @@ void EnMaYto_ChangeAnim(EnMaYto* this, s32 animIndex) { void func_80B90C78(EnMaYto* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 flag; + s16 trackingMode; SkelAnime_Update(&this->skelAnime); - flag = this->unk31E == 2 ? true : false; + trackingMode = (this->unk31E == 2) ? NPC_TRACKING_NONE : NPC_TRACKING_PLAYER_AUTO_TURN; if (this->unk31E == 0) { - this->unk_1D8.unk_18 = player->actor.world.pos; - this->unk_1D8.unk_14 = 0.0f; + this->interactInfo.trackPos = player->actor.world.pos; + this->interactInfo.yOffset = 0.0f; } else if (this->unk31E == 1) { - Math_Vec3f_StepTo(&this->unk_1D8.unk_18, &this->actor.child->world.pos, 8.0f); - this->unk_1D8.unk_14 = 0.0f; + Math_Vec3f_StepTo(&this->interactInfo.trackPos, &this->actor.child->world.pos, 8.0f); + this->interactInfo.yOffset = 0.0f; } if (this->unk320 == 0) { if (this->actionFunc == EnMaYto_WarmFuzzyFeelingCs) { - this->unk_1D8.unk_08.y = 0; - this->unk_1D8.unk_08.x = 0; + this->interactInfo.headRot.y = 0; + this->interactInfo.headRot.x = 0; } else { - func_800BD888(&this->actor, &this->unk_1D8, 0xD, flag); + Npc_TrackPoint(&this->actor, &this->interactInfo, 13, trackingMode); } } else { - Math_SmoothStepToS(&this->unk_1D8.unk_08.y, 0, 3, 0x71C, 0xB6); - Math_SmoothStepToS(&this->unk_1D8.unk_08.x, 0x18E3, 5, 0x71C, 0xB6); + Math_SmoothStepToS(&this->interactInfo.headRot.y, 0, 3, 0x71C, 0xB6); + Math_SmoothStepToS(&this->interactInfo.headRot.x, 0x18E3, 5, 0x71C, 0xB6); } EnMaYto_UpdateEyes(this); @@ -1423,26 +1423,26 @@ void EnMaYto_Update(Actor* thisx, PlayState* play) { s32 EnMaYto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMaYto* this = THIS; - Vec3s sp4; + Vec3s limbRot; if (limbIndex == CREMIA_LIMB_HEAD) { - sp4 = this->unk_1D8.unk_08; + limbRot = this->interactInfo.headRot; - rot->x += sp4.y; - rot->z += sp4.x; + rot->x += limbRot.y; + rot->z += limbRot.x; } else if (limbIndex == CREMIA_LIMB_TORSO) { - if (this->skelAnime.animation != &gCremiaSittingPetCowAnim && - this->skelAnime.animation != &gCremiaSittingLookDownAnim) { - sp4 = this->unk_1D8.unk_0E; + if ((this->skelAnime.animation != &gCremiaSittingPetCowAnim) && + (this->skelAnime.animation != &gCremiaSittingLookDownAnim)) { + limbRot = this->interactInfo.torsoRot; - rot->x += sp4.y; - if (this->skelAnime.animation == &gCremiaIdleAnim || this->skelAnime.animation == &gCremiaSittingAnim || - this->skelAnime.animation == &gCremiaSittingLookDownAnim) { - rot->z += sp4.x; + rot->x += limbRot.y; + if ((this->skelAnime.animation == &gCremiaIdleAnim) || (this->skelAnime.animation == &gCremiaSittingAnim) || + (this->skelAnime.animation == &gCremiaSittingLookDownAnim)) { + rot->z += limbRot.x; } } } - return 0; + return false; } void EnMaYto_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h index 0955cd8e8..208e41270 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h @@ -13,7 +13,7 @@ typedef struct EnMaYto { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnMaYtoActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; + /* 0x1D8 */ NpcInteractInfo interactInfo; /* 0x200 */ s32 unk200; // unused /* 0x204 */ s32 type; /* 0x208 */ Vec3s jointTable[CREMIA_LIMB_MAX]; diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 64a6d138c..b52378a5a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -121,17 +121,17 @@ void EnMaYts_ChangeAnim(EnMaYts* this, s32 animIndex) { void func_80B8D12C(EnMaYts* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 flag = this->unk_32C == 2 ? true : false; + s16 trackingMode = (this->unk_32C == 2) ? NPC_TRACKING_NONE : NPC_TRACKING_PLAYER_AUTO_TURN; if (this->unk_32C == 0 || this->actor.parent == NULL) { - this->unk_1D8.unk_18 = player->actor.world.pos; - this->unk_1D8.unk_18.y -= -10.0f; + this->interactInfo.trackPos = player->actor.world.pos; + this->interactInfo.trackPos.y -= -10.0f; } else { - Math_Vec3f_StepTo(&this->unk_1D8.unk_18, &this->actor.parent->world.pos, 8.0f); - this->unk_1D8.unk_18.y -= -10.0f; + Math_Vec3f_StepTo(&this->interactInfo.trackPos, &this->actor.parent->world.pos, 8.0f); + this->interactInfo.trackPos.y -= -10.0f; } - func_800BD888(&this->actor, &this->unk_1D8, 0, flag); + Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode); } void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { @@ -238,7 +238,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); Actor_SetScale(&this->actor, 0.01f); - this->unk_1D8.unk_00 = 0; + this->interactInfo.talkState = NPC_TALK_STATE_IDLE; this->unk_200 = 0; this->blinkTimer = 0; @@ -248,7 +248,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { this->hasBow = false; } - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { this->overrideEyeTexIndex = 0; this->eyeTexIndex = 0; this->mouthTexIndex = 0; @@ -501,18 +501,18 @@ void EnMaYts_Update(Actor* thisx, PlayState* play) { s32 EnMaYts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnMaYts* this = THIS; - Vec3s sp4; + Vec3s limbRot; if (limbIndex == ROMANI_LIMB_HEAD) { - sp4 = this->unk_1D8.unk_08; - rot->x += sp4.y; + limbRot = this->interactInfo.headRot; + rot->x += limbRot.y; if ((this->skelAnime.animation == &gRomaniIdleAnim) || (this->skelAnime.animation == &gRomaniSittingAnim)) { - rot->z += sp4.x; + rot->z += limbRot.x; } } else if (limbIndex == ROMANI_LIMB_TORSO) { - sp4 = this->unk_1D8.unk_0E; - rot->x += sp4.y; - rot->z += sp4.x; + limbRot = this->interactInfo.torsoRot; + rot->x += limbRot.y; + rot->z += limbRot.x; } return false; diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h index eb700d8c2..65e7a0eb6 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h @@ -13,7 +13,7 @@ typedef struct EnMaYts { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnMaYtsActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; + /* 0x1D8 */ NpcInteractInfo interactInfo; /* 0x200 */ s32 unk_200; // Set, but not used /* 0x204 */ Vec3s jointTable[ROMANI_LIMB_MAX]; /* 0x28E */ UNK_TYPE1 unk_28E[0x6]; diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 4a8ce8731..513964338 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -388,7 +388,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { D_801BB12C = 0; } play_sound(NA_SE_SY_PIECE_OF_HEART); - gSaveContext.gameMode = 2; // Go to FileChoose + gSaveContext.gameMode = GAMEMODE_FILE_SELECT; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; play->nextEntrance = ENTRANCE(CUTSCENE, 0); diff --git a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c index 65e3d8b38..95890455c 100644 --- a/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c +++ b/src/overlays/actors/ovl_En_Maruta/z_en_maruta.c @@ -525,7 +525,7 @@ void func_80B37CA0(EnMaruta* this, PlayState* play) { ((this->actionFunc == func_80B37428) && !(this->actor.world.pos.y < (this->actor.floorHeight - 20.0f)))) { if ((this->collider.base.acFlags & AC_HIT) && (this->actionFunc == func_80B372CC)) { this->collider.base.acFlags &= ~AC_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SWORD_STRIKE); + Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_STRIKE); if (D_80B386CC[player->meleeWeaponAnimation] != 0) { s32 temp = D_80B386CC[player->meleeWeaponAnimation] + 1; @@ -587,7 +587,7 @@ void func_80B37EC0(EnMaruta* this, PlayState* play) { if (this->actor.velocity.y < -this->actor.gravity) { func_80B382E4(play, sp34); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LOG_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_LOG_BOUND); this->actor.velocity.y *= -0.6f; func_80B38060(this, &sp34); } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index f459a6a41..e5855004f 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -99,7 +99,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->frogIndex = MINIFROG_YELLOW; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnMinifrog_Idle; this->jumpState = MINIFROG_STATE_GROUND; this->flags = 0; @@ -115,7 +115,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->timer = 30; this->actionFunc = EnMinifrog_SpawnGrowAndShrink; - this->actor.textId = 0xD81; // "Ah! Don Gero! It has been so long." + this->actor.textId = 0xD81; this->actor.colChkInfo.mass = 30; } else { // Frogs in mountain village if (this->frogIndex == MINIFROG_YELLOW) { @@ -187,14 +187,14 @@ void EnMinifrog_Jump(EnMinifrog* this) { switch (this->jumpState) { case MINIFROG_STATE_JUMP: if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 6.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EV_FROG_JUMP); this->jumpState = MINIFROG_STATE_AIR; } break; case MINIFROG_STATE_AIR: - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->jumpState = MINIFROG_STATE_GROUND; Animation_MorphToLoop(&this->skelAnime, &object_fr_Anim_001534, -2.5f); SkelAnime_Update(&this->skelAnime); @@ -254,27 +254,27 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_SetJumpState(this); switch (play->msgCtx.currentTextId) { - case 0xD81: // "Ah! Don Gero! It has been so long." - case 0xD83: // "Could it be... Has spring finally come to the mountains?" - case 0xD84: // "That look...It is true! Winter was so long that I began to lose all hope." - case 0xD86: // "Could it be... You came all this way looking for me?" - case 0xD87: // "Ah! You need not say a thing. Upon seeing that face, I understand!" ... - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0xD81: + case 0xD83: + case 0xD84: + case 0xD86: + case 0xD87: + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0xD82: // "What has brought you all this way?" + case 0xD82: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { - func_80151938(play, 0xD83); // "Could it be... Has spring finally come to the mountains?" + Message_ContinueTextbox(play, 0xD83); } else { - func_80151938(play, 0xD86); // "Could it be... You came all this way looking for me?" + Message_ContinueTextbox(play, 0xD86); } SET_WEEKEVENTREG(isFrogReturnedFlags[this->frogIndex]); break; - case 0xD85: // "I understand. I shall head for the mountains immediately." + case 0xD85: default: - func_801477B4(play); + Message_CloseTextbox(play); EnMinifrog_SpawnDust(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); if (this->actor.cutscene != -1) { @@ -338,7 +338,7 @@ void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, PlayState* play) { missingFrog = nextFrog->frog; if (nextFrog->frog != NULL) { this->actor.home.rot.y = - (s16)Actor_YawBetweenActors(&this->actor, &missingFrog->actor); // Set home to missing frog + (s16)Actor_WorldYawTowardActor(&this->actor, &missingFrog->actor); // Set home to missing frog EnMinifrog_TurnToMissingFrog(this); } else { EnMinifrog_TurnToPlayer(this); @@ -354,10 +354,9 @@ void EnMinifrog_SetupNextFrogInit(EnMinifrog* this, PlayState* play) { void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, PlayState* play) { this->actionFunc = EnMinifrog_YellowFrogDialog; if (this->frog != NULL) { - func_80151938(play, 0xD78); // "Unfortunately, it seems not all of our members have gathered." + Message_ContinueTextbox(play, 0xD78); } else { - func_80151938(play, - 0xD7C); // "The conducting was spectacular. And all of our members rose to the occasion!" + Message_ContinueTextbox(play, 0xD7C); } EnMinifrog_SetJumpState(this); @@ -427,7 +426,7 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { this->actor.home.rot.z = 0; this->actionFunc = EnMinifrog_NextFrogMissing; this->timer = 60; - this->actor.home.rot.y = Actor_YawBetweenActors(&this->actor, &this->frog->actor); + this->actor.home.rot.y = Actor_WorldYawTowardActor(&this->actor, &this->frog->actor); func_801A1F88(); this->flags &= ~0x100; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | @@ -462,7 +461,7 @@ void EnMinifrog_EndChoir(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - Message_StartTextbox(play, 0xD7E, &this->actor); // "Let us do it again sometime." + Message_StartTextbox(play, 0xD7E, &this->actor); this->actionFunc = EnMinifrog_YellowFrogDialog; } else { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); @@ -478,7 +477,7 @@ void EnMinifrog_GetFrogHP(EnMinifrog* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_NONE); } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } } @@ -496,7 +495,7 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { break; case 1: // No func_8019F230(); - func_80151938(play, 0xD7E); // "Let us do it again sometime." + Message_ContinueTextbox(play, 0xD7E); break; } } @@ -506,40 +505,38 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { if (Message_ShouldAdvance(play)) { EnMinifrog_SetJumpState(this); switch (play->msgCtx.currentTextId) { - case 0xD76: // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, but it looks like - // you've lost a little weight..." - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0xD76: + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->actor.flags &= ~ACTOR_FLAG_10000; SET_WEEKEVENTREG(WEEKEVENTREG_34_01); break; - case 0xD78: // "Unfortunately, it seems not all of our members have gathered." - case 0xD79: // "Perhaps it is because winter was too long? They must not have realized that spring - // has come to the mountains..." - case 0xD7A: // "And when the great Don Gero has come for us, too...What a pity." - case 0xD7F: // "Well, if it isn't the great Don Gero." - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0xD78: + case 0xD79: + case 0xD7A: + case 0xD7F: + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0xD77: // "Let us begin our chorus" + case 0xD77: this->actionFunc = EnMinifrog_BeginChoirCutscene; play->msgCtx.msgLength = 0; break; - case 0xD7C: // "The conducting was spectacular. And all of our members rose to the occasion!" + case 0xD7C: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_35_80)) { // Obtained Heart Piece - func_80151938(play, 0xD7E); + Message_ContinueTextbox(play, 0xD7E); } else { - func_80151938(play, 0xD7D); // Get Heart Piece + Message_ContinueTextbox(play, 0xD7D); // Get Heart Piece SET_WEEKEVENTREG(WEEKEVENTREG_35_80); } break; - case 0xD7D: // "This is how deeply we were moved by your spectacular conducting..." - func_801477B4(play); + case 0xD7D: + Message_CloseTextbox(play); this->actionFunc = EnMinifrog_GetFrogHP; EnMinifrog_GetFrogHP(this, play); break; - case 0xD7B: // "Where in the world could the other members be, and what could they be doing?" - case 0xD7E: // "Let us do it again sometime." + case 0xD7B: + case 0xD7E: default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnMinifrog_SetupYellowFrogDialog; this->actor.flags &= ~ACTOR_FLAG_10000; break; @@ -558,11 +555,9 @@ void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMinifrog_YellowFrogDialog; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_01)) { - Message_StartTextbox(play, 0xD76, - &this->actor); // "I have been waiting for you, Don Gero. Forgive me if I'm mistaken, - // but it looks like you've lost a little weight..." + Message_StartTextbox(play, 0xD76, &this->actor); } else { - Message_StartTextbox(play, 0xD7F, &this->actor); // "Well, if it isn't the great Don Gero." + Message_StartTextbox(play, 0xD7F, &this->actor); } } else if ((this->actor.xzDistToPlayer < 150.0f) && (Player_IsFacingActor(&this->actor, 0x3000, play) || diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 1ab5f2cc6..4aa052549 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -140,36 +140,36 @@ void EnMinislime_CheckBackgroundCollision(EnMinislime* this) { f32 scaleY = this->actor.scale.y * 400.0f; f32 scaleZ = this->actor.scale.z * 400.0f; - this->actor.bgCheckFlags &= ~(0x10 | 0x8 | 0x2); + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); if ((this->actor.world.pos.y + scaleY) > GBT_ROOM_5_MAX_Y) { - this->actor.bgCheckFlags |= 0x10; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags |= BGCHECKFLAG_CEILING; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.world.pos.y = GBT_ROOM_5_MAX_Y - scaleY; } else if ((this->actor.world.pos.y - scaleY) < GBT_ROOM_5_MIN_Y) { this->actor.world.pos.y = GBT_ROOM_5_MIN_Y + scaleY; - if (!(this->actor.bgCheckFlags & 1)) { - this->actor.bgCheckFlags |= 2; + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH; } - this->actor.bgCheckFlags |= 1; + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; } else { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } if ((this->actor.world.pos.x + scaleX) > GBT_ROOM_5_MAX_X) { - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; this->actor.world.pos.x = GBT_ROOM_5_MAX_X - scaleX; } else if ((this->actor.world.pos.x - scaleX) < GBT_ROOM_5_MIN_X) { this->actor.world.pos.x = GBT_ROOM_5_MIN_X + scaleX; - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; } if ((this->actor.world.pos.z + scaleZ) > GBT_ROOM_5_MAX_Z) { - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; this->actor.world.pos.z = GBT_ROOM_5_MAX_Z - scaleZ; } else if ((this->actor.world.pos.z - scaleZ) < GBT_ROOM_5_MIN_Z) { this->actor.world.pos.z = GBT_ROOM_5_MIN_Z + scaleZ; - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; } } @@ -202,7 +202,7 @@ void EnMinislime_AddIceShardEffect(EnMinislime* this) { } this->frozenAlpha = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_BROKEN); } void EnMinislime_AddIceSmokeEffect(EnMinislime* this, PlayState* play) { @@ -240,14 +240,14 @@ void EnMinislime_SetupFall(EnMinislime* this, PlayState* play) { this->collider.base.atFlags |= AT_ON; this->collider.base.acFlags |= AC_ON; this->collider.base.ocFlags1 |= OC1_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -2.0f; if (this->actionFunc != EnMinislime_GekkoThrow) { this->actor.scale.x = 0.095f; this->actor.scale.z = 0.095f; this->actor.scale.y = 0.10700001f; - if (Actor_XZDistanceBetweenActors(&this->actor, &player->actor) < 225.0f) { - yaw = Actor_YawBetweenActors(&player->actor, &this->actor); + if (Actor_WorldDistXZToActor(&this->actor, &player->actor) < 225.0f) { + yaw = Actor_WorldYawTowardActor(&player->actor, &this->actor); this->actor.world.pos.x = Math_SinS(yaw) * 225.0f + player->actor.world.pos.x; this->actor.world.pos.z = Math_CosS(yaw) * 225.0f + player->actor.world.pos.z; } @@ -259,7 +259,7 @@ void EnMinislime_Fall(EnMinislime* this, PlayState* play) { Math_StepToF(&this->actor.scale.x, 0.17999999f, 0.003f); Math_StepToF(&this->actor.scale.y, 0.05f, 0.003f); this->actor.scale.z = this->actor.scale.x; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnMinislime_SetupGrowAndShrink(this); } } @@ -267,11 +267,11 @@ void EnMinislime_Fall(EnMinislime* this, PlayState* play) { void EnMinislime_SetupBreakFromBigslime(EnMinislime* this) { f32 velY; - this->actor.world.rot.y = Actor_YawBetweenActors(this->actor.parent, &this->actor); + this->actor.world.rot.y = Actor_WorldYawTowardActor(this->actor.parent, &this->actor); this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.speedXZ = Math_CosS(this->actor.world.rot.x) * 15.0f; + this->actor.speed = Math_CosS(this->actor.world.rot.x) * 15.0f; velY = Math_SinS(this->actor.world.rot.x) * 15.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = velY + 2.0f; this->actor.gravity = -1.0f; this->frozenScale = 0.1f; @@ -289,7 +289,7 @@ void EnMinislime_BreakFromBigslime(EnMinislime* this, PlayState* play) { this->actor.shape.rot.x += this->actor.world.rot.x; if (this->actor.velocity.y < 0.0f) { this->collider.base.ocFlags1 |= OC1_ON; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnMinislime_AddIceShardEffect(this); this->attackTimer = 40; EnMinislime_SetupGrowAndShrink(this); @@ -300,7 +300,7 @@ void EnMinislime_BreakFromBigslime(EnMinislime* this, PlayState* play) { void EnMinislime_SetupIceArrowDamage(EnMinislime* this) { this->collider.base.atFlags &= ~AT_ON; this->frozenTimer = 80; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->frozenScale = 0.1f; this->actionFunc = EnMinislime_IceArrowDamage; } @@ -341,7 +341,7 @@ void EnMinislime_IceArrowDamage(EnMinislime* this, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { EnMinislime_AddIceShardEffect(this); EnMinislime_SetupGrowAndShrink(this); } @@ -354,7 +354,7 @@ void EnMinislime_SetupFireArrowDamage(EnMinislime* this) { this->actor.shape.rot.z = 0; this->actor.world.rot.x = 0; this->collider.base.acFlags &= ~AC_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnMinislime_FireArrowDamage; } @@ -385,13 +385,13 @@ void EnMinislime_SetupGrowAndShrink(EnMinislime* this) { this->actor.shape.rot.y = 0; this->actor.shape.rot.z = 0; this->actor.world.rot.x = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); this->growShrinkTimer = 42; this->actor.scale.x = 0.19f; this->actor.scale.y = 0.044999998f; this->actor.scale.z = 0.19f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SLIME_JUMP2); + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_JUMP2); this->actionFunc = EnMinislime_GrowAndShrink; } @@ -425,8 +425,8 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { this->idleTimer--; speedXZ = sin_rad(this->idleTimer * (M_PI / 10)); - this->actor.speedXZ = speedXZ * 1.5f; - this->actor.speedXZ = CLAMP_MIN(this->actor.speedXZ, 0.0f); + this->actor.speed = speedXZ * 1.5f; + this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f); Math_StepToF(&this->actor.scale.x, ((0.14f * speedXZ) + 1.5f) * 0.1f, 0.010000001f); Math_StepToF(&this->actor.scale.y, ((cos_rad(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f, 0.010000001f); Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f); @@ -434,8 +434,8 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { if (this->actor.xzDistToPlayer < 300.0f) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { - this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } else { this->actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x13); } @@ -451,9 +451,9 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { } void EnMinislime_SetupBounce(EnMinislime* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->bounceTimer = (this->actionFunc == EnMinislime_GrowAndShrink) ? 1 : 4; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SLIME_JUMP1); + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_JUMP1); this->actionFunc = EnMinislime_Bounce; } @@ -466,7 +466,7 @@ void EnMinislime_Bounce(EnMinislime* this, PlayState* play) { if (this->bounceTimer == 0) { this->actor.gravity = -2.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actor.velocity.y = 12.0f; this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -478,7 +478,7 @@ void EnMinislime_Bounce(EnMinislime* this, PlayState* play) { } else { Math_StepToF(&this->actor.scale.x, 0.17999999f, 0.003f); Math_StepToF(&this->actor.scale.y, 0.05f, 0.003f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnMinislime_SetupGrowAndShrink(this); return; } @@ -490,9 +490,9 @@ void EnMinislime_Bounce(EnMinislime* this, PlayState* play) { void EnMinislime_SetupMoveToBigslime(EnMinislime* this) { this->actor.gravity = 0.0f; - this->actor.speedXZ = 15.0f; - this->actor.shape.rot.x = Actor_PitchToPoint(&this->actor, &this->actor.parent->home.pos); - this->actor.shape.rot.y = Actor_YawToPoint(&this->actor, &this->actor.parent->home.pos); + this->actor.speed = 15.0f; + this->actor.shape.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->actor.parent->home.pos); + this->actor.shape.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.parent->home.pos); this->actor.world.rot.x = -this->actor.shape.rot.x; this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.atFlags &= ~AT_ON; @@ -517,7 +517,7 @@ void EnMinislime_MoveToBigslime(EnMinislime* this, PlayState* play) { EnMinislime_SetupDisappear(this); } else if ((this->actor.scale.x > 0.0f) && (this->actor.world.pos.y > (GBT_ROOM_5_MAX_Y - 100.0f))) { this->actor.params = MINISLIME_SETUP_DISAPPEAR; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Actor_SetScale(&this->actor, 0.0f); } } @@ -526,7 +526,7 @@ void EnMinislime_SetupKnockback(EnMinislime* this) { this->collider.base.acFlags &= ~AC_ON; this->collider.base.ocFlags1 |= OC1_ON; this->knockbackTimer = 30; - this->actor.speedXZ = 20.0f; + this->actor.speed = 20.0f; func_800BE504(&this->actor, &this->collider); this->actionFunc = EnMinislime_Knockback; } @@ -535,7 +535,7 @@ void EnMinislime_Knockback(EnMinislime* this, PlayState* play) { f32 sqrtFrozenTimer; this->knockbackTimer--; - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); sqrtFrozenTimer = sqrtf(this->knockbackTimer); this->actor.scale.x = ((cos_rad(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f; this->actor.scale.z = this->actor.scale.x; @@ -556,7 +556,7 @@ void EnMinislime_SetupDefeatIdle(EnMinislime* this) { this->idleTimer = 20; this->collider.base.atFlags &= ~(AT_ON | AT_HIT); this->collider.base.acFlags &= ~(AC_ON | AC_HIT); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->frozenAlpha > 20) { EnMinislime_AddIceShardEffect(this); } @@ -625,7 +625,7 @@ void EnMinislime_Despawn(EnMinislime* this, PlayState* play) { } void EnMinislime_SetupMoveToGekko(EnMinislime* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->collider.base.acFlags &= ~AC_ON; @@ -657,11 +657,11 @@ void EnMinislime_SetupGekkoThrow(EnMinislime* this) { this->collider.base.acFlags |= AC_ON; this->collider.base.ocFlags1 |= OC1_ON; xzDistToPlayer = CLAMP_MIN(this->actor.xzDistToPlayer, 200.0f); - this->actor.speedXZ = 17.5f; + this->actor.speed = 17.5f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.gravity = -1.0f; this->actor.velocity.y = ((xzDistToPlayer - 200.0f) * 0.01f) + 3.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->throwTimer = 10; this->actionFunc = EnMinislime_GekkoThrow; } @@ -678,7 +678,7 @@ void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) { this->throwTimer = 10; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnMinislime_SetupGrowAndShrink(this); } } @@ -713,7 +713,7 @@ void EnMinislime_Update(Actor* thisx, PlayState* play) { s32 pad; Vec3f vec1; - if ((this->actor.params == MINISLIME_DEFEAT_IDLE) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.params == MINISLIME_DEFEAT_IDLE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnMinislime_SetupDefeatIdle(this); } else if (this->actor.params == MINISLIME_DEFEAT_MELT) { EnMinislime_SetupDefeatMelt(this, play); @@ -761,7 +761,7 @@ void EnMinislime_Update(Actor* thisx, PlayState* play) { this->attackTimer--; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { player = GET_PLAYER(play); vec1.x = this->actor.world.pos.x; vec1.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 894d73a6f..ced5f991b 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -170,7 +170,7 @@ void func_809596A0(EnMk* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959774; } break; @@ -279,15 +279,15 @@ void func_80959A24(EnMk* this, PlayState* play) { case 0xFA4: case 0xFAA: case 0xFAE: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0xFA2: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; } else { - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); } break; @@ -303,53 +303,53 @@ void func_80959A24(EnMk* this, PlayState* play) { case 0xFBD: case 0xFBE: case 0xFBF: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; break; case 0xFA0: SET_WEEKEVENTREG(WEEKEVENTREG_19_04); - func_80151938(play, 0xFA1); + Message_ContinueTextbox(play, 0xFA1); break; case 0xFA8: SET_WEEKEVENTREG(WEEKEVENTREG_19_08); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { - func_80151938(play, 0xFBD); + Message_ContinueTextbox(play, 0xFBD); } else { - func_80151938(play, 0xFA9); + Message_ContinueTextbox(play, 0xFA9); } break; case 0xFAC: SET_WEEKEVENTREG(WEEKEVENTREG_19_10); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { - func_80151938(play, 0xFBE); + Message_ContinueTextbox(play, 0xFBE); } else { - func_80151938(play, 0xFAD); + Message_ContinueTextbox(play, 0xFAD); } break; case 0xFB1: SET_WEEKEVENTREG(WEEKEVENTREG_19_20); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; break; case 0xFB3: case 0xFB4: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; this->actor.flags &= ~ACTOR_FLAG_10000; break; case 0xFB5: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80959E18; break; } diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index cbbaffca9..7da0b46e3 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -256,31 +256,31 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { s32 sp20; this->unk_14E--; - if ((this->actor.params == 1) && (this->actor.bgCheckFlags & 1) && (this->actor.speedXZ > 2.5f) && + if ((this->actor.params == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed > 2.5f) && ((play->gameplayFrames % 3) == 0)) { func_80A4E22C(this, play); } if (this->unk_14E > 0) { - Math_StepToF(&this->actor.speedXZ, 5.0f, 0.7f); + Math_StepToF(&this->actor.speed, 5.0f, 0.7f); sp20 = false; } else { - sp20 = Math_StepToF(&this->actor.speedXZ, 0.0f, 0.7f); + sp20 = Math_StepToF(&this->actor.speed, 0.0f, 0.7f); } if ((player->stateFlags3 & 0x100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { - Math_ScaledStepToS(&this->unk_150, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x400); + Math_ScaledStepToS(&this->unk_150, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x400); } else if ((player->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer + 0x8000, 0x400); } else { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); } this->actor.shape.rot.y = - (s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speedXZ)) + this->unk_150; + (s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); if (sp20) { this->unk_14B &= ~2; func_80A4E190(this); } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & 0x100)) && - (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & 1) && + (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (Actor_IsFacingPlayer(&this->actor, 0x1800)) && (this->actor.xzDistToPlayer < 120.0f) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { func_80A4E58C(this); @@ -289,9 +289,9 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { void func_80A4E58C(EnMkk* this) { this->unk_14B |= 1; - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actor.velocity.y = 5.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUROSUKE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUROSUKE_ATTACK); this->collider.base.atFlags |= AT_ON; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); this->actionFunc = func_80A4E60C; @@ -301,7 +301,7 @@ void func_80A4E60C(EnMkk* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~(AT_ON | AT_HIT); } - if ((this->actor.velocity.y < 0.0f) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.velocity.y < 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_149 = 2; this->collider.base.atFlags &= ~AT_ON; func_80A4E2B8(this); @@ -313,35 +313,35 @@ void func_80A4E67C(EnMkk* this) { this->actor.flags &= ~ACTOR_FLAG_1; this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD); this->alpha = 254; func_800BE568(&this->actor, &this->collider); - this->actor.speedXZ = 7.0f; + this->actor.speed = 7.0f; this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.velocity.y = 5.0f; this->actor.gravity = -1.3f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actionFunc = func_80A4E72C; } void func_80A4E72C(EnMkk* this, PlayState* play) { Vec3f temp; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.velocity.y > -1.0f) { temp.x = this->actor.world.pos.x; temp.y = this->actor.world.pos.y + 15.0f; temp.z = this->actor.world.pos.z; EffectSsDeadDb_Spawn(play, &temp, &gZeroVec3f, &gZeroVec3f, &sEffPrimColors[this->actor.params], &sEffEnvColors[this->actor.params], 0x46, 4, 0xC); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EXTINCT); + Actor_PlaySfx(&this->actor, NA_SE_EN_EXTINCT); if (this->unk_14C != 0) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, this->unk_14C * 0x10); } func_80A4EEF4(this); } else { this->actor.velocity.y *= -0.8f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } } @@ -379,16 +379,16 @@ void func_80A4E84C(EnMkk* this) { this->unk_154.y = this->actor.world.pos.y; this->unk_154.x = this->actor.world.pos.x - 10.0f * Math_SinS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); this->unk_154.z = this->actor.world.pos.z - 10.0f * Math_CosS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); this->unk_160.x = this->unk_154.x - 12.0f * Math_SinS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); this->unk_160.z = this->unk_154.z - 12.0f * Math_CosS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + (s32)(1228.8f * this->actor.speed * sin_rad(this->unk_14E * (M_PI / 5)))); } } @@ -421,7 +421,7 @@ void EnMkk_Update(Actor* thisx, PlayState* play) { } if (Actor_IsFacingPlayer(&this->actor, 0x3000)) { player = GET_PLAYER(play); - this->actor.shape.rot.x = Actor_PitchToPoint(&this->actor, &player->actor.focus.pos); + this->actor.shape.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &player->actor.focus.pos); this->actor.shape.rot.x = CLAMP(this->actor.shape.rot.x, -0x1800, 0x1800); } Actor_SetFocus(&this->actor, 10.0f); @@ -483,7 +483,7 @@ void func_80A4EF74(EnMkk* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_80A4EDF0(this); } else { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index d9b0bf507..cc2e5803e 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -124,54 +124,54 @@ void func_80965DB4(EnMm* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { func_80965BBC(this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PULL_UP_ROCK); + Actor_PlaySfx(&this->actor, NA_SE_PL_PULL_UP_ROCK); } else { - if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & 0x10)) { + if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { this->actor.velocity.y = 0.0f; } - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + if ((this->actor.speed != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { angle = BINANG_SUB(this->actor.world.rot.y, BINANG_ROT180(this->actor.wallYaw)); this->actor.world.rot.y += BINANG_SUB(0x8000, (s16)(angle * 2)); - this->actor.speedXZ *= 0.5f; + this->actor.speed *= 0.5f; CollisionCheck_SpawnShieldParticles(play, &this->actor.world.pos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); } - if (!(this->actor.bgCheckFlags & 1)) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.08f); + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Math_StepToF(&this->actor.speed, 0.0f, 0.08f); } else { - temp_f14 = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; - temp_f12 = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + temp_f14 = Math_SinS(this->actor.world.rot.y) * this->actor.speed; + temp_f12 = Math_CosS(this->actor.world.rot.y) * this->actor.speed; Actor_GetSlopeDirection(this->actor.floorPoly, &slopeNormal, &downwardSlopeYaw); temp_f14 += 3.0f * slopeNormal.x; temp_f12 += 3.0f * slopeNormal.z; temp_f2 = sqrtf(SQ(temp_f14) + SQ(temp_f12)); - if ((temp_f2 < this->actor.speedXZ) || + if ((temp_f2 < this->actor.speed) || (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { - this->actor.speedXZ = CLAMP_MAX(temp_f2, 16.0f); + this->actor.speed = CLAMP_MAX(temp_f2, 16.0f); this->actor.world.rot.y = Math_Atan2S_XY(temp_f12, temp_f14); } - if (!Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f)) { + if (!Math_StepToF(&this->actor.speed, 0.0f, 1.0f)) { direction = this->actor.world.rot.y; if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, this->actor.shape.rot.y)) > 0x4000) { direction = BINANG_ROT180(direction); } - Math_ScaledStepToS(&this->actor.shape.rot.y, direction, this->actor.speedXZ * 100.0f); - this->unk_190 += (s16)(this->actor.speedXZ * 800.0f); + Math_ScaledStepToS(&this->actor.shape.rot.y, direction, this->actor.speed * 100.0f); + this->unk_190 += (s16)(this->actor.speed * 800.0f); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->actor.velocity.y < -6.0f) { this->actor.velocity.y *= -0.3f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); } else { - Actor_PickUp(&this->actor, play, GI_NONE, 50.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 50.0f, 30.0f); } } @@ -186,7 +186,7 @@ void func_8096611C(EnMm* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { EnMm_SetupAction(this, func_80965DB4); this->actor.room = play->roomCtx.curRoom.num; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); gSaveContext.unk_1014 = 0; } else { diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 14c8d1170..48a379304 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -49,7 +49,7 @@ void EnMm2_Reading(EnMm2* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnMm2_WaitForRead; } break; diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 3e58691cc..1fc29eafc 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -106,7 +106,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) { void EnMm3_Destroy(Actor* thisx, PlayState* play) { EnMm3* this = THIS; - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); Collider_DestroyCylinder(play, &this->collider); } @@ -271,7 +271,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { break; case 0x2793: - func_801477B4(play); + Message_CloseTextbox(play); func_80A6FE1C(this); func_80A6FE30(this, play); break; @@ -279,7 +279,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { case 0x2795: case 0x2796: case 0x2797: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { Message_StartTextbox(play, 0x279B, &this->actor); this->unk_2B4 = 0x279B; func_80151BB4(play, 0xB); @@ -347,12 +347,12 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { } else { Interface_StartPostmanTimer(0, POSTMAN_MINIGAME_BUNNY_HOOD_OFF); } - func_801477B4(play); + Message_CloseTextbox(play); play_sound(NA_SE_SY_START_SHOT); func_80A6FBA0(this); } else { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); func_80A6F270(this); } } @@ -365,7 +365,7 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && Animation_OnFrame(&this->skelAnime, 8.0f) && (this->unk_2AE == 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LIE_DOWN_ON_BED); + Actor_PlaySfx(&this->actor, NA_SE_EV_LIE_DOWN_ON_BED); this->unk_2AE = 1; } } @@ -373,9 +373,9 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { void func_80A6FBA0(EnMm3* this) { AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); - func_801A0238(0, 5); - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + Audio_SetMainBgmVolume(0, 5); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = func_80A6FBFC; } @@ -400,7 +400,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { AudioSfx_MuteBanks(0); - func_801A0238(0x7F, 5); + Audio_SetMainBgmVolume(0x7F, 5); Message_StartTextbox(play, 0x2791, &this->actor); this->unk_2B4 = 0x2791; this->unk_2AC = 7; @@ -431,9 +431,9 @@ void func_80A6FE30(EnMm3* this, PlayState* play) { this->actor.parent = NULL; func_80A6FED8(this); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_01)) { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } } @@ -453,7 +453,7 @@ void func_80A6FEEC(EnMm3* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; func_80A6F9C8(this); } else { - func_800B85E0(&this->actor, play, 200.0f, -1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 6aac1355d..d7a4fff3d 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -69,7 +69,7 @@ void EnMs_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.015f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; // Eating Magic Beans all day will do that to you this->actionFunc = EnMs_Wait; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; } @@ -106,9 +106,9 @@ void EnMs_Talk(EnMs* this, PlayState* play) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - func_801477B4(play); - Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, - this->actor.playerHeightRel); + Message_CloseTextbox(play); + Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, + this->actor.playerHeightRel); this->actionFunc = EnMs_Sell; } break; @@ -117,16 +117,16 @@ void EnMs_Talk(EnMs* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // yes - func_801477B4(play); + Message_CloseTextbox(play); if (gSaveContext.save.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); - func_80151938(play, 0x935); // "[...] You don't have enough Rupees." + Message_ContinueTextbox(play, 0x935); // "[...] You don't have enough Rupees." } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { play_sound(NA_SE_SY_ERROR); - func_80151938(play, 0x937); // "[...] You can't carry anymore." + Message_ContinueTextbox(play, 0x937); // "[...] You can't carry anymore." } else { func_8019F208(); - Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); Rupees_ChangeBy(-10); this->actionFunc = EnMs_Sell; } @@ -135,7 +135,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { case 1: // no default: func_8019F230(); - func_80151938(play, 0x934); // "[...] Well, if your mood changes [...]" + Message_ContinueTextbox(play, 0x934); // "[...] Well, if your mood changes [...]" break; } } @@ -152,13 +152,13 @@ void EnMs_Sell(EnMs* this, PlayState* play) { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_NONE); this->actionFunc = EnMs_TalkAfterPurchase; } else { - Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80151938(play, 0x936); // "You can plant 'em whenever you want [...]" + Message_ContinueTextbox(play, 0x936); // "You can plant 'em whenever you want [...]" this->actionFunc = EnMs_Talk; } else { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_MINUS1); diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 7b2dc9db6..e772e12fa 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -220,7 +220,8 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { } if ((currentCheckpoints[0] > 0) && (currentCheckpoints[0] < highestCurrentCheckpoint) && - (player->actor.bgCheckFlags & 1) && ((highestCurrentCheckpoint - currentCheckpoints[0]) >= 24)) { + (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + ((highestCurrentCheckpoint - currentCheckpoints[0]) >= 24)) { playerIsLikelyToLose = true; } @@ -245,7 +246,7 @@ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = transitionType; gSaveContext.nextTransitionType = nextTransitionType; - func_801477B4(play); + Message_CloseTextbox(play); return 1; } @@ -256,7 +257,7 @@ void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start func_800B7298(play, &this->actor, PLAYER_CSMODE_7); - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->actionFunc = EnMttag_PotentiallyRestartRace; } @@ -316,7 +317,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; - Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); play->envCtx.unk_E4 = 0xFE; player->stateFlags1 &= ~PLAYER_STATE1_20; } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { @@ -361,14 +362,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { if (EnMttag_IsInFinishLine(playerPos)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); - Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_11); this->actionFunc = EnMttag_RaceFinish; } else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); - Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_12); this->actionFunc = EnMttag_RaceFinish; @@ -431,7 +432,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; - func_801477B4(play); + Message_CloseTextbox(play); func_800B7298(play, &this->actor, PLAYER_CSMODE_7); Magic_Add(play, MAGIC_FILL_TO_CAPACITY); @@ -466,7 +467,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { // Keep racing func_8019F208(); - func_801477B4(play); + Message_CloseTextbox(play); func_800B7298(play, &this->actor, PLAYER_CSMODE_6); CLEAR_EVENTINF(EVENTINF_13); this->timer = 100; diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index c10244e55..b5bc6610e 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -178,7 +178,7 @@ void func_80A68A78(EnMushi2* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MUSHI2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y + (D_80A6B998 + i)->unk_02, this->actor.shape.rot.z, - (D_80A6B998 + i)->unk_00, this->actor.cutscene, this->actor.unk20, NULL); + (D_80A6B998 + i)->unk_00, this->actor.cutscene, this->actor.halfDaysBits, NULL); } } @@ -204,7 +204,7 @@ void func_80A68BC8(EnMushi2* this) { if (this->unk_36C > 0) { this->unk_36C--; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MUSI_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_MUSI_WALK); this->unk_36C = 3.0f / CLAMP_MIN(this->skelAnime.playSpeed, 0.12f); if (this->unk_36C < 2) { @@ -275,9 +275,9 @@ s32 func_80A68DD4(EnMushi2* this, PlayState* play) { } void func_80A68ED8(EnMushi2* this) { - this->actor.velocity.x = this->actor.speedXZ * this->unk_328.x; - this->actor.velocity.y = this->actor.speedXZ * this->unk_328.y; - this->actor.velocity.z = this->actor.speedXZ * this->unk_328.z; + this->actor.velocity.x = this->actor.speed * this->unk_328.x; + this->actor.velocity.y = this->actor.speed * this->unk_328.y; + this->actor.velocity.z = this->actor.speed * this->unk_328.z; Actor_UpdatePos(&this->actor); } @@ -797,7 +797,7 @@ void func_80A6A36C(EnMushi2* this, PlayState* play) { s32 pad; s32 sp20 = false; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); this->actor.velocity.y -= this->actor.velocity.y * D_80A6BA14[ENMUSHI2_GET_3(&this->actor)]; Actor_MoveWithGravity(&this->actor); func_80A69424(this, play); @@ -820,10 +820,10 @@ void func_80A6A36C(EnMushi2* this, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { func_80A6AAA4(this); - } else if (this->actor.bgCheckFlags & 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_WALK); + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_WALK); func_80A68F24(this); func_80A691EC(this, this->actor.floorPoly, -1.0f); func_80A69388(this); @@ -853,11 +853,11 @@ void func_80A6A5C0(EnMushi2* this, PlayState* play) { EnMushi2* this2 = this; func_80A69D3C(this); - Math_SmoothStepToF(&this->actor.speedXZ, this->unk_35C, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, this->unk_35C, 0.1f, 0.5f, 0.0f); if (this->unk_354 < SQ(40.0f)) { f32 temp = 1.0f - ((SQ(40.0f) - this->unk_354) * (1.0f / (10.0f * SQ(40.0f)))); - this->actor.speedXZ *= temp; + this->actor.speed *= temp; } func_80A68ED8(this); @@ -866,7 +866,7 @@ void func_80A6A5C0(EnMushi2* this, PlayState* play) { func_80A69388(this); } - this->skelAnime.playSpeed = this->actor.speedXZ * 1.6f; + this->skelAnime.playSpeed = this->actor.speed * 1.6f; this2->skelAnime.playSpeed = CLAMP(this2->skelAnime.playSpeed, 0.1f, 1.9f); if ((this->unk_36A <= 0) || func_80A68BA0(this)) { @@ -896,7 +896,7 @@ void func_80A6A794(EnMushi2* this) { void func_80A6A824(EnMushi2* this, PlayState* play) { EnMushi2* this2 = this; - Math_SmoothStepToF(&this->actor.speedXZ, this->unk_35C, 0.1f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, this->unk_35C, 0.1f, 0.5f, 0.0f); func_80A68ED8(this); func_80A697C4(this, play); @@ -904,7 +904,7 @@ void func_80A6A824(EnMushi2* this, PlayState* play) { func_80A69388(this); } - this->skelAnime.playSpeed = (Rand_ZeroOne() * 0.8f) + (this->actor.speedXZ * 1.2f); + this->skelAnime.playSpeed = (Rand_ZeroOne() * 0.8f) + (this->actor.speed * 1.2f); this2->skelAnime.playSpeed = CLAMP(this2->skelAnime.playSpeed, 0.0f, 1.9f); if ((this->unk_36A <= 0) || func_80A68BA0(this)) { @@ -963,9 +963,9 @@ void func_80A6AB08(EnMushi2* this, PlayState* play) { s16 temp; if (this->unk_368 > 80) { - Math_StepToF(&this->actor.speedXZ, 0.6f, 0.08f); + Math_StepToF(&this->actor.speed, 0.6f, 0.08f); } else { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.02f); + Math_StepToF(&this->actor.speed, 0.0f, 0.02f); } Actor_MoveWithGravity(&this->actor); @@ -1005,7 +1005,7 @@ void func_80A6AB08(EnMushi2* this, PlayState* play) { func_80A6A094(this); func_80A6A0D8(this); func_80A6AE14(this); - } else if (!(this->actor.bgCheckFlags & 0x20)) { + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { func_80A6A794(this); } } @@ -1025,8 +1025,8 @@ void func_80A6AE7C(EnMushi2* this, PlayState* play) { this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.y += 0xC8; - this->actor.speedXZ += (Rand_ZeroOne() - 0.5f) * 0.16f; - this->actor.speedXZ *= 0.9f; + this->actor.speed += (Rand_ZeroOne() - 0.5f) * 0.16f; + this->actor.speed *= 0.9f; this->actor.world.rot.y += (s16)((Rand_ZeroOne() - 0.5f) * 2000.0f); this->actor.gravity = -0.04f - (Rand_ZeroOne() * 0.02f); this->actor.velocity.y *= 0.95f; @@ -1049,7 +1049,7 @@ void func_80A6B078(EnMushi2* this) { this->unk_30C &= ~1; this->unk_368 = 50; this->skelAnime.playSpeed = 1.9f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTURA_BOUND); func_80A68B6C(this); this->actionFunc = func_80A6B0D8; } @@ -1058,7 +1058,7 @@ void func_80A6B0D8(EnMushi2* this, PlayState* play) { s32 pad[2]; f32 temp_f2; - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.4f, 1.2f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.4f, 1.2f, 0.0f); temp_f2 = this->actor.scale.x - 0.0002f; Actor_SetScale(&this->actor, CLAMP_MIN(temp_f2, 0.001f)); @@ -1077,11 +1077,11 @@ void func_80A6B0D8(EnMushi2* this, PlayState* play) { } this->actor.velocity.x = - (this->actor.speedXZ * this->unk_328.x) + (-0.01f * this->unk_31C.x) + (this->unk_310.x * temp_f2); + (this->actor.speed * this->unk_328.x) + (-0.01f * this->unk_31C.x) + (this->unk_310.x * temp_f2); this->actor.velocity.y = - (this->actor.speedXZ * this->unk_328.y) + (-0.01f * this->unk_31C.y) + (this->unk_310.y * temp_f2); + (this->actor.speed * this->unk_328.y) + (-0.01f * this->unk_31C.y) + (this->unk_310.y * temp_f2); this->actor.velocity.z = - (this->actor.speedXZ * this->unk_328.z) + (-0.01f * this->unk_31C.z) + (this->unk_310.z * temp_f2); + (this->actor.speed * this->unk_328.z) + (-0.01f * this->unk_31C.z) + (this->unk_310.z * temp_f2); if ((this->actor.flags & ACTOR_FLAG_40) && (this->unk_368 > 20) && (Rand_ZeroOne() < 0.15f)) { Vec3f sp48; @@ -1225,7 +1225,7 @@ void EnMushi2_Update(Actor* thisx, PlayState* play) { } if ((this->unk_30C & 1) && func_80A68DD4(this, play)) { - Actor_PickUp(&this->actor, play, GI_MAX, 60.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 30.0f); } } } diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index f9d17ca96..49d37330b 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -199,7 +199,7 @@ void EnMuto_InDialogue(EnMuto* this, PlayState* play) { if (!this->isInMayorsRoom) { this->yawTowardsTarget = this->actor.yawTowardsPlayer; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (this->actor.textId == 0x62C) { SET_WEEKEVENTREG(WEEKEVENTREG_88_08); diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 86099a214..562217efd 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -171,7 +171,7 @@ void EnNeoReeba_WaitUnderground(EnNeoReeba* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if ((Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos) < 200.0f) && + if ((Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { EnNeoReeba_SetupRise(this); } @@ -199,7 +199,7 @@ void EnNeoReeba_SetupChooseAction(EnNeoReeba* this) { void EnNeoReeba_ChooseAction(EnNeoReeba* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 distToPlayer = Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos); + f32 distToPlayer = Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos); if ((distToPlayer > 200.0f) || (fabsf(this->actor.playerHeightRel) > 100.0f)) { EnNeoReeba_SetupSink(this); @@ -207,8 +207,8 @@ void EnNeoReeba_ChooseAction(EnNeoReeba* this, PlayState* play) { if (this->actionTimer == 0) { if ((distToPlayer < 140.0f) && (fabsf(this->actor.playerHeightRel) < 100.0f)) { this->targetPos = player->actor.world.pos; - this->targetPos.x += 10.0f * player->actor.speedXZ * Math_SinS(player->actor.world.rot.y); - this->targetPos.z += 10.0f * player->actor.speedXZ * Math_CosS(player->actor.world.rot.y); + this->targetPos.x += 10.0f * player->actor.speed * Math_SinS(player->actor.world.rot.y); + this->targetPos.z += 10.0f * player->actor.speed * Math_CosS(player->actor.world.rot.y); EnNeoReeba_SetupMove(this); } else { EnNeoReeba_SetupReturnHome(this); @@ -224,7 +224,7 @@ void EnNeoReeba_ChooseAction(EnNeoReeba* this, PlayState* play) { void EnNeoReeba_SetupSink(EnNeoReeba* this) { this->sinkRiseRate = 0.0f; this->skelAnime.playSpeed = 2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = EnNeoReeba_Sink; } @@ -247,7 +247,7 @@ void EnNeoReeba_SetupRise(EnNeoReeba* this) { this->actor.draw = EnNeoReeba_Draw; this->sinkRiseRate = 300.0f; this->skelAnime.playSpeed = 2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); this->actor.flags |= ACTOR_FLAG_1; this->actionFunc = EnNeoReeba_RiseOutOfGround; } @@ -268,28 +268,28 @@ void EnNeoReeba_RiseOutOfGround(EnNeoReeba* this, PlayState* play) { } void EnNeoReeba_SetupMove(EnNeoReeba* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIVA_MOVE); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_MOVE); this->sfxTimer = 10; this->actionTimer = 60; this->actionFunc = EnNeoReeba_Move; this->skelAnime.playSpeed = 2.0f; - this->actor.speedXZ = 14.0f; + this->actor.speed = 14.0f; } void EnNeoReeba_Move(EnNeoReeba* this, PlayState* play) { - f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speedXZ); + f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speed); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 4.0f, 0xFA, 0xA, 1); if (remainingDist < 2.0f) { EnNeoReeba_SetupChooseAction(this); - } else if (remainingDist < 40.0f && this->actor.speedXZ > 3.0f) { - this->actor.speedXZ -= 2.0f; + } else if (remainingDist < 40.0f && this->actor.speed > 3.0f) { + this->actor.speed -= 2.0f; } if (this->sfxTimer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIVA_MOVE); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_MOVE); this->sfxTimer = 10; } else { this->sfxTimer--; @@ -304,21 +304,21 @@ void EnNeoReeba_Move(EnNeoReeba* this, PlayState* play) { void EnNeoReeba_SetupReturnHome(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_ReturnHome; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } void EnNeoReeba_ReturnHome(EnNeoReeba* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->actor.home.pos, this->actor.speedXZ); + f32 remainingDist = Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->actor.home.pos, this->actor.speed); if (remainingDist < 2.0f) { EnNeoReeba_SetupChooseAction(this); - } else if (remainingDist < 40.0f && this->actor.speedXZ > 3.0f) { - this->actor.speedXZ -= 1.0f; + } else if (remainingDist < 40.0f && this->actor.speed > 3.0f) { + this->actor.speed -= 1.0f; } - if (Actor_XZDistanceToPoint(&player->actor, &this->actor.home.pos) > 200.0f || + if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 200.0f || fabsf(this->actor.playerHeightRel) > 100.0f) { EnNeoReeba_SetupSink(this); } @@ -333,7 +333,7 @@ void EnNeoReeba_SetupBounce(EnNeoReeba* this) { } void EnNeoReeba_Bounce(EnNeoReeba* this, PlayState* play) { - if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speedXZ) < 2.0f) { + if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &this->targetPos, this->actor.speed) < 2.0f) { EnNeoReeba_SetupChooseAction(this); } @@ -345,7 +345,7 @@ void EnNeoReeba_Bounce(EnNeoReeba* this, PlayState* play) { } void EnNeoReeba_SetupStun(EnNeoReeba* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = EnNeoReeba_Stunned; } @@ -378,7 +378,7 @@ void EnNeoReeba_SetupFrozen(EnNeoReeba* this) { this->stunTimer = 12; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = EnNeoReeba_Frozen; } @@ -407,8 +407,8 @@ void EnNeoReeba_SetupDamageAnim(EnNeoReeba* this) { this->velToTarget.x = Math_SinS(this->actor.yawTowardsPlayer) * -12.0f; this->velToTarget.z = Math_CosS(this->actor.yawTowardsPlayer) * -12.0f; this->rotationSpeed = 4551.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIVA_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DAMAGE); this->actionFunc = EnNeoReeba_DamageAnim; } @@ -444,11 +444,11 @@ void EnNeoReeba_SetupDeathEffects(EnNeoReeba* this) { this->velToTarget.z = Math_CosS(this->actor.yawTowardsPlayer) * -12.0f; this->rotationSpeed = 3640.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 25); - this->actor.flags |= ACTOR_FLAG_8000000; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIVA_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DEAD); this->actionFunc = EnNeoReeba_PlayDeathEffects; } @@ -562,12 +562,12 @@ void EnNeoReeba_HandleHit(EnNeoReeba* this, PlayState* play) { this->stunTimer = 40; this->drawEffectAlpha = 1.0f; this->drawEffectScale = 2.0f; - Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); EnNeoReeba_SetupStun(this); break; case EN_NEO_REEBA_DMGEFF_STUN: - Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); EnNeoReeba_SetupStun(this); break; } diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c index abaf6c3e0..9c91d7092 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c @@ -81,7 +81,7 @@ void EnNimotsu_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); - if (!(this->dustDone & 1) && (this->actor.bgCheckFlags & 1)) { + if (!(this->dustDone & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (DECR(this->timer) == 0) { this->dustDone |= 1; } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 1c9212a63..274ddbc49 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -86,41 +86,20 @@ static ColliderCylinderInit sCylinderInit = { { 15, 25, 4, { 0, 0, 0 } }, }; -static Vec3f D_808934C4 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), -}; - -static Vec3f D_808934DC = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static Vec3f D_808934E8 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static s32 pad = 0; - void EnNiw_Init(Actor* thisx, PlayState* play) { + static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), + }; EnNiw* this = THIS; - Vec3f dTemp = D_808934C4; + Vec3f D_808934C4 = { 90000.0f, 90000.0f, 90000.0f }; if (this->actor.params < 0) { // all scene spawned cucco are (-1) this->actor.params = NIW_TYPE_REGULAR; } - Math_Vec3f_Copy(&this->unk2BC, &dTemp); + Math_Vec3f_Copy(&this->unk2BC, &D_808934C4); this->niwType = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -138,9 +117,6 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->niwType == NIW_TYPE_UNK1) { - // @Bug this unused variant is broken and crashes on spawn (EnNiw_Update expects a parent, NULL) - // if modified to change niwType to TYPE_REGULAR here, new size is smaller than normal - // theory: was meant to be a small hand held cucco for grog to show the player Actor_SetScale(&this->actor, (BREG(86) / 10000.0f) + 0.004f); } @@ -154,13 +130,13 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { } if (this->niwType == NIW_TYPE_HELD) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; this->heldTimer = 30; this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF this->niwState = NIW_STATE_HELD; this->actionFunc = EnNiw_Held; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk2BC.z = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; @@ -319,8 +295,8 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { if (this->hopTimer == 0) { this->hopTimer = 3; - if (this->actor.bgCheckFlags & 1) { // hit floor - this->actor.velocity.y = 3.5f; // hopping up while running away + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.velocity.y = 3.5f; // hopping up while running away } } @@ -336,8 +312,7 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { runningDirection = -runningAngles[isStormCucco]; } - if (isStormCucco == true && - (this->runAwayTimer == 0 || (this->actor.bgCheckFlags & 8))) { // bgCheckFlags 8: hit a wall + if (isStormCucco == true && (this->runAwayTimer == 0 || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->runAwayTimer = 150; if (this->yawTimer == 0) { this->yawTimer = 70; @@ -366,17 +341,17 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { s16 nextAnimIndex; if (this->niwType == NIW_TYPE_REGULAR) { - if (Actor_HasParent(&this->actor, play)) { // picked up - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow + if (Actor_HasParent(&this->actor, play)) { // picked up + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->sfxTimer1 = 30; this->heldTimer = 30; this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF this->niwState = NIW_STATE_HELD; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnNiw_Held; return; } else { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } } else { // NIW_TYPE_UNK1 || NIW_TYPE_HELD this->unkIdleTimer2 = 10; @@ -414,8 +389,8 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { } else { this->unkIdleTimer = 4; - if (this->actor.bgCheckFlags & 1) { // hit floor - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; this->actor.velocity.y = 3.5f; // hopping up and down } } @@ -451,7 +426,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { } void EnNiw_Held(EnNiw* this, PlayState* play) { - Vec3f vec3fcopy = D_808934DC; + Vec3f D_808934DC = { 90000.0f, 90000.0f, 90000.0f }; s16 rotZ; if (this->heldTimer == 0) { @@ -476,7 +451,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.z = 0; rotZ = this->actor.shape.rot.z; this->actor.velocity.y = 8.0f; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->actor.gravity = -2.0f; this->niwState = NIW_STATE_FALLING; this->unk2EC = 0; @@ -484,7 +459,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Math_Vec3f_Copy(&this->unk2BC, &vec3fcopy); + Math_Vec3f_Copy(&this->unk2BC, &D_808934DC); this->actor.flags |= ACTOR_FLAG_1; // targetable ON this->actionFunc = EnNiw_Thrown; } @@ -494,16 +469,16 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { void EnNiw_Thrown(EnNiw* this, PlayState* play) { if (this->unk2EC == 0) { - if (this->actor.bgCheckFlags & 1) { // hit floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk2EC = 1; this->hoppingTimer = 80; // hop timer - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 4.0f; } else { return; // wait until back on floor } } else { - if (this->actor.bgCheckFlags & 1) { // hit floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->sfxTimer1 = 0; this->actor.velocity.y = 4.0f; // vertical hop this->unk29E = 1; @@ -519,17 +494,17 @@ void EnNiw_Thrown(EnNiw* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { // picked up again before could run off - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->sfxTimer1 = 30; this->unk2EC = 0; this->heldTimer = 30; this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF this->niwState = NIW_STATE_HELD; this->actionFunc = EnNiw_Held; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (this->hoppingTimer > 5) { - Actor_LiftActor(&this->actor, play); + Actor_OfferCarry(&this->actor, play); } EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } @@ -544,8 +519,8 @@ void EnNiw_Swimming(EnNiw* this, PlayState* play) { EnNiw_SpawnAttackNiw(this, play); // spawn attack niw } - this->actor.speedXZ = 2.0f; - if (this->actor.bgCheckFlags & 0x20) { // touching water + this->actor.speed = 2.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->actor.gravity = 0.0f; if (this->actor.depthInWater > 15.0f) { this->actor.world.pos.y += 2.0f; @@ -557,21 +532,21 @@ void EnNiw_Swimming(EnNiw* this, PlayState* play) { EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 30); } - if (this->actor.bgCheckFlags & 8) { // hit a wall + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 10.0f; // fly up in straight line - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; } } else { this->actor.gravity = -2.0f; - if (this->actor.bgCheckFlags & 8) { // hit a wall + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 10.0f; // fly up in straight line - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actor.gravity = 0.0f; } else { - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } - if (this->actor.bgCheckFlags & 1) { // hit floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.gravity = -2.0f; this->runAwayTimer = 100; this->swimRippleTimer = 0; @@ -629,7 +604,7 @@ void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play) { this->targetLimbRots[1] = 0.0f; this->targetLimbRots[2] = 0.0f; this->unkTimer24C = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); } if (this->cuccoStormTimer == 0) { @@ -646,7 +621,7 @@ void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play) { void EnNiw_CuccoStorm(EnNiw* this, PlayState* play) { EnNiw_SpawnAttackNiw(this, play); if (this->cuccoStormTimer == 1) { // not countdown to 0? mistype? - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->isRunningRight = Rand_ZeroFloat(1.99f); this->generalTimer1 = 0; this->unkTimer24E = this->generalTimer1; @@ -662,12 +637,12 @@ void EnNiw_SetupRunAway(EnNiw* this) { this->isRunningRight = Rand_ZeroFloat(1.99f); this->niwState = NIW_STATE_RUNNING; this->actionFunc = EnNiw_RunAway; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } void EnNiw_RunAway(EnNiw* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f tempVec3f = D_808934E8; + Vec3f D_808934E8 = { 90000.0f, 90000.0f, 90000.0f }; s16 temp298; f32 dX; f32 dZ; @@ -678,12 +653,12 @@ void EnNiw_RunAway(EnNiw* this, PlayState* play) { this->unk2A4.z = this->unk2B0.z = this->actor.world.pos.z; this->generalTimer2 = this->generalTimer1 = this->unk298 = 0; this->unk300 = this->unk304 = 0; - this->actor.speedXZ = 0; + this->actor.speed = 0; this->targetLimbRots[8] = 0; this->targetLimbRots[6] = 0; this->targetLimbRots[5] = 0; this->targetLimbRots[7] = 0; - Math_Vec3f_Copy(&this->unk2BC, &tempVec3f); + Math_Vec3f_Copy(&this->unk2BC, &D_808934E8); EnNiw_SetupIdle(this); @@ -702,7 +677,7 @@ void EnNiw_RunAway(EnNiw* this, PlayState* play) { } void EnNiw_LandBeforeIdle(EnNiw* this, PlayState* play) { - if (this->actor.bgCheckFlags & 1) { // hit floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnNiw_SetupIdle(this); } } @@ -715,7 +690,7 @@ void EnNiw_CheckRage(EnNiw* this, PlayState* play) { this->iframeTimer = 10; this->sfxTimer1 = 30; this->unk29E = 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->runAwayTimer = 100; this->unk2EC = 0; EnNiw_SetupRunAway(this); @@ -746,13 +721,13 @@ void EnNiw_CheckRage(EnNiw* this, PlayState* play) { this->actionFunc = EnNiw_Trigger; this->unk304 = 0.0f; this->unk300 = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { this->iframeTimer = 10; this->sfxTimer1 = 30; this->unk29E = 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); // crow this->runAwayTimer = 100; this->unk2EC = 0; EnNiw_SetupRunAway(this); @@ -857,7 +832,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->actor.world.pos.y = this->actor.home.pos.y + 300.0f; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -2.0f; Math_Vec3f_Copy(&this->unk2A4, &this->actor.home.pos); Math_Vec3f_Copy(&this->unk2B0, &this->actor.home.pos); @@ -890,8 +865,8 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { return; } - if ((this->actor.bgCheckFlags & 0x20) && // touching water - this->actor.depthInWater > 15.0f && this->niwState != NIW_STATE_SWIMMING) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 15.0f) && + (this->niwState != NIW_STATE_SWIMMING)) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; Math_Vec3f_Copy(&pos, &this->actor.world.pos); @@ -911,16 +886,16 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { EnNiw_CheckRage(this, play); if (this->flutterSfxTimer == 0 && this->niwState == NIW_STATE_HELD) { this->flutterSfxTimer = 7; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); } if (this->sfxTimer1 == 0) { if (this->niwState != NIW_STATE_IDLE) { this->sfxTimer1 = 30; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_A); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_A); } else { this->sfxTimer1 = 300; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_N); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_N); } } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index c1cec3b88..c60397535 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -79,7 +79,7 @@ typedef struct EnNiw { /* 0x2E8 */ s16 yawTowardsPlayer; /* 0x2EA */ s16 headRotationToggle; /* 0x2EC */ s16 unk2EC; - /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; + /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; /* 0x2F4 */ f32 unusedFloat2F4; // set in EnNiw_Update if Cucco falls off map, never read /* 0x2F8 */ f32 unusedFloat2F8; /* 0x2FC */ f32 unusedFloat2FC; @@ -91,12 +91,13 @@ typedef struct EnNiw { /* 0x35C */ EnNiwFeather feathers[NIW_FEATHER_COUNT]; } EnNiw; // size = 0x7BC -// in init, any value below zero becomes zero -// however, in vanilla, only 0xFFFF (-1) exists in scene spawns, actors can spawn 0x0 -#define NIW_TYPE_VANILLA 0xFFFF -#define NIW_TYPE_REGULAR 0 -#define NIW_TYPE_UNK1 1 -#define NIW_TYPE_HELD 2 // spawns held by the bomber kid in east clock town during hide and seek +typedef enum { + /* -1 */ NIW_TYPE_VANILLA = -1, // Will be converted to 0, in vanilla exists only in scene spawns + /* 0 */ NIW_TYPE_REGULAR, + /* 1 */ NIW_TYPE_UNK1, // This unused variant must be spawned as a child, as it expects a NON-NULL parent. + // Theory: This was meant to be a small hand held cucco for Grog to show the player + /* 2 */ NIW_TYPE_HELD // spawns held by the bomber kid in east clock town during hide and seek +} NiwType; // the attacking cuccos are not here, they are a different actor: [ ovl_En_Attack_Niw ] typedef enum { diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index ad872cd21..193334ff1 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -57,7 +57,7 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.shape.rot.y = 0; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; if (this->actor.params == 2) { this->timer = 1; this->timerThreshold = 0; @@ -107,9 +107,9 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) { this->actor.world.rot.x = Math_Atan2S_XY(spdXZ, this->actor.velocity.y); } this->actor.home.rot.z += 0x2AA8; - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->actor.bgCheckFlags & 16) || - (this->collider.base.atFlags & AT_HIT) || (this->collider.base.acFlags & AC_HIT) || - (this->collider.base.ocFlags1 & OC1_HIT)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->collider.base.atFlags & AT_HIT) || + (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { if ((player->currentShield == PLAYER_SHIELD_HEROS_SHIELD) && (this->collider.base.atFlags & AT_HIT) && (this->collider.base.atFlags & AT_TYPE_ENEMY) && (this->collider.base.atFlags & AT_BOUNCED)) { EnNutsball_InitColliderParams(this); @@ -138,16 +138,16 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) { Math_Vec3f_Copy(&worldPos, &this->actor.world.pos); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 5.0f, 10.0f, 0x7); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (func_800C9A4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) { - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &worldPos, &this->actor.world.pos, &poly, true, false, false, true, &bgId)) { if (func_800C9A4C(&play->colCtx, poly, bgId) & 0x30) { this->actor.world.pos.x += this->actor.velocity.x * 0.01f; this->actor.world.pos.z += this->actor.velocity.z * 0.01f; } else { - this->actor.bgCheckFlags |= 8; + this->actor.bgCheckFlags |= BGCHECKFLAG_WALL; } } else { Math_Vec3f_Copy(&this->actor.world.pos, &worldPos); diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 74ac78b5f..8c1947267 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -172,7 +172,7 @@ s32 EnNwc_IsFound(EnNwc* this, PlayState* play) { } void EnNwc_ChangeState(EnNwc* this, s16 newState) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; switch (newState) { case NWC_STATE_CHECK_BREMAN: this->stateTimer = 10; @@ -209,7 +209,7 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) { * If previously checking for breman -> select random (NWC_STATE_TURNING, NWC_STATE_HOPPING_FORWARD) */ void EnNwc_ToggleState(EnNwc* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->state != NWC_STATE_CHECK_BREMAN) { EnNwc_ChangeState(this, NWC_STATE_CHECK_BREMAN); } else { @@ -276,7 +276,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { s16 targetUpperBodyRot = 0; s16 targetFootRot = 0; - if (this->actor.speedXZ > 0.0f) { + if (this->actor.speed > 0.0f) { if (this->stateTimer & 4) { targetFootRot = 0x1B58; targetUpperBodyRot = -0x2710; @@ -293,7 +293,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { this->actor.velocity.y = 2.0f; // hop up and down } if ((this->stateTimer & 0x1B) == 24) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_SONG); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICK_SONG); } } @@ -306,13 +306,13 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { this->grog->actor.home.rot.x += 2; // increment grog's adult tranformation counter EnNwc_SpawnDust(this, play); Actor_SetScale(&this->actor, 0.002f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_TO_CHICKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICK_TO_CHICKEN); } } Math_Vec3f_Diff(&chickCoords[this->actor.home.rot.z], &this->actor.world.pos, &targetVector); if (SQXZ(targetVector) < SQ(5.0f)) { // too close to keep moving, stop - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; // first nwc in the line follows player, the rest follow the previous one if (this->actor.home.rot.z == 1) { @@ -329,7 +329,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { } else if (this->randomRot < -0x1388) { this->randomRot = -0x1388; } - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; newRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &chickCoords[this->actor.home.rot.z]) + this->randomRot; } @@ -356,9 +356,9 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { } if (this->grog->actor.home.rot.x >= 20) { // all chicks have turned into adult cucco, stop and crow - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICKEN_CRY_M); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->actionFunc = EnNwc_CrowAtTheEnd; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Actor_SetScale(&this->actor, 0.01f); } } @@ -378,14 +378,14 @@ void EnNwc_HopForward(EnNwc* this, PlayState* play) { this->actor.velocity.y = 2.0f; // hop up and down } if ((this->stateTimer & 0xB) == 8) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_SONG); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICK_SONG); } // they only move forward while off the ground, which gives the visual of them hopping to move - if (this->actor.bgCheckFlags & 0x1) { // touching floor - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } else { - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } } @@ -404,11 +404,11 @@ void EnNwc_RunAway(EnNwc* this, PlayState* play) { this->actor.velocity.y = 2.0f; // hop up and down } if ((this->stateTimer & 0xB) == 8) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_SONG); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICK_SONG); } - this->actor.speedXZ = 2.0f; - if (this->actor.bgCheckFlags & 0x8) { // touching wall + this->actor.speed = 2.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { EnNwc_ToggleState(this); } } @@ -429,11 +429,11 @@ void EnNwc_Turn(EnNwc* this, PlayState* play) { } if ((this->stateTimer & 0xB) == 8) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CHICK_SONG); + Actor_PlaySfx(&this->actor, NA_SE_EV_CHICK_SONG); } // they only rotate when off the ground, giving the visual that they turn by hopping - if (!(this->actor.bgCheckFlags & 0x1)) { // NOT touching floor + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->fallingRotY, 0xA, 0x1000, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index d4d3db017..c53a29232 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -6,7 +6,7 @@ #include "z_en_okarina_tag.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnOkarinaTag*)thisx) diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index df18de3e7..0518e9457 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -106,11 +106,11 @@ void func_80B1202C(EnOnpuman* this, PlayState* play2) { switch (play->msgCtx.currentTextId) { case 0x8D4: this->unk_2A4 |= 1; - func_80151938(play, 0x8DA); + Message_ContinueTextbox(play, 0x8DA); break; case 0x8DA: - func_80151938(play, 0x8D6); + Message_ContinueTextbox(play, 0x8D6); if (this->unk_2A0 != NULL) { this->unk_2A0->home.rot.x = 0x50; } @@ -140,7 +140,7 @@ void func_80B1202C(EnOnpuman* this, PlayState* play2) { void func_80B1217C(EnOnpuman* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && (Message_ShouldAdvance(play))) { this->actionFunc = func_80B121D8; - func_801477B4(play); + Message_CloseTextbox(play); } } diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.c b/src/overlays/actors/ovl_En_Osk/z_en_osk.c index ac3c5ef6b..2b938a35f 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.c +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.c @@ -181,20 +181,20 @@ void func_80BF609C(EnOsk* this, PlayState* play) { case 0: if (Animation_OnFrame(&this->skelAnime, this->unk_25C) || Animation_OnFrame(&this->skelAnime, this->unk_25C + 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_TALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOSU_TALK); } break; case 1: if (Animation_OnFrame(&this->skelAnime, this->unk_25C)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_TALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOSU_TALK); } break; case 2: if (Animation_OnFrame(&this->skelAnime, this->unk_25C) || Animation_OnFrame(&this->skelAnime, this->unk_25C + 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOSU_TALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOSU_TALK); } break; } @@ -280,19 +280,19 @@ void func_80BF6478(EnOsk* this) { case 1: if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 11.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 3: if (Animation_OnFrame(&this->skelAnime, 11.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 4: if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; @@ -406,31 +406,31 @@ void func_80BF68E0(EnOsk* this) { case 7: if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 11.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 2: if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 4: if (Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 5: if ((Animation_OnFrame(&this->skelAnime, 6.0f)) || Animation_OnFrame(&this->skelAnime, 11.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; case 8: if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEBU_HEAD_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_DEBU_HEAD_UP); } break; } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index 7df9d843d..e9e12e311 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -851,7 +851,7 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { if ((this->animIndex == OSN_ANIM_BELIEVE) && (play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 400)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_OMVO00); + Actor_PlaySfx(&this->actor, NA_SE_VO_OMVO00); } if (this->animIndex == OSN_ANIM_TURN_AROUND_START) { @@ -870,7 +870,7 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { (((Animation_OnFrame(&this->skelAnime, 17.0f))) || (Animation_OnFrame(&this->skelAnime, 27.0f)) || (Animation_OnFrame(&this->skelAnime, 37.0f)) || (Animation_OnFrame(&this->skelAnime, 47.0f)) || (Animation_OnFrame(&this->skelAnime, 57.0f)) || (Animation_OnFrame(&this->skelAnime, 67.0f)))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OMENYA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_OMENYA_WALK); } Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } else { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index d1f7dbec9..c26a1a2c7 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -265,8 +265,8 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = THIS; s16 id; - //! @bug Condition is impossible, params cannot be both greater then 1 AND less then 0. if ((this->actor.params > ENOSSAN_PART_TIME_WORKER) && (this->actor.params < ENOSSAN_CURIOSITY_SHOP_MAN)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } @@ -332,7 +332,7 @@ s32 EnOssan_TestEndInteraction(EnOssan* this, PlayState* play, Input* input) { s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); return true; } return false; @@ -349,7 +349,7 @@ void EnOssan_SetupStartShopping(PlayState* play, EnOssan* this, u8 skipHello) { void EnOssan_StartShopping(PlayState* play, EnOssan* this) { EnOssan_SetupAction(this, EnOssan_FaceShopkeeper); - func_80151938(play, 0x640); + Message_ContinueTextbox(play, 0x640); func_8011552C(play, DO_ACTION_DECIDE); this->stickRightPrompt.isEnabled = true; this->stickLeftPrompt.isEnabled = true; @@ -586,7 +586,7 @@ void EnOssan_Hello(EnOssan* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, ANI_ANIM_APOLOGY_LOOP); } if ((this->animIndex == FSN_ANIM_SLAM_COUNTER_LOOP) && Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); + Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO); } } @@ -602,7 +602,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, 9); } EnOssan_SetupAction(this, EnOssan_TalkToShopkeeper); - func_80151938(play, sTalkOptionTextIds[this->actor.params]); + Message_ContinueTextbox(play, sTalkOptionTextIds[this->actor.params]); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -693,7 +693,7 @@ void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) { this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseLeftShelf); - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -721,7 +721,7 @@ void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) { this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseRightShelf); - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -824,7 +824,7 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) if (EnOssan_TestItemSelected(play)) { if (!item->isOutOfStock) { this->prevActionFunc = this->actionFunc; - func_80151938(play, this->items[this->cursorIndex]->choiceTextId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; play_sound(NA_SE_SY_DECIDE); @@ -888,7 +888,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) { } EnOssan_CursorUpDown(this); if (this->cursorIndex != prevCursorIndex) { - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -946,7 +946,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { } EnOssan_CursorUpDown(this); if (this->cursorIndex != prevCursorIndex) { - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -981,7 +981,7 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play) { void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; @@ -991,12 +991,12 @@ void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { } void EnOssan_SetupCannotBuy(PlayState* play, EnOssan* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); EnOssan_SetupAction(this, EnOssan_CannotBuy); } void EnOssan_SetupBuy(PlayState* play, EnOssan* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); EnOssan_SetupAction(this, EnOssan_CanBuy); } @@ -1061,7 +1061,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) { case 1: func_8019F230(); this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); break; } } @@ -1071,7 +1071,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) { void EnOssan_CannotBuy(EnOssan* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } @@ -1084,7 +1084,7 @@ void EnOssan_CanBuy(EnOssan* this, PlayState* play) { item = this->items[this->cursorIndex]; item->restockFunc(play, item); this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } @@ -1093,7 +1093,7 @@ void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) { this->actor.parent = NULL; EnOssan_SetupAction(this, EnOssan_SetupItemPurchased); } else { - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); } } @@ -1172,7 +1172,7 @@ void EnOssan_ItemPurchased(EnOssan* this, PlayState* play) { } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80151938(play, 0x642); + Message_ContinueTextbox(play, 0x642); } else { func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 5fa27e026..ed5078864 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -5,7 +5,6 @@ */ #include "z_en_ot.h" -#include "prevent_bss_reordering.h" #include "objects/object_ot/object_ot.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -141,7 +140,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->unk_33C = ENOT_GET_C000(&this->actor); if (this->unk_33C == 0) { D_80B5E880 = this; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.update = func_80B5DB6C; this->actor.draw = NULL; @@ -265,7 +264,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { case 3: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Actor_SetScale(&this->actor, 0.0064999997f); this->collider.dim.radius *= 0.5f; @@ -327,10 +326,10 @@ void func_80B5BE88(EnOt* this, PlayState* play) { } void func_80B5BED4(EnOt* this, PlayState* play) { - func_800BE33C(&this->actor.world.pos, &this->unk_360->actor.world.pos, &this->actor.world.rot, 0); - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, &this->unk_360->actor), 3, 0xE38, - 0x38E); - this->actor.speedXZ = 3.5f; + func_800BE33C(&this->actor.world.pos, &this->unk_360->actor.world.pos, &this->actor.world.rot, false); + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &this->unk_360->actor), 3, + 0xE38, 0x38E); + this->actor.speed = 3.5f; this->actor.world.pos.y = this->unk_360->actor.world.pos.y; Actor_MoveWithoutGravityReverse(&this->actor); } @@ -349,10 +348,10 @@ void func_80B5BFB8(EnOt* this, PlayState* play) { Math_StepToF(&this->actor.world.pos.y, temp_f0, 2.0f); } - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, &this->unk_360->actor), 3, 0xE38, - 0x38E); + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &this->unk_360->actor), 3, + 0xE38, 0x38E); - if (Actor_DistanceBetweenActors(&this->actor, &this->unk_360->actor) <= 52.519997f) { + if (Actor_WorldDistXYZToActor(&this->actor, &this->unk_360->actor) <= 52.519997f) { this->unk_73C = 50; Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_NEW); Matrix_MultVecZ(52.519997f, &sp34); @@ -382,7 +381,7 @@ void func_80B5C154(EnOt* this, PlayState* play) { this->getItemId = GI_HEART_PIECE; SET_WEEKEVENTREG(WEEKEVENTREG_32_01); } - Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; } @@ -392,7 +391,8 @@ void func_80B5C1CC(EnOt* this, PlayState* play) { func_80B5C244(this, play); func_80B5C244(this->unk_360, play); } else { - Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, + this->actor.playerHeightRel); } } @@ -401,7 +401,7 @@ void func_80B5C244(EnOt* this, PlayState* play) { } void func_80B5C25C(EnOt* this, PlayState* play) { - this->unk_390 = Actor_YawBetweenActors(&this->actor, &this->unk_360->actor); + this->unk_390 = Actor_WorldYawTowardActor(&this->actor, &this->unk_360->actor); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_390, 3, 0xE38, 0x38E); if (BINANG_SUB(BINANG_ROT180(this->unk_360->actor.shape.rot.y), this->actor.shape.rot.y) < 0x38E) { this->unk_32C |= 0x80; @@ -412,9 +412,9 @@ void func_80B5C25C(EnOt* this, PlayState* play) { this->unk_360->unk_32C |= 0x100; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 2, &this->animIndex); SubS_ChangeAnimationBySpeedInfo(&this->unk_360->skelAnime, sAnimations, 2, &this->unk_360->animIndex); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->unk_360->actor.flags |= ACTOR_FLAG_8000000; + this->unk_360->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->unk_360->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); func_80B5C9A8(this->unk_360, play); func_80B5C3B8(this, play); @@ -450,7 +450,7 @@ void func_80B5C3D8(EnOt* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_348); Math_Vec3f_Copy(&this->unk_360->actor.world.pos, &this->unk_360->unk_348); - temp = Actor_YawBetweenActors(&this->actor, &this->unk_360->actor); + temp = Actor_WorldYawTowardActor(&this->actor, &this->unk_360->actor); this->actor.shape.rot.y = temp; this->unk_360->actor.shape.rot.y = BINANG_ROT180(temp); @@ -488,7 +488,7 @@ void func_80B5C64C(EnOt* this, PlayState* play) { } void func_80B5C684(EnOt* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5C6DC; } @@ -499,7 +499,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { s16 sp3E; Vec3f sp30; - sp3E = Actor_YawToPoint(&player->actor, &this->unk_394); + sp3E = Actor_WorldYawTowardPoint(&player->actor, &this->unk_394); Matrix_RotateYS(BINANG_ADD(sp3E, 0x4000), MTXMODE_NEW); if (this->unk_33C == 2) { Matrix_MultVecZ(26.259998f, &sp30); @@ -535,7 +535,7 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { this->unk_360->unk_3A0 = this->unk_3A0; func_80B5C9A8(this, play); func_80B5D114(this, play); - } else if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && + } else if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { func_800B8614(&this->actor, play, 130.0f); } @@ -555,7 +555,7 @@ void func_80B5C910(EnOt* this, PlayState* play) { void func_80B5C950(EnOt* this, PlayState* play) { if (this->unk_32C & 8) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); SET_WEEKEVENTREG(WEEKEVENTREG_25_04); func_80B5CAD0(this, play); } @@ -576,7 +576,7 @@ void func_80B5C9D0(EnOt* this, PlayState* play) { this->actor.world.rot.x = this->actor.world.rot.x; this->actor.world.rot.y = this->actor.world.rot.y; this->actor.world.rot.z = this->actor.world.rot.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SEAHORSE_OUT_BOTTLE); this->actionFunc = func_80B5CA30; } @@ -696,7 +696,8 @@ void func_80B5CEC8(EnOt* this, PlayState* play) { func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_IA_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; - if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_801242B4(player) && + (this->actor.xzDistToPlayer < 130.0f)) { func_800B8614(&this->actor, play, 130.0f); } } @@ -803,12 +804,12 @@ void func_80B5D160(EnOt* this, PlayState* play) { break; case 0x10A5: - func_801477B4(play); + Message_CloseTextbox(play); func_80B5CE6C(this, play); break; case 0x106D: - func_801477B4(play); + Message_CloseTextbox(play); func_80B5C154(this, play); break; } @@ -820,11 +821,11 @@ void func_80B5D160(EnOt* this, PlayState* play) { s32 EnOt_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { Actor* thisx = actorPath->actor; EnOt* this = (EnOt*)thisx; - f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ; + f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speed; f32 sp20 = gFramerateDivisorHalf; thisx->velocity.x = Math_SinS(thisx->world.rot.y) * sp24; - thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speedXZ; + thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speed; thisx->velocity.z = Math_CosS(thisx->world.rot.y) * sp24; this->unk_330.x += (thisx->velocity.x * sp20) + thisx->colChkInfo.displacement.x; @@ -846,7 +847,7 @@ s32 EnOt_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) s32 sp34; thisx->gravity = 0.0f; - Math_SmoothStepToF(&thisx->speedXZ, 10.0f, 0.8f, 2.0f, 0.0f); + Math_SmoothStepToF(&thisx->speed, 10.0f, 0.8f, 2.0f, 0.0f); sp50.x = actorPath->curPoint.x - thisx->world.pos.x; sp50.y = actorPath->curPoint.y - thisx->world.pos.y; @@ -857,10 +858,10 @@ s32 EnOt_ActorPathing_UpdateActorInfo(PlayState* play, ActorPathing* actorPath) sp44.z = actorPath->curPoint.z - actorPath->prevPoint.z; temp = Math3D_Parallel(&sp50, &sp44); - if ((actorPath->distSqToCurPointXZ < SQ(thisx->speedXZ)) || (temp <= 0.0f)) { + if ((actorPath->distSqToCurPointXZ < SQ(thisx->speed)) || (temp <= 0.0f)) { ret = true; } else { - temp = SQ(thisx->speedXZ) / actorPath->distSqToCurPoint; + temp = SQ(thisx->speed) / actorPath->distSqToCurPoint; sp34 = ABS(actorPath->rotToCurPoint.x - thisx->world.rot.x); sp2C = (s32)(sp34 * temp) + 0xAAA; @@ -885,9 +886,9 @@ void func_80B5D648(EnOt* this, PlayState* play) { this->actorPath.pointOffset.y = 0.0f; this->actorPath.pointOffset.z = 0.0f; this->actor.gravity = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Flags_SetSwitch(play, ENOT_GET_3F80(&this->actor)); this->actionFunc = func_80B5D750; @@ -915,7 +916,7 @@ void func_80B5D750(EnOt* this, PlayState* play) { } if ((this->unk_32C & 1) && (this->actor.xzDistToPlayer <= 180.0f)) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); if (D_80B5E884 != 0) { func_80B5C9A8(this, play); @@ -930,11 +931,11 @@ void EnOt_Update(Actor* thisx, PlayState* play) { EnOt* this = THIS; if ((this->animIndex == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_SWIM); + Actor_PlaySfx(&this->actor, NA_SE_EV_SEAHORSE_SWIM); } this->actionFunc(this, play); - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (DECR(this->unk_354) == 0) { if (this->actor.flags & ACTOR_FLAG_40) { s32 i; @@ -992,7 +993,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, this->actor.shape.rot.y, 1, ENOT_GET_3FFF(&this->actor) | 0x8000, - this->actor.cutscene, this->actor.unk20, NULL) != NULL) { + this->actor.cutscene, this->actor.halfDaysBits, NULL) != NULL) { this->unk_32C |= 8; } } else if (D_80B5E888 != NULL) { diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 8d7b92b69..52287f317 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -292,7 +292,7 @@ void func_8095ABA8(EnOwl* this) { void func_8095ABF0(EnOwl* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); func_8095AAD0(this, play); this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -301,7 +301,7 @@ void func_8095ABF0(EnOwl* this, PlayState* play) { // Unused? void func_8095AC50(EnOwl* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); if ((this->unk_3DA % 64) == 0) { func_8095AAD0(this, play); } else { @@ -327,12 +327,12 @@ void func_8095AD54(EnOwl* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: - func_80151938(play, 0x7D1); + Message_ContinueTextbox(play, 0x7D1); this->actionFunc = func_8095AE00; break; case OWL_OK: - func_80151938(play, 0x7D3); + Message_ContinueTextbox(play, 0x7D3); this->actionFunc = func_8095ABF0; break; } @@ -341,14 +341,14 @@ void func_8095AD54(EnOwl* this, PlayState* play) { void func_8095AE00(EnOwl* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_80151938(play, 0x7D2); + Message_ContinueTextbox(play, 0x7D2); this->actionFunc = func_8095AD54; } } void func_8095AE60(EnOwl* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_80151938(play, 0x7D1); + Message_ContinueTextbox(play, 0x7D1); this->actionFunc = func_8095AE00; } } @@ -367,10 +367,10 @@ void func_8095AF2C(EnOwl* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.currentTextId == 0xBFE) { func_8095ACEC(this); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_8095ABF0; } else { - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); } } break; @@ -419,13 +419,13 @@ void func_8095B158(EnOwl* this) { if (Animation_OnFrame(&this->skelAnime1, 2.0f) || Animation_OnFrame(&this->skelAnime1, 9.0f) || Animation_OnFrame(&this->skelAnime1, 23.0f) || Animation_OnFrame(&this->skelAnime1, 40.0f) || Animation_OnFrame(&this->skelAnime1, 58.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OWL_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_OWL_FLUTTER); } } void func_8095B1E4(EnOwl* this, PlayState* play) { - if (this->actor.speedXZ < 6.0f) { - this->actor.speedXZ += 1.0f; + if (this->actor.speed < 6.0f) { + this->actor.speed += 1.0f; } if (this->actor.xzDistToPlayer > 6000.0f) { @@ -434,8 +434,8 @@ void func_8095B1E4(EnOwl* this, PlayState* play) { } void func_8095B254(EnOwl* this, PlayState* play) { - if (this->actor.speedXZ < 6.0f) { - this->actor.speedXZ += 1.0f; + if (this->actor.speed < 6.0f) { + this->actor.speed += 1.0f; } if (this->actionFlags & 1) { @@ -491,7 +491,7 @@ void func_8095B480(EnOwl* this, PlayState* play) { this->unk_3EC = this->actor.home.rot.y; this->actor.world.pos = this->actor.home.pos; func_8095A510(this, play); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_8095BE0C; } } @@ -540,8 +540,8 @@ void func_8095B76C(EnOwl* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, sp4A, 6, 0x800, 0x200); this->actor.shape.rot.y = this->actor.world.rot.y; - if (sp44 < SQ(this->actor.speedXZ)) { - this->actor.speedXZ = 0.0f; + if (sp44 < SQ(this->actor.speed)) { + this->actor.speed = 0.0f; points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_3F8; @@ -564,13 +564,13 @@ void func_8095B76C(EnOwl* this, PlayState* play) { } func_8095B0C8(this); } else if (sp44 < SQ(21.0f)) { - if (this->actor.speedXZ > 1.0f) { - this->actor.speedXZ -= 1.0f; + if (this->actor.speed > 1.0f) { + this->actor.speed -= 1.0f; } else { - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; } - } else if (this->actor.speedXZ < 6.0f) { - this->actor.speedXZ += 1.0f; + } else if (this->actor.speed < 6.0f) { + this->actor.speed += 1.0f; } func_8095B06C(this); @@ -614,16 +614,16 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0: func_8019F208(); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_09_40)) { - func_80151938(play, 0xBF4); + Message_ContinueTextbox(play, 0xBF4); } else { SET_WEEKEVENTREG(WEEKEVENTREG_09_40); - func_80151938(play, 0xBED); + Message_ContinueTextbox(play, 0xBED); } break; case 1: func_8019F230(); - func_80151938(play, 0xBEF); + Message_ContinueTextbox(play, 0xBEF); break; } break; @@ -632,12 +632,12 @@ void func_8095BA84(EnOwl* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0xBF4); + Message_ContinueTextbox(play, 0xBF4); return; case 1: func_8019F230(); - func_80151938(play, 0xBF3); + Message_ContinueTextbox(play, 0xBF3); return; } break; @@ -650,22 +650,22 @@ void func_8095BA84(EnOwl* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0xBEA: SET_WEEKEVENTREG(WEEKEVENTREG_09_20); - func_80151938(play, 0xBEB); + Message_ContinueTextbox(play, 0xBEB); break; case 0xBEB: case 0xBF0: - func_80151938(play, 0xBEC); + Message_ContinueTextbox(play, 0xBEC); break; case 0xBED: case 0xBF4: - func_80151938(play, 0xBEE); + Message_ContinueTextbox(play, 0xBEE); break; case 0xBEE: - func_801477B4(play); - Audio_QueueSeqCmd(0x110000FF); + Message_CloseTextbox(play); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); EnOwl_ChangeMode(this, func_8095B9FC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, 0.0f); this->eyeTexIndex = 0; @@ -680,8 +680,8 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0xBEF: case 0xBF3: - func_801477B4(play); - Audio_QueueSeqCmd(0x110000FF); + Message_CloseTextbox(play); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); func_8095ACEC(this); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.textId = 0xBF0; @@ -689,12 +689,12 @@ void func_8095BA84(EnOwl* this, PlayState* play) { break; case 0xBF1: - func_80151938(play, 0xBF2); + Message_ContinueTextbox(play, 0xBF2); break; case 0xBF5: - func_801477B4(play); - Audio_QueueSeqCmd(0x110000FF); + Message_CloseTextbox(play); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); this->actor.flags &= ~ACTOR_FLAG_10000; EnOwl_ChangeMode(this, func_8095B3DC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, 0.0f); @@ -745,8 +745,8 @@ void func_8095BF78(EnOwl* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_3EC, 2, 0x80, 0x40); this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->actor.speedXZ < 16.0f) { - this->actor.speedXZ += 0.5f; + if (this->actor.speed < 16.0f) { + this->actor.speed += 0.5f; } if ((this->unk_3E4 + 1000.0f) < this->actor.world.pos.y) { @@ -767,11 +767,11 @@ void func_8095C09C(EnOwl* this, PlayState* play) { if (this->skelAnime1.curFrame > 45.0f) { this->actor.velocity.y = 2.0f; this->actor.gravity = 0.0f; - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; } else if (this->skelAnime1.curFrame > 17.0f) { this->actor.velocity.y = 6.0f; this->actor.gravity = 0.0f; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } if (this->actionFlags & 1) { @@ -899,7 +899,7 @@ void EnOwl_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.update != NULL) { if ((this->skelAnime1.animation == &object_owl_Anim_001ADC) && Animation_OnFrame(&this->skelAnime1, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OWL_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_OWL_FLUTTER); } if (this->actionFlags & 2) { @@ -1078,7 +1078,7 @@ void func_8095CCF4(Actor* thisx, PlayState* play) { this->actor.world.pos.y -= 1.0f; Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_3DA = (this->unk_3DA >> 3) * 7; if (this->unk_3DC > 0) { this->unk_3DC--; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index bcbb78716..36605afcb 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -246,7 +246,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[0])), &this->actor); - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; @@ -255,7 +255,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { } else if ((this->cutscenes[0] != -1) && (this->actor.xzDistToPlayer < 1000.0f)) { ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } else { - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; @@ -290,7 +290,7 @@ void func_80BD8964(EnPamera* this, PlayState* play) { vec.z = this->pathPoints->z; if (Math_Vec3f_StepTo(&this->actor.world.pos, &vec, 1.0f) < 5.0f) { - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); SET_WEEKEVENTREG(WEEKEVENTREG_59_01); func_80BD8B50(this); @@ -329,7 +329,7 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { vec.y = this->pathPoints[this->pathIndex].y; vec.z = this->pathPoints[this->pathIndex].z; sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &vec); - if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speedXZ) > 10.0f) { + if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speed) > 10.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp32, 0xA, 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } else if (this->pathIndex < (this->pathPointsCount - 1)) { @@ -344,14 +344,14 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { void func_80BD8CCC(EnPamera* this) { this->hideInisdeTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80BD8D1C; } void func_80BD8D1C(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 200) { - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); func_80BD8D80(this); } @@ -373,7 +373,7 @@ void func_80BD8DB0(EnPamera* this, PlayState* play) { vec.y = this->pathPoints[this->pathIndex].y; vec.z = this->pathPoints[this->pathIndex].z; sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &vec); - if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speedXZ) > 10.0f) { + if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speed) > 10.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp32, 0xA, 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } else if (this->pathIndex > 0) { @@ -396,7 +396,7 @@ void func_80BD8F60(EnPamera* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x3000, 0x1000); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; func_80BD93CC(this, 0, 0); func_80BD8D80(this); } @@ -425,7 +425,7 @@ void func_80BD90AC(EnPamera* this, PlayState* play) { if (Player_GetMask(play) != PLAYER_MASK_STONE && (this->actionFunc != func_80BD8758) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) && (this->actionFunc != func_80BD8F60) && ((this->actionFunc != func_80BD8B70) || (this->pathIndex != 0)) && - ((this->actionFunc != func_80BD8DB0) || (this->actor.speedXZ != 3.0f)) && + ((this->actionFunc != func_80BD8DB0) || (this->actor.speed != 3.0f)) && ((this->actor.xzDistToPlayer < 150.0f) || ((this->actionFunc == func_80BD909C) && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { @@ -501,11 +501,11 @@ void func_80BD93F4(EnPamera* this, PlayState* play) { (this->actionFunc == func_80BD8964) || (this->actionFunc == func_80BD8A7C)) { if (this->skelAnime.animation == &object_pamera_Anim_008AE0) { if (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } } else if ((this->skelAnime.animation == &object_pamera_Anim_008E38) && (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } } } @@ -513,7 +513,7 @@ void func_80BD93F4(EnPamera* this, PlayState* play) { void func_80BD94E0(EnPamera* this, PlayState* play) { if ((this->actionFunc != func_80BD8B70) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD909C) && (this->actionFunc != func_80BD8D1C) && - ((this->actionFunc != func_80BD8DB0) || (this->actor.speedXZ == 3.0f))) { + ((this->actionFunc != func_80BD8DB0) || (this->actor.speed == 3.0f))) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { Actor_TrackNone(&this->headRot, &this->torsoRot); @@ -680,7 +680,7 @@ void func_80BD9B4C(EnPamera* this, PlayState* play) { break; case 0x158E: case 0x15A8: - func_801477B4(play); + Message_CloseTextbox(play); func_80BD9C70(this, play); break; } @@ -772,7 +772,7 @@ void func_80BD9F3C(EnPamera* this, PlayState* play) { Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f) || Animation_OnFrame(&this->skelAnime, 18.0f) || Animation_OnFrame(&this->skelAnime, 22.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; @@ -820,7 +820,7 @@ void func_80BDA1C8(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 14.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 82b424657..50cae4844 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -376,10 +376,10 @@ void EnPametfrog_PlaceSnapper(EnPametfrog* this, PlayState* play) { void EnPametfrog_JumpOnGround(EnPametfrog* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_JUMP); } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) { EnPametfrog_JumpWaterEffects(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER); } } @@ -402,8 +402,8 @@ void EnPametfrog_ApplyMagicArrowEffects(EnPametfrog* this, PlayState* play) { void EnPametfrog_ApplyElectricStun(EnPametfrog* this) { this->freezeTimer = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 2.0f; @@ -411,8 +411,8 @@ void EnPametfrog_ApplyElectricStun(EnPametfrog* this) { void EnPametfrog_ApplyStun(EnPametfrog* this) { this->freezeTimer = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); } void EnPametfrog_SetupRearOnSnapper(EnPametfrog* this) { @@ -447,7 +447,7 @@ void EnPametfrog_RearOnSnapper(EnPametfrog* this, PlayState* play) { rearingPoint.x = this->actor.world.pos.x; rearingPoint.y = this->actor.world.pos.y + 10.0f; rearingPoint.z = this->actor.world.pos.z; - if (actor->world.rot.x < Actor_PitchToPoint(actor, &rearingPoint)) { + if (actor->world.rot.x < Actor_WorldPitchTowardPoint(actor, &rearingPoint)) { EnPametfrog_SetupRearOnSnapperWave(this); } else { EnPametfrog_SetupRearOnSnapperRise(this); @@ -497,19 +497,19 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gGekkoFallInAirAnim); this->actor.params = GEKKO_FALL_OFF_SNAPPER; - this->actor.speedXZ = 7.0f; + this->actor.speed = 7.0f; this->actor.velocity.y = 15.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.child->world.rot.y); this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.flags |= ACTOR_FLAG_1; this->timer = 30; this->collider.base.ocFlags1 |= OC1_ON; - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); subCamEye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 100.0f; subCamEye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_DAMAGE); this->actionFunc = EnPametfrog_FallOffSnapper; } @@ -525,7 +525,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) { sin = sin_rad(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnPametfrog_StopCutscene(this, play); EnPametfrog_SetupJumpToWall(this); } @@ -535,22 +535,22 @@ void EnPametfrog_SetupJumpToWall(EnPametfrog* this) { Animation_Change(&this->skelAnime, &gGekkoJumpForwardAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -2.0f); this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; - this->actor.bgCheckFlags &= ~8; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_VOICE2); + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_VOICE2); this->actionFunc = EnPametfrog_JumpToWall; } void EnPametfrog_JumpToWall(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnPametfrog_JumpOnGround(this, play); - if ((this->actor.bgCheckFlags & 1) && (this->actor.bgCheckFlags & 8) && (this->actor.wallBgId == BGCHECK_SCENE) && - (COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.y) < 0.5f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + (this->actor.wallBgId == BGCHECK_SCENE) && (COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.y) < 0.5f)) { EnPametfrog_SetupWallCrawl(this); - } else if (!(this->actor.bgCheckFlags & 1) || + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { - this->actor.speedXZ = 12.0f; + this->actor.speed = 12.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -579,8 +579,8 @@ void EnPametfrog_SetupWallCrawl(EnPametfrog* this) { this->skelAnime.playSpeed = 1.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_RUNAWAY); - this->actor.speedXZ = 8.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_RUNAWAY); + this->actor.speed = 8.0f; this->timer = Rand_S16Offset(35, 15); this->actionFunc = EnPametfrog_WallCrawl; } @@ -602,8 +602,8 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, PlayState* play) { } else { SkelAnime_Update(&this->skelAnime); this->timer--; - this->actor.speedXZ = 8.0f; - doubleSpeedXZ = this->actor.speedXZ * 2.0f; + this->actor.speed = 8.0f; + doubleSpeedXZ = this->actor.speed * 2.0f; vec1.x = this->actor.world.pos.x + this->unk_2DC.x * 2.0f; vec1.y = this->actor.world.pos.y + this->unk_2DC.y * 2.0f; vec1.z = this->actor.world.pos.z + this->unk_2DC.z * 2.0f; @@ -619,7 +619,7 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, PlayState* play) { isSuccess = func_8086A2CC(this, poly1); Math_Vec3f_Copy(&this->actor.world.pos, &worldPos1); this->actor.floorBgId = bgId1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (this->actor.floorPoly != poly2) { isSuccess = func_8086A2CC(this, poly2); @@ -636,11 +636,11 @@ void EnPametfrog_WallCrawl(EnPametfrog* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); } if (((play->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_REAL); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_REAL); } if ((this->timer == 0) || @@ -659,7 +659,7 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) { s32 pad; f32 randFloat; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->skelAnime.playSpeed = 1.5f; if (this->timer != 0) { this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PI / 30) : (-M_PI / 30); @@ -668,7 +668,7 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) { this->wallRotation = (Rand_ZeroOne() < 0.5f ? -1 : 1) * (0x1000 + randFloat) * (M_PI / (15 * 0x8000)); } this->timer = 15; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_RUNAWAY2); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_RUNAWAY2); this->actionFunc = EnPametfrog_WallPause; } @@ -686,7 +686,7 @@ void EnPametfrog_WallPause(EnPametfrog* this, PlayState* play) { Math3D_CrossProduct(&this->unk_2DC, &this->unk_2D0, &this->unk_2E8); func_8086A238(this); if (((play->gameplayFrames % 60) == 0) && (Rand_ZeroOne() < 0.8f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_REAL); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_REAL); } if (this->timer == 0) { @@ -700,19 +700,19 @@ void EnPametfrog_SetupClimbDownWall(EnPametfrog* this) { Animation_Change(&this->skelAnime, &gGekkoJumpForwardAnim, 0.0f, 0.0f, Animation_GetLastFrame(&gGekkoJumpForwardAnim), ANIMMODE_ONCE, 0.0f); - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, this->actor.child); this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.colChkInfo.mass = 50; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->collider.base.acFlags &= ~AC_ON; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->actor.world.pos.x += 30.0f * Math_SinS(yaw); this->actor.world.pos.z += 30.0f * Math_CosS(yaw); - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.params = GEKKO_RETURN_TO_SNAPPER; this->actionFunc = EnPametfrog_ClimbDownWall; } @@ -720,10 +720,10 @@ void EnPametfrog_SetupClimbDownWall(EnPametfrog* this) { void EnPametfrog_ClimbDownWall(EnPametfrog* this, PlayState* play) { s16 yaw; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnPametfrog_SetupRunToSnapper(this); } else if (this->actor.floorHeight == BGCHECK_Y_MIN) { - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->actor.world.pos.x += 5.0f * Math_SinS(yaw); this->actor.world.pos.z += 5.0f * Math_CosS(yaw); if (this->actor.world.pos.y < (this->actor.home.pos.y - 5.0f)) { @@ -741,15 +741,16 @@ void EnPametfrog_SetupRunToSnapper(EnPametfrog* this) { void EnPametfrog_RunToSnapper(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnPametfrog_JumpOnGround(this, play); - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, this->actor.child); this->actor.world.rot.y = this->actor.shape.rot.y; - if (!(this->actor.bgCheckFlags & 1) || ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { - this->actor.speedXZ = 12.0f; + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { + this->actor.speed = 12.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } - if ((this->actor.child->params == 1) && (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < 120.0f) && + if ((this->actor.child->params == 1) && (Actor_WorldDistXZToActor(&this->actor, this->actor.child) < 120.0f) && Animation_OnFrame(&this->skelAnime, 0.0f)) { EnPametfrog_SetupJumpOnSnapper(this); } @@ -760,12 +761,12 @@ void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this) { this->timer = 6; this->collider.base.ocFlags1 &= ~OC1_ON; this->collider.base.acFlags &= ~AC_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, this->actor.child); this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.params = GEKKO_JUMP_ON_SNAPPER; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_GREET); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_GREET); this->actionFunc = EnPametfrog_JumpOnSnapper; } @@ -811,18 +812,18 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { this->actor.params = GEKKO_RETURN_TO_SNAPPER; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->collider.base.acFlags &= ~AC_ON; this->timer = 10; if (this->actor.colChkInfo.health == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_DEAD); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_DAMAGE); } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); - yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); + yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); this->actor.world.pos.x += 30.0f * Math_SinS(yaw); this->actor.world.pos.z += 30.0f * Math_CosS(yaw); if (this->subCamId != SUB_CAM_ID_DONE) { @@ -860,7 +861,7 @@ void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { &Play_GetCamera(play, this->subCamId)->eye); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnPametfrog_SetupFallOnGround(this, play); } } @@ -875,7 +876,7 @@ void EnPametfrog_SetupFallOnGround(EnPametfrog* this, PlayState* play) { this->timer = 5; EnPametfrog_Thaw(this, play); EnPametfrog_JumpWaterEffects(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_WALK_WATER); this->actionFunc = EnPametfrog_FallOnGround; } @@ -898,7 +899,7 @@ void EnPametfrog_FallOnGround(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; - s16 yaw = Actor_YawToPoint(this->actor.child, &this->actor.home.pos); + s16 yaw = Actor_WorldYawTowardPoint(this->actor.child, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; @@ -923,7 +924,7 @@ void EnPametfrog_DefeatGekko(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) { Vec3f subCamEye; - s16 yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; @@ -997,7 +998,7 @@ void EnPametfrog_SetupCutscene(EnPametfrog* this) { ActorCutscene_SetIntentToPlay(this->cutscene); this->actionFunc = EnPametfrog_PlayCutscene; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; } @@ -1023,7 +1024,7 @@ void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupLookAround(EnPametfrog* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoLookAroundAnim); this->collider.base.atFlags &= ~AT_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnPametfrog_LookAround; } @@ -1053,10 +1054,11 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; SkelAnime_Update(&this->skelAnime); EnPametfrog_JumpOnGround(this, play); - if (!(this->actor.bgCheckFlags & 1) || (this->skelAnime.curFrame > 1.0f && this->skelAnime.curFrame < 12.0f)) { - this->actor.speedXZ = 8.0f; + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->skelAnime.curFrame > 1.0f && this->skelAnime.curFrame < 12.0f)) { + this->actor.speed = 8.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) && @@ -1069,7 +1071,7 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupMeleeAttack(EnPametfrog* this) { Animation_PlayOnce(&this->skelAnime, &gGekkoBoxingStanceAnim); this->timer = 7; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnPametfrog_MeleeAttack; } @@ -1099,9 +1101,9 @@ void EnPametfrog_MeleeAttack(EnPametfrog* this, PlayState* play) { ((this->skelAnime.animation == &gGekkoWindupPunchAnim) && Animation_OnFrame(&this->skelAnime, 27.0f))) { this->collider.base.atFlags |= AT_ON; if (this->skelAnime.animation == &gGekkoKickAnim) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_KICK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_KICK); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_PUNCH1); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_PUNCH1); } } else { this->collider.base.atFlags &= ~AT_ON; @@ -1113,9 +1115,9 @@ void EnPametfrog_SetupDamage(EnPametfrog* this) { this->timer = 20; this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; - this->actor.speedXZ = 10.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); + this->actor.speed = 10.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); func_800BE5CC(&this->actor, &this->collider, 0); this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); this->actionFunc = EnPametfrog_Damage; @@ -1124,7 +1126,7 @@ void EnPametfrog_SetupDamage(EnPametfrog* this) { void EnPametfrog_Damage(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->timer--; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (this->timer == 0) { if (this->actor.colChkInfo.health > 0) { EnPametfrog_SetupJumpToLink(this); @@ -1141,7 +1143,7 @@ void EnPametfrog_SetupStun(EnPametfrog* this) { } this->collider.base.atFlags &= ~AT_ON; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.colChkInfo.health == 0) { this->collider.base.acFlags &= ~AC_ON; @@ -1168,10 +1170,10 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { s16 yawDiff; Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 3.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_GREET); + Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_GREET); this->actor.flags &= ~ACTOR_FLAG_1; this->actor.colChkInfo.health = 6; - this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yawDiff > 0) { this->actor.world.rot.y -= 0x2000; @@ -1209,7 +1211,7 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { subCamAt.x = this->actor.child->world.pos.x; subCamAt.z = this->actor.child->world.pos.z; subCamAt.y = this->actor.child->floorHeight + 50.0f; - if ((s16)(Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y) > 0) { + if ((s16)(Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y) > 0) { yaw = this->actor.child->shape.rot.y - 0x1000; } else { yaw = this->actor.child->shape.rot.y + 0x1000; @@ -1285,7 +1287,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ICE) { EnPametfrog_Freeze(this); this->freezeTimer = 80; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x50); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); EnPametfrog_SetupStun(this); } else { EnPametfrog_Thaw(this, play); diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 527a91b3d..2a12b9af8 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -52,7 +52,7 @@ void func_80865390(EnPart* this, PlayState* play) { this->actor.world.rot.y = this->actor.parent->shape.rot.y + 0x8000; this->unk146 = 100; this->actor.velocity.y = 7.0f; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actor.gravity = -1.0f; break; } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 3e2fdcfac..6b4d3269b 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -234,7 +234,7 @@ void func_80897170(EnPeehat* this) { this->drawDmgEffAlpha = 1.0f; this->colliderSphere.base.colType = COLTYPE_HIT3; this->unk_2B0 = 80; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_808971DC(EnPeehat* this, PlayState* play) { @@ -283,7 +283,7 @@ void func_80897390(EnPeehat* this, PlayState* play) { } this->unk_2B0 = 8; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIHAT_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_DAMAGE); } void func_80897498(EnPeehat* this) { @@ -327,7 +327,7 @@ void func_80897648(EnPeehat* this) { Animation_GetLastFrame(&object_ph_Anim_0009C4), ANIMMODE_ONCE, 0.0f); } this->unk_2B0 = 16; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIHAT_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_UP); this->actionFunc = func_808976DC; } @@ -378,7 +378,7 @@ void func_80897864(EnPeehat* this) { void func_80897910(EnPeehat* this, PlayState* play) { Player* player = GET_PLAYER(play); - Math_StepToF(&this->actor.speedXZ, 3.0f, 0.25f); + Math_StepToF(&this->actor.speed, 3.0f, 0.25f); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 3.0f); SkelAnime_Update(&this->skelAnime); if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { @@ -396,7 +396,7 @@ void func_80897910(EnPeehat* this, PlayState* play) { void func_80897A34(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &object_ph_Anim_0005C4); this->unk_2B0 = 30; - this->actor.speedXZ = 5.3f; + this->actor.speed = 5.3f; this->colliderTris.base.atFlags |= AT_ON; this->actionFunc = func_80897A94; } @@ -432,10 +432,10 @@ void func_80897A94(EnPeehat* this, PlayState* play) { this->colliderTris.base.atFlags &= ~(AT_BOUNCED | AT_ON); this->actor.colChkInfo.health = 0; func_808982E0(this); - } else if ((this->colliderCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { + } else if ((this->colliderCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_PIHAT_SM_DEAD); } Actor_Kill(&this->actor); @@ -449,7 +449,7 @@ void func_80897A94(EnPeehat* this, PlayState* play) { this->unk_2B0 = 40; } else if (this->colliderCylinder.base.ocFlags1 & OC1_HIT) { this->colliderCylinder.base.ocFlags1 &= ~OC1_HIT; - if ((BINANG_SUB(Actor_YawBetweenActors(&this->actor, this->colliderCylinder.base.oc), + if ((BINANG_SUB(Actor_WorldYawTowardActor(&this->actor, this->colliderCylinder.base.oc), this->actor.world.rot.y)) > 0) { this->actor.world.rot.y -= 0x2000; } else { @@ -469,12 +469,12 @@ void func_80897D48(EnPeehat* this, PlayState* play) { Vec3f sp34; Math_StepToF(&this->actor.shape.yOffset, -1000.0f, 50.0f); - Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 50); if (SkelAnime_Update(&this->skelAnime)) { func_80897498(this); this->actor.world.pos.y = this->actor.floorHeight; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIHAT_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_LAND); } else if (this->actor.floorHeight < this->actor.world.pos.y) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 0.3f, 3.5f, 0.25f); if ((this->actor.world.pos.y - this->actor.floorHeight) < 60.0f) { @@ -490,7 +490,7 @@ void func_80897D48(EnPeehat* this, PlayState* play) { void func_80897EAC(EnPeehat* this) { Animation_PlayLoop(&this->skelAnime, &object_ph_Anim_0005C4); - this->actor.speedXZ = Rand_ZeroFloat(0.5f) + 2.5f; + this->actor.speed = Rand_ZeroFloat(0.5f) + 2.5f; this->unk_2B0 = Rand_ZeroFloat(10.0f) + 10.0f; this->colliderTris.base.atFlags |= AT_ON; this->colliderSphere.base.acFlags |= AC_ON; @@ -512,7 +512,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) { this->unk_2B0--; if (this->unk_2B0 <= 0) { - this->actor.speedXZ = Rand_ZeroFloat(0.5f) + 2.5f; + this->actor.speed = Rand_ZeroFloat(0.5f) + 2.5f; this->unk_2B0 = Rand_ZeroFloat(10.0f) + 10.0f; this->unk_2B6 = randPlusMinusPoint5Scaled(1000.0f); } @@ -536,7 +536,7 @@ void func_80897F44(EnPeehat* this, PlayState* play) { void func_80898124(EnPeehat* this) { this->actionFunc = func_80898144; - this->actor.speedXZ = 2.5f; + this->actor.speed = 2.5f; } void func_80898144(EnPeehat* this, PlayState* play) { @@ -574,7 +574,7 @@ void func_80898144(EnPeehat* this, PlayState* play) { void func_808982E0(EnPeehat* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ph_Anim_000844, -4.0f); - this->actor.speedXZ = -9.0f; + this->actor.speed = -9.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actionFunc = func_80898338; } @@ -583,7 +583,7 @@ void func_80898338(EnPeehat* this, PlayState* play) { this->unk_2B4 += this->unk_2B2; SkelAnime_Update(&this->skelAnime); - if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f)) { + if (Math_StepToF(&this->actor.speed, 0.0f, 0.5f)) { if (this->actor.params != 0) { func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 40, 7, 0); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); @@ -599,7 +599,7 @@ void func_80898338(EnPeehat* this, PlayState* play) { void func_80898414(EnPeehat* this) { func_800BE568(&this->actor, &this->colliderSphere); this->unk_2B2 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80898454; } @@ -622,11 +622,11 @@ void func_80898454(EnPeehat* this, PlayState* play) { void func_808984E0(EnPeehat* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ph_Anim_000844, -4.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIHAT_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_DAMAGE); this->unk_2B2 = 4000; this->unk_2B0 = 14; - this->actor.speedXZ = 10.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 14); + this->actor.speed = 10.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 14); this->colliderSphere.base.acFlags &= ~AC_ON; this->unk_2C4 = 0.0f; if (this->actor.colChkInfo.health == 0) { @@ -640,7 +640,7 @@ void func_80898594(EnPeehat* this, PlayState* play) { this->unk_2B4 += this->unk_2B2; Math_ScaledStepToS(&this->unk_2B2, 4000, 250); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 88.5f, 3.0f); - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->unk_2B0--; if (this->unk_2B0 <= 0) { if (this->actor.colChkInfo.health == 0) { @@ -697,16 +697,16 @@ void func_8089874C(EnPeehat* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 5) { this->unk_2B0 = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffScale = 1.1f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; func_80898414(this); } else if (this->actor.colChkInfo.damageEffect == 1) { this->unk_2B0 = 40; - Actor_SetColorFilter(&this->actor, 0, 200, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_80898414(this); } else if (this->actor.colChkInfo.damageEffect == 3) { func_80897170(this); @@ -930,7 +930,7 @@ void EnPeehat_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, (this->actor.params == 0) ? EnPeehat_PostLimbDraw : NULL, &this->actor); - if ((this->actor.speedXZ != 0.0f) || (this->actor.velocity.y != 0.0f)) { + if ((this->actor.speed != 0.0f) || (this->actor.velocity.y != 0.0f)) { Matrix_MultVecZ(4500.0f, &sp40); Matrix_MultVecZ(-4500.0f, &sp4C); Matrix_MultVecX(4500.0f, &sp58); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index c2846a26b..f1f34b6be 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1023,14 +1023,14 @@ s32 func_80AF87C4(EnPm* this, PlayState* play) { func_80AF7E98(this, 0); this->unk_258 = 255; this->unk_380 = true; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->actor.gravity = -1.0f; } ret = true; } else if (this->unk_380) { this->unk_258 = 0; this->unk_380 = false; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } return ret; } @@ -1311,7 +1311,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->unk_356 &= ~8; this->unk_356 &= ~0x10; if (this->unk_258 == 27) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_UnsetSwitch(play, 0); } @@ -1431,7 +1431,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { switch (scheduleOutput->result) { case 27: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_SetSwitch(play, 0); this->unk_36C = 20; SubS_UpdateFlags(&this->unk_356, 3, 7); @@ -1717,7 +1717,7 @@ s32 func_80AF9D04(EnPm* this, PlayState* play) { Lib_Vec3f_TranslateAndRotateY(&this->unk_26C, this->actor.world.rot.y, &sp38, &this->actor.world.pos); this->unk_36E += this->timePathTimeSpeed; if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK); } } return false; @@ -1774,7 +1774,7 @@ s32 func_80AF9E7C(EnPm* this, PlayState* play) { this->timePathTargetPos = timePathTargetPos; } else if ((this->unk_258 != 91) && (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK); } if ((this->unk_356 & 0x10) && (this->unk_258 == 90)) { @@ -1820,7 +1820,7 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { } if ((this->unk_384 == 11) && Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMACHINE_HIT_OPEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMACHINE_HIT_OPEN); } if (this->unk_258 == 19) { @@ -1865,7 +1865,7 @@ s32 func_80AFA334(EnPm* this, PlayState* play) { case 21: case 22: if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_NP_SLEEP_OUT); + Actor_PlaySfx(&this->actor, NA_SE_VO_NP_SLEEP_OUT); } break; @@ -2044,7 +2044,7 @@ void func_80AFA724(EnPm* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK); } } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index a9fcf95e3..ac717641b 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -6,7 +6,6 @@ #include "z_en_po_fusen.h" #include "overlays/actors/ovl_En_Ma4/z_en_ma4.h" -#include "objects/object_po_fusen/object_po_fusen.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_100000 | ACTOR_FLAG_80000000) @@ -17,7 +16,7 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play); void EnPoFusen_Update(Actor* thisx, PlayState* play); void EnPoFusen_Draw(Actor* thisx, PlayState* play); -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); void EnPoFusen_InitNoFuse(EnPoFusen* this); void EnPoFusen_InitFuse(EnPoFusen* this); void EnPoFusen_Pop(EnPoFusen* this, PlayState* play); @@ -57,44 +56,49 @@ static ColliderSphereInit sSphereInit = { { 0, { { 0, 0, 0 }, 200 }, 100 }, }; +typedef enum { + /* 0x0 */ POE_BALLOON_DMGEFF_NONE, + /* 0xF */ POE_BALLOON_DMGEFF_POP = 0xF, +} PoeBalloonDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x0), - /* Deku Stick */ DMG_ENTRY(0, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(0, 0x0), - /* Zora boomerang */ DMG_ENTRY(0, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0xF), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x0), - /* Goron punch */ DMG_ENTRY(0, 0x0), - /* Sword */ DMG_ENTRY(0, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0x0), - /* Fire arrow */ DMG_ENTRY(1, 0xF), - /* Ice arrow */ DMG_ENTRY(1, 0xF), - /* Light arrow */ DMG_ENTRY(1, 0xF), - /* Goron spikes */ DMG_ENTRY(1, 0xF), - /* Deku spin */ DMG_ENTRY(0, 0x0), - /* Deku bubble */ DMG_ENTRY(0, 0x0), - /* Deku launch */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(0, 0x0), - /* Zora punch */ DMG_ENTRY(0, 0x0), - /* Spin attack */ DMG_ENTRY(0, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(0, 0x0), + /* Deku Nut */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Deku Stick */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, POE_BALLOON_DMGEFF_POP), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(1, POE_BALLOON_DMGEFF_POP), + /* Ice arrow */ DMG_ENTRY(1, POE_BALLOON_DMGEFF_POP), + /* Light arrow */ DMG_ENTRY(1, POE_BALLOON_DMGEFF_POP), + /* Goron spikes */ DMG_ENTRY(1, POE_BALLOON_DMGEFF_POP), + /* Deku spin */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Zora barrier */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(0, POE_BALLOON_DMGEFF_NONE), }; void EnPoFusen_Init(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; - f32 heightTemp; + f32 flyingHeightMin; this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.007f; this->actor.targetMode = 6; @@ -103,10 +107,9 @@ void EnPoFusen_Init(Actor* thisx, PlayState* play) { Collider_InitSphere(play, &this->collider); Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); - if (0) {} this->collider.dim.worldSphere.radius = 40; - SkelAnime_InitFlex(play, &this->anime, &object_po_fusen_Skel_0024F0, &object_po_fusen_Anim_000040, this->jointTable, - this->morphTable, 10); + SkelAnime_InitFlex(play, &this->anime, &gPoeBalloonSkel, &gPoeBalloonEmptyAnim, this->jointTable, this->morphTable, + POE_BALLOON_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); @@ -114,27 +117,26 @@ void EnPoFusen_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } - heightTemp = this->actor.floorHeight + 90.0f; - if (this->actor.home.pos.y < heightTemp) { - this->actor.home.pos.y = heightTemp; + flyingHeightMin = this->actor.floorHeight + 90.0f; + if (this->actor.home.pos.y < flyingHeightMin) { + this->actor.home.pos.y = flyingHeightMin; } this->randScaleChange = (Rand_Next() % 0xFFFE) - 0x7FFF; this->randYRotChange = (Rand_Next() % 0x4B0) - 0x258; this->avgBaseRotation = 0x10000 / 12; - this->limb3Rot = 0; + this->limbRotYRightUpperArm = 0; this->limb46Rot = 0; this->limb57Rot = 0; - this->limb8Rot = 0; - this->limb9Rot = 0x71C; + this->limbRotLeftHand = 0; + this->limbRotChainAndLantern = 0x71C; this->randBaseRotChange = 0; - if (ENPOFUSEN_IS_FUSE_TYPE(&this->actor)) { + if (POE_BALLOON_IS_FUSE_TYPE(&this->actor)) { EnPoFusen_InitFuse(this); - return; + } else { + EnPoFusen_InitNoFuse(this); } - - EnPoFusen_InitNoFuse(this); } void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { @@ -143,26 +145,28 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { Collider_DestroySphere(play, &this->collider); } -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { - Actor* actorPtr; +/** + * Search for Romani's actor, beacuse it's PoFusen's job to update her actor when the balloon is popped. + */ +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { + Actor* actorIter = play->actorCtx.actorLists[ACTORCAT_NPC].first; - actorPtr = play->actorCtx.actorLists[ACTORCAT_NPC].first; - if (ENPOFUSEN_IS_FUSE_TYPE(&this->actor)) { + if (POE_BALLOON_IS_FUSE_TYPE(&this->actor)) { return true; } - while (actorPtr != NULL) { - if (actorPtr->id == ACTOR_EN_MA4) { - this->actor.parent = actorPtr; + while (actorIter != NULL) { + if (actorIter->id == ACTOR_EN_MA4) { + this->actor.parent = actorIter; return true; } - actorPtr = actorPtr->next; + actorIter = actorIter->next; } return false; } -u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { +s32 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { if (this->actionFunc == EnPoFusen_IdleFuse) { return false; } @@ -171,7 +175,7 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + 20.0f; this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; - if ((this->collider.base.acFlags & AC_HIT) && (this->actor.colChkInfo.damageEffect == 0xF)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->actor.colChkInfo.damageEffect == POE_BALLOON_DMGEFF_POP)) { this->collider.base.acFlags &= ~AC_HIT; return true; } @@ -191,7 +195,6 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { f32 shadowScaleTmp; f32 shadowAlphaTmp; f32 heightOffset; - f32 f255 = 255.0f; this->actor.world.pos = this->actor.home.pos; this->randScaleChange += 0x190; @@ -203,30 +206,30 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { this->actor.world.pos.y += heightOffset; this->actor.shape.rot.z = (Math_SinS(this->randBaseRotChange) * 910.0f); - if ((this->randScaleChange < 0x4000) && (this->randScaleChange >= -0x3FFF)) { - Math_SmoothStepToS(&this->limb9Rot, 0x38E, 0x14, 0xBB8, 0x64); + if ((this->randScaleChange < 0x4000) && (this->randScaleChange > -0x4000)) { + Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x38E, 0x14, 0xBB8, 0x64); } else { - Math_SmoothStepToS(&this->limb9Rot, 0x71C, 0x8, 0xBB8, 0x64); + Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x71C, 0x8, 0xBB8, 0x64); } - this->avgBaseRotation = this->limb9Rot * 3; - this->limb3Rot = (Math_SinS(this->randBaseRotChange + 0x38E3) * this->avgBaseRotation); + this->avgBaseRotation = this->limbRotChainAndLantern * 3; + this->limbRotYRightUpperArm = (Math_SinS(this->randBaseRotChange + 0x38E3) * this->avgBaseRotation); this->limb46Rot = (Math_SinS(this->randBaseRotChange) * this->avgBaseRotation); this->limb57Rot = (Math_SinS(this->randBaseRotChange - 0x38E3) * this->avgBaseRotation); - this->limb8Rot = (Math_SinS(this->randBaseRotChange - 0x71C6) * this->avgBaseRotation); + this->limbRotLeftHand = (Math_SinS(this->randBaseRotChange - 0x71C6) * this->avgBaseRotation); shadowScaleTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 10.0f) + 50.0f; shadowAlphaTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 75.0f) + 100.0f; this->actor.shape.shadowScale = shadowScaleTmp; - this->actor.shape.shadowAlpha = (shadowAlphaTmp > f255) ? (u8)f255 : (u8)shadowAlphaTmp; + this->actor.shape.shadowAlpha = CLAMP_MAX(shadowAlphaTmp, 255.0f); } void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { Actor* parent = this->actor.parent; - EnMa4* romani; if ((parent != NULL) && (parent->id == ACTOR_EN_MA4)) { - romani = (EnMa4*)parent; + EnMa4* romani = (EnMa4*)parent; + romani->poppedBalloonCounter++; } @@ -237,13 +240,14 @@ void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { void EnPoFusen_Pop(EnPoFusen* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 255, 255, 200, CLEAR_TAG_POP); - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } void EnPoFusen_InitFuse(EnPoFusen* this) { s16 rotZ = this->actor.shape.rot.z; - this->fuse = ENPOFUSEN_GET_FUSE_LEN(&this->actor); + + this->fuse = POE_BALLOON_GET_FUSE_LEN(&this->actor); this->actor.shape.rot.z = 0; this->randScaleChange = rotZ & 0xFFFF; this->actionFunc = EnPoFusen_IdleFuse; @@ -258,6 +262,7 @@ void EnPoFusen_IdleFuse(EnPoFusen* this, PlayState* play) { void EnPoFusen_Update(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; + this->actionFunc(this, play); if (EnPoFusen_CheckCollision(this, play)) { EnPoFusen_IncrementRomaniPop(this); @@ -266,39 +271,38 @@ void EnPoFusen_Update(Actor* thisx, PlayState* play) { s32 EnPoFusen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPoFusen* this = THIS; - f32 zScale; - f32 yScale; - f32 xScale; - s16 pad; - s16 zRot; - s16 pad2; - s16 xRot; - if (limbIndex == 2) { - zScale = (Math_CosS(this->randScaleChange) * 0.08f) + 1.0f; - xScale = zScale; - if (!zScale) {} + if (limbIndex == POE_BALLOON_LIMB_BODY) { + f32 zScale = (Math_CosS(this->randScaleChange) * 0.08f) + 1.0f; + f32 yScale; + f32 xScale = zScale; + s16 pad; + s16 zRot; + s16 pad2; + s16 xRot; + yScale = (Math_SinS(this->randScaleChange) * 0.08f) + 1.0f; - yScale = yScale * yScale; + yScale = SQ(yScale); xRot = ((Math_SinS(this->randXZRotChange) * 2730.0f)); zRot = ((Math_CosS(this->randXZRotChange) * 2730.0f)); Matrix_RotateZYX(xRot, 0, zRot, MTXMODE_APPLY); Matrix_Scale(xScale, yScale, zScale, MTXMODE_APPLY); Matrix_RotateZS(-zRot, MTXMODE_APPLY); Matrix_RotateXS(-xRot, MTXMODE_APPLY); - } else if (limbIndex == 3) { - rot->y += this->limb3Rot; - } else if (limbIndex == 6) { + + } else if (limbIndex == POE_BALLOON_RIGHT_UPPER_ARM) { + rot->y += this->limbRotYRightUpperArm; + } else if (limbIndex == POE_BALLOON_LEFT_UPPER_ARM) { rot->y += this->limb46Rot; - } else if (limbIndex == 4) { + } else if (limbIndex == POE_BALLOON_RIGHT_FOREARM) { rot->z += this->limb46Rot; - } else if ((limbIndex == 5) || (limbIndex == 7)) { + } else if ((limbIndex == POE_BALLOON_RIGHT_HAND) || (limbIndex == POE_BALLOON_LEFT_FOREARM)) { rot->z += this->limb57Rot; - } else if (limbIndex == 8) { - rot->z += this->limb8Rot; - } else if (limbIndex == 9) { - rot->y += (s16)(this->limb9Rot * Math_SinS(this->randBaseRotChange)); - rot->z += (s16)(this->limb9Rot * Math_CosS(this->randBaseRotChange)); + } else if (limbIndex == POE_BALLOON_LEFT_HAND) { + rot->z += this->limbRotLeftHand; + } else if (limbIndex == POE_BALLOON_LIMB_CHAIN_AND_LANTERN) { + rot->y += (s16)(this->limbRotChainAndLantern * Math_SinS(this->randBaseRotChange)); + rot->z += (s16)(this->limbRotChainAndLantern * Math_CosS(this->randBaseRotChange)); } return false; } @@ -311,6 +315,7 @@ void EnPoFusen_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnPoFusen_Draw(Actor* thisx, PlayState* play) { EnPoFusen* this = THIS; + func_8012C28C(play->state.gfxCtx); SkelAnime_DrawTransformFlexOpa(play, this->anime.skeleton, this->anime.jointTable, this->anime.dListCount, EnPoFusen_OverrideLimbDraw, EnPoFusen_PostLimbDraw, EnPoFusen_TransformLimbDraw, diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h index 740d65968..506f046d0 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h @@ -2,11 +2,13 @@ #define Z_EN_PO_FUSEN_H #include "global.h" +#include "objects/object_po_fusen/object_po_fusen.h" struct EnPoFusen; -#define ENPOFUSEN_GET_FUSE_LEN(thisx) ((thisx)->params & 0x3FF) -#define ENPOFUSEN_IS_FUSE_TYPE(thisx) ((thisx)->params & 0x8000) +// The version used in the credits, where we see romani shoot three in a row, are on timer, this is the fuse length. +#define POE_BALLOON_GET_FUSE_LEN(thisx) ((thisx)->params & 0x3FF) +#define POE_BALLOON_IS_FUSE_TYPE(thisx) ((thisx)->params & 0x8000) typedef void (*EnPoFusenActionFunc)(struct EnPoFusen*, PlayState*); @@ -15,17 +17,17 @@ typedef struct EnPoFusen { /* 0x144 */ SkelAnime anime; /* 0x188 */ EnPoFusenActionFunc actionFunc; /* 0x18C */ ColliderSphere collider; - /* 0x1E4 */ Vec3s jointTable[0xA]; - /* 0x220 */ Vec3s morphTable[0xA]; + /* 0x1E4 */ Vec3s jointTable[POE_BALLOON_LIMB_MAX]; + /* 0x220 */ Vec3s morphTable[POE_BALLOON_LIMB_MAX]; /* 0x25C */ s16 randScaleChange; /* 0x25E */ s16 randXZRotChange; /* 0x260 */ s16 randYRotChange; /* 0x262 */ s16 avgBaseRotation; - /* 0x264 */ s16 limb3Rot; + /* 0x264 */ s16 limbRotYRightUpperArm; /* 0x266 */ s16 limb46Rot; /* 0x268 */ s16 limb57Rot; - /* 0x26A */ s16 limb8Rot; - /* 0x26C */ s16 limb9Rot; + /* 0x26A */ s16 limbRotLeftHand; + /* 0x26C */ s16 limbRotChainAndLantern; /* 0x26E */ s16 randBaseRotChange; /* 0x270 */ s16 fuse; } EnPoFusen; // size = 0x274 diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index a89a55d9e..3545d2f8c 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -97,46 +97,46 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit sColChkInfoInit = { 6, 25, 60, 50 }; typedef enum { - /* 0x0 */ POSISTERS_DAMAGEEFFECT_NOEFFECT, - /* 0x1 */ POSISTERS_DAMAGEEFFECT_UNKDMG12, // set in DamageTable, but unused - /* 0x4 */ POSISTERS_DAMAGEEFFECT_LIGHTARROWS = 0x4, - /* 0xE */ POSISTERS_DAMAGEEFFECT_SPINATTACK = 0xE, - /* 0xF */ POSISTERS_DAMAGEEFFECT_DEKUNUT = 0xF, -} PoSisterDamageEffect; + /* 0x0 */ POE_SISTERS_DMGEFF_NONE, + /* 0x1 */ POE_SISTERS_DMGEFF_UNKDMG12, // set in DamageTable, but unused + /* 0x4 */ POE_SISTERS_DMGEFF_LIGHTARROWS = 0x4, + /* 0xE */ POE_SISTERS_DMGEFF_SPINATTACK = 0xE, + /* 0xF */ POE_SISTERS_DMGEFF_DEKUNUT = 0xF, +} PoeSisterDamageEffect; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_DEKUNUT), - /* Deku Stick */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Horse trample */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Explosives */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Zora boomerang */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Normal arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Hookshot */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Goron punch */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Sword */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Goron pound */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Fire arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Ice arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Light arrow */ DMG_ENTRY(2, POSISTERS_DAMAGEEFFECT_LIGHTARROWS), - /* Goron spikes */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Deku spin */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Deku bubble */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Deku launch */ DMG_ENTRY(2, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_UNKDMG12), - /* Zora barrier */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Normal shield */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Light ray */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Thrown object */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Zora punch */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Spin attack */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_SPINATTACK), - /* Sword beam */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Normal Roll */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Unblockable */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), - /* Powder Keg */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Deku Nut */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_DEKUNUT), + /* Deku Stick */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Ice arrow */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Light arrow */ DMG_ENTRY(2, POE_SISTERS_DMGEFF_LIGHTARROWS), + /* Goron spikes */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, POE_SISTERS_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_UNKDMG12), + /* Zora barrier */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_SPINATTACK), + /* Sword beam */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, POE_SISTERS_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, POE_SISTERS_DMGEFF_NONE), }; static InitChainEntry sInitChain[] = { @@ -146,15 +146,15 @@ static InitChainEntry sInitChain[] = { // clang-format off // PoSisters have their own flags variable for cross function behavior detection -#define POSISTERS_FLAG_CLEAR (0) -#define POSISTERS_FLAG_CHECK_AC (1 << 0) -#define POSISTERS_FLAG_UPDATE_SHAPE_ROT (1 << 1) -#define POSISTERS_FLAG_CHECK_Z_TARGET (1 << 2) // meg doesnt go invis if you ztarget her for too long -#define POSISTERS_FLAG_MATCH_PLAYER_HEIGHT (1 << 3) // the po is attempting to level with player's height -#define POSISTERS_FLAG_UPDATE_BGCHECK_INFO (1 << 4) -#define POSISTERS_FLAG_UPDATE_FIRES (1 << 5) // firePos updated to match limb in PostLimbDraw -#define POSISTERS_FLAG_REAL_MEG_ROTATION (1 << 6) // real meg rotates different than her clones for one cycle -#define POSISTERS_FLAG_DRAW_TORCH (1 << 7) +#define POE_SISTERS_FLAG_CLEAR (0) +#define POE_SISTERS_FLAG_CHECK_AC (1 << 0) +#define POE_SISTERS_FLAG_UPDATE_SHAPE_ROT (1 << 1) +#define POE_SISTERS_FLAG_CHECK_Z_TARGET (1 << 2) // Meg doesnt go invisible if you ztarget her for too long +#define POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT (1 << 3) // The Poe is attempting to level with player's height +#define POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO (1 << 4) +#define POE_SISTERS_FLAG_UPDATE_FIRES (1 << 5) // firePos updated to match limb in PostLimbDraw +#define POE_SISTERS_FLAG_REAL_MEG_ROTATION (1 << 6) // Real Meg rotates different than her clones for one cycle +#define POE_SISTERS_FLAG_DRAW_TORCH (1 << 7) // clang-format on void EnPoSisters_Init(Actor* thisx, PlayState* play) { @@ -163,8 +163,8 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_Init(play, &this->skelAnime, &gPoSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, - POSISTERS_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gPoeSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, + POE_SISTERS_LIMB_MAX); this->color.r = 255; this->color.g = 255; @@ -176,21 +176,21 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->type = ENPOSISTERS_GET_TYPE(thisx); + this->type = POE_SISTERS_GET_TYPE(thisx); this->actor.hintId = this->type + TATL_HINT_ID_POE_SISTER_MEG; - this->megCloneId = ENPOSISTERS_GET_MEG_CLONE_ID(thisx); + this->megCloneId = POE_SISTERS_GET_MEG_CLONE_ID(thisx); this->floatingBobbingTimer = 32; this->zTargetTimer = 20; this->fireCount = 1; - this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; + this->poSisterFlags = POE_SISTERS_FLAG_UPDATE_FIRES; this->megDistToPlayer = 110.0f; thisx->flags &= ~ACTOR_FLAG_1; - if (ENPOSISTERS_GET_OBSERVER_FLAG(&this->actor)) { - // if flagged observer, they are a floating prop spawned by EnGb2 (po hut proprieter) + if (POE_SISTERS_GET_OBSERVER_FLAG(&this->actor)) { + // "Flagged observer": non-enemy floating prop spawned by EnGb2 (Poe Hut Proprieter) for display EnPoSisters_SetupObserverIdle(this); - } else if (this->type == POSISTER_TYPE_MEG) { - if (this->megCloneId == POSISTER_MEG_REAL) { + } else if (this->type == POE_SISTERS_TYPE_MEG) { + if (this->megCloneId == POE_SISTERS_MEG_REAL) { this->actor.colChkInfo.health = 8; this->collider.info.toucher.damage = 16; this->collider.base.ocFlags1 = (OC1_TYPE_PLAYER | OC1_ON); @@ -242,7 +242,7 @@ void EnPoSisters_MatchPlayerXZ(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 dist; - if (this->megCloneId == POSISTER_MEG_REAL || this->actionFunc != EnPoSisters_DamageFlinch) { + if (this->megCloneId == POE_SISTERS_MEG_REAL || this->actionFunc != EnPoSisters_DamageFlinch) { if ((player->meleeWeaponState == 0 || player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && ((player->actor.world.pos.y - player->actor.floorHeight) < 1.0f)) { Math_StepToF(&this->megDistToPlayer, 110.0f, 3.0f); @@ -250,7 +250,7 @@ void EnPoSisters_MatchPlayerXZ(EnPoSisters* this, PlayState* play) { Math_StepToF(&this->megDistToPlayer, 170.0f, 10.0f); } dist = this->megDistToPlayer; - } else if (this->megCloneId != POSISTER_MEG_REAL) { + } else if (this->megCloneId != POE_SISTERS_MEG_REAL) { dist = this->actor.parent->xzDistToPlayer; } @@ -309,7 +309,7 @@ void EnPoSisters_CheckZTarget(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupObserverIdle(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->laughTimer = Rand_S16Offset(100, 50); this->actionFunc = EnPoSisters_ObserverIdle; } @@ -318,7 +318,7 @@ void EnPoSisters_ObserverIdle(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (DECR(this->laughTimer) == 0) { this->laughTimer = Rand_S16Offset(100, 50); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); } } @@ -330,7 +330,7 @@ void EnPoSisters_ObserverIdle(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupAimlessIdleFlying2(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); this->idleFlyingAnimationCounter = Rand_S16Offset(2, 3); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnPoSisters_AimlessIdleFlying2; } @@ -353,29 +353,32 @@ void EnPoSisters_SetupAimlessIdleFlying(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); } this->idleFlyingAnimationCounter = Rand_S16Offset(15, 3); - this->poSisterFlags |= (POSISTERS_FLAG_CHECK_Z_TARGET | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); + this->poSisterFlags |= + (POE_SISTERS_FLAG_CHECK_Z_TARGET | POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC); this->actionFunc = EnPoSisters_AimlessIdleFlying; } void EnPoSisters_AimlessIdleFlying(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); + Math_StepToF(&this->actor.speed, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { DECR(this->idleFlyingAnimationCounter); } if ((this->actor.xzDistToPlayer < 600.0f) && (fabsf(this->actor.playerHeightRel + 5.0f) < 30.0f)) { EnPoSisters_SetupInvestigating(this); - } else if ((this->idleFlyingAnimationCounter == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f)) { + } else if ((this->idleFlyingAnimationCounter == 0) && Math_StepToF(&this->actor.speed, 0.0f, 0.2f)) { // ! @bug: this is never reached because speedXZ is reduced // at the same rate it is increased at the top of this function EnPoSisters_SetupAimlessIdleFlying2(this); } - if (this->actor.bgCheckFlags & 8) { // touching a wall - Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); - } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 600.0f) { - Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x71C); + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 600.0f) { + Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x71C); } } @@ -392,7 +395,7 @@ void EnPoSisters_Investigating(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); yawDiff = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; - Math_StepToF(&this->actor.speedXZ, 2.0f, 0.2f); + Math_StepToF(&this->actor.speed, 2.0f, 0.2f); if (yawDiff > 0x3000) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C); @@ -418,10 +421,10 @@ void EnPoSisters_SetupSpinUp(EnPoSisters* this) { this->collider.base.acFlags |= AC_HARD; } - Animation_MorphToLoop(&this->skelAnime, &gPoSistersAttackAnim, -5.0f); - this->actor.speedXZ = 0.0f; - this->spinupTimer = Animation_GetLastFrame(&gPoSistersAttackAnim.common) * 3 + 3; - this->poSisterFlags &= ~POSISTERS_FLAG_UPDATE_SHAPE_ROT; + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersAttackAnim, -5.0f); + this->actor.speed = 0.0f; + this->spinupTimer = Animation_GetLastFrame(&gPoeSistersAttackAnim.common) * 3 + 3; + this->poSisterFlags &= ~POE_SISTERS_FLAG_UPDATE_SHAPE_ROT; this->actionFunc = EnPoSisters_SpinUp; } @@ -430,23 +433,23 @@ void EnPoSisters_SpinUp(EnPoSisters* this, PlayState* play) { DECR(this->spinupTimer); this->actor.shape.rot.y += ((s32)((this->skelAnime.endFrame + 1.0f) * 3.0f) - this->spinupTimer) * 0x180; if ((this->spinupTimer == 18) || (this->spinupTimer == 7)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); } else if (this->spinupTimer == 0) { EnPoSisters_SetupSpinAttack(this); } } void EnPoSisters_SetupSpinAttack(EnPoSisters* this) { - this->actor.speedXZ = 5.0f; - if (this->type == POSISTER_TYPE_MEG) { + this->actor.speed = 5.0f; + if (this->type == POE_SISTERS_TYPE_MEG) { this->collider.base.colType = COLTYPE_METAL; this->collider.base.acFlags |= AC_HARD; - Animation_MorphToLoop(&this->skelAnime, &gPoSistersAttackAnim, -5.0f); + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersAttackAnim, -5.0f); } this->spinTimer = 5; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->poSisterFlags |= POSISTERS_FLAG_MATCH_PLAYER_HEIGHT; + this->poSisterFlags |= POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT; this->actionFunc = EnPoSisters_SpinAttack; } @@ -462,19 +465,19 @@ void EnPoSisters_SpinAttack(EnPoSisters* this, PlayState* play) { s16 rotY = this->actor.shape.rot.y - this->actor.world.rot.y; if (ABS_ALT(rotY) < 0x1000) { - if (this->type != POSISTER_TYPE_MEG) { + if (this->type != POE_SISTERS_TYPE_MEG) { this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; EnPoSisters_SetupAimlessIdleFlying(this); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); EnPoSisters_MegCloneVanish(this, play); } } } if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_ROLL); } } @@ -484,7 +487,7 @@ void EnPoSisters_SpinAttack(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupAttackConnect(EnPoSisters* this) { Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); this->actor.world.rot.y = BINANG_ROT180(this->actor.yawTowardsPlayer); - if (this->type != POSISTER_TYPE_MEG) { + if (this->type != POE_SISTERS_TYPE_MEG) { this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; } @@ -494,14 +497,14 @@ void EnPoSisters_SetupAttackConnect(EnPoSisters* this) { void EnPoSisters_AttackConnectDrift(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - this->actor.shape.rot.y -= (s16)(this->actor.speedXZ * 10.0f * 128.0f); + this->actor.shape.rot.y -= (s16)(this->actor.speed * 10.0f * 128.0f); - if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f)) { // wait to stop moving + if (Math_StepToF(&this->actor.speed, 0.0f, 0.1f)) { // wait to stop moving this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->type != POSISTER_TYPE_MEG) { + if (this->type != POE_SISTERS_TYPE_MEG) { EnPoSisters_SetupAimlessIdleFlying(this); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); EnPoSisters_MegCloneVanish(this, play); } } @@ -513,22 +516,23 @@ void EnPoSisters_SetupDamageFlinch(EnPoSisters* this) { func_800BE504(&this->actor, &this->collider); } - if (this->type != POSISTER_TYPE_MEG) { - this->actor.speedXZ = 10.0f; + if (this->type != POE_SISTERS_TYPE_MEG) { + this->actor.speed = 10.0f; } this->poSisterFlags &= - ~(POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); + ~(POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC); + + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); this->actionFunc = EnPoSisters_DamageFlinch; } void EnPoSisters_DamageFlinch(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_8000)) { if (this->actor.colChkInfo.health != 0) { - if (this->type != POSISTER_TYPE_MEG) { + if (this->type != POE_SISTERS_TYPE_MEG) { EnPoSisters_SetupFlee(this); - } else if (this->megCloneId != POSISTER_MEG_REAL) { + } else if (this->megCloneId != POE_SISTERS_MEG_REAL) { EnPoSisters_MegCloneVanish(this, NULL); } else { EnPoSisters_MegCloneVanish(this, play); @@ -538,28 +542,28 @@ void EnPoSisters_DamageFlinch(EnPoSisters* this, PlayState* play) { } } - if (this->megCloneId != POSISTER_MEG_REAL) { + if (this->megCloneId != POE_SISTERS_MEG_REAL) { s32 alpha; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y, - (this->megCloneId == POSISTER_MEG_CLONE2) ? 0x800 : 0x400); + (this->megCloneId == POE_SISTERS_MEG_CLONE2) ? 0x800 : 0x400); alpha = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; this->color.a = CLAMP(alpha, 0, 255); this->actor.world.pos.y = this->actor.parent->world.pos.y; EnPoSisters_MatchPlayerXZ(this, play); - } else if (this->type != POSISTER_TYPE_MEG) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + } else if (this->type != POE_SISTERS_TYPE_MEG) { + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); } } void EnPoSisters_SetupFlee(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &gPoSistersFleeAnim, -3.0f); + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFleeAnim, -3.0f); this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); this->fleeTimer = 5; this->poSisterFlags |= - (POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); - this->actor.speedXZ = 5.0f; + (POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC); + this->actor.speed = 5.0f; this->actionFunc = EnPoSisters_Flee; } @@ -570,9 +574,9 @@ void EnPoSisters_Flee(EnPoSisters* this, PlayState* play) { DECR(this->fleeTimer); } - if (this->actor.bgCheckFlags & 8) { // touching a wall + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->poSisterFlags |= POSISTERS_FLAG_UPDATE_SHAPE_ROT; + this->poSisterFlags |= POE_SISTERS_FLAG_UPDATE_SHAPE_ROT; EnPoSisters_SetupSpinToInvis(this); } else if (this->fleeTimer == 0 && this->actor.xzDistToPlayer > 480.0f) { this->actor.world.rot.y = this->actor.shape.rot.y; @@ -584,11 +588,11 @@ void EnPoSisters_SetupSpinToInvis(EnPoSisters* this) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim.common), ANIMMODE_ONCE, -3.0f); this->invisibleTimer = 100; // 5 seconds - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->poSisterFlags &= ~(POSISTERS_FLAG_CHECK_Z_TARGET | POSISTERS_FLAG_CHECK_AC); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DISAPPEAR); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); + this->poSisterFlags &= ~(POE_SISTERS_FLAG_CHECK_Z_TARGET | POE_SISTERS_FLAG_CHECK_AC); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DISAPPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); this->actionFunc = EnPoSisters_SpinToInvis; } @@ -607,7 +611,7 @@ void EnPoSisters_SpinToInvis(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupSpinBackToVisible(EnPoSisters* this, PlayState* play) { Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim.common), ANIMMODE_ONCE, -3.0f); - if (this->type == POSISTER_TYPE_MEG) { + if (this->type == POE_SISTERS_TYPE_MEG) { this->megDistToPlayer = 110.0f; EnPoSisters_MatchPlayerXZ(this, play); this->color.a = 0; @@ -617,17 +621,17 @@ void EnPoSisters_SetupSpinBackToVisible(EnPoSisters* this, PlayState* play) { } this->spinInvisibleTimer = 15; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); - this->poSisterFlags &= ~POSISTERS_FLAG_CHECK_AC; + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + this->poSisterFlags &= ~POE_SISTERS_FLAG_CHECK_AC; this->actionFunc = EnPoSisters_SpinBackToVisible; } void EnPoSisters_SpinBackToVisible(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->color.a = 255; // fully visible - if (this->type != POSISTER_TYPE_MEG) { - this->poSisterFlags |= POSISTERS_FLAG_CHECK_AC; + if (this->type != POE_SISTERS_TYPE_MEG) { + this->poSisterFlags |= POE_SISTERS_FLAG_CHECK_AC; this->collider.info.bumper.dmgFlags = ~(0x8000000 | 0x200000 | 0x100000 | 0x40000 | 0x1); DECR(this->spinInvisibleTimer); @@ -643,7 +647,7 @@ void EnPoSisters_SpinBackToVisible(EnPoSisters* this, PlayState* play) { s32 alpha = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; this->color.a = CLAMP(alpha, 0, 255); - if (this->type == POSISTER_TYPE_MEG) { + if (this->type == POE_SISTERS_TYPE_MEG) { EnPoSisters_MatchPlayerXZ(this, play); } } @@ -651,11 +655,11 @@ void EnPoSisters_SpinBackToVisible(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupDeathStage1(EnPoSisters* this) { this->deathTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.pos.y += 42.0f; this->actor.shape.yOffset = -6000.0f; this->actor.flags &= ~ACTOR_FLAG_1; - this->poSisterFlags = POSISTERS_FLAG_CLEAR; + this->poSisterFlags = POE_SISTERS_FLAG_CLEAR; this->actionFunc = EnPoSisters_DeathStage1; } @@ -696,7 +700,7 @@ void EnPoSisters_DeathStage1(EnPoSisters* this, PlayState* play) { } if (this->deathTimer == 16) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); } } @@ -724,15 +728,15 @@ void EnPoSisters_DeathStage2(EnPoSisters* this, PlayState* play) { void EnPoSisters_SpawnMegClones(EnPoSisters* this, PlayState* play) { Actor* clone1 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE1, POSISTER_TYPE_MEG)); + 0, POE_SISTERS_PARAMS(false, POE_SISTERS_MEG_CLONE1, POE_SISTERS_TYPE_MEG)); Actor* clone2 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE2, POSISTER_TYPE_MEG)); + 0, POE_SISTERS_PARAMS(false, POE_SISTERS_MEG_CLONE2, POE_SISTERS_TYPE_MEG)); Actor* clone3 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE3, POSISTER_TYPE_MEG)); + 0, POE_SISTERS_PARAMS(false, POE_SISTERS_MEG_CLONE3, POE_SISTERS_TYPE_MEG)); - // if we cannot spawn all clones: abort + // If we cannot spawn all clones: Abort if ((clone1 == NULL) || (clone2 == NULL) || (clone3 == NULL)) { if (clone1 != NULL) { Actor_Kill(clone1); @@ -759,7 +763,7 @@ void EnPoSisters_MegCloneVanish(EnPoSisters* this, PlayState* play) { this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; this->invisibleTimer = 100; // 5 seconds - this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; + this->poSisterFlags = POE_SISTERS_FLAG_UPDATE_FIRES; this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; @@ -767,10 +771,10 @@ void EnPoSisters_MegCloneVanish(EnPoSisters* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 45.0f; pos.z = this->actor.world.pos.z; - func_800B3030(play, &pos, &gZeroVec3f, &gZeroVec3f, 150, 0, 3); // spawns EffectSsDeadDb + func_800B3030(play, &pos, &gZeroVec3f, &gZeroVec3f, 150, 0, 3); // Spawns EffectSsDeadDb (flame effects) } - Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); // light OFF + Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); // Light OFF this->actionFunc = EnPoSisters_MegCloneWaitForSpinBack; } @@ -778,7 +782,7 @@ void EnPoSisters_MegCloneWaitForSpinBack(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); EnPoSisters* parent = (EnPoSisters*)this->actor.parent; - if (this->megCloneId == POSISTER_MEG_REAL) { + if (this->megCloneId == POE_SISTERS_MEG_REAL) { DECR(this->invisibleTimer); if (this->invisibleTimer == 0) { s32 rand = Rand_ZeroFloat(4.0f); @@ -803,7 +807,7 @@ void EnPoSisters_SetupMegSurroundPlayer(EnPoSisters* this) { this->color.a = 255; this->megSurroundTimer = 300; // 15 seconds this->megClonesRemaining = 3; - this->poSisterFlags |= (POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_CHECK_AC); + this->poSisterFlags |= (POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_CHECK_AC); this->actor.flags |= ACTOR_FLAG_1; this->actionFunc = EnPoSisters_MegSurroundPlayer; } @@ -815,47 +819,48 @@ void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play) { if (this->megClonesRemaining > 0 && this->megSurroundTimer >= 16) { SkelAnime_Update(&this->skelAnime); - if (this->megCloneId == POSISTER_MEG_REAL) { + if (this->megCloneId == POE_SISTERS_MEG_REAL) { if (ABS_ALT(16 - this->floatingBobbingTimer) < 14) { - // every x frames rotate around player, the fewer meg clones remaining the faster they spin + // Every N frames rotate around player. The fewer Meg clones remaining the faster they spin. this->actor.shape.rot.y += (s16)((0x580 - (this->megClonesRemaining * 0x180)) * fabsf(Math_SinS(this->floatingBobbingTimer * 0x800))); } - // twirl the real meg backwards for a bit for visual tell to player + // Twirl the real Meg backwards for a bit for a visual tell to player. if ((this->megSurroundTimer >= 284) || (this->megSurroundTimer <= 30)) { - this->poSisterFlags |= POSISTERS_FLAG_REAL_MEG_ROTATION; + this->poSisterFlags |= POE_SISTERS_FLAG_REAL_MEG_ROTATION; } else { - this->poSisterFlags &= ~POSISTERS_FLAG_REAL_MEG_ROTATION; + this->poSisterFlags &= ~POE_SISTERS_FLAG_REAL_MEG_ROTATION; } } else { this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->megCloneId * 0x4000); } } - if (this->megCloneId == POSISTER_MEG_REAL) { + if (this->megCloneId == POE_SISTERS_MEG_REAL) { if ((this->megSurroundTimer >= 284) || ((this->megSurroundTimer <= 30) && (this->megSurroundTimer >= 16))) { - this->poSisterFlags |= POSISTERS_FLAG_REAL_MEG_ROTATION; + this->poSisterFlags |= POE_SISTERS_FLAG_REAL_MEG_ROTATION; } else { - this->poSisterFlags &= ~POSISTERS_FLAG_REAL_MEG_ROTATION; + this->poSisterFlags &= ~POE_SISTERS_FLAG_REAL_MEG_ROTATION; } } if (this->megSurroundTimer == 0) { - if (this->megCloneId == POSISTER_MEG_REAL) { + if (this->megCloneId == POE_SISTERS_MEG_REAL) { EnPoSisters_SetupSpinAttack(this); } else { EnPoSisters_MegCloneVanish(this, play); } - } else if (this->megCloneId != POSISTER_MEG_REAL) { + } else if (this->megCloneId != POE_SISTERS_MEG_REAL) { parent = (EnPoSisters*)this->actor.parent; if (parent->actionFunc == EnPoSisters_DamageFlinch) { - // flinch clones if you hit the real meg + // Clones flinch if you hit the real Meg EnPoSisters_SetupDamageFlinch(this); } } else if (this->megClonesRemaining == 0) { - // all meg clones have been killed, meg waits 15 frames then spin attacks - // timer is negative because megClonesRemaining and megAttackTimer are the same union'd variable + // All Meg clones have been killed: Real Meg waits 15 frames then spin attacks in retaliation + // Timer is negative (inrecrements to zero) + // because megClonesRemaining and megAttackTimer are the same union'd variable this->megAttackTimer = -15; } else if (this->megAttackTimer < 0) { this->megAttackTimer++; @@ -872,9 +877,9 @@ void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play) { */ void EnPoSisters_SetupSpawnPo(EnPoSisters* this) { Animation_PlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); this->color.a = 0; - this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; + this->poSisterFlags = POE_SISTERS_FLAG_UPDATE_FIRES; this->actionFunc = EnPoSisters_PoeSpawn; } @@ -882,8 +887,8 @@ void EnPoSisters_PoeSpawn(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->color.a = 255; this->actor.flags |= ACTOR_FLAG_1; - this->poSisterFlags |= (POSISTERS_FLAG_UPDATE_BGCHECK_INFO | POSISTERS_FLAG_MATCH_PLAYER_HEIGHT); - if (this->type == POSISTER_TYPE_MEG) { + this->poSisterFlags |= (POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO | POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT); + if (this->type == POE_SISTERS_TYPE_MEG) { EnPoSisters_MegCloneVanish(this, play); } else { EnPoSisters_SetupAimlessIdleFlying(this); @@ -903,9 +908,9 @@ void EnPoSisters_CheckCollision(EnPoSisters* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); - if (this->megCloneId != POSISTER_MEG_REAL) { + if (this->megCloneId != POE_SISTERS_MEG_REAL) { ((EnPoSisters*)this->actor.parent)->megClonesRemaining--; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH2); EnPoSisters_MegCloneVanish(this, play); if (Rand_ZeroOne() < 0.2f) { pos.x = this->actor.world.pos.x; @@ -914,27 +919,27 @@ void EnPoSisters_CheckCollision(EnPoSisters* this, PlayState* play) { Item_DropCollectible(play, &pos, ITEM00_ARROWS_10); } } else if (this->collider.base.colType != 9) { - if (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_DEKUNUT) { + if (this->actor.colChkInfo.damageEffect == POE_SISTERS_DMGEFF_DEKUNUT) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->poSisterFlags |= POSISTERS_FLAG_UPDATE_SHAPE_ROT; + this->poSisterFlags |= POE_SISTERS_FLAG_UPDATE_SHAPE_ROT; EnPoSisters_SetupSpinBackToVisible(this, play); - } else if ((this->type == POSISTER_TYPE_MEG) && - (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_SPINATTACK) && + } else if ((this->type == POE_SISTERS_TYPE_MEG) && + (this->actor.colChkInfo.damageEffect == POE_SISTERS_DMGEFF_SPINATTACK) && (this->actionFunc == EnPoSisters_MegSurroundPlayer)) { if (this->megClonesRemaining == 0) { - // all meg clones have been killed, meg waits 45 frames then spin attacks - // timer is negative because megClonesRemaining and megAttackTimer are the same union'd variable + // All Meg clones have been killed: Real Meg waits 45 frames then spin attacks + // Timer is negative because megClonesRemaining and megAttackTimer are the same union'd variable this->megAttackTimer = -45; } } else { if (Actor_ApplyDamage(&this->actor)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DAMAGE); } else { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_SISTER_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } - if (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_LIGHTARROWS) { + if (this->actor.colChkInfo.damageEffect == POE_SISTERS_DMGEFF_LIGHTARROWS) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, @@ -960,19 +965,19 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { } EnPoSisters_CheckCollision(this, play); - if (this->poSisterFlags & POSISTERS_FLAG_CHECK_Z_TARGET) { + if (this->poSisterFlags & POE_SISTERS_FLAG_CHECK_Z_TARGET) { EnPoSisters_CheckZTarget(this, play); } this->actionFunc(this, play); - if (this->poSisterFlags & POSISTERS_FLAG_MATCH_PLAYER_HEIGHT) { + if (this->poSisterFlags & POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT) { EnPoSisters_MatchPlayerY(this, play); } Actor_MoveWithGravity(&this->actor); - if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_BGCHECK_INFO) { + if (this->poSisterFlags & POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); } else { checkPos.x = this->actor.world.pos.x; @@ -999,8 +1004,8 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { } if (this->poSisterFlags & - (POSISTERS_FLAG_UPDATE_BGCHECK_INFO | POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_CHECK_Z_TARGET | - POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC)) { + (POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO | POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_CHECK_Z_TARGET | + POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC)) { Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->actionFunc == EnPoSisters_SpinAttack) || (this->actionFunc == EnPoSisters_SpinUp)) { this->fireCount++; @@ -1014,7 +1019,7 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->poSisterFlags & POSISTERS_FLAG_CHECK_AC) { + if (this->poSisterFlags & POE_SISTERS_FLAG_CHECK_AC) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } @@ -1024,23 +1029,23 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { if (this->actionFunc == EnPoSisters_Flee) { this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); - } else if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_SHAPE_ROT) { + } else if (this->poSisterFlags & POE_SISTERS_FLAG_UPDATE_SHAPE_ROT) { this->actor.shape.rot.y = this->actor.world.rot.y; } } } void EnPoSisters_UpdateColors(EnPoSisters* this) { - if (this->skelAnime.animation == &gPoSistersAttackAnim) { + if (this->skelAnime.animation == &gPoeSistersAttackAnim) { this->color.r = CLAMP_MAX(this->color.r + 5, 255); this->color.g = CLAMP_MIN(this->color.g - 5, 50); this->color.b = CLAMP_MIN(this->color.b - 5, 0); - } else if (this->skelAnime.animation == &gPoSistersFleeAnim) { + } else if (this->skelAnime.animation == &gPoeSistersFleeAnim) { this->color.r = CLAMP_MAX(this->color.r + 5, 80); this->color.g = CLAMP_MAX(this->color.g + 5, 255); this->color.b = CLAMP_MAX(this->color.b + 5, 225); } else if (this->skelAnime.animation == &gPoeSistersDamagedAnim) { - // flash every other frame after taking damage + // Flash every other frame after taking damage if (this->actor.colorFilterTimer & 0x2) { this->color.r = 0; this->color.g = 0; @@ -1067,16 +1072,16 @@ void EnPoSisters_UpdateColors(EnPoSisters* this) { s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Gfx* gPoSisterBodyDisplayLists[] = { - gPoSistersMegBodyDL, - gPoSistersJoelleBodyDL, - gPoSistersBethBodyDL, - gPoSistersAmyBodyDL, + gPoeSistersMegBodyDL, + gPoeSistersJoelleBodyDL, + gPoeSistersBethBodyDL, + gPoeSistersAmyBodyDL, }; static Gfx* gPoSisterFaceDisplayLists[] = { - gPoSistersMegFaceDL, - gPoSistersJoelleFaceDL, - gPoSistersBethFaceDL, - gPoSistersAmyFaceDL, + gPoeSistersMegFaceDL, + gPoeSistersJoelleFaceDL, + gPoeSistersBethFaceDL, + gPoeSistersAmyFaceDL, }; static Color_RGBA8 gPoSisterColors[] = { { 80, 0, 100, 0 }, @@ -1086,7 +1091,7 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve }; EnPoSisters* this = THIS; - if (limbIndex == POSISTERS_LIMB_ROOT && (this->poSisterFlags & POSISTERS_FLAG_REAL_MEG_ROTATION)) { + if (limbIndex == POE_SISTERS_LIMB_ROOT && (this->poSisterFlags & POE_SISTERS_FLAG_REAL_MEG_ROTATION)) { if (this->megSurroundTimer >= 284) { rot->x += (this->megSurroundTimer - 284) * 0x1000; } else { @@ -1094,17 +1099,17 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve } } - if ((this->color.a == 0) || (limbIndex == POSISTERS_LIMB_TORCH) || + if ((this->color.a == 0) || (limbIndex == POE_SISTERS_LIMB_TORCH) || ((this->actionFunc == EnPoSisters_DeathStage1) && (this->deathTimer >= 8))) { *dList = NULL; - } else if (limbIndex == POSISTERS_LIMB_MAIN_BODY) { + } else if (limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { *dList = gPoSisterBodyDisplayLists[this->type]; - } else if (limbIndex == POSISTERS_LIMB_FACE) { + } else if (limbIndex == POE_SISTERS_LIMB_FACE) { *dList = gPoSisterFaceDisplayLists[this->type]; gDPPipeSync((*gfx)++); gDPSetEnvColor((*gfx)++, this->color.r, this->color.g, this->color.b, this->color.a); - } else if (limbIndex == POSISTERS_LIMB_LOWER_BODY) { + } else if (limbIndex == POE_SISTERS_LIMB_LOWER_BODY) { Color_RGBA8* color = &gPoSisterColors[this->type]; gDPPipeSync((*gfx)++); @@ -1114,46 +1119,47 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve return false; } -#define POSISTER_LIMBPOS_INVALID -1 +#define POE_SISTERS_LIMBPOS_INVALID -1 void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; static s8 D_80B1DB08[] = { - POSISTER_LIMBPOS_INVALID, - POSISTER_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, 0, 1, 2, - POSISTER_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, 3, - POSISTER_LIMBPOS_INVALID, - POSISTER_LIMBPOS_INVALID, - POSISTER_LIMBPOS_INVALID, - POSISTER_LIMBPOS_INVALID, - POSISTER_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, + POE_SISTERS_LIMBPOS_INVALID, }; EnPoSisters* this = THIS; s32 end; f32 brightness; - if (D_80B1DB08[limbIndex] != POSISTER_LIMBPOS_INVALID) { + if (D_80B1DB08[limbIndex] != POE_SISTERS_LIMBPOS_INVALID) { Matrix_MultZero(&this->limbPos[D_80B1DB08[limbIndex]]); - } else if (limbIndex == POSISTERS_LIMB_MAIN_BODY) { + } else if (limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { Matrix_MultVecY(-2500.0f, &this->limbPos[4]); Matrix_MultVecY(3000.0f, &this->limbPos[5]); - } else if (limbIndex == POSISTERS_LIMB_FACE) { + } else if (limbIndex == POE_SISTERS_LIMB_FACE) { Matrix_MultVecY(-4000.0f, &this->limbPos[6]); - } else if (limbIndex == POSISTERS_LIMB_LOWER_BODY) { + } else if (limbIndex == POE_SISTERS_LIMB_LOWER_BODY) { Matrix_MultVecX(3000.0f, &this->limbPos[7]); } - if (this->actionFunc == EnPoSisters_DeathStage1 && this->deathTimer >= 8 && limbIndex == POSISTERS_LIMB_MAIN_BODY) { + if (this->actionFunc == EnPoSisters_DeathStage1 && this->deathTimer >= 8 && + limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList((*gfx)++, gPoSistersBurnBodyDL); + gSPDisplayList((*gfx)++, gPoeSistersBurnBodyDL); } - if (limbIndex == POSISTERS_LIMB_TORCH) { - if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_FIRES) { + if (limbIndex == POE_SISTERS_LIMB_TORCH) { + if (this->poSisterFlags & POE_SISTERS_FLAG_UPDATE_FIRES) { for (end = this->fireCount - 1; end > 0; end--) { this->firePos[end] = this->firePos[end - 1]; } @@ -1164,7 +1170,7 @@ void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s if (this->fireCount > 0) { Color_RGBA8* flameColor = &sPoSisterFlameColors[this->type]; - brightness = Rand_ZeroFloat(0.3f) + 0.7f; // flickering torch light level + brightness = Rand_ZeroFloat(0.3f) + 0.7f; // Flickering torch light level if (this->actionFunc == EnPoSisters_DeathStage2) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->firePos[0].x, this->firePos[0].y + 15.0f, @@ -1179,7 +1185,7 @@ void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); } - if (!(this->poSisterFlags & POSISTERS_FLAG_DRAW_TORCH)) { + if (!(this->poSisterFlags & POE_SISTERS_FLAG_DRAW_TORCH)) { Matrix_Get(&this->mtxf); } } @@ -1203,23 +1209,23 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { if ((this->color.a == 255) || (this->color.a == 0)) { gDPSetEnvColor(POLY_OPA_DISP++, this->color.r, this->color.g, this->color.b, this->color.a); - gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); // empty + gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); // Empty DL POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->color.a); - gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); // xlu only DL + gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); // XLU only DL POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - if (!(this->poSisterFlags & POSISTERS_FLAG_DRAW_TORCH)) { + if (!(this->poSisterFlags & POE_SISTERS_FLAG_DRAW_TORCH)) { Matrix_Put(&this->mtxf); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gPoSistersDrawTorchDL); + gSPDisplayList(POLY_OPA_DISP++, gPoeSistersDrawTorchDL); } gSPSegment( diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 5e549c4d7..cfb8a1697 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -8,24 +8,24 @@ struct EnPoSisters; typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); -#define ENPOSISTERS_GET_OBSERVER_FLAG(thisx) ((thisx)->params & 0x1000) -#define ENPOSISTERS_GET_MEG_CLONE_ID(thisx) (((thisx)->params >> 0xA) & 3) -#define ENPOSISTERS_GET_TYPE(thisx) (((thisx)->params >> 8) & 3) +#define POE_SISTERS_GET_OBSERVER_FLAG(thisx) ((thisx)->params & 0x1000) +#define POE_SISTERS_GET_MEG_CLONE_ID(thisx) (((thisx)->params >> 0xA) & 3) +#define POE_SISTERS_GET_TYPE(thisx) (((thisx)->params >> 8) & 3) -#define ENPOSISTERS_PARAMS(observerFlag, megClone, type) (((observerFlag) << 0xC) | ((megClone & 3) << 0xA) | ((type & 3) << 8)) +#define POE_SISTERS_PARAMS(observerFlag, megClone, type) (((observerFlag) << 0xC) | ((megClone & 3) << 0xA) | ((type & 3) << 8)) typedef enum { - /* 0 */ POSISTER_TYPE_MEG, // purple - /* 1 */ POSISTER_TYPE_JO, // red - /* 2 */ POSISTER_TYPE_BETH, // blue - /* 3 */ POSISTER_TYPE_AMY, // green + /* 0 */ POE_SISTERS_TYPE_MEG, // purple + /* 1 */ POE_SISTERS_TYPE_JO, // red + /* 2 */ POE_SISTERS_TYPE_BETH, // blue + /* 3 */ POE_SISTERS_TYPE_AMY, // green } EnPoSisterType; typedef enum { - /* 0 */ POSISTER_MEG_REAL, - /* 1 */ POSISTER_MEG_CLONE1, - /* 2 */ POSISTER_MEG_CLONE2, - /* 3 */ POSISTER_MEG_CLONE3, + /* 0 */ POE_SISTERS_MEG_REAL, + /* 1 */ POE_SISTERS_MEG_CLONE1, + /* 2 */ POE_SISTERS_MEG_CLONE2, + /* 3 */ POE_SISTERS_MEG_CLONE3, } EnPoSisterMegCloneID; typedef struct EnPoSisters { @@ -54,8 +54,8 @@ typedef struct EnPoSisters { s16 megAttackTimer; // delay until meg spin attacks player (negative frames counting up to 0) s16 megClonesRemaining; // positive count of meg clones remaining }; - /* 0x196 */ Vec3s jointTable[POSISTERS_LIMB_MAX]; - /* 0x1DE */ Vec3s morphTable[POSISTERS_LIMB_MAX]; + /* 0x196 */ Vec3s jointTable[POE_SISTERS_LIMB_MAX]; + /* 0x1DE */ Vec3s morphTable[POE_SISTERS_LIMB_MAX]; /* 0x226 */ Color_RGBA8 color; /* 0x22C */ Vec3f firePos[8]; /* 0x28C */ Vec3f limbPos[8]; // passed to Actor_DrawDamageEffects diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index f1b0f74d4..997e91e8a 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -167,7 +167,7 @@ void EnPoh_Init(Actor* thisx, PlayState* play) { 255, 255, 255, 0); SkelAnime_Init(play, &this->skelAnime, &object_po_Skel_0050D0, &object_po_Anim_000A60, this->jointTable, this->morphTable, 21); - this->actor.bgCheckFlags |= 0x400; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; func_80B2D0E8(this); } @@ -216,7 +216,7 @@ void func_80B2CA4C(EnPoh* this) { Animation_PlayLoop(&this->skelAnime, &object_po_Anim_0015B0); this->unk_18E = Rand_S16Offset(2, 3); this->actionFunc = func_80B2CAA4; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80B2CAA4(EnPoh* this, PlayState* play) { @@ -247,13 +247,13 @@ void func_80B2CB60(EnPoh* this) { void func_80B2CBBC(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); + Math_StepToF(&this->actor.speed, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f) && (this->unk_18E != 0)) { this->unk_18E--; } - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 400.0f) { - this->unk_192 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 400.0f) { + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_192, 0x71C); @@ -277,7 +277,7 @@ void func_80B2CD14(EnPoh* this) { Animation_PlayLoop(&this->skelAnime, &object_po_Anim_000A60); this->actionFunc = func_80B2CD64; this->unk_18E = 0; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; } void func_80B2CD64(EnPoh* this, PlayState* play) { @@ -315,15 +315,15 @@ void func_80B2CD64(EnPoh* this, PlayState* play) { void func_80B2CEC8(EnPoh* this) { Animation_MorphToLoop(&this->skelAnime, &object_po_Anim_0001A8, -6.0f); this->unk_18E = 12; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = func_80B2CF28; } void func_80B2CF28(EnPoh* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_KANTERA); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_KANTERA); if (this->unk_18E != 0) { this->unk_18E--; } @@ -333,7 +333,7 @@ void func_80B2CF28(EnPoh* this, PlayState* play) { if (this->unk_18E >= 10) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xAAA); } else if (this->unk_18E == 9) { - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->skelAnime.playSpeed = 2.0f; } else if (this->unk_18E == 0) { func_80B2CB60(this); @@ -345,13 +345,13 @@ void func_80B2CFF8(EnPoh* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_po_Anim_0004EC, -6.0f); func_800BE504(&this->actor, &this->colliderCylinder); this->colliderCylinder.base.acFlags &= ~AC_ON; - this->actor.speedXZ = 5.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); + this->actor.speed = 5.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); this->actionFunc = func_80B2D07C; } void func_80B2D07C(EnPoh* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { func_80B2DAD0(this); @@ -379,13 +379,13 @@ void func_80B2D140(EnPoh* this, PlayState* play) { } if ((this->skelAnime.playSpeed < 0.5f) && (this->actor.xzDistToPlayer < 280.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); this->skelAnime.playSpeed = 1.0f; } } void func_80B2D2C0(EnPoh* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_18E = 0; this->actor.hintId = TATL_HINT_ID_NONE; @@ -438,14 +438,14 @@ void func_80B2D300(EnPoh* this, PlayState* play) { } if (this->unk_18E == 18) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); } } void func_80B2D5DC(EnPoh* this) { Animation_PlayOnce(&this->skelAnime, &object_po_Anim_000A60); this->actionFunc = func_80B2D628; - this->actor.speedXZ = -5.0f; + this->actor.speed = -5.0f; } void func_80B2D628(EnPoh* this, PlayState* play) { @@ -454,7 +454,7 @@ void func_80B2D628(EnPoh* this, PlayState* play) { func_80B2CB60(this); this->unk_18E = 23; } else { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.shape.rot.y += 0x1000; } } @@ -463,7 +463,7 @@ void func_80B2D694(EnPoh* this) { Animation_PlayLoop(&this->skelAnime, &object_po_Anim_0015B0); this->unk_192 = BINANG_ROT180(this->actor.world.rot.y); this->actionFunc = func_80B2D6EC; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80B2D6EC(EnPoh* this, PlayState* play) { @@ -482,10 +482,10 @@ void func_80B2D6EC(EnPoh* this, PlayState* play) { void func_80B2D76C(EnPoh* this) { this->unk_18C = 32; this->unk_192 = 0x2000; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DISAPPEAR); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DISAPPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->colliderCylinder.base.acFlags &= ~AC_ON; this->actionFunc = func_80B2D7D4; } @@ -513,9 +513,9 @@ void func_80B2D7D4(EnPoh* this, PlayState* play) { void func_80B2D924(EnPoh* this) { this->unk_18C = 0; this->unk_192 = 0x2000; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->colliderCylinder.base.acFlags &= ~AC_ON; this->actionFunc = func_80B2D980; } @@ -539,7 +539,7 @@ void func_80B2D980(EnPoh* this, PlayState* play) { void func_80B2DAD0(EnPoh* this) { Animation_MorphToLoop(&this->skelAnime, &object_po_Anim_0006E0, -5.0f); - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); this->colliderCylinder.base.acFlags |= AC_ON; this->unk_18E = 200; @@ -582,7 +582,7 @@ void func_80B2DC50(EnPoh* this, PlayState* play) { } void func_80B2DD2C(EnPoh* this, PlayState* play) { - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight <= BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight <= BGCHECK_Y_MIN)) { EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO, 10, object_po_DL_002D28); func_80B2E0B0(this); } @@ -629,7 +629,7 @@ void func_80B2E0B0(EnPoh* this) { this->actor.home.pos.y = this->actor.world.pos.y; this->actor.scale.x = 0.0f; this->actor.scale.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_METAL_BOX_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_METAL_BOX_BOUND); this->actionFunc = func_80B2E180; } @@ -663,7 +663,7 @@ void func_80B2E230(EnPoh* this, PlayState* play) { return; } - Actor_PickUp(&this->actor, play, GI_MAX, 35.0f, 60.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f); this->actor.world.pos.y = (Math_SinS(this->unk_18D * 0x800) * 5.0f) + this->actor.home.pos.y; if (this->unk_18D) { this->unk_18D--; @@ -680,7 +680,7 @@ void func_80B2E230(EnPoh* this, PlayState* play) { void func_80B2E3B0(EnPoh* this) { AudioSfx_StopByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = func_80B2E3F8; } @@ -696,9 +696,9 @@ void func_80B2E438(EnPoh* this, PlayState* play) { this->colliderCylinder.base.acFlags &= ~AC_HIT; if (!Actor_ApplyDamage(&this->actor)) { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD); } else if (this->actor.colChkInfo.damage != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DAMAGE); } if (this->actor.colChkInfo.damageEffect != 14) { diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index fad487e62..20c0dc1d8 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -446,27 +446,27 @@ void EnPp_PlaySfxForAnimation(EnPp* this) { case EN_PP_ANIM_WALK: case EN_PP_ANIM_TURN_TO_FACE_PLAYER: if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOTSTEP); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_FOOTSTEP); } break; case EN_PP_ANIM_WIND_UP: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_FOOT - SFX_FLAG); break; case EN_PP_ANIM_CHARGE: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_RUN - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_RUN - SFX_FLAG); break; case EN_PP_ANIM_ATTACK: if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); } break; case EN_PP_ANIM_ROAR: if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); } break; @@ -537,7 +537,7 @@ void EnPp_Idle(EnPp* this, PlayState* play) { posToLookAt.x += randPlusMinusPoint5Scaled(50.0f); posToLookAt.z += randPlusMinusPoint5Scaled(50.0f); this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &posToLookAt); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->animIndex != EN_PP_ANIM_IDLE) { EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); } @@ -561,7 +561,7 @@ void EnPp_Idle(EnPp* this, PlayState* play) { if ((this->maskBounceRotationalVelocity < 0x64) && (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f)) { - Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.0f, 0.3f, 1.0f); } Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, @@ -611,7 +611,7 @@ void EnPp_Charge(EnPp* this, PlayState* play) { Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); if (!this->actionVar.isCharging) { - Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); + Math_ApproachZeroF(&this->actor.speed, 0.5f, 1.0f); if (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f) { if (this->chargesInStraightLines) { this->actor.world.rot.y = this->targetRotY; @@ -629,13 +629,13 @@ void EnPp_Charge(EnPp* this, PlayState* play) { } } else if (this->animIndex == EN_PP_ANIM_CHARGE) { if (EnPp_CheckCollision(this, play) != EN_PP_COLLISION_RESULT_OK) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnPp_SetupRoar(this); return; } if (!this->chargesInStraightLines) { - Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 10.0f, 0.3f, 1.0f); } else { Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); @@ -661,9 +661,9 @@ void EnPp_Charge(EnPp* this, PlayState* play) { return; } else { if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED) { - this->actor.speedXZ *= -1.0f; + this->actor.speed *= -1.0f; } else { - this->actor.speedXZ *= -0.5f; + this->actor.speed *= -0.5f; } EnPp_SetupRoar(this); @@ -682,7 +682,7 @@ void EnPp_SetupAttack(EnPp* this) { EnPp_ChangeAnim(this, EN_PP_ANIM_ATTACK); this->hornColliderOn = true; this->action = EN_PP_ACTION_ATTACK; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnPp_Attack; } @@ -711,7 +711,7 @@ void EnPp_SetupBounced(EnPp* this) { this->targetPos.x += distanceFromWorldPos.x; this->targetPos.z += distanceFromWorldPos.z; EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->action = EN_PP_ACTION_BOUNCED; this->chargeAndBounceSpeed = 14.0f; this->actionFunc = EnPp_Bounced; @@ -751,7 +751,7 @@ void EnPp_Roar(EnPp* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->chargeAndBounceSpeed = 0.0f; } @@ -771,8 +771,8 @@ void EnPp_Roar(EnPp* this, PlayState* play) { } } - Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); - if ((this->actor.speedXZ > 0.3f) && (this->secondaryTimer == 0)) { + Math_ApproachZeroF(&this->actor.speed, 0.5f, 1.0f); + if ((this->actor.speed > 0.3f) && (this->secondaryTimer == 0)) { EnPp_SpawnDust(this, play); this->secondaryTimer = 3; } @@ -793,7 +793,7 @@ void EnPp_SetupJump(EnPp* this) { this->secondaryTimer = 0; this->actionVar.hasLandedFromJump = false; this->timer = this->secondaryTimer; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 20.0f; this->actor.gravity = -3.0f; EnPp_ChangeAnim(this, EN_PP_ANIM_JUMP); @@ -836,7 +836,7 @@ void EnPp_Jump(EnPp* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, 0x1388, 0); if (!this->actionVar.hasLandedFromJump) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actionVar.hasLandedFromJump = true; EnPp_ChangeAnim(this, EN_PP_ANIM_LAND); } @@ -853,7 +853,7 @@ void EnPp_SetupStunnedOrFrozen(EnPp* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->action = EN_PP_ACTION_STUNNED_OR_FROZEN; this->actionFunc = EnPp_StunnedOrFrozen; } @@ -914,7 +914,7 @@ void EnPp_SetupDamaged(EnPp* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->secondaryTimer = 0; EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); this->targetRotY = this->actor.yawTowardsPlayer + 0x8000; @@ -922,10 +922,10 @@ void EnPp_SetupDamaged(EnPp* this, PlayState* play) { if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { this->damagedVelocity.z = 0.0f; this->damagedVelocity.x = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_DAMAGE); this->actionFunc = EnPp_Damaged; } @@ -957,7 +957,7 @@ void EnPp_Damaged(EnPp* this, PlayState* play) { if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { this->damagedVelocity.z = 0.0f; this->damagedVelocity.x = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if ((fabsf(this->actor.home.pos.y - this->actor.world.pos.y) > 100.0f) && @@ -998,10 +998,10 @@ void EnPp_SetupDead(EnPp* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); Enemy_StartFinishingBlow(play, &this->actor); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_HIPLOOP_DEAD); - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->action = EN_PP_ACTION_DEAD; this->actionFunc = EnPp_Dead; @@ -1096,7 +1096,7 @@ void EnPp_Mask_SetupDetach(EnPp* this, PlayState* play) { } this->actor.gravity = 0.0f; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_START; EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); @@ -1117,7 +1117,7 @@ void EnPp_Mask_Detach(EnPp* this, PlayState* play) { this->maskAccelY = 50.0f; this->maskVelocity.y = -230.0f; this->maskVelocity.x = -150.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_MASC_OFF); + Actor_PlaySfx(&this->actor, NA_SE_EN_HIPLOOP_MASC_OFF); this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_FALL; break; @@ -1172,7 +1172,7 @@ void EnPp_BodyPart_SetupMove(EnPp* this) { this->deadBodyPartRotationalVelocity.x = (this->deadBodyPartIndex * 0x2E) + 0xFF00; this->deadBodyPartRotationalVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00; if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) { - this->actor.speedXZ = Rand_ZeroFloat(4.0f) + 4.0f; + this->actor.speed = Rand_ZeroFloat(4.0f) + 4.0f; this->actor.world.rot.y = ((s32)randPlusMinusPoint5Scaled(223.0f) + 0x1999) * this->deadBodyPartIndex; } @@ -1224,7 +1224,7 @@ void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); } - if ((this->timer == 0) || (this->actor.bgCheckFlags & 1)) { + if ((this->timer == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Actor_Kill(&this->actor); } } @@ -1276,8 +1276,9 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { (this->drawDmgEffTimer == 0)) { this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, + 40); EnPp_SetupStunnedOrFrozen(this); } return; @@ -1285,8 +1286,9 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || (this->drawDmgEffTimer == 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, + 40); this->secondaryTimer = 40; EnPp_SetupStunnedOrFrozen(this); } @@ -1295,7 +1297,7 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { (this->actor.colChkInfo.damageEffect != EN_PP_DMGEFF_JUMP)) { attackDealsDamage = true; this->hasBeenDamaged = true; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_FIRE) { this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; @@ -1323,7 +1325,8 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); - Actor_SetColorFilter(&this->actor, 0x8000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, 255, COLORFILTER_BUFFLAG_OPA, + 25); this->drawDmgEffTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; } @@ -1350,7 +1353,7 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { this->secondaryTimer = 0; this->timer = 10; this->maskBounceRotationalVelocity = 0x20D0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->action == EN_PP_ACTION_CHARGE) { this->actionVar.isCharging = false; EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); @@ -1359,7 +1362,7 @@ void EnPp_UpdateDamage(EnPp* this, PlayState* play) { this->targetRotY = this->actor.yawTowardsPlayer; if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_BOUND); } } } @@ -1413,7 +1416,7 @@ void EnPp_Update(Actor* thisx, PlayState* play) { if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { EnPp_UpdateDamage(this, play); Actor_SetFocus(&this->actor, 40.0f); - if ((this->action == EN_PP_ACTION_DEAD) || (this->actor.bgCheckFlags & 1)) { + if ((this->action == EN_PP_ACTION_DEAD) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.pos.x += this->damagedVelocity.x; this->actor.world.pos.z += this->damagedVelocity.z; Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 5068c96ee..388388c53 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -241,7 +241,7 @@ void func_80A326F0(EnPr* this) { func_80A3242C(this, 0); } this->unk_206 = 0; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actionFunc = func_80A32740; } @@ -343,19 +343,19 @@ void func_80A32AF8(EnPr* this) { void func_80A32B20(EnPr* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->actor.speedXZ = BREG(57) + 3.0f; + this->actor.speed = BREG(57) + 3.0f; Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); this->unk_2B8 = D_80A338C0[GET_PLAYER_FORM] + player->actor.world.pos.y; func_80A324E0(this, play); if (!(player->stateFlags1 & PLAYER_STATE1_8000000)) { this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; func_80A32854(this); } else if (this->unk_2C8 < sqrtf(SQ(player->actor.world.pos.x - this->actor.home.pos.x) + SQ(player->actor.world.pos.z - this->actor.home.pos.z))) { this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; func_80A32854(this); } else if (!func_80A325E4(this) && (this->actor.xzDistToPlayer < 200.0f) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 80.0f)) { @@ -377,7 +377,7 @@ void func_80A32D28(EnPr* this, PlayState* play) { if (!(player->stateFlags1 & PLAYER_STATE1_8000000)) { this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; func_80A32854(this); } else { Math_SmoothStepToS(&this->unk_22C, this->actor.yawTowardsPlayer, BREG(49) + 1, BREG(50) + 1000, BREG(51)); @@ -387,7 +387,7 @@ void func_80A32D28(EnPr* this, PlayState* play) { if (this->unk_2C8 < sqrtf(SQ(player->actor.world.pos.x - this->actor.home.pos.x) + SQ(player->actor.world.pos.z - this->actor.home.pos.z))) { this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; func_80A32854(this); } } @@ -396,7 +396,7 @@ void func_80A32D28(EnPr* this, PlayState* play) { void func_80A32E60(EnPr* this) { func_80A3242C(this, 4); this->unk_206 = 6; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80A32EA4; } @@ -407,10 +407,10 @@ void func_80A32EA4(EnPr* this, PlayState* play) { if (this->actor.colChkInfo.health <= 0) { this->unk_206 = 7; this->unk_20A = 50; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->unk_2C4 = 0.0f; Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); this->unk_216 = 0; this->actionFunc = func_80A32F48; } else { @@ -470,8 +470,8 @@ void func_80A33098(EnPr* this, PlayState* play) { if ((this->unk_206 != 6) && (this->unk_206 != 7)) { Actor_ApplyDamage(&this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEWALK_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLEWALK_DAMAGE); func_80A32E60(this); } } diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 0cc6dc134..2328ba87c 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -173,7 +173,7 @@ void EnPr2_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, 0x1D); - if (!(this->actor.bgCheckFlags & 0x60)) { + if (!(this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH))) { Actor_Kill(&this->actor); } } @@ -267,13 +267,13 @@ void func_80A745FC(EnPr2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_EXIST - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_EXIST - SFX_FLAG); Math_ApproachF(&this->unk_204, 0.02f, 0.1f, 0.005f); if (this->path->unk2 < this->unk_1D0) { - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 10.0f, 0.3f, 1.0f); } if ((this->path != NULL) && !SubS_CopyPointFromPath(this->path, this->unk_1D0, &this->unk_21C)) { @@ -326,7 +326,7 @@ void func_80A748E8(EnPr2* this, PlayState* play) { Vec3f sp3C; Math_ApproachF(&this->unk_204, 0.02f, 0.1f, 0.005f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_EXIST - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_EXIST - SFX_FLAG); if (fabsf(this->actor.world.rot.y - this->unk_1EE) < 200.0f) { sp48 = true; @@ -334,7 +334,7 @@ void func_80A748E8(EnPr2* this, PlayState* play) { } if (this->unk_1F4 != 255) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_SmoothStepToS(&this->unk_1F4, 0, 1, 30, 100); if (this->unk_1F4 < 2) { Actor_Kill(&this->actor); @@ -370,7 +370,7 @@ void func_80A748E8(EnPr2* this, PlayState* play) { sp4C = true; this->unk_1DC = 0; Math_Vec3f_Copy(&this->unk_21C, &this->unk_228); - Math_ApproachF(&this->actor.speedXZ, 3.0f, 0.3f, 0.2f); + Math_ApproachF(&this->actor.speed, 3.0f, 0.3f, 0.2f); } } break; @@ -383,7 +383,7 @@ void func_80A748E8(EnPr2* this, PlayState* play) { this->unk_1D6 = true; } - Math_ApproachZeroF(&this->actor.speedXZ, 0.1f, 0.2f); + Math_ApproachZeroF(&this->actor.speed, 0.1f, 0.2f); if (this->unk_1DA == 1) { this->unk_1D8 = Rand_S16Offset(100, 100); @@ -393,12 +393,13 @@ void func_80A748E8(EnPr2* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_21C, &sp3C); } } else { - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.3f, 0.2f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.3f, 0.2f); Math_Vec3f_Copy(&sp3C, &this->actor.world.pos); sp3C.x += Math_SinS(this->actor.world.rot.y) * 20.0f; sp3C.z += Math_CosS(this->actor.world.rot.y) * 20.0f; if (fabsf(this->actor.world.rot.y - this->unk_1EE) < 100.0f) { - if (BgCheck_SphVsFirstPoly(&play->colCtx, &sp3C, 20.0f) || (this->actor.bgCheckFlags & 8)) { + if (BgCheck_SphVsFirstPoly(&play->colCtx, &sp3C, 20.0f) || + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->unk_1DC = 0; this->unk_1F2++; Math_Vec3f_Copy(&this->unk_21C, &this->unk_228); @@ -430,7 +431,7 @@ void func_80A74DEC(EnPr2* this, PlayState* play) { this->unk_1F0 = 0; func_80A74510(this, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_ATTACK); Math_Vec3f_Copy(&this->unk_21C, &player->actor.world.pos); this->unk_1EE = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_21C); @@ -452,7 +453,7 @@ void func_80A74E90(EnPr2* this, PlayState* play) { } if (this->unk_1F4 != 255) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_SmoothStepToS(&this->unk_1F4, 0, 1, 30, 100); if (this->unk_1F4 < 2) { Actor_Kill(&this->actor); @@ -470,7 +471,7 @@ void func_80A74E90(EnPr2* this, PlayState* play) { } this->unk_21C.y = player->actor.world.pos.y + 30.0f + this->unk_20C; - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 1.0f); this->unk_1F0 = 0; if (this->unk_1E0 == 2) { @@ -514,7 +515,7 @@ void func_80A74E90(EnPr2* this, PlayState* play) { void func_80A751B4(EnPr2* this) { this->unk_1EC = 0; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; if (this->unk_1E0 < 10) { func_80A74510(this, 2); @@ -532,10 +533,10 @@ void func_80A751B4(EnPr2* this) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.z = this->actor.world.rot.z; this->unk_1D8 = 30; - this->actor.speedXZ = Rand_ZeroFloat(0.5f); + this->actor.speed = Rand_ZeroFloat(0.5f); this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000); } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 10); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 10); this->unk_1D4 = 3; this->actionFunc = func_80A75310; } @@ -614,8 +615,8 @@ void func_80A755D8(EnPr2* this, PlayState* play) { Actor_ApplyDamage(&this->actor); if ((this->actor.colChkInfo.health <= 0) && (this->unk_1D4 != 3)) { Enemy_StartFinishingBlow(play, &this->actor); - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_DEAD); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_DEAD); if (this->unk_218 >= 0) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, D_80A75C3C[this->unk_218]); @@ -627,7 +628,7 @@ void func_80A755D8(EnPr2* this, PlayState* play) { } if (this->collider.base.atFlags & AT_BOUNCED) { - this->actor.speedXZ = -10.0f; + this->actor.speed = -10.0f; } } diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index dad8fc126..d4a48cfd2 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -119,7 +119,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { this->unk_1E6 = ENPRZ_GET(&this->actor); this->actor.shape.yOffset = 500.0f; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -218,7 +218,7 @@ s32 func_80A762C0(EnPrz* this, PlayState* play) { } void func_80A76388(EnPrz* this) { - this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f; func_80A75F18(this, 0); this->unk_1EA = 1; this->actionFunc = func_80A763E8; @@ -302,7 +302,7 @@ void func_80A76634(EnPrz* this, PlayState* play) { } void func_80A76748(EnPrz* this) { - this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; this->unk_1EE = 0; this->unk_1EA = 3; this->skelAnime.playSpeed = 2.0f; @@ -317,7 +317,7 @@ void func_80A767A8(EnPrz* this, PlayState* play) { if (func_80A762C0(this, play)) { func_80A75F18(this, 0); - this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + this->actor.speed = randPlusMinusPoint5Scaled(1.0f) + 4.0f; func_80A76604(this, play); return; } @@ -360,10 +360,10 @@ void func_80A767A8(EnPrz* this, PlayState* play) { void func_80A76A1C(EnPrz* this) { this->unk_1E8 = 0; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); this->unk_1EE = Rand_S16Offset(100, 30); this->unk_1FC = 0x4000; @@ -373,10 +373,10 @@ void func_80A76A1C(EnPrz* this) { } this->unk_1FE = this->actor.world.rot.y; - this->actor.speedXZ = Rand_ZeroFloat(0.5f); + this->actor.speed = Rand_ZeroFloat(0.5f); this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 30); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 30); this->unk_1EE = 50; func_80A75F18(this, 0); this->unk_1EA = 7; diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 0caa2f8ca..c356a318b 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -393,7 +393,7 @@ void EnRacedog_Race(EnRacedog* this, PlayState* play) { this->collider.dim.radius = 15; if (this->path != NULL) { yRotation = EnRacedog_GetYRotation(this->path, this->currentPoint, &this->actor.world.pos, &distSq); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yRotation = this->actor.wallYaw; } @@ -515,16 +515,16 @@ void EnRacedog_UpdateSpeed(EnRacedog* this) { this->actor.shape.rot.y = this->actor.world.rot.y; } - Math_ApproachF(&this->actor.speedXZ, this->targetSpeed, 0.5f, 3.0f); + Math_ApproachF(&this->actor.speed, this->targetSpeed, 0.5f, 3.0f); // The dog that the player has selected has a slightly higher max speed than the other dogs. if (this->index == this->selectedDogIndex) { - if (this->actor.speedXZ > 7.5f) { - this->actor.speedXZ = 7.5f; + if (this->actor.speed > 7.5f) { + this->actor.speed = 7.5f; } } else { - if (this->actor.speedXZ > 7.0f) { - this->actor.speedXZ = 7.0f; + if (this->actor.speed > 7.0f) { + this->actor.speed = 7.0f; } } } @@ -586,7 +586,7 @@ void EnRacedog_CheckForFinish(EnRacedog* this) { this->raceStatus == RACEDOG_RACE_STATUS_AFTER_POINT_11) { sNumberOfDogsFinished++; if (sNumberOfDogsFinished == 1) { - Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); } @@ -602,7 +602,7 @@ void EnRacedog_CheckForFinish(EnRacedog* this) { * to normal speed otherwise. */ void EnRacedog_UpdateRunAnimationPlaySpeed(EnRacedog* this) { - if (this->actor.speedXZ < 3.0f) { + if (this->actor.speed < 3.0f) { sAnimationInfo[RACEDOG_ANIM_RUN].playSpeed = 0.9f; } else { sAnimationInfo[RACEDOG_ANIM_RUN].playSpeed = 1.0f; @@ -660,7 +660,7 @@ s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* finishLineCoordinates) { void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; + s16 mod = (this->actor.speed > 6.0f) ? 2 : 3; Vec3f pos; if (((this->index + curFrame) % mod) == 0) { @@ -675,7 +675,7 @@ void EnRacedog_PlaySfxWalk(EnRacedog* this) { s16 curFrame = this->skelAnime.curFrame; if ((curFrame == 1) || (curFrame == 7)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_MONKEY_WALK); } } @@ -701,7 +701,7 @@ void EnRacedog_Update(Actor* thisx, PlayState* play) { } } - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index 8421b20ac..b89aa26f3 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -6,7 +6,7 @@ #include "z_en_raf.h" -#define FLAGS (ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnRaf*)thisx) @@ -360,7 +360,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { void EnRaf_SetupGrab(EnRaf* this) { EnRaf_ChangeAnim(this, EN_RAF_ANIM_CLOSE); this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_GRAB; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_DRINK); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_DRINK); this->action = EN_RAF_ACTION_GRAB; this->actionFunc = EnRaf_Grab; } @@ -426,11 +426,15 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { this->chewCount++; } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_EAT); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_EAT); switch (this->grabTarget) { case EN_RAF_GRAB_TARGET_PLAYER: play->damagePlayer(play, -2); - func_800B8E58((Player*)this, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); + + //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be + //! player->currentMask, but in this case is padding in `DynaPolyActor` + Player_PlaySfx((Player*)&this->dyna.actor, + player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); CollisionCheck_GreenBlood(play, NULL, &player->actor.world.pos); if ((this->chewCount > (BREG(53) + 5)) || !(player->stateFlags2 & PLAYER_STATE2_80)) { player->actor.freezeTimer = 10; @@ -478,7 +482,7 @@ void EnRaf_Throw(EnRaf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 10.0f)) { player->actor.freezeTimer = 0; player->actor.parent = NULL; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_THROW); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_THROW); func_800B8D50(play, &this->dyna.actor, BREG(55) + 3.0f, this->playerRotYWhenGrabbed + 0x8000, BREG(56) + 10.0f, 0); } else if (curFrame < 10.0f) { @@ -508,8 +512,8 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { explosionPos.y += 10.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_DEAD); + Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_DEAD); if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); } @@ -710,7 +714,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { if ((this->heightDiffFromPlayer > -0.1f) && !this->isCurrentlyInRidingMovingState) { this->heightDiffFromPlayer = -20.0f; this->isCurrentlyInRidingMovingState = true; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_COMMON_WATER_MID); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_COMMON_WATER_MID); } } else { this->isCurrentlyInRidingMovingState = false; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 073f2045a..dd0225f0c 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -281,7 +281,7 @@ void EnRailSkb_Init(Actor* thisx, PlayState* play) { } Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.speedXZ = 1.6f; + this->actor.speed = 1.6f; this->actor.hintId = TATL_HINT_ID_STALCHILD; this->unk_3F2 = 0; this->unk_2E4 = -1; @@ -334,7 +334,7 @@ void func_80B70FF8(EnRailSkb* this, PlayState* play) { } void func_80B710AC(EnRailSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_80B710E4; } @@ -345,7 +345,7 @@ void func_80B710E4(EnRailSkb* this, PlayState* play) { } void func_80B71114(EnRailSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_80B7114C; } @@ -355,9 +355,9 @@ void func_80B7114C(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); } else { @@ -379,9 +379,9 @@ void func_80B7123C(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); } else { @@ -405,7 +405,7 @@ void func_80B71314(EnRailSkb* this, PlayState* play) { } void func_80B71354(EnRailSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80B713A4; } @@ -452,7 +452,7 @@ void func_80B7151C(EnRailSkb* this) { this->actor.colChkInfo.health = 2; this->unk_402 = 0; this->actor.flags |= ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); this->actor.draw = EnRailSkb_Draw; this->actor.shape.shadowAlpha = 0; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -575,7 +575,7 @@ void func_80B71954(EnRailSkb* this, PlayState* play) { } void func_80B71A08(EnRailSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80B71A58; } @@ -584,7 +584,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) { s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) { this->unk_22C->dyna.actor.colChkInfo.health--; @@ -625,7 +625,7 @@ void func_80B71BB8(EnRailSkb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos), 1, 0x71C, 0xB6); - if ((this->actor.bgCheckFlags & 1) && (this->unk_22C->dyna.actor.colChkInfo.health == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_22C->dyna.actor.colChkInfo.health == 0)) { Actor_MoveWithGravity(&this->actor); } else { this->actor.velocity.y += this->actor.gravity; @@ -634,13 +634,13 @@ void func_80B71BB8(EnRailSkb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_22C->dyna.actor.world.pos.z, 0.6f, 1.6f, 0.1f); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_Kill(&this->actor); return; } - if ((sp34 < 50.0f) && (this->actor.bgCheckFlags & 1)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + if ((sp34 < 50.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); this->actor.velocity.y = 10.0f; @@ -732,7 +732,7 @@ void func_80B71F3C(EnRailSkb* this, PlayState* play) { Message_StartTextbox(play, 0x13F4, &this->actor); this->unk_400 = 0x13F4; } else { - func_801477B4(play); + Message_CloseTextbox(play); func_80B71D8C(this, play, func_80B71650); } break; @@ -744,7 +744,7 @@ void func_80B71F3C(EnRailSkb* this, PlayState* play) { break; case 0x13F4: - func_801477B4(play); + Message_CloseTextbox(play); func_80B71D8C(this, play, func_80B718B0); break; } @@ -773,7 +773,7 @@ void func_80B72190(EnRailSkb* this, PlayState* play) { if ((this->actionFunc != func_80B714D8) && (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 15.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); } if (this->actor.parent == NULL) { @@ -984,12 +984,12 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80B710AC(this); break; case 1: - Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80B710AC(this); break; @@ -998,8 +998,8 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_402 |= 1; func_80B712FC(this); @@ -1007,7 +1007,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { case 3: if (this->actor.colChkInfo.health != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->drawDmgEffTimer = 80; } else { this->drawDmgEffTimer = 3; @@ -1015,7 +1015,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); func_80B71114(this); break; @@ -1024,8 +1024,8 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80B71228(this); break; @@ -1043,8 +1043,8 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { } case 13: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80B712FC(this); break; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 50a203c81..27da7017c 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -286,7 +286,7 @@ void EnRailgibud_Destroy(Actor* thisx, PlayState* play) { } void EnRailgibud_SetupWalkInCircles(EnRailgibud* this) { - this->actor.speedXZ = 0.6f; + this->actor.speed = 0.6f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); this->actionFunc = EnRailgibud_WalkInCircles; } @@ -350,7 +350,7 @@ void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, PlayState* play) { player->actor.freezeTimer = 60; Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_80123E90(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); EnRailgibud_SetupWalkToPlayer(this); } @@ -359,7 +359,7 @@ void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupWalkToPlayer(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); - this->actor.speedXZ = 0.4f; + this->actor.speed = 0.4f; if (this->actionFunc == EnRailgibud_AttemptPlayerFreeze) { this->playerStunWaitTimer = 80; @@ -396,7 +396,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { this->playerStunWaitTimer = 60; Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_80123E90(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); } else { this->playerStunWaitTimer--; } @@ -412,9 +412,9 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } else if (!(play->gameplayFrames & 95)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -452,7 +452,7 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; play->damagePlayer(play, -8); - func_800B8E58(player, damageSfxId); + Player_PlaySfx(player, damageSfxId); Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 0; } else { @@ -460,7 +460,7 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_ATTACK); } if (!(player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B62 != 0)) { @@ -490,14 +490,14 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupGrabFail(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DAMAGE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); - this->actor.speedXZ = -2.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + this->actor.speed = -2.0f; this->actionFunc = EnRailgibud_GrabFail; } void EnRailgibud_GrabFail(EnRailgibud* this, PlayState* play) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -530,18 +530,18 @@ void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupWalkToHome(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); - this->actor.speedXZ = 0.4f; + this->actor.speed = 0.4f; this->actionFunc = EnRailgibud_WalkToHome; } void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { - if (this->actor.speedXZ > 0.2f) { - this->actor.speedXZ -= 0.2f; + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { + if (this->actor.speed > 0.2f) { + this->actor.speed -= 0.2f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 200, 10); @@ -550,7 +550,8 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { EnRailgibud_SetupWalkInCircles(this); } } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 450); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 450); this->actor.world.rot = this->actor.shape.rot; } if (EnRailgibud_PlayerInRangeWithCorrectState(this, play)) { @@ -563,17 +564,17 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupDamage(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DAMAGE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->stunTimer = 0; this->grabWaitTimer = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.speedXZ = -2.0f; + this->actor.speed = -2.0f; this->actionFunc = EnRailgibud_Damage; } void EnRailgibud_Damage(EnRailgibud* this, PlayState* play) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -596,9 +597,9 @@ void EnRailgibud_SetupStunned(EnRailgibud* this) { this->stunTimer = 10; if (this->drawDmgEffTimer != 0) { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 0x28); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } else { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 0x28); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } this->actionFunc = EnRailgibud_Stunned; @@ -621,7 +622,7 @@ void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupDead(EnRailgibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DEATH); this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; this->actionFunc = EnRailgibud_Dead; } @@ -750,7 +751,7 @@ s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play return false; } - if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) < 100.0f && + if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 100.0f && !(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_200000)) && !(player->stateFlags2 & (PLAYER_STATE2_80 | PLAYER_STATE2_4000))) { @@ -768,7 +769,7 @@ s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play s32 EnRailgibud_PlayerOutOfRange(EnRailgibud* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 100.0f) { + if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 100.0f) { return true; } @@ -787,7 +788,7 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) { switch (this->actor.colChkInfo.damageEffect) { case EN_RAILGIBUD_DMGEFF_DAMAGE: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (player->unk_ADC != 0) { this->unk_405 = player->unk_ADD; } @@ -808,7 +809,7 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) { break; case EN_RAILGIBUD_DMGEFF_FIRE_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { EnRailgibud_SetupDead(this); } else { @@ -820,7 +821,7 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) { break; case EN_RAILGIBUD_DMGEFF_LIGHT_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { EnRailgibud_SetupDead(this); } else { @@ -906,7 +907,7 @@ void EnRailgibud_MoveGrabbedPlayerAwayFromWall(EnRailgibud* this, PlayState* pla } if ((this->actionFunc == EnRailgibud_Grab) && (this->grabState == EN_RAILGIBUD_GRAB_START) && - (this->actor.bgCheckFlags & 8)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { targetPos = player->actor.world.pos; targetPos.x += 10.0f * Math_SinS(this->actor.wallYaw); targetPos.z += 10.0f * Math_CosS(this->actor.wallYaw); @@ -962,8 +963,8 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { this->isInvincible = true; Message_StartTextbox(play, 0x13B2, &this->actor); this->textId = 0x13B2; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); - this->actor.speedXZ = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); + this->actor.speed = 0.0f; } else if (CHECK_FLAG_ALL(this->actor.flags, (ACTOR_FLAG_1 | ACTOR_FLAG_8)) && !(this->collider.base.acFlags & AC_HIT)) { func_800B8614(&this->actor, play, 100.0f); @@ -981,7 +982,7 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { if (Message_ShouldAdvance(play)) { this->textId = 0; this->isInvincible = false; - this->actor.speedXZ = 0.6f; + this->actor.speed = 0.6f; } break; @@ -1188,7 +1189,7 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { case 2: this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_WEAKENED2); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED2); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_START); break; @@ -1231,9 +1232,9 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { case 5: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (play->csCtx.frames < 280) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_WEAKENED1); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED1); } } break; diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index da0b27e6d..63ef35aab 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -293,7 +293,7 @@ void EnRat_ChooseDirection(EnRat* this) { angle -= 0x8000; } } else { - if (Actor_DistanceToPoint(&this->actor, &this->actor.home.pos) > 50.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) > 50.0f) { Vec3f homeInHome; Vec3f worldInHome; Vec3f worldPlusForwardInHome; @@ -386,7 +386,7 @@ s32 EnRat_IsTouchingSurface(EnRat* this, PlayState* play) { bgIdUpDown = bgIdSide = BGCHECK_SCENE; - lineLength = 2.0f * this->actor.speedXZ; + lineLength = 2.0f * this->actor.speed; posA.x = this->actor.world.pos.x + (this->axisUp.x * 5.0f); posA.y = this->actor.world.pos.y + (this->axisUp.y * 5.0f); @@ -409,7 +409,7 @@ s32 EnRat_IsTouchingSurface(EnRat* this, PlayState* play) { this->shouldRotateOntoSurfaces |= EnRat_UpdateFloorPoly(this, polySide, play); Math_Vec3f_Copy(&this->actor.world.pos, &posSide); this->actor.floorBgId = bgIdSide; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (polyUpDown != this->actor.floorPoly) { this->shouldRotateOntoSurfaces |= EnRat_UpdateFloorPoly(this, polyUpDown, play); @@ -419,7 +419,7 @@ s32 EnRat_IsTouchingSurface(EnRat* this, PlayState* play) { this->actor.floorBgId = bgIdUpDown; } } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; lineLength *= 3.0f; Math_Vec3f_Copy(&posA, &posB); @@ -535,7 +535,7 @@ void EnRat_SetupRevive(EnRat* this) { EnRat_InitializeAxes(this); EnRat_UpdateRotation(this); this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_PlayLoopSetSpeed(&this->skelAnime, &gRealBombchuSpotAnim, 0.0f); this->revivePosY = 2666.6667f; this->actor.draw = NULL; @@ -573,7 +573,7 @@ void EnRat_Revive(EnRat* this, PlayState* play) { void EnRat_SetupIdle(EnRat* this) { Animation_PlayLoop(&this->skelAnime, &gRealBombchuRunAnim); this->animLoopCounter = 5; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actionFunc = EnRat_Idle; } @@ -583,16 +583,16 @@ void EnRat_SetupIdle(EnRat* this) { void EnRat_Idle(EnRat* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); if (this->animLoopCounter != 0) { this->animLoopCounter--; } } if ((this->animLoopCounter == 0) && (Rand_ZeroOne() < 0.05f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_VOICE); this->animLoopCounter = 5; } @@ -606,7 +606,7 @@ void EnRat_SetupSpottedPlayer(EnRat* this) { this->actor.flags |= ACTOR_FLAG_10; Animation_MorphToLoop(&this->skelAnime, &gRealBombchuSpotAnim, -5.0f); this->animLoopCounter = 3; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnRat_SpottedPlayer; } @@ -615,7 +615,7 @@ void EnRat_SetupSpottedPlayer(EnRat* this) { */ void EnRat_SpottedPlayer(EnRat* this, PlayState* play) { if ((this->animLoopCounter == 3) && Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_AIM); } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -640,7 +640,7 @@ void EnRat_UpdateSparkOffsets(EnRat* this) { void EnRat_SetupChasePlayer(EnRat* this) { Animation_MorphToLoop(&this->skelAnime, &gRealBombchuRunAnim, -5.0f); - this->actor.speedXZ = 6.1f; + this->actor.speed = 6.1f; EnRat_UpdateSparkOffsets(this); this->actionFunc = EnRat_ChasePlayer; } @@ -659,7 +659,7 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { Vec3f blureP1; Vec3f blureP2; - this->actor.speedXZ = 6.1f; + this->actor.speed = 6.1f; if (this->hasLostTrackOfPlayer) { if (!(player->stateFlags3 & PLAYER_STATE3_100) && (Player_GetMask(play) != PLAYER_MASK_STONE) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { @@ -674,7 +674,7 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { this->animLoopCounter--; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); } DECR(this->timer); @@ -704,7 +704,7 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { } if ((this->animLoopCounter == 0) && (Rand_ZeroOne() < 0.05f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_AIM); this->animLoopCounter = 5; } @@ -713,12 +713,12 @@ void EnRat_ChasePlayer(EnRat* this, PlayState* play) { } void EnRat_SetupBounced(EnRat* this) { - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.velocity.y = 8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; this->actor.gravity = -1.0f; EnRat_UpdateSparkOffsets(this); - this->actor.bgCheckFlags &= ~(0x10 | 0x8 | 0x1); + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); this->actionFunc = EnRat_Bounced; } @@ -733,14 +733,14 @@ void EnRat_Bounced(EnRat* this, PlayState* play) { this->timer = 30; } - if (this->actor.bgCheckFlags & (0x10 | 0x8 | 0x1)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { EnRat_Explode(this, play); } } void EnRat_Explode(EnRat* this, PlayState* play) { EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_TYPE_BODY); if (bomb != NULL) { bomb->timer = 0; @@ -750,7 +750,7 @@ void EnRat_Explode(EnRat* this, PlayState* play) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x100); } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnRat_PostDetonation; } @@ -790,10 +790,10 @@ void EnRat_Update(Actor* thisx, PlayState* play) { if (this->actor.colChkInfo.damageEffect == EN_RAT_DMGEFF_HOOKSHOT) { this->damageReaction.hookedState = EN_RAT_HOOK_STARTED; } else if (this->actor.colChkInfo.damageEffect == EN_RAT_DMGEFF_STUN) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); if (this->actionFunc == EnRat_Bounced) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 3e46c9f04..dacfb6e2b 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -266,7 +266,7 @@ void EnRd_Init(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_INVISIBLE) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; } if (EN_RD_GET_TYPE(&this->actor) == EN_RD_TYPE_FROZEN) { @@ -356,7 +356,7 @@ void EnRd_SetupIdle(EnRd* this) { this->action = EN_RD_ACTION_IDLE; this->animationJudderTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnRd_Idle; } @@ -410,7 +410,7 @@ void EnRd_Idle(EnRd* this, PlayState* play) { } if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -419,7 +419,7 @@ void EnRd_SetupSquattingDance(EnRd* this) { this->action = EN_RD_ACTION_SQUATTING_DANCE; this->animationJudderTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->danceEndTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnRd_SquattingDance; } @@ -454,7 +454,7 @@ void EnRd_SquattingDance(EnRd* this, PlayState* play) { } if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -463,7 +463,7 @@ void EnRd_SetupClappingDance(EnRd* this) { this->action = EN_RD_ACTION_CLAPPING_DANCE; this->animationJudderTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->danceEndTimer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnRd_ClappingDance; } @@ -498,14 +498,14 @@ void EnRd_ClappingDance(EnRd* this, PlayState* play) { } if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } void EnRd_EndClappingOrSquattingDanceWhenPlayerIsClose(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } this->danceEndTimer++; @@ -524,7 +524,7 @@ void EnRd_SetupPirouette(EnRd* this) { this->action = EN_RD_ACTION_PIROUETTE; this->animationJudderTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->pirouetteRotationalVelocity = 0x1112; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnRd_Pirouette; } @@ -558,7 +558,7 @@ void EnRd_Pirouette(EnRd* this, PlayState* play) { } if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -574,7 +574,7 @@ void EnRd_Pirouette(EnRd* this, PlayState* play) { void EnRd_EndPirouetteWhenPlayerIsClose(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } this->actor.world.rot.y -= this->pirouetteRotationalVelocity; @@ -600,7 +600,7 @@ void EnRd_SetupRiseFromCoffin(EnRd* this) { this->actor.shape.rot.x = -0x4000; this->actor.gravity = 0.0f; this->actor.shape.yOffset = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnRd_RiseFromCoffin; } @@ -613,14 +613,14 @@ void EnRd_RiseFromCoffin(EnRd* this, PlayState* play) { } } else { if (this->actor.world.pos.y == this->actor.home.pos.y) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 50.0f, 0.3f, 2.0f, 0.3f) == 0.0f) { if (this->coffinRiseForwardAccelTimer != 0) { this->coffinRiseForwardAccelTimer--; - Math_SmoothStepToF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f); - } else if (Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.3f, 1.0f, 0.3f) == 0.0f) { + Math_SmoothStepToF(&this->actor.speed, 6.0f, 0.3f, 1.0f, 0.3f); + } else if (Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.3f, 1.0f, 0.3f) == 0.0f) { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0); } } @@ -631,7 +631,7 @@ void EnRd_SetupWalkToPlayer(EnRd* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gGibdoRedeadWalkAnim); Animation_Change(&this->skelAnime, &gGibdoRedeadWalkAnim, 1.0f, 4.0f, frameCount, ANIMMODE_LOOP_INTERP, -4.0f); - this->actor.speedXZ = 0.4f; + this->actor.speed = 0.4f; this->action = EN_RD_ACTION_WALKING_TO_PLAYER_OR_RELEASING_GRAB; this->actionFunc = EnRd_WalkToPlayer; } @@ -642,18 +642,18 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { s16 yaw = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->headYRotation) - this->upperBodyYRotation; - this->skelAnime.playSpeed = this->actor.speedXZ; + this->skelAnime.playSpeed = this->actor.speed; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 250, 0); Math_SmoothStepToS(&this->headYRotation, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyYRotation, 0, 1, 100, 0); this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); - if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { + if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { EnRd_SetupWalkToHome(this, play); } - if ((ABS_ALT(yaw) < 0x1554) && (Actor_DistanceBetweenActors(&this->actor, &player->actor) <= 150.0f)) { + if ((ABS_ALT(yaw) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) { if (!(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_200000)) && !(player->stateFlags2 & (PLAYER_STATE2_80 | PLAYER_STATE2_4000))) { @@ -665,7 +665,7 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); } this->playerStunWaitTimer = 60; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); } } else { EnRd_SetupWalkToHome(this, play); @@ -676,11 +676,11 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { this->grabWaitTimer--; } - if (!this->grabWaitTimer && (Actor_DistanceBetweenActors(&this->actor, &player->actor) <= 45.0f) && + if (!this->grabWaitTimer && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 45.0f) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { player->actor.freezeTimer = 0; if ((player->transformation == PLAYER_FORM_GORON) || (player->transformation == PLAYER_FORM_DEKU)) { - if (Actor_DistanceToPoint(&this->actor, &this->actor.home.pos) < 150.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) < 150.0f) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnRd_SetupGrabFail(this); @@ -700,9 +700,9 @@ void EnRd_WalkToPlayer(EnRd* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } else if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -716,12 +716,12 @@ void EnRd_SetupWalkToHome(EnRd* this, PlayState* play) { void EnRd_WalkToHome(EnRd* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - s16 sp36 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + s16 sp36 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - if (Actor_DistanceToPoint(&this->actor, &this->actor.home.pos) >= 5.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) >= 5.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp36, 1, 450, 0); } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 450, 0)) { if (EN_RD_GET_TYPE(&this->actor) != EN_RD_TYPE_CRYING) { EnRd_SetupIdle(this); @@ -739,7 +739,7 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) { if (!(player->stateFlags1 & (0x200000 | 0x80000 | 0x40000 | 0x4000 | 0x2000 | 0x80)) && !(player->stateFlags2 & (0x4000 | 0x80)) && (player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU) && - (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { + (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = 0; EnRd_SetupWalkToPlayer(this, play); } else if (EN_RD_GET_TYPE(&this->actor) > EN_RD_TYPE_DOES_NOT_MOURN_IF_WALKING) { @@ -751,9 +751,9 @@ void EnRd_WalkToHome(EnRd* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } else if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -779,13 +779,13 @@ void EnRd_WalkToParent(EnRd* this, PlayState* play) { if (this->actor.parent != NULL) { parentPos = this->actor.parent->world.pos; - yaw = Actor_YawToPoint(&this->actor, &parentPos); + yaw = Actor_WorldYawTowardPoint(&this->actor, &parentPos); Math_SmoothStepToS(&this->actor.shape.rot.y, yaw, 1, 250, 0); - if (Actor_DistanceToPoint(&this->actor, &parentPos) >= 45.0f) { - this->actor.speedXZ = 0.4f; + if (Actor_WorldDistXYZToPoint(&this->actor, &parentPos) >= 45.0f) { + this->actor.speed = 0.4f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (EN_RD_GET_TYPE(&this->actor) != EN_RD_TYPE_CRYING) { EnRd_SetupIdle(this); } else { @@ -802,9 +802,9 @@ void EnRd_WalkToParent(EnRd* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } else if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -814,7 +814,7 @@ void EnRd_SetupGrab(EnRd* this) { this->grabState = 0; this->grabDamageTimer = 200; this->action = EN_RD_ACTION_GRABBING; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnRd_Grab; } @@ -873,7 +873,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 6000, 0); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_ATTACK); } this->grabDamageTimer--; @@ -881,7 +881,7 @@ void EnRd_Grab(EnRd* this, PlayState* play) { play->damagePlayer(play, -8); Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 20; - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); } break; @@ -922,7 +922,7 @@ void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) { Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_80123E90(play, &this->actor); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); EnRd_SetupWalkToPlayer(this, play); } } @@ -930,15 +930,15 @@ void EnRd_AttemptPlayerFreeze(EnRd* this, PlayState* play) { void EnRd_SetupGrabFail(EnRd* this) { this->action = EN_RD_ACTION_FAILING_GRAB; Animation_MorphToPlayOnce(&this->skelAnime, &gGibdoRedeadDamageAnim, -6.0f); - this->actor.speedXZ = -2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + this->actor.speed = -2.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->action = EN_RD_ACTION_FAILING_GRAB; this->actionFunc = EnRd_GrabFail; } void EnRd_GrabFail(EnRd* this, PlayState* play) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -1004,12 +1004,12 @@ void EnRd_Crouch(EnRd* this, PlayState* play) { void EnRd_SetupDamage(EnRd* this) { this->actor.shape.yOffset = 0.0f; Animation_MorphToPlayOnce(&this->skelAnime, &gGibdoRedeadDamageAnim, -6.0f); - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -2.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -2.0f; } this->actor.flags |= ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->action = EN_RD_ACTION_DAMAGE; this->actionFunc = EnRd_Damage; } @@ -1017,8 +1017,8 @@ void EnRd_SetupDamage(EnRd* this) { void EnRd_Damage(EnRd* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -1029,7 +1029,7 @@ void EnRd_Damage(EnRd* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.parent != NULL) { EnRd_SetupWalkToParent(this); - } else if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { + } else if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { EnRd_SetupWalkToHome(this, play); } else { EnRd_SetupWalkToPlayer(this, play); @@ -1043,8 +1043,8 @@ void EnRd_SetupDead(EnRd* this) { this->action = EN_RD_ACTION_DEAD; this->deathTimer = 300; this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DEAD); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->actionFunc = EnRd_Dead; } @@ -1075,24 +1075,25 @@ void EnRd_Dead(EnRd* this, PlayState* play) { this->deathTimer--; } } else if (Animation_OnFrame(&this->skelAnime, 33.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } } void EnRd_SetupStunned(EnRd* this) { this->action = EN_RD_ACTION_STUNNED; this->stunTimer = 10; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; if (gSaveContext.sunsSongState != SUNSSONG_INACTIVE) { this->stunnedBySunsSong = true; this->sunsSongStunTimer = 600; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LIGHT_ARROW_HIT); - Actor_SetColorFilter(&this->actor, 0x8000, 0x80C8, 0, 255); + Actor_PlaySfx(&this->actor, NA_SE_EN_LIGHT_ARROW_HIT); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, COLORFILTER_INTENSITY_FLAG | 200, + COLORFILTER_BUFFLAG_OPA, 255); } else if (this->damageEffect == EN_RD_DMGEFF_STUN) { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } else if (this->damageEffect == EN_RD_DMGEFF_ZORA_MAGIC) { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } this->actionFunc = EnRd_Stunned; } @@ -1106,7 +1107,8 @@ void EnRd_Stunned(EnRd* this, PlayState* play) { if (this->sunsSongStunTimer != 0) { this->sunsSongStunTimer--; if (this->sunsSongStunTimer >= 255) { - Actor_SetColorFilter(&this->actor, 0x8000, 0x80C8, 0, 255); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, COLORFILTER_INTENSITY_FLAG | 200, + COLORFILTER_BUFFLAG_OPA, 255); } if (this->sunsSongStunTimer == 0) { @@ -1186,7 +1188,7 @@ void EnRd_UpdateDamage(EnRd* this, PlayState* play) { return; case EN_RD_DMGEFF_FIRE_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffTimer = 180; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->stunnedBySunsSong = false; @@ -1195,7 +1197,7 @@ void EnRd_UpdateDamage(EnRd* this, PlayState* play) { break; case EN_RD_DMGEFF_LIGHT_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffTimer = 60; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->stunnedBySunsSong = false; @@ -1204,13 +1206,13 @@ void EnRd_UpdateDamage(EnRd* this, PlayState* play) { break; case EN_RD_DMGEFF_DAMAGE: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->stunnedBySunsSong = false; this->sunsSongStunTimer = 0; break; case EN_RD_DMGEFF_LIGHT_RAY: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->stunnedBySunsSong = false; this->sunsSongStunTimer = 0; this->actor.colChkInfo.health = 0; @@ -1273,12 +1275,11 @@ void EnRd_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->action != EN_RD_ACTION_GRABBING) && (this->actor.speedXZ != 0.0f)) { + if ((this->action != EN_RD_ACTION_GRABBING) && (this->actor.speed != 0.0f)) { Actor_MoveWithGravity(&this->actor); } - if ((this->actor.shape.rot.x == 0) && (this->action != EN_RD_ACTION_GRABBING) && - (this->actor.speedXZ != 0.0f)) { + if ((this->actor.shape.rot.x == 0) && (this->action != EN_RD_ACTION_GRABBING) && (this->actor.speed != 0.0f)) { Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); } @@ -1325,10 +1326,10 @@ void EnRd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } void EnRd_Draw(Actor* thisx, PlayState* play) { - static Vec3f D_808D7138 = { 0.25f, 0.25f, 0.25f }; + static Vec3f sScale = { 0.25f, 0.25f, 0.25f }; s32 pad; EnRd* this = THIS; - Vec3f sp54 = this->actor.world.pos; + Vec3f pos = this->actor.world.pos; OPEN_DISPS(play->state.gfxCtx); @@ -1344,7 +1345,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRd_OverrideLimbDraw, EnRd_PostLimbDraw, &this->actor, POLY_OPA_DISP); - func_800BC620(&sp54, &D_808D7138, 255, play); + func_800BC620(&pos, &sScale, 255, play); } else { func_8012C2DC(play->state.gfxCtx); @@ -1354,7 +1355,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnRd_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); - func_800BC620(&sp54, &D_808D7138, this->alpha, play); + func_800BC620(&pos, &sScale, this->alpha, play); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index 051cc8b33..64313c4be 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -168,7 +168,7 @@ void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { this->actor.textId = 0x2AE0; // drawing room on the right, don't go in without an appointment } } - func_80151938(play, this->actor.textId); + Message_ContinueTextbox(play, this->actor.textId); } } diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 7f6d39886..190af1a8a 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -231,7 +231,7 @@ void func_80BF3DC4(EnRg* this, PlayState* play) { this->collider2.dim.worldSphere.center.y = this->actor.world.pos.y + this->actor.shape.yOffset; this->collider2.dim.worldSphere.center.z = this->actor.world.pos.z; - if (this->actor.speedXZ >= 10.0f) { + if (this->actor.speed >= 10.0f) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); @@ -285,11 +285,11 @@ void func_80BF3FF8(EnRg* this) { s32 func_80BF4024(EnRg* this, PlayState* play) { if ((play->csCtx.state == 0) && (this->unk_334 == 1)) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_CIRCLE); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE); } if (Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SIT_IMT); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT); } } @@ -318,8 +318,8 @@ void func_80BF40F4(EnRg* this) { } s32 func_80BF416C(EnRg* this, PlayState* play) { - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ >= 0.01f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_ROLLING - SFX_FLAG); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed >= 0.01f)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_ROLLING - SFX_FLAG); func_800AE930(&play->colCtx, Effect_GetByIndex(this->unk_340), &this->actor.world.pos, 18.0f, this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } else { @@ -345,9 +345,9 @@ s32 func_80BF42BC(EnRg* this, f32 arg1) { f32 sp2C; s32 sp24; - Math_ApproachF(&this->actor.speedXZ, arg1, 0.3f, 0.5f); + Math_ApproachF(&this->actor.speed, arg1, 0.3f, 0.5f); - sp2C = this->actor.speedXZ * (1.0f / 26); + sp2C = this->actor.speed * (1.0f / 26); if (sp2C > 1.0f) { sp2C = 1.0f; } @@ -410,7 +410,7 @@ s32 func_80BF45B4(EnRg* this) { s16 temp_v0; s16 temp_v1; - if ((this->actor.bgCheckFlags & 8) && (this->actor.speedXZ >= 5.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.speed >= 5.0f)) { temp_v1 = this->actor.world.rot.y; temp_v0 = temp_v1 - BINANG_ROT180(this->actor.wallYaw); @@ -419,27 +419,27 @@ s32 func_80BF45B4(EnRg* this) { this->unk_322 = 0xA; } else if (ABS_ALT(temp_v0) >= 0x1000) { this->actor.world.rot.y = BINANG_ROT180(BINANG_ROT180(this->actor.wallYaw) - temp_v0); - this->actor.speedXZ *= 0.75f; + this->actor.speed *= 0.75f; this->unk_322 = 0xA; } else { this->actor.world.rot.y = BINANG_ROT180(temp_v1); ret = 1; - this->actor.speedXZ *= 0.25f; + this->actor.speed *= 0.25f; } sp24 = 1; } else if (this->unk_310 & 0x40) { - s16 yaw = Actor_YawBetweenActors(&this->actor, ((void)0, this->collider2.base.ac)); + s16 yaw = Actor_WorldYawTowardActor(&this->actor, ((void)0, this->collider2.base.ac)); sp24 = 2; if (this->actor.colorFilterTimer == 0) { - this->actor.speedXZ *= 0.5f; + this->actor.speed *= 0.5f; if ((s16)(yaw - this->actor.world.rot.y) > 0) { this->actor.world.rot.y -= 0x2000; } else { this->actor.world.rot.y += 0x2000; } } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->unk_322 = 0xA; } @@ -501,7 +501,7 @@ s32 func_80BF47AC(EnRg* this, PlayState* play) { void func_80BF4934(EnRg* this) { if (this->unk_318 == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_DASH); } } @@ -533,7 +533,7 @@ void func_80BF4964(EnRg* this) { } if (!(this->unk_310 & 0x400) && !(this->unk_310 & 0x1000) && (this->unk_322 == 0) && (this->unk_324 == 0) && - (this->actor.bgCheckFlags & 1)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_18C == NULL) { Math_Vec3s_ToVec3f(&sp30, &sp3C[this->unk_33C]); } else { @@ -625,8 +625,8 @@ s32 func_80BF4DA8(EnRg* this) { s32 i; for (i = 0; i < ARRAY_COUNT(D_80BF596C); i++) { - temp_f20 = Actor_XZDistanceToPoint(&this->actor, &D_80BF596C[i]); - temp_v1 = Actor_YawToPoint(&this->actor, &D_80BF596C[i]) - this->actor.world.rot.y; + temp_f20 = Actor_WorldDistXZToPoint(&this->actor, &D_80BF596C[i]); + temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &D_80BF596C[i]) - this->actor.world.rot.y; if ((temp_f20 < 100.0f) && (ABS_ALT(temp_v1) < 0xC00)) { if (temp_v1 > 0) { @@ -676,10 +676,10 @@ void func_80BF4FC4(EnRg* this, PlayState* play) { this->unk_344 = func_80BF4560(this, play); if (!Play_InCsMode(play)) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->unk_310 & 0x400) { this->unk_310 &= ~0x400; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (this->unk_344 != -1) { @@ -688,7 +688,7 @@ void func_80BF4FC4(EnRg* this, PlayState* play) { this->unk_33C++; } } - } else if ((this->actor.bgCheckFlags & 1) && !(this->unk_310 & 0x1000) && + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->unk_310 & 0x1000) && func_80BF4D64(&this->actor.world.pos)) { this->unk_310 |= 0x1000; } diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 0fd1007d0..ae7da7d1b 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -86,7 +86,7 @@ void EnRiverSound_Draw(Actor* thisx, PlayState* play) { s16 params = this->actor.params; if (params < RS_RIVER_DEFAULT_LOW_FREQ) { - Actor_PlaySfxAtPos(&this->actor, gAudioEnvironmentalSfx[params]); + Actor_PlaySfx(&this->actor, gAudioEnvironmentalSfx[params]); } else { Audio_PlaySfxForRiver(&this->actor.projectedPos, freqScale[this->soundFreqIndex]); } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 6c7ac273c..3e193ce79 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -197,7 +197,7 @@ void func_808FA11C(EnRr* this) { this->drawDmgEffFrozenSteamScale = 1.2750001f; this->drawDmgEffAlpha = 1.0f; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_808FA19C(EnRr* this, PlayState* play) { @@ -214,8 +214,8 @@ void func_808FA19C(EnRr* this, PlayState* play) { } void func_808FA238(EnRr* this, f32 arg1) { - this->actor.speedXZ = arg1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LIKE_WALK); + this->actor.speed = arg1; + Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_WALK); } void func_808FA260(EnRr* this) { @@ -236,7 +236,7 @@ void func_808FA260(EnRr* this) { this->actionFunc = func_808FB088; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LIKE_UNARI); + Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_UNARI); } void func_808FA344(EnRr* this) { @@ -271,7 +271,7 @@ void func_808FA3F8(EnRr* this, Player* player) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_1F0 = 8; this->unk_1E1 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_218 = 0.0f; this->unk_210 = 0.0f; this->unk_204 = 0.15f; @@ -286,7 +286,7 @@ void func_808FA3F8(EnRr* this, Player* player) { } this->actionFunc = func_808FB1C0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SUISEN_DRINK); + Actor_PlaySfx(&this->actor, NA_SE_EN_SUISEN_DRINK); } void func_808FA4F4(EnRr* this, PlayState* play) { @@ -331,7 +331,7 @@ void func_808FA4F4(EnRr* this, PlayState* play) { player->actor.world.pos.z += sp30 * Math_CosS(this->actor.shape.rot.y); func_800B8D50(play, &this->actor, sp30, this->actor.shape.rot.y, sp2C, sp38); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SUISEN_THROW); + Actor_PlaySfx(&this->actor, NA_SE_EN_SUISEN_THROW); } } @@ -344,7 +344,7 @@ void func_808FA6B8(EnRr* this) { } else { this->unk_1EC = 40; } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, this->unk_1EC); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, this->unk_1EC); this->unk_1E6 = 20; this->unk_1F6 = 2500; @@ -360,7 +360,7 @@ void func_808FA6B8(EnRr* this) { } this->actionFunc = func_808FB398; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LIKE_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_DAMAGE); } void func_808FA7AC(EnRr* this) { @@ -405,7 +405,7 @@ void func_808FA910(EnRr* this) { this->unk_1E4 = 0; this->unk_214 = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->unk_210 = 0.0f; for (i = 0; i < ARRAY_COUNT(this->unk_324); i++) { @@ -415,7 +415,7 @@ void func_808FA910(EnRr* this) { } this->actionFunc = func_808FB42C; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LIKE_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; } @@ -482,8 +482,8 @@ s32 func_808FAA94(EnRr* this, PlayState* play) { func_808FA910(this); } } else if (this->actor.colChkInfo.damageEffect == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_SetColorFilter(&this->actor, 0, 255, 0, 80); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); this->unk_1EE = 80; func_808FA9CC(this); } else if (this->actor.colChkInfo.damageEffect == 3) { @@ -575,7 +575,7 @@ void func_808FAF94(EnRr* this, PlayState* play) { (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < (8421.053f * this->actor.scale.x))) { func_808FA260(this); - } else if ((this->actor.xzDistToPlayer < 400.0f) && (this->actor.speedXZ == 0.0f)) { + } else if ((this->actor.xzDistToPlayer < 400.0f) && (this->actor.speed == 0.0f)) { func_808FA238(this, 2.0f); } } @@ -632,7 +632,7 @@ void func_808FB1C0(EnRr* this, PlayState* play) { Rumble_Request(this->actor.xyzDistToPlayerSq, 120, 2, 120); if (!(this->unk_1E4 & 7)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_DEMO_EYE); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_DEMO_EYE); } player->unk_AE8 = 0; @@ -742,7 +742,7 @@ void func_808FB680(EnRr* this, PlayState* play) { } else { Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 10, 1000, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->actor.speedXZ == 0.0f) { + if (this->actor.speed == 0.0f) { func_808FA238(this, 2.0f); } } @@ -801,9 +801,9 @@ void EnRr_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->actor.params == ENRR_2) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f); + Math_StepToF(&this->actor.speed, 0.0f, 0.1f); } Actor_MoveWithGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 042f2e46f..0f8c45872 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -145,7 +145,7 @@ s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { leftWasGrounded = this->isLeftFootGrounded; rightWasGrounded = this->isRightFootGrounded; - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.depthInWater < 20.0f) { waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { @@ -161,12 +161,12 @@ s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); if (this->isLeftFootGrounded && !leftWasGrounded && isFootGrounded) { - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); if (this->isRightFootGrounded && !rightWasGrounded && isFootGrounded) { - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } return false; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index f77993e5d..cf62faf71 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -282,7 +282,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, PlayState* play) { this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_RUPY_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_RUPY_FALL); rupee = this->rupees[rupeeIndex]; rupee->unk152 = 60; this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; @@ -293,7 +293,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, PlayState* play) { this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_RUPY_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_RUPY_FALL); rupee = this->rupees[rupeeIndex]; rupee->unk152 = 60; this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; @@ -305,7 +305,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, PlayState* play) { this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_RUPY_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_RUPY_FALL); rupee = this->rupees[rupeeIndex]; rupee->unk152 = 60; this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; @@ -316,7 +316,7 @@ void EnRuppecrow_SpawnRupee(EnRuppecrow* this, PlayState* play) { this->rupees[rupeeIndex] = rupee; this->rupees[rupeeIndex]->actor.gravity = -5.0f; this->rupees[rupeeIndex]->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_RUPY_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_RUPY_FALL); rupee = this->rupees[rupeeIndex]; rupee->unk152 = 60; this->rupees[rupeeIndex]->actor.flags |= ACTOR_FLAG_10; @@ -329,7 +329,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) { Vec3s nextPointDirection; EnRuppecrow_GetPointDirection(this->path, this->currentPoint, &this->actor.world, &nextPointDirection); - if (this->actor.bgCheckFlags & 0x8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { nextPointDirection.y = this->actor.wallYaw; } @@ -438,18 +438,18 @@ void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, PlayState* play) { void EnRuppecrow_HandleDeath(EnRuppecrow* this) { f32 scale; - this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); + this->actor.speed *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gGuayFlyAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); this->actor.shape.yOffset = 0.0f; this->actor.targetArrowOffset = 0.0f; - this->actor.bgCheckFlags &= ~0x1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; scale = this->actor.scale.x * 100.0f; this->actor.world.pos.y += 20.0f * scale; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_DEAD); this->unk_2CC = 0.5f; if (this->actor.colChkInfo.damageEffect == 0x3) { @@ -464,9 +464,9 @@ void EnRuppecrow_HandleDeath(EnRuppecrow* this) { this->unk_2C8 = 5.0f; } - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x0, 0x28); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); if (this->actor.flags & ACTOR_FLAG_8000) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } this->collider.base.acFlags &= ~AC_ON; @@ -492,7 +492,7 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { Player* player = GET_PLAYER(play); EnRuppecrow_UpdatePosition(this, play); - if (this->actor.xzDistToPlayer < 1000.0f && EnRuppecrow_CheckPlayedMatchingSong(play)) { + if ((this->actor.xzDistToPlayer < 1000.0f) && EnRuppecrow_CheckPlayedMatchingSong(play)) { // If Link is in front, the guay will turn around and go the other way if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { this->isGoingCounterClockwise |= 1; @@ -508,9 +508,9 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { } if (player->stateFlags2 & PLAYER_STATE2_8000000) { - Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.0f, 0.1f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.1f, 0.1f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.1f, 0.1f); } Actor_MoveWithoutGravity(&this->actor); @@ -518,7 +518,7 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { this->actor.shape.yOffset = Math_SinS(this->yOffset) * 500.0f; if ((play->state.frames % 43) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } } @@ -546,7 +546,7 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, PlayState* play) { //! @bug: Source of the "Termina Field Guay Glitch"; guay will no longer fall if killed after this point this->actor.gravity = 0.0f; - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.2f, 0.5f); Math_ApproachF(&this->actor.velocity.y, 3.0f, 0.2f, 0.5f); this->actionFunc = EnRuppecrow_FlyToDespawn; @@ -555,7 +555,7 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, PlayState* play) { } else { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { EnRuppecrow_UpdateSpeed(this, play); - Math_ApproachF(&this->actor.speedXZ, this->speedModifier, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, this->speedModifier, 0.2f, 0.5f); } Actor_MoveWithoutGravity(&this->actor); @@ -563,17 +563,17 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, PlayState* play) { this->actor.shape.yOffset = Math_SinS(this->yOffset) * 500.0f; if ((play->state.frames % 43) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } } } void EnRuppecrow_FlyToDespawn(EnRuppecrow* this, PlayState* play) { - if (this->actor.bgCheckFlags & 0x8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y *= -0x1; } - Math_ApproachF(&this->actor.speedXZ, this->speedModifier, 0.1f, 0.1f); + Math_ApproachF(&this->actor.speed, this->speedModifier, 0.1f, 0.1f); Math_ApproachF(&this->actor.velocity.y, 3.0f, 0.2f, 0.5f); if (this->actor.world.pos.y > 1000.0f || this->actor.xzDistToPlayer > 2000.0f) { @@ -585,13 +585,13 @@ void EnRuppecrow_FlyToDespawn(EnRuppecrow* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if ((play->state.frames % 43) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } } } void EnRuppecrow_FallToDespawn(EnRuppecrow* this, PlayState* play) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (this->currentEffect != ENRUPPECROW_EFFECT_ICE) { Math_StepToF(&this->unk_2C8, 0.0f, 0.05f); @@ -608,7 +608,7 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, PlayState* play) { this->actor.shape.rot.z += 0x1780; } - if (this->actor.bgCheckFlags & 0x1 || this->actor.floorHeight == BGCHECK_Y_MIN) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { EnRuppecrow_ShatterIce(this, play); func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, (this->actor.scale.x * 10000.0f), 0x0, 0x0); diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index 108d88023..23b6419ab 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -423,12 +423,12 @@ void func_80BFC078(EnRz* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x2927: case 0x2928: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); SET_WEEKEVENTREG(WEEKEVENTREG_77_04); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BFC3F8; if (this->animIndex != EN_RZ_ANIM_LINK_DANCE) { func_80BFB9E4(play, this, EN_RZ_ANIM_DANCE); @@ -473,15 +473,15 @@ void func_80BFC270(EnRz* this, PlayState* play) { this->actionFunc = func_80BFC214; func_80BFBDFC(play); } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 2000.0f, 1000.0f); } } void func_80BFC2F4(EnRz* this, PlayState* play) { EnRz_UpdateSkelAnime(this, play); if (!func_80BFBE70(this, play)) { - func_801477B4(play); - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 2000.0f, 1000.0f); + Message_CloseTextbox(play); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 2000.0f, 1000.0f); this->actionFunc = func_80BFC270; } } @@ -554,7 +554,7 @@ void func_80BFC608(EnRz* this, PlayState* play) { EnRz_UpdateSkelAnime(this, play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BFC674; } } @@ -578,7 +578,7 @@ void func_80BFC728(EnRz* this, PlayState* play) { EnRz_UpdateSkelAnime(this, play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BFC7E0; this->actor.textId++; if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) { @@ -604,7 +604,7 @@ void func_80BFC7E0(EnRz* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BFC728; func_80BFB9E4(play, this, EN_RZ_ANIM_THINKING); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80BFBDFC(play); } else if (EnRz_CanTalk(this, play)) { func_800B8614(&this->actor, play, 120.0f); @@ -614,13 +614,13 @@ void func_80BFC7E0(EnRz* this, PlayState* play) { void EnRz_StopToThink(EnRz* this, PlayState* play) { this->timer = 100; this->actionFunc = func_80BFC7E0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80BFB9E4(play, this, EN_RZ_ANIM_THINKING); } void EnRz_Walk(EnRz* this, PlayState* play) { EnRz_UpdateSkelAnime(this, play); - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; switch (EnRz_GetPathStatus(this)) { case EN_RZ_PATHSTATUS_END: @@ -639,7 +639,7 @@ void EnRz_Walk(EnRz* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BFC728; func_80BFB9E4(play, this, EN_RZ_ANIM_THINKING); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80BFBDFC(play); } else if (EnRz_CanTalk(this, play)) { func_800B8614(&this->actor, play, 120.0f); diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index cc3cd2455..f3af8a510 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -765,10 +765,10 @@ void EnSGoro_UpdateSleeping(EnSGoro* this, PlayState* play) { if (this->snorePhase == 0) { if (this->actionFlags & EN_S_GORO_ACTIONFLAG_SNOREPHASE) { this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_SNOREPHASE; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE2); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SNORE2); } else { this->actionFlags |= EN_S_GORO_ACTIONFLAG_SNOREPHASE; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE1); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SNORE1); } } } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { @@ -1245,7 +1245,7 @@ void EnSGoro_ShopGoron_Talk(EnSGoro* this, PlayState* play) { if ((this->textId == 0x675) || (this->textId == 0x676)) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Actor_PickUp(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); this->actionFunc = EnSGoro_ShopGoron_TakePayment; } else { Message_StartTextbox(play, this->textId, &this->actor); @@ -1262,7 +1262,7 @@ void EnSGoro_ShopGoron_TakePayment(EnSGoro* this, PlayState* play) { Rupees_ChangeBy(-this->powderKegPrice); this->actionFunc = EnSGoro_ShopGoron_FinishTransaction; } else { - Actor_PickUp(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); } } @@ -1271,7 +1271,7 @@ void EnSGoro_ShopGoron_FinishTransaction(EnSGoro* this, PlayState* play) { Message_StartTextbox(play, this->textId, &this->actor); this->actionFunc = EnSGoro_ShopGoron_Talk; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 868b48923..6b2304b19 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -118,7 +118,7 @@ void EnSb_Init(Actor* thisx, PlayState* play) { this->isDead = false; this->actor.colChkInfo.mass = 90; this->actor.shape.rot.y = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -0.35f; this->fireCount = 0; this->unk_252 = 0; @@ -155,7 +155,7 @@ void EnSb_SetupOpen(EnSb* this) { ANIMMODE_ONCE, 0.0f); this->state = SHELLBLADE_OPEN; this->actionFunc = EnSb_Open; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); } void EnSb_SetupWaitOpen(EnSb* this) { @@ -172,7 +172,7 @@ void EnSb_SetupLunge(EnSb* this) { Animation_Change(&this->skelAnime, &object_sb_Anim_000124, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0); this->state = SHELLBLADE_LUNGE; this->actionFunc = EnSb_Lunge; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); } void EnSb_SetupBounce(EnSb* this) { @@ -191,12 +191,12 @@ void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) { this->state = SHELLBLADE_WAIT_CLOSED; if (changeSpeed) { if (this->actor.depthInWater > 0.0f) { - this->actor.speedXZ = -5.0f; + this->actor.speed = -5.0f; if (this->actor.velocity.y < 0.0f) { this->actor.velocity.y = 2.1f; } } else { - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; if (this->actor.velocity.y < 0.0f) { this->actor.velocity.y = 1.4f; } @@ -253,11 +253,11 @@ void EnSb_TurnAround(EnSb* this, PlayState* play) { this->actor.world.rot.y = this->yawAngle; if (this->actor.depthInWater > 0.0f) { this->actor.velocity.y = 3.0f; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.gravity = -0.35f; } else { this->actor.velocity.y = 2.0f; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; this->actor.gravity = -2.0f; } EnSb_SpawnBubbles(play, this); @@ -267,12 +267,12 @@ void EnSb_TurnAround(EnSb* this, PlayState* play) { } 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) { + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); + if ((this->actor.velocity.y <= -0.1f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH)) { if (!(this->actor.depthInWater > 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; EnSb_SetupBounce(this); } } @@ -282,25 +282,25 @@ void EnSb_Bounce(EnSb* this, PlayState* play) { f32 currentFrame = currentFrame = this->skelAnime.curFrame; f32 frameCount = frameCount = Animation_GetLastFrame(&object_sb_Anim_0000B4); - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); if (currentFrame == frameCount) { if (this->bounceCounter != 0) { this->bounceCounter--; this->attackTimer = 1; if (this->actor.depthInWater > 0.0f) { this->actor.velocity.y = 3.0f; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->actor.gravity = -0.35f; } else { this->actor.velocity.y = 2.0f; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; this->actor.gravity = -2.0f; } EnSb_SpawnBubbles(play, this); EnSb_SetupLunge(this); - } else if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~2; - this->actor.speedXZ = 0.0f; + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; + this->actor.speed = 0.0f; this->attackTimer = 1; EnSb_SetupWaitClosed(this); } @@ -310,14 +310,14 @@ void EnSb_Bounce(EnSb* this, PlayState* play) { void EnSb_ReturnToIdle(EnSb* this, PlayState* play) { if (this->attackTimer != 0) { this->attackTimer--; - if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~1; - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + this->actor.speed = 0.0f; } - } else if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~1; + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actionFunc = EnSb_Idle; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -331,7 +331,7 @@ void EnSb_UpdateDamage(EnSb* this, PlayState* play) { hitPlayer = 0; if (this->vulnerableTimer != 0) { Actor_ApplyDamage(&this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_XLU, 80); hitPlayer = 1; } } diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c index fa017af87..da7c85f63 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c @@ -116,7 +116,7 @@ void func_80BD6A8C(EnScRuppe* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { this->ruppeDisplayTime = 0; this->actor.gravity = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_GET_RUPY); + Actor_PlaySfx(&this->actor, NA_SE_SY_GET_RUPY); Rupees_ChangeBy(sRupeeInfo[this->ruppeIndex].amount); this->actionFunc = func_80BD6B18; } @@ -156,7 +156,7 @@ void EnScRuppe_Init(Actor* thisx, PlayState* play) { if ((this->ruppeIndex < RUPEE_GREEN) || (this->ruppeIndex >= RUPEE_UNUSED)) { this->ruppeIndex = RUPEE_GREEN; } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80BD6A8C; this->actor.gravity = -0.5f; this->actor.shape.yOffset = 700.0f; diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index b37190ee1..da4614d24 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -166,7 +166,7 @@ void func_80BCD2BC(EnScopecrow* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SC_RUPPE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, this->actor.params, - this->actor.cutscene, this->actor.unk20, NULL); + this->actor.cutscene, this->actor.halfDaysBits, NULL); } s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) { @@ -236,7 +236,7 @@ void func_80BCD640(EnScopecrow* this, PlayState* play) { if (this->path != NULL) { func_80BCD4D0(this->path, this->unk_1FC, &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp30.y = this->actor.wallYaw; } @@ -257,7 +257,7 @@ void func_80BCD640(EnScopecrow* this, PlayState* play) { } } - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.2f, 1.0f); Actor_MoveWithoutGravity(&this->actor); this->unk_264 += 0x1000; this->actor.shape.yOffset = Math_SinS(this->unk_264) * 500.0f; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 4f8207046..63a713358 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -126,19 +126,19 @@ void func_80BCAC40(EnScopenuts* this, PlayState* play) { } void func_80BCAD64(EnScopenuts* this, s16 arg1) { - f32 sp24 = Math_CosS(this->actor.world.rot.x) * this->actor.speedXZ; + f32 sp24 = Math_CosS(this->actor.world.rot.x) * this->actor.speed; switch (arg1) { case 1: - this->actor.velocity.y = this->actor.speedXZ; + this->actor.velocity.y = this->actor.speed; this->actor.velocity.x = 0.0f; this->actor.velocity.z = 0.0f; break; case 2: - this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; + this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; this->actor.velocity.y = 0.0f; - this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; break; case 3: @@ -149,7 +149,7 @@ void func_80BCAD64(EnScopenuts* this, s16 arg1) { default: this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * sp24; - this->actor.velocity.y = Math_SinS(this->actor.world.rot.x) * this->actor.speedXZ; + this->actor.velocity.y = Math_SinS(this->actor.world.rot.x) * this->actor.speed; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * sp24; break; } @@ -208,7 +208,7 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) { if (this->path != NULL) { func_80BCC448(this->path, this->unk_334, &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp30.y = this->actor.wallYaw; } Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 10, 300, 0); @@ -219,7 +219,7 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) { if (func_80BCC2AC(this, this->path, this->unk_334)) { if (this->unk_334 >= (this->path->count - 1)) { this->actionFunc = func_80BCB1C8; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -1.0f; return; } @@ -228,9 +228,9 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) { } if (this->unk_334 >= (this->path->count - 2)) { - Math_ApproachF(&this->actor.speedXZ, 1.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.5f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 1.0f); } Actor_MoveWithoutGravity(&this->actor); } @@ -238,7 +238,7 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) { void func_80BCB1C8(EnScopenuts* this, PlayState* play) { this->unk_350 *= 0.92f; Actor_SetScale(&this->actor, this->unk_350); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { SET_WEEKEVENTREG(WEEKEVENTREG_52_40); Actor_Kill(&this->actor); } @@ -252,7 +252,7 @@ void func_80BCB230(EnScopenuts* this, PlayState* play) { if ((((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) && ((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80BCB4DC; this->unk_348 = 3; this->collider.dim.height = 64; @@ -262,12 +262,12 @@ void func_80BCB230(EnScopenuts* this, PlayState* play) { if ((this->unk_348 == 4) || (this->unk_348 == 18)) { this->unk_348 = 17; this->collider.dim.height = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_348 == 2) { this->unk_348 = 16; this->collider.dim.height = 32; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_348 == 17) { if (DECR(this->unk_34E) == 0) { @@ -360,7 +360,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { } } } else if (talkState == TEXT_STATE_DONE) { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_80BCB980; } } @@ -371,7 +371,7 @@ void func_80BCB90C(EnScopenuts* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_53_02); this->actionFunc = func_80BCB6D0; } else { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 300.0f, 300.0f); } } @@ -382,7 +382,7 @@ void func_80BCB980(EnScopenuts* this, PlayState* play) { Message_StartTextbox(play, this->unk_33C, &this->actor); this->actionFunc = func_80BCB6D0; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -464,7 +464,7 @@ void func_80BCBA00(EnScopenuts* this, PlayState* play) { this->unk_35A = 3; this->unk_348 = 19; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 19); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_328 &= ~2; this->unk_34E = 50; this->unk_328 |= 8; @@ -528,7 +528,7 @@ void func_80BCBD28(EnScopenuts* this, PlayState* play) { this->unk_368 = 0.3f; this->unk_348 = 9; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 9); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); func_80BCAC40(this, play); this->actionFunc = func_80BCBF0C; } @@ -564,7 +564,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { if (this->path != NULL) { sp34 = func_80BCC448(this->path, this->unk_334, &this->actor.world.pos, &sp38); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp38.y = this->actor.wallYaw; } @@ -605,7 +605,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { this->actionFunc = func_80BCC288; } - Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.0f, 0.2f, 1.0f); func_80BCAD64(this, sp32); if (this->unk_36C == 2) { @@ -701,7 +701,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_328 |= 2; this->unk_328 |= 4; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_40)) { diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index 88fab3298..ff12d798f 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -59,8 +59,9 @@ void EnSekihi_Init(Actor* thisx, PlayState* play) { return; } - if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= 30)) { - SET_WEEKEVENTREG(WEEKEVENTREG_13_20); + if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= SPIDER_HOUSE_TOKENS_REQUIRED)) { + // For some reason the mikau grave sets the flag instead of something in the spider house on exit. + SET_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN); } objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); @@ -118,15 +119,15 @@ void func_80A44F40(EnSekihi* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0x101A); + Message_ContinueTextbox(play, 0x101A); break; case 1: func_8019F208(); - func_80151938(play, 0x101B); + Message_ContinueTextbox(play, 0x101B); break; case 2: func_8019F230(); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80A450B0; break; } @@ -138,11 +139,11 @@ void func_80A44F40(EnSekihi* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1018: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x101A: case 0x101B: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80A450B0; break; } diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h index fb4ad7e60..0c26dab71 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h @@ -2,6 +2,8 @@ #define Z_EN_SEKIHI_H #include "global.h" +#include "overlays/actors/ovl_En_Si/z_en_si.h" + #define ENSIKIHI_GET_TYPE(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index b16153a53..03aa4ab19 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -294,7 +294,7 @@ void func_80ADB254(EnSellnuts* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); if (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f) ? true : false) && ((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80ADB4F4; this->unk_34C = 3; this->collider.dim.height = 64; @@ -303,12 +303,12 @@ void func_80ADB254(EnSellnuts* this, PlayState* play) { if ((this->unk_34C == 4) || (this->unk_34C == 18)) { this->unk_34C = 17; this->collider.dim.height = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_34C == 2) { this->unk_34C = 16; this->collider.dim.height = 32; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_34C == 17) { if (DECR(this->unk_34E) == 0) { @@ -433,20 +433,20 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { this->unk_340 = player->actor.textId; this->actionFunc = func_80ADB0D8; } - func_801477B4(play); + Message_CloseTextbox(play); } else if (itemAction <= PLAYER_IA_MINUS1) { this->unk_340 = D_80ADD920[this->unk_33A]; - func_80151938(play, this->unk_340); + Message_ContinueTextbox(play, this->unk_340); this->actionFunc = func_80ADB0D8; } } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_340 == D_80ADD910[this->unk_33A]) { this->unk_340 = D_80ADD938[this->unk_33A]; - func_80151938(play, this->unk_340); + Message_ContinueTextbox(play, this->unk_340); this->actionFunc = func_80ADB0D8; } else { this->unk_340 = 0xFF; - func_80151938(play, this->unk_340); + Message_ContinueTextbox(play, this->unk_340); this->actionFunc = func_80ADB0D8; } } @@ -483,7 +483,7 @@ void func_80ADBBEC(EnSellnuts* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_17_80); this->actionFunc = func_80ADBCE4; } else { - Actor_PickUp(&this->actor, play, GI_DEED_LAND, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_DEED_LAND, 300.0f, 300.0f); } } @@ -548,7 +548,7 @@ void func_80ADBE80(EnSellnuts* this, PlayState* play) { this->unk_350 = 4; this->unk_34C = 19; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 19); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_338 &= ~1; this->unk_338 |= 8; this->unk_32C = this->actor.world.pos.y; @@ -617,7 +617,7 @@ void func_80ADC118(EnSellnuts* this, PlayState* play) { this->unk_34C = 9; this->unk_360 = 0.3f; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 9); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80ADC034; } } @@ -649,7 +649,7 @@ void func_80ADC37C(EnSellnuts* this, PlayState* play) { this->actor.gravity = 0.0f; if (this->path != NULL) { sp2C = func_80ADCFE8(this->path, this->unk_334, &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp30.y = this->actor.wallYaw; } Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 0xA, 0x12C, 0); @@ -670,7 +670,7 @@ void func_80ADC37C(EnSellnuts* this, PlayState* play) { this->actionFunc = func_80ADC580; } - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.2f, 1.0f); Actor_MoveWithoutGravity(&this->actor); if (this->unk_366 == 2) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -780,7 +780,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { if (this->path != NULL) { func_80ADCFE8(this->path, this->unk_334, &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp30.y = this->actor.wallYaw; } Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 0xA, 0x12C, 0); @@ -793,7 +793,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { this->unk_34C = 22; this->actor.gravity = -1.0f; this->actor.velocity.y = -1.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->unk_338 &= ~1; this->unk_338 &= ~2; @@ -802,7 +802,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { } this->unk_334++; } - Math_ApproachF(&this->actor.speedXZ, 2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.0f, 0.2f, 1.0f); Actor_MoveWithoutGravity(&this->actor); } } @@ -823,7 +823,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { this->unk_34C = 19; this->actor.velocity.y = 0.0f; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DOWN); } return; } @@ -884,7 +884,7 @@ void func_80ADCD3C(EnSellnuts* this, PlayState* play) { this->collider.dim.height = 64; this->unk_34C = 3; this->unk_350 = 4; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADCC04; } else if (D_80ADD940 != 0) { @@ -968,7 +968,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->unk_374 = 0.01f; this->unk_370 = 0.01f; this->unk_36C = 0.01f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_73_04)) { if (ENSELLNUTS_GET_1(&this->actor)) { diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index 5f7e111a4..cf44d641b 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -15,10 +15,8 @@ void EnSi_Destroy(Actor* thisx, PlayState* play); void EnSi_Update(Actor* thisx, PlayState* play); void EnSi_Draw(Actor* thisx, PlayState* play); -void func_8098CB70(EnSi* this, PlayState* play); -void func_8098CBDC(EnSi* this, PlayState* play); +void EnSi_DraggedByHookshot(EnSi* this, PlayState* play); -#if 0 ActorInit En_Si_InitVars = { ACTOR_EN_SI, ACTORCAT_ITEMACTION, @@ -31,18 +29,29 @@ ActorInit En_Si_InitVars = { (ActorFunc)EnSi_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_8098CD80 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_NO_PUSH | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderSphereInit sSphereInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_NO_PUSH | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_SPHERE, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 0, { { 0, 0, 0 }, 10 }, 100 }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_8098CDAC = { 1, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_8098CDB8 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -77,24 +86,79 @@ static DamageTable D_8098CDB8 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -#endif +void EnSi_UpdateCollision(EnSi* this, PlayState* play) { + this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.dim.worldSphere.center.y = this->actor.world.pos.y; + this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; + this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale; + if (this->actor.colChkInfo.health > 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} -extern ColliderSphereInit D_8098CD80; -extern CollisionCheckInfoInit2 D_8098CDAC; -extern DamageTable D_8098CDB8; +void EnSi_GiveToken(EnSi* this, PlayState* play) { + s32 chestFlag = ENSI_GET_CHEST_FLAG(&this->actor); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CA20.s") + if ((chestFlag < 0x20) && (chestFlag >= 0)) { + Flags_SetTreasure(play, chestFlag); + } + Item_Give(play, ITEM_SKULL_TOKEN); + if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { + Message_StartTextbox(play, 0xFC, NULL); // You collected all tokens, curse lifted + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); + } else { + Message_StartTextbox(play, 0x52, NULL); // You got one more gold token, your [count] one! + Audio_PlayFanfare(NA_BGM_GET_SMALL_ITEM); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CAD0.s") +void EnSi_Wait(EnSi* this, PlayState* play) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000)) { + this->actionFunc = EnSi_DraggedByHookshot; + } else if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { + EnSi_GiveToken(this, play); + Actor_Kill(&this->actor); + return; + } + this->actor.shape.rot.y += 0x38E; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CB70.s") +void EnSi_DraggedByHookshot(EnSi* this, PlayState* play) { + if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000)) { + EnSi_GiveToken(this, play); + Actor_Kill(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CBDC.s") +void EnSi_Init(Actor* thisx, PlayState* play) { + EnSi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Init.s") + Collider_InitSphere(play, &this->collider); + Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + Actor_SetScale(&this->actor, 0.25f); + this->actionFunc = EnSi_Wait; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Destroy.s") +void EnSi_Destroy(Actor* thisx, PlayState* play) { + EnSi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Update.s") + Collider_DestroySphere(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Draw.s") +void EnSi_Update(Actor* thisx, PlayState* play) { + EnSi* this = THIS; + + this->actionFunc(this, play); + EnSi_UpdateCollision(this, play); + Actor_SetFocus(&this->actor, 0.0f); +} + +void EnSi_Draw(Actor* thisx, PlayState* play) { + EnSi* this = THIS; + + func_800B8118(&this->actor, play, 0); + func_800B8050(&this->actor, play, 0); + GetItem_Draw(play, GID_SKULL_TOKEN_2); +} diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.h b/src/overlays/actors/ovl_En_Si/z_en_si.h index b401e5e6a..f1b089ddd 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -3,6 +3,10 @@ #include "global.h" +#define ENSI_GET_CHEST_FLAG(thisx) (((thisx)->params & 0xFC) >> 2) + +#define SPIDER_HOUSE_TOKENS_REQUIRED 30 + struct EnSi; typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*); @@ -10,7 +14,7 @@ typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*); typedef struct EnSi { /* 0x000 */ Actor actor; /* 0x144 */ EnSiActionFunc actionFunc; - /* 0x148 */ char unk_148[0x58]; + /* 0x148 */ ColliderSphere collider; } EnSi; // size = 0x1A0 #endif // Z_EN_SI_H diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index bb1fb7e0b..09cee41f2 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -289,7 +289,7 @@ void func_80994DA8(EnSkb* this, PlayState* play) { void func_80994E2C(EnSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_APPEAR); this->unk_3D0 = 0; this->unk_3DE = 0; this->actionFunc = func_80994E94; @@ -325,7 +325,7 @@ void func_80994F7C(EnSkb* this, PlayState* play) { this->unk_3E0 = 1; } this->actionFunc = func_80995190; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if (Actor_IsFacingPlayer(&this->actor, 0x2AAA) && !(this->collider.base.acFlags & AC_HIT)) { func_800B8614(&this->actor, play, 100.0f); } @@ -333,7 +333,7 @@ void func_80994F7C(EnSkb* this, PlayState* play) { void func_8099504C(EnSkb* this) { this->actionFunc = func_80995068; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80995068(EnSkb* this, PlayState* play) { @@ -349,7 +349,7 @@ void func_80995068(EnSkb* this, PlayState* play) { this->unk_3E0 = 1; } this->actionFunc = func_80995190; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if (Player_GetMask(play) != PLAYER_MASK_CAPTAIN) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_4); this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); @@ -417,7 +417,7 @@ void func_809952D8(EnSkb* this) { this->unk_3DE = 9; this->actionFunc = func_8099533C; this->actor.shape.shadowScale = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.yOffset = 0.0f; } @@ -439,7 +439,7 @@ void func_809953E8(EnSkb* this) { this->unk_3DE = 10; this->actionFunc = func_8099544C; this->actor.shape.shadowScale = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.yOffset = 0.0f; } @@ -462,7 +462,7 @@ void func_809954F8(EnSkb* this) { this->actionFunc = func_8099556C; this->actor.gravity = 0.0f; this->actor.shape.shadowScale = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.yOffset = 0.0f; this->actor.targetArrowOffset = 4000.0f; } @@ -495,19 +495,19 @@ void func_8099556C(EnSkb* this, PlayState* play) { } void func_8099571C(EnSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_3DC = 0; this->actor.shape.shadowScale = 0.0f; if (this->unk_3DE == 9) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); - this->actor.speedXZ = 2.4f; + this->actor.speed = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; } else if (this->unk_3DE == 0xA) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); } else if (this->unk_3DE == 0xB) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); - this->actor.speedXZ = 3.2f; + this->actor.speed = 3.2f; this->actor.gravity = -1.0f; this->actor.velocity.y = 2.0f; } @@ -526,8 +526,8 @@ void func_80995818(EnSkb* this, PlayState* play) { func_80995A30(this); } - if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; for (i = 0; i < 10; i++) { func_809947B0(play, this, &this->actor.world.pos); } @@ -539,8 +539,8 @@ void func_809958F4(EnSkb* this) { 0.0f, ANIMMODE_ONCE, -4.0f); this->unk_3E4 = 0; this->actor.flags &= ~ACTOR_FLAG_1; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->unk_3DE = 1; this->actionFunc = func_8099599C; } @@ -561,7 +561,7 @@ void func_8099599C(EnSkb* this, PlayState* play) { void func_80995A30(EnSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); - this->actor.speedXZ = 1.6f; + this->actor.speed = 1.6f; this->unk_3DA = 0; this->unk_3DE = 2; this->actionFunc = func_80995A8C; @@ -585,7 +585,7 @@ void func_80995A8C(EnSkb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_3DA, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); } if ((this->actor.xzDistToPlayer > 800.0f) || func_80996594(this, play)) { @@ -598,14 +598,14 @@ void func_80995A8C(EnSkb* this, PlayState* play) { void func_80995C24(EnSkb* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->collider.base.atFlags &= ~AT_BOUNCED; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_3DE = 3; this->actionFunc = func_80995C84; } void func_80995C84(EnSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 3.0f) && (this->unk_3E4 == 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_3E4 = 1; } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) { this->unk_3E4 = 0; @@ -635,27 +635,27 @@ void func_80995DC4(EnSkb* this, PlayState* play) { } void func_80995E08(EnSkb* this) { - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = 0.0f; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->unk_3E4 = 0; this->unk_3DE = 5; this->actionFunc = func_80995E64; } void func_80995E64(EnSkb* this, PlayState* play) { - if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & 1) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.05f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.05f; } } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_3DC == 0) { if (this->actor.colChkInfo.health == 0) { func_809961E4(this, play); @@ -684,43 +684,44 @@ void func_80995F98(EnSkb* this) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->actor.gravity = -1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; } else if (this->unk_3DE == 0xB) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); - this->actor.speedXZ = 3.2f; + this->actor.speed = 3.2f; this->actor.velocity.y = 2.0f; this->actor.gravity = -1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -4.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -4.0f; } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3DE = 6; this->actionFunc = func_809960AC; } void func_809960AC(EnSkb* this, PlayState* play) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { s32 i; for (i = 0; i < 10; i++) { func_809947B0(play, this, &this->actor.world.pos); } - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & 1) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.05f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.05f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x9C4, 0); } Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 0x10, 0x7D0, 0x64); - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->actor.bgCheckFlags & 1)) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.shape.rot.x = 0; this->actor.world.rot = this->actor.shape.rot; func_80994DA8(this, play); @@ -730,8 +731,8 @@ void func_809960AC(EnSkb* this, PlayState* play) { void func_809961E4(EnSkb* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->unk_3D8 |= 0x40; - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -6.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -6.0f; } this->unk_3E4 = 0; this->actor.flags &= ~ACTOR_FLAG_1; @@ -749,7 +750,7 @@ void func_80996284(EnSkb* this, PlayState* play) { } void func_809962D4(EnSkb* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_8099630C; } @@ -759,7 +760,7 @@ void func_8099630C(EnSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_3D8 |= 1; func_80995F98(this); @@ -781,7 +782,7 @@ void func_809963D8(EnSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_3D8 |= 1; func_80995F98(this); @@ -873,7 +874,8 @@ void func_8099672C(EnSkb* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((this->unk_3DE != 6) && (this->unk_3DE != 7)) { - if ((this->actor.bgCheckFlags & 0x60) && (this->actor.depthInWater >= 40.0f)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) && + (this->actor.depthInWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_3E4 = 0; func_809961E4(this, play); @@ -913,12 +915,12 @@ void func_8099672C(EnSkb* this, PlayState* play) { this->drawDmgEffTimer = 40; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80995E08(this); break; case 1: - Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); func_80995E08(this); break; @@ -927,14 +929,14 @@ void func_8099672C(EnSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->unk_3D8 |= 1; func_80995F98(this); break; case 3: if (this->actor.colChkInfo.health != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->drawDmgEffTimer = 80; } else { this->drawDmgEffTimer = 3; @@ -942,7 +944,7 @@ void func_8099672C(EnSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); func_809962D4(this); break; @@ -951,8 +953,8 @@ void func_8099672C(EnSkb* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.5f; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_809963C4(this); break; @@ -970,7 +972,7 @@ void func_8099672C(EnSkb* this, PlayState* play) { } case 13: - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80995F98(this); break; diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 994115f89..640bd2a26 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -208,7 +208,7 @@ void EnSnowman_Init(Actor* thisx, PlayState* play) { thisx->world.pos.z, 0, 0, 0, EN_SNOWMAN_TYPE_SPLIT); thisx->parent = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SNOWMAN, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, - EN_SNOWMAN_TYPE_SPLIT, -1, thisx->unk20, NULL); + EN_SNOWMAN_TYPE_SPLIT, -1, thisx->halfDaysBits, NULL); if ((thisx->child == NULL) || (thisx->parent == NULL)) { if (thisx->child != NULL) { Actor_Kill(thisx->child); @@ -242,19 +242,19 @@ void EnSnowman_Init(Actor* thisx, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_1; Collider_InitAndSetCylinder(play, &this->collider, thisx, &sSnowballCylinderInit); - thisx->world.rot.y = Actor_YawBetweenActors(thisx, &player->actor); - thisx->velocity.y = (Actor_XZDistanceBetweenActors(thisx, &player->actor) * 0.035f) + -5.0f; + thisx->world.rot.y = Actor_WorldYawTowardActor(thisx, &player->actor); + thisx->velocity.y = (Actor_WorldDistXZToActor(thisx, &player->actor) * 0.035f) + -5.0f; thisx->velocity.y = CLAMP_MAX(thisx->velocity.y, 3.5f); if (EN_SNOWMAN_GET_TYPE(thisx) == EN_SNOWMAN_TYPE_SMALL_SNOWBALL) { - thisx->speedXZ = 15.0f; + thisx->speed = 15.0f; } else { - thisx->speedXZ = 22.5f; + thisx->speed = 22.5f; thisx->velocity.y *= 1.5f; } - thisx->world.pos.x += thisx->speedXZ * Math_SinS(thisx->world.rot.y); + thisx->world.pos.x += thisx->speed * Math_SinS(thisx->world.rot.y); thisx->world.pos.y += thisx->velocity.y; - thisx->world.pos.z += thisx->speedXZ * Math_CosS(thisx->world.rot.y); + thisx->world.pos.z += thisx->speed * Math_CosS(thisx->world.rot.y); if (EN_SNOWMAN_GET_TYPE(thisx) == EN_SNOWMAN_TYPE_SMALL_SNOWBALL) { this->collider.dim.radius = 8; @@ -338,7 +338,7 @@ void EnSnowman_SpawnBigSnowballFragmentEffects(EnSnowman* this, PlayState* play) void EnSnowman_SetupMoveSnowPile(EnSnowman* this) { Animation_PlayLoop(&this->snowPileSkelAnime, &gEenoSnowPileMoveAnim); this->actor.scale.y = this->actor.scale.x; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; this->actor.draw = EnSnowman_DrawSnowPile; this->work.timer = 40; this->turningOnSteepSlope = false; @@ -403,10 +403,11 @@ void EnSnowman_MoveSnowPile(EnSnowman* this, PlayState* play) { } this->actor.world.rot.y = this->actor.shape.rot.y; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->snowPileTargetRotY = this->actor.wallYaw; - } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 200.0f) { - this->snowPileTargetRotY = Actor_YawToPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 200.0f) { + this->snowPileTargetRotY = + Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) + ((s32)Rand_Next() >> 0x14); } else if (Rand_ZeroOne() < 0.02f) { this->snowPileTargetRotY += (s16)(((Rand_Next() >> 0x13) + 0x1000) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)); } @@ -414,12 +415,12 @@ void EnSnowman_MoveSnowPile(EnSnowman* this, PlayState* play) { void EnSnowman_SetupEmerge(EnSnowman* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gEenoEmergeAnim); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_SURFACE); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_SURFACE); this->collider.dim.radius = this->eenoScale * 40.0f; this->collider.dim.height = this->eenoScale * 25.0f; this->actor.draw = EnSnowman_Draw; this->actor.scale.y = this->actor.scale.x * 0.4f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; EnSnowman_SpawnCircularDustEffect(this, play); this->collider.base.acFlags &= ~AC_ON; @@ -494,9 +495,9 @@ void EnSnowman_ReadySnowball(EnSnowman* this, PlayState* play) { EnSnowman_SetupThrowSnowball(this); } else if (Animation_OnFrame(&this->skelAnime, this->fwork.frameToStartHoldingSnowball)) { if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_HOLD_SNOW); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_HOLD_SNOW); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_MINI_HOLD); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_MINI_HOLD); } this->isHoldingSnowball = true; @@ -539,10 +540,10 @@ void EnSnowman_ThrowSnowball(EnSnowman* this, PlayState* play) { this->isHoldingSnowball = false; if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { params = EN_SNOWMAN_TYPE_LARGE_SNOWBALL; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_THROW); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_THROW); } else { params = EN_SNOWMAN_TYPE_SMALL_SNOWBALL; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_MINI_THROW); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_MINI_THROW); } Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SNOWMAN, this->snowballPos.x, this->snowballPos.y, @@ -572,7 +573,7 @@ void EnSnowman_SetupSubmerge(EnSnowman* this, PlayState* play) { Animation_Change(&this->skelAnime, &gEenoEmergeAnim, -1.0f, Animation_GetLastFrame(&gEenoEmergeAnim), 0.0f, ANIMMODE_ONCE, -3.0f); EnSnowman_SpawnCircularDustEffect(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_HIDE); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_HIDE); this->actionFunc = EnSnowman_Submerge; } @@ -598,13 +599,13 @@ void EnSnowman_Submerge(EnSnowman* this, PlayState* play) { } void EnSnowman_SetupMelt(EnSnowman* this) { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 50); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 50); this->collider.base.acFlags &= ~AC_ON; this->work.timer = 50; this->actor.flags &= ~ACTOR_FLAG_1; this->actor.flags |= ACTOR_FLAG_10; this->actor.scale.y = this->actor.scale.x; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnSnowman_Melt; } @@ -667,18 +668,18 @@ void EnSnowman_Stun(EnSnowman* this, PlayState* play) { void EnSnowman_SetupDamaged(EnSnowman* this) { Animation_PlayLoop(&this->skelAnime, &gEenoDamageAnim); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); this->collider.base.acFlags &= ~AC_ON; this->work.timer = 20; this->actor.draw = EnSnowman_Draw; this->actor.scale.y = this->actor.scale.x; - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; func_800BE504(&this->actor, &this->collider); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_DAMAGE); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_MINI_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_MINI_DAMAGE); } this->actionFunc = EnSnowman_Damaged; @@ -695,7 +696,7 @@ void EnSnowman_Damaged(EnSnowman* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); rotationalVelocityScale = CLAMP_MAX(this->work.timer, 10); this->actor.shape.rot.y += rotationalVelocityScale * 0x300; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { Math_StepToF(&this->actor.scale.y, 1.3f * 0.01f, 0.7f * 0.001f); @@ -706,7 +707,7 @@ void EnSnowman_Damaged(EnSnowman* this, PlayState* play) { if (this->work.timer > 0) { this->work.timer--; } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YMAJIN_SPLIT); + Actor_PlaySfx(&this->actor, NA_SE_EN_YMAJIN_SPLIT); EnSnowman_SpawnCircularDustEffect(this, play); this->drawDmgEffAlpha = 0.0f; EnSnowman_CreateSplitEeno((EnSnowman*)this->actor.parent, &this->actor.world.pos, @@ -844,7 +845,7 @@ void EnSnowman_CreateSplitEeno(EnSnowman* this, Vec3f* basePos, s32 yRot) { * target scale increases. */ void EnSnowman_AbsorbEeno(EnSnowman* smallerEeno, EnSnowman* largerEeno) { - Actor_PlaySfxAtPos(&largerEeno->actor, NA_SE_EN_YMAJIN_UNITE); + Actor_PlaySfx(&largerEeno->actor, NA_SE_EN_YMAJIN_UNITE); largerEeno->fwork.targetScaleDuringCombine += 0.005f; smallerEeno->combineState = EN_SNOWMAN_COMBINE_STATE_BEING_ABSORBED_OR_DONE; smallerEeno->collider.base.ocFlags1 &= ~OC1_HIT; @@ -877,11 +878,11 @@ void EnSnowman_SetupCombine(EnSnowman* this, PlayState* play, Vec3f* combinePos) //! @bug: If an Eeno is in the middle of submerging, its draw function will still be EnSnowman_Draw. //! It will call EnSnowman_SetupSubmerge again, resulting in the submerge animation playing twice. if (this->actor.draw == EnSnowman_DrawSnowPile) { - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actionFunc = EnSnowman_Combine; } else { this->isHoldingSnowball = false; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; // At this point, the combineState is EN_SNOWMAN_COMBINE_STATE_ACTIVE, and the actionFunc // will be set to EnSnowman_Submerge. When the submerging animation is complete with this @@ -902,7 +903,7 @@ void EnSnowman_Combine(EnSnowman* this, PlayState* play) { SkelAnime_Update(&this->snowPileSkelAnime); parent = (EnSnowman*)this->actor.parent; child = (EnSnowman*)this->actor.child; - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->combinePos), 0x1000); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->combinePos), 0x1000); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->combineState == EN_SNOWMAN_COMBINE_STATE_ACTIVE) { @@ -940,8 +941,8 @@ void EnSnowman_Combine(EnSnowman* this, PlayState* play) { this->fwork.targetScaleDuringCombine = 0.0f; } - if (Actor_XZDistanceToPoint(&this->actor, &this->combinePos) < 20.0f) { - this->actor.speedXZ = 0.0f; + if (Actor_WorldDistXZToPoint(&this->actor, &this->combinePos) < 20.0f) { + this->actor.speed = 0.0f; } if (Math_StepToF(&this->actor.scale.x, this->fwork.targetScaleDuringCombine, 0.0005f)) { @@ -976,15 +977,15 @@ void EnSnowman_UpdateDamage(EnSnowman* this, PlayState* play) { if ((this->actionFunc == EnSnowman_MoveSnowPile) || (this->actionFunc == EnSnowman_Combine)) { EnSnowman_SetupEmerge(this, play); } else if (this->actor.colChkInfo.damageEffect == EN_SNOWMAN_DMGEFF_STUN) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); EnSnowman_SetupStun(this); } else if (this->actor.colChkInfo.damageEffect == EN_SNOWMAN_DMGEFF_ELECTRIC_STUN) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); EnSnowman_SetupStun(this); } else if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_LARGE) { if (this->isHoldingSnowball == true) { @@ -1080,9 +1081,9 @@ void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play) { this->collider.base.ocFlags1 |= OC1_ON; } - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->actor.bgCheckFlags & 0x10) || - (this->collider.base.atFlags & AT_HIT) || (this->collider.base.acFlags & AC_HIT) || - (this->collider.base.ocFlags1 & OC1_HIT)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->collider.base.atFlags & AT_HIT) || + (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { if (EN_SNOWMAN_GET_TYPE(&this->actor) == EN_SNOWMAN_TYPE_SMALL_SNOWBALL) { scale = 10; for (i = 0; i < 3; i++) { diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 035bc2bfa..e1ebc505c 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -487,7 +487,7 @@ s32 EnSob1_TestEndInteraction(EnSob1* this, PlayState* play, Input* input) { s32 EnSob1_TestCancelOption(EnSob1* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); return true; } return false; @@ -504,7 +504,7 @@ void EnSob1_SetupStartShopping(PlayState* play, EnSob1* this, u8 skipHello) { void EnSob1_StartShopping(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_FaceShopkeeper); - func_80151938(play, sFacingShopkeeperTextIds[this->shopType]); + Message_ContinueTextbox(play, sFacingShopkeeperTextIds[this->shopType]); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -513,7 +513,7 @@ void EnSob1_StartShopping(PlayState* play, EnSob1* this) { void EnSob1_TalkToShopkeeper(PlayState* play, EnSob1* this) { EnSob1_SetupAction(this, EnSob1_TalkingToShopkeeper); this->talkOptionTextId = EnSob1_GetTalkOption(this, play); - func_80151938(play, this->talkOptionTextId); + Message_ContinueTextbox(play, this->talkOptionTextId); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -738,9 +738,9 @@ void EnSob1_EndWalk(EnSob1* this, PlayState* play) { EnSob1_GetDistSqAndOrient(this->path, this->waypoint - 1, &this->actor.world.pos, &distSq), 4, 1000, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 0.5f, 0.2f, 1.0f); if (distSq < 12.0f) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (animLastFrame == curFrame) { EnSob1_ChangeAnim(&this->skelAnime, sAnimationInfoBombShopkeeper, BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_START); @@ -777,11 +777,11 @@ void EnSob1_Walk(EnSob1* this, PlayState* play) { EnSob1_GetDistSqAndOrient(this->path, this->waypoint, &this->actor.world.pos, &distSq), 4, 1000, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.speedXZ = 2.0f; + this->actor.speed = 2.0f; if (distSq < SQ(5.0f)) { this->waypoint++; if ((this->path->count - 1) < this->waypoint) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; EnSob1_SetupAction(this, EnSob1_EndWalk); } } @@ -842,7 +842,7 @@ void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80151938(play, 0x647); + Message_ContinueTextbox(play, 0x647); } else { func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } @@ -866,7 +866,7 @@ void EnSob1_LookToShelf(EnSob1* this, PlayState* play) { this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; EnSob1_UpdateCursorPos(play, this); EnSob1_SetupAction(this, EnSob1_BrowseShelf); - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -904,7 +904,7 @@ s32 EnSob1_HasPlayerSelectedItem(PlayState* play, EnSob1* this, Input* input) { if (EnSob1_TestItemSelected(play)) { if (!item->isOutOfStock) { this->prevActionFunc = this->actionFunc; - func_80151938(play, this->items[this->cursorIndex]->choiceTextId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->choiceTextId); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -938,7 +938,7 @@ void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { EnSob1_CursorLeftRight(play, this); cursorIndex = this->cursorIndex; if (cursorIndex != prevCursorIndex) { - func_80151938(play, this->items[cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[cursorIndex]->actor.textId); play_sound(NA_SE_SY_CURSOR); } } @@ -949,7 +949,7 @@ void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; @@ -959,12 +959,12 @@ void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { } void EnSob1_SetupCannotBuy(PlayState* play, EnSob1* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); EnSob1_SetupAction(this, EnSob1_CannotBuy); } void EnSob1_SetupCanBuy(PlayState* play, EnSob1* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); EnSob1_SetupAction(this, EnSob1_CanBuy); } @@ -1050,7 +1050,7 @@ void EnSob1_SelectItem(EnSob1* this, PlayState* play) { case 1: func_8019F230(); this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); break; } } @@ -1061,7 +1061,7 @@ void EnSob1_CannotBuy(EnSob1* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } } @@ -1075,7 +1075,7 @@ void EnSob1_CanBuy(EnSob1* this, PlayState* play) { item = this->items[this->cursorIndex]; item->restockFunc(play, item); this->actionFunc = this->prevActionFunc; - func_80151938(play, this->items[this->cursorIndex]->actor.textId); + Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } } @@ -1084,7 +1084,7 @@ void EnSob1_BuyItemWithFanfare(EnSob1* this, PlayState* play) { this->actor.parent = NULL; EnSob1_SetupAction(this, EnSob1_SetupItemPurchased); } else { - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); } } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 233c6c811..18031242c 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -228,7 +228,7 @@ void EnSsh_SetWaitAnimation(EnSsh* this) { } void EnSsh_SetReturnAnimation(EnSsh* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_UP); EnSsh_ChangeAnim(this, SSH_ANIM_UP); } @@ -282,7 +282,7 @@ void EnSsh_SetColliderScale(EnSsh* this, f32 arg1, f32 arg2) { s32 EnSsh_Damaged(EnSsh* this) { if ((this->stunTimer == 120) && (this->stateFlags & SSH_STATE_STUNNED)) { - Actor_SetColorFilter(&this->actor, 0, 200, 0, this->stunTimer); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, this->stunTimer); } if (DECR(this->stunTimer) != 0) { @@ -297,8 +297,8 @@ s32 EnSsh_Damaged(EnSsh* this) { this->spinTimer = 30; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_ROLL); - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_ST_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_VO_ST_ATTACK); return true; } @@ -477,8 +477,8 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, PlayState* play) { this->spinTimer = this->hitTimer; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_ROLL); - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_ST_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_VO_ST_ATTACK); play->damagePlayer(play, -8); @@ -532,8 +532,8 @@ s32 EnSsh_CheckHitBack(EnSsh* this, PlayState* play) { } if (this->stunTimer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_ST_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_VO_ST_DAMAGE); } EnSsh_SetStunned(this); @@ -553,8 +553,8 @@ s32 EnSsh_CollisionCheck(EnSsh* this, PlayState* play) { if (play->actorCtx.unk2 != 0) { this->invincibilityTimer = 8; if (this->stunTimer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_ST_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_VO_ST_DAMAGE); } EnSsh_SetStunned(this); this->stateFlags |= SSH_STATE_STUNNED; @@ -654,7 +654,7 @@ void EnSsh_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->initialYaw = this->actor.world.rot.y; EnSsh_SetupAction(this, EnSsh_Start); - if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { Actor_Kill(&this->actor); } } @@ -686,19 +686,19 @@ void EnSsh_Talk(EnSsh* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x904: - case 0x905: - case 0x906: - case 0x908: - case 0x910: - case 0x911: - case 0x912: - case 0x914: - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x904: // (does not exist) + case 0x905: // (does not exist) + case 0x906: // (does not exist) + case 0x908: // (does not exist) + case 0x910: // Help me! I am not a monster, I was cursed this way + case 0x911: // Find all in here and defeat them + case 0x912: // Don't forget to collect their token + case 0x914: // In here, cursed spiders, defeat them to make me normal + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - default: - func_801477B4(play); + default: // intended case 0x915 from above (914+1) + Message_CloseTextbox(play); this->actionFunc = EnSsh_Idle; break; } @@ -706,15 +706,15 @@ void EnSsh_Talk(EnSsh* this, PlayState* play) { } void func_809756D0(EnSsh* this, PlayState* play) { - u16 phi_a1; + u16 nextTextId; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { - phi_a1 = 0x914; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) { + nextTextId = 0x914; // In here, cursed spiders, defeat them to make me normal } else { - phi_a1 = 0x910; - SET_WEEKEVENTREG(WEEKEVENTREG_34_08); + nextTextId = 0x910; // Help me! I am not a monster, I was cursed this way + SET_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED); } - Message_StartTextbox(play, phi_a1, &this->actor); + Message_StartTextbox(play, nextTextId, &this->actor); } void EnSsh_Idle(EnSsh* this, PlayState* play) { @@ -739,7 +739,7 @@ void EnSsh_Idle(EnSsh* this, PlayState* play) { } if (DECR(this->sfxTimer) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_LAUGH); this->sfxTimer = 64; } @@ -780,7 +780,7 @@ void EnSsh_Drop(EnSsh* this, PlayState* play) { EnSsh_SetLandAnimation(this); EnSsh_SetupAction(this, EnSsh_Land); } else if (DECR(this->sfxTimer) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_DOWN); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_DOWN); this->sfxTimer = 3; } } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 094c63f7e..6f19a5e51 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -2,6 +2,8 @@ #define Z_EN_SSH_H #include "global.h" +#include "overlays/actors/ovl_En_Si/z_en_si.h" +#include "overlays/actors/ovl_En_Sth/z_en_sth.h" struct EnSsh; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 14e0c1cb5..987558e3f 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -348,7 +348,7 @@ s16 func_808A5BEC(EnSt* this) { } else { ret = this->actor.yawTowardsPlayer; if (DECR(this->unk_30E) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_ROLL); this->unk_18C ^= 2; this->unk_310 = 8; if (this->unk_18C & 1) { @@ -456,7 +456,7 @@ void func_808A60E0(EnSt* this) { if (sp1C == 1.0f) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } this->unk_2D4 = (1.0f - sp1C) * sp20 * this->unk_2C8; @@ -587,23 +587,26 @@ s32 func_808A6580(EnSt* this, PlayState* play) { } else if (func_808A61F4(this)) { switch (this->actor.colChkInfo.damageEffect) { case 1: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->unk_312 = 40; - Actor_SetColorFilter(&this->actor, 0, 200, 0, this->unk_312); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, + this->unk_312); break; case 5: this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->unk_312 = 40; func_808A576C(this); - Actor_SetColorFilter(&this->actor, 0, 200, 0, this->unk_312); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, + this->unk_312); break; default: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_DAMAGE); this->unk_314 = 20; this->unk_312 = 0; - Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_314); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, + this->unk_314); SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 1); this->unk_18C |= 8; this->actionFunc = func_808A6D84; @@ -652,7 +655,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { } this->unk_314 = 20; this->unk_312 = 0; - Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_314); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, this->unk_314); ret = true; } this->unk_310 = 0; @@ -663,7 +666,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if ((this->unk_316 == 0) && (this->unk_314 == 0) && (this->unk_312 == 0) && !(this->collider1.base.atFlags & AT_BOUNCED) && (this->actor.colChkInfo.health != 0)) { play->damagePlayer(play, -8); - Actor_PlaySfxAtPos(&sp3C->actor, NA_SE_PL_BODY_HIT); + Actor_PlaySfx(&sp3C->actor, NA_SE_PL_BODY_HIT); func_800B8D98(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_316 = 10; this->unk_18C |= 1; @@ -699,7 +702,7 @@ void func_808A6A78(EnSt* this, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (ENST_GET_1C0(&this->actor) == ENST_1C0_1) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; } Actor_SetScale(&this->actor, 0.04f); @@ -776,15 +779,15 @@ void func_808A6E24(EnSt* this, PlayState* play) { this->unk_2CC = 0.0f; this->unk_2D4 = 0.0f; } else { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.shape.yOffset = 400.0f; this->actor.world.rot.x = 0x4000; this->actor.shape.rot.x = this->actor.world.rot.x; this->unk_2D0 = this->actor.velocity.y = fabsf(this->actor.velocity.y) * 0.6f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((s32)this->unk_2D0 != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } else { this->actor.velocity.y = 0.0f; this->actionFunc = func_808A701C; @@ -864,8 +867,8 @@ void EnSt_Update(Actor* thisx, PlayState* play) { return; } - if (!(this->actor.flags & ACTOR_FLAG_80) && func_808A6A3C(this)) { - this->actor.flags |= ACTOR_FLAG_80; + if (!(this->actor.flags & ACTOR_FLAG_REACT_TO_LENS) && func_808A6A3C(this)) { + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; } if (func_808A6580(this, play)) { diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 5d1bd1471..9048a1d0f 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -1,13 +1,13 @@ /* * File: z_en_sth.c * Overlay: ovl_En_Sth - * Description: Guy looking at moon in South Clock Town + * Description: Guy looking at moon in South Clock Town, + * And the Cured Swamp Spider House man who gives you Mask of Truth + * (the cursed version is EnSsh) + * And the man who wants to buy Oceanside Spider House from you with rupees or Wallet */ #include "z_en_sth.h" -#include "objects/object_sth/object_sth.h" -#include "objects/object_ahg/object_ahg.h" -#include "objects/object_mask_truth/object_mask_truth.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,17 +15,17 @@ void EnSth_Init(Actor* thisx, PlayState* play); void EnSth_Destroy(Actor* thisx, PlayState* play); -void EnSth_Update(Actor* thisx, PlayState* play); +void EnSth_UpdateWaitForObject(Actor* thisx, PlayState* play); -void func_80B67208(EnSth* this, PlayState* play); -void func_80B67540(EnSth* this, PlayState* play); -void func_80B677BC(EnSth* this, PlayState* play); -void func_80B678A8(EnSth* this, PlayState* play); -void func_80B67958(EnSth* this, PlayState* play); -void func_80B67C1C(EnSth* this, PlayState* play); -void func_80B67DA0(EnSth* this, PlayState* play); -void func_80B680A8(Actor* thisx, PlayState* play); -void func_80B6849C(Actor* thisx, PlayState* play); +void EnSth_PanicIdle(EnSth* this, PlayState* play); +void EnSth_HandleOceansideSpiderHouseConversation(EnSth* this, PlayState* play); +void EnSth_OceansideSpiderHouseIdle(EnSth* this, PlayState* play); +void EnSth_MoonLookingIdle(EnSth* this, PlayState* play); +void EnSth_DefaultIdle(EnSth* this, PlayState* play); +void EnSth_HandleSwampSpiderHouseConversation(EnSth* this, PlayState* play); +void EnSth_SwampSpiderHouseIdle(EnSth* this, PlayState* play); +void EnSth_Update(Actor* thisx, PlayState* play); +void EnSth_Draw(Actor* thisx, PlayState* play); ActorInit En_Sth_InitVars = { ACTOR_EN_STH, @@ -35,7 +35,7 @@ ActorInit En_Sth_InitVars = { sizeof(EnSth), (ActorFunc)EnSth_Init, (ActorFunc)EnSth_Destroy, - (ActorFunc)EnSth_Update, + (ActorFunc)EnSth_UpdateWaitForObject, (ActorFunc)NULL, }; @@ -61,21 +61,48 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -AnimationHeader* D_80B6D1C8[] = { - &ovl_En_Sth_Anim_003F50, &ovl_En_Sth_Anim_0045B4, &ovl_En_Sth_Anim_004CC0, &ovl_En_Sth_Anim_00533C, - &ovl_En_Sth_Anim_0059B8, &ovl_En_Sth_Anim_005E40, &ovl_En_Sth_Anim_006354, &ovl_En_Sth_Anim_00645C, +typedef enum { + /* 0 */ STH_ANIM_SIGNALLING, // default, waving arms at you from telescope, OOT: cured happy animation + /* 1 */ STH_ANIM_BENDING_DOWN, // default anim of cured spider house, but never seen before wait overrides it + /* 2 */ STH_ANIM_TALK, + /* 3 */ STH_ANIM_WAIT, + /* 4 */ STH_ANIM_LOOK_UP, // South Clock Town, looking at moon + /* 5 */ STH_ANIM_LOOK_AROUND, // checking out Oceanside Spider House + /* 6 */ STH_ANIM_PLEAD, // wants to buy Oceanside Spider House + /* 7 */ STH_ANIM_PANIC, // after buying Oceanside Spider House, can be found at bottom of slide, + /* 8 */ STH_ANIM_START, // set in init, not an actual index to the array +} EnSthAnimation; + +static AnimationHeader* sAnimationInfo[] = { + &gEnSthSignalAnim, &gEnSthBendDownAnim, &gEnSthTalkWithHandUpAnim, &gEnSthWaitAnim, + &gEnSthLookUpAnim, &gEnSthLookAroundAnim, &gEnSthPleadAnim, &gEnSthPanicAnim, }; -u16 D_80B6D1E8[] = { 0x1144, 0x1145, 0x1146 }; +// three slightly different variants of "Only a little time left, oh goddess please save me" +static u16 sSthOceanspiderhousePanicText[] = { 0x1144, 0x1145, 0x1146 }; -u16 D_80B6D1F0[] = { 0x1139, 0x113E, 0x1143 }; +static u16 sSthFirstOceansideSpiderHouseGreet2TextIds[] = { + 0x1139, // I thought I heard noises... I'm glad I found it early + 0x113E, // I had no idea this place was here, perhaps it can keep me safe + 0x1143 // There's no time we have to hide! +}; -u16 D_80B6D1F8[] = { 0x1132, 0x113A, 0x113F }; +static u16 sSthFirstOceansideSpiderHouseGreet1TextIds[] = { + 0x1132, // I thought I heard some noise.. is this some sort of underground shelter? + 0x113A, // I had no idea there was a basement here.. + 0x113F // I heard loud noises.. I never thought I'd find a place like this.. +}; -Vec3f D_80B6D200 = { 700.0f, 400.0f, 0.0f }; +static Vec3f sFocusOffset = { 700.0f, 400.0f, 0.0f }; -Color_RGB8 D_80B6D20C[] = { - { 190, 110, 0 }, { 0, 180, 110 }, { 0, 255, 0x50 }, { 255, 160, 60 }, { 190, 230, 250 }, { 240, 230, 120 }, +// Sth is hardcoded to only use element [1]. +static Color_RGB8 sShirtColors[] = { + { 190, 110, 0 }, // darker orange + { 0, 180, 110 }, // green + { 0, 255, 80 }, // lime green + { 255, 160, 60 }, // brighter orange + { 190, 230, 250 }, // white + { 240, 230, 120 }, // pale yellow }; void EnSth_Init(Actor* thisx, PlayState* play) { @@ -83,82 +110,88 @@ void EnSth_Init(Actor* thisx, PlayState* play) { EnSth* this = THIS; s32 objectId; - if (ENSTH_GET_100(&this->actor)) { + // this actor can draw two separate bodies that use different objects + if (STH_GET_SWAMP_BODY(&this->actor)) { objectId = Object_GetIndex(&play->objectCtx, OBJECT_AHG); } else { objectId = Object_GetIndex(&play->objectCtx, OBJECT_STH); } - this->unk_29E = objectId; - this->unk_29F = Object_GetIndex(&play->objectCtx, OBJECT_MASK_TRUTH); + this->mainObjectId = objectId; + this->maskOfTruthObjectId = Object_GetIndex(&play->objectCtx, OBJECT_MASK_TRUTH); Actor_SetScale(&this->actor, 0.01f); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - this->unk_29C = 0; - this->unk_29A = 8; + this->sthFlags = 0; // clear + this->animIndex = STH_ANIM_START; this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - switch (ENSTH_GET_F(&this->actor)) { - case ENSTH_F_1: + switch (STH_GET_TYPE(&this->actor)) { + case STH_TYPE_UNUSED_1: if (play->actorCtx.flags & ACTORCTX_FLAG_1) { this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); - this->actionFunc = func_80B67958; + this->actionFunc = EnSth_DefaultIdle; } else { Actor_Kill(&this->actor); return; } break; - case ENSTH_F_2: - if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { - this->actionFunc = func_80B67DA0; + case STH_TYPE_SWAMP_SPIDER_HOUSE_CURED: + if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { + this->actionFunc = EnSth_SwampSpiderHouseIdle; } else { Actor_Kill(&this->actor); } this->actor.textId = 0; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40) || !CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { - this->unk_29C |= 1; + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH) || + !CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) { + this->sthFlags |= STH_FLAG_DRAW_MASK_OF_TRUTH; } break; - case ENSTH_F_3: - if ((gSaveContext.save.skullTokenCount & 0xFFFF) >= 30) { + case STH_TYPE_MOON_LOOKING: // South Clock Town + if ((gSaveContext.save.skullTokenCount & 0xFFFF) >= SPIDER_HOUSE_TOKENS_REQUIRED) { Actor_Kill(&this->actor); return; } - this->actionFunc = func_80B678A8; - this->unk_29C |= 8; + + this->actionFunc = EnSth_MoonLookingIdle; + this->sthFlags |= STH_FLAG_DISABLE_HEAD_TRACK; this->actor.targetMode = 3; this->actor.uncullZoneForward = 800.0f; break; - case ENSTH_F_4: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_20)) { + case STH_TYPE_OCEANSIDE_SPIDER_HOUSE_GREET: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN)) { + // The player has already exited the house after complete; EnSth has moved deeper into the house. Actor_Kill(&this->actor); return; } this->actor.textId = 0; - this->actionFunc = func_80B677BC; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_80)) { - this->unk_29C |= 2; + this->actionFunc = EnSth_OceansideSpiderHouseIdle; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD)) { + this->sthFlags |= STH_FLAG_OCEANSIDE_SPIDER_HOUSE_GREET; } break; - case ENSTH_F_5: - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_13_20) || (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { + case STH_TYPE_OCEANSIDE_SPIDER_HOUSE_PANIC: + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN) || + (Inventory_GetSkullTokenCount(play->sceneId) < SPIDER_HOUSE_TOKENS_REQUIRED)) { + // Has not moved in, and has not completed the house; do NOT spawn yet. Actor_Kill(&this->actor); return; } - this->actionFunc = func_80B67208; + this->actionFunc = EnSth_PanicIdle; this->actor.textId = 0; - this->unk_29C |= 8; + this->sthFlags |= STH_FLAG_DISABLE_HEAD_TRACK; break; default: - this->actionFunc = func_80B67958; + this->actionFunc = EnSth_DefaultIdle; break; } } @@ -169,142 +202,144 @@ void EnSth_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -s32 func_80B6703C(EnSth* this, PlayState* play) { +s32 EnSth_CanSpeakToPlayer(EnSth* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x2000)) { return true; - } - return false; -} - -void func_80B670A4(EnSth* this, s16 arg1) { - if ((arg1 >= 0) && (arg1 < ARRAY_COUNT(D_80B6D1C8)) && (arg1 != this->unk_29A)) { - Animation_Change(&this->skelAnime, D_80B6D1C8[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80B6D1C8[arg1]), - ANIMMODE_LOOP, -5.0f); - this->unk_29A = arg1; + } else { + return false; } } -void func_80B67148(EnSth* this, PlayState* play) { +void EnSth_ChangeAnim(EnSth* this, s16 animIndex) { + if ((animIndex >= 0) && (animIndex < ARRAY_COUNT(sAnimationInfo)) && (animIndex != this->animIndex)) { + Animation_Change(&this->skelAnime, sAnimationInfo[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[animIndex]), ANIMMODE_LOOP, -5.0f); + this->animIndex = animIndex; + } +} + +void EnSth_GetInitialPanicText(EnSth* this, PlayState* play) { s32 day = CURRENT_DAY - 1; - u16 val; + u16 nextTextId; if (day < 0) { day = 0; } - val = D_80B6D1E8[day]; + nextTextId = sSthOceanspiderhousePanicText[day]; - Message_StartTextbox(play, val, &this->actor); + Message_StartTextbox(play, nextTextId, &this->actor); } -void func_80B671A0(EnSth* this, PlayState* play) { +void EnSth_HandlePanicConversation(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - this->actionFunc = func_80B67208; - func_801477B4(play); + this->actionFunc = EnSth_PanicIdle; + Message_CloseTextbox(play); } } -void func_80B67208(EnSth* this, PlayState* play) { +void EnSth_PanicIdle(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80B67148(this, play); - this->actionFunc = func_80B671A0; + EnSth_GetInitialPanicText(this, play); + this->actionFunc = EnSth_HandlePanicConversation; } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { func_800B8614(&this->actor, play, 110.0f); } } -void func_80B672A4(EnSth* this, PlayState* play) { - u16 sp1E; +void EnSth_GetInitialOceansideSpiderHouseText(EnSth* this, PlayState* play) { + u16 nextTextId; s32 day = CURRENT_DAY - 1; if (day < 0) { day = 0; } - if (this->unk_29C & 2) { + if (this->sthFlags & STH_FLAG_OCEANSIDE_SPIDER_HOUSE_GREET) { s32 pad; - sp1E = D_80B6D1F0[day]; + nextTextId = sSthFirstOceansideSpiderHouseGreet2TextIds[day]; if (day == 2) { - func_80B670A4(this, 5); + EnSth_ChangeAnim(this, STH_ANIM_LOOK_AROUND); } } else { - sp1E = D_80B6D1F8[day]; + nextTextId = sSthFirstOceansideSpiderHouseGreet1TextIds[day]; } - Message_StartTextbox(play, sp1E, &this->actor); + Message_StartTextbox(play, nextTextId, &this->actor); } -void func_80B67348(EnSth* this, PlayState* play) { - u16 phi_a1; +void EnSth_PostOceanspiderhouseReward(EnSth* this, PlayState* play) { + u16 nextTextId; SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - this->actionFunc = func_80B67540; + this->actionFunc = EnSth_HandleOceansideSpiderHouseConversation; - switch (this->actor.home.rot.z) { - case 8: - case 9: - phi_a1 = 0x1137; + switch (STH_GI_ID(&this->actor)) { + case GI_WALLET_ADULT: + case GI_WALLET_GIANT: + nextTextId = 0x1137; // I'm just glad it was something you needed break; - case 6: - phi_a1 = 0x1138; + case GI_RUPEE_SILVER: + // unused code, as he only gives wallet, purple and red, silver is never assigned to STH_GI_ID + nextTextId = 0x1138; // That's my life's fortune break; - case 5: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { - phi_a1 = 0x113D; + case GI_RUPEE_PURPLE: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE)) { + nextTextId = 0x113D; // That's my life's savings } else { - phi_a1 = 0x113C; + nextTextId = 0x113C; // That's my life's savings (2) } break; default: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { - phi_a1 = 0x1142; + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE)) { + nextTextId = 0x1142; // Well, thats all I have on me } else { - phi_a1 = 0x1141; + nextTextId = 0x1141; // Well, thats all I have on me } break; } - Message_StartTextbox(play, phi_a1, &this->actor); + Message_StartTextbox(play, nextTextId, &this->actor); } else { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } -void func_80B67458(EnSth* this, PlayState* play) { +void EnSth_GiveOceansideSpiderHouseReward(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->actionFunc = func_80B67348; + this->actionFunc = EnSth_PostOceanspiderhouseReward; this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); if (CURRENT_DAY == 3) { - func_80B670A4(this, 6); + EnSth_ChangeAnim(this, STH_ANIM_PLEAD); } else { - func_80B670A4(this, 3); + EnSth_ChangeAnim(this, STH_ANIM_WAIT); } } else { - Actor_PickUp(&this->actor, play, this->actor.home.rot.z, 10000.0f, 500.0f); + Actor_OfferGetItem(&this->actor, play, STH_GI_ID(&this->actor), 10000.0f, 500.0f); } } -void func_80B67540(EnSth* this, PlayState* play) { - s32 sp2C = CURRENT_DAY - 1; +void EnSth_HandleOceansideSpiderHouseConversation(EnSth* this, PlayState* play) { + s32 day = CURRENT_DAY - 1; - if (sp2C < 0) { - sp2C = 0; + if (day < 0) { + day = 0; } - if (this->unk_29A == 6) { + if (this->animIndex == STH_ANIM_PLEAD) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; } @@ -315,313 +350,329 @@ void func_80B67540(EnSth* this, PlayState* play) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x1134: - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x1134: // (does not exist) + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0x1132: - case 0x113A: - case 0x113F: - func_80151938(play, 0x1133); + case 0x1132: // Heard noise, came in to see + case 0x113A: // Had no idea there was a basement here + case 0x113F: // Heard noise... I never thought I'd find a place like this + Message_ContinueTextbox(play, 0x1133); // did you find this place? break; - case 0x1133: - func_80151938(play, 0x1136); - func_80B670A4(this, 6); + case 0x1133: // did you find this place? + Message_ContinueTextbox(play, 0x1136); // I want to buy this place from you + EnSth_ChangeAnim(this, STH_ANIM_PLEAD); break; - case 0x1136: - SET_WEEKEVENTREG(WEEKEVENTREG_13_80); + case 0x1136: // I want to buy this house from you + // This flag prevents multiple rewards, switching to secondary dialogue after + SET_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD); - switch (sp2C) { - case 0: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_40)) { - this->actor.home.rot.z = 6; + switch (day) { + case 0: // first day + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE)) { + STH_GI_ID(&this->actor) = GI_RUPEE_SILVER; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_13_40); + // This flag prevents getting two wallets from the same place. + // Instead, getting silver rupee above. + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE); switch (CUR_UPG_VALUE(UPG_WALLET)) { case 0: - this->actor.home.rot.z = 8; + STH_GI_ID(&this->actor) = GI_WALLET_ADULT; break; case 1: - this->actor.home.rot.z = 9; + STH_GI_ID(&this->actor) = GI_WALLET_GIANT; break; } } break; - case 1: - this->actor.home.rot.z = 5; + case 1: // second day + STH_GI_ID(&this->actor) = GI_RUPEE_PURPLE; break; - default: - this->actor.home.rot.z = 4; + default: // final day + STH_GI_ID(&this->actor) = GI_RUPEE_RED; break; } - func_801477B4(play); - this->actionFunc = func_80B67458; - func_80B67458(this, play); + Message_CloseTextbox(play); + this->actionFunc = EnSth_GiveOceansideSpiderHouseReward; + EnSth_GiveOceansideSpiderHouseReward(this, play); break; - case 0x113C: - func_80151938(play, 0x113B); + case 0x113C: // (Second day) I am giving you my life savings + Message_ContinueTextbox(play, 0x113B); // If only I had gotten here yesterday... break; - case 0x1141: - func_80151938(play, 0x1140); - func_80B670A4(this, 3); + case 0x1141: // (Final day) This is all I have + Message_ContinueTextbox(play, 0x1140); // If only I had gotten here two days ago... + EnSth_ChangeAnim(this, STH_ANIM_WAIT); break; default: - this->actionFunc = func_80B677BC; - func_801477B4(play); - this->unk_29C |= 2; + this->actionFunc = EnSth_OceansideSpiderHouseIdle; + Message_CloseTextbox(play); + this->sthFlags |= STH_FLAG_OCEANSIDE_SPIDER_HOUSE_GREET; break; } } break; case TEXT_STATE_CLOSING: - this->actionFunc = func_80B677BC; - this->unk_29C |= 2; + this->actionFunc = EnSth_OceansideSpiderHouseIdle; + this->sthFlags |= STH_FLAG_OCEANSIDE_SPIDER_HOUSE_GREET; break; } } -void func_80B677BC(EnSth* this, PlayState* play) { +void EnSth_OceansideSpiderHouseIdle(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80B672A4(this, play); - this->actionFunc = func_80B67540; - } else if (func_80B6703C(this, play)) { + EnSth_GetInitialOceansideSpiderHouseText(this, play); + this->actionFunc = EnSth_HandleOceansideSpiderHouseConversation; + } else if (EnSth_CanSpeakToPlayer(this, play)) { func_800B8614(&this->actor, play, 110.0f); } } -void func_80B67838(EnSth* this, PlayState* play) { +void EnSth_HandleMoonLookingConversation(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - this->actionFunc = func_80B678A8; - func_801477B4(play); + this->actionFunc = EnSth_MoonLookingIdle; + Message_CloseTextbox(play); } - this->unk_294.x = -0x1388; + this->headRot.x = -0x1388; } -void func_80B678A8(EnSth* this, PlayState* play) { +void EnSth_MoonLookingIdle(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->actionFunc = func_80B67838; - } else if (func_80B6703C(this, play) || this->actor.isTargeted) { + this->actionFunc = EnSth_HandleMoonLookingConversation; + } else if (EnSth_CanSpeakToPlayer(this, play) || this->actor.isTargeted) { if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { - this->actor.textId = 0x1130; + this->actor.textId = 0x1130; // Huh? The Moon... } else { - this->actor.textId = 0x1131; + this->actor.textId = 0x1131; // (The Moon) gotten bigger again } func_800B8614(&this->actor, play, 110.0f); } - this->unk_294.x = -0x1388; + this->headRot.x = -0x1388; } -void func_80B67958(EnSth* this, PlayState* play) { +// used by type: STH_TYPE_UNUSED_1 and undefined types +void EnSth_DefaultIdle(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } -void func_80B67984(EnSth* this, PlayState* play) { - u16 sp1E; +void EnSth_GetInitialSwampSpiderHouseText(EnSth* this, PlayState* play) { + u16 nextTextId; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_10)) { - sp1E = 0x903; - func_80B670A4(this, 2); + nextTextId = 0x903; // (does not exist) + EnSth_ChangeAnim(this, STH_ANIM_TALK); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_20)) { - sp1E = 0x90F; - func_80B670A4(this, 2); - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40)) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_08)) { - sp1E = 0x91B; + nextTextId = 0x90F; // (does not exist) + EnSth_ChangeAnim(this, STH_ANIM_TALK); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) { + nextTextId = 0x91B; // As soon as I calm down, getting rid of it } else { - sp1E = 0x918; + nextTextId = 0x918; // I've had enough of this, going home } - func_80B670A4(this, 2); - } else if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { + EnSth_ChangeAnim(this, STH_ANIM_TALK); + } else if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { if (INV_CONTENT(ITEM_MASK_TRUTH) == ITEM_MASK_TRUTH) { - this->unk_29C |= 4; - sp1E = 0x919; + this->sthFlags |= STH_FLAG_SWAMP_SPIDER_HOUSE_SAVED; + nextTextId = 0x919; // I've been saved! } else { - sp1E = 0x916; + nextTextId = 0x916; // I've been saved! (Duplicate) } } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_02)) { - sp1E = 0x8FF; + nextTextId = 0x8FF; // (does not exist) } else { - sp1E = 0x8FC; + nextTextId = 0x8FC; // (does not exist) SET_WEEKEVENTREG(WEEKEVENTREG_34_02); } - Message_StartTextbox(play, sp1E, &this->actor); + + Message_StartTextbox(play, nextTextId, &this->actor); } -void func_80B67AB4(EnSth* this, PlayState* play) { +void EnSth_TalkAfterSwampSpiderHouseGiveMask(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - this->actionFunc = func_80B67C1C; - SET_WEEKEVENTREG(WEEKEVENTREG_34_40); - Message_StartTextbox(play, 0x918, &this->actor); + this->actionFunc = EnSth_HandleSwampSpiderHouseConversation; + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH); + Message_StartTextbox(play, 0x918, &this->actor); // I've had enough of this, going home } else { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } } -void func_80B67B50(EnSth* this, PlayState* play) { +void EnSth_SwampSpiderHouseGiveMask(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->actionFunc = func_80B67AB4; + this->actionFunc = EnSth_TalkAfterSwampSpiderHouseGiveMask; this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - this->unk_29C &= ~1; - SET_WEEKEVENTREG(WEEKEVENTREG_34_08); - Actor_PickUp(&this->actor, play, GI_MASK_TRUTH, 10000.0f, 50.0f); + this->sthFlags &= ~STH_FLAG_DRAW_MASK_OF_TRUTH; + // This flag is used to keep track if the player has already spoken to the actor, triggering secondary dialogue. + SET_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED); + Actor_OfferGetItem(&this->actor, play, GI_MASK_TRUTH, 10000.0f, 50.0f); } } -void func_80B67C1C(EnSth* this, PlayState* play) { +void EnSth_HandleSwampSpiderHouseConversation(EnSth* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x90C: - func_80B670A4(this, 2); - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x90C: // (does not exist) + EnSth_ChangeAnim(this, STH_ANIM_TALK); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0x916: - case 0x919: - func_80B670A4(this, 3); - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x916: // I have been saved! I thought I was doomed + case 0x919: // I have been saved! I thought I was doomed (duplicate) + EnSth_ChangeAnim(this, STH_ANIM_WAIT); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0x8FC: - case 0x8FD: - case 0x900: - case 0x90A: - case 0x90D: - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x8FC: // (does not exist) + case 0x8FD: // (does not exist) + case 0x900: // (does not exist) + case 0x90A: // (does not exist) + case 0x90D: // (does not exist) + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0x901: - case 0x90B: - case 0x917: - func_801477B4(play); - this->actionFunc = func_80B67B50; - func_80B67B50(this, play); + case 0x901: // (does not exist) + case 0x90B: // (does not exist) + case 0x917: // Someone gave me this mask and said it would make me rich, Take it + Message_CloseTextbox(play); + this->actionFunc = EnSth_SwampSpiderHouseGiveMask; + EnSth_SwampSpiderHouseGiveMask(this, play); break; - case 0x91A: - SET_WEEKEVENTREG(WEEKEVENTREG_34_40); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_34_08); + case 0x91A: // Someone gave me this mask and said it would make me rich, getting rid of it + SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED); - case 0x902: - case 0x903: - case 0x90E: - case 0x90F: - case 0x918: - case 0x91B: - func_80B670A4(this, 3); + case 0x902: // (does not exist) + case 0x903: // (does not exist) + case 0x90E: // (does not exist) + case 0x90F: // (does not exist) + case 0x918: // I have had enough, going home + case 0x91B: // As soon as I calm down, getting rid of it + EnSth_ChangeAnim(this, STH_ANIM_WAIT); default: this->actor.flags &= ~ACTOR_FLAG_10000; - func_801477B4(play); - this->actionFunc = func_80B67DA0; + Message_CloseTextbox(play); + this->actionFunc = EnSth_SwampSpiderHouseIdle; break; } } } -void func_80B67DA0(EnSth* this, PlayState* play) { +void EnSth_SwampSpiderHouseIdle(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80B67984(this, play); - this->actionFunc = func_80B67C1C; - } else if (func_80B6703C(this, play)) { + EnSth_GetInitialSwampSpiderHouseText(this, play); + this->actionFunc = EnSth_HandleSwampSpiderHouseConversation; + } else if (EnSth_CanSpeakToPlayer(this, play)) { this->actor.textId = 0; func_800B8614(&this->actor, play, 110.0f); } } -void func_80B67E20(Actor* thisx, PlayState* play) { +/** + * Oceanside Spider House EnSth shows up after you collect all 30 tokens. + * Here we wait invisible until the player has finished. + */ +void EnSth_UpdateOceansideSpiderHouseWaitForTokens(Actor* thisx, PlayState* play) { EnSth* this = THIS; - if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { - this->actor.update = func_80B680A8; - this->actor.draw = func_80B6849C; + if (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED) { + this->actor.update = EnSth_Update; + this->actor.draw = EnSth_Draw; this->actor.flags |= ACTOR_FLAG_1; } } -void EnSth_Update(Actor* thisx, PlayState* play) { +/** + * Dual object actors have to wait for the object to finish loading. + * This dev chose to use a temporary update instead of temporary actionFunc. + */ +void EnSth_UpdateWaitForObject(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - if (Object_IsLoaded(&play->objectCtx, this->unk_29E)) { - this->actor.objBankIndex = this->unk_29E; + if (Object_IsLoaded(&play->objectCtx, this->mainObjectId)) { + this->actor.objBankIndex = this->mainObjectId; Actor_SetObjectDependency(play, &this->actor); - if (ENSTH_GET_100(&this->actor)) { - SkelAnime_InitFlex(play, &this->skelAnime, &object_ahg_Skel_005998, &ovl_En_Sth_Anim_0045B4, - this->jointTable, this->morphTable, 16); - Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); - this->unk_29A = 1; + if (STH_GET_SWAMP_BODY(&this->actor)) { + SkelAnime_InitFlex(play, &this->skelAnime, &gAhgSkel, &gEnSthBendDownAnim, this->jointTable, + this->morphTable, AHG_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gEnSthBendDownAnim); + this->animIndex = STH_ANIM_BENDING_DOWN; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_10) || CHECK_WEEKEVENTREG(WEEKEVENTREG_34_20) || - CHECK_WEEKEVENTREG(WEEKEVENTREG_34_40) || (Inventory_GetSkullTokenCount(play->sceneId) >= 30)) { - func_80B670A4(this, 3); + CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH) || + (Inventory_GetSkullTokenCount(play->sceneId) >= SPIDER_HOUSE_TOKENS_REQUIRED)) { + EnSth_ChangeAnim(this, STH_ANIM_WAIT); } } else { - SkelAnime_InitFlex(play, &this->skelAnime, &object_sth_Skel_0031F8, &ovl_En_Sth_Anim_003F50, - this->jointTable, this->morphTable, 16); - Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_003F50); + SkelAnime_InitFlex(play, &this->skelAnime, &gSthSkel, &gEnSthSignalAnim, this->jointTable, this->morphTable, + STH_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gEnSthSignalAnim); } - this->actor.update = func_80B680A8; - this->actor.draw = func_80B6849C; + this->actor.update = EnSth_Update; + this->actor.draw = EnSth_Draw; - switch (ENSTH_GET_F(&this->actor)) { - case ENSTH_F_3: - func_80B670A4(this, 4); + switch (STH_GET_TYPE(&this->actor)) { + case STH_TYPE_MOON_LOOKING: + EnSth_ChangeAnim(this, STH_ANIM_LOOK_UP); break; - case ENSTH_F_4: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_80)) { - func_80B670A4(this, 5); + case STH_TYPE_OCEANSIDE_SPIDER_HOUSE_GREET: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD)) { + EnSth_ChangeAnim(this, STH_ANIM_LOOK_AROUND); } else { - func_80B670A4(this, 5); + EnSth_ChangeAnim(this, STH_ANIM_LOOK_AROUND); } break; - case ENSTH_F_5: - func_80B670A4(this, 7); + case STH_TYPE_OCEANSIDE_SPIDER_HOUSE_PANIC: + EnSth_ChangeAnim(this, STH_ANIM_PANIC); break; } - if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { - this->actor.update = func_80B67E20; + // not ready to appear yet + if ((STH_GET_TYPE(&this->actor) == STH_TYPE_OCEANSIDE_SPIDER_HOUSE_GREET) && + (Inventory_GetSkullTokenCount(play->sceneId) < SPIDER_HOUSE_TOKENS_REQUIRED)) { + this->actor.update = EnSth_UpdateOceansideSpiderHouseWaitForTokens; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; } } } -void func_80B680A8(Actor* thisx, PlayState* play) { +void EnSth_Update(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; - Vec3s sp38; Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); @@ -630,59 +681,66 @@ void func_80B680A8(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (func_80B6703C(this, play) && !(this->unk_29C & 8) && (this->unk_29A != 5)) { - sp38.x = sp38.y = sp38.z = 0; + if (EnSth_CanSpeakToPlayer(this, play) && !(this->sthFlags & STH_FLAG_DISABLE_HEAD_TRACK) && + (this->animIndex != STH_ANIM_LOOK_AROUND)) { + Vec3s torsoRot; - Actor_TrackPlayer(play, &this->actor, &this->unk_294, &sp38, this->actor.focus.pos); + torsoRot.x = torsoRot.y = torsoRot.z = 0; // this should block torso rot from working + + Actor_TrackPlayer(play, &this->actor, &this->headRot, &torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk_294.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_294.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); } } -s32 func_80B681E8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; EnSth* this = THIS; - if (limbIndex == 15) { - rot->x += this->unk_294.y; - rot->z += this->unk_294.x; - *dList = ovl_En_Sth_DL_0034A0; + if (limbIndex == STH_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; + + // object_sth body has no head by default, forced here from overlay data + *dList = gEnSthHeadDL; } - if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { + if ((limbIndex == STH_LIMB_CHEST) || (limbIndex == STH_LIMB_LEFT_FOREARM) || + (limbIndex == STH_LIMB_RIGHT_FOREARM)) { rot->y += (s16)(Math_SinS(play->state.frames * ((limbIndex * 50) + 0x814)) * 200.0f); rot->z += (s16)(Math_CosS(play->state.frames * ((limbIndex * 50) + 0x940)) * 200.0f); } + return false; } -void func_80B68310(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void EnSth_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSth* this = THIS; - if (limbIndex == 15) { + if (limbIndex == STH_LIMB_HEAD) { s32 pad; - Matrix_MultVec3f(&D_80B6D200, &this->actor.focus.pos); + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); - if (!ENSTH_GET_100(&this->actor)) { + if (!STH_GET_SWAMP_BODY(&this->actor)) { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Sth_DL_0037C0); + gSPDisplayList(POLY_OPA_DISP++, gEnSthExtraHairDL); CLOSE_DISPS(play->state.gfxCtx); } else { OPEN_DISPS(play->state.gfxCtx); - if (this->unk_29C & 1) { - if (Object_IsLoaded(&play->objectCtx, this->unk_29F)) { + if (this->sthFlags & STH_FLAG_DRAW_MASK_OF_TRUTH) { + if (Object_IsLoaded(&play->objectCtx, this->maskOfTruthObjectId)) { Matrix_Push(); Matrix_RotateZS(0x3A98, MTXMODE_APPLY); Matrix_Translate(0.0f, 190.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(POLY_OPA_DISP++, 0x0A, play->objectCtx.status[this->unk_29F].segment); + gSPSegment(POLY_OPA_DISP++, 0x0A, play->objectCtx.status[this->maskOfTruthObjectId].segment); gSPDisplayList(POLY_OPA_DISP++, object_mask_truth_DL_0001A0); Matrix_Pop(); @@ -694,7 +752,7 @@ void func_80B68310(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto } } -void func_80B6849C(Actor* thisx, PlayState* play) { +void EnSth_Draw(Actor* thisx, PlayState* play) { s32 pad; EnSth* this = THIS; @@ -703,11 +761,11 @@ void func_80B6849C(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, - Gfx_EnvColor(play->state.gfxCtx, D_80B6D20C[1].r, D_80B6D20C[1].g, D_80B6D20C[1].b, 255)); + Gfx_EnvColor(play->state.gfxCtx, sShirtColors[1].r, sShirtColors[1].g, sShirtColors[1].b, 255)); gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 90, 110, 130, 255)); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B681E8, func_80B68310, &this->actor); + EnSth_OverrideLimbDraw, EnSth_PostLimbDraw, &this->actor); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/src/overlays/actors/ovl_En_Sth/z_en_sth.h index 857b92505..1c8c92852 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -2,33 +2,48 @@ #define Z_EN_STH_H #include "global.h" +#include "overlays/actors/ovl_En_Si/z_en_si.h" +#include "objects/object_sth/object_sth.h" +#include "objects/object_ahg/object_ahg.h" +#include "objects/object_mask_truth/object_mask_truth.h" struct EnSth; typedef void (*EnSthActionFunc)(struct EnSth*, PlayState*); -#define ENSTH_GET_F(thisx) ((thisx)->params & 0xF) -#define ENSTH_GET_100(thisx) ((thisx)->params & 0x100) +typedef enum { + /* 1 */ STH_TYPE_UNUSED_1 = 1, + /* 2 */ STH_TYPE_SWAMP_SPIDER_HOUSE_CURED, // cursed is EnSsh + /* 3 */ STH_TYPE_MOON_LOOKING, // South Clock Town, looking up at the moon + /* 4 */ STH_TYPE_OCEANSIDE_SPIDER_HOUSE_GREET, // looking for shelter + /* 5 */ STH_TYPE_OCEANSIDE_SPIDER_HOUSE_PANIC, // shelter was not enough + // Other values: Actor will spawn and animate with arm waving, no further interaction. +} EnSthTypes; -enum { - /* 1 */ ENSTH_F_1 = 1, - /* 2 */ ENSTH_F_2, - /* 3 */ ENSTH_F_3, - /* 4 */ ENSTH_F_4, - /* 5 */ ENSTH_F_5, -}; +// Note: Vanilla types usually have 0xFEXX typing, but this upper section is unused by the code, reason unknown +#define STH_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define STH_GET_SWAMP_BODY(thisx) ((thisx)->params & 0x100) + +// The get item ID for the reward for Oceanside Spider House (wallet, or rupees) is set here +#define STH_GI_ID(thisx) ((thisx)->home.rot.z) + +// This actor has its own flags system +#define STH_FLAG_DRAW_MASK_OF_TRUTH (1 << 0) +#define STH_FLAG_OCEANSIDE_SPIDER_HOUSE_GREET (1 << 1) +#define STH_FLAG_SWAMP_SPIDER_HOUSE_SAVED (1 << 2) // set, but not read +#define STH_FLAG_DISABLE_HEAD_TRACK (1 << 3) typedef struct EnSth { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; /* 0x190 */ SkelAnime skelAnime; - /* 0x1D4 */ Vec3s jointTable[16]; - /* 0x234 */ Vec3s morphTable[16]; - /* 0x294 */ Vec3s unk_294; - /* 0x29A */ s16 unk_29A; - /* 0x29C */ u16 unk_29C; - /* 0x29E */ u8 unk_29E; - /* 0x29F */ u8 unk_29F; + /* 0x1D4 */ Vec3s jointTable[STH_LIMB_MAX]; + /* 0x234 */ Vec3s morphTable[STH_LIMB_MAX]; + /* 0x294 */ Vec3s headRot; + /* 0x29A */ s16 animIndex; + /* 0x29C */ u16 sthFlags; + /* 0x29E */ u8 mainObjectId; + /* 0x29F */ u8 maskOfTruthObjectId; /* 0x2A0 */ EnSthActionFunc actionFunc; } EnSth; // size = 0x2A4 diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c index ac615a8dd..ba6d72cb6 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c @@ -63,8 +63,8 @@ void EnSth2_Update(Actor* thisx, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->actor.objBankIndex = this->objIndex; Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &object_sth_Skel_0031F8, &gEnSth2WavingHandAnim, this->jointTable, - this->morphTable, OBJECT_STH_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gSthSkel, &gEnSth2WavingHandAnim, this->jointTable, + this->morphTable, STH_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gEnSth2WavingHandAnim); this->actor.update = EnSth2_UpdateActionFunc; this->actor.draw = EnSth2_Draw; @@ -80,10 +80,11 @@ void EnSth2_UpdateActionFunc(Actor* thisx, PlayState* play) { s32 EnSth2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 pad; - if (limbIndex == OBJECT_STH_LIMB_0F) { + if (limbIndex == STH_LIMB_HEAD) { *dList = gEnSth2HeadDL; } - if ((limbIndex == OBJECT_STH_LIMB_08) || (limbIndex == OBJECT_STH_LIMB_0A) || (limbIndex == OBJECT_STH_LIMB_0D)) { + if ((limbIndex == STH_LIMB_CHEST) || (limbIndex == STH_LIMB_LEFT_FOREARM) || + (limbIndex == STH_LIMB_RIGHT_FOREARM)) { rot->y += (s16)(Math_SinS((play->state.frames * ((limbIndex * 50) + 0x814))) * 200.0f); rot->z += (s16)(Math_CosS((play->state.frames * ((limbIndex * 50) + 0x940))) * 200.0f); } @@ -93,7 +94,7 @@ s32 EnSth2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnSth2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f focusOffset = { 700.0f, 400.0f, 0.0f }; - if (limbIndex == OBJECT_STH_LIMB_0F) { + if (limbIndex == STH_LIMB_HEAD) { Matrix_MultVec3f(&focusOffset, &thisx->focus.pos); OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h index 265332ffd..d8ecc9cdb 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h @@ -11,8 +11,8 @@ typedef void (*EnSth2ActionFunc)(struct EnSth2*, PlayState*); typedef struct EnSth2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[OBJECT_STH_LIMB_MAX]; - /* 0x1E8 */ Vec3s morphTable[OBJECT_STH_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[STH_LIMB_MAX]; + /* 0x1E8 */ Vec3s morphTable[STH_LIMB_MAX]; /* 0x248 */ s16 unused; /* 0x24A */ u8 objIndex; /* 0x24C */ EnSth2ActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 36dd9398e..93e68a83f 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -6,7 +6,7 @@ #include "z_en_stone_heishi.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnStoneheishi*)thisx) @@ -164,7 +164,7 @@ void func_80BC94B0(EnStoneheishi* this) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40)) { // After drinking bottle EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_CHEER_WITH_SPEAR); this->textIdIndex = 8; - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; } else { // Initial configuration EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_WAVE); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_80)) { @@ -186,13 +186,13 @@ void func_80BC9560(EnStoneheishi* this, PlayState* play) { } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40) && (play->actorCtx.lensMaskSize != 100)) { - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; return; } SkelAnime_Update(&this->skelAnime); - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)); @@ -229,7 +229,7 @@ void func_80BC9680(EnStoneheishi* this, PlayState* play) { this->textIdSet = true; player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex]; - func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]); + Message_ContinueTextbox(play, sEnStoneHeishiTextIds[this->textIdIndex]); func_80151BB4(play, 0x12); } } @@ -237,10 +237,10 @@ void func_80BC9680(EnStoneheishi* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); if (this->textIdIndex == 2) { - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); EnStoneheishi_SetupCheckGivenItem(this); } else if (this->textIdIndex == 3) { func_80BC94B0(this); @@ -254,7 +254,7 @@ void func_80BC9680(EnStoneheishi* this, PlayState* play) { func_80BC94B0(this); return; } - func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]); + Message_ContinueTextbox(play, sEnStoneHeishiTextIds[this->textIdIndex]); } } } @@ -274,7 +274,7 @@ void EnStoneheishi_CheckGivenItem(EnStoneheishi* this, PlayState* play) { if (itemAction > PLAYER_IA_NONE) { this->timer = 40; - func_801477B4(play); + Message_CloseTextbox(play); if ((itemAction == PLAYER_IA_BOTTLE_POTION_RED) || (itemAction == PLAYER_IA_BOTTLE_POTION_BLUE)) { this->playerGivesBluePotion = false; @@ -292,7 +292,7 @@ void EnStoneheishi_CheckGivenItem(EnStoneheishi* this, PlayState* play) { this->actionFunc = func_80BC9680; } } else if (itemAction <= PLAYER_IA_MINUS1) { - func_801477B4(play); + Message_CloseTextbox(play); func_80151BB4(play, 0x12); func_80BC94B0(this); } @@ -314,7 +314,7 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { case EN_STONE_DRINK_BOTTLE_INITIAL: if (this->timer == 0) { this->textIdIndex = 4; - func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]); + Message_ContinueTextbox(play, sEnStoneHeishiTextIds[this->textIdIndex]); player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex]; this->drinkBottleState++; } @@ -346,7 +346,7 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { if (this->timer != 0) { if ((this->timer < 10) && (this->bottleDisplay != EN_STONE_BOTTLE_EMPTY)) { this->bottleDisplay = EN_STONE_BOTTLE_EMPTY; - Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_NP_DRINK); + Actor_PlaySfx(&this->actor, NA_SE_VO_NP_DRINK); Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); } } else { @@ -366,7 +366,7 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { case EN_STONE_DRINK_BOTTLE_STANDING: if (this->endFrame <= currentFrame) { this->textIdIndex = 5; - func_80151938(play, sEnStoneHeishiTextIds[this->textIdIndex]); + Message_ContinueTextbox(play, sEnStoneHeishiTextIds[this->textIdIndex]); player->actor.textId = sEnStoneHeishiTextIds[this->textIdIndex]; EnStoneheishi_ChangeAnim(this, EN_STONE_HEISHI_ANIM_STAND_HAND_ON_HIP); this->action = EN_STONE_ACTION_1; @@ -377,12 +377,12 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { } void EnStoneheishi_GiveItemReward(EnStoneheishi* this, PlayState* play) { - func_801477B4(play); + Message_CloseTextbox(play); if (INV_CONTENT(ITEM_MASK_STONE) == ITEM_MASK_STONE) { - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f); } this->action = EN_STONE_ACTION_4; @@ -401,9 +401,9 @@ void func_80BC9D28(EnStoneheishi* this, PlayState* play) { func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_IA_MINUS1); this->actionFunc = func_80BC9E50; } else if (INV_CONTENT(ITEM_MASK_STONE) == ITEM_MASK_STONE) { - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_STONE, 300.0f, 300.0f); } } diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index c4d56b70a..edbf581f9 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -18,8 +18,22 @@ void EnStopheishi_Draw(Actor* thisx, PlayState* play); void func_80AE7F34(EnStopheishi* this, PlayState* play); void func_80AE85C4(EnStopheishi* this, PlayState* play); +void func_80AE7E9C(EnStopheishi* this); +void func_80AE854C(EnStopheishi* this, PlayState* play); +void func_80AE795C(EnStopheishi* this, PlayState* play); + +typedef enum { + /* 0 */ SOLDIER_ANIM_LOOK_DOWN, + /* 1 */ SOLDIER_ANIM_COME_UP_HERE, + /* 2 */ SOLDIER_ANIM_STAND_HAND_ON_HIP, + /* 3 */ SOLDIER_ANIM_STAND_LOOK_DOWN, + /* 4 */ SOLDIER_ANIM_4, + /* 5 */ SOLDIER_ANIM_5, + /* 6 */ SOLDIER_ANIM_6, + /* 7 */ SOLDIER_ANIM_STAND_HAND_ON_CHEST, + /* 8 */ SOLDIER_ANIM_MAX, +} SoldierAnimation; -#if 0 ActorInit En_Stop_heishi_InitVars = { ACTOR_EN_STOP_HEISHI, ACTORCAT_NPC, @@ -32,45 +46,538 @@ ActorInit En_Stop_heishi_InitVars = { (ActorFunc)EnStopheishi_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80AE88B0 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 50, 260, 0, { 0, 0, 0 } }, }; -#endif +static u16 sLeaveMessages[] = { + 0x0516, 0x0517, 0x051A, 0x0000, 0x051C, 0x0000, 0x051E, 0x0000, 0x0520, 0x0521, 0x0524, 0x0000, 0x0526, 0x0000, + 0x0528, 0x0000, 0x052A, 0x052B, 0x052E, 0x0000, 0x0530, 0x0000, 0x0532, 0x0000, 0x0534, 0x0535, 0x0538, 0x0000, + 0x053A, 0x0000, 0x053C, 0x0000, 0x0518, 0x0519, 0x051B, 0x0000, 0x051D, 0x0000, 0x051F, 0x0000, 0x0522, 0x0523, + 0x0525, 0x0000, 0x0527, 0x0000, 0x0529, 0x0000, 0x052C, 0x052D, 0x052F, 0x0000, 0x0531, 0x0000, 0x0533, 0x0000, + 0x0536, 0x0537, 0x0539, 0x0000, 0x053B, 0x0000, 0x053D, 0x0000, 0x0514, 0x0000, 0x0560, 0x0000, 0x0562, 0x0000, + 0x0564, 0x0000, 0x0515, 0x0000, 0x0561, 0x0000, 0x0563, 0x0000, 0x0565, 0x0000, +}; -extern ColliderCylinderInit D_80AE88B0; +static u16 sThirdDayLeaveMessages[] = { + 0x0540, 0x0541, 0x0542, 0x0000, 0x0543, 0x0000, 0x0543, 0x0000, 0x0547, 0x0548, 0x0549, 0x0000, 0x054A, 0x0000, + 0x054B, 0x0000, 0x054F, 0x0550, 0x0551, 0x0000, 0x0552, 0x0000, 0x0553, 0x0000, 0x0557, 0x0558, 0x0559, 0x0000, + 0x055A, 0x0000, 0x055A, 0x0000, 0x0544, 0x0545, 0x0546, 0x0000, 0x0546, 0x0000, 0x0546, 0x0000, 0x054C, 0x054D, + 0x054E, 0x0000, 0x054E, 0x0000, 0x054E, 0x0000, 0x0554, 0x0555, 0x0556, 0x0000, 0x0556, 0x0000, 0x0556, 0x0000, + 0x055B, 0x055C, 0x055D, 0x0000, 0x055D, 0x0000, 0x055D, 0x0000, 0x053E, 0x0000, 0x053E, 0x0000, 0x053E, 0x0000, + 0x053E, 0x0000, 0x053F, 0x0000, 0x053F, 0x0000, 0x053F, 0x0000, 0x053F, 0x0000, +}; -extern UNK_TYPE D_06006C18; +static AnimationHeader* sAnimations[SOLDIER_ANIM_MAX] = { + &gSoldierLookDown, // SOLDIER_ANIM_LOOK_DOWN + &gSoldierComeUpHere, // SOLDIER_ANIM_COME_UP_HERE + &gSoldierStandHandOnHip, // SOLDIER_ANIM_STAND_HAND_ON_HIP + &gSoldierStandAndLookDown, // SOLDIER_ANIM_STAND_LOOK_DOWN + &object_sdn_Anim_0057BC, // SOLDIER_ANIM_4 + &object_sdn_Anim_005D28, // SOLDIER_ANIM_5 + &object_sdn_Anim_0064C0, // SOLDIER_ANIM_6 + &gSoldierStandWithHandOnChest, // SOLDIER_ANIM_STAND_HAND_ON_CHEST +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/EnStopheishi_Init.s") +void EnStopheishi_Init(Actor* thisx, PlayState* play) { + EnStopheishi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/EnStopheishi_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierStandHandOnHip, this->jointTable, + this->morphTable, SOLDIER_LIMB_MAX); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE750C.s") + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->unk_276 = ENSTOPHEISHI_GET_F000(&this->actor); + this->switchFlag = ENSTOPHEISHI_GET_SWITCH_FLAG(&this->actor); + this->unk_288 = (this->actor.world.rot.z * 40.0f) + 50.0f; + this->actor.world.rot.z = 0; + if (this->switchFlag == 0x7F) { + this->switchFlag = -1; + } + if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { + Actor_Kill(&this->actor); + return; + } + this->actor.targetMode = 0; + this->actor.gravity = -3.0f; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->rotYTarget = this->actor.world.rot.y; + this->headTurnTimer2 = 6; + func_80AE7E9C(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE75C8.s") +void EnStopheishi_Destroy(Actor* thisx, PlayState* play) { + EnStopheishi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE7718.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE77D4.s") +void EnStopHeishi_ChangeAnim(EnStopheishi* this, s32 animIndex) { + s32 mode; + f32 morphFrames; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE795C.s") + this->currentAnim = animIndex; + this->currentAnimFrameCount = Animation_GetLastFrame(sAnimations[animIndex]); + mode = ANIMMODE_ONCE; + morphFrames = -10.0f; + if ((animIndex >= SOLDIER_ANIM_STAND_HAND_ON_HIP) && (animIndex != SOLDIER_ANIM_4)) { + mode = ANIMMODE_LOOP; + } + if (animIndex == SOLDIER_ANIM_5) { + morphFrames = 0.0f; + } + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->currentAnimFrameCount, mode, + morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE7E9C.s") +void EnStopheishi_UpdateHeadNormal(EnStopheishi* this, PlayState* play) { + s32 yawDiff; + Player* player; + Vec3f playerPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE7F34.s") + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE854C.s") + this->headRotXTarget = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE85C4.s") + if (this->actor.xzDistToPlayer < 200.0f) { + player = GET_PLAYER(play); + if (yawDiff < 0x4E20) { + this->headRotXTarget = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + if (this->headRotXTarget > 0x2710) { + this->headRotXTarget = 0x2710; + } else if (this->headRotXTarget < -0x2710) { + this->headRotXTarget = -0x2710; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/EnStopheishi_Update.s") + Math_Vec3f_Copy(&playerPos, &player->actor.world.pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE87A4.s") + if ((player->transformation == PLAYER_FORM_DEKU) || (player->transformation == PLAYER_FORM_HUMAN)) { + playerPos.y += 57.0f + BREG(34); + } else { + playerPos.y += 70.0f + BREG(35); + } + this->pitchToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &playerPos); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/func_80AE87EC.s") +void EnStopHeishi_UpdateHeadThirdDay(EnStopheishi* this) { + if (this->headTurnTimer1 != 0) { + this->headTurnTimer1--; + } + this->pitchToPlayer = -0xBB8; + this->headRotXTarget = 0; + if (this->headTurnTimer2 < 6) { + this->headRotXTarget = 0x1770; + if (((u32)this->headTurnTimer2 % 8) == 0) { + this->headRotXTarget = -0x1770; + } + if (this->headTurnTimer1 == 0) { + this->headTurnTimer2++; + this->headTurnTimer1 = 10; + if (this->headTurnTimer2 >= 6) { + this->headTurnTimer1 = 50; + } + } + } else if ((this->headTurnTimer1 == 0) && (Quake_NumActiveQuakes() != 0) && (this->headTurnTimer2 >= 6)) { + this->headTurnTimer2 = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Stop_heishi/EnStopheishi_Draw.s") +void func_80AE77D4(EnStopheishi* this) { + this->unk_274 = 0; + this->maxMoveStep = 0.0f; + this->rotYTarget = this->actor.home.rot.y; + if (this->timer == 1) { + this->pitchToPlayer = 0; + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_5); + } + if ((this->timer == 0) && (this->unk_264 == 0)) { + if ((fabsf(this->actor.world.pos.x - this->actor.home.pos.x) > 3.0f) || + (fabsf(this->actor.world.pos.z - this->actor.home.pos.z) > 3.0f)) { + this->skelAnime.playSpeed = 3.0f; + Math_ApproachF(&this->actor.world.pos.x, this->actor.home.pos.x, 0.3f, 5.0f); + Math_ApproachF(&this->actor.world.pos.z, this->actor.home.pos.z, 0.3f, 5.0f); + } else { + this->unk_264 = 1; + } + } + if ((this->currentAnim != SOLDIER_ANIM_STAND_HAND_ON_HIP) && (this->currentAnim != SOLDIER_ANIM_STAND_LOOK_DOWN) && + (this->currentAnim != SOLDIER_ANIM_STAND_HAND_ON_CHEST) && (this->unk_264 != 0)) { + this->skelAnime.playSpeed = 1.0f; + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + if ((gSaveContext.save.day != 3) && gSaveContext.save.isNight) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_LOOK_DOWN); + } + if (gSaveContext.save.day == 3) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_CHEST); + } + } +} + +void func_80AE795C(EnStopheishi* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 curFrame = this->skelAnime.curFrame; + Vec3f newPos; + f32 xDiff; + f32 zDiff; + f32 playSpeed; + s16 yaw; + s16 rotY; + + if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)) < 0x2000) { + this->rotYTarget = this->actor.yawTowardsPlayer; + } + playSpeed = + fabsf((f32)this->actor.yawTowardsPlayer - Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos)) * + 0.01f * 5.0f; + if (this->unk_274 != 4) { + this->skelAnime.playSpeed = CLAMP(playSpeed, 1.0f, 5.0f); + } + yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); + xDiff = fabsf(this->actor.home.pos.x - player->actor.world.pos.x); + zDiff = fabsf(this->actor.home.pos.z - player->actor.world.pos.z); + Math_Vec3f_Copy(&newPos, &this->actor.home.pos); + rotY = this->actor.home.rot.y; + + if (rotY == -0x8000) { + if (yaw > 0) { + xDiff = Math_SinS(this->actor.home.rot.y + 0xC000) * xDiff; + zDiff = Math_CosS(this->actor.home.rot.y + 0xC000) * zDiff; + } else { + xDiff = Math_SinS(this->actor.home.rot.y + 0x4000) * xDiff; + zDiff = Math_CosS(this->actor.home.rot.y + 0x4000) * zDiff; + } + } else if (yaw < rotY) { + xDiff = Math_SinS(this->actor.home.rot.y + 0xC000) * xDiff; + zDiff = Math_CosS(this->actor.home.rot.y + 0xC000) * zDiff; + } else { + xDiff = Math_SinS(this->actor.home.rot.y + 0x4000) * xDiff; + zDiff = Math_CosS(this->actor.home.rot.y + 0x4000) * zDiff; + } + + if (this->unk_288 < xDiff) { + xDiff = this->unk_288; + } else if (xDiff < -this->unk_288) { + xDiff = -this->unk_288; + } + if (this->unk_288 < zDiff) { + zDiff = this->unk_288; + } else if (zDiff < -this->unk_288) { + zDiff = -this->unk_288; + } + newPos.x += xDiff; + newPos.z += zDiff; + Math_ApproachF(&this->actor.world.pos.x, newPos.x, 0.5f, this->maxMoveStep); + Math_ApproachF(&this->actor.world.pos.z, newPos.z, 0.5f, this->maxMoveStep); + Math_ApproachF(&this->maxMoveStep, 50.0f, 0.3f, 1.0f); + + switch (this->unk_274) { + case 0: + if (gSaveContext.save.day != 3) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_4); + this->unk_274 = 2; + } else { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + this->unk_274 = 1; + } + break; + + case 1: + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_4); + this->unk_274 = 2; + break; + + case 2: + if (this->currentAnimFrameCount <= curFrame) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_5); + this->unk_274 = 3; + } + break; + + case 3: + if ((fabsf(this->actor.world.pos.x - newPos.x) < 2.0f) && + (fabsf(this->actor.world.pos.z - newPos.z) < 2.0f)) { + this->skelAnime.playSpeed = 1.0f; + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_6); + this->unk_274 = 4; + } + break; + + case 4: + if ((fabsf(this->actor.world.pos.x - newPos.x) > 4.0f) || + (fabsf(this->actor.world.pos.z - newPos.z) > 4.0f)) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_5); + this->unk_274 = 3; + } + break; + } + this->unk_264 = 0; + this->timer = 20; + this->pitchToPlayer = 0; + if (this->unk_276 == 3) { + Math_Vec3f_Copy(&newPos, &player->actor.world.pos); + if ((player->transformation == PLAYER_FORM_DEKU) || (player->transformation == PLAYER_FORM_HUMAN)) { + newPos.y += 77.0f + BREG(37); + this->pitchToPlayer = Math_Vec3f_Pitch(&this->actor.focus.pos, &newPos); + } + } +} + +void func_80AE7E9C(EnStopheishi* this) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + if ((gSaveContext.save.day != 3) && gSaveContext.save.isNight) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_LOOK_DOWN); + } + if (gSaveContext.save.day == 3) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_CHEST); + } + this->unk_274 = 0; + this->disableCollider = false; + this->actionFunc = func_80AE7F34; + this->actor.speed = 0.0f; +} + +void func_80AE7F34(EnStopheishi* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s16 sp32; + s16 phi_a2; + s32 yawDiffAbs; + s16 yawDiff; + f32 xDiff; + f32 zDiff; + + SkelAnime_Update(&this->skelAnime); + if ((this->currentAnim == SOLDIER_ANIM_5) && (((s16)this->skelAnime.curFrame % 2) != 0)) { + Actor_PlaySfx(&this->actor, NA_SE_EV_SOLDIER_WALK); + } + if (gSaveContext.save.day != 3) { + EnStopheishi_UpdateHeadNormal(this, play); + } else { + EnStopHeishi_UpdateHeadThirdDay(this); + } + Math_SmoothStepToS(&this->actor.world.rot.y, this->rotYTarget, 1, 0x1388, 0); + + sp32 = 0; + if (gSaveContext.save.isNight) { + sp32 = 0x20; + } + + phi_a2 = 0; + switch (player->transformation) { + case PLAYER_FORM_HUMAN: + if ((STOLEN_ITEM_1 == SLOT_SWORD_GREAT_FAIRY) || (STOLEN_ITEM_1 == ITEM_SWORD_KOKIRI) || + (STOLEN_ITEM_1 == ITEM_SWORD_RAZOR) || (STOLEN_ITEM_1 == ITEM_SWORD_GILDED) || + (STOLEN_ITEM_2 == SLOT_SWORD_GREAT_FAIRY) || (STOLEN_ITEM_2 == ITEM_SWORD_KOKIRI) || + (STOLEN_ITEM_2 == ITEM_SWORD_RAZOR) || (STOLEN_ITEM_2 == ITEM_SWORD_GILDED)) { + if (this->unk_265 != 0) { + phi_a2 = 1; + } + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_20)) { + phi_a2 = 1; + } + break; + + case PLAYER_FORM_DEKU: + phi_a2 = 4; + break; + + case PLAYER_FORM_ZORA: + phi_a2 = 3; + break; + + case PLAYER_FORM_GORON: + phi_a2 = 2; + break; + } + + if (((phi_a2 == 1) || (phi_a2 == 2) || (phi_a2 == 3)) && + (((this->currentAnim == SOLDIER_ANIM_4)) || (this->currentAnim == SOLDIER_ANIM_5) || + (this->currentAnim == SOLDIER_ANIM_6))) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + if ((gSaveContext.save.day != 3) && gSaveContext.save.isNight) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_LOOK_DOWN); + } + if (gSaveContext.save.day == 3) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_CHEST); + } + } + + if ((phi_a2 == 0) || (phi_a2 == 4)) { + xDiff = this->actor.home.pos.x - player->actor.world.pos.x; + zDiff = this->actor.home.pos.z - player->actor.world.pos.z; + this->collider.dim.radius = 50; + this->collider.dim.height = 260; + if (sqrtf(SQ(xDiff) + SQ(zDiff)) < 240.0f) { + func_80AE795C(this, play); + } else { + func_80AE77D4(this); + } + } else { + this->collider.dim.radius = 15; + this->collider.dim.height = 60; + } + if (phi_a2 != 4) { + this->messageIndex = this->unk_276 * 8; + this->messageIndex += sp32; + this->messageIndex += phi_a2 * 2; + } else { + this->messageIndex = 64; + if (sp32 != 0) { + this->messageIndex = 72; + } + this->messageIndex += this->unk_276 * 2; + } + if (gSaveContext.save.day != 3) { + this->actor.textId = sLeaveMessages[this->messageIndex]; + this->unk_27E = sLeaveMessages[this->messageIndex + 1]; + } else { + this->actor.textId = sThirdDayLeaveMessages[this->messageIndex]; + this->unk_27E = sThirdDayLeaveMessages[this->messageIndex + 1]; + } + if (this->unk_27E != 0) { + if ((STOLEN_ITEM_1 == ITEM_SWORD_GREAT_FAIRY) || (STOLEN_ITEM_1 == ITEM_SWORD_KOKIRI) || + (STOLEN_ITEM_1 == ITEM_SWORD_RAZOR) || (STOLEN_ITEM_1 == ITEM_SWORD_GILDED) || + (STOLEN_ITEM_2 == ITEM_SWORD_GREAT_FAIRY) || (STOLEN_ITEM_2 == ITEM_SWORD_KOKIRI) || + (STOLEN_ITEM_2 == ITEM_SWORD_RAZOR) || (STOLEN_ITEM_2 == ITEM_SWORD_GILDED)) { + if (this->actor.textId == 0x516) { + this->actor.textId = 0x56C; + } else if (this->actor.textId == 0x520) { + this->actor.textId = 0x56E; + } else if (this->actor.textId == 0x52A) { + this->actor.textId = 0x570; + } else if (this->actor.textId == 0x534) { + this->actor.textId = 0x572; + } else if (this->actor.textId == 0x518) { + this->actor.textId = 0x56D; + } else if (this->actor.textId == 0x522) { + this->actor.textId = 0x56F; + } else if (this->actor.textId == 0x52C) { + this->actor.textId = 0x571; + } else if (this->actor.textId == 0x536) { + this->actor.textId = 0x573; + } + } else if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + if (this->actor.textId == 0x516) { + this->actor.textId = 0x55E; + } else if (this->actor.textId == 0x520) { + this->actor.textId = 0x566; + } else if (this->actor.textId == 0x52A) { + this->actor.textId = 0x568; + } else if (this->actor.textId == 0x534) { + this->actor.textId = 0x56A; + } else if (this->actor.textId == 0x518) { + this->actor.textId = 0x55F; + } else if (this->actor.textId == 0x522) { + this->actor.textId = 0x567; + } else if (this->actor.textId == 0x52C) { + this->actor.textId = 0x569; + } else if (this->actor.textId == 0x536) { + this->actor.textId = 0x56B; + } + } + } + yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + yawDiffAbs = ABS_ALT(yawDiff); + + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->skelAnime.playSpeed = 1.0f; + func_80AE854C(this, play); + } else if (yawDiffAbs < 0x4BB9) { + func_800B8614(&this->actor, play, 70.0f); + } +} + +void func_80AE854C(EnStopheishi* this, PlayState* play) { + if (((this->unk_265 != 0) || (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_20))) && + (this->currentAnim != SOLDIER_ANIM_STAND_HAND_ON_HIP)) { + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + } + this->pitchToPlayer = 0; + this->unk_274 = 0; + this->disableCollider = true; + this->actionFunc = func_80AE85C4; +} + +void func_80AE85C4(EnStopheishi* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnStopheishi_UpdateHeadNormal(this, play); + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + if (this->unk_27E != 0) { + this->actor.textId = this->unk_27E; + Message_ContinueTextbox(play, this->actor.textId); + EnStopHeishi_ChangeAnim(this, SOLDIER_ANIM_STAND_HAND_ON_HIP); + SET_WEEKEVENTREG(WEEKEVENTREG_12_20); + this->unk_265 = 1; + this->unk_27E = 0; + } else { + Message_CloseTextbox(play); + func_80AE7E9C(this); + } + } +} + +void EnStopheishi_Update(Actor* thisx, PlayState* play) { + EnStopheishi* this = (EnStopheishi*)thisx; + s32 pad; + + if (this->timer != 0) { + this->timer--; + } + this->actor.shape.rot.y = this->actor.world.rot.y; + Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 0x7D0, 0); + Math_SmoothStepToS(&this->headRotZ, this->pitchToPlayer, 1, 0x7D0, 0); + this->actionFunc(this, play); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_SetScale(&this->actor, 0.01f); + this->actor.uncullZoneForward = 500.0f; + Math_Vec3f_Copy(&this->actor.focus.pos, &this->headWorldPos); + Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); + if (!this->disableCollider) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } +} + +s32 EnStopheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnStopheishi* this = THIS; + + if (limbIndex == SOLDIER_LIMB_HEAD) { + rot->x += this->headRotX; + rot->z += this->headRotZ; + } + return false; +} + +void EnStopheishi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnStopheishi* this = THIS; + + if (limbIndex == SOLDIER_LIMB_HEAD) { + Matrix_MultVec3f(&gZeroVec3f, &this->headWorldPos); + } +} + +void EnStopheishi_Draw(Actor* thisx, PlayState* play) { + EnStopheishi* this = THIS; + + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnStopheishi_OverrideLimbDraw, EnStopheishi_PostLimbDraw, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h index 8e27f1c36..651a66496 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.h @@ -2,16 +2,46 @@ #define Z_EN_STOP_HEISHI_H #include "global.h" +#include "objects/object_sdn/object_sdn.h" struct EnStopheishi; typedef void (*EnStopheishiActionFunc)(struct EnStopheishi*, PlayState*); +#define ENSTOPHEISHI_GET_SWITCH_FLAG(thisx) (((thisx)->params) & 0x3F) +#define ENSTOPHEISHI_GET_F000(thisx) ((((thisx)->params) >> 0xC) & 0xF) + typedef struct EnStopheishi { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x110]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[SOLDIER_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[SOLDIER_LIMB_MAX]; /* 0x254 */ EnStopheishiActionFunc actionFunc; - /* 0x258 */ char unk_258[0x90]; + /* 0x258 */ s16 headRotZ; + /* 0x25A */ s16 headRotX; + /* ox25C */ UNK_TYPE1 unk_25C[2]; + /* 0x25E */ s16 pitchToPlayer; + /* 0x260 */ s16 headRotXTarget; + /* 0x262 */ s16 unk_262; // Unused + /* 0x264 */ u8 unk_264; // Locking value at `0` prevents leaving the guard pose, however locking to 1 doesn't prevent guarding. + /* 0x265 */ u8 unk_265; + /* 0x266 */ s16 unk_266; + /* 0x268 */ s32 currentAnim; + /* 0x26C */ f32 currentAnimFrameCount; + /* 0x270 */ s16 timer; + /* 0x272 */ s16 headTurnTimer1; + /* 0x274 */ s16 unk_274; + /* 0x276 */ s16 unk_276; + /* 0x278 */ s16 disableCollider; + /* 0x27A */ s16 switchFlag; + /* 0x27C */ s16 messageIndex; + /* 0x27E */ s16 unk_27E; + /* 0x280 */ s16 rotYTarget; + /* 0x284 */ s32 headTurnTimer2; + /* 0x288 */ f32 unk_288; + /* 0x28C */ f32 maxMoveStep; + /* 0x28C */ Vec3f headWorldPos; + /* 0x29C */ ColliderCylinder collider; } EnStopheishi; // size = 0x2E8 #endif // Z_EN_STOP_HEISHI_H diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 93c93eef9..5bffa0d83 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -452,7 +452,7 @@ void func_80BAAFDC(EnSuttari* this, PlayState* play) { if (this->playerDetected == true) { play_sound(NA_SE_SY_FOUND); this->playerDetected = false; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } @@ -485,7 +485,7 @@ void func_80BAB1A0(EnSuttari* this, PlayState* play) { if (this->playerDetected == true) { play_sound(NA_SE_SY_FOUND); this->playerDetected = false; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk1F4[0] != 0) { this->unk1F4[0]--; } @@ -632,7 +632,7 @@ void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) { if (this->paths[arg1] != NULL) { target = EnSuttari_GetDistSqAndOrient(this->paths[arg1], this->unk1F4[arg1], &this->actor.world.pos, &dist); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (arg2 == 2) { this->unk1F4[arg1] = -0x63; } else { @@ -661,7 +661,7 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { if (this->paths[arg1] != NULL) { target = EnSuttari_GetDistSqAndOrient(this->paths[arg1], this->unk1F4[arg1], &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { target = this->actor.wallYaw; } Math_SmoothStepToS(&this->actor.world.rot.y, target, 1, 0xBB8, 0); @@ -1032,7 +1032,7 @@ void func_80BACA14(EnSuttari* this, PlayState* play) { func_800B8614(&this->actor, play, 200.0f); } } - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 0.1f); Actor_MoveWithGravity(&this->actor); } @@ -1045,7 +1045,7 @@ void func_80BACBB0(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BACA14; } if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { target = this->actor.wallYaw; } else if (func_80BAA904(this, play)) { target = -this->actor.world.rot.y; @@ -1054,13 +1054,13 @@ void func_80BACBB0(EnSuttari* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.world.rot.y, target, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 0.1f); } else { this->actionFunc = func_80BACD2C; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } Actor_MoveWithGravity(&this->actor); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.pos = this->actor.prevPos; this->actor.world.rot.y = -this->actor.world.rot.y; this->actionFunc = func_80BACE4C; @@ -1076,13 +1076,13 @@ void func_80BACD2C(EnSuttari* this, PlayState* play) { } if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { this->actionFunc = func_80BACBB0; - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 0.1f); } else { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; } Actor_MoveWithGravity(&this->actor); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.pos = this->actor.prevPos; this->actor.world.rot.y = -this->actor.world.rot.y; this->actionFunc = func_80BACE4C; @@ -1118,7 +1118,7 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) { if (this->unk428 == 5) { SET_WEEKEVENTREG(WEEKEVENTREG_58_80); this->actionFunc = func_80BADDB4; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else if (Player_GetMask(play) != PLAYER_MASK_STONE) { func_80BAB1A0(this, play); } @@ -1173,7 +1173,7 @@ void func_80BAD230(EnSuttari* this, PlayState* play) { this->textId = 0x2A31; Message_StartTextbox(play, this->textId, &this->actor); this->flags1 |= 0x4000; - Audio_QueueSeqCmd(NA_BGM_CHASE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CHASE | SEQ_FLAG_ASYNC); this->actionFunc = func_80BAD380; } else { ActorCutscene_SetIntentToPlay(this->cutscenes[1]); @@ -1203,7 +1203,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { if ((player->stateFlags1 & PLAYER_STATE1_40) && (play->msgCtx.currentTextId != 0x2A31)) { this->flags1 |= 0x8000; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { this->flags1 &= ~0x8000; func_80BABA90(this, 1, 1); @@ -1222,7 +1222,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { } else if (this->flags1 & 0x200) { SET_WEEKEVENTREG(WEEKEVENTREG_79_40); this->flags2 |= 4; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); @@ -1233,13 +1233,13 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { if (this->flags2 & 8) { SET_WEEKEVENTREG(WEEKEVENTREG_33_08); } - this->actor.speedXZ = 0.0f; - Audio_QueueSeqCmd(0x101400FF); + this->actor.speed = 0.0f; + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->flags2 |= 4; EnSuttari_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { this->unk3F2 = this->headRot.y; - Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, 4.0f, 0.2f, 0.5f); Actor_MoveWithGravity(&this->actor); func_80BAB374(this, play); } @@ -1410,10 +1410,10 @@ void func_80BADDB4(EnSuttari* this, PlayState* play) { void func_80BADE14(EnSuttari* this, PlayState* play) { func_80BABA90(this, 1, 2); if (this->unk1F4[1] == -0x63) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { this->unk3F2 = this->headRot.y; - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.2f, 0.5f); } Actor_MoveWithGravity(&this->actor); } @@ -1438,7 +1438,7 @@ void func_80BADF3C(EnSuttari* this, PlayState* play) { } this->unk3F2 = this->headRot.y; if (DECR(this->unk3F6) == 0) { - Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f); + Math_ApproachF(&this->actor.speed, 6.0f, 0.2f, 0.5f); } Actor_MoveWithGravity(&this->actor); } @@ -1465,7 +1465,7 @@ void EnSuttari_Destroy(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; if ((play->sceneId == SCENE_BACKTOWN) && !(this->flags2 & 4)) { - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } Collider_DestroyCylinder(play, &this->collider); } @@ -1488,11 +1488,11 @@ void EnSuttari_Update(Actor* thisx, PlayState* play) { if (this->unk428 != 0) { if (this->animIndex == 2 || this->animIndex == 6) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } } else if (this->animIndex == 0 || this->animIndex == 5) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } } } @@ -1562,11 +1562,12 @@ void EnSuttari_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnSuttari_Draw(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; s32 pad; - Vec3f sp5C; - Vec3f sp50; + Vec3f pos; + Vec3f scale; if (this->flags1 & 0x80) { OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 55, 55, 255, 0)); @@ -1576,12 +1577,13 @@ void EnSuttari_Draw(Actor* thisx, PlayState* play) { EnSuttari_TransformLimbDraw, &this->actor); if (this->flags1 & 0x80) { func_8012C2DC(play->state.gfxCtx); - sp5C = this->actor.world.pos; - sp50.x = 0.2f; - sp50.y = 0.2f; - sp50.z = 0.2f; - func_800BC620(&sp5C, &sp50, 0xFF, play); + pos = this->actor.world.pos; + scale.x = 0.2f; + scale.y = 0.2f; + scale.z = 0.2f; + func_800BC620(&pos, &scale, 255, play); } + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index bbc010a2a..e76bc85a5 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -378,8 +378,8 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { sp68 = BGCHECK_SCENE; sp64 = BGCHECK_SCENE; func_808D90F0(this, arg3, arg4); - this->actor.speedXZ = this->unk_44C; - temp_f20 = thisx->speedXZ * 2.0f; + this->actor.speed = this->unk_44C; + temp_f20 = thisx->speed * 2.0f; sp90.x = this->actor.world.pos.x + (this->unk_368.x * 2.0f); sp90.y = this->actor.world.pos.y + (this->unk_368.y * 2.0f); @@ -397,7 +397,7 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { func_808D91C4(this, spA4); Math_Vec3f_Copy(&this->actor.world.pos, &sp78); this->actor.floorBgId = sp64; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { if (spA0 != this->actor.floorPoly) { func_808D91C4(this, spA0); @@ -406,7 +406,7 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { this->actor.floorBgId = sp68; } } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; temp_f20 *= 3.0f; Math_Vec3f_Copy(&sp90, &sp84); @@ -440,8 +440,8 @@ void func_808D94D0(EnSw* this, PlayState* play, s32 arg2, s32 arg3, s16 arg4) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.z = this->actor.world.rot.z; - if (this->actor.speedXZ != 0.0f) { - this->unk_44C = this->actor.speedXZ; + if (this->actor.speed != 0.0f) { + this->unk_44C = this->actor.speed; } if (arg2 == 1) { @@ -504,8 +504,8 @@ s32 func_808D99C8(EnSw* this, PlayState* play) { return false; } - if ((this->actor.xyzDistToPlayerSq < ((sREG(16) * 10) + 60000)) && (play->actorCtx.unk1F5 != 0) && - (play->actorCtx.unk1F4 == 0)) { + if ((this->actor.xyzDistToPlayerSq < ((sREG(16) * 10) + 60000)) && (play->actorCtx.unk_1F4.timer != 0) && + (play->actorCtx.unk_1F4.unk_00 == 0)) { this->actor.colChkInfo.damage = 4; phi_v1 = true; } @@ -524,9 +524,9 @@ s32 func_808D9A70(EnSw* this, PlayState* play) { } else { if (this->unk_456 != 0) { if (!ENSW_GET_3(&this->actor)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_ROLL); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); } this->unk_456--; this->skelAnime.curFrame = 0.0f; @@ -555,15 +555,15 @@ s32 func_808D9C18(EnSw* this) { f32 new_var; if ((this->unk_498 == 0xF9) || (this->unk_498 == 0x82) || (this->unk_498 == 0xE4) || (this->unk_498 == 0xE5)) { - this->actor.velocity.x = this->actor.speedXZ; - this->actor.velocity.z = this->actor.speedXZ; + this->actor.velocity.x = this->actor.speed; + this->actor.velocity.z = this->actor.speed; this->actor.velocity.x *= Math_SinS(this->actor.world.rot.y); this->actor.velocity.z *= Math_CosS(this->actor.world.rot.y); } else { - new_var = this->actor.speedXZ * this->unk_350.x; - this->actor.velocity.x = new_var + (this->actor.speedXZ * this->unk_368.x); - new_var = this->actor.speedXZ * this->unk_350.z; - this->actor.velocity.z = new_var + this->actor.speedXZ * this->unk_368.z; + new_var = this->actor.speed * this->unk_350.x; + this->actor.velocity.x = new_var + (this->actor.speed * this->unk_368.x); + new_var = this->actor.speed * this->unk_350.z; + this->actor.velocity.z = new_var + this->actor.speed * this->unk_368.z; this->actor.velocity.y = 14.0f; Math_Vec3f_Copy(&sp3C, &this->actor.world.pos); Math_Vec3f_Copy(&sp30, &this->actor.world.pos); @@ -575,7 +575,7 @@ s32 func_808D9C18(EnSw* this) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp3C, &sp30); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTURA_APPEAR); if (ENSW_GET_3(&this->actor) == 1) { Actor_SetScale(&this->actor, 0.0f); @@ -635,10 +635,10 @@ void func_808D9F78(EnSw* this, PlayState* play, s32 arg2) { } Actor_SetScale(&this->actor, 0.02f); func_808D9DA0(this); - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->unk_44C = 10.0f; func_808D94D0(this, play, 0, 0, 0); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_44C = 0.0f; this->unk_450 = 1.0f; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); @@ -647,10 +647,10 @@ void func_808D9F78(EnSw* this, PlayState* play, s32 arg2) { void func_808DA024(EnSw* this, PlayState* play) { func_808D9DA0(this); - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->unk_44C = 10.0f; func_808D94D0(this, play, 0, 0, 0); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_44C = 0.0f; this->unk_450 = 1.0f; } @@ -717,19 +717,20 @@ s32 func_808DA08C(EnSw* this, PlayState* play) { } this->unk_458 = 20; this->unk_45A = 0; - Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_458); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, this->unk_458); ret = true; } else if (this->actor.colChkInfo.damageEffect == 1) { if (this->unk_45A == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->unk_45A = 40; - Actor_SetColorFilter(&this->actor, 0, 200, 0, this->unk_45A); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, + this->unk_45A); } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_DAMAGE); this->unk_458 = 20; this->unk_45A = 0; - Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_458); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, this->unk_458); } } return ret; @@ -739,7 +740,7 @@ void func_808DA350(EnSw* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((player->stateFlags1 & PLAYER_STATE1_200000) && (this->actor.xyzDistToPlayerSq < 8000.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_LAUGH); Math_Vec3f_Copy(&this->unk_374, &player->actor.world.pos); this->unk_410 &= ~0x20; this->unk_414 = 0.0f; @@ -764,7 +765,7 @@ void func_808DA3F4(EnSw* this, PlayState* play) { temp_v0 = Math_Atan2S_XY(sp38.z, sp38.x); if (ABS_ALT(temp_v0) < temp_s1) { this->skelAnime.curFrame = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); this->unk_414 = 0.0f; if (this->unk_410 & 0x20) { this->actionFunc = func_808DA6FC; @@ -775,7 +776,7 @@ void func_808DA3F4(EnSw* this, PlayState* play) { } temp_s1 *= (temp_v0 < 0) ? -1 : 1; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_ROLL); this->skelAnime.curFrame = 0.0f; } func_808D94D0(this, play, 0, 0, temp_s1); @@ -791,7 +792,7 @@ void func_808DA578(EnSw* this, PlayState* play) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.3f * temp_f0; func_808D94D0(this, play, 1, 0, 0); - if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { + if ((this->actor.speed == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp30, &this->unk_374); func_808D9894(this, &sp30); temp2 = Math_Atan2S_XY(sp30.z, sp30.x); @@ -801,7 +802,7 @@ void func_808DA578(EnSw* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_374, &this->actor.home.pos); this->actionFunc = func_808DA3F4; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); this->skelAnime.curFrame = 0.0f; } @@ -822,14 +823,14 @@ void func_808DA6FC(EnSw* this, PlayState* play) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.14f * temp_f0; func_808D94D0(this, play, 1, 0, 0); - if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { + if ((this->actor.speed == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); temp2 = Math_Atan2S_XY(sp38.z, sp38.x); func_808D94D0(this, play, 0, 0, temp2); } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); this->skelAnime.curFrame = 0.0f; } @@ -873,16 +874,16 @@ void func_808DA89C(EnSw* this, PlayState* play) { } else if (ENSW_GET_3(&this->actor)) { this->actionFunc = func_808DAEB4; } else { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { f32 temp_f2; this->actor.shape.yOffset = 400.0f; temp_f2 = fabsf(this->actor.velocity.y) * 0.6f; this->actor.velocity.y = temp_f2; this->unk_448 = temp_f2; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if ((s32)temp_f2 != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTURA_BOUND); } else { this->actionFunc = func_808DAEB4; this->actor.velocity.y = 0.0f; @@ -919,7 +920,7 @@ void func_808DAA60(EnSw* this, PlayState* play) { temp_v0 = Math_Atan2S_XY(sp34.z, sp34.x); if (ABS_ALT(temp_v0) < sp40) { this->skelAnime.curFrame = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); Math_Vec3s_ToVec3f(&this->unk_374, &sp44[this->unk_4A0]); this->actionFunc = func_808DACF4; this->unk_414 = 0.0f; @@ -929,7 +930,7 @@ void func_808DAA60(EnSw* this, PlayState* play) { } } else { if (this->unk_456 != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); this->unk_456--; this->skelAnime.curFrame = 0.0f; } else { @@ -963,7 +964,7 @@ void func_808DACF4(EnSw* this, PlayState* play) { temp = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.1f * temp; func_808D94D0(this, play, 1, 0, 0); - if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { + if ((this->actor.speed == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); @@ -971,7 +972,7 @@ void func_808DACF4(EnSw* this, PlayState* play) { func_808D94D0(this, play, 0, 0, temp_f6); } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); this->skelAnime.curFrame = 0.0f; } @@ -1075,9 +1076,9 @@ void func_808DB100(EnSw* this, PlayState* play) { if ((DECR(this->unk_454) == 0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->unk_456 != 0) { if (!ENSW_GET_3(&this->actor)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_ROLL); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); } this->unk_456--; this->skelAnime.curFrame = 0.0f; @@ -1103,7 +1104,7 @@ void func_808DB25C(EnSw* this, PlayState* play) { void func_808DB2E0(EnSw* this, PlayState* play) { f32 temp_f2; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_808D9F78(this, play, 0); temp_f2 = fabsf(this->actor.velocity.y) * 0.6f; this->actor.velocity.x *= 0.5f; @@ -1112,7 +1113,7 @@ void func_808DB2E0(EnSw* this, PlayState* play) { this->actor.velocity.z *= 0.5f; if ((s32)temp_f2 != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALTURA_BOUND); } else { func_800BC154(play, &play->actorCtx, &this->actor, 5); Math_Vec3f_Copy(&this->actor.velocity, &gZeroVec3f); diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index 1a2f8b685..abc773637 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -7,7 +7,7 @@ #include "z_en_syateki_crow.h" #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiCrow*)thisx) @@ -16,8 +16,8 @@ void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play); void EnSyatekiCrow_Update(Actor* thisx, PlayState* play); void EnSyatekiCrow_Draw(Actor* thisx, PlayState* play); -void EnSyatekiCrow_SetupWaitForSpawn(EnSyatekiCrow* this); -void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play); +void EnSyatekiCrow_SetupWaitForSignal(EnSyatekiCrow* this); +void EnSyatekiCrow_WaitForSignal(EnSyatekiCrow* this, PlayState* play); void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this); void EnSyatekiCrow_WaitToMove(EnSyatekiCrow* this, PlayState* play); void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play); @@ -105,7 +105,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { this->maxPointIndex = path->count; this->deathTimer = 20; this->waitTimer = 0; - EnSyatekiCrow_SetupWaitForSpawn(this); + EnSyatekiCrow_SetupWaitForSignal(this); } void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play) { @@ -114,22 +114,22 @@ void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void EnSyatekiCrow_SetupWaitForSpawn(EnSyatekiCrow* this) { +void EnSyatekiCrow_SetupWaitForSignal(EnSyatekiCrow* this) { Actor_SetScale(&this->actor, 0.03f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = 0.0f; this->actor.world = this->actor.home; this->actor.prevPos = this->actor.home.pos; this->actor.shape.rot = this->actor.world.rot; this->currentPointIndex = 1; this->actor.draw = NULL; - this->actionFunc = EnSyatekiCrow_WaitForSpawn; + this->actionFunc = EnSyatekiCrow_WaitForSignal; } /** - * Waits until the shooting gallery man sets the appropriate Guay flag to spawn. + * Waits until the shooting gallery man sets the appropriate Guay flag. */ -void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play) { +void EnSyatekiCrow_WaitForSignal(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true) && @@ -144,6 +144,10 @@ void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play) { } } +/** + * Positions the Guay at the start of its assigned path and rotates it to face the + * next point on the path, then sets it up to start waiting. + */ void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this) { Vec3f targetPos; @@ -165,9 +169,9 @@ void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this) { */ void EnSyatekiCrow_WaitToMove(EnSyatekiCrow* this, PlayState* play) { if (((EN_SYATEKI_CROW_GET_WAIT_MOD(&this->actor) * 20) + 20) < this->waitTimer) { - Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(this->actor.parent, NA_SE_EN_KAICHO_CRY); this->waitTimer = 0; - this->actor.speedXZ = EN_SYATEKI_CROW_GET_SPEED_MOD(&this->actor) + 6.0f; + this->actor.speed = EN_SYATEKI_CROW_GET_SPEED_MOD(&this->actor) + 6.0f; this->actor.gravity = -0.5f; this->actionFunc = EnSyatekiCrow_Fly; } else { @@ -181,7 +185,7 @@ void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { - EnSyatekiCrow_SetupWaitForSpawn(this); + EnSyatekiCrow_SetupWaitForSignal(this); return; } @@ -203,13 +207,13 @@ void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { } else { this->isActive = false; syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); - EnSyatekiCrow_SetupWaitForSpawn(this); + EnSyatekiCrow_SetupWaitForSignal(this); } SkelAnime_Update(&this->skelAnime); this->actor.shape.yOffset = (fabsf(this->skelAnime.curFrame - 3.0f) * 150.0f) + 1700.0f; if ((syatekiMan->perGameVar1.guaySpawnTimer % 90) == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_CRY); } } @@ -218,19 +222,19 @@ void EnSyatekiCrow_SetupDead(EnSyatekiCrow* this) { syatekiMan->score += 60; this->isActive = false; - this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); + this->actor.speed *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gGuayFlyAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); - this->actor.bgCheckFlags &= ~1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_DEAD); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->actionFunc = EnSyatekiCrow_Dead; } void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; if (this->actor.colorFilterParams & 0x4000) { @@ -242,7 +246,7 @@ void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play) { func_800B3030(play, &this->actor.world.pos, &sZeroVec, &sZeroVec, this->actor.scale.x * 10000.0f, 0, 0); syatekiMan->guayHitCounter++; syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); - EnSyatekiCrow_SetupWaitForSpawn(this); + EnSyatekiCrow_SetupWaitForSignal(this); } this->deathTimer++; diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 601095cfd..20abd71e4 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiDekunuts*)thisx) @@ -17,10 +17,10 @@ void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play); -void EnSyatekiDekunuts_SetupWaitForSpawn(EnSyatekiDekunuts* this); -void EnSyatekiDekunuts_WaitForSpawn(EnSyatekiDekunuts* this, PlayState* play); -void EnSyatekiDekunuts_SetupSpawn(EnSyatekiDekunuts* this); -void EnSyatekiDekunuts_Spawn(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupWaitForSignal(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_WaitForSignal(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupWaitToStart(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_WaitToStart(EnSyatekiDekunuts* this, PlayState* play); void EnSyatekiDekunuts_SetupWaitToEmerge(EnSyatekiDekunuts* this); void EnSyatekiDekunuts_WaitToEmerge(EnSyatekiDekunuts* this, PlayState* play); void EnSyatekiDekunuts_SetupEmerge(EnSyatekiDekunuts* this); @@ -152,7 +152,7 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { this->timer = 0; this->unk_1DC = 0; this->waitTimer = 0; - EnSyatekiDekunuts_SetupWaitForSpawn(this); + EnSyatekiDekunuts_SetupWaitForSignal(this); } void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play) { @@ -161,10 +161,10 @@ void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnSyatekiDekunuts_SetupWaitForSpawn(EnSyatekiDekunuts* this) { +void EnSyatekiDekunuts_SetupWaitForSignal(EnSyatekiDekunuts* this) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gDekuScrubUpAnim, 0.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world = this->actor.home; this->actor.prevPos = this->actor.home.pos; this->actor.shape.rot = this->actor.world.rot; @@ -176,18 +176,18 @@ void EnSyatekiDekunuts_SetupWaitForSpawn(EnSyatekiDekunuts* this) { this->isAlive = true; } - this->actionFunc = EnSyatekiDekunuts_WaitForSpawn; + this->actionFunc = EnSyatekiDekunuts_WaitForSignal; } /** - * Waits until the shooting gallery man sets the appropriate Deku Scrub flag to spawn. + * Waits until the shooting gallery man sets the appropriate Deku Scrub flag. */ -void EnSyatekiDekunuts_WaitForSpawn(EnSyatekiDekunuts* this, PlayState* play) { +void EnSyatekiDekunuts_WaitForSignal(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isAlive == true) && (syatekiMan->dekuScrubFlags & (1 << this->index))) { - EnSyatekiDekunuts_SetupSpawn(this); + EnSyatekiDekunuts_SetupWaitToStart(this); } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { this->isAlive = true; } @@ -201,7 +201,7 @@ void EnSyatekiDekunuts_WaitForSpawn(EnSyatekiDekunuts* this, PlayState* play) { /** * Positions the Deku Scrub to match up with its flower, then sets it up to start waiting. */ -void EnSyatekiDekunuts_SetupSpawn(EnSyatekiDekunuts* this) { +void EnSyatekiDekunuts_SetupWaitToStart(EnSyatekiDekunuts* this) { Vec3f pos; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; @@ -221,18 +221,18 @@ void EnSyatekiDekunuts_SetupSpawn(EnSyatekiDekunuts* this) { this->headdressType = EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_NORMAL; } - this->actionFunc = EnSyatekiDekunuts_Spawn; + this->actionFunc = EnSyatekiDekunuts_WaitToStart; } /** * Waits 20 frames, then plays a sound and starts the process of making the Deku Scrubs emerge. */ -void EnSyatekiDekunuts_Spawn(EnSyatekiDekunuts* this, PlayState* play) { +void EnSyatekiDekunuts_WaitToStart(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan; if (this->waitTimer > 20) { syatekiMan = (EnSyatekiMan*)this->actor.parent; - Actor_PlaySfxAtPos(&syatekiMan->actor, NA_SE_EN_NUTS_DAMAGE); + Actor_PlaySfx(&syatekiMan->actor, NA_SE_EN_NUTS_DAMAGE); this->waitTimer = 0; EnSyatekiDekunuts_SetupWaitToEmerge(this); } else { @@ -258,7 +258,7 @@ void EnSyatekiDekunuts_WaitToEmerge(EnSyatekiDekunuts* this, PlayState* play) { } void EnSyatekiDekunuts_SetupEmerge(EnSyatekiDekunuts* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_UP); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_UP); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -357,7 +357,7 @@ void EnSyatekiDekunuts_SetupGameEnd(EnSyatekiDekunuts* this) { */ void EnSyatekiDekunuts_GameEnd(EnSyatekiDekunuts* this, PlayState* play) { if (this->waitTimer > 20) { - EnSyatekiDekunuts_SetupWaitForSpawn(this); + EnSyatekiDekunuts_SetupWaitForSignal(this); this->waitTimer = 0; } else { this->waitTimer++; @@ -379,7 +379,7 @@ void EnSyatekiDekunuts_SetupDead(EnSyatekiDekunuts* this, PlayState* play) { syatekiMan->dekuScrubHitCounter++; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DAMAGE); this->isAlive = false; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DAMAGE); this->timer = 160; @@ -394,7 +394,7 @@ void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->timer == 160) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DIE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_DEAD); this->timer--; } else if (this->timer < 160) { Vec3f pos; @@ -411,7 +411,7 @@ void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play) { syatekiMan->dekuScrubFlags &= ~(1 << this->index); } - EnSyatekiDekunuts_SetupWaitForSpawn(this); + EnSyatekiDekunuts_SetupWaitForSignal(this); } } else if (this->timer < 160) { this->timer--; @@ -424,7 +424,7 @@ void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->actionFunc != EnSyatekiDekunuts_WaitForSpawn) && (this->timer < this->timeToBurrow) && + if ((this->actionFunc != EnSyatekiDekunuts_WaitForSignal) && (this->timer < this->timeToBurrow) && (this->timer > 10)) { if ((this->collider.base.acFlags & AC_HIT) && (this->isAlive == true)) { if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { @@ -463,7 +463,7 @@ void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play) { Vec3f flowerPos; s32 i; - if (this->actionFunc != EnSyatekiDekunuts_WaitForSpawn) { + if (this->actionFunc != EnSyatekiDekunuts_WaitForSignal) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiDekunuts_OverrideLimbDraw, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 759e97206..b0c052b5c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -12,7 +12,7 @@ #include "overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h" #include "overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiMan*)thisx) @@ -222,7 +222,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { } void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); } /** @@ -341,8 +341,8 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { } else { func_8019F208(); Rupees_ChangeBy(-20); - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; @@ -404,15 +404,15 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) func_80123F2C(play, 80); this->shootingGameState = SG_GAME_STATE_RUNNING; this->actionFunc = EnSyatekiMan_Swamp_StartGame; - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); break; case 0xA32: // You have to try harder! - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - func_801477B4(play); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + Message_CloseTextbox(play); player->stateFlags1 &= ~PLAYER_STATE1_20; - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = EnSyatekiMan_Swamp_Idle; gSaveContext.minigameStatus = MINIGAME_STATUS_END; this->shootingGameState = SG_GAME_STATE_NONE; @@ -469,8 +469,8 @@ void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags1 &= ~PLAYER_STATE1_20; - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = EnSyatekiMan_Swamp_Idle; this->shootingGameState = SG_GAME_STATE_NONE; } @@ -660,8 +660,8 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0x3FF; } - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); } } else { func_8019F230(); @@ -747,8 +747,8 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) player->actor.freezeTimer = 0; this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; player->stateFlags1 |= PLAYER_STATE1_20; - SET_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = EnSyatekiMan_Town_MovePlayerAndSayHighScore; } break; @@ -762,15 +762,15 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) Interface_InitMinigame(play); func_80123F2C(play, 0x63); this->shootingGameState = SG_GAME_STATE_RUNNING; - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); this->actionFunc = EnSyatekiMan_Town_StartGame; break; case 0x401: // You got [score]? Oh, that's too bad... - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - func_801477B4(play); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + Message_CloseTextbox(play); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Town_Idle; } else { @@ -781,10 +781,10 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) break; case 0x403: // You got [score]? Too bad... - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - func_801477B4(play); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + Message_CloseTextbox(play); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Town_Idle; } else { @@ -839,8 +839,8 @@ void EnSyatekiMan_Town_Talk(EnSyatekiMan* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); player->stateFlags1 &= ~PLAYER_STATE1_20; this->actionFunc = EnSyatekiMan_Town_Idle; this->shootingGameState = SG_GAME_STATE_NONE; @@ -872,13 +872,13 @@ void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Swamp_GiveReward; } else { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_10)) { - Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else if (this->score < 2180) { - Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_02)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } player->actor.shape.rot.y = -0x8000; @@ -933,14 +933,14 @@ void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { } else { if (this->prevTextId == 0x407) { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_20)) { - Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 500.0f, 100.0f); } } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_32_04)) { - Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_HUGE, 500.0f, 100.0f); } player->actor.shape.rot.y = -0x8000; @@ -958,8 +958,8 @@ void EnSyatekiMan_Town_GiveReward(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20; this->score = 0; this->shootingGameState = SG_GAME_STATE_NONE; - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = EnSyatekiMan_SetupIdle; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -1012,7 +1012,7 @@ void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play) { this->flagsIndex = 0; this->score = 0; player->stateFlags1 &= ~PLAYER_STATE1_20; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); + Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); this->dekuScrubFlags = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0); this->guayFlags = 0; this->wolfosFlags = 0; @@ -1036,7 +1036,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { // Spawn three guays after the player has killed all Deku Scrubs, or after 140 frames. sHasSpawnedGuaysForThisWave = true; this->perGameVar1.guaySpawnTimer = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); + Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); this->guayFlags = sGuayFlagsPerWave[this->flagsIndex]; if (this->flagsIndex == 3) { this->flagsIndex = 0; @@ -1078,7 +1078,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; sHasSpawnedGuaysForThisWave = false; - func_801A2C20(); + Audio_StopSubBgm(); this->actionFunc = EnSyatekiMan_Swamp_EndGame; } else if ((this->currentWave == 4) && (this->wolfosFlags == 0) && (this->perGameVar2.bonusDekuScrubHitCounter == 2)) { @@ -1087,7 +1087,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; sHasSpawnedGuaysForThisWave = false; - func_801A2C20(); + Audio_StopSubBgm(); this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; if (this->score == 2120) { Interface_SetPerfectLetters(play, PERFECT_LETTERS_TYPE_2); @@ -1118,9 +1118,9 @@ void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play) { this->prevTextId = 0xA34; this->shootingGameState = SG_GAME_STATE_ENDED; } else if (this->score >= 2000) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_01); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_63_02); + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); + CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->shootingGameState = SG_GAME_STATE_NONE; gSaveContext.minigameStatus = MINIGAME_STATUS_END; this->actionFunc = EnSyatekiMan_Swamp_Idle; @@ -1168,7 +1168,7 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += SECONDS_TO_TIMER(1); play->interfaceCtx.minigamePoints += 10; this->score += 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); sBonusTimer = 0; } else { sBonusTimer++; @@ -1342,7 +1342,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { if ((sModFromLosingTime == (timer % 50)) && (this->perGameVar1.octorokState >= SG_OCTO_STATE_INITIAL)) { if (this->flagsIndex < 15) { this->octorokFlags = sOctorokFlagsPerWave[this->flagsIndex++]; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); + Actor_PlaySfx(&this->actor, NA_SE_SY_FOUND); this->perGameVar1.octorokState = SG_OCTO_STATE_SPAWNING; } } @@ -1355,7 +1355,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; sModFromLosingTime = 0; this->actor.draw = EnSyatekiMan_Draw; - func_801A2C20(); + Audio_StopSubBgm(); this->actionFunc = EnSyatekiMan_Town_EndGame; if (this->score == 50) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index 162a6d718..401bc34ff 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -7,7 +7,7 @@ #include "z_en_syateki_okuta.h" #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiOkuta*)thisx) @@ -195,7 +195,7 @@ void func_80A363B4(EnSyatekiOkuta* this, PlayState* play) { return; } else { func_80A361B0(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } } @@ -225,7 +225,7 @@ void func_80A364C0(EnSyatekiOkuta* this) { void func_80A36504(EnSyatekiOkuta* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 4.0f)) { func_80A361B0(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_LAND); } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { func_80A362F8(this); } @@ -235,7 +235,7 @@ void func_80A3657C(EnSyatekiOkuta* this) { this->unk_2A4 = 0; this->unk_2AA = 300; if (this->unk_2A6 == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD1); + Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_DEAD1); } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); @@ -261,7 +261,7 @@ void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) { sp84.y = -0.5f; sp84.z = 0.0f; func_80A36148(&sp78, &sp84, -20, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); + Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); } this->unk_2A4++; @@ -369,12 +369,12 @@ void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play) { if (func_80A36A90(this, play)) { syatekiMan = (EnSyatekiMan*)this->actor.parent; if (this->unk_2A6 == 1) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); play->interfaceCtx.minigamePoints++; syatekiMan->score++; syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_RED; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); + Actor_PlaySfx(&this->actor, NA_SE_SY_ERROR); syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_BLUE; } diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 20871efb2..a4407dcc2 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -7,7 +7,7 @@ #include "z_en_syateki_wf.h" #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnSyatekiWf*)thisx) @@ -16,19 +16,19 @@ void EnSyatekiWf_Destroy(Actor* thisx, PlayState* play); void EnSyatekiWf_Update(Actor* thisx, PlayState* play2); void EnSyatekiWf_Draw(Actor* thisx, PlayState* play); -void func_80A201CC(EnSyatekiWf* this); -void func_80A20284(EnSyatekiWf* this, PlayState* play); -void func_80A2030C(EnSyatekiWf* this); -void func_80A20320(EnSyatekiWf* this, PlayState* play); -void func_80A20378(EnSyatekiWf* this); -void func_80A203DC(EnSyatekiWf* this, PlayState* play); -void func_80A20670(EnSyatekiWf* this); -void func_80A206DC(EnSyatekiWf* this, PlayState* play); -void func_80A20710(EnSyatekiWf* this); -void func_80A2075C(EnSyatekiWf* this, PlayState* play); -void func_80A2079C(EnSyatekiWf* this); -void func_80A20800(EnSyatekiWf* this, PlayState* play); -void func_80A208F8(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupWaitForSignal(EnSyatekiWf* this); +void EnSyatekiWf_WaitForSignal(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupWaitToMove(EnSyatekiWf* this); +void EnSyatekiWf_WaitToMove(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupRun(EnSyatekiWf* this); +void EnSyatekiWf_Run(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupJump(EnSyatekiWf* this); +void EnSyatekiWf_Jump(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupLand(EnSyatekiWf* this); +void EnSyatekiWf_Land(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_SetupHowl(EnSyatekiWf* this); +void EnSyatekiWf_Howl(EnSyatekiWf* this, PlayState* play); +void EnSyatekiWf_Dead(EnSyatekiWf* this, PlayState* play); static ColliderJntSphElementInit sJntSphElementsInit[1] = { { @@ -40,11 +40,11 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { BUMP_ON, OCELEM_ON, }, - { 17, { { 800, 0, 0 }, 25 }, 100 }, + { WOLFOS_NORMAL_LIMB_HEAD, { { 800, 0, 0 }, 25 }, 100 }, }, }; -static ColliderCylinderInit sCylinderInit1 = { +static ColliderCylinderInit sBodyCylinderInit = { { COLTYPE_HIT5, AT_NONE, @@ -77,7 +77,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static ColliderCylinderInit sCylinderInit2 = { +static ColliderCylinderInit sTailCylinderInit = { { COLTYPE_HIT5, AT_NONE, @@ -97,9 +97,9 @@ static ColliderCylinderInit sCylinderInit2 = { { 15, 20, -15, { 0, 0, 0 } }, }; -static Vec3f D_80A20EDC = { 0.0f, 20.0f, 0.0f }; +static Vec3f sVelocity = { 0.0f, 20.0f, 0.0f }; -static Vec3f D_80A20EE8 = { 0.0f, 0.0f, 0.0f }; +static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; ActorInit En_Syateki_Wf_InitVars = { ACTOR_EN_SYATEKI_WF, @@ -113,14 +113,24 @@ ActorInit En_Syateki_Wf_InitVars = { (ActorFunc)EnSyatekiWf_Draw, }; +typedef enum { + /* 0 */ EN_SYATEKI_WF_ANIM_WAIT, // unused + /* 1 */ EN_SYATEKI_WF_ANIM_RUN, + /* 2 */ EN_SYATEKI_WF_ANIM_JUMP, + /* 3 */ EN_SYATEKI_WF_ANIM_LAND, + /* 4 */ EN_SYATEKI_WF_ANIM_BACKFLIP, // unused + /* 5 */ EN_SYATEKI_WF_ANIM_DAMAGED, + /* 6 */ EN_SYATEKI_WF_ANIM_REAR_UP_FALL_OVER, +} EnSyatekiWfAnimation; + static AnimationInfo sAnimationInfo[] = { - { &gWolfosWaitingAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, - { &gWolfosRunningAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gWolfosRunningAnim, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, - { &gWolfosRunningAnim, 1.0f, 4.0f, 8.0f, ANIMMODE_ONCE, 1.0f }, - { &gWolfosBackflippingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gWolfosWaitAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, + { &gWolfosRunAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &gWolfosRunAnim, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, + { &gWolfosRunAnim, 1.0f, 4.0f, 8.0f, ANIMMODE_ONCE, 1.0f }, + { &gWolfosBackflipAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &gWolfosDamagedAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f }, - { &gWolfosRearingUpFallingOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &gWolfosRearUpFallOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, }; static InitChainEntry sInitChain[] = { @@ -128,17 +138,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -static Vec3f D_80A20FC4 = { 0.0f, 0.5f, 0.0f }; - -static Vec3f D_80A20FD0 = { 1200.0f, 0.0f, 0.0f }; - -static TexturePtr sEyeTextures[] = { - gWolfosNormalEyeOpenTex, - gWolfosNormalEyeHalfTex, - gWolfosNormalEyeNarrowTex, - gWolfosNormalEyeHalfTex, -}; - void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { s32 pad; EnSyatekiWf* this = THIS; @@ -160,12 +159,12 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { return; } - this->unk_2A0 = Lib_SegmentedToVirtual(path->points); - this->unk_2A4 = 1; - this->unk_2A6 = path->count; + this->pathPoints = Lib_SegmentedToVirtual(path->points); + this->currentPointIndex = 1; + this->maxPointIndex = path->count; Actor_ProcessInitChain(&this->actor, sInitChain); - this->unk_29C = 0; + this->waitTimer = 0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -175,146 +174,159 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { this->eyeIndex = 0; this->unk_2AC = 10.0f; - Collider_InitCylinder(play, &this->unk_2B4); - Collider_SetCylinder(play, &this->unk_2B4, &this->actor, &sCylinderInit1); - Collider_InitCylinder(play, &this->unk_300); - Collider_SetCylinder(play, &this->unk_300, &this->actor, &sCylinderInit2); - Collider_InitJntSph(play, &this->unk_34C); - Collider_SetJntSph(play, &this->unk_34C, &this->actor, &sJntSphInit, this->unk_36C); - this->unk_34C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->tailCollider); + Collider_SetCylinder(play, &this->tailCollider, &this->actor, &sTailCylinderInit); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderElements); + this->headCollider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; - SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, - this->morphTable, WOLFOS_NORMAL_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitAnim, this->jointTable, this->morphTable, + WOLFOS_NORMAL_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); this->actor.hintId = TATL_HINT_ID_WOLFOS; - func_80A201CC(this); + EnSyatekiWf_SetupWaitForSignal(this); } void EnSyatekiWf_Destroy(Actor* thisx, PlayState* play) { EnSyatekiWf* this = THIS; - Collider_DestroyCylinder(play, &this->unk_2B4); - Collider_DestroyCylinder(play, &this->unk_300); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->tailCollider); } -void func_80A200E0(EnSyatekiWf* this) { - Vec3f sp24; - s16 temp; +/** + * Positions the Wolfos at the start of its assigned path and rotates it to face + * the next point on the path. + */ +void EnSyatekiWf_InitPathStart(EnSyatekiWf* this) { + Vec3f targetPos; - this->actor.world.pos.x = this->unk_2A0[0].x; - this->actor.world.pos.y = this->unk_2A0[0].y; - this->actor.world.pos.z = this->unk_2A0[0].z; - sp24.x = this->unk_2A0[this->unk_2A4].x; - sp24.y = this->unk_2A0[this->unk_2A4].y; - sp24.z = this->unk_2A0[this->unk_2A4].z; - temp = Math_Vec3f_Yaw(&this->actor.world.pos, &sp24); - this->actor.shape.rot.y = temp; - this->actor.world.rot.y = temp; + this->actor.world.pos.x = this->pathPoints[0].x; + this->actor.world.pos.y = this->pathPoints[0].y; + this->actor.world.pos.z = this->pathPoints[0].z; + targetPos.x = this->pathPoints[this->currentPointIndex].x; + targetPos.y = this->pathPoints[this->currentPointIndex].y; + targetPos.z = this->pathPoints[this->currentPointIndex].z; + this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPos); } -void func_80A201CC(EnSyatekiWf* this) { +void EnSyatekiWf_SetupWaitForSignal(EnSyatekiWf* this) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world = this->actor.home; this->actor.prevPos = this->actor.home.pos; this->actor.shape.rot = this->actor.world.rot; this->actor.colChkInfo.health = 2; this->actor.draw = NULL; - this->unk_2A4 = 1; - this->unk_298 = 0; + this->currentPointIndex = 1; + this->isActive = false; syatekiMan->wolfosFlags &= ~(1 << EN_SYATEKI_WF_GET_INDEX(&this->actor)); - this->actionFunc = func_80A20284; + this->actionFunc = EnSyatekiWf_WaitForSignal; } -void func_80A20284(EnSyatekiWf* this, PlayState* play) { +/** + * Waits until the shooting gallery man sets the appropriate Wolfos flag. + */ +void EnSyatekiWf_WaitForSignal(EnSyatekiWf* this, PlayState* play) { EnSyatekiMan* syatekiMan; if (this->actor.parent != NULL) { syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_298 == 1)) { - func_80A200E0(this); - func_80A2030C(this); + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true)) { + EnSyatekiWf_InitPathStart(this); + EnSyatekiWf_SetupWaitToMove(this); } else if (syatekiMan->wolfosFlags & (1 << EN_SYATEKI_WF_GET_INDEX(&this->actor))) { - this->unk_298 = 1; + this->isActive = true; } } } -void func_80A2030C(EnSyatekiWf* this) { - this->actionFunc = func_80A20320; +void EnSyatekiWf_SetupWaitToMove(EnSyatekiWf* this) { + this->actionFunc = EnSyatekiWf_WaitToMove; } -void func_80A20320(EnSyatekiWf* this, PlayState* play) { - if (this->unk_29C >= 11) { - Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_WOLFOS_APPEAR); - this->unk_29C = 0; - func_80A20378(this); +/** + * Waits 11 frames, then makes the Wolfos start running forward. + */ +void EnSyatekiWf_WaitToMove(EnSyatekiWf* this, PlayState* play) { + if (this->waitTimer >= 11) { + Actor_PlaySfx(this->actor.parent, NA_SE_EN_WOLFOS_APPEAR); + this->waitTimer = 0; + EnSyatekiWf_SetupRun(this); } else { - this->unk_29C++; + this->waitTimer++; } } -void func_80A20378(EnSyatekiWf* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); - this->actor.speedXZ = 10.0f; +void EnSyatekiWf_SetupRun(EnSyatekiWf* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_RUN); + this->actor.speed = 10.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.draw = EnSyatekiWf_Draw; - this->actionFunc = func_80A203DC; + this->actionFunc = EnSyatekiWf_Run; } -void func_80A203DC(EnSyatekiWf* this, PlayState* play) { - Vec3f sp54; - f32 sp50; - s16 temp_v0; +/** + * Runs forward along its assigned path. If the Wolfos encounters a wall directly + * in front of it, this function will make it jump. If the Wolfos reaches a certain + * point along the path (which is specified via its params), this function will make + * it stop running and howl in place. + */ +void EnSyatekiWf_Run(EnSyatekiWf* this, PlayState* play) { + Vec3f targetPoint; + f32 distToTarget; + s16 wallYawDiff; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { - func_80A201CC(this); + EnSyatekiWf_SetupWaitForSignal(this); } - sp54.x = this->unk_2A0[this->unk_2A4].x; - sp54.y = this->unk_2A0[this->unk_2A4].y; - sp54.z = this->unk_2A0[this->unk_2A4].z; - temp_v0 = (this->actor.wallYaw - this->actor.world.rot.y) + 0x8000; + targetPoint.x = this->pathPoints[this->currentPointIndex].x; + targetPoint.y = this->pathPoints[this->currentPointIndex].y; + targetPoint.z = this->pathPoints[this->currentPointIndex].z; + wallYawDiff = (this->actor.wallYaw - this->actor.world.rot.y) + 0x8000; - if (this->actor.bgCheckFlags & 1) { - if (this->actor.bgCheckFlags & 8) { - if ((ABS(temp_v0) < 0x1555) && (this->actor.wallPoly != this->actor.floorPoly)) { - func_80A20670(this); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if ((ABS(wallYawDiff) < 0x1555) && (this->actor.wallPoly != this->actor.floorPoly)) { + EnSyatekiWf_SetupJump(this); return; } } - if (this->actor.bgCheckFlags & 4) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) { this->actor.velocity.y = 2.0f; } - sp50 = Math_Vec3f_DistXZ(&this->actor.world.pos, &sp54); - this->unk_2A8 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp54); + distToTarget = Math_Vec3f_DistXZ(&this->actor.world.pos, &targetPoint); + this->yawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPoint); - if (sp50 > 15.0f) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2A8, 5, 0x3000, 0x100); + if (distToTarget > 15.0f) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTarget, 5, 0x3000, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; - if (sp50 < 50.0f) { - if (this->actor.speedXZ > 3.0f) { - this->actor.speedXZ = this->actor.speedXZ - 0.5f; + if (distToTarget < 50.0f) { + if (this->actor.speed > 3.0f) { + this->actor.speed = this->actor.speed - 0.5f; } else { - this->actor.speedXZ = this->actor.speedXZ; + this->actor.speed = this->actor.speed; } } } else { - if (this->unk_2A4 < (this->unk_2A6 - 1)) { - if (this->unk_2A4 == EN_SYATEKI_WF_GET_PARAM_F0(&this->actor)) { - func_80A2079C(this); + if (this->currentPointIndex < (this->maxPointIndex - 1)) { + if (this->currentPointIndex == EN_SYATEKI_WF_GET_POINT_TO_HOWL(&this->actor)) { + EnSyatekiWf_SetupHowl(this); } - this->unk_2A4++; + this->currentPointIndex++; } else { - this->unk_298 = 0; - this->unk_2A4 = 1; - func_80A201CC(this); + this->isActive = false; + this->currentPointIndex = 1; + EnSyatekiWf_SetupWaitForSignal(this); } } @@ -324,76 +336,82 @@ void func_80A203DC(EnSyatekiWf* this, PlayState* play) { } } -void func_80A20670(EnSyatekiWf* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); +void EnSyatekiWf_SetupJump(EnSyatekiWf* this) { + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); this->actor.velocity.y = 20.0f; - this->actor.speedXZ = 5.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); - this->actionFunc = func_80A206DC; + this->actor.speed = 5.0f; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_JUMP); + this->actionFunc = EnSyatekiWf_Jump; } -void func_80A206DC(EnSyatekiWf* this, PlayState* play) { - if (this->actor.bgCheckFlags & 2) { - func_80A20710(this); +void EnSyatekiWf_Jump(EnSyatekiWf* this, PlayState* play) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + EnSyatekiWf_SetupLand(this); } } -void func_80A20710(EnSyatekiWf* this) { - this->actor.speedXZ = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - this->actionFunc = func_80A2075C; +void EnSyatekiWf_SetupLand(EnSyatekiWf* this) { + this->actor.speed = 0.0f; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_LAND); + this->actionFunc = EnSyatekiWf_Land; } -void func_80A2075C(EnSyatekiWf* this, PlayState* play) { +/** + * Freezes the Wolfos in place until its landing animation is complete, then makes it start running. + */ +void EnSyatekiWf_Land(EnSyatekiWf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A20378(this); + EnSyatekiWf_SetupRun(this); } } -void func_80A2079C(EnSyatekiWf* this) { - this->unk_29A = 40; - this->actor.speedXZ = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); - this->actionFunc = func_80A20800; +void EnSyatekiWf_SetupHowl(EnSyatekiWf* this) { + this->timer = 40; + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_DAMAGED); + this->actionFunc = EnSyatekiWf_Howl; } -void func_80A20800(EnSyatekiWf* this, PlayState* play) { +/** + * Makes the Wolfos stand completely still until 40 frames after its damaged animation is complete. + */ +void EnSyatekiWf_Howl(EnSyatekiWf* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - this->unk_29A--; - if (this->unk_29A == 0) { - func_80A20378(this); + this->timer--; + if (this->timer == 0) { + EnSyatekiWf_SetupRun(this); } } } -void func_80A20858(EnSyatekiWf* this, PlayState* play) { +void EnSyatekiWf_SetupDead(EnSyatekiWf* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - this->unk_298 = 0; - this->actor.speedXZ = 0.0f; - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + this->isActive = false; + this->actor.speed = 0.0f; + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 2); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_REAR_UP_FALL_OVER); syatekiMan->score += 100; - this->actionFunc = func_80A208F8; + this->actionFunc = EnSyatekiWf_Dead; } -void func_80A208F8(EnSyatekiWf* this, PlayState* play) { +void EnSyatekiWf_Dead(EnSyatekiWf* this, PlayState* play) { s32 pad; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A201CC(this); + EnSyatekiWf_SetupWaitForSignal(this); } else { - Vec3f sp68; - Vec3f sp5C = D_80A20FC4; + Vec3f firePos; + Vec3f sFireVelocityAndAccel = { 0.0f, 0.5f, 0.0f }; s32 i; for (i = (s32)this->skelAnime.animLength - (s32)this->skelAnime.curFrame; i >= 0; i--) { - sp68.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; - sp68.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; - sp68.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); - func_800B3030(play, &sp68, &sp5C, &sp5C, 0x64, 0, 2); + firePos.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; + firePos.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; + firePos.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + func_800B3030(play, &firePos, &sFireVelocityAndAccel, &sFireVelocityAndAccel, 100, 0, 2); } } } @@ -402,7 +420,7 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnSyatekiWf* this = THIS; - if (this->actionFunc != func_80A20284) { + if (this->actionFunc != EnSyatekiWf_WaitForSignal) { SkelAnime_Update(&this->skelAnime); } @@ -410,33 +428,41 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 5); this->actionFunc(this, play); - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); } else { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x3E8, 0); Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0x3E8, 0); } - if ((this->unk_2B4.base.acFlags & AC_HIT) || (this->unk_300.base.acFlags & AC_HIT) || - (this->unk_34C.base.acFlags & AC_HIT)) { - this->unk_2B4.base.acFlags &= ~AC_HIT; - this->unk_300.base.acFlags &= ~AC_HIT; - this->unk_34C.base.acFlags &= ~AC_HIT; + if ((this->bodyCollider.base.acFlags & AC_HIT) || (this->tailCollider.base.acFlags & AC_HIT) || + (this->headCollider.base.acFlags & AC_HIT)) { + this->bodyCollider.base.acFlags &= ~AC_HIT; + this->tailCollider.base.acFlags &= ~AC_HIT; + this->headCollider.base.acFlags &= ~AC_HIT; + + // The Wolfos always starts with 2 health, so the subtraction below is guaranteed to kill it; + // the else-block is never reached in practice. If you *could* damage the Wolfos without killing + // it, then the number "30" would appear every time you hit it, and the player's displayed score + // would increase by 30. However, the else-block doesn't increase the shooting gallery man's + // "score" variable, so it would become desynchronized from the displayed score. This could cause + // weird behavior, like not getting a free replay after finishing a game with 2000 or more points. this->actor.colChkInfo.health -= 2; if (this->actor.colChkInfo.health == 0) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); - func_80A20858(this, play); + EnSyatekiWf_SetupDead(this, play); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 3, 0); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 3, 0); } } - Collider_UpdateCylinder(&this->actor, &this->unk_2B4); - if ((this->actionFunc != func_80A20284) && (this->actionFunc != func_80A208F8) && (this->actor.draw != NULL)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_300.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_2B4.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_34C.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + if ((this->actionFunc != EnSyatekiWf_WaitForSignal) && (this->actionFunc != EnSyatekiWf_Dead) && + (this->actor.draw != NULL)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tailCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->headCollider.base); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; } @@ -455,19 +481,26 @@ s32 EnSyatekiWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve } void EnSyatekiWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f sTailColliderOffset = { 1200.0f, 0.0f, 0.0f }; EnSyatekiWf* this = THIS; - Vec3f sp18; + Vec3f tailColliderPos; - Collider_UpdateSpheres(limbIndex, &this->unk_34C); + Collider_UpdateSpheres(limbIndex, &this->headCollider); if (limbIndex == WOLFOS_NORMAL_LIMB_TAIL) { - Matrix_MultVec3f(&D_80A20FD0, &sp18); - this->unk_300.dim.pos.x = sp18.x; - this->unk_300.dim.pos.y = sp18.y; - this->unk_300.dim.pos.z = sp18.z; + Matrix_MultVec3f(&sTailColliderOffset, &tailColliderPos); + this->tailCollider.dim.pos.x = tailColliderPos.x; + this->tailCollider.dim.pos.y = tailColliderPos.y; + this->tailCollider.dim.pos.z = tailColliderPos.z; } } void EnSyatekiWf_Draw(Actor* thisx, PlayState* play) { + static TexturePtr sEyeTextures[] = { + gWolfosNormalEyeOpenTex, + gWolfosNormalEyeHalfTex, + gWolfosNormalEyeNarrowTex, + gWolfosNormalEyeHalfTex, + }; EnSyatekiWf* this = THIS; OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index 56770952f..4a1fb2f72 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -4,9 +4,9 @@ #include "global.h" #include "objects/object_wf/object_wf.h" -#define EN_SYATEKI_WF_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_WF_GET_POINT_TO_HOWL(thisx) (((thisx)->params & 0xF0) >> 4) #define EN_SYATEKI_WF_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_WF_PARAMS(index, unkF0, unused) (((index << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unused & 0xF)) +#define EN_SYATEKI_WF_PARAMS(index, pointToHowl, unused) (((index << 8) & 0xFF00) | ((pointToHowl << 4) & 0xF0) | (unused & 0xF)) struct EnSyatekiWf; @@ -19,19 +19,19 @@ typedef struct EnSyatekiWf { /* 0x20C */ Vec3s morphTable[WOLFOS_NORMAL_LIMB_MAX]; /* 0x290 */ UNK_TYPE1 unk_290[0x4]; /* 0x294 */ EnSyatekiWfActionFunc actionFunc; - /* 0x298 */ s16 unk_298; - /* 0x29A */ s16 unk_29A; - /* 0x29C */ s16 unk_29C; - /* 0x2A0 */ Vec3s* unk_2A0; - /* 0x2A4 */ s16 unk_2A4; - /* 0x2A6 */ s16 unk_2A6; - /* 0x2A8 */ s16 unk_2A8; - /* 0x2AC */ f32 unk_2AC; + /* 0x298 */ s16 isActive; + /* 0x29A */ s16 timer; + /* 0x29C */ s16 waitTimer; + /* 0x2A0 */ Vec3s* pathPoints; + /* 0x2A4 */ s16 currentPointIndex; + /* 0x2A6 */ s16 maxPointIndex; + /* 0x2A8 */ s16 yawTarget; + /* 0x2AC */ f32 unk_2AC; // set to 10.0f, but never used /* 0x2B0 */ u8 eyeIndex; - /* 0x2B4 */ ColliderCylinder unk_2B4; - /* 0x300 */ ColliderCylinder unk_300; - /* 0x34C */ ColliderJntSph unk_34C; - /* 0x36C */ ColliderJntSphElement unk_36C[1]; + /* 0x2B4 */ ColliderCylinder bodyCollider; + /* 0x300 */ ColliderCylinder tailCollider; + /* 0x34C */ ColliderJntSph headCollider; + /* 0x36C */ ColliderJntSphElement headColliderElements[1]; /* 0x3AC */ UNK_TYPE1 unk_3AC[0x20]; } EnSyatekiWf; // size = 0x3CC diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index a84059634..386e80a1f 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -313,7 +313,7 @@ void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, PlayState* play) { player->actor.freezeTimer = 60; Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_80123E90(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); EnTalkGibud_SetupWalkToPlayer(this); } @@ -322,7 +322,7 @@ void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupWalkToPlayer(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_WALK); - this->actor.speedXZ = 0.4f; + this->actor.speed = 0.4f; if (this->actionFunc == EnTalkGibud_AttemptPlayerFreeze) { this->playerStunWaitTimer = 80; @@ -358,7 +358,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { this->playerStunWaitTimer = 60; Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); func_80123E90(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); } else { this->playerStunWaitTimer--; } @@ -374,9 +374,9 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_RIZA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } else if (!(play->gameplayFrames & 95)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } } @@ -409,7 +409,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { damageSfxId = player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S; play->damagePlayer(play, -8); - func_800B8E58(player, damageSfxId); + Player_PlaySfx(player, damageSfxId); Rumble_Request(this->actor.xzDistToPlayer, 240, 1, 12); this->grabDamageTimer = 0; } else { @@ -417,7 +417,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_ATTACK); } if (!(player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B62 != 0)) { @@ -447,14 +447,14 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupGrabFail(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DAMAGE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); - this->actor.speedXZ = -2.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + this->actor.speed = -2.0f; this->actionFunc = EnTalkGibud_GrabFail; } void EnTalkGibud_GrabFail(EnTalkGibud* this, PlayState* play) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -487,18 +487,18 @@ void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupWalkToHome(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_WALK); - this->actor.speedXZ = 0.4f; + this->actor.speed = 0.4f; this->actionFunc = EnTalkGibud_WalkToHome; } void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { Math_SmoothStepToS(&this->headRotation.y, 0, 1, 100, 0); Math_SmoothStepToS(&this->upperBodyRotation.y, 0, 1, 100, 0); - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { - if (this->actor.speedXZ > 0.2f) { - this->actor.speedXZ -= 0.2f; + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 5.0f) { + if (this->actor.speed > 0.2f) { + this->actor.speed -= 0.2f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 200, 10); @@ -507,7 +507,8 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { EnTalkGibud_SetupIdle(this); } } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 450); + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 450); this->actor.world.rot = this->actor.shape.rot; } if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play)) { @@ -520,13 +521,13 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupStunned(EnTalkGibud* this) { this->stunTimer = 10; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; if (this->drawDmgEffTimer != 0) { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 0x28); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } else { - Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 0x28); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); } this->actionFunc = EnTalkGibud_Stunned; @@ -548,17 +549,17 @@ void EnTalkGibud_Stunned(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupDamage(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DAMAGE); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->stunTimer = 0; this->grabWaitTimer = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.speedXZ = -2.0f; + this->actor.speed = -2.0f; this->actionFunc = EnTalkGibud_Damage; } void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { - if (this->actor.speedXZ < 0.0f) { - this->actor.speedXZ += 0.15f; + if (this->actor.speed < 0.0f) { + this->actor.speed += 0.15f; } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -585,7 +586,7 @@ void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupDead(EnTalkGibud* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DEATH); this->actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; this->actionFunc = EnTalkGibud_Dead; } @@ -611,7 +612,7 @@ void EnTalkGibud_SetupRevive(EnTalkGibud* this) { Animation_Change(&this->skelAnime, &gGibdoRedeadDeathAnim, -1.0f, Animation_GetLastFrame(&gGibdoRedeadDeathAnim), 0.0f, ANIMMODE_ONCE, -8.0f); this->actor.flags |= ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_REVERSE); this->deathTimer = 0; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnTalkGibud_Revive; @@ -751,7 +752,7 @@ void EnTalkGibud_CheckPresentedItem(EnTalkGibud* this, PlayState* play) { default: break; } - func_801477B4(play); + Message_CloseTextbox(play); } else if (this->itemAction <= PLAYER_IA_MINUS1) { Message_StartTextbox(play, 0x1389, &this->actor); this->textId = 0x1389; @@ -776,7 +777,7 @@ void EnTalkGibud_PassiveIdle(EnTalkGibud* this, PlayState* play) { this->isTalking = true; Message_StartTextbox(play, 0x1388, &this->actor); this->textId = 0x1388; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_AIM); EnTalkGibud_SetupTalk(this); } else if (this->actor.xzDistToPlayer < 100.0f && !(this->collider.base.acFlags & AC_HIT)) { Actor_TrackPlayer(play, &this->actor, &this->headRotation, &this->upperBodyRotation, this->actor.focus.pos); @@ -895,7 +896,7 @@ void EnTalkGibud_FacePlayerWhenTalking(EnTalkGibud* this, PlayState* play) { s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) < 150.0f) && + if ((Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f) && !(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_200000)) && !(player->stateFlags2 & (PLAYER_STATE2_80 | PLAYER_STATE2_4000))) { @@ -913,7 +914,7 @@ s32 EnTalkGibud_PlayerInRangeWithCorrectState(EnTalkGibud* this, PlayState* play s32 EnTalkGibud_PlayerOutOfRange(EnTalkGibud* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { + if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) >= 150.0f) { return true; } @@ -1017,7 +1018,7 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { switch (this->actor.colChkInfo.damageEffect) { case EN_TALK_GIBUD_DMGEFF_DAMAGE: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (player->unk_ADC != 0) { this->unk_3F7 = player->unk_ADD; } @@ -1038,7 +1039,7 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { break; case EN_TALK_GIBUD_DMGEFF_FIRE_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { EnTalkGibud_SetupDead(this); } else { @@ -1050,7 +1051,7 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { break; case EN_TALK_GIBUD_DMGEFF_LIGHT_ARROW: - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { EnTalkGibud_SetupDead(this); } else { @@ -1112,7 +1113,7 @@ void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, PlayState* pla Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 29); if (this->actionFunc == EnTalkGibud_Grab && this->grabState == EN_TALK_GIBUD_GRAB_START && - (this->actor.bgCheckFlags & 8)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { targetPos = player->actor.world.pos; targetPos.x += 10.0f * Math_SinS(this->actor.wallYaw); targetPos.z += 10.0f * Math_CosS(this->actor.wallYaw); diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 332560403..56384193e 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -188,7 +188,7 @@ void func_80BB69FC(EnTanron2* this, PlayState* play) { if ((this->unk_158 == 0) && ((sp34 + sp30 + sp2C) < 2.0f)) { this->unk_158 = 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_SLIME_EAT); + Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_EAT); } Math_ApproachF(&this->unk_15C, 1.0f, 1.0f, 0.02f); @@ -201,7 +201,7 @@ void func_80BB69FC(EnTanron2* this, PlayState* play) { void func_80BB6B80(EnTanron2* this) { this->actionFunc = func_80BB6BD8; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.z = 0.0f; this->actor.velocity.y = 0.0f; this->actor.velocity.x = 0.0f; @@ -228,7 +228,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_JUMP2); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_JUMP2); sp2C = D_80BB8450->unk_6BC.x - this->actor.world.pos.x; sp28 = D_80BB8450->unk_6BC.z - this->actor.world.pos.z; @@ -240,14 +240,14 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { } else { sp32 = Math_Atan2S(sp2C, sp28); } - this->actor.speedXZ = Rand_ZeroFloat(5.0f) + 5.0f; + this->actor.speed = Rand_ZeroFloat(5.0f) + 5.0f; break; case 1: sp32 = Math_Atan2S(sp2C, sp28); - this->actor.speedXZ += 2.0f; - if (this->actor.speedXZ > 10.0f) { - this->actor.speedXZ = 10.0f; + this->actor.speed += 2.0f; + if (this->actor.speed > 10.0f) { + this->actor.speed = 10.0f; } break; @@ -255,14 +255,14 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { sp32 = Math_Atan2S(player->actor.world.pos.x - this->actor.world.pos.x, player->actor.world.pos.z - this->actor.world.pos.z) + (s16)Rand_ZeroFloat(20000.0f); - this->actor.speedXZ = Rand_ZeroFloat(7.0f) + 7.0f; + this->actor.speed = Rand_ZeroFloat(7.0f) + 7.0f; if ((this->unk_152 == 0) && (D_80BB8450->unk_1F6 == 0)) { this->unk_158 = 1; } break; } Matrix_RotateYS(sp32, MTXMODE_NEW); - Matrix_MultVecZ(this->actor.speedXZ, &this->actor.velocity); + Matrix_MultVecZ(this->actor.speed, &this->actor.velocity); this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 12.0f; this->unk_14E = 5; } @@ -285,7 +285,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { func_80BB69C0(this); } else { this->unk_150 = 10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_JUMP1); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_JUMP1); } } } @@ -318,9 +318,9 @@ void func_80BB6F78(EnTanron2* this, PlayState* play) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_JUMP2); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_JUMP2); if (D_80BB8450->unk_6F8 > 0.1f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER_L); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER_L); } this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 12.0f; this->unk_14E = 5; @@ -344,7 +344,7 @@ void func_80BB6F78(EnTanron2* this, PlayState* play) { this->unk_159 = 0; } else { this->unk_150 = 0xA; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_JUMP1); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_JUMP1); } } } @@ -381,7 +381,7 @@ void func_80BB7398(EnTanron2* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_IKURA_DEAD); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_DAMAGE); } } @@ -427,7 +427,7 @@ void func_80BB7578(EnTanron2* this, PlayState* play) { if (acHitInfo->toucher.dmgFlags & 0x80) { func_80BB6B80(this); this->unk_158 = 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_DAMAGE); if ((player->targetedActor != NULL) && (&this->actor != player->targetedActor)) { player->targetedActor = &this->actor; play->actorCtx.targetContext.arrowPointedActor = &this->actor; @@ -448,7 +448,7 @@ void func_80BB7578(EnTanron2* this, PlayState* play) { func_80BB7398(this, play); } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IKURA_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_IKURA_DAMAGE); goto block_18; } } diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 0e7be15f3..bc8fee2fd 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -153,7 +153,7 @@ void EnTanron3_SetupLive(EnTanron3* this, PlayState* play) { this->rotationStep = 0; this->rotationScale = 5; this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = 50; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; this->speedMaxStep = 0.5f; this->deviation.x = randPlusMinusPoint5Scaled(500.0f); this->deviation.y = randPlusMinusPoint5Scaled(100.0f); @@ -180,7 +180,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { Player* player = GET_PLAYER(play); this->skelAnime.curFrame = 4.0f; - if ((player->actor.bgCheckFlags & 1) && player->actor.shape.feetPos[0].y >= 438.0f) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && player->actor.shape.feetPos[0].y >= 438.0f) { // Player is standing on the central platform, so stop chasing them this->isNonHostile = true; } else if (this->isNonHostile && this->workTimer[WORK_TIMER_WAIT] == 0 && !(this->timer & 0x1F)) { @@ -205,7 +205,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { Math_Vec3f_Copy(&this->targetPos, &player->actor.world.pos); if (!(this->timer & 0xF)) { if (Rand_ZeroOne() < 0.5f && this->actor.xzDistToPlayer <= 200.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PIRANHA_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_ATTACK); } } @@ -219,7 +219,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { case true: if (sGyorg->unk_324 != 0 && !(this->timer & 0x7)) { this->nextRotationAngle = 0x4E20; - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; } else { this->nextRotationAngle = 0x1F40; } @@ -242,7 +242,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { } if (this->workTimer[WORK_TIMER_OUT_OF_WATER] == 0) { - if (this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speedXZ > 1.0f) { + if (this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speed > 1.0f) { this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); this->deviation.x = randPlusMinusPoint5Scaled(100.0f); this->deviation.y = randPlusMinusPoint5Scaled(50.0f + extraScaleY); @@ -265,7 +265,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, atanTemp, this->rotationScale, this->rotationStep, 0); Math_ApproachS(&this->rotationStep, this->targetRotationStep, 1, 0x100); - Math_ApproachF(&this->actor.speedXZ, this->targetSpeedXZ, 1.0f, this->speedMaxStep); + Math_ApproachF(&this->actor.speed, this->targetSpeedXZ, 1.0f, this->speedMaxStep); Actor_MoveWithoutGravityReverse(&this->actor); } else { switch (this->isBeached) { @@ -275,13 +275,13 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { this->targetPosWithDeviation.y = this->waterSurfaceYPos - 50.0f; this->workTimer[WORK_TIMER_OUT_OF_WATER] = 25; Math_ApproachS(&this->actor.world.rot.x, 0x3000, 5, 0xBD0); - if (this->actor.bgCheckFlags & 8) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = -1.0f; } } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { // Fish has touched land this->isBeached = true; } @@ -289,10 +289,10 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { case true: this->nextRotationAngle = 0x3A98; this->actor.gravity = -1.5f; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { // Fish is still touching land, so it's still beached. Randomly flop around this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 5.0f; - this->actor.speedXZ = Rand_ZeroFloat(2.0f) + 2.0f; + this->actor.speed = Rand_ZeroFloat(2.0f) + 2.0f; if (Rand_ZeroOne() < 0.5f) { this->targetShapeRotation.x = (s16)randPlusMinusPoint5Scaled(500.0f) + this->targetShapeRotation.x + 0x8000; @@ -346,8 +346,8 @@ void EnTanron3_SetupDie(EnTanron3* this, PlayState* play) { this->actor.world.rot.x = Math_Atan2S_XY(sqrtf(SQ(xDistance) + SQ(zDistance)), -yDistance); this->actor.world.rot.y = Math_Atan2S_XY(zDistance, xDistance); this->workTimer[WORK_TIMER_DIE] = 6; - this->actor.speedXZ = 10.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_MINI_DEAD); + this->actor.speed = 10.0f; + Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_MINI_DEAD); } void EnTanron3_Die(EnTanron3* this, PlayState* play) { @@ -413,7 +413,7 @@ void EnTanron3_Update(Actor* thisx, PlayState* play) { splashPos.y = this->waterSurfaceYPos + 10.0f; splashPos.z = this->actor.world.pos.z; EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 1, 500); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); } } diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index b53343931..1eaf1d128 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -51,7 +51,7 @@ void EnTanron4_Init(Actor* thisx, PlayState* play2) { OBJECT_TANRON4_LIMB_MAX); thisx->flags &= ~ACTOR_FLAG_1; - thisx->speedXZ = 3.0f + KREG(48); + thisx->speed = 3.0f + KREG(48); thisx->uncullZoneForward = 10000.0f + KREG(70); this->randRollTimer = Rand_ZeroFloat(10.0f); diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index c052c3309..e285869a5 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -163,7 +163,7 @@ void EnTanron5_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, (Rand_ZeroFloat(0.015f) + 0.01f) * D_80BE5DD0); } - this->actor.speedXZ = (Rand_ZeroFloat(10.0f) + 10.0f) * D_80BE5DD0; + this->actor.speed = (Rand_ZeroFloat(10.0f) + 10.0f) * D_80BE5DD0; this->actor.velocity.y = (Rand_ZeroFloat(10.0f) + 15.0f) * D_80BE5DD0; this->actor.gravity = -2.5f * D_80BE5DD0; this->actor.terminalVelocity = -1000.0f * D_80BE5DD0; @@ -349,7 +349,7 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { } this->actor.shape.rot.y += phi_v0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BIG_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BIG_BOMB_EXPLOSION); func_800BC848(&this->actor, play, 4, 4); this->unk_1A0++; } else { @@ -360,7 +360,7 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { sp90.y = info->bumper.hitPos.y; sp90.z = info->bumper.hitPos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); CollisionCheck_SpawnShieldParticlesMetal(play, &sp90); } } @@ -415,7 +415,7 @@ void func_80BE5818(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); } - if (this->actor.speedXZ > 0.02f) { + if (this->actor.speed > 0.02f) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); } @@ -425,7 +425,7 @@ void func_80BE5818(Actor* thisx, PlayState* play2) { this->actor.shape.rot.y += this->unk_19A; sp6C = 1225.0f; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (ENTANRON5_GET(&this->actor) < ENTANRON5_108) { Math_Vec3f_Copy(&sp5C, &this->actor.world.pos); sp5C.y = this->actor.floorHeight; @@ -441,9 +441,9 @@ void func_80BE5818(Actor* thisx, PlayState* play2) { } else { sp6C = 400.0f; this->unk_198 += 0x2000; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_198 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index 257aea283..fd1710264 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -12,7 +12,7 @@ #include "objects/object_meganeana_obj/object_meganeana_obj.h" #include "objects/object_haka_obj/object_haka_obj.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_REACT_TO_LENS) #define THIS ((EnTest2*)thisx) @@ -96,7 +96,7 @@ void EnTest2_Update(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); } - if (play->roomCtx.curRoom.unk5) { + if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { this->actor.update = EnTest2_UpdateForLens; } else { this->actor.update = Actor_Noop; @@ -108,9 +108,9 @@ void EnTest2_UpdateForLens(Actor* thisx, PlayState* play) { EnTest2* this = THIS; if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) { - this->actor.flags |= ACTOR_FLAG_80; + this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; } else { - this->actor.flags &= ~ACTOR_FLAG_80; + this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; } } @@ -122,7 +122,7 @@ void EnTest2_Draw(Actor* thisx, PlayState* play) { if (this->animMat != NULL) { AnimatedMat_Draw(play, this->animMat); } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { OPEN_DISPS(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 22883d53d..8d1c726b7 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -4,7 +4,6 @@ * Description: Kafei */ -#include "prevent_bss_reordering.h" #include "z_en_test3.h" #include "objects/object_test3/object_test3.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" @@ -316,9 +315,9 @@ s32 func_80A3E898(EnTest3* this, PlayState* play) { func_80151BB4(play, 2); } if (textId == 0xFFFF) { - func_801477B4(play); + Message_CloseTextbox(play); } else if (textId) { // != 0 - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); } if (textId == 0x296B) { LinkAnimation_PlayOnceSetSpeed(play, &this->player.skelAnime, &gPlayerAnim_al_yareyare, 2.0f / 3.0f); @@ -576,7 +575,7 @@ Actor* func_80A3F2BC(PlayState* play, EnTest3* this, s32 actorId, s32 category, if (actorId == actor->id) { f32 dy = this->player.actor.world.pos.y - actor->world.pos.y; - if ((fabsf(dy) < arg5) && (Actor_XZDistanceBetweenActors(&this->player.actor, actor) < arg4)) { + if ((fabsf(dy) < arg5) && (Actor_WorldDistXZToActor(&this->player.actor, actor) < arg4)) { return actor; } } @@ -688,7 +687,7 @@ s32 func_80A3F8D4(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul func_80A3F15C(this, play, arg2); if (((postActor = func_80A3F2BC(play, this, ACTOR_EN_PST, ACTORCAT_PROP, 100.0f, 20.0f)) != NULL) || ((postActor = func_80A3F2BC(play, this, ACTOR_EN_PM, ACTORCAT_NPC, 100.0f, 20.0f)) != NULL)) { - this->player.actor.home.rot.y = Actor_YawBetweenActors(&this->player.actor, postActor); + this->player.actor.home.rot.y = Actor_WorldYawTowardActor(&this->player.actor, postActor); } play->startPlayerCutscene(play, &this->player, 0x61); return true; @@ -773,7 +772,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { if (play->actorCtx.flags & ACTORCTX_FLAG_5) { this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->unk_D8D); } - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); D_80A41D20 = 2; } else { func_80A3F73C(this, play); diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 5a6c4573f..180bc59d4 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -315,7 +315,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { if (CURRENT_DAY == 0) { if (gSaveContext.save.time < CLOCK_TIME(6, 1)) { gSaveContext.save.time = CLOCK_TIME(6, 0); - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState)); this->unk_144 = 1; @@ -367,7 +367,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && - (play->roomCtx.unk31 == 0) && !Play_IsDebugCamEnabled()) { + (play->roomCtx.status == 0) && !Play_IsDebugCamEnabled()) { s16 temp_a2; u16 temp_a0 = D_80A43364[this->unk_144]; s16 temp_a3; diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index 83451fa02..a041a1aaf 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -73,7 +73,8 @@ void EnTest5_HandleBottleAction(EnTest5* this, PlayState* play) { if (playerPosRelativeToWater.x >= 0.0f && playerPosRelativeToWater.x <= this->xLength && playerPosRelativeToWater.z >= 0.0f && playerPosRelativeToWater.z <= this->zLength && fabsf(playerPosRelativeToWater.y) < 100.0f && player->actor.depthInWater > 12.0f) { - Actor_PickUp(&this->actor, play, GI_MAX, this->actor.xzDistToPlayer, fabsf(this->actor.playerHeightRel)); + Actor_OfferGetItem(&this->actor, play, GI_MAX, this->actor.xzDistToPlayer, + fabsf(this->actor.playerHeightRel)); } } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 6f1c5ac54..2b57ecf51 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -806,7 +806,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B))) { this->unk_286 = 1; this->unk_27A = 39; - Audio_QueueSeqCmd(0x111400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } if (DECR(this->unk_27A) == 0) { diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index bf0dc785b..56b6c6f81 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -762,7 +762,7 @@ void func_80AF2938(EnTest7* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_20000000; this->unk_144 |= 2; this->unk_148.unk_04 = 30.0f; - if (play->roomCtx.curRoom.unk3 != 1) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) { func_80AF082C(this, func_80AF2AE8); } else { func_80AF082C(this, func_80AF2EC8); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 58f44d468..674059f1a 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -403,7 +403,7 @@ s32 func_80C10E98(PlayState* play) { if (temp_s1_5 != NULL) { temp_s1_5->velocity.y = Rand_ZeroFloat(3.0f) + 6.0f; - temp_s1_5->speedXZ = Rand_ZeroFloat(3.0f) + 3.0f; + temp_s1_5->speed = Rand_ZeroFloat(3.0f) + 3.0f; temp_s1_5->world.rot.y = phi_s3; } phi_s3 += (s16)(0x10000 / (spB0 + spAC + phi_s0_2 + spA0 + phi_s2 + spA8)); @@ -430,7 +430,7 @@ void func_80C11338(EnThiefbird* this, PlayState* play) { item = (EnItem00*)SubS_FindActor(play, &item->actor, ACTORCAT_MISC, ACTOR_EN_ITEM00); if (item != NULL) { if (item->unk152 > 0) { - if (Actor_XZDistanceBetweenActors(&player->actor, &item->actor) > 10.0f) { + if (Actor_WorldDistXZToActor(&player->actor, &item->actor) > 10.0f) { for (i = 0; i < ARRAY_COUNT(D_80C13664); i++) { if (item->actor.params == D_80C13664[i]) { break; @@ -438,7 +438,7 @@ void func_80C11338(EnThiefbird* this, PlayState* play) { } if (i != ARRAY_COUNT(D_80C13664)) { - temp_f0 = Actor_DistanceBetweenActors(&this->actor, &item->actor); + temp_f0 = Actor_WorldDistXYZToActor(&this->actor, &item->actor); if (temp_f0 < phi_f20) { this->unk_3EC = item; phi_f20 = temp_f0; @@ -457,7 +457,7 @@ void func_80C11454(EnThiefbird* this) { this->drawDmgEffFrozenSteamScale = 0.75f; this->drawDmgEffAlpha = 1.0f; this->actor.flags &= ~ACTOR_FLAG_200; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_80C114C0(EnThiefbird* this, PlayState* play) { @@ -482,29 +482,29 @@ void func_80C11590(EnThiefbird* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); sp38 = Animation_OnFrame(&this->skelAnime, 0.0f); - this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 3.0f; + this->actor.speed = (Rand_ZeroOne() * 1.5f) + 3.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else { - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { - this->unk_192 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } } if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 5, 0x300, 0x10) && (sp38 != 0) && (Rand_ZeroOne() < 0.1f)) { - s16 yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y; + s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y; if (yaw > 0) { this->unk_192 += Rand_S16Offset(4096, 4096); } else { this->unk_192 -= Rand_S16Offset(4096, 4096); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); } - if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_190 = -4096; } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 75.0f)) { this->unk_190 = -Rand_S16Offset(2048, 2048); @@ -538,7 +538,7 @@ void func_80C118E4(EnThiefbird* this) { Animation_MorphToLoop(&this->skelAnime, &gTakkuriAttackAnim, -10.0f); this->unk_18E = 300; this->actionFunc = func_80C1193C; - this->actor.speedXZ = 5.0f; + this->actor.speed = 5.0f; } void func_80C1193C(EnThiefbird* this, PlayState* play) { @@ -547,17 +547,17 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } if (this->unk_18E != 0) { this->unk_18E--; } - pitch = Actor_PitchBetweenActors(&this->actor, &player->actor); + pitch = Actor_WorldPitchTowardActor(&this->actor, &player->actor); pitch = CLAMP(pitch, -0x2800, 0x2800); Math_SmoothStepToS(&this->actor.shape.rot.x, pitch, 4, 0x800, 0x80); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 6, 0x1000, 0x100); } else if (Actor_IsFacingPlayer(&this->actor, 0x3C00) || (this->actor.xzDistToPlayer > 120.0f)) { s16 rot = BINANG_ROT180(this->actor.yawTowardsPlayer - player->actor.shape.rot.y); @@ -574,10 +574,10 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { if ((this->unk_18E == 0) || (player->stateFlags1 & PLAYER_STATE1_800000) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (this->collider.base.atFlags & AT_HIT) || - (this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > -40.0f)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.depthInWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); + Actor_PlaySfx(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); if (!(this->collider.base.atFlags & AT_BOUNCED)) { if ((D_80C1392C != 0) && CUR_UPG_VALUE(UPG_QUIVER) && ((STOLEN_ITEM_1 == STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 == STOLEN_ITEM_NONE)) && @@ -599,15 +599,15 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { } void func_80C11C60(EnThiefbird* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; Animation_PlayOnce(&this->skelAnime, &gTakkuriDeathAnim); - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.shape.rot.x = 0; this->unk_18E = 40; this->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_THIEFBIRD_DEAD); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_THIEFBIRD_DEAD); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_10; this->unk_192 = 0x1C00; @@ -623,7 +623,7 @@ void func_80C11D14(EnThiefbird* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { if (this->unk_18E < 38) { func_80C114C0(this, play); - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else { return; } @@ -654,7 +654,7 @@ void func_80C11DF0(EnThiefbird* this, PlayState* play) { this->actor.shape.rot.y += this->unk_192; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { for (i = 0; i < ARRAY_COUNT(this->limbPos); i++) { func_800B3030(play, &this->limbPos[i], &gZeroVec3f, &gZeroVec3f, 0x8C, 0, 0); } @@ -676,20 +676,20 @@ void func_80C11F6C(EnThiefbird* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gTakkuriFlyWithItemAnim, -4.0f); func_80C10984(this, 15); if (this->actor.colChkInfo.damageEffect != 3) { - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } if (this->actor.colChkInfo.damageEffect == 5) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); } else if (this->actor.colChkInfo.damageEffect == 1) { - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); } else { - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_THIEFBIRD_DAMAGE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_THIEFBIRD_DAMAGE); } this->collider.base.acFlags &= ~AC_ON; @@ -697,7 +697,7 @@ void func_80C11F6C(EnThiefbird* this, PlayState* play) { this->unk_190 = -0x1000; this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer); } else { - this->unk_190 = Actor_PitchToPoint(&this->actor, &D_80C13920); + this->unk_190 = Actor_WorldPitchTowardPoint(&this->actor, &D_80C13920); } this->unk_18E = 40; @@ -725,20 +725,20 @@ void func_80C1215C(EnThiefbird* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { if (this->unk_18E < 38) { func_80C114C0(this, play); - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; } else { return; } } SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else if (this->unk_3E8 == 0) { this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer); } else { - this->unk_192 = Actor_YawToPoint(&this->actor, &D_80C13920); - this->unk_190 = Actor_PitchToPoint(&this->actor, &D_80C13920); + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &D_80C13920); + this->unk_190 = Actor_WorldPitchTowardPoint(&this->actor, &D_80C13920); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 6, 0x1000, 0x100); @@ -771,7 +771,7 @@ void func_80C12378(EnThiefbird* this, PlayState* play) { } SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else { this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer); @@ -790,7 +790,7 @@ void func_80C1242C(EnThiefbird* this) { this->actor.flags |= ACTOR_FLAG_10; this->collider.base.acFlags |= AC_ON; this->actionFunc = func_80C124B0; - this->actor.speedXZ = 12.0f; + this->actor.speed = 12.0f; } void func_80C124B0(EnThiefbird* this, PlayState* play) { @@ -798,17 +798,18 @@ void func_80C124B0(EnThiefbird* this, PlayState* play) { s16 temp_v1; SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else { - this->unk_192 = Actor_YawToPoint(&this->actor, &D_80C13920); + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &D_80C13920); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 6, 0x1000, 0x100); - Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_PitchToPoint(&this->actor, &D_80C13920), 6, 0x1000, 0x100); + Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &D_80C13920), 6, 0x1000, + 0x100); temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); if (temp_v0 != NULL) { - temp_v1 = temp_v0->world.rot.x - Actor_PitchToPoint(temp_v0, &this->actor.focus.pos); + temp_v1 = temp_v0->world.rot.x - Actor_WorldPitchTowardPoint(temp_v0, &this->actor.focus.pos); if (ABS_ALT(temp_v1) < 0x1800) { if (temp_v1 > 0) { this->unk_3E0 = 25.0f; @@ -826,7 +827,7 @@ void func_80C124B0(EnThiefbird* this, PlayState* play) { this->unk_3E0 * Math_SinS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); } - if (Actor_DistanceToPoint(&this->actor, &D_80C13920) < 1000.0f) { + if (Actor_WorldDistXYZToPoint(&this->actor, &D_80C13920) < 1000.0f) { func_80C126A8(this); } } @@ -852,7 +853,7 @@ void func_80C12744(EnThiefbird* this) { this->collider.base.acFlags |= AC_ON; this->actor.flags |= ACTOR_FLAG_10; this->actionFunc = func_80C127F4; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->skelAnime.playSpeed = 3.0f; } @@ -863,7 +864,7 @@ void func_80C127F4(EnThiefbird* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->unk_3EC != NULL) && ((this->unk_3EC->actor.update == NULL) || (this->unk_3EC->unk152 == 0) || - (Actor_XZDistanceBetweenActors(&player->actor, &this->unk_3EC->actor) <= 10.0f))) { + (Actor_WorldDistXZToActor(&player->actor, &this->unk_3EC->actor) <= 10.0f))) { this->unk_3EC = NULL; } @@ -880,19 +881,19 @@ void func_80C127F4(EnThiefbird* this, PlayState* play) { } if (this->unk_3EC != NULL) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 3, 0x2000, 0x100); } else { - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, &this->unk_3EC->actor), 3, - 0x2000, 0x100); + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &this->unk_3EC->actor), + 3, 0x2000, 0x100); } temp_v0 = Math_Vec3f_Pitch(&this->limbPos[9], &this->unk_3EC->actor.world.pos); temp_v0 = CLAMP(temp_v0, -0x3000, 0x3000); Math_SmoothStepToS(&this->actor.shape.rot.x, temp_v0, 4, 0x800, 0x80); - temp_f0 = Actor_DistanceToPoint(&this->unk_3EC->actor, &this->limbPos[9]); - this->actor.speedXZ = (0.02f * temp_f0) + 2.0f; - this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, 4.0f); - if ((this->unk_3EC->actor.speedXZ <= 0.0f) && (temp_f0 < 40.0f)) { + temp_f0 = Actor_WorldDistXYZToPoint(&this->unk_3EC->actor, &this->limbPos[9]); + this->actor.speed = (0.02f * temp_f0) + 2.0f; + this->actor.speed = CLAMP_MAX(this->actor.speed, 4.0f); + if ((this->unk_3EC->actor.speed <= 0.0f) && (temp_f0 < 40.0f)) { s32 i; this->unk_3EC->unk152 = 0; @@ -907,8 +908,8 @@ void func_80C127F4(EnThiefbird* this, PlayState* play) { this->unk_190 = -0x3800; } } else { - this->actor.speedXZ = 4.0f; - if (this->actor.bgCheckFlags & 8) { + this->actor.speed = 4.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 6, 0x1000, 0x100); } else { Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 6, 0x1000, 0x100); @@ -1042,7 +1043,7 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { func_80C12D00(this); if (((this->skelAnime.animation == &gTakkuriFlyAnim) && Animation_OnFrame(&this->skelAnime, 13.0f)) || ((this->skelAnime.animation == &gTakkuriFlyWithItemAnim) && Animation_OnFrame(&this->skelAnime, 1.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_FLUTTER); + Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } } diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index 4e09f01a9..c0ae22fd5 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -1,7 +1,11 @@ /* * File: z_en_time_tag.c * Overlay: ovl_En_Time_Tag - * Description: + * Description: Various text-, time- and event-based triggers. There are 4 variations of this actor. + * - Song of Soaring engraving + * - Clocktown Rooftop Oath to Order event + * - Mikau's and Lulu's diary + * - Kick out of scene event after a certain time */ #include "z_en_time_tag.h" @@ -15,20 +19,23 @@ void EnTimeTag_Init(Actor* thisx, PlayState* play); void EnTimeTag_Destroy(Actor* thisx, PlayState* play); void EnTimeTag_Update(Actor* thisx, PlayState* play); -void func_80AC9FD4(EnTimeTag* this, PlayState* play); -void func_80AC9FE4(EnTimeTag* this, PlayState* play); -void func_80ACA0A8(EnTimeTag* this, PlayState* play); -void func_80ACA12C(EnTimeTag* this, PlayState* play); -void func_80ACA184(EnTimeTag* this, PlayState* play); -void func_80ACA268(EnTimeTag* this, PlayState* play); -void func_80ACA348(EnTimeTag* this, PlayState* play); -void func_80ACA3C0(EnTimeTag* this, PlayState* play); -void func_80ACA418(EnTimeTag* this, PlayState* play); -void func_80ACA5F8(EnTimeTag* this, PlayState* play); -void func_80ACA714(EnTimeTag* this, PlayState* play); -void func_80ACA724(EnTimeTag* this, PlayState* play); -void func_80ACA7C4(EnTimeTag* this, PlayState* play); -void func_80ACA840(EnTimeTag* this, PlayState* play); +void EnTimeTag_RooftopOath_DoNothing(EnTimeTag* this, PlayState* play); +void EnTimeTag_RooftopOath_Cutscene(EnTimeTag* this, PlayState* play); +void EnTimeTag_RooftopOath_Wait(EnTimeTag* this, PlayState* play); + +void EnTimeTag_SoaringEngraving_GetSong(EnTimeTag* this, PlayState* play); +void EnTimeTag_SoaringEngraving_StartCutscene(EnTimeTag* this, PlayState* play); +void EnTimeTag_SoaringEngraving_Wait(EnTimeTag* this, PlayState* play); + +void EnTimeTag_Diary_AfterOcarina(EnTimeTag* this, PlayState* play); +void EnTimeTag_Diary_TeachEvanSongSnippets(EnTimeTag* this, PlayState* play); +void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play); +void EnTimeTag_Diary_Wait(EnTimeTag* this, PlayState* play); + +void EnTimeTag_KickOut_DoNothing(EnTimeTag* this, PlayState* play); +void EnTimeTag_KickOut_Transition(EnTimeTag* this, PlayState* play); +void EnTimeTag_KickOut_WaitForTrigger(EnTimeTag* this, PlayState* play); +void EnTimeTag_KickOut_WaitForTime(EnTimeTag* this, PlayState* play); ActorInit En_Time_Tag_InitVars = { ACTOR_EN_TIME_TAG, @@ -45,37 +52,41 @@ ActorInit En_Time_Tag_InitVars = { void EnTimeTag_Init(Actor* thisx, PlayState* play) { EnTimeTag* this = THIS; - this->actionFunc = func_80ACA840; + this->actionFunc = EnTimeTag_KickOut_WaitForTime; - switch (ENTIMETAG_GET_E000(&this->actor)) { - case 4: + switch (TIMETAG_GET_TYPE(&this->actor)) { + case TIMETAG_KICKOUT_FINAL_HOURS: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40) || (CURRENT_DAY != 3)) { Actor_Kill(&this->actor); return; } - this->actor.home.rot.x = 0; - this->actor.home.rot.y = 0; + // Overwrite kickout time to midnight + TIMETAG_KICKOUT_HOUR(&this->actor) = 0; + TIMETAG_KICKOUT_MINUTE(&this->actor) = 0; break; - case 2: - this->actionFunc = func_80ACA0A8; + case TIMETAG_ROOFTOP_OATH: + this->actionFunc = EnTimeTag_RooftopOath_Wait; this->actor.flags |= ACTOR_FLAG_2000000; break; - case 1: - this->actionFunc = func_80ACA268; + case TIMETAG_SOARING_ENGRAVING: + this->actionFunc = EnTimeTag_SoaringEngraving_Wait; this->actor.flags |= ACTOR_FLAG_2000000; if (CHECK_QUEST_ITEM(QUEST_SONG_SOARING)) { this->actor.textId = 0xC02; - return; + } else { + this->actor.textId = 0; } - this->actor.textId = 0; break; - case 3: - this->actionFunc = func_80ACA5F8; + case TIMETAG_DIARY: + this->actionFunc = EnTimeTag_Diary_Wait; this->actor.textId = 0; - this->actor.home.rot.x = 0; + TIMETAG_DIARY_TIMER(&this->actor) = 0; + break; + + default: break; } } @@ -83,14 +94,16 @@ void EnTimeTag_Init(Actor* thisx, PlayState* play) { void EnTimeTag_Destroy(Actor* thisx, PlayState* play) { } -void func_80AC9FD4(EnTimeTag* this, PlayState* play) { +void EnTimeTag_RooftopOath_DoNothing(EnTimeTag* this, PlayState* play) { } -void func_80AC9FE4(EnTimeTag* this, PlayState* play) { +void EnTimeTag_RooftopOath_Cutscene(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - this->actionFunc = func_80AC9FD4; + + this->actionFunc = EnTimeTag_RooftopOath_DoNothing; gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; + if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { SET_WEEKEVENTREG(WEEKEVENTREG_25_02); @@ -100,12 +113,12 @@ void func_80AC9FE4(EnTimeTag* this, PlayState* play) { } } -void func_80ACA0A8(EnTimeTag* this, PlayState* play) { +void EnTimeTag_RooftopOath_Wait(EnTimeTag* this, PlayState* play) { EnTimeTag* this2 = this; if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_OATH)) { if (this->actor.cutscene != -1) { - this->actionFunc = func_80AC9FE4; + this->actionFunc = EnTimeTag_RooftopOath_Cutscene; ActorCutscene_SetIntentToPlay(this2->actor.cutscene); gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; } @@ -113,192 +126,217 @@ void func_80ACA0A8(EnTimeTag* this, PlayState* play) { } } -void func_80ACA12C(EnTimeTag* this, PlayState* play) { +void EnTimeTag_SoaringEngraving_GetSong(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { - this->actionFunc = func_80ACA268; + this->actionFunc = EnTimeTag_SoaringEngraving_Wait; this->actor.textId = 0xC02; Item_Give(play, ITEM_SONG_SOARING); } } -void func_80ACA184(EnTimeTag* this, PlayState* play) { +void EnTimeTag_SoaringEngraving_StartCutscene(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actor.cutscene); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->actionFunc = func_80ACA12C; + this->actionFunc = EnTimeTag_SoaringEngraving_GetSong; } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } -void func_80ACA208(EnTimeTag* this, PlayState* play) { +void EnTimeTag_SoaringEngraving_SubsequentInteraction(EnTimeTag* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); - this->actionFunc = func_80ACA268; + Message_CloseTextbox(play); + this->actionFunc = EnTimeTag_SoaringEngraving_Wait; } } -void func_80ACA268(EnTimeTag* this, PlayState* play) { +void EnTimeTag_SoaringEngraving_Wait(EnTimeTag* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.textId == 0) { - this->actionFunc = func_80ACA184; + this->actionFunc = EnTimeTag_SoaringEngraving_StartCutscene; } else { - this->actionFunc = func_80ACA208; + this->actionFunc = EnTimeTag_SoaringEngraving_SubsequentInteraction; } } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && - (Flags_GetSwitch(play, ENTIMETAG_GET_SWITCHFLAG(&this->actor)) || + (Flags_GetSwitch(play, TIMETAG_SOARING_GET_SWITCHFLAG(&this->actor)) || CHECK_QUEST_ITEM(QUEST_SONG_SOARING))) { this->actor.flags |= ACTOR_FLAG_1; func_800B8614(&this->actor, play, 110.0f); } } -void func_80ACA348(EnTimeTag* this, PlayState* play) { - if (this->actor.home.rot.x > 0) { - this->actor.home.rot.x--; +void EnTimeTag_Diary_AfterOcarina(EnTimeTag* this, PlayState* play) { + if (TIMETAG_DIARY_TIMER(&this->actor) > 0) { + TIMETAG_DIARY_TIMER(&this->actor)--; return; } - if (this->actor.home.rot.z != 0) { - func_80151938(play, 0x1230); + if (TIMETAG_DIARY_SONG(&this->actor) != TIMETAG_DIARY_SONG_EVAN_PART1) { + // TIMETAG_DIARY_SONG_EVAN_PART2 + Message_ContinueTextbox(play, 0x1230); } else { - func_80151938(play, 0x122D); + // TIMETAG_DIARY_SONG_EVAN_PART1 + Message_ContinueTextbox(play, 0x122D); } - this->actionFunc = func_80ACA418; + this->actionFunc = EnTimeTag_Diary_Cutscene; } -void func_80ACA3C0(EnTimeTag* this, PlayState* play) { - if ((play->msgCtx.unk11F00->state == 0) && (play->msgCtx.msgMode == 0x1B)) { - this->actor.home.rot.x = 5; - this->actionFunc = func_80ACA348; +void EnTimeTag_Diary_TeachEvanSongSnippets(EnTimeTag* this, PlayState* play) { + if ((play->msgCtx.ocarinaStaff->state == 0) && (play->msgCtx.msgMode == 0x1B)) { + TIMETAG_DIARY_TIMER(&this->actor) = 5; + this->actionFunc = EnTimeTag_Diary_AfterOcarina; play->msgCtx.msgLength = 0; play->msgCtx.msgMode = 0; } } -void func_80ACA418(EnTimeTag* this, PlayState* play) { +void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 0x101C: - case 0x101D: - case 0x101E: - case 0x122D: - func_80151938(play, play->msgCtx.currentTextId + 1); + case 0x101C: // Lulu diary part 1 + case 0x101D: // Lulu diary part 2 + case 0x101E: // Lulu diary part 3 + case 0x122D: // Mikau diary part 2 + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; - case 0x101F: - case 0x122A: - case 0x1230: - func_801477B4(play); - this->actionFunc = func_80ACA5F8; + case 0x101F: // Lulu diary part 4 + case 0x122A: // Can not read Zora script + case 0x1230: // Mikau diary part 4 + Message_CloseTextbox(play); + this->actionFunc = EnTimeTag_Diary_Wait; if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); } break; - case 0x122B: + case 0x122B: // Mikau diary part 1 func_80152434(play, 0x3F); - this->actionFunc = func_80ACA3C0; - this->actor.home.rot.z = 0; + this->actionFunc = EnTimeTag_Diary_TeachEvanSongSnippets; + TIMETAG_DIARY_SONG(&this->actor) = TIMETAG_DIARY_SONG_EVAN_PART1; break; - case 0x122E: + case 0x122E: // Mikau diary part 3 func_80152434(play, 0x40); - this->actionFunc = func_80ACA3C0; - this->actor.home.rot.z = 1; + this->actionFunc = EnTimeTag_Diary_TeachEvanSongSnippets; + TIMETAG_DIARY_SONG(&this->actor) = TIMETAG_DIARY_SONG_EVAN_PART2; + break; + + default: break; } } break; case TEXT_STATE_CLOSING: - this->actionFunc = func_80ACA5F8; + this->actionFunc = EnTimeTag_Diary_Wait; break; } - if (this->actor.home.rot.x != 0) { + if (TIMETAG_DIARY_TIMER(&this->actor) != 0) { if (this->actor.cutscene == -1) { - this->actor.home.rot.x = 0; + TIMETAG_DIARY_TIMER(&this->actor) = 0; } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actor.cutscene); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->actor.home.rot.x = 0; + TIMETAG_DIARY_TIMER(&this->actor) = 0; } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } } } -void func_80ACA5F8(EnTimeTag* this, PlayState* play) { +void EnTimeTag_Diary_Wait(EnTimeTag* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (ENTIMETAG_GET_SWITCHFLAG(&this->actor) == 1) { + if (TIMETAG_DIARY_GET_TYPE(&this->actor) == TIMETAG_DIARY_LULU) { Message_StartTextbox(play, 0x101C, &this->actor); } else { + // TIMETAG_DIARY_MIKAU Message_StartTextbox(play, 0x122B, &this->actor); } - this->actor.home.rot.x = 1; + TIMETAG_DIARY_TIMER(&this->actor) = 1; } else { + // unable to read Zora script Message_StartTextbox(play, 0x122A, &this->actor); + + //! FAKE: https://decomp.me/scratch/AHRNe if (0) {} + ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 4; Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); - this->actor.home.rot.x = 0; + TIMETAG_DIARY_TIMER(&this->actor) = 0; } - this->actionFunc = func_80ACA418; + this->actionFunc = EnTimeTag_Diary_Cutscene; } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play)) { func_800B8614(&this->actor, play, 110.0f); } } -void func_80ACA714(EnTimeTag* this, PlayState* play) { +void EnTimeTag_KickOut_DoNothing(EnTimeTag* this, PlayState* play) { } -void func_80ACA724(EnTimeTag* this, PlayState* play) { +void EnTimeTag_KickOut_Transition(EnTimeTag* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { - play->nextEntrance = play->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; + play->nextEntrance = play->setupExitList[TIMETAG_KICKOUT_GET_EXIT_INDEX(&this->actor)]; play->transitionTrigger = TRANS_TRIGGER_START; - if (!ENTIMETAG_GET_E000(&this->actor)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_OC_DOOR_OPEN); + if (TIMETAG_GET_TYPE(&this->actor) == TIMETAG_KICKOUT_DOOR) { + Actor_PlaySfx(&this->actor, NA_SE_OC_DOOR_OPEN); } - this->actionFunc = func_80ACA714; + this->actionFunc = EnTimeTag_KickOut_DoNothing; } } -void func_80ACA7C4(EnTimeTag* this, PlayState* play) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { +/** + * Setup a request to kickout, but wait for an external system to unset + * both `WEEKEVENTREG_KICKOUT_WAIT` and `WEEKEVENTREG_KICKOUT_TIME_PASSED` + */ +void EnTimeTag_KickOut_WaitForTrigger(EnTimeTag* this, PlayState* play) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { func_800B7298(play, &this->actor, PLAYER_CSMODE_7); - Message_StartTextbox(play, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); - this->actionFunc = func_80ACA724; + Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); + this->actionFunc = EnTimeTag_KickOut_Transition; } } -void func_80ACA840(EnTimeTag* this, PlayState* play) { - s16 temp_ft4; - s16 temp_hi; +/** + * Wait for a certain time to pass, then trigger the kickout event. + * If an external system sets `WEEKEVENTREG_KICKOUT_WAIT`, then instead of triggering the kickout event now, + * store the kickout by going to `EnTimeTag_KickOut_WaitForTrigger`. + * If the time has passed but the kickout is being stored, then `WEEKEVENTREG_KICKOUT_TIME_PASSED` is set here + * to indicate to external systems that the time has passed and is waiting for a trigger. + */ +void EnTimeTag_KickOut_WaitForTime(EnTimeTag* this, PlayState* play) { + s16 hour; + s16 minute; - if ((play->sceneId != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { - temp_ft4 = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F - temp_hi = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_01)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_63_02)) { - this->actionFunc = func_80ACA7C4; - } else if ((temp_ft4 == this->actor.home.rot.x) && (temp_hi == this->actor.home.rot.y)) { - SET_WEEKEVENTREG(WEEKEVENTREG_63_02); - } - } else if ((temp_ft4 == this->actor.home.rot.x) && (temp_hi == this->actor.home.rot.y) && - !Play_InCsMode(play)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); - Message_StartTextbox(play, ENTIMETAG_GET_1FE0(&this->actor) + 0x1883, NULL); - this->actionFunc = func_80ACA724; + if ((play->sceneId == SCENE_YADOYA) && (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_ROOM_KEY)) { + // Having the room key allows you to stay in Stock Pot Inn + return; + } + + hour = TIME_TO_HOURS_F(gSaveContext.save.time); + minute = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; + + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { + this->actionFunc = EnTimeTag_KickOut_WaitForTrigger; + } else if ((hour == TIMETAG_KICKOUT_HOUR(&this->actor)) && (minute == TIMETAG_KICKOUT_MINUTE(&this->actor))) { + SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); } + } else if ((hour == TIMETAG_KICKOUT_HOUR(&this->actor)) && (minute == TIMETAG_KICKOUT_MINUTE(&this->actor)) && + !Play_InCsMode(play)) { + func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); + this->actionFunc = EnTimeTag_KickOut_Transition; } } diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h index ed6b611e4..128e01973 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.h @@ -7,10 +7,57 @@ struct EnTimeTag; typedef void (*EnTimeTagActionFunc)(struct EnTimeTag*, PlayState*); -#define ENTIMETAG_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENTIMETAG_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) -#define ENTIMETAG_GET_1FE0(thisx) (((thisx)->params & 0x1FE0) >> 0x5) -#define ENTIMETAG_GET_E000(thisx) (((thisx)->params & 0xE000) >> 0xD) +#define TIMETAG_GET_TYPE(thisx) (((thisx)->params & 0xE000) >> 0xD) + +#define TIMETAG_KICKOUT_GET_TEXT(thisx) (((thisx)->params & 0x1FE0) >> 0x5) +#define TIMETAG_KICKOUT_GET_EXIT_INDEX(thisx) ((thisx)->params & 0x1F) +#define TIMETAG_KICKOUT_HOUR(thisx) ((thisx)->home.rot.x) +#define TIMETAG_KICKOUT_MINUTE(thisx) ((thisx)->home.rot.y) + +#define TIMETAG_SOARING_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) + +#define TIMETAG_DIARY_GET_TYPE(thisx) ((thisx)->params & 0x7F) +#define TIMETAG_DIARY_TIMER(thisx) ((thisx)->home.rot.x) +#define TIMETAG_DIARY_SONG(thisx) ((thisx)->home.rot.z) + +typedef enum { + /* 0 */ TIMETAG_KICKOUT_DOOR, + /* 1 */ TIMETAG_SOARING_ENGRAVING, + /* 2 */ TIMETAG_ROOFTOP_OATH, + /* 3 */ TIMETAG_DIARY, + /* 4 */ TIMETAG_KICKOUT_FINAL_HOURS, + /* 5 */ TIMETAG_KICKOUT_NO_DOOR +} TimeTagType; + +typedef enum { + /* 0 */ TIMETAG_DIARY_MIKAU, + /* 1 */ TIMETAG_DIARY_LULU +} TimeTagDiaryType; + +typedef enum { + /* 0 */ TIMETAG_DIARY_SONG_EVAN_PART1, + /* 1 */ TIMETAG_DIARY_SONG_EVAN_PART2 +} TimeTagDiarySong; + +typedef enum { + /* 0 */ TIMETAG_KICKOUT_TEXT_0, // I am closing the shop + /* 1 */ TIMETAG_KICKOUT_TEXT_SWAMP_SHOOTING_GALLERY, // time to close shop + /* 2 */ TIMETAG_KICKOUT_TEXT_STOCK_POT_INN, // Stock Pot Inn locking the door + /* 3 */ TIMETAG_KICKOUT_TEXT_HONEY_AND_DARLING, // need some alone time + /* 4 */ TIMETAG_KICKOUT_TEXT_LOTTERY, // business is finished + /* 5 */ TIMETAG_KICKOUT_TEXT_BARN_DAY, // the lady needs a break + /* 6 */ TIMETAG_KICKOUT_TEXT_GENERIC, // (Many scenes) place is about to close + /* 7 */ TIMETAG_KICKOUT_TEXT_BARN_NIGHT, // they came + /* 8 */ TIMETAG_KICKOUT_TEXT_TRADING_POST, // we have to close shop + /* 9 */ TIMETAG_KICKOUT_TEXT_MILK_BAR, // I have to get ready for business + /* 10 */ TIMETAG_KICKOUT_TEXT_CURIOSITY_SHOP_BACK_1, // shop is opening, you need to go + /* 11 */ TIMETAG_KICKOUT_TEXT_CURIOSITY_SHOP_BACK_2, // shop is opening, we're in the way + /* 12 */ TIMETAG_KICKOUT_TEXT_TOWN_SHOOTING_GALLERY_1, // it's time to close + /* 13 */ TIMETAG_KICKOUT_TEXT_TOWN_SHOOTING_GALLERY_2, // quick, it's closing time + /* 14 */ TIMETAG_KICKOUT_TEXT_SWORDSMANS_SCHOOL, // need to cut the moon, must leave + /* 15 */ TIMETAG_KICKOUT_TEXT_TREASURE_CHEST_SHOP, // already time to close shop + /* 16 */ TIMETAG_KICKOUT_TEXT_DOGGY_RACETRACK, // no more for today +} TimeTagKickOutText; typedef struct EnTimeTag { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index eb005b224..f6a5b1ae4 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -195,7 +195,7 @@ void func_80893A18(EnTite* this) { } s32 func_80893A34(EnTite* this, PlayState* play) { - if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & 1) && + if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 5)) { return true; } @@ -211,7 +211,7 @@ void func_80893A9C(EnTite* this, PlayState* play) { } s32 func_80893ADC(EnTite* this) { - if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { return true; } return false; @@ -224,7 +224,7 @@ s32 func_80893B10(EnTite* this) { void func_80893B70(EnTite* this) { if (this->actor.params == ENTITE_MINUS_2) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->actor.gravity = 0.0f; func_80893B10(this); } else { @@ -238,7 +238,7 @@ void func_80893BCC(EnTite* this, PlayState* play) { s32 i; s32 j; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { u32 surface = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((surface == COLPOLY_SURFACE_GROUND) || (surface == COLPOLY_SURFACE_SAND)) { @@ -259,7 +259,7 @@ void func_80893BCC(EnTite* this, PlayState* play) { } } } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } } @@ -270,7 +270,7 @@ void func_80893DD4(EnTite* this) { this->drawDmgEffScale = 0.5f; this->drawDmgEffFrozenSteamScale = 0.75f; this->drawDmgEffAlpha = 1.0f; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); this->actor.flags &= ~ACTOR_FLAG_200; } @@ -287,7 +287,7 @@ void func_80893E54(EnTite* this, PlayState* play) { void func_80893ED4(EnTite* this) { Animation_MorphToLoop(&this->skelAnime, &object_tite_Anim_0012E4, 4.0f); this->unk_2BC = Rand_S16Offset(15, 30); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80893F30; } @@ -305,7 +305,7 @@ void func_80893F30(EnTite* this, PlayState* play) { void func_80893FD0(EnTite* this) { Animation_PlayOnce(&this->skelAnime, &object_tite_Anim_00083C); this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_80894024; } @@ -323,10 +323,10 @@ void func_80894024(EnTite* this, PlayState* play) { void func_8089408C(EnTite* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_tite_Anim_0004F8); if (!func_80893ADC(this)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); } else { this->actor.world.pos.y += this->actor.depthInWater; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } if (this->actor.shape.yOffset < 0.0f) { @@ -356,17 +356,19 @@ void func_8089408C(EnTite* this, PlayState* play) { this->actor.velocity.y = 8.0f; } - this->actor.bgCheckFlags &= ~(0x40 | 0x20 | 0x2 | 0x1); + this->actor.bgCheckFlags &= + ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); this->actor.gravity = -1.0f; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; this->actionFunc = func_808942B4; } void func_808942B4(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && + if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && (this->actor.velocity.y <= 0.0f)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->collider.base.atFlags &= ~AT_HIT; if (!func_80893ADC(this)) { func_80893BCC(this, play); @@ -377,7 +379,7 @@ void func_808942B4(EnTite* this, PlayState* play) { func_8089452C(this, play); } else { this->actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); func_80894414(this); } } @@ -418,7 +420,7 @@ void func_8089452C(EnTite* this, PlayState* play) { sp2C.y += this->actor.depthInWater; this->actor.velocity.y *= 0.75f; EffectSsGRipple_Spawn(play, &sp2C, 0, 500, 0); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_LAND_WATER); this->actionFunc = func_808945B4; } @@ -430,7 +432,7 @@ void func_808945B4(EnTite* this, PlayState* play) { void func_808945EC(EnTite* this) { Animation_PlayLoop(&this->skelAnime, &object_tite_Anim_000A14); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actionFunc = func_80894638; } @@ -454,16 +456,17 @@ void func_80894638(EnTite* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { if (func_80893ADC(this)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_WALK_WATER); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_WALK); } } if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); - } else if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater < 10.0f))) && + } else if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (func_80893ADC(this) && (this->actor.depthInWater < 10.0f))) && Actor_IsFacingPlayer(&this->actor, 0xE38)) { if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.playerHeightRel <= 80.0f)) { func_80893A9C(this, play); @@ -480,12 +483,12 @@ void func_8089484C(EnTite* this) { } this->actor.velocity.y = 9.5f; this->actor.gravity = -1.0f; - this->actor.speedXZ = 4.0f; + this->actor.speed = 4.0f; if (func_80893ADC(this)) { this->actor.world.pos.y += this->actor.depthInWater; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); } this->actionFunc = func_80894910; } @@ -493,10 +496,10 @@ void func_8089484C(EnTite* this) { void func_80894910(EnTite* this, PlayState* play) { Vec3f sp34; - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 1.0f, 0.0f); SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 0x40) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_LAND_WATER); if (func_80893ADC(this)) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); @@ -508,9 +511,10 @@ void func_80894910(EnTite* this, PlayState* play) { func_80893BCC(this, play); } - if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && + if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && (this->actor.velocity.y <= 0.0f)) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4000); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -536,7 +540,7 @@ void func_80894910(EnTite* this, PlayState* play) { void func_80894B2C(EnTite* this) { Animation_MorphToLoop(&this->skelAnime, &object_tite_Anim_0012E4, 4.0f); - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; this->actor.gravity = -1.0f; if (this->collider.base.ac != NULL) { func_800BE568(&this->actor, &this->collider); @@ -548,7 +552,7 @@ void func_80894B2C(EnTite* this) { } void func_80894BC8(EnTite* this, PlayState* play) { - Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); + Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); SkelAnime_Update(&this->skelAnime); if (func_80893ADC(this) && (this->actor.velocity.y <= 0.0f)) { this->actor.gravity = 0.0f; @@ -556,13 +560,13 @@ void func_80894BC8(EnTite* this, PlayState* play) { this->actor.world.pos.y += this->actor.depthInWater - 1.0f; } - if (this->actor.bgCheckFlags & 0x40) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } else { func_80893BCC(this, play); } - if ((this->actor.speedXZ == 0.0f) && ((this->actor.bgCheckFlags & 1) || func_80893ADC(this))) { + if ((this->actor.speed == 0.0f) && ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || func_80893ADC(this))) { this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.acFlags |= AC_ON; if ((Player_GetMask(play) == PLAYER_MASK_STONE) || @@ -579,7 +583,7 @@ void func_80894BC8(EnTite* this, PlayState* play) { } void func_80894DD0(EnTite* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -598,8 +602,8 @@ void func_80894E0C(EnTite* this, PlayState* play) { this->actor.world.pos.y += this->actor.depthInWater; } - if (this->actor.bgCheckFlags & 0x40) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } else { func_80893BCC(this, play); } @@ -629,7 +633,7 @@ void func_80895020(EnTite* this, PlayState* play) { f32 temp_f0; Vec3f* ptr; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->collider.base.acFlags &= ~AC_ON; this->actor.colorFilterTimer = 0; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_TEKU_DEAD); @@ -640,7 +644,7 @@ void func_80895020(EnTite* this, PlayState* play) { this->unk_2BC = 25; this->actor.gravity = -0.58f; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; ptr = &this->unk_33C[0]; for (i = 0; i < ARRAY_COUNT(this->limbPos); i++, ptr++) { @@ -680,15 +684,15 @@ void func_808951B8(EnTite* this, PlayState* play) { void func_808952EC(EnTite* this) { Animation_PlayLoopSetSpeed(&this->skelAnime, &object_tite_Anim_000A14, 1.5f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); this->collider.base.acFlags &= ~AC_ON; func_80893A18(this); this->unk_2B9 = 1; this->unk_2BC = 400; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.gravity = -1.0f; this->unk_2B8 = Rand_ZeroOne() * 50.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 11.0f; this->actionFunc = func_80895424; } @@ -704,11 +708,11 @@ void func_80895424(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->collider.base.acFlags |= AC_ON; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, 0); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } if (this->unk_2BC == 0) { @@ -724,8 +728,8 @@ void func_80895424(EnTite* this, PlayState* play) { void func_808955E4(EnTite* this) { this->unk_2B9 = 0; this->actor.velocity.y = 13.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); - this->actor.bgCheckFlags &= ~1; + Actor_PlaySfx(&this->actor, NA_SE_EN_LAST1_GROW_HEAD); + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->collider.base.acFlags &= ~AC_ON; this->actionFunc = func_80895640; } @@ -733,7 +737,7 @@ void func_808955E4(EnTite* this) { void func_80895640(EnTite* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 4000); SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->collider.base.acFlags |= AC_ON; this->actor.shape.yOffset = 0.0f; func_80893BCC(this, play); @@ -752,7 +756,7 @@ void func_808956B8(EnTite* this) { void func_808956FC(EnTite* this) { this->unk_2BC = -1; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.velocity.y = 7.5f; func_80893A18(this); } @@ -765,26 +769,26 @@ void func_80895738(EnTite* this, PlayState* play) { if (this->collider.base.atFlags & AT_BOUNCED) { func_808956FC(this); } - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = BINANG_SUB((this->actor.wallYaw * 2) - this->actor.world.rot.y, 0x8000); } if (this->unk_2BC == -1) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.3f); - if (this->actor.bgCheckFlags & 1) { + Math_StepToF(&this->actor.speed, 0.0f, 0.3f); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80893ED4(this); this->unk_2BC = 100; } } else if (this->unk_2BC > 0) { this->unk_2BC--; - Math_StepToF(&this->actor.speedXZ, 10.0f, 0.3f); + Math_StepToF(&this->actor.speed, 10.0f, 0.3f); this->actor.flags |= ACTOR_FLAG_1000000; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); if (!func_80893A34(this, play)) { this->unk_2BC = 0; } - } else if ((this->unk_2BC == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.3f)) { + } else if ((this->unk_2BC == 0) && Math_StepToF(&this->actor.speed, 0.0f, 0.3f)) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80893A18(this); if ((Player_GetMask(play) == PLAYER_MASK_STONE) || (this->actor.xzDistToPlayer > 450.0f) || @@ -796,7 +800,7 @@ void func_80895738(EnTite* this, PlayState* play) { func_80893A9C(this, play); } } - this->actor.shape.rot.y += (s16)(this->actor.speedXZ * 768.0f); + this->actor.shape.rot.y += (s16)(this->actor.speed * 768.0f); } void func_8089595C(EnTite* this, PlayState* play) { @@ -813,7 +817,7 @@ void func_80895A10(EnTite* this) { s16 rand; Animation_Change(&this->skelAnime, &object_tite_Anim_000A14, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 4.0f); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; rand = Rand_S16Offset(20, 20); this->unk_2BC = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * rand; this->actionFunc = func_80895AC0; @@ -828,18 +832,18 @@ void func_80895AC0(EnTite* this, PlayState* play) { if (Rand_ZeroOne() < 0.25f) { func_8089595C(this, play); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_WALK); } if ((this->unk_2BC == 1) || (this->unk_2BC == -1)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { temp_v1 = this->actor.shape.rot.y - this->actor.wallYaw; temp_v0 = ABS_ALT(temp_v1); if (temp_v0 > 0x3000) { this->unk_2BC = (temp_v0 >> 9) * this->unk_2BC; } - } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { - temp_v1 = this->actor.shape.rot.y - Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { + temp_v1 = this->actor.shape.rot.y - Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); temp_v0 = ABS_ALT(temp_v1); if (temp_v0 > 0x2000) { this->unk_2BC = (temp_v0 >> 9) * this->unk_2BC; @@ -862,7 +866,7 @@ void func_80895AC0(EnTite* this, PlayState* play) { void func_80895CB0(EnTite* this) { this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_2BC = Rand_S16Offset(20, 20); this->actionFunc = func_80895D08; @@ -874,7 +878,7 @@ void func_80895D08(EnTite* this, PlayState* play) { if (Rand_ZeroOne() < 0.5f) { func_8089595C(this, play); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_WALK); } if ((this->actor.xzDistToPlayer < 240.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { func_8089408C(this, play); @@ -890,7 +894,7 @@ void func_80895DE8(EnTite* this) { this->collider.base.acFlags &= ~AC_ON; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->skelAnime.playSpeed = 1.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80895E28; } @@ -956,8 +960,8 @@ void func_80895FF8(EnTite* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect != 0xF) { if (this->actor.colChkInfo.damageEffect == 5) { this->unk_2BC = 40; - Actor_SetColorFilter(&this->actor, 0, 200, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; this->drawDmgEffScale = 0.5f; this->drawDmgEffAlpha = 2.0f; @@ -967,8 +971,8 @@ void func_80895FF8(EnTite* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 1) { this->unk_2BC = 40; - Actor_SetColorFilter(&this->actor, 0, 200, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_80894DD0(this); return; } @@ -996,12 +1000,12 @@ void func_80895FF8(EnTite* this, PlayState* play) { CLEAR_TAG_LARGE_LIGHT_RAYS); } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { func_80895020(this, play); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_DAMAGE); if (this->unk_2B9 == 0) { func_80894B2C(this); @@ -1012,7 +1016,7 @@ void func_80895FF8(EnTite* this, PlayState* play) { } } } - } else if ((this->actor.bgCheckFlags & 1) && (this->collider.base.acFlags & AC_ON) && + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->collider.base.acFlags & AC_ON) && (this->actor.colChkInfo.health != 0) && (play->actorCtx.unk2 != 0) && (this->actor.xyzDistToPlayerSq < SQ(200.0f))) { this->actor.flags |= ACTOR_FLAG_1; @@ -1032,13 +1036,13 @@ void func_808963B4(EnTite* this, PlayState* play) { s32 i; Vec3f sp48; - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { Math_Vec3f_Copy(&sp48, &this->limbPos[i]); sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(play, &sp48, 0, 220, 0); } - } else if (this->actor.bgCheckFlags & 0x20) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { s32 temp = play->gameplayFrames & 7; if (!(temp & 1) && (this->actor.depthInWater < 10.0f)) { @@ -1060,7 +1064,7 @@ void EnTite_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 40.0f, 20.0f, this->unk_2C0); func_808963B4(this, play); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); if (this->unk_2B9 != 0) { this->actor.shape.rot.z = BINANG_ROT180(this->actor.shape.rot.z); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 1bdc92b4a..dd122ed8c 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -299,7 +299,7 @@ void func_80AECA90(EnTk* this, PlayState* play) { } void func_80AECB0C(EnTk* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_3CC = 0xFF; this->unk_2DC = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); @@ -442,8 +442,8 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { do { doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); if (doorIter != NULL) { - if (Actor_XZDistanceBetweenActors(&this->actor, doorIter) <= 120.0f) { - if (ABS(BINANG_SUB(Actor_YawToPoint(&this->actor, &doorIter->world.pos), + if (Actor_WorldDistXZToActor(&this->actor, doorIter) <= 120.0f) { + if (ABS(BINANG_SUB(Actor_WorldYawTowardPoint(&this->actor, &doorIter->world.pos), this->actor.shape.rot.y)) <= 0x2000) { this->unk_2CA |= 0x400; door = (EnDoor*)doorIter; @@ -459,7 +459,7 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { do { doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); if (doorIter != NULL) { - if (Actor_XZDistanceBetweenActors(&this->actor, doorIter) <= 160.0f) { + if (Actor_WorldDistXZToActor(&this->actor, doorIter) <= 160.0f) { door = (EnDoor*)doorIter; break; } @@ -590,13 +590,13 @@ void func_80AED610(EnTk* this, PlayState* play) { break; case 0x13FE: - func_80151938(play, 0x13FF); + Message_ContinueTextbox(play, 0x13FF); break; case 0x1413: Rupees_ChangeBy(30); SET_WEEKEVENTREG(WEEKEVENTREG_60_02); - func_80151938(play, 0x13FF); + Message_ContinueTextbox(play, 0x13FF); break; case 0x13FF: @@ -631,7 +631,7 @@ void func_80AED610(EnTk* this, PlayState* play) { void func_80AED898(EnTk* this, PlayState* play) { this->unk_316 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_2CA & 0x1000) { if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); @@ -706,7 +706,7 @@ void func_80AED940(EnTk* this, PlayState* play) { void func_80AEDBEC(EnTk* this, PlayState* play) { this->actor.params = -1; this->unk_2E8 = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actionFunc = func_80AEDC4C; } @@ -715,13 +715,13 @@ void func_80AEDC4C(EnTk* this, PlayState* play) { if ((this->actor.params >= 0) && SubS_StartActorCutscene(&this->actor, this->cutscenes[1], this->actor.params, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_2E8 = ActorCutscene_GetLength(this->cutscenes[1]); - func_80151938(play, 0x1411); + Message_ContinueTextbox(play, 0x1411); func_80AEDCBC(this, play); } } void func_80AEDCBC(EnTk* this, PlayState* play) { - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 5, &this->unk_2D4); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_2EC); Math_Vec3f_Copy(&this->actor.prevPos, &this->unk_2EC); @@ -734,13 +734,13 @@ void func_80AEDD4C(EnTk* this, PlayState* play) { this->unk_2E8--; if (this->unk_2E8 <= 0) { ActorCutscene_Stop(this->cutscenes[1]); - func_801477B4(play); + Message_CloseTextbox(play); Actor_Kill(&this->actor); } } void func_80AEDDA0(EnTk* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actor.flags |= ACTOR_FLAG_10000; this->unk_2CA |= 0x80; @@ -837,29 +837,29 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { break; case 0x1405: - func_80151938(play, 0x1406); + Message_ContinueTextbox(play, 0x1406); break; case 0x1406: - func_80151938(play, 0x1407); + Message_ContinueTextbox(play, 0x1407); break; case 0x1407: if (play->msgCtx.choiceIndex == 0) { func_8019F208(); - func_80151938(play, 0x1409); + Message_ContinueTextbox(play, 0x1409); } else { func_8019F230(); - func_80151938(play, 0x1408); + Message_ContinueTextbox(play, 0x1408); } break; case 0x1408: - func_80151938(play, 0x1407); + Message_ContinueTextbox(play, 0x1407); break; case 0x1409: - func_80151938(play, 0x140A); + Message_ContinueTextbox(play, 0x140A); break; case 0x140A: @@ -877,7 +877,7 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { func_80AEE2A8(this, play); } else { func_8019F230(); - func_80151938(play, 0x140E); + Message_ContinueTextbox(play, 0x140E); } break; @@ -911,7 +911,7 @@ s32 func_80AEE300(PlayState* play, Actor* arg1, Actor* arg2, void* _arg3) { f32 temp_f0; if ((arg2 != arg1) && (ENTK_GET_F(arg2) == 3)) { - temp_f0 = Actor_DistanceBetweenActors(arg1, arg2); + temp_f0 = Actor_WorldDistXYZToActor(arg1, arg2); if (temp_f0 < arg3->unk_04) { arg3->unk_00 = arg2; arg3->unk_04 = temp_f0; @@ -932,7 +932,7 @@ void func_80AEE374(EnTk* this, PlayState* play) { return; } - this->unk_2CC = Actor_YawToPoint(&this->actor, &sp30.unk_00->world.pos); + this->unk_2CC = Actor_WorldYawTowardPoint(&this->actor, &sp30.unk_00->world.pos); this->actionFunc = func_80AEE414; } @@ -958,7 +958,7 @@ void func_80AEE4D0(EnTk* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 33.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIG_UP); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIG_UP); } if (!(this->unk_2CA & 0x20)) { @@ -968,7 +968,7 @@ void func_80AEE4D0(EnTk* this, PlayState* play) { bigPoe = SubS_FindActor(play, bigPoe, ACTORCAT_PROP, ACTOR_EN_BIGPO); if (bigPoe != NULL) { - if ((bigPoe->params == 3) && (Actor_DistanceBetweenActors(&this->actor, bigPoe) < 80.0f)) { + if ((bigPoe->params == 3) && (Actor_WorldDistXYZToActor(&this->actor, bigPoe) < 80.0f)) { bigPoe->params = 4; this->unk_2CA |= 0x20; this->unk_2E4++; @@ -996,7 +996,7 @@ void func_80AEE6B8(EnTk* this, PlayState* play) { if (this->unk_2CA & 0x20) { if (this->unk_2E4 >= 3) { ActorCutscene_Stop(this->cutscenes[0]); - func_801477B4(play); + Message_CloseTextbox(play); func_80AEDBEC(this, play); } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_310 = 3; @@ -1183,10 +1183,10 @@ void func_80AEED38(EnTk* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); - func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speedXZ, &sp64); + func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speed, &sp64); } - if (this->actor.speedXZ > 0.5f) { + if (this->actor.speed > 0.5f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2CC, 2, 0xAAA, 1); this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -1210,17 +1210,17 @@ void func_80AEF094(EnTk* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); - func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speedXZ, &sp2C); + func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speed, &sp2C); } - if (this->actor.speedXZ >= 0.5f) { + if (this->actor.speed >= 0.5f) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x38E, 1); this->actor.shape.rot.y = this->actor.world.rot.y; } } void func_80AEF15C(EnTk* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->unk_30C = func_80AEF1B4; } @@ -1237,7 +1237,7 @@ void func_80AEF210(EnTk* this, PlayState* play) { } void func_80AEF220(EnTk* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->unk_30C = func_80AEF278; } @@ -1264,7 +1264,7 @@ void func_80AEF2D8(Actor* thisx, PlayState* play) { if ((this->actor.draw != NULL) && ((this->unk_2D4 == 0) || (this->unk_2D4 == 1)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 24.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WALK); } this->actionFunc(this, play); @@ -1286,7 +1286,7 @@ void EnTk_Update(Actor* thisx, PlayState* play) { if (((this->unk_2D4 == 0) || (this->unk_2D4 == 1)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 24.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WALK); } this->unk_2CA &= ~1; @@ -1321,10 +1321,10 @@ void EnTk_Update(Actor* thisx, PlayState* play) { } if (!(this->unk_2CA & 0x200)) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_800B9010(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG); - } else if (this->actor.bgCheckFlags & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); } } } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index aefa6383f..54ed5babc 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -190,7 +190,7 @@ void EnToto_Init(Actor* thisx, PlayState* play) { return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - this->actor.bgCheckFlags |= 0x400; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, ((play->sceneId == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), this->jointTable, this->morphTable, 18); @@ -251,7 +251,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { return; } - //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro + //! TODO: Neither 0xED02 nor 0xED01 match CLOCK_TIME macro if (((play->sceneId == SCENE_MILK_BAR) && !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { @@ -364,9 +364,9 @@ s32 func_80BA3EE8(EnToto* this, PlayState* play) { s32 func_80BA3F2C(EnToto* this, PlayState* play) { if (this->text->textId != 0) { - func_80151938(play, this->text->textId); + Message_ContinueTextbox(play, this->text->textId); } else { - func_801477B4(play); + Message_CloseTextbox(play); func_80BA3EE8(this, play); } if (this->text->unk0 == 4) { @@ -515,7 +515,7 @@ s32 func_80BA4530(EnToto* this, PlayState* play) { this->unk2B6 = 1; return this->text->unk1; } - if (player->actor.bgCheckFlags & 1) { + if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { temp_s0 = &D_80BA50DC[gSaveContext.save.playerForm - 1]; if (func_80BA44D4(temp_s0, player)) { Math_Vec3s_ToVec3f(&player->actor.world.pos, &temp_s0->unk6); @@ -699,7 +699,7 @@ void func_80BA4CB4(EnToto* this, PlayState* play) { } } if (this->unk2B5 == 4 && !Actor_HasParent(&this->actor, play)) { - Actor_PickUp(&this->actor, play, GI_MASK_CIRCUS_LEADER, 9999.9f, 9999.9f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_CIRCUS_LEADER, 9999.9f, 9999.9f); } } diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index caceb62bd..ed0e61937 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -246,7 +246,7 @@ s32 EnTrt_TestEndInteraction(EnTrt* this, PlayState* play, Input* input) { s32 EnTrt_TestCancelOption(EnTrt* this, PlayState* play, Input* input) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); return true; } return false; @@ -262,7 +262,7 @@ void EnTrt_SetupStartShopping(PlayState* play, EnTrt* this, u8 skipHello) { } void EnTrt_StartShopping(PlayState* play, EnTrt* this) { - func_80151938(play, 0x83E); + Message_ContinueTextbox(play, 0x83E); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -378,7 +378,7 @@ void EnTrt_PayForMushroom(EnTrt* this, PlayState* play) { Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); this->actionFunc = EnTrt_SetupItemGiven; } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); } } @@ -387,7 +387,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) { switch (this->textId) { case 0x886: this->textId = 0x887; - func_80151938(play, this->textId); + Message_ContinueTextbox(play, this->textId); break; case 0x887: case 0x88B: @@ -453,9 +453,9 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_20000000; this->actionFunc = EnTrt_GivenRedPotionForKoume; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { - Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); } } @@ -567,7 +567,7 @@ void EnTrt_LookToShelf(EnTrt* this, PlayState* play) { this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; EnTrt_UpdateCursorPos(play, this); this->actionFunc = EnTrt_BrowseShelf; - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); } else { ActorCutscene_SetIntentToPlay(this->cutscene); } @@ -605,7 +605,7 @@ s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) { if (EnTrt_TestItemSelected(play)) { if (item->actor.params != SI_POTION_BLUE || (this->flags & ENTRT_GIVEN_MUSHROOM)) { this->prevActionFunc = this->actionFunc; - func_80151938(play, EnTrt_GetItemChoiceTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemChoiceTextId(this)); play_sound(NA_SE_SY_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -638,7 +638,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { EnTrt_CursorLeftRight(play, this); if (this->cursorIndex != prevCursorIdx) { - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); play_sound(NA_SE_SY_CURSOR); } } @@ -649,7 +649,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { Player* player = GET_PLAYER(play); - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~PLAYER_STATE2_20000000; @@ -659,12 +659,12 @@ void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { } void EnTrt_SetupCannotBuy(PlayState* play, EnTrt* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); this->actionFunc = EnTrt_CannotBuy; } void EnTrt_SetupCanBuy(PlayState* play, EnTrt* this, u16 textId) { - func_80151938(play, textId); + Message_ContinueTextbox(play, textId); this->actionFunc = EnTrt_CanBuy; } @@ -736,7 +736,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { case 1: func_8019F230(); this->actionFunc = this->prevActionFunc; - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); break; } } @@ -880,7 +880,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_OpenEyesThenSetToBlink; this->timer = 10; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_SURPRISED2); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOTAKE_SURPRISED2); } } else { this->blinkFunc = EnTrt_OpenEyesThenSetToBlink; @@ -934,7 +934,7 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) { EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SURPRISED); this->animIndex = TRT_ANIM_SURPRISED; this->blinkFunc = EnTrt_OpenEyes2; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_SURPRISED); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOTAKE_SURPRISED); this->timer = 30; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; } @@ -1029,7 +1029,7 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { this->textId = 0x849; break; } - func_80151938(play, this->textId); + Message_ContinueTextbox(play, this->textId); } else { func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } @@ -1068,7 +1068,7 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { void EnTrt_CannotBuy(EnTrt* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); } } @@ -1081,7 +1081,7 @@ void EnTrt_CanBuy(EnTrt* this, PlayState* play) { item = this->items[this->cursorIndex]; item->restockFunc(play, item); this->actionFunc = this->prevActionFunc; - func_80151938(play, EnTrt_GetItemTextId(this)); + Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); } } @@ -1090,7 +1090,7 @@ void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnTrt_SetupItemGiven; } else { - Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); } } @@ -1385,7 +1385,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if ((this->talkOptionTextId == 0x845) || (this->talkOptionTextId == 0x882)) { - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); } else { EnTrt_StartShopping(play, this); } @@ -1411,7 +1411,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { this->textId = player->actor.textId; this->actionFunc = EnTrt_Goodbye; } - func_801477B4(play); + Message_CloseTextbox(play); } else if (itemAction <= PLAYER_IA_MINUS1) { if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->textId = 0x88B; @@ -1426,7 +1426,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { void EnTrt_SetupTalkToShopkeeper(PlayState* play, EnTrt* this) { this->actionFunc = EnTrt_TalkToShopkeeper; - func_80151938(play, this->talkOptionTextId); + Message_ContinueTextbox(play, this->talkOptionTextId); func_8011552C(play, DO_ACTION_DECIDE); this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 4018a5021..44f2e7d3e 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -164,7 +164,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) { func_80AD46F8(this); if (this->path != NULL) { phi_a1 = func_80AD48F8(this->path, this->unk_1E4, &this->actor.world.pos, &sp30); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { phi_a1 = this->actor.wallYaw; } Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 1000, 1); @@ -176,7 +176,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) { this->unk_1E4++; } } - Math_ApproachF(&this->actor.speedXZ, 1.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 1.5f, 0.2f, 1.0f); } Actor_MoveWithGravity(&this->actor); @@ -229,7 +229,7 @@ void func_80AD36EC(EnTrt2* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); if ((this->actor.shape.rot.y >= 0x2800) && (this->actor.shape.rot.y < 0x3800)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOTAKE_ROLL); } } @@ -269,7 +269,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { } } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->unk_1E4 >= (this->path->count - 1)) { ActorCutscene_Stop(this->unk_3DA); this->unk_3D9 = 2; @@ -277,7 +277,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { sp30.y = this->actor.wallYaw; } } - Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 5.0f, 0.2f, 1.0f); } Actor_MoveWithoutGravity(&this->actor); @@ -286,8 +286,8 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { void func_80AD3A24(EnTrt2* this, PlayState* play) { func_80AD46F8(this); - if (this->actor.speedXZ > 0.05f) { - Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); + if (this->actor.speed > 0.05f) { + Math_ApproachF(&this->actor.speed, 0.0f, 0.2f, 1.0f); } else if (DECR(this->unk_3AE) == 0) { this->unk_3AE = Rand_S16Offset(100, 50); EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER); @@ -332,7 +332,7 @@ void func_80AD3BE4(EnTrt2* this, PlayState* play) { void func_80AD3C94(EnTrt2* this, PlayState* play) { if (this->actor.world.pos.y < 5.0f) { func_80AD4A78(this, play); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_3B2 = 0xF; } } @@ -417,15 +417,15 @@ void func_80AD3FF4(EnTrt2* this, PlayState* play) { this->actor.parent = NULL; this->unk_3B2 = 14; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { - Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); } } void func_80AD40AC(EnTrt2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); this->unk_3B2 = 13; } } @@ -433,10 +433,10 @@ void func_80AD40AC(EnTrt2* this, PlayState* play) { void func_80AD4110(EnTrt2* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_3A8 = 0x84C; - func_80151938(play, this->unk_3A8); + Message_ContinueTextbox(play, this->unk_3A8); this->unk_3B2 = 10; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } } @@ -514,7 +514,7 @@ void func_80AD434C(EnTrt2* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if ((this->actor.shape.rot.y >= 0x2800) && (this->actor.shape.rot.y < 0x3800)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOTAKE_ROLL); } } @@ -663,10 +663,10 @@ s32 func_80AD4B4C(EnTrt2* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { sp24 = true; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80AD349C(this); this->unk_3B4 = this->unk_3B2; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) { this->unk_3A8 = 0x84F; } @@ -686,7 +686,7 @@ s32 func_80AD4B4C(EnTrt2* this, PlayState* play) { } s32 func_80AD4C4C(EnTrt2* this) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.xzDistToPlayer < 100.0f) { return true; } @@ -700,9 +700,10 @@ s32 func_80AD4CCC(EnTrt2* this, PlayState* play) { s16 sp1E = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Player* player = GET_PLAYER(play); - if (((this->unk_3B2 == 4) || (this->unk_3B2 == 5)) && this->actor.isTargeted && !(this->actor.bgCheckFlags & 1) && + if (((this->unk_3B2 == 4) || (this->unk_3B2 == 5)) && this->actor.isTargeted && + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY))) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 1.5f; this->unk_3B2 = 16; return true; diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 733ea0c57..eac370ebf 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -736,7 +736,7 @@ s32 func_80A87400(EnTru* this, PlayState* play) { this->unk_360 = CLAMP(this->unk_360 + 2000, 0, 0x4000); Math_ApproachF(&this->unk_35C, 30.0f, 0.08f, 1000.0f); - Math_ApproachF(&this->actor.speedXZ, 30.0f, 0.2f, 1000.0f); + Math_ApproachF(&this->actor.speed, 30.0f, 0.2f, 1000.0f); if (this->path != NULL) { sp4C = Lib_SegmentedToVirtual(this->path->points); @@ -915,9 +915,9 @@ s32 func_80A87880(Actor* thisx, PlayState* play) { this->unk_34E &= ~0x400; Player_UpdateBottleHeld(play, player, ITEM_BOTTLE, PLAYER_IA_BOTTLE); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DRINK); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_DRINK); } else if (Animation_OnFrame(&this->skelAnime, 90.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_REGAIN); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_REGAIN); } if ((this->skelAnime.curFrame > 90.0f) && (this->skelAnime.curFrame < 95.0f)) { @@ -961,7 +961,7 @@ s32 func_80A87B48(Actor* thisx, PlayState* play) { this->unk_372 = 10; this->unk_364++; } else if (Animation_OnFrame(&this->skelAnime, 22.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_MAGIC); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_MAGIC); func_80A85AA4(this->unk_394, &this->unk_1F8, 1.0f, 0.1f, 40.0f); } break; @@ -1017,8 +1017,8 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { case 2: AudioSfx_StopById(NA_SE_EN_KOUME_MAGIC); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_AWAY); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_LAUGH); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_AWAY); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_LAUGH); EnTru_ChangeAnim(this, KOUME_ANIM_TAKE_OFF); this->skelAnime.baseTransl.y = 0; this->skelAnime.moveFlags = 2; @@ -1119,7 +1119,7 @@ void func_80A881E0(EnTru* this, PlayState* play) { this->unk_34E &= ~(0x1000 | 0x8); this->unk_34E |= 0x10; this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->unk_1E8 = 0; this->actionFunc = func_80A87FD0; } diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index e5ff4350f..64f936bbd 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -180,13 +180,13 @@ s32 func_80B761FC(EnTruMt* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; if (this->unk_3A4 == 0) { this->unk_3A4 = 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_DAMAGE); } else { this->unk_3A4 = 0; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_DAMAGE2); + Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_DAMAGE2); } play->interfaceCtx.minigameHiddenPoints = 1; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 25); return true; } } @@ -247,13 +247,13 @@ void func_80B76440(EnTruMt* this, PlayState* play) { s16 temp_v1 = this->unk_394 - Math_Vec3f_Yaw(&this->unk_398, &this->actor.world.pos); if ((temp_v1 <= -0x2000) || (temp_v1 >= 0x2000)) { - Math_ApproachF(&this->actor.speedXZ, 7.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 7.0f, 0.2f, 1.0f); } else if (this->actor.xzDistToPlayer < 300.0f) { - Math_ApproachF(&this->actor.speedXZ, 7.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 7.0f, 0.2f, 1.0f); } else if (this->actor.xzDistToPlayer > 500.0f) { - Math_ApproachF(&this->actor.speedXZ, 2.5f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 2.5f, 0.2f, 1.0f); } else { - Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 1.0f); + Math_ApproachF(&this->actor.speed, 4.0f, 0.2f, 1.0f); } } } @@ -335,7 +335,7 @@ s32 func_80B768F0(EnTruMt* this, PlayState* play) { } void func_80B76924(EnTruMt* this) { - this->unk_38E.z = Math_SinS(this->unk_388) * 30.0f * (0x10000 / 360.0f); + this->unk_38E.z = DEG_TO_BINANG(Math_SinS(this->unk_388) * 30.0f); this->unk_388 += 0x400; } @@ -347,7 +347,7 @@ void func_80B76980(EnTruMt* this, PlayState* play) { SET_EVENTINF(EVENTINF_36); SET_EVENTINF(EVENTINF_40); player->stateFlags3 &= ~PLAYER_STATE3_400; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80B76BB8; } else if (CHECK_EVENTINF(EVENTINF_40)) { u32 score = gSaveContext.minigameScore; @@ -381,7 +381,7 @@ void func_80B76A64(EnTruMt* this, PlayState* play) { if (func_80B76600(this, this->path, this->unk_36C)) { if (this->unk_36C >= (this->path->count - 1)) { this->actionFunc = func_80B76C38; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; return; } this->unk_36C++; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 5b6f7b978..87ae0791a 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -198,43 +198,43 @@ void func_80AE0010(EnTsn* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x107F: case 0x1081: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1080: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_001198, -10.0f); break; case 0x1082: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); SET_WEEKEVENTREG(WEEKEVENTREG_25_80); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1083: SET_WEEKEVENTREG(WEEKEVENTREG_25_80); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; case 0x1084: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_000964, -10.0f); break; case 0x1085: case 0x1086: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1089: case 0x1093: SET_WEEKEVENTREG(WEEKEVENTREG_26_01); - func_801477B4(play); + Message_CloseTextbox(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; this->actor.textId = 0; @@ -242,24 +242,24 @@ void func_80AE0010(EnTsn* this, PlayState* play) { case 0x1087: Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_001198, -10.0f); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1088: SET_WEEKEVENTREG(WEEKEVENTREG_26_01); if (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) { - func_801477B4(play); + Message_CloseTextbox(play); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); this->actionFunc = func_80AE0304; this->actor.textId = 0; } else { - func_80151938(play, 0x1093); + Message_ContinueTextbox(play, 0x1093); Animation_MorphToLoop(&this->skelAnime, &object_tsn_Anim_0092FC, -10.0f); } break; case 0x107E: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0304; this->actor.textId = 0; break; @@ -300,7 +300,7 @@ void func_80AE0460(EnTsn* this, PlayState* play) { ENTSN_SET_Z(&this->unk_1D8->actor, false); this->actionFunc = func_80AE0418; } else { - Actor_PickUp(&this->actor, play, GI_SEAHORSE_CAUGHT, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, GI_SEAHORSE_CAUGHT, 2000.0f, 1000.0f); } } @@ -322,7 +322,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { } if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0704; if (itemAction == PLAYER_IA_PICTO_BOX) { if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { @@ -357,7 +357,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { } if (itemAction <= PLAYER_IA_MINUS1) { - func_80151938(play, 0x1078); + Message_ContinueTextbox(play, 0x1078); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_001198, -10.0f); this->actionFunc = func_80AE0704; } @@ -365,7 +365,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { } void func_80AE0698(EnTsn* this, PlayState* play) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0C88; this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; @@ -391,9 +391,9 @@ void func_80AE0704(EnTsn* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x106E: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_25_40)) { - func_80151938(play, 0x1074); + Message_ContinueTextbox(play, 0x1074); } else { - func_80151938(play, 0x106F); + Message_ContinueTextbox(play, 0x106F); } this->unk_220 |= 2; SET_WEEKEVENTREG(WEEKEVENTREG_25_40); @@ -405,51 +405,51 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x1070: case 0x1071: case 0x1072: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1076: case 0x1079: Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_000964, -10.0f); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x107A: - func_80151938(play, 0x10A6); + Message_ContinueTextbox(play, 0x10A6); break; case 0x1075: case 0x1078: player->exchangeItemId = 0; - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; case 0x107C: if (Inventory_HasEmptyBottle()) { SET_WEEKEVENTREG(WEEKEVENTREG_26_08); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0460; func_80AE0460(this, play); this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; ActorCutscene_Stop(this->actor.cutscene); - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); } else { - func_80151938(play, 0x10A8); + Message_ContinueTextbox(play, 0x10A8); } break; case 0x1073: case 0x1074: - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80AE04FC; break; case 0x107B: player->exchangeItemId = 0; - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); break; @@ -458,14 +458,14 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x10A8: Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_0092FC, -10.0f); func_80AE0698(this, play); - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_80AE04C4; break; case 0x108A: case 0x1091: SET_WEEKEVENTREG(WEEKEVENTREG_26_04); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->unk_220 |= 2; this->actor.textId = 0x1091; break; @@ -475,14 +475,14 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x108D: case 0x108E: case 0x108F: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1092: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_26_08)) { func_80AE0698(this, play); } else { - func_80151938(play, 0x10A7); + Message_ContinueTextbox(play, 0x10A7); Animation_MorphToLoop(&this->unk_1D8->skelAnime, &object_tsn_Anim_000964, -10.0f); } break; @@ -498,7 +498,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { case 0x10A9: func_80AE0698(this, play); - this->actor.flags &= ~ACTOR_FLAG_100; + this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; this->actionFunc = func_80AE04C4; break; } @@ -543,7 +543,7 @@ void func_80AE0C88(EnTsn* this, PlayState* play) { void func_80AE0D10(EnTsn* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80AE0D78; ActorCutscene_Stop(this->actor.cutscene); } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 4f7b8b720..48d7b4330 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -173,7 +173,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, PlayState* play) { Player* player = GET_PLAYER(play); Player* player2 = GET_PLAYER(play); - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 15.0f)) { EnTuboTrap_SpawnEffectsInWater(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, play); @@ -214,7 +214,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, PlayState* play) { } } - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnTuboTrap_SpawnEffectsOnLand(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, play); @@ -246,7 +246,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, PlayState* play) { this->targetHeight += transformationHeight; } this->originPos = this->actor.world.pos; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POT_MOVE_START); + Actor_PlaySfx(&this->actor, NA_SE_EV_POT_MOVE_START); this->actionFunc = EnTuboTrap_Levitate; } } @@ -257,7 +257,7 @@ void EnTuboTrap_Levitate(EnTuboTrap* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.8f, 3.0f); if (fabsf(this->actor.world.pos.y - this->targetHeight) < 10.0f) { - this->actor.speedXZ = 10.0f; + this->actor.speed = 10.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actionFunc = EnTuboTrap_FlyAtPlayer; } @@ -273,7 +273,7 @@ void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, PlayState* play) { // But in MM, certain sfxIds got reordered and devs forgot to update: // In MM, NA_SE_EN_MIZUBABA2_ATTACK is the old value 0x3837 // In MM, NA_SE_EN_TUBOOCK_FLY is the new value 0x3AE0 - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_MIZUBABA2_ATTACK - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_MIZUBABA2_ATTACK - SFX_FLAG); if ((SQ(dX) + SQ(dY) + SQ(dZ) > SQ(240.0f))) { Math_ApproachF(&this->actor.gravity, -3.0f, 0.2f, 0.5f); diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 5843357ee..205b9d9cc 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -37,9 +37,9 @@ ActorInit En_Twig_InitVars = { (ActorFunc)EnTwig_Draw, }; -static s32 sCurrentRing; -static s16 sRingCount; -static s16 sRingNotCollected[25]; +s32 sCurrentRing; +s16 sRingCount; +s16 sRingNotCollected[25]; static CollisionHeader* sColHeaders[] = { NULL, @@ -67,7 +67,7 @@ void EnTwig_Init(Actor* thisx, PlayState* play2) { if (sColHeaders[this->unk_160] != NULL) { DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[this->unk_160]); } - this->dyna.actor.bgCheckFlags |= 0x400; + this->dyna.actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; switch (this->unk_160) { case 0: Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 50109f887..aae20d26d 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -180,7 +180,7 @@ void EnVm_Init(Actor* thisx, PlayState* play) { this->unk_21C = params * 40.0f; thisx->params &= 0xFF; - this->actor.bgCheckFlags |= 0x400; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; if (!D_808CD5B8) { for (i = 0; i < ARRAY_COUNT(D_808CD58C); i++) { @@ -265,7 +265,7 @@ void func_808CC610(EnVm* this, PlayState* play) { } void func_808CC788(EnVm* this) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BIMOS_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_BIMOS_AIM); Animation_Change(&this->skelAnime, &object_vm_Anim_000068, 3.0f, 3.0f, 7.0f, ANIMMODE_ONCE, 0.0f); this->unk_214 = 305; this->unk_220 = 0.06f; @@ -328,7 +328,7 @@ void func_808CCA10(EnVm* this) { this->unk_210 = 0; this->unk_224 = 0.0f; this->unk_220 = 0.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->actionFunc = func_808CCAA4; } @@ -368,7 +368,7 @@ void func_808CCBE4(EnVm* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_vm_Anim_000068, -1.0f, Animation_GetLastFrame(&object_vm_Anim_000068), 0.0f, ANIMMODE_ONCE, 0.0f); Enemy_StartFinishingBlow(play, &this->actor); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 33); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 33); this->unk_214 = 33; this->unk_220 = 0.0f; this->unk_224 = 0.0f; @@ -376,7 +376,7 @@ void func_808CCBE4(EnVm* this, PlayState* play) { this->actor.world.pos.y = this->actor.focus.pos.y; this->actor.velocity.y = 8.0f; this->actor.gravity = -0.5f; - this->actor.speedXZ = Rand_ZeroOne() + 1.0f; + this->actor.speed = Rand_ZeroOne() + 1.0f; this->unk_210 = 0; this->actor.flags |= ACTOR_FLAG_10; this->actionFunc = func_808CCCF0; @@ -440,7 +440,7 @@ void EnVm_Update(Actor* thisx, PlayState* play) { if ((play->gameplayFrames % 2) != 0) { func_800BBFB0(play, &this->unk_234, 6.0f, 1, 120, 20, 1); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BIMOS_LAZER_GND - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_BIMOS_LAZER_GND - SFX_FLAG); } if (this->unk_224 > 0.0f) { diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 74bd4fec6..63a97dab9 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -205,7 +205,7 @@ void EnWallmas_Freeze(EnWallmas* this) { this->collider.base.colType = 3; this->timer = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void EnWallmas_ThawIfFrozen(EnWallmas* this, PlayState* play) { @@ -245,7 +245,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { if ((player->stateFlags1 & (PLAYER_STATE1_100000 | PLAYER_STATE1_8000000)) || (player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B5E > 0) || (player->actor.freezeTimer > 0) || - !(player->actor.bgCheckFlags & 1) || + !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || ((WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_PROXIMITY) && (Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos) > (120.f + this->detectionRadius)))) { AudioSfx_StopById(NA_SE_EN_FALL_AIM); @@ -253,7 +253,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { } if (this->timer == 80) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_AIM); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_AIM); } if (this->timer == 0) { @@ -298,7 +298,7 @@ void EnWallmas_SetupLand(EnWallmas* this, PlayState* play) { ANIMMODE_ONCE, -3.0f); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 6, 20.0f, 300, 100, true); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_LAND); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = EnWallmas_Land; } @@ -324,7 +324,7 @@ void EnWallmas_Stand(EnWallmas* this, PlayState* play) { void EnWallmas_SetupWalk(EnWallmas* this) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gWallmasterWalkAnim, 3.0f); - this->actor.speedXZ = 3.0f; + this->actor.speed = 3.0f; this->actionFunc = EnWallmas_Walk; } @@ -337,13 +337,13 @@ void EnWallmas_Walk(EnWallmas* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; 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)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_WALK); } } void EnWallmas_SetupJumpToCeiling(EnWallmas* this) { Animation_PlayOnce(&this->skelAnime, &gWallmasterStopWalkAnim); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = EnWallmas_JumpToCeiling; } @@ -355,7 +355,7 @@ void EnWallmas_JumpToCeiling(EnWallmas* this, PlayState* play) { void EnWallmas_SetupReturnToCeiling(EnWallmas* this) { this->timer = 0; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gWallmasterJumpAnim), ANIMMODE_ONCE, -3.0f); this->actionFunc = EnWallmas_ReturnToCeiling; @@ -372,7 +372,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 20.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_UP); } if (this->actor.playerHeightRel < -900.0f) { @@ -397,8 +397,8 @@ void EnWallmas_SetupDamage(EnWallmas* this, s32 arg1) { func_800BE504(&this->actor, &this->collider); } - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 20); - this->actor.speedXZ = 5.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 20); + this->actor.speed = 5.0f; this->actor.velocity.y = 10.0f; this->actionFunc = EnWallmas_Damage; } @@ -413,15 +413,15 @@ void EnWallmas_Damage(EnWallmas* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); + Math_StepToF(&this->actor.speed, 0.0f, 0.2f); } void EnWallmas_SetupCooldown(EnWallmas* this) { Animation_PlayOnce(&this->skelAnime, &gWallmasterRecoverFromDamageAnim); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnWallmas_Cooldown; @@ -434,7 +434,7 @@ void EnWallmas_Cooldown(EnWallmas* this, PlayState* play) { } void EnWallmas_SetupDie(EnWallmas* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 250, -10, 2); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); @@ -456,7 +456,7 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterHoverAnim, -5.0f); this->timer = -30; this->actionFunc = EnWallmas_TakePlayer; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->yTarget = this->actor.playerHeightRel; func_800B724C(play, &this->actor, PLAYER_CSMODE_18); @@ -466,8 +466,8 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_CATCH); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DAMAGE_S); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_CATCH); } if (SkelAnime_Update(&this->skelAnime)) { @@ -482,11 +482,11 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { player->actor.world.pos.y = this->actor.world.pos.y - sYOffsetPerForm[GET_PLAYER_FORM]; if (this->timer == -30) { - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_TAKEN_AWAY); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_TAKEN_AWAY); } if (this->timer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_UP); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_UP); } this->timer += 2; @@ -530,7 +530,7 @@ void EnWallmas_WaitForSwitchFlag(EnWallmas* this, PlayState* play) { } void EnWallmas_SetupStun(EnWallmas* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -564,10 +564,10 @@ void EnWallmas_UpdateDamage(EnWallmas* this, PlayState* play) { (!(this->collider.info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) { if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); + Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); this->actor.flags &= ~ACTOR_FLAG_1; } else if (this->actor.colChkInfo.damage != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FALL_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_DAMAGE); } EnWallmas_ThawIfFrozen(this, play); @@ -583,13 +583,13 @@ void EnWallmas_UpdateDamage(EnWallmas* this, PlayState* play) { EnWallmas_SetupStun(this); } else if (this->actor.colChkInfo.damageEffect == WALLMASTER_DMGEFF_STUN) { this->timer = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); EnWallmas_SetupStun(this); } else if (this->actor.colChkInfo.damageEffect == WALLMASTER_DMGEFF_ZORA_MAGIC) { this->timer = 40; - Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; @@ -635,7 +635,7 @@ void EnWallmas_Update(Actor* thisx, PlayState* play) { if ((this->actionFunc != EnWallmas_Die) && (this->actionFunc != EnWallmas_Drop)) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if ((this->actionFunc != EnWallmas_Damage) && (this->actor.bgCheckFlags & 1) && + if ((this->actionFunc != EnWallmas_Damage) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.freezeTimer == 0)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index 32038c411..3cfc1eba7 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -98,7 +98,7 @@ void func_80A66278(EnWarpUzu* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80A66384(this, play); } else { - phi_a0 = ABS((s16)(Actor_YawBetweenActors(&this->actor, &player->actor) - this->actor.shape.rot.y)); + phi_a0 = ABS((s16)(Actor_WorldYawTowardActor(&this->actor, &player->actor) - this->actor.shape.rot.y)); temp_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; phi_v1 = ABS(temp_v0); if (phi_a0 >= 0x2AAB) { diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index ef1ae15bc..99fa30977 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -8,7 +8,7 @@ #include "z_en_warp_tag.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnWarptag*)thisx) @@ -156,7 +156,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { } else { ActorCutscene_StartAndSetUnkLinkFields(play->playerActorCsIds[4], &this->dyna.actor); - func_800B8E58(player, NA_SE_PL_WARP_PLATE); + Player_PlaySfx(player, NA_SE_PL_WARP_PLATE); Play_EnableMotionBlur(0); } diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index 983104001..f1400d69b 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -482,7 +482,7 @@ void func_80A59C04(Actor* thisx, PlayState* play2) { player->flameTimers[j] = Rand_S16Offset(0, 200); } player->isBurning = true; - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DEMO_DAMAGE); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_DEMO_DAMAGE); } } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 7ddd539e7..530b75b0e 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -86,7 +86,9 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966E0C); break; case WEATHERTAG_TYPE_UNK3: - if (0) {} // this can move to diff locations and still match + //! FAKE: this can move to different locations and still match + if (1) {} + EnWeatherTag_SetupAction(this, func_80966EF0); break; case WEATHERTAG_TYPE_UNK4: @@ -94,7 +96,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { break; case WEATHERTAG_TYPE_UNK5: func_800BC154(play, &play->actorCtx, &this->actor, 7); - play->skyboxId = 3; + play->skyboxId = SKYBOX_3; play->envCtx.unk_1F = 5; play->envCtx.unk_20 = 5; D_801F4E74 = 1.0f; @@ -119,7 +121,7 @@ u8 func_80966608(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, Player* player = GET_PLAYER(play); u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(&this->actor) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { + if (WEATHER_TAG_RANGE100(&this->actor) > Actor_WorldDistXZToActor(&player->actor, &this->actor)) { if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { @@ -147,7 +149,7 @@ u8 func_80966758(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, Player* player = GET_PLAYER(play); u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(&this->actor) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { + if (WEATHER_TAG_RANGE100(&this->actor) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { @@ -173,7 +175,7 @@ void func_8096689C(EnWeatherTag* this, PlayState* play) { f32 distance; f32 partialResult; - distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); + distance = Actor_WorldDistXZToActor(&player->actor, &this->actor); if (this->fadeDistance < distance) { distance = this->fadeDistance; } @@ -231,10 +233,10 @@ void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play) { // this tag stops spawning after STT cleared? void func_80966B08(EnWeatherTag* this, PlayState* play) { if (func_80966608(this, play, 0, 0, play->envCtx.unk_1F, 5, 100, 2) || (gWeatherMode == 2)) { - play->skyboxId = 3; + play->skyboxId = SKYBOX_3; EnWeatherTag_SetupAction(this, func_80966D20); } else if (D_801F4E74 <= 0.01f) { - play->skyboxId = 1; + play->skyboxId = SKYBOX_NORMAL_SKY; } else { Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); } @@ -422,7 +424,7 @@ void func_809672DC(EnWeatherTag* this, PlayState* play) { Actor_GetClosestPosOnPath(this->pathPoints, this->pathCount, &GET_PLAYER(play)->actor.world.pos, &this->actor.world.pos, false); - distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); + distance = Actor_WorldDistXZToActor(&player->actor, &this->actor); range = WEATHER_TAG_RANGE100(&this->actor); if (distance < range) { @@ -447,7 +449,7 @@ void func_809672DC(EnWeatherTag* this, PlayState* play) { void func_809674C8(EnWeatherTag* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(&this->actor)) { + if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(&this->actor)) { if (CURRENT_DAY == 2) { if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { @@ -471,7 +473,7 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { // WEATHERTAG_TYPE_LOCALDAY2RAIN 2 void func_80967608(EnWeatherTag* this, PlayState* play) { if ((WEATHER_TAG_RANGE100(&this->actor) + 10.0f) < - Actor_XZDistanceBetweenActors(&GET_PLAYER(play)->actor, &this->actor)) { + Actor_WorldDistXZToActor(&GET_PLAYER(play)->actor, &this->actor)) { gWeatherMode = 0; EnWeatherTag_SetupAction(this, func_809674C8); } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index bc505ee53..4ed6b6a7d 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -299,10 +299,10 @@ void EnWf_Init(Actor* thisx, PlayState* play) { if (this->actor.child != NULL) { Player* player = GET_PLAYER(play); - this->actor.child->xzDistToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &player->actor); + this->actor.child->xzDistToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor); this->unk_2A4 = (temp_s0 * 0.5f) + 45.0f; this->unk_29C = 0x32000 / this->unk_2A4; - this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, &player->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &player->actor); this->actor.world.pos.x -= this->unk_2A4 * Math_SinS(this->actor.shape.rot.y); this->actor.world.pos.z -= this->unk_2A4 * Math_CosS(this->actor.shape.rot.y); } @@ -317,7 +317,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.0075f); if (this->actor.params == 0) { - SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitAnim, this->jointTable, this->morphTable, WOLFOS_NORMAL_LIMB_MAX); this->actor.hintId = TATL_HINT_ID_WOLFOS; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable2, &sColChkInfoInit); @@ -325,7 +325,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { this->collider1.elements[1].info.toucher.damage = 8; this->actor.colChkInfo.health = 6; } else { - SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitAnim, this->jointTable, this->morphTable, WOLFOS_WHITE_LIMB_MAX); this->actor.hintId = TATL_HINT_ID_WHITE_WOLFOS; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable1, &sColChkInfoInit); @@ -367,7 +367,7 @@ void func_809907D4(EnWf* this) { this->collider3.base.colType = COLTYPE_HIT3; this->unk_2A0 = 80; this->actor.flags &= ~ACTOR_FLAG_400; - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 80); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } void func_80990854(EnWf* this, PlayState* play) { @@ -405,7 +405,7 @@ s32 func_80990948(PlayState* play, EnWf* this, s16 arg2) { if (((this->unk_295 == 0) || ((this->unk_295 == 1) && (this->actor.child != NULL) && (this->actor.child->update != NULL))) && (this->actor.xzDistToPlayer > 160.0f) && - (this->unk_2A8 < Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos))) { + (this->unk_2A8 < Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos))) { func_80993524(this); return true; } @@ -419,7 +419,7 @@ s32 func_80990948(PlayState* play, EnWf* this, s16 arg2) { if (func_800BE184(play, &this->actor, 100.0f, 24000, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if ((this->actor.bgCheckFlags & 8) && (sp38 < 12000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (sp38 < 12000)) { func_809926D0(this); return true; } @@ -499,9 +499,9 @@ void func_80990C6C(EnWf* this, PlayState* play, s32 arg2) { } void func_80990E4C(EnWf* this, PlayState* play) { - if (Animation_OnFrame(&this->skelAnime, 1.0f) && (this->actor.bgCheckFlags & 1)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80990C6C(this, play, 2); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); } } @@ -517,7 +517,7 @@ s32 func_80990EAC(EnWf* this) { void func_80990ED4(EnWf* this) { this->actor.child = NULL; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); func_80991438(this); } @@ -549,7 +549,7 @@ void func_80990F50(EnWf* this, PlayState* play) { } void func_80990FC8(EnWf* this) { - Animation_Change(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); + Animation_Change(&this->skelAnime, &gWolfosRearUpFallOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->unk_2A0 = 5; this->actor.flags |= ACTOR_FLAG_1; this->actionFunc = func_80991040; @@ -561,7 +561,7 @@ void func_80991040(EnWf* this, PlayState* play) { Math_StepToF(&this->actor.shape.shadowScale, 70.0f, 14.0f); this->unk_2A0--; if (this->unk_2A0 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); } } else if (SkelAnime_Update(&this->skelAnime)) { this->actor.scale.y = this->actor.scale.x; @@ -571,8 +571,8 @@ void func_80991040(EnWf* this, PlayState* play) { void func_809910F0(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; - this->actor.speedXZ = 0.0f; - Animation_Change(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, -5.0f); + this->actor.speed = 0.0f; + Animation_Change(&this->skelAnime, &gWolfosRearUpFallOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, -5.0f); this->unk_2A0 = 5; this->actionFunc = func_80991174; } @@ -591,11 +591,11 @@ void func_80991174(EnWf* this, PlayState* play) { void func_80991200(EnWf* this) { this->collider2.base.acFlags |= AC_ON; - Animation_MorphToLoop(&this->skelAnime, &gWolfosWaitingAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosWaitAnim, -4.0f); this->unk_2A0 = (s32)Rand_ZeroFloat(10.0f) + 2; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_80991280; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } void func_80991280(EnWf* this, PlayState* play) { @@ -633,7 +633,7 @@ void func_80991280(EnWf* this, PlayState* play) { } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } } @@ -642,9 +642,9 @@ void func_80991280(EnWf* this, PlayState* play) { void func_80991438(EnWf* this) { this->collider2.base.acFlags |= AC_ON; - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); this->actor.world.rot.y = this->actor.shape.rot.y; - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; this->actionFunc = func_8099149C; } @@ -694,7 +694,7 @@ void func_8099149C(EnWf* this, PlayState* play) { } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } func_80990E4C(this, play); @@ -703,7 +703,7 @@ void func_8099149C(EnWf* this, PlayState* play) { } void func_80991738(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosSidesteppingAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosSidestepAnim, -4.0f); this->actionFunc = func_8099177C; } @@ -748,20 +748,20 @@ void func_8099177C(EnWf* this, PlayState* play) { } } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } } void func_80991948(EnWf* this) { this->collider2.base.acFlags |= AC_ON; - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); if (Rand_ZeroOne() > 0.5f) { this->unk_29A = 16000; } else { this->unk_29A = -16000; } - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_2A0 = (s32)Rand_ZeroFloat(30.0f) + 30; this->actionFunc = func_809919F4; @@ -776,7 +776,7 @@ void func_809919F4(EnWf* this, PlayState* play) { if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; sp26 = BINANG_ROT180(player->actor.shape.rot.y + this->unk_29A); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { temp_v0 = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk_29A; if (ABS_ALT(temp_v0) > 0x2EE0) { this->unk_29A = -this->unk_29A; @@ -787,7 +787,7 @@ void func_809919F4(EnWf* this, PlayState* play) { func_80990E4C(this, play); if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } if ((Math_CosS(sp26 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsTargeted(play, &this->actor) && @@ -809,12 +809,12 @@ void func_809919F4(EnWf* this, PlayState* play) { void func_80991C04(EnWf* this) { this->collider2.base.acFlags |= AC_ON; - Animation_PlayOnce(&this->skelAnime, &gWolfosSlashingAnim); + Animation_PlayOnce(&this->skelAnime, &gWolfosSlashAnim); this->collider1.base.atFlags &= ~AT_BOUNCED; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->unk_2A0 = 7; this->skelAnime.endFrame = 20.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80991C80; } @@ -827,11 +827,11 @@ void func_80991C80(EnWf* this, PlayState* play) { sp2A = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); sp30 = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (((this->skelAnime.curFrame >= 9.0f) && (this->skelAnime.curFrame < 13.0f)) || ((this->skelAnime.curFrame >= 17.0f) && (this->skelAnime.curFrame < 20.0f))) { if (!(this->collider1.base.atFlags & AT_ON)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_ATTACK); } this->collider1.base.atFlags |= AT_ON; } else { @@ -879,7 +879,7 @@ void func_80991FD8(EnWf* this) { if (this->skelAnime.curFrame > 15.0f) { phi_f0 = 15.0f; } - Animation_Change(&this->skelAnime, &gWolfosSlashingAnim, -0.5f, this->skelAnime.curFrame - 1.0f, phi_f0, + Animation_Change(&this->skelAnime, &gWolfosSlashAnim, -0.5f, this->skelAnime.curFrame - 1.0f, phi_f0, ANIMMODE_ONCE_INTERP, 0.0f); this->collider1.base.atFlags &= ~AT_ON; this->actionFunc = func_80992068; @@ -923,12 +923,12 @@ void func_80992068(EnWf* this, PlayState* play) { void func_8099223C(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; - Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosBackflippingAnim, -3.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosBackflipAnim, -3.0f); this->unk_2A0 = 0; - this->actor.speedXZ = -6.0f; + this->actor.speed = -6.0f; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); this->actionFunc = func_809922B4; } @@ -944,12 +944,12 @@ void func_809922B4(EnWf* this, PlayState* play) { } } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } void func_809923B0(EnWf* this) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } @@ -974,24 +974,24 @@ void func_809923E4(EnWf* this, PlayState* play) { void func_8099245C(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosDamagedAnim, -4.0f); - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -4.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -4.0f; } this->unk_298 = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DAMAGE); this->actionFunc = func_809924EC; } void func_809924EC(EnWf* this, PlayState* play) { s16 sp26; - if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; } - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ < 0.0f)) { - this->actor.speedXZ += 0.05f; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed < 0.0f)) { + this->actor.speed += 0.05f; } Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3000); @@ -1002,7 +1002,8 @@ void func_809924EC(EnWf* this, PlayState* play) { return; } - if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(sp26) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(sp26) < 0x2EE0) && + (this->actor.xzDistToPlayer < 120.0f)) { func_809926D0(this); } else if (!func_8099408C(play, this)) { if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(play, &this->actor) && @@ -1021,24 +1022,25 @@ void func_809924EC(EnWf* this, PlayState* play) { void func_809926D0(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; - Animation_Change(&this->skelAnime, &gWolfosBackflippingAnim, -1.0f, - Animation_GetLastFrame(&gWolfosBackflippingAnim.common), 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gWolfosBackflipAnim, -1.0f, Animation_GetLastFrame(&gWolfosBackflipAnim.common), + 0.0f, ANIMMODE_ONCE, -3.0f); this->unk_2A0 = 0; - this->actor.speedXZ = 6.5f; + this->actor.speed = 6.5f; this->actor.velocity.y = 15.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); + Actor_PlaySfx(&this->actor, NA_SE_EN_TEKU_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_80992784; } void func_80992784(EnWf* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2500); - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (2 | 1))) { + if (SkelAnime_Update(&this->skelAnime) && + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->actor.shape.rot.x = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; if (!Actor_OtherIsTargeted(play, &this->actor)) { func_80991C04(this); @@ -1052,9 +1054,9 @@ void func_8099282C(EnWf* this) { this->collider2.base.acFlags |= AC_ON; this->collider1.base.atFlags &= ~AT_ON; this->unk_2A0 = 10; - this->actor.speedXZ = 0.0f; - Animation_Change(&this->skelAnime, &gWolfosBlockingAnim, -1.0f, Animation_GetLastFrame(&gWolfosBlockingAnim.common), - 0.0f, ANIMMODE_ONCE, -2.0f); + this->actor.speed = 0.0f; + Animation_Change(&this->skelAnime, &gWolfosBlockAnim, -1.0f, Animation_GetLastFrame(&gWolfosBlockAnim.common), 0.0f, + ANIMMODE_ONCE, -2.0f); this->actionFunc = func_809928CC; } @@ -1091,7 +1093,7 @@ void func_80992A74(EnWf* this, PlayState* play) { f32 temp_f0; this->collider2.base.acFlags |= AC_ON; - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); player = GET_PLAYER(play); temp_f0 = Math_SinS((player->actor.shape.rot.y + this->unk_29A) - this->actor.yawTowardsPlayer); if (temp_f0 > 0.0f) { @@ -1103,7 +1105,7 @@ void func_80992A74(EnWf* this, PlayState* play) { } else { this->unk_29A = -16000; } - this->actor.speedXZ = 6.0f; + this->actor.speed = 6.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_2A0 = (s32)Rand_ZeroFloat(10.0f) + 5; this->actionFunc = func_80992B8C; @@ -1115,7 +1117,7 @@ void func_80992B8C(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_29A, 2000); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { sp2C = BINANG_SUB((this->actor.wallYaw - this->actor.yawTowardsPlayer), this->unk_29A); if (ABS_ALT(sp2C) > 0x2EE0) { this->unk_29A = -this->unk_29A; @@ -1146,33 +1148,33 @@ void func_80992B8C(EnWf* this, PlayState* play) { func_80990E4C(this, play); if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } } void func_80992D6C(EnWf* this) { this->collider2.base.acFlags &= ~AC_ON; - Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosRearUpFallOverAnim, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & 1) { - this->actor.speedXZ = -6.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.speed = -6.0f; } this->actor.flags &= ~ACTOR_FLAG_1; this->unk_2A0 = 25; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); this->actionFunc = func_80992E0C; } void func_80992E0C(EnWf* this, PlayState* play) { static Vec3f D_809942F0 = { 0.0f, 0.5f, 0.0f }; - if (this->actor.bgCheckFlags & 2) { - this->actor.speedXZ = 0.0f; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & 1) { - Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Math_StepToF(&this->actor.speed, 0.0f, 0.5f); } if (SkelAnime_Update(&this->skelAnime)) { @@ -1205,7 +1207,7 @@ void func_80992E0C(EnWf* this, PlayState* play) { } void func_80992FD4(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosWaitingAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosWaitAnim, -4.0f); this->actionFunc = func_80993018; } @@ -1217,7 +1219,7 @@ void func_80993018(EnWf* this, PlayState* play) { } else if (this->actor.child->xzDistToPlayer < (80.0f + this->unk_2A4)) { func_80993350(this); } else { - s16 temp_v0 = Actor_YawBetweenActors(this->actor.child, &this->actor); + s16 temp_v0 = Actor_WorldYawTowardActor(this->actor.child, &this->actor); s16 temp_v1 = BINANG_SUB(temp_v0 - this->actor.child->yawTowardsPlayer, 0x8000); if (ABS_ALT(temp_v1) > 0x800) { @@ -1232,8 +1234,8 @@ void func_80993018(EnWf* this, PlayState* play) { } void func_80993148(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); - this->actor.speedXZ = 0.0f; + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); + this->actor.speed = 0.0f; this->actionFunc = func_80993194; } @@ -1251,7 +1253,7 @@ void func_80993194(EnWf* this, PlayState* play) { if (this->actor.child->xzDistToPlayer < (80.0f + this->unk_2A4)) { func_80993350(this); } else { - sp36 = Actor_YawBetweenActors(this->actor.child, &this->actor); + sp36 = Actor_WorldYawTowardActor(this->actor.child, &this->actor); sp34 = Math_SmoothStepToS(&sp36, BINANG_ROT180(this->actor.child->yawTowardsPlayer), 10, this->unk_29C, 16); this->actor.world.pos.x = (Math_SinS(sp36) * this->unk_2A4) + this->actor.child->world.pos.x; @@ -1272,13 +1274,13 @@ void func_80993194(EnWf* this, PlayState* play) { } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } void func_80993350(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); this->actionFunc = func_809933A0; } @@ -1293,7 +1295,7 @@ void func_809933A0(EnWf* this, PlayState* play) { if (func_80990EAC(this)) { func_80990ED4(this); } else { - sp2E = Actor_YawBetweenActors(this->actor.child, &this->actor); + sp2E = Actor_WorldYawTowardActor(this->actor.child, &this->actor); Math_ScaledStepToS(&sp2E, this->actor.child->yawTowardsPlayer, this->unk_29C >> 2); sp2C = sp2E - this->actor.child->yawTowardsPlayer; this->actor.world.pos.x = (Math_SinS(sp2E) * this->unk_2A4) + this->actor.child->world.pos.x; @@ -1312,13 +1314,13 @@ void func_809933A0(EnWf* this, PlayState* play) { func_80990ED4(this); } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } void func_80993524(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); - this->actor.speedXZ = 6.0f; + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); + this->actor.speed = 6.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8099357C; } @@ -1330,14 +1332,14 @@ void func_8099357C(EnWf* this, PlayState* play) { func_80990E4C(this, play); if (this->unk_295 != 0) { if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - sp2E = Actor_YawBetweenActors(&this->actor, this->actor.child); + sp2E = Actor_WorldYawTowardActor(&this->actor, this->actor.child); if (func_80990EAC(this)) { this->actor.child = NULL; func_80991738(this); return; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (BINANG_SUB(sp2E, this->actor.wallYaw) > 0) { sp2E = this->actor.wallYaw - 0x4000; } else { @@ -1348,7 +1350,7 @@ void func_8099357C(EnWf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp2E, 10, 0x800, 16); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < (this->unk_2A4 + 10.0f)) { + if (Actor_WorldDistXZToActor(&this->actor, this->actor.child) < (this->unk_2A4 + 10.0f)) { func_80993148(this); } } else { @@ -1356,16 +1358,16 @@ void func_8099357C(EnWf* this, PlayState* play) { func_80991738(this); } } else { - Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 10, 0x800, - 16); + Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 10, + 0x800, 16); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) < 40.0f) { + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 40.0f) { func_809910F0(this); } } if (this->unk_2A2 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_CRY); + Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -1422,16 +1424,16 @@ void func_8099386C(EnWf* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect == 1) { this->unk_2A0 = 40; - Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 40); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_809923B0(this); } else if (this->actor.colChkInfo.damageEffect == 5) { this->unk_2A0 = 40; - Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 40); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; this->drawDmgEffScale = 0.75f; this->drawDmgEffAlpha = 2.0f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); func_809923B0(this); } else if (this->actor.colChkInfo.damageEffect == 3) { func_809907D4(this); @@ -1454,7 +1456,7 @@ void func_8099386C(EnWf* this, PlayState* play) { CLEAR_TAG_LARGE_LIGHT_RAYS); } - Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (this->actor.colChkInfo.health == 0) { func_80992D6C(this); } else { @@ -1486,7 +1488,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); func_80993738(this, play); - if (this->actor.bgCheckFlags & (2 | 1)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); } else { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 600); @@ -1590,7 +1592,7 @@ s32 func_8099408C(PlayState* play, EnWf* this) { s16 temp_v1; if (temp_v0 != NULL) { - temp_v1 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_29E; + temp_v1 = (Actor_WorldYawTowardActor(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_29E; if (ABS_ALT(temp_v1) < 0x3000) { if (Rand_ZeroOne() < 0.5f) { func_8099223C(this); diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index ee2f3d158..26f126e72 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -10,7 +10,7 @@ #define FLAGS \ (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_1000 | ACTOR_FLAG_100000 | \ - ACTOR_FLAG_8000000 | ACTOR_FLAG_80000000) + ACTOR_FLAG_CANT_LOCK_ON | ACTOR_FLAG_80000000) #define THIS ((EnWiz*)thisx) @@ -456,9 +456,9 @@ void EnWiz_HandleIntroCutscene(EnWiz* this, PlayState* play) { this->targetPlatformLightAlpha = 255; Math_Vec3f_Copy(&this->platformLightPos, &this->actor.world.pos); if (this->fightState == EN_WIZ_FIGHT_STATE_FIRST_PHASE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_UNARI); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_UNARI); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); } this->introCutsceneTimer = 40; @@ -504,7 +504,7 @@ void EnWiz_HandleIntroCutscene(EnWiz* this, PlayState* play) { break; case EN_WIZ_INTRO_CS_RUN_IN_CIRCLES: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); if (this->introCutsceneTimer == 0) { this->animLoopCounter = this->introCutsceneCameraAngle = 0; this->introCutsceneState = EN_WIZ_INTRO_CS_DISAPPEAR; @@ -663,7 +663,7 @@ void EnWiz_MoveGhosts(EnWiz* this) { } if (playSfx) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); } } @@ -702,9 +702,9 @@ void EnWiz_SetupAppear(EnWiz* this, PlayState* play) { Math_Vec3f_Copy(&this->platformLightPos, &this->actor.world.pos); if (this->fightState == EN_WIZ_FIGHT_STATE_FIRST_PHASE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_UNARI); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_UNARI); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); } } @@ -744,7 +744,7 @@ void EnWiz_Appear(EnWiz* this, PlayState* play) { this->shouldStartTimer = true; } } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_VOICE - SFX_FLAG); } if (this->timer == 0) { @@ -756,7 +756,7 @@ void EnWiz_Appear(EnWiz* this, PlayState* play) { return; } else { this->action = EN_WIZ_ACTION_RUN_IN_CIRCLES; - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->ghostColliders.elements[0].info.bumper.dmgFlags = 0x1013A22; Math_Vec3f_Copy(&this->staffTargetFlameScale, &staffTargetFlameScale); this->targetPlatformLightAlpha = 0; @@ -803,7 +803,7 @@ void EnWiz_Dance(EnWiz* this, PlayState* play) { Math_SmoothStepToS(&this->alpha, 255, 1, 5, 0); Math_ApproachF(&this->scale, 0.015f, 0.05f, 0.001f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); this->actor.world.rot.y += this->rotationalVelocity; if (this->fightState >= EN_WIZ_FIGHT_STATE_SECOND_PHASE_GHOSTS_RUN_AROUND) { EnWiz_MoveGhosts(this); @@ -856,7 +856,7 @@ void EnWiz_SecondPhaseCutscene(EnWiz* this, PlayState* play) { Math_SmoothStepToS(&this->alpha, 255, 1, 5, 0); subCam = Play_GetCamera(play, this->subCamId); Math_Vec3f_Copy(&subCam->at, &this->actor.focus.pos); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_RUN - SFX_FLAG); if (this->platforms[this->nextPlatformIndex] != NULL) { f32 diffX = this->actor.world.pos.x - this->platforms[this->nextPlatformIndex]->world.pos.x; f32 diffZ = this->actor.world.pos.z - this->platforms[this->nextPlatformIndex]->world.pos.z; @@ -875,7 +875,7 @@ void EnWiz_SecondPhaseCutscene(EnWiz* this, PlayState* play) { s32 pad; s32 i; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; if (sqrtf(SQ(diffX) + SQ(diffZ)) < 20.0f) { for (i = 0; i < this->platformCount; i++) { Math_Vec3f_Copy(&this->ghostPos[i], &gZeroVec3f); @@ -976,8 +976,8 @@ void EnWiz_Attack(EnWiz* this, PlayState* play) { Math_Vec3f_Pitch(&pos, &player->actor.world.pos), Math_Vec3f_Yaw(&pos, &player->actor.world.pos), 0, type * 4); this->hasActiveProjectile = true; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_ATTACK); - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_MAGIC_FIRE); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_ATTACK); + Actor_PlaySfx(&this->actor, NA_SE_PL_MAGIC_FIRE); } if ((curFrame >= 8.0f) && !this->shouldStartTimer) { @@ -1003,8 +1003,8 @@ void EnWiz_SetupDisappear(EnWiz* this) { } this->targetPlatformLightAlpha = 0; - this->actor.flags |= ACTOR_FLAG_8000000; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); Math_SmoothStepToS(&this->rotationalVelocity, 0x1388, 0x64, 0x3E8, 0x3E8); this->actor.world.rot.y += this->rotationalVelocity; this->actor.flags &= ~ACTOR_FLAG_1; @@ -1055,16 +1055,16 @@ void EnWiz_Disappear(EnWiz* this, PlayState* play) { void EnWiz_SetupDamaged(EnWiz* this, PlayState* play) { EnWiz_ChangeAnim(this, EN_WIZ_ANIM_DAMAGE, false); - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->timer = 20; if ((this->fightState != EN_WIZ_FIGHT_STATE_FIRST_PHASE) && (this->actor.colChkInfo.health <= 0)) { Enemy_StartFinishingBlow(play, &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DEAD); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DEAD); this->timer = 0; this->actor.flags &= ~ACTOR_FLAG_1; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DAMAGE); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_DAMAGE); } this->scale = 0.015f; @@ -1146,7 +1146,7 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { EnWiz_SetupDisappear(this); } - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; } Math_SmoothStepToS(&this->platformLightAlpha, this->targetPlatformLightAlpha, 20, 50, 10); @@ -1261,7 +1261,8 @@ void EnWiz_UpdateDamage(EnWiz* this, PlayState* play) { // If the player throws a Deku Nut or hits a ghost's collider (something that is impossible // in the final game, since EnWiz_Init effectively disables them), then the below code will // "destroy" the ghost by turning into a cloud of smoke. - if ((iREG(50) != 0) || (this->ghostColliders.elements[i + 1].info.bumperFlags & BUMP_HIT)) { + if ((R_TRANS_FADE_FLASH_ALPHA_STEP != 0) || + (this->ghostColliders.elements[i + 1].info.bumperFlags & BUMP_HIT)) { //! @bug: If a single ghost is destroyed, then changing the fight state here will cause //! strange behavior; the ghosts will stand still and pretend to attack the player like //! the real Wizrobe. Since Deku Nuts destroy all ghosts at once, and since the ghost diff --git a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c index f2d88759e..4a3689005 100644 --- a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c +++ b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c @@ -7,7 +7,7 @@ #include "z_en_wiz_brock.h" #include "objects/object_wiz/object_wiz.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnWizBrock*)thisx) diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c index 4ed3333fd..bf63fcc3c 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Wiz/z_en_wiz.h" #include "objects/object_wiz/object_wiz.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_8000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_CANT_LOCK_ON) #define THIS ((EnWizFire*)thisx) @@ -206,15 +206,15 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { Math_ApproachF(&this->scale, this->targetScale, 0.2f, 0.01f); if (this->wallCheckTimer == 0) { - if ((this->actor.bgCheckFlags & 8) && (this->type == EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE) && (this->timer != 0) && - (this->actor.bgCheckFlags & 8)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->type == EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE) && + (this->timer != 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { sPoolHitByIceArrow = false; this->timer = 0; this->targetScale = 0.0f; } } - if ((this->actor.bgCheckFlags & 1) && (this->poolTimer == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->poolTimer == 0)) { s32 i; s16 arcingProjectileRotY; s32 pad; @@ -260,13 +260,13 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { arcingProjectileRotY += BINANG_ADD((s32)randPlusMinusPoint5Scaled(0x1000), 0x3333); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_BOMB_EXPLOSION); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); this->poolTimer = Rand_S16Offset(70, 30); if (this->poolTimer != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_EXP - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_EXP - SFX_FLAG); } } else if (this->poolTimer != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } Math_Vec3f_Copy(&this->actor.velocity, &gZeroVec3f); @@ -291,7 +291,7 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) { } if (Player_HasMirrorShieldEquipped(play) && (this->collider.base.atFlags & AT_BOUNCED)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_REFLECT_MG); + Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_MG); this->collider.base.atFlags &= ~(AT_TYPE_ENEMY | AT_BOUNCED | AT_HIT); this->collider.base.atFlags |= AT_TYPE_PLAYER; this->collider.info.toucher.dmgFlags = 0x20; @@ -351,7 +351,7 @@ void EnWiz_SmallFlame(EnWizFire* this, PlayState* play) { } if (this->timer != 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } } @@ -392,7 +392,7 @@ void EnWiz_Pool(EnWizFire* this, PlayState* play) { this->collider.dim.height = 30; this->collider.dim.yShift = 15; EnWizFire_InitializeEffect(this, &pos, &accel); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); return; } @@ -426,7 +426,7 @@ void EnWiz_Pool(EnWizFire* this, PlayState* play) { if (this->isIceType == true) { Math_ApproachZeroF(&this->poolScale, 0.046f, 0.001f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (!this->shouldPoolFadeOut) { if ((this->actor.parent != NULL) && (this->actor.parent->id == ACTOR_EN_WIZ) && (this->poolScale < 0.05f)) { @@ -625,7 +625,7 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (this->type == EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_LAUGH2); + Actor_PlaySfx(&this->actor, NA_SE_EN_WIZ_LAUGH2); if (player->invincibilityTimer > 0) { player->invincibilityTimer += 40; if (this->isIceType) { diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index ba63b3021..9b74a97ac 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -4,6 +4,7 @@ * Description: Trees, shrubs */ +#include "prevent_bss_reordering.h" #include "z_en_wood02.h" #include "objects/object_wood02/object_wood02.h" @@ -35,8 +36,8 @@ typedef enum { /* 5 */ WOOD_DRAW_LEAF_YELLOW } WoodDrawType; -static f32 sSpawnCos; -static f32 sSpawnSin; +f32 sWood02SpawnCos; +f32 sWood02SpawnSin; ActorInit En_Wood02_InitVars = { ACTOR_EN_WOOD02, @@ -70,9 +71,9 @@ static ColliderCylinderInit sCylinderInit = { { 18, 60, 0, { 0, 0, 0 } }, }; -static f32 sSpawnDistance[] = { 707.0f, 525.0f, 510.0f, 500.0f, 566.0f, 141.0f }; +f32 sWood02SpawnDistance[] = { 707.0f, 525.0f, 510.0f, 500.0f, 566.0f, 141.0f }; -static s16 sSpawnAngle[] = { 0x1FFF, 0x4C9E, 0x77F5, 0xA5C9, -0x293D, 0xA000 }; +s16 sWood02SpawnAngle[] = { 0x1FFF, 0x4C9E, 0x77F5, 0xA5C9, -0x293D, 0xA000 }; static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 5600, ICHAIN_STOP), @@ -136,12 +137,12 @@ void EnWood02_SpawnOffspring(EnWood02* this, PlayState* play) { extraRot = 0x4000; } - sSpawnCos = Math_CosS(sSpawnAngle[i] + this->actor.world.rot.y + extraRot); - sSpawnSin = Math_SinS(sSpawnAngle[i] + this->actor.world.rot.y + extraRot); + sWood02SpawnCos = Math_CosS(sWood02SpawnAngle[i] + this->actor.world.rot.y + extraRot); + sWood02SpawnSin = Math_SinS(sWood02SpawnAngle[i] + this->actor.world.rot.y + extraRot); - childPos.x = (sSpawnDistance[i] * sSpawnSin) + this->actor.home.pos.x; + childPos.x = (sWood02SpawnDistance[i] * sWood02SpawnSin) + this->actor.home.pos.x; childPos.y = this->actor.home.pos.y; - childPos.z = (sSpawnDistance[i] * sSpawnCos) + this->actor.home.pos.z; + childPos.z = (sWood02SpawnDistance[i] * sWood02SpawnCos) + this->actor.home.pos.z; if (EnWood02_SpawnZoneCheck(this, play, &childPos)) { if (this->unk_14A[i] & 0x80) { @@ -152,8 +153,8 @@ void EnWood02_SpawnOffspring(EnWood02* this, PlayState* play) { childParams = ((this->unk_144 << 8) & 0xFF00) | (this->actor.params + 1); child = (EnWood02*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_WOOD02, childPos.x, - childPos.y, childPos.z, this->actor.world.rot.x, sSpawnAngle[i], - unk, childParams); + childPos.y, childPos.z, this->actor.world.rot.x, + sWood02SpawnAngle[i], unk, childParams); if (child != NULL) { child->unk_14A[0] = i; this->unk_14A[i] |= 1; @@ -296,10 +297,10 @@ void EnWood02_Init(Actor* thisx, PlayState* play) { if (spawnType == WOOD_SPAWN_SPAWNER) { EnWood02_SpawnOffspring(this, play); - sSpawnCos = Math_CosS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); - sSpawnSin = Math_SinS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); - this->actor.world.pos.x += sSpawnSin * sSpawnDistance[5]; - this->actor.world.pos.z += sSpawnCos * sSpawnDistance[5]; + sWood02SpawnCos = Math_CosS(sWood02SpawnAngle[5] + this->actor.world.rot.y + extraRot); + sWood02SpawnSin = Math_SinS(sWood02SpawnAngle[5] + this->actor.world.rot.y + extraRot); + this->actor.world.pos.x += sWood02SpawnSin * sWood02SpawnDistance[5]; + this->actor.world.pos.z += sWood02SpawnCos * sWood02SpawnDistance[5]; } else { this->actor.flags |= ACTOR_FLAG_10; this->unk_151 = 2; @@ -385,7 +386,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { if ((thisx->params < WOOD_BUSH_GREEN_SMALL) || (thisx->params == WOOD_TREE_SPECIAL)) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Actor_PlaySfxAtPos(thisx, NA_SE_IT_REFLECTION_WOOD); + Actor_PlaySfx(thisx, NA_SE_IT_REFLECTION_WOOD); } if (thisx->home.rot.y != 0) { @@ -404,7 +405,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { (thisx->params == WOOD_TREE_OVAL_YELLOW_SPAWNED)) { leavesParams = WOOD_LEAF_YELLOW; } - Actor_PlaySfxAtPos(thisx, NA_SE_EV_TREE_SWING); + Actor_PlaySfx(thisx, NA_SE_EV_TREE_SWING); for (i = 3; i >= 0; i--) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, @@ -436,10 +437,10 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { if ((this->unk_146 >= -1) && (((player->rideActor == NULL) && (sqrtf(thisx->xyzDistToPlayerSq) < 20.0f) && (player->linearVelocity != 0.0f)) || ((player->rideActor != NULL) && (sqrtf(thisx->xyzDistToPlayerSq) < 60.0f) && - (player->rideActor->speedXZ != 0.0f)))) { + (player->rideActor->speed != 0.0f)))) { func_808C4458(this, play, &thisx->world.pos, 1); this->unk_146 = -0x15; - Actor_PlaySfxAtPos(thisx, NA_SE_EV_TREE_SWING); + Actor_PlaySfx(thisx, NA_SE_EV_TREE_SWING); } } else { // Leaves this->unk_146++; diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 2310a2eef..7a751c7ce 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -276,7 +276,7 @@ void EnYb_ReceiveMask(EnYb* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - Actor_PickUp(&this->actor, play, GI_MASK_KAMARO, 10000.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, GI_MASK_KAMARO, 10000.0f, 100.0f); } EnYb_EnableProximityMusic(this); } @@ -289,27 +289,27 @@ void EnYb_Talk(EnYb* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x147D: // I am counting on you - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnYb_Disappear; SET_WEEKEVENTREG(WEEKEVENTREG_82_04); break; case 0x147C: // Spread my dance across the world if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnYb_Idle; } else if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { - func_80151938(play, 0x147D); // I am counting on you + Message_ContinueTextbox(play, 0x147D); // I am counting on you func_80BFA2FC(play); } else { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnYb_ReceiveMask; EnYb_ReceiveMask(this, play); } break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnYb_Idle; break; } @@ -377,7 +377,7 @@ void EnYb_Idle(EnYb* this, PlayState* play) { } else if ((player->stateFlags2 & PLAYER_STATE2_8000000) && this->actor.xzDistToPlayer < 180.0f && fabsf(this->actor.playerHeightRel) < 50.0f) { this->playerOcarinaOut |= 1; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); } EnYb_EnableProximityMusic(this); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index a16b828f9..0e282656c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -129,7 +129,7 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { leftWasGrounded = this->isLeftFootGrounded; rightWasGrounded = this->isRightFootGrounded; - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.depthInWater < 20.0f) { waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { @@ -142,12 +142,12 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) { - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) { - Actor_PlaySfxAtPos(&this->actor, sfxId); + Actor_PlaySfx(&this->actor, sfxId); } return 0; @@ -220,8 +220,8 @@ void EnZo_FollowPath(EnZo* this, PlayState* play) { s16 speed; Vec3f pos; - Math_SmoothStepToF(&this->actor.speedXZ, 1.0f, 0.4f, 1000.0f, 0.0f); - speed = this->actor.speedXZ * 400.0f; + Math_SmoothStepToF(&this->actor.speed, 1.0f, 0.4f, 1000.0f, 0.0f); + speed = this->actor.speed * 400.0f; if (SubS_CopyPointFromPath(this->path, this->waypoint, &pos) && SubS_MoveActorToPoint(&this->actor, &pos, speed)) { this->waypoint++; if (this->waypoint >= this->path->count) { @@ -233,7 +233,7 @@ void EnZo_FollowPath(EnZo* this, PlayState* play) { EnZo_ChangeAnim(&this->skelAnime, 1); this->actionFunc = EnZo_TreadWater; this->actor.gravity = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index fdc6e4789..895c5c032 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -267,7 +267,7 @@ void func_80B9FC70(EnZob* this, s16 arg1) { } void func_80B9FCA0(EnZob* this, PlayState* play) { - func_801477B4(play); + Message_CloseTextbox(play); play->msgCtx.ocarinaMode = 4; func_80B9FC0C(this); this->unk_2F4 &= ~1; @@ -372,14 +372,14 @@ void func_80BA00BC(EnZob* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 1: func_8019F208(); - func_80151938(play, 0x1209); + Message_ContinueTextbox(play, 0x1209); this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); break; case 0: func_8019F230(); - func_80151938(play, 0x1213); + Message_ContinueTextbox(play, 0x1213); break; } } @@ -391,7 +391,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { case 0x1208: case 0x120E: case 0x1216: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x120C: @@ -405,7 +405,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { case 0x1211: case 0x1213: case 0x1217: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->unk_304 = 3; func_80B9F7E4(this, 4, ANIMMODE_ONCE); break; @@ -457,13 +457,13 @@ void func_80BA0374(EnZob* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0x1207); + Message_ContinueTextbox(play, 0x1207); func_80B9F7E4(this, 2, ANIMMODE_ONCE); break; case 1: func_8019F230(); - func_80151938(play, 0x1206); + Message_ContinueTextbox(play, 0x1206); break; } } @@ -474,11 +474,11 @@ void func_80BA0374(EnZob* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x11F8: SET_WEEKEVENTREG(WEEKEVENTREG_30_02); - func_80151938(play, 0x11F9); + Message_ContinueTextbox(play, 0x11F9); break; case 0x11F9: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BA0728; this->unk_304 = 0; func_80B9F7E4(this, 6, ANIMMODE_ONCE); @@ -490,19 +490,19 @@ void func_80BA0374(EnZob* this, PlayState* play) { case 0x11FF: case 0x1201: case 0x1203: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x11FD: this->unk_304 = 3; func_80B9F7E4(this, 4, ANIMMODE_ONCE); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x11FE: this->unk_304 = 1; func_80B9F7E4(this, 3, ANIMMODE_LOOP); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x11FA: @@ -513,7 +513,7 @@ void func_80BA0374(EnZob* this, PlayState* play) { case 0x120F: case 0x1210: case 0x1215: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BA0728; this->unk_304 = 0; func_80B9F7E4(this, 6, ANIMMODE_ONCE); @@ -522,7 +522,7 @@ void func_80BA0374(EnZob* this, PlayState* play) { break; case 0x1207: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BA0318; player->unk_A90 = &this->actor; player->stateFlags3 |= PLAYER_STATE3_20; @@ -630,7 +630,7 @@ void func_80BA0A04(EnZob* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BA0AD8; this->unk_304 = 0; func_80B9F7E4(this, 6, ANIMMODE_ONCE); diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index 8d8065ff6..0da7a17bb 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -316,12 +316,12 @@ void func_80BAF7CC(EnZod* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0x1220); + Message_ContinueTextbox(play, 0x1220); break; case 1: func_8019F230(); - func_80151938(play, 0x1223); + Message_ContinueTextbox(play, 0x1223); break; } } @@ -336,32 +336,32 @@ void func_80BAF7CC(EnZod* this, PlayState* play) { case 0x1220: case 0x1221: case 0x1227: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1219: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->nextAnimIndex = ENZOD_ANIM_ARMS_FOLDED; break; case 0x121D: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->nextAnimIndex = ENZOD_ANIM_READY_TO_PLAY; break; case 0x1223: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); this->nextAnimIndex = ENZOD_ANIM_PLAYING_VIVACE; break; case 0x121E: case 0x1226: - func_80151938(play, 0x121F); + Message_ContinueTextbox(play, 0x121F); this->nextAnimIndex = ENZOD_ANIM_READY_TO_PLAY; break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = EnZod_PlayDrumsSequence; EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_LENTO, ANIMMODE_ONCE); break; @@ -419,7 +419,7 @@ void func_80BAFADC(EnZod* this, PlayState* play) { talkState = Message_GetState(&play->msgCtx); if (talkState != TEXT_STATE_CLOSING) { if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BAFB84; EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_LENTO, ANIMMODE_ONCE); } @@ -465,14 +465,14 @@ void EnZod_Rehearse(EnZod* this, PlayState* play) { void EnZod_SetupRehearse(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_LENTO, ANIMMODE_ONCE); this->actionFunc = EnZod_Rehearse; ActorCutscene_Stop(this->actor.cutscene); this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); ActorCutscene_SetIntentToPlay(this->actor.cutscene); gSaveContext.save.weekEventReg[79] |= 1; - Audio_QueueSeqCmd(NA_BGM_INDIGO_GO_SESSION | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_INDIGO_GO_SESSION | SEQ_FLAG_ASYNC); } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index a165d91fe..1935d627e 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -173,7 +173,7 @@ void func_80B93468(EnZog* this, PlayState* play) { this->actor.world.pos.x = points[-1].x; this->actor.world.pos.z = points[-1].z; this->actor.world.rot.y = Math_Atan2S(points->x - this->actor.world.pos.x, points->z - this->actor.world.pos.z); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } } @@ -465,7 +465,7 @@ s32 func_80B93EA0(EnZog* this, PlayState* play) { switch (this->unk_306) { case 2: if (play->csCtx.frames == 60) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_JUMP_SAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_SAND); } break; @@ -606,14 +606,14 @@ void func_80B943EC(EnZog* this, PlayState* play) { } } else if ((player->stateFlags2 & PLAYER_STATE2_8000000) && (this->actor.xzDistToPlayer < 120.0f)) { this->unk_30A |= 0x10; - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); } } void func_80B94470(EnZog* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x103C)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B9451C; this->unk_300 = this->unk_302 = 0; this->unk_31C = 2; @@ -675,7 +675,7 @@ void func_80B946FC(EnZog* this, PlayState* play) { case 1: func_8019F230(); - func_80151938(play, 0x1014); + Message_ContinueTextbox(play, 0x1014); break; } } @@ -685,20 +685,20 @@ void func_80B946FC(EnZog* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1008: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1009: this->unk_300 = 4; - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1014: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1015: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B948A8; this->unk_300 = this->unk_302 = 0; this->unk_31C = 2; @@ -762,9 +762,9 @@ void func_80B94A00(EnZog* this, PlayState* play) { if ((this->skelAnime.curFrame >= 35.0f) || ((this->skelAnime.curFrame >= 10.0f) && (this->skelAnime.curFrame <= 24.0f))) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; } if ((this->actor.depthInWater > 0.0f) && ((play->gameplayFrames % 8) == 0)) { @@ -781,21 +781,21 @@ void func_80B94A00(EnZog* this, PlayState* play) { if ((this->unk_304 == 4) && (Animation_OnFrame(&this->skelAnime, 136.0f) || Animation_OnFrame(&this->skelAnime, 155.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_WATER0); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0); } if ((this->unk_304 == 5) && (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 37.0f))) { if (this->actor.depthInWater > 0.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_WATER0); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0); } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_WALK_SAND); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SAND); } } } void func_80B94C5C(EnZog* this, PlayState* play) { - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_304 != 0) { if (this->actor.shape.yOffset > 0.0f) { this->actor.shape.yOffset -= 20.0f; @@ -818,7 +818,7 @@ void func_80B94C5C(EnZog* this, PlayState* play) { void func_80B94D0C(EnZog* this, PlayState* play) { func_80B93D2C(this, play); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; if (this->unk_320 > 0) { this->unk_320--; this->unk_31C = 1; @@ -834,11 +834,11 @@ void func_80B94D0C(EnZog* this, PlayState* play) { case 0x1004: case 0x1005: case 0x1006: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1007: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B94E34; this->unk_300 = 5; this->unk_320 = 0; @@ -857,10 +857,10 @@ void func_80B94E34(EnZog* this, PlayState* play) { func_80B93D2C(this, play); func_80B93BE0(this, play); - if (this->actor.speedXZ < 0.1f) { - this->actor.speedXZ = 0.0f; + if (this->actor.speed < 0.1f) { + this->actor.speed = 0.0f; } else { - if (this->actor.speedXZ > 0.1f) { + if (this->actor.speed > 0.1f) { WaterBox* sp44; Vec3f sp38; @@ -871,19 +871,19 @@ void func_80B94E34(EnZog* this, PlayState* play) { if (WaterBox_GetSurface1(play, &play->colCtx, sp38.x, sp38.z, &sp38.y, &sp44) && (this->actor.world.pos.y < sp38.y)) { EffectSsGSplash_Spawn(play, &sp38, NULL, NULL, 1, - Rand_ZeroFloat(this->actor.speedXZ * 40.0f) + (this->actor.speedXZ * 60.0f)); + Rand_ZeroFloat(this->actor.speed * 40.0f) + (this->actor.speed * 60.0f)); } - if ((player->actor.speedXZ > 3.0f) && (this->unk_324 == 0)) { + if ((player->actor.speed > 3.0f) && (this->unk_324 == 0)) { this->unk_324 = 25; - func_800B8E58(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_PUSH); + Player_PlaySfx(player, player->ageProperties->voiceSfxIdOffset + NA_SE_VO_LI_PUSH); } } - this->actor.speedXZ *= 0.3f; + this->actor.speed *= 0.3f; } if (ABS_ALT(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0x5000) { - Actor_PickUp(&this->actor, play, GI_NONE, 60.0f, 40.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 60.0f, 40.0f); } if (this->unk_324 > 0) { @@ -892,12 +892,12 @@ void func_80B94E34(EnZog* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B94D0C; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_300 = 2; - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.home.rot.z = 1; this->actionFunc = func_80B94C5C; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->unk_2FE = 1; this->actor.velocity.y = 0.0f; this->actor.terminalVelocity = 0.0f; @@ -922,7 +922,7 @@ void func_80B95128(EnZog* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B94D0C; this->unk_300 = 2; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; switch (CURRENT_DAY) { case 1: @@ -966,7 +966,7 @@ void EnZog_Update(Actor* thisx, PlayState* play) { if (((this->unk_304 == 6) && Animation_OnFrame(&this->skelAnime, 43.0f)) || ((this->unk_304 == 17) && Animation_OnFrame(&this->skelAnime, 14.0f))) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LAND_SAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_LAND_SAND); } if (this->unk_30A & 1) { diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 2f6f0e791..cc391c0b1 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -318,7 +318,7 @@ void func_80B31E00(EnZoraegg* this) { } if ((this->unk_1E8 == 111) || (this->unk_1E8 == 32)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_BORN); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_BORN); } } @@ -340,7 +340,7 @@ void func_80B320E0(EnZoraegg* this, PlayState* play) { this->actionFunc = func_80B32094; Message_StartTextbox(play, 0x24B, &this->actor); } else { - Actor_PickUp(&this->actor, play, GI_MAX, 80.0f, 60.0f); + Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 60.0f); if (this->actor.isTargeted) { func_800B8614(&this->actor, play, 110.0f); } @@ -437,7 +437,7 @@ void func_80B324B0(EnZoraegg* this, PlayState* play) { Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if ((this->unk_1EA & 4) && Animation_OnFrame(&this->skelAnime, this->unk_1E4)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); this->unk_1E4 = Rand_ZeroFloat(5.0f); } } else if (this->unk_1EA & 4) { @@ -478,13 +478,13 @@ void func_80B326F4(EnZoraegg* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_19_40); this->unk_1EC = 2; this->unk_1EE = 100; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); } Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (Animation_OnFrame(&this->skelAnime, 4.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); } } @@ -507,7 +507,7 @@ void func_80B32820(EnZoraegg* this, PlayState* play) { Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); if (Animation_OnFrame(&this->skelAnime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_0); } } @@ -542,7 +542,7 @@ void func_80B32928(EnZoraegg* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 97.0f) || Animation_OnFrame(&this->skelAnime, 101.0f) || Animation_OnFrame(&this->skelAnime, 105.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); } } @@ -579,7 +579,7 @@ void func_80B32BB8(EnZoraegg* this, PlayState* play) { func_80B31C40(this, play); func_80B31D64(this, play, 13, 0.0f); - if (this->actor.bgCheckFlags & 0x1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actionFunc = func_80B32B70; } @@ -627,7 +627,7 @@ void func_80B32D08(EnZoraegg* this, PlayState* play) { EffectSsGRipple_Spawn(play, &sp34, 150, 500, 0); EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 200); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER_L); this->actionFunc = func_80B32C34; this->actor.velocity.y = -1.0f; diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 72de2024f..c538457e8 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -273,7 +273,7 @@ void func_80BBB354(EnZos* this, PlayState* play) { } else { getItemId = GI_HEART_PIECE; } - Actor_PickUp(&this->actor, play, getItemId, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f); } } @@ -324,7 +324,7 @@ void func_80BBB574(EnZos* this, PlayState* play) { if (func_80BBAFFC(this, play)) { if (this->unk_2B6 & 0x20) { this->unk_2B6 &= ~0x20; - func_80151938(play, 0x124C); + Message_ContinueTextbox(play, 0x124C); } } @@ -335,7 +335,7 @@ void func_80BBB574(EnZos* this, PlayState* play) { play->msgCtx.msgLength = 0; this->unk_2B6 |= 0x20; } else { - func_80151938(play, 0x124C); + Message_ContinueTextbox(play, 0x124C); } break; @@ -348,11 +348,11 @@ void func_80BBB574(EnZos* this, PlayState* play) { case 0x124D: this->unk_2B6 &= ~0x10; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_80151938(play, 0x124E); + Message_ContinueTextbox(play, 0x124E); break; case 0x124E: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BBB354; func_80BBB354(this, play); break; @@ -370,7 +370,7 @@ void func_80BBB718(EnZos* this, PlayState* play) { itemAction = func_80123810(play); if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); if (itemAction == PLAYER_IA_BOTTLE_ZORA_EGG) { player->actor.textId = 0x1232; @@ -388,9 +388,9 @@ void func_80BBB718(EnZos* this, PlayState* play) { this->actionFunc = func_80BBB8AC; } else if (itemAction <= PLAYER_IA_MINUS1) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_39_08)) { - func_80151938(play, 0x1241); + Message_ContinueTextbox(play, 0x1241); } else { - func_80151938(play, 0x1237); + Message_ContinueTextbox(play, 0x1237); SET_WEEKEVENTREG(WEEKEVENTREG_39_08); EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 4; @@ -425,13 +425,13 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x123C: case 0x123E: case 0x123F: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1244: this->unk_2B6 &= ~0x10; EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1232: @@ -441,29 +441,29 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1239: case 0x1246: EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1233: EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1245: case 0x1248: EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_FOOT_TAP, ANIMMODE_LOOP); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1231: - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80BBB718; break; case 0x1243: case 0x1249: EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; @@ -473,21 +473,23 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1242: EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); Actor_ProcessTalkRequest(&this->actor, &play->state); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; case 0x1236: EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; default: - if (0) {} - func_801477B4(play); + //! FAKE: + if (1) {} + + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; break; @@ -612,7 +614,7 @@ void func_80BBC070(EnZos* this, PlayState* play) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BBC14C; this->unk_2B6 |= 1; } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 331a153df..ce5625b83 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -299,7 +299,7 @@ s32 func_80B96E5C(EnZot* this) { temp_f14 = points->z - this->actor.world.pos.z; this->actor.world.rot.y = Math_Atan2S(temp_f12, temp_f14); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 2000, 200); - phi_f2 = SQ(this->actor.speedXZ) * SQ(3.0f); + phi_f2 = SQ(this->actor.speed) * SQ(3.0f); if (this->unk_2D4 == 0) { phi_f2 = SQ(20.0f); @@ -383,14 +383,14 @@ void func_80B97194(EnZot* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x125C: case 0x125F: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x125D: case 0x125E: case 0x1260: case 0x1261: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97240; break; } @@ -454,36 +454,36 @@ void func_80B973BC(EnZot* this, PlayState* play) { case 0x1270: case 0x1273: case 0x1274: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1272: - func_80151938(play, 0x126F); + Message_ContinueTextbox(play, 0x126F); break; case 0x126F: Rupees_ChangeBy(90); - func_80151938(play, 0x1270); + Message_ContinueTextbox(play, 0x1270); break; case 0x1275: if (gSaveContext.save.playerData.rupees < 10) { - func_80151938(play, 0x1277); + Message_ContinueTextbox(play, 0x1277); } else { - func_80151938(play, 0x1278); + Message_ContinueTextbox(play, 0x1278); Rupees_ChangeBy(-10); } break; case 0x1276: - func_80151938(play, 0x1275); + Message_ContinueTextbox(play, 0x1275); break; case 0x1271: case 0x1277: case 0x1278: case 0x1279: - func_801477B4(play); + Message_CloseTextbox(play); func_80B965D0(this, play); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.textId = 0; @@ -530,10 +530,10 @@ void func_80B9765C(EnZot* this, PlayState* play) { case 0x1267: case 0x126A: case 0x126B: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97708; break; } @@ -652,9 +652,9 @@ void func_80B979DC(EnZot* this, PlayState* play) { if (func_80B96E5C(this)) { this->actionFunc = func_80B97B5C; func_80B96BEC(this, 0, ANIMMODE_LOOP); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; } } @@ -667,7 +667,7 @@ void func_80B97A44(EnZot* this, PlayState* play) { case 0x1282: case 0x1285: case 0x1288: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x127D: @@ -676,7 +676,7 @@ void func_80B97A44(EnZot* this, PlayState* play) { case 0x1284: case 0x1289: case 0x128A: - func_801477B4(play); + Message_CloseTextbox(play); if (!(this->unk_2F2 & 2)) { this->unk_2F2 |= 2; this->actionFunc = func_80B979DC; @@ -687,7 +687,7 @@ void func_80B97A44(EnZot* this, PlayState* play) { break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97B5C; break; } @@ -720,7 +720,7 @@ void func_80B97C40(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97CC8; } } @@ -737,14 +737,14 @@ void func_80B97CC8(EnZot* this, PlayState* play) { void func_80B97D6C(EnZot* this, PlayState* play) { if (func_80B96E5C(this)) { this->actionFunc = func_80B97CC8; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80B96BEC(this, 0, ANIMMODE_LOOP); } else { - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ZORA_WALK); + Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_WALK); } } @@ -772,17 +772,17 @@ void func_80B97E4C(EnZot* this, PlayState* play) { case 0x128C: this->unk_2F2 &= ~4; func_80B96BEC(this, 6, ANIMMODE_ONCE); - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x128D: case 0x128E: case 0x128F: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1290: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97D6C; this->unk_2F2 |= 4; func_80B96BEC(this, 3, ANIMMODE_LOOP); @@ -790,7 +790,7 @@ void func_80B97E4C(EnZot* this, PlayState* play) { break; case 0x128B: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B97FD0; break; } @@ -819,9 +819,9 @@ void func_80B980FC(EnZot* this, PlayState* play) { this->actor.home.rot.x--; } else if (func_80B96E5C(this)) { this->actionFunc = func_80B97100; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; } else { - this->actor.speedXZ = 8.0f; + this->actor.speed = 8.0f; if (this->unk_2F0 != 3) { func_80B96BEC(this, 3, ANIMMODE_LOOP); } @@ -943,7 +943,7 @@ void func_80B9854C(EnZot* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - Actor_PickUp(&this->actor, play, this->unk_2D4, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, this->unk_2D4, 10000.0f, 50.0f); } } @@ -956,7 +956,7 @@ void func_80B985EC(EnZot* this, PlayState* play) { itemAction = func_80123810(play); if (itemAction > PLAYER_IA_NONE) { - func_801477B4(play); + Message_CloseTextbox(play); if ((itemAction == PLAYER_IA_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && Snap_CheckFlag(PICTO_VALID_LULU_HEAD)) { if (Snap_CheckFlag(PICTO_VALID_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTO_VALID_LULU_LEFT_ARM)) { @@ -970,7 +970,7 @@ void func_80B985EC(EnZot* this, PlayState* play) { } this->actionFunc = func_80B98728; } else if (itemAction <= PLAYER_IA_MINUS1) { - func_80151938(play, 0x12AB); + Message_ContinueTextbox(play, 0x12AB); this->actionFunc = func_80B98728; } } @@ -985,12 +985,12 @@ void func_80B98728(EnZot* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_80151938(play, 0x1294); + Message_ContinueTextbox(play, 0x1294); break; case 1: func_8019F230(); - func_80151938(play, 0x1298); + Message_ContinueTextbox(play, 0x1298); break; } } @@ -1015,44 +1015,44 @@ void func_80B98728(EnZot* this, PlayState* play) { case 0x12A7: case 0x12A8: case 0x12AE: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x12A9: case 0x12AA: - func_80151938(play, 0xFF); + Message_ContinueTextbox(play, 0xFF); this->actionFunc = func_80B985EC; break; case 0x1294: if (CURRENT_DAY == 3) { - func_80151938(play, 0x1296); + Message_ContinueTextbox(play, 0x1296); } else { - func_80151938(play, 0x1295); + Message_ContinueTextbox(play, 0x1295); } break; case 0x12AB: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98998; break; case 0x12AC: - func_801477B4(play); + Message_CloseTextbox(play); this->unk_2D4 = 2; this->actionFunc = func_80B9854C; func_80B9854C(this, play); break; case 0x12AF: - func_801477B4(play); + Message_CloseTextbox(play); this->unk_2D4 = 4; this->actionFunc = func_80B9854C; func_80B9854C(this, play); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98998; this->actor.flags &= ~ACTOR_FLAG_10000; break; @@ -1099,25 +1099,25 @@ void func_80B98AD0(EnZot* this, PlayState* play) { case 0x12B4: case 0x12B7: case 0x12B9: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x12B8: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98CA8; CLEAR_WEEKEVENTREG(WEEKEVENTREG_41_20); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98CA8; SET_WEEKEVENTREG(WEEKEVENTREG_41_20); AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98CA8; break; } @@ -1205,7 +1205,7 @@ void func_80B98F30(EnZot* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80B990A4; } else { - Actor_PickUp(&this->actor, play, GI_RUPEE_BLUE, 10000.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, GI_RUPEE_BLUE, 10000.0f, 50.0f); } } @@ -1223,17 +1223,17 @@ void func_80B98F94(EnZot* this, PlayState* play) { case 0x12BC: case 0x12C0: case 0x12C3: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x12BE: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B98F30; func_80B98F30(this, play); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B990A4; break; } @@ -1282,9 +1282,9 @@ void func_80B991E4(EnZot* this, PlayState* play) { if ((temp == 0x12C6) || (temp == 0x12C7) || (temp == 0x12CA) || (temp == 0x12CB)) { temp2 = temp; - func_80151938(play, temp2 + 1); + Message_ContinueTextbox(play, temp2 + 1); } else { - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80B992C0; func_80B96BEC(this, 1, ANIMMODE_LOOP); } @@ -1295,13 +1295,13 @@ void func_80B992C0(EnZot* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B991E4; func_80B99160(this, play); - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; func_80B96BEC(this, 0, ANIMMODE_LOOP); } else { if (Player_IsFacingActor(&this->actor, 0x3000, play) && (this->actor.xzDistToPlayer < 100.0f)) { func_800B8614(&this->actor, play, 120.0f); } - this->actor.speedXZ = 1.5f; + this->actor.speed = 1.5f; func_80B96FB0(this); } } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 27d4e04b1..17c4a9f70 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -264,14 +264,14 @@ void func_80BD187C(EnZov* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1022: - func_80151938(play, 0x1023); + Message_ContinueTextbox(play, 0x1023); break; case 0x1023: if ((this->unk_322 != 6) && (this->unk_322 != 1)) { func_80BD1570(this, 1, ANIMMODE_ONCE); } - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BD1C84; break; @@ -279,14 +279,14 @@ void func_80BD187C(EnZov* this, PlayState* play) { if (this->unk_322 != 6) { func_80BD1570(this, 0, ANIMMODE_LOOP); } - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BD1C84; break; default: this->unk_320 &= ~1; func_80BD1570(this, 0, ANIMMODE_LOOP); - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BD1C84; break; } @@ -294,7 +294,7 @@ void func_80BD187C(EnZov* this, PlayState* play) { break; case TEXT_STATE_CLOSING: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BD1C84; this->unk_320 &= ~1; func_80BD1570(this, 0, ANIMMODE_LOOP); @@ -419,7 +419,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { case 0x1036: case 0x1037: case 0x1038: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; case 0x1039: @@ -429,11 +429,11 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_78_01); this->actionFunc = func_80BD1D94; play->msgCtx.msgLength = 0; - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); break; default: - func_801477B4(play); + Message_CloseTextbox(play); this->actionFunc = func_80BD1F1C; break; } diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index 7e3709162..e68a11038 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -405,7 +405,7 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { void func_80BDD350(EnZow* this, PlayState* play) { if (this->unk_2CA & 2) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DIVE_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_DIVE_WATER); func_80BDCDA8(this, this->unk_2D0); this->actor.flags &= ~ACTOR_FLAG_1; this->skelAnime.playSpeed = 0.0f; @@ -420,7 +420,7 @@ void func_80BDD350(EnZow* this, PlayState* play) { } } - if ((this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > 180.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.depthInWater > 180.0f)) { this->actor.velocity.y = 0.0f; this->actionFunc = func_80BDD79C; } @@ -477,11 +477,11 @@ void func_80BDD570(EnZow* this, PlayState* play) { case 0x12FB: case 0x12FD: case 0x12FF: - func_80151938(play, play->msgCtx.currentTextId + 1); + Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1); break; default: - func_801477B4(play); + Message_CloseTextbox(play); break; } } @@ -511,7 +511,7 @@ void func_80BDD6BC(EnZow* this, PlayState* play) { } if (this->actor.depthInWater < 54.0f) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); + Actor_PlaySfx(&this->actor, NA_SE_EV_OUT_OF_WATER); func_80BDCDA8(this, this->unk_2D0); func_80BDD04C(this, 1, ANIMMODE_ONCE); this->actor.flags |= ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index c4d72a8f1..c41f45579 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -1,9 +1,3 @@ -/* - * File: z_item_b_heart.c - * Overlay: ovl_Item_B_Heart - * Description: Heart Container - */ - #include "z_item_b_heart.h" #include "objects/object_gi_hearts/object_gi_hearts.h" @@ -16,9 +10,8 @@ void ItemBHeart_Destroy(Actor* thisx, PlayState* play); void ItemBHeart_Update(Actor* thisx, PlayState* play); void ItemBHeart_Draw(Actor* thisx, PlayState* play); -void func_808BCF54(ItemBHeart* this, PlayState* play); - -ActorInit Item_B_Heart_InitVars = { +/* +const ActorInit Item_B_Heart_InitVars = { ACTOR_ITEM_B_HEART, ACTORCAT_BOSS, FLAGS, @@ -27,89 +20,16 @@ ActorInit Item_B_Heart_InitVars = { (ActorFunc)ItemBHeart_Init, (ActorFunc)ItemBHeart_Destroy, (ActorFunc)ItemBHeart_Update, - (ActorFunc)ItemBHeart_Draw, + (ActorFunc)ItemBHeart_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 0, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Init.s") -void ItemBHeart_Init(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Destroy.s") - if (Flags_GetCollectible(play, 0x1F)) { - Actor_Kill(&this->actor); - return; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Update.s") - Actor_ProcessInitChain(&this->actor, sInitChain); - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.8f); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/func_808BCF54.s") - if (this->actor.params == 0x23) { - this->unk_168 = 0.1f; - } else { - this->unk_168 = 1.0f; - } - - this->actor.world.pos.y += (20.0f * this->unk_168); -} - -void ItemBHeart_Destroy(Actor* thisx, PlayState* play) { -} - -void ItemBHeart_Update(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; - - func_808BCF54(this, play); - - if (!(this->unk_168 < 0.5f)) { - if (Actor_HasParent(&this->actor, play)) { - Flags_SetCollectible(play, 0x1F); - Actor_Kill(&this->actor); - return; - } - - Actor_PickUp(&this->actor, play, GI_HEART_CONTAINER, 30.0f, 80.0f); - } -} - -void func_808BCF54(ItemBHeart* this, PlayState* play) { - this->actor.shape.rot.y += 0x400; - Math_ApproachF(&this->unk_164, 0.4f, 0.1f, 0.01f); - Actor_SetScale(&this->actor, this->unk_164 * this->unk_168); -} - -void ItemBHeart_Draw(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; - Actor* blueWarpActor; - u8 flag = false; - - OPEN_DISPS(play->state.gfxCtx); - - blueWarpActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - - while (blueWarpActor != NULL) { - if ((blueWarpActor->id == ACTOR_DOOR_WARP1) && (blueWarpActor->projectedPos.z > this->actor.projectedPos.z)) { - flag = true; - break; - } - blueWarpActor = blueWarpActor->next; - } - - if (flag || thisx->world.rot.y != 0) { - func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGiHeartBorderDL); - gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); - } else { - func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gGiHeartBorderDL); - gSPDisplayList(POLY_OPA_DISP++, gGiHeartContainerDL); - } - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Draw.s") diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h index f7ff62fa9..4e3126e25 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h @@ -7,8 +7,7 @@ struct ItemBHeart; typedef struct ItemBHeart { /* 0x000 */ Actor actor; - /* 0x144 */ UNK_TYPE1 unk_144[0x20]; - /* 0x164 */ f32 unk_164; + /* 0x144 */ UNK_TYPE1 unk_144[0x24]; /* 0x168 */ f32 unk_168; } ItemBHeart; // size = 0x16C diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index e327dc3f4..c5b218815 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -106,7 +106,7 @@ void func_8092009C(ItemEtcetera* this, PlayState* play) { return; } - Actor_PickUp(&this->actor, play, this->getItemId, 30.0f, 50.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 30.0f, 50.0f); } void func_809200F8(ItemEtcetera* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index acea3daf1..532daec90 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -151,7 +151,10 @@ void ObjAqua_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); - if (1) {}; + + //! FAKE: + if (1) {} + this->actor.shape.shadowAlpha = 140; this->alpha = 255; if (func_80ACBA60(this, play)) { @@ -175,11 +178,11 @@ void func_80ACBC70(ObjAqua* this) { } void func_80ACBC8C(ObjAqua* this, PlayState* play) { - if (this->actor.bgCheckFlags & 0x21) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80ACB7F4(this, play); func_80ACBA10(this); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOTTLE_WATERING); + Actor_PlaySfx(&this->actor, NA_SE_EV_BOTTLE_WATERING); func_80ACBD34(this); } else { func_80ACB6A0(this, play); diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index 565c99504..05544da0e 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -277,14 +277,14 @@ void func_809A562C(ObjArmos* this, PlayState* play) { if ((temp == OBJARMOS_ROT_7_4) || (temp == OBJARMOS_ROT_7_5) || (temp == OBJARMOS_ROT_7_6)) { if (!func_809A500C(this, this->unk_264) || func_809A4E00(this, play, 0x5A)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else if (func_809A500C(this, this->unk_264)) { if (func_809A4E00(this, play, 0x5A)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Flags_SetSwitch(play, OBJARMOS_GET_7F(&this->dyna.actor)); sp20 = true; } @@ -325,7 +325,7 @@ void ObjArmos_Update(Actor* thisx, PlayState* play2) { if (this->unk_24C != 0) { Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 30.0f, 0.0f, this->unk_24C); - if ((this->actionFunc == func_809A54E0) && (this->dyna.actor.bgCheckFlags & 1) && + if ((this->actionFunc == func_809A54E0) && (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId) == NULL)) { this->unk_24C = 0; } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 35f37d5d8..13b565598 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -235,15 +235,15 @@ void func_809372D0(ObjBean* this) { sp34 = Math3D_Vec3fMagnitude(&actor->velocity); temp_f2 = D_80938FF8[this->unk_1DE].x; temp_f12 = D_80938FF8[this->unk_1DE].z; - if (sp34 < (actor->speedXZ * 8.0f)) { + if (sp34 < (actor->speed * 8.0f)) { temp_f2 = ((temp_f2 - 2.0f) * 0.1f) + 2.0f; temp_f12 *= 0.4f; } - Math_StepToF(&actor->speedXZ, temp_f2, temp_f12); + Math_StepToF(&actor->speed, temp_f2, temp_f12); - if ((actor->speedXZ + 0.05f) < sp34) { - Math_Vec3f_Scale(&actor->velocity, actor->speedXZ / sp34); + if ((actor->speed + 0.05f) < sp34) { + Math_Vec3f_Scale(&actor->velocity, actor->speed / sp34); this->unk_1BC.x += actor->velocity.x; this->unk_1BC.y += actor->velocity.y; this->unk_1BC.z += actor->velocity.z; @@ -255,7 +255,7 @@ void func_809372D0(ObjBean* this) { } else { this->unk_1DC++; } - actor->speedXZ *= 0.5f; + actor->speed *= 0.5f; } } @@ -576,7 +576,7 @@ void func_80937FC8(ObjBean* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } else { - func_800B85E0(&this->dyna.actor, play, 28.0f, 0x2E); + func_800B85E0(&this->dyna.actor, play, 28.0f, PLAYER_IA_MAGIC_BEANS); } } } @@ -775,7 +775,7 @@ void func_80938874(ObjBean* this) { this->actionFunc = func_809388A8; this->dyna.actor.draw = func_80938E00; this->dyna.actor.flags |= ACTOR_FLAG_10; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_809388A8(ObjBean* this, PlayState* play) { @@ -847,7 +847,7 @@ void func_80938AD8(ObjBean* this, PlayState* play) { func_80937160(this); if (this->unk_1B2 == 25) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_PL_PLANT_GROW_BIG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_PL_PLANT_GROW_BIG); } if (sp30 != 0) { diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c index f8534afea..fb7f1466c 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c @@ -188,11 +188,11 @@ s32 func_80A357A8(ObjBell* this, PlayState* play) { this->unk_20E = 10; switch (this->dyna.actor.colChkInfo.damageEffect) { case 15: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGBELL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGBELL); func_80A35510(this, 1); break; case 14: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGBELL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGBELL); func_80A35510(this, 2); break; default: diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index 4b7e9f471..04871bae5 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -247,7 +247,7 @@ void func_80AE9258(ObjBigicicle* this, PlayState* play) { icePoly = (ObjIcePoly*)itemAction; temp_f0 = this->actor.world.pos.y - icePoly->actor.world.pos.y; if ((temp_f0 < icePoly->colliders1[0].dim.height) && (temp_f0 > 0.0f) && - (Actor_XZDistanceBetweenActors(&this->actor, &icePoly->actor) < icePoly->colliders1[0].dim.radius)) { + (Actor_WorldDistXZToActor(&this->actor, &icePoly->actor) < icePoly->colliders1[0].dim.radius)) { Flags_SetSwitch(play, this->actor.params); this->actionFunc = func_80AE939C; return; @@ -256,7 +256,7 @@ void func_80AE9258(ObjBigicicle* this, PlayState* play) { itemAction = itemAction->next; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actionFunc = func_80AE939C; } else { Collider_UpdateCylinder(&this->actor, &this->collider1); diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index c48ff332c..cc94527a0 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -16,7 +16,7 @@ void ObjBoat_Destroy(Actor* thisx, PlayState* play); void ObjBoat_Update(Actor* thisx, PlayState* play); void ObjBoat_Draw(Actor* thisx, PlayState* play); -void func_80B9B428(Actor* thisx, PlayState* play2); +void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2); ActorInit Obj_Boat_InitVars = { ACTOR_OBJ_BOAT, @@ -37,14 +37,21 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -s16 func_80B9AF50(ObjBoat* this, Vec3f* arg0) { +/** + * Get the next point on the path and the yaw to use to get there. + * + * @param this + * @param nextPoint Position of next point on path + * @return yaw to use (or opposite of yaw if reversing) + */ +s16 ObjBoat_GetNextPoint(ObjBoat* this, Vec3f* nextPoint) { s16 yaw; - Vec3s* temp = &this->unk_164[(s32)this->unk_15C]; + Vec3s* curPoint = &this->points[(s32)this->curPointIndex]; - Math_Vec3s_ToVec3f(arg0, &temp[this->unk_15D]); - yaw = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, arg0); + Math_Vec3s_ToVec3f(nextPoint, &curPoint[this->direction]); + yaw = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, nextPoint); - return ((this->unk_15D > 0) ? yaw : (yaw + 0x8000)); + return ((this->direction > 0) ? yaw : yaw + 0x8000); } void ObjBoat_Init(Actor* thisx, PlayState* play) { @@ -57,17 +64,17 @@ void ObjBoat_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 3); DynaPolyActor_LoadMesh(play, &this->dyna, &object_kaizoku_obj_Colheader_009A88); if (thisx->params < 0) { - this->dyna.actor.update = func_80B9B428; + this->dyna.actor.update = ObjBoat_UpdateCutscene; } else { path = &play->setupPathList[OBJBOAT_GET_PATH(thisx)]; - this->unk_163 = path->count - 1; - this->unk_164 = Lib_SegmentedToVirtual(path->points); - this->unk_15D = 1; - this->dyna.actor.world.pos.x = this->unk_164[this->unk_15C].x; - this->dyna.actor.world.pos.z = this->unk_164[this->unk_15C].z; - this->dyna.actor.shape.rot.y = func_80B9AF50(this, &sp24); + this->maxPointIndex = path->count - 1; + this->points = Lib_SegmentedToVirtual(path->points); + this->direction = 1; + this->dyna.actor.world.pos.x = this->points[this->curPointIndex].x; + this->dyna.actor.world.pos.z = this->points[this->curPointIndex].z; + this->dyna.actor.shape.rot.y = ObjBoat_GetNextPoint(this, &sp24); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; - this->unk_15D = -this->unk_15D; + this->direction = -this->direction; } } @@ -77,11 +84,11 @@ void ObjBoat_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80B9B124(ObjBoat* this) { - this->unk_160 += 1000; - this->dyna.actor.world.pos.y = Math_SinS(this->unk_160) + this->dyna.actor.home.pos.y; - this->dyna.actor.shape.rot.x = Math_SinS(this->unk_160) * 100.0f; - this->dyna.actor.shape.rot.z = Math_SinS(this->unk_160 * 2) * 50.0f; +void ObjBoat_SetRotations(ObjBoat* this) { + this->angle += 0x3E8; + this->dyna.actor.world.pos.y = Math_SinS(this->angle) + this->dyna.actor.home.pos.y; + this->dyna.actor.shape.rot.x = Math_SinS(this->angle) * 100.0f; + this->dyna.actor.shape.rot.z = Math_SinS(this->angle * 2) * 50.0f; } void ObjBoat_Update(Actor* thisx, PlayState* play) { @@ -89,93 +96,102 @@ void ObjBoat_Update(Actor* thisx, PlayState* play) { ObjBoat* this = THIS; Player* player = GET_PLAYER(play); s32 temp = DynaPolyActor_IsInRidingMovingState(&this->dyna); - f32 sp3C = 0.0f; - s16 sp3A = this->dyna.actor.shape.rot.y; - Vec3f sp2C; + f32 speedTarget = 0.0f; + s16 yawTarget = this->dyna.actor.shape.rot.y; + Vec3f nextPoint; - if ((temp != 0) || ((DynaPolyActor_IsInRidingFallingState(&this->dyna)))) { - if ((this->unk_15F == 0) && (OBJBOAT_GET_4000(thisx) || ((temp != 0) && (this->unk_15C == this->unk_15E)))) { - this->unk_15D = -this->unk_15D; - if (this->unk_15D > 0) { - this->unk_15E = this->unk_163; + if (temp || ((DynaPolyActor_IsInRidingFallingState(&this->dyna)))) { + if ((this->timer == 0) && + (OBJBOAT_GET_4000(thisx) || (temp && (this->curPointIndex == this->lastPointIndex)))) { + this->direction = -this->direction; + if (this->direction > 0) { + this->lastPointIndex = this->maxPointIndex; } else { - this->unk_15E = 0; + this->lastPointIndex = 0; } - this->unk_15F = 60; + this->timer = 60; } - } else if (this->dyna.actor.speedXZ == 0.0f) { - if (this->unk_15F != 0) { - this->unk_15F--; + } else if (this->dyna.actor.speed == 0.0f) { + if (this->timer != 0) { + this->timer--; } } - if (this->unk_15C != this->unk_15E) { - sp3A = func_80B9AF50(this, &sp2C); - if (Math_Vec3f_DistXZ(&this->dyna.actor.world.pos, &sp2C) < 200.0f) { - this->unk_15C += this->unk_15D; - if (this->unk_15C == this->unk_15E) { + + if (this->curPointIndex != this->lastPointIndex) { + yawTarget = ObjBoat_GetNextPoint(this, &nextPoint); + if (Math_Vec3f_DistXZ(&this->dyna.actor.world.pos, &nextPoint) < 200.0f) { + this->curPointIndex += this->direction; + if (this->curPointIndex == this->lastPointIndex) { if (OBJBOAT_GET_4000(thisx)) { - this->unk_15C = 0; - } else if (this->dyna.actor.speedXZ == 0.0f) { - this->unk_15C = 0; - this->unk_15D = -1; + this->curPointIndex = 0; + } else if (this->dyna.actor.speed == 0.0f) { + this->curPointIndex = 0; + this->direction = -1; } } } else { - sp3C = this->unk_15D * (OBJBOAT_GET_4000(thisx) ? 5.0f : 3.0f); + speedTarget = this->direction * (OBJBOAT_GET_4000(thisx) ? 5.0f : 3.0f); } } + if (player->csMode != PLAYER_CSMODE_26) { - Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, sp3A, (s16)(s32)(fabsf(this->dyna.actor.speedXZ) * 40.0f)); + Math_ScaledStepToS(&this->dyna.actor.shape.rot.y, yawTarget, (s32)(fabsf(this->dyna.actor.speed) * 40.0f)); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; - Math_StepToF(&this->dyna.actor.speedXZ, sp3C, 0.05f); + Math_StepToF(&this->dyna.actor.speed, speedTarget, 0.05f); Actor_MoveWithGravity(&this->dyna.actor); - if (this->dyna.actor.speedXZ != 0.0f) { + if (this->dyna.actor.speed != 0.0f) { func_800B9010(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); } } - func_80B9B124(this); + ObjBoat_SetRotations(this); } -void func_80B9B428(Actor* thisx, PlayState* play2) { +// Update used in cutscenes +void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjBoat* this = THIS; if (Cutscene_CheckActorAction(play, 511)) { CsCmdActorAction* actionIndex = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 511)]; - if (this->unk_15F != actionIndex->action) { + if (this->csAction != actionIndex->action) { this->dyna.actor.shape.rot.x = actionIndex->urot.x; + if (actionIndex->action != 1) { Path* path = &play->setupPathList[OBJBOAT_GET_PATH(&this->dyna.actor)]; if (actionIndex->action == 3) { path = &play->setupPathList[path->unk1]; } - this->unk_163 = path->count; - this->unk_164 = Lib_SegmentedToVirtual(path->points); - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->unk_164); - this->dyna.actor.speedXZ = actionIndex->urot.z * (45.0f / 0x2000); - this->unk_164++; - this->unk_15C = 1; + + this->maxPointIndex = path->count; + this->points = Lib_SegmentedToVirtual(path->points); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->points); + this->dyna.actor.speed = actionIndex->urot.z * (45.0f / 0x2000); + this->points++; + this->curPointIndex = 1; } - this->unk_15F = actionIndex->action; + + this->csAction = actionIndex->action; } else { if (actionIndex->action != 1) { - Vec3f vec; - f32 step; + Vec3f posTarget; + f32 distRemaining; - Math_Vec3s_ToVec3f(&vec, this->unk_164); - step = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &vec, this->dyna.actor.speedXZ); - if ((this->unk_15C < this->unk_163) && (step < this->dyna.actor.speedXZ)) { - this->unk_164++; - this->unk_15C++; + Math_Vec3s_ToVec3f(&posTarget, this->points); + distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &posTarget, this->dyna.actor.speed); + if ((this->curPointIndex < this->maxPointIndex) && (distRemaining < this->dyna.actor.speed)) { + this->points++; + this->curPointIndex++; } } + if (actionIndex->action != 3) { - func_80B9B124(this); + ObjBoat_SetRotations(this); if (actionIndex->action == 2) { func_800B9010(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); } } else { + // Tumble in the air this->dyna.actor.shape.rot.y += 0x7D0; this->dyna.actor.shape.rot.x += 0x3E8; this->dyna.actor.shape.rot.z += 0x1F4; diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h index 795c50689..879e2e50c 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h @@ -10,14 +10,17 @@ struct ObjBoat; typedef struct ObjBoat { /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ u8 unk_15C; - /* 0x15D */ s8 unk_15D; - /* 0x15E */ u8 unk_15E; - /* 0x15F */ u8 unk_15F; - /* 0x160 */ s16 unk_160; + /* 0x15C */ u8 curPointIndex; + /* 0x15D */ s8 direction; // To follow the path + /* 0x15E */ u8 lastPointIndex; // max point if direction is negative, first point if forwards + /* 0x15F */ union { + u8 timer; + u8 csAction; + }; + /* 0x160 */ s16 angle; // Angle used to set rotations /* 0x162 */ UNK_TYPE1 pad_162; - /* 0x163 */ u8 unk_163; - /* 0x164 */ Vec3s* unk_164; + /* 0x163 */ u8 maxPointIndex; // point at the other end from 0 + /* 0x164 */ Vec3s* points; } ObjBoat; // size = 0x168 #endif // Z_OBJ_BOAT_H diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index cfecbdad0..e5e53000a 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -1,13 +1,4 @@ -/* - * File: z_obj_boyo.c - * Overlay: ovl_Obj_Boyo - * Description: Unused Bumper - */ - #include "z_obj_boyo.h" -#include "overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h" -#include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#include "objects/object_boyo/object_boyo.h" #define FLAGS (ACTOR_FLAG_10) @@ -18,7 +9,8 @@ void ObjBoyo_Destroy(Actor* thisx, PlayState* play2); void ObjBoyo_Update(Actor* thisx, PlayState* play2); void ObjBoyo_Draw(Actor* thisx, PlayState* play); -ActorInit Obj_Boyo_InitVars = { +/* +const ActorInit Obj_Boyo_InitVars = { ACTOR_OBJ_BOYO, ACTORCAT_PROP, FLAGS, @@ -27,158 +19,22 @@ ActorInit Obj_Boyo_InitVars = { (ActorFunc)ObjBoyo_Init, (ActorFunc)ObjBoyo_Destroy, (ActorFunc)ObjBoyo_Update, - (ActorFunc)ObjBoyo_Draw, + (ActorFunc)ObjBoyo_Draw }; +*/ -static ColliderCylinderInit sCylinderInit = { - { - COLTYPE_NONE, - AT_NONE, - AC_ON | AC_HARD | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x01CBFFBE, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, - OCELEM_ON, - }, - { 60, 140, 0, { 0, 0, 0 } }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Init.s") -static InitChainEntry sInitChain[] = { - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Destroy.s") -void ObjBoyo_Init(Actor* thisx, PlayState* play) { - ObjBoyo* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DC0.s") - Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->unk_190 = Lib_SegmentedToVirtual(object_boyo_Matanimheader_000E88); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DE0.s") -void ObjBoyo_Destroy(Actor* thisx, PlayState* play2) { - PlayState* play = play2; - ObjBoyo* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E14.s") - Collider_DestroyCylinder(play, &this->collider); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E24.s") -void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, Player* target) { - target->unk_B80 = 30.0f; - target->unk_B84 = this->actor.yawTowardsPlayer; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Update.s") -void ObjBoyo_UpdatePirateBumpValues(ObjBoyo* src, EnKaizoku* target) { - target->unk_2F0 = 30.0f; - target->unk_2F4 = Actor_YawBetweenActors(&src->actor, &target->picto.actor); -} - -void ObjBoyo_UpdateBombBumpValues(ObjBoyo* src, EnBom* target) { - target->timer = 0; -} - -BumperCollideInfo sBumperCollideInfo[] = { - { ACTOR_PLAYER, (BumperCollideActorFunc)ObjBoyo_UpdatePlayerBumpValues }, - { ACTOR_EN_KAIZOKU, (BumperCollideActorFunc)ObjBoyo_UpdatePirateBumpValues }, - { ACTOR_EN_BOM, (BumperCollideActorFunc)ObjBoyo_UpdateBombBumpValues }, -}; - -Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, PlayState* play, s32* num) { - Actor* collideActor; - BumperCollideInfo* collideInfo; - s32 i; - - if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - *num = 0; - return &GET_PLAYER(play)->actor; - } - - if (this->collider.base.ocFlags1 & OC2_UNK1) { - for (collideActor = this->collider.base.oc, collideInfo = &sBumperCollideInfo[1], i = 1; i < 3; - collideInfo++, i++) { - if (collideInfo->id == collideActor->id) { - *num = i; - return collideActor; - } - } - } - - return NULL; -} - -void ObjBoyo_Update(Actor* thisx, PlayState* play2) { - PlayState* play = play2; - ObjBoyo* this = THIS; - Actor* target; - s32 num; - - target = ObjBoyo_GetCollidedActor(this, play, &num); - - if (target != NULL) { - sBumperCollideInfo[num].actorCollideFunc(this, (void*)target); - this->unk_194 = 100; - this->unk_196 = 3; - this->unk_198 = 0.01f; - this->unk_19C = this->unk_1A0 = 0.03f; - this->unk_1A4 = 0x3F40; - this->unk_1A6 = 2000; - this->unk_1A8 = 0; - this->unk_1AA = 0x2DF7; - this->unk_1AC = 600; - } - - if (this->unk_194 > 0) { - this->unk_194 -= this->unk_196; - this->unk_1AA += this->unk_1AC; - this->unk_1A8 += this->unk_1AA; - - this->actor.scale.x = this->actor.scale.z = - (Math_CosS(this->unk_1A8 + this->unk_1A4) * this->unk_194 * this->unk_19C * this->unk_198) + 0.1f; - this->actor.scale.y = - (Math_CosS(this->unk_1A8 + this->unk_1A6) * this->unk_194 * this->unk_1A0 * this->unk_198) + 0.1f; - } else { - Actor_SetScale(&this->actor, 0.1f); - - if (this->collider.base.acFlags & AC_HIT) { - this->unk_194 = 30; - this->unk_196 = 2; - this->unk_198 = 0.033333335f; - this->unk_19C = 0.012f; - this->unk_1A0 = 0.006f; - this->unk_1A4 = 0x3F40; - this->unk_1A6 = 2000; - this->unk_1A8 = 0; - this->unk_1AA = 15000; - this->unk_1AC = 1600; - } - } - - this->collider.base.acFlags &= ~AC_HIT; - this->collider.base.ocFlags1 &= ~OC1_HIT; - this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - - if (thisx->xzDistToPlayer < 2000.0f) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } -} - -void ObjBoyo_Draw(Actor* thisx, PlayState* play) { - ObjBoyo* this = THIS; - - AnimatedMat_Draw(play, this->unk_190); - Gfx_DrawDListOpa(play, object_boyo_DL_000300); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Draw.s") diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h index dcff2a893..feb95dcd1 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h @@ -5,27 +5,9 @@ struct ObjBoyo; -typedef void (*BumperCollideActorFunc)(struct ObjBoyo*, void*); - -typedef struct { - /* 0x0 */ s16 id; - /* 0x4 */ BumperCollideActorFunc actorCollideFunc; -} BumperCollideInfo; // size = 0x8 - typedef struct ObjBoyo { /* 0x000 */ Actor actor; - /* 0x144 */ ColliderCylinder collider; - /* 0x190 */ AnimatedMaterial* unk_190; - /* 0x194 */ s16 unk_194; - /* 0x196 */ s16 unk_196; - /* 0x198 */ f32 unk_198; - /* 0x19C */ f32 unk_19C; - /* 0x1A0 */ f32 unk_1A0; - /* 0x1A4 */ s16 unk_1A4; - /* 0x1A6 */ s16 unk_1A6; - /* 0x1A8 */ s16 unk_1A8; - /* 0x1AA */ s16 unk_1AA; - /* 0x1AC */ s16 unk_1AC; + /* 0x144 */ char unk_144[0x6C]; } ObjBoyo; // size = 0x1B0 #endif // Z_OBJ_BOYO_H diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 27f5cc273..dd9f84ae0 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -150,7 +150,7 @@ void ObjChan_CalculatePotPosition(Vec3f* childPosOut, Vec3s* childRotOut, Vec3f* childRotOut->y += childAngle; } -//! @TODO: Possibly takes actor and recasts +//! TODO: Possibly takes actor and recasts void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { ObjChan* this = this2; s32 i; @@ -176,9 +176,10 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { for (i = 0; i < 5; i++) { ObjChan_CalculatePotPosition(&childPos, &childRot, &this->actor.world.pos, &this->actor.shape.rot, (s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation); - temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene( - &play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, - childRot.z, (this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene, this->actor.unk20, &this->actor); + temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y, + childPos.z, childRot.x, childRot.y, childRot.z, + (this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene, + this->actor.halfDaysBits, &this->actor); if (temp_v0 != NULL) { this->pots[i] = temp_v0; temp_v0->myPotIndex = i; @@ -209,7 +210,7 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { this->actionFunc = ObjChan_ChandelierAction; } -//! @TODO: More descriptive name than Action? +//! TODO: More descriptive name than Action? void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { ObjChan* this = this2; ObjChan* temp; @@ -314,7 +315,7 @@ void ObjChan_PotAction(ObjChan* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_37_10); Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000, - this->actor.cutscene, this->actor.unk20, NULL); + this->actor.cutscene, this->actor.halfDaysBits, NULL); } } Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index b03344708..f37a15a80 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -303,10 +303,10 @@ void func_8098D99C(ObjComb* this, PlayState* play) { temp_v0->parent = &this->actor; if (this->actionFunc == func_8098DC60) { temp_v0->velocity.y = 8.0f; - temp_v0->speedXZ = 2.0f; + temp_v0->speed = 2.0f; } else { temp_v0->velocity.y = 10.0f; - temp_v0->speedXZ = 2.0f; + temp_v0->speed = 2.0f; } this->unk_1B6 = 1; play_sound(NA_SE_SY_TRE_BOX_APPEAR); @@ -406,7 +406,7 @@ void func_8098DC60(ObjComb* this, PlayState* play) { } else { if (this->unk_1B8 >= 0) { if (this->unk_1B8 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->unk_1B8 = Rand_S16Offset(40, 80); } else { @@ -431,15 +431,15 @@ void func_8098DE58(ObjComb* this) { this->unk_1B4 = 100; this->actor.terminalVelocity = -20.0f; this->actor.gravity = -1.5f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_8098DEA0; } void func_8098DEA0(ObjComb* this, PlayState* play) { this->unk_1B4--; - if ((this->actor.bgCheckFlags & 1) || (this->unk_1B4 <= 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->unk_1B4 <= 0)) { func_8098DA74(this, play); - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 30.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 30.0f)) { func_8098D47C(this, play); } else { func_8098D19C(this, play); @@ -447,11 +447,11 @@ void func_8098DEA0(ObjComb* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_HONEYCOMB_BROKEN); func_8098E098(this); } else { - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { func_8098D6E0(this, play); } - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->actor.gravity = -0.5f; this->actor.velocity.y *= 0.8f; this->unk_1AE >>= 1; diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index 9daa20bad..1a9f62ede 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -107,15 +107,15 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { step = this->speed * 0.16f; } - Math_StepToF(&thisx->speedXZ, target, step); - if ((thisx->speedXZ + 0.05f) < speed) { - Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / speed); + Math_StepToF(&thisx->speed, target, step); + if ((thisx->speed + 0.05f) < speed) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speed / speed); thisx->world.pos.x += thisx->velocity.x; thisx->world.pos.y += thisx->velocity.y; thisx->world.pos.z += thisx->velocity.z; } else { this->curPoint += this->direction; - thisx->speedXZ *= 0.4f; + thisx->speed *= 0.4f; isTeleporting = OBJDANPEILIFT_SHOULD_TELEPORT(thisx); isPosUpdated = true; if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || @@ -154,7 +154,7 @@ void ObjDanpeilift_Wait(ObjDanpeilift* this, PlayState* play) { this->waitTimer--; if (this->waitTimer <= 0) { this->actionFunc = ObjDanpeilift_Move; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } } diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 060e793ca..8af30b3fd 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -1,7 +1,7 @@ /* * File: z_obj_demo.c * Overlay: ovl_Obj_Demo - * Description: + * Description: Cutscene triggers when player is in range */ #include "z_obj_demo.h" @@ -60,8 +60,8 @@ void ObjDemo_Init(Actor* thisx, PlayState* play) { } void func_80983634(PlayState* play) { - if ((play->sceneId == SCENE_CASTLE) && (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { - Audio_QueueSeqCmd(0x100100FF); + if ((play->sceneId == SCENE_CASTLE) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } } @@ -89,7 +89,7 @@ void func_80983704(ObjDemo* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } if (play->sceneId == SCENE_CASTLE) { - Audio_QueueSeqCmd(NA_BGM_IKANA_CASTLE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_IKANA_CASTLE | SEQ_FLAG_ASYNC); } this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); if (this->actor.cutscene == -1) { diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index fce6d99ec..4a0c5194f 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -436,7 +436,7 @@ void func_80B13940(ObjDhouse* this, PlayState* play2) { if (Flags_GetSwitch(play, OBJDHOUSE_GET_7F(&this->dyna.actor))) { sp20 = true; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_EXPLSION_LONG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EXPLSION_LONG); } if (sp20) { diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c index 9b6c81266..bdff9b3bc 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -274,10 +274,10 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { case DORA_DMGEFF_STRONG: case DORA_DMGEFF_LIGHT: if (this->actor.colChkInfo.damageEffect == DORA_DMGEFF_LIGHT) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DORA_S); + Actor_PlaySfx(&this->actor, NA_SE_EV_DORA_S); this->lastGongHitType = DORA_HIT_LIGHT; } else { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_DORA_L); + Actor_PlaySfx(&this->actor, NA_SE_EV_DORA_L); this->lastGongHitType = DORA_HIT_STRONG; } @@ -285,7 +285,7 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { ObjDora_SetupMoveGong(this); if ((ObjDora_IsHalfHour(time) == true) && (this->rupeeDropTimer == 0)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); + Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); itemDrop = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); itemDrop->world.rot.y = this->actor.world.rot.y; itemDrop->world.rot.y += (s32)(Rand_Centered() * 90.0f * (0x10000 / 360.0f)); @@ -332,20 +332,20 @@ void ObjDora_Draw(Actor* thisx, PlayState* play) { Matrix_Push(); Matrix_RotateXS(this->gongRotation.x, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL); + gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); Matrix_Translate(position.x, position.y + gongForceX, position.z + gongForceX, MTXMODE_APPLY); Matrix_RotateXS(this->gongRotation.z - this->gongRotation.x, MTXMODE_APPLY); Matrix_Translate(-position.x, -position.y, -position.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); + gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL); Matrix_Pop(); } else { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); gSPDisplayList(POLY_OPA_DISP++, &gDoraGongDL); + gSPDisplayList(POLY_OPA_DISP++, &gDoraChainDL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c index 01675c173..f1dc17968 100644 --- a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c +++ b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c @@ -65,6 +65,6 @@ void ObjDowsing_Update(Actor* thisx, PlayState* play) { ObjDowsing* this = THIS; if (!ObjDowsing_CheckValidSpawn(this, play)) { - func_800B8C50(thisx, play); + Actor_SetClosestSecretDistance(thisx, play); } } diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c index f0eaaf25a..a93ab99bf 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c @@ -358,10 +358,10 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { phi_f12 = this->unk_23C * 0.13f; } - Math_StepToF(&this->dyna.actor.speedXZ, phi_f0, phi_f12); + Math_StepToF(&this->dyna.actor.speed, phi_f0, phi_f12); - if ((this->dyna.actor.speedXZ + 0.05f) < sp3C) { - Math_Vec3f_Scale(&this->dyna.actor.velocity, this->dyna.actor.speedXZ / sp3C); + if ((this->dyna.actor.speed + 0.05f) < sp3C) { + Math_Vec3f_Scale(&this->dyna.actor.velocity, this->dyna.actor.speed / sp3C); this->dyna.actor.world.pos.x += this->dyna.actor.velocity.x; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; this->dyna.actor.world.pos.z += this->dyna.actor.velocity.z; @@ -371,7 +371,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { if (1) {} - this->dyna.actor.speedXZ *= 0.5f; + this->dyna.actor.speed *= 0.5f; if (((this->unk_164 >= this->unk_160) && (this->unk_168 > 0)) || ((this->unk_164 <= 0) && (this->unk_168 < 0))) { if (!OBJDRIFTICE_GET_1000(&this->dyna.actor)) { @@ -421,7 +421,7 @@ void func_80A674A8(ObjDriftice* this) { void func_80A674C4(ObjDriftice* this, PlayState* play) { this->unk_24C--; if (this->unk_24C <= 0) { - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; func_80A671CC(this); } } diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h index 21e0f8f27..19627c3df 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h @@ -56,6 +56,4 @@ typedef struct ObjDriftice { /* 0x24C */ s32 unk_24C; } ObjDriftice; // size = 0x250 -extern ActorInit Obj_Driftice_InitVars; - #endif // Z_OBJ_DRIFTICE_H diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index ceedeb6c4..69829d09e 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -159,7 +159,7 @@ void ObjEtcetera_Idle(ObjEtcetera* this, PlayState* play) { // Player is walking onto the Deku Flower, or falling on it from a height this->oscillationTimer = 10; ObjEtcetera_StartRustleAnimation(this); - } else if ((player->actor.speedXZ > 0.1f) || + } else if ((player->actor.speed > 0.1f) || ((player->unk_ABC < 0.0f) && !(player->stateFlags3 & PLAYER_STATE3_100))) { // Player is walking on top of the Deku Flower, is at the very start of burrowing, or is at the very // start of launching diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index 49e8ac934..a5c66629a 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -4,6 +4,7 @@ * Description: Breakable Pot With Grass */ +#include "prevent_bss_reordering.h" #include "z_obj_flowerpot.h" #include "objects/object_flowerpot/object_flowerpot.h" @@ -454,8 +455,8 @@ void func_80A1C838(ObjFlowerpot* this, PlayState* play) { //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the collider - func_800B8E58((Player*)this, NA_SE_PL_PULL_UP_POT); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { + Player_PlaySfx((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 19.0f)) { if (!(this->unk_1EA & 2)) { func_80A1B914(this, play); func_80A1C328(this, play); @@ -490,7 +491,7 @@ void func_80A1C838(ObjFlowerpot* this, PlayState* play) { if (this->unk_1EA & 1) { Actor_MoveWithGravity(&this->actor); func_80A1C5E8(this, play); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.colChkInfo.mass == MASS_IMMOVABLE) { if (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL) { this->actor.flags &= ~ACTOR_FLAG_10; @@ -518,7 +519,7 @@ void func_80A1C838(ObjFlowerpot* this, PlayState* play) { s16 temp_v0_3 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; if (ABS_ALT(temp_v0_3) >= 0x5556) { - Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -537,9 +538,9 @@ void func_80A1CC0C(ObjFlowerpot* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; - if (fabsf(this->actor.speedXZ) < 0.1f) { + if (fabsf(this->actor.speed) < 0.1f) { func_80A1C818(this); - func_800B8E58(GET_PLAYER(play), NA_SE_PL_PUT_DOWN_POT); + Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_PUT_DOWN_POT); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } else { Actor_MoveWithGravity(&this->actor); @@ -601,7 +602,8 @@ void func_80A1CEF4(ObjFlowerpot* this2, PlayState* play) { func_80A1C62C(this, play); - if ((this->actor.bgCheckFlags & (0x8 | 0x2 | 0x1)) || sp28 || (this->unk_1E8 <= 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || sp28 || + (this->unk_1E8 <= 0)) { if (!(this->unk_1EA & 2)) { func_80A1B914(this, play); func_80A1C0FC(this, play); @@ -614,7 +616,7 @@ void func_80A1CEF4(ObjFlowerpot* this2, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { if (!(this->unk_1EA & 2)) { func_80A1B914(this, play); func_80A1C328(this, play); @@ -653,7 +655,7 @@ void ObjFlowerpot_Update(Actor* thisx, PlayState* play2) { func_80A1C554(this); - if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { + if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0)) { func_80A1B3D0(); D_80A1D830 = play->gameplayFrames; } @@ -678,7 +680,7 @@ void ObjFlowerpot_Draw(Actor* thisx, PlayState* play) { } if (!(this->unk_1EA & 2)) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && (this->actionFunc == func_80A1C838)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A1B840(&D_80A1D838[this->unk_1EB]); diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 0581706d5..e7ddf5038 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -61,10 +61,10 @@ void func_80B3C2B0(ObjGhaka* this) { void func_80B3C2C4(ObjGhaka* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 0, - this->dyna.actor.cutscene, this->dyna.actor.unk20, 0); + this->dyna.actor.cutscene, this->dyna.actor.halfDaysBits, 0); } else { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 1, -1, - this->dyna.actor.unk20, 0); + this->dyna.actor.halfDaysBits, 0); } } diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c index 501fb2ee4..b1924c63b 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -4,11 +4,9 @@ * Description: "Master" instance of grass for unit spawned by Obj_Grass_Unit */ -#include "prevent_bss_reordering.h" #include "z_obj_grass.h" #include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "prevent_bss_reordering.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c index 9872fb0b7..e649664f3 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c @@ -227,11 +227,11 @@ void func_809AB4A8(ObjGrassCarry* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_194->unk_00); this->actor.shape.rot.y = this->actor.world.rot.y = this->unk_194->unk_0C; this->unk_198 = this2->unk_194->unk_0E; - this->actor.xzDistToPlayer = Actor_XZDistanceBetweenActors(&this->actor, &player->actor); + this->actor.xzDistToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor); this->actor.playerHeightRel = Actor_HeightDiff(&this->actor, &player->actor); this->actor.xyzDistToPlayerSq = SQ(this->actor.xzDistToPlayer) + SQ(this->actor.playerHeightRel); - this->actor.yawTowardsPlayer = Actor_YawBetweenActors(&this->actor, &player->actor); - Actor_LiftActor(&this->actor, play); + this->actor.yawTowardsPlayer = Actor_WorldYawTowardActor(&this->actor, &player->actor); + Actor_OfferCarry(&this->actor, play); } } @@ -246,8 +246,8 @@ void func_809AB610(ObjGrassCarry* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { func_809AB6FC(this); - this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; - this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; + this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed; + this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed; this->actor.gravity = -0.1f; this->actor.terminalVelocity = -17.0f; func_809AAF18(this); @@ -283,7 +283,8 @@ void func_809AB77C(ObjGrassCarry* this, PlayState* play) { this->unk_19A--; - if ((this->actor.bgCheckFlags & (1 | 2 | 8)) || temp_v0 || (this->unk_19A <= 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || temp_v0 || + (this->unk_19A <= 0)) { func_809AAFE8(&this->actor.world.pos, play); func_809AAF9C(&this->actor.world.pos, this->unk_198, play); @@ -294,14 +295,14 @@ void func_809AB77C(ObjGrassCarry* this, PlayState* play) { this->actor.room = this->unk_190->actor.room; } - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } func_809AB428(this); return; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { sp5C.y = this->actor.world.pos.y + this->actor.depthInWater; for (phi_s0 = 0, i = 0; i < 4; i++, phi_s0 += 0x4000) { @@ -326,7 +327,7 @@ void func_809AB77C(ObjGrassCarry* this, PlayState* play) { D_809ABBFC = D_809ABBFC >> 1; D_809ABC08 = D_809ABC08 >> 1; D_809ABC04 = D_809ABC04 >> 1; - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index 9c38849c9..dcd1dad4e 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -207,9 +207,9 @@ void func_80B1456C(ObjHakaisi* this, PlayState* play) { void func_80B145F4(ObjHakaisi* this) { this->unk_19A = 0; - this->dyna.actor.flags |= ACTOR_FLAG_8000000; + this->dyna.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->dyna.actor.flags &= ~ACTOR_FLAG_1; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); this->actionFunc = func_80B14648; } @@ -281,7 +281,7 @@ void func_80B14B6C(ObjHakaisi* this, PlayState* play, Vec3f vec, s16 arg3) { s16 temp_s1; Vec3f sp6C; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); for (i = 0; i < 5; i++) { temp_s1 = Rand_Next(); @@ -403,7 +403,7 @@ void func_80B15330(ObjHakaisi* this, PlayState* play) { this->dyna.actor.velocity.y += this->dyna.actor.gravity; Actor_UpdatePos(&this->dyna.actor); - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { func_80B14B6C(this, play, this->dyna.actor.world.pos, 40); func_80B14CF8(play, this->dyna.actor.world.pos, 100, 30, 10); Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index e3972be18..fa39be7df 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -134,7 +134,7 @@ void ObjHgdoor_HandleCsAction(ObjHgdoor* this, PlayState* play) { this->csAction = play->csCtx.actorActions[actionIndex]->action; switch (play->csCtx.actorActions[actionIndex]->action) { case 1: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY); if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.parent->id == ACTOR_EN_HG)) { this->dyna.actor.parent->colChkInfo.health = 1; } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 13f49fd1f..dc95eec27 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -274,7 +274,7 @@ void func_80931E58(ObjIcePoly* this, PlayState* play) { } this->unk_14A = 40; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ICE_MELT); + Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_MELT); this->actionFunc = func_80931EEC; } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 8c88c35ee..85b23d232 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -206,10 +206,10 @@ s32 func_80A236D4(ObjIceblock* this, Vec3f* arg1) { s32 sp20; sp26 = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, arg1); - sp2C = Math_SinS(sp26) * this->dyna.actor.speedXZ; + sp2C = Math_SinS(sp26) * this->dyna.actor.speed; sp2C = fabsf(sp2C) + 0.01f; - sp28 = Math_CosS(sp26) * this->dyna.actor.speedXZ; + sp28 = Math_CosS(sp26) * this->dyna.actor.speed; sp28 = fabsf(sp28) + 0.01f; sp20 = Math_StepToF(&this->dyna.actor.world.pos.x, arg1->x, sp2C); @@ -892,7 +892,7 @@ void func_80A25440(ObjIceblock* this) { } static InitChainEntry sInitChain[] = { - ICHAIN_F32_DIV1000(speedXZ, 16000, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(speed, 16000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -1800, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(terminalVelocity, -26000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), @@ -1096,13 +1096,13 @@ void func_80A25BBC(ObjIceblock* this, PlayState* play) { func_80A23690(this); if (func_80A23F90(this, play)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } if (func_80A24954(this, play)) { func_80A2491C(this); if (this->unk_2B0 == 3) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DIVE_INTO_WATER_L); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DIVE_INTO_WATER_L); } } } @@ -1175,7 +1175,7 @@ void func_80A25E50(ObjIceblock* this, PlayState* play) { func_80A25BA0(this); } else if (sp38) { if (func_80A24118(this, play, 59.9f, &sp28)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } func_80A2541C(this, play); func_80A25CF4(this); @@ -1262,7 +1262,7 @@ void func_80A26144(ObjIceblock* this, PlayState* play) { func_80A23B88(this); func_80A25BA0(this); } else if (sp28) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80A23B88(this); func_80A25FA0(this); } else { diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c index 3942fff76..4d5845d45 100644 --- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c +++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c @@ -382,7 +382,7 @@ void ObjKendoKanban_HandlePhysics(ObjKendoKanban* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { // When on the ground, apply some friction. this->actor.velocity.x *= 0.8f; this->actor.velocity.z *= 0.8f; @@ -401,18 +401,18 @@ void ObjKendoKanban_HandlePhysics(ObjKendoKanban* this, PlayState* play) { return; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { // Upon touching the ground... - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); this->hasNewRootCornerPos = false; this->actor.velocity.y *= 0.5f; - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { // When on the ground... this->numBounces++; this->hasNewRootCornerPos = false; this->actor.velocity.x *= 0.3f; this->actor.velocity.z *= 0.3f; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); // Adjust and (potentially) reverse rotation depending on the current // facing of the board and the direction in which it is rotating. diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 36927b262..8dbff17b2 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -121,7 +121,7 @@ void func_80926318(ObjKibako* this, PlayState* play) { if (this->actor.xzDistToPlayer < 100.0f) { angle = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; if (ABS_ALT(angle) > 0x5555) { - Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -278,8 +278,8 @@ void ObjKibako_Idle(ObjKibako* this, PlayState* play) { //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the collider - func_800B8E58((Player*)this, NA_SE_PL_PULL_UP_WOODBOX); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { + Player_PlaySfx((Player*)&this->actor, NA_SE_PL_PULL_UP_WOODBOX); + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 19.0f)) { ObjKibako_WaterBreak(this, play); ObjKibako_SpawnCollectible(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); @@ -340,10 +340,10 @@ void ObjKibako_Held(ObjKibako* this, PlayState* play) { func_80926394(this, play); if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; - if (fabsf(this->actor.speedXZ) < 0.1f) { + if (fabsf(this->actor.speed) < 0.1f) { ObjKibako_SetupIdle(this); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); + Actor_PlaySfx(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); } else { Actor_MoveWithGravity(&this->actor); ObjKibako_SetupThrown(this); @@ -384,13 +384,14 @@ void ObjKibako_Thrown(ObjKibako* this, PlayState* play) { if (this->timer > 0) { this->timer--; } - if ((this->actor.bgCheckFlags & 0xB) || (atHit) || (this->timer <= 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || atHit || + (this->timer <= 0)) { ObjKibako_AirBreak(this, play); ObjKibako_SpawnCollectible(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); Actor_Kill(&this->actor); } else { - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { ObjKibako_WaterBreak(this, play); ObjKibako_SpawnCollectible(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 06af2a8e3..e9ca6aba8 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -128,7 +128,7 @@ void ObjKibako2_SpawnSkulltula(ObjKibako2* this, PlayState* play) { if (skulltula != NULL) { skulltula->parent = &this->dyna.actor; skulltula->velocity.y = 13.0f; - skulltula->speedXZ = 0.0f; + skulltula->speed = 0.0f; } } } @@ -233,7 +233,7 @@ void ObjKibako2_Update(Actor* thisx, PlayState* play) { if (this->skulltulaNoiseTimer >= 0) { if (this->skulltulaNoiseTimer == 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->skulltulaNoiseTimer = Rand_S16Offset(40, 80); } else { diff --git a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c index 9c9215b24..b52a66d84 100644 --- a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c +++ b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c @@ -52,10 +52,10 @@ void ObjKinoko_Update(Actor* thisx, PlayState* play) { Actor_Kill(thisx); return; } - Actor_PickUp(thisx, play, GI_MAX, 20.0f, 10.0f); - if (Math_SmoothStepToF(&thisx->speedXZ, 0.0f, 0.04f, 2.0f, 0.5f) < 0.5f) { + Actor_OfferGetItem(thisx, play, GI_MAX, 20.0f, 10.0f); + if (Math_SmoothStepToF(&thisx->speed, 0.0f, 0.04f, 2.0f, 0.5f) < 0.5f) { thisx->scale.x = 0.0f; - thisx->speedXZ = 110.0f; + thisx->speed = 110.0f; thisx->velocity.x = 0.2f; } if (Math_SmoothStepToF(&thisx->scale.x, thisx->velocity.x, 0.04f, 0.004f, 0.001f) < @@ -76,7 +76,7 @@ void ObjKinoko_Draw(Actor* thisx, PlayState* play) { func_8012C2DC(play->state.gfxCtx); gfx = POLY_XLU_DISP; - gDPSetPrimColor(&gfx[0], 0, 0, 169, 63, 186, (u8)thisx->speedXZ); + gDPSetPrimColor(&gfx[0], 0, 0, 169, 63, 186, (u8)thisx->speed); gDPSetEnvColor(&gfx[1], 110, 44, 200, 100); gDPSetRenderMode(&gfx[2], G_RM_PASS, G_RM_ZB_CLD_SURF2); gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index f2946d536..4518e4e29 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -231,7 +231,7 @@ void ObjLightSwitch_SetupAsleep(ObjLightswitch* this) { void ObjLightSwitch_Asleep(ObjLightswitch* this, PlayState* play) { if (this->colorShiftTimer == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SUN_MARK_FLASH); + Actor_PlaySfx(&this->actor, NA_SE_EV_SUN_MARK_FLASH); } this->colorShiftTimer++; @@ -244,7 +244,7 @@ void ObjLightSwitch_Asleep(ObjLightswitch* this, PlayState* play) { ObjLightSwitch_SetupEnabled(this); } else if (this->colorShiftTimer == 15) { this->faceState = LIGHTSWITCH_FACE_WAKING; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FOOT_SWITCH); + Actor_PlaySfx(&this->actor, NA_SE_EV_FOOT_SWITCH); } } @@ -302,7 +302,7 @@ void ObjLightSwitch_Disabled(ObjLightswitch* this, PlayState* play) { ObjLightswitch_SetupIdle(this); } else if (this->colorShiftTimer == 15) { this->faceState = LIGHTSWITCH_FACE_ASLEEP; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FOOT_SWITCH); + Actor_PlaySfx(&this->actor, NA_SE_EV_FOOT_SWITCH); } } diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index 6620c5116..7be450b3b 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -131,21 +131,21 @@ void func_80AF04D8(ObjLupygamelift* this, PlayState* play) { void func_80AF0514(ObjLupygamelift* this) { this->actionFunc = func_80AF0530; - this->dyna.actor.speedXZ = this->targetSpeedXZ; + this->dyna.actor.speed = this->targetSpeedXZ; } void func_80AF0530(ObjLupygamelift* this, PlayState* play) { - f32 step; + f32 distRemaining; Vec3f target; target.x = this->points[this->pointIndex].x; target.y = this->points[this->pointIndex].y; target.z = this->points[this->pointIndex].z; - step = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &target, this->dyna.actor.speedXZ); - if (step > 30.0f) { - Math_SmoothStepToF(&this->dyna.actor.speedXZ, this->targetSpeedXZ, 0.5f, 5.0f, 0.1f); - } else if (step > 0.0f) { - Math_SmoothStepToF(&this->dyna.actor.speedXZ, 5.0f, 0.5f, 5.0f, 1.0f); + distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &target, this->dyna.actor.speed); + if (distRemaining > 30.0f) { + Math_SmoothStepToF(&this->dyna.actor.speed, this->targetSpeedXZ, 0.5f, 5.0f, 0.1f); + } else if (distRemaining > 0.0f) { + Math_SmoothStepToF(&this->dyna.actor.speed, 5.0f, 0.5f, 5.0f, 1.0f); } else { if (this->pointIndex < (this->count - 1)) { this->pointIndex++; diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index c46821ac1..d544fcbfc 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -95,11 +95,11 @@ void func_8099FB64(Actor* thisx, PlayState* play) { actor->parent = thisx; if (rotCheck) { actor->velocity.y = 10.0f; - actor->speedXZ = 3.0f; + actor->speed = 3.0f; } else { speedXZ = sqrtf((destVec.x * destVec.x) + (destVec.z * destVec.z)); actor->velocity.y = (4 * destVec.y) + 4.0f; - actor->speedXZ = (2 * speedXZ) + 2.0f; + actor->speed = (2 * speedXZ) + 2.0f; } } } @@ -113,7 +113,7 @@ void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { } else { if (this->unk144 >= 0) { if (this->unk144 == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->unk144 = Rand_S16Offset(0x28, 0x50); } else { diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 18c36f87e..e1ee3cee5 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -117,7 +117,7 @@ void func_80C06768(ObjMoonStone* this, PlayState* play) { this->actor.draw = NULL; func_80C0685C(this); } else if (this->actor.xzDistToPlayer < 25.0f) { - Actor_PickUp(&this->actor, play, GI_MOON_TEAR, 100.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_MOON_TEAR, 100.0f, 30.0f); } } } diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 815c15af8..678f76ed0 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -140,7 +140,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { this->children[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.cutscene, - this->actor.unk20, NULL); + this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { if (this->type == 0x90) { ((ObjMureChild*)this->children[i])->unk_197 = 1; @@ -153,7 +153,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { this->children[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.cutscene, - this->actor.unk20, NULL); + this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { this->children[i]->room = this->actor.room; } @@ -175,7 +175,7 @@ void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { &play2->actorCtx, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, (this->type == OBJMURE_TYPE_BUTTERFLY && i == 0) ? 1 : sSpawnParams[this->type], this->actor.cutscene, - this->actor.unk20, NULL); + this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { this->childrenStates[i] = OBJMURE_CHILD_STATE_0; this->children[i]->room = actor->room; diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 933ea06d2..1f42807c2 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -4,6 +4,7 @@ * Description: Sakon's Hideout Objects (Sun's Mask, doors, etc) */ +#include "prevent_bss_reordering.h" #include "z_obj_nozoki.h" #include "objects/object_secom_obj/object_secom_obj.h" @@ -199,7 +200,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) { void func_80BA28DC(ObjNozoki* this, PlayState* play) { if (this->unk_15E != 0) { if (DECR(this->unk_15E) == 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); } return; } @@ -231,7 +232,7 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) { } else if (ActorCutscene_GetCurrentIndex() != this->unk_15F) { this->unk_15F = cs; this->dyna.actor.params &= ~OBJNOZOKI_400; - Audio_QueueSeqCmd(0x881A); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); } return; } @@ -239,7 +240,7 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) { ObjNozoki_SetupAction(this, func_80BA2AB4); this->dyna.actor.velocity.y = 0.0f; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); } void func_80BA2AB4(ObjNozoki* this, PlayState* play) { @@ -314,17 +315,17 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) { Flags_UnsetSwitch(play, this->dyna.actor.world.rot.x); } - Math_StepToF(&this->dyna.actor.speedXZ, D_80BA34E4[this->unk_15D], 0.1f); + Math_StepToF(&this->dyna.actor.speed, D_80BA34E4[this->unk_15D], 0.1f); if ((play->actorCtx.flags & ACTORCTX_FLAG_6) || (play->actorCtx.flags & ACTORCTX_FLAG_5)) { temp_f0 = 0.5f; } else { - temp_f0 = this->dyna.actor.speedXZ; + temp_f0 = this->dyna.actor.speed; } sp34 = Math_Vec3f_StepToXZ(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos, temp_f0); - D_80BA36B8 += this->dyna.actor.speedXZ; + D_80BA36B8 += this->dyna.actor.speed; if (play->actorCtx.flags & ACTORCTX_FLAG_6) { if (sp34 <= 5.0f) { @@ -355,14 +356,14 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) { } } - this->dyna.actor.velocity.x += this->dyna.actor.speedXZ * 0.66f; + this->dyna.actor.velocity.x += this->dyna.actor.speed * 0.66f; if (this->dyna.actor.velocity.x >= 0x10000) { this->dyna.actor.velocity.x -= 0x10000; } play->roomCtx.unk7A[0] = this->dyna.actor.velocity.x; - func_8019FAD8(&gSfxDefaultPos, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speedXZ); + func_8019FAD8(&gSfxDefaultPos, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speed); } void func_80BA3044(ObjNozoki* this, PlayState* play) { @@ -393,10 +394,10 @@ void func_80BA311C(ObjNozoki* this, PlayState* play) { } else if (this->unk_15D == 1) { if (D_80BA36B8 > 40.0f) { this->unk_15D = 2; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_PL_SIT_ON_HORSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_PL_SIT_ON_HORSE); } else if (this->unk_15E != 0) { if (DECR(this->unk_15E) == 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CONVEYOR_SHUTTER_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CONVEYOR_SHUTTER_OPEN); } } else { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 50.0f, 4.0f); diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 3a25ef402..ab60ec034 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -99,7 +99,7 @@ void func_80AC96A4(ObjOcarinalift* this, PlayState* play) { void func_80AC96B4(ObjOcarinalift* this) { this->actionFunc = func_80AC96D0; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { @@ -125,9 +125,9 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { phi_fa0 = this->unk160 * 0.16f; } - Math_StepToF(&thisx->speedXZ, phi_fv0, phi_fa0); - if ((thisx->speedXZ + 0.05f) < magnitude) { - Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / magnitude); + Math_StepToF(&thisx->speed, phi_fv0, phi_fa0); + if ((thisx->speed + 0.05f) < magnitude) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speed / magnitude); thisx->world.pos.x += thisx->velocity.x; thisx->world.pos.y += thisx->velocity.y; thisx->world.pos.z += thisx->velocity.z; @@ -135,7 +135,7 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { paramsC = OBJOCARINALIFT_GET_C(thisx); sp34 = true; this->unk168 += this->unk16C; - thisx->speedXZ *= 0.4f; + thisx->speed *= 0.4f; if (((this->unk168 >= this->unk164) && (this->unk16C > 0)) || ((this->unk168 <= 0) && (this->unk16C < 0))) { if (paramsC == OBJOCARINALIFT_PARAMSC_0) { this->unk16C = -this->unk16C; @@ -197,7 +197,7 @@ void func_80AC9A7C(ObjOcarinalift* this, PlayState* play) { } void func_80AC9AB8(ObjOcarinalift* this) { - this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000); + this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); this->actionFunc = func_80AC9AE0; } @@ -234,7 +234,7 @@ void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { } void func_80AC9C20(ObjOcarinalift* this) { - this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000); + this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON); this->actionFunc = func_80AC9C48; } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 1d7762c44..582d43f02 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -503,7 +503,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { player = GET_PLAYER(play); if (ObjOshihiki_CheckWall(play, this->dyna.yRotation, this->dyna.pushForce, this)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; @@ -521,7 +521,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } void ObjOshihiki_SetupFall(ObjOshihiki* this, PlayState* play) { @@ -553,10 +553,10 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { } else { ObjOshihiki_SetupOnActor(this, play); } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Actor_PlaySfxAtPos(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], - this->floorBgIds[this->highestFloor]) + - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], + this->floorBgIds[this->highestFloor]) + + SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index 3aca23bca..51eadfadc 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -287,14 +287,14 @@ void func_809A3BC0(ObjPzlblock* this, PlayState* play) { if ((params == 4) || (params == 5) || (params == 6)) { if (!func_809A35EC(this, this->unk_16C) || func_809A33E0(this, play, 0x5A)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else if (func_809A35EC(this, this->unk_16C)) { if (func_809A33E0(this, play, 0x5A)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Flags_SetSwitch(play, OBJPZLBLOCK_GET_7F(&this->dyna.actor)); sp20 = 1; } @@ -351,7 +351,8 @@ void func_809A3E58(Actor* thisx, PlayState* play) { if (this->unk_160 != 0) { Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, this->unk_160); if (((this->actionFunc == func_809A3A74) || (this->actionFunc == func_809A3D38)) && - (this->dyna.actor.bgCheckFlags & 1) && !DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId)) { + (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + !DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId)) { this->unk_160 = 0; } } diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index d0a705cf2..0fdf0a86b 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -141,15 +141,15 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { step = this->speed * 0.16f; } - Math_StepToF(&thisx->speedXZ, target, step); - if ((thisx->speedXZ + 0.05f) < speed) { - Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / speed); + Math_StepToF(&thisx->speed, target, step); + if ((thisx->speed + 0.05f) < speed) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speed / speed); thisx->world.pos.x += thisx->velocity.x; thisx->world.pos.y += thisx->velocity.y; thisx->world.pos.z += thisx->velocity.z; } else { this->curPoint += this->direction; - thisx->speedXZ *= 0.4f; + thisx->speed *= 0.4f; isTeleporting = OBJRAILLIFT_SHOULD_TELEPORT(thisx); isPosUpdated = true; if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || @@ -191,13 +191,13 @@ void ObjRaillift_Wait(ObjRaillift* this, PlayState* play) { this->waitTimer--; if (this->waitTimer <= 0) { this->actionFunc = ObjRaillift_Move; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } } void ObjRaillift_Idle(ObjRaillift* this, PlayState* play) { if (Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); this->actionFunc = ObjRaillift_StartCutscene; } diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 6a469eea0..374a2f520 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -563,7 +563,7 @@ void func_80A224A4(ObjSkateblock* this, PlayState* play) { *this->unk_16C += this->unk_164; if (func_80A21934(this, play)) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); func_80A21D1C(this); sp28 = true; } else { diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c index 068be3ea0..b0416cc58 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c @@ -106,7 +106,7 @@ void func_80B02CD0(ObjSnowball* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, - ptr->unk_02, -1, this->actor.unk20, NULL); + ptr->unk_02, -1, this->actor.halfDaysBits, NULL); } void func_80B02D58(ObjSnowball* this, PlayState* play) { @@ -121,10 +121,10 @@ void func_80B02DB0(ObjSnowball* this, PlayState* play) { s32 pad; ObjSnowballStruct2* ptr = &D_80B04F84[this->actor.home.rot.y]; - Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, - this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, - this->actor.params | ptr->unk_02, - ActorCutscene_GetAdditionalCutscene(this->actor.cutscene), this->actor.unk20, NULL); + Actor_SpawnAsChildAndCutscene( + &play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, + this->actor.home.rot.x, 0, this->actor.home.rot.z, this->actor.params | ptr->unk_02, + ActorCutscene_GetAdditionalCutscene(this->actor.cutscene), this->actor.halfDaysBits, NULL); } void func_80B02E54(ObjSnowball* this, PlayState* play) { @@ -132,7 +132,7 @@ void func_80B02E54(ObjSnowball* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, - this->actor.params | ptr->unk_02, -1, this->actor.unk20, NULL); + this->actor.params | ptr->unk_02, -1, this->actor.halfDaysBits, NULL); } void func_80B02EE4(ObjSnowball* this, PlayState* play) { @@ -440,7 +440,7 @@ void func_80B03FF8(ObjSnowball* this, PlayState* play) { sp18->unk_04(this, play); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); + Actor_PlaySfx(&this->actor, NA_SE_EV_SNOWBALL_BROKEN); if (rotY == 5) { Flags_SetSwitch(play, OBJSNOWBALL_GET_3F(&this->actor)); @@ -571,7 +571,7 @@ void func_80B04350(ObjSnowball* this, PlayState* play) { } else { this->unk_209 = 10; } - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_REFLECTION_SNOW); + Actor_PlaySfx(&this->actor, NA_SE_IT_REFLECTION_SNOW); } } diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index d62002e73..f5c39f0b8 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -356,9 +356,9 @@ void func_80B39C9C(ObjSnowball2* this, PlayState* play) { func_80B38E88(this, play); } func_80B38EFC(this, play); - func_800B8E58(GET_PLAYER(play), NA_SE_PL_PULL_UP_SNOWBALL); + Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_PULL_UP_SNOWBALL); func_80B39F60(this); - } else if ((this->actor.bgCheckFlags & 0x20) && + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && ((this->actor.shape.yOffset * this->actor.scale.y) < this->actor.depthInWater)) { func_80B3A498(this); } else if (sp38 && (this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x0583FFBC)) { @@ -375,7 +375,8 @@ void func_80B39C9C(ObjSnowball2* this, PlayState* play) { if (this->unk_1AD == 0) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); - if ((this->actor.bgCheckFlags & 1) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_1AD = 1; this->actor.flags &= ~ACTOR_FLAG_10; } @@ -388,7 +389,7 @@ void func_80B39C9C(ObjSnowball2* this, PlayState* play) { if (this->actor.xzDistToPlayer < 100.0f) { if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, GET_PLAYER(play)->actor.world.rot.y)) >= 0x5556) { - Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -417,7 +418,7 @@ void func_80B39FA8(ObjSnowball2* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; - this->actor.speedXZ *= 3.8f; + this->actor.speed *= 3.8f; this->actor.velocity.y *= 0.4f; this->actor.gravity = -2.8f; Actor_MoveWithGravity(&this->actor); @@ -460,7 +461,9 @@ void func_80B3A13C(ObjSnowball2* this, PlayState* play) { func_80B39B28(this, play); - if ((((this->actor.bgCheckFlags & 9) || sp38) && !(this->actor.bgCheckFlags & 0x20)) || (this->unk_1AC <= 0)) { + if ((((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || sp38) && + !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) || + (this->unk_1AC <= 0)) { func_80B38E88(this, play); func_80B39108(this, play); func_80B39B5C(this, play); @@ -469,14 +472,14 @@ void func_80B3A13C(ObjSnowball2* this, PlayState* play) { } sp30 = false; - if (this->actor.bgCheckFlags & 0x60) { - if ((this->actor.bgCheckFlags & 0x40) || (this->actor.speedXZ > 3.0f)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) || (this->actor.speed > 3.0f)) { if (this->actor.depthInWater < (1200.0f * this->actor.scale.y)) { func_80B39470(&this->actor, play); func_80B395EC(&this->actor, play); } - if (this->actor.bgCheckFlags & 0x40) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); } } else if ((((play->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) && (this->actor.depthInWater < (1200.0f * this->actor.scale.y))) { @@ -488,20 +491,20 @@ void func_80B3A13C(ObjSnowball2* this, PlayState* play) { this->unk_1AA >>= 1; if (sp34) { - this->actor.speedXZ *= 0.8f; + this->actor.speed *= 0.8f; } else { - this->actor.speedXZ *= 0.65f; + this->actor.speed *= 0.65f; } this->actor.velocity.y *= 0.27f; this->actor.gravity *= 0.27f; - if (this->actor.speedXZ < 0.4f) { + if (this->actor.speed < 0.4f) { sp30 = true; } } else { if (sp34) { - this->actor.speedXZ *= 0.8f; + this->actor.speed *= 0.8f; } else { - this->actor.speedXZ *= 0.96f; + this->actor.speed *= 0.96f; } this->actor.velocity.y *= 0.96f; } @@ -527,7 +530,7 @@ void func_80B3A498(ObjSnowball2* this) { this->actor.home.pos.z = this->actor.world.pos.z; this->actor.world.pos.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); this->actor.shape.yOffset = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actionFunc = func_80B3A500; } @@ -539,7 +542,7 @@ void func_80B3A500(ObjSnowball2* this, PlayState* play) { this->unk_1AC--; - this->actor.speedXZ *= 0.7f; + this->actor.speed *= 0.7f; this->unk_1A8 >>= 1; this->unk_1AA >>= 1; diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 4708062da..13e127c73 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -762,7 +762,7 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { if (this->unk_3C7 > 0) { this->unk_3C7--; } else if (this->unk_3C1 > 50) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_EXTINCT); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_EXTINCT); this->unk_3C7 = Rand_S16Offset(2, 2); } else { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 11, NA_SE_EN_EXTINCT); diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 83959e168..4541baa2a 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -149,7 +149,7 @@ void func_80A1DA50(PlayState* play, ObjSpinyroll* this, Vec3f* arg2, Vec3f* arg3 Math_Vec3f_Sum(arg2, arg3, &sp1C); Math_Vec3f_Scale(&sp1C, 0.5f); EffectSsHitmark_SpawnFixedScale(play, 3, &sp1C); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); } void func_80A1DAAC(Vec3f* arg0, Vec3f* arg1, s16 arg2) { @@ -195,10 +195,10 @@ void func_80A1DC5C(ObjSpinyroll* this) { void func_80A1DCCC(ObjSpinyroll* this) { f32 phi_f2; - if (this->dyna.actor.speedXZ > 3.0f) { + if (this->dyna.actor.speed > 3.0f) { phi_f2 = 3.0f; } else { - phi_f2 = this->dyna.actor.speedXZ; + phi_f2 = this->dyna.actor.speed; } if (this->unk_4D4 < phi_f2) { @@ -246,15 +246,15 @@ s32 func_80A1DEB8(ObjSpinyroll* this) { s32 sp30 = this->unk_4A8 ^ 1; Vec3f sp24; - Math_StepToF(&this->dyna.actor.speedXZ, this->unk_4A4, this->unk_4A4 * 0.2f); + Math_StepToF(&this->dyna.actor.speed, this->unk_4A4, this->unk_4A4 * 0.2f); - this->dyna.actor.world.pos.x += this->dyna.actor.speedXZ * this->unk_4C4.x; - this->dyna.actor.world.pos.y += this->dyna.actor.speedXZ * this->unk_4C4.y; - this->dyna.actor.world.pos.z += this->dyna.actor.speedXZ * this->unk_4C4.z; + this->dyna.actor.world.pos.x += this->dyna.actor.speed * this->unk_4C4.x; + this->dyna.actor.world.pos.y += this->dyna.actor.speed * this->unk_4C4.y; + this->dyna.actor.world.pos.z += this->dyna.actor.speed * this->unk_4C4.z; Math_Vec3f_Diff(&this->unk_4AC[sp30], &this->dyna.actor.world.pos, &sp24); - return Math3D_LengthSquared(&sp24) < (SQ(this->dyna.actor.speedXZ) + 0.05f); + return Math3D_LengthSquared(&sp24) < (SQ(this->dyna.actor.speed) + 0.05f); } void func_80A1DFA0(ObjSpinyroll* this) { @@ -517,7 +517,7 @@ void ObjSpinyroll_Destroy(Actor* thisx, PlayState* play) { } void func_80A1E9C4(ObjSpinyroll* this) { - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; this->actionFunc = func_80A1E9E0; } @@ -531,7 +531,7 @@ void func_80A1E9E0(ObjSpinyroll* this, PlayState* play) { void func_80A1EA10(ObjSpinyroll* this) { this->actionFunc = func_80A1EA4C; this->unk_4E2 = D_80A1F1E4[OBJSPINYROLL_GET_1C00(&this->dyna.actor)]; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_80A1EA4C(ObjSpinyroll* this, PlayState* play) { @@ -548,7 +548,7 @@ void func_80A1EA4C(ObjSpinyroll* this, PlayState* play) { void func_80A1EAAC(ObjSpinyroll* this) { this->actionFunc = func_80A1EAE0; this->unk_4DC = D_80A1F20C[this->unk_4A8]; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_80A1EAE0(ObjSpinyroll* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index ada5eadd3..76f5bc872 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -273,13 +273,13 @@ void ObjSwitch_StopCutscene(ObjSwitch* this) { void ObjSwitch_PlayFootSwitchSfx(ObjSwitch* this) { if (this->sfxTimer <= 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FOOT_SWITCH); } } void ObjSwitch_PlayDiamondSwitchSfx(ObjSwitch* this) { if (this->sfxTimer <= 0) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DIAMOND_SWITCH); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DIAMOND_SWITCH); } } diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c index 578244237..5e6f399a8 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c @@ -64,7 +64,7 @@ void func_80C253D0(ObjSwprize* this, PlayState* play) { if (collectible != NULL) { if (sp78.y < 0.98f) { collectible->velocity.y = (sp78.y + 1.0f) * 4.0f; - collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; + collectible->speed = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; collectible->world.rot.y = Math_Atan2S_XY(sp78.z, sp78.x) + D_80C257F8[i]; } else { collectible->world.rot.y = i * (0x10000 / 3); @@ -75,7 +75,7 @@ void func_80C253D0(ObjSwprize* this, PlayState* play) { collectible = Item_DropCollectible(play, &thisx->world.pos, temp_s0); if ((collectible != NULL) && (sp78.y < 0.98f)) { collectible->velocity.y = (sp78.y + 1.0f) * 4.0f; - collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; + collectible->speed = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; collectible->world.rot.y = Math_Atan2S_XY(sp78.z, sp78.x); } } diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 791564b57..5608143b3 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -181,7 +181,7 @@ void func_80B9BCBC(ObjTaru* this, PlayState* play) { if (spawnedActor != NULL) { spawnedActor->parent = &this->dyna.actor; spawnedActor->velocity.y = 12.0f; - spawnedActor->speedXZ = 2.0f; + spawnedActor->speed = 2.0f; } } } @@ -316,7 +316,7 @@ void ObjTaru_Update(Actor* thisx, PlayState* play) { if (this->unk_1AD >= 0) { switch (this->unk_1AD) { case 0: - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->unk_1AD = Rand_S16Offset(40, 80); } else { diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index 306ca7029..490ade729 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -148,7 +148,7 @@ void ObjToge_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&thisx->world.pos, &this->unk_198[0]); thisx->world.rot.y = Math_Vec3f_Yaw(&this->unk_198[0], &this->unk_198[1]); this->unk_194 = 0; - thisx->speedXZ = 0.0f; + thisx->speed = 0.0f; if (sp3E > 0) { s16 sp36; @@ -228,7 +228,7 @@ void func_809A481C(ObjToge* this, PlayState* play) { } void func_809A488C(ObjToge* this) { - this->actor.speedXZ = 1.0f; + this->actor.speed = 1.0f; this->actionFunc = func_809A48AC; } @@ -237,16 +237,16 @@ void func_809A48AC(ObjToge* this, PlayState* play) { s32 sp30 = this->unk_194 ^ 1; if (this->unk_1B4 && (this->unk_194 == 1)) { - Math_StepToF(&this->actor.speedXZ, 2.0f, 0.4f); + Math_StepToF(&this->actor.speed, 2.0f, 0.4f); } else { - Math_StepToF(&this->actor.speedXZ, D_809A4CDC[OBJTOGE_GET_700(&this->actor)], 1.5f); + Math_StepToF(&this->actor.speed, D_809A4CDC[OBJTOGE_GET_700(&this->actor)], 1.5f); this->actor.shape.rot.y += 0x1770; } Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f, 0x81); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[this->unk_194]); this->unk_194 = sp30; if (this->unk_1B4 && (this->unk_194 == 0)) { @@ -254,7 +254,7 @@ void func_809A48AC(ObjToge* this, PlayState* play) { } else { func_809A4744(this); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE); } else { s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[sp30]) - this->actor.world.rot.y; @@ -267,7 +267,7 @@ void func_809A48AC(ObjToge* this, PlayState* play) { } else { func_809A4744(this); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE); + Actor_PlaySfx(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE); } } } @@ -279,7 +279,7 @@ void ObjToge_Update(Actor* thisx, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000) { func_809A43A8(this, play); - Actor_SetColorFilter(&this->actor, 0, 250, 0, 250); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 250, COLORFILTER_BUFFLAG_OPA, 250); } collider->base.acFlags &= ~AC_HIT; } diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 694a5ac59..4f02a46b2 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -156,7 +156,7 @@ s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, PlayState* play) { if (hasPrevBounced && (panel->numBounces < 3) && (panel->startFallingTimer <= 0)) { finalPosY = sPanelXOffsets[i] + this->dyna.actor.world.pos.y; if (!panel->hasSoundPlayed) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CLOCK_TOWER_STAIR_MOVE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CLOCK_TOWER_STAIR_MOVE); panel->hasSoundPlayed = true; } panel->posChangeY += -2.5f; diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 7d2ed1999..a61fb6f64 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -36,7 +36,7 @@ #define THIS ((ObjTokeidai*)thisx) -#define GET_CURRENT_CLOCK_HOUR(this) ((s32)((this)->clockTime * (24.0f / 0x10000))) +#define GET_CURRENT_CLOCK_HOUR(this) ((s32)TIME_TO_HOURS_F((this)->clockTime)) #define GET_CURRENT_CLOCK_MINUTE(this) ((s32)((this)->clockTime * (360 * 2.0f / 0x10000)) % 30) #define GET_CLOCK_FACE_ROTATION(currentClockHour) ((s16)(currentClockHour * (0x10000 / 24.0f))) #define GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute) \ @@ -285,7 +285,7 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { if (currentClockMinute != this->clockMinute) { if (this->minuteRingOrExteriorGearRotationTimer == 8 && playSfx) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_SECOND_HAND); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_SECOND_HAND); } if (this->minuteRingOrExteriorGearRotationTimer > 8) { @@ -318,7 +318,7 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { } void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, PlayState* play) { - if ((this->actor.bgCheckFlags & 1) || this->actor.world.pos.y < 0.0f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.world.pos.y < 0.0f) { this->actionFunc = ObjTokeidai_DoNothing; } else { this->actor.shape.rot.x += 0x50; @@ -332,7 +332,7 @@ void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 132) && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 2) { this->actionFunc = ObjTokeidai_ExteriorGear_Collapse; - this->actor.speedXZ = this->actor.scale.y * 5.0f; + this->actor.speed = this->actor.scale.y * 5.0f; this->actor.velocity.y = 0.0f; this->actor.terminalVelocity = this->actor.scale.y * -50.0f; this->actor.gravity = this->actor.scale.y * -5.0f; @@ -505,15 +505,15 @@ void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, PlayState* pl this->xRotation = 0x4000; switch (this->boundCount) { case 0: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_0); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_0); break; case 1: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_1); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_1); break; case 2: - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_2); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_2); break; } this->boundCount++; @@ -553,7 +553,7 @@ void ObjTokeidai_TowerOpening_FinishRaise(ObjTokeidai* this, PlayState* play) { type = OBJ_TOKEIDAI_TYPE(&this->actor); if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_FALL); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_FALL); } this->yTranslation = 3400; this->actionFunc = ObjTokeidai_TowerOpening_DropCounterweight; @@ -577,7 +577,7 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { type = OBJ_TOKEIDAI_TYPE(&this->actor); if ((type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_CLOCK_TOWN) || (type == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_CLOCK_TOWER_STOP); + Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_STOP); } this->yTranslation = 3400; this->actionFunc = ObjTokeidai_TowerOpening_FinishRaise; diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c index 4dcfd4f74..6009affe4 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c @@ -141,7 +141,7 @@ void ObjTree_SetupSway(ObjTree* this) { this->timer = 0; this->swayAmplitude = 546.0f; this->swayVelocity = 35 * 0x10000 / 360; - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_TREE_SWING); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_TREE_SWING); this->actionFunc = ObjTree_Sway; } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 33b493237..99b7e3532 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -148,7 +148,7 @@ void ObjTsubo_SpawnGoldSkulltula(ObjTsubo* this, PlayState* play, s32 arg2) { if (child != NULL) { child->parent = &this->actor; child->velocity.y = 0.0f; - child->speedXZ = 0.0f; + child->speed = 0.0f; } } } @@ -467,13 +467,13 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { func_80927818(this, play, 0); //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be //! player->currentMask, but in this case is garbage in the collider - func_800B8E58((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); + Player_PlaySfx((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); func_80928D6C(this); } else if ((this->unk_19B != 0) || (acHit && (this->cylinderCollider.info.acHitInfo->toucher.dmgFlags & 0x058BFFBC))) { typeData = &sPotTypeData[type]; this->unk_19B = 0; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 15.0f)) { typeData->breakPot3(this, play); } else { typeData->breakPot1(this, play); @@ -494,7 +494,8 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { if (!this->unk_195) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); - if ((this->actor.bgCheckFlags & 1) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_195 = true; this->actor.flags &= ~ACTOR_FLAG_10; } @@ -509,7 +510,7 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { s32 absYawDiff = ABS_ALT(yawDiff); if (absYawDiff > (0x10000 / 3)) { - Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); + Actor_OfferGetItem(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } @@ -568,7 +569,8 @@ void func_80928F18(ObjTsubo* this, PlayState* play) { this->unk_194--; } typeData = &sPotTypeData[type]; - if ((this->actor.bgCheckFlags & 0xB) || atHit || (this->unk_194 <= 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || atHit || + (this->unk_194 <= 0)) { typeData->breakPot1(this, play); if (type == OBJ_TSUBO_TYPE_3) { func_8092762C(this, play); @@ -582,7 +584,7 @@ void func_80928F18(ObjTsubo* this, PlayState* play) { } func_809291DC(this); - } else if (this->actor.bgCheckFlags & 0x40) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { typeData->breakPot2(this, play); if (type == OBJ_TSUBO_TYPE_3) { func_8092762C(this, play); @@ -621,7 +623,7 @@ void func_809291DC(ObjTsubo* this) { this->actor.shape.rot.x = this->actor.home.rot.x; this->actor.world.rot.x = this->actor.home.rot.x; this->actor.velocity.y = 0.0f; - this->actor.speedXZ = 0.0f; + this->actor.speed = 0.0f; this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; Actor_SetScale(&this->actor, 0.0f); @@ -673,7 +675,7 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) { } if (this->unk_19A >= 0) { if (this->unk_19A == 0) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + Actor_PlaySfx(&this->actor, NA_SE_EN_STALGOLD_ROLL); if (Rand_ZeroOne() < 0.1f) { this->unk_19A = Rand_S16Offset(40, 80); } else { diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index c9ac4899c..f06d13caf 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -222,7 +222,7 @@ s32 ObjUm_InitBandits(ObjUm* this, PlayState* play) { EnHorse* bandit2; spawnPoints = Lib_SegmentedToVirtual(path->points); - Audio_QueueSeqCmd(0x8000 | NA_BGM_CHASE); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CHASE | SEQ_FLAG_ASYNC); bandit1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPoints[0].x, spawnPoints[0].y, spawnPoints[0].z, 0, this->dyna.actor.shape.rot.y, 0, @@ -410,11 +410,11 @@ s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit } bandit->actor.world.rot.y = Math_Vec3f_Yaw(&bandit->actor.world.pos, &sp50); - bandit->actor.speedXZ = 45.0f; + bandit->actor.speed = 45.0f; - sp3C = Math_CosS(bandit->actor.world.rot.x) * bandit->actor.speedXZ; + sp3C = Math_CosS(bandit->actor.world.rot.x) * bandit->actor.speed; bandit->actor.velocity.x = Math_SinS(bandit->actor.world.rot.y) * sp3C; - bandit->actor.velocity.y = Math_SinS(bandit->actor.world.rot.x) * bandit->actor.speedXZ; + bandit->actor.velocity.y = Math_SinS(bandit->actor.world.rot.x) * bandit->actor.speed; bandit->actor.velocity.z = Math_CosS(bandit->actor.world.rot.y) * sp3C; bandit->banditPosition.x = @@ -535,12 +535,12 @@ s32 func_80B78A54(ObjUm* this, PlayState* play, s32 arg2, EnHorse* arg3, EnHorse arg3->unk_564 = 1; if (arg3->rider != NULL) { arg3->rider->actor.colorFilterTimer = 20; - Actor_SetColorFilter(&arg3->rider->actor, 0x4000, 0xFF, 0, 40); + Actor_SetColorFilter(&arg3->rider->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); } } else { if (arg3->rider != NULL) { arg3->rider->actor.colorFilterTimer = 20; - Actor_SetColorFilter(&arg3->rider->actor, 0x4000, 0xFF, 0, 40); + Actor_SetColorFilter(&arg3->rider->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); } Audio_PlaySfxAtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); } @@ -937,7 +937,7 @@ s32 func_80B7984C(PlayState* play, ObjUm* this, s32 arg2, s32* arg3) { return 0; } if (*arg3 == 3) { - func_80151938(play, this->dyna.actor.textId); + Message_ContinueTextbox(play, this->dyna.actor.textId); *arg3 = 1; return 0; } @@ -1122,9 +1122,9 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { } if (this->animIndex == OBJ_UM_ANIM_TROT) { - this->dyna.actor.speedXZ = 4.0f; + this->dyna.actor.speed = 4.0f; } else if (this->animIndex == OBJ_UM_ANIM_GALLOP) { - this->dyna.actor.speedXZ = 8.0f; + this->dyna.actor.speed = 8.0f; } return sp3C; @@ -1656,9 +1656,9 @@ void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { } if (animIndex == OBJ_UM_ANIM_TROT) { - animPlaybackSpeed = this->dyna.actor.speedXZ * 0.25f; + animPlaybackSpeed = this->dyna.actor.speed * 0.25f; } else if (animIndex == OBJ_UM_ANIM_GALLOP) { - animPlaybackSpeed = this->dyna.actor.speedXZ * 0.2f; + animPlaybackSpeed = this->dyna.actor.speed * 0.2f; } else if (animIndex == OBJ_UM_ANIM_IDLE) { animPlaybackSpeed = 1.0f; } @@ -1703,8 +1703,8 @@ void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { if (this->wheelRot / 0x199A != this->unk_420) { this->unk_420 = this->wheelRot / 0x199A; //! FAKE - if (!&sUmAnims[0]) {} - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CART_WHEEL); + if (sUmAnims[0].doesMove) {} + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CART_WHEEL); } } diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index 24e816644..d527e4937 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -139,7 +139,7 @@ void func_80C07F30(ObjUsiyane* this, PlayState* play) { } } - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_HOUSE_BROKEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_HOUSE_BROKEN); this->unk_740 = 0; this->unk_744 |= 4; } diff --git a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c index 4b0a797f6..9859d9c0f 100644 --- a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c +++ b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c @@ -7,7 +7,7 @@ #include "z_obj_visiblock.h" #include "objects/object_visiblock/object_visiblock.h" -#define FLAGS (ACTOR_FLAG_80) +#define FLAGS (ACTOR_FLAG_REACT_TO_LENS) #define THIS ((ObjVisiblock*)thisx) diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c index b7a1e59be..257e9eb79 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c @@ -123,14 +123,14 @@ s32 func_80A3C700(ObjVspinyroll* this) { s32 sp30 = this->unk_398 ^ 1; Vec3f sp24; - Math_StepToF(&this->dyna.actor.speedXZ, this->unk_394, this->unk_394 * 0.2f); + Math_StepToF(&this->dyna.actor.speed, this->unk_394, this->unk_394 * 0.2f); - this->dyna.actor.world.pos.x += this->dyna.actor.speedXZ * this->unk_3B4.x; - this->dyna.actor.world.pos.y += this->dyna.actor.speedXZ * this->unk_3B4.y; - this->dyna.actor.world.pos.z += this->dyna.actor.speedXZ * this->unk_3B4.z; + this->dyna.actor.world.pos.x += this->dyna.actor.speed * this->unk_3B4.x; + this->dyna.actor.world.pos.y += this->dyna.actor.speed * this->unk_3B4.y; + this->dyna.actor.world.pos.z += this->dyna.actor.speed * this->unk_3B4.z; Math_Vec3f_Diff(&this->unk_39C[sp30], &this->dyna.actor.world.pos, &sp24); - return Math3D_LengthSquared(&sp24) < (SQ(this->dyna.actor.speedXZ) + 0.05f); + return Math3D_LengthSquared(&sp24) < (SQ(this->dyna.actor.speed) + 0.05f); } void func_80A3C7E8(ObjVspinyroll* this) { @@ -208,7 +208,7 @@ s32 func_80A3C8D8(ObjVspinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { spB4.z += this->dyna.actor.world.pos.z; EffectSsHitmark_SpawnFixedScale(play, 3, &spB4); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); + Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_SHIELD_REFLECT_SW); } temp_f0 = Math3D_Vec3fDistSq(&spD8, &spC0); @@ -322,7 +322,7 @@ void ObjVspinyroll_Destroy(Actor* thisx, PlayState* play) { } void func_80A3CEC4(ObjVspinyroll* this) { - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; this->actionFunc = func_80A3CEE0; } @@ -336,7 +336,7 @@ void func_80A3CEE0(ObjVspinyroll* this, PlayState* play) { void func_80A3CF10(ObjVspinyroll* this) { this->actionFunc = func_80A3CF4C; this->unk_3C8 = D_80A3D478[OBJVSPINYROLL_GET_1C00(&this->dyna.actor)]; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_80A3CF4C(ObjVspinyroll* this, PlayState* play) { @@ -351,7 +351,7 @@ void func_80A3CF4C(ObjVspinyroll* this, PlayState* play) { void func_80A3CFAC(ObjVspinyroll* this) { this->actionFunc = func_80A3CFE0; this->unk_3C2 = D_80A3D4DC[this->unk_398]; - this->dyna.actor.speedXZ = 0.0f; + this->dyna.actor.speed = 0.0f; } void func_80A3CFE0(ObjVspinyroll* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index 3fa3260fd..905002784 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -100,7 +100,7 @@ s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, PlayState* play) { if (this->dyna.actor.cutscene < 0 || ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); ObjWarpstone_SetupAction(this, ObjWarpstone_PlayOpeningCutscene); - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_OWL_WARP_SWITCH_ON); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_OWL_WARP_SWITCH_ON); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); } @@ -146,7 +146,7 @@ void ObjWarpstone_Update(Actor* thisx, PlayState* play) { play->msgCtx.unk120D4 = 0; gSaveContext.save.owlSaveLocation = OBJ_WARPSTONE_GET_ID(&this->dyna.actor); } else { - func_801477B4(play); + Message_CloseTextbox(play); } } } else if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 067618491..4558a6a75 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -97,7 +97,7 @@ void func_808A7C04(ObjWturn* this, PlayState* play) { this->actor.world.pos.y += this->actor.playerHeightRel; player->actor.shape.shadowAlpha = 0; func_800B7298(play, &this->actor, PLAYER_CSMODE_84); - func_800B8E58(player, NA_SE_VO_NAVY_ENEMY); + Player_PlaySfx(player, NA_SE_VO_NAVY_ENEMY); this->unk_14A = 0; Play_DisableMotionBlur(); this->actionFunc = func_808A7C78; diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c index 9d35288c5..1196cb0be 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c @@ -73,7 +73,7 @@ void ObjY2shutter_SetupOpen(ObjY2shutter* this, ShutterInfo* info, ShutterType s this->openTimer = info->openTimer; this->settleTimer = info->openStartSettleTimer; if (shutterType == SHUTTER_BARRED) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); } } @@ -134,7 +134,7 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { this->openTimer = 0; this->settleTimer = info->openStartSettleTimer; if (shutterType == SHUTTER_BARRED) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); } } else { targetPosY = this->dyna.actor.home.pos.y; @@ -153,7 +153,7 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { this->isStationary = true; this->settleTimer = info->openEndAndCloseSettleTimer; if (shutterType != SHUTTER_BARRED) { - Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP); } } } else { diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 74e711cfa..23713aa71 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -61,7 +61,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; this->actionFunc = ShotSun_UpdateForOcarina; - this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; } else { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -160,7 +160,7 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { collectible = (EnItem00*)Item_DropCollectible(play, &spawnPos, ITEM00_MAGIC_LARGE); if (collectible != NULL) { collectible->unk152 = 0x1770; - collectible->actor.speedXZ = 0.0f; + collectible->actor.speed = 0.0f; } } diff --git a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c index 8c1e98bed..5e42daffb 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c @@ -5,6 +5,7 @@ */ #include "z_tg_sw.h" +#include "z64debug_display.h" #define FLAGS (ACTOR_FLAG_10) @@ -36,14 +37,14 @@ void TGSw_ActionDecider(TGSw* this, PlayState* play) { u8 unk1F4; // Maybe actorCtx Debug Flag? - if (play->actorCtx.unk1F5 != 0) { + if (play->actorCtx.unk_1F4.timer != 0) { scaledAbsoluteRotY = ABS_ALT(this->actor.world.rot.y) * 4.0f; scaledAbsoluteRotZ = ABS_ALT(this->actor.world.rot.z) * 4.0f; if ((scaledAbsoluteRotZ < this->actor.xzDistToPlayer) || (scaledAbsoluteRotY < this->actor.playerHeightRel)) { return; } - unk1F4 = play->actorCtx.unk1F4; + unk1F4 = play->actorCtx.unk_1F4.unk_00; if (unk1F4 == 2 || unk1F4 == 0) { this->actionFunc = TGSw_ActionExecuteOneShot; } @@ -62,7 +63,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, PlayState* play) { } if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actor->params & 0xFC) >> 2) & 0xFF)) { actor->parent = &this->actor; - actor->speedXZ = ABS_ALT(this->actor.world.rot.x); + actor->speed = ABS_ALT(this->actor.world.rot.x); break; } actor = actor->next; @@ -78,7 +79,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, PlayState* play) { } if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actor->params & 0xFC) >> 2) & 0xFF)) { actor->parent = &this->actor; - actor->speedXZ = ABS_ALT(this->actor.world.rot.x); + actor->speed = ABS_ALT(this->actor.world.rot.x); break; } actor = actor->next; diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c index 09c2afb11..ef88015b7 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c @@ -14,7 +14,7 @@ u32 EffectEnIceBlock_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectEnIceBlock_Update(PlayState* play, u32 index, EffectSs* this); void EffectEnIceBlock_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_En_Ice_Block_InitVars = { +EffectSsInit Effect_En_Ice_Block_InitVars = { EFFECT_EN_ICE_BLOCK, EffectEnIceBlock_Init, }; diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h index e5377b20f..2707d64c8 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h @@ -11,6 +11,4 @@ typedef struct { /* 0x28 */ s16 scale; } EffectEnIceBlockInitParams; // size = 0x2C -extern const EffectSsInit Effect_En_Ice_Block_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index c903bac6d..2d80b4161 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -26,7 +26,7 @@ u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Blast_InitVars = { +EffectSsInit Effect_Ss_Blast_InitVars = { EFFECT_SS_BLAST, EffectSsBlast_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h index 72a264c03..1e9087d85 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h @@ -15,6 +15,4 @@ typedef struct { /* 0x32 */ s16 life; } EffectSsBlastInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Blast_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index d15151d49..b17a43fbe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -26,7 +26,7 @@ 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); -const EffectSsInit Effect_Ss_Bomb2_InitVars = { +EffectSsInit Effect_Ss_Bomb2_InitVars = { EFFECT_SS_BOMB2, EffectSsBomb2_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 468e2c016..4a63bd4c8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -12,6 +12,4 @@ typedef struct { /* 0x28 */ u8 drawMode; } EffectSsBomb2InitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Bomb2_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 3298b2ab3..a3d203992 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -17,7 +17,7 @@ u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this); void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Bubble_InitVars = { +EffectSsInit Effect_Ss_Bubble_InitVars = { EFFECT_SS_BUBBLE, EffectSsBubble_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h index 0916a95ca..9e57bc657 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h @@ -11,6 +11,4 @@ typedef struct { /* 0x18 */ f32 scale; } EffectSsBubbleInitParams; // size = 0x1C -extern const EffectSsInit Effect_Ss_Bubble_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 9d8eecfbc..d8394b159 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -21,7 +21,7 @@ u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_D_Fire_InitVars = { +EffectSsInit Effect_Ss_D_Fire_InitVars = { EFFECT_SS_D_FIRE, EffectSsDFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h index 2d657bc43..e72616b84 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h @@ -15,6 +15,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsDFireInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_D_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c index 54963eb3b..543363ade 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c @@ -25,7 +25,7 @@ u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Db_InitVars = { +EffectSsInit Effect_Ss_Dead_Db_InitVars = { EFFECT_SS_DEAD_DB, EffectSsDeadDb_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h index a1ac62167..58e46426f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h @@ -14,6 +14,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsDeadDbInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Dead_Db_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index 5e8a1e451..9f124d39e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -25,7 +25,7 @@ u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Dd_InitVars = { +EffectSsInit Effect_Ss_Dead_Dd_InitVars = { EFFECT_SS_DEAD_DD, EffectSsDeadDd_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h index 9c9dcf28e..7d32c3284 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h @@ -23,6 +23,4 @@ typedef struct { /* 0x40 */ u8 type; } EffectSsDeadDdInitParams; // size = 0x44 -extern const EffectSsInit Effect_Ss_Dead_Dd_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index 7bf60c2a1..6243b4302 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -23,7 +23,7 @@ u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Ds_InitVars = { +EffectSsInit Effect_Ss_Dead_Ds_InitVars = { EFFECT_SS_DEAD_DS, EffectSsDeadDs_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h index e04742296..b057f3f42 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h @@ -13,6 +13,4 @@ typedef struct { /* 0x2C */ s32 life; } EffectSsDeadDsInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Dead_Ds_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index 4d009c00a..b6e3b747f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -39,7 +39,7 @@ static Color_RGBA8 sEnvColors[] = { { 150, 150, 150, 0 }, }; -const EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { +EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { EFFECT_SS_DT_BUBBLE, EffectSsDtBubble_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h index e572f4a2c..b5247eb0f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h @@ -23,6 +23,4 @@ typedef struct { /* 0x34 */ u8 customColor; } EffectSsDtBubbleInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_Dt_Bubble_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index 7a2274a5d..10e8fbeed 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -28,7 +28,7 @@ void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this); void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dust_InitVars = { +EffectSsInit Effect_Ss_Dust_InitVars = { EFFECT_SS_DUST, EffectSsDust_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h index 410a14352..b2b76e0be 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h @@ -26,6 +26,4 @@ typedef struct { /* 0x34 */ u8 updateMode; } EffectSsDustInitParams; // size = 0x38 -extern const EffectSsInit Effect_Ss_Dust_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index fab6f8788..9d78d4d71 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -24,7 +24,7 @@ u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_En_Fire_InitVars = { +EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index 9fb959824..0f17477b8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -15,6 +15,4 @@ typedef struct { /* 0x16 */ s16 bodyPart; } EffectSsEnFireInitParams; // size = 0x18 -extern const EffectSsInit Effect_Ss_En_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 1108e61ce..21a0f1019 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -28,7 +28,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_En_Ice_InitVars = { +EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index 46b162cc1..051e81983 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -20,6 +20,4 @@ typedef struct { /* 0x38 */ s16 type; } EffectSsEnIceInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_En_Ice_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index bf21a8741..03522f5af 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -16,7 +16,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); static s16 sScores[] = { 30, 60, 100 }; -const EffectSsInit Effect_Ss_Extra_InitVars = { +EffectSsInit Effect_Ss_Extra_InitVars = { EFFECT_SS_EXTRA, EffectSsExtra_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h index c278ec927..081570f62 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h @@ -17,6 +17,4 @@ typedef struct { /* 0x26 */ s16 scoreIdx; } EffectSsExtraInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_Extra_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index b81ccf594..cd7c6d5bd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -19,7 +19,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { +EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, EffectSsFhgFlash_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h index c464047b5..c2f231269 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h @@ -40,6 +40,4 @@ typedef struct { /* 0x2C */ u8 type; } EffectSsFhgFlashInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Fhg_Flash_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index da4de14d6..de464ae8d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -27,7 +27,7 @@ u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Fire_Tail_InitVars = { +EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h index 60fc2a6ef..a809e4ebc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h @@ -16,6 +16,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsFireTailInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Fire_Tail_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index 7bc2d6966..b41f35756 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -13,7 +13,7 @@ u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Fire_InitVars = { +EffectSsInit Effect_Ss_G_Fire_InitVars = { EFFECT_SS_G_FIRE, EffectSsGFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h index 574abc976..cc02cae83 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h @@ -7,6 +7,4 @@ typedef struct { /* 0x00 */ Vec3f pos; } EffectSsGFireInitParams; // size = 0xC -extern const EffectSsInit Effect_Ss_G_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index b820d8168..24aadc0ec 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -27,7 +27,7 @@ u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initP void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Ripple_InitVars = { +EffectSsInit Effect_Ss_G_Ripple_InitVars = { EFFECT_SS_G_RIPPLE, EffectSsGRipple_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h index 018fff6be..c746fbf28 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h @@ -10,6 +10,4 @@ typedef struct { /* 0x10 */ s16 life; } EffectSsGRippleInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_G_Ripple_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index 260541b51..ccc2951c6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -26,7 +26,7 @@ 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); -const EffectSsInit Effect_Ss_G_Spk_InitVars = { +EffectSsInit Effect_Ss_G_Spk_InitVars = { EFFECT_SS_G_SPK, EffectSsGSpk_Init, }; @@ -134,8 +134,8 @@ void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this) { void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this) { if (this->actor != NULL) { if ((this->actor->category == ACTORCAT_EXPLOSIVES) && (this->actor->update != NULL)) { - this->pos.x += (Math_SinS(this->actor->world.rot.y) * this->actor->speedXZ); - this->pos.z += (Math_CosS(this->actor->world.rot.y) * this->actor->speedXZ); + this->pos.x += (Math_SinS(this->actor->world.rot.y) * this->actor->speed); + this->pos.z += (Math_CosS(this->actor->world.rot.y) * this->actor->speed); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h index c44bb9168..b952802d2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h @@ -20,6 +20,4 @@ typedef struct { /* 0x34 */ u8 updateMode; } EffectSsGSpkInitParams; // size = 0x38 -extern const EffectSsInit Effect_Ss_G_Spk_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 78bee9835..8d7647bfe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -17,7 +17,7 @@ u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initP void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Splash_InitVars = { +EffectSsInit Effect_Ss_G_Splash_InitVars = { EFFECT_SS_G_SPLASH, EffectSsGSplash_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h index 7ea428400..9d3fbcd13 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h @@ -12,6 +12,4 @@ typedef struct { /* 0x14 */ Color_RGBA8 envColor; } EffectSsGSplashInitParams; // size = 0x18 -extern const EffectSsInit Effect_Ss_G_Splash_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index b4d9ae6fb..e1a9371cd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -21,7 +21,7 @@ u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Hahen_InitVars = { +EffectSsInit Effect_Ss_Hahen_InitVars = { EFFECT_SS_HAHEN, EffectSsHahen_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h index 9a73ac664..d962bf55f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h @@ -19,6 +19,4 @@ typedef struct { /* 0x2C */ s16 life; } EffectSsHahenInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Hahen_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c index f65e36c7d..36eb650f7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c @@ -73,7 +73,7 @@ static TexturePtr sTextures[] = { gEffHitmarkWhiteMetal8Tex, }; -const EffectSsInit Effect_Ss_Hitmark_InitVars = { +EffectSsInit Effect_Ss_Hitmark_InitVars = { EFFECT_SS_HITMARK, EffectSsHitmark_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h index 6e38ab8d2..e513f0665 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h @@ -16,6 +16,4 @@ typedef struct { /* 0x08 */ Vec3f pos; } EffectSsHitmarkInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_Hitmark_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 52561fea2..9efadc99e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -19,7 +19,7 @@ u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Ice_Piece_InitVars = { +EffectSsInit Effect_Ss_Ice_Piece_InitVars = { EFFECT_SS_ICE_PIECE, EffectSsIcePiece_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h index 2bbe9e481..16ada036f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h @@ -11,6 +11,4 @@ typedef struct { /* 0x28 */ s32 life; } EffectSsIcePieceInitParams; // size = 0xC -extern const EffectSsInit Effect_Ss_Ice_Piece_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 41c9c818a..e1c2bc72d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -18,7 +18,7 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { +EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { EFFECT_SS_ICE_SMOKE, EffectSsIceSmoke_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h index bc6893311..e56678fb0 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h @@ -10,6 +10,4 @@ typedef struct { /* 0x24 */ s16 scale; } EffectSsIceSmokeInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_Ice_Smoke_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 4aa209639..17d7edc1e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -20,7 +20,7 @@ u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_K_Fire_InitVars = { +EffectSsInit Effect_Ss_K_Fire_InitVars = { EFFECT_SS_K_FIRE, EffectSsKFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h index 23ed053c3..3cb53de39 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h @@ -11,6 +11,4 @@ typedef struct { /* 0x26 */ u8 type; } EffectSsKFireInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_K_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index a84b450c1..e424c0b44 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -28,7 +28,7 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this); void EffectSsKakera_CheckForObject(EffectSs* this, PlayState* play); -const EffectSsInit Effect_Ss_Kakera_InitVars = { +EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, EffectSsKakera_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c index 97899ae68..540d9e505 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c @@ -29,7 +29,7 @@ void func_80977E6C(PlayState* play, u32 index, EffectSs* this); void func_80977F28(PlayState* play, u32 index, EffectSs* this); void EffectSsKirakira_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Kirakira_InitVars = { +EffectSsInit Effect_Ss_Kirakira_InitVars = { EFFECT_SS_KIRAKIRA, EffectSsKirakira_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h index 66e73e0a5..e9513cc7a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h @@ -17,6 +17,4 @@ typedef struct { /* 0x38 */ u8 updateMode; } EffectSsKirakiraInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_Kirakira_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 1f70b8064..9037b20f4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -31,7 +31,7 @@ TexturePtr sLightningTextures[] = { gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, }; -const EffectSsInit Effect_Ss_Lightning_InitVars = { +EffectSsInit Effect_Ss_Lightning_InitVars = { EFFECT_SS_LIGHTNING, EffectSsLightning_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h index 35ef380b9..07052e522 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h @@ -13,6 +13,4 @@ typedef struct { /* 0x1A */ s16 numBolts; } EffectSsLightningInitParams; // size = 0x1C -extern const EffectSsInit Effect_Ss_Lightning_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c index c5c058cc3..3402eb2b7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c @@ -27,7 +27,7 @@ void EffectSsSbn_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSbn_DrawSliding(PlayState* play, u32 index, EffectSs* this); void EffectSsSbn_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Sbn_InitVars = { +EffectSsInit Effect_Ss_Sbn_InitVars = { EFFECT_SS_SBN, EffectSsSbn_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h index 439ef88a0..9290d7948 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h @@ -9,6 +9,4 @@ typedef struct { /* 0x10 */ f32 scale; } EffectSsSbnInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_Sbn_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index 4dbdc65a2..a9a190948 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -25,7 +25,7 @@ u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Sibuki_InitVars = { +EffectSsInit Effect_Ss_Sibuki_InitVars = { EFFECT_SS_SIBUKI, EffectSsSibuki_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h index 9efe7c77a..27e3780d2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h @@ -12,6 +12,4 @@ typedef struct { /* 0x28 */ s16 scale; } EffectSsSibukiInitParams; // size = 0x2C -extern const EffectSsInit Effect_Ss_Sibuki_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index 01224dd32..d6d6d1cbc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -15,7 +15,7 @@ u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { +EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { EFFECT_SS_SOLDER_SRCH_BALL, EffectSsSolderSrchBall_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h index fb4fb4159..5c250a7af 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h @@ -15,6 +15,4 @@ typedef struct { /* 0x2C */ s16 flags; } EffectSsSolderSrchBallInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 1c6d53e7f..4f1aa5d91 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -16,7 +16,7 @@ u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Stick_InitVars = { +EffectSsInit Effect_Ss_Stick_InitVars = { EFFECT_SS_STICK, EffectSsStick_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index ad61166d3..6e6b48156 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -15,7 +15,7 @@ u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Stone1_InitVars = { +EffectSsInit Effect_Ss_Stone1_InitVars = { EFFECT_SS_STONE1, EffectSsStone1_Init, }; @@ -77,6 +77,6 @@ void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this) { if ((this->life == 6) && (this->rReg0 != 0)) { - iREG(50) = 0; + R_TRANS_FADE_FLASH_ALPHA_STEP = 0; } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h index 365585a8e..b50868b81 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h @@ -8,6 +8,4 @@ typedef struct { /* 0x0C */ s32 reg0; } EffectSsStone1InitParams; // size = 0x10 -extern const EffectSsInit Effect_Ss_Stone1_InitVars; - #endif diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c index f4f68d230..c4eb826c7 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c +++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c @@ -31,8 +31,11 @@ void TransitionTriforce_Start(void* thisx) { case STATE_SPIRAL_IN_FAST: this->transPos = 1.0f; return; + + default: + this->transPos = 0.03f; + return; } - this->transPos = 0.03f; } void* TransitionTriforce_Init(void* thisx) { @@ -44,7 +47,7 @@ void* TransitionTriforce_Init(void* thisx) { this->transPos = 1.0f; this->state = STATE_SPIRAL_IN_FAST; this->step = 0.015f; - this->fadeType = TYPE_TRANSPARENT_TRIFORCE; + this->type = TRANS_INSTANCE_TYPE_FILL_OUT; return this; } @@ -77,7 +80,7 @@ void TransitionTriforce_SetColor(void* thisx, u32 color) { void TransitionTriforce_SetType(void* thisx, s32 type) { TransitionTriforce* this = (TransitionTriforce*)thisx; - this->fadeType = type; + this->type = type; } void TransitionTriforce_SetState(void* thisx, s32 state) { @@ -99,37 +102,43 @@ void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) { guRotate(&modelView[1], rotation, 0.0f, 0.0f, 1.0f); guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f); gDPPipeSync(gfx++); - gSPDisplayList(gfx++, sTriforceWipeDL); + gSPDisplayList(gfx++, sTransTriforceDL); gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); gSPMatrix(gfx++, &this->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); - gSPVertex(gfx++, &sTriforceWipeVtx, ARRAY_COUNT(sTriforceWipeVtx), 0); + gSPVertex(gfx++, &sTransTriforceVtx, ARRAY_COUNT(sTransTriforceVtx), 0); if (!TransitionTriforce_IsDone(this)) { - switch (this->fadeType) { - case TYPE_TRANSPARENT_TRIFORCE: + switch (this->type) { + case TRANS_INSTANCE_TYPE_FILL_OUT: gSP2Triangles(gfx++, 0, 4, 5, 0, 4, 1, 3, 0); gSP1Triangle(gfx++, 5, 3, 2, 0); break; - case TYPE_FILLED_TRIFORCE: + case TRANS_INSTANCE_TYPE_FILL_IN: gSP2Triangles(gfx++, 3, 4, 5, 0, 0, 2, 6, 0); gSP2Triangles(gfx++, 0, 6, 7, 0, 1, 0, 7, 0); gSP2Triangles(gfx++, 1, 7, 8, 0, 1, 8, 9, 0); gSP2Triangles(gfx++, 1, 9, 2, 0, 2, 9, 6, 0); break; + + default: + break; } } else { - switch (this->fadeType) { - case TYPE_TRANSPARENT_TRIFORCE: + switch (this->type) { + case TRANS_INSTANCE_TYPE_FILL_OUT: break; - case TYPE_FILLED_TRIFORCE: + case TRANS_INSTANCE_TYPE_FILL_IN: gSP1Quadrangle(gfx++, 6, 7, 8, 9, 0); break; + + default: + break; } } gDPPipeSync(gfx++); @@ -143,6 +152,7 @@ s32 TransitionTriforce_IsDone(void* thisx) { return this->transPos <= 0.03f; } else if ((this->state == STATE_SPIRAL_OUT_SLOW) || (this->state == STATE_SPIRAL_OUT_FAST)) { return (this->transPos >= 1.0f); + } else { + return false; } - return false; } diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h index cd7f4563e..1bcfe5c3d 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h +++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h @@ -10,20 +10,14 @@ typedef enum { /* 2 */ STATE_SPIRAL_IN_FAST, /* 3 */ STATE_SPIRAL_OUT_SLOW, /* 4 */ STATE_SPIRAL_OUT_FAST -} FbTriforceState; - -typedef enum { - /* 0 */ TYPE_NONE, - /* 1 */ TYPE_TRANSPARENT_TRIFORCE, - /* 2 */ TYPE_FILLED_TRIFORCE -} TriforceFadeType; +} TransitionTriforceState; typedef struct { /* 0x000 */ Color_RGBA8_u32 color; /* 0x004 */ f32 transPos; /* 0x008 */ f32 step; /* 0x00C */ s32 state; - /* 0x010 */ s32 fadeType; + /* 0x010 */ s32 type; /* 0x018 */ Mtx projection; /* 0x058 */ s32 frame; /* 0x060 */ Mtx modelView[2][3]; diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c index 0c20dba93..48c8bdf58 100644 --- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c +++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c @@ -127,7 +127,7 @@ void TransitionWipe5_SetType(void* thisx, s32 type) { if (type & 0x80) { this->unk_11 = 0; this->unk_12 = type & 1; - } else if (type == 1) { + } else if (type == TRANS_INSTANCE_TYPE_FILL_OUT) { this->unk_10 = 1; } else { this->unk_10 = 0; diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index 201030862..845baa3cb 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -73,7 +73,7 @@ void DayTelop_Update(DayTelopState* this, GameState* thisx) { this->transitionCountdown--; if (this->transitionCountdown == 0) { if (gSaveContext.save.day < 9) { - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; } else { gSaveContext.nextCutsceneIndex = 0xFFF6; gSaveContext.save.day = 1; @@ -213,11 +213,11 @@ void DayTelop_Noop(DayTelopState* this) { void DayTelop_LoadGraphics(DayTelopState* this) { size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static); - this->daytelopStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize); segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static); - this->gameoverStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize); } diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c56cc4bbb..7edfb8e78 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -13,7 +13,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { static s32 sOpeningCutscenes[] = { 0xFFFA, 0xFFFA }; CLEAR_EVENTINF(EVENTINF_17); - gSaveContext.gameMode = 1; + gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; Sram_InitNewSave(); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 183f6b069..ab34ebffe 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -30,7 +30,7 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; gSaveContext.hudVisibilityTimer = 0; - Audio_QueueSeqCmd(NA_BGM_STOP); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); gSaveContext.save.entrance = entrance; if (spawn != 0) { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index e31e31c7d..01e29668e 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -132,7 +132,7 @@ void ConsoleLogo_Main(GameState* thisx) { if (this->exit) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; - gSaveContext.gameMode = 1; + gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState)); @@ -153,7 +153,7 @@ void ConsoleLogo_Init(GameState* thisx) { ConsoleLogoState* this = (ConsoleLogoState*)thisx; uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static); - this->staticSegment = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->staticSegment = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize); Game_SetFramerateDivisor(&this->state, 1); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index d1a358e75..474180826 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -241,9 +241,9 @@ void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx) { pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1]; } -s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; -s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; -s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; +static s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; +static s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; +static s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; void KaleidoScope_DrawItemSelect(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index d1c42dd73..721ca7a18 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -528,7 +528,7 @@ void KaleidoScope_UpdateOpening(PlayState* play) { if (pauseCtx->switchPageTimer == 64) { // Finished opening - func_80112C0C(play, 1); + Interface_UpdateButtonsAlt(play, 1); if (pauseCtx->cursorSpecialPos == 0) { gSaveContext.buttonStatus[EQUIP_SLOT_B] = D_801C6A98[pauseCtx->pageIndex][0]; @@ -962,7 +962,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->promptChoice = PAUSE_PROMPT_YES; pauseCtx->state++; if (gameOverCtx->state == GAMEOVER_INACTIVE) { - pauseCtx->state++; + pauseCtx->state++; // GAMEOVER_DEATH_START } break; @@ -1340,7 +1340,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = sUnpausedButtonStatus[EQUIP_SLOT_C_RIGHT]; gSaveContext.buttonStatus[EQUIP_SLOT_A] = sUnpausedButtonStatus[EQUIP_SLOT_A]; - func_80110038(play); + Interface_UpdateButtonsPart2(play); gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); MsgEvent_SendNullTask(); diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index 3144cab20..131ccdc88 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = 5786abbdd2d0fd14907e03575a0bd972c1fe9b28 - parent = e451a103ba5d14af3dd14acfa54a6b4999fd951f + commit = 23929ec9373d28cb298daad4ad7cb468e09c0a46 + parent = 2e487b5008c129031ab311a3a7bfd42adeb4916b method = merge - cmdver = 0.4.5 + cmdver = 0.4.3 diff --git a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp b/tools/ZAPD/ZAPD/ZTextureAnimation.cpp index 698054fa8..0c55b2609 100644 --- a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp +++ b/tools/ZAPD/ZAPD/ZTextureAnimation.cpp @@ -569,6 +569,7 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix) count = 2; } params = new TextureScrollingParams(parent); + params->type = entry.type; params->ExtractFromBinary(paramsOffset, count); break; @@ -582,6 +583,7 @@ void ZTextureAnimation::DeclareReferences(const std::string& prefix) case TextureAnimationParamsType::TextureCycle: params = new TextureCyclingParams(parent); + params->type = entry.type; params->ExtractFromBinary(paramsOffset); break; diff --git a/tools/asm-differ/.gitignore b/tools/asm-differ/.gitignore index eb176dc56..a2b216fea 100644 --- a/tools/asm-differ/.gitignore +++ b/tools/asm-differ/.gitignore @@ -1,2 +1,4 @@ .mypy_cache/ __pycache__/ +.vscode/ +poetry.lock diff --git a/tools/asm-differ/.gitrepo b/tools/asm-differ/.gitrepo index 8d0a6445d..a23a9c1e4 100644 --- a/tools/asm-differ/.gitrepo +++ b/tools/asm-differ/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/simonlindholm/asm-differ branch = main - commit = 1236288d1520335c2bfb672078fec65084d7cb5c - parent = 2c5690701a350c7e7c3d6252dff925ad65d59910 + commit = ae408664a89ea4dc70d005d0afc69ac26c938cbb + parent = c833969ea79ba31c3103e25e94ef88098c0287de method = merge cmdver = 0.4.3 diff --git a/tools/asm-differ/.pre-commit-config.yaml b/tools/asm-differ/.pre-commit-config.yaml index ccc4afc0e..67ba03d12 100644 --- a/tools/asm-differ/.pre-commit-config.yaml +++ b/tools/asm-differ/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: - repo: https://github.com/psf/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black diff --git a/tools/asm-differ/README.md b/tools/asm-differ/README.md index 205310d39..1d0932c9b 100644 --- a/tools/asm-differ/README.md +++ b/tools/asm-differ/README.md @@ -7,7 +7,7 @@ Nice differ for assembly code. Currently supports MIPS, PPC, AArch64, and ARM32; ## Dependencies - Python >= 3.6 -- `python3 -m pip install --user colorama watchdog python-Levenshtein` (also `dataclasses` if on 3.6) +- `python3 -m pip install --user colorama watchdog levenshtein cxxfilt` (also `dataclasses` if on 3.6) ## Usage diff --git a/tools/asm-differ/diff.py b/tools/asm-differ/diff.py index 4b5bc892e..230dbaed7 100755 --- a/tools/asm-differ/diff.py +++ b/tools/asm-differ/diff.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK import argparse +import enum import sys from typing import ( Any, @@ -28,6 +29,14 @@ def static_assert_unreachable(x: NoReturn) -> NoReturn: raise Exception("Unreachable! " + repr(x)) +class DiffMode(enum.Enum): + SINGLE = "single" + SINGLE_BASE = "single_base" + NORMAL = "normal" + THREEWAY_PREV = "3prev" + THREEWAY_BASE = "3base" + + # ==== COMMAND-LINE ==== if __name__ == "__main__": @@ -201,11 +210,11 @@ if __name__ == "__main__": ) parser.add_argument( "-s", - "--stop-jr-ra", - dest="stop_jrra", + "--stop-at-ret", + dest="stop_at_ret", action="store_true", - help="""Stop disassembling at the first 'jr ra'. Some functions have - multiple return points, so use with care!""", + help="""Stop disassembling at the first return instruction. + Some functions have multiple return points, so use with care!""", ) parser.add_argument( "-i", @@ -228,6 +237,13 @@ if __name__ == "__main__": action="store_false", help="Don't visualize branches/branch targets.", ) + parser.add_argument( + "-R", + "--no-show-rodata-refs", + dest="show_rodata_refs", + action="store_false", + help="Don't show .rodata -> .text references (typically from jump tables).", + ) parser.add_argument( "-S", "--base-shift", @@ -248,21 +264,37 @@ if __name__ == "__main__": help="""Automatically update when source/object files change. Recommended in combination with -m.""", ) + parser.add_argument( + "-0", + "--diff_mode=single_base", + dest="diff_mode", + action="store_const", + const=DiffMode.SINGLE_BASE, + help="""View the base asm only (not a diff).""", + ) + parser.add_argument( + "-1", + "--diff_mode=single", + dest="diff_mode", + action="store_const", + const=DiffMode.SINGLE, + help="""View the current asm only (not a diff).""", + ) parser.add_argument( "-3", "--threeway=prev", - dest="threeway", + dest="diff_mode", action="store_const", - const="prev", + const=DiffMode.THREEWAY_PREV, help="""Show a three-way diff between target asm, current asm, and asm prior to -w rebuild. Requires -w.""", ) parser.add_argument( "-b", "--threeway=base", - dest="threeway", + dest="diff_mode", action="store_const", - const="base", + const=DiffMode.THREEWAY_BASE, help="""Show a three-way diff between target asm, current asm, and asm when diff.py was started. Requires -w.""", ) @@ -336,11 +368,9 @@ if __name__ == "__main__": # (We do imports late to optimize auto-complete performance.) import abc -import ast from collections import Counter, defaultdict from dataclasses import asdict, dataclass, field, replace import difflib -import enum import html import itertools import json @@ -357,7 +387,7 @@ import traceback MISSING_PREREQUISITES = ( "Missing prerequisite python module {}. " - "Run `python3 -m pip install --user colorama watchdog python-Levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." + "Run `python3 -m pip install --user colorama watchdog levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." ) try: @@ -376,7 +406,8 @@ class ProjectSettings: objdump_flags: List[str] build_command: List[str] map_format: str - mw_build_dir: str + build_dir: str + ms_map_address_offset: int baseimg: Optional[str] myimg: Optional[str] mapfile: Optional[str] @@ -384,6 +415,8 @@ class ProjectSettings: source_extensions: List[str] show_line_numbers_default: bool disassemble_all: bool + reg_categories: Dict[str, int] + expected_dir: str @dataclass @@ -408,17 +441,19 @@ class Config: # Display options formatter: "Formatter" - threeway: Optional[str] + diff_mode: DiffMode base_shift: int skip_lines: int compress: Optional[Compress] + show_rodata_refs: bool show_branches: bool show_line_numbers: bool show_source: bool - stop_jrra: bool + stop_at_ret: bool ignore_large_imms: bool ignore_addr_diffs: bool algorithm: str + reg_categories: Dict[str, int] # Score options score_stack_differences = True @@ -444,10 +479,13 @@ def create_project_settings(settings: Dict[str, Any]) -> ProjectSettings: ), objdump_executable=get_objdump_executable(settings.get("objdump_executable")), objdump_flags=settings.get("objdump_flags", []), + expected_dir=settings.get("expected_dir", "expected/"), map_format=settings.get("map_format", "gnu"), - mw_build_dir=settings.get("mw_build_dir", "build/"), + ms_map_address_offset=settings.get("ms_map_address_offset", 0), + build_dir=settings.get("build_dir", settings.get("mw_build_dir", "build/")), show_line_numbers_default=settings.get("show_line_numbers_default", True), disassemble_all=settings.get("disassemble_all", False), + reg_categories=settings.get("reg_categories", {}), ) @@ -493,19 +531,21 @@ def create_config(args: argparse.Namespace, project: ProjectSettings) -> Config: max_function_size_bytes=args.max_lines * 4, # Display options formatter=formatter, - threeway=args.threeway, + diff_mode=args.diff_mode or DiffMode.NORMAL, base_shift=eval_int( args.base_shift, "Failed to parse --base-shift (-S) argument as an integer." ), skip_lines=args.skip_lines, compress=compress, + show_rodata_refs=args.show_rodata_refs, show_branches=args.show_branches, show_line_numbers=show_line_numbers, show_source=args.show_source or args.source_old_binutils, - stop_jrra=args.stop_jrra, + stop_at_ret=args.stop_at_ret, ignore_large_imms=args.ignore_large_imms, ignore_addr_diffs=args.ignore_addr_diffs, algorithm=args.algorithm, + reg_categories=project.reg_categories, ) @@ -563,6 +603,7 @@ class BasicFormat(enum.Enum): IMMEDIATE = enum.auto() STACK = enum.auto() REGISTER = enum.auto() + REGISTER_CATEGORY = enum.auto() DELAY_SLOT = enum.auto() DIFF_CHANGE = enum.auto() DIFF_ADD = enum.auto() @@ -662,11 +703,19 @@ class Text: @dataclass -class TableMetadata: +class TableLine: + key: Optional[str] + is_data_ref: bool + cells: Tuple[Tuple[Text, Optional["Line"]], ...] + + +@dataclass +class TableData: headers: Tuple[Text, ...] current_score: int max_score: int previous_score: Optional[int] + lines: List[TableLine] class Formatter(abc.ABC): @@ -676,7 +725,7 @@ class Formatter(abc.ABC): ... @abc.abstractmethod - def table(self, meta: TableMetadata, lines: List[Tuple["OutputLine", ...]]) -> str: + def table(self, data: TableData) -> str: """Format a multi-column table with metadata""" ... @@ -684,8 +733,8 @@ class Formatter(abc.ABC): return "".join(self.apply_format(chunk, f) for chunk, f in text.segments) @staticmethod - def outputline_texts(lines: Tuple["OutputLine", ...]) -> Tuple[Text, ...]: - return tuple([lines[0].base or Text()] + [line.fmt2 for line in lines[1:]]) + def outputline_texts(line: TableLine) -> Tuple[Text, ...]: + return tuple(cell[0] for cell in line.cells) @dataclass @@ -695,8 +744,8 @@ class PlainFormatter(Formatter): def apply_format(self, chunk: str, f: Format) -> str: return chunk - def table(self, meta: TableMetadata, lines: List[Tuple["OutputLine", ...]]) -> str: - rows = [meta.headers] + [self.outputline_texts(ls) for ls in lines] + def table(self, data: TableData) -> str: + rows = [data.headers] + [self.outputline_texts(line) for line in data.lines] return "\n".join( "".join(self.apply(x.ljust(self.column_width)) for x in row) for row in rows ) @@ -709,12 +758,14 @@ class AnsiFormatter(Formatter): STYLE_UNDERLINE = "\x1b[4m" STYLE_NO_UNDERLINE = "\x1b[24m" STYLE_INVERT = "\x1b[7m" + STYLE_RESET = "\x1b[0m" BASIC_ANSI_CODES = { BasicFormat.NONE: "", BasicFormat.IMMEDIATE: Fore.LIGHTBLUE_EX, BasicFormat.STACK: Fore.YELLOW, BasicFormat.REGISTER: Fore.YELLOW, + BasicFormat.REGISTER_CATEGORY: Fore.LIGHTYELLOW_EX, BasicFormat.DELAY_SLOT: Fore.LIGHTBLACK_EX, BasicFormat.DIFF_CHANGE: Fore.LIGHTBLUE_EX, BasicFormat.DIFF_ADD: Fore.GREEN, @@ -761,14 +812,19 @@ class AnsiFormatter(Formatter): static_assert_unreachable(f) return f"{ansi_code}{chunk}{undo_ansi_code}" - def table(self, meta: TableMetadata, lines: List[Tuple["OutputLine", ...]]) -> str: - rows = [(meta.headers, False)] + [ - (self.outputline_texts(line), line[1].is_data_ref) for line in lines + def table(self, data: TableData) -> str: + rows = [(data.headers, False)] + [ + ( + self.outputline_texts(line), + line.is_data_ref, + ) + for line in data.lines ] return "\n".join( "".join( (self.STYLE_INVERT if is_data_ref else "") + self.apply(x.ljust(self.column_width)) + + (self.STYLE_RESET if is_data_ref else "") for x in row ) for (row, is_data_ref) in rows @@ -794,7 +850,7 @@ class HtmlFormatter(Formatter): static_assert_unreachable(f) return f"{chunk}" - def table(self, meta: TableMetadata, lines: List[Tuple["OutputLine", ...]]) -> str: + def table(self, data: TableData) -> str: def table_row(line: Tuple[Text, ...], is_data_ref: bool, cell_el: str) -> str: tr_attrs = " class='data-ref'" if is_data_ref else "" output_row = f" " @@ -806,12 +862,12 @@ class HtmlFormatter(Formatter): output = "\n" output += " \n" - output += table_row(meta.headers, False, "th") + output += table_row(data.headers, False, "th") output += " \n" output += " \n" output += "".join( - table_row(self.outputline_texts(line), line[1].is_data_ref, "td") - for line in lines + table_row(self.outputline_texts(line), line.is_data_ref, "td") + for line in data.lines ) output += " \n" output += "
\n" @@ -826,7 +882,7 @@ class JsonFormatter(Formatter): # This method is unused by this formatter return NotImplemented - def table(self, meta: TableMetadata, rows: List[Tuple["OutputLine", ...]]) -> str: + def table(self, data: TableData) -> str: def serialize_format(s: str, f: Format) -> Dict[str, Any]: if f == BasicFormat.NONE: return {"text": s} @@ -844,29 +900,25 @@ class JsonFormatter(Formatter): return [] return [serialize_format(s, f) for s, f in text.segments] - is_threeway = len(meta.headers) == 3 - output: Dict[str, Any] = {} output["arch_str"] = self.arch_str output["header"] = { name: serialize(h) - for h, name in zip(meta.headers, ("base", "current", "previous")) + for h, name in zip(data.headers, ("base", "current", "previous")) } - output["current_score"] = meta.current_score - output["max_score"] = meta.max_score - if meta.previous_score is not None: - output["previous_score"] = meta.previous_score + output["current_score"] = data.current_score + output["max_score"] = data.max_score + if data.previous_score is not None: + output["previous_score"] = data.previous_score output_rows: List[Dict[str, Any]] = [] - for row in rows: + for row in data.lines: output_row: Dict[str, Any] = {} - output_row["key"] = row[0].key2 - output_row["is_data_ref"] = row[1].is_data_ref - iters = [ - ("base", row[0].base, row[0].line1), - ("current", row[1].fmt2, row[1].line2), + output_row["key"] = row.key + output_row["is_data_ref"] = row.is_data_ref + iters: List[Tuple[str, Text, Optional[Line]]] = [ + (label, *cell) + for label, cell in zip(("base", "current", "previous"), row.cells) ] - if is_threeway: - iters.append(("previous", row[2].fmt2, row[2].line2)) if all(line is None for _, _, line in iters): # Skip rows that were only for displaying source code continue @@ -935,10 +987,41 @@ def symbol_formatter(group: str, base_index: int) -> FormatFunction: ObjdumpCommand = Tuple[List[str], str, Optional[str]] +# eval_expr adapted from https://stackoverflow.com/a/9558001 + +import ast +import operator as op + +# supported operators +operators: Dict[Type[Union[ast.operator, ast.unaryop]], Any] = { + ast.Add: op.add, + ast.Sub: op.sub, + ast.Mult: op.mul, + ast.Div: op.truediv, + ast.Pow: op.pow, + ast.BitXor: op.xor, + ast.USub: op.neg, +} + + +def eval_expr(expr: str) -> Any: + return eval_(ast.parse(expr, mode="eval").body) + + +def eval_(node: ast.AST) -> Any: + if isinstance(node, ast.Num): # + return node.n + elif isinstance(node, ast.BinOp): # + return operators[type(node.op)](eval_(node.left), eval_(node.right)) + elif isinstance(node, ast.UnaryOp): # e.g., -1 + return operators[type(node.op)](eval_(node.operand)) + else: + raise TypeError(node) + def maybe_eval_int(expr: str) -> Optional[int]: try: - ret = ast.literal_eval(expr) + ret = eval_expr(expr) if not isinstance(ret, int): raise Exception("not an integer") return ret @@ -1056,7 +1139,7 @@ def preprocess_objdump_out( out = out[out.find("\n") + 1 :] out = out.rstrip("\n") - if obj_data: + if obj_data and config.show_rodata_refs: out = ( serialize_rodata_references(parse_elf_rodata_references(obj_data, config)) + out @@ -1065,8 +1148,27 @@ def preprocess_objdump_out( return out +def search_build_objects(objname: str, project: ProjectSettings) -> Optional[str]: + objfiles = [ + os.path.join(dirpath, f) + for dirpath, _, filenames in os.walk(project.build_dir) + for f in filenames + if f == objname + ] + if len(objfiles) > 1: + all_objects = "\n".join(objfiles) + fail( + f"Found multiple objects of the same name {objname} in {project.build_dir}, " + f"cannot determine which to diff against: \n{all_objects}" + ) + if len(objfiles) == 1: + return objfiles[0] + + return None + + def search_map_file( - fn_name: str, project: ProjectSettings, config: Config + fn_name: str, project: ProjectSettings, config: Config, *, for_binary: bool ) -> Tuple[Optional[str], Optional[int]]: if not project.mapfile: fail(f"No map file configured; cannot find function {fn_name}.") @@ -1078,6 +1180,12 @@ def search_map_file( fail(f"Failed to open map file {project.mapfile} for reading.") if project.map_format == "gnu": + if for_binary and "load address" not in contents: + fail( + 'Failed to find "load address" in map file. Maybe you need to add\n' + '"export LANG := C" to your Makefile to avoid localized output?' + ) + lines = contents.split("\n") try: @@ -1093,10 +1201,12 @@ def search_map_file( ram = int(tokens[1], 0) rom = int(tokens[5], 0) ram_to_rom = rom - ram - if line.endswith(" " + fn_name): + if line.endswith(" " + fn_name) or f" {fn_name} = 0x" in line: ram = int(line.split()[0], 0) - if cur_objfile is not None and ram_to_rom is not None: - cands.append((cur_objfile, ram + ram_to_rom)) + if (for_binary and ram_to_rom is not None) or ( + not for_binary and cur_objfile is not None + ): + cands.append((cur_objfile, ram + (ram_to_rom or 0))) last_line = line except Exception as e: traceback.print_exc() @@ -1108,16 +1218,14 @@ def search_map_file( return cands[0] elif project.map_format == "mw": find = re.findall( - re.compile( - # ram elf rom - r" \S+ \S+ (\S+) (\S+) . " - + re.escape(fn_name) - + r"(?: \(entry of " - + re.escape(config.diff_section) - + r"\))? \t" - # object name - + "(\S+)" - ), + # ram elf rom alignment + r" \S+ \S+ (\S+) (\S+) +\S+ " + + re.escape(fn_name) + + r"(?: \(entry of " + + re.escape(config.diff_section) + + r"\))? \t" + # object name + + "(\S+)", contents, ) if len(find) > 1: @@ -1125,27 +1233,56 @@ def search_map_file( if len(find) == 1: rom = int(find[0][1], 16) objname = find[0][2] - # The metrowerks linker map format does not contain the full object path, - # so we must complete it manually. - objfiles = [ - os.path.join(dirpath, f) - for dirpath, _, filenames in os.walk(project.mw_build_dir) - for f in filenames - if f == objname - ] - if len(objfiles) > 1: - all_objects = "\n".join(objfiles) - fail( - f"Found multiple objects of the same name {objname} in {project.mw_build_dir}, " - f"cannot determine which to diff against: \n{all_objects}" - ) - if len(objfiles) == 1: - objfile = objfiles[0] - # TODO Currently the ram-rom conversion only works for diffing ELF - # executables, but it would likely be more convenient to diff DOLs. - # At this time it is recommended to always use -o when running the diff - # script as this mode does not make use of the ram-rom conversion. + objfile = search_build_objects(objname, project) + + # TODO Currently the ram-rom conversion only works for diffing ELF + # executables, but it would likely be more convenient to diff DOLs. + # At this time it is recommended to always use -o when running the diff + # script as this mode does not make use of the ram-rom conversion. + if objfile is not None: return objfile, rom + elif project.map_format == "ms": + load_address_find = re.search( + r"Preferred load address is ([0-9a-f]+)", + contents, + ) + if not load_address_find: + fail(f"Couldn't find module load address in map file.") + load_address = int(load_address_find.group(1), 16) + + diff_segment_find = re.search( + r"([0-9a-f]+):[0-9a-f]+ [0-9a-f]+H " + re.escape(config.diff_section), + contents, + ) + if not diff_segment_find: + fail(f"Couldn't find segment for section in map file.") + diff_segment = diff_segment_find.group(1) + + find = re.findall( + r" (?:" + + re.escape(diff_segment) + + r")\S+\s+(?:" + + re.escape(fn_name) + + r")\s+\S+ ... \S+", + contents, + ) + if len(find) > 1: + fail(f"Found multiple occurrences of function {fn_name} in map file.") + if len(find) == 1: + names_find = re.search(r"(\S+) ... (\S+)", find[0]) + assert names_find is not None + fileofs = ( + int(names_find.group(1), 16) + - load_address + + project.ms_map_address_offset + ) + if for_binary: + return None, fileofs + + objname = names_find.group(2) + objfile = search_build_objects(objname, project) + if objfile is not None: + return objfile, fileofs else: fail(f"Linker map format {project.map_format} unrecognised.") return None, None @@ -1161,6 +1298,8 @@ def parse_elf_rodata_references( SHT_SYMTAB = 2 SHT_REL = 9 SHT_RELA = 4 + R_MIPS_32 = 2 + R_MIPS_GPREL32 = 12 is_32bit = e_ident[4] == 1 is_little_endian = e_ident[5] == 1 @@ -1234,7 +1373,7 @@ def parse_elf_rodata_references( # Skip section_name -> section_name references continue sec_name = sec_names[s.sh_info].decode("latin1") - if sec_name != ".rodata": + if sec_name not in (".rodata", ".late_rodata"): continue sec_base = sections[s.sh_info].sh_offset for i in range(0, s.sh_size, s.sh_entsize): @@ -1259,7 +1398,7 @@ def parse_elf_rodata_references( ) if st_shndx == text_section: if s.sh_type == SHT_REL: - if e_machine == 8 and r_type == 2: # R_MIPS_32 + if e_machine == 8 and r_type in (R_MIPS_32, R_MIPS_GPREL32): (r_addend,) = read("I", sec_base + r_offset) else: continue @@ -1325,7 +1464,7 @@ def dump_objfile( objfile = config.objfile if not objfile: - objfile, _ = search_map_file(start, project, config) + objfile, _ = search_map_file(start, project, config, for_binary=False) if not objfile: fail("Not able to find .o file for function.") @@ -1336,8 +1475,8 @@ def dump_objfile( if not os.path.isfile(objfile): fail(f"Not able to find .o file for function: {objfile} is not a file.") - refobjfile = "expected/" + objfile - if not os.path.isfile(refobjfile): + refobjfile = os.path.join(project.expected_dir, objfile) + if config.diff_mode != DiffMode.SINGLE and not os.path.isfile(refobjfile): fail(f'Please ensure an OK .o file exists at "{refobjfile}".') if project.disassemble_all: @@ -1362,7 +1501,7 @@ def dump_binary( run_make(project.myimg, project) start_addr = maybe_eval_int(start) if start_addr is None: - _, start_addr = search_map_file(start, project, config) + _, start_addr = search_map_file(start, project, config, for_binary=True) if start_addr is None: fail("Not able to find function in map file.") if end is not None: @@ -1391,8 +1530,13 @@ class AsmProcessor: def __init__(self, config: Config) -> None: self.config = config - def process_reloc(self, row: str, prev: str) -> str: - return prev + def pre_process( + self, mnemonic: str, args: str, next_row: Optional[str] + ) -> Tuple[str, str]: + return mnemonic, args + + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: + return prev, None def normalize(self, mnemonic: str, row: str) -> str: """This should be called exactly once for each line.""" @@ -1408,28 +1552,24 @@ class AsmProcessor: def post_process(self, lines: List["Line"]) -> None: return + def is_end_of_function(self, mnemonic: str, args: str) -> bool: + return False + class AsmProcessorMIPS(AsmProcessor): - def process_reloc(self, row: str, prev: str) -> str: + def __init__(self, config: Config) -> None: + super().__init__(config) + self.seen_jr_ra = False + + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: arch = self.config.arch if "R_MIPS_NONE" in row or "R_MIPS_JALR" in row: # GNU as emits no-op relocations immediately after real ones when # assembling with -mabi=64. Return without trying to parse 'imm' as an # integer. - return prev + return prev, None before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - if imm != "0": - # MIPS uses relocations with addends embedded in the code as immediates. - # If there is an immediate, show it as part of the relocation. Ideally - # we'd show this addend in both %lo/%hi, but annoyingly objdump's output - # doesn't include enough information to pair up %lo's and %hi's... - # TODO: handle unambiguous cases where all addends for a symbol are the - # same, or show "+???". - mnemonic = prev.split()[0] - if mnemonic in arch.instructions_with_address_immediates: - imm = hex(int(imm, 16)) - repl += ("" if imm.startswith("-") else "+") + imm + repl = row.split()[-1] + reloc_addend_from_imm(imm, before, self.config.arch) if "R_MIPS_LO16" in row: repl = f"%lo({repl})" elif "R_MIPS_HI16" in row: @@ -1452,20 +1592,57 @@ class AsmProcessorMIPS(AsmProcessor): repl = f"%call16({repl})" else: assert False, f"unknown relocation type '{row}' for line '{prev}'" - return before + repl + after + return before + repl + after, repl + + def is_end_of_function(self, mnemonic: str, args: str) -> bool: + if self.seen_jr_ra: + return True + if mnemonic == "jr" and args == "ra": + self.seen_jr_ra = True + return False class AsmProcessorPPC(AsmProcessor): - def process_reloc(self, row: str, prev: str) -> str: + def pre_process( + self, mnemonic: str, args: str, next_row: Optional[str] + ) -> Tuple[str, str]: + + if next_row and "R_PPC_EMB_SDA21" in next_row: + # With sda21 relocs, the linker transforms `r0` into `r2`/`r13`, and + # we may encounter this in either pre-transformed or post-transformed + # versions depending on if the .o file comes from compiler output or + # from disassembly. Normalize, to make sure both forms are treated as + # equivalent. + + args = args.replace("(r2)", "(0)") + args = args.replace("(r13)", "(0)") + args = args.replace(",r2,", ",0,") + args = args.replace(",r13,", ",0,") + + # We want to convert li and lis with an sda21 reloc, + # because the r0 to r2/r13 transformation results in + # turning an li/lis into an addi/addis with r2/r13 arg + # our preprocessing normalizes all versions to addi with a 0 arg + if mnemonic in {"li", "lis"}: + mnemonic = mnemonic.replace("li", "addi") + args_parts = args.split(",") + args = args_parts[0] + ",0," + args_parts[1] + + return mnemonic, args + + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: arch = self.config.arch assert any( - r in row for r in ["R_PPC_REL24", "R_PPC_ADDR16", "R_PPC_EMB_SDA21"] + r in row + for r in ["R_PPC_REL24", "R_PPC_ADDR16", "R_PPC_EMB_SDA21", "R_PPC_REL14"] ), f"unknown relocation type '{row}' for line '{prev}'" before, imm, after = parse_relocated_line(prev) repl = row.split()[-1] if "R_PPC_REL24" in row: # function calls pass + if "R_PPC_REL14" in row: + pass elif "R_PPC_ADDR16_HI" in row: # absolute hi of addr repl = f"{repl}@h" @@ -1483,17 +1660,30 @@ class AsmProcessorPPC(AsmProcessor): if int(repl.split("+")[1], 16) > 0x70000000: repl = repl.split("+")[0] elif "R_PPC_EMB_SDA21" in row: - # small data area - pass - return before + repl + after + # sda21 relocations; r2/r13 --> 0 swaps are performed in pre_process + repl = f"{repl}@sda21" + + return before + repl + after, repl + + def is_end_of_function(self, mnemonic: str, args: str) -> bool: + return mnemonic == "blr" class AsmProcessorARM32(AsmProcessor): - def process_reloc(self, row: str, prev: str) -> str: + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: arch = self.config.arch + if "R_ARM_V4BX" in row: + # R_ARM_V4BX converts "bx " to "mov pc," for some targets. + # Ignore for now. + return prev, None + if "R_ARM_ABS32" in row and not prev.startswith(".word"): + # Don't crash on R_ARM_ABS32 relocations incorrectly applied to code. + # (We may want to do something more fancy here that actually shows the + # related symbol, but this serves as a stop-gap.) + return prev, None before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - return before + repl + after + repl = row.split()[-1] + reloc_addend_from_imm(imm, before, self.config.arch) + return before + repl + after, repl def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: if self.config.ignore_addr_diffs: @@ -1577,6 +1767,51 @@ class AsmProcessorAArch64(AsmProcessor): return row +class AsmProcessorI686(AsmProcessor): + def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: + repl = row.split()[-1] + mnemonic, args = prev.split(maxsplit=1) + + addr_imm = re.search(r"(? bool: + return mnemonic == "ret" + + @dataclass class ArchSettings: name: str @@ -1701,6 +1936,76 @@ PPC_BRANCH_INSTRUCTIONS = { "bgt-", } +I686_BRANCH_INSTRUCTIONS = { + "call", + "jmp", + "ljmp", + "ja", + "jae", + "jb", + "jbe", + "jc", + "jcxz", + "jecxz", + "jrcxz", + "je", + "jg", + "jge", + "jl", + "jle", + "jna", + "jnae", + "jnb", + "jnbe", + "jnc", + "jne", + "jng", + "jnge", + "jnl", + "jnle", + "jno", + "jnp", + "jns", + "jnz", + "jo", + "jp", + "jpe", + "jpo", + "js", + "jz", + "ja", + "jae", + "jb", + "jbe", + "jc", + "je", + "jz", + "jg", + "jge", + "jl", + "jle", + "jna", + "jnae", + "jnb", + "jnbe", + "jnc", + "jne", + "jng", + "jnge", + "jnl", + "jnle", + "jno", + "jnp", + "jns", + "jnz", + "jo", + "jp", + "jpe", + "jpo", + "js", + "jz", +} + MIPS_SETTINGS = ArchSettings( name="mips", re_int=re.compile(r"[0-9]+"), @@ -1713,18 +2018,26 @@ MIPS_SETTINGS = ArchSettings( re_reg=re.compile(r"\$?\b([astv][0-9]|at|f[astv]?[0-9]+f?|kt?[01]|fp|ra|zero)\b"), re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"), re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)"), + re_imm=re.compile( + r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi|got|gp_rel|call16)\([^)]*\)" + ), re_reloc=re.compile(r"R_MIPS_"), arch_flags=["-m", "mips:4300"], branch_likely_instructions=MIPS_BRANCH_LIKELY_INSTRUCTIONS, branch_instructions=MIPS_BRANCH_INSTRUCTIONS, - instructions_with_address_immediates=MIPS_BRANCH_INSTRUCTIONS.union({"jal", "j"}), + instructions_with_address_immediates=MIPS_BRANCH_INSTRUCTIONS.union({"j", "jal"}), delay_slot_instructions=MIPS_BRANCH_INSTRUCTIONS.union({"j", "jal", "jr", "jalr"}), proc=AsmProcessorMIPS, ) MIPSEL_SETTINGS = replace(MIPS_SETTINGS, name="mipsel", big_endian=False) +MIPSEE_SETTINGS = replace( + MIPSEL_SETTINGS, name="mipsee", arch_flags=["-m", "mips:5900"] +) + +MIPS_ARCH_NAMES = {"mips", "mipsel", "mipsee"} + ARM32_SETTINGS = ArchSettings( name="arm32", re_int=re.compile(r"[0-9]+"), @@ -1773,23 +2086,56 @@ PPC_SETTINGS = ArchSettings( name="ppc", re_int=re.compile(r"[0-9]+"), re_comment=re.compile(r"(<.*>|//.*$)"), - re_reg=re.compile(r"\$?\b([rf][0-9]+)\b"), + # r1 not included + re_reg=re.compile(r"\$?\b([rf](?:[02-9]|[1-9][0-9]+)|f1)\b"), re_sprel=re.compile(r"(?<=,)(-?[0-9]+|-?0x[0-9a-f]+)\(r1\)"), re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(r1)|[^@]*@(ha|h|lo)"), + re_imm=re.compile( + r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(r1)|[^ \t,]+@(l|ha|h|sda21)" + ), re_reloc=re.compile(r"R_PPC_"), + arch_flags=["-m", "powerpc", "-M", "broadway"], branch_instructions=PPC_BRANCH_INSTRUCTIONS, instructions_with_address_immediates=PPC_BRANCH_INSTRUCTIONS.union({"bl"}), proc=AsmProcessorPPC, ) +I686_SETTINGS = ArchSettings( + name="i686", + re_int=re.compile(r"[0-9]+"), + re_comment=re.compile(r"<.*>"), + # Includes: + # - (e)a-d(x,l,h) + # - (e)s,d,b(i,p)(l) + # - cr0-7 + # - x87 st + # - MMX, SSE vector registers + # - cursed registers: eal ebl ebh edl edh... + re_reg=re.compile( + r"\%?\b(e?(([sd]i|[sb]p)l?|[abcd][xhl])|[cdesfg]s|cr[0-7]|x?mm[0-7]|st)\b" + ), + re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), + re_sprel=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)(?=\((%ebp|%esi)\))"), + re_imm=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)"), + re_reloc=re.compile(r"R_386_"), + # The x86 architecture has a variable instruction length. The raw bytes of + # an instruction as displayed by objdump can line wrap if it's long enough. + # This destroys the objdump output processor logic, so we avoid this. + arch_flags=["-m", "i386", "--no-show-raw-insn"], + branch_instructions=I686_BRANCH_INSTRUCTIONS, + instructions_with_address_immediates=I686_BRANCH_INSTRUCTIONS.union({"mov"}), + proc=AsmProcessorI686, +) + ARCH_SETTINGS = [ MIPS_SETTINGS, MIPSEL_SETTINGS, + MIPSEE_SETTINGS, ARM32_SETTINGS, ARMEL_SETTINGS, AARCH64_SETTINGS, PPC_SETTINGS, + I686_SETTINGS, ] @@ -1822,11 +2168,31 @@ def parse_relocated_line(line: str) -> Tuple[str, str, str]: imm, after = after, "" else: imm, after = after[:ind2], after[ind2:] - if imm == "0x0": - imm = "0" return before, imm, after +def reloc_addend_from_imm(imm: str, before: str, arch: ArchSettings) -> str: + """For architectures like MIPS where relocations have addends embedded in + the code as immediates, convert such an immediate into an addition/ + subtraction that can occur just after the symbol.""" + # TODO this is incorrect for MIPS %lo/%hi which need to be paired up + # and combined. In practice, this means we only get symbol offsets within + # %lo, while %hi just shows the symbol. Unfortunately, objdump's output + # loses relocation order, so we cannot do this without parsing ELF relocs + # ourselves... + mnemonic = before.split()[0] + if mnemonic in arch.instructions_with_address_immediates: + addend = int(imm, 16) + else: + addend = int(imm, 0) + if addend == 0: + return "" + elif addend < 0: + return hex(addend) + else: + return "+" + hex(addend) + + def pad_mnemonic(line: str) -> str: if "\t" not in line: return line @@ -1841,6 +2207,7 @@ class Line: original: str normalized_original: str scorable_line: str + symbol: Optional[str] = None line_num: Optional[int] = None branch_target: Optional[int] = None data_pool_addr: Optional[int] = None @@ -1896,10 +2263,8 @@ def process(dump: str, config: Config) -> List[Line]: if not re.match(r"^\s+[0-9a-f]+:\s+", row): # This regex is conservative, and assumes the file path does not contain "weird" - # characters like colons, tabs, or angle brackets. - if re.match( - r"^[^ \t<>:][^\t<>:]*:[0-9]+( \(discriminator [0-9]+\))?$", row - ): + # characters like tabs or angle brackets. + if re.match(r"^[^ \t<>][^\t<>]*:[0-9]+( \(discriminator [0-9]+\))?$", row): source_filename, _, tail = row.rpartition(":") source_line_num = int(tail.partition(" ")[0]) source_lines.append(row) @@ -1919,9 +2284,14 @@ def process(dump: str, config: Config) -> List[Line]: line_num_str = row.split(":")[0] row = row.rstrip() tabs = row.split("\t") - row = "\t".join(tabs[2:]) line_num = eval_line_num(line_num_str.strip()) + # TODO: use --no-show-raw-insn for all arches + if arch.name == "i686": + row = "\t".join(tabs[1:]) + else: + row = "\t".join(tabs[2:]) + if line_num in data_refs: refs = data_refs[line_num] ref_str = "; ".join( @@ -1943,7 +2313,13 @@ def process(dump: str, config: Config) -> List[Line]: else: # powerpc-eabi-objdump doesn't use tabs row_parts = [part.lstrip() for part in row.split(" ", 1)] + mnemonic = row_parts[0].strip() + args = row_parts[1].strip() if len(row_parts) >= 2 else "" + + next_line = lines[i] if i < len(lines) else None + mnemonic, args = processor.pre_process(mnemonic, args, next_line) + row = mnemonic + "\t" + args.replace("\t", " ") addr = "" if mnemonic in arch.instructions_with_address_immediates: @@ -1960,14 +2336,28 @@ def process(dump: str, config: Config) -> List[Line]: # immediates. original = row + symbol = None while i < len(lines): reloc_row = lines[i] if re.search(arch.re_reloc, reloc_row): - original = processor.process_reloc(reloc_row, original) + original, reloc_symbol = processor.process_reloc(reloc_row, original) + if reloc_symbol is not None: + symbol = reloc_symbol else: break i += 1 + is_text_relative_j = False + if ( + arch.name in MIPS_ARCH_NAMES + and mnemonic == "j" + and symbol is not None + and symbol.startswith(".text") + ): + symbol = None + original = row + is_text_relative_j = True + normalized_original = processor.normalize(mnemonic, original) scorable_line = normalized_original @@ -1993,8 +2383,16 @@ def process(dump: str, config: Config) -> List[Line]: row = normalize_imms(row, arch) branch_target = None - if mnemonic in arch.branch_instructions: - branch_target = int(row_parts[1].strip().split(",")[-1], 16) + if ( + mnemonic in arch.branch_instructions or is_text_relative_j + ) and symbol is None: + x86_longjmp = re.search(r"\*(.*)\(", args) + if x86_longjmp: + capture = x86_longjmp.group(1) + if capture != "": + branch_target = int(capture, 16) + else: + branch_target = int(args.split(",")[-1], 16) output.append( Line( @@ -2003,6 +2401,7 @@ def process(dump: str, config: Config) -> List[Line]: original=original, normalized_original=normalized_original, scorable_line=scorable_line, + symbol=symbol, line_num=line_num, branch_target=branch_target, data_pool_addr=data_pool_addr, @@ -2015,9 +2414,7 @@ def process(dump: str, config: Config) -> List[Line]: num_instr += 1 source_lines = [] - if config.stop_jrra and mnemonic == "jr" and row_parts[1].strip() == "ra": - stop_after_delay_slot = True - elif stop_after_delay_slot: + if config.stop_at_ret and processor.is_end_of_function(mnemonic, args): break processor.post_process(output) @@ -2032,9 +2429,44 @@ def normalize_stack(row: str, arch: ArchSettings) -> str: return re.sub(arch.re_sprel, "addr(sp)", row) -def imm_matches_everything(row: str, arch: ArchSettings) -> bool: - # (this should probably be arch-specific) - return "(." in row +def check_for_symbol_mismatch( + old_line: Line, new_line: Line, symbol_map: Dict[str, str] +) -> bool: + + assert old_line.symbol is not None + assert new_line.symbol is not None + + if new_line.symbol.startswith("%hi"): + return False + + if old_line.symbol not in symbol_map: + symbol_map[old_line.symbol] = new_line.symbol + return False + elif symbol_map[old_line.symbol] == new_line.symbol: + return False + + return True + + +def field_matches_any_symbol(field: str, arch: ArchSettings) -> bool: + if arch.name == "ppc": + if "..." in field: + return True + + parts = field.rsplit("@", 1) + if len(parts) == 2 and parts[1] in {"l", "h", "ha", "sda21"}: + field = parts[0] + + return re.fullmatch((r"^@\d+$"), field) is not None + + if arch.name in MIPS_ARCH_NAMES: + return "." in field + + # Example: ".text+0x34" + if arch.name == "arm32": + return "." in field + + return False def split_off_address(line: str) -> Tuple[str, str]: @@ -2058,15 +2490,10 @@ def diff_sequences_difflib( def diff_sequences( seq1: List[str], seq2: List[str], algorithm: str ) -> List[Tuple[str, int, int, int, int]]: - if ( - algorithm != "levenshtein" - or len(seq1) * len(seq2) > 4 * 10**8 - or len(seq1) + len(seq2) >= 0x110000 - ): + if algorithm != "levenshtein": return diff_sequences_difflib(seq1, seq2) # The Levenshtein library assumes that we compare strings, not lists. Convert. - # (Per the check above we know we have fewer than 0x110000 unique elements, so chr() works.) remapping: Dict[str, str] = {} def remap(seq: List[str]) -> str: @@ -2079,8 +2506,16 @@ def diff_sequences( seq[i] = val return "".join(seq) - rem1 = remap(seq1) - rem2 = remap(seq2) + try: + rem1 = remap(seq1) + rem2 = remap(seq2) + except ValueError as e: + if len(seq1) + len(seq2) < 0x110000: + raise + # If there are too many unique elements, chr() doesn't work. + # Assume this is the case and fall back to difflib. + return diff_sequences_difflib(seq1, seq2) + import Levenshtein ret: List[Tuple[str, int, int, int, int]] = Levenshtein.opcodes(rem1, rem2) @@ -2113,69 +2548,80 @@ def diff_lines( return ret +def diff_sameline( + old_line: Line, new_line: Line, config: Config, symbol_map: Dict[str, str] +) -> Tuple[int, int, bool]: + + old = old_line.scorable_line + new = new_line.scorable_line + if old == new: + return (0, 0, False) + + num_stack_penalties = 0 + num_regalloc_penalties = 0 + has_symbol_mismatch = False + + ignore_last_field = False + if config.score_stack_differences: + oldsp = re.search(config.arch.re_sprel, old) + newsp = re.search(config.arch.re_sprel, new) + if oldsp and newsp: + oldrel = int(oldsp.group(1) or "0", 0) + newrel = int(newsp.group(1) or "0", 0) + num_stack_penalties += abs(oldrel - newrel) + ignore_last_field = True + + # Probably regalloc difference, or signed vs unsigned + + # Compare each field in order + new_parts, old_parts = new.split(None, 1), old.split(None, 1) + newfields, oldfields = new_parts[1].split(","), old_parts[1].split(",") + if ignore_last_field: + newfields = newfields[:-1] + oldfields = oldfields[:-1] + else: + # If the last field has a parenthesis suffix, e.g. "0x38(r7)" + # we split that part out to make it a separate field + # however, we don't split if it has a proceeding % macro, e.g. "%lo(.data)" + re_paren = re.compile(r"(? int: # This logic is copied from `scorer.py` from the decomp permuter project # https://github.com/simonlindholm/decomp-permuter/blob/main/src/scorer.py - score = 0 + num_stack_penalties = 0 + num_regalloc_penalties = 0 + num_reordering_penalties = 0 + num_insertion_penalties = 0 + num_deletion_penalties = 0 deletions = [] insertions = [] - def lo_hi_match(old: str, new: str) -> bool: - # TODO: Make this arch-independent, like `imm_matches_everything()` - old_lo = old.find("%lo") - old_hi = old.find("%hi") - new_lo = new.find("%lo") - new_hi = new.find("%hi") - - if old_lo != -1 and new_lo != -1: - old_idx = old_lo - new_idx = new_lo - elif old_hi != -1 and new_hi != -1: - old_idx = old_hi - new_idx = new_hi - else: - return False - - if old[:old_idx] != new[:new_idx]: - return False - - old_inner = old[old_idx + 4 : -1] - new_inner = new[new_idx + 4 : -1] - return old_inner.startswith(".") or new_inner.startswith(".") - - def diff_sameline(old: str, new: str) -> None: - nonlocal score - if old == new: - return - - if lo_hi_match(old, new): - return - - ignore_last_field = False - if config.score_stack_differences: - oldsp = re.search(config.arch.re_sprel, old) - newsp = re.search(config.arch.re_sprel, new) - if oldsp and newsp: - oldrel = int(oldsp.group(1) or "0", 0) - newrel = int(newsp.group(1) or "0", 0) - score += abs(oldrel - newrel) * config.penalty_stackdiff - ignore_last_field = True - - # Probably regalloc difference, or signed vs unsigned - - # Compare each field in order - newfields, oldfields = new.split(","), old.split(",") - if ignore_last_field: - newfields = newfields[:-1] - oldfields = oldfields[:-1] - for nf, of in zip(newfields, oldfields): - if nf != of: - score += config.penalty_regalloc - # Penalize any extra fields - score += abs(len(newfields) - len(oldfields)) * config.penalty_regalloc - def diff_insert(line: str) -> None: # Reordering or totally different codegen. # Defer this until later when we can tell. @@ -2205,7 +2651,9 @@ def score_diff_lines( if max_index is not None and index > max_index: break if line1 and line2 and line1.mnemonic == line2.mnemonic: - diff_sameline(line1.scorable_line, line2.scorable_line) + sp, rp, _ = diff_sameline(line1, line2, config, symbol_map) + num_stack_penalties += sp + num_regalloc_penalties += rp else: if line1: diff_delete(line1.scorable_line) @@ -2218,13 +2666,17 @@ def score_diff_lines( ins = insertions_co[item] dels = deletions_co[item] common = min(ins, dels) - score += ( - (ins - common) * config.penalty_insertion - + (dels - common) * config.penalty_deletion - + config.penalty_reordering * common - ) + num_insertion_penalties += ins - common + num_deletion_penalties += dels - common + num_reordering_penalties += common - return score + return ( + num_stack_penalties * config.penalty_stackdiff + + num_regalloc_penalties * config.penalty_regalloc + + num_reordering_penalties * config.penalty_reordering + + num_insertion_penalties * config.penalty_insertion + + num_deletion_penalties * config.penalty_deletion + ) @dataclass(frozen=True) @@ -2262,6 +2714,7 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: arch = config.arch fmt = config.formatter output: List[OutputLine] = [] + symbol_map: Dict[str, str] = {} sc1 = symbol_formatter("base-reg", 0) sc2 = symbol_formatter("my-reg", 0) @@ -2287,7 +2740,6 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: lines2 = trim_nops(lines2, arch) diffed_lines = diff_lines(lines1, lines2, config.algorithm) - max_score = len(lines1) * config.penalty_deletion line_num_base = -1 line_num_offset = 0 @@ -2372,7 +2824,17 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: if normalize_imms(branchless1, arch) == normalize_imms( branchless2, arch ): - if imm_matches_everything(branchless2, arch): + ( + stack_penalties, + regalloc_penalties, + has_symbol_mismatch, + ) = diff_sameline(line1, line2, config, symbol_map) + + if ( + regalloc_penalties == 0 + and stack_penalties == 0 + and not has_symbol_mismatch + ): # ignore differences due to %lo(.rodata + ...) vs symbol out1 = out1.reformat(BasicFormat.NONE) out2 = out2.reformat(BasicFormat.NONE) @@ -2397,8 +2859,19 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: else: # reg differences and maybe imm as well out1, out2 = format_fields(arch.re_reg, out1, out2, sc1, sc2) - line_color1 = line_color2 = sym_color = BasicFormat.REGISTER - line_prefix = "r" + cats = config.reg_categories + if cats and any( + cats.get(of.group()) != cats.get(nf.group()) + for (of, nf) in zip( + out1.finditer(arch.re_reg), out2.finditer(arch.re_reg) + ) + ): + sym_color = BasicFormat.REGISTER_CATEGORY + line_prefix = "R" + else: + sym_color = BasicFormat.REGISTER + line_prefix = "r" + line_color1 = line_color2 = sym_color if same_target: address_imm_fmt = BasicFormat.NONE @@ -2523,8 +2996,10 @@ def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: ) ) - score = score_diff_lines(diffed_lines, config) output = output[config.skip_lines :] + + score = score_diff_lines(diffed_lines, config, symbol_map) + max_score = len(lines1) * config.penalty_deletion return Diff(lines=output, score=score, max_score=max_score) @@ -2586,24 +3061,12 @@ def compress_matching( return ret -def align_diffs( - old_diff: Diff, new_diff: Diff, config: Config -) -> Tuple[TableMetadata, List[Tuple[OutputLine, ...]]]: - meta: TableMetadata +def align_diffs(old_diff: Diff, new_diff: Diff, config: Config) -> TableData: + headers: Tuple[Text, ...] diff_lines: List[Tuple[OutputLine, ...]] padding = " " * 7 if config.show_line_numbers else " " * 2 - if config.threeway: - meta = TableMetadata( - headers=( - Text("TARGET"), - Text(f"{padding}CURRENT ({new_diff.score})"), - Text(f"{padding}PREVIOUS ({old_diff.score})"), - ), - current_score=new_diff.score, - max_score=new_diff.max_score, - previous_score=old_diff.score, - ) + if config.diff_mode in (DiffMode.THREEWAY_PREV, DiffMode.THREEWAY_BASE): old_chunks = chunk_diff_lines(old_diff.lines) new_chunks = chunk_diff_lines(new_diff.lines) diff_lines = [] @@ -2638,20 +3101,54 @@ def align_diffs( diff_lines = [ (base, new, old if old != new else empty) for base, new, old in diff_lines ] - else: - meta = TableMetadata( - headers=( - Text("TARGET"), - Text(f"{padding}CURRENT ({new_diff.score})"), - ), - current_score=new_diff.score, - max_score=new_diff.max_score, - previous_score=None, + headers = ( + Text("TARGET"), + Text(f"{padding}CURRENT ({new_diff.score})"), + Text(f"{padding}PREVIOUS ({old_diff.score})"), ) + current_score = new_diff.score + max_score = new_diff.max_score + previous_score = old_diff.score + elif config.diff_mode in (DiffMode.SINGLE, DiffMode.SINGLE_BASE): + header = Text("BASE" if config.diff_mode == DiffMode.SINGLE_BASE else "CURRENT") + diff_lines = [(line,) for line in new_diff.lines] + headers = (header,) + # Scoring is disabled for view mode + current_score = 0 + max_score = 0 + previous_score = None + else: diff_lines = [(line, line) for line in new_diff.lines] + headers = ( + Text("TARGET"), + Text(f"{padding}CURRENT ({new_diff.score})"), + ) + current_score = new_diff.score + max_score = new_diff.max_score + previous_score = None if config.compress: diff_lines = compress_matching(diff_lines, config.compress.context) - return meta, diff_lines + + def diff_line_to_table_line(line: Tuple[OutputLine, ...]) -> TableLine: + cells = [ + (line[0].base or Text(), line[0].line1) + ] + for ol in line[1:]: + cells.append((ol.fmt2, ol.line2)) + + return TableLine( + key=line[0].key2, + is_data_ref=line[0].is_data_ref, + cells=tuple(cells), + ) + + return TableData( + headers=headers, + current_score=current_score, + max_score=max_score, + previous_score=previous_score, + lines=[diff_line_to_table_line(line) for line in diff_lines], + ) def debounced_fs_watch( @@ -2754,17 +3251,26 @@ class Display: return (self.emsg, self.emsg) my_lines = process(self.mydump, self.config) - diff_output = do_diff(self.base_lines, my_lines, self.config) + + if self.config.diff_mode == DiffMode.SINGLE_BASE: + diff_output = do_diff(self.base_lines, self.base_lines, self.config) + elif self.config.diff_mode == DiffMode.SINGLE: + diff_output = do_diff(my_lines, my_lines, self.config) + else: + diff_output = do_diff(self.base_lines, my_lines, self.config) + last_diff_output = self.last_diff_output or diff_output - if self.config.threeway != "base" or not self.last_diff_output: + if self.config.diff_mode != DiffMode.THREEWAY_BASE or not self.last_diff_output: self.last_diff_output = diff_output - meta, diff_lines = align_diffs(last_diff_output, diff_output, self.config) - output = self.config.formatter.table(meta, diff_lines) + data = align_diffs(last_diff_output, diff_output, self.config) + output = self.config.formatter.table(data) + refresh_key = ( [line.key2 for line in diff_output.lines], diff_output.score, ) + return (output, refresh_key) def run_less( @@ -2882,7 +3388,10 @@ def main() -> None: except ModuleNotFoundError as e: fail(MISSING_PREREQUISITES.format(e.name)) - if config.threeway and not args.watch: + if ( + config.diff_mode in (DiffMode.THREEWAY_BASE, DiffMode.THREEWAY_PREV) + and not args.watch + ): fail("Threeway diffing requires -w.") if args.diff_elf_symbol: @@ -2910,8 +3419,10 @@ def main() -> None: if args.base_asm is not None: with open(args.base_asm) as f: basedump = f.read() - else: + elif config.diff_mode != DiffMode.SINGLE: basedump = run_objdump(basecmd, config, project) + else: + basedump = "" mydump = run_objdump(mycmd, config, project) diff --git a/tools/asm-differ/diff_settings.py b/tools/asm-differ/diff_settings.py index 183b96b75..19d67d548 100644 --- a/tools/asm-differ/diff_settings.py +++ b/tools/asm-differ/diff_settings.py @@ -5,7 +5,8 @@ def apply(config, args): config["source_directories"] = ["."] # config["show_line_numbers_default"] = True # config["arch"] = "mips" - # config["map_format"] = "gnu" # gnu or mw - # config["mw_build_dir"] = "build/" # only needed for mw map format + # config["map_format"] = "gnu" # gnu, mw, ms + # config["build_dir"] = "build/" # only needed for mw and ms map format + # config["expected_dir"] = "expected/" # needed for -o # config["makeflags"] = [] # config["objdump_executable"] = "" diff --git a/tools/asm-differ/pyproject.toml b/tools/asm-differ/pyproject.toml new file mode 100644 index 000000000..7a112aee5 --- /dev/null +++ b/tools/asm-differ/pyproject.toml @@ -0,0 +1,21 @@ +[tool.poetry] +name = "asm-differ" +version = "0.1.0" +description = "" +authors = ["Simon Lindholm "] +license = "UNLICENSE" +readme = "README.md" +packages = [{ include = "diff.py" }] + +[tool.poetry.dependencies] +python = "^3.7" +colorama = "^0.4.6" +ansiwrap = "^0.8.4" +watchdog = "^2.2.0" +levenshtein = "^0.20.9" +cxxfilt = "^0.3.0" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/tools/asm-processor/.gitignore b/tools/asm-processor/.gitignore new file mode 100644 index 000000000..cc5bba4b5 --- /dev/null +++ b/tools/asm-processor/.gitignore @@ -0,0 +1,2 @@ +*.o +*.py[cod] diff --git a/tools/asm-processor/.gitrepo b/tools/asm-processor/.gitrepo new file mode 100644 index 000000000..e9ee1dd74 --- /dev/null +++ b/tools/asm-processor/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = git@github.com:simonlindholm/asm-processor.git + branch = main + commit = bbd86ea1faf84e6a7a0e101ab8068a00a3dfb2fc + parent = 8985197b6da23db874ac6e8a29ddec5636944bba + method = merge + cmdver = 0.4.3 diff --git a/tools/asm-processor/LICENSE b/tools/asm-processor/LICENSE new file mode 100644 index 000000000..cf1ab25da --- /dev/null +++ b/tools/asm-processor/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/tools/asm-processor/README.md b/tools/asm-processor/README.md new file mode 100644 index 000000000..009147c06 --- /dev/null +++ b/tools/asm-processor/README.md @@ -0,0 +1,112 @@ +# asm-processor + +Pre-process .c files and post-process .o files to enable embedding MIPS assembly into IDO-compiled C. + +## Usage + +Let's say you have a file compiled with `-g` on the IDO compiler, that looks like this: +```c +float func4(void) { + "func4"; + return 0.2f; +} +``` + +This script enables replacing it by: +```asm +GLOBAL_ASM( +.rdata +.word 0x66756e63 # func +.word 0x34000000 # 4\0\0\0 + +.late_rodata +glabel rv +.word 0x3e4ccccd # 0.2f + +.text +glabel func4 +lui $at, %hi(rv) +jr $ra +lwc1 $f0, %lo(rv)($at) +jr $ra +nop +jr $ra +nop +) +``` + +To compile the file, run `python3 build.py $CC -- $AS $ASFLAGS -- $CFLAGS -o out.o in.c`, where $CC points to an IDO binary (5.3/7.1 and recomp/qemu all supported), $AS is e.g. `mips-linux-gnu-as`, $ASFLAGS e.g. `-march=vr4300 -mabi=32` and $CFLAGS e.g. `-Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -g`. build.py may be customized as needed. + +In addition to an .o file, build.py also generates a .d file with Makefile dependencies for .s files referenced by the input .c file. +This functionality may be removed if not needed. + +Reading assembly from file is also supported, by either `GLOBAL_ASM("file.s")` or `#pragma GLOBAL_ASM("file.s")`. + +### What is supported? + +`.text`, `.data`, `.bss` and `.rodata` sections, `.word`/`.incbin`, `.ascii`/`.asciz`, and `-g`, `-g3`, `-O1`, `-O2`, `-framepointer` and `-mips1`/`-mips2` flags to the IDO compiler. + +### What is not supported? + +* complicated assembly (.ifdef, macro declarations/calls other than `glabel`, pseudo-instructions that expand to several real instructions) +* non-IDO compilers +* `-O3` (due to function reordering) + +C `#ifdef`s only work outside of `GLOBAL_ASM` calls, but is otherwise able to replace `.ifdef`. + +### What's up with "late rodata"? + +The IDO compiler emits rodata in two passes: first array/string contents, then large literals/switch jump tables. + +Data declared within `.rdata`/`.section .rodata` will end up in the first half, and `.late_rodata`/`.section .late_rodata` in the second half. + +### How does it work? + +It's a bit of a hack! +The basic idea is replace `GLOBAL_ASM` blocks with dummy C functions/global vars of the same sections sizes as the assembly. +Then the C file gets compiled, and the dummy contents overwritten with the injected assembly. + +To accomplish this, asm-processor has logic for guessing the size of assembly contents +(which assumes the assembly isn't too complicated, e.g. no macros), +and for emitting C code of exact sizes for a bunch of different IDO compiler flags. + +The assembler code is padded with nops to line it up with its correct position in the C; +this allows C and asm ELF files to be merged easily without having to fix up e.g. symbol addresses. + +The most difficult part is `late_rodata`, which is hard to create programmatically. +asm-processor does that by emitting code that uses dummy float literals/double literals/jump tables, +assembles the late_rodata at another location of the .rodata section, then overwrites the dummy rodata. +This does require some movement of symbols and relocations, and quite a bit of care in what code to +emit and how to preserve .double alignment. + +It's worth noting some alternative ways in which asm-processor would have been implemented: +- One idea to get rid of the C/asm size estimations is to emit arbitrary code, and then move code, +symbols and relocations to the correct place after the sizes are known. +Given the machinery for `late_rodata` this wouldn't have been too difficult, and it would have the upside of improved portability. +There is a big downside, however: using dummy code of incorrect size throws off alignment and can introduce unintended padding. +Fixing this would require running multiple passes of asm-processor, with one compile per `ASM_GLOBAL`. +- Another idea is to run the compiler with -S to emit assembly, modify the emitted assembly, then run the assembler +(which in IDO's case may perform additional instruction reordering etc.). +This option has not been investigated in much detail, and would perhaps be superior to the current implementation. +It does have a few unknowns to it, e.g. instruction encoding differences between GNU `as` and IDO's assembler, +how to avoid reordering the injected assembly, and how .rodata/.late_rodata are implemented. + +### Testing + +There are a few tests to ensure you don't break anything when hacking on asm-processor: `./run-tests.sh` should exit without output if they pass, or else output a diff from previous to new version. + +Tests need the environment variable `MIPS_CC` set to point to the IDO 7.1 compiler, with Pascal support enabled. + +For example if asm-processor is cloned in the same directory as [ido static recomp](https://github.com/decompals/ido-static-recomp) and the working directory is asm-processor, tests can be run using: + +```sh +MIPS_CC=../ido-static-recomp/build/7.1/out/cc ./run-tests.sh +``` + +Or using [qemu-irix](https://github.com/zeldaret/oot/releases/tag/0.1q) (don't forget `chmod u+x qemu-irix`) to emulate IDO: + +```sh +MIPS_CC='./qemu-irix -silent -L ../ido-static-recomp/ido/7.1/ ../ido-static-recomp/ido/7.1/usr/bin/cc' ./run-tests.sh +``` + +To skip running Pascal tests, remove the `tests/*.p` glob from `run-tests.sh`. diff --git a/tools/asm-processor/add-test.sh b/tools/asm-processor/add-test.sh new file mode 100755 index 000000000..708548e57 --- /dev/null +++ b/tools/asm-processor/add-test.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +for A in "$@"; do + OBJDUMPFLAGS="-srt" + ./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" > "${A%.*}.objdump" +done diff --git a/tools/asm-processor/asm_processor.py b/tools/asm-processor/asm_processor.py index 544b1b1b7..0d62bc32a 100644 --- a/tools/asm-processor/asm_processor.py +++ b/tools/asm-processor/asm_processor.py @@ -85,6 +85,18 @@ MIPS_DEBUG_ST_STATIC = 2 MIPS_DEBUG_ST_STATIC_PROC = 14 +class ElfFormat: + def __init__(self, is_big_endian): + self.is_big_endian = is_big_endian + self.struct_char = ">" if is_big_endian else "<" + + def pack(self, fmt, *args): + return struct.pack(self.struct_char + fmt, *args) + + def unpack(self, fmt, data): + return struct.unpack(self.struct_char + fmt, data) + + class ElfHeader: """ typedef struct { @@ -107,9 +119,9 @@ class ElfHeader: def __init__(self, data): self.e_ident = data[:EI_NIDENT] - self.e_type, self.e_machine, self.e_version, self.e_entry, self.e_phoff, self.e_shoff, self.e_flags, self.e_ehsize, self.e_phentsize, self.e_phnum, self.e_shentsize, self.e_shnum, self.e_shstrndx = struct.unpack('>HHIIIIIHHHHHH', data[EI_NIDENT:]) assert self.e_ident[EI_CLASS] == 1 # 32-bit - assert self.e_ident[EI_DATA] == 2 # big-endian + self.fmt = ElfFormat(is_big_endian=(self.e_ident[EI_DATA] == 2)) + self.e_type, self.e_machine, self.e_version, self.e_entry, self.e_phoff, self.e_shoff, self.e_flags, self.e_ehsize, self.e_phentsize, self.e_phnum, self.e_shentsize, self.e_shnum, self.e_shstrndx = self.fmt.unpack('HHIIIIIHHHHHH', data[EI_NIDENT:]) assert self.e_type == 1 # relocatable assert self.e_machine == 8 # MIPS I Architecture assert self.e_phoff == 0 # no program header @@ -117,7 +129,7 @@ class ElfHeader: assert self.e_shstrndx != SHN_UNDEF def to_bin(self): - return self.e_ident + struct.pack('>HHIIIIIHHHHHH', self.e_type, + return self.e_ident + self.fmt.pack('HHIIIIIHHHHHH', self.e_type, self.e_machine, self.e_version, self.e_entry, self.e_phoff, self.e_shoff, self.e_flags, self.e_ehsize, self.e_phentsize, self.e_phnum, self.e_shentsize, self.e_shnum, self.e_shstrndx) @@ -135,8 +147,9 @@ class Symbol: } Elf32_Sym; """ - def __init__(self, data, strtab, name=None): - self.st_name, self.st_value, self.st_size, st_info, self.st_other, self.st_shndx = struct.unpack('>IIIBBH', data) + def __init__(self, fmt, data, strtab, name=None): + self.fmt = fmt + self.st_name, self.st_value, self.st_size, st_info, self.st_other, self.st_shndx = fmt.unpack('IIIBBH', data) assert self.st_shndx != SHN_XINDEX, "too many sections (SHN_XINDEX not supported)" self.bind = st_info >> 4 self.type = st_info & 15 @@ -144,31 +157,32 @@ class Symbol: self.visibility = self.st_other & 3 @staticmethod - def from_parts(st_name, st_value, st_size, st_info, st_other, st_shndx, strtab, name): - header = struct.pack('>IIIBBH', st_name, st_value, st_size, st_info, st_other, st_shndx) - return Symbol(header, strtab, name) + def from_parts(fmt, st_name, st_value, st_size, st_info, st_other, st_shndx, strtab, name): + header = fmt.pack('IIIBBH', st_name, st_value, st_size, st_info, st_other, st_shndx) + return Symbol(fmt, header, strtab, name) def to_bin(self): st_info = (self.bind << 4) | self.type - return struct.pack('>IIIBBH', self.st_name, self.st_value, self.st_size, st_info, self.st_other, self.st_shndx) + return self.fmt.pack('IIIBBH', self.st_name, self.st_value, self.st_size, st_info, self.st_other, self.st_shndx) class Relocation: - def __init__(self, data, sh_type): + def __init__(self, fmt, data, sh_type): + self.fmt = fmt self.sh_type = sh_type if sh_type == SHT_REL: - self.r_offset, self.r_info = struct.unpack('>II', data) + self.r_offset, self.r_info = fmt.unpack('II', data) else: - self.r_offset, self.r_info, self.r_addend = struct.unpack('>III', data) + self.r_offset, self.r_info, self.r_addend = fmt.unpack('III', data) self.sym_index = self.r_info >> 8 self.rel_type = self.r_info & 0xff def to_bin(self): self.r_info = (self.sym_index << 8) | self.rel_type if self.sh_type == SHT_REL: - return struct.pack('>II', self.r_offset, self.r_info) + return self.fmt.pack('II', self.r_offset, self.r_info) else: - return struct.pack('>III', self.r_offset, self.r_info, self.r_addend) + return self.fmt.pack('III', self.r_offset, self.r_info, self.r_addend) class Section: @@ -187,8 +201,9 @@ class Section: } Elf32_Shdr; """ - def __init__(self, header, data, index): - self.sh_name, self.sh_type, self.sh_flags, self.sh_addr, self.sh_offset, self.sh_size, self.sh_link, self.sh_info, self.sh_addralign, self.sh_entsize = struct.unpack('>IIIIIIIIII', header) + def __init__(self, fmt, header, data, index): + self.fmt = fmt + self.sh_name, self.sh_type, self.sh_flags, self.sh_addr, self.sh_offset, self.sh_size, self.sh_link, self.sh_info, self.sh_addralign, self.sh_entsize = fmt.unpack('IIIIIIIIII', header) assert not self.sh_flags & SHF_LINK_ORDER if self.sh_entsize != 0: assert self.sh_size % self.sh_entsize == 0 @@ -200,9 +215,9 @@ class Section: self.relocated_by = [] @staticmethod - def from_parts(sh_name, sh_type, sh_flags, sh_link, sh_info, sh_addralign, sh_entsize, data, index): - header = struct.pack('>IIIIIIIIII', sh_name, sh_type, sh_flags, 0, 0, len(data), sh_link, sh_info, sh_addralign, sh_entsize) - return Section(header, data, index) + def from_parts(fmt, sh_name, sh_type, sh_flags, sh_link, sh_info, sh_addralign, sh_entsize, data, index): + header = fmt.pack('IIIIIIIIII', sh_name, sh_type, sh_flags, 0, 0, len(data), sh_link, sh_info, sh_addralign, sh_entsize) + return Section(fmt, header, data, index) def lookup_str(self, index): assert self.sh_type == SHT_STRTAB @@ -222,7 +237,7 @@ class Section: def header_to_bin(self): if self.sh_type != SHT_NOBITS: self.sh_size = len(self.data) - return struct.pack('>IIIIIIIIII', self.sh_name, self.sh_type, self.sh_flags, self.sh_addr, self.sh_offset, self.sh_size, self.sh_link, self.sh_info, self.sh_addralign, self.sh_entsize) + return self.fmt.pack('IIIIIIIIII', self.sh_name, self.sh_type, self.sh_flags, self.sh_addr, self.sh_offset, self.sh_size, self.sh_link, self.sh_info, self.sh_addralign, self.sh_entsize) def late_init(self, sections): if self.sh_type == SHT_SYMTAB: @@ -251,14 +266,14 @@ class Section: self.strtab = sections[self.sh_link] entries = [] for i in range(0, self.sh_size, self.sh_entsize): - entries.append(Symbol(self.data[i:i+self.sh_entsize], self.strtab)) + entries.append(Symbol(self.fmt, self.data[i:i+self.sh_entsize], self.strtab)) self.symbol_entries = entries def init_relocs(self): assert self.is_rel() entries = [] for i in range(0, self.sh_size, self.sh_entsize): - entries.append(Relocation(self.data[i:i+self.sh_entsize], self.sh_type)) + entries.append(Relocation(self.fmt, self.data[i:i+self.sh_entsize], self.sh_type)) self.relocations = entries def local_symbols(self): @@ -281,9 +296,9 @@ class Section: hdrr_cbOptOffset, hdrr_iauxMax, hdrr_cbAuxOffset, hdrr_issMax, \ hdrr_cbSsOffset, hdrr_issExtMax, hdrr_cbSsExtOffset, hdrr_ifdMax, \ hdrr_cbFdOffset, hdrr_crfd, hdrr_cbRfdOffset, hdrr_iextMax, \ - hdrr_cbExtOffset = struct.unpack(">HHIIIIIIIIIIIIIIIIIIIIIII", self.data[0:0x60]) + hdrr_cbExtOffset = self.fmt.unpack("HHIIIIIIIIIIIIIIIIIIIIIII", self.data[0:0x60]) - assert hdrr_magic == 0x7009 , "Invalid magic value for .mdebug symbolic header" + assert hdrr_magic == 0x7009, "Invalid magic value for .mdebug symbolic header" hdrr_cbLineOffset += shift_by hdrr_cbDnOffset += shift_by @@ -297,7 +312,7 @@ class Section: hdrr_cbRfdOffset += shift_by hdrr_cbExtOffset += shift_by - new_data[0:0x60] = struct.pack(">HHIIIIIIIIIIIIIIIIIIIIIII", hdrr_magic, hdrr_vstamp, hdrr_ilineMax, hdrr_cbLine, \ + new_data[0:0x60] = self.fmt.pack("HHIIIIIIIIIIIIIIIIIIIIIII", hdrr_magic, hdrr_vstamp, hdrr_ilineMax, hdrr_cbLine, \ hdrr_cbLineOffset, hdrr_idnMax, hdrr_cbDnOffset, hdrr_ipdMax, \ hdrr_cbPdOffset, hdrr_isymMax, hdrr_cbSymOffset, hdrr_ioptMax, \ hdrr_cbOptOffset, hdrr_iauxMax, hdrr_cbAuxOffset, hdrr_issMax, \ @@ -313,15 +328,16 @@ class ElfFile: assert data[:4] == b'\x7fELF', "not an ELF file" self.elf_header = ElfHeader(data[0:52]) + self.fmt = self.elf_header.fmt offset, size = self.elf_header.e_shoff, self.elf_header.e_shentsize - null_section = Section(data[offset:offset + size], data, 0) + null_section = Section(self.fmt, data[offset:offset + size], data, 0) num_sections = self.elf_header.e_shnum or null_section.sh_size self.sections = [null_section] for i in range(1, num_sections): ind = offset + i * size - self.sections.append(Section(data[ind:ind + size], data, i)) + self.sections.append(Section(self.fmt, data[ind:ind + size], data, i)) symtab = None for s in self.sections: @@ -345,7 +361,7 @@ class ElfFile: def add_section(self, name, sh_type, sh_flags, sh_link, sh_info, sh_addralign, sh_entsize, data): shstr = self.sections[self.elf_header.e_shstrndx] sh_name = shstr.add_str(name) - s = Section.from_parts(sh_name=sh_name, sh_type=sh_type, + s = Section.from_parts(self.fmt, sh_name=sh_name, sh_type=sh_type, sh_flags=sh_flags, sh_link=sh_link, sh_info=sh_info, sh_addralign=sh_addralign, sh_entsize=sh_entsize, data=data, index=len(self.sections)) @@ -421,15 +437,18 @@ class Failure(Exception): class GlobalState: - def __init__(self, min_instr_count, skip_instr_count, use_jtbl_for_rodata, mips1): + def __init__(self, min_instr_count, skip_instr_count, use_jtbl_for_rodata, prelude_if_late_rodata, mips1, pascal): # A value that hopefully never appears as a 32-bit rodata constant (or we # miscompile late rodata). Increases by 1 in each step. self.late_rodata_hex = 0xE0123456 + self.valuectr = 0 self.namectr = 0 self.min_instr_count = min_instr_count self.skip_instr_count = skip_instr_count self.use_jtbl_for_rodata = use_jtbl_for_rodata + self.prelude_if_late_rodata = prelude_if_late_rodata self.mips1 = mips1 + self.pascal = pascal def next_late_rodata_hex(self): dummy_bytes = struct.pack('>I', self.late_rodata_hex) @@ -443,6 +462,36 @@ class GlobalState: self.namectr += 1 return '_asmpp_{}{}'.format(cat, self.namectr) + def func_prologue(self, name): + if self.pascal: + return " ".join([ + "procedure {}();".format(name), + "type", + " pi = ^integer;", + " pf = ^single;", + " pd = ^double;", + "var", + " vi: pi;", + " vf: pf;", + " vd: pd;", + "begin", + " vi := vi;", + " vf := vf;", + " vd := vd;", + ]) + else: + return 'void {}(void) {{'.format(name) + + def func_epilogue(self): + if self.pascal: + return "end;" + else: + return "}" + + def pascal_assignment(self, tp, val): + self.valuectr += 1 + address = (8 * self.valuectr) & 0x7FFF + return 'v{} := p{}({}); v{}^ := {};'.format(tp, tp, address, tp, val) Function = namedtuple('Function', ['text_glabels', 'asm_conts', 'late_rodata_dummy_bytes', 'jtbl_rodata_size', 'late_rodata_asm_conts', 'fn_desc', 'data']) @@ -476,6 +525,7 @@ class GlobalAsmBlock: def count_quoted_size(self, line, z, real_line, output_enc): line = line.encode(output_enc).decode('latin1') in_quote = False + has_comma = True num_parts = 0 ret = 0 i = 0 @@ -486,10 +536,15 @@ class GlobalAsmBlock: if not in_quote: if c == '"': in_quote = True + if z and not has_comma: + self.fail(".asciiz with glued strings is not supported due to GNU as version diffs") num_parts += 1 + elif c == ',': + has_comma = True else: if c == '"': in_quote = False + has_comma = False continue ret += 1 if c != '\\': @@ -554,7 +609,7 @@ class GlobalAsmBlock: self.text_glabels.append(line.split()[1]) if not line: pass # empty line - elif line.startswith('glabel ') or (' ' not in line and line.endswith(':')): + elif line.startswith('glabel ') or line.startswith('dlabel ') or line.startswith('endlabel ') or (' ' not in line and line.endswith(':')): pass # label elif line.startswith('.section') or line in ['.text', '.data', '.rdata', '.rodata', '.bss', '.late_rodata']: # section change @@ -574,7 +629,7 @@ class GlobalAsmBlock: changed_section = True elif line.startswith('.incbin'): self.add_sized(int(line.split(',')[-1].strip(), 0), real_line) - elif line.startswith('.word') or line.startswith('.float'): + elif line.startswith('.word') or line.startswith('.gpword') or line.startswith('.float'): self.align4() self.add_sized(4 * len(line.split(',')), real_line) elif line.startswith('.double'): @@ -651,7 +706,12 @@ class GlobalAsmBlock: skip_next = False needs_double = (self.late_rodata_alignment != 0) extra_mips1_nop = False - jtbl_size = 11 if state.mips1 else 9 + if state.pascal: + jtbl_size = 9 if state.mips1 else 8 + jtbl_min_rodata_size = 2 + else: + jtbl_size = 11 if state.mips1 else 9 + jtbl_min_rodata_size = 5 for i in range(size): if skip_next: skip_next = False @@ -668,9 +728,15 @@ class GlobalAsmBlock: # - we have at least 10 more instructions to go in this function (otherwise our # function size computation will be wrong since the delay slot goes unused) if (not needs_double and state.use_jtbl_for_rodata and i >= 1 and - size - i >= 5 and num_instr - len(late_rodata_fn_output) >= jtbl_size + 1): - cases = " ".join("case {}:".format(case) for case in range(size - i)) - late_rodata_fn_output.append("switch (*(volatile int*)0) { " + cases + " ; }") + size - i >= jtbl_min_rodata_size and + num_instr - len(late_rodata_fn_output) >= jtbl_size + 1): + if state.pascal: + cases = " ".join("{}: ;".format(case) for case in range(size - i)) + line = "case 0 of " + cases + " otherwise end;" + else: + cases = " ".join("case {}:".format(case) for case in range(size - i)) + line = "switch (*(volatile int*)0) { " + cases + " ; }" + late_rodata_fn_output.append(line) late_rodata_fn_output.extend([""] * (jtbl_size - 1)) jtbl_rodata_size = (size - i) * 4 extra_mips1_nop = i != 2 @@ -681,7 +747,11 @@ class GlobalAsmBlock: dummy_bytes2 = state.next_late_rodata_hex() late_rodata_dummy_bytes.append(dummy_bytes2) fval, = struct.unpack('>d', dummy_bytes + dummy_bytes2) - late_rodata_fn_output.append('*(volatile double*)0 = {};'.format(fval)) + if state.pascal: + line = state.pascal_assignment('d', fval) + else: + line = '*(volatile double*)0 = {};'.format(fval) + late_rodata_fn_output.append(line) skip_next = True needs_double = False if state.mips1: @@ -691,7 +761,11 @@ class GlobalAsmBlock: extra_mips1_nop = False else: fval, = struct.unpack('>f', dummy_bytes) - late_rodata_fn_output.append('*(volatile float*)0 = {}f;'.format(fval)) + if state.pascal: + line = state.pascal_assignment('f', fval) + else: + line = '*(volatile float*)0 = {}f;'.format(fval) + late_rodata_fn_output.append(line) extra_mips1_nop = True late_rodata_fn_output.append('') late_rodata_fn_output.append('') @@ -701,8 +775,8 @@ class GlobalAsmBlock: text_name = None if self.fn_section_sizes['.text'] > 0 or late_rodata_fn_output: text_name = state.make_name('func') - src[0] = 'void {}(void) {{'.format(text_name) - src[self.num_lines] = '}' + src[0] = state.func_prologue(text_name) + src[self.num_lines] = state.func_epilogue() instr_count = self.fn_section_sizes['.text'] // 4 if instr_count < state.min_instr_count: self.fail("too short .text block") @@ -710,6 +784,7 @@ class GlobalAsmBlock: tot_skipped = 0 fn_emitted = 0 fn_skipped = 0 + skipping = True rodata_stack = late_rodata_fn_output[::-1] for (line, count) in self.fn_ins_inds: for _ in range(count): @@ -718,16 +793,28 @@ class GlobalAsmBlock: # Don't let functions become too large. When a function reaches 284 # instructions, and -O2 -framepointer flags are passed, the IRIX # compiler decides it is a great idea to start optimizing more. + # Also, Pascal cannot handle too large functions before it runs out + # of unique statements to write. fn_emitted = 0 fn_skipped = 0 - src[line] += ' }} void {}(void) {{ '.format(state.make_name('large_func')) - if fn_skipped < state.skip_instr_count: + skipping = True + src[line] += (' ' + state.func_epilogue() + ' ' + + state.func_prologue(state.make_name('large_func')) + ' ') + if ( + skipping and + fn_skipped < state.skip_instr_count + + (state.prelude_if_late_rodata if rodata_stack else 0) + ): fn_skipped += 1 tot_skipped += 1 - elif rodata_stack: - src[line] += rodata_stack.pop() else: - src[line] += '*(volatile int*)0 = 0;' + skipping = False + if rodata_stack: + src[line] += rodata_stack.pop() + elif state.pascal: + src[line] += state.pascal_assignment('i', '0') + else: + src[line] += '*(volatile int*)0 = 0;' tot_emitted += 1 fn_emitted += 1 if rodata_stack: @@ -741,16 +828,24 @@ class GlobalAsmBlock: rodata_name = None if self.fn_section_sizes['.rodata'] > 0: + if state.pascal: + self.fail(".rodata isn't supported with Pascal for now") rodata_name = state.make_name('rodata') src[self.num_lines] += ' const char {}[{}] = {{1}};'.format(rodata_name, self.fn_section_sizes['.rodata']) data_name = None if self.fn_section_sizes['.data'] > 0: data_name = state.make_name('data') - src[self.num_lines] += ' char {}[{}] = {{1}};'.format(data_name, self.fn_section_sizes['.data']) + if state.pascal: + line = ' var {}: packed array[1..{}] of char := [otherwise: 0];'.format(data_name, self.fn_section_sizes['.data']) + else: + line = ' char {}[{}] = {{1}};'.format(data_name, self.fn_section_sizes['.data']) + src[self.num_lines] += line bss_name = None if self.fn_section_sizes['.bss'] > 0: + if state.pascal: + self.fail(".bss isn't supported with Pascal") bss_name = state.make_name('bss') src[self.num_lines] += ' char {}[{}];'.format(bss_name, self.fn_section_sizes['.bss']) @@ -775,43 +870,55 @@ float_regexpr = re.compile(r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?f") def repl_float_hex(m): return str(struct.unpack(">I", struct.pack(">f", float(m.group(0).strip().rstrip("f"))))[0]) -def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_dependencies, print_source=None): - if opt in ['O2', 'O1']: - if framepointer: +Opts = namedtuple('Opts', ['opt', 'framepointer', 'mips1', 'kpic', 'pascal', 'input_enc', 'output_enc']) + +def parse_source(f, opts, out_dependencies, print_source=None): + if opts.opt in ['O1', 'O2']: + if opts.framepointer: min_instr_count = 6 skip_instr_count = 5 else: min_instr_count = 2 skip_instr_count = 1 - elif opt == 'O0': - if framepointer: + elif opts.opt == 'O0': + if opts.framepointer: min_instr_count = 8 skip_instr_count = 8 else: min_instr_count = 4 skip_instr_count = 4 - elif opt == 'g': - if framepointer: + elif opts.opt == 'g': + if opts.framepointer: min_instr_count = 7 skip_instr_count = 7 else: min_instr_count = 4 skip_instr_count = 4 - else: - if opt != 'g3': - raise Failure("must pass one of -g, -O0, -O1, -O2, -O2 -g3") - if framepointer: + elif opts.opt == 'g3': + if opts.framepointer: min_instr_count = 4 skip_instr_count = 4 else: min_instr_count = 2 skip_instr_count = 2 + else: + raise Failure("must pass one of -g, -O0, -O1, -O2, -O2 -g3") + prelude_if_late_rodata = 0 + if opts.kpic: + # Without optimizations, the PIC prelude always takes up 3 instructions. + # With optimizations, the prelude is optimized out if there's no late rodata. + if opts.opt in ('g3', 'O2'): + prelude_if_late_rodata = 3 + else: + min_instr_count += 3 + skip_instr_count += 3 use_jtbl_for_rodata = False - if opt in ['O2', 'g3'] and not framepointer: + if opts.opt in ['O2', 'g3'] and not opts.framepointer and not opts.kpic: use_jtbl_for_rodata = True - state = GlobalState(min_instr_count, skip_instr_count, use_jtbl_for_rodata, mips1) + state = GlobalState(min_instr_count, skip_instr_count, use_jtbl_for_rodata, prelude_if_late_rodata, opts.mips1, opts.pascal) + output_enc = opts.output_enc global_asm = None asm_functions = [] @@ -848,7 +955,7 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende fname = line[line.index('(') + 2 : -2] out_dependencies.append(fname) global_asm = GlobalAsmBlock(fname) - with open(fname, encoding=input_enc) as f: + with open(fname, encoding=opts.input_enc) as f: for line2 in f: global_asm.process_line(line2.rstrip(), output_enc) src, fn = global_asm.finish(state) @@ -870,8 +977,8 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende fname = os.path.join(fpath, line[line.index(' ') + 2 : -1]) out_dependencies.append(fname) include_src = StringIO() - with open(fname, encoding=input_enc) as include_file: - parse_source(include_file, opt, framepointer, mips1, input_enc, output_enc, out_dependencies, include_src) + with open(fname, encoding=opts.input_enc) as include_file: + parse_source(include_file, opts, out_dependencies, include_src) include_src.write('#line ' + str(line_no + 1) + ' "' + f.name + '"') output_lines[-1] = include_src.getvalue() include_src.close() @@ -891,6 +998,7 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende for line in output_lines: print_source.write(line + '\n') else: + newline_encoded = "\n".encode(output_enc) for line in output_lines: try: line_encoded = line.encode(output_enc) @@ -899,18 +1007,18 @@ def parse_source(f, opt, framepointer, mips1, input_enc, output_enc, out_depende print("The line:", line) print("The line, utf-8-encoded:", line.encode("utf-8")) raise - print_source.write(line_encoded + b'\n') + print_source.write(line_encoded) + print_source.write(newline_encoded) print_source.flush() - if print_source != sys.stdout.buffer: - print_source.close() return asm_functions -def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, drop_mdebug_gptab): +def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, drop_mdebug_gptab, convert_statics): SECTIONS = ['.data', '.text', '.rodata', '.bss'] with open(objfile_name, 'rb') as f: objfile = ElfFile(f.read()) + fmt = objfile.fmt prev_locs = { '.text': 0, @@ -949,6 +1057,11 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d loc = loc[1] prev_loc = prev_locs[sectype] if loc < prev_loc: + # If the dummy C generates too little asm, and we have two + # consecutive GLOBAL_ASM blocks, we detect that error here. + # On the other hand, if it generates too much, we don't have + # a good way of discovering that error: it's indistinguishable + # from a static symbol occurring after the GLOBAL_ASM block. raise Failure("Wrongly computed size for section {} (diff {}). This is an asm-processor bug!".format(sectype, prev_loc- loc)) if loc != prev_loc: asm.append('.section ' + sectype) @@ -958,7 +1071,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d else: asm.append('.space {}'.format(loc - prev_loc)) to_copy[sectype].append((loc, size, temp_name, function.fn_desc)) - if function.text_glabels: + if function.text_glabels and sectype == '.text': func_sizes[function.text_glabels[0]] = size prev_locs[sectype] = loc + size if not ifdefed: @@ -980,7 +1093,10 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d if any(late_rodata_asm): late_rodata_source_name_start = '_asmpp_late_rodata_start' late_rodata_source_name_end = '_asmpp_late_rodata_end' - asm.append('.rdata') + asm.append('.section .late_rodata') + # Put some padding at the start to avoid conflating symbols with + # references to the whole section. + asm.append('.word 0, 0') asm.append('glabel {}'.format(late_rodata_source_name_start)) for conts in late_rodata_asm: asm.extend(conts) @@ -1011,11 +1127,12 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d # Unify reginfo sections target_reginfo = objfile.find_section('.reginfo') - source_reginfo_data = list(asm_objfile.find_section('.reginfo').data) - data = list(target_reginfo.data) - for i in range(20): - data[i] |= source_reginfo_data[i] - target_reginfo.data = bytes(data) + if target_reginfo is not None: + source_reginfo_data = list(asm_objfile.find_section('.reginfo').data) + data = list(target_reginfo.data) + for i in range(20): + data[i] |= source_reginfo_data[i] + target_reginfo.data = bytes(data) # Move over section contents modified_text_positions = set() @@ -1052,7 +1169,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d # of another way of doing it. moved_late_rodata = {} if any(all_late_rodata_dummy_bytes) or any(all_jtbl_rodata_size): - source = asm_objfile.find_section('.rodata') + source = asm_objfile.find_section('.late_rodata') target = objfile.find_section('.rodata') source_pos = asm_objfile.symtab.find_symbol_in_section(late_rodata_source_name_start, source) source_end = asm_objfile.symtab.find_symbol_in_section(late_rodata_source_name_end, source) @@ -1061,6 +1178,8 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d new_data = list(target.data) for dummy_bytes_list, jtbl_rodata_size in zip(all_late_rodata_dummy_bytes, all_jtbl_rodata_size): for index, dummy_bytes in enumerate(dummy_bytes_list): + if not fmt.is_big_endian: + dummy_bytes = dummy_bytes[::-1] pos = target.data.index(dummy_bytes, last_rodata_pos) # This check is nice, but makes time complexity worse for large files: if SLOW_CHECKS and target.data.find(dummy_bytes, pos + 4) != -1: @@ -1096,7 +1215,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d # Find relocated symbols relocated_symbols = set() - for sectype in SECTIONS: + for sectype in SECTIONS + ['.late_rodata']: for obj in [asm_objfile, objfile]: sec = obj.find_section(sectype) if sec is None: @@ -1106,50 +1225,60 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d relocated_symbols.add(obj.symtab.symbol_entries[rel.sym_index]) # Move over symbols, deleting the temporary function labels. - # Sometimes this naive procedure results in duplicate symbols, or UNDEF - # symbols that are also defined the same .o file. Hopefully that's fine. - # Skip over local symbols that aren't relocated against, to avoid - # conflicts. - new_local_syms = [s for s in objfile.symtab.local_symbols() if not is_temp_name(s.name)] - new_global_syms = [s for s in objfile.symtab.global_symbols() if not is_temp_name(s.name)] + # Skip over new local symbols that aren't relocated against, to + # avoid conflicts. + empty_symbol = objfile.symtab.symbol_entries[0] + new_syms = [s for s in objfile.symtab.symbol_entries[1:] if not is_temp_name(s.name)] + for i, s in enumerate(asm_objfile.symtab.symbol_entries): is_local = (i < asm_objfile.symtab.sh_info) if is_local and s not in relocated_symbols: continue if is_temp_name(s.name): + assert s not in relocated_symbols continue if s.st_shndx not in [SHN_UNDEF, SHN_ABS]: section_name = asm_objfile.sections[s.st_shndx].name - if section_name not in SECTIONS: - raise Failure("generated assembly .o must only have symbols for .text, .data, .rodata, ABS and UNDEF, but found " + section_name) - s.st_shndx = objfile.find_section(section_name).index + target_section_name = section_name + if section_name == ".late_rodata": + target_section_name = ".rodata" + elif section_name not in SECTIONS: + raise Failure("generated assembly .o must only have symbols for .text, .data, .rodata, .late_rodata, ABS and UNDEF, but found " + section_name) + objfile_section = objfile.find_section(target_section_name) + if objfile_section is None: + raise Failure("generated assembly .o has section that real objfile lacks: " + target_section_name) + s.st_shndx = objfile_section.index # glabel's aren't marked as functions, making objdump output confusing. Fix that. if s.name in all_text_glabels: s.type = STT_FUNC if s.name in func_sizes: s.st_size = func_sizes[s.name] - if objfile.sections[s.st_shndx].name == '.rodata' and s.st_value in moved_late_rodata: + if section_name == '.late_rodata': + if s.st_value == 0: + # This must be a symbol corresponding to the whole .late_rodata + # section, being referred to from a relocation. + # Moving local symbols is tricky, because it requires fixing up + # lo16/hi16 relocation references to .late_rodata+. + # Just disallow it for now. + raise Failure("local symbols in .late_rodata are not allowed") s.st_value = moved_late_rodata[s.st_value] s.st_name += strtab_adj - if is_local: - new_local_syms.append(s) - else: - new_global_syms.append(s) + new_syms.append(s) + make_statics_global = convert_statics in ("global", "global-with-filename") # Add static symbols from .mdebug, so they can be referred to from GLOBAL_ASM - local_sym_replacements = {} - if mdebug_section: + if mdebug_section and convert_statics != "no": strtab_index = len(objfile.symtab.strtab.data) new_strtab_data = [] - ifd_max, cb_fd_offset = struct.unpack('>II', mdebug_section.data[18*4 : 20*4]) - cb_sym_offset, = struct.unpack('>I', mdebug_section.data[9*4 : 10*4]) - cb_ss_offset, = struct.unpack('>I', mdebug_section.data[15*4 : 16*4]) + ifd_max, cb_fd_offset = fmt.unpack('II', mdebug_section.data[18*4 : 20*4]) + cb_sym_offset, = fmt.unpack('I', mdebug_section.data[9*4 : 10*4]) + cb_ss_offset, = fmt.unpack('I', mdebug_section.data[15*4 : 16*4]) for i in range(ifd_max): offset = cb_fd_offset + 18*4*i - iss_base, _, isym_base, csym = struct.unpack('>IIII', objfile.data[offset + 2*4 : offset + 6*4]) + iss_base, _, isym_base, csym = fmt.unpack('IIII', objfile.data[offset + 2*4 : offset + 6*4]) for j in range(csym): offset2 = cb_sym_offset + 12 * (isym_base + j) - iss, value, st_sc_index = struct.unpack('>III', objfile.data[offset2 : offset2 + 12]) + iss, value, st_sc_index = fmt.unpack('III', objfile.data[offset2 : offset2 + 12]) st = (st_sc_index >> 26) sc = (st_sc_index >> 21) & 0x1f if st in [MIPS_DEBUG_ST_STATIC, MIPS_DEBUG_ST_STATIC_PROC]: @@ -1157,44 +1286,72 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d symbol_name_offset_end = objfile.data.find(b'\0', symbol_name_offset) assert symbol_name_offset_end != -1 symbol_name = objfile.data[symbol_name_offset : symbol_name_offset_end + 1] - symbol_name_str = symbol_name[:-1].decode('latin1') + emitted_symbol_name = symbol_name + if convert_statics == "global-with-filename": + # Change the emitted symbol name to include the filename, + # but don't let that affect deduplication logic. + emitted_symbol_name = objfile_name.encode("utf-8") + b":" + symbol_name section_name = {1: '.text', 2: '.data', 3: '.bss', 15: '.rodata'}[sc] section = objfile.find_section(section_name) symtype = STT_FUNC if sc == 1 else STT_OBJECT + binding = STB_GLOBAL if make_statics_global else STB_LOCAL sym = Symbol.from_parts( + fmt, st_name=strtab_index, st_value=value, st_size=0, - st_info=(STB_LOCAL << 4 | symtype), + st_info=(binding << 4 | symtype), st_other=STV_DEFAULT, st_shndx=section.index, strtab=objfile.symtab.strtab, - name=symbol_name_str) - local_sym_replacements[symbol_name_str] = len(new_local_syms) - strtab_index += len(symbol_name) - new_strtab_data.append(symbol_name) - new_local_syms.append(sym) + name=symbol_name[:-1].decode('latin1')) + strtab_index += len(emitted_symbol_name) + new_strtab_data.append(emitted_symbol_name) + new_syms.append(sym) objfile.symtab.strtab.data += b''.join(new_strtab_data) - # To get the linker to use the local symbols, we have to get rid of UNDEF - # global ones. - newer_global_syms = [] - for s in new_global_syms: - if s.st_shndx == SHN_UNDEF and s.name in local_sym_replacements: - s.new_index = local_sym_replacements[s.name] + # Get rid of duplicate symbols, favoring ones that are not UNDEF. + # Skip this for unnamed local symbols though. + new_syms.sort(key=lambda s: 0 if s.st_shndx != SHN_UNDEF else 1) + old_syms = [] + newer_syms = [] + name_to_sym = {} + for s in new_syms: + if s.name == "_gp_disp": + s.type = STT_OBJECT + if s.bind == STB_LOCAL and s.st_shndx == SHN_UNDEF: + raise Failure("local symbol \"" + s.name + "\" is undefined") + if not s.name: + if s.bind != STB_LOCAL: + raise Failure("global symbol with no name") + newer_syms.append(s) else: - newer_global_syms.append(s) - new_global_syms = newer_global_syms + existing = name_to_sym.get(s.name) + if not existing: + name_to_sym[s.name] = s + newer_syms.append(s) + elif s.st_shndx != SHN_UNDEF: + raise Failure("symbol \"" + s.name + "\" defined twice") + else: + s.replace_by = existing + old_syms.append(s) + new_syms = newer_syms + + # Put local symbols in front, with the initial dummy entry first, and + # _gp_disp at the end if it exists. + new_syms.insert(0, empty_symbol) + new_syms.sort(key=lambda s: (s.bind != STB_LOCAL, s.name == "_gp_disp")) + num_local_syms = sum(1 for s in new_syms if s.bind == STB_LOCAL) - new_syms = new_local_syms + new_global_syms for i, s in enumerate(new_syms): s.new_index = i + for s in old_syms: + s.new_index = s.replace_by.new_index objfile.symtab.data = b''.join(s.to_bin() for s in new_syms) - objfile.symtab.sh_info = len(new_local_syms) + objfile.symtab.sh_info = num_local_syms - # Move over relocations + # Fix up relocation symbol references for sectype in SECTIONS: - source = asm_objfile.find_section(sectype) target = objfile.find_section(sectype) if target is not None: @@ -1206,34 +1363,38 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc, d sectype == '.rodata' and rel.r_offset in jtbl_rodata_positions): # don't include relocations for late_rodata dummy code continue - # hopefully we don't have relocations for local or - # temporary symbols, so new_index exists rel.sym_index = objfile.symtab.symbol_entries[rel.sym_index].new_index nrels.append(rel) reltab.relocations = nrels reltab.data = b''.join(rel.to_bin() for rel in nrels) - if not source: + # Move over relocations + for sectype in SECTIONS + ['.late_rodata']: + source = asm_objfile.find_section(sectype) + if source is None or not source.data: continue - target_reltab = objfile.find_section('.rel' + sectype) - target_reltaba = objfile.find_section('.rela' + sectype) + target_sectype = '.rodata' if sectype == '.late_rodata' else sectype + target = objfile.find_section(target_sectype) + assert target is not None, target_sectype + target_reltab = objfile.find_section('.rel' + target_sectype) + target_reltaba = objfile.find_section('.rela' + target_sectype) for reltab in source.relocated_by: for rel in reltab.relocations: rel.sym_index = asm_objfile.symtab.symbol_entries[rel.sym_index].new_index - if sectype == '.rodata' and rel.r_offset in moved_late_rodata: + if sectype == '.late_rodata': rel.r_offset = moved_late_rodata[rel.r_offset] new_data = b''.join(rel.to_bin() for rel in reltab.relocations) if reltab.sh_type == SHT_REL: if not target_reltab: - target_reltab = objfile.add_section('.rel' + sectype, + target_reltab = objfile.add_section('.rel' + target_sectype, sh_type=SHT_REL, sh_flags=0, sh_link=objfile.symtab.index, sh_info=target.index, sh_addralign=4, sh_entsize=8, data=b'') target_reltab.data += new_data else: if not target_reltaba: - target_reltaba = objfile.add_section('.rela' + sectype, + target_reltaba = objfile.add_section('.rela' + target_sectype, sh_type=SHT_RELA, sh_flags=0, sh_link=objfile.symtab.index, sh_info=target.index, sh_addralign=4, sh_entsize=12, data=b'') @@ -1257,9 +1418,12 @@ def run_wrapped(argv, outfile, functions): parser.add_argument('--input-enc', default='latin1', help="input encoding (default: %(default)s)") parser.add_argument('--output-enc', default='latin1', help="output encoding (default: %(default)s)") parser.add_argument('--drop-mdebug-gptab', dest='drop_mdebug_gptab', action='store_true', help="drop mdebug and gptab sections") + parser.add_argument('--convert-statics', dest='convert_statics', choices=["no", "local", "global", "global-with-filename"], default="local", help="change static symbol visibility (default: %(default)s)") + parser.add_argument('--force', dest='force', action='store_true', help="force processing of files without GLOBAL_ASM blocks") parser.add_argument('-framepointer', dest='framepointer', action='store_true') parser.add_argument('-mips1', dest='mips1', action='store_true') parser.add_argument('-g3', dest='g3', action='store_true') + parser.add_argument('-KPIC', dest='kpic', action='store_true') group = parser.add_mutually_exclusive_group(required=True) group.add_argument('-O0', dest='opt', action='store_const', const='O0') group.add_argument('-O1', dest='opt', action='store_const', const='O1') @@ -1267,31 +1431,35 @@ def run_wrapped(argv, outfile, functions): group.add_argument('-g', dest='opt', action='store_const', const='g') args = parser.parse_args(argv) opt = args.opt + pascal = any(args.filename.endswith(ext) for ext in (".p", ".pas", ".pp")) if args.g3: if opt != 'O2': raise Failure("-g3 is only supported together with -O2") opt = 'g3' - if args.mips1 and (opt != 'O2' or args.framepointer): - raise Failure("-mips1 is only supported together with -O2") + if args.mips1 and (opt not in ('O1', 'O2') or args.framepointer): + raise Failure("-mips1 is only supported together with -O1 or -O2") + if pascal and opt not in ('O1', 'O2', 'g3'): + raise Failure("Pascal is only supported together with -O1, -O2 or -O2 -g3") + opts = Opts(opt, args.framepointer, args.mips1, args.kpic, pascal, args.input_enc, args.output_enc) if args.objfile is None: with open(args.filename, encoding=args.input_enc) as f: deps = [] - functions = parse_source(f, opt=opt, framepointer=args.framepointer, mips1=args.mips1, input_enc=args.input_enc, output_enc=args.output_enc, out_dependencies=deps, print_source=outfile) + functions = parse_source(f, opts, out_dependencies=deps, print_source=outfile) return functions, deps else: if args.assembler is None: raise Failure("must pass assembler command") if functions is None: with open(args.filename, encoding=args.input_enc) as f: - functions = parse_source(f, opt=opt, framepointer=args.framepointer, mips1=args.mips1, input_enc=args.input_enc, out_dependencies=[], output_enc=args.output_enc) - if not functions: + functions = parse_source(f, opts, out_dependencies=[]) + if not functions and not args.force: return asm_prelude = b'' if args.asm_prelude: with open(args.asm_prelude, 'rb') as f: asm_prelude = f.read() - fixup_objfile(args.objfile, functions, asm_prelude, args.assembler, args.output_enc, args.drop_mdebug_gptab) + fixup_objfile(args.objfile, functions, asm_prelude, args.assembler, args.output_enc, args.drop_mdebug_gptab, args.convert_statics) def run(argv, outfile=sys.stdout.buffer, functions=None): try: diff --git a/tools/asm-processor/build.py b/tools/asm-processor/build.py old mode 100755 new mode 100644 index 480dec9ed..efbaade4a --- a/tools/asm-processor/build.py +++ b/tools/asm-processor/build.py @@ -1,41 +1,50 @@ #!/usr/bin/env python3 import sys -import os +from pathlib import Path import shlex import subprocess import tempfile +import uuid import asm_processor -dir_path = os.path.dirname(os.path.realpath(__file__)) -prelude = os.path.join(dir_path, "prelude.inc") +# Boolean for debugging purposes +# Preprocessed files are temporary, set to True to keep a copy +keep_preprocessed_files = False + +dir_path = Path(__file__).resolve().parent +asm_prelude_path = dir_path / "prelude.inc" all_args = sys.argv[1:] -sep0 = [index for index, arg in enumerate(all_args) if not arg.startswith("-")][0] +sep0 = next(index for index, arg in enumerate(all_args) if not arg.startswith("-")) sep1 = all_args.index("--") sep2 = all_args.index("--", sep1 + 1) asmproc_flags = all_args[:sep0] compiler = all_args[sep0:sep1] -assembler = all_args[sep1 + 1 : sep2] -assembler_sh = " ".join(shlex.quote(x) for x in assembler) +assembler_args = all_args[sep1 + 1 : sep2] +assembler_sh = " ".join(shlex.quote(x) for x in assembler_args) + compile_args = all_args[sep2 + 1 :] -in_file = compile_args[-1] -out_ind = compile_args.index("-o") -out_file = compile_args[out_ind + 1] + +in_file = Path(compile_args[-1]) del compile_args[-1] + +out_ind = compile_args.index("-o") +out_file = Path(compile_args[out_ind + 1]) del compile_args[out_ind + 1] del compile_args[out_ind] -in_dir = os.path.split(os.path.realpath(in_file))[0] + +in_dir = in_file.resolve().parent opt_flags = [ - x for x in compile_args if x in ["-g3", "-g", "-O0", "-O1", "-O2", "-framepointer"] + x for x in compile_args if x in {"-g3", "-g", "-O0", "-O1", "-O2", "-framepointer", "-KPIC"} ] if "-mips2" not in compile_args: opt_flags.append("-mips1") -asmproc_flags += opt_flags + [in_file] +asmproc_flags += opt_flags + [str(in_file)] # Drop .mdebug and .gptab sections from resulting binaries. This makes # resulting .o files much smaller and speeds up builds, but loses line @@ -45,50 +54,61 @@ asmproc_flags += opt_flags + [in_file] # Convert encoding before compiling. # asmproc_flags += ["--input-enc", "utf-8", "--output-enc", "euc-jp"] -preprocessed_file = tempfile.NamedTemporaryFile( - prefix="preprocessed", suffix=".c", delete=False -) +with tempfile.TemporaryDirectory(prefix="asm_processor") as tmpdirname: + tmpdir_path = Path(tmpdirname) + preprocessed_filename = "preprocessed_" + uuid.uuid4().hex + in_file.suffix + preprocessed_path = tmpdir_path / preprocessed_filename + + with preprocessed_path.open("wb") as f: + functions, deps = asm_processor.run(asmproc_flags, outfile=f) + + if keep_preprocessed_files: + import shutil + + keep_output_dir = Path("./asm_processor_preprocessed") + keep_output_dir.mkdir(parents=True, exist_ok=True) + + shutil.copy( + preprocessed_path, + keep_output_dir / (in_file.stem + "_" + preprocessed_filename), + ) -try: compile_cmdline = ( - compiler + compile_args + ["-I", in_dir, "-o", out_file, preprocessed_file.name] + compiler + + compile_args + + ["-I", str(in_dir), "-o", str(out_file), str(preprocessed_path)] ) - functions, deps = asm_processor.run(asmproc_flags, outfile=preprocessed_file) try: subprocess.check_call(compile_cmdline) except subprocess.CalledProcessError as e: - print("Failed to compile file " + in_file + ". Command line:") + print("Failed to compile file " + str(in_file) + ". Command line:") print() print(" ".join(shlex.quote(x) for x in compile_cmdline)) print() sys.exit(55) - # To keep the preprocessed file: - # os._exit(1) asm_processor.run( asmproc_flags + [ "--post-process", - out_file, + str(out_file), "--assembler", assembler_sh, "--asm-prelude", - prelude, + str(asm_prelude_path), ], functions=functions, ) - deps_file = out_file[:-2] + ".asmproc.d" + deps_file = out_file.with_suffix(".asmproc.d") if deps: - with open(deps_file, "w") as f: - f.write(out_file + ": " + " \\\n ".join(deps) + "\n") + with deps_file.open("w") as f: + f.write(str(out_file) + ": " + " \\\n ".join(deps) + "\n") for dep in deps: f.write("\n" + dep + ":\n") else: try: - os.remove(deps_file) + deps_file.unlink() except OSError: pass -finally: - os.remove(preprocessed_file.name) diff --git a/tools/asm-processor/compile-test.sh b/tools/asm-processor/compile-test.sh new file mode 100755 index 000000000..65516629e --- /dev/null +++ b/tools/asm-processor/compile-test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -o pipefail +INPUT="$1" +OUTPUT="${INPUT%.*}.o" + +rm -f "$OUTPUT" + +CC="$MIPS_CC" # ido 7.1 via recomp or qemu-irix +AS="mips-linux-gnu-as" +ASFLAGS="-march=vr4300 -mabi=32" +OPTFLAGS=$(grep 'COMPILE-FLAGS: ' $INPUT | sed 's#^.*COMPILE-FLAGS: ##' | sed 's#}$##') +ASMPFLAGS=$(grep 'ASMP-FLAGS: ' $INPUT | sed 's#^.*ASMP-FLAGS: ##' | sed 's#}$##') +ISET=$(grep 'COMPILE-ISET: ' $INPUT | sed 's#^.*COMPILE-ISET: ##' | sed 's#}$##') +if [[ -z "$OPTFLAGS" ]]; then + OPTFLAGS="-g" +fi +CFLAGS="-Wab,-r4300_mul -G 0 -Xcpluscomm -fullwarn -wlint -woff 819,820,852,821 -signed -c" +if [[ -z "$ISET" ]]; then + CFLAGS="$CFLAGS -mips2" +fi +if [[ "$OPTFLAGS" != *-KPIC* ]]; then + CFLAGS="$CFLAGS -non_shared" +fi + +set -e +python3 build.py --drop-mdebug-gptab $ASMPFLAGS $CC -- $AS $ASFLAGS -- $CFLAGS $OPTFLAGS $ISET -o "$OUTPUT" "$INPUT" diff --git a/tools/asm-processor/run-tests.sh b/tools/asm-processor/run-tests.sh new file mode 100755 index 000000000..5cae0a741 --- /dev/null +++ b/tools/asm-processor/run-tests.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +for A in tests/*.c tests/*.p; do + OBJDUMPFLAGS=-srt + echo $A + ./compile-test.sh "$A" && mips-linux-gnu-objdump $OBJDUMPFLAGS "${A%.*}.o" | diff - "${A%.*}.objdump" || echo FAIL "$A" +done diff --git a/tools/asm-processor/tests/ascii.c b/tools/asm-processor/tests/ascii.c new file mode 100644 index 000000000..bb27d2527 --- /dev/null +++ b/tools/asm-processor/tests/ascii.c @@ -0,0 +1,19 @@ +void foo(void) { "abcdef"; } + +GLOBAL_ASM( +.rdata + .ascii "AB" + .ascii "CD", "EF" + .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" +) + +void bar(void) { "hello"; } + +GLOBAL_ASM( +.rdata + .asciiz "12" + .asciiz "34", "56" + .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" +) + +void baz(void) { "ghijkl"; } diff --git a/tools/asm-processor/tests/ascii.objdump b/tools/asm-processor/tests/ascii.objdump new file mode 100644 index 000000000..bf42638a9 --- /dev/null +++ b/tools/asm-processor/tests/ascii.objdump @@ -0,0 +1,29 @@ + +tests/ascii.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000030 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000010 foo +00000010 g F .text 00000010 bar +00000020 g F .text 00000010 baz + + +Contents of section .text: + 0000 03e00008 00000000 03e00008 00000000 ................ + 0010 03e00008 00000000 03e00008 00000000 ................ + 0020 03e00008 00000000 03e00008 00000000 ................ +Contents of section .rodata: + 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH + 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ + 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 + 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ + 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/comments.c b/tools/asm-processor/tests/comments.c new file mode 100644 index 000000000..4c9366991 --- /dev/null +++ b/tools/asm-processor/tests/comments.c @@ -0,0 +1,6 @@ +const char before[] = "^"; +GLOBAL_ASM( +.rdata +.asciz "aaaa /* bbbb */ # cccc", /**//**//**//**/ /*/ "xxxx" /*/ /* dddd " eeee */ "# ffff" # gggg "hhhh" /* iiii */ +) +const char after[] = "$"; diff --git a/tools/asm-processor/tests/comments.objdump b/tools/asm-processor/tests/comments.objdump new file mode 100644 index 000000000..246df2094 --- /dev/null +++ b/tools/asm-processor/tests/comments.objdump @@ -0,0 +1,21 @@ + +tests/comments.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .rodata 00000030 .rodata +00000000 g O .rodata 00000002 before +00000024 g O .rodata 00000002 after + + +Contents of section .rodata: + 0000 5e000000 61616161 202f2a20 62626262 ^...aaaa /* bbbb + 0010 202a2f20 23206363 63630023 20666666 */ # cccc.# fff + 0020 66000000 24000000 00000000 00000000 f...$........... +Contents of section .options: + 0000 01200000 00000000 00000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/force.c b/tools/asm-processor/tests/force.c new file mode 100644 index 000000000..03b630c13 --- /dev/null +++ b/tools/asm-processor/tests/force.c @@ -0,0 +1,17 @@ +// COMPILE-FLAGS: -O2 +// ASMP-FLAGS: --convert-statics=global-with-filename --force +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/force.objdump b/tools/asm-processor/tests/force.objdump new file mode 100644 index 000000000..7ef70247b --- /dev/null +++ b/tools/asm-processor/tests/force.objdump @@ -0,0 +1,47 @@ + +tests/force.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000050 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000014 g F .text 00000034 baz +00000004 g O .rodata 00000000 tests/force.o:rodata2 +00000004 g O .data 00000000 tests/force.o:data2 +00000004 g O .bss 00000000 tests/force.o:bss2 +00000000 g F .text 00000000 tests/force.o:xtext + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000001c R_MIPS_HI16 .bss +00000034 R_MIPS_LO16 .bss +00000020 R_MIPS_HI16 .rodata +0000002c R_MIPS_LO16 .rodata +00000024 R_MIPS_HI16 .data +00000028 R_MIPS_LO16 .data +00000030 R_MIPS_26 .text + + +Contents of section .text: + 0000 afa40000 afa50004 afa60008 03e00008 ................ + 0010 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0020 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0030 0c000000 8c840004 8fbf0014 27bd0018 ............'... + 0040 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/kpic-o1.c b/tools/asm-processor/tests/kpic-o1.c new file mode 100644 index 000000000..4d3346d2f --- /dev/null +++ b/tools/asm-processor/tests/kpic-o1.c @@ -0,0 +1,93 @@ +// COMPILE-FLAGS: -O1 -KPIC +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +addiu $a0, $a0, 4 +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +addiu $a0, $a0, 9 +addiu $a0, $a0, 10 +addiu $a0, $a0, 11 +addiu $a0, $a0, 12 +) +GLOBAL_ASM( +.late_rodata +.float 1 +.text +glabel float_fn +addiu $a0, $a0, 13 +addiu $a0, $a0, 14 +addiu $a0, $a0, 15 +addiu $a0, $a0, 16 +addiu $a0, $a0, 17 +addiu $a0, $a0, 18 +addiu $a0, $a0, 19 +addiu $a0, $a0, 20 +addiu $a0, $a0, 21 +addiu $a0, $a0, 22 +addiu $a0, $a0, 23 +addiu $a0, $a0, 24 +addiu $a0, $a0, 25 +addiu $a0, $a0, 26 +addiu $a0, $a0, 27 +addiu $a0, $a0, 28 +addiu $a0, $a0, 29 +addiu $a0, $a0, 30 +) +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 4 +.float 2 +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles +addiu $a0, $a0, 31 +addiu $a0, $a0, 32 +addiu $a0, $a0, 33 +addiu $a0, $a0, 34 +addiu $a0, $a0, 35 +addiu $a0, $a0, 36 +addiu $a0, $a0, 37 +addiu $a0, $a0, 38 +addiu $a0, $a0, 39 +addiu $a0, $a0, 40 +addiu $a0, $a0, 41 +addiu $a0, $a0, 42 +addiu $a0, $a0, 43 +addiu $a0, $a0, 44 +addiu $a0, $a0, 45 +addiu $a0, $a0, 46 +addiu $a0, $a0, 47 +addiu $a0, $a0, 48 +addiu $a0, $a0, 49 +addiu $a0, $a0, 50 +addiu $a0, $a0, 51 +addiu $a0, $a0, 52 +addiu $a0, $a0, 53 +addiu $a0, $a0, 54 +addiu $a0, $a0, 55 +addiu $a0, $a0, 56 +addiu $a0, $a0, 57 +addiu $a0, $a0, 58 +addiu $a0, $a0, 59 +addiu $a0, $a0, 60 +addiu $a0, $a0, 61 +addiu $a0, $a0, 62 +addiu $a0, $a0, 63 +addiu $a0, $a0, 64 +addiu $a0, $a0, 65 +addiu $a0, $a0, 66 +addiu $a0, $a0, 67 +addiu $a0, $a0, 68 +) diff --git a/tools/asm-processor/tests/kpic-o1.objdump b/tools/asm-processor/tests/kpic-o1.objdump new file mode 100644 index 000000000..6e336753a --- /dev/null +++ b/tools/asm-processor/tests/kpic-o1.objdump @@ -0,0 +1,46 @@ + +tests/kpic-o1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000110 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000030 foo +00000030 g F .text 00000048 float_fn +00000078 g F .text 00000098 doubles +00000000 O *UND* 00000000 _gp_disp + + +RELOCATION RECORDS FOR [.text]: (none) + +Contents of section .text: + 0000 24840001 24840002 24840003 24840004 $...$...$...$... + 0010 24840005 24840006 24840007 24840008 $...$...$...$... + 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... + 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... + 0040 24840011 24840012 24840013 24840014 $...$...$...$... + 0050 24840015 24840016 24840017 24840018 $...$...$...$... + 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... + 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. + 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ + 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( + 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., + 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 + 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 + 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 + 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< + 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ + 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D +Contents of section .rodata: + 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... + 0010 40000000 00000000 40080000 00000000 @.......@....... + 0020 40100000 00000000 40140000 00000000 @.......@....... + 0030 40180000 00000000 401c0000 00000000 @.......@....... + 0040 40200000 00000000 00000000 00000000 @ .............. +Contents of section .options: + 0000 01200000 00000000 92000002 00000000 . .............. + 0010 000f0ff0 00000000 00000000 00000000 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 92000012 00000000 000f0ff0 00000000 ................ + 0010 00000000 00000000 ........ diff --git a/tools/asm-processor/tests/kpic-o2.c b/tools/asm-processor/tests/kpic-o2.c new file mode 100644 index 000000000..f037341cc --- /dev/null +++ b/tools/asm-processor/tests/kpic-o2.c @@ -0,0 +1,92 @@ +// COMPILE-FLAGS: -O2 -KPIC +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +addiu $a0, $a0, 4 +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +addiu $a0, $a0, 9 +addiu $a0, $a0, 10 +addiu $a0, $a0, 11 +addiu $a0, $a0, 12 +) +GLOBAL_ASM( +.late_rodata +.float 1 +.text +glabel float_fn +addiu $a0, $a0, 13 +addiu $a0, $a0, 14 +addiu $a0, $a0, 15 +addiu $a0, $a0, 16 +addiu $a0, $a0, 17 +addiu $a0, $a0, 18 +addiu $a0, $a0, 19 +addiu $a0, $a0, 20 +addiu $a0, $a0, 21 +addiu $a0, $a0, 22 +addiu $a0, $a0, 23 +addiu $a0, $a0, 24 +addiu $a0, $a0, 25 +addiu $a0, $a0, 26 +addiu $a0, $a0, 27 +addiu $a0, $a0, 28 +addiu $a0, $a0, 29 +addiu $a0, $a0, 30 +) +GLOBAL_ASM( +.late_rodata +.float 2 +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles +addiu $a0, $a0, 31 +addiu $a0, $a0, 32 +addiu $a0, $a0, 33 +addiu $a0, $a0, 34 +addiu $a0, $a0, 35 +addiu $a0, $a0, 36 +addiu $a0, $a0, 37 +addiu $a0, $a0, 38 +addiu $a0, $a0, 39 +addiu $a0, $a0, 40 +addiu $a0, $a0, 41 +addiu $a0, $a0, 42 +addiu $a0, $a0, 43 +addiu $a0, $a0, 44 +addiu $a0, $a0, 45 +addiu $a0, $a0, 46 +addiu $a0, $a0, 47 +addiu $a0, $a0, 48 +addiu $a0, $a0, 49 +addiu $a0, $a0, 50 +addiu $a0, $a0, 51 +addiu $a0, $a0, 52 +addiu $a0, $a0, 53 +addiu $a0, $a0, 54 +addiu $a0, $a0, 55 +addiu $a0, $a0, 56 +addiu $a0, $a0, 57 +addiu $a0, $a0, 58 +addiu $a0, $a0, 59 +addiu $a0, $a0, 60 +addiu $a0, $a0, 61 +addiu $a0, $a0, 62 +addiu $a0, $a0, 63 +addiu $a0, $a0, 64 +addiu $a0, $a0, 65 +addiu $a0, $a0, 66 +addiu $a0, $a0, 67 +addiu $a0, $a0, 68 +) diff --git a/tools/asm-processor/tests/kpic-o2.objdump b/tools/asm-processor/tests/kpic-o2.objdump new file mode 100644 index 000000000..abf87aeb4 --- /dev/null +++ b/tools/asm-processor/tests/kpic-o2.objdump @@ -0,0 +1,46 @@ + +tests/kpic-o2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000110 .text +00000000 l d .rodata 00000050 .rodata +00000000 g F .text 00000030 foo +00000030 g F .text 00000048 float_fn +00000078 g F .text 00000098 doubles +00000000 O *UND* 00000000 _gp_disp + + +RELOCATION RECORDS FOR [.text]: (none) + +Contents of section .text: + 0000 24840001 24840002 24840003 24840004 $...$...$...$... + 0010 24840005 24840006 24840007 24840008 $...$...$...$... + 0020 24840009 2484000a 2484000b 2484000c $...$...$...$... + 0030 2484000d 2484000e 2484000f 24840010 $...$...$...$... + 0040 24840011 24840012 24840013 24840014 $...$...$...$... + 0050 24840015 24840016 24840017 24840018 $...$...$...$... + 0060 24840019 2484001a 2484001b 2484001c $...$...$...$... + 0070 2484001d 2484001e 2484001f 24840020 $...$...$...$.. + 0080 24840021 24840022 24840023 24840024 $..!$.."$..#$..$ + 0090 24840025 24840026 24840027 24840028 $..%$..&$..'$..( + 00a0 24840029 2484002a 2484002b 2484002c $..)$..*$..+$.., + 00b0 2484002d 2484002e 2484002f 24840030 $..-$...$../$..0 + 00c0 24840031 24840032 24840033 24840034 $..1$..2$..3$..4 + 00d0 24840035 24840036 24840037 24840038 $..5$..6$..7$..8 + 00e0 24840039 2484003a 2484003b 2484003c $..9$..:$..;$..< + 00f0 2484003d 2484003e 2484003f 24840040 $..=$..>$..?$..@ + 0100 24840041 24840042 24840043 24840044 $..A$..B$..C$..D +Contents of section .rodata: + 0000 3f800000 40000000 3ff00000 00000000 ?...@...?....... + 0010 40000000 00000000 40080000 00000000 @.......@....... + 0020 40100000 00000000 40140000 00000000 @.......@....... + 0030 40180000 00000000 401c0000 00000000 @.......@....... + 0040 40200000 00000000 00000000 00000000 @ .............. +Contents of section .options: + 0000 01200000 00000000 92000002 00000000 . .............. + 0010 000f0ff0 00000000 00000000 00000000 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 92000012 00000000 000f0ff0 00000000 ................ + 0010 00000000 00000000 ........ diff --git a/tools/asm-processor/tests/label-sameline.c b/tools/asm-processor/tests/label-sameline.c new file mode 100644 index 000000000..a35b43d85 --- /dev/null +++ b/tools/asm-processor/tests/label-sameline.c @@ -0,0 +1,7 @@ +GLOBAL_ASM( +.rdata +.word 0x12345678 +glabel blah +.word blah2 + /*a*/ blah2: /*b*/ .word blah /*c*/ +) diff --git a/tools/asm-processor/tests/label-sameline.objdump b/tools/asm-processor/tests/label-sameline.objdump new file mode 100644 index 000000000..1f1aacff4 --- /dev/null +++ b/tools/asm-processor/tests/label-sameline.objdump @@ -0,0 +1,25 @@ + +tests/label-sameline.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .rodata 00000010 .rodata +00000000 l d .rodata 00000000 +00000004 g .rodata 00000000 blah + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +00000004 R_MIPS_32 +00000008 R_MIPS_32 blah + + +Contents of section .rodata: + 0000 12345678 00000008 00000000 00000000 .4Vx............ +Contents of section .options: + 0000 01200000 00000000 00000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/large.c b/tools/asm-processor/tests/large.c new file mode 100644 index 000000000..4ffb4ac12 --- /dev/null +++ b/tools/asm-processor/tests/large.c @@ -0,0 +1,164 @@ + +GLOBAL_ASM( +glabel test + +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 +addiu $sp, $sp, -24 + sw $zero, 4($sp) +lw $t6, 4($sp) +addu $t7, $a0, $t6 +sb $zero, ($t7) +lw $t8, 4($sp) +addiu $t9, $t8, 1 +slt $at, $t9, $a1 + sw $t9, 4($sp) + nop +jr $ra + addiu $sp, $sp, 24 + +) + +void foo(void) {} diff --git a/tools/asm-processor/tests/large.objdump b/tools/asm-processor/tests/large.objdump new file mode 100644 index 000000000..17409a7af --- /dev/null +++ b/tools/asm-processor/tests/large.objdump @@ -0,0 +1,58 @@ + +tests/large.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000280 .text +00000270 g F .text 00000010 foo +00000000 g F .text 00000270 test + + +Contents of section .text: + 0000 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0010 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0020 afb90004 00000000 03e00008 27bd0018 ............'... + 0030 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0040 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0050 afb90004 00000000 03e00008 27bd0018 ............'... + 0060 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0070 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0080 afb90004 00000000 03e00008 27bd0018 ............'... + 0090 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 00a0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 00b0 afb90004 00000000 03e00008 27bd0018 ............'... + 00c0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 00d0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 00e0 afb90004 00000000 03e00008 27bd0018 ............'... + 00f0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0100 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0110 afb90004 00000000 03e00008 27bd0018 ............'... + 0120 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0130 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0140 afb90004 00000000 03e00008 27bd0018 ............'... + 0150 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0160 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0170 afb90004 00000000 03e00008 27bd0018 ............'... + 0180 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0190 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 01a0 afb90004 00000000 03e00008 27bd0018 ............'... + 01b0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 01c0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 01d0 afb90004 00000000 03e00008 27bd0018 ............'... + 01e0 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 01f0 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0200 afb90004 00000000 03e00008 27bd0018 ............'... + 0210 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0220 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0230 afb90004 00000000 03e00008 27bd0018 ............'... + 0240 27bdffe8 afa00004 8fae0004 008e7821 '.............x! + 0250 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0260 afb90004 00000000 03e00008 27bd0018 ............'... + 0270 03e00008 00000000 03e00008 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00000000 00000000 ...2............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_align.c b/tools/asm-processor/tests/late_rodata_align.c new file mode 100644 index 000000000..7367c792b --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_align.c @@ -0,0 +1,80 @@ +GLOBAL_ASM( +.late_rodata + .float 4.1 + .float 4.2 + .float 4.3 + .float 4.4 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { "foo"; return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 4 + .float 5.1 + .float 5.2 + .float 5.3 + .float 5.4 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { "bar"; return 1.2f; } + +GLOBAL_ASM( +.late_rodata +.late_rodata_alignment 8 + .float 6.1 + .float 6.2 + .float 6.3 + .float 6.4 + .float 6.5 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + diff --git a/tools/asm-processor/tests/late_rodata_align.objdump b/tools/asm-processor/tests/late_rodata_align.objdump new file mode 100644 index 000000000..87c05e866 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_align.objdump @@ -0,0 +1,51 @@ + +tests/late_rodata_align.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000050 .rodata +00000040 g F .text 0000001c foo +00000090 g F .text 0000001c bar +00000000 g F .text 00000040 a +0000005c g F .text 00000034 b +000000ac g F .text 00000038 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +00000090 R_MIPS_HI16 .rodata +00000098 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 c4200018 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 3c010000 03e00008 c420002c 03e00008 <........ .,.... + 00a0 00000000 03e00008 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 666f6f00 62617200 40833333 40866666 foo.bar.@.33@.ff + 0010 4089999a 408ccccd 3f8ccccd 40a33333 @...@...?...@.33 + 0020 40a66666 40a9999a 40accccd 3f99999a @.ff@...@...?... + 0030 40c33333 40c66666 40c9999a 40cccccd @.33@.ff@...@... + 0040 40d00000 00000000 00000000 00000000 @............... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000005f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000005f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_doubles.c b/tools/asm-processor/tests/late_rodata_doubles.c new file mode 100644 index 000000000..0a27b4148 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles.c @@ -0,0 +1,83 @@ +GLOBAL_ASM( +.late_rodata + .float 4.1 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { + return 4.15f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.2 + .word 0 + .double 4.3 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { + return 4.4f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.55 + .double 4.6 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float baz(void) { + return 4.6f; +} diff --git a/tools/asm-processor/tests/late_rodata_doubles.objdump b/tools/asm-processor/tests/late_rodata_doubles.objdump new file mode 100644 index 000000000..84d7e67f4 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles.objdump @@ -0,0 +1,55 @@ + +tests/late_rodata_doubles.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000120 .text +00000000 l d .rodata 00000030 .rodata +00000040 g F .text 0000001c foo +0000009c g F .text 0000001c bar +000000f8 g F .text 0000001c baz +00000000 g F .text 00000040 a +0000005c g F .text 00000040 b +000000b8 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +0000009c R_MIPS_HI16 .rodata +000000a4 R_MIPS_LO16 .rodata +000000f8 R_MIPS_HI16 .rodata +00000100 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 c4200004 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 3c010000 ............<... + 00a0 03e00008 c4200018 03e00008 00000000 ..... .......... + 00b0 03e00008 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ + 00f0 00000000 00000000 3c010000 03e00008 ........<....... + 0100 c4200028 03e00008 00000000 03e00008 . .(............ + 0110 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... + 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... + 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_doubles_mips1.c b/tools/asm-processor/tests/late_rodata_doubles_mips1.c new file mode 100644 index 000000000..b97261f68 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles_mips1.c @@ -0,0 +1,86 @@ +// COMPILE-FLAGS: -O2 +// COMPILE-ISET: -mips1 +// exact copy of late_rodata_doubles.c except for the -mips1 -O2 additions +GLOBAL_ASM( +.late_rodata + .float 4.1 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float foo(void) { + return 4.15f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.2 + .word 0 + .double 4.3 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float bar(void) { + return 4.4f; +} + +GLOBAL_ASM( +.late_rodata + .float 4.55 + .double 4.6 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +float baz(void) { + return 4.6f; +} diff --git a/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump b/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump new file mode 100644 index 000000000..8fac85f46 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_doubles_mips1.objdump @@ -0,0 +1,52 @@ + +tests/late_rodata_doubles_mips1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000030 .rodata +00000040 g F .text 00000010 foo +00000090 g F .text 00000010 bar +000000e0 g F .text 00000010 baz +00000000 g F .text 00000040 a +00000050 g F .text 00000040 b +000000a0 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000044 R_MIPS_LO16 .rodata +00000090 R_MIPS_HI16 .rodata +00000094 R_MIPS_LO16 .rodata +000000e0 R_MIPS_HI16 .rodata +000000e4 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 c4200004 03e00008 00000000 <.... .......... + 0050 00000000 00000000 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 3c010000 c4200018 03e00008 00000000 <.... .......... + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 3c010000 c4200028 03e00008 00000000 <.... .(........ +Contents of section .rodata: + 0000 40833333 4084cccd 40866666 00000000 @.33@...@.ff.... + 0010 40113333 33333333 408ccccd 4091999a @.333333@...@... + 0020 40126666 66666666 40933333 00000000 @.ffffff@.33.... +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000c0011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000c0011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_jtbl.c b/tools/asm-processor/tests/late_rodata_jtbl.c new file mode 100644 index 000000000..3c2a5bba2 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl.c @@ -0,0 +1,153 @@ +// COMPILE-FLAGS: -O2 +GLOBAL_ASM( +.late_rodata +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles1 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +float a(void) { return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.float 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.double 9 +.float 10 +.text +glabel doubles2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +glabel a2 +move $a0, $a0 +nop +nop +nop +jr $ra +move $a0, $a0 +) + +GLOBAL_ASM( +.late_rodata + +glabel jtbl +.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 +.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 +.word case21, case22, case23, case24, case25, case26 + +.text +glabel foo +sltiu $at, $a0, 0xa +beqz $at, .L756E659B + sll $t7, $a0, 2 +lui $at, %hi(jtbl) +addu $at, $at, $t7 +lw $t7, %lo(jtbl)($at) +jr $t7 + nop +case0: addiu $a0, $a0, 1 +case1: addiu $a0, $a0, 1 +case2: addiu $a0, $a0, 1 +case3: addiu $a0, $a0, 1 +case4: addiu $a0, $a0, 1 +case5: addiu $a0, $a0, 1 +case6: addiu $a0, $a0, 1 +case7: addiu $a0, $a0, 1 +case8: addiu $a0, $a0, 1 +case9: addiu $a0, $a0, 1 +case10: addiu $a0, $a0, 1 +case11: addiu $a0, $a0, 1 +case12: addiu $a0, $a0, 1 +case13: addiu $a0, $a0, 1 +case14: addiu $a0, $a0, 1 +case15: addiu $a0, $a0, 1 +case16: addiu $a0, $a0, 1 +case17: addiu $a0, $a0, 1 +case18: addiu $a0, $a0, 1 +case19: addiu $a0, $a0, 1 +case20: addiu $a0, $a0, 1 +case21: addiu $a0, $a0, 1 +case22: addiu $a0, $a0, 1 +case23: addiu $a0, $a0, 1 +case24: addiu $a0, $a0, 1 +case25: addiu $a0, $a0, 1 +case26: +jr $ra + addiu $v0, $a0, 1 + +.L756E659B: +addiu $v0, $zero, 2 +jr $ra + nop +) + +GLOBAL_ASM( +glabel b2 +move $a0, $a0 +nop +nop +jr $ra +move $a0, $a0 +) + +float b(void) { return 1.2f; } diff --git a/tools/asm-processor/tests/late_rodata_jtbl.objdump b/tools/asm-processor/tests/late_rodata_jtbl.objdump new file mode 100644 index 000000000..44bb6e847 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl.objdump @@ -0,0 +1,110 @@ + +tests/late_rodata_jtbl.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000001a0 .text +00000000 l d .rodata 00000100 .rodata +00000000 l d .text 00000000 +0000005c g F .text 0000000c a +0000018c g F .text 0000000c b +00000000 g F .text 0000005c doubles1 +00000068 g F .text 0000005c doubles2 +000000c4 g F .text 00000018 a2 +000000dc g F .text 0000009c foo +0000008c g .rodata 00000000 jtbl +00000178 g F .text 00000014 b2 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000005c R_MIPS_HI16 .rodata +00000064 R_MIPS_LO16 .rodata +0000018c R_MIPS_HI16 .rodata +00000194 R_MIPS_LO16 .rodata +000000e8 R_MIPS_HI16 jtbl +000000f0 R_MIPS_LO16 jtbl + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000008c R_MIPS_32 +00000090 R_MIPS_32 +00000094 R_MIPS_32 +00000098 R_MIPS_32 +0000009c R_MIPS_32 +000000a0 R_MIPS_32 +000000a4 R_MIPS_32 +000000a8 R_MIPS_32 +000000ac R_MIPS_32 +000000b0 R_MIPS_32 +000000b4 R_MIPS_32 +000000b8 R_MIPS_32 +000000bc R_MIPS_32 +000000c0 R_MIPS_32 +000000c4 R_MIPS_32 +000000c8 R_MIPS_32 +000000cc R_MIPS_32 +000000d0 R_MIPS_32 +000000d4 R_MIPS_32 +000000d8 R_MIPS_32 +000000dc R_MIPS_32 +000000e0 R_MIPS_32 +000000e4 R_MIPS_32 +000000e8 R_MIPS_32 +000000ec R_MIPS_32 +000000f0 R_MIPS_32 +000000f4 R_MIPS_32 + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 00000000 00000000 00000000 00000000 ................ + 0050 00000000 00000000 00000000 3c010000 ............<... + 0060 03e00008 c4200040 00000000 00000000 ..... .@........ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00802025 00000000 00000000 ...... %........ + 00d0 00000000 03e00008 00802025 2c81000a .......... %,... + 00e0 10200022 00047880 3c010000 002f0821 . ."..x.<..../.! + 00f0 8c2f0000 01e00008 00000000 24840001 ./..........$... + 0100 24840001 24840001 24840001 24840001 $...$...$...$... + 0110 24840001 24840001 24840001 24840001 $...$...$...$... + 0120 24840001 24840001 24840001 24840001 $...$...$...$... + 0130 24840001 24840001 24840001 24840001 $...$...$...$... + 0140 24840001 24840001 24840001 24840001 $...$...$...$... + 0150 24840001 24840001 24840001 24840001 $...$...$...$... + 0160 24840001 03e00008 24820001 24020002 $.......$...$... + 0170 03e00008 00000000 00802025 00000000 .......... %.... + 0180 00000000 03e00008 00802025 3c010000 .......... %<... + 0190 03e00008 c42000f8 00000000 00000000 ..... .......... +Contents of section .rodata: + 0000 3ff00000 00000000 40000000 00000000 ?.......@....... + 0010 40080000 00000000 40100000 00000000 @.......@....... + 0020 40140000 00000000 40180000 00000000 @.......@....... + 0030 401c0000 00000000 40200000 00000000 @.......@ ...... + 0040 3f8ccccd 3f800000 40000000 00000000 ?...?...@....... + 0050 40080000 00000000 40100000 00000000 @.......@....... + 0060 40140000 00000000 40180000 00000000 @.......@....... + 0070 401c0000 00000000 40200000 00000000 @.......@ ...... + 0080 40220000 00000000 41200000 000000fc @"......A ...... + 0090 00000100 00000104 00000108 0000010c ................ + 00a0 00000110 00000114 00000118 0000011c ................ + 00b0 00000120 00000124 00000128 0000012c ... ...$...(..., + 00c0 00000130 00000134 00000138 0000013c ...0...4...8...< + 00d0 00000140 00000144 00000148 0000014c ...@...D...H...L + 00e0 00000150 00000154 00000158 0000015c ...P...T...X...\ + 00f0 00000160 00000164 3f99999a 00000000 ...`...d?....... +Contents of section .options: + 0000 01200000 00000000 80004002 00000000 . ........@..... + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 8000c016 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_jtbl_mips1.c b/tools/asm-processor/tests/late_rodata_jtbl_mips1.c new file mode 100644 index 000000000..505f4c1d5 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl_mips1.c @@ -0,0 +1,155 @@ +// COMPILE-FLAGS: -O2 +// COMPILE-ISET: -mips1 +// exact copy of late_rodata_jtbl.c except for the -mips1 addition +GLOBAL_ASM( +.late_rodata +.double 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.text +glabel doubles1 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +float a(void) { return 1.1f; } + +GLOBAL_ASM( +.late_rodata +.float 1 +.double 2 +.double 3 +.double 4 +.double 5 +.double 6 +.double 7 +.double 8 +.double 9 +.float 10 +.text +glabel doubles2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +glabel a2 +move $a0, $a0 +nop +nop +nop +jr $ra +move $a0, $a0 +) + +GLOBAL_ASM( +.late_rodata + +glabel jtbl +.word case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10 +.word case11, case12, case13, case14, case15, case16, case17, case18, case19, case20 +.word case21, case22, case23, case24, case25, case26 + +.text +glabel foo +sltiu $at, $a0, 0xa +beqz $at, .L756E659B + sll $t7, $a0, 2 +lui $at, %hi(jtbl) +addu $at, $at, $t7 +lw $t7, %lo(jtbl)($at) +jr $t7 + nop +case0: addiu $a0, $a0, 1 +case1: addiu $a0, $a0, 1 +case2: addiu $a0, $a0, 1 +case3: addiu $a0, $a0, 1 +case4: addiu $a0, $a0, 1 +case5: addiu $a0, $a0, 1 +case6: addiu $a0, $a0, 1 +case7: addiu $a0, $a0, 1 +case8: addiu $a0, $a0, 1 +case9: addiu $a0, $a0, 1 +case10: addiu $a0, $a0, 1 +case11: addiu $a0, $a0, 1 +case12: addiu $a0, $a0, 1 +case13: addiu $a0, $a0, 1 +case14: addiu $a0, $a0, 1 +case15: addiu $a0, $a0, 1 +case16: addiu $a0, $a0, 1 +case17: addiu $a0, $a0, 1 +case18: addiu $a0, $a0, 1 +case19: addiu $a0, $a0, 1 +case20: addiu $a0, $a0, 1 +case21: addiu $a0, $a0, 1 +case22: addiu $a0, $a0, 1 +case23: addiu $a0, $a0, 1 +case24: addiu $a0, $a0, 1 +case25: addiu $a0, $a0, 1 +case26: +jr $ra + addiu $v0, $a0, 1 + +.L756E659B: +addiu $v0, $zero, 2 +jr $ra + nop +) + +GLOBAL_ASM( +glabel b2 +move $a0, $a0 +nop +nop +jr $ra +move $a0, $a0 +) + +float b(void) { return 1.2f; } diff --git a/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump b/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump new file mode 100644 index 000000000..d37c8bb9e --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_jtbl_mips1.objdump @@ -0,0 +1,110 @@ + +tests/late_rodata_jtbl_mips1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000001a0 .text +00000000 l d .rodata 00000100 .rodata +00000000 l d .text 00000000 +0000005c g F .text 00000010 a +00000190 g F .text 00000010 b +00000000 g F .text 0000005c doubles1 +0000006c g F .text 0000005c doubles2 +000000c8 g F .text 00000018 a2 +000000e0 g F .text 0000009c foo +0000008c g .rodata 00000000 jtbl +0000017c g F .text 00000014 b2 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000005c R_MIPS_HI16 .rodata +00000060 R_MIPS_LO16 .rodata +00000190 R_MIPS_HI16 .rodata +00000194 R_MIPS_LO16 .rodata +000000ec R_MIPS_HI16 jtbl +000000f4 R_MIPS_LO16 jtbl + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000008c R_MIPS_32 +00000090 R_MIPS_32 +00000094 R_MIPS_32 +00000098 R_MIPS_32 +0000009c R_MIPS_32 +000000a0 R_MIPS_32 +000000a4 R_MIPS_32 +000000a8 R_MIPS_32 +000000ac R_MIPS_32 +000000b0 R_MIPS_32 +000000b4 R_MIPS_32 +000000b8 R_MIPS_32 +000000bc R_MIPS_32 +000000c0 R_MIPS_32 +000000c4 R_MIPS_32 +000000c8 R_MIPS_32 +000000cc R_MIPS_32 +000000d0 R_MIPS_32 +000000d4 R_MIPS_32 +000000d8 R_MIPS_32 +000000dc R_MIPS_32 +000000e0 R_MIPS_32 +000000e4 R_MIPS_32 +000000e8 R_MIPS_32 +000000ec R_MIPS_32 +000000f0 R_MIPS_32 +000000f4 R_MIPS_32 + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 00000000 00000000 00000000 00000000 ................ + 0050 00000000 00000000 00000000 3c010000 ............<... + 0060 c4200040 03e00008 00000000 00000000 . .@............ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00802025 00000000 .......... %.... + 00d0 00000000 00000000 03e00008 00802025 .............. % + 00e0 2c81000a 10200022 00047880 3c010000 ,.... ."..x.<... + 00f0 002f0821 8c2f0000 01e00008 00000000 ./.!./.......... + 0100 24840001 24840001 24840001 24840001 $...$...$...$... + 0110 24840001 24840001 24840001 24840001 $...$...$...$... + 0120 24840001 24840001 24840001 24840001 $...$...$...$... + 0130 24840001 24840001 24840001 24840001 $...$...$...$... + 0140 24840001 24840001 24840001 24840001 $...$...$...$... + 0150 24840001 24840001 24840001 24840001 $...$...$...$... + 0160 24840001 24840001 03e00008 24820001 $...$.......$... + 0170 24020002 03e00008 00000000 00802025 $............. % + 0180 00000000 00000000 03e00008 00802025 .............. % + 0190 3c010000 c42000f8 03e00008 00000000 <.... .......... +Contents of section .rodata: + 0000 3ff00000 00000000 40000000 00000000 ?.......@....... + 0010 40080000 00000000 40100000 00000000 @.......@....... + 0020 40140000 00000000 40180000 00000000 @.......@....... + 0030 401c0000 00000000 40200000 00000000 @.......@ ...... + 0040 3f8ccccd 3f800000 40000000 00000000 ?...?...@....... + 0050 40080000 00000000 40100000 00000000 @.......@....... + 0060 40140000 00000000 40180000 00000000 @.......@....... + 0070 401c0000 00000000 40200000 00000000 @.......@ ...... + 0080 40220000 00000000 41200000 00000100 @"......A ...... + 0090 00000104 00000108 0000010c 00000110 ................ + 00a0 00000114 00000118 0000011c 00000120 ............... + 00b0 00000124 00000128 0000012c 00000130 ...$...(...,...0 + 00c0 00000134 00000138 0000013c 00000140 ...4...8...<...@ + 00d0 00000144 00000148 0000014c 00000150 ...D...H...L...P + 00e0 00000154 00000158 0000015c 00000160 ...T...X...\...` + 00f0 00000164 00000168 3f99999a 00000000 ...d...h?....... +Contents of section .options: + 0000 01200000 00000000 80004002 00000000 . ........@..... + 0010 000000f1 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 8000c016 00000000 000000f1 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/late_rodata_misaligned_doubles.c b/tools/asm-processor/tests/late_rodata_misaligned_doubles.c new file mode 100644 index 000000000..a453dbdd4 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_misaligned_doubles.c @@ -0,0 +1,77 @@ +GLOBAL_ASM( +.late_rodata + .float 4.01 + .word 0 + .double 4.02 +.text +glabel a + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +double foo(void) { return 4.03; } + +GLOBAL_ASM( +.late_rodata + .float 4.04 + .double 4.05 +.text +glabel b + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + +double bar(void) { return 4.06; } +float baz(void) { return 4.07f; } + +GLOBAL_ASM( +.late_rodata + .double 4.08 +.text +glabel c + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +) + diff --git a/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump b/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump new file mode 100644 index 000000000..cdba84de4 --- /dev/null +++ b/tools/asm-processor/tests/late_rodata_misaligned_doubles.objdump @@ -0,0 +1,56 @@ + +tests/late_rodata_misaligned_doubles.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000120 .text +00000000 l d .rodata 00000040 .rodata +00000040 g F .text 0000001c foo +0000009c g F .text 0000001c bar +000000b8 g F .text 0000001c baz +00000000 g F .text 00000040 a +0000005c g F .text 00000040 b +000000d4 g F .text 00000040 c + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000040 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +0000009c R_MIPS_HI16 .rodata +000000a4 R_MIPS_LO16 .rodata +000000b8 R_MIPS_HI16 .rodata +000000c0 R_MIPS_LO16 .rodata + + +Contents of section .text: + 0000 00000000 00000000 00000000 00000000 ................ + 0010 00000000 00000000 00000000 00000000 ................ + 0020 00000000 00000000 00000000 00000000 ................ + 0030 00000000 00000000 00000000 00000000 ................ + 0040 3c010000 03e00008 d4200010 03e00008 <........ ...... + 0050 00000000 03e00008 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 3c010000 ............<... + 00a0 03e00008 d4200028 03e00008 00000000 ..... .(........ + 00b0 03e00008 00000000 3c010000 03e00008 ........<....... + 00c0 c4200030 03e00008 00000000 03e00008 . .0............ + 00d0 00000000 00000000 00000000 00000000 ................ + 00e0 00000000 00000000 00000000 00000000 ................ + 00f0 00000000 00000000 00000000 00000000 ................ + 0100 00000000 00000000 00000000 00000000 ................ + 0110 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 408051ec 00000000 4010147a e147ae14 @.Q.....@..z.G.. + 0010 40101eb8 51eb851f 00000000 408147ae @...Q.......@.G. + 0020 40103333 33333333 40103d70 a3d70a3d @.333333@.=p...= + 0030 40823d71 00000000 401051eb 851eb852 @.=q....@.Q....R +Contents of section .options: + 0000 01200000 00000000 80000002 00000000 . .............. + 0010 000000f3 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000002 00000000 000000f3 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/line-continuation-separate-file.s b/tools/asm-processor/tests/line-continuation-separate-file.s new file mode 100644 index 000000000..e1301804a --- /dev/null +++ b/tools/asm-processor/tests/line-continuation-separate-file.s @@ -0,0 +1,4 @@ +.rdata + label: .asciiz "1\n\ +2", \ + "34", "56" diff --git a/tools/asm-processor/tests/line-continuation.asmproc.d b/tools/asm-processor/tests/line-continuation.asmproc.d new file mode 100644 index 000000000..687dd1aee --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.asmproc.d @@ -0,0 +1,3 @@ +tests/line-continuation.o: tests/line-continuation-separate-file.s + +tests/line-continuation-separate-file.s: diff --git a/tools/asm-processor/tests/line-continuation.c b/tools/asm-processor/tests/line-continuation.c new file mode 100644 index 000000000..d5ab09372 --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.c @@ -0,0 +1,22 @@ +void foo(void) { "abcdef"; } + +GLOBAL_ASM( +.rdata + .ascii "AB" \ + "CD", "EF" + .ascii "GH\n\n\n\0\11\222\3333\44444\x1234567\n\nIJK" +) + +void bar(void) { "hello"; } + +GLOBAL_ASM( +.rdata + .asciiz "1\ +2" + .asciiz "34", "56" + .asciiz "78\n\n\n\0\11\222\3333\44444\x1234567\n\n9A" +) + +void baz(void) { "ghijkl"; } + +GLOBAL_ASM("tests/line-continuation-separate-file.s") diff --git a/tools/asm-processor/tests/line-continuation.objdump b/tools/asm-processor/tests/line-continuation.objdump new file mode 100644 index 000000000..038766fdb --- /dev/null +++ b/tools/asm-processor/tests/line-continuation.objdump @@ -0,0 +1,30 @@ + +tests/line-continuation.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000030 .text +00000000 l d .rodata 00000060 .rodata +00000000 g F .text 00000010 foo +00000010 g F .text 00000010 bar +00000020 g F .text 00000010 baz + + +Contents of section .text: + 0000 03e00008 00000000 03e00008 00000000 ................ + 0010 03e00008 00000000 03e00008 00000000 ................ + 0020 03e00008 00000000 03e00008 00000000 ................ +Contents of section .rodata: + 0000 61626364 65660000 41424344 45464748 abcdef..ABCDEFGH + 0010 0a0a0a00 0992db33 24343467 0a0a494a .......3$44g..IJ + 0020 4b000000 68656c6c 6f000000 31320033 K...hello...12.3 + 0030 34003536 0037380a 0a0a0009 92db3324 4.56.78.......3$ + 0040 3434670a 0a394100 6768696a 6b6c0000 44g..9A.ghijkl.. + 0050 310a3200 33340035 36000000 00000000 1.2.34.56....... +Contents of section .options: + 0000 01200000 00000000 80000000 00000000 . .............. + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000000 00000000 00000000 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/o0.c b/tools/asm-processor/tests/o0.c new file mode 100644 index 000000000..6f8e5e419 --- /dev/null +++ b/tools/asm-processor/tests/o0.c @@ -0,0 +1,28 @@ +// COMPILE-FLAGS: -O0 + +int a(void) { return 1; } +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +jr $ra +addiu $a0, $a0, 4 +) +float b(void) { return 1.2f; } +GLOBAL_ASM( +.late_rodata +glabel float1 +.float 12.34 + +.text +glabel bar +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +addiu $a0, $a0, 7 +addiu $a0, $a0, 8 +lui $v0, %hi(float1 + 1) +jr $ra +addiu $v0, $v0, %lo(float1 + 1) +) +float c(void) { return 1.3f; } diff --git a/tools/asm-processor/tests/o0.objdump b/tools/asm-processor/tests/o0.objdump new file mode 100644 index 000000000..f94ec7a05 --- /dev/null +++ b/tools/asm-processor/tests/o0.objdump @@ -0,0 +1,44 @@ + +tests/o0.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000090 .text +00000000 l d .rodata 00000010 .rodata +00000000 g F .text 0000001c a +00000030 g F .text 00000020 b +0000006c g F .text 00000020 c +0000001c g F .text 00000014 foo +00000050 g F .text 0000001c bar +00000004 g .rodata 00000000 float1 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000030 R_MIPS_HI16 .rodata +00000034 R_MIPS_LO16 .rodata +0000006c R_MIPS_HI16 .rodata +00000070 R_MIPS_LO16 .rodata +00000060 R_MIPS_HI16 float1 +00000068 R_MIPS_LO16 float1 + + +Contents of section .text: + 0000 24020001 03e00008 00000000 03e00008 $............... + 0010 00000000 03e00008 00000000 24840001 ............$... + 0020 24840002 24840003 03e00008 24840004 $...$.......$... + 0030 3c010000 c4200000 03e00008 00000000 <.... .......... + 0040 03e00008 00000000 03e00008 00000000 ................ + 0050 24840005 24840006 24840007 24840008 $...$...$...$... + 0060 3c020000 03e00008 24420001 3c010000 <.......$B..<... + 0070 c4200008 03e00008 00000000 03e00008 . .............. + 0080 00000000 03e00008 00000000 00000000 ................ +Contents of section .rodata: + 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... +Contents of section .options: + 0000 01200000 00000000 80000006 00000000 . .............. + 0010 00000011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000016 00000000 00000011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/o2.c b/tools/asm-processor/tests/o2.c new file mode 100644 index 000000000..144a604e0 --- /dev/null +++ b/tools/asm-processor/tests/o2.c @@ -0,0 +1,26 @@ +// COMPILE-FLAGS: -O2 + +int a(void) { return 1; } +GLOBAL_ASM( +glabel foo +addiu $a0, $a0, 1 +addiu $a0, $a0, 2 +addiu $a0, $a0, 3 +jr $ra +addiu $a0, $a0, 4 +) +float b(void) { return 1.2f; } +GLOBAL_ASM( +.late_rodata +glabel float1 +.float 12.34 + +.text +glabel bar +addiu $a0, $a0, 5 +addiu $a0, $a0, 6 +lui $v0, %hi(float1 + 1) +jr $ra +addiu $v0, $v0, %lo(float1 + 1) +) +float c(void) { return 1.3f; } diff --git a/tools/asm-processor/tests/o2.objdump b/tools/asm-processor/tests/o2.objdump new file mode 100644 index 000000000..61e3fb0e5 --- /dev/null +++ b/tools/asm-processor/tests/o2.objdump @@ -0,0 +1,40 @@ + +tests/o2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000050 .text +00000000 l d .rodata 00000010 .rodata +00000000 g F .text 00000008 a +0000001c g F .text 0000000c b +0000003c g F .text 0000000c c +00000008 g F .text 00000014 foo +00000028 g F .text 00000014 bar +00000004 g .rodata 00000000 float1 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000001c R_MIPS_HI16 .rodata +00000024 R_MIPS_LO16 .rodata +0000003c R_MIPS_HI16 .rodata +00000044 R_MIPS_LO16 .rodata +00000030 R_MIPS_HI16 float1 +00000038 R_MIPS_LO16 float1 + + +Contents of section .text: + 0000 03e00008 24020001 24840001 24840002 ....$...$...$... + 0010 24840003 03e00008 24840004 3c010000 $.......$...<... + 0020 03e00008 c4200000 24840005 24840006 ..... ..$...$... + 0030 3c020000 03e00008 24420001 3c010000 <.......$B..<... + 0040 03e00008 c4200008 00000000 00000000 ..... .......... +Contents of section .rodata: + 0000 3f99999a 414570a4 3fa66666 00000000 ?...AEp.?.ff.... +Contents of section .options: + 0000 01200000 00000000 80000006 00000000 . .............. + 0010 00000011 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80000016 00000000 00000011 00000000 ................ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/pascal.objdump b/tools/asm-processor/tests/pascal.objdump new file mode 100644 index 000000000..cb3740f0a --- /dev/null +++ b/tools/asm-processor/tests/pascal.objdump @@ -0,0 +1,137 @@ + +tests/pascal.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000e0 .text +00000000 l d .rodata 00000030 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 l O .bss 00000000 $dat +00000000 g F .text 0000000c foo +000000d0 g F .text 0000000c bar +0000000c g F .text 00000004 test +00000048 g F .text 00000004 test2 +0000008c g F .text 00000044 test3 +00000000 *UND* 00000000 get +00000000 *UND* 00000000 put +00000000 *UND* 00000000 pascal_close +00000000 *UND* 00000000 fflush +00000000 *UND* 00000000 filesize +00000000 *UND* 00000000 curpos +00000000 *UND* 00000000 seek +00000000 *UND* 00000000 eof +00000000 *UND* 00000000 eoln +00000000 *UND* 00000000 page +00000000 *UND* 00000000 reset +00000000 *UND* 00000000 rewrite +00000000 *UND* 00000000 cos +00000000 *UND* 00000000 exp +00000000 *UND* 00000000 sqrt +00000000 *UND* 00000000 log +00000000 *UND* 00000000 atan +00000000 *UND* 00000000 sin +00000000 *UND* 00000000 __random_float +00000000 *UND* 00000000 clock +00000000 *UND* 00000000 exit +00000000 *UND* 00000000 __date +00000000 *UND* 00000000 __time +00000000 *UND* 00000000 get_arg +00000000 *UND* 00000000 new +00000000 *UND* 00000000 dispose +00000000 *UND* 00000000 initfile +00000000 *UND* 00000000 peek_char +00000000 *UND* 00000000 next_char +00000000 *UND* 00000000 readln +00000000 *UND* 00000000 read_int64 +00000000 *UND* 00000000 read_card64 +00000000 *UND* 00000000 read_integer +00000000 *UND* 00000000 read_cardinal +00000000 *UND* 00000000 read_integer_range +00000000 *UND* 00000000 read_real +00000000 *UND* 00000000 read_double +00000000 *UND* 00000000 read_extended +00000000 *UND* 00000000 read_string +00000000 *UND* 00000000 read_enum +00000000 *UND* 00000000 read_char +00000000 *UND* 00000000 read_char_range +00000000 *UND* 00000000 read_boolean +00000000 *UND* 00000000 read_set +00000000 *UND* 00000000 writeln +00000000 *UND* 00000000 write_int64 +00000000 *UND* 00000000 write_card64 +00000000 *UND* 00000000 write_integer +00000000 *UND* 00000000 write_cardinal +00000000 *UND* 00000000 write_boolean +00000000 *UND* 00000000 write_char +00000000 *UND* 00000000 write_real +00000000 *UND* 00000000 write_double +00000000 *UND* 00000000 write_extended +00000000 *UND* 00000000 write_string +00000000 *UND* 00000000 write_enum +00000000 *UND* 00000000 write_set +00000000 *UND* 00000000 caseerror +00000000 *UND* 00000000 __pc_nloc_goto +00000000 *UND* 00000000 memcpy +00000000 *UND* 00000000 __in_range +00000000 *UND* 00000000 __ll_mul +00000000 *UND* 00000000 __ll_div +00000000 *UND* 00000000 __ull_div +00000000 *UND* 00000000 __ll_mod +00000000 *UND* 00000000 __ll_rem +00000000 *UND* 00000000 __ull_rem +00000000 *UND* 00000000 __ll_lshift +00000000 *UND* 00000000 __ll_rshift +00000000 *UND* 00000000 __ll_to_f +00000000 *UND* 00000000 __ull_to_f +00000000 *UND* 00000000 __ll_to_d +00000000 *UND* 00000000 __ull_to_d +00000000 *UND* 00000000 __f_ll_ll +00000000 *UND* 00000000 __f_to_ull +00000000 *UND* 00000000 __d_to_ll +00000000 *UND* 00000000 __d_to_ull +00000000 *UND* 00000000 round64 +00000000 *UND* 00000000 trunc64 +00000000 *UND* 00000000 max64 +00000000 *UND* 00000000 min64 +00000000 *UND* 00000000 abs64 +00000000 *UND* 00000000 odd64 +00000000 *UND* 00000000 trapNaN +00000000 *UND* 00000008 input +00000000 *UND* 00000008 output +00000000 *UND* 00000008 err +00000000 *UND* 00000008 __Argc + + +RELOCATION RECORDS FOR [.text]: (none) + +RELOCATION RECORDS FOR [.rodata]: (none) + +Contents of section .text: + 0000 00041080 03e00008 00441023 27bdffe8 .........D.#'... + 0010 18a00009 afa00004 8fae0004 008e7821 ..............x! + 0020 a1e00000 8fb80004 27190001 0325082a ........'....%.* + 0030 1420fff9 afb90004 10000001 00000000 . .............. + 0040 03e00008 27bd0018 00000000 00000000 ....'........... + 0050 00000000 00000000 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 00000000 00000000 ................ + 0080 00000000 00000000 00000000 00000000 ................ + 0090 00000000 00000000 00000000 00000000 ................ + 00a0 00000000 00000000 00000000 00000000 ................ + 00b0 00000000 00000000 00000000 00000000 ................ + 00c0 00000000 00000000 00000000 00000000 ................ + 00d0 00041080 03e00008 00441023 00000000 .........D.#.... +Contents of section .rodata: + 0000 00123123 00456456 00789789 00000001 ..1#.EdV.x...... + 0010 3ff19999 9999999a 00000002 00000003 ?............... + 0020 4000cccc cccccccd 00000000 00000000 @............... +Contents of section .data: + 0000 00002323 00003434 00000000 00000000 ..##..44........ +Contents of section .options: + 0000 01200000 00000000 80004016 00000000 . ........@..... + 0010 000000f0 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c036 00000000 000000f0 00000000 ...6............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/pascal.p b/tools/asm-processor/tests/pascal.p new file mode 100644 index 000000000..0886126ab --- /dev/null +++ b/tools/asm-processor/tests/pascal.p @@ -0,0 +1,95 @@ +{ COMPILE-FLAGS: -O2 } + +function foo(x: integer): integer; +begin + foo := x * 3 +end; + +GLOBAL_ASM( +.section .data +.word 0x2323 + +.late_rodata +.word 0x123123 +.word 0x456456 +.word 0x789789 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +GLOBAL_ASM( +.section .data +.word 0x3434 + +.late_rodata +.word 0x1 +.double 1.1 +.word 0x2, 0x3 +.text +glabel test2 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +GLOBAL_ASM( +.late_rodata +.double 2.1 +.text +glabel test3 +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +nop +) + +function bar(x: integer): integer; +begin + return x * 3 +end; + diff --git a/tools/asm-processor/tests/static-global.c b/tools/asm-processor/tests/static-global.c new file mode 100644 index 000000000..a7f616907 --- /dev/null +++ b/tools/asm-processor/tests/static-global.c @@ -0,0 +1,33 @@ +// COMPILE-FLAGS: -O2 +// ASMP-FLAGS: --convert-statics=global +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +GLOBAL_ASM( +glabel bar +lui $a0, %hi(rodata2) +lw $a0, %lo(rodata2)($a0) +lui $a1, %hi(data2) +lw $a1, %lo(data2)($a0) +lui $a2, %hi(bss2) +lw $a2, %lo(bss2)($a0) +jal xtext +nop +jr $ra +nop +nop +nop +) + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/static-global.objdump b/tools/asm-processor/tests/static-global.objdump new file mode 100644 index 000000000..a519e4f48 --- /dev/null +++ b/tools/asm-processor/tests/static-global.objdump @@ -0,0 +1,58 @@ + +tests/static-global.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000080 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000044 g F .text 00000034 baz +00000000 g F .text 00000030 bar +00000004 g O .rodata 00000000 rodata2 +00000004 g O .data 00000000 data2 +00000004 g O .bss 00000000 bss2 +00000030 g F .text 00000000 xtext + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000004c R_MIPS_HI16 .bss +00000064 R_MIPS_LO16 .bss +00000050 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .data +00000058 R_MIPS_LO16 .data +00000060 R_MIPS_26 .text +00000000 R_MIPS_HI16 rodata2 +00000004 R_MIPS_LO16 rodata2 +00000008 R_MIPS_HI16 data2 +0000000c R_MIPS_LO16 data2 +00000010 R_MIPS_HI16 bss2 +00000014 R_MIPS_LO16 bss2 +00000018 R_MIPS_26 xtext + + +Contents of section .text: + 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... + 0010 3c060000 8c860000 0c000000 00000000 <............... + 0020 03e00008 00000000 00000000 00000000 ................ + 0030 afa40000 afa50004 afa60008 03e00008 ................ + 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/static.c b/tools/asm-processor/tests/static.c new file mode 100644 index 000000000..c265021e5 --- /dev/null +++ b/tools/asm-processor/tests/static.c @@ -0,0 +1,32 @@ +// COMPILE-FLAGS: -O2 +static int xtext(int a, int b, int c); +const int rodata1[] = {1}; +static const int rodata2[] = {2}; +int data1[] = {3}; +static int data2[] = {4}; +int bss1; +static int bss2; + +GLOBAL_ASM( +glabel bar +lui $a0, %hi(rodata2) +lw $a0, %lo(rodata2)($a0) +lui $a1, %hi(data2) +lw $a1, %lo(data2)($a0) +lui $a2, %hi(bss2) +lw $a2, %lo(bss2)($a0) +jal xtext +nop +jr $ra +nop +nop +nop +) + +static int xtext(int a, int b, int c) { + return 1; +} + +void baz(void) { + xtext(bss2, rodata2[0], data2[0]); +} diff --git a/tools/asm-processor/tests/static.objdump b/tools/asm-processor/tests/static.objdump new file mode 100644 index 000000000..dd62c94c1 --- /dev/null +++ b/tools/asm-processor/tests/static.objdump @@ -0,0 +1,58 @@ + +tests/static.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 00000080 .text +00000000 l d .rodata 00000010 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000004 l O .rodata 00000000 rodata2 +00000004 l O .data 00000000 data2 +00000004 l O .bss 00000000 bss2 +00000030 l F .text 00000000 xtext +00000000 g O .rodata 00000004 rodata1 +00000000 g O .data 00000004 data1 +00000000 g O .bss 00000004 bss1 +00000044 g F .text 00000034 baz +00000000 g F .text 00000030 bar + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +0000004c R_MIPS_HI16 .bss +00000064 R_MIPS_LO16 .bss +00000050 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .data +00000058 R_MIPS_LO16 .data +00000060 R_MIPS_26 .text +00000000 R_MIPS_HI16 rodata2 +00000004 R_MIPS_LO16 rodata2 +00000008 R_MIPS_HI16 data2 +0000000c R_MIPS_LO16 data2 +00000010 R_MIPS_HI16 bss2 +00000014 R_MIPS_LO16 bss2 +00000018 R_MIPS_26 xtext + + +Contents of section .text: + 0000 3c040000 8c840000 3c050000 8c850000 <.......<....... + 0010 3c060000 8c860000 0c000000 00000000 <............... + 0020 03e00008 00000000 00000000 00000000 ................ + 0030 afa40000 afa50004 afa60008 03e00008 ................ + 0040 24020001 27bdffe8 afbf0014 3c040000 $...'.......<... + 0050 3c050000 3c060000 8cc60004 8ca50004 <...<........... + 0060 0c00000c 8c840004 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 00000001 00000002 00000000 00000000 ................ +Contents of section .data: + 0000 00000003 00000004 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000074 00000000 . .........t.... + 0010 00000000 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a0000074 00000000 00000000 00000000 ...t............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test1.c b/tools/asm-processor/tests/test1.c new file mode 100644 index 000000000..475555a75 --- /dev/null +++ b/tools/asm-processor/tests/test1.c @@ -0,0 +1,71 @@ + +GLOBAL_ASM( +.rdata +.word 0x1212 +) + +GLOBAL_ASM( +.late_rodata +.word 0x123123 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +char bss1[3]; +GLOBAL_ASM( +.bss +bss2: +.space 3 +) +char bss3[3]; +char bss4[3]; +const int rodata1[2] = {1}; +extern int some_rodata; + +unsigned g(float, int); +unsigned f(void) { + return g(1.1f, some_rodata); +} + +GLOBAL_ASM( +.rdata +glabel some_rodata +.word 0x1313 +.text +.late_rodata +.word 0x321321 +.text +glabel g +/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) +/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 +/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) +/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) +/* 0000D4 004000D4 0C10002C */ jal func_004000B0 +/* 0000D8 004000D8 00000000 */ nop +/* 0000DC 004000DC 10000001 */ b .L004000E4 +/* 0000E0 004000E0 00000000 */ nop +.L004000E4: +/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) +/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 +/* 0000EC 004000EC 03E00008 */ jr $ra +/* 0000F0 004000F0 00000000 */ nop +) diff --git a/tools/asm-processor/tests/test1.objdump b/tools/asm-processor/tests/test1.objdump new file mode 100644 index 000000000..b97ae46e1 --- /dev/null +++ b/tools/asm-processor/tests/test1.objdump @@ -0,0 +1,54 @@ + +tests/test1.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000b0 .text +00000000 l d .rodata 00000020 .rodata +00000000 l d .bss 00000010 .bss +00000000 g O .bss 00000003 bss1 +00000008 g O .bss 00000003 bss3 +0000000c g O .bss 00000003 bss4 +00000004 g O .rodata 00000008 rodata1 +0000003c g F .text 0000003c f +00000000 g F .text 0000003c test +0000000c g .rodata 00000000 some_rodata +00000078 g F .text 00000004 g +00000000 *UND* 00000000 D_410100 +00000000 *UND* 00000000 func_004000B0 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000044 R_MIPS_HI16 .rodata +00000054 R_MIPS_LO16 .rodata +00000048 R_MIPS_HI16 some_rodata +0000004c R_MIPS_LO16 some_rodata +00000050 R_MIPS_26 g +00000084 R_MIPS_HI16 D_410100 +00000088 R_MIPS_LO16 D_410100 +0000008c R_MIPS_26 func_004000B0 + + +Contents of section .text: + 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... + 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... + 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... + 0030 00000000 03e00008 27bd0018 27bdffe8 ........'...'... + 0040 afbf0014 3c010000 3c050000 8ca50000 ....<...<....... + 0050 0c000000 c42c0014 10000003 00000000 .....,.......... + 0060 10000001 00000000 8fbf0014 27bd0018 ............'... + 0070 03e00008 00000000 27bdffe8 afbf0014 ........'....... + 0080 240e0004 3c010000 ac2e0000 0c000000 $...<........... + 0090 00000000 10000001 00000000 8fbf0014 ................ + 00a0 27bd0018 03e00008 00000000 00000000 '............... +Contents of section .rodata: + 0000 00001212 00000001 00000000 00001313 ................ + 0010 00123123 3f8ccccd 00321321 00000000 ..1#?....2.!.... +Contents of section .options: + 0000 01200000 00000000 a0000022 00000000 . .........".... + 0010 00001010 00000000 00000000 00007ff0 ................ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00001010 00000000 ...2............ + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test2.c b/tools/asm-processor/tests/test2.c new file mode 100644 index 000000000..15969feb6 --- /dev/null +++ b/tools/asm-processor/tests/test2.c @@ -0,0 +1,69 @@ +const char buf1[1] = {1}; +float func1(void) { + "func1"; + return 0.1f; +} +const char buf2[1] = {2}; +void func2(void) { + *(volatile float*)0 = -3.5792360305786133f; + *(volatile float*)0 = -3.5792362689971924f; + // "func2"; + // return 0.2f; +} +const char buf3[1] = {3}; +int func3(int x) { + switch(x) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 3; + case 3: + return 4; + case 4: + return 5; + case 5: + return 4; + case 6: + return 4; + case 7: + return 4; + default: + return 3; + } +} + +#if 1 +GLOBAL_ASM( +.rdata +.word 0x66756e63 # func +.word 0x34000000 # 4\0\0\0 +.word jumptarget + 4 + +.late_rodata +glabel rv +.word 0x3e4ccccd # 0.2f +.word jumptarget + 8 + +.text +glabel func4 +lui $at, %hi(rv) +glabel jumptarget +jr $ra +lwc1 $f0, %lo(rv)($at) +jr $ra +nop +jr $ra +nop +jr $ra +nop +jr $ra +nop +) +#else +float func4(void) { + "func4"; + return 0.2f; +} +#endif diff --git a/tools/asm-processor/tests/test2.objdump b/tools/asm-processor/tests/test2.objdump new file mode 100644 index 000000000..276ed9f1f --- /dev/null +++ b/tools/asm-processor/tests/test2.objdump @@ -0,0 +1,76 @@ + +tests/test2.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000f0 .text +00000000 l d .rodata 00000060 .rodata +00000000 g O .rodata 00000001 buf1 +00000000 g F .text 0000001c func1 +0000000c g O .rodata 00000001 buf2 +0000001c g F .text 00000028 func2 +00000010 g O .rodata 00000001 buf3 +00000044 g F .text 0000007c func3 +000000c4 g F .text 00000000 jumptarget +000000c0 g F .text 0000000c func4 +0000004c g .rodata 00000000 rv + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000000 R_MIPS_HI16 .rodata +00000008 R_MIPS_LO16 .rodata +0000001c R_MIPS_HI16 .rodata +00000020 R_MIPS_LO16 .rodata +00000028 R_MIPS_HI16 .rodata +0000002c R_MIPS_LO16 .rodata +00000054 R_MIPS_HI16 .rodata +0000005c R_MIPS_LO16 .rodata +000000c0 R_MIPS_HI16 rv +000000c8 R_MIPS_LO16 rv + + +RELOCATION RECORDS FOR [.rodata]: +OFFSET TYPE VALUE +0000002c R_MIPS_32 .text +00000030 R_MIPS_32 .text +00000034 R_MIPS_32 .text +00000038 R_MIPS_32 .text +0000003c R_MIPS_32 .text +00000040 R_MIPS_32 .text +00000044 R_MIPS_32 .text +00000048 R_MIPS_32 .text +0000001c R_MIPS_32 jumptarget +00000050 R_MIPS_32 jumptarget + + +Contents of section .text: + 0000 3c010000 03e00008 c4200020 03e00008 <........ . .... + 0010 00000000 03e00008 00000000 3c010000 ............<... + 0020 c4240024 e4040000 3c010000 c4260028 .$.$....<....&.( + 0030 e4060000 03e00008 00000000 03e00008 ................ + 0040 00000000 2c810008 10200017 00000000 ....,.... ...... + 0050 00047080 3c010000 002e0821 8c2e002c ..p.<......!..., + 0060 01c00008 00000000 03e00008 24020001 ............$... + 0070 03e00008 24020002 03e00008 24020003 ....$.......$... + 0080 03e00008 24020004 03e00008 24020005 ....$.......$... + 0090 03e00008 24020004 03e00008 24020004 ....$.......$... + 00a0 03e00008 24020004 03e00008 24020003 ....$.......$... + 00b0 03e00008 00000000 03e00008 00000000 ................ + 00c0 3c010000 03e00008 c4200000 03e00008 <........ ...... + 00d0 00000000 03e00008 00000000 03e00008 ................ + 00e0 00000000 03e00008 00000000 00000000 ................ +Contents of section .rodata: + 0000 01000000 66756e63 31000000 02000000 ....func1....... + 0010 03000000 66756e63 34000000 00000004 ....func4....... + 0020 3dcccccd c0651234 c0651235 00000068 =....e.4.e.5...h + 0030 00000070 00000078 00000080 00000088 ...p...x........ + 0040 00000090 00000098 000000a0 3e4ccccd ............>L.. + 0050 00000008 00000000 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 80004016 00000000 . ........@..... + 0010 00000051 00000000 00000000 00007ff0 ...Q............ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 80004016 00000000 00000051 00000000 ..@........Q.... + 0010 00000000 00007ff0 ........ diff --git a/tools/asm-processor/tests/test3.c b/tools/asm-processor/tests/test3.c new file mode 100644 index 000000000..d74bb4cbd --- /dev/null +++ b/tools/asm-processor/tests/test3.c @@ -0,0 +1,70 @@ + +GLOBAL_ASM( +.rdata +.word 321321 +.text +glabel test +/* 000090 00400090 27BDFFF8 */ addiu $sp, $sp, -24 +/* 000094 00400094 18A00009 */ blez $a1, .L004000BC +/* 000098 00400098 AFA00004 */ sw $zero, 4($sp) +.L0040009C: +/* 00009C 0040009C 8FAE0004 */ lw $t6, 4($sp) +/* 0000A0 004000A0 008E7821 */ addu $t7, $a0, $t6 +/* 0000A4 004000A4 A1E00000 */ sb $zero, ($t7) +/* 0000A8 004000A8 8FB80004 */ lw $t8, 4($sp) +/* 0000AC 004000AC 27190001 */ addiu $t9, $t8, 1 +/* 0000B0 004000B0 0325082A */ slt $at, $t9, $a1 +/* 0000B4 004000B4 1420FFF9 */ bnez $at, .L0040009C +/* 0000B8 004000B8 AFB90004 */ sw $t9, 4($sp) +.L004000BC: +/* 0000BC 004000BC 10000001 */ b .L004000C4 +/* 0000C0 004000C0 00000000 */ nop +.L004000C4: +/* 0000C4 004000C4 03E00008 */ jr $ra +/* 0000C8 004000C8 27BD0008 */ addiu $sp, $sp, 24 +) + +// static -> no symbols +// bss +char globalBuf[4]; +const char constBuf[4]; + +// data +char globalBufInit[4] = {1}; + +// rodata +const char constBufInit[4] = {1}; +const char constBufInit2[1] = {2}; +const char constBufInit3[1] = {3}; + +unsigned g(void); +unsigned f(void) { + // aligns to 4 or 8 byte boundary (char -> 4, double -> 8) + double x = 5.1; + float y = 5.2f; + float z = 5.3f; + "Hello "; + "World"; + return g(); +} + +GLOBAL_ASM( +.rdata +.word 123123 +.text +glabel g +/* 0000C0 004000C0 27BDFFE8 */ addiu $sp, $sp, -0x18 +/* 0000C4 004000C4 AFBF0014 */ sw $ra, 0x14($sp) +/* 0000C8 004000C8 240E0004 */ addiu $t6, $zero, 4 +/* 0000CC 004000CC 3C010041 */ lui $at, %hi(D_410100) +/* 0000D0 004000D0 AC2E0100 */ sw $t6, %lo(D_410100)($at) +/* 0000D4 004000D4 0C10002C */ jal func_004000B0 +/* 0000D8 004000D8 00000000 */ nop +/* 0000DC 004000DC 10000001 */ b .L004000E4 +/* 0000E0 004000E0 00000000 */ nop +.L004000E4: +/* 0000E4 004000E4 8FBF0014 */ lw $ra, 0x14($sp) +/* 0000E8 004000E8 27BD0018 */ addiu $sp, $sp, 0x18 +/* 0000EC 004000EC 03E00008 */ jr $ra +/* 0000F0 004000F0 00000000 */ nop +) diff --git a/tools/asm-processor/tests/test3.objdump b/tools/asm-processor/tests/test3.objdump new file mode 100644 index 000000000..bfa7f6e37 --- /dev/null +++ b/tools/asm-processor/tests/test3.objdump @@ -0,0 +1,64 @@ + +tests/test3.o: file format elf32-tradbigmips + +SYMBOL TABLE: +00000000 l d .text 000000d0 .text +00000000 l d .rodata 00000040 .rodata +00000000 l d .data 00000010 .data +00000000 l d .bss 00000010 .bss +00000000 g O .bss 00000004 globalBuf +00000004 g O .bss 00000004 constBuf +00000000 g O .data 00000004 globalBufInit +00000004 g O .rodata 00000004 constBufInit +00000008 g O .rodata 00000001 constBufInit2 +0000000c g O .rodata 00000001 constBufInit3 +0000003c g F .text 00000054 f +00000000 g F .text 00000004 test +00000090 g F .text 00000004 g +00000000 *UND* 00000000 D_410100 +00000000 *UND* 00000000 func_004000B0 + + +RELOCATION RECORDS FOR [.text]: +OFFSET TYPE VALUE +00000044 R_MIPS_HI16 .rodata +00000048 R_MIPS_LO16 .rodata +00000050 R_MIPS_HI16 .rodata +00000054 R_MIPS_LO16 .rodata +0000005c R_MIPS_HI16 .rodata +00000060 R_MIPS_LO16 .rodata +00000068 R_MIPS_26 g +0000009c R_MIPS_HI16 D_410100 +000000a0 R_MIPS_LO16 D_410100 +000000a4 R_MIPS_26 func_004000B0 + + +Contents of section .text: + 0000 27bdffe8 18a00009 afa00004 8fae0004 '............... + 0010 008e7821 a1e00000 8fb80004 27190001 ..x!........'... + 0020 0325082a 1420fff9 afb90004 10000001 .%.*. .......... + 0030 00000000 03e00008 27bd0018 27bdffd8 ........'...'... + 0040 afbf0014 3c010000 d4240028 f7a40020 ....<....$.(... + 0050 3c010000 c4260030 e7a6001c 3c010000 <....&.0....<... + 0060 c4280034 e7a80018 0c000000 00000000 .(.4............ + 0070 10000003 00000000 10000001 00000000 ................ + 0080 8fbf0014 27bd0028 03e00008 00000000 ....'..(........ + 0090 27bdffe8 afbf0014 240e0004 3c010000 '.......$...<... + 00a0 ac2e0000 0c000000 00000000 10000001 ................ + 00b0 00000000 8fbf0014 27bd0018 03e00008 ........'....... + 00c0 00000000 00000000 00000000 00000000 ................ +Contents of section .rodata: + 0000 0004e729 01000000 02000000 03000000 ...)............ + 0010 48656c6c 6f202000 576f726c 64000000 Hello .World... + 0020 0001e0f3 00000000 40146666 66666666 ........@.ffffff + 0030 40a66666 40a9999a 00000000 00000000 @.ff@........... +Contents of section .data: + 0000 01000000 00000000 00000000 00000000 ................ +Contents of section .options: + 0000 01200000 00000000 a0000002 00000000 . .............. + 0010 00000170 00000000 00000000 00007ff0 ...p............ + 0020 07100000 00000000 00000000 00000000 ................ + 0030 08100000 00000000 00000000 00000000 ................ +Contents of section .reginfo: + 0000 a300c032 00000000 00000170 00000000 ...2.......p.... + 0010 00000000 00007ff0 ........ diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 2a79674bf..81701e140 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -453,8 +453,8 @@ 0x8016FCF0 : "PreRender", 0x801727F0 : "TwoHeadGfxArena", 0x80172A00 : "TwoHeadArena", - 0x80172BC0 : "code_80172BC0", - 0x80172C30 : "audioMgr", + 0x80172BC0 : "audio_stop_all_sfx", + 0x80172C30 : "audio_thread_manager", 0x80173130 : "title_setup", 0x80173360 : "game", 0x80173BF0 : "gamealloc", @@ -495,11 +495,11 @@ 0x8019AEB0 : "[PADDING]", 0x8019AEC0 : "code_8019AEC0", 0x8019AF00 : "code_8019AF00", - 0x801A4EB0 : "code_801A4EB0", - 0x801A51F0 : "code_801A51F0", + 0x801A4EB0 : "voice_external", + 0x801A51F0 : "voice_internal", 0x801A5BC0 : "[PADDING]", 0x801A5BD0 : "code_801A5BD0", - 0x801A7B10 : "code_801A7B10", + 0x801A7B10 : "sequence", 0x801A9B10 : "jpegutils", 0x801AA020 : "jpegdecoder", 0x801AA610 : "z_game_over", @@ -554,7 +554,7 @@ 0x801C1D30 : "code_8012EC80", 0x801C2410 : "code_801C2410", 0x801C2650 : "z_scene", - 0x801C2730 : "", + 0x801C2730 : "object_table", 0x801C3B60 : "z_scene_proc", 0x801C3CA0 : "z_scene_table", 0x801C5C50 : "z_schedule", @@ -570,10 +570,11 @@ 0x801D0B70 : "z_kaleido_manager", 0x801D0BB0 : "", 0x801D0C80 : "z_fbdemo", + 0x801D0CB0 : "z_fbdemo_fade", 0x801D0D00 : "z_fbdemo_circle", 0x801D0D50 : "z_play", 0x801D0D80 : "z_play_hireso", - 0x801D14F0 : "audioMgr", + 0x801D14F0 : "audio_thread_manager", 0x801D1500 : "game", 0x801D1510 : "graph", 0x801D1520 : "main", @@ -595,12 +596,12 @@ 0x801D61A0 : "audio_seqplayer", 0x801D6200 : "audio_dramStack", 0x801D6600 : "code_8019AF00", - 0x801D8BE0 : "code_801A4EB0", - 0x801D8E50 : "code_801A51F0", + 0x801D8BE0 : "voice_external", + 0x801D8E50 : "voice_internal", 0x801D9090 : "audio_sound_params", 0x801DB470 : "code_801A5BD0", - 0x801DB4C0 : "code_801A7B10", - 0x801DB4E0 : "audio_init_params", + 0x801DB4C0 : "sequence", + 0x801DB4E0 : "session_config", # .rodata section 0x801DBDF0 : "z_en_item00", @@ -657,8 +658,8 @@ 0x801DFA00 : "z_play", 0x801DFC50 : "z_play_hireso", 0x801DFC60 : "PreRender", - 0x801DFC70 : "code_80172BC0", - 0x801DFC80 : "audioMgr", + 0x801DFC70 : "audio_stop_all_sfx", + 0x801DFC80 : "audio_thread_manager", 0x801DFCC0 : "game", 0x801DFCE0 : "graph", 0x801DFD70 : "main", @@ -678,10 +679,10 @@ 0x801E0510 : "audio_effects", 0x801E0540 : "audio_seqplayer", 0x801E0BD0 : "code_8019AF00", - 0x801E0EC0 : "code_801A51F0", + 0x801E0EC0 : "voice_internal", 0x801E1050 : "code_801A5BD0", - 0x801E1070 : "code_801A7B10", - 0x801E1100 : "audio_init_params", + 0x801E1070 : "sequence", + 0x801E1100 : "session_config", 0x801E1110 : "z_game_over", 0x801E1180 : "audio_tables", 0x801E1E80 : "aspMain", @@ -741,9 +742,9 @@ 0x801FD120 : "audio_heap", 0x801FD140 : "audio_load", 0x801FD1F0 : "code_8019AF00", - 0x801FD5A0 : "code_801A51F0", + 0x801FD5A0 : "voice_internal", 0x801FD710 : "code_801A5BD0", - 0x801FFD00 : "code_801A7B10", + 0x801FFD00 : "sequence", 0x80208E90 : "jpegdecoder", 0x80208EA0 : "gfxbuffers", 0x8024A4C0 : "buffers", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index b178fe3ed..e4a63bfde 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -722,16 +722,16 @@ 0x800B6BD8:("Actor_MoveWithoutGravityReverse",), 0x800B6C04:("Actor_SetSpeeds",), 0x800B6C58:("Actor_UpdatePosFromSkelAnime",), - 0x800B6CD4:("Actor_YawBetweenActors",), - 0x800B6D00:("Actor_YawBetweenActorsTop",), - 0x800B6D2C:("Actor_YawToPoint",), - 0x800B6D50:("Actor_PitchBetweenActors",), - 0x800B6D7C:("Actor_PitchBetweenActorsTop",), - 0x800B6DA8:("Actor_PitchToPoint",), - 0x800B6DCC:("Actor_DistanceBetweenActors",), - 0x800B6DF8:("Actor_DistanceToPoint",), - 0x800B6E1C:("Actor_XZDistanceBetweenActors",), - 0x800B6E48:("Actor_XZDistanceToPoint",), + 0x800B6CD4:("Actor_WorldYawTowardActor",), + 0x800B6D00:("Actor_FocusYawTowardActor",), + 0x800B6D2C:("Actor_WorldYawTowardPoint",), + 0x800B6D50:("Actor_WorldPitchTowardActor",), + 0x800B6D7C:("Actor_FocusPitchTowardActor",), + 0x800B6DA8:("Actor_WorldPitchTowardPoint",), + 0x800B6DCC:("Actor_WorldDistXYZToActor",), + 0x800B6DF8:("Actor_WorldDistXYZToPoint",), + 0x800B6E1C:("Actor_WorldDistXZToActor",), + 0x800B6E48:("Actor_WorldDistXZToPoint",), 0x800B6E6C:("Actor_OffsetOfPointInActorCoords",), 0x800B6F0C:("Actor_HeightDiff",), 0x800B6F20:("func_800B6F20",), @@ -785,13 +785,13 @@ 0x800B8898:("Actor_GetScreenPos",), 0x800B8934:("Actor_OnScreen",), 0x800B89F8:("Actor_HasParent",), - 0x800B8A1C:("Actor_PickUp",), - 0x800B8B84:("Actor_PickUpNearby",), - 0x800B8BB0:("Actor_LiftActor",), - 0x800B8BD0:("Actor_PickUpFar",), + 0x800B8A1C:("Actor_OfferGetItem",), + 0x800B8B84:("Actor_OfferGetItemNearby",), + 0x800B8BB0:("Actor_OfferCarry",), + 0x800B8BD0:("Actor_OfferGetItemFar",), 0x800B8BFC:("Actor_HasNoParent",), 0x800B8C20:("func_800B8C20",), - 0x800B8C50:("func_800B8C50",), + 0x800B8C50:("Actor_SetClosestSecretDistance",), 0x800B8C78:("Actor_HasRider",), 0x800B8C9C:("Actor_SetRideActor",), 0x800B8CEC:("Actor_HasNoRider",), @@ -800,8 +800,8 @@ 0x800B8D98:("func_800B8D98",), 0x800B8DD4:("func_800B8DD4",), 0x800B8E1C:("func_800B8E1C",), - 0x800B8E58:("func_800B8E58",), - 0x800B8EC8:("Actor_PlaySfxAtPos",), + 0x800B8E58:("Player_PlaySfx",), + 0x800B8EC8:("Actor_PlaySfx",), 0x800B8EF4:("func_800B8EF4",), 0x800B8F98:("func_800B8F98",), 0x800B8FC0:("func_800B8FC0",), @@ -812,23 +812,23 @@ 0x800B9098:("func_800B9098",), 0x800B90AC:("func_800B90AC",), 0x800B90F4:("Actor_DeactivateLens",), - 0x800B9120:("func_800B9120",), + 0x800B9120:("Actor_InitHalfDaysBit",), 0x800B9170:("Actor_InitContext",), 0x800B9334:("Actor_SpawnSetupActors",), 0x800B948C:("Actor_UpdateActor",), 0x800B9780:("Actor_UpdateAll",), 0x800B9A04:("Actor_Draw",), 0x800B9D1C:("func_800B9D1C",), - 0x800B9E3C:("Actor_DrawAllSetup",), - 0x800B9E4C:("Actor_RecordUndrawnActor",), + 0x800B9E3C:("Actor_ResetLensActors",), + 0x800B9E4C:("Actor_AddToLensActors",), 0x800B9E84:("Actor_DrawLensOverlay",), 0x800B9EF4:("Actor_DrawLensActors",), 0x800BA2D8:("func_800BA2D8",), 0x800BA2FC:("func_800BA2FC",), 0x800BA42C:("Actor_DrawAll",), - 0x800BA6FC:("func_800BA6FC",), + 0x800BA6FC:("Actor_KillAllWithMissingObject",), 0x800BA798:("func_800BA798",), - 0x800BA8B8:("func_800BA8B8",), + 0x800BA8B8:("Actor_KillAllOnHalfDayChange",), 0x800BA9B4:("Actor_CleanupContext",), 0x800BAAB4:("Actor_AddToCategory",), 0x800BAB24:("Actor_RemoveFromCategory",), @@ -851,7 +851,7 @@ 0x800BBDAC:("Actor_SpawnFloorDustRing",), 0x800BBFB0:("func_800BBFB0",), 0x800BC154:("func_800BC154",), - 0x800BC188:("func_800BC188",), + 0x800BC188:("Actor_GetArrowDmgFlags",), 0x800BC1B4:("func_800BC1B4",), 0x800BC270:("func_800BC270",), 0x800BC444:("func_800BC444",), @@ -868,11 +868,11 @@ 0x800BCBF4:("func_800BCBF4",), 0x800BCC68:("func_800BCC68",), 0x800BCCDC:("Actor_GetClosestPosOnPath",), - 0x800BD2B4:("func_800BD2B4",), - 0x800BD384:("func_800BD384",), - 0x800BD6B8:("func_800BD6B8",), - 0x800BD6E4:("func_800BD6E4",), - 0x800BD888:("func_800BD888",), + 0x800BD2B4:("Npc_UpdateTalking",), + 0x800BD384:("Npc_TrackPointWithLimits",), + 0x800BD6B8:("Npc_GetTrackingPresetMaxPlayerYaw",), + 0x800BD6E4:("Npc_UpdateAutoTurn",), + 0x800BD888:("Npc_TrackPoint",), 0x800BD9A0:("func_800BD9A0",), 0x800BD9E0:("func_800BD9E0",), 0x800BDAA0:("func_800BDAA0",), @@ -895,7 +895,7 @@ 0x800BE63C:("Actor_IsSmallChest",), 0x800BE680:("Actor_DrawDamageEffects",), 0x800BF7CC:("Actor_SpawnIceEffects",), - 0x800BF9A0:("ActorOverlayTable_FaultPrint",), + 0x800BF9A0:("ActorOverlayTable_FaultClient",), 0x800BFA78:("ActorOverlayTable_FaultAddrConv",), 0x800BFAE8:("ActorOverlayTable_Init",), 0x800BFB40:("ActorOverlayTable_Cleanup",), @@ -1519,7 +1519,7 @@ 0x800E9138:("Actor_TrackPlayerSetFocusHeight",), 0x800E9250:("Actor_TrackPlayer",), 0x800E9360:("SaveContext_Init",), - 0x800E93E0:("GameInfo_Init",), + 0x800E93E0:("Regs_Init",), 0x800E9470:("DebugDisplay_Init",), 0x800E9488:("DebugDisplay_AddObject",), 0x800E9564:("DebugDisplay_DrawObjects",), @@ -1527,12 +1527,12 @@ 0x800E97D8:("DebugDisplay_DrawPolygon",), 0x800E992C:("DebugDisplay_DrawPath",), 0x800E99B0:("DebugDisplay_PathDisplayList",), - 0x800E9C90:("func_800E9C90",), - 0x800E9CA0:("func_800E9CA0",), - 0x800E9CFC:("func_800E9CFC",), - 0x800E9DBC:("func_800E9DBC",), - 0x800E9E94:("func_800E9E94",), - 0x800E9F78:("func_800E9F78",), + 0x800E9C90:("Debug_ClearTextDrawFlags",), + 0x800E9CA0:("Debug_ScreenText",), + 0x800E9CFC:("Debug_DrawScreenText",), + 0x800E9DBC:("DebugCamera_ScreenText",), + 0x800E9E94:("DebugCamera_DrawScreenText",), + 0x800E9F78:("Debug_DrawText",), 0x800EA060:("Cutscene_Init",), 0x800EA0D4:("Cutscene_Start",), 0x800EA0EC:("Cutscene_End",), @@ -2104,14 +2104,14 @@ 0x8010EF9C:("Interface_UpdateButtonAlphasByStatus",), 0x8010F0D4:("Interface_UpdateButtonAlphas",), 0x8010F1A8:("Interface_UpdateHudAlphas",), - 0x80110038:("func_80110038",), - 0x80111CB4:("func_80111CB4",), + 0x80110038:("Interface_UpdateButtonsPart2",), + 0x80111CB4:("Interface_UpdateButtonsPart1",), 0x801129E4:("Interface_SetSceneRestrictions",), 0x80112AF4:("Interface_Noop",), 0x80112AFC:("Interface_InitMinigame",), 0x80112B40:("Interface_LoadItemIconImpl",), 0x80112BE4:("Interface_LoadItemIcon",), - 0x80112C0C:("func_80112C0C",), + 0x80112C0C:("Interface_UpdateButtonsAlt",), 0x80112E80:("Item_Give",), 0x801143CC:("Item_CheckObtainabilityImpl",), 0x80114978:("Item_CheckObtainability",), @@ -2141,15 +2141,15 @@ 0x80116114:("Magic_FlashMeterBorder",), 0x80116348:("Magic_Update",), 0x80116918:("Magic_DrawMeter",), - 0x80116FD8:("func_80116FD8",), - 0x801170B8:("func_801170B8",), - 0x80117100:("func_80117100",), - 0x80117A20:("func_80117A20",), - 0x80117BD0:("func_80117BD0",), - 0x80118084:("func_80118084",), - 0x80118890:("func_80118890",), - 0x80118BA4:("func_80118BA4",), - 0x80119030:("func_80119030",), + 0x80116FD8:("Interface_SetPerspectiveView",), + 0x801170B8:("Interface_SetOrthoView",), + 0x80117100:("Interface_DrawItemButtons",), + 0x80117A20:("Interface_DrawItemIconTexture",), + 0x80117BD0:("Interface_DrawAmmoCount",), + 0x80118084:("Interface_DrawBButtonIcons",), + 0x80118890:("Interface_DrawCButtonIcons",), + 0x80118BA4:("Interface_DrawAButton",), + 0x80119030:("Interface_DrawPauseMenuEquippingIcons",), 0x80119610:("Interface_DrawClock",), 0x8011B4E0:("Interface_SetPerfectLetters",), 0x8011B5C0:("Interface_UpdatePerfectLettersType1",), @@ -2391,14 +2391,14 @@ 0x8012CF0C:("func_8012CF0C",), 0x8012D374:("func_8012D374",), 0x8012D40C:("func_8012D40C",), - 0x8012D510:("Room_nop8012D510",), - 0x8012D528:("Room_DrawType3Mesh",), - 0x8012D53C:("Room_DrawType0Mesh",), - 0x8012D750:("Room_DrawType2Mesh",), - 0x8012DEE8:("func_8012DEE8",), - 0x8012E254:("func_8012E254",), - 0x8012E32C:("func_8012E32C",), - 0x8012E6A8:("Room_DrawType1Mesh",), + 0x8012D510:("Room_Noop",), + 0x8012D528:("Room_DrawNone",), + 0x8012D53C:("Room_DrawNormal",), + 0x8012D750:("Room_DrawCullable",), + 0x8012DEE8:("Room_DrawImageSingle",), + 0x8012E254:("Room_GetImageMultiBgEntry",), + 0x8012E32C:("Room_DrawImageMulti",), + 0x8012E6A8:("Room_DrawImage",), 0x8012E710:("Room_Init",), 0x8012E750:("Room_AllocateAndLoad",), 0x8012E96C:("Room_StartRoomTransition",), @@ -2422,40 +2422,40 @@ 0x8012F668:("Object_IsLoaded",), 0x8012F698:("Object_LoadAll",), 0x8012F73C:("func_8012F73C",), - 0x8012F79C:("Scene_HeaderCmdSpawnList",), - 0x8012F90C:("Scene_HeaderCmdActorList",), - 0x8012F954:("Scene_HeaderCmdActorCutsceneCamList",), - 0x8012F984:("Scene_HeaderCmdColHeader",), - 0x8012FA24:("Scene_HeaderCmdRoomList",), - 0x8012FA68:("Scene_HeaderCmdEntranceList",), - 0x8012FA98:("Scene_HeaderCmdSpecialFiles",), - 0x8012FB60:("Scene_HeaderCmdRoomBehavior",), - 0x8012FBE8:("Scene_HeaderCmdMesh",), - 0x8012FC18:("Scene_HeaderCmdObjectList",), - 0x8012FDA4:("Scene_HeaderCmdLightList",), - 0x8012FE2C:("Scene_HeaderCmdPathList",), - 0x8012FE5C:("Scene_HeaderCmdTransiActorList",), + 0x8012F79C:("Scene_CommandSpawnList",), + 0x8012F90C:("Scene_CommandActorList",), + 0x8012F954:("Scene_CommandActorCutsceneCamList",), + 0x8012F984:("Scene_CommandCollisionHeader",), + 0x8012FA24:("Scene_CommandRoomList",), + 0x8012FA68:("Scene_CommandEntranceList",), + 0x8012FA98:("Scene_CommandSpecialFiles",), + 0x8012FB60:("Scene_CommandRoomBehavior",), + 0x8012FBE8:("Scene_CommandMesh",), + 0x8012FC18:("Scene_CommandObjectList",), + 0x8012FDA4:("Scene_CommandLightList",), + 0x8012FE2C:("Scene_CommandPathList",), + 0x8012FE5C:("Scene_CommandTransiActorList",), 0x8012FEBC:("Door_InitContext",), - 0x8012FECC:("Scene_HeaderCmdEnvLightSettings",), + 0x8012FECC:("Scene_CommandEnvLightSettings",), 0x8012FF10:("Scene_LoadAreaTextures",), - 0x8012FF8C:("Scene_HeaderCmdSkyboxSettings",), - 0x8012FFF0:("Scene_HeaderCmdSkyboxDisables",), - 0x80130018:("Scene_HeaderCmdTimeSettings",), - 0x8013033C:("Scene_HeaderCmdWindSettings",), - 0x801303A0:("Scene_HeaderCmdExitList",), - 0x801303D0:("Scene_HeaderCmd09",), - 0x801303E0:("Scene_HeaderCmdSoundSettings",), - 0x8013043C:("Scene_HeaderCmdEchoSetting",), - 0x80130454:("Scene_HeaderCmdAltHeaderList",), - 0x801304CC:("Scene_HeaderCmdCutsceneList",), - 0x80130500:("Scene_HeaderCmdActorCutsceneList",), - 0x80130540:("Scene_HeaderCmdMiniMap",), - 0x80130578:("Scene_HeaderCmd1D",), - 0x80130588:("Scene_HeaderCmdMiniMapCompassInfo",), - 0x801305B0:("Scene_HeaderCmdSetRegionVisitedFlag",), - 0x80130674:("Scene_HeaderCmdAnimatedMaterials",), + 0x8012FF8C:("Scene_CommandSkyboxSettings",), + 0x8012FFF0:("Scene_CommandSkyboxDisables",), + 0x80130018:("Scene_CommandTimeSettings",), + 0x8013033C:("Scene_CommandWindSettings",), + 0x801303A0:("Scene_CommandExitList",), + 0x801303D0:("Scene_Command09",), + 0x801303E0:("Scene_CommandSoundSettings",), + 0x8013043C:("Scene_CommandEchoSetting",), + 0x80130454:("Scene_CommandAltHeaderList",), + 0x801304CC:("Scene_CommandCutsceneList",), + 0x80130500:("Scene_CommandActorCutsceneList",), + 0x80130540:("Scene_CommandMiniMap",), + 0x80130578:("Scene_Command1D",), + 0x80130588:("Scene_CommandMiniMapCompassInfo",), + 0x801305B0:("Scene_CommandSetRegionVisitedFlag",), + 0x80130674:("Scene_CommandAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), - 0x801306E8:("Scene_ProcessHeader",), + 0x801306E8:("Scene_ExecuteCommands",), 0x80130768:("Entrance_Create",), 0x80130784:("Entrance_CreateFromSpawn",), 0x801307C0:("Scene_Draw",), @@ -2783,10 +2783,10 @@ 0x801431E8:("Skybox_Setup",), 0x80143324:("func_80143324",), 0x801434E4:("Skybox_Init",), - 0x801435A0:("SkyboxDraw_UpdateMatrix",), - 0x80143624:("SkyboxDraw_SetColors",), - 0x80143668:("SkyboxDraw_Draw",), - 0x80143A04:("SkyboxDraw_Update",), + 0x801435A0:("Skybox_UpdateMatrix",), + 0x80143624:("Skybox_SetColors",), + 0x80143668:("Skybox_Draw",), + 0x80143A04:("Skybox_Update",), 0x80143A10:("Sram_ActivateOwl",), 0x80143A54:("Sram_ClearHighscores",), 0x80143AC4:("Sram_ClearFlagsAtDawnOfTheFirstDay",), @@ -2824,7 +2824,7 @@ 0x80147564:("func_80147564",), 0x80147624:("Message_ShouldAdvance",), 0x80147734:("Message_ShouldAdvanceSilent",), - 0x801477B4:("func_801477B4",), + 0x801477B4:("Message_CloseTextbox",), 0x80147818:("func_80147818",), 0x80147F18:("func_80147F18",), 0x80148558:("func_80148558",), @@ -2853,7 +2853,7 @@ 0x80150D08:("func_80150D08",), 0x801514B0:("func_801514B0",), 0x801518B0:("Message_StartTextbox",), - 0x80151938:("func_80151938",), + 0x80151938:("Message_ContinueTextbox",), 0x80151A68:("func_80151A68",), 0x80151BB4:("func_80151BB4",), 0x80151C9C:("func_80151C9C",), @@ -2925,7 +2925,7 @@ 0x801631DC:("func_801631DC",), 0x80163334:("func_80163334",), 0x80163660:("func_80163660",), - 0x80163700:("KaleidoManager_FaultAddrConvFunc",), + 0x80163700:("KaleidoManager_FaultAddrConv",), 0x80163758:("KaleidoManager_LoadOvl",), 0x801637B4:("KaleidoManager_ClearOvl",), 0x80163804:("KaleidoManager_Init",), @@ -2938,14 +2938,14 @@ 0x80163C0C:("KaleidoScopeCall_Draw",), 0x80163C90:("Transition_Init",), 0x80163D80:("Transition_Destroy",), - 0x80163DC0:("func_80163DC0",), - 0x8016418C:("func_8016418C",), - 0x8016424C:("TransitionUnk_Destroy",), - 0x801642D8:("TransitionUnk_Init",), - 0x80164438:("func_80164438",), - 0x8016454C:("TransitionUnk_Draw",), - 0x80164678:("func_80164678",), - 0x801647AC:("func_801647AC",), + 0x80163DC0:("TransitionTile_InitGraphics",), + 0x8016418C:("TransitionTile_InitVtxData",), + 0x8016424C:("TransitionTile_Destroy",), + 0x801642D8:("TransitionTile_Init",), + 0x80164438:("TransitionTile_SetVtx",), + 0x8016454C:("TransitionTile_Draw",), + 0x80164678:("TransitionTile_Suck",), + 0x801647AC:("TransitionTile_Update",), 0x801647B8:("func_801647B8",), 0x801647D0:("TransitionFade_Start",), 0x8016482C:("TransitionFade_Init",), @@ -3032,7 +3032,7 @@ 0x80169EFC:("func_80169EFC",), 0x80169F78:("func_80169F78",), 0x80169FDC:("func_80169FDC",), - 0x80169FFC:("func_80169FFC",), + 0x80169FFC:("Play_CamIsNotFixed",), 0x8016A01C:("FrameAdvance_IsEnabled",), 0x8016A02C:("func_8016A02C",), 0x8016A0AC:("Play_IsUnderwater",), @@ -3079,36 +3079,36 @@ 0x80172078:("PreRender_ApplyFiltersSlowlyDestroy",), 0x801720C4:("func_801720C4",), 0x801720FC:("func_801720FC",), - 0x80172758:("func_80172758",), - 0x801727F0:("THGA_Ct",), - 0x80172810:("THGA_Dt",), + 0x80172758:("Prerender_DrawBackground2D",), + 0x801727F0:("THGA_Init",), + 0x80172810:("THGA_Destroy",), 0x80172830:("THGA_IsCrash",), 0x80172850:("THGA_Init",), - 0x80172870:("THGA_GetSize",), + 0x80172870:("THGA_GetRemaining",), 0x80172890:("THGA_GetHead",), 0x801728B0:("THGA_SetHead",), 0x801728D0:("THGA_GetTail",), - 0x801728F0:("THGA_AllocStartArray8",), - 0x80172914:("THGA_AllocStart8",), - 0x80172934:("THGA_AllocStart8Wrapper",), - 0x80172954:("THGA_AllocEnd",), - 0x80172974:("THGA_AllocEndArray64",), - 0x80172998:("THGA_AllocEnd64",), - 0x801729B8:("THGA_AllocEndArray16",), - 0x801729DC:("THGA_AllocEnd16",), + 0x801728F0:("THGA_AllocDisplayList",), + 0x80172914:("THGA_AllocGfx",), + 0x80172934:("THGA_AllocGfx2",), + 0x80172954:("THGA_AllocTail",), + 0x80172974:("THGA_AllocMtxArray",), + 0x80172998:("THGA_AllocMtx",), + 0x801729B8:("THGA_AllocVtxArray",), + 0x801729DC:("THGA_AllocVtx",), 0x80172A00:("THA_GetHead",), 0x80172A0C:("THA_SetHead",), 0x80172A18:("THA_GetTail",), - 0x80172A24:("THA_AllocStart",), - 0x80172A38:("THA_AllocStart1",), - 0x80172A58:("THA_AllocEnd",), - 0x80172AC8:("THA_AllocEndAlign16",), - 0x80172AE8:("THA_AllocEndAlign",), - 0x80172B04:("THA_GetSize",), + 0x80172A24:("THA_AllocHead",), + 0x80172A38:("THA_AllocHeadByte",), + 0x80172A58:("THA_AllocTail",), + 0x80172AC8:("THA_AllocTailAlign16",), + 0x80172AE8:("THA_AllocTailAlign",), + 0x80172B04:("THA_GetRemaining",), 0x80172B18:("THA_IsCrash",), - 0x80172B3C:("THA_Init",), - 0x80172B58:("THA_Ct",), - 0x80172B9C:("THA_Dt",), + 0x80172B3C:("THA_Reset",), + 0x80172B58:("THA_Init",), + 0x80172B9C:("THA_Destroy",), 0x80172BC0:("AudioMgr_StopAllSfxExceptSystem",), 0x80172C30:("func_80172C30",), 0x80172C68:("AudioMgr_HandleRetrace",), @@ -3148,7 +3148,7 @@ 0x80173DAC:("Graph_InitTHGA",), 0x80173DCC:("Graph_SetNextGfxPool",), 0x80173F98:("Graph_GetNextGameState",), - 0x80174060:("Graph_FaultAddrConvFunc",), + 0x80174060:("Graph_FaultAddrConv",), 0x801740D0:("Graph_Init",), 0x80174174:("Graph_Destroy",), 0x801741A8:("Graph_TaskSet00",), @@ -3445,8 +3445,8 @@ 0x80185460:("func_80185460",), 0x80185660:("Slowly_Main",), 0x801856FC:("Slowly_ThreadEntry",), - 0x8018571C:("Slowly_Start",), - 0x801857A0:("Slowly_Stop",), + 0x8018571C:("Slowly_Init",), + 0x801857A0:("Slowly_Destroy",), 0x801857C0:("func_801857C0",), 0x801857D0:("func_801857D0",), 0x80185864:("func_80185864",), @@ -3767,42 +3767,42 @@ 0x80197138:("AudioEffects_NotePortamentoInit",), 0x80197164:("AudioEffects_AdsrInit",), 0x80197188:("AudioEffects_AdsrUpdate",), - 0x801974D0:("AudioSeq_GetScriptControlFlowArgument",), - 0x80197538:("AudioSeq_HandleScriptFlowControl",), - 0x80197714:("AudioSeq_InitSequenceChannel",), - 0x80197880:("AudioSeq_SeqChannelSetLayer",), - 0x801979D8:("AudioSeq_SeqLayerDisable",), - 0x80197A54:("AudioSeq_SeqLayerFree",), - 0x80197AA4:("AudioSeq_SequenceChannelDisable",), - 0x80197B14:("AudioSeq_SequencePlayerSetupChannels",), - 0x80197C0C:("AudioSeq_SequencePlayerDisableChannels",), - 0x80197C8C:("AudioSeq_SequenceChannelEnable",), - 0x80197D24:("AudioSeq_SequencePlayerDisableAsFinished",), - 0x80197D4C:("AudioSeq_SequencePlayerDisable",), - 0x80197E08:("AudioSeq_AudioListPushBack",), - 0x80197E48:("AudioSeq_AudioListPopBack",), - 0x80197E88:("AudioSeq_InitLayerFreelist",), - 0x80197F28:("AudioSeq_ScriptReadU8",), - 0x80197F3C:("AudioSeq_ScriptReadS16",), - 0x80197F74:("AudioSeq_ScriptReadCompressedU16",), - 0x80197FB4:("AudioSeq_SeqLayerProcessScript",), - 0x801980D0:("AudioSeq_SeqLayerProcessScriptStep1",), - 0x8019815C:("AudioSeq_SeqLayerProcessScriptStep5",), - 0x8019825C:("AudioSeq_SeqLayerProcessScriptStep2",), - 0x80198640:("AudioSeq_SeqLayerProcessScriptStep4",), - 0x80198CE0:("AudioSeq_SeqLayerProcessScriptStep3",), - 0x801990F4:("AudioSeq_SetChannelPriorities",), - 0x80199124:("AudioSeq_GetInstrument",), - 0x80199198:("AudioSeq_SetInstrument",), - 0x80199244:("AudioSeq_SequenceChannelSetVolume",), - 0x80199268:("AudioSeq_SequenceChannelProcessScript",), - 0x8019A0BC:("AudioSeq_SequencePlayerProcessSequence",), - 0x8019AA3C:("AudioSeq_ProcessSequences",), - 0x8019AAF0:("AudioSeq_SkipForwardSequence",), - 0x8019AB40:("AudioSeq_ResetSequencePlayer",), - 0x8019AC10:("AudioSeq_InitSequencePlayerChannels",), - 0x8019ACEC:("AudioSeq_InitSequencePlayer",), - 0x8019ADBC:("AudioSeq_InitSequencePlayers",), + 0x801974D0:("AudioScript_GetScriptControlFlowArgument",), + 0x80197538:("AudioScript_HandleScriptFlowControl",), + 0x80197714:("AudioScript_InitSequenceChannel",), + 0x80197880:("AudioScript_SeqChannelSetLayer",), + 0x801979D8:("AudioScript_SeqLayerDisable",), + 0x80197A54:("AudioScript_SeqLayerFree",), + 0x80197AA4:("AudioScript_SequenceChannelDisable",), + 0x80197B14:("AudioScript_SequencePlayerSetupChannels",), + 0x80197C0C:("AudioScript_SequencePlayerDisableChannels",), + 0x80197C8C:("AudioScript_SequenceChannelEnable",), + 0x80197D24:("AudioScript_SequencePlayerDisableAsFinished",), + 0x80197D4C:("AudioScript_SequencePlayerDisable",), + 0x80197E08:("AudioScript_AudioListPushBack",), + 0x80197E48:("AudioScript_AudioListPopBack",), + 0x80197E88:("AudioScript_InitLayerFreelist",), + 0x80197F28:("AudioScript_ScriptReadU8",), + 0x80197F3C:("AudioScript_ScriptReadS16",), + 0x80197F74:("AudioScript_ScriptReadCompressedU16",), + 0x80197FB4:("AudioScript_SeqLayerProcessScript",), + 0x801980D0:("AudioScript_SeqLayerProcessScriptStep1",), + 0x8019815C:("AudioScript_SeqLayerProcessScriptStep5",), + 0x8019825C:("AudioScript_SeqLayerProcessScriptStep2",), + 0x80198640:("AudioScript_SeqLayerProcessScriptStep4",), + 0x80198CE0:("AudioScript_SeqLayerProcessScriptStep3",), + 0x801990F4:("AudioScript_SetChannelPriorities",), + 0x80199124:("AudioScript_GetInstrument",), + 0x80199198:("AudioScript_SetInstrument",), + 0x80199244:("AudioScript_SequenceChannelSetVolume",), + 0x80199268:("AudioScript_SequenceChannelProcessScript",), + 0x8019A0BC:("AudioScript_SequencePlayerProcessSequence",), + 0x8019AA3C:("AudioScript_ProcessSequences",), + 0x8019AAF0:("AudioScript_SkipForwardSequence",), + 0x8019AB40:("AudioScript_ResetSequencePlayer",), + 0x8019AC10:("AudioScript_InitSequencePlayerChannels",), + 0x8019ACEC:("AudioScript_InitSequencePlayer",), + 0x8019ADBC:("AudioScript_InitSequencePlayers",), 0x8019AE40:("func_8019AE40",), 0x8019AEC0:("func_8019AEC0",), 0x8019AF00:("AudioOcarina_ReadControllerInput",), @@ -3857,7 +3857,7 @@ 0x8019E014:("Audio_Update",), 0x8019E0FC:("Audio_Noop4",), 0x8019E104:("Audio_Noop5",), - 0x8019E110:("func_8019E110",), + 0x8019E110:("Audio_PlayMainBgm",), 0x8019E14C:("AudioSfx_ComputeVolume",), 0x8019E324:("AudioSfx_ComputeReverb",), 0x8019E4B0:("AudioSfx_ComputePanSigned",), @@ -3901,10 +3901,10 @@ 0x801A0048:("Audio_PlaySfxForWaterfall",), 0x801A00EC:("Audio_StepFreqLerp",), 0x801A0124:("func_801A0124",), - 0x801A0184:("func_801A0184",), - 0x801A01C4:("func_801A01C4",), + 0x801A0184:("Audio_SetBgmVolumeOff",), + 0x801A01C4:("Audio_SetBgmVolumeOn",), 0x801A0204:("func_801A0204",), - 0x801A0238:("func_801A0238",), + 0x801A0238:("Audio_SetMainBgmVolume",), 0x801A026C:("Audio_SetGanonsTowerBgmVolumeLevel",), 0x801A0318:("Audio_SetGanonsTowerBgmVolume",), 0x801A0450:("Audio_LowerMainBgmVolume",), @@ -3943,12 +3943,12 @@ 0x801A25E4:("Audio_PlaySceneSequence",), 0x801A2670:("Audio_StartSceneSequence",), 0x801A2778:("Audio_UpdateSceneSequenceResumePoint",), - 0x801A27E8:("func_801A27E8",), - 0x801A281C:("func_801A281C",), - 0x801A29D4:("func_801A29D4",), - 0x801A2BB8:("func_801A2BB8",), - 0x801A2C20:("func_801A2C20",), - 0x801A2C44:("func_801A2C44",), + 0x801A27E8:("Audio_PlayBgmForSongOfStorms",), + 0x801A281C:("Audio_ScaleTempoAndFreqForMainBgm",), + 0x801A29D4:("Audio_SetSeqTempoAndFreq",), + 0x801A2BB8:("Audio_PlaySubBgm",), + 0x801A2C20:("Audio_StopSubBgm",), + 0x801A2C44:("Audio_IncreaseTempoForTimedMinigame",), 0x801A2C88:("Audio_PlaySequenceInCutscene",), 0x801A2D54:("Audio_StopSequenceInCutscene",), 0x801A2DE0:("Audio_IsSequencePlaying",), @@ -3994,7 +3994,7 @@ 0x801A4428:("func_801A4428",), 0x801A44A4:("Audio_PreNMI",), 0x801A44C4:("Audio_ResetRequestedSceneSeqId",), - 0x801A44D4:("func_801A44D4",), + 0x801A44D4:("Audio_ResetData",), 0x801A46F8:("func_801A46F8",), 0x801A4748:("func_801A4748",), 0x801A479C:("func_801A479C",), @@ -4004,11 +4004,11 @@ 0x801A4B80:("Audio_SetAmbienceRandomBend",), 0x801A4C30:("Audio_Init",), 0x801A4C54:("AudioSfx_Init",), - 0x801A4D00:("func_801A4D00",), - 0x801A4D50:("func_801A4D50",), - 0x801A4DA4:("func_801A4DA4",), - 0x801A4DF4:("func_801A4DF4",), - 0x801A4E64:("func_801A4E64",), + 0x801A4D00:("Audio_InitSound",), + 0x801A4D50:("Audio_ResetForAudioHeapStep3",), + 0x801A4DA4:("Audio_ResetForAudioHeapStep2",), + 0x801A4DF4:("Audio_ResetForAudioHeapStep1",), + 0x801A4E64:("Audio_UnusedReset",), 0x801A4EB0:("func_801A4EB0",), 0x801A4EB8:("func_801A4EB8",), 0x801A4FD8:("func_801A4FD8",), @@ -4028,7 +4028,7 @@ 0x801A54D0:("func_801A54D0",), 0x801A5680:("func_801A5680",), 0x801A5808:("func_801A5808",), - 0x801A5A10:("func_801A5A10",), + 0x801A5A10:("AudioVoice_ResetData",), 0x801A5A1C:("func_801A5A1C",), 0x801A5BD0:("AudioSfx_MuteBanks",), 0x801A5C28:("AudioSfx_LowerBgmVolume",), @@ -4052,21 +4052,21 @@ 0x801A787C:("AudioSfx_ProcessActiveSfx",), 0x801A78E4:("AudioSfx_IsPlaying",), 0x801A794C:("AudioSfx_Reset",), - 0x801A7B10:("Audio_StartSequence",), - 0x801A7D04:("Audio_StopSequence",), - 0x801A7D84:("func_801A7D84",), - 0x801A89A8:("Audio_QueueSeqCmd",), - 0x801A89D0:("func_801A89D0",), - 0x801A8A50:("Audio_GetActiveSequence",), - 0x801A8ABC:("func_801A8ABC",), - 0x801A8B14:("func_801A8B14",), - 0x801A8B2C:("func_801A8B2C",), - 0x801A8BD0:("Audio_SetVolumeScale",), - 0x801A8D5C:("func_801A8D5C",), - 0x801A9768:("func_801A9768",), - 0x801A982C:("func_801A982C",), - 0x801A99B8:("func_801A99B8",), - 0x801A9A74:("func_801A9A74",), + 0x801A7B10:("AudioSeq_StartSequence",), + 0x801A7D04:("AudioSeq_StopSequence",), + 0x801A7D84:("AudioSeq_ProcessSeqCmd",), + 0x801A89A8:("AudioSeq_QueueSeqCmd",), + 0x801A89D0:("AudioSeq_ProcessSeqCmds",), + 0x801A8A50:("AudioSeq_GetActiveSeqId",), + 0x801A8ABC:("AudioSeq_IsSeqCmdNotQueued",), + 0x801A8B14:("AudioSeq_ResetSequenceRequests",), + 0x801A8B2C:("AudioSeq_ReplaceSeqCmdSetupOpVolRestore",), + 0x801A8BD0:("AudioSeq_SetVolumeScale",), + 0x801A8D5C:("AudioSeq_UpdateActiveSequences",), + 0x801A9768:("AudioSeq_UpdateAudioHeapReset",), + 0x801A982C:("AudioSeq_ResetReverb",), + 0x801A99B8:("AudioSeq_ResetActiveSequences",), + 0x801A9A74:("AudioSeq_ResetActiveSequencesAndVolume",), 0x801A9B10:("JpegUtils_ProcessQuantizationTable",), 0x801A9B78:("JpegUtils_ParseHuffmanCodesLengths",), 0x801A9BFC:("JpegUtils_GetHuffmanCodes",), @@ -5098,14 +5098,14 @@ 0x808706E0:("EnOkuta_Draw",), 0x80870DB0:("EnBom_Init",), 0x80870FF8:("EnBom_Destroy",), - 0x80871058:("func_80871058",), - 0x808714D4:("func_808714D4",), - 0x808715B8:("func_808715B8",), + 0x80871058:("EnBom_Move",), + 0x808714D4:("EnBom_WaitForRelease",), + 0x808715B8:("EnBom_Explode",), 0x808719A8:("EnBom_Update",), 0x808722F4:("EnBom_Draw",), 0x80872648:("func_80872648",), 0x808726DC:("func_808726DC",), - 0x80872BC0:("func_80872BC0",), + 0x80872BC0:("EnBom_DrawKeg",), 0x80874810:("EnWallmas_Init",), 0x80874A28:("EnWallmas_Destroy",), 0x80874A88:("EnWallmas_Freeze",), @@ -5901,48 +5901,48 @@ 0x808B0F98:("EnAm_Draw",), 0x808B1330:("EnDekubaba_Init",), 0x808B1504:("EnDekubaba_Destroy",), - 0x808B1530:("func_808B1530",), - 0x808B15B8:("func_808B15B8",), - 0x808B16BC:("func_808B16BC",), - 0x808B1798:("func_808B1798",), - 0x808B1814:("func_808B1814",), - 0x808B18A8:("func_808B18A8",), - 0x808B1B14:("func_808B1B14",), - 0x808B1BC0:("func_808B1BC0",), - 0x808B1CF0:("func_808B1CF0",), - 0x808B2158:("func_808B2158",), - 0x808B2240:("func_808B2240",), - 0x808B2608:("func_808B2608",), - 0x808B2660:("func_808B2660",), - 0x808B2890:("func_808B2890",), - 0x808B28B4:("func_808B28B4",), - 0x808B2980:("func_808B2980",), - 0x808B29C4:("func_808B29C4",), - 0x808B2C40:("func_808B2C40",), - 0x808B2CB8:("func_808B2CB8",), - 0x808B3044:("func_808B3044",), - 0x808B3078:("func_808B3078",), - 0x808B3170:("func_808B3170",), - 0x808B3280:("func_808B3280",), - 0x808B3390:("func_808B3390",), - 0x808B3404:("func_808B3404",), - 0x808B3768:("func_808B3768",), - 0x808B37E8:("func_808B37E8",), - 0x808B39AC:("func_808B39AC",), - 0x808B3B48:("func_808B3B48",), - 0x808B3BE4:("func_808B3BE4",), - 0x808B3C50:("func_808B3C50",), - 0x808B3D74:("func_808B3D74",), - 0x808B3DA8:("func_808B3DA8",), - 0x808B3E40:("func_808B3E40",), - 0x808B3EE8:("func_808B3EE8",), - 0x808B3F50:("func_808B3F50",), + 0x808B1530:("EnDekubaba_DisableHitboxes",), + 0x808B15B8:("EnDekubaba_UpdateHeadPosition",), + 0x808B16BC:("EnDekubaba_SetFireLightEffects",), + 0x808B1798:("EnDekubaba_SetFrozenEffects",), + 0x808B1814:("EnDekubaba_SpawnIceEffects",), + 0x808B18A8:("EnDekubaba_SetupWait",), + 0x808B1B14:("EnDekubaba_Wait",), + 0x808B1BC0:("EnDekubaba_SetupGrow",), + 0x808B1CF0:("EnDekubaba_Grow",), + 0x808B2158:("EnDekubaba_SetupRetract",), + 0x808B2240:("EnDekubaba_Retract",), + 0x808B2608:("EnDekubaba_SetupDecideLunge",), + 0x808B2660:("EnDekubaba_DecideLunge",), + 0x808B2890:("EnDekubaba_SetupPrepareLunge",), + 0x808B28B4:("EnDekubaba_PrepareLunge",), + 0x808B2980:("EnDekubaba_SetupLunge",), + 0x808B29C4:("EnDekubaba_Lunge",), + 0x808B2C40:("EnDekubaba_SetupPullBack",), + 0x808B2CB8:("EnDekubaba_PullBack",), + 0x808B3044:("EnDekubaba_SetupRecover",), + 0x808B3078:("EnDekubaba_Recover",), + 0x808B3170:("EnDekubaba_SetupHit",), + 0x808B3280:("EnDekubaba_Hit",), + 0x808B3390:("EnDekubaba_SetupPrunedSomersaultDie",), + 0x808B3404:("EnDekubaba_PrunedSomersaultDie",), + 0x808B3768:("EnDekubaba_SetupShrinkDie",), + 0x808B37E8:("EnDekubaba_ShrinkDie",), + 0x808B39AC:("EnDekubaba_SetupStunnedVertical",), + 0x808B3B48:("EnDekubaba_StunnedVertical",), + 0x808B3BE4:("EnDekubaba_SetupSway",), + 0x808B3C50:("EnDekubaba_Sway",), + 0x808B3D74:("EnDekubaba_SetupFrozen",), + 0x808B3DA8:("EnDekubaba_Frozen",), + 0x808B3E40:("EnDekubaba_SetupDeadStickDrop",), + 0x808B3EE8:("EnDekubaba_DeadStickDrop",), + 0x808B3F50:("EnDekubaba_UpdateDamage",), 0x808B42FC:("EnDekubaba_Update",), - 0x808B4548:("func_808B4548",), - 0x808B465C:("func_808B465C",), - 0x808B48FC:("func_808B48FC",), - 0x808B49C8:("func_808B49C8",), - 0x808B4ABC:("func_808B4ABC",), + 0x808B4548:("EnDekubaba_DrawStemRetracted",), + 0x808B465C:("EnDekubaba_DrawStemExtended",), + 0x808B48FC:("EnDekubaba_DrawStemBasePruned",), + 0x808B49C8:("EnDekubaba_DrawShadow",), + 0x808B4ABC:("EnDekubaba_PostLimbDraw",), 0x808B4AF8:("EnDekubaba_Draw",), 0x808B5230:("EnMFire1_Init",), 0x808B5294:("EnMFire1_Destroy",), @@ -6675,33 +6675,33 @@ 0x808ED3F4:("func_808ED3F4",), 0x808F1200:("EnKarebaba_Init",), 0x808F1334:("EnKarebaba_Destroy",), - 0x808F1374:("func_808F1374",), - 0x808F13FC:("func_808F13FC",), - 0x808F152C:("func_808F152C",), - 0x808F155C:("func_808F155C",), - 0x808F15B0:("func_808F15B0",), - 0x808F1648:("func_808F1648",), - 0x808F169C:("func_808F169C",), - 0x808F16FC:("func_808F16FC",), - 0x808F1778:("func_808F1778",), - 0x808F1878:("func_808F1878",), - 0x808F190C:("func_808F190C",), - 0x808F1A3C:("func_808F1A3C",), - 0x808F1A58:("func_808F1A58",), - 0x808F1BF8:("func_808F1BF8",), - 0x808F1C84:("func_808F1C84",), - 0x808F1FAC:("func_808F1FAC",), - 0x808F200C:("func_808F200C",), - 0x808F20FC:("func_808F20FC",), - 0x808F21A4:("func_808F21A4",), - 0x808F220C:("func_808F220C",), - 0x808F228C:("func_808F228C",), - 0x808F238C:("func_808F238C",), - 0x808F241C:("func_808F241C",), - 0x808F24F8:("func_808F24F8",), - 0x808F254C:("func_808F254C",), + 0x808F1374:("EnKarebaba_SpawnIceEffects",), + 0x808F13FC:("EnKarebaba_SetDamageEffects",), + 0x808F152C:("EnKarebaba_ResetColliders",), + 0x808F155C:("EnKarebaba_SetupGrow",), + 0x808F15B0:("EnKarebaba_Grow",), + 0x808F1648:("EnKarebaba_SetupIdle",), + 0x808F169C:("EnKarebaba_Idle",), + 0x808F16FC:("EnKarebaba_SetupAwaken",), + 0x808F1778:("EnKarebaba_Awaken",), + 0x808F1878:("EnKarebaba_SetupUpright",), + 0x808F190C:("EnKarebaba_Upright",), + 0x808F1A3C:("EnKarebaba_SetupSpin",), + 0x808F1A58:("EnKarebaba_Spin",), + 0x808F1BF8:("EnKarebaba_SetupDying",), + 0x808F1C84:("EnKarebaba_Dying",), + 0x808F1FAC:("EnKarebaba_SetupShrinkDie",), + 0x808F200C:("EnKarebaba_ShrinkDie",), + 0x808F20FC:("EnKarebaba_SetupDeadItemDrop",), + 0x808F21A4:("EnKarebaba_DeadItemDrop",), + 0x808F220C:("EnKarebaba_SetupRetract",), + 0x808F228C:("EnKarebaba_Retract",), + 0x808F238C:("EnKarebaba_SetupDead",), + 0x808F241C:("EnKarebaba_Regrow",), + 0x808F24F8:("EnKarebaba_SetupRegrow",), + 0x808F254C:("EnKarebaba_Dead",), 0x808F25A4:("EnKarebaba_Update",), - 0x808F280C:("func_808F280C",), + 0x808F280C:("EnKarebaba_DrawShadow",), 0x808F28F8:("EnKarebaba_Draw",), 0x808F30B0:("EnIn_ChangeAnim",), 0x808F3178:("func_808F3178",), @@ -8354,10 +8354,10 @@ 0x8098BFB8:("EnDg_OverrideLimbDraw",), 0x8098BFD4:("EnDg_PostLimbDraw",), 0x8098C06C:("EnDg_Draw",), - 0x8098CA20:("func_8098CA20",), - 0x8098CAD0:("func_8098CAD0",), - 0x8098CB70:("func_8098CB70",), - 0x8098CBDC:("func_8098CBDC",), + 0x8098CA20:("EnSi_UpdateCollision",), + 0x8098CAD0:("EnSi_GiveToken",), + 0x8098CB70:("EnSi_Wait",), + 0x8098CBDC:("EnSi_DraggedByHookshot",), 0x8098CC18:("EnSi_Init",), 0x8098CC98:("EnSi_Destroy",), 0x8098CCC4:("EnSi_Update",), @@ -8682,7 +8682,7 @@ 0x809A20FC:("EnMm2_WaitForRead",), 0x809A2194:("EnMm2_Update",), 0x809A21B8:("EnMm2_Draw",), - 0x809A2B60:("DoorSpiral_SetupAction",), + 0x809A2B60:("func_809A2B60",), 0x809A2B70:("func_809A2B70",), 0x809A2BF8:("func_809A2BF8",), 0x809A2C78:("DoorSpiral_Init",), @@ -9125,8 +9125,8 @@ 0x809CA27C:("BgIcicle_Draw",), 0x809CA3F0:("EnSyatekiCrow_Init",), 0x809CA5A8:("EnSyatekiCrow_Destroy",), - 0x809CA5D4:("EnSyatekiCrow_SetupWaitForSpawn",), - 0x809CA67C:("EnSyatekiCrow_WaitForSpawn",), + 0x809CA5D4:("EnSyatekiCrow_SetupWaitForSignal",), + 0x809CA67C:("EnSyatekiCrow_WaitForSignal",), 0x809CA71C:("EnSyatekiCrow_SetupWaitToMove",), 0x809CA840:("EnSyatekiCrow_WaitToMove",), 0x809CA8E4:("EnSyatekiCrow_Fly",), @@ -9876,21 +9876,21 @@ 0x80A1FC50:("DmHina_Draw",), 0x80A1FE50:("EnSyatekiWf_Init",), 0x80A200A0:("EnSyatekiWf_Destroy",), - 0x80A200E0:("func_80A200E0",), - 0x80A201CC:("func_80A201CC",), - 0x80A20284:("func_80A20284",), - 0x80A2030C:("func_80A2030C",), - 0x80A20320:("func_80A20320",), - 0x80A20378:("func_80A20378",), - 0x80A203DC:("func_80A203DC",), - 0x80A20670:("func_80A20670",), - 0x80A206DC:("func_80A206DC",), - 0x80A20710:("func_80A20710",), - 0x80A2075C:("func_80A2075C",), - 0x80A2079C:("func_80A2079C",), - 0x80A20800:("func_80A20800",), - 0x80A20858:("func_80A20858",), - 0x80A208F8:("func_80A208F8",), + 0x80A200E0:("EnSyatekiWf_InitPathStart",), + 0x80A201CC:("EnSyatekiWf_SetupWaitForSignal",), + 0x80A20284:("EnSyatekiWf_WaitForSignal",), + 0x80A2030C:("EnSyatekiWf_SetupWaitToMove",), + 0x80A20320:("EnSyatekiWf_WaitToMove",), + 0x80A20378:("EnSyatekiWf_SetupRun",), + 0x80A203DC:("EnSyatekiWf_Run",), + 0x80A20670:("EnSyatekiWf_SetupJump",), + 0x80A206DC:("EnSyatekiWf_Jump",), + 0x80A20710:("EnSyatekiWf_SetupLand",), + 0x80A2075C:("EnSyatekiWf_Land",), + 0x80A2079C:("EnSyatekiWf_SetupHowl",), + 0x80A20800:("EnSyatekiWf_Howl",), + 0x80A20858:("EnSyatekiWf_SetupDead",), + 0x80A208F8:("EnSyatekiWf_Dead",), 0x80A20A50:("EnSyatekiWf_Update",), 0x80A20CF4:("EnSyatekiWf_OverrideLimbDraw",), 0x80A20D10:("EnSyatekiWf_PostLimbDraw",), @@ -10063,10 +10063,10 @@ 0x80A2B390:("BgDblueMovebg_Draw",), 0x80A2BC00:("EnSyatekiDekunuts_Init",), 0x80A2BE28:("EnSyatekiDekunuts_Destroy",), - 0x80A2BE54:("EnSyatekiDekunuts_SetupWaitForSpawn",), - 0x80A2BF18:("EnSyatekiDekunuts_WaitForSpawn",), - 0x80A2BFC4:("EnSyatekiDekunuts_SetupSpawn",), - 0x80A2C0F8:("EnSyatekiDekunuts_Spawn",), + 0x80A2BE54:("EnSyatekiDekunuts_SetupWaitForSignal",), + 0x80A2BF18:("EnSyatekiDekunuts_WaitForSignal",), + 0x80A2BFC4:("EnSyatekiDekunuts_SetupWaitToStart",), + 0x80A2C0F8:("EnSyatekiDekunuts_WaitToStart",), 0x80A2C150:("EnSyatekiDekunuts_SetupWaitToEmerge",), 0x80A2C168:("EnSyatekiDekunuts_WaitToEmerge",), 0x80A2C1AC:("EnSyatekiDekunuts_SetupEmerge",), @@ -12021,21 +12021,21 @@ 0x80AC9D10:("ObjOcarinalift_Draw",), 0x80AC9EA0:("EnTimeTag_Init",), 0x80AC9FC4:("EnTimeTag_Destroy",), - 0x80AC9FD4:("func_80AC9FD4",), - 0x80AC9FE4:("func_80AC9FE4",), - 0x80ACA0A8:("func_80ACA0A8",), - 0x80ACA12C:("func_80ACA12C",), - 0x80ACA184:("func_80ACA184",), - 0x80ACA208:("func_80ACA208",), - 0x80ACA268:("func_80ACA268",), - 0x80ACA348:("func_80ACA348",), - 0x80ACA3C0:("func_80ACA3C0",), - 0x80ACA418:("func_80ACA418",), - 0x80ACA5F8:("func_80ACA5F8",), - 0x80ACA714:("func_80ACA714",), - 0x80ACA724:("func_80ACA724",), - 0x80ACA7C4:("func_80ACA7C4",), - 0x80ACA840:("func_80ACA840",), + 0x80AC9FD4:("EnTimeTag_RooftopOath_DoNothing",), + 0x80AC9FE4:("EnTimeTag_RooftopOath_Cutscene",), + 0x80ACA0A8:("EnTimeTag_RooftopOath_Wait",), + 0x80ACA12C:("EnTimeTag_SoaringEngraving_GetSong",), + 0x80ACA184:("EnTimeTag_SoaringEngraving_StartCutscene",), + 0x80ACA208:("EnTimeTag_SoaringEngraving_SubsequentInteraction",), + 0x80ACA268:("EnTimeTag_SoaringEngraving_Wait",), + 0x80ACA348:("EnTimeTag_Diary_AfterOcarina",), + 0x80ACA3C0:("EnTimeTag_Diary_TeachEvanSongSnippets",), + 0x80ACA418:("EnTimeTag_Diary_Cutscene",), + 0x80ACA5F8:("EnTimeTag_Diary_Wait",), + 0x80ACA714:("EnTimeTag_KickOut_DoNothing",), + 0x80ACA724:("EnTimeTag_KickOut_Transition",), + 0x80ACA7C4:("EnTimeTag_KickOut_WaitForTrigger",), + 0x80ACA840:("EnTimeTag_KickOut_WaitForTime",), 0x80ACA9AC:("EnTimeTag_Update",), 0x80ACAB10:("func_80ACAB10",), 0x80ACABA8:("func_80ACABA8",), @@ -12481,8 +12481,8 @@ 0x80AE6E8C:("EnShn_Draw",), 0x80AE73A0:("EnStopheishi_Init",), 0x80AE74E0:("EnStopheishi_Destroy",), - 0x80AE750C:("func_80AE750C",), - 0x80AE75C8:("func_80AE75C8",), + 0x80AE750C:("EnStopHeishi_ChangeAnim",), + 0x80AE75C8:("EnStopheishi_UpdateHeadNormal",), 0x80AE7718:("func_80AE7718",), 0x80AE77D4:("func_80AE77D4",), 0x80AE795C:("func_80AE795C",), @@ -12491,8 +12491,8 @@ 0x80AE854C:("func_80AE854C",), 0x80AE85C4:("func_80AE85C4",), 0x80AE8680:("EnStopheishi_Update",), - 0x80AE87A4:("func_80AE87A4",), - 0x80AE87EC:("func_80AE87EC",), + 0x80AE87A4:("EnStopheishi_OverrideLimbDraw",), + 0x80AE87EC:("EnStopheishi_PostLimbDraw",), 0x80AE882C:("EnStopheishi_Draw",), 0x80AE8B70:("ObjBigicicle_Init",), 0x80AE8DA4:("ObjBigicicle_Destroy",), @@ -13735,9 +13735,9 @@ 0x80B43DD4:("func_80B43DD4",), 0x80B43E6C:("func_80B43E6C",), 0x80B43F0C:("func_80B43F0C",), - 0x80B43F70:("EnInvadepoh_GetTotalPathDistance",), + 0x80B43F70:("func_80B43F70",), 0x80B44024:("func_80B44024",), - 0x80B4407C:("EnInvadepoh_SetPathPointToWorldPos",), + 0x80B4407C:("func_80B4407C",), 0x80B440B8:("func_80B440B8",), 0x80B44234:("func_80B44234",), 0x80B442E4:("func_80B442E4",), @@ -13771,9 +13771,9 @@ 0x80B453F4:("func_80B453F4",), 0x80B45460:("func_80B45460",), 0x80B454BC:("func_80B454BC",), - 0x80B45518:("EnInvadepoh_SetSysMatrix",), + 0x80B45518:("func_80B45518",), 0x80B45550:("func_80B45550",), - 0x80B4560C:("EnInvadepoh_SetTextID",), + 0x80B4560C:("func_80B4560C",), 0x80B45648:("func_80B45648",), 0x80B456A8:("func_80B456A8",), 0x80B457A0:("func_80B457A0",), @@ -13791,13 +13791,13 @@ 0x80B46184:("func_80B46184",), 0x80B461DC:("func_80B461DC",), 0x80B4627C:("func_80B4627C",), - 0x80B46414:("EnInvadepoh_InitAlien",), - 0x80B46520:("EnInvadepoh_InitParentCow",), - 0x80B465CC:("EnInvadepoh_InitChildCow",), - 0x80B46644:("EnInvadepoh_InitRomani",), + 0x80B46414:("func_80B46414",), + 0x80B46520:("func_80B46520",), + 0x80B465CC:("func_80B465CC",), + 0x80B46644:("func_80B46644",), 0x80B468B4:("func_80B468B4",), - 0x80B469C4:("EnInvadepoh_InitDog",), - 0x80B46A80:("EnInvadepoh_InitCremia",), + 0x80B469C4:("func_80B469C4",), + 0x80B46A80:("func_80B46A80",), 0x80B46B74:("EnInvadepoh_Init",), 0x80B46BB0:("func_80B46BB0",), 0x80B46BC0:("func_80B46BC0",), @@ -14252,30 +14252,30 @@ 0x80B66BDC:("ObjHariko_Draw",), 0x80B66D30:("EnSth_Init",), 0x80B67010:("EnSth_Destroy",), - 0x80B6703C:("func_80B6703C",), - 0x80B670A4:("func_80B670A4",), - 0x80B67148:("func_80B67148",), - 0x80B671A0:("func_80B671A0",), - 0x80B67208:("func_80B67208",), - 0x80B672A4:("func_80B672A4",), - 0x80B67348:("func_80B67348",), - 0x80B67458:("func_80B67458",), - 0x80B67540:("func_80B67540",), - 0x80B677BC:("func_80B677BC",), - 0x80B67838:("func_80B67838",), - 0x80B678A8:("func_80B678A8",), - 0x80B67958:("func_80B67958",), - 0x80B67984:("func_80B67984",), - 0x80B67AB4:("func_80B67AB4",), - 0x80B67B50:("func_80B67B50",), - 0x80B67C1C:("func_80B67C1C",), - 0x80B67DA0:("func_80B67DA0",), - 0x80B67E20:("func_80B67E20",), - 0x80B67E78:("EnSth_Update",), - 0x80B680A8:("func_80B680A8",), - 0x80B681E8:("func_80B681E8",), - 0x80B68310:("func_80B68310",), - 0x80B6849C:("func_80B6849C",), + 0x80B6703C:("EnSth_CanSpeakToPlayer",), + 0x80B670A4:("EnSth_ChangeAnim",), + 0x80B67148:("EnSth_GetInitialPanicText",), + 0x80B671A0:("EnSth_HandlePanicConversation",), + 0x80B67208:("EnSth_PanicIdle",), + 0x80B672A4:("EnSth_GetInitialOceansideSpiderHouseText",), + 0x80B67348:("EnSth_PostOceanspiderhouseReward",), + 0x80B67458:("EnSth_GiveOceansideSpiderHouseReward",), + 0x80B67540:("EnSth_HandleOceansideSpiderHouseConversation",), + 0x80B677BC:("EnSth_OceansideSpiderHouseIdle",), + 0x80B67838:("EnSth_HandleMoonLookingConversation",), + 0x80B678A8:("EnSth_MoonLookingIdle",), + 0x80B67958:("EnSth_DefaultIdle",), + 0x80B67984:("EnSth_GetInitialSwampSpiderHouseText",), + 0x80B67AB4:("EnSth_TalkAfterSwampSpiderHouseGiveMask",), + 0x80B67B50:("EnSth_SwampSpiderHouseGiveMask",), + 0x80B67C1C:("EnSth_HandleSwampSpiderHouseConversation",), + 0x80B67DA0:("EnSth_SwampSpiderHouseIdle",), + 0x80B67E20:("EnSth_UpdateOceansideSpiderHouseWaitForTokens",), + 0x80B67E78:("EnSth_UpdateWaitForObject",), + 0x80B680A8:("EnSth_Update",), + 0x80B681E8:("EnSth_OverrideLimbDraw",), + 0x80B68310:("EnSth_PostLimbDraw",), + 0x80B6849C:("EnSth_Draw",), 0x80B6D660:("BgSinkaiKabe_Init",), 0x80B6D9EC:("BgSinkaiKabe_Destroy",), 0x80B6DA20:("BgSinkaiKabe_WaitForPlayer",), @@ -14704,33 +14704,33 @@ 0x80B8A718:("EnKaizoku_Draw",), 0x80B8B2D0:("EnGe2_Init",), 0x80B8B504:("EnGe2_Destroy",), - 0x80B8B514:("func_80B8B514",), - 0x80B8B5AC:("func_80B8B5AC",), - 0x80B8B6B4:("func_80B8B6B4",), - 0x80B8B7A8:("func_80B8B7A8",), - 0x80B8B848:("func_80B8B848",), - 0x80B8B90C:("func_80B8B90C",), - 0x80B8BA40:("func_80B8BA40",), - 0x80B8BB3C:("func_80B8BB3C",), - 0x80B8BC1C:("func_80B8BC1C",), - 0x80B8BC78:("func_80B8BC78",), - 0x80B8BCEC:("func_80B8BCEC",), - 0x80B8BD38:("func_80B8BD38",), - 0x80B8BD90:("func_80B8BD90",), - 0x80B8BE08:("func_80B8BE08",), - 0x80B8BF04:("func_80B8BF04",), - 0x80B8BFC8:("func_80B8BFC8",), - 0x80B8C048:("func_80B8C048",), - 0x80B8C0B0:("func_80B8C0B0",), - 0x80B8C13C:("func_80B8C13C",), - 0x80B8C45C:("func_80B8C45C",), - 0x80B8C59C:("func_80B8C59C",), - 0x80B8C644:("func_80B8C644",), - 0x80B8C9B8:("func_80B8C9B8",), + 0x80B8B514:("EnGe2_DetectPlayer",), + 0x80B8B5AC:("EnGe2_LookForPlayer",), + 0x80B8B6B4:("EnGe2_SetupPath",), + 0x80B8B7A8:("EnGe2_GetNextPath",), + 0x80B8B848:("EnGe2_SetupBlownAwayPath",), + 0x80B8B90C:("EnGe2_FollowPath",), + 0x80B8BA40:("EnGe2_FollowPathWithoutGravity",), + 0x80B8BB3C:("EnGe2_SpawnEffects",), + 0x80B8BC1C:("EnGe2_Scream",), + 0x80B8BC78:("EnGe2_ThrowPlayerOut",), + 0x80B8BCEC:("EnGe2_TurnToPlayerFast",), + 0x80B8BD38:("EnGe2_CapturePlayer",), + 0x80B8BD90:("EnGe2_SetupCapturePlayer",), + 0x80B8BE08:("EnGe2_Charge",), + 0x80B8BF04:("EnGe2_SetupCharge",), + 0x80B8BFC8:("EnGe2_SetupLookAround",), + 0x80B8C048:("EnGe2_Stunned",), + 0x80B8C0B0:("EnGe2_KnockedOut",), + 0x80B8C13C:("EnGe2_PatrolDuties",), + 0x80B8C45C:("EnGe2_LookAround",), + 0x80B8C59C:("EnGe2_Walk",), + 0x80B8C644:("EnGe2_PerformCutsceneActions",), + 0x80B8C9B8:("EnGe2_GuardStationary",), 0x80B8CAA8:("EnGe2_Update",), - 0x80B8CC0C:("func_80B8CC0C",), - 0x80B8CCB4:("func_80B8CCB4",), - 0x80B8CCFC:("func_80B8CCFC",), + 0x80B8CC0C:("EnGe2_ValidatePictograph",), + 0x80B8CCB4:("EnGe2_OverrideLimbDraw",), + 0x80B8CCFC:("EnGe2_PostLimbDraw",), 0x80B8CD3C:("EnGe2_Draw",), 0x80B8D030:("EnMaYts_UpdateEyes",), 0x80B8D0BC:("EnMaYts_ChangeAnim",), @@ -14960,9 +14960,9 @@ 0x80B9AF50:("func_80B9AF50",), 0x80B9AFE0:("ObjBoat_Init",), 0x80B9B0F0:("ObjBoat_Destroy",), - 0x80B9B124:("func_80B9B124",), + 0x80B9B124:("ObjBoat_SetRotations",), 0x80B9B1B8:("ObjBoat_Update",), - 0x80B9B428:("func_80B9B428",), + 0x80B9B428:("ObjBoat_UpdateCutscene",), 0x80B9B628:("ObjBoat_Draw",), 0x80B9B6E0:("func_80B9B6E0",), 0x80B9B74C:("func_80B9B74C",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 962bf4fc2..d896f3ae7 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -285,15 +285,15 @@ 0x800994D0:("D_800994D0","char","[]",0xc), 0x800994DC:("D_800994DC","char","[]",0x12), 0x800994F0:("D_800994F0","char","[]",0x1), - 0x80099500:("sBootThreadInfo","StackEntry","",0x1c), + 0x80099500:("sBootStackInfo","StackEntry","",0x1c), 0x80099520:("sIdleThread","OSThread","",0x1b0), 0x800996D0:("sIdleThreadStack","u8","[1024]",0x400), - 0x80099AD0:("sIdleThreadInfo","StackEntry","",0x1c), + 0x80099AD0:("sIdleStackInfo","StackEntry","",0x1c), 0x80099AF0:("sBootThreadStack","u8","[1024]",0x400), 0x80099EF0:("gIrqMgr","IrqMgr","",0x280), 0x8009A170:("sIrqMgrStack","u8","[1280]",0x500), 0x8009A670:("sIrqMgrStackInfo","StackEntry","",0x1c), - 0x8009A690:("gMainThread","OSThread","",0x1b0), + 0x8009A690:("sMainThread","OSThread","",0x1b0), 0x8009A840:("sMainStack","u8","[2304]",0x900), 0x8009B140:("sMainStackInfo","StackEntry","",0x1c), 0x8009B160:("sPiMgrCmdBuff","OSMesg","[50]",0xc8), @@ -320,7 +320,7 @@ 0x8009BE58:("faultCustomOptions","u32","",0x4), 0x8009BE5C:("faultCopyToLog","u32","",0x4), 0x8009BE60:("sFaultStack","u8","[1536]",0x600), - 0x8009C460:("sFaultThreadInfo","StackEntry","",0x1c), + 0x8009C460:("sFaultStackInfo","StackEntry","",0x1c), 0x8009C480:("gFaultStruct","FaultThreadStruct","",0x848), 0x8009CCD0:("sFaultDrawerStruct","FaultDrawer","",0x3c), 0x8009CD10:("D_8009CD10","UNK_TYPE4","",0x4), @@ -343,8 +343,8 @@ 0x8009CF80:("__osThreadSave","OSThread","",0x1b0), 0x8009D130:("D_8009D130","OSPiHandle","",0x74), 0x8009D1A8:("D_8009D1A8","OSPiHandle","",0x74), - 0x8009D220:("D_8009D220","OSThread","",0x1b0), - 0x8009D3D0:("piManagerStack","u8","[4096]",0x1000), + 0x8009D220:("sPiMgrThread","OSThread","",0x1b0), + 0x8009D3D0:("sPiMgrStack","u8","[4096]",0x1000), 0x8009E3D0:("D_8009E3D0","OSMesgQueue","",0x18), 0x8009E3E8:("D_8009E3E8","OSMesg","[1]",0x4), 0x8009E3F0:("D_8009E3F0","OSMesg","[1]",0x4), @@ -359,7 +359,7 @@ 0x8009E5D0:("__osPfsPifRam","OSPifRam","",0x40), 0x8009E610:("CartRomHandle","OSPiHandle","",0x74), 0x8009E690:("viThread","OSThread","",0x1b0), - 0x8009E840:("viThreadStack","u8","[4096]",0x1000), + 0x8009E840:("sViStack","u8","[4096]",0x1000), 0x8009F840:("viEventQueue","OSMesgQueue","",0x18), 0x8009F858:("viEventBuf","OSMesg","[5]",0x14), 0x8009F870:("viRetraceMsg","OSIoMesg","",0x18), @@ -398,7 +398,7 @@ 0x801AE2BC:("D_801AE2BC","UNK_TYPE4","",0x4), 0x801AE2CC:("D_801AE2CC","UNK_TYPE4","",0x4), 0x801AE2DC:("D_801AE2DC","UNK_TYPE4","",0x4), - 0x801AE2F0:("sEffectShieldParticleVertices","F3DVertex","[4]",0x40), + 0x801AE2F0:("sEffShieldParticleVtx","Vtx","[4]",0x40), 0x801AE330:("sEffectInfoTable","EffectInfo","[5]",0x64), 0x801AE3A0:("sEffectSsInfo","EffectSsInfo","",0xc), 0x801AE3B0:("D_801AE3B0","Color_RGBA8","",0x4), @@ -430,19 +430,19 @@ 0x801AEC78:("sTimer","s32","",0x4), 0x801AEC80:("D_801AEC80","Color_RGBA8","",0x4), 0x801AEC84:("sTatlColorList","TatlColor","[13]",0x68), - 0x801AECEC:("actorMovementScale","f32","",0x4), + 0x801AECEC:("sActorMovementScale","f32","",0x4), 0x801AECF0:("gTargetRanges","f32","[]",0x58), 0x801AED48:("D_801AED48","s16","[8]",0x10), - 0x801AED58:("D_801AED58","UNK_TYPE4","",0x4), + 0x801AED58:("sCategoryFreezeMasks","UNK_TYPE4","",0x4), 0x801AED88:("actorDefaultHitColor","Color_RGBA8","",0x4), 0x801AED8C:("D_801AED8C","UNK_TYPE1","",0x1), 0x801AED98:("D_801AED98","Vec3f","",0xC), 0x801AEDA4:("D_801AEDA4","UNK_TYPE4","",0x4), - 0x801AEDB0:("D_801AEDB0","UNK_TYPE1","",0x1), - 0x801AEDD4:("D_801AEDD4","UNK_TYPE4","",0x4), + 0x801AEDB0:("sArrowDmgFlags","UNK_TYPE1","",0x1), + 0x801AEDD4:("sDoorLocksInfo","UNK_TYPE4","",0x4), 0x801AEE28:("D_801AEE28","UNK_TYPE4","",0x4), 0x801AEE30:("D_801AEE30","UNK_TYPE4","",0x4), - 0x801AEE38:("D_801AEE38","struct_801AEE38","[14]",0x150), + 0x801AEE38:("sNpcTrackingPresets","NpcTrackingParams","[14]",0x150), 0x801AEF88:("D_801AEF88","UNK_TYPE1","",0x1), 0x801AEFA0:("D_801AEFA0","UNK_TYPE1","",0x1), 0x801AEFA8:("sElectricSparkTextures","UNK_TYPE1","",0x1), @@ -927,9 +927,9 @@ 0x801BB15C:("D_801BB15C","UNK_TYPE2","",0x2), 0x801BB160:("D_801BB160","UNK_TYPE4","",0x4), 0x801BB170:("sDrawItemTable","DrawItemTableEntry","[118]",0x1098), - 0x801BC210:("D_801BC210","UNK_TYPE1","",0x1), - 0x801BC240:("D_801BC240","Gfx","[9]",0x48), - 0x801BC288:("D_801BC288","Gfx","[3]",0x18), + 0x801BC210:("gEffFootprintVtx","UNK_TYPE1","",0x1), + 0x801BC240:("gEffFootprintMaterialDL","Gfx","[9]",0x48), + 0x801BC288:("gEffFootprintModelDL","Gfx","[3]",0x18), 0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1), 0x801BC3F0:("gEnHyBodyParts","UNK_TYPE1","",0x1), 0x801BC400:("gEnHyParentBodyParts","UNK_TYPE1","",0x1), @@ -1136,9 +1136,9 @@ 0x801BFAFC:("D_801BFAFC","UNK_TYPE4","",0x4), 0x801BFB04:("D_801BFB04","UNK_TYPE1","",0x1), 0x801BFB0C:("D_801BFB0C","UNK_TYPE1","",0x1), - 0x801BFB14:("D_801BFB14","UNK_TYPE1","",0x1), - 0x801BFB1C:("D_801BFB1C","UNK_TYPE1","",0x1), - 0x801BFB24:("D_801BFB24","UNK_TYPE1","",0x1), + 0x801BFB14:("sMagicArrowEffectsR","UNK_TYPE1","",0x1), + 0x801BFB1C:("sMagicArrowEffectsG","UNK_TYPE1","",0x1), + 0x801BFB24:("sMagicArrowEffectsB","UNK_TYPE1","",0x1), 0x801BFB2C:("sThreeDayClockAlpha","UNK_TYPE2","",0x2), 0x801BFB30:("D_801BFB30","UNK_TYPE2","",0x2), 0x801BFB34:("D_801BFB34","UNK_TYPE2","",0x2), @@ -1339,8 +1339,8 @@ 0x801C0EF0:("sSetupDL","Gfx","[438]",0xdb0), 0x801C1CA0:("sFillSetupDL","Gfx","[12]",0x60), 0x801C1D00:("gEmptyDL","Gfx","[1]",0x8), - 0x801C1D10:("D_801C1D10","Vec3f","",0xc), - 0x801C1D1C:("roomDrawFuncs","room_draw_func","[4]",0x10), + 0x801C1D10:("sZeroVec","Vec3f","",0xc), + 0x801C1D1C:("sRoomDrawHandlers","RoomDrawHandler","[4]",0x10), 0x801C1D30:("gBitFlags","u32","[32]",0x80), 0x801C1DB0:("gEquipMasks","u16","[4]",0x8), 0x801C1DB8:("gEquipNegMasks","u16","[4]",0x8), @@ -1360,7 +1360,8 @@ 0x801C2650:("tatlMessageFiles","RomFile","[2]",0x10), 0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48), 0x801C26A8:("sceneHeaderFuncTable","scene_header_func","[31]",0x7c), - 0x801C2730:("gPlayerFormObjectIndices","s16","[8]",0x10), + 0x801C2730:("gPlayerFormObjectIndices","s16","[5]",0xA), + 0x801C273C:("gObjectTableSize","ObjectId","",0x4), 0x801C2740:("gObjectTable","RomFile","[643]",0x1418), 0x801C3B60:("sSceneDrawDefaultDl","Gfx","[11]",0x58), 0x801C3BB8:("gSceneProcSceneDrawFuncs","SceneDrawConfigFunc","[8]",0x20), @@ -2400,14 +2401,14 @@ 0x801DB4A4:("gSfxDefaultPos","UNK_TYPE4","",0x4), 0x801DB4B0:("gSfxDefaultFreqAndVolScale","UNK_TYPE1","",0x1), 0x801DB4B8:("gSfxDefaultReverb","UNK_TYPE1","",0x1), - 0x801DB4C0:("D_801DB4C0","UNK_TYPE1","",0x1), - 0x801DB4C4:("D_801DB4C4","UNK_TYPE1","",0x1), - 0x801DB4C8:("D_801DB4C8","UNK_TYPE1","",0x1), - 0x801DB4CC:("D_801DB4CC","UNK_TYPE1","",0x1), + 0x801DB4C0:("sSeqCmdWritePos","UNK_TYPE1","",0x1), + 0x801DB4C4:("sSeqCmdReadPos","UNK_TYPE1","",0x1), + 0x801DB4C8:("sStartSeqDisabled","UNK_TYPE1","",0x1), + 0x801DB4CC:("sSoundModeList","UNK_TYPE1","",0x1), 0x801DB4D4:("gAudioSpecId","UNK_TYPE1","",0x1), - 0x801DB4D8:("D_801DB4D8","UNK_TYPE1","",0x1), - 0x801DB4DC:("D_801DB4DC","UNK_TYPE4","",0x4), - 0x801DB4E0:("D_801DB4E0","UNK_TYPE1","",0x1), + 0x801DB4D8:("gAudioHeapResetState","UNK_TYPE1","",0x1), + 0x801DB4DC:("sResetAudioHeapSeqCmd","UNK_TYPE4","",0x4), + 0x801DB4E0:("gReverbSettings","UNK_TYPE1","",0x1), 0x801DB528:("D_801DB528","UNK_TYPE1","",0x1), 0x801DB570:("D_801DB570","UNK_TYPE1","",0x1), 0x801DB5B8:("D_801DB5B8","UNK_TYPE1","",0x1), @@ -3856,7 +3857,7 @@ 0x801ED8E0:("D_801ED8E0","Mtx","",0x40), 0x801ED920:("D_801ED920","UNK_TYPE1","",0x1), 0x801ED930:("D_801ED930","FaultClient","",0x10), - 0x801ED940:("D_801ED940","FaultAddrConvClient","",0xc), + 0x801ED940:("sActorOverlayTableFaultAddrConvClient","FaultAddrConvClient","",0xC), 0x801ED950:("D_801ED950","char","[80]",0x50), 0x801ED9A0:("D_801ED9A0","char","[80]",0x50), 0x801ED9F0:("D_801ED9F0","Vec3f","[3]",0x24), @@ -3923,11 +3924,9 @@ 0x801EF670:("gSaveContext","SaveContext","",0x48e8), 0x801F3F58:("D_801F3F58","UNK_TYPE1","",0x1), 0x801F3F5A:("D_801F3F5A","UNK_TYPE1","",0x1), - 0x801F3F60:("gGameInfo","GameInfo*","",0x4), + 0x801F3F60:("gRegEditor","RegEditor*","",0x4), 0x801F3F70:("sDebugObjectListHead","UNK_TYPE1","",0x1), - 0x801F3F80:("D_801F3F80","UNK_TYPE1","",0x1), - 0x801F3F83:("D_801F3F83","UNK_TYPE1","",0x1), - 0x801F48C8:("D_801F48C8","UNK_TYPE1","",0x1), + 0x801F3F80:("D_801F3F80","UNK_TYPE1","",0xDC0), 0x801F4D40:("seqId","u16","",0x2), 0x801F4D42:("sCutsceneQuakeIndex","UNK_TYPE2","",0x2), 0x801F4D48:("sCutsceneCameraInfo","UNK_TYPE","",0x80), @@ -4048,14 +4047,13 @@ 0x801F6B44:("sShrinkWindowPtr","ShrinkWindow*","",0x4), 0x801F6B50:("D_801F6B50","UNK_TYPE4","",0x4), 0x801F6B58:("D_801F6B58","UNK_TYPE1","",0x1), - 0x801F6BF0:("sKaleidoAreaFaultClient","FaultAddrConvClient","",0xC), + 0x801F6BF0:("sKaleidoMgrFaultAddrConvClient","FaultAddrConvClient","",0xC), 0x801F6C00:("sKaleidoScopeUpdateFunc","void*","",0x4), 0x801F6C04:("sKaleidoScopeDrawFunc","void*","",0x4), 0x801F6C10:("sTransitionFillTimer","UNK_TYPE1","",0x1), 0x801F6C18:("D_801F6C18","Input","",0x18), - 0x801F6C30:("sTrnsnUnk","UNK_TYPE1","",0x1), - 0x801F6D0C:("D_801F6D0C","UNK_TYPE1","",0x1), - 0x801F6D10:("gTrnsnUnkState","UNK_TYPE4","",0x4), + 0x801F6C30:("sTransitionTile","TransitionTile","",0xE0), + 0x801F6D10:("gTransitionTileState","UNK_TYPE4","",0x4), 0x801F6D18:("sVisMono","UNK_TYPE1","",0x1), 0x801F6D30:("gVisMonoColor","Color_RGBA8","",0x4), 0x801F6D38:("D_801F6D38","UNK_TYPE1","",0x1), @@ -4063,11 +4061,10 @@ 0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1), 0x801F6DFC:("sBombersNotebookOpen","u8","",0x1), 0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1), - 0x801F6E00:("D_801F6E00","SlowlyTask","",0x1c0), + 0x801F6E00:("sSlowlyMgr","SlowlyMgr","",0x1c0), 0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1), - 0x801F6FC8:("slowlyStackEntry","StackEntry","",0x1c), - 0x801F6FE8:("slowlyStack","u8","[4096]",0x1000), - 0x801F7FE8:("D_801F7FE8","UNK_TYPE1","",0x1), + 0x801F6FC8:("sSlowlyStackInfo","StackEntry","",0x1c), + 0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000), 0x801F7FF0:("D_801F7FF0","UNK_TYPE1","",0x1), 0x801F8010:("D_801F8010","struct_801F8010","",0x10), 0x801F8020:("D_801F8020","struct_801F8020","",0x10), @@ -4085,17 +4082,17 @@ 0x801F84F8:("irqClient","IrqMgrClient","",0x8), 0x801F8500:("irqMgrMsgQ","OSMesgQueue","",0x18), 0x801F8518:("irqMgrMsgBuf","OSMesg","[60]",0xf0), - 0x801F8608:("sGraphThread","OSThread","",0x1b0), + 0x801F8608:("gGraphThread","OSThread","",0x1b0), 0x801F87B8:("sGraphStack","u8","[6144]",0x1800), - 0x801F9FB8:("schedStack","u8","[1536]",0x600), - 0x801FA5B8:("audioStack","u8","[2048]",0x800), - 0x801FADB8:("padmgrStack","u8","[1280]",0x500), + 0x801F9FB8:("sSchedStack","u8","[1536]",0x600), + 0x801FA5B8:("sAudioStack","u8","[2048]",0x800), + 0x801FADB8:("sPadMgrStack","u8","[1280]",0x500), 0x801FB2B8:("sGraphStackInfo","StackEntry","",0x1c), - 0x801FB2D8:("schedStackEntry","StackEntry","",0x1c), - 0x801FB2F8:("audioStackEntry","StackEntry","",0x1c), - 0x801FB318:("padmgrStackEntry","StackEntry","",0x1c), - 0x801FB338:("audioContext","AudioMgr","",0x2e0), - 0x801FB620:("D_801FB620","PadMgr","",0x480), + 0x801FB2D8:("sSchedStackInfo","StackEntry","",0x1c), + 0x801FB2F8:("sAudioStackInfo","StackEntry","",0x1c), + 0x801FB318:("sPadMgrStackInfo","StackEntry","",0x1c), + 0x801FB338:("sAudioMgr","AudioMgr","",0x2e0), + 0x801FB620:("gPadMgr","PadMgr","",0x480), 0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1), 0x801FBAB0:("sRSPGFXStartTime","OSTime","",0x8), 0x801FBAB8:("sRSPAudioStartTime","OSTime","",0x8), @@ -4218,7 +4215,7 @@ 0x801FBE28:("D_801FBE28","UNK_TYPE1","",0x1), 0x801FBE2C:("D_801FBE2C","UNK_TYPE1","",0x1), 0x801FBE30:("D_801FBE30","UNK_TYPE4","",0x4), - 0x801FBE38:("sys_flashromStack","u8","[4096]",0x1000), + 0x801FBE38:("sSysFlashromStack","u8","[4096]",0x1000), 0x801FCE38:("sys_flashromStackEntry","StackEntry","",0x1c), 0x801FCE58:("sys_flashromOSThread","OSThread","",0x1b0), 0x801FD008:("D_801FD008","s80185D40","",0x2c), @@ -4334,9 +4331,9 @@ 0x801FFC80:("sCurSfxPlayerChannelIndex","UNK_TYPE1","",0x1), 0x801FFC84:("gSfxBankMuted","UNK_TYPE1","",0x1), 0x801FFC90:("sUnusedBankLerp","UNK_TYPE1","",0x1), - 0x801FFD00:("D_801FFD00","UNK_TYPE1","",0x1), - 0x801FFD34:("D_801FFD34","UNK_TYPE1","",0x1), - 0x801FFD40:("D_801FFD40","UNK_TYPE1","",0x1), + 0x801FFD00:("sSeqRequests","UNK_TYPE1","",0x1), + 0x801FFD34:("sNumSeqRequests","UNK_TYPE1","",0x1), + 0x801FFD40:("sAudioSeqCmds","UNK_TYPE1","",0x1), 0x80200000:("D_80200000","UNK_TYPE1","",0x1), 0x80200002:("D_80200002","UNK_TYPE1","",0x1), 0x80200004:("D_80200004","UNK_TYPE1","",0x1), @@ -4348,9 +4345,9 @@ 0x8020034A:("D_8020034A","UNK_TYPE1","",0x1), 0x80200B88:("D_80200B88","UNK_TYPE1","",0x1), 0x80200BBA:("D_80200BBA","UNK_TYPE1","",0x1), - 0x80200BCC:("D_80200BCC","UNK_TYPE1","",0x1), - 0x80200BCE:("D_80200BCE","UNK_TYPE1","",0x1), - 0x80200BD0:("D_80200BD0","UNK_TYPE1","",0x1), + 0x80200BCC:("sResetAudioHeapTimer","UNK_TYPE1","",0x1), + 0x80200BCE:("sResetAudioHeapFadeReverbVolume","UNK_TYPE1","",0x1), + 0x80200BD0:("sResetAudioHeapFadeReverbVolumeStep","UNK_TYPE1","",0x1), 0x80200C70:("gAudioCtx","AudioContext","",0x81F8), 0x80208E68:("gAudioCustomUpdateFunction","UNK_TYPE4","",0x4), 0x80208E6C:("gAudioCustomSeqFunction","UNK_TYPE4","",0x4), @@ -6431,15 +6428,15 @@ 0x808B11B0:("D_808B11B0","f32","",0x4), 0x808B11B4:("D_808B11B4","f32","",0x4), 0x808B11B8:("D_808B11B8","f32","",0x4), - 0x808B4D40:("En_Dekubaba_InitVars","UNK_TYPE1","",0x1), - 0x808B4D60:("D_808B4D60","UNK_TYPE1","",0x1), - 0x808B4E5C:("D_808B4E5C","UNK_TYPE1","",0x1), - 0x808B4E6C:("D_808B4E6C","UNK_TYPE1","",0x1), - 0x808B4E74:("D_808B4E74","UNK_TYPE1","",0x1), - 0x808B4E94:("D_808B4E94","UNK_TYPE1","",0x1), - 0x808B4E98:("D_808B4E98","UNK_TYPE1","",0x1), - 0x808B4E9C:("D_808B4E9C","UNK_TYPE1","",0x1), - 0x808B4EA0:("D_808B4EA0","UNK_PTR","",0x4), + 0x808B4D40:("En_Dekubaba_InitVars","ActorInit","",0x20), + 0x808B4D60:("sJntSphElementsInit","ColliderJntSphElementInit","[7]",0xFC), + 0x808B4E5C:("sJntSphInit","ColliderJntSphInit","",0x10), + 0x808B4E6C:("sColChkInfoInit","CollisionCheckInfoInit","",0x4), + 0x808B4E74:("sDamageTable","DamageTable","",0x20), + 0x808B4E94:("sInitChain","InitChainEntry","[1]",0x4), + 0x808B4E98:("sDustPrimColor","Color_RGBA8","",0x4), + 0x808B4E9C:("sDustEnvColor","Color_RGBA8","",0x4), + 0x808B4EA0:("sStemDLists","Gfx*","[3]",0xC), 0x808B4EB0:("D_808B4EB0","f32","",0x4), 0x808B4EB4:("D_808B4EB4","f32","",0x4), 0x808B4EB8:("D_808B4EB8","f32","",0x4), @@ -6651,8 +6648,8 @@ 0x808C3BC0:("D_808C3BC0","UNK_TYPE1","",0x1), 0x808C4CE0:("En_Wood02_InitVars","UNK_TYPE1","",0x1), 0x808C4D00:("D_808C4D00","UNK_TYPE1","",0x1), - 0x808C4D2C:("D_808C4D2C","UNK_TYPE1","",0x1), - 0x808C4D44:("D_808C4D44","UNK_TYPE1","",0x1), + 0x808C4D2C:("sWood02SpawnDistance","f32","",0x1), + 0x808C4D44:("sWood02SpawnAngle","UNK_TYPE1","",0x1), 0x808C4D4E:("D_808C4D4E","UNK_TYPE2","",0x2), 0x808C4D50:("D_808C4D50","UNK_TYPE1","",0x1), 0x808C4D54:("D_808C4D54","UNK_TYPE1","",0x1), @@ -6662,8 +6659,8 @@ 0x808C4E10:("D_808C4E10","f32","",0x4), 0x808C4E14:("D_808C4E14","f32","",0x4), 0x808C4E18:("D_808C4E18","UNK_TYPE1","",0x1), - 0x808C4F70:("D_808C4F70","f32","",0x4), - 0x808C4F74:("D_808C4F74","UNK_TYPE1","",0x1), + 0x808C4F70:("sWood02SpawnCos","f32","",0x4), + 0x808C4F74:("sWood02SpawnSin","UNK_TYPE1","",0x4), 0x808C98C0:("En_Death_InitVars","UNK_TYPE1","",0x1), 0x808C98E0:("D_808C98E0","UNK_TYPE1","",0x1), 0x808C990C:("D_808C990C","UNK_TYPE1","",0x1), @@ -7197,8 +7194,8 @@ 0x808F2DF8:("D_808F2DF8","UNK_TYPE1","",0x1), 0x808F2E00:("D_808F2E00","UNK_TYPE1","",0x1), 0x808F2E20:("D_808F2E20","UNK_TYPE1","",0x1), - 0x808F2E28:("D_808F2E28","UNK_TYPE1","",0x1), - 0x808F2E2C:("D_808F2E2C","UNK_PTR","",0x4), + 0x808F2E28:("sFogColor","Color_RGBA8","",0x4), + 0x808F2E2C:("sStemDLists","Gfx*","[3]",0xC), 0x808F2E40:("D_808F2E40","f32","",0x4), 0x808F2E44:("D_808F2E44","f32","",0x4), 0x808F2E48:("D_808F2E48","f32","",0x4), @@ -7911,7 +7908,7 @@ 0x80920290:("jtbl_80920290","UNK_PTR","",0x4), 0x80920DF0:("gFireArrowTex","u8","[2048]",0x800), 0x809215F0:("gFireArrowMaskTex","u8","[2048]",0x800), - 0x80921DF0:("gFireArrowVtx","F3DVertex","[43]",0x2b0), + 0x80921DF0:("gFireArrowVtx","Vtx","[43]",0x2b0), 0x809220A0:("gIceArrowMaterialDL","Gfx","[22]",0xb0), 0x80922150:("gIceArrowModelDL","Gfx","[24]",0xc0), 0x80922210:("Arrow_Fire_InitVars","ActorInit","",0x20), @@ -9189,9 +9186,9 @@ 0x8098C498:("D_8098C498","f32","",0x4), 0x8098C49C:("jtbl_8098C49C","UNK_PTR","",0x4), 0x8098CD60:("En_Si_InitVars","UNK_TYPE1","",0x1), - 0x8098CD80:("D_8098CD80","UNK_TYPE1","",0x1), - 0x8098CDAC:("D_8098CDAC","UNK_PTR","",0x4), - 0x8098CDB8:("D_8098CDB8","UNK_TYPE1","",0x1), + 0x8098CD80:("sSphereInit","UNK_TYPE1","",0x1), + 0x8098CDAC:("sColChkInfoInit","UNK_PTR","",0x4), + 0x8098CDB8:("sDamageTable","UNK_TYPE1","",0x1), 0x8098E420:("Obj_Comb_InitVars","UNK_TYPE1","",0x1), 0x8098E440:("D_8098E440","UNK_TYPE1","",0x1), 0x8098E464:("D_8098E464","UNK_TYPE1","",0x1), @@ -9514,7 +9511,7 @@ 0x809A6150:("Obj_Boyo_InitVars","UNK_TYPE1","",0x1), 0x809A6170:("D_809A6170","UNK_TYPE1","",0x1), 0x809A619C:("D_809A619C","UNK_TYPE1","",0x1), - 0x809A61B0:("sBumperCollideInfo","UNK_TYPE1","",0x1), + 0x809A61B0:("D_809A61B0","UNK_TYPE1","",0x1), 0x809A61B4:("D_809A61B4","UNK_TYPE2","",0x2), 0x809A61D0:("D_809A61D0","f32","",0x4), 0x809A61D4:("D_809A61D4","f32","",0x4), @@ -10949,13 +10946,13 @@ 0x80A20EA0:("D_80A20EA0","UNK_TYPE1","",0x1), 0x80A20EAC:("D_80A20EAC","UNK_PTR","",0x4), 0x80A20EB0:("D_80A20EB0","UNK_TYPE1","",0x1), - 0x80A20EDC:("D_80A20EDC","UNK_TYPE1","",0x1), - 0x80A20EE8:("D_80A20EE8","UNK_TYPE1","",0x1), + 0x80A20EDC:("sVelocity","UNK_TYPE1","",0x1), + 0x80A20EE8:("sAccel","UNK_TYPE1","",0x1), 0x80A20EF4:("En_Syateki_Wf_InitVars","UNK_TYPE1","",0x1), 0x80A20F14:("D_80A20F14","UNK_PTR","",0x4), 0x80A20FBC:("D_80A20FBC","UNK_TYPE1","",0x1), - 0x80A20FC4:("D_80A20FC4","UNK_TYPE4","",0x4), - 0x80A20FD0:("D_80A20FD0","UNK_TYPE1","",0x1), + 0x80A20FC4:("sFireVelocityAndAccel","UNK_TYPE4","",0x4), + 0x80A20FD0:("sTailColliderOffset","UNK_TYPE1","",0x1), 0x80A20FDC:("D_80A20FDC","UNK_TYPE1","",0x1), 0x80A20FF0:("D_80A20FF0","f32","",0x4), 0x80A229F0:("Obj_Skateblock_InitVars","UNK_TYPE1","",0x1), @@ -12919,8 +12916,8 @@ 0x80AC4F60:("D_80AC4F60","f32","",0x4), 0x80AC4F64:("D_80AC4F64","f32","",0x4), 0x80AC5060:("D_80AC5060","UNK_TYPE1","",0x1), - 0x80AC5630:("sTriforceWipeDL","UNK_TYPE1","",0x1), - 0x80AC5660:("sTriforceWipeVtx","UNK_TYPE1","",0x1), + 0x80AC5630:("sTransTriforceDL","UNK_TYPE1","",0x1), + 0x80AC5660:("sTransTriforceVtx","UNK_TYPE1","",0x1), 0x80AC5700:("TransitionTriforce_InitVars","UNK_PTR","",0x4), 0x80AC5730:("D_80AC5730","f32","",0x4), 0x80AC5734:("D_80AC5734","f32","",0x4), @@ -13255,10 +13252,10 @@ 0x80AE7270:("D_80AE7270","UNK_TYPE1","",0x1), 0x80AE7280:("jtbl_80AE7280","UNK_PTR","",0x4), 0x80AE8890:("En_Stop_heishi_InitVars","UNK_TYPE1","",0x1), - 0x80AE88B0:("D_80AE88B0","UNK_TYPE1","",0x1), + 0x80AE88B0:("sCylinderInit","UNK_TYPE1","",0x1), 0x80AE88DC:("D_80AE88DC","UNK_TYPE1","",0x1), 0x80AE897C:("D_80AE897C","UNK_TYPE1","",0x1), - 0x80AE8A1C:("D_80AE8A1C","UNK_TYPE1","",0x1), + 0x80AE8A1C:("sAnimations","UNK_TYPE1","",0x1), 0x80AE8A24:("D_80AE8A24","UNK_TYPE1","",0x1), 0x80AE8A2C:("D_80AE8A2C","UNK_TYPE1","",0x1), 0x80AE8A30:("D_80AE8A30","UNK_TYPE1","",0x1), @@ -14326,11 +14323,11 @@ 0x80B4E934:("D_80B4E934","UNK_TYPE4","",0x4), 0x80B4E938:("D_80B4E938","f32","",0x4), 0x80B4E940:("D_80B4E940","UNK_TYPE4","",0x4), - 0x80B4E944:("sRomaniEyeTextures","UNK_TYPE4","",0x4), - 0x80B4E958:("sRomaniMouthTextures","UNK_TYPE4","",0x4), + 0x80B4E944:("D_80B4E944","UNK_TYPE4","",0x4), + 0x80B4E958:("D_80B4E958","UNK_TYPE4","",0x4), 0x80B4E968:("D_80B4E968","UNK_TYPE1","",0x1), - 0x80B4E96C:("sCremiaEyeTextures","UNK_TYPE4","",0x4), - 0x80B4E984:("sCremiaMouthTextures","UNK_TYPE4","",0x4), + 0x80B4E96C:("D_80B4E96C","UNK_TYPE4","",0x4), + 0x80B4E984:("D_80B4E984","UNK_TYPE4","",0x4), 0x80B4E994:("D_80B4E994","UNK_TYPE1","",0x1), 0x80B4E998:("D_80B4E998","UNK_TYPE1","",0x1), 0x80B4E99C:("D_80B4E99C","UNK_TYPE1","",0x1), @@ -14416,6 +14413,21 @@ 0x80B4EE0C:("D_80B4EE0C","UNK_TYPE1","",0x1), 0x80B4EE24:("D_80B4EE24","UNK_TYPE1","",0x1), 0x80B4EE30:("D_80B4EE30","UNK_TYPE1","",0x1), + 0x80B4EE40:("D_80B4EE40","f32","",0x4), + 0x80B4EE44:("D_80B4EE44","f32","",0x4), + 0x80B4EE48:("D_80B4EE48","f32","",0x4), + 0x80B4EE4C:("D_80B4EE4C","f32","",0x4), + 0x80B4EE50:("D_80B4EE50","f32","",0x4), + 0x80B4EE54:("D_80B4EE54","f32","",0x4), + 0x80B4EE58:("D_80B4EE58","f32","",0x4), + 0x80B4EE5C:("D_80B4EE5C","f32","",0x4), + 0x80B4EE60:("D_80B4EE60","f32","",0x4), + 0x80B4EE64:("D_80B4EE64","f32","",0x4), + 0x80B4EE68:("D_80B4EE68","f32","",0x4), + 0x80B4EE6C:("D_80B4EE6C","f32","",0x4), + 0x80B4EE70:("D_80B4EE70","f32","",0x4), + 0x80B4EE74:("D_80B4EE74","f32","",0x4), + 0x80B4EE78:("D_80B4EE78","f32","",0x4), 0x80B4EE7C:("D_80B4EE7C","f32","",0x4), 0x80B4EE80:("D_80B4EE80","f32","",0x4), 0x80B4EE84:("D_80B4EE84","f32","",0x4), @@ -14556,8 +14568,8 @@ 0x80B503F0:("D_80B503F0","UNK_TYPE4","",0x4), 0x80B503F4:("D_80B503F4","UNK_TYPE4","",0x4), 0x80B503F8:("D_80B503F8","UNK_TYPE4","",0x4), - 0x80B503FC:("sAlienEyeBeamTexAnim","UNK_TYPE4","",0x4), - 0x80B50400:("sAlienEmptyTexAnim","UNK_TYPE4","",0x4), + 0x80B503FC:("D_80B503FC","UNK_TYPE4","",0x4), + 0x80B50400:("D_80B50400","UNK_TYPE4","",0x4), 0x80B50404:("D_80B50404","UNK_TYPE2","",0x2), 0x80B50406:("D_80B50406","UNK_TYPE2","",0x2), 0x80B5040A:("D_80B5040A","UNK_TYPE1","",0x1), @@ -15177,13 +15189,13 @@ 0x80B8ADB0:("D_80B8ADB0","f32","",0x4), 0x80B8ADB4:("D_80B8ADB4","f32","",0x4), 0x80B8CE20:("En_Ge2_InitVars","UNK_TYPE1","",0x1), - 0x80B8CE40:("D_80B8CE40","UNK_TYPE1","",0x1), - 0x80B8CE6C:("D_80B8CE6C","UNK_TYPE1","",0x1), - 0x80B8CE78:("D_80B8CE78","UNK_TYPE1","",0x1), - 0x80B8CE84:("D_80B8CE84","UNK_TYPE1","",0x1), - 0x80B8CE88:("D_80B8CE88","UNK_TYPE1","",0x1), - 0x80B8CE8C:("D_80B8CE8C","UNK_TYPE1","",0x1), - 0x80B8CE98:("D_80B8CE98","UNK_TYPE1","",0x1), + 0x80B8CE40:("sCylinderInit","ColliderCylinderInit","",0x2C), + 0x80B8CE6C:("effectVelocity","Vec3f","",0xC), + 0x80B8CE78:("effectAccel","Vec3f","",0xC), + 0x80B8CE84:("effectPrimColor","Color_RGBA8","",0x4), + 0x80B8CE88:("effectEnvColor","Color_RGBA8","",0x4), + 0x80B8CE8C:("sFocusOffset","Vec3f","",0x1), + 0x80B8CE98:("sEyeTextures","TexturePtr","[3]",0xC), 0x80B8CEB0:("jtbl_80B8CEB0","UNK_PTR","",0x4), 0x80B8E150:("En_Ma_Yts_InitVars","UNK_TYPE1","",0x1), 0x80B8E170:("D_80B8E170","ColliderCylinderInit","",0x2C), diff --git a/tools/fado/.gitrepo b/tools/fado/.gitrepo index cedec4930..042b904f1 100644 --- a/tools/fado/.gitrepo +++ b/tools/fado/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:EllipticEllipsis/fado.git branch = master - commit = f7efb10a9a65f27e9ccad7ce270234f20d386ac9 - parent = 90cfafec47fe4b73ad9009e9501e147e86025aa6 + commit = 8d896ee97d565508755584803c409fc33bb0c953 + parent = b51c9f4d22d6e7db63700c163418654431a2a61a method = merge cmdver = 0.4.3 diff --git a/tools/fado/lib/vc_vector/vc_vector.c b/tools/fado/lib/vc_vector/vc_vector.c index 3f677c242..426f1b0cb 100644 --- a/tools/fado/lib/vc_vector/vc_vector.c +++ b/tools/fado/lib/vc_vector/vc_vector.c @@ -112,15 +112,15 @@ bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2) { return memcmp(vector1->data, vector2->data, size_vector1) == 0; } -float vc_vector_get_growth_factor() { +float vc_vector_get_growth_factor(void) { return GROWTH_FACTOR; } -size_t vc_vector_get_default_count_of_elements() { +size_t vc_vector_get_default_count_of_elements(void) { return DEFAULT_COUNT_OF_ELEMENTS; } -size_t vc_vector_struct_size() { +size_t vc_vector_struct_size(void) { return sizeof(vc_vector); } diff --git a/tools/fado/lib/vc_vector/vc_vector.h b/tools/fado/lib/vc_vector/vc_vector.h index 2b1422c1a..e57f83254 100644 --- a/tools/fado/lib/vc_vector/vc_vector.h +++ b/tools/fado/lib/vc_vector/vc_vector.h @@ -24,13 +24,13 @@ void vc_vector_release(vc_vector* vector); bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2); // Returns constant value of the vector growth factor. -float vc_vector_get_growth_factor(); +float vc_vector_get_growth_factor(void); // Returns constant value of the vector default count of elements. -size_t vc_vector_get_default_count_of_elements(); +size_t vc_vector_get_default_count_of_elements(void); // Returns constant value of the vector struct size. -size_t vc_vector_struct_size(); +size_t vc_vector_struct_size(void); // ---------------------------------------------------------------------------- // Element access diff --git a/tools/fado/src/main.c b/tools/fado/src/main.c index c6af79025..e6b7926d6 100644 --- a/tools/fado/src/main.c +++ b/tools/fado/src/main.c @@ -15,7 +15,7 @@ #include "version.inc" -void PrintVersion() { +void PrintVersion(void) { printf("Fado (Fairy-Assisted relocations for Decompiled Overlays), version %s\n", versionNumber); printf("Copyright (C) 2021 Elliptic Ellipsis\n"); printf("%s\n", credits); @@ -88,7 +88,7 @@ static size_t posArgCount = ARRAY_COUNT(posArgInfo); static size_t optCount = ARRAY_COUNT(optInfo); static struct option longOptions[ARRAY_COUNT(optInfo)]; -void ConstructLongOpts() { +void ConstructLongOpts(void) { size_t i; for (i = 0; i < optCount; i++) { diff --git a/tools/graphovl/.gitrepo b/tools/graphovl/.gitrepo index 064b8ee58..ca544b885 100644 --- a/tools/graphovl/.gitrepo +++ b/tools/graphovl/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/AngheloAlf/graphovl.git branch = master - commit = f5fe93d75bb75ea4bea65f62c43f41f6a1e70679 - parent = 6c5a50ef95f351acc7c4c0455a347a94443adbe1 + commit = dab4addae0c5db6274ab5daf7780c62c346120a1 + parent = 5da1ae553569ddb0016d302cfac8c45d9cb22e73 method = merge cmdver = 0.4.3 diff --git a/tools/graphovl/graphovl.py b/tools/graphovl/graphovl.py index 28f0a361c..7cb7af2c5 100755 --- a/tools/graphovl/graphovl.py +++ b/tools/graphovl/graphovl.py @@ -18,7 +18,7 @@ except ModuleNotFoundError: script_dir = os.path.dirname(os.path.realpath(__file__)) config = ConfigParser() -func_names = None +func_names = list() func_definitions = list() line_numbers_of_functions = list() @@ -72,6 +72,19 @@ def capture_setupaction_call_arg(content): transitionList.append(func) return transitionList +setaction_regexpr = re.compile(r"_SetAction+\([^\)]*\)(\.[^\)]*\))?;") + +def capture_setaction_calls(content): + return [x.group() for x in re.finditer(setaction_regexpr, content)] + +def capture_setaction_call_arg(content): + transitionList = [] + for x in re.finditer(setaction_regexpr, content): + func = x.group().split(",")[2].strip().split(");")[0].strip() + if func not in transitionList: + transitionList.append(func) + return transitionList + # Search for the function definition by supplied function name def definition_by_name(content, name): for definition in capture_definitions(content): @@ -206,7 +219,11 @@ def addFunctionTransitionToGraph(dot, index: int, func_name: str, action_transit fontColor = config.get("colors", "fontcolor") bubbleColor = config.get("colors", "bubbleColor") indexStr = str(index) - funcIndex = str(index_of_func(action_transition)) + try: + funcIndex = str(index_of_func(action_transition)) + except ValueError: + print(f"Warning: function '{action_transition}' called by '{func_name}' was not found. Skiping...", file=sys.stderr) + return dot.node(indexStr, func_name, fontcolor=fontColor, color=bubbleColor) dot.node(funcIndex, action_transition, fontcolor=fontColor, color=bubbleColor) @@ -230,7 +247,7 @@ def addCallNamesToGraph(dot, func_names: list, index: int, code_body: str, remov if call in removeList: continue - if setupAction and "_SetupAction" in call: + if setupAction and ("_SetupAction" in call or "_SetAction" in call): continue seen.add(call) @@ -342,10 +359,11 @@ def main(): actionIdentifier = "this->actionFunc" setupAction = func_prefix + "_SetupAction" in func_names + setAction = func_prefix + "_SetAction" in func_names arrayActorFunc = match_obj is not None rawActorFunc = actionIdentifier in contents - if not setupAction and not arrayActorFunc and not rawActorFunc: + if not setupAction and not setAction and not arrayActorFunc and not rawActorFunc: print("No actor action-based structure found") os._exit(1) @@ -383,6 +401,8 @@ def main(): Create all edges for SetupAction-based actors """ transitionList = capture_setupaction_call_arg(code_body) + elif setAction: + transitionList = capture_setaction_call_arg(code_body) elif arrayActorFunc: """ Create all edges for ActorFunc array-based actors diff --git a/tools/ido_recomp/linux/5.3/as0 b/tools/ido_recomp/linux/5.3/as0 index 15c169107..cdac712e5 100755 Binary files a/tools/ido_recomp/linux/5.3/as0 and b/tools/ido_recomp/linux/5.3/as0 differ diff --git a/tools/ido_recomp/linux/5.3/as1 b/tools/ido_recomp/linux/5.3/as1 index 1a24f18b2..f89911f80 100755 Binary files a/tools/ido_recomp/linux/5.3/as1 and b/tools/ido_recomp/linux/5.3/as1 differ diff --git a/tools/ido_recomp/linux/5.3/cc b/tools/ido_recomp/linux/5.3/cc index 65f0d1b2d..be5bed557 100755 Binary files a/tools/ido_recomp/linux/5.3/cc and b/tools/ido_recomp/linux/5.3/cc differ diff --git a/tools/ido_recomp/linux/5.3/cfe b/tools/ido_recomp/linux/5.3/cfe index cbb4f9d44..c257f65a6 100755 Binary files a/tools/ido_recomp/linux/5.3/cfe and b/tools/ido_recomp/linux/5.3/cfe differ diff --git a/tools/ido_recomp/linux/5.3/ugen b/tools/ido_recomp/linux/5.3/ugen index 119d2817b..d356300bf 100755 Binary files a/tools/ido_recomp/linux/5.3/ugen and b/tools/ido_recomp/linux/5.3/ugen differ diff --git a/tools/ido_recomp/linux/5.3/ujoin b/tools/ido_recomp/linux/5.3/ujoin index 4091986a8..5a3162799 100755 Binary files a/tools/ido_recomp/linux/5.3/ujoin and b/tools/ido_recomp/linux/5.3/ujoin differ diff --git a/tools/ido_recomp/linux/5.3/uld b/tools/ido_recomp/linux/5.3/uld index 653ff37df..a65a2239b 100755 Binary files a/tools/ido_recomp/linux/5.3/uld and b/tools/ido_recomp/linux/5.3/uld differ diff --git a/tools/ido_recomp/linux/5.3/umerge b/tools/ido_recomp/linux/5.3/umerge index 4b00ffa36..36fa5ac6e 100755 Binary files a/tools/ido_recomp/linux/5.3/umerge and b/tools/ido_recomp/linux/5.3/umerge differ diff --git a/tools/ido_recomp/linux/5.3/uopt b/tools/ido_recomp/linux/5.3/uopt index d5ba32fbd..f44642087 100755 Binary files a/tools/ido_recomp/linux/5.3/uopt and b/tools/ido_recomp/linux/5.3/uopt differ diff --git a/tools/ido_recomp/linux/5.3/usplit b/tools/ido_recomp/linux/5.3/usplit index 17d9d3d5d..5aa4151ed 100755 Binary files a/tools/ido_recomp/linux/5.3/usplit and b/tools/ido_recomp/linux/5.3/usplit differ diff --git a/tools/ido_recomp/linux/7.1/as0 b/tools/ido_recomp/linux/7.1/as0 index e9ef71c63..1a69a14a5 100755 Binary files a/tools/ido_recomp/linux/7.1/as0 and b/tools/ido_recomp/linux/7.1/as0 differ diff --git a/tools/ido_recomp/linux/7.1/as1 b/tools/ido_recomp/linux/7.1/as1 index 475079063..047cfdd7f 100755 Binary files a/tools/ido_recomp/linux/7.1/as1 and b/tools/ido_recomp/linux/7.1/as1 differ diff --git a/tools/ido_recomp/linux/7.1/cc b/tools/ido_recomp/linux/7.1/cc index 6c68698f3..61c43ede1 100755 Binary files a/tools/ido_recomp/linux/7.1/cc and b/tools/ido_recomp/linux/7.1/cc differ diff --git a/tools/ido_recomp/linux/7.1/cfe b/tools/ido_recomp/linux/7.1/cfe index 2b52669de..75235c112 100755 Binary files a/tools/ido_recomp/linux/7.1/cfe and b/tools/ido_recomp/linux/7.1/cfe differ diff --git a/tools/ido_recomp/linux/7.1/ugen b/tools/ido_recomp/linux/7.1/ugen index 340a282c9..32d8d0be6 100755 Binary files a/tools/ido_recomp/linux/7.1/ugen and b/tools/ido_recomp/linux/7.1/ugen differ diff --git a/tools/ido_recomp/linux/7.1/ujoin b/tools/ido_recomp/linux/7.1/ujoin index 3752698d8..49b35ba6a 100755 Binary files a/tools/ido_recomp/linux/7.1/ujoin and b/tools/ido_recomp/linux/7.1/ujoin differ diff --git a/tools/ido_recomp/linux/7.1/uld b/tools/ido_recomp/linux/7.1/uld index 2b76d0c18..756d30cd4 100755 Binary files a/tools/ido_recomp/linux/7.1/uld and b/tools/ido_recomp/linux/7.1/uld differ diff --git a/tools/ido_recomp/linux/7.1/umerge b/tools/ido_recomp/linux/7.1/umerge index 03d68a8f2..569e56e76 100755 Binary files a/tools/ido_recomp/linux/7.1/umerge and b/tools/ido_recomp/linux/7.1/umerge differ diff --git a/tools/ido_recomp/linux/7.1/uopt b/tools/ido_recomp/linux/7.1/uopt index feef7f749..349d1d6ff 100755 Binary files a/tools/ido_recomp/linux/7.1/uopt and b/tools/ido_recomp/linux/7.1/uopt differ diff --git a/tools/ido_recomp/linux/7.1/usplit b/tools/ido_recomp/linux/7.1/usplit index 090200ab5..563c5f8a2 100755 Binary files a/tools/ido_recomp/linux/7.1/usplit and b/tools/ido_recomp/linux/7.1/usplit differ diff --git a/tools/ido_recomp/macos/5.3/as0 b/tools/ido_recomp/macos/5.3/as0 index 46e69e09b..1d2b7a725 100755 Binary files a/tools/ido_recomp/macos/5.3/as0 and b/tools/ido_recomp/macos/5.3/as0 differ diff --git a/tools/ido_recomp/macos/5.3/as1 b/tools/ido_recomp/macos/5.3/as1 index f723cc5c1..44fada1c5 100755 Binary files a/tools/ido_recomp/macos/5.3/as1 and b/tools/ido_recomp/macos/5.3/as1 differ diff --git a/tools/ido_recomp/macos/5.3/cc b/tools/ido_recomp/macos/5.3/cc index d583c6b5b..9e3c8f8c9 100755 Binary files a/tools/ido_recomp/macos/5.3/cc and b/tools/ido_recomp/macos/5.3/cc differ diff --git a/tools/ido_recomp/macos/5.3/cfe b/tools/ido_recomp/macos/5.3/cfe index 92f76465a..86d98c79d 100755 Binary files a/tools/ido_recomp/macos/5.3/cfe and b/tools/ido_recomp/macos/5.3/cfe differ diff --git a/tools/ido_recomp/macos/5.3/ugen b/tools/ido_recomp/macos/5.3/ugen index 7be477312..add44a34d 100755 Binary files a/tools/ido_recomp/macos/5.3/ugen and b/tools/ido_recomp/macos/5.3/ugen differ diff --git a/tools/ido_recomp/macos/5.3/ujoin b/tools/ido_recomp/macos/5.3/ujoin index e69611f41..5e7ed4789 100755 Binary files a/tools/ido_recomp/macos/5.3/ujoin and b/tools/ido_recomp/macos/5.3/ujoin differ diff --git a/tools/ido_recomp/macos/5.3/uld b/tools/ido_recomp/macos/5.3/uld index 2bcce1cd6..64fc3899c 100755 Binary files a/tools/ido_recomp/macos/5.3/uld and b/tools/ido_recomp/macos/5.3/uld differ diff --git a/tools/ido_recomp/macos/5.3/umerge b/tools/ido_recomp/macos/5.3/umerge index 7fdf06e8d..c66ef9f2f 100755 Binary files a/tools/ido_recomp/macos/5.3/umerge and b/tools/ido_recomp/macos/5.3/umerge differ diff --git a/tools/ido_recomp/macos/5.3/uopt b/tools/ido_recomp/macos/5.3/uopt index e9b8cbe62..0872f9c17 100755 Binary files a/tools/ido_recomp/macos/5.3/uopt and b/tools/ido_recomp/macos/5.3/uopt differ diff --git a/tools/ido_recomp/macos/5.3/usplit b/tools/ido_recomp/macos/5.3/usplit index cb28e320c..2a7c35188 100755 Binary files a/tools/ido_recomp/macos/5.3/usplit and b/tools/ido_recomp/macos/5.3/usplit differ diff --git a/tools/ido_recomp/macos/7.1/as0 b/tools/ido_recomp/macos/7.1/as0 index cdb4f9121..9a2fd2f0a 100755 Binary files a/tools/ido_recomp/macos/7.1/as0 and b/tools/ido_recomp/macos/7.1/as0 differ diff --git a/tools/ido_recomp/macos/7.1/as1 b/tools/ido_recomp/macos/7.1/as1 index 93370b495..e91f7d1a2 100755 Binary files a/tools/ido_recomp/macos/7.1/as1 and b/tools/ido_recomp/macos/7.1/as1 differ diff --git a/tools/ido_recomp/macos/7.1/cc b/tools/ido_recomp/macos/7.1/cc index 96d45690b..b487956f2 100755 Binary files a/tools/ido_recomp/macos/7.1/cc and b/tools/ido_recomp/macos/7.1/cc differ diff --git a/tools/ido_recomp/macos/7.1/cfe b/tools/ido_recomp/macos/7.1/cfe index a9f0b56fc..f86fc3743 100755 Binary files a/tools/ido_recomp/macos/7.1/cfe and b/tools/ido_recomp/macos/7.1/cfe differ diff --git a/tools/ido_recomp/macos/7.1/ugen b/tools/ido_recomp/macos/7.1/ugen index 801337b48..1e9839b4e 100755 Binary files a/tools/ido_recomp/macos/7.1/ugen and b/tools/ido_recomp/macos/7.1/ugen differ diff --git a/tools/ido_recomp/macos/7.1/ujoin b/tools/ido_recomp/macos/7.1/ujoin index 620e624f0..d2512e934 100755 Binary files a/tools/ido_recomp/macos/7.1/ujoin and b/tools/ido_recomp/macos/7.1/ujoin differ diff --git a/tools/ido_recomp/macos/7.1/uld b/tools/ido_recomp/macos/7.1/uld index a7826480f..a746a8236 100755 Binary files a/tools/ido_recomp/macos/7.1/uld and b/tools/ido_recomp/macos/7.1/uld differ diff --git a/tools/ido_recomp/macos/7.1/umerge b/tools/ido_recomp/macos/7.1/umerge index 0f1978051..a561c0801 100755 Binary files a/tools/ido_recomp/macos/7.1/umerge and b/tools/ido_recomp/macos/7.1/umerge differ diff --git a/tools/ido_recomp/macos/7.1/uopt b/tools/ido_recomp/macos/7.1/uopt index 528151499..30817f201 100755 Binary files a/tools/ido_recomp/macos/7.1/uopt and b/tools/ido_recomp/macos/7.1/uopt differ diff --git a/tools/ido_recomp/macos/7.1/usplit b/tools/ido_recomp/macos/7.1/usplit index cc539bdb1..247279453 100755 Binary files a/tools/ido_recomp/macos/7.1/usplit and b/tools/ido_recomp/macos/7.1/usplit differ diff --git a/tools/ido_recomp/windows/5.3/as0.exe b/tools/ido_recomp/windows/5.3/as0.exe index 10c16ca69..0c4926085 100755 Binary files a/tools/ido_recomp/windows/5.3/as0.exe and b/tools/ido_recomp/windows/5.3/as0.exe differ diff --git a/tools/ido_recomp/windows/5.3/as1.exe b/tools/ido_recomp/windows/5.3/as1.exe index 0ddac02bb..2d79cc536 100755 Binary files a/tools/ido_recomp/windows/5.3/as1.exe and b/tools/ido_recomp/windows/5.3/as1.exe differ diff --git a/tools/ido_recomp/windows/5.3/cc.exe b/tools/ido_recomp/windows/5.3/cc.exe index fdbaea21d..7c08eac81 100755 Binary files a/tools/ido_recomp/windows/5.3/cc.exe and b/tools/ido_recomp/windows/5.3/cc.exe differ diff --git a/tools/ido_recomp/windows/5.3/cfe.exe b/tools/ido_recomp/windows/5.3/cfe.exe index abe1063c6..2f5de5f18 100755 Binary files a/tools/ido_recomp/windows/5.3/cfe.exe and b/tools/ido_recomp/windows/5.3/cfe.exe differ diff --git a/tools/ido_recomp/windows/5.3/ugen.exe b/tools/ido_recomp/windows/5.3/ugen.exe index be08a43c9..0f919c234 100755 Binary files a/tools/ido_recomp/windows/5.3/ugen.exe and b/tools/ido_recomp/windows/5.3/ugen.exe differ diff --git a/tools/ido_recomp/windows/5.3/ujoin.exe b/tools/ido_recomp/windows/5.3/ujoin.exe index b01b5c335..f1397ee0c 100755 Binary files a/tools/ido_recomp/windows/5.3/ujoin.exe and b/tools/ido_recomp/windows/5.3/ujoin.exe differ diff --git a/tools/ido_recomp/windows/5.3/uld.exe b/tools/ido_recomp/windows/5.3/uld.exe index 34cad1400..d415d9ba0 100755 Binary files a/tools/ido_recomp/windows/5.3/uld.exe and b/tools/ido_recomp/windows/5.3/uld.exe differ diff --git a/tools/ido_recomp/windows/5.3/umerge.exe b/tools/ido_recomp/windows/5.3/umerge.exe index 3ce31e0cb..23bf7b251 100755 Binary files a/tools/ido_recomp/windows/5.3/umerge.exe and b/tools/ido_recomp/windows/5.3/umerge.exe differ diff --git a/tools/ido_recomp/windows/5.3/uopt.exe b/tools/ido_recomp/windows/5.3/uopt.exe index c1fb98c0d..248beabc7 100755 Binary files a/tools/ido_recomp/windows/5.3/uopt.exe and b/tools/ido_recomp/windows/5.3/uopt.exe differ diff --git a/tools/ido_recomp/windows/5.3/usplit.exe b/tools/ido_recomp/windows/5.3/usplit.exe index d179f1e13..6ac2a6382 100755 Binary files a/tools/ido_recomp/windows/5.3/usplit.exe and b/tools/ido_recomp/windows/5.3/usplit.exe differ diff --git a/tools/ido_recomp/windows/7.1/as0.exe b/tools/ido_recomp/windows/7.1/as0.exe index 1a375d73e..346827a49 100755 Binary files a/tools/ido_recomp/windows/7.1/as0.exe and b/tools/ido_recomp/windows/7.1/as0.exe differ diff --git a/tools/ido_recomp/windows/7.1/as1.exe b/tools/ido_recomp/windows/7.1/as1.exe index 4778d2db6..7076875b9 100755 Binary files a/tools/ido_recomp/windows/7.1/as1.exe and b/tools/ido_recomp/windows/7.1/as1.exe differ diff --git a/tools/ido_recomp/windows/7.1/cc.exe b/tools/ido_recomp/windows/7.1/cc.exe index 887b7cc49..53bf83433 100755 Binary files a/tools/ido_recomp/windows/7.1/cc.exe and b/tools/ido_recomp/windows/7.1/cc.exe differ diff --git a/tools/ido_recomp/windows/7.1/cfe.exe b/tools/ido_recomp/windows/7.1/cfe.exe index 6f5fd9e8d..0286c3fa5 100755 Binary files a/tools/ido_recomp/windows/7.1/cfe.exe and b/tools/ido_recomp/windows/7.1/cfe.exe differ diff --git a/tools/ido_recomp/windows/7.1/ugen.exe b/tools/ido_recomp/windows/7.1/ugen.exe index fcc03538c..30577e396 100755 Binary files a/tools/ido_recomp/windows/7.1/ugen.exe and b/tools/ido_recomp/windows/7.1/ugen.exe differ diff --git a/tools/ido_recomp/windows/7.1/ujoin.exe b/tools/ido_recomp/windows/7.1/ujoin.exe index 9fb3a3f4f..18fc825bc 100755 Binary files a/tools/ido_recomp/windows/7.1/ujoin.exe and b/tools/ido_recomp/windows/7.1/ujoin.exe differ diff --git a/tools/ido_recomp/windows/7.1/uld.exe b/tools/ido_recomp/windows/7.1/uld.exe index 4a0cc8fe2..a0bb88593 100755 Binary files a/tools/ido_recomp/windows/7.1/uld.exe and b/tools/ido_recomp/windows/7.1/uld.exe differ diff --git a/tools/ido_recomp/windows/7.1/umerge.exe b/tools/ido_recomp/windows/7.1/umerge.exe index 7cc0b1be6..3e6698ada 100755 Binary files a/tools/ido_recomp/windows/7.1/umerge.exe and b/tools/ido_recomp/windows/7.1/umerge.exe differ diff --git a/tools/ido_recomp/windows/7.1/uopt.exe b/tools/ido_recomp/windows/7.1/uopt.exe index 4fbd1ab57..ae714d528 100755 Binary files a/tools/ido_recomp/windows/7.1/uopt.exe and b/tools/ido_recomp/windows/7.1/uopt.exe differ diff --git a/tools/ido_recomp/windows/7.1/usplit.exe b/tools/ido_recomp/windows/7.1/usplit.exe index 5c0da6fe6..f61837d0f 100755 Binary files a/tools/ido_recomp/windows/7.1/usplit.exe and b/tools/ido_recomp/windows/7.1/usplit.exe differ diff --git a/tools/namefixer.py b/tools/namefixer.py index 9de1fc43b..853322f5c 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -117,6 +117,23 @@ wordReplace = { "Actor_MarkForDeath": "Actor_Kill", "func_800B84D0": "Actor_ProcessTalkRequest", "func_8017D668": "Math3D_PointDistToLine2D", + + "THGA_GetSize": "THGA_GetRemaining", + "THGA_AllocStartArray8": "THGA_AllocDisplayList", + "THGA_AllocStart8": "THGA_AllocGfx", + "THGA_AllocStart8Wrapper": "THGA_AllocGfx2", + "THGA_AllocEnd": "THGA_AllocTail", + "THGA_AllocEndArray64": "THGA_AllocMtxArray", + "THGA_AllocEnd64": "THGA_AllocMtx", + "THGA_AllocEndArray16": "THGA_AllocVtxArray", + "THGA_AllocEnd16": "THGA_AllocVtx", + "THA_AllocStart": "THA_AllocHead", + "THA_AllocStart1": "THA_AllocHeadByte", + "THA_AllocEnd": "THA_AllocTail", + "THA_AllocEndAlign16": "THA_AllocTailAlign16", + "THA_AllocEndAlign": "THA_AllocTailAlign", + "THA_GetSize": "THA_GetRemaining", + "func_800BDFC0": "Gfx_DrawDListOpa", "func_800BE03C": "Gfx_DrawDListXlu", "func_800B6FC8": "Player_GetHeight", @@ -137,6 +154,16 @@ wordReplace = { "func_800B8214": "Actor_GetWorld", "func_800B8248": "Actor_GetWorldPosShapeRot", "func_800BE22C": "Actor_ApplyDamage", + "Actor_YawBetweenActors": "Actor_WorldYawTowardActor", + "Actor_YawBetweenActorsTop": "Actor_FocusYawTowardActor", + "Actor_YawToPoint": "Actor_WorldYawTowardPoint", + "Actor_PitchBetweenActors": "Actor_WorldPitchTowardActor", + "Actor_PitchBetweenActorsTop": "Actor_FocusPitchTowardActor", + "Actor_PitchToPoint": "Actor_WorldPitchTowardPoint", + "Actor_DistanceBetweenActors": "Actor_WorldDistXYZToActor", + "Actor_DistanceToPoint": "Actor_WorldDistXYZToPoint", + "Actor_XZDistanceBetweenActors": "Actor_WorldDistXZToActor", + "Actor_XZDistanceToPoint": "Actor_WorldDistXZToPoint", "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos", "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos", "func_8016970C": "Play_SetCameraAtEye", @@ -144,14 +171,19 @@ wordReplace = { "func_800BBA88": "Enemy_StartFinishingBlow", "ShrinkWindow_Step": "ShrinkWindow_Update", "ShrinkWindow_Fini": "ShrinkWindow_Destroy", - "func_801A89A8": "Audio_QueueSeqCmd", + "func_801A89A8": "AudioSeq_QueueSeqCmd", + "Audio_QueueSeqCmd": "AudioSeq_QueueSeqCmd", + "func_801A0238": "Audio_SetMainBgmVolume", + "func_801A2C20": "Audio_StopSubBgm", + "func_801A2BB8": "Audio_PlaySubBgm", "func_8019F1C0": "Audio_PlaySfxAtPos", "func_801A5BD0": "AudioSfx_MuteBanks", "func_801A72CC": "AudioSfx_StopByPos", "Audio_StopSfxByPos": "AudioSfx_StopByPos", "Audio_StopSfxById": "AudioSfx_StopById", "func_801A3098": "Audio_PlayFanfare", - "func_801A8A50": "Audio_GetActiveSequence", + "func_801A8A50": "AudioSeq_GetActiveSeqId", + "Audio_GetActiveSequence": "AudioSeq_GetActiveSeqId", "func_801A2E54": "Audio_PlayBgm_StorePrevBgm", "func_801A2ED8": "Audio_RestorePrevBgm", "func_801A2544": "Audio_PlayMorningSceneSequence", @@ -269,12 +301,17 @@ wordReplace = { "Actor_UnsetRoomClearedTemp": "Flags_UnsetTempClear", "Actor_GetCollectibleFlag": "Flags_GetCollectible", "Actor_SetCollectibleFlag": "Flags_SetCollectible", - "func_800B8A1C": "Actor_PickUp", - "func_800B8B84": "Actor_PickUpNearby", - "func_800B8BB0": "Actor_LiftActor", - "func_800B8BD0": "Actor_PickUpFar", + "func_800B8A1C": "Actor_OfferGetItem", + "Actor_PickUp": "Actor_OfferGetItem", + "func_800B8B84": "Actor_OfferGetItemNearby", + "Actor_PickUpNearby": "Actor_OfferGetItemNearby", + "func_800B8BB0": "Actor_OfferCarry", + "Actor_LiftActor": "Actor_OfferCarry", + "func_800B8BD0": "Actor_OfferGetItemFar", + "Actor_PickUpFar": "Actor_OfferGetItemFar", "func_801A5CFC": "AudioSfx_PlaySfx", "Audio_PlaySfxGeneral": "AudioSfx_PlaySfx", + "func_800B8C50": "Actor_SetClosestSecretDistance", "func_800BBDAC": "Actor_SpawnFloorDustRing", "func_800B8708": "Player_GetExchangeItemId", "func_801233E4": "Player_InCsMode", @@ -289,13 +326,18 @@ wordReplace = { "func_800B867C": "Actor_TextboxIsClosing", "func_800BDC5C": "Actor_ChangeAnimationByInfo", "Actor_ChangeAnimation": "Actor_ChangeAnimationByInfo", + "func_801477B4": "Message_CloseTextbox", + "func_80151938": "Message_ContinueTextbox", "func_80152498": "Message_GetState", "func_800B8898": "Actor_GetScreenPos", - "Audio_PlayActorSound2": "Actor_PlaySfxAtPos", + "Audio_PlayActorSound2": "Actor_PlaySfx", + "Actor_PlaySfxAtPos": "Actor_PlaySfx", + "func_800B8E58": "Player_PlaySfx", "func_800BF7CC": "Actor_SpawnIceEffects", "Actor_IsFacingPlayerAndWithinRange": "Actor_IsFacingAndNearPlayer", "func_800BC8B8": "Actor_DrawDoorLock", "func_800B86C8": "Actor_ChangeFocus", + "func_800DF840": "Camera_ChangeMode", "func_800B90F4": "Actor_DeactivateLens", "func_800BC770": "Actor_AddQuake", "func_800DF840": "Camera_ChangeMode", @@ -472,7 +514,7 @@ wordReplace = { "func_800DFC90": "Camera_GetCamDir", "func_800DFD04": "Camera_AddQuake", "func_800DFFAC": "Camera_ChangeDoorCam", - + "func_80169FFC": "Play_CamIsNotFixed", "func_801694DC": "Play_CreateSubCamera", "Play_GetActiveCameraIndex": "Play_GetActiveCamId", "func_80169590": "Play_ChangeCameraStatus", @@ -678,9 +720,12 @@ wordReplace = { "skelAnime.prevFrameRot": "skelAnime.prevRot", "skelAnime.prevFramePos": "skelAnime.prevTransl", "skelAnime.unk3E": "skelAnime.baseTransl", + "actor.unk20": "actor.halfDaysBits", "actor.minVelocityY": "actor.terminalVelocity", "actor.yDistToWater": "actor.depthInWater", "actor.yDistToPlayer": "actor.playerHeightRel", + "actor.speedXZ": "actor.speed", + "thisx->speedXZ": "thisx->speed", "gSaveContext.unk_3F1E": "gSaveContext.hudVisibilityForceButtonAlphasByStatus", "gSaveContext.unk_3F20": "gSaveContext.nextHudVisibility", @@ -791,6 +836,15 @@ wordReplace = { "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", + "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1", + "play->roomCtx.curRoom.unk2": "play->roomCtx.curRoom.behaviorType2", + "play->roomCtx.unk31": "play->roomCtx.status", + + "actorCtx.unkC": "actorCtx.halfDaysBit", + "actorCtx.unk1F4": "actorCtx.unk_1F4.unk_00", + "actorCtx.unk1F5": "actorCtx.unk_1F4.timer", + "actorCtx.unk1F8": "actorCtx.unk_1F4.unk_04", + "actorCtx.unk1FC": "actorCtx.unk_1F4.unk_08", "gSaveContext.unk_3DC8": "gSaveContext.timerOsTime", "gSaveContext.unk_3DD0": "gSaveContext.timerStates", @@ -822,6 +876,9 @@ wordReplace = { "ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON", + "ACTOR_FLAG_100": "ACTOR_FLAG_TALK_REQUESTED", + "ACTOR_FLAG_8000000": "ACTOR_FLAG_CANT_LOCK_ON", + "EXCH_ITEM_MINUS1": "PLAYER_IA_MINUS1", "EXCH_ITEM_NONE": "PLAYER_IA_NONE", "EXCH_ITEM_PICTO_BOX": "PLAYER_IA_PICTO_BOX", diff --git a/tools/progress.py b/tools/progress.py index dccd743d7..5a2958cd8 100755 --- a/tools/progress.py +++ b/tools/progress.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import argparse, csv, git, json, os, re, sys +import argparse, csv, os, re, sys parser = argparse.ArgumentParser() @@ -170,6 +170,7 @@ srcCategories = [ "libultra", "code", "overlays", + "audio", ] srcCategoriesFixer = { @@ -256,6 +257,12 @@ asmTracker["boot"]["totalSize"] += asmTracker["libultra"]["totalSize"] del srcTracker["libultra"] del asmTracker["libultra"] +# Add audio to code. +srcTracker["code"]["totalSize"] += srcTracker["audio"]["totalSize"] +asmTracker["code"]["totalSize"] += asmTracker["audio"]["totalSize"] +del srcTracker["audio"] +del asmTracker["audio"] + # Calculate Non-Matching non_matching_functions_ovl = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/overlays/" in x, non_matching_functions))) non_matching_functions_code = list(map(lambda x: x.split("/")[-1].split(".")[0], filter(lambda x: "/code/" in x, non_matching_functions))) @@ -337,6 +344,8 @@ masks = int(src / bytes_per_mask) rupees = int((src % bytes_per_mask) / bytes_per_rupee) if args.format == 'csv': + import git + version = 2 git_object = git.Repo().head.object timestamp = str(git_object.committed_date) @@ -358,6 +367,8 @@ if args.format == 'csv': print(",".join(map(str, csv_list))) elif args.format == 'shield-json': + import json + # https://shields.io/endpoint print(json.dumps({ "schemaVersion": 1, diff --git a/tools/regconvert.py b/tools/regconvert.py index f4b9b0db1..892e3f885 100755 --- a/tools/regconvert.py +++ b/tools/regconvert.py @@ -28,7 +28,7 @@ def read_file(filename): file_contents = src_file.read() src_file.close() - pattern = re.compile("gGameInfo->data\[((0[xX])?[0-9a-fA-F]+)\]") + pattern = re.compile("gRegEditor->data\[((0[xX])?[0-9a-fA-F]+)\]") match = pattern.search(file_contents) while match: @@ -56,19 +56,19 @@ def check_valid_offset(offset): return 0x14 <= offset <= 0x15D2 def main(): - parser = argparse.ArgumentParser(description="Converts a gGameInfo->data index to a REG macro.") + parser = argparse.ArgumentParser(description="Converts a gRegEditor->data index to a REG macro.") # TODO: Add a description and a better title # index_group = parser.add_argument_group(title="index", description="") index_group = parser.add_argument_group() - index_group.add_argument("index", help="index of gGameInfo->data in decimal (or hexadecimal if starts with 0x)") - index_group.add_argument("--offset", help="treat index argument as an offset to gGameInfo instead", action="store_true") + index_group.add_argument("index", help="index of gRegEditor->data in decimal (or hexadecimal if starts with 0x)") + index_group.add_argument("--offset", help="treat index argument as an offset to gRegEditor instead", action="store_true") index_group.add_argument("--hex", help="treat index argument as hexadecimal, even without the 0x", action="store_true") # TODO: Add a description and a better title # file_group = parser.add_argument_group(title="file", description="") file_group = parser.add_argument_group() - file_group.add_argument("--file", help="use the parameter as a filepath, then replace every occurrence of `gGameInfo->data[number]` in that file a REG macro", action="store_true") + file_group.add_argument("--file", help="use the parameter as a filepath, then replace every occurrence of `gRegEditor->data[number]` in that file a REG macro", action="store_true") file_group.add_argument("--stdout", help="print the processed file to stdout instead of overwriting the original", action="store_true") args = parser.parse_args() diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 3e1befd91..1d08b2962 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -236,16 +236,16 @@ asm/non_matchings/code/z_actor/Actor_UpdateVelocityWithoutGravityReverse.s,Actor asm/non_matchings/code/z_actor/Actor_MoveWithoutGravityReverse.s,Actor_MoveWithoutGravityReverse,0x800B6BD8,0xB asm/non_matchings/code/z_actor/Actor_SetSpeeds.s,Actor_SetSpeeds,0x800B6C04,0x15 asm/non_matchings/code/z_actor/Actor_UpdatePosFromSkelAnime.s,Actor_UpdatePosFromSkelAnime,0x800B6C58,0x1F -asm/non_matchings/code/z_actor/Actor_YawBetweenActors.s,Actor_YawBetweenActors,0x800B6CD4,0xB -asm/non_matchings/code/z_actor/Actor_YawBetweenActorsTop.s,Actor_YawBetweenActorsTop,0x800B6D00,0xB -asm/non_matchings/code/z_actor/Actor_YawToPoint.s,Actor_YawToPoint,0x800B6D2C,0x9 -asm/non_matchings/code/z_actor/Actor_PitchBetweenActors.s,Actor_PitchBetweenActors,0x800B6D50,0xB -asm/non_matchings/code/z_actor/Actor_PitchBetweenActorsTop.s,Actor_PitchBetweenActorsTop,0x800B6D7C,0xB -asm/non_matchings/code/z_actor/Actor_PitchToPoint.s,Actor_PitchToPoint,0x800B6DA8,0x9 -asm/non_matchings/code/z_actor/Actor_DistanceBetweenActors.s,Actor_DistanceBetweenActors,0x800B6DCC,0xB -asm/non_matchings/code/z_actor/Actor_DistanceToPoint.s,Actor_DistanceToPoint,0x800B6DF8,0x9 -asm/non_matchings/code/z_actor/Actor_XZDistanceBetweenActors.s,Actor_XZDistanceBetweenActors,0x800B6E1C,0xB -asm/non_matchings/code/z_actor/Actor_XZDistanceToPoint.s,Actor_XZDistanceToPoint,0x800B6E48,0x9 +asm/non_matchings/code/z_actor/Actor_WorldYawTowardActor.s,Actor_WorldYawTowardActor,0x800B6CD4,0xB +asm/non_matchings/code/z_actor/Actor_FocusYawTowardActor.s,Actor_FocusYawTowardActor,0x800B6D00,0xB +asm/non_matchings/code/z_actor/Actor_WorldYawTowardPoint.s,Actor_WorldYawTowardPoint,0x800B6D2C,0x9 +asm/non_matchings/code/z_actor/Actor_WorldPitchTowardActor.s,Actor_WorldPitchTowardActor,0x800B6D50,0xB +asm/non_matchings/code/z_actor/Actor_FocusPitchTowardActor.s,Actor_FocusPitchTowardActor,0x800B6D7C,0xB +asm/non_matchings/code/z_actor/Actor_WorldPitchTowardPoint.s,Actor_WorldPitchTowardPoint,0x800B6DA8,0x9 +asm/non_matchings/code/z_actor/Actor_WorldDistXYZToActor.s,Actor_WorldDistXYZToActor,0x800B6DCC,0xB +asm/non_matchings/code/z_actor/Actor_WorldDistXYZToPoint.s,Actor_WorldDistXYZToPoint,0x800B6DF8,0x9 +asm/non_matchings/code/z_actor/Actor_WorldDistXZToActor.s,Actor_WorldDistXZToActor,0x800B6E1C,0xB +asm/non_matchings/code/z_actor/Actor_WorldDistXZToPoint.s,Actor_WorldDistXZToPoint,0x800B6E48,0x9 asm/non_matchings/code/z_actor/Actor_OffsetOfPointInActorCoords.s,Actor_OffsetOfPointInActorCoords,0x800B6E6C,0x28 asm/non_matchings/code/z_actor/Actor_HeightDiff.s,Actor_HeightDiff,0x800B6F0C,0x5 asm/non_matchings/code/z_actor/func_800B6F20.s,func_800B6F20,0x800B6F20,0x2A @@ -299,13 +299,13 @@ asm/non_matchings/code/z_actor/func_800B886C.s,func_800B886C,0x800B886C,0xB asm/non_matchings/code/z_actor/Actor_GetScreenPos.s,Actor_GetScreenPos,0x800B8898,0x27 asm/non_matchings/code/z_actor/Actor_OnScreen.s,Actor_OnScreen,0x800B8934,0x31 asm/non_matchings/code/z_actor/Actor_HasParent.s,Actor_HasParent,0x800B89F8,0x9 -asm/non_matchings/code/z_actor/Actor_PickUp.s,Actor_PickUp,0x800B8A1C,0x5A -asm/non_matchings/code/z_actor/Actor_PickUpNearby.s,Actor_PickUpNearby,0x800B8B84,0xB -asm/non_matchings/code/z_actor/Actor_LiftActor.s,Actor_LiftActor,0x800B8BB0,0x8 -asm/non_matchings/code/z_actor/Actor_PickUpFar.s,Actor_PickUpFar,0x800B8BD0,0xB +asm/non_matchings/code/z_actor/Actor_OfferGetItem.s,Actor_OfferGetItem,0x800B8A1C,0x5A +asm/non_matchings/code/z_actor/Actor_OfferGetItemNearby.s,Actor_OfferGetItemNearby,0x800B8B84,0xB +asm/non_matchings/code/z_actor/Actor_OfferCarry.s,Actor_OfferCarry,0x800B8BB0,0x8 +asm/non_matchings/code/z_actor/Actor_OfferGetItemFar.s,Actor_OfferGetItemFar,0x800B8BD0,0xB asm/non_matchings/code/z_actor/Actor_HasNoParent.s,Actor_HasNoParent,0x800B8BFC,0x9 asm/non_matchings/code/z_actor/func_800B8C20.s,func_800B8C20,0x800B8C20,0xC -asm/non_matchings/code/z_actor/func_800B8C50.s,func_800B8C50,0x800B8C50,0xA +asm/non_matchings/code/z_actor/Actor_SetClosestSecretDistance.s,Actor_SetClosestSecretDistance,0x800B8C50,0xA asm/non_matchings/code/z_actor/Actor_HasRider.s,Actor_HasRider,0x800B8C78,0x9 asm/non_matchings/code/z_actor/Actor_SetRideActor.s,Actor_SetRideActor,0x800B8C9C,0x14 asm/non_matchings/code/z_actor/Actor_HasNoRider.s,Actor_HasNoRider,0x800B8CEC,0x9 @@ -314,8 +314,8 @@ asm/non_matchings/code/z_actor/func_800B8D50.s,func_800B8D50,0x800B8D50,0x12 asm/non_matchings/code/z_actor/func_800B8D98.s,func_800B8D98,0x800B8D98,0xF asm/non_matchings/code/z_actor/func_800B8DD4.s,func_800B8DD4,0x800B8DD4,0x12 asm/non_matchings/code/z_actor/func_800B8E1C.s,func_800B8E1C,0x800B8E1C,0xF -asm/non_matchings/code/z_actor/func_800B8E58.s,func_800B8E58,0x800B8E58,0x1C -asm/non_matchings/code/z_actor/Actor_PlaySfxAtPos.s,Actor_PlaySfxAtPos,0x800B8EC8,0xB +asm/non_matchings/code/z_actor/Player_PlaySfx.s,Player_PlaySfx,0x800B8E58,0x1C +asm/non_matchings/code/z_actor/Actor_PlaySfx.s,Actor_PlaySfx,0x800B8EC8,0xB asm/non_matchings/code/z_actor/func_800B8EF4.s,func_800B8EF4,0x800B8EF4,0x29 asm/non_matchings/code/z_actor/func_800B8F98.s,func_800B8F98,0x800B8F98,0xA asm/non_matchings/code/z_actor/func_800B8FC0.s,func_800B8FC0,0x800B8FC0,0xA @@ -326,23 +326,23 @@ asm/non_matchings/code/z_actor/func_800B9084.s,func_800B9084,0x800B9084,0x5 asm/non_matchings/code/z_actor/func_800B9098.s,func_800B9098,0x800B9098,0x5 asm/non_matchings/code/z_actor/func_800B90AC.s,func_800B90AC,0x800B90AC,0x12 asm/non_matchings/code/z_actor/Actor_DeactivateLens.s,Actor_DeactivateLens,0x800B90F4,0xB -asm/non_matchings/code/z_actor/func_800B9120.s,func_800B9120,0x800B9120,0x14 +asm/non_matchings/code/z_actor/Actor_InitHalfDaysBit.s,Actor_InitHalfDaysBit,0x800B9120,0x14 asm/non_matchings/code/z_actor/Actor_InitContext.s,Actor_InitContext,0x800B9170,0x71 asm/non_matchings/code/z_actor/Actor_SpawnSetupActors.s,Actor_SpawnSetupActors,0x800B9334,0x56 asm/non_matchings/code/z_actor/Actor_UpdateActor.s,Actor_UpdateActor,0x800B948C,0xBD asm/non_matchings/code/z_actor/Actor_UpdateAll.s,Actor_UpdateAll,0x800B9780,0xA1 asm/non_matchings/code/z_actor/Actor_Draw.s,Actor_Draw,0x800B9A04,0xC6 asm/non_matchings/code/z_actor/func_800B9D1C.s,func_800B9D1C,0x800B9D1C,0x48 -asm/non_matchings/code/z_actor/Actor_DrawAllSetup.s,Actor_DrawAllSetup,0x800B9E3C,0x4 -asm/non_matchings/code/z_actor/Actor_RecordUndrawnActor.s,Actor_RecordUndrawnActor,0x800B9E4C,0xE +asm/non_matchings/code/z_actor/Actor_ResetLensActors.s,Actor_ResetLensActors,0x800B9E3C,0x4 +asm/non_matchings/code/z_actor/Actor_AddToLensActors.s,Actor_AddToLensActors,0x800B9E4C,0xE asm/non_matchings/code/z_actor/Actor_DrawLensOverlay.s,Actor_DrawLensOverlay,0x800B9E84,0x1C asm/non_matchings/code/z_actor/Actor_DrawLensActors.s,Actor_DrawLensActors,0x800B9EF4,0xF9 asm/non_matchings/code/z_actor/func_800BA2D8.s,func_800BA2D8,0x800BA2D8,0x9 asm/non_matchings/code/z_actor/func_800BA2FC.s,func_800BA2FC,0x800BA2FC,0x4C asm/non_matchings/code/z_actor/Actor_DrawAll.s,Actor_DrawAll,0x800BA42C,0xB4 -asm/non_matchings/code/z_actor/func_800BA6FC.s,func_800BA6FC,0x800BA6FC,0x27 +asm/non_matchings/code/z_actor/Actor_KillAllWithMissingObject.s,Actor_KillAllWithMissingObject,0x800BA6FC,0x27 asm/non_matchings/code/z_actor/func_800BA798.s,func_800BA798,0x800BA798,0x48 -asm/non_matchings/code/z_actor/func_800BA8B8.s,func_800BA8B8,0x800BA8B8,0x3F +asm/non_matchings/code/z_actor/Actor_KillAllOnHalfDayChange.s,Actor_KillAllOnHalfDayChange,0x800BA8B8,0x3F asm/non_matchings/code/z_actor/Actor_CleanupContext.s,Actor_CleanupContext,0x800BA9B4,0x40 asm/non_matchings/code/z_actor/Actor_AddToCategory.s,Actor_AddToCategory,0x800BAAB4,0x1C asm/non_matchings/code/z_actor/Actor_RemoveFromCategory.s,Actor_RemoveFromCategory,0x800BAB24,0x36 @@ -365,7 +365,7 @@ asm/non_matchings/code/z_actor/Actor_SpawnBodyParts.s,Actor_SpawnBodyParts,0x800 asm/non_matchings/code/z_actor/Actor_SpawnFloorDustRing.s,Actor_SpawnFloorDustRing,0x800BBDAC,0x81 asm/non_matchings/code/z_actor/func_800BBFB0.s,func_800BBFB0,0x800BBFB0,0x69 asm/non_matchings/code/z_actor/func_800BC154.s,func_800BC154,0x800BC154,0xD -asm/non_matchings/code/z_actor/func_800BC188.s,func_800BC188,0x800BC188,0xB +asm/non_matchings/code/z_actor/Actor_GetArrowDmgFlags.s,Actor_GetArrowDmgFlags,0x800BC188,0xB asm/non_matchings/code/z_actor/func_800BC1B4.s,func_800BC1B4,0x800BC1B4,0x2F asm/non_matchings/code/z_actor/func_800BC270.s,func_800BC270,0x800BC270,0x75 asm/non_matchings/code/z_actor/func_800BC444.s,func_800BC444,0x800BC444,0x2A @@ -382,11 +382,11 @@ asm/non_matchings/code/z_actor/Actor_SetColorFilter.s,Actor_SetColorFilter,0x800 asm/non_matchings/code/z_actor/func_800BCBF4.s,func_800BCBF4,0x800BCBF4,0x1D asm/non_matchings/code/z_actor/func_800BCC68.s,func_800BCC68,0x800BCC68,0x1D asm/non_matchings/code/z_actor/Actor_GetClosestPosOnPath.s,Actor_GetClosestPosOnPath,0x800BCCDC,0x176 -asm/non_matchings/code/z_actor/func_800BD2B4.s,func_800BD2B4,0x800BD2B4,0x34 -asm/non_matchings/code/z_actor/func_800BD384.s,func_800BD384,0x800BD384,0xCD -asm/non_matchings/code/z_actor/func_800BD6B8.s,func_800BD6B8,0x800BD6B8,0xB -asm/non_matchings/code/z_actor/func_800BD6E4.s,func_800BD6E4,0x800BD6E4,0x69 -asm/non_matchings/code/z_actor/func_800BD888.s,func_800BD888,0x800BD888,0x46 +asm/non_matchings/code/z_actor/Npc_UpdateTalking.s,Npc_UpdateTalking,0x800BD2B4,0x34 +asm/non_matchings/code/z_actor/Npc_TrackPointWithLimits.s,Npc_TrackPointWithLimits,0x800BD384,0xCD +asm/non_matchings/code/z_actor/Npc_GetTrackingPresetMaxPlayerYaw.s,Npc_GetTrackingPresetMaxPlayerYaw,0x800BD6B8,0xB +asm/non_matchings/code/z_actor/Npc_UpdateAutoTurn.s,Npc_UpdateAutoTurn,0x800BD6E4,0x69 +asm/non_matchings/code/z_actor/Npc_TrackPoint.s,Npc_TrackPoint,0x800BD888,0x46 asm/non_matchings/code/z_actor/func_800BD9A0.s,func_800BD9A0,0x800BD9A0,0x10 asm/non_matchings/code/z_actor/func_800BD9E0.s,func_800BD9E0,0x800BD9E0,0x30 asm/non_matchings/code/z_actor/func_800BDAA0.s,func_800BDAA0,0x800BDAA0,0x33 @@ -409,7 +409,7 @@ asm/non_matchings/code/z_actor/func_800BE5CC.s,func_800BE5CC,0x800BE5CC,0x1C asm/non_matchings/code/z_actor/func_800BE63C.s,func_800BE63C,0x800BE63C,0x11 asm/non_matchings/code/z_actor/Actor_DrawDamageEffects.s,Actor_DrawDamageEffects,0x800BE680,0x453 asm/non_matchings/code/z_actor/Actor_SpawnIceEffects.s,Actor_SpawnIceEffects,0x800BF7CC,0x75 -asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_FaultPrint.s,ActorOverlayTable_FaultPrint,0x800BF9A0,0x36 +asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_FaultClient.s,ActorOverlayTable_FaultClient,0x800BF9A0,0x36 asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_FaultAddrConv.s,ActorOverlayTable_FaultAddrConv,0x800BFA78,0x1C asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_Init.s,ActorOverlayTable_Init,0x800BFAE8,0x16 asm/non_matchings/code/z_actor_dlftbls/ActorOverlayTable_Cleanup.s,ActorOverlayTable_Cleanup,0x800BFB40,0x10 @@ -1033,7 +1033,7 @@ asm/non_matchings/code/code_800E8EA0/Actor_TrackPoint.s,Actor_TrackPoint,0x800E8 asm/non_matchings/code/code_800E8EA0/Actor_TrackPlayerSetFocusHeight.s,Actor_TrackPlayerSetFocusHeight,0x800E9138,0x46 asm/non_matchings/code/code_800E8EA0/Actor_TrackPlayer.s,Actor_TrackPlayer,0x800E9250,0x44 asm/non_matchings/code/z_common_data/func_800E9360.s,func_800E9360,0x800E9360,0x20 -asm/non_matchings/code/z_debug/GameInfo_Init.s,GameInfo_Init,0x800E93E0,0x24 +asm/non_matchings/code/z_debug/Regs_Init.s,Regs_Init,0x800E93E0,0x24 asm/non_matchings/code/z_debug_display/DebugDisplay_Init.s,DebugDisplay_Init,0x800E9470,0x6 asm/non_matchings/code/z_debug_display/DebugDisplay_AddObject.s,DebugDisplay_AddObject,0x800E9488,0x37 asm/non_matchings/code/z_debug_display/DebugDisplay_DrawObjects.s,DebugDisplay_DrawObjects,0x800E9564,0x24 @@ -1041,12 +1041,12 @@ asm/non_matchings/code/z_debug_display/func_800E95F4.s,func_800E95F4,0x800E95F4, asm/non_matchings/code/z_debug_display/func_800E97D8.s,func_800E97D8,0x800E97D8,0x55 asm/non_matchings/code/z_debug_display/func_800E992C.s,func_800E992C,0x800E992C,0x21 asm/non_matchings/code/z_debug_display/func_800E99B0.s,func_800E99B0,0x800E99B0,0xB8 -asm/non_matchings/code/z_debug_mode/func_800E9C90.s,func_800E9C90,0x800E9C90,0x4 -asm/non_matchings/code/z_debug_mode/func_800E9CA0.s,func_800E9CA0,0x800E9CA0,0x17 -asm/non_matchings/code/z_debug_mode/func_800E9CFC.s,func_800E9CFC,0x800E9CFC,0x30 -asm/non_matchings/code/z_debug_mode/func_800E9DBC.s,func_800E9DBC,0x800E9DBC,0x36 -asm/non_matchings/code/z_debug_mode/func_800E9E94.s,func_800E9E94,0x800E9E94,0x39 -asm/non_matchings/code/z_debug_mode/func_800E9F78.s,func_800E9F78,0x800E9F78,0x3A +asm/non_matchings/code/z_debug_mode/Debug_ClearTextDrawFlags.s,Debug_ClearTextDrawFlags,0x800E9C90,0x4 +asm/non_matchings/code/z_debug_mode/Debug_ScreenText.s,Debug_ScreenText,0x800E9CA0,0x17 +asm/non_matchings/code/z_debug_mode/Debug_DrawScreenText.s,Debug_DrawScreenText,0x800E9CFC,0x30 +asm/non_matchings/code/z_debug_mode/DebugCamera_ScreenText.s,DebugCamera_ScreenText,0x800E9DBC,0x36 +asm/non_matchings/code/z_debug_mode/DebugCamera_DrawScreenText.s,DebugCamera_DrawScreenText,0x800E9E94,0x39 +asm/non_matchings/code/z_debug_mode/Debug_DrawText.s,Debug_DrawText,0x800E9F78,0x3A asm/non_matchings/code/z_demo/Cutscene_Init.s,Cutscene_Init,0x800EA060,0x1D asm/non_matchings/code/z_demo/Cutscene_Start.s,Cutscene_Start,0x800EA0D4,0x6 asm/non_matchings/code/z_demo/Cutscene_End.s,Cutscene_End,0x800EA0EC,0x9 @@ -1618,14 +1618,14 @@ asm/non_matchings/code/z_parameter/Interface_SetHudVisibility.s,Interface_SetHud asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphasByStatus.s,Interface_UpdateButtonAlphasByStatus,0x8010EF9C,0x4E asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphas.s,Interface_UpdateButtonAlphas,0x8010F0D4,0x35 asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateHudAlphas,0x8010F1A8,0x3A4 -asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F -asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsPart2.s,Interface_UpdateButtonsPart2,0x80110038,0x71F +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsPart1.s,Interface_UpdateButtonsPart1,0x80111CB4,0x34C asm/non_matchings/code/z_parameter/Interface_SetSceneRestrictions.s,Interface_SetSceneRestrictions,0x801129E4,0x44 asm/non_matchings/code/z_parameter/Interface_Noop.s,Interface_Noop,0x80112AF4,0x2 asm/non_matchings/code/z_parameter/Interface_InitMinigame.s,Interface_InitMinigame,0x80112AFC,0x11 asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s,Interface_LoadItemIconImpl,0x80112B40,0x29 asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s,Interface_LoadItemIcon,0x80112BE4,0xA -asm/non_matchings/code/z_parameter/func_80112C0C.s,func_80112C0C,0x80112C0C,0x9D +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsAlt.s,Interface_UpdateButtonsAlt,0x80112C0C,0x9D asm/non_matchings/code/z_parameter/Item_Give.s,Item_Give,0x80112E80,0x553 asm/non_matchings/code/z_parameter/Item_CheckObtainabilityImpl.s,Item_CheckObtainabilityImpl,0x801143CC,0x16B asm/non_matchings/code/z_parameter/Item_CheckObtainability.s,Item_CheckObtainability,0x80114978,0xA @@ -1655,15 +1655,15 @@ asm/non_matchings/code/z_parameter/Magic_UpdateAddRequest.s,Magic_UpdateAddReque asm/non_matchings/code/z_parameter/Magic_FlashMeterBorder.s,Magic_FlashMeterBorder,0x80116114,0x8D asm/non_matchings/code/z_parameter/Magic_Update.s,Magic_Update,0x80116348,0x174 asm/non_matchings/code/z_parameter/Magic_DrawMeter.s,Magic_DrawMeter,0x80116918,0x1B0 -asm/non_matchings/code/z_parameter/func_80116FD8.s,func_80116FD8,0x80116FD8,0x38 -asm/non_matchings/code/z_parameter/func_801170B8.s,func_801170B8,0x801170B8,0x12 -asm/non_matchings/code/z_parameter/func_80117100.s,func_80117100,0x80117100,0x248 -asm/non_matchings/code/z_parameter/func_80117A20.s,func_80117A20,0x80117A20,0x6C -asm/non_matchings/code/z_parameter/func_80117BD0.s,func_80117BD0,0x80117BD0,0x12D -asm/non_matchings/code/z_parameter/func_80118084.s,func_80118084,0x80118084,0x203 -asm/non_matchings/code/z_parameter/func_80118890.s,func_80118890,0x80118890,0xC5 -asm/non_matchings/code/z_parameter/func_80118BA4.s,func_80118BA4,0x80118BA4,0x123 -asm/non_matchings/code/z_parameter/func_80119030.s,func_80119030,0x80119030,0x178 +asm/non_matchings/code/z_parameter/Interface_SetPerspectiveView.s,Interface_SetPerspectiveView,0x80116FD8,0x38 +asm/non_matchings/code/z_parameter/Interface_SetOrthoView.s,Interface_SetOrthoView,0x801170B8,0x12 +asm/non_matchings/code/z_parameter/Interface_DrawItemButtons.s,Interface_DrawItemButtons,0x80117100,0x248 +asm/non_matchings/code/z_parameter/Interface_DrawItemIconTexture.s,Interface_DrawItemIconTexture,0x80117A20,0x6C +asm/non_matchings/code/z_parameter/Interface_DrawAmmoCount.s,Interface_DrawAmmoCount,0x80117BD0,0x12D +asm/non_matchings/code/z_parameter/Interface_DrawBButtonIcons.s,Interface_DrawBButtonIcons,0x80118084,0x203 +asm/non_matchings/code/z_parameter/Interface_DrawCButtonIcons.s,Interface_DrawCButtonIcons,0x80118890,0xC5 +asm/non_matchings/code/z_parameter/Interface_DrawAButton.s,Interface_DrawAButton,0x80118BA4,0x123 +asm/non_matchings/code/z_parameter/Interface_DrawPauseMenuEquippingIcons.s,Interface_DrawPauseMenuEquippingIcons,0x80119030,0x178 asm/non_matchings/code/z_parameter/Interface_DrawClock.s,Interface_DrawClock,0x80119610,0x7B4 asm/non_matchings/code/z_parameter/Interface_SetPerfectLetters.s,Interface_SetPerfectLetters,0x8011B4E0,0x38 asm/non_matchings/code/z_parameter/Interface_UpdatePerfectLettersType1.s,Interface_UpdatePerfectLettersType1,0x8011B5C0,0x108 @@ -1905,14 +1905,14 @@ asm/non_matchings/code/z_rcp/Gfx_PrimColor.s,Gfx_PrimColor,0x8012CEA8,0x19 asm/non_matchings/code/z_rcp/func_8012CF0C.s,func_8012CF0C,0x8012CF0C,0x11A asm/non_matchings/code/z_rcp/func_8012D374.s,func_8012D374,0x8012D374,0x26 asm/non_matchings/code/z_rcp/func_8012D40C.s,func_8012D40C,0x8012D40C,0x3D -asm/non_matchings/code/z_room/Room_nop8012D510.s,Room_nop8012D510,0x8012D510,0x6 -asm/non_matchings/code/z_room/Room_DrawType3Mesh.s,Room_DrawType3Mesh,0x8012D528,0x5 -asm/non_matchings/code/z_room/Room_DrawType0Mesh.s,Room_DrawType0Mesh,0x8012D53C,0x85 -asm/non_matchings/code/z_room/Room_DrawType2Mesh.s,Room_DrawType2Mesh,0x8012D750,0x1E6 -asm/non_matchings/code/z_room/func_8012DEE8.s,func_8012DEE8,0x8012DEE8,0xDB -asm/non_matchings/code/z_room/func_8012E254.s,func_8012E254,0x8012E254,0x36 -asm/non_matchings/code/z_room/func_8012E32C.s,func_8012E32C,0x8012E32C,0xDF -asm/non_matchings/code/z_room/Room_DrawType1Mesh.s,Room_DrawType1Mesh,0x8012E6A8,0x1A +asm/non_matchings/code/z_room/Room_Noop.s,Room_Noop,0x8012D510,0x6 +asm/non_matchings/code/z_room/Room_DrawNone.s,Room_DrawNone,0x8012D528,0x5 +asm/non_matchings/code/z_room/Room_DrawNormal.s,Room_DrawNormal,0x8012D53C,0x85 +asm/non_matchings/code/z_room/Room_DrawCullable.s,Room_DrawCullable,0x8012D750,0x1E6 +asm/non_matchings/code/z_room/Room_DrawImageSingle.s,Room_DrawImageSingle,0x8012DEE8,0xDB +asm/non_matchings/code/z_room/Room_GetImageMultiBgEntry.s,Room_GetImageMultiBgEntry,0x8012E254,0x36 +asm/non_matchings/code/z_room/Room_DrawImageMulti.s,Room_DrawImageMulti,0x8012E32C,0xDF +asm/non_matchings/code/z_room/Room_DrawImage.s,Room_DrawImage,0x8012E6A8,0x1A asm/non_matchings/code/z_room/Room_Init.s,Room_Init,0x8012E710,0x10 asm/non_matchings/code/z_room/Room_AllocateAndLoad.s,Room_AllocateAndLoad,0x8012E750,0x87 asm/non_matchings/code/z_room/Room_StartRoomTransition.s,Room_StartRoomTransition,0x8012E96C,0x4F @@ -1936,40 +1936,40 @@ asm/non_matchings/code/z_scene/Object_GetIndex.s,Object_GetIndex,0x8012F608,0x18 asm/non_matchings/code/z_scene/Object_IsLoaded.s,Object_IsLoaded,0x8012F668,0xC asm/non_matchings/code/z_scene/Object_LoadAll.s,Object_LoadAll,0x8012F698,0x29 asm/non_matchings/code/z_scene/func_8012F73C.s,func_8012F73C,0x8012F73C,0x18 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSpawnList.s,Scene_HeaderCmdSpawnList,0x8012F79C,0x5C -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorList.s,Scene_HeaderCmdActorList,0x8012F90C,0x12 -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneCamList.s,Scene_HeaderCmdActorCutsceneCamList,0x8012F954,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdColHeader.s,Scene_HeaderCmdColHeader,0x8012F984,0x28 -asm/non_matchings/code/z_scene/Scene_HeaderCmdRoomList.s,Scene_HeaderCmdRoomList,0x8012FA24,0x11 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEntranceList.s,Scene_HeaderCmdEntranceList,0x8012FA68,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdSpecialFiles.s,Scene_HeaderCmdSpecialFiles,0x8012FA98,0x32 -asm/non_matchings/code/z_scene/Scene_HeaderCmdRoomBehavior.s,Scene_HeaderCmdRoomBehavior,0x8012FB60,0x22 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMesh.s,Scene_HeaderCmdMesh,0x8012FBE8,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdObjectList.s,Scene_HeaderCmdObjectList,0x8012FC18,0x63 -asm/non_matchings/code/z_scene/Scene_HeaderCmdLightList.s,Scene_HeaderCmdLightList,0x8012FDA4,0x22 -asm/non_matchings/code/z_scene/Scene_HeaderCmdPathList.s,Scene_HeaderCmdPathList,0x8012FE2C,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdTransiActorList.s,Scene_HeaderCmdTransiActorList,0x8012FE5C,0x18 +asm/non_matchings/code/z_scene/Scene_CommandSpawnList.s,Scene_CommandSpawnList,0x8012F79C,0x5C +asm/non_matchings/code/z_scene/Scene_CommandActorList.s,Scene_CommandActorList,0x8012F90C,0x12 +asm/non_matchings/code/z_scene/Scene_CommandActorCutsceneCamList.s,Scene_CommandActorCutsceneCamList,0x8012F954,0xC +asm/non_matchings/code/z_scene/Scene_CommandCollisionHeader.s,Scene_CommandCollisionHeader,0x8012F984,0x28 +asm/non_matchings/code/z_scene/Scene_CommandRoomList.s,Scene_CommandRoomList,0x8012FA24,0x11 +asm/non_matchings/code/z_scene/Scene_CommandEntranceList.s,Scene_CommandEntranceList,0x8012FA68,0xC +asm/non_matchings/code/z_scene/Scene_CommandSpecialFiles.s,Scene_CommandSpecialFiles,0x8012FA98,0x32 +asm/non_matchings/code/z_scene/Scene_CommandRoomBehavior.s,Scene_CommandRoomBehavior,0x8012FB60,0x22 +asm/non_matchings/code/z_scene/Scene_CommandMesh.s,Scene_CommandMesh,0x8012FBE8,0xC +asm/non_matchings/code/z_scene/Scene_CommandObjectList.s,Scene_CommandObjectList,0x8012FC18,0x63 +asm/non_matchings/code/z_scene/Scene_CommandLightList.s,Scene_CommandLightList,0x8012FDA4,0x22 +asm/non_matchings/code/z_scene/Scene_CommandPathList.s,Scene_CommandPathList,0x8012FE2C,0xC +asm/non_matchings/code/z_scene/Scene_CommandTransiActorList.s,Scene_CommandTransiActorList,0x8012FE5C,0x18 asm/non_matchings/code/z_scene/Door_InitContext.s,Door_InitContext,0x8012FEBC,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEnvLightSettings.s,Scene_HeaderCmdEnvLightSettings,0x8012FECC,0x11 +asm/non_matchings/code/z_scene/Scene_CommandEnvLightSettings.s,Scene_CommandEnvLightSettings,0x8012FECC,0x11 asm/non_matchings/code/z_scene/Scene_LoadAreaTextures.s,Scene_LoadAreaTextures,0x8012FF10,0x1F -asm/non_matchings/code/z_scene/Scene_HeaderCmdSkyboxSettings.s,Scene_HeaderCmdSkyboxSettings,0x8012FF8C,0x19 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSkyboxDisables.s,Scene_HeaderCmdSkyboxDisables,0x8012FFF0,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdTimeSettings.s,Scene_HeaderCmdTimeSettings,0x80130018,0xC9 -asm/non_matchings/code/z_scene/Scene_HeaderCmdWindSettings.s,Scene_HeaderCmdWindSettings,0x8013033C,0x19 -asm/non_matchings/code/z_scene/Scene_HeaderCmdExitList.s,Scene_HeaderCmdExitList,0x801303A0,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmd09.s,Scene_HeaderCmd09,0x801303D0,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSoundSettings.s,Scene_HeaderCmdSoundSettings,0x801303E0,0x17 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEchoSetting.s,Scene_HeaderCmdEchoSetting,0x8013043C,0x6 -asm/non_matchings/code/z_scene/Scene_HeaderCmdAltHeaderList.s,Scene_HeaderCmdAltHeaderList,0x80130454,0x1E -asm/non_matchings/code/z_scene/Scene_HeaderCmdCutsceneList.s,Scene_HeaderCmdCutsceneList,0x801304CC,0xD -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneList.s,Scene_HeaderCmdActorCutsceneList,0x80130500,0x10 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMap.s,Scene_HeaderCmdMiniMap,0x80130540,0xE -asm/non_matchings/code/z_scene/Scene_HeaderCmd1D.s,Scene_HeaderCmd1D,0x80130578,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMapCompassInfo.s,Scene_HeaderCmdMiniMapCompassInfo,0x80130588,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdSetRegionVisitedFlag.s,Scene_HeaderCmdSetRegionVisitedFlag,0x801305B0,0x31 -asm/non_matchings/code/z_scene/Scene_HeaderCmdAnimatedMaterials.s,Scene_HeaderCmdAnimatedMaterials,0x80130674,0xC +asm/non_matchings/code/z_scene/Scene_CommandSkyboxSettings.s,Scene_CommandSkyboxSettings,0x8012FF8C,0x19 +asm/non_matchings/code/z_scene/Scene_CommandSkyboxDisables.s,Scene_CommandSkyboxDisables,0x8012FFF0,0xA +asm/non_matchings/code/z_scene/Scene_CommandTimeSettings.s,Scene_CommandTimeSettings,0x80130018,0xC9 +asm/non_matchings/code/z_scene/Scene_CommandWindSettings.s,Scene_CommandWindSettings,0x8013033C,0x19 +asm/non_matchings/code/z_scene/Scene_CommandExitList.s,Scene_CommandExitList,0x801303A0,0xC +asm/non_matchings/code/z_scene/Scene_Command09.s,Scene_Command09,0x801303D0,0x4 +asm/non_matchings/code/z_scene/Scene_CommandSoundSettings.s,Scene_CommandSoundSettings,0x801303E0,0x17 +asm/non_matchings/code/z_scene/Scene_CommandEchoSetting.s,Scene_CommandEchoSetting,0x8013043C,0x6 +asm/non_matchings/code/z_scene/Scene_CommandAltHeaderList.s,Scene_CommandAltHeaderList,0x80130454,0x1E +asm/non_matchings/code/z_scene/Scene_CommandCutsceneList.s,Scene_CommandCutsceneList,0x801304CC,0xD +asm/non_matchings/code/z_scene/Scene_CommandActorCutsceneList.s,Scene_CommandActorCutsceneList,0x80130500,0x10 +asm/non_matchings/code/z_scene/Scene_CommandMiniMap.s,Scene_CommandMiniMap,0x80130540,0xE +asm/non_matchings/code/z_scene/Scene_Command1D.s,Scene_Command1D,0x80130578,0x4 +asm/non_matchings/code/z_scene/Scene_CommandMiniMapCompassInfo.s,Scene_CommandMiniMapCompassInfo,0x80130588,0xA +asm/non_matchings/code/z_scene/Scene_CommandSetRegionVisitedFlag.s,Scene_CommandSetRegionVisitedFlag,0x801305B0,0x31 +asm/non_matchings/code/z_scene/Scene_CommandAnimatedMaterials.s,Scene_CommandAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11 -asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 +asm/non_matchings/code/z_scene/Scene_ExecuteCommands.s,Scene_ExecuteCommands,0x801306E8,0x20 asm/non_matchings/code/z_scene/Entrance_Create.s,Entrance_Create,0x80130768,0x7 asm/non_matchings/code/z_scene/Entrance_CreateFromSpawn.s,Entrance_CreateFromSpawn,0x80130784,0xF asm/non_matchings/code/z_scene_proc/Scene_Draw.s,Scene_Draw,0x801307C0,0xD @@ -2338,7 +2338,7 @@ asm/non_matchings/code/z_message/func_80147520.s,func_80147520,0x80147520,0x11 asm/non_matchings/code/z_message/func_80147564.s,func_80147564,0x80147564,0x30 asm/non_matchings/code/z_message/Message_ShouldAdvance.s,Message_ShouldAdvance,0x80147624,0x44 asm/non_matchings/code/z_message/Message_ShouldAdvanceSilent.s,Message_ShouldAdvanceSilent,0x80147734,0x20 -asm/non_matchings/code/z_message/func_801477B4.s,func_801477B4,0x801477B4,0x19 +asm/non_matchings/code/z_message/Message_CloseTextbox.s,Message_CloseTextbox,0x801477B4,0x19 asm/non_matchings/code/z_message/func_80147818.s,func_80147818,0x80147818,0x1C0 asm/non_matchings/code/z_message/func_80147F18.s,func_80147F18,0x80147F18,0x190 asm/non_matchings/code/z_message/func_80148558.s,func_80148558,0x80148558,0x190 @@ -2367,7 +2367,7 @@ asm/non_matchings/code/z_message/func_80150A84.s,func_80150A84,0x80150A84,0xA1 asm/non_matchings/code/z_message/func_80150D08.s,func_80150D08,0x80150D08,0x1EA asm/non_matchings/code/z_message/func_801514B0.s,func_801514B0,0x801514B0,0x100 asm/non_matchings/code/z_message/Message_StartTextbox.s,Message_StartTextbox,0x801518B0,0x22 -asm/non_matchings/code/z_message/func_80151938.s,func_80151938,0x80151938,0x4C +asm/non_matchings/code/z_message/Message_ContinueTextbox.s,Message_ContinueTextbox,0x80151938,0x4C asm/non_matchings/code/z_message/func_80151A68.s,func_80151A68,0x80151A68,0x53 asm/non_matchings/code/z_message/func_80151BB4.s,func_80151BB4,0x80151BB4,0x3A asm/non_matchings/code/z_message/func_80151C9C.s,func_80151C9C,0x80151C9C,0x42 @@ -2452,14 +2452,14 @@ asm/non_matchings/code/z_kaleido_scope_call/func_80163A58.s,func_80163A58,0x8016 asm/non_matchings/code/z_kaleido_scope_call/func_80163C0C.s,func_80163C0C,0x80163C0C,0x21 asm/non_matchings/code/z_fbdemo_dlftbls/Transition_Init.s,Transition_Init,0x80163C90,0x3C asm/non_matchings/code/z_fbdemo_dlftbls/Transition_Destroy.s,Transition_Destroy,0x80163D80,0x10 -asm/non_matchings/code/z_fbdemo/func_80163DC0.s,func_80163DC0,0x80163DC0,0xF3 -asm/non_matchings/code/z_fbdemo/func_8016418C.s,func_8016418C,0x8016418C,0x30 -asm/non_matchings/code/z_fbdemo/TransitionUnk_Destroy.s,TransitionUnk_Destroy,0x8016424C,0x23 -asm/non_matchings/code/z_fbdemo/TransitionUnk_Init.s,TransitionUnk_Init,0x801642D8,0x58 -asm/non_matchings/code/z_fbdemo/func_80164438.s,func_80164438,0x80164438,0x45 -asm/non_matchings/code/z_fbdemo/TransitionUnk_Draw.s,TransitionUnk_Draw,0x8016454C,0x4B -asm/non_matchings/code/z_fbdemo/func_80164678.s,func_80164678,0x80164678,0x4D -asm/non_matchings/code/z_fbdemo/func_801647AC.s,func_801647AC,0x801647AC,0x3 +asm/non_matchings/code/z_fbdemo/TransitionTile_InitGraphics.s,TransitionTile_InitGraphics,0x80163DC0,0xF3 +asm/non_matchings/code/z_fbdemo/TransitionTile_InitVtxData.s,TransitionTile_InitVtxData,0x8016418C,0x30 +asm/non_matchings/code/z_fbdemo/TransitionTile_Destroy.s,TransitionTile_Destroy,0x8016424C,0x23 +asm/non_matchings/code/z_fbdemo/TransitionTile_Init.s,TransitionTile_Init,0x801642D8,0x58 +asm/non_matchings/code/z_fbdemo/TransitionTile_SetVtx.s,TransitionTile_SetVtx,0x80164438,0x45 +asm/non_matchings/code/z_fbdemo/TransitionTile_Draw.s,TransitionTile_Draw,0x8016454C,0x4B +asm/non_matchings/code/z_fbdemo/TransitionTile_Suck.s,TransitionTile_Suck,0x80164678,0x4D +asm/non_matchings/code/z_fbdemo/TransitionTile_Update.s,TransitionTile_Update,0x801647AC,0x3 asm/non_matchings/code/z_fbdemo/func_801647B8.s,func_801647B8,0x801647B8,0x6 asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Start.s,TransitionFade_Start,0x801647D0,0x17 asm/non_matchings/code/z_fbdemo_fade/TransitionFade_Init.s,TransitionFade_Init,0x8016482C,0xB @@ -2546,7 +2546,7 @@ asm/non_matchings/code/z_play/func_80169ECC.s,func_80169ECC,0x80169ECC,0xC asm/non_matchings/code/z_play/func_80169EFC.s,func_80169EFC,0x80169EFC,0x1F asm/non_matchings/code/z_play/func_80169F78.s,func_80169F78,0x80169F78,0x19 asm/non_matchings/code/z_play/func_80169FDC.s,func_80169FDC,0x80169FDC,0x8 -asm/non_matchings/code/z_play/func_80169FFC.s,func_80169FFC,0x80169FFC,0x8 +asm/non_matchings/code/z_play/Play_CamIsNotFixed.s,Play_CamIsNotFixed,0x80169FFC,0x8 asm/non_matchings/code/z_play/FrameAdvance_IsEnabled.s,FrameAdvance_IsEnabled,0x8016A01C,0x4 asm/non_matchings/code/z_play/func_8016A02C.s,func_8016A02C,0x8016A02C,0x20 asm/non_matchings/code/z_play/Play_IsUnderwater.s,Play_IsUnderwater,0x8016A0AC,0x2F @@ -2593,43 +2593,43 @@ asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyInit.s,PreRender_Ap asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyDestroy.s,PreRender_ApplyFiltersSlowlyDestroy,0x80172078,0x13 asm/non_matchings/code/PreRender/func_801720C4.s,func_801720C4,0x801720C4,0xE asm/non_matchings/code/PreRender/func_801720FC.s,func_801720FC,0x801720FC,0x197 -asm/non_matchings/code/PreRender/func_80172758.s,func_80172758,0x80172758,0x26 -asm/non_matchings/code/TwoHeadGfxArena/THGA_Ct.s,THGA_Ct,0x801727F0,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_Dt.s,THGA_Dt,0x80172810,0x8 +asm/non_matchings/code/PreRender/Prerender_DrawBackground2D.s,Prerender_DrawBackground2D,0x80172758,0x26 +asm/non_matchings/code/TwoHeadGfxArena/THGA_Init.s,THGA_Init,0x801727F0,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_Destroy.s,THGA_Destroy,0x80172810,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_IsCrash.s,THGA_IsCrash,0x80172830,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_Init.s,THGA_Init,0x80172850,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_GetSize.s,THGA_GetSize,0x80172870,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_GetRemaining.s,THGA_GetRemaining,0x80172870,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_GetHead.s,THGA_GetHead,0x80172890,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_SetHead.s,THGA_SetHead,0x801728B0,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_GetTail.s,THGA_GetTail,0x801728D0,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStartArray8.s,THGA_AllocStartArray8,0x801728F0,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStart8.s,THGA_AllocStart8,0x80172914,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStart8Wrapper.s,THGA_AllocStart8Wrapper,0x80172934,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd.s,THGA_AllocEnd,0x80172954,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEndArray64.s,THGA_AllocEndArray64,0x80172974,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd64.s,THGA_AllocEnd64,0x80172998,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEndArray16.s,THGA_AllocEndArray16,0x801729B8,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd16.s,THGA_AllocEnd16,0x801729DC,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocDisplayList.s,THGA_AllocDisplayList,0x801728F0,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocGfx.s,THGA_AllocGfx,0x80172914,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocGfx2.s,THGA_AllocGfx2,0x80172934,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocTail.s,THGA_AllocTail,0x80172954,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocMtxArray.s,THGA_AllocMtxArray,0x80172974,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocMtx.s,THGA_AllocMtx,0x80172998,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocVtxArray.s,THGA_AllocVtxArray,0x801729B8,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocVtx.s,THGA_AllocVtx,0x801729DC,0x9 asm/non_matchings/code/TwoHeadArena/THA_GetHead.s,THA_GetHead,0x80172A00,0x3 asm/non_matchings/code/TwoHeadArena/THA_SetHead.s,THA_SetHead,0x80172A0C,0x3 asm/non_matchings/code/TwoHeadArena/THA_GetTail.s,THA_GetTail,0x80172A18,0x3 -asm/non_matchings/code/TwoHeadArena/THA_AllocStart.s,THA_AllocStart,0x80172A24,0x5 -asm/non_matchings/code/TwoHeadArena/THA_AllocStart1.s,THA_AllocStart1,0x80172A38,0x8 -asm/non_matchings/code/TwoHeadArena/THA_AllocEnd.s,THA_AllocEnd,0x80172A58,0x1C -asm/non_matchings/code/TwoHeadArena/THA_AllocEndAlign16.s,THA_AllocEndAlign16,0x80172AC8,0x8 -asm/non_matchings/code/TwoHeadArena/THA_AllocEndAlign.s,THA_AllocEndAlign,0x80172AE8,0x7 -asm/non_matchings/code/TwoHeadArena/THA_GetSize.s,THA_GetSize,0x80172B04,0x5 +asm/non_matchings/code/TwoHeadArena/THA_AllocHead.s,THA_AllocHead,0x80172A24,0x5 +asm/non_matchings/code/TwoHeadArena/THA_AllocHeadByte.s,THA_AllocHeadByte,0x80172A38,0x8 +asm/non_matchings/code/TwoHeadArena/THA_AllocTail.s,THA_AllocTail,0x80172A58,0x1C +asm/non_matchings/code/TwoHeadArena/THA_AllocTailAlign16.s,THA_AllocTailAlign16,0x80172AC8,0x8 +asm/non_matchings/code/TwoHeadArena/THA_AllocTailAlign.s,THA_AllocTailAlign,0x80172AE8,0x7 +asm/non_matchings/code/TwoHeadArena/THA_GetRemaining.s,THA_GetRemaining,0x80172B04,0x5 asm/non_matchings/code/TwoHeadArena/THA_IsCrash.s,THA_IsCrash,0x80172B18,0x9 -asm/non_matchings/code/TwoHeadArena/THA_Init.s,THA_Init,0x80172B3C,0x7 -asm/non_matchings/code/TwoHeadArena/THA_Ct.s,THA_Ct,0x80172B58,0x11 -asm/non_matchings/code/TwoHeadArena/THA_Dt.s,THA_Dt,0x80172B9C,0x9 -asm/non_matchings/code/code_80172BC0/AudioMgr_StopAllSfxExceptSystem.s,AudioMgr_StopAllSfxExceptSystem,0x80172BC0,0x1C -asm/non_matchings/code/audioMgr/func_80172C30.s,func_80172C30,0x80172C30,0xE -asm/non_matchings/code/audioMgr/AudioMgr_HandleRetrace.s,AudioMgr_HandleRetrace,0x80172C68,0x91 -asm/non_matchings/code/audioMgr/AudioMgr_HandlePRENMI.s,AudioMgr_HandlePRENMI,0x80172EAC,0x9 -asm/non_matchings/code/audioMgr/AudioMgr_ThreadEntry.s,AudioMgr_ThreadEntry,0x80172ED0,0x5E -asm/non_matchings/code/audioMgr/AudioMgr_Unlock.s,AudioMgr_Unlock,0x80173048,0xB -asm/non_matchings/code/audioMgr/AudioMgr_Init.s,AudioMgr_Init,0x80173074,0x2F +asm/non_matchings/code/TwoHeadArena/THA_Reset.s,THA_Reset,0x80172B3C,0x7 +asm/non_matchings/code/TwoHeadArena/THA_Init.s,THA_Init,0x80172B58,0x11 +asm/non_matchings/code/TwoHeadArena/THA_Destroy.s,THA_Destroy,0x80172B9C,0x9 +asm/non_matchings/code/audio_stop_all_sfx/AudioMgr_StopAllSfxExceptSystem.s,AudioMgr_StopAllSfxExceptSystem,0x80172BC0,0x1C +asm/non_matchings/code/audio_thread_manager/func_80172C30.s,func_80172C30,0x80172C30,0xE +asm/non_matchings/code/audio_thread_manager/AudioMgr_HandleRetrace.s,AudioMgr_HandleRetrace,0x80172C68,0x91 +asm/non_matchings/code/audio_thread_manager/AudioMgr_HandlePRENMI.s,AudioMgr_HandlePRENMI,0x80172EAC,0x9 +asm/non_matchings/code/audio_thread_manager/AudioMgr_ThreadEntry.s,AudioMgr_ThreadEntry,0x80172ED0,0x5E +asm/non_matchings/code/audio_thread_manager/AudioMgr_Unlock.s,AudioMgr_Unlock,0x80173048,0xB +asm/non_matchings/code/audio_thread_manager/AudioMgr_Init.s,AudioMgr_Init,0x80173074,0x2F asm/non_matchings/code/title_setup/Setup_SetRegs.s,Setup_SetRegs,0x80173130,0x6B asm/non_matchings/code/title_setup/Setup_InitImpl.s,Setup_InitImpl,0x801732DC,0x14 asm/non_matchings/code/title_setup/Setup_Destroy.s,Setup_Destroy,0x8017332C,0x3 @@ -2662,7 +2662,7 @@ asm/non_matchings/code/graph/Graph_FaultClient.s,Graph_FaultClient,0x80173D30,0x asm/non_matchings/code/graph/Graph_InitTHGA.s,Graph_InitTHGA,0x80173DAC,0x8 asm/non_matchings/code/graph/Graph_SetNextGfxPool.s,Graph_SetNextGfxPool,0x80173DCC,0x73 asm/non_matchings/code/graph/Graph_GetNextGameState.s,Graph_GetNextGameState,0x80173F98,0x32 -asm/non_matchings/code/graph/Graph_FaultAddrConvFunc.s,Graph_FaultAddrConvFunc,0x80174060,0x1C +asm/non_matchings/code/graph/Graph_FaultAddrConv.s,Graph_FaultAddrConv,0x80174060,0x1C asm/non_matchings/code/graph/Graph_Init.s,Graph_Init,0x801740D0,0x29 asm/non_matchings/code/graph/Graph_Destroy.s,Graph_Destroy,0x80174174,0xD asm/non_matchings/code/graph/Graph_TaskSet00.s,Graph_TaskSet00,0x801741A8,0xC1 @@ -2959,8 +2959,8 @@ asm/non_matchings/code/c_keyframe/func_801853C8.s,func_801853C8,0x801853C8,0x26 asm/non_matchings/code/c_keyframe/func_80185460.s,func_80185460,0x80185460,0x80 asm/non_matchings/code/sys_slowly/Slowly_Main.s,Slowly_Main,0x80185660,0x27 asm/non_matchings/code/sys_slowly/Slowly_ThreadEntry.s,Slowly_ThreadEntry,0x801856FC,0x8 -asm/non_matchings/code/sys_slowly/Slowly_Start.s,Slowly_Start,0x8018571C,0x21 -asm/non_matchings/code/sys_slowly/Slowly_Stop.s,Slowly_Stop,0x801857A0,0x8 +asm/non_matchings/code/sys_slowly/Slowly_Init.s,Slowly_Init,0x8018571C,0x21 +asm/non_matchings/code/sys_slowly/Slowly_Destroy.s,Slowly_Destroy,0x801857A0,0x8 asm/non_matchings/code/sys_flashrom/func_801857C0.s,func_801857C0,0x801857C0,0x4 asm/non_matchings/code/sys_flashrom/func_801857D0.s,func_801857D0,0x801857D0,0x25 asm/non_matchings/code/sys_flashrom/func_80185864.s,func_80185864,0x80185864,0x29 @@ -3283,42 +3283,42 @@ asm/non_matchings/code/audio_effects/AudioEffects_NoteVibratoInit.s,AudioEffects asm/non_matchings/code/audio_effects/AudioEffects_NotePortamentoInit.s,AudioEffects_NotePortamentoInit,0x80197138,0xB asm/non_matchings/code/audio_effects/AudioEffects_AdsrInit.s,AudioEffects_AdsrInit,0x80197164,0x9 asm/non_matchings/code/audio_effects/AudioEffects_AdsrUpdate.s,AudioEffects_AdsrUpdate,0x80197188,0xD2 -asm/non_matchings/code/audio_seqplayer/AudioSeq_GetScriptControlFlowArgument.s,AudioSeq_GetScriptControlFlowArgument,0x801974D0,0x1A -asm/non_matchings/code/audio_seqplayer/AudioSeq_HandleScriptFlowControl.s,AudioSeq_HandleScriptFlowControl,0x80197538,0x77 -asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequenceChannel.s,AudioSeq_InitSequenceChannel,0x80197714,0x5B -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqChannelSetLayer.s,AudioSeq_SeqChannelSetLayer,0x80197880,0x56 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerDisable.s,AudioSeq_SeqLayerDisable,0x801979D8,0x1F -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerFree.s,AudioSeq_SeqLayerFree,0x80197A54,0x14 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelDisable.s,AudioSeq_SequenceChannelDisable,0x80197AA4,0x1C -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerSetupChannels.s,AudioSeq_SequencePlayerSetupChannels,0x80197B14,0x3E -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisableChannels.s,AudioSeq_SequencePlayerDisableChannels,0x80197C0C,0x20 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelEnable.s,AudioSeq_SequenceChannelEnable,0x80197C8C,0x26 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisableAsFinished.s,AudioSeq_SequencePlayerDisableAsFinished,0x80197D24,0xA -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisable.s,AudioSeq_SequencePlayerDisable,0x80197D4C,0x2F -asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPushBack.s,AudioSeq_AudioListPushBack,0x80197E08,0x10 -asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPopBack.s,AudioSeq_AudioListPopBack,0x80197E48,0x10 -asm/non_matchings/code/audio_seqplayer/AudioSeq_InitLayerFreelist.s,AudioSeq_InitLayerFreelist,0x80197E88,0x28 -asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadU8.s,AudioSeq_ScriptReadU8,0x80197F28,0x5 -asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadS16.s,AudioSeq_ScriptReadS16,0x80197F3C,0xE -asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadCompressedU16.s,AudioSeq_ScriptReadCompressedU16,0x80197F74,0x10 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScript.s,AudioSeq_SeqLayerProcessScript,0x80197FB4,0x47 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep1.s,AudioSeq_SeqLayerProcessScriptStep1,0x801980D0,0x23 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep5.s,AudioSeq_SeqLayerProcessScriptStep5,0x8019815C,0x40 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep2.s,AudioSeq_SeqLayerProcessScriptStep2,0x8019825C,0xF9 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep4.s,AudioSeq_SeqLayerProcessScriptStep4,0x80198640,0x1A8 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep3.s,AudioSeq_SeqLayerProcessScriptStep3,0x80198CE0,0x105 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SetChannelPriorities.s,AudioSeq_SetChannelPriorities,0x801990F4,0xC -asm/non_matchings/code/audio_seqplayer/AudioSeq_GetInstrument.s,AudioSeq_GetInstrument,0x80199124,0x1D -asm/non_matchings/code/audio_seqplayer/AudioSeq_SetInstrument.s,AudioSeq_SetInstrument,0x80199198,0x2B -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelSetVolume.s,AudioSeq_SequenceChannelSetVolume,0x80199244,0x9 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelProcessScript.s,AudioSeq_SequenceChannelProcessScript,0x80199268,0x395 -asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerProcessSequence.s,AudioSeq_SequencePlayerProcessSequence,0x8019A0BC,0x260 -asm/non_matchings/code/audio_seqplayer/AudioSeq_ProcessSequences.s,AudioSeq_ProcessSequences,0x8019AA3C,0x2D -asm/non_matchings/code/audio_seqplayer/AudioSeq_SkipForwardSequence.s,AudioSeq_SkipForwardSequence,0x8019AAF0,0x14 -asm/non_matchings/code/audio_seqplayer/AudioSeq_ResetSequencePlayer.s,AudioSeq_ResetSequencePlayer,0x8019AB40,0x34 -asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayerChannels.s,AudioSeq_InitSequencePlayerChannels,0x8019AC10,0x37 -asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayer.s,AudioSeq_InitSequencePlayer,0x8019ACEC,0x34 -asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayers.s,AudioSeq_InitSequencePlayers,0x8019ADBC,0x21 +asm/non_matchings/code/audio_seqplayer/AudioScript_GetScriptControlFlowArgument.s,AudioScript_GetScriptControlFlowArgument,0x801974D0,0x1A +asm/non_matchings/code/audio_seqplayer/AudioScript_HandleScriptFlowControl.s,AudioScript_HandleScriptFlowControl,0x80197538,0x77 +asm/non_matchings/code/audio_seqplayer/AudioScript_InitSequenceChannel.s,AudioScript_InitSequenceChannel,0x80197714,0x5B +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqChannelSetLayer.s,AudioScript_SeqChannelSetLayer,0x80197880,0x56 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerDisable.s,AudioScript_SeqLayerDisable,0x801979D8,0x1F +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerFree.s,AudioScript_SeqLayerFree,0x80197A54,0x14 +asm/non_matchings/code/audio_seqplayer/AudioScript_SequenceChannelDisable.s,AudioScript_SequenceChannelDisable,0x80197AA4,0x1C +asm/non_matchings/code/audio_seqplayer/AudioScript_SequencePlayerSetupChannels.s,AudioScript_SequencePlayerSetupChannels,0x80197B14,0x3E +asm/non_matchings/code/audio_seqplayer/AudioScript_SequencePlayerDisableChannels.s,AudioScript_SequencePlayerDisableChannels,0x80197C0C,0x20 +asm/non_matchings/code/audio_seqplayer/AudioScript_SequenceChannelEnable.s,AudioScript_SequenceChannelEnable,0x80197C8C,0x26 +asm/non_matchings/code/audio_seqplayer/AudioScript_SequencePlayerDisableAsFinished.s,AudioScript_SequencePlayerDisableAsFinished,0x80197D24,0xA +asm/non_matchings/code/audio_seqplayer/AudioScript_SequencePlayerDisable.s,AudioScript_SequencePlayerDisable,0x80197D4C,0x2F +asm/non_matchings/code/audio_seqplayer/AudioScript_AudioListPushBack.s,AudioScript_AudioListPushBack,0x80197E08,0x10 +asm/non_matchings/code/audio_seqplayer/AudioScript_AudioListPopBack.s,AudioScript_AudioListPopBack,0x80197E48,0x10 +asm/non_matchings/code/audio_seqplayer/AudioScript_InitLayerFreelist.s,AudioScript_InitLayerFreelist,0x80197E88,0x28 +asm/non_matchings/code/audio_seqplayer/AudioScript_ScriptReadU8.s,AudioScript_ScriptReadU8,0x80197F28,0x5 +asm/non_matchings/code/audio_seqplayer/AudioScript_ScriptReadS16.s,AudioScript_ScriptReadS16,0x80197F3C,0xE +asm/non_matchings/code/audio_seqplayer/AudioScript_ScriptReadCompressedU16.s,AudioScript_ScriptReadCompressedU16,0x80197F74,0x10 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScript.s,AudioScript_SeqLayerProcessScript,0x80197FB4,0x47 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScriptStep1.s,AudioScript_SeqLayerProcessScriptStep1,0x801980D0,0x23 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScriptStep5.s,AudioScript_SeqLayerProcessScriptStep5,0x8019815C,0x40 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScriptStep2.s,AudioScript_SeqLayerProcessScriptStep2,0x8019825C,0xF9 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScriptStep4.s,AudioScript_SeqLayerProcessScriptStep4,0x80198640,0x1A8 +asm/non_matchings/code/audio_seqplayer/AudioScript_SeqLayerProcessScriptStep3.s,AudioScript_SeqLayerProcessScriptStep3,0x80198CE0,0x105 +asm/non_matchings/code/audio_seqplayer/AudioScript_SetChannelPriorities.s,AudioScript_SetChannelPriorities,0x801990F4,0xC +asm/non_matchings/code/audio_seqplayer/AudioScript_GetInstrument.s,AudioScript_GetInstrument,0x80199124,0x1D +asm/non_matchings/code/audio_seqplayer/AudioScript_SetInstrument.s,AudioScript_SetInstrument,0x80199198,0x2B +asm/non_matchings/code/audio_seqplayer/AudioScript_SequenceChannelSetVolume.s,AudioScript_SequenceChannelSetVolume,0x80199244,0x9 +asm/non_matchings/code/audio_seqplayer/AudioScript_SequenceChannelProcessScript.s,AudioScript_SequenceChannelProcessScript,0x80199268,0x395 +asm/non_matchings/code/audio_seqplayer/AudioScript_SequencePlayerProcessSequence.s,AudioScript_SequencePlayerProcessSequence,0x8019A0BC,0x260 +asm/non_matchings/code/audio_seqplayer/AudioScript_ProcessSequences.s,AudioScript_ProcessSequences,0x8019AA3C,0x2D +asm/non_matchings/code/audio_seqplayer/AudioScript_SkipForwardSequence.s,AudioScript_SkipForwardSequence,0x8019AAF0,0x14 +asm/non_matchings/code/audio_seqplayer/AudioScript_ResetSequencePlayer.s,AudioScript_ResetSequencePlayer,0x8019AB40,0x34 +asm/non_matchings/code/audio_seqplayer/AudioScript_InitSequencePlayerChannels.s,AudioScript_InitSequencePlayerChannels,0x8019AC10,0x37 +asm/non_matchings/code/audio_seqplayer/AudioScript_InitSequencePlayer.s,AudioScript_InitSequencePlayer,0x8019ACEC,0x34 +asm/non_matchings/code/audio_seqplayer/AudioScript_InitSequencePlayers.s,AudioScript_InitSequencePlayers,0x8019ADBC,0x21 asm/non_matchings/code/code_8019AE40/func_8019AE40.s,func_8019AE40,0x8019AE40,0x1C asm/non_matchings/code/code_8019AEC0/func_8019AEC0.s,func_8019AEC0,0x8019AEC0,0x10 asm/non_matchings/code/code_8019AF00/AudioOcarina_ReadControllerInput.s,AudioOcarina_ReadControllerInput,0x8019AF00,0x16 @@ -3373,7 +3373,7 @@ asm/non_matchings/code/code_8019AF00/Audio_Noop3.s,Audio_Noop3,0x8019E00C,0x2 asm/non_matchings/code/code_8019AF00/Audio_Update.s,Audio_Update,0x8019E014,0x3A asm/non_matchings/code/code_8019AF00/Audio_Noop4.s,Audio_Noop4,0x8019E0FC,0x2 asm/non_matchings/code/code_8019AF00/Audio_Noop5.s,Audio_Noop5,0x8019E104,0x3 -asm/non_matchings/code/code_8019AF00/func_8019E110.s,func_8019E110,0x8019E110,0xF +asm/non_matchings/code/code_8019AF00/Audio_PlayMainBgm.s,Audio_PlayMainBgm,0x8019E110,0xF asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeVolume.s,AudioSfx_ComputeVolume,0x8019E14C,0x76 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeReverb.s,AudioSfx_ComputeReverb,0x8019E324,0x63 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputePanSigned.s,AudioSfx_ComputePanSigned,0x8019E4B0,0x61 @@ -3417,10 +3417,10 @@ asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForRiver.s,Audio_PlaySfxForRiv asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForWaterfall.s,Audio_PlaySfxForWaterfall,0x801A0048,0x29 asm/non_matchings/code/code_8019AF00/Audio_StepFreqLerp.s,Audio_StepFreqLerp,0x801A00EC,0xE asm/non_matchings/code/code_8019AF00/func_801A0124.s,func_801A0124,0x801A0124,0x18 -asm/non_matchings/code/code_8019AF00/func_801A0184.s,func_801A0184,0x801A0184,0x10 -asm/non_matchings/code/code_8019AF00/func_801A01C4.s,func_801A01C4,0x801A01C4,0x10 +asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOff.s,Audio_SetBgmVolumeOff,0x801A0184,0x10 +asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOn.s,Audio_SetBgmVolumeOn,0x801A01C4,0x10 asm/non_matchings/code/code_8019AF00/func_801A0204.s,func_801A0204,0x801A0204,0xD -asm/non_matchings/code/code_8019AF00/func_801A0238.s,func_801A0238,0x801A0238,0xD +asm/non_matchings/code/code_8019AF00/Audio_SetMainBgmVolume.s,Audio_SetMainBgmVolume,0x801A0238,0xD asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolumeLevel.s,Audio_SetGanonsTowerBgmVolumeLevel,0x801A026C,0x2B asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolume.s,Audio_SetGanonsTowerBgmVolume,0x801A0318,0x4E asm/non_matchings/code/code_8019AF00/Audio_LowerMainBgmVolume.s,Audio_LowerMainBgmVolume,0x801A0450,0x7 @@ -3459,12 +3459,12 @@ asm/non_matchings/code/code_8019AF00/Audio_StartMorningSceneSequence.s,Audio_Sta asm/non_matchings/code/code_8019AF00/Audio_PlaySceneSequence.s,Audio_PlaySceneSequence,0x801A25E4,0x23 asm/non_matchings/code/code_8019AF00/Audio_StartSceneSequence.s,Audio_StartSceneSequence,0x801A2670,0x42 asm/non_matchings/code/code_8019AF00/Audio_UpdateSceneSequenceResumePoint.s,Audio_UpdateSceneSequenceResumePoint,0x801A2778,0x1C -asm/non_matchings/code/code_8019AF00/func_801A27E8.s,func_801A27E8,0x801A27E8,0xD -asm/non_matchings/code/code_8019AF00/func_801A281C.s,func_801A281C,0x801A281C,0x6E -asm/non_matchings/code/code_8019AF00/func_801A29D4.s,func_801A29D4,0x801A29D4,0x79 -asm/non_matchings/code/code_8019AF00/func_801A2BB8.s,func_801A2BB8,0x801A2BB8,0x1A -asm/non_matchings/code/code_8019AF00/func_801A2C20.s,func_801A2C20,0x801A2C20,0x9 -asm/non_matchings/code/code_8019AF00/func_801A2C44.s,func_801A2C44,0x801A2C44,0x11 +asm/non_matchings/code/code_8019AF00/Audio_PlayBgmForSongOfStorms.s,Audio_PlayBgmForSongOfStorms,0x801A27E8,0xD +asm/non_matchings/code/code_8019AF00/Audio_ScaleTempoAndFreqForMainBgm.s,Audio_ScaleTempoAndFreqForMainBgm,0x801A281C,0x6E +asm/non_matchings/code/code_8019AF00/Audio_SetSeqTempoAndFreq.s,Audio_SetSeqTempoAndFreq,0x801A29D4,0x79 +asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgm.s,Audio_PlaySubBgm,0x801A2BB8,0x1A +asm/non_matchings/code/code_8019AF00/Audio_StopSubBgm.s,Audio_StopSubBgm,0x801A2C20,0x9 +asm/non_matchings/code/code_8019AF00/Audio_IncreaseTempoForTimedMinigame.s,Audio_IncreaseTempoForTimedMinigame,0x801A2C44,0x11 asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceInCutscene.s,Audio_PlaySequenceInCutscene,0x801A2C88,0x33 asm/non_matchings/code/code_8019AF00/Audio_StopSequenceInCutscene.s,Audio_StopSequenceInCutscene,0x801A2D54,0x23 asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s,Audio_IsSequencePlaying,0x801A2DE0,0x1D @@ -3510,7 +3510,7 @@ asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBan asm/non_matchings/code/code_8019AF00/func_801A4428.s,func_801A4428,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 asm/non_matchings/code/code_8019AF00/Audio_ResetRequestedSceneSeqId.s,Audio_ResetRequestedSceneSeqId,0x801A44C4,0x4 -asm/non_matchings/code/code_8019AF00/func_801A44D4.s,func_801A44D4,0x801A44D4,0x89 +asm/non_matchings/code/code_8019AF00/Audio_ResetData.s,Audio_ResetData,0x801A44D4,0x89 asm/non_matchings/code/code_8019AF00/func_801A46F8.s,func_801A46F8,0x801A46F8,0x14 asm/non_matchings/code/code_8019AF00/func_801A4748.s,func_801A4748,0x801A4748,0x15 asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x10 @@ -3520,32 +3520,32 @@ asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience.s,Audio_PlayAmbience,0x8 asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceRandomBend.s,Audio_SetAmbienceRandomBend,0x801A4B80,0x2C asm/non_matchings/code/code_8019AF00/Audio_Init.s,Audio_Init,0x801A4C30,0x9 asm/non_matchings/code/code_8019AF00/AudioSfx_Init.s,AudioSfx_Init,0x801A4C54,0x2B -asm/non_matchings/code/code_8019AF00/func_801A4D00.s,func_801A4D00,0x801A4D00,0x14 -asm/non_matchings/code/code_8019AF00/func_801A4D50.s,func_801A4D50,0x801A4D50,0x15 -asm/non_matchings/code/code_8019AF00/func_801A4DA4.s,func_801A4DA4,0x801A4DA4,0x14 -asm/non_matchings/code/code_8019AF00/func_801A4DF4.s,func_801A4DF4,0x801A4DF4,0x1C -asm/non_matchings/code/code_8019AF00/func_801A4E64.s,func_801A4E64,0x801A4E64,0x13 -asm/non_matchings/code/code_8019AF00/func_801A4EB0.s,func_801A4EB0,0x801A4EB0,0x2 -asm/non_matchings/code/code_8019AF00/func_801A4EB8.s,func_801A4EB8,0x801A4EB8,0x48 -asm/non_matchings/code/code_8019AF00/func_801A4FD8.s,func_801A4FD8,0x801A4FD8,0x2A -asm/non_matchings/code/code_8019AF00/func_801A5080.s,func_801A5080,0x801A5080,0x10 -asm/non_matchings/code/code_8019AF00/func_801A50C0.s,func_801A50C0,0x801A50C0,0x10 -asm/non_matchings/code/code_8019AF00/func_801A5100.s,func_801A5100,0x801A5100,0x3 -asm/non_matchings/code/code_8019AF00/func_801A510C.s,func_801A510C,0x801A510C,0x3 -asm/non_matchings/code/code_8019AF00/func_801A5118.s,func_801A5118,0x801A5118,0x36 -asm/non_matchings/code/code_801A51F0/func_801A51F0.s,func_801A51F0,0x801A51F0,0xE -asm/non_matchings/code/code_801A51F0/func_801A5228.s,func_801A5228,0x801A5228,0x5A -asm/non_matchings/code/code_801A51F0/func_801A5390.s,func_801A5390,0x801A5390,0x13 -asm/non_matchings/code/code_801A51F0/func_801A53DC.s,func_801A53DC,0x801A53DC,0x3 -asm/non_matchings/code/code_801A51F0/func_801A53E8.s,func_801A53E8,0x801A53E8,0xD -asm/non_matchings/code/code_801A51F0/func_801A541C.s,func_801A541C,0x801A541C,0x1B -asm/non_matchings/code/code_801A51F0/func_801A5488.s,func_801A5488,0x801A5488,0xF -asm/non_matchings/code/code_801A51F0/func_801A54C4.s,func_801A54C4,0x801A54C4,0x3 -asm/non_matchings/code/code_801A51F0/func_801A54D0.s,func_801A54D0,0x801A54D0,0x6C -asm/non_matchings/code/code_801A51F0/func_801A5680.s,func_801A5680,0x801A5680,0x62 -asm/non_matchings/code/code_801A51F0/func_801A5808.s,func_801A5808,0x801A5808,0x82 -asm/non_matchings/code/code_801A51F0/func_801A5A10.s,func_801A5A10,0x801A5A10,0x3 -asm/non_matchings/code/code_801A51F0/func_801A5A1C.s,func_801A5A1C,0x801A5A1C,0x69 +asm/non_matchings/code/code_8019AF00/Audio_InitSound.s,Audio_InitSound,0x801A4D00,0x14 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep3.s,Audio_ResetForAudioHeapStep3,0x801A4D50,0x15 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep2.s,Audio_ResetForAudioHeapStep2,0x801A4DA4,0x14 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep1.s,Audio_ResetForAudioHeapStep1,0x801A4DF4,0x1C +asm/non_matchings/code/code_8019AF00/Audio_UnusedReset.s,Audio_UnusedReset,0x801A4E64,0x13 +asm/non_matchings/code/voice_external/func_801A4EB0.s,func_801A4EB0,0x801A4EB0,0x2 +asm/non_matchings/code/voice_external/func_801A4EB8.s,func_801A4EB8,0x801A4EB8,0x48 +asm/non_matchings/code/voice_external/func_801A4FD8.s,func_801A4FD8,0x801A4FD8,0x2A +asm/non_matchings/code/voice_external/func_801A5080.s,func_801A5080,0x801A5080,0x10 +asm/non_matchings/code/voice_external/func_801A50C0.s,func_801A50C0,0x801A50C0,0x10 +asm/non_matchings/code/voice_external/func_801A5100.s,func_801A5100,0x801A5100,0x3 +asm/non_matchings/code/voice_external/func_801A510C.s,func_801A510C,0x801A510C,0x3 +asm/non_matchings/code/voice_external/func_801A5118.s,func_801A5118,0x801A5118,0x36 +asm/non_matchings/code/voice_internal/func_801A51F0.s,func_801A51F0,0x801A51F0,0xE +asm/non_matchings/code/voice_internal/func_801A5228.s,func_801A5228,0x801A5228,0x5A +asm/non_matchings/code/voice_internal/func_801A5390.s,func_801A5390,0x801A5390,0x13 +asm/non_matchings/code/voice_internal/func_801A53DC.s,func_801A53DC,0x801A53DC,0x3 +asm/non_matchings/code/voice_internal/func_801A53E8.s,func_801A53E8,0x801A53E8,0xD +asm/non_matchings/code/voice_internal/func_801A541C.s,func_801A541C,0x801A541C,0x1B +asm/non_matchings/code/voice_internal/func_801A5488.s,func_801A5488,0x801A5488,0xF +asm/non_matchings/code/voice_internal/func_801A54C4.s,func_801A54C4,0x801A54C4,0x3 +asm/non_matchings/code/voice_internal/func_801A54D0.s,func_801A54D0,0x801A54D0,0x6C +asm/non_matchings/code/voice_internal/func_801A5680.s,func_801A5680,0x801A5680,0x62 +asm/non_matchings/code/voice_internal/func_801A5808.s,func_801A5808,0x801A5808,0x82 +asm/non_matchings/code/voice_internal/AudioVoice_ResetData.s,AudioVoice_ResetData,0x801A5A10,0x3 +asm/non_matchings/code/voice_internal/func_801A5A1C.s,func_801A5A1C,0x801A5A1C,0x69 asm/non_matchings/code/code_801A5BD0/AudioSfx_MuteBanks.s,AudioSfx_MuteBanks,0x801A5BD0,0x16 asm/non_matchings/code/code_801A5BD0/AudioSfx_LowerBgmVolume.s,AudioSfx_LowerBgmVolume,0x801A5C28,0x19 asm/non_matchings/code/code_801A5BD0/AudioSfx_RestoreBgmVolume.s,AudioSfx_RestoreBgmVolume,0x801A5C8C,0x1C @@ -3568,21 +3568,21 @@ asm/non_matchings/code/code_801A5BD0/AudioSfx_StepBankLerp.s,AudioSfx_StepBankLe asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessActiveSfx.s,AudioSfx_ProcessActiveSfx,0x801A787C,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_IsPlaying.s,AudioSfx_IsPlaying,0x801A78E4,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_Reset.s,AudioSfx_Reset,0x801A794C,0x71 -asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s,Audio_StartSequence,0x801A7B10,0x7D -asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s,Audio_StopSequence,0x801A7D04,0x20 -asm/non_matchings/code/code_801A7B10/func_801A7D84.s,func_801A7D84,0x801A7D84,0x309 -asm/non_matchings/code/code_801A7B10/Audio_QueueSeqCmd.s,Audio_QueueSeqCmd,0x801A89A8,0xA -asm/non_matchings/code/code_801A7B10/func_801A89D0.s,func_801A89D0,0x801A89D0,0x20 -asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s,Audio_GetActiveSequence,0x801A8A50,0x1B -asm/non_matchings/code/code_801A7B10/func_801A8ABC.s,func_801A8ABC,0x801A8ABC,0x16 -asm/non_matchings/code/code_801A7B10/func_801A8B14.s,func_801A8B14,0x801A8B14,0x6 -asm/non_matchings/code/code_801A7B10/func_801A8B2C.s,func_801A8B2C,0x801A8B2C,0x29 -asm/non_matchings/code/code_801A7B10/Audio_SetVolumeScale.s,Audio_SetVolumeScale,0x801A8BD0,0x63 -asm/non_matchings/code/code_801A7B10/func_801A8D5C.s,func_801A8D5C,0x801A8D5C,0x283 -asm/non_matchings/code/code_801A7B10/func_801A9768.s,func_801A9768,0x801A9768,0x31 -asm/non_matchings/code/code_801A7B10/func_801A982C.s,func_801A982C,0x801A982C,0x63 -asm/non_matchings/code/code_801A7B10/func_801A99B8.s,func_801A99B8,0x801A99B8,0x2F -asm/non_matchings/code/code_801A7B10/func_801A9A74.s,func_801A9A74,0x801A9A74,0x27 +asm/non_matchings/code/sequence/AudioSeq_StartSequence.s,AudioSeq_StartSequence,0x801A7B10,0x7D +asm/non_matchings/code/sequence/AudioSeq_StopSequence.s,AudioSeq_StopSequence,0x801A7D04,0x20 +asm/non_matchings/code/sequence/AudioSeq_ProcessSeqCmd.s,AudioSeq_ProcessSeqCmd,0x801A7D84,0x309 +asm/non_matchings/code/sequence/AudioSeq_QueueSeqCmd.s,AudioSeq_QueueSeqCmd,0x801A89A8,0xA +asm/non_matchings/code/sequence/AudioSeq_ProcessSeqCmds.s,AudioSeq_ProcessSeqCmds,0x801A89D0,0x20 +asm/non_matchings/code/sequence/AudioSeq_GetActiveSeqId.s,AudioSeq_GetActiveSeqId,0x801A8A50,0x1B +asm/non_matchings/code/sequence/AudioSeq_IsSeqCmdNotQueued.s,AudioSeq_IsSeqCmdNotQueued,0x801A8ABC,0x16 +asm/non_matchings/code/sequence/AudioSeq_ResetSequenceRequests.s,AudioSeq_ResetSequenceRequests,0x801A8B14,0x6 +asm/non_matchings/code/sequence/AudioSeq_ReplaceSeqCmdSetupOpVolRestore.s,AudioSeq_ReplaceSeqCmdSetupOpVolRestore,0x801A8B2C,0x29 +asm/non_matchings/code/sequence/AudioSeq_SetVolumeScale.s,AudioSeq_SetVolumeScale,0x801A8BD0,0x63 +asm/non_matchings/code/sequence/AudioSeq_UpdateActiveSequences.s,AudioSeq_UpdateActiveSequences,0x801A8D5C,0x283 +asm/non_matchings/code/sequence/AudioSeq_UpdateAudioHeapReset.s,AudioSeq_UpdateAudioHeapReset,0x801A9768,0x31 +asm/non_matchings/code/sequence/AudioSeq_ResetReverb.s,AudioSeq_ResetReverb,0x801A982C,0x63 +asm/non_matchings/code/sequence/AudioSeq_ResetActiveSequences.s,AudioSeq_ResetActiveSequences,0x801A99B8,0x2F +asm/non_matchings/code/sequence/AudioSeq_ResetActiveSequencesAndVolume.s,AudioSeq_ResetActiveSequencesAndVolume,0x801A9A74,0x27 asm/non_matchings/code/jpegutils/JpegUtils_ProcessQuantizationTable.s,JpegUtils_ProcessQuantizationTable,0x801A9B10,0x1A asm/non_matchings/code/jpegutils/JpegUtils_ParseHuffmanCodesLengths.s,JpegUtils_ParseHuffmanCodesLengths,0x801A9B78,0x21 asm/non_matchings/code/jpegutils/JpegUtils_GetHuffmanCodes.s,JpegUtils_GetHuffmanCodes,0x801A9BFC,0x1B diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index e2092e595..02a3e4a42 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -5,36 +5,36 @@ import re weekEventReg = { ( 0 << 8) | 0x01: "WEEKEVENTREG_00_01", - ( 0 << 8) | 0x02: "WEEKEVENTREG_00_02", - ( 0 << 8) | 0x04: "WEEKEVENTREG_00_04", - ( 0 << 8) | 0x08: "WEEKEVENTREG_00_08", - ( 0 << 8) | 0x10: "WEEKEVENTREG_00_10", - ( 0 << 8) | 0x20: "WEEKEVENTREG_00_20", - ( 0 << 8) | 0x40: "WEEKEVENTREG_00_40", - ( 0 << 8) | 0x80: "WEEKEVENTREG_00_80", - ( 1 << 8) | 0x01: "WEEKEVENTREG_01_01", - ( 1 << 8) | 0x02: "WEEKEVENTREG_01_02", - ( 1 << 8) | 0x04: "WEEKEVENTREG_01_04", - ( 1 << 8) | 0x08: "WEEKEVENTREG_01_08", - ( 1 << 8) | 0x10: "WEEKEVENTREG_01_10", - ( 1 << 8) | 0x20: "WEEKEVENTREG_01_20", - ( 1 << 8) | 0x40: "WEEKEVENTREG_01_40", - ( 1 << 8) | 0x80: "WEEKEVENTREG_01_80", - ( 2 << 8) | 0x01: "WEEKEVENTREG_02_01", - ( 2 << 8) | 0x02: "WEEKEVENTREG_02_02", - ( 2 << 8) | 0x04: "WEEKEVENTREG_02_04", - ( 2 << 8) | 0x08: "WEEKEVENTREG_02_08", - ( 2 << 8) | 0x10: "WEEKEVENTREG_02_10", - ( 2 << 8) | 0x20: "WEEKEVENTREG_02_20", - ( 2 << 8) | 0x40: "WEEKEVENTREG_02_40", - ( 2 << 8) | 0x80: "WEEKEVENTREG_02_80", - ( 3 << 8) | 0x01: "WEEKEVENTREG_03_01", - ( 3 << 8) | 0x02: "WEEKEVENTREG_03_02", - ( 3 << 8) | 0x04: "WEEKEVENTREG_03_04", - ( 3 << 8) | 0x08: "WEEKEVENTREG_03_08", - ( 3 << 8) | 0x10: "WEEKEVENTREG_03_10", - ( 3 << 8) | 0x20: "WEEKEVENTREG_03_20", - ( 3 << 8) | 0x40: "WEEKEVENTREG_03_40", + ( 0 << 8) | 0x02: "WEEKEVENTREG_ENTERED_TERMINA_FIELD", + ( 0 << 8) | 0x04: "WEEKEVENTREG_ENTERED_IKANA_GRAVEYARD", + ( 0 << 8) | 0x08: "WEEKEVENTREG_ENTERED_ROMANI_RANCH", + ( 0 << 8) | 0x10: "WEEKEVENTREG_ENTERED_GORMAN_TRACK", + ( 0 << 8) | 0x20: "WEEKEVENTREG_ENTERED_MOUNTAIN_VILLAGE_WINTER", + ( 0 << 8) | 0x40: "WEEKEVENTREG_ENTERED_GORON_SHRINE", + ( 0 << 8) | 0x80: "WEEKEVENTREG_ENTERED_SNOWHEAD", + ( 1 << 8) | 0x01: "WEEKEVENTREG_ENTERED_SOUTHERN_SWAMP_POISONED", + ( 1 << 8) | 0x02: "WEEKEVENTREG_ENTERED_WOODFALL", + ( 1 << 8) | 0x04: "WEEKEVENTREG_ENTERED_DEKU_PALACE", + ( 1 << 8) | 0x08: "WEEKEVENTREG_ENTERED_GREAT_BAY_COAST", + ( 1 << 8) | 0x10: "WEEKEVENTREG_ENTERED_PIRATES_FORTRESS", + ( 1 << 8) | 0x20: "WEEKEVENTREG_ENTERED_ZORA_HALL", + ( 1 << 8) | 0x40: "WEEKEVENTREG_ENTERED_WATERFALL_RAPIDS", + ( 1 << 8) | 0x80: "WEEKEVENTREG_ENTERED_IKANA_CANYON", + ( 2 << 8) | 0x01: "WEEKEVENTREG_ENTERED_IKANA_CASTLE", + ( 2 << 8) | 0x02: "WEEKEVENTREG_ENTERED_STONE_TOWER", + ( 2 << 8) | 0x04: "WEEKEVENTREG_ENTERED_STONE_TOWER_INVERTED", + ( 2 << 8) | 0x08: "WEEKEVENTREG_ENTERED_EAST_CLOCK_TOWN", + ( 2 << 8) | 0x10: "WEEKEVENTREG_ENTERED_WEST_CLOCK_TOWN", + ( 2 << 8) | 0x20: "WEEKEVENTREG_ENTERED_NORTH_CLOCK_TOWN", + ( 2 << 8) | 0x40: "WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE", + ( 2 << 8) | 0x80: "WEEKEVENTREG_ENTERED_SNOWHEAD_TEMPLE", + ( 3 << 8) | 0x01: "WEEKEVENTREG_ENTERED_PIRATES_FORTRESS_EXTERIOR", + ( 3 << 8) | 0x02: "WEEKEVENTREG_ENTERED_STONE_TOWER_TEMPLE", + ( 3 << 8) | 0x04: "WEEKEVENTREG_ENTERED_STONE_TOWER_TEMPLE_INVERTED", + ( 3 << 8) | 0x08: "WEEKEVENTREG_ENTERED_THE_MOON", + ( 3 << 8) | 0x10: "WEEKEVENTREG_ENTERED_MOON_DEKU_TRIAL", + ( 3 << 8) | 0x20: "WEEKEVENTREG_ENTERED_MOON_GORON_TRIAL", + ( 3 << 8) | 0x40: "WEEKEVENTREG_ENTERED_MOON_ZORA_TRIAL", ( 3 << 8) | 0x80: "WEEKEVENTREG_03_80", ( 4 << 8) | 0x01: "WEEKEVENTREG_04_01", ( 4 << 8) | 0x02: "WEEKEVENTREG_04_02", @@ -67,7 +67,7 @@ weekEventReg = { ( 7 << 8) | 0x10: "WEEKEVENTREG_07_10", ( 7 << 8) | 0x20: "WEEKEVENTREG_07_20", ( 7 << 8) | 0x40: "WEEKEVENTREG_07_40", - ( 7 << 8) | 0x80: "WEEKEVENTREG_07_80", + ( 7 << 8) | 0x80: "WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON", ( 8 << 8) | 0x01: "WEEKEVENTREG_08_01", ( 8 << 8) | 0x02: "WEEKEVENTREG_08_02", ( 8 << 8) | 0x04: "WEEKEVENTREG_08_04", @@ -113,9 +113,9 @@ weekEventReg = { (13 << 8) | 0x04: "WEEKEVENTREG_13_04", (13 << 8) | 0x08: "WEEKEVENTREG_13_08", (13 << 8) | 0x10: "WEEKEVENTREG_13_10", - (13 << 8) | 0x20: "WEEKEVENTREG_13_20", - (13 << 8) | 0x40: "WEEKEVENTREG_13_40", - (13 << 8) | 0x80: "WEEKEVENTREG_13_80", + (13 << 8) | 0x20: "WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN", + (13 << 8) | 0x40: "WEEKEVENTREG_RECEIVED_OCEANSIDE_WALLET_UPGRADE", + (13 << 8) | 0x80: "WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_COLLECTED_REWARD", (14 << 8) | 0x01: "WEEKEVENTREG_14_01", (14 << 8) | 0x02: "WEEKEVENTREG_14_02", (14 << 8) | 0x04: "WEEKEVENTREG_14_04", @@ -279,10 +279,10 @@ weekEventReg = { (34 << 8) | 0x01: "WEEKEVENTREG_34_01", (34 << 8) | 0x02: "WEEKEVENTREG_34_02", (34 << 8) | 0x04: "WEEKEVENTREG_34_04", - (34 << 8) | 0x08: "WEEKEVENTREG_34_08", + (34 << 8) | 0x08: "WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED", (34 << 8) | 0x10: "WEEKEVENTREG_34_10", (34 << 8) | 0x20: "WEEKEVENTREG_34_20", - (34 << 8) | 0x40: "WEEKEVENTREG_34_40", + (34 << 8) | 0x40: "WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH", (34 << 8) | 0x80: "WEEKEVENTREG_34_80", (35 << 8) | 0x01: "WEEKEVENTREG_35_01", (35 << 8) | 0x02: "WEEKEVENTREG_35_02", @@ -508,8 +508,8 @@ weekEventReg = { (62 << 8) | 0x20: "WEEKEVENTREG_62_20", (62 << 8) | 0x40: "WEEKEVENTREG_62_40", (62 << 8) | 0x80: "WEEKEVENTREG_62_80", - (63 << 8) | 0x01: "WEEKEVENTREG_63_01", - (63 << 8) | 0x02: "WEEKEVENTREG_63_02", + (63 << 8) | 0x01: "WEEKEVENTREG_KICKOUT_WAIT", + (63 << 8) | 0x02: "WEEKEVENTREG_KICKOUT_TIME_PASSED", (63 << 8) | 0x04: "WEEKEVENTREG_63_04", (63 << 8) | 0x08: "WEEKEVENTREG_63_08", (63 << 8) | 0x10: "WEEKEVENTREG_63_10", diff --git a/undefined_syms.txt b/undefined_syms.txt index 41b9d0558..e28be948d 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -574,6 +574,22 @@ D_06001680 = 0x06001680; D_06000288 = 0x06000288; +// ovl_Bg_Keikoku_Spr + +D_06000100 = 0x06000100; +D_060001F8 = 0x060001F8; +D_060003F8 = 0x060003F8; +D_06000500 = 0x06000500; +D_060005F8 = 0x060005F8; + +/* ovl_Bg_Lotus */ +D_06000A20 = 0x06000A20; +D_06000040 = 0x06000040; + +/* ovl_Bg_Tobira01 */ +D_060011C0 = 0x060011C0; +D_06000088 = 0x06000088; + // ovl_Boss_01 D_06000C44 = 0x06000C44; @@ -727,6 +743,21 @@ D_060129F0 = 0x060129F0; D_06002D30 = 0x06002D30; D_06011458 = 0x06011458; +// ovl_Door_Spiral + +D_06000590 = 0x06000590; +D_060007A8 = 0x060007A8; +D_06000EA0 = 0x06000EA0; +D_060012C0 = 0x060012C0; +D_060014C8 = 0x060014C8; +D_06002110 = 0x06002110; +D_06004448 = 0x06004448; +D_060051B8 = 0x060051B8; +D_06006128 = 0x06006128; +D_06009278 = 0x06009278; +D_06012B70 = 0x06012B70; +D_06013EA8 = 0x06013EA8; + // ovl_Eff_Stk D_06008920 = 0x06008920; @@ -783,16 +814,6 @@ D_0600CB2C = 0x0600CB2C; D_0600CB84 = 0x0600CB84; D_0600CBC0 = 0x0600CBC0; -// ovl_En_Dekubaba - -D_06000208 = 0x06000208; -D_060002B8 = 0x060002B8; -D_060010F0 = 0x060010F0; -D_06001330 = 0x06001330; -D_06001828 = 0x06001828; -D_06002A40 = 0x06002A40; -D_06003070 = 0x06003070; - // ovl_En_Dnh D_06002950 = 0x06002950; @@ -843,6 +864,55 @@ D_0600A344 = 0x0600A344; D_06001EFC = 0x06001EFC; D_0600A808 = 0x0600A808; +// ovl_En_Invadepoh + +D_06000080 = 0x06000080; +D_060003B0 = 0x060003B0; +D_06000550 = 0x06000550; +D_06000560 = 0x06000560; +D_06000608 = 0x06000608; +D_060006C8 = 0x060006C8; +D_06000720 = 0x06000720; +D_06000998 = 0x06000998; +D_06001560 = 0x06001560; +D_06001674 = 0x06001674; +D_06001BD8 = 0x06001BD8; +D_06001D80 = 0x06001D80; +D_060021C8 = 0x060021C8; +D_06002A8C = 0x06002A8C; +D_06004010 = 0x06004010; +D_06004264 = 0x06004264; +D_06004C30 = 0x06004C30; +D_06004E50 = 0x06004E50; +D_06004E98 = 0x06004E98; +D_06007328 = 0x06007328; +D_060080F0 = 0x060080F0; +D_06009E58 = 0x06009E58; +D_0600A174 = 0x0600A174; +D_0600FFC8 = 0x0600FFC8; +D_060107C8 = 0x060107C8; +D_06010FC8 = 0x06010FC8; +D_060117C8 = 0x060117C8; +D_06011AD8 = 0x06011AD8; +D_06011FC8 = 0x06011FC8; +D_060122D8 = 0x060122D8; +D_060127C8 = 0x060127C8; +D_06012AD8 = 0x06012AD8; +D_06012BC8 = 0x06012BC8; +D_06012FC8 = 0x06012FC8; +D_060132D8 = 0x060132D8; +D_060133C8 = 0x060133C8; +D_06013928 = 0x06013928; +D_06013AD8 = 0x06013AD8; +D_06014088 = 0x06014088; +D_060142D8 = 0x060142D8; +D_06014AD8 = 0x06014AD8; +D_06014ED8 = 0x06014ED8; +D_060152D8 = 0x060152D8; +D_06015C28 = 0x06015C28; +D_060156D8 = 0x060156D8; +D_06016720 = 0x06016720; + // ovl_En_Invadepoh_Demo D_06000080 = 0x06000080; @@ -983,11 +1053,6 @@ D_06001AA0 = 0x06001AA0; D_06000304 = 0x06000304; -// ovl_En_Stop_heishi - -D_06006C18 = 0x06006C18; -D_0600D640 = 0x0600D640; - // ovl_En_Takaraya D_06000968 = 0x06000968; @@ -1028,6 +1093,16 @@ D_06000D94 = 0x06000D94; D_06007650 = 0x06007650; D_0600D658 = 0x0600D658; +// ovl_Item_B_Heart + +D_06001290 = 0x06001290; +D_06001470 = 0x06001470; + +// ovl_Obj_Boyo + +D_06000300 = 0x06000300; +D_06000E88 = 0x06000E88; + // ovl_Obj_Mine D_06000030 = 0x06000030;