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_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..f1e62d59a 100644 --- a/assets/xml/objects/object_dt.xml +++ b/assets/xml/objects/object_dt.xml @@ -1,10 +1,10 @@  - - - - - + + + + + @@ -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_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/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/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)<= 0x18 -typedef void(*osCreateThread_func)(void*); - typedef enum { SLOWLY_CALLBACK_NO_ARGS, SLOWLY_CALLBACK_ONE_ARG, @@ -306,36 +306,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; @@ -542,36 +512,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 +638,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*); @@ -779,23 +713,6 @@ 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; @@ -906,7 +823,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 +847,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 +878,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,14 +886,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; diff --git a/include/z64actor.h b/include/z64actor.h index 370b49e75..04c8fd02a 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -385,6 +385,13 @@ 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 @@ -399,9 +406,9 @@ typedef struct ActorContext { /* 0x00B */ s8 lensActorsDrawn; /* 0x00C */ s16 unkC; /* 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; @@ -467,8 +474,8 @@ typedef enum { #define ACTOR_FLAG_20 (1 << 5) // #define ACTOR_FLAG_40 (1 << 6) -// Invisible -#define ACTOR_FLAG_80 (1 << 7) +// hidden or revealed by Lens of Truth (depending on room lensMode) +#define ACTOR_FLAG_REACT_TO_LENS (1 << 7) // Related to talk #define ACTOR_FLAG_100 (1 << 8) // 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/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/z64save.h b/include/z64save.h index c9be6d27c..d01ae0bcb 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -504,36 +504,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) @@ -566,7 +573,8 @@ 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) #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) @@ -786,6 +794,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 @@ -1219,7 +1230,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) @@ -1244,7 +1258,10 @@ typedef enum SunsSongState { #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) diff --git a/include/z64scene.h b/include/z64scene.h index 41198af71..66830d86d 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -261,7 +261,7 @@ typedef struct { /* 0x02 */ u8 unk2; // 3: Room is hot /* 0x03 */ u8 unk3; /* 0x04 */ s8 echo; - /* 0x05 */ u8 unk5; + /* 0x05 */ u8 lensMode; /* 0x06 */ u8 enablePosLights; /* 0x07 */ UNK_TYPE1 pad7[0x1]; /* 0x08 */ RoomMesh* mesh; diff --git a/include/z64skybox.h b/include/z64skybox.h new file mode 100644 index 000000000..1664b94b1 --- /dev/null +++ b/include/z64skybox.h @@ -0,0 +1,67 @@ +#ifndef Z64_SKYBOX_H +#define Z64_SKYBOX_H + +#include "PR/ultratypes.h" +#include "PR/gbi.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 */ 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 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/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/spec b/spec index bef1b4654..9a9deb950 100644 --- a/spec +++ b/spec @@ -463,7 +463,6 @@ beginseg 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" @@ -513,7 +512,7 @@ beginseg 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 +548,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" @@ -963,8 +961,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 @@ -3429,8 +3426,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 @@ -4024,8 +4020,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/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/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/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/z_actor.c b/src/code/z_actor.c index dcc5c0219..a1b60fa69 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2623,18 +2623,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 +2643,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 +2818,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 +2842,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 +2872,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; 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_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_play.c b/src/code/z_play.c index b33b449d2..f7e3dc521 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -13,9 +13,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 +388,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) { @@ -669,7 +668,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) { @@ -710,9 +710,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 +759,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 +793,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 +822,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 +858,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 +881,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,25 +922,28 @@ 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 (gTransitionTileState != TRANS_TILE_READY) { if ((gSaveContext.gameMode == 0) && (((this->msgCtx.msgMode == 0)) || ((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == 0x42) && @@ -989,7 +992,7 @@ void Play_UpdateMain(PlayState* this) { Room_nop8012D510(this, &this->roomCtx.curRoom, &input[1], 0); Room_nop8012D510(this, &this->roomCtx.prevRoom, &input[1], 1); - SkyboxDraw_Update(&this->skyboxCtx); + Skybox_Update(&this->skyboxCtx); if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { KaleidoScopeCall_Update(this); @@ -1121,7 +1124,7 @@ 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 ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.mesh->type0.type == 1)) { func_8012CF0C(gfxCtx, false, true, 0, 0, 0); } else { @@ -1226,10 +1229,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 +1265,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 +1303,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 +1365,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 +1384,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 +1415,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); } } @@ -2241,7 +2245,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; 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_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_scene.c b/src/code/z_scene.c index 48c360107..5be9dca41 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -239,7 +239,7 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { 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; + 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; 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..13ce84ec4 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 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_vr_box.c b/src/code/z_vr_box.c index f42e66a25..2797fee3c 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -191,7 +191,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) skyboxCtx->rotZ = 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); @@ -224,7 +224,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) } 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) { @@ -293,10 +293,10 @@ void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) { Skybox_Setup(gameState, skyboxCtx, skyboxId); - if (skyboxId != 0) { + if (skyboxId != SKYBOX_NONE) { skyboxCtx->dListBuf = THA_AllocEndAlign16(&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); func_80143148(skyboxCtx, 6); diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index e0884e270..2569f81fa 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -2,7 +2,7 @@ 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); @@ -11,7 +11,7 @@ Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) { return Matrix_ToMtx(sSkyboxDrawMatrix); } -void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { +void Skybox_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { skyboxCtx->primR = primR; skyboxCtx->primG = primG; skyboxCtx->primB = primB; @@ -20,7 +20,7 @@ void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB skyboxCtx->envB = 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); @@ -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/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index e5505e92a..805d79170 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1288,17 +1288,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); 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_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 069d829c1..7e13a8e7f 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" 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_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 7ec2245d7..df067d0a9 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -652,7 +652,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 +711,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_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index b07e65de3..d41da1326 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -373,7 +373,7 @@ 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); sp82 = NA_SE_IT_DEKU; @@ -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, 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..9e49ca0b1 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -30,7 +30,7 @@ typedef struct { /* 0x1A */ s16 rotX; } PowderKegFuseSegment; // size = 0x1C -static PowderKegFuseSegment sPowderKegFuseSegments[16]; +PowderKegFuseSegment sPowderKegFuseSegments[16]; ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, 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..9529b5fdf 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; @@ -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_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 2f2496f57..210179774 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -642,7 +642,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_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 93d495267..45b851271 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,1332 @@ 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_PlaySfxAtPos(&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_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_MOUTH); + } else { + Actor_PlaySfxAtPos(&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_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_ATTACK); + } else { + Actor_PlaySfxAtPos(&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_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_MOUTH); + } else { + Actor_PlaySfxAtPos(&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_PlaySfxAtPos(&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.speedXZ = 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.speedXZ, 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 & 2) || (this->actor.bgCheckFlags & 8))) { + 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.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 & 2) { + Actor_PlaySfxAtPos(&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_PickUpNearby(&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_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + } else { + Actor_PlaySfxAtPos(&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_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_DEAD); + } else { + Actor_PlaySfxAtPos(&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_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 615383a27..e96785133 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) 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..c41e6fd76 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; } 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..aac1cb637 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -3,6 +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" 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..c66ce4b16 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; } @@ -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; 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..7007e7ed9 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -189,13 +189,14 @@ 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); @@ -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); @@ -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; @@ -339,22 +340,27 @@ void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { 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..a4b28fa85 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.speedXZ = 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.speedXZ = 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.speedXZ = 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.speedXZ = 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_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO00); + } else { + Actor_PlaySfxAtPos(&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.speedXZ = 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 & 1)) { + 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_PlaySfxAtPos(&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.speedXZ = 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.speedXZ = 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.speedXZ = 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.speedXZ = 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.speedXZ = 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.speedXZ = 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.speedXZ = 0.0f; + this->actionFunc = EnGe2_KnockedOut; + Actor_PlaySfxAtPos(&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.speedXZ = 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.speedXZ = 5.0f; + + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfxAtPos(&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.speedXZ = 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_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index a6c2a31ec..bb14b0dd0 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); @@ -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..b2f35c49e 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; } } @@ -203,7 +203,7 @@ void func_80B3B120(EnGg2* this, PlayState* play) { 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)) { + 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; } @@ -370,7 +370,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { 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_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..1e26b47e6 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 @@ -345,7 +345,8 @@ void func_808DF194(EnHorseLinkChild* this, PlayState* play) { 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; 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..dd8d513e4 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,211 +140,208 @@ 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); +void EnKarebaba_SetupAwaken(EnKarebaba* this) { + Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, + Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DEKU_WAKEUP); - this->actionFunc = func_808F1778; + 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); } - 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); @@ -347,66 +350,66 @@ void func_808F1A58(EnKarebaba* this, PlayState* play) { Actor_PlaySfxAtPos(&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; } else { - this->unk_1EE = 3; + this->timer = 3; } Actor_PlaySfxAtPos(&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.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); - 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); @@ -422,156 +425,155 @@ void func_808F1C84(EnKarebaba* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); - this->unk_1EE = 1; + 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) { +void EnKarebaba_SetupShrinkDie(EnKarebaba* this) { Actor_PlaySfxAtPos(&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); } } -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 +593,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 +627,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 +636,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 +646,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 +700,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_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index f188e1df0..f2733c3c1 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -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_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index a9fcf95e3..e7a2ae607 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) @@ -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,20 +145,22 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { Collider_DestroySphere(play, &this->collider); } +/** + * Search for Romani's actor, beacuse it's PoFusen's job to update her actor on pop. + */ u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { - Actor* actorPtr; + 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; @@ -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; } @@ -204,16 +208,16 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { 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); + 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; @@ -223,10 +227,9 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { 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++; } @@ -243,7 +246,8 @@ void EnPoFusen_Pop(EnPoFusen* this, PlayState* play) { 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..2c1ad1e02 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; } @@ -353,7 +353,8 @@ 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; } @@ -418,10 +419,10 @@ void EnPoSisters_SetupSpinUp(EnPoSisters* this) { this->collider.base.acFlags |= AC_HARD; } - Animation_MorphToLoop(&this->skelAnime, &gPoSistersAttackAnim, -5.0f); + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersAttackAnim, -5.0f); this->actor.speedXZ = 0.0f; - this->spinupTimer = Animation_GetLastFrame(&gPoSistersAttackAnim.common) * 3 + 3; - this->poSisterFlags &= ~POSISTERS_FLAG_UPDATE_SHAPE_ROT; + this->spinupTimer = Animation_GetLastFrame(&gPoeSistersAttackAnim.common) * 3 + 3; + this->poSisterFlags &= ~POE_SISTERS_FLAG_UPDATE_SHAPE_ROT; this->actionFunc = EnPoSisters_SpinUp; } @@ -438,15 +439,15 @@ void EnPoSisters_SpinUp(EnPoSisters* this, PlayState* play) { void EnPoSisters_SetupSpinAttack(EnPoSisters* this) { this->actor.speedXZ = 5.0f; - if (this->type == POSISTER_TYPE_MEG) { + 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,7 +463,7 @@ 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); @@ -484,7 +485,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; } @@ -498,7 +499,7 @@ void EnPoSisters_AttackConnectDrift(EnPoSisters* this, PlayState* play) { if (Math_StepToF(&this->actor.speedXZ, 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); @@ -513,12 +514,12 @@ void EnPoSisters_SetupDamageFlinch(EnPoSisters* this) { func_800BE504(&this->actor, &this->collider); } - if (this->type != POSISTER_TYPE_MEG) { + if (this->type != POE_SISTERS_TYPE_MEG) { this->actor.speedXZ = 10.0f; } this->poSisterFlags &= - ~(POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); + ~(POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); this->actionFunc = EnPoSisters_DamageFlinch; } @@ -526,9 +527,9 @@ void EnPoSisters_SetupDamageFlinch(EnPoSisters* this) { 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,27 +539,27 @@ 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) { + } else if (this->type != POE_SISTERS_TYPE_MEG) { Math_StepToF(&this->actor.speedXZ, 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); + (POE_SISTERS_FLAG_MATCH_PLAYER_HEIGHT | POE_SISTERS_FLAG_UPDATE_SHAPE_ROT | POE_SISTERS_FLAG_CHECK_AC); this->actor.speedXZ = 5.0f; this->actionFunc = EnPoSisters_Flee; } @@ -572,7 +573,7 @@ void EnPoSisters_Flee(EnPoSisters* this, PlayState* play) { if (this->actor.bgCheckFlags & 8) { // touching a 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; @@ -586,7 +587,7 @@ void EnPoSisters_SetupSpinToInvis(EnPoSisters* this) { this->invisibleTimer = 100; // 5 seconds this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->poSisterFlags &= ~(POSISTERS_FLAG_CHECK_Z_TARGET | POSISTERS_FLAG_CHECK_AC); + this->poSisterFlags &= ~(POE_SISTERS_FLAG_CHECK_Z_TARGET | POE_SISTERS_FLAG_CHECK_AC); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DISAPPEAR); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); this->actionFunc = EnPoSisters_SpinToInvis; @@ -607,7 +608,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; @@ -619,15 +620,15 @@ 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->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 +644,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); } } @@ -655,7 +656,7 @@ void EnPoSisters_SetupDeathStage1(EnPoSisters* this) { 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; } @@ -724,15 +725,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 +760,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 +768,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 +779,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 +804,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 +816,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++; @@ -874,7 +876,7 @@ void EnPoSisters_SetupSpawnPo(EnPoSisters* this) { Animation_PlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim); Actor_PlaySfxAtPos(&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 +884,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,7 +905,7 @@ 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); EnPoSisters_MegCloneVanish(this, play); @@ -914,16 +916,16 @@ 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 { @@ -934,7 +936,7 @@ void EnPoSisters_CheckCollision(EnPoSisters* this, PlayState* play) { Actor_PlaySfxAtPos(&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 +962,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 +1001,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 +1016,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 +1026,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 +1069,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 +1088,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 +1096,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 +1116,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 +1167,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 +1182,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 +1206,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_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 3e46c9f04..9a51c664f 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) { 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..c5cc3232c 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -699,7 +699,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); @@ -864,8 +864,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_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 36dd9398e..69efb5676 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)) { 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..6d214b4fd 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.speedXZ = 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_PlaySfxAtPos(&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; + func_80151938(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 { + func_801477B4(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_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index 1a2f8b685..6f533b3a3 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 @@ -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,7 +114,7 @@ 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.gravity = 0.0f; @@ -123,13 +123,13 @@ void EnSyatekiCrow_SetupWaitForSpawn(EnSyatekiCrow* this) { 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; @@ -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,7 +207,7 @@ 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); @@ -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..c21eb6115 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 @@ -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,7 +161,7 @@ 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; @@ -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,13 +221,13 @@ 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) { @@ -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++; @@ -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_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 20871efb2..9f35d8bc7 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 @@ -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,45 +174,46 @@ 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; @@ -222,67 +222,79 @@ void func_80A201CC(EnSyatekiWf* this) { 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) { +/** + * Waits 11 frames, then makes the Wolfos start running forward. + */ +void EnSyatekiWf_WaitToMove(EnSyatekiWf* this, PlayState* play) { + if (this->waitTimer >= 11) { Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_WOLFOS_APPEAR); - this->unk_29C = 0; - func_80A20378(this); + this->waitTimer = 0; + EnSyatekiWf_SetupRun(this); } else { - this->unk_29C++; + this->waitTimer++; } } -void func_80A20378(EnSyatekiWf* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); +void EnSyatekiWf_SetupRun(EnSyatekiWf* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_RUN); this->actor.speedXZ = 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 ((ABS(wallYawDiff) < 0x1555) && (this->actor.wallPoly != this->actor.floorPoly)) { + EnSyatekiWf_SetupJump(this); return; } } @@ -291,13 +303,13 @@ void func_80A203DC(EnSyatekiWf* this, PlayState* play) { 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 (distToTarget < 50.0f) { if (this->actor.speedXZ > 3.0f) { this->actor.speedXZ = this->actor.speedXZ - 0.5f; } else { @@ -305,16 +317,16 @@ void func_80A203DC(EnSyatekiWf* this, PlayState* play) { } } } 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) { +void EnSyatekiWf_SetupJump(EnSyatekiWf* this) { Actor_PlaySfxAtPos(&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; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_WF_ANIM_JUMP); + this->actionFunc = EnSyatekiWf_Jump; } -void func_80A206DC(EnSyatekiWf* this, PlayState* play) { +void EnSyatekiWf_Jump(EnSyatekiWf* this, PlayState* play) { if (this->actor.bgCheckFlags & 2) { - func_80A20710(this); + EnSyatekiWf_SetupLand(this); } } -void func_80A20710(EnSyatekiWf* this) { +void EnSyatekiWf_SetupLand(EnSyatekiWf* this) { this->actor.speedXZ = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - this->actionFunc = func_80A2075C; + 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; +void EnSyatekiWf_SetupHowl(EnSyatekiWf* this) { + this->timer = 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; + 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->isActive = false; this->actor.speedXZ = 0.0f; - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + 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); } @@ -417,26 +435,34 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { 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_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_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 7ddd539e7..b4f63eb88 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 @@ -94,7 +94,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; @@ -231,10 +231,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); } 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..8d6daa3c2 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -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); @@ -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; @@ -572,7 +572,7 @@ 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); + 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,7 +591,7 @@ 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; @@ -642,7 +642,7 @@ 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->actionFunc = func_8099149C; @@ -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; } @@ -755,7 +755,7 @@ void func_8099177C(EnWf* this, PlayState* play) { 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 { @@ -809,7 +809,7 @@ 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; @@ -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,7 +923,7 @@ 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.shape.rot.y = this->actor.yawTowardsPlayer; @@ -1021,8 +1021,8 @@ 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.velocity.y = 15.0f; @@ -1053,8 +1053,8 @@ void func_8099282C(EnWf* this) { 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); + Animation_Change(&this->skelAnime, &gWolfosBlockAnim, -1.0f, Animation_GetLastFrame(&gWolfosBlockAnim.common), 0.0f, + ANIMMODE_ONCE, -2.0f); this->actionFunc = func_809928CC; } @@ -1091,7 +1091,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) { @@ -1153,7 +1153,7 @@ void func_80992B8C(EnWf* this, PlayState* play) { 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; @@ -1205,7 +1205,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; } @@ -1232,7 +1232,7 @@ void func_80993018(EnWf* this, PlayState* play) { } void func_80993148(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); this->actor.speedXZ = 0.0f; this->actionFunc = func_80993194; } @@ -1277,7 +1277,7 @@ void func_80993194(EnWf* this, PlayState* play) { } void func_80993350(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); this->actionFunc = func_809933A0; } @@ -1317,7 +1317,7 @@ void func_809933A0(EnWf* this, PlayState* play) { } void func_80993524(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosRunningAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gWolfosRunAnim, -4.0f); this->actor.speedXZ = 6.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = func_8099357C; 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..353fe01ab 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -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_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index c48ff332c..e4b69cbd2 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--; + 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; + this->curPointIndex = 0; } else if (this->dyna.actor.speedXZ == 0.0f) { - this->unk_15C = 0; - this->unk_15D = -1; + 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.speedXZ) * 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.speedXZ, speedTarget, 0.05f); Actor_MoveWithGravity(&this->dyna.actor); if (this->dyna.actor.speedXZ != 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->maxPointIndex = path->count; + this->points = Lib_SegmentedToVirtual(path->points); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->points); this->dyna.actor.speedXZ = actionIndex->urot.z * (45.0f / 0x2000); - this->unk_164++; - this->unk_15C = 1; + 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.speedXZ); + if ((this->curPointIndex < this->maxPointIndex) && (distRemaining < this->dyna.actor.speedXZ)) { + 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_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 060e793ca..af796da2c 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" 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..509f285fe 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -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_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index 6620c5116..a4b211bef 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -135,16 +135,16 @@ void func_80AF0514(ObjLupygamelift* this) { } 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) { + distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &target, this->dyna.actor.speedXZ); + if (distRemaining > 30.0f) { Math_SmoothStepToF(&this->dyna.actor.speedXZ, this->targetSpeedXZ, 0.5f, 5.0f, 0.1f); - } else if (step > 0.0f) { + } else if (distRemaining > 0.0f) { Math_SmoothStepToF(&this->dyna.actor.speedXZ, 5.0f, 0.5f, 5.0f, 1.0f); } else { if (this->pointIndex < (this->count - 1)) { 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/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..c64ad38c6 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 @@ -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/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/tools/disasm/files.txt b/tools/disasm/files.txt index 2a79674bf..0b15fa834 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -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,6 +570,7 @@ 0x801D0B70 : "z_kaleido_manager", 0x801D0BB0 : "", 0x801D0C80 : "z_fbdemo", + 0x801D0CB0 : "z_fbdemo_fade", 0x801D0D00 : "z_fbdemo_circle", 0x801D0D50 : "z_play", 0x801D0D80 : "z_play_hireso", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 8c21d769d..b585e4e92 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -819,8 +819,8 @@ 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",), @@ -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",), @@ -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",), @@ -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",), @@ -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",), @@ -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",), @@ -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 d852878c1..6d601955a 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -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), @@ -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), @@ -4053,9 +4054,8 @@ 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), @@ -6431,15 +6431,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), @@ -7197,8 +7197,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), @@ -10954,13 +10954,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), @@ -12924,8 +12924,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), @@ -13260,10 +13260,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), @@ -15182,13 +15182,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/sizes/code_functions.csv b/tools/sizes/code_functions.csv index cdf818d0b..ee12b7bd5 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -333,8 +333,8 @@ asm/non_matchings/code/z_actor/Actor_UpdateActor.s,Actor_UpdateActor,0x800B948C, 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 @@ -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 diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index e2092e595..fbefc1b3d 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", diff --git a/undefined_syms.txt b/undefined_syms.txt index 649b781ce..1809e1600 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -780,16 +780,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; @@ -980,11 +970,6 @@ D_06001AA0 = 0x06001AA0; D_06000304 = 0x06000304; -// ovl_En_Stop_heishi - -D_06006C18 = 0x06006C18; -D_0600D640 = 0x0600D640; - // ovl_En_Takaraya D_06000968 = 0x06000968;