diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml index a73a2f28db..7a299bff7b 100644 --- a/assets/xml/objects/gameplay_field_keep.xml +++ b/assets/xml/objects/gameplay_field_keep.xml @@ -12,14 +12,14 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_ah.xml b/assets/xml/objects/object_ah.xml index 296347dacb..3644f2a902 100644 --- a/assets/xml/objects/object_ah.xml +++ b/assets/xml/objects/object_ah.xml @@ -37,22 +37,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ahg.xml b/assets/xml/objects/object_ahg.xml index c636f0baa3..7d4c2c7415 100644 --- a/assets/xml/objects/object_ahg.xml +++ b/assets/xml/objects/object_ahg.xml @@ -33,21 +33,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_al.xml b/assets/xml/objects/object_al.xml index 7a2ff1a52a..d0f6a6cbb1 100644 --- a/assets/xml/objects/object_al.xml +++ b/assets/xml/objects/object_al.xml @@ -39,33 +39,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_an1.xml b/assets/xml/objects/object_an1.xml index c2ae65d8b2..15c38af325 100644 --- a/assets/xml/objects/object_an1.xml +++ b/assets/xml/objects/object_an1.xml @@ -54,27 +54,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_and.xml b/assets/xml/objects/object_and.xml index 269e2a73fe..17cff45978 100644 --- a/assets/xml/objects/object_and.xml +++ b/assets/xml/objects/object_and.xml @@ -42,32 +42,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_aob.xml b/assets/xml/objects/object_aob.xml index dcdb757484..7c1e2e4ef7 100644 --- a/assets/xml/objects/object_aob.xml +++ b/assets/xml/objects/object_aob.xml @@ -1,22 +1,22 @@  - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_az.xml b/assets/xml/objects/object_az.xml index c192f6914f..d4382673f8 100644 --- a/assets/xml/objects/object_az.xml +++ b/assets/xml/objects/object_az.xml @@ -27,30 +27,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -98,30 +98,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bai.xml b/assets/xml/objects/object_bai.xml index ad8d8445bf..4225bec840 100644 --- a/assets/xml/objects/object_bai.xml +++ b/assets/xml/objects/object_bai.xml @@ -28,26 +28,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bal.xml b/assets/xml/objects/object_bal.xml index e564a4798d..a16e2fb1fa 100644 --- a/assets/xml/objects/object_bal.xml +++ b/assets/xml/objects/object_bal.xml @@ -36,39 +36,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bb.xml b/assets/xml/objects/object_bb.xml index ba3e4cb94a..4f1c39dac0 100644 --- a/assets/xml/objects/object_bb.xml +++ b/assets/xml/objects/object_bb.xml @@ -17,21 +17,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bee.xml b/assets/xml/objects/object_bee.xml index b2c90324b0..8f1d704cf4 100644 --- a/assets/xml/objects/object_bee.xml +++ b/assets/xml/objects/object_bee.xml @@ -14,15 +14,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index 554047b443..0602f987d4 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -28,30 +28,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -84,29 +84,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bh.xml b/assets/xml/objects/object_bh.xml index d54e99e23c..84f3050c01 100644 --- a/assets/xml/objects/object_bh.xml +++ b/assets/xml/objects/object_bh.xml @@ -8,11 +8,11 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_bigokuta.xml b/assets/xml/objects/object_bigokuta.xml index 653853c928..21ead0501a 100644 --- a/assets/xml/objects/object_bigokuta.xml +++ b/assets/xml/objects/object_bigokuta.xml @@ -34,25 +34,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bji.xml b/assets/xml/objects/object_bji.xml index cd953541c1..b41ac15468 100644 --- a/assets/xml/objects/object_bji.xml +++ b/assets/xml/objects/object_bji.xml @@ -36,22 +36,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bjt.xml b/assets/xml/objects/object_bjt.xml index 9f0c0edc23..6266711aba 100644 --- a/assets/xml/objects/object_bjt.xml +++ b/assets/xml/objects/object_bjt.xml @@ -12,12 +12,12 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_bob.xml b/assets/xml/objects/object_bob.xml index 968a838d2f..f942c84db3 100644 --- a/assets/xml/objects/object_bob.xml +++ b/assets/xml/objects/object_bob.xml @@ -1,21 +1,21 @@  - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boj.xml b/assets/xml/objects/object_boj.xml index e59c72027b..ed42d90314 100644 --- a/assets/xml/objects/object_boj.xml +++ b/assets/xml/objects/object_boj.xml @@ -60,22 +60,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss01.xml b/assets/xml/objects/object_boss01.xml index a9865a0962..6a10080a33 100644 --- a/assets/xml/objects/object_boss01.xml +++ b/assets/xml/objects/object_boss01.xml @@ -62,58 +62,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -163,27 +163,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss02.xml b/assets/xml/objects/object_boss02.xml index fee15d4a06..0370e1ae2f 100644 --- a/assets/xml/objects/object_boss02.xml +++ b/assets/xml/objects/object_boss02.xml @@ -34,19 +34,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -71,29 +71,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml index 5cf4ad2b8a..e483cbc896 100644 --- a/assets/xml/objects/object_boss03.xml +++ b/assets/xml/objects/object_boss03.xml @@ -49,23 +49,23 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + diff --git a/assets/xml/objects/object_boss04.xml b/assets/xml/objects/object_boss04.xml index d24ad986a9..d5d0f728a2 100644 --- a/assets/xml/objects/object_boss04.xml +++ b/assets/xml/objects/object_boss04.xml @@ -17,14 +17,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_boss05.xml b/assets/xml/objects/object_boss05.xml index ec994d8242..b401ae2be9 100644 --- a/assets/xml/objects/object_boss05.xml +++ b/assets/xml/objects/object_boss05.xml @@ -15,16 +15,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -53,26 +53,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss07.xml b/assets/xml/objects/object_boss07.xml index aa0ef8c886..15a2e162da 100644 --- a/assets/xml/objects/object_boss07.xml +++ b/assets/xml/objects/object_boss07.xml @@ -23,31 +23,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -98,25 +98,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -157,34 +157,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_boss_hakugin.xml b/assets/xml/objects/object_boss_hakugin.xml index 52a124fec1..62d6fb91f6 100644 --- a/assets/xml/objects/object_boss_hakugin.xml +++ b/assets/xml/objects/object_boss_hakugin.xml @@ -41,39 +41,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index c1185f237e..1641e1a498 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -17,11 +17,11 @@ - - - - - + + + + + @@ -30,21 +30,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bsb.xml b/assets/xml/objects/object_bsb.xml index ddaadc33d9..7ccf12bce2 100644 --- a/assets/xml/objects/object_bsb.xml +++ b/assets/xml/objects/object_bsb.xml @@ -52,27 +52,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_crow.xml b/assets/xml/objects/object_crow.xml index b3b004cd7b..3092d91ec3 100644 --- a/assets/xml/objects/object_crow.xml +++ b/assets/xml/objects/object_crow.xml @@ -11,14 +11,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_cs.xml b/assets/xml/objects/object_cs.xml index 65cff1d46c..5ed7254937 100644 --- a/assets/xml/objects/object_cs.xml +++ b/assets/xml/objects/object_cs.xml @@ -69,27 +69,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dai.xml b/assets/xml/objects/object_dai.xml index c39ef9a6df..f613a9ab82 100644 --- a/assets/xml/objects/object_dai.xml +++ b/assets/xml/objects/object_dai.xml @@ -63,24 +63,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_daiku.xml b/assets/xml/objects/object_daiku.xml index 0c42532ecd..57124bd281 100644 --- a/assets/xml/objects/object_daiku.xml +++ b/assets/xml/objects/object_daiku.xml @@ -49,23 +49,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_death.xml b/assets/xml/objects/object_death.xml index 2aba9582d1..7d3e1e5969 100644 --- a/assets/xml/objects/object_death.xml +++ b/assets/xml/objects/object_death.xml @@ -54,28 +54,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index bd59555c48..b82cfb94b7 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -13,14 +13,14 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_dekunuts.xml b/assets/xml/objects/object_dekunuts.xml index 442dc756d8..2e9529d4c6 100644 --- a/assets/xml/objects/object_dekunuts.xml +++ b/assets/xml/objects/object_dekunuts.xml @@ -18,16 +18,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_dinofos.xml b/assets/xml/objects/object_dinofos.xml index 83eade0dad..7b1ff8c205 100644 --- a/assets/xml/objects/object_dinofos.xml +++ b/assets/xml/objects/object_dinofos.xml @@ -41,27 +41,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnk.xml b/assets/xml/objects/object_dnk.xml index 0d290f19de..359cdfd5d3 100644 --- a/assets/xml/objects/object_dnk.xml +++ b/assets/xml/objects/object_dnk.xml @@ -33,17 +33,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_dno.xml b/assets/xml/objects/object_dno.xml index 16fa904c5b..a320be10fe 100644 --- a/assets/xml/objects/object_dno.xml +++ b/assets/xml/objects/object_dno.xml @@ -54,33 +54,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnp.xml b/assets/xml/objects/object_dnp.xml index 575ae3d698..3763685782 100644 --- a/assets/xml/objects/object_dnp.xml +++ b/assets/xml/objects/object_dnp.xml @@ -56,32 +56,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnq.xml b/assets/xml/objects/object_dnq.xml index d286082bf8..830e6d8e43 100644 --- a/assets/xml/objects/object_dnq.xml +++ b/assets/xml/objects/object_dnq.xml @@ -56,39 +56,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnt.xml b/assets/xml/objects/object_dnt.xml index d2ff328d3e..6a2b0058d1 100644 --- a/assets/xml/objects/object_dnt.xml +++ b/assets/xml/objects/object_dnt.xml @@ -57,34 +57,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dodongo.xml b/assets/xml/objects/object_dodongo.xml index cf0fa37256..f63a27467a 100644 --- a/assets/xml/objects/object_dodongo.xml +++ b/assets/xml/objects/object_dodongo.xml @@ -28,37 +28,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dog.xml b/assets/xml/objects/object_dog.xml index 7e9cd3e992..f14a3d55e7 100644 --- a/assets/xml/objects/object_dog.xml +++ b/assets/xml/objects/object_dog.xml @@ -36,18 +36,18 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_drs.xml b/assets/xml/objects/object_drs.xml index 35202d17bf..c5f4ee7261 100644 --- a/assets/xml/objects/object_drs.xml +++ b/assets/xml/objects/object_drs.xml @@ -1,20 +1,21 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ds2.xml b/assets/xml/objects/object_ds2.xml index 0745fad580..1f1fd9d207 100644 --- a/assets/xml/objects/object_ds2.xml +++ b/assets/xml/objects/object_ds2.xml @@ -19,14 +19,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml index 63ccca136b..8cee6b22e7 100644 --- a/assets/xml/objects/object_ds2n.xml +++ b/assets/xml/objects/object_ds2n.xml @@ -31,25 +31,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dt.xml b/assets/xml/objects/object_dt.xml index a4df244adb..78ad8046e9 100644 --- a/assets/xml/objects/object_dt.xml +++ b/assets/xml/objects/object_dt.xml @@ -47,21 +47,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml index 7de69f2ff3..8dd90375ab 100644 --- a/assets/xml/objects/object_dy_obj.xml +++ b/assets/xml/objects/object_dy_obj.xml @@ -64,33 +64,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index f251f9607b..4d4c1029c5 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -3,8 +3,8 @@ - - - + + + diff --git a/assets/xml/objects/object_eg.xml b/assets/xml/objects/object_eg.xml index 1458afaec0..46d3e00890 100644 --- a/assets/xml/objects/object_eg.xml +++ b/assets/xml/objects/object_eg.xml @@ -47,30 +47,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_famos.xml b/assets/xml/objects/object_famos.xml index 7cec70be54..4466f9b300 100644 --- a/assets/xml/objects/object_famos.xml +++ b/assets/xml/objects/object_famos.xml @@ -15,12 +15,12 @@ - - - - - - + + + + + + diff --git a/assets/xml/objects/object_fb.xml b/assets/xml/objects/object_fb.xml index 101ddbc5a7..f0d3b8111c 100644 --- a/assets/xml/objects/object_fb.xml +++ b/assets/xml/objects/object_fb.xml @@ -32,30 +32,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_firefly.xml b/assets/xml/objects/object_firefly.xml index f6d8f1bc71..84018ddd86 100644 --- a/assets/xml/objects/object_firefly.xml +++ b/assets/xml/objects/object_firefly.xml @@ -22,33 +22,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index c0cbd54c77..9da78b6ab8 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -20,22 +20,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -65,15 +65,15 @@ - - - - - - - - - + + + + + + + + + @@ -120,18 +120,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fr.xml b/assets/xml/objects/object_fr.xml index cf65cc0ac2..cb02087bab 100644 --- a/assets/xml/objects/object_fr.xml +++ b/assets/xml/objects/object_fr.xml @@ -39,29 +39,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml index fe847642e7..4094355aeb 100644 --- a/assets/xml/objects/object_fu.xml +++ b/assets/xml/objects/object_fu.xml @@ -32,21 +32,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index e401fd0888..2f6aac2dda 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml index 357b832843..6338b48d61 100644 --- a/assets/xml/objects/object_geldb.xml +++ b/assets/xml/objects/object_geldb.xml @@ -48,30 +48,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gg.xml b/assets/xml/objects/object_gg.xml index e1ac1c779b..17c21c93ab 100644 --- a/assets/xml/objects/object_gg.xml +++ b/assets/xml/objects/object_gg.xml @@ -52,26 +52,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gk.xml b/assets/xml/objects/object_gk.xml index 420f544f19..3fde40f946 100644 --- a/assets/xml/objects/object_gk.xml +++ b/assets/xml/objects/object_gk.xml @@ -23,26 +23,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index ee793c256a..ae80c7dfc2 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -44,28 +44,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_grasshopper.xml b/assets/xml/objects/object_grasshopper.xml index 5b8ee82af2..35120e0c98 100644 --- a/assets/xml/objects/object_grasshopper.xml +++ b/assets/xml/objects/object_grasshopper.xml @@ -35,30 +35,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ha.xml b/assets/xml/objects/object_ha.xml index f3d3f10290..4f595b6bed 100644 --- a/assets/xml/objects/object_ha.xml +++ b/assets/xml/objects/object_ha.xml @@ -38,32 +38,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -105,31 +105,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hakaisi.xml b/assets/xml/objects/object_hakaisi.xml index 82e80242e6..227fc4cf86 100644 --- a/assets/xml/objects/object_hakaisi.xml +++ b/assets/xml/objects/object_hakaisi.xml @@ -10,6 +10,6 @@ - + diff --git a/assets/xml/objects/object_harfgibud.xml b/assets/xml/objects/object_harfgibud.xml index 9a9bf4745c..a97e42c000 100644 --- a/assets/xml/objects/object_harfgibud.xml +++ b/assets/xml/objects/object_harfgibud.xml @@ -35,25 +35,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -91,25 +91,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml index 3131a6628d..3f5e12a381 100644 --- a/assets/xml/objects/object_hata.xml +++ b/assets/xml/objects/object_hata.xml @@ -14,26 +14,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hintnuts.xml b/assets/xml/objects/object_hintnuts.xml index 655c8ae3c4..a500981a7e 100644 --- a/assets/xml/objects/object_hintnuts.xml +++ b/assets/xml/objects/object_hintnuts.xml @@ -18,16 +18,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_horse_link_child.xml b/assets/xml/objects/object_horse_link_child.xml index f844224fa5..47ceff55aa 100644 --- a/assets/xml/objects/object_horse_link_child.xml +++ b/assets/xml/objects/object_horse_link_child.xml @@ -28,53 +28,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hs.xml b/assets/xml/objects/object_hs.xml index 3151288155..0d36c4ff1a 100644 --- a/assets/xml/objects/object_hs.xml +++ b/assets/xml/objects/object_hs.xml @@ -27,21 +27,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 34dcac8f2c..0b68303dab 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -72,35 +72,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ikn_demo.xml b/assets/xml/objects/object_ikn_demo.xml index 69d225933c..56f8fd0e97 100644 --- a/assets/xml/objects/object_ikn_demo.xml +++ b/assets/xml/objects/object_ikn_demo.xml @@ -27,23 +27,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -57,13 +57,13 @@ - - - - - - - + + + + + + + @@ -83,13 +83,13 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_in.xml b/assets/xml/objects/object_in.xml index 42bace14f8..3874e4834d 100644 --- a/assets/xml/objects/object_in.xml +++ b/assets/xml/objects/object_in.xml @@ -93,26 +93,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_in2.xml b/assets/xml/objects/object_in2.xml index a47c7613ea..4457defae5 100644 --- a/assets/xml/objects/object_in2.xml +++ b/assets/xml/objects/object_in2.xml @@ -47,26 +47,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_js.xml b/assets/xml/objects/object_js.xml index be9246ab66..92f14da0ba 100644 --- a/assets/xml/objects/object_js.xml +++ b/assets/xml/objects/object_js.xml @@ -27,19 +27,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_jso.xml b/assets/xml/objects/object_jso.xml index 777c6e53c3..33816a797f 100644 --- a/assets/xml/objects/object_jso.xml +++ b/assets/xml/objects/object_jso.xml @@ -30,26 +30,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -95,26 +95,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ka.xml b/assets/xml/objects/object_ka.xml index 2944a00b24..36dceb0caf 100644 --- a/assets/xml/objects/object_ka.xml +++ b/assets/xml/objects/object_ka.xml @@ -31,34 +31,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kamejima.xml b/assets/xml/objects/object_kamejima.xml index 8bdb54d06c..9b45ad4789 100644 --- a/assets/xml/objects/object_kamejima.xml +++ b/assets/xml/objects/object_kamejima.xml @@ -43,30 +43,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kbt.xml b/assets/xml/objects/object_kbt.xml index b3ab0baaf8..ec8dbd6ea3 100644 --- a/assets/xml/objects/object_kbt.xml +++ b/assets/xml/objects/object_kbt.xml @@ -43,26 +43,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kgy.xml b/assets/xml/objects/object_kgy.xml index 856c5883d9..0e2d3be2c3 100644 --- a/assets/xml/objects/object_kgy.xml +++ b/assets/xml/objects/object_kgy.xml @@ -45,29 +45,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kitan.xml b/assets/xml/objects/object_kitan.xml index 3884470f94..05d090d93e 100644 --- a/assets/xml/objects/object_kitan.xml +++ b/assets/xml/objects/object_kitan.xml @@ -29,26 +29,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_knight.xml b/assets/xml/objects/object_knight.xml index 67d87a0ffd..0459cb062f 100644 --- a/assets/xml/objects/object_knight.xml +++ b/assets/xml/objects/object_knight.xml @@ -143,64 +143,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 24c16e1fcb..2b714be38f 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -52,30 +52,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_boy.xml b/assets/xml/objects/object_link_boy.xml index 8bfd17e988..b0a85ece51 100644 --- a/assets/xml/objects/object_link_boy.xml +++ b/assets/xml/objects/object_link_boy.xml @@ -55,27 +55,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml index 86c5969095..51145033c5 100644 --- a/assets/xml/objects/object_link_child.xml +++ b/assets/xml/objects/object_link_child.xml @@ -130,27 +130,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_goron.xml b/assets/xml/objects/object_link_goron.xml index 05336d6dbe..2fe3906fb6 100644 --- a/assets/xml/objects/object_link_goron.xml +++ b/assets/xml/objects/object_link_goron.xml @@ -76,33 +76,33 @@ - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_nuts.xml b/assets/xml/objects/object_link_nuts.xml index 169dc848aa..e3dab39dac 100644 --- a/assets/xml/objects/object_link_nuts.xml +++ b/assets/xml/objects/object_link_nuts.xml @@ -53,27 +53,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_link_zora.xml b/assets/xml/objects/object_link_zora.xml index e3bbaba951..d36aaa420f 100644 --- a/assets/xml/objects/object_link_zora.xml +++ b/assets/xml/objects/object_link_zora.xml @@ -63,27 +63,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ma1.xml b/assets/xml/objects/object_ma1.xml index 7001eb84ac..3d0ea1fcc5 100644 --- a/assets/xml/objects/object_ma1.xml +++ b/assets/xml/objects/object_ma1.xml @@ -63,29 +63,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ma2.xml b/assets/xml/objects/object_ma2.xml index a6554d3875..a61eff4e08 100644 --- a/assets/xml/objects/object_ma2.xml +++ b/assets/xml/objects/object_ma2.xml @@ -58,28 +58,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mk.xml b/assets/xml/objects/object_mk.xml index c927f33de2..1ee3741bb3 100644 --- a/assets/xml/objects/object_mk.xml +++ b/assets/xml/objects/object_mk.xml @@ -28,18 +28,18 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mm.xml b/assets/xml/objects/object_mm.xml index 43c0e9b194..baac5425d0 100644 --- a/assets/xml/objects/object_mm.xml +++ b/assets/xml/objects/object_mm.xml @@ -39,22 +39,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mnk.xml b/assets/xml/objects/object_mnk.xml index 8f813ba002..c6e23399da 100644 --- a/assets/xml/objects/object_mnk.xml +++ b/assets/xml/objects/object_mnk.xml @@ -19,11 +19,11 @@ - - - - - + + + + + @@ -82,29 +82,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -118,9 +118,9 @@ - - - - + + + + diff --git a/assets/xml/objects/object_ms.xml b/assets/xml/objects/object_ms.xml index 9d7df53ad2..a4a36e1493 100644 --- a/assets/xml/objects/object_ms.xml +++ b/assets/xml/objects/object_ms.xml @@ -19,14 +19,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_msmo.xml b/assets/xml/objects/object_msmo.xml index cb08f53ef6..6bfd0e46d9 100644 --- a/assets/xml/objects/object_msmo.xml +++ b/assets/xml/objects/object_msmo.xml @@ -1,9 +1,10 @@  + - - - - - + + + + + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml index a1c11fed2f..925cb74e94 100644 --- a/assets/xml/objects/object_mu.xml +++ b/assets/xml/objects/object_mu.xml @@ -36,27 +36,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml index e0f557f981..e8a695b52b 100644 --- a/assets/xml/objects/object_nb.xml +++ b/assets/xml/objects/object_nb.xml @@ -34,13 +34,13 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_niw.xml b/assets/xml/objects/object_niw.xml index b055a27409..e494265608 100644 --- a/assets/xml/objects/object_niw.xml +++ b/assets/xml/objects/object_niw.xml @@ -18,21 +18,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index 9557dc73e3..6c3af07780 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -78,24 +78,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ob.xml b/assets/xml/objects/object_ob.xml index 7a75a59f28..0f79703b57 100644 --- a/assets/xml/objects/object_ob.xml +++ b/assets/xml/objects/object_ob.xml @@ -59,24 +59,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_okuta.xml b/assets/xml/objects/object_okuta.xml index 0eebb587e1..e71f65a1cb 100644 --- a/assets/xml/objects/object_okuta.xml +++ b/assets/xml/objects/object_okuta.xml @@ -34,22 +34,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_osn.xml b/assets/xml/objects/object_osn.xml index 0994d057fd..b31660e6ac 100644 --- a/assets/xml/objects/object_osn.xml +++ b/assets/xml/objects/object_osn.xml @@ -92,25 +92,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ot.xml b/assets/xml/objects/object_ot.xml index 1fb04a34a7..49a8d89cea 100644 --- a/assets/xml/objects/object_ot.xml +++ b/assets/xml/objects/object_ot.xml @@ -30,25 +30,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_owl.xml b/assets/xml/objects/object_owl.xml index 381c0bfd0e..6c9d798833 100644 --- a/assets/xml/objects/object_owl.xml +++ b/assets/xml/objects/object_owl.xml @@ -37,27 +37,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -75,21 +75,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pamera.xml b/assets/xml/objects/object_pamera.xml index 6ce4c5219c..6b457ab8b6 100644 --- a/assets/xml/objects/object_pamera.xml +++ b/assets/xml/objects/object_pamera.xml @@ -38,29 +38,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ph.xml b/assets/xml/objects/object_ph.xml index df0cff73d3..2e8a8eb29b 100644 --- a/assets/xml/objects/object_ph.xml +++ b/assets/xml/objects/object_ph.xml @@ -16,29 +16,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po.xml b/assets/xml/objects/object_po.xml index 5d66d380cd..2cc6e5cbd8 100644 --- a/assets/xml/objects/object_po.xml +++ b/assets/xml/objects/object_po.xml @@ -28,26 +28,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_composer.xml b/assets/xml/objects/object_po_composer.xml index 288dd41c31..ae8ef56e33 100644 --- a/assets/xml/objects/object_po_composer.xml +++ b/assets/xml/objects/object_po_composer.xml @@ -42,17 +42,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_fusen.xml b/assets/xml/objects/object_po_fusen.xml index 6dd6d1f9bb..5885b89a3c 100644 --- a/assets/xml/objects/object_po_fusen.xml +++ b/assets/xml/objects/object_po_fusen.xml @@ -18,15 +18,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index 6004d6cbfa..f42fe1664f 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -37,17 +37,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pp.xml b/assets/xml/objects/object_pp.xml index 63bf541cd0..1ac690935d 100644 --- a/assets/xml/objects/object_pp.xml +++ b/assets/xml/objects/object_pp.xml @@ -37,32 +37,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100,32 +100,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pr.xml b/assets/xml/objects/object_pr.xml index 27a03fdcf5..95fc4743c5 100644 --- a/assets/xml/objects/object_pr.xml +++ b/assets/xml/objects/object_pr.xml @@ -31,16 +31,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -51,11 +51,11 @@ - - - - - + + + + + diff --git a/assets/xml/objects/object_ps.xml b/assets/xml/objects/object_ps.xml index 9febc56609..f341e95a43 100644 --- a/assets/xml/objects/object_ps.xml +++ b/assets/xml/objects/object_ps.xml @@ -22,18 +22,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pst.xml b/assets/xml/objects/object_pst.xml index 9d62acba78..3649877eac 100644 --- a/assets/xml/objects/object_pst.xml +++ b/assets/xml/objects/object_pst.xml @@ -7,8 +7,8 @@ - - - + + + diff --git a/assets/xml/objects/object_raf.xml b/assets/xml/objects/object_raf.xml index df3d619d1c..26c0741ecc 100644 --- a/assets/xml/objects/object_raf.xml +++ b/assets/xml/objects/object_raf.xml @@ -26,17 +26,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rat.xml b/assets/xml/objects/object_rat.xml index 5c979b098c..ce32e20ccd 100644 --- a/assets/xml/objects/object_rat.xml +++ b/assets/xml/objects/object_rat.xml @@ -14,15 +14,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_rb.xml b/assets/xml/objects/object_rb.xml index 3898e84176..a344c5327e 100644 --- a/assets/xml/objects/object_rb.xml +++ b/assets/xml/objects/object_rb.xml @@ -22,23 +22,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rs.xml b/assets/xml/objects/object_rs.xml index 5019d9631f..01099db478 100644 --- a/assets/xml/objects/object_rs.xml +++ b/assets/xml/objects/object_rs.xml @@ -33,21 +33,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index 016a610e82..f2d3fd2b0c 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -46,29 +46,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rz.xml b/assets/xml/objects/object_rz.xml index 323393f87e..a75e033f0a 100644 --- a/assets/xml/objects/object_rz.xml +++ b/assets/xml/objects/object_rz.xml @@ -45,27 +45,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sb.xml b/assets/xml/objects/object_sb.xml index 9fcd76a8f4..359cff20dd 100644 --- a/assets/xml/objects/object_sb.xml +++ b/assets/xml/objects/object_sb.xml @@ -16,15 +16,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_sdn.xml b/assets/xml/objects/object_sdn.xml index 691a272eef..219436b025 100644 --- a/assets/xml/objects/object_sdn.xml +++ b/assets/xml/objects/object_sdn.xml @@ -44,23 +44,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_shn.xml b/assets/xml/objects/object_shn.xml index b322641a9e..1b94600ab4 100644 --- a/assets/xml/objects/object_shn.xml +++ b/assets/xml/objects/object_shn.xml @@ -50,7 +50,7 @@ - + @@ -66,22 +66,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sichitai_obj.xml b/assets/xml/objects/object_sichitai_obj.xml index f093778abd..d1179beab2 100644 --- a/assets/xml/objects/object_sichitai_obj.xml +++ b/assets/xml/objects/object_sichitai_obj.xml @@ -1,9 +1,9 @@  - - - - + + + + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index cafba559ed..c9935b64fd 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -36,26 +36,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_snowman.xml b/assets/xml/objects/object_snowman.xml index f92110b3ed..91b650a75c 100644 --- a/assets/xml/objects/object_snowman.xml +++ b/assets/xml/objects/object_snowman.xml @@ -18,25 +18,25 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + diff --git a/assets/xml/objects/object_ssh.xml b/assets/xml/objects/object_ssh.xml index a95597ae48..57599fdce3 100644 --- a/assets/xml/objects/object_ssh.xml +++ b/assets/xml/objects/object_ssh.xml @@ -29,36 +29,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_st.xml b/assets/xml/objects/object_st.xml index 011d76449c..2dabce2f83 100644 --- a/assets/xml/objects/object_st.xml +++ b/assets/xml/objects/object_st.xml @@ -35,36 +35,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sth.xml b/assets/xml/objects/object_sth.xml index 7b6947b07c..c7a0ffd250 100644 --- a/assets/xml/objects/object_sth.xml +++ b/assets/xml/objects/object_sth.xml @@ -22,21 +22,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_stk.xml b/assets/xml/objects/object_stk.xml index 44a311dfbd..68e8ae26b4 100644 --- a/assets/xml/objects/object_stk.xml +++ b/assets/xml/objects/object_stk.xml @@ -55,28 +55,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tab.xml b/assets/xml/objects/object_tab.xml index 52c3156a3c..9a63c2ed33 100644 --- a/assets/xml/objects/object_tab.xml +++ b/assets/xml/objects/object_tab.xml @@ -24,9 +24,10 @@ - + - + + @@ -37,26 +38,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tanron4.xml b/assets/xml/objects/object_tanron4.xml index 7e48cdf0ec..f1002fd229 100644 --- a/assets/xml/objects/object_tanron4.xml +++ b/assets/xml/objects/object_tanron4.xml @@ -9,16 +9,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_test3.xml b/assets/xml/objects/object_test3.xml index fc6e026a94..6b0a5349ce 100644 --- a/assets/xml/objects/object_test3.xml +++ b/assets/xml/objects/object_test3.xml @@ -42,27 +42,27 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_thiefbird.xml b/assets/xml/objects/object_thiefbird.xml index 31f0213c54..e7cb3ac915 100644 --- a/assets/xml/objects/object_thiefbird.xml +++ b/assets/xml/objects/object_thiefbird.xml @@ -44,23 +44,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tite.xml b/assets/xml/objects/object_tite.xml index eec5b05d0d..681b732e8c 100644 --- a/assets/xml/objects/object_tite.xml +++ b/assets/xml/objects/object_tite.xml @@ -25,30 +25,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tk.xml b/assets/xml/objects/object_tk.xml index 813b0fb24e..0c0ea38314 100644 --- a/assets/xml/objects/object_tk.xml +++ b/assets/xml/objects/object_tk.xml @@ -43,23 +43,23 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tl.xml b/assets/xml/objects/object_tl.xml index 656d707433..6397283af1 100644 --- a/assets/xml/objects/object_tl.xml +++ b/assets/xml/objects/object_tl.xml @@ -7,10 +7,10 @@ - - - - + + + + @@ -43,19 +43,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_toryo.xml b/assets/xml/objects/object_toryo.xml index 101db58395..45d3da1005 100644 --- a/assets/xml/objects/object_toryo.xml +++ b/assets/xml/objects/object_toryo.xml @@ -32,22 +32,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_trt.xml b/assets/xml/objects/object_trt.xml index ecde36e182..a0d83076e8 100644 --- a/assets/xml/objects/object_trt.xml +++ b/assets/xml/objects/object_trt.xml @@ -63,32 +63,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tru.xml b/assets/xml/objects/object_tru.xml index 0ca1acff45..dd0e6d20c8 100644 --- a/assets/xml/objects/object_tru.xml +++ b/assets/xml/objects/object_tru.xml @@ -76,33 +76,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tsn.xml b/assets/xml/objects/object_tsn.xml index 63c03c84c3..bd83a3be50 100644 --- a/assets/xml/objects/object_tsn.xml +++ b/assets/xml/objects/object_tsn.xml @@ -31,23 +31,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_uch.xml b/assets/xml/objects/object_uch.xml index 86f2a4646e..a58af56542 100644 --- a/assets/xml/objects/object_uch.xml +++ b/assets/xml/objects/object_uch.xml @@ -28,19 +28,19 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_um.xml b/assets/xml/objects/object_um.xml index 693c704d33..5717124a7c 100644 --- a/assets/xml/objects/object_um.xml +++ b/assets/xml/objects/object_um.xml @@ -49,28 +49,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_utubo.xml b/assets/xml/objects/object_utubo.xml index 97a7095c9b..68cd3e1960 100644 --- a/assets/xml/objects/object_utubo.xml +++ b/assets/xml/objects/object_utubo.xml @@ -18,22 +18,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_vm.xml b/assets/xml/objects/object_vm.xml index b07534c65c..b6c1cdfa29 100644 --- a/assets/xml/objects/object_vm.xml +++ b/assets/xml/objects/object_vm.xml @@ -15,16 +15,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_wallmaster.xml b/assets/xml/objects/object_wallmaster.xml index 249af61eec..d6ab1aa02e 100644 --- a/assets/xml/objects/object_wallmaster.xml +++ b/assets/xml/objects/object_wallmaster.xml @@ -30,31 +30,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_warp1.xml b/assets/xml/objects/object_warp1.xml index 50d4c527a1..8143347923 100644 --- a/assets/xml/objects/object_warp1.xml +++ b/assets/xml/objects/object_warp1.xml @@ -11,28 +11,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wdhand.xml b/assets/xml/objects/object_wdhand.xml index 22e12cfa08..bcd5b0ce36 100644 --- a/assets/xml/objects/object_wdhand.xml +++ b/assets/xml/objects/object_wdhand.xml @@ -16,13 +16,13 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index 56c9e1621a..4775552e2c 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -27,28 +27,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -81,28 +81,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wiz.xml b/assets/xml/objects/object_wiz.xml index 7f41954cf2..d9c8a15898 100644 --- a/assets/xml/objects/object_wiz.xml +++ b/assets/xml/objects/object_wiz.xml @@ -78,25 +78,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zl1.xml b/assets/xml/objects/object_zl1.xml index 759b358678..04d4ae406e 100644 --- a/assets/xml/objects/object_zl1.xml +++ b/assets/xml/objects/object_zl1.xml @@ -57,24 +57,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zl4.xml b/assets/xml/objects/object_zl4.xml index f13487f981..dafdef8cda 100644 --- a/assets/xml/objects/object_zl4.xml +++ b/assets/xml/objects/object_zl4.xml @@ -51,24 +51,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zm.xml b/assets/xml/objects/object_zm.xml index 022efcf279..f6f1b95e5a 100644 --- a/assets/xml/objects/object_zm.xml +++ b/assets/xml/objects/object_zm.xml @@ -38,24 +38,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zo.xml b/assets/xml/objects/object_zo.xml index f0926dd2b1..8fc22ae469 100644 --- a/assets/xml/objects/object_zo.xml +++ b/assets/xml/objects/object_zo.xml @@ -42,26 +42,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zob.xml b/assets/xml/objects/object_zob.xml index 22400d46ef..bc4d61c6a6 100644 --- a/assets/xml/objects/object_zob.xml +++ b/assets/xml/objects/object_zob.xml @@ -44,30 +44,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zod.xml b/assets/xml/objects/object_zod.xml index f1152e2ac1..3e0b6567a0 100644 --- a/assets/xml/objects/object_zod.xml +++ b/assets/xml/objects/object_zod.xml @@ -35,16 +35,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_zog.xml b/assets/xml/objects/object_zog.xml index 55f169ad1a..627bb676ad 100644 --- a/assets/xml/objects/object_zog.xml +++ b/assets/xml/objects/object_zog.xml @@ -85,28 +85,28 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zoraegg.xml b/assets/xml/objects/object_zoraegg.xml index 0835e26989..367d2df760 100644 --- a/assets/xml/objects/object_zoraegg.xml +++ b/assets/xml/objects/object_zoraegg.xml @@ -16,13 +16,13 @@ - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_zos.xml b/assets/xml/objects/object_zos.xml index 5af477773f..1f5a2a5429 100644 --- a/assets/xml/objects/object_zos.xml +++ b/assets/xml/objects/object_zos.xml @@ -45,24 +45,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zov.xml b/assets/xml/objects/object_zov.xml index e485291b3b..abbc52268b 100644 --- a/assets/xml/objects/object_zov.xml +++ b/assets/xml/objects/object_zov.xml @@ -54,28 +54,28 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Mm3.xml b/assets/xml/overlays/ovl_En_Mm3.xml new file mode 100644 index 0000000000..207b5ec8f6 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Mm3.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/include/functions.h b/include/functions.h index 9cd3e6af26..154ee737be 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1144,7 +1144,7 @@ u32 Camera_ChangeDataIdx(Camera* camera, u32 camDataIdx); // void func_800DFC1C(void); // void func_800DFC40(void); s32 Camera_GetInputDirYaw(Camera* camera); -// void func_800DFC90(void); +void func_800DFC90(Vec3s* arg0, Camera* camera); s16 Camera_GetCamDirPitch(Camera* camera); s16 Camera_GetCamDirYaw(Camera* camera); void func_800DFD04(Camera* camera, s32 arg1, s32 arg2, s32 arg3); @@ -1900,7 +1900,7 @@ void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); // void func_8010E028(void); // void func_8010E968(void); void func_8010E9F0(s16 arg0, s16 arg1); -// void func_8010EA9C(void); +void func_8010EA9C(s32 arg0, s32 arg1); // void func_8010EB50(void); // void func_8010EBA0(void); // void func_8010EC54(void); @@ -2405,7 +2405,7 @@ void Animation_MorphToLoop(SkelAnime* skelAnime, AnimationHeader* animation, f32 void Animation_PlayLoopSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed); void Animation_EndLoop(SkelAnime* skelAnime); void Animation_Reverse(SkelAnime* skelAnime); -void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index); +void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle); s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); @@ -2690,11 +2690,7 @@ void func_801588D0(GlobalContext* globalCtx, s16 param_2); // void func_8015E750(void); void func_8015E7EC(GlobalContext* globalCtx, UNK_PTR puParm2); // void func_8015F8A8(UNK_TYPE4 ctxt); -// void func_80160A90(void); -// void func_80160AF8(void); -// void func_80160B40(void); -// void func_80160B80(void); -// void func_80160BC0(void); + void ShrinkWindow_SetLetterboxTarget(s32 target); s32 ShrinkWindow_GetLetterboxTarget(void); void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude); @@ -2822,21 +2818,20 @@ void Play_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting); void func_80169AFC(GlobalContext* globalCtx, s16 camId, s16 arg2); s16 Play_GetCsCamDataSetting(GlobalContext* globalCtx, s32 camId); Vec3s* Play_GetCsCamDataVec3s(GlobalContext* globalCtx, s32 camId); -s16 convert_scene_number_among_shared_scenes(s16 arg0); -void func_80169D40(GlobalContext* globalCtx); -void func_80169DCC(GlobalContext* globalCtx, s32 arg1, u16 arg2, s32 arg3, s32 arg4, Vec3f* arg5, s16 arg6); -void func_80169E6C(GlobalContext* globalCtx, s32 param_1, s32 param_2); -// void func_80169ECC(void); -void func_80169EFC(GlobalContext* globalCtx); -void func_80169F78(GlobalContext* globalCtx); -void func_80169FDC(GlobalContext* globalCtx); -// void func_80169FFC(void); -s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx); -// UNK_TYPE4 func_8016A02C(s32 param_1, s32 param_2, s16* param_3); -// void func_8016A0AC(void); +s16 Play_GetOriginalSceneNumber(s16 sceneNum); +void Play_SaveCycleSceneFlags(GameState* gameState); +void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); +void Play_SetupRespawnPoint(GameState* gameState, s32 respawnNumber, s32 playerParams); +void func_80169EFC(GameState* gameState); +void func_80169F78(GameState* gameState); +void func_80169FDC(GameState* gameState); +s32 func_80169FFC(GameState* gameState); +s32 FrameAdvance_IsEnabled(GameState* gameState); +s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw); +s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos); s32 func_8016A168(void); -// void func_8016A178(void); -void func_8016A268(GlobalContext* globalCtx, s32 param_2, s32 param_3, s32 param_4, s32 param_5, s32 param_6); +void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 cutscene); +void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5); void Play_Init(GameState* gameState); // void func_8016AC10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); // void func_8016AE1C(void); @@ -3639,7 +3634,7 @@ void func_801A0124(Vec3f* pos, u8 arg1); // void func_801A0184(void); // void func_801A01C4(void); void func_801A0204(s8 seqId); -// void func_801A0238(void); +void func_801A0238(s32 arg0, s32 arg1); // void func_801A026C(void); // void func_801A0318(void); // void func_801A046C(void); diff --git a/include/initvars.h b/include/initvars.h index 797e738764..11a6719e9c 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -34,6 +34,7 @@ extern EffectSsInit Effect_Ss_Ice_Smoke_InitVars; extern EffectSsInit Effect_En_Ice_Block_InitVars; extern EffectSsInit Effect_Ss_Sbn_InitVars; +extern ActorInit Player_InitVars; extern ActorInit Arms_Hook_InitVars; extern ActorInit Arrow_Fire_InitVars; extern ActorInit Arrow_Ice_InitVars; diff --git a/include/variables.h b/include/variables.h index 9ddad27f90..7eafe0d2f3 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1535,7 +1535,6 @@ extern char D_801D0714[]; // extern UNK_TYPE1 D_801D08E4; // extern UNK_TYPE1 D_801D08E8; // extern UNK_TYPE1 D_801D0900; -extern ActorInit Player_InitVars; extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[2]; // extern UNK_TYPE1 D_801D0B8C; extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; @@ -3294,10 +3293,6 @@ extern LightsBuffer sLightsBuffer; // extern UNK_TYPE1 D_801F6B1E; // extern UNK_TYPE1 D_801F6B20; // extern UNK_TYPE1 D_801F6B22; -// extern UNK_TYPE1 D_801F6B30; -// extern UNK_TYPE1 D_801F6B34; -// extern UNK_TYPE1 D_801F6B38; -// extern UNK_TYPE1 D_801F6B3C; extern ShrinkWindowContext gShrinkWindowContext; extern ShrinkWindowContext* gShrinkWindowContextPtr; // extern UNK_TYPE4 D_801F6B50; diff --git a/include/z64.h b/include/z64.h index 4c875ca7ec..189937fb71 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1291,7 +1291,7 @@ struct GlobalContext { /* 0x18790 */ void (*unk_18790)(struct GlobalContext* globalCtx, s16 arg1, Actor* actor); /* 0x18794 */ void* unk_18794; //! @TODO: Determine function prototype /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct GlobalContext* globalCtx, void* talkAnim, s32 arg2); - /* 0x1879C */ s16 unk_1879C[10]; + /* 0x1879C */ s16 playerActorCsIds[10]; /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f unk_187F0; /* 0x187FC */ MtxF billboardMtxF; @@ -1319,7 +1319,7 @@ struct GlobalContext { /* 0x1887C */ s8 unk_1887C; /* 0x1887D */ s8 unk_1887D; /* 0x1887E */ s8 unk_1887E; - /* 0x1887F */ u8 unk_1887F; + /* 0x1887F */ u8 unk_1887F; // fadeTransition /* 0x18880 */ u8 unk_18880; /* 0x18884 */ CollisionCheckContext colChkCtx; /* 0x18B20 */ u16 envFlags[20]; diff --git a/include/z64item.h b/include/z64item.h index 00683dd402..7d637b2915 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -400,6 +400,7 @@ typedef enum { typedef enum { /* -1 */ EXCH_ITEM_MINUS1 = -1, // Unknown usage or function /* 0x00 */ EXCH_ITEM_NONE, + /* 0x13 */ EXCH_ITEM_13 = 0x13, /* 0x1E */ EXCH_ITEM_1E = 0x1E, // BOTTLE_MUSHROOM /* 0x2A */ EXCH_ITEM_2A = 0x2A, // MOON_TEAR? /* 0x2E */ EXCH_ITEM_2E = 0x2E diff --git a/spec b/spec index 0cfd47f20b..ab47cdd85b 100644 --- a/spec +++ b/spec @@ -553,11 +553,9 @@ beginseg include "build/data/code/z_message_nes.data.o" include "build/src/code/z_message_staff.o" include "build/src/code/z_player_call.o" - include "build/data/code/z_player_call.bss.o" include "build/src/code/z_shrink_window.o" include "build/src/code/db_camera.o" include "build/data/code/db_camera.bss.o" - include "build/data/code/code_801D0B50.data.o" include "build/src/code/z_kaleido_manager.o" include "build/src/code/z_kaleido_scope_call.o" include "build/src/code/z_fbdemo_dlftbls.o" @@ -1360,8 +1358,7 @@ beginseg name "ovl_En_Butte" compress include "build/src/overlays/actors/ovl_En_Butte/z_en_butte.o" - include "build/data/ovl_En_Butte/ovl_En_Butte.data.o" - include "build/data/ovl_En_Butte/ovl_En_Butte.reloc.o" + include "build/src/overlays/actors/ovl_En_Butte/ovl_En_Butte_reloc.o" endseg beginseg @@ -1625,8 +1622,7 @@ beginseg name "ovl_Bg_Ingate" compress include "build/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.o" - include "build/data/ovl_Bg_Ingate/ovl_Bg_Ingate.data.o" - include "build/data/ovl_Bg_Ingate/ovl_Bg_Ingate.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Ingate/ovl_Bg_Ingate_reloc.o" endseg beginseg @@ -2451,8 +2447,7 @@ beginseg name "ovl_En_Syateki_Crow" compress include "build/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.o" - include "build/data/ovl_En_Syateki_Crow/ovl_En_Syateki_Crow.data.o" - include "build/data/ovl_En_Syateki_Crow/ovl_En_Syateki_Crow.reloc.o" + include "build/src/overlays/actors/ovl_En_Syateki_Crow/ovl_En_Syateki_Crow_reloc.o" endseg beginseg @@ -3095,8 +3090,7 @@ beginseg name "ovl_En_Mm3" compress include "build/src/overlays/actors/ovl_En_Mm3/z_en_mm3.o" - include "build/data/ovl_En_Mm3/ovl_En_Mm3.data.o" - include "build/data/ovl_En_Mm3/ovl_En_Mm3.reloc.o" + include "build/src/overlays/actors/ovl_En_Mm3/ovl_En_Mm3_reloc.o" endseg beginseg @@ -3126,8 +3120,7 @@ beginseg name "ovl_En_Prz" compress include "build/src/overlays/actors/ovl_En_Prz/z_en_prz.o" - include "build/data/ovl_En_Prz/ovl_En_Prz.data.o" - include "build/data/ovl_En_Prz/ovl_En_Prz.reloc.o" + include "build/src/overlays/actors/ovl_En_Prz/ovl_En_Prz_reloc.o" endseg beginseg @@ -3661,8 +3654,7 @@ beginseg name "ovl_En_Shn" compress include "build/src/overlays/actors/ovl_En_Shn/z_en_shn.o" - include "build/data/ovl_En_Shn/ovl_En_Shn.data.o" - include "build/data/ovl_En_Shn/ovl_En_Shn.reloc.o" + include "build/src/overlays/actors/ovl_En_Shn/ovl_En_Shn_reloc.o" endseg beginseg @@ -3878,17 +3870,14 @@ beginseg name "ovl_Obj_Hakaisi" compress include "build/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.o" - include "build/data/ovl_Obj_Hakaisi/ovl_Obj_Hakaisi.data.o" - include "build/data/ovl_Obj_Hakaisi/ovl_Obj_Hakaisi.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Hakaisi/ovl_Obj_Hakaisi_reloc.o" endseg beginseg name "ovl_Bg_Hakugin_Switch" compress include "build/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.o" - include "build/data/ovl_Bg_Hakugin_Switch/ovl_Bg_Hakugin_Switch.data.o" - include "build/data/ovl_Bg_Hakugin_Switch/ovl_Bg_Hakugin_Switch.bss.o" - include "build/data/ovl_Bg_Hakugin_Switch/ovl_Bg_Hakugin_Switch.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Hakugin_Switch/ovl_Bg_Hakugin_Switch_reloc.o" endseg beginseg @@ -3955,8 +3944,7 @@ beginseg name "ovl_En_Racedog" compress include "build/src/overlays/actors/ovl_En_Racedog/z_en_racedog.o" - include "build/data/ovl_En_Racedog/ovl_En_Racedog.data.o" - include "build/data/ovl_En_Racedog/ovl_En_Racedog.reloc.o" + include "build/src/overlays/actors/ovl_En_Racedog/ovl_En_Racedog_reloc.o" endseg beginseg @@ -4045,8 +4033,7 @@ beginseg name "ovl_En_Gg2" compress include "build/src/overlays/actors/ovl_En_Gg2/z_en_gg2.o" - include "build/data/ovl_En_Gg2/ovl_En_Gg2.data.o" - include "build/data/ovl_En_Gg2/ovl_En_Gg2.reloc.o" + include "build/src/overlays/actors/ovl_En_Gg2/ovl_En_Gg2_reloc.o" endseg beginseg @@ -4832,8 +4819,7 @@ beginseg name "ovl_En_Tab" compress include "build/src/overlays/actors/ovl_En_Tab/z_en_tab.o" - include "build/data/ovl_En_Tab/ovl_En_Tab.data.o" - include "build/data/ovl_En_Tab/ovl_En_Tab.reloc.o" + include "build/src/overlays/actors/ovl_En_Tab/ovl_En_Tab_reloc.o" endseg beginseg @@ -4906,8 +4892,7 @@ beginseg name "ovl_En_Heishi" compress include "build/src/overlays/actors/ovl_En_Heishi/z_en_heishi.o" - include "build/data/ovl_En_Heishi/ovl_En_Heishi.data.o" - include "build/data/ovl_En_Heishi/ovl_En_Heishi.reloc.o" + include "build/src/overlays/actors/ovl_En_Heishi/ovl_En_Heishi_reloc.o" endseg beginseg @@ -5306,8 +5291,7 @@ beginseg name "ovl_En_Drs" compress include "build/src/overlays/actors/ovl_En_Drs/z_en_drs.o" - include "build/data/ovl_En_Drs/ovl_En_Drs.data.o" - include "build/data/ovl_En_Drs/ovl_En_Drs.reloc.o" + include "build/src/overlays/actors/ovl_En_Drs/ovl_En_Drs_reloc.o" endseg beginseg diff --git a/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c index 754b8759da..d95f532691 100644 --- a/src/code/code_800E8EA0.c +++ b/src/code/code_800E8EA0.c @@ -57,15 +57,13 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* Player* player = GET_PLAYER(globalCtx); s16 sVar3; Vec3f local_14; - s16 sVar3A; actor->focus.pos = actor->world.pos; actor->focus.pos.y += param_5; if (((globalCtx->csCtx).state == 0) && (D_801D0D50 == 0)) { - sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y; - sVar3A = ABS_ALT(sVar3); - if (sVar3A >= 0x4300) { + sVar3 = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); + if (sVar3 >= 0x4300) { func_800E8F08(param_3, param_4); return 0; } @@ -86,14 +84,12 @@ s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* Player* player = GET_PLAYER(globalCtx); s16 sVar3; Vec3f local_14; - s16 sVar3A; actor->focus.pos = param_5; if (((globalCtx->csCtx).state == 0) && (D_801D0D50 == 0)) { - sVar3 = actor->yawTowardsPlayer - actor->shape.rot.y; - sVar3A = ABS_ALT(sVar3); - if (sVar3A >= 0x4300) { + sVar3 = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); + if (sVar3 >= 0x4300) { func_800E8F08(param_3, param_4); return 0; } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 475c31827e..55c5bf2049 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2016,7 +2016,7 @@ s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRa player->getItemDirection = absYawDiff; if ((getItemId > GI_NONE) && (getItemId < GI_MAX)) { - ActorCutscene_SetIntentToPlay(globalCtx->unk_1879C[1]); + ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[1]); } return true; @@ -2237,7 +2237,7 @@ void Actor_InitContext(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEn s32 i; gSaveContext.weekEventReg[92] |= 0x80; - cycleFlags = &gSaveContext.cycleSceneFlags[convert_scene_number_among_shared_scenes(globalCtx->sceneNum)]; + cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); @@ -3037,7 +3037,7 @@ void Actor_CleanupContext(ActorContext* actorCtx, GlobalContext* globalCtx) { actorCtx->absoluteSpace = NULL; } - func_80169D40(globalCtx); + Play_SaveCycleSceneFlags(&globalCtx->state); ActorOverlayTable_Cleanup(); } @@ -3405,7 +3405,8 @@ void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player, if (((phi_s2) || (phi_s2_2)) && (func_800B83BC(actor, temp_f0_2))) { if (func_800BB59C(globalCtx, actor)) { if (((!BgCheck_CameraLineTest1(&globalCtx->colCtx, &player->actor.focus.pos, - &actor->focus.pos, &sp70, &sp80, 1, 1, 1, 1, &sp7C)) || + &actor->focus.pos, &sp70, &sp80, true, true, true, true, + &sp7C)) || (SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, sp80, sp7C)))) { if (actor->targetPriority != 0) { if ((phi_s2 != 0) && (actor->targetPriority < D_801ED8D4)) { diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index ddf21fe172..a08e3f822a 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1145,7 +1145,7 @@ ColChkResetFunc sATResetFuncs[] = { s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sATResetFuncs[collider->shape](globalCtx, collider); @@ -1171,7 +1171,7 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colCtx * will be inserted into the next slot. */ s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sATResetFuncs[collider->shape](globalCtx, collider); @@ -1205,7 +1205,7 @@ ColChkResetFunc sACResetFuncs[] = { s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sACResetFuncs[collider->shape](globalCtx, collider); @@ -1231,7 +1231,7 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colCtx * will be inserted into the next slot */ s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sACResetFuncs[collider->shape](globalCtx, collider); @@ -1265,7 +1265,7 @@ ColChkResetFunc sOCResetFuncs[] = { s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sOCResetFuncs[collider->shape](globalCtx, collider); @@ -1291,7 +1291,7 @@ s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colCtx * will be inserted into the next slot. */ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, Collider* collider, s32 index) { - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } sOCResetFuncs[collider->shape](globalCtx, collider); @@ -1323,7 +1323,7 @@ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* co s32 CollisionCheck_SetOCLine(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, OcLine* line) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx)) { + if (FrameAdvance_IsEnabled(&globalCtx->state)) { return -1; } diff --git a/src/code/z_effect.c b/src/code/z_effect.c index dd696393ff..4c446b6501 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -124,7 +124,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg *pIndex = TOTAL_EFFECT_COUNT; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(&globalCtx->state) != true) { slotFound = false; switch (type) { case EFFECT_SPARK: diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 43307bbc8a..fd1d0212c7 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -152,7 +152,7 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) { s32 index; - if (FrameAdvance_IsEnabled(globalCtx) != true) { + if (FrameAdvance_IsEnabled(&globalCtx->state) != true) { if (EffectSS_FindFreeSpace(effectsSs->priority, &index) == 0) { sEffectSsInfo.searchIndex = index + 1; sEffectSsInfo.data_table[index] = *effectsSs; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 5dc1f92a21..5c8a75f982 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -30,13 +30,22 @@ const ActorInit En_Item00_InitVars = { }; static ColliderCylinderInit sCylinderInit = { - { COLTYPE_NONE, AT_NONE, AC_ON | AT_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER }, - { ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x00000010, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, - OCELEM_NONE }, + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AT_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000010, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 10, 30, 0, { 0, 0, 0 } }, }; diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index c6ee50d876..e22b5f351e 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -14,10 +14,10 @@ void SkelCurve_Clear(SkelAnimeCurve* skelCurve) { s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, TransformUpdateIndex* transUpdIdx) { SkelCurveLimb** limbs; - SkelCurveLimbList* limbList = (SkelCurveLimbList*)Lib_SegmentedToVirtual(limbListSeg); + SkelCurveLimbList* limbList = Lib_SegmentedToVirtual(limbListSeg); skelCurve->limbCount = limbList->limbCount; - skelCurve->limbList = (SkelCurveLimb**)Lib_SegmentedToVirtual(limbList->limbs); + skelCurve->limbList = Lib_SegmentedToVirtual(limbList->limbs); skelCurve->transforms = ZeldaArena_Malloc(sizeof(*skelCurve->transforms) * skelCurve->limbCount); @@ -100,7 +100,7 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) { void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx) { - SkelCurveLimb* limb = (SkelCurveLimb*)Lib_SegmentedToVirtual(skelCurve->limbList[limbIndex]); + SkelCurveLimb* limb = Lib_SegmentedToVirtual(skelCurve->limbList[limbIndex]); OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 15f3a66935..411cb5d003 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -67,14 +67,14 @@ void GameOver_Update(GlobalContext* globalCtx) { break; case GAMEOVER_DEATH_FADE_OUT: if (func_801A8A50(1) != NA_BGM_GAME_OVER) { - func_80169F78(globalCtx); + func_80169F78(&globalCtx->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; } gSaveContext.nextTransition = 2; gSaveContext.health = 48; gameOverCtx->state++; - if (gSaveContext.inventory.items[SLOT(ITEM_MASK_DEKU)] == ITEM_MASK_DEKU) { + if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { gSaveContext.playerForm = PLAYER_FORM_HUMAN; gSaveContext.equippedMask = PLAYER_MASK_NONE; } diff --git a/src/code/z_play.c b/src/code/z_play.c index a14359be70..b5c2b15c89 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -110,34 +110,254 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/convert_scene_number_among_shared_scenes.s") +/** + * Converts the number of a scene to its "original" equivalent, the default version of the area which the player first + * enters. + */ +s16 Play_GetOriginalSceneNumber(s16 sceneNum) { + // Inverted Stone Tower Temple -> Stone Tower Temple + if (sceneNum == SCENE_INISIE_R) { + return SCENE_INISIE_N; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169D40.s") + // Purified Southern Swamp -> Poisoned Sothern Swamp + if (sceneNum == SCENE_20SICHITAI2) { + return SCENE_20SICHITAI; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169DCC.s") + // Spring Mountain Village -> Winter Mountain Village + if (sceneNum == SCENE_10YUKIYAMANOMURA2) { + return SCENE_10YUKIYAMANOMURA; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169E6C.s") + // Spring Goron Village -> Winter Goron Village + if (sceneNum == SCENE_11GORONNOSATO2) { + return SCENE_11GORONNOSATO; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169ECC.s") + // Spring Path to Goron Village -> Winter Path to Goron Village + if (sceneNum == SCENE_17SETUGEN2) { + return SCENE_17SETUGEN; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169EFC.s") + // Inverted Stone Tower -> Stone Tower + if (sceneNum == SCENE_F41) { + return SCENE_F40; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169F78.s") + return sceneNum; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169FDC.s") +/** + * Copies the flags set in ActorContext over to the current scene's CycleSceneFlags, usually using the original scene + * number. Exception for Inverted Stone Tower Temple, which uses its own. + */ +void Play_SaveCycleSceneFlags(GameState* gameState) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + CycleSceneFlags* cycleSceneFlags; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169FFC.s") + cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(globalCtx->sceneNum)]; + cycleSceneFlags->chest = globalCtx->actorCtx.flags.chest; + cycleSceneFlags->swch0 = globalCtx->actorCtx.flags.switches[0]; + cycleSceneFlags->swch1 = globalCtx->actorCtx.flags.switches[1]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/FrameAdvance_IsEnabled.s") + if (globalCtx->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple + cycleSceneFlags = &gSaveContext.cycleSceneFlags[globalCtx->sceneNum]; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016A02C.s") + cycleSceneFlags->collectible = globalCtx->actorCtx.flags.collectible[0]; + cycleSceneFlags->clearedRoom = globalCtx->actorCtx.flags.clearedRoom; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016A0AC.s") +void Play_SetRespawnData(GameState* gameState, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams, + Vec3f* pos, s16 yaw) { + GlobalContext* globalCtx = (GlobalContext*)gameState; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016A168.s") + gSaveContext.respawn[respawnMode].entranceIndex = Entrance_CreateIndex(entranceIndex >> 9, 0, entranceIndex & 0xF); + gSaveContext.respawn[respawnMode].roomIndex = roomIndex; + gSaveContext.respawn[respawnMode].pos = *pos; + gSaveContext.respawn[respawnMode].yaw = yaw; + gSaveContext.respawn[respawnMode].playerParams = playerParams; + gSaveContext.respawn[respawnMode].tempSwchFlags = globalCtx->actorCtx.flags.switches[2]; + gSaveContext.respawn[respawnMode].unk_18 = globalCtx->actorCtx.flags.collectible[1]; + gSaveContext.respawn[respawnMode].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016A178.s") +void Play_SetupRespawnPoint(GameState* gameState, s32 respawnMode, s32 playerParams) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016A268.s") + if (globalCtx->sceneNum != SCENE_KAKUSIANA) { // Grottos + Play_SetRespawnData(&globalCtx->state, respawnMode, (u16)((void)0, gSaveContext.entranceIndex), + globalCtx->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, + player->actor.shape.rot.y); + } +} + +// Override respawn data in Sakon's Hideout +void func_80169ECC(GlobalContext* globalCtx) { + if (globalCtx->sceneNum == SCENE_SECOM) { + globalCtx->nextEntranceIndex = 0x2060; + gSaveContext.respawnFlag = -7; + } +} + +// Gameplay_TriggerVoidOut ? +// Used by Player, Ikana_Rotaryroom, Bji01, Kakasi, LiftNuts, Test4, Warptag, WarpUzu, Roomtimer +void func_80169EFC(GameState* gameState) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + + gSaveContext.respawn[0].tempSwchFlags = globalCtx->actorCtx.flags.switches[2]; + gSaveContext.respawn[0].unk_18 = globalCtx->actorCtx.flags.collectible[1]; + gSaveContext.respawn[0].tempCollectFlags = globalCtx->actorCtx.flags.collectible[2]; + globalCtx->nextEntranceIndex = gSaveContext.respawn[0].entranceIndex; + gSaveContext.respawnFlag = 1; + func_80169ECC(globalCtx); + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 2; +} + +// Gameplay_LoadToLastEntrance ? +// Used by game_over and Test7 +void func_80169F78(GameState* gameState) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + + globalCtx->nextEntranceIndex = gSaveContext.respawn[2].entranceIndex; + gSaveContext.respawnFlag = -1; + func_80169ECC(globalCtx); + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 2; +} + +// Gameplay_TriggerRespawn ? +// Used for void by Wallmaster, Deku Shrine doors. Also used by Player, Kaleido, DoorWarp1 +void func_80169FDC(GameState* gameState) { + func_80169F78(gameState); +} + +// Used by Kankyo to determine how to change the lighting, e.g. for game over. +s32 func_80169FFC(GameState* gameState) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + + return globalCtx->roomCtx.currRoom.mesh->type0.type != 1; +} + +s32 FrameAdvance_IsEnabled(GameState* gameState) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + + return globalCtx->frameAdvCtx.enabled != 0; +} + +// Unused, unchanged from OoT, which uses it only in one Camera function. +/** + * @brief Tests if \p actor is a door and the sides are different rooms. + * + * @param[in] gameState GameState, promoted to globalCtx inside. + * @param[in] actor Actor to test. + * @param[out] yaw Facing angle of the actor, or reverse if in the back room. + * @return true if \p actor is a door and the sides are in different rooms, false otherwise + */ +s32 func_8016A02C(GameState* gameState, Actor* actor, s16* yaw) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + TransitionActorEntry* transitionActor; + s8 frontRoom; + + if (actor->category != ACTORCAT_DOOR) { + return false; + } + + transitionActor = &globalCtx->doorCtx.transitionActorList[(u16)actor->params >> 10]; + frontRoom = transitionActor->sides[0].room; + if (frontRoom == transitionActor->sides[1].room) { + return false; + } + + if (frontRoom == actor->room) { + *yaw = actor->shape.rot.y; + } else { + *yaw = actor->shape.rot.y + 0x8000; + } + + return true; +} + +// Unused +/** + * @brief Tests if \p pos is underwater. + * + * @param[in] globalCtx GlobalContext + * @param[in] pos position to test + * @return true if inside a waterbox and not above a void. + */ +s32 Play_IsUnderwater(GlobalContext* globalCtx, Vec3f* pos) { + WaterBox* waterBox; + CollisionPoly* poly; + Vec3f waterSurfacePos; + s32 bgId; + + waterSurfacePos = *pos; + + if ((WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y, + &waterBox) == true) && + (pos->y < waterSurfacePos.y) && + (BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN)) { + return true; + } else { + return false; + } +} + +// z_demo and EnTest4 +// This data appears to be a boolean. It is only set by Play_Init. +s32 func_8016A168(void) { + return D_801D0D50; +} + +// A mapping from playerActorCsIds to sGlobalCamDataSettings indices. +extern s16 D_801D0D64[]; +// s16 D_801D0D64[] = { -3, -2, -4, -5, -7, -11, -8, -9, -6, -16 }; + +// Used by Player +/** + * Extract the common actor cutscene ids used by Player from the scene and set the actor cutscene ids in + * globalCtx->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set + * to -1. Otherwise, if there is an ActorCutscene where csCamSceneDataId matches the appropriate element of D_801D0D64, + * set the corresponding playerActorCsId (and possibly change its priority for the zeroth one) + */ +void Play_AssignPlayerActorCsIdsFromScene(GameState* gameState, s32 startActorCsId) { + GlobalContext* globalCtx = (GlobalContext*)gameState; + s32 i; + s16* curPlayerActorCsId = globalCtx->playerActorCsIds; + s16* phi_s1 = D_801D0D64; + + for (i = 0; i < ARRAY_COUNT(globalCtx->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) { + ActorCutscene* actorCutscene; + s32 curActorCsId; + + *curPlayerActorCsId = -1; + + for (curActorCsId = startActorCsId; curActorCsId != -1; curActorCsId = actorCutscene->additionalCutscene) { + actorCutscene = ActorCutscene_GetCutscene(curActorCsId); + + if (actorCutscene->csCamSceneDataId == *phi_s1) { + if ((actorCutscene->csCamSceneDataId == -3) && + (actorCutscene->priority == 700)) { // override ocarina cs priority + actorCutscene->priority = 550; + } + *curPlayerActorCsId = curActorCsId; + break; + } + } + } +} + +// These regs are used by Gameplay_Draw, and several actors, purpose as yet unclear. +void func_8016A268(GameState* gameState, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5) { + MREG(64) = arg1; + MREG(65) = arg2; + MREG(66) = arg3; + MREG(67) = arg4; + MREG(68) = arg5; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Init.s") diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 69e2f4dae9..7ed1ce5ce6 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,11 +1,60 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160A90.s") +#define FLAGS \ + (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000 | \ + ACTOR_FLAG_4000000 | ACTOR_FLAG_80000000) -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160AF8.s") +ActorFunc sPlayerCallInitFunc; +ActorFunc sPlayerCallDestroyFunc; +ActorFunc sPlayerCallUpdateFunc; +ActorFunc sPlayerCallDrawFunc; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160B40.s") +void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx); +void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160B80.s") +const ActorInit Player_InitVars = { + ACTOR_PLAYER, + ACTORCAT_PLAYER, + FLAGS, + GAMEPLAY_KEEP, + sizeof(Player), + (ActorFunc)PlayerCall_Init, + (ActorFunc)PlayerCall_Destroy, + (ActorFunc)PlayerCall_Update, + (ActorFunc)PlayerCall_Draw, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_call/func_80160BC0.s") +void Player_Init(Actor* thisx, GlobalContext* globalCtx); +void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); +void Player_Update(Actor* thisx, GlobalContext* globalCtx); +void Player_Draw(Actor* thisx, GlobalContext* globalCtx); + +void PlayerCall_InitFuncPtrs(void) { + sPlayerCallInitFunc = KaleidoManager_GetRamAddr(Player_Init); + sPlayerCallDestroyFunc = KaleidoManager_GetRamAddr(Player_Destroy); + sPlayerCallUpdateFunc = KaleidoManager_GetRamAddr(Player_Update); + sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(Player_Draw); +} + +void PlayerCall_Init(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + PlayerCall_InitFuncPtrs(); + sPlayerCallInitFunc(thisx, globalCtx); +} + +void PlayerCall_Destroy(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallDestroyFunc(thisx, globalCtx); +} + +void PlayerCall_Update(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallUpdateFunc(thisx, globalCtx); +} + +void PlayerCall_Draw(Actor* thisx, GlobalContext* globalCtx) { + KaleidoScopeCall_LoadPlayer(); + sPlayerCallDrawFunc(thisx, globalCtx); +} diff --git a/src/code/z_room.c b/src/code/z_room.c index 67c6c61586..7579c62008 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -29,7 +29,7 @@ void Room_DrawType0Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { } mesh = &room->mesh->type0; - meshParams = (RoomMeshType0Params*)Lib_SegmentedToVirtual(mesh->paramsStart); + meshParams = Lib_SegmentedToVirtual(mesh->paramsStart); for (i = 0; i < mesh->count; i++) { if ((flags & 1) && (meshParams->opaqueDl != NULL)) { gSPDisplayList(gfxCtx->polyOpa.p++, meshParams->opaqueDl); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 6e47936612..6ef6a60913 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -13,8 +13,7 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) { } if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) { - objectCtx->status[objectCtx->num + 1].segment = - (void*)ALIGN16((u32)objectCtx->status[objectCtx->num].segment + size); + objectCtx->status[objectCtx->num + 1].segment = ALIGN16((u32)objectCtx->status[objectCtx->num].segment + size); } objectCtx->num++; @@ -172,9 +171,9 @@ void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x01: Actor List void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->numSetupActors = (u16)cmd->actorList.num; - globalCtx->setupActorList = (ActorEntry*)Lib_SegmentedToVirtual(cmd->actorList.segment); - globalCtx->actorCtx.unkC = (u16)0; + globalCtx->numSetupActors = cmd->actorList.num; + globalCtx->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment); + globalCtx->actorCtx.unkC = 0; } // SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes @@ -187,21 +186,21 @@ void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { CollisionHeader* colHeaderTemp; CollisionHeader* colHeader; - colHeaderTemp = (CollisionHeader*)Lib_SegmentedToVirtual(cmd->colHeader.segment); + colHeaderTemp = Lib_SegmentedToVirtual(cmd->colHeader.segment); colHeader = colHeaderTemp; - colHeader->vtxList = (Vec3s*)Lib_SegmentedToVirtual(colHeaderTemp->vtxList); - colHeader->polyList = (CollisionPoly*)Lib_SegmentedToVirtual(colHeader->polyList); + colHeader->vtxList = Lib_SegmentedToVirtual(colHeaderTemp->vtxList); + colHeader->polyList = Lib_SegmentedToVirtual(colHeader->polyList); if (colHeader->surfaceTypeList != NULL) { - colHeader->surfaceTypeList = (SurfaceType*)Lib_SegmentedToVirtual(colHeader->surfaceTypeList); + colHeader->surfaceTypeList = Lib_SegmentedToVirtual(colHeader->surfaceTypeList); } if (colHeader->cameraDataList != NULL) { - colHeader->cameraDataList = (void*)Lib_SegmentedToVirtual(colHeader->cameraDataList); + colHeader->cameraDataList = Lib_SegmentedToVirtual(colHeader->cameraDataList); } if (colHeader->waterBoxes != NULL) { - colHeader->waterBoxes = (WaterBox*)Lib_SegmentedToVirtual(colHeader->waterBoxes); + colHeader->waterBoxes = Lib_SegmentedToVirtual(colHeader->waterBoxes); } BgCheck_Allocate(&globalCtx->colCtx, globalCtx, colHeader); @@ -210,12 +209,12 @@ void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x04: Room List void Scene_HeaderCmdRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->numRooms = cmd->roomList.num; - globalCtx->roomList = (RomFile*)Lib_SegmentedToVirtual(cmd->roomList.segment); + globalCtx->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment); } // SceneTableEntry Header Command 0x06: Entrance List void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupEntranceList = (EntranceEntry*)Lib_SegmentedToVirtual(cmd->entranceList.segment); + globalCtx->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment); } // SceneTableEntry Header Command 0x07: Special Files @@ -248,19 +247,21 @@ void Scene_HeaderCmdRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x0A: Mesh Header void Scene_HeaderCmdMesh(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomCtx.currRoom.mesh = (RoomMesh*)Lib_SegmentedToVirtual(cmd->mesh.segment); + globalCtx->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { - s32 i, j, k; + s32 i; + s32 j; + s32 k; ObjectStatus* firstObject; ObjectStatus* status; ObjectStatus* status2; s16* objectEntry; void* nextPtr; - objectEntry = (s16*)Lib_SegmentedToVirtual(cmd->objectList.segment); + objectEntry = Lib_SegmentedToVirtual(cmd->objectList.segment); k = 0; i = globalCtx->objectCtx.spawnedObjectCount; status = &globalCtx->objectCtx.status[i]; @@ -305,7 +306,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x0C: Light List void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i; - LightInfo* lightInfo = (LightInfo*)Lib_SegmentedToVirtual(cmd->lightList.segment); + LightInfo* lightInfo = Lib_SegmentedToVirtual(cmd->lightList.segment); for (i = 0; i < cmd->lightList.num; i++) { LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, lightInfo); @@ -315,14 +316,13 @@ void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x0D: Path List void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupPathList = (Path*)Lib_SegmentedToVirtual(cmd->pathList.segment); + globalCtx->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment); } // SceneTableEntry Header Command 0x0E: Transition Actor List void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->doorCtx.numTransitionActors = cmd->transiActorList.num; - globalCtx->doorCtx.transitionActorList = - (TransitionActorEntry*)Lib_SegmentedToVirtual((void*)cmd->transiActorList.segment); + globalCtx->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); func_80105818(globalCtx, globalCtx->doorCtx.numTransitionActors, globalCtx->doorCtx.transitionActorList); } @@ -334,7 +334,7 @@ void Door_InitContext(GameState* state, DoorContext* doorCtx) { // SceneTableEntry Header Command 0x0F: Environment Light Settings List void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; - globalCtx->envCtx.lightSettingsList = (void*)Lib_SegmentedToVirtual(cmd->lightSettingList.segment); + globalCtx->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment); } /** @@ -440,7 +440,7 @@ void Scene_HeaderCmdWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x13: Exit List void Scene_HeaderCmdExitList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->setupExitList = (u16*)Lib_SegmentedToVirtual(cmd->exitList.segment); + globalCtx->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment); } // SceneTableEntry Header Command 0x09: Undefined @@ -468,11 +468,11 @@ void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { SceneCmd* altHeader; if (gSaveContext.sceneSetupIndex) { - altHeaderList = (SceneCmd**)Lib_SegmentedToVirtual(cmd->altHeaders.segment); + altHeaderList = Lib_SegmentedToVirtual(cmd->altHeaders.segment); altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1]; if (altHeader != NULL) { - Scene_ProcessHeader(globalCtx, (SceneCmd*)Lib_SegmentedToVirtual(altHeader)); + Scene_ProcessHeader(globalCtx, Lib_SegmentedToVirtual(altHeader)); (cmd + 1)->base.code = 0x14; } } @@ -480,14 +480,13 @@ void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x17: Cutscene List void Scene_HeaderCmdCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->csCtx.sceneCsCount = (u8)cmd->base.data1; - globalCtx->csCtx.sceneCsList = (CutsceneEntry*)Lib_SegmentedToVirtual((void*)cmd->base.data2); + globalCtx->csCtx.sceneCsCount = cmd->base.data1; + globalCtx->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->base.data2); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List void Scene_HeaderCmdActorCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { - ActorCutscene_Init(globalCtx, (ActorCutscene*)Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), - cmd->cutsceneActorList.num); + ActorCutscene_Init(globalCtx, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); } // SceneTableEntry Header Command 0x1C: Mini Maps diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index b04b79bb47..f7f71a2dd7 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -114,7 +114,7 @@ void AnimatedMat_DrawTwoTexScroll(GlobalContext* globalCtx, s32 segment, void* p * Generates a displaylist that sets the prim and env color, and stores it in the provided segment ID. */ void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* primColorResult, F3DEnvColor* envColor) { - Gfx* colorDList = (Gfx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); + Gfx* colorDList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 4); OPEN_DISPS(globalCtx->state.gfxCtx); @@ -141,13 +141,10 @@ void AnimatedMat_SetColor(GlobalContext* globalCtx, s32 segment, F3DPrimColor* p */ void AnimatedMat_DrawColor(GlobalContext* globalCtx, s32 segment, void* params) { AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params; - F3DPrimColor* primColor; + F3DPrimColor* primColor = Lib_SegmentedToVirtual(colorAnimParams->primColors); F3DEnvColor* envColor; - s32 curFrame; + s32 curFrame = sMatAnimStep % colorAnimParams->keyFrameLength; - primColor = (F3DPrimColor*)Lib_SegmentedToVirtual(colorAnimParams->primColors); - - curFrame = sMatAnimStep % colorAnimParams->keyFrameLength; primColor += curFrame; envColor = (colorAnimParams->envColors != NULL) ? (F3DEnvColor*)Lib_SegmentedToVirtual(colorAnimParams->envColors) + curFrame @@ -169,10 +166,10 @@ s32 AnimatedMat_Lerp(s32 min, s32 max, f32 norm) { */ void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* params) { AnimatedMatColorParams* colorAnimParams = (AnimatedMatColorParams*)params; - F3DPrimColor* primColorMax; + F3DPrimColor* primColorMax = Lib_SegmentedToVirtual(colorAnimParams->primColors); F3DEnvColor* envColorMax; - u16* keyFrames; - s32 curFrame; + u16* keyFrames = Lib_SegmentedToVirtual(colorAnimParams->keyFrames); + s32 curFrame = sMatAnimStep % colorAnimParams->keyFrameLength; s32 endFrame; s32 relativeFrame; // relative to the start frame s32 startFrame; @@ -183,9 +180,6 @@ void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* para F3DEnvColor envColorResult; s32 i; - primColorMax = (F3DPrimColor*)Lib_SegmentedToVirtual(colorAnimParams->primColors); - keyFrames = (u16*)Lib_SegmentedToVirtual(colorAnimParams->keyFrames); - curFrame = sMatAnimStep % colorAnimParams->keyFrameLength; keyFrames++; i = 1; @@ -211,7 +205,7 @@ void AnimatedMat_DrawColorLerp(GlobalContext* globalCtx, s32 segment, void* para primColorResult.lodFrac = AnimatedMat_Lerp(primColorMin->lodFrac, primColorMax->lodFrac, norm); if (colorAnimParams->envColors) { - envColorMax = (F3DEnvColor*)Lib_SegmentedToVirtual(colorAnimParams->envColors); + envColorMax = Lib_SegmentedToVirtual(colorAnimParams->envColors); envColorMax += i; envColorMin = envColorMax - 1; envColorResult.r = AnimatedMat_Lerp(envColorMin->r, envColorMax->r, norm); @@ -370,8 +364,8 @@ void AnimatedMat_DrawColorNonLinearInterp(GlobalContext* globalCtx, s32 segment, */ void AnimatedMat_DrawTexCycle(GlobalContext* globalCtx, s32 segment, void* params) { AnimatedMatTexCycleParams* texAnimParams = params; - void** texList = (void**)Lib_SegmentedToVirtual(texAnimParams->textureList); - u8* texId = (u8*)Lib_SegmentedToVirtual(texAnimParams->textureIndexList); + void** texList = Lib_SegmentedToVirtual(texAnimParams->textureList); + u8* texId = Lib_SegmentedToVirtual(texAnimParams->textureIndexList); s32 curFrame = sMatAnimStep % texAnimParams->keyFrameLength; void* tex = Lib_SegmentedToVirtual(texList[texId[curFrame]]); @@ -408,9 +402,9 @@ void AnimatedMat_DrawMain(GlobalContext* globalCtx, AnimatedMaterial* matAnim, f do { segment = matAnim->segment; segmentAbs = ((segment < 0) ? -segment : segment) + 7; - matAnimDrawHandlers[matAnim->type](globalCtx, segmentAbs, (void*)Lib_SegmentedToVirtual(matAnim->params)); + matAnimDrawHandlers[matAnim->type](globalCtx, segmentAbs, Lib_SegmentedToVirtual(matAnim->params)); matAnim++; - } while (segment > -1); + } while (segment >= 0); } } @@ -726,7 +720,7 @@ void Scene_DrawConfigGreatBayTemple(GlobalContext* globalCtx) { BgCheck_UnsetContextFlags(&globalCtx->colCtx, BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW); } - dList = (Gfx*)GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 18); + dList = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Gfx) * 18); AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 6abaaf72c1..4306d5582d 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -87,7 +87,7 @@ static InitChainEntry sInitChain[] = { }; void func_80A9ACD0(BgHakuginPostUnkStruct* arg0) { - bzero((void*)arg0, sizeof(BgHakuginPostUnkStruct)); + bzero(arg0, sizeof(BgHakuginPostUnkStruct)); } void func_80A9ACF0(void) { diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c index d16c6c0db5..f5e035be73 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c @@ -5,6 +5,7 @@ */ #include "z_bg_hakugin_switch.h" +#include "objects/object_goronswitch/object_goronswitch.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,27 @@ void BgHakuginSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx); void BgHakuginSwitch_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80B15A68(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15B1C(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15E0C(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15E78(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15F3C(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B15F88(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B1606C(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B160DC(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B161A0(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B16244(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B163C4(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B16400(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B16494(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B16520(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B165A0(BgHakuginSwitch* this, GlobalContext* globalCtx); +void func_80B165E0(BgHakuginSwitch* this, GlobalContext* globalCtx); + +u32 D_80B16AF0; + const ActorInit Bg_Hakugin_Switch_InitVars = { ACTOR_BG_HAKUGIN_SWITCH, ACTORCAT_SWITCH, @@ -28,84 +49,489 @@ const ActorInit Bg_Hakugin_Switch_InitVars = { (ActorFunc)BgHakuginSwitch_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B16860 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000400, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000400, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 60, 10, 180, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B16904[] = { +typedef struct { + /* 0x00 */ f32 unk_0; + /* 0x04 */ f32 unk_4; + /* 0x08 */ f32 unk_8; + /* 0x0C */ f32 unk_C; + /* 0x10 */ Gfx* unk_10; + /* 0x14 */ u8 unk_14; +} BgHakuginSwitchStruct; + +BgHakuginSwitchStruct D_80B1688C[] = { + { -156.0f, -178.0f, 6.0f, 10.0f, object_goronswitch_DL_000268, 0xB4 }, + { -60.0f, -178.0f, 6.0f, 10.0f, object_goronswitch_DL_000268, 0x32 }, + { -60.0f, -178.0f, 6.0f, 10.0f, object_goronswitch_DL_000268, 0x31 }, + { -120.0f, -178.0f, 6.0f, 10.0f, object_goronswitch_DL_0007D8, 0x3A }, + { -156.0f, -178.0f, 6.0f, 10.0f, object_goronswitch_DL_0007D8, 0xB4 }, +}; + +static InitChainEntry sInitChain1[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 150, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 130, ICHAIN_STOP), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B16910[] = { +static InitChainEntry sInitChain2[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 260, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 360, ICHAIN_STOP), }; -#endif +void func_80B15790(BgHakuginSwitch* this, u16 sfxId) { + if (this->unk_1B2 <= 0) { + Actor_PlaySfxAtPos(&this->dyna.actor, sfxId); + } +} -extern ColliderCylinderInit D_80B16860; -extern InitChainEntry D_80B16904[]; -extern InitChainEntry D_80B16910[]; +void func_80B157C4(BgHakuginSwitch* this, u16 arg1) { + if (this->unk_1B2 <= 0) { + func_800B9010(&this->dyna.actor, arg1); + } +} -extern UNK_TYPE D_060005C8; +void BgHakuginSwitch_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitch* this = THIS; + s32 sp34 = BGHAKUGINSWITCH_GET_7(&this->dyna.actor); + s32 sp30; + s32 pad2; + s32 sp28; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15790.s") + if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + sp30 = true; + } else { + sp30 = false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B157C4.s") + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_goronswitch_Colheader_0005C8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/BgHakuginSwitch_Init.s") + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/BgHakuginSwitch_Destroy.s") + this->unk_1B2 = 15; + if (!BGHAKUGINSWITCH_GET_10(&this->dyna.actor)) { + Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15A4C.s") + this->dyna.actor.scale.x = 0.07f; + this->dyna.actor.scale.y = 0.016f; + this->dyna.actor.scale.z = 0.07f; + this->collider.dim.radius = 46; + this->collider.dim.yShift = 0x1D; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15A68.s") + this->unk_1A8 = object_goronswitch_DL_000268; + this->unk_1B8 = this->dyna.actor.cutscene; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15B1C.s") + if (sp34 == 0) { + this->unk_1BA = -1; + } else { + this->unk_1BA = ActorCutscene_GetAdditionalCutscene(this->unk_1B8); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15B74.s") + if (sp30) { + func_80B16494(this, globalCtx); + } else { + func_80B16244(this, globalCtx); + } + } else { + if (D_80B1688C[sp34].unk_14 & 4) { + sp28 = true; + } else { + sp28 = false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15E0C.s") + Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15E78.s") + this->unk_1A8 = D_80B1688C[sp34].unk_10; + this->unk_1B8 = this->dyna.actor.cutscene; + this->unk_1BA = ActorCutscene_GetAdditionalCutscene(this->unk_1B8); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15F3C.s") + if (sp30 == sp28) { + func_80B15F3C(this, globalCtx); + } else { + func_80B15B1C(this, globalCtx); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B15F88.s") + this->unk_1C8 = 1.0f / this->dyna.actor.scale.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B1606C.s") +void BgHakuginSwitch_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgHakuginSwitch* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B160DC.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B16180.s") +void func_80B15A4C(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2) { + this->unk_1B4 = func; + this->unk_1BC = arg2; + this->actionFunc = func_80B15A68; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B161A0.s") +void func_80B15A68(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + s32 sp18 = !(s->unk_14 & 0x40); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B16244.s") + if (ActorCutscene_GetCanPlayNext(this->unk_1BC)) { + if (sp18) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); + this->unk_1BF = 40; + } + this->unk_1B4(this, globalCtx); + } else if (sp18) { + ActorCutscene_SetIntentToPlay(this->unk_1BC); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B162AC.s") +void func_80B15B1C(BgHakuginSwitch* this, GlobalContext* globalCtx) { + BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B163C4.s") + this->dyna.actor.world.pos.y = s->unk_0 + this->dyna.actor.home.pos.y; + this->unk_1C0 = 1; + this->unk_1B0 = 480; + this->actionFunc = func_80B15B74; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B16400.s") +void func_80B15B74(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitchStruct* sp38 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + s32 sp34 = (this->collider.base.acFlags & AC_HIT) != 0; + s32 pad2; + s32 sp2C; + s32 sp28; + s32 sp24; + s32 sp20; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B16494.s") + if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + sp2C = 1; + } else { + sp2C = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B16520.s") + if (sp38->unk_14 & 4) { + sp28 = 1; + } else { + sp28 = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B165A0.s") + sp24 = false; + sp20 = -1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/func_80B165E0.s") + if (sp34) { + this->collider.base.acFlags &= ~AC_HIT; + if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + sp24 = true; + sp20 = sp28; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/BgHakuginSwitch_Update.s") + if (this->unk_1B0 > 0) { + this->unk_1B0--; + if (sp38->unk_14 & 8) { + func_800B9038(&this->dyna.actor, this->unk_1B0); + if (this->unk_1B0 == 0) { + sp24 = true; + sp20 = sp28; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Switch/BgHakuginSwitch_Draw.s") + if (sp2C == sp28) { + if ((sp38->unk_14 & 0xFF) & 0x10) { + if (D_80B16AF0 < globalCtx->gameplayFrames) { + sp24 = true; + } + } else { + sp24 = true; + } + } + + if (sp24) { + if (sp20 == 1) { + Flags_SetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + } else if (sp20 == 0) { + Flags_UnsetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + } + + D_80B16AF0 = globalCtx->gameplayFrames; + + if (sp38->unk_14 & 0x10) { + func_80B15A4C(this, func_80B15E0C, this->unk_1B8); + } else { + func_80B15E0C(this, globalCtx); + } + } else if (!(sp38->unk_14 & 1)) { + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B15E0C(BgHakuginSwitch* this, GlobalContext* globalCtx) { + BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + + if ((s->unk_14 & 0x80)) { + func_80B15790(this, NA_SE_EV_STONE_SWITCH_ON); + } + this->unk_1C0 = 0; + this->actionFunc = func_80B15E78; +} + +void func_80B15E78(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitchStruct* sp20 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + + if (Math_StepToF(&this->dyna.actor.world.pos.y, sp20->unk_4 + this->dyna.actor.home.pos.y, sp20->unk_C)) { + if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + func_8013ECE0(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); + } + func_80B15F3C(this, globalCtx); + } else if (!(sp20->unk_14 & 0x80)) { + func_80B157C4(this, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); + } +} + +void func_80B15F3C(BgHakuginSwitch* this, GlobalContext* globalCtx) { + BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + + this->dyna.actor.world.pos.y = s->unk_4 + this->dyna.actor.home.pos.y; + this->unk_1C0 = 0; + this->actionFunc = func_80B15F88; +} + +void func_80B15F88(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 phi_a0; + BgHakuginSwitchStruct* sp18 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + s32 phi_v1; + + if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + phi_a0 = true; + } else { + phi_a0 = false; + } + + if (sp18->unk_14 & 4) { + phi_v1 = true; + } else { + phi_v1 = false; + } + + if (phi_a0 != phi_v1) { + if ((sp18->unk_14 & 0xFF) & 0x20) { + if (D_80B16AF0 < globalCtx->gameplayFrames) { + func_80B15A4C(this, func_80B1606C, this->unk_1BA); + } + } else { + func_80B1606C(this, globalCtx); + } + } +} + +void func_80B1606C(BgHakuginSwitch* this, GlobalContext* globalCtx) { + BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + + if (s->unk_14 & 0x80) { + func_80B15790(this, NA_SE_EV_STONE_SWITCH_OFF); + } + this->unk_1C0 = 1; + this->actionFunc = func_80B160DC; +} + +void func_80B160DC(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitchStruct* sp18 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; + + if (Math_StepToF(&this->dyna.actor.world.pos.y, sp18->unk_0 + this->dyna.actor.home.pos.y, sp18->unk_8)) { + func_80B15B1C(this, globalCtx); + } else if (!(sp18->unk_14 & 0x80)) { + func_80B157C4(this, NA_SE_EV_PILLAR_UP_FAST - SFX_FLAG); + } +} + +void func_80B16180(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2, s32 arg3) { + this->unk_1B4 = func; + this->unk_1BE = arg2; + this->unk_1BC = arg3; + this->actionFunc = func_80B161A0; +} + +void func_80B161A0(BgHakuginSwitch* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(this->unk_1BC)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); + if (this->unk_1BE != 0) { + Flags_SetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + } else { + Flags_UnsetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); + } + this->unk_1BF = 50; + this->unk_1B4(this, globalCtx); + } else { + ActorCutscene_SetIntentToPlay(this->unk_1BC); + } +} + +void func_80B16244(BgHakuginSwitch* this, GlobalContext* globalCtx) { + this->unk_1C0 = 1; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + if ((BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) && + (this->dyna.actor.category != ACTORCAT_SWITCH)) { + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, 0); + } + this->actionFunc = func_80B162AC; +} + +void func_80B162AC(BgHakuginSwitch* this, GlobalContext* globalCtx) { + s32 sp34 = (this->collider.base.acFlags & AC_HIT) != 0; + s32 sp30 = BGHAKUGINSWITCH_GET_7(&this->dyna.actor); + s32 pad; + s32 sp28 = false; + s32 sp24 = false; + + if (sp34) { + this->collider.base.acFlags &= ~AC_HIT; + if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + sp24 = true; + sp28 = true; + } + } + + if (sp30 == 1) { + if (Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + sp24 = true; + } + } + + if (sp24) { + if (sp28) { + func_80B16180(this, func_80B163C4, 1, this->unk_1B8); + } else { + func_80B163C4(this, globalCtx); + } + } else { + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } +} + +void func_80B163C4(BgHakuginSwitch* this, GlobalContext* globalCtx) { + func_80B15790(this, NA_SE_EV_STONE_SWITCH_ON); + this->unk_1C0 = 0; + this->actionFunc = func_80B16400; +} + +void func_80B16400(BgHakuginSwitch* this, GlobalContext* globalCtx) { + if (Math_StepToF(&this->dyna.actor.world.pos.y, + (this->dyna.actor.home.pos.y + 2.0f) - (1800.0f * this->dyna.actor.scale.y), 10.0f)) { + if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + func_8013ECE0(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); + } + func_80B16494(this, globalCtx); + } +} + +void func_80B16494(BgHakuginSwitch* this, GlobalContext* globalCtx) { + this->unk_1C0 = 0; + this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y - (1800.0f * this->dyna.actor.scale.y)) + 2.0f; + if ((BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) && + (this->dyna.actor.category != ACTORCAT_PROP)) { + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORCAT_PROP); + } + this->actionFunc = func_80B16520; +} + +void func_80B16520(BgHakuginSwitch* this, GlobalContext* globalCtx) { + if (!Flags_GetSwitch(globalCtx, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { + if (BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) { + func_80B16180(this, func_80B165A0, 0, this->unk_1BA); + } else { + func_80B165A0(this, globalCtx); + } + } +} + +void func_80B165A0(BgHakuginSwitch* this, GlobalContext* globalCtx) { + func_80B15790(this, NA_SE_EV_STONE_SWITCH_OFF); + this->unk_1C0 = 1; + this->actionFunc = func_80B165E0; +} + +void func_80B165E0(BgHakuginSwitch* this, GlobalContext* globalCtx) { + if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 6.0f)) { + func_80B16244(this, globalCtx); + } +} + +void BgHakuginSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgHakuginSwitch* this = THIS; + f32 sp24; + + if (this->unk_1B2 > 0) { + this->unk_1B2--; + } + + if (this->unk_1BF > 0) { + if ((this->actionFunc != func_80B15A68) && (this->actionFunc != func_80B161A0)) { + this->unk_1BF--; + if (this->unk_1BF == 0) { + ActorCutscene_Stop(this->unk_1BC); + } + } + } + + this->actionFunc(this, globalCtx); + + sp24 = this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y; + + if (this->unk_1C0 != 0) { + f32 phi_f0; + + if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { + phi_f0 = (sp24 - -10.0f) * -0.21f; + } else { + phi_f0 = (sp24 - -3.0f) * -0.08f; + } + this->unk_1C4 += phi_f0; + this->unk_1C4 *= 0.75f; + this->dyna.actor.shape.yOffset += this->unk_1C4 * this->unk_1C8; + } else { + this->unk_1C4 += sp24 * -0.11f; + this->unk_1C4 *= 0.75f; + this->dyna.actor.shape.yOffset += this->unk_1C4 * this->unk_1C8; + this->dyna.actor.shape.yOffset = CLAMP_MAX(this->dyna.actor.shape.yOffset, 0.0f); + } + } else { + Math_StepToF(&this->dyna.actor.shape.yOffset, 0.0f, 2.0f * this->unk_1C8); + this->unk_1C4 = 0.0f; + } +} + +void BgHakuginSwitch_Draw(Actor* thisx, GlobalContext* globalCtx) { + BgHakuginSwitch* this = THIS; + + Gfx_DrawDListOpa(globalCtx, this->unk_1A8); +} diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h index 58cbfed686..cc13639650 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h @@ -6,12 +6,30 @@ struct BgHakuginSwitch; typedef void (*BgHakuginSwitchActionFunc)(struct BgHakuginSwitch*, GlobalContext*); +typedef void (*BgHakuginSwitchUnkFunc)(struct BgHakuginSwitch*, GlobalContext*); + +#define BGHAKUGINSWITCH_GET_7(thisx) ((thisx)->params & 7) +#define BGHAKUGINSWITCH_GET_10(thisx) (((thisx)->params >> 4) & 1) +#define BGHAKUGINSWITCH_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0x7F) + +#define BGHAKUGINSWITCH_GET_7_1 1 typedef struct BgHakuginSwitch { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x68]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x015C */ ColliderCylinder collider; + /* 0x01A8 */ Gfx* unk_1A8; /* 0x01AC */ BgHakuginSwitchActionFunc actionFunc; - /* 0x01B0 */ char unk_1B0[0x1C]; + /* 0x01B0 */ s16 unk_1B0; + /* 0x01B2 */ s8 unk_1B2; + /* 0x01B4 */ BgHakuginSwitchUnkFunc unk_1B4; + /* 0x01B8 */ s16 unk_1B8; + /* 0x01BA */ s16 unk_1BA; + /* 0x01BC */ s16 unk_1BC; + /* 0x01BE */ s8 unk_1BE; + /* 0x01BF */ s8 unk_1BF; + /* 0x01C0 */ s8 unk_1C0; + /* 0x01C4 */ f32 unk_1C4; + /* 0x01C8 */ f32 unk_1C8; } BgHakuginSwitch; // size = 0x1CC extern const ActorInit Bg_Hakugin_Switch_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c index 95e33a2eff..d0ec425224 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c @@ -69,9 +69,9 @@ void BgIkanaRay_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetCylinder(globalCtx, collision, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->collision); - this->animatedTextures = (AnimatedMaterial*)Lib_SegmentedToVirtual(object_ikana_obj_Matanimheader_001228); + this->animatedTextures = Lib_SegmentedToVirtual(object_ikana_obj_Matanimheader_001228); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { + if (Flags_GetSwitch(globalCtx, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { BgIkanaRay_SetActivated(this); } else { BgIkanaRay_SetDeactivated(this); @@ -88,11 +88,11 @@ void BgIkanaRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgIkanaRay_SetDeactivated(BgIkanaRay* this) { this->actor.draw = NULL; this->actor.flags |= ACTOR_FLAG_10; - this->update = BgIkanaRay_UpdateCheckForActivation; + this->actionFunc = BgIkanaRay_UpdateCheckForActivation; } void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { + if (Flags_GetSwitch(globalCtx, BGIKANARAY_GET_SWITCH_FLAG(&this->actor))) { BgIkanaRay_SetActivated(this); } } @@ -100,7 +100,7 @@ void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, GlobalContext* global void BgIkanaRay_SetActivated(BgIkanaRay* this) { this->actor.draw = BgIkanaRay_Draw; this->actor.flags &= ~ACTOR_FLAG_10; - this->update = BgIkanaRay_UpdateActivated; + this->actionFunc = BgIkanaRay_UpdateActivated; } void BgIkanaRay_UpdateActivated(BgIkanaRay* this, GlobalContext* globalCtx) { @@ -110,7 +110,7 @@ void BgIkanaRay_UpdateActivated(BgIkanaRay* this, GlobalContext* globalCtx) { void BgIkanaRay_Update(Actor* thisx, GlobalContext* globalCtx) { BgIkanaRay* this = THIS; - this->update(this, globalCtx); + this->actionFunc(this, globalCtx); } void BgIkanaRay_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h index d17fbeed98..7c8d8c3693 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h @@ -5,11 +5,15 @@ struct BgIkanaRay; +typedef void (*BgIkanaRayActionFunc)(struct BgIkanaRay*, GlobalContext*); + +#define BGIKANARAY_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) + typedef struct BgIkanaRay { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collision; /* 0x190 */ AnimatedMaterial* animatedTextures; - /* 0x194 */ void (*update)(struct BgIkanaRay*, GlobalContext*); + /* 0x194 */ BgIkanaRayActionFunc actionFunc; } BgIkanaRay; // size = 0x198 extern const ActorInit Bg_Ikana_Ray_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 13d8161e2b..a3b234392b 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -647,7 +647,7 @@ void func_80B814B8(BgIkanaRotaryroom* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { if (player->actor.bgCheckFlags & 0x100) { func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->unk_92); - func_80169EFC(globalCtx); + func_80169EFC(&globalCtx->state); func_800B8E58(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->unk_92); globalCtx->unk_18845 = 1; play_sound(NA_SE_OC_ABYSS); diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index a9bf942564..7cd39251c3 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -162,7 +162,7 @@ void func_80BD7ED8(BgIknvObj* this, GlobalContext* globalCtx) { } void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { - if (gSaveContext.time > 0xD000) { + if (gSaveContext.time > CLOCK_TIME(19, 30)) { this->actionFunc = func_80BD7ED8; } if ((this->dyna.actor.home.rot.x == 1) && !(gSaveContext.weekEventReg[58] & 0x80)) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index d120c451e5..c7e39eec64 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -5,6 +5,7 @@ */ #include "z_bg_ingate.h" +#include "objects/object_sichitai_obj/object_sichitai_obj.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -15,7 +16,16 @@ void BgIngate_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx); void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +Actor* BgIngate_FindActor(BgIngate* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId); +s32 func_80953BEC(BgIngate* this); +void func_80953B40(BgIngate* this); +void func_80953F8C(BgIngate* this, GlobalContext* globalCtx); +void func_80953F9C(BgIngate* this, GlobalContext* globalCtx); +void func_809541B8(BgIngate* this, GlobalContext* globalCtx); +void func_809542A0(BgIngate* this, GlobalContext* globalCtx); +void func_80954340(BgIngate* this, GlobalContext* globalCtx); +void func_809543D4(BgIngate* this, GlobalContext* globalCtx); + const ActorInit Bg_Ingate_InitVars = { ACTOR_BG_INGATE, ACTORCAT_BG, @@ -28,41 +38,355 @@ const ActorInit Bg_Ingate_InitVars = { (ActorFunc)BgIngate_Draw, }; -#endif +/** + * @brief Searches for an actor based on the parameters given to the function. Returns Actor* of actor found or NULL + * + * @param this + * @param globalCtx + * @param actorCat - Category of Actor + * @param actorId - ID of actor to search for + * @return Actor* + */ +Actor* BgIngate_FindActor(BgIngate* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { + Actor* foundActor = NULL; + Actor* tempActor; -extern UNK_TYPE D_060006B0; -extern UNK_TYPE D_060016DC; + while (true) { + foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953A90.s") + if ((foundActor == NULL) || (((this != (BgIngate*)foundActor)) && (foundActor->update != NULL))) { + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953B40.s") + tempActor = foundActor->next; + if (tempActor == NULL) { + foundActor = NULL; + break; + } + foundActor = tempActor; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953BEC.s") + return foundActor; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953DA8.s") +void func_80953B40(BgIngate* this) { + s32 temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953E38.s") + if (!(gSaveContext.eventInf[3] & 0x20)) { + this->unk180 = 0xFA0; + this->unk168 = 4; + } else { + this->unk180 = 0x7D0; + this->unk168 = 1; + } + temp = this->unk164->count - 2; + this->unk184 = this->unk180 / temp; + this->unk188 = 2; + this->unk18C = 0; + this->unk160 &= ~0x1; + this->unk160 &= ~0x2; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953EA4.s") +s32 func_80953BEC(BgIngate* this) { + f32 sp74[265]; + Vec3f sp68; + Vec3f sp5C; + Vec3f unkVec; + s16 yaw; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953F14.s") + func_8013AF00(sp74, 3, this->unk164->count + 3); + if (!(this->unk160 & 1)) { + unkVec = gZeroVec3f; + func_8013B6B0(this->unk164, &this->unk17C, &this->unk18C, this->unk184, this->unk180, &this->unk188, sp74, + &unkVec, this->unk168); + this->unk160 |= 1; + } else { + unkVec = this->unk170; + } + this->dyna.actor.world.pos.x = unkVec.x; + this->dyna.actor.world.pos.z = unkVec.z; + this->unk170 = gZeroVec3f; + if (func_8013B6B0(this->unk164, &this->unk17C, &this->unk18C, this->unk184, this->unk180, &this->unk188, sp74, + &this->unk170, this->unk168) != 0) { + this->unk160 |= 2; + } else { + sp68 = this->dyna.actor.world.pos; + sp5C = this->unk170; + yaw = Math_Vec3f_Yaw(&sp68, &sp5C); + this->dyna.actor.world.rot.y = yaw; + this->dyna.actor.shape.rot.y = yaw; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953F8C.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80953F9C.s") +s32 func_80953DA8(BgIngate* this, GlobalContext* globalCtx) { + Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_809541B8.s") + if (gSaveContext.eventInf[3] & 0x20) { + func_800B7298(globalCtx, &this->dyna.actor, 7); + } else { + gSaveContext.eventInf[4] |= 2; + } + func_800DFAC8(camera, 47); + globalCtx->unk_1887C = 0x63; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_809542A0.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_80954340.s") +void func_80953E38(GlobalContext* globalCtx) { + func_800DFAC8(Play_GetCamera(globalCtx, CAM_ID_MAIN), 1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/func_809543D4.s") + if (!(gSaveContext.eventInf[3] & 0x20)) { + gSaveContext.eventInf[4] &= (u8)~2; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/BgIngate_Init.s") + globalCtx->unk_1887C = -1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/BgIngate_Destroy.s") +void func_80953EA4(BgIngate* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/BgIngate_Update.s") + func_800B7298(globalCtx, &this->dyna.actor, 0x3A); + player->unk_3A0.x = this->dyna.actor.world.pos.x; + player->unk_3A0.z = this->dyna.actor.world.pos.z; + this->unk160 &= ~0x4; + this->unk16A = 0x1E; + this->actionFunc = func_80954340; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ingate/BgIngate_Draw.s") +void func_80953F14(BgIngate* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + player->actor.shape.rot.y = this->dyna.actor.shape.rot.y; + player->actor.world.rot.y = player->actor.shape.rot.y; + player->currentYaw = player->actor.shape.rot.y; + player->actor.focus.rot.y = player->actor.shape.rot.y; + this->unk160 |= 0x10; + func_80953DA8(this, globalCtx); + if (this->unk164 != 0) { + func_80953B40(this); + } + this->unk16E = -1; + this->actionFunc = func_80953F9C; +} + +void func_80953F8C(BgIngate* this, GlobalContext* globalCtx) { +} + +void func_80953F9C(BgIngate* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); + + if (!(gSaveContext.eventInf[4] & 1)) { + + if (!(gSaveContext.eventInf[3] & 0x20) && (this->unk160 & 0x10) && (this->unk16C == 0)) { + this->dyna.actor.textId = 0x9E3; + Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + this->unk160 &= ~0x10; + } + + if (this->unk160 & 2) { + + if (this->unk164->unk1 != 0xFF) { + func_80953E38(globalCtx); + func_800B7298(globalCtx, &this->dyna.actor, 7); + this->dyna.actor.textId = 0x9E4; + Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + this->unk16C += 1; + gSaveContext.weekEventReg[90] |= 0x40; + this->actionFunc = func_809543D4; + } else { + + if (!(gSaveContext.eventInf[3] & 0x20)) { + gSaveContext.eventInf[4] &= (u8)~2; + } else { + gSaveContext.eventInf[4] |= 1; + } + this->actionFunc = func_809542A0; + } + } else if ((ActorCutscene_GetCurrentIndex() == -1) && (this->unk164 != NULL)) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CRUISER - SFX_FLAG); + func_80953BEC(this); + } + } + if (ActorCutscene_GetCurrentIndex() != this->unk16E) { + if (ActorCutscene_GetCurrentIndex() != -1) { + func_800DFAC8(camera, 1); + player->stateFlags1 |= 0x20; + globalCtx->actorCtx.unk5 &= ~0x4; + } else { + func_800DFAC8(camera, 47); + player->stateFlags1 &= ~0x20; + } + } + this->unk16E = ActorCutscene_GetCurrentIndex(); +} + +void func_809541B8(BgIngate* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (this->unk160 & 0x4) { + if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & 1) && + (this->dyna.actor.xzDistToPlayer < 40.0f)) { + if (this->dyna.actor.playerHeightRel > 15.0f) { + func_800B7298(globalCtx, &this->dyna.actor, 7); + this->dyna.actor.textId = 0x9E6; + Message_StartTextbox(globalCtx, this->dyna.actor.textId, NULL); + this->actionFunc = func_809543D4; + } + } + } else if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + this->unk160 |= 4; + } +} + +void func_809542A0(BgIngate* this, GlobalContext* globalCtx) { + if (gSaveContext.eventInf[5] & 1) { + globalCtx->nextEntranceIndex = 0xA820; + gSaveContext.eventInf[5] &= (u8)~1; + } else { + globalCtx->nextEntranceIndex = 0xA810; + } + gSaveContext.nextCutsceneIndex = 0; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 3; + gSaveContext.nextTransition = 3; + this->actionFunc = func_80953F8C; + gSaveContext.weekEventReg[90] &= (u8)~0x40; + func_800FE498(); +} + +void func_80954340(BgIngate* this, GlobalContext* globalCtx) { + if (!DECR(this->unk16A)) { + if (this->unk164 != 0) { + func_800B7298(globalCtx, &this->dyna.actor, 6); + this->unk164 = &globalCtx->setupPathList[this->unk164->unk1]; + func_80953F14(this, globalCtx); + func_800FE484(); + } + } +} + +void func_809543D4(BgIngate* this, GlobalContext* globalCtx) { + u8 talkState = Message_GetState(&globalCtx->msgCtx); + + if (((talkState == 4) || (talkState == 5)) && func_80147624(globalCtx)) { + switch (this->dyna.actor.textId) { + case 0x9E4: + this->dyna.actor.textId = 0x9E5; + func_80151938(globalCtx, this->dyna.actor.textId); + break; + case 0x9E5: + if (globalCtx->msgCtx.choiceIndex == 0) { + func_800B7298(globalCtx, &this->dyna.actor, 6); + this->unk160 &= ~0x4; + this->actionFunc = func_809541B8; + func_800FE498(); + func_8019F208(); + } else { + if (this->unk164 != 0) { + this->unk164 = &globalCtx->setupPathList[this->unk164->unk1]; + } + func_80953F14(this, globalCtx); + gSaveContext.weekEventReg[90] &= (u8)~0x40; + func_8019F230(); + } + func_801477B4(globalCtx); + break; + case 0x9E6: + if (globalCtx->msgCtx.choiceIndex == 0) { + func_80953EA4(this, globalCtx); + gSaveContext.weekEventReg[90] &= (u8)~0x40; + func_8019F208(); + } else { + this = this; + func_800B7298(globalCtx, &this->dyna.actor, 6); + this->unk160 &= ~0x4; + this->actionFunc = func_809541B8; + func_800FE498(); + func_8019F230(); + } + func_801477B4(globalCtx); + break; + } + } +} + +void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + BgIngate* this = THIS; + s32 phi_a2; + Vec3s* sp38; + Vec3f sp2C; + Vec3f sp20; + + if (BgIngate_FindActor(this, globalCtx, ACTORCAT_BG, ACTOR_BG_INGATE) == NULL) { + DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gSichitaiBoatCol); + this->unk160 = 0; + this->unk160 |= 0x8; + this->unk160 |= 0x10; + Actor_SetScale(&this->dyna.actor, 1.0f); + this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0); + this->dyna.actor.room = -1; + if (gSaveContext.weekEventReg[20] & 2) { + gSaveContext.weekEventReg[90] &= (u8)~0x40; + } + if (!(gSaveContext.eventInf[3] & 0x20) && (gSaveContext.weekEventReg[90] & 0x40)) { + phi_a2 = 1; + this->unk16C = 1; + this->actionFunc = func_809541B8; + } else { + phi_a2 = 0; + if (globalCtx->curSpawn == 6) { + func_80953F14(this, globalCtx); + if (gSaveContext.eventInf[3] & 0x20) { + func_80112AFC(globalCtx); + } else { + gSaveContext.eventInf[4] |= 2; + } + } else { + this->actionFunc = func_80953F8C; + } + } + this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), phi_a2); + if (this->unk164 != 0) { + sp38 = Lib_SegmentedToVirtual(this->unk164->points); + Math_Vec3s_ToVec3f(&sp2C, &sp38[0]); + Math_Vec3s_ToVec3f(&sp20, &sp38[1]); + this->dyna.actor.world.rot.y = Math_Vec3f_Yaw(&sp2C, &sp20); + this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; + this->dyna.actor.world.pos.x = sp2C.x; + this->dyna.actor.world.pos.y = -15.0f; + this->dyna.actor.world.pos.z = sp2C.z; + } + this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0); + } else { + Actor_MarkForDeath(&this->dyna.actor); + } +} + +void BgIngate_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgIngate* this = THIS; + + if (this->unk160 & 8) { + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + } +} + +void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx) { + BgIngate* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gSichitaiBoat); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index 8daa69d914..08d062e6c0 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -7,11 +7,23 @@ struct BgIngate; typedef void (*BgIngateActionFunc)(struct BgIngate*, GlobalContext*); +#define BGINGATE_GET_FF(thisx) ((thisx)->params & 0xFF) + typedef struct BgIngate { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x18]; - /* 0x015C */ BgIngateActionFunc actionFunc; - /* 0x0160 */ char unk_160[0x30]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ BgIngateActionFunc actionFunc; + /* 0x160 */ u16 unk160; + /* 0x164 */ Path* unk164; + /* 0x168 */ s16 unk168; + /* 0x16A */ s16 unk16A; + /* 0x16C */ s16 unk16C; + /* 0x16E */ s16 unk16E; + /* 0x170 */ Vec3f unk170; + /* 0x17C */ f32 unk17C; + /* 0x180 */ s32 unk180; + /* 0x184 */ s32 unk184; + /* 0x188 */ s32 unk188; + /* 0x18C */ s32 unk18C; } BgIngate; // size = 0x190 extern const ActorInit Bg_Ingate_InitVars; 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 e2c8c079e6..ea65880de7 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1347,7 +1347,7 @@ void Boss02_Draw(Actor* thisx, GlobalContext* globalCtx2) { f32 sp9C; f32 sp98; - matrix = (RSPMatrix*)GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(RSPMatrix) * 23); + matrix = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(RSPMatrix) * 23); OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index b4106527b6..b74d9c66b8 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -179,8 +179,8 @@ void Boss04_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(D_809EE1F8); i++) { spA8.x = D_809EE1F8[i].x + this->actor.world.pos.x; spA8.z = D_809EE1F8[i].z + this->actor.world.pos.z; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &spA8, &spB4, &spC0, 1, 0, 0, 1, - &spA4)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &spA8, &spB4, &spC0, true, false, false, + true, &spA4)) { if (i == 0) { this->unk_6D8 = spB4.x; } else if (i == 1) { diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 9eebc0fd91..4d791c42ec 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -146,9 +146,10 @@ s32 DemoTreLgt_OverrideLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCu Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 2) % 256, 0, 64, 32, 1, (globalCtx->state.frames * -2) % 256, 0, 64, 32)); - if (limbIndex == 1) { + if (limbIndex == OBJECT_BOX_LIGHT_LIMB_01) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha1); - } else if (limbIndex == 13 || limbIndex == 7 || limbIndex == 4 || limbIndex == 10) { + } else if (limbIndex == OBJECT_BOX_LIGHT_LIMB_13 || limbIndex == OBJECT_BOX_LIGHT_LIMB_07 || + limbIndex == OBJECT_BOX_LIGHT_LIMB_04 || limbIndex == OBJECT_BOX_LIGHT_LIMB_10) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->colorAlpha2); } diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index 4dd75d8435..102ecd95ef 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -28,7 +28,7 @@ const ActorInit Dm_Nb_InitVars = { (ActorFunc)DmNb_Draw, }; -static AnimationInfoS D_80C1E200[] = { &object_nb_Anim_000990, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; +static AnimationInfoS D_80C1E200[] = { { &object_nb_Anim_000990, 1.0f, 0, -1, ANIMMODE_LOOP, 0 } }; s32 func_80C1DED0(DmNb* this, s32 arg1) { s32 ret = false; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 2017e960b5..b32140c83b 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1566,7 +1566,7 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) { } if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.msgMode != 0) && - (globalCtx->msgCtx.unk11F04 == 0x5E6) && !FrameAdvance_IsEnabled(globalCtx) && + (globalCtx->msgCtx.unk11F04 == 0x5E6) && !FrameAdvance_IsEnabled(&globalCtx->state) && (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { time = gSaveContext.time; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 85a7a9bc86..73d9911f99 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -147,7 +147,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { // unused in vanilla, the highest params bits can directly index an address entranceIndex = GET_DOORANA_DIRECT_ENTRANCE(this); - func_80169E6C(globalCtx, 3, 0x4FF); + Play_SetupRespawnPoint(&globalCtx->state, 3, 0x4FF); gSaveContext.respawn[3].pos.y = this->actor.world.pos.y; gSaveContext.respawn[3].yaw = this->actor.home.rot.y; 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 a1a738fee8..56f39772a6 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -376,7 +376,7 @@ void func_808B93A0(DoorWarp1* this, GlobalContext* globalCtx) { } void func_808B94A4(DoorWarp1* this, GlobalContext* globalCtx) { - if (!func_808B866C(this, globalCtx) && (ActorCutscene_GetCurrentIndex() != globalCtx->unk_1879C[8])) { + if (!func_808B866C(this, globalCtx) && (ActorCutscene_GetCurrentIndex() != globalCtx->playerActorCsIds[8])) { DoorWarp1_SetupAction(this, func_808B921C); } func_808BB8D4(this, globalCtx, 1); @@ -384,10 +384,10 @@ void func_808B94A4(DoorWarp1* this, GlobalContext* globalCtx) { } void func_808B9524(DoorWarp1* this, GlobalContext* globalCtx) { - if (!ActorCutscene_GetCanPlayNext(globalCtx->unk_1879C[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->unk_1879C[9]); + if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->unk_1879C[9], NULL); + ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); DoorWarp1_SetupAction(this, func_808B958C); } } @@ -456,10 +456,10 @@ void func_808B977C(DoorWarp1* this, GlobalContext* globalCtx) { } void func_808B9840(DoorWarp1* this, GlobalContext* globalCtx) { - if (!ActorCutscene_GetCanPlayNext(globalCtx->unk_1879C[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->unk_1879C[9]); + if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->unk_1879C[9], NULL); + ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); DoorWarp1_SetupAction(this, func_808B98A8); } } @@ -488,7 +488,7 @@ void func_808B98A8(DoorWarp1* this, GlobalContext* globalCtx) { Scene_SetExitFade(globalCtx); globalCtx->sceneLoadFlag = 0x14; } else { - func_80169FDC(globalCtx); + func_80169FDC(&globalCtx->state); } } } @@ -615,10 +615,10 @@ void func_808B9FD0(DoorWarp1* this, GlobalContext* globalCtx) { return; } - if (!ActorCutscene_GetCanPlayNext(globalCtx->unk_1879C[9])) { - ActorCutscene_SetIntentToPlay(globalCtx->unk_1879C[9]); + if (!ActorCutscene_GetCanPlayNext(globalCtx->playerActorCsIds[9])) { + ActorCutscene_SetIntentToPlay(globalCtx->playerActorCsIds[9]); } else { - ActorCutscene_Start(globalCtx->unk_1879C[9], NULL); + ActorCutscene_Start(globalCtx->playerActorCsIds[9], NULL); Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, Animation_GetLastFrame(&object_warp1_Anim_001374.common), @@ -767,7 +767,7 @@ void func_808BA10C(DoorWarp1* this, GlobalContext* globalCtx) { Scene_SetExitFade(globalCtx); globalCtx->sceneLoadFlag = 0x14; } else { - func_80169FDC(globalCtx); + func_80169FDC(&globalCtx->state); } } 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 adfce2f19b..d3286f5451 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -472,7 +472,7 @@ void func_8088ACE0(EnArrow* this, GlobalContext* globalCtx) { } this->unk_262 = BgCheck_ProjectileLineTest(&globalCtx->colCtx, &this->actor.prevPos, &this->actor.world.pos, - &sp9C, &this->actor.wallPoly, 1, 1, 1, 1, &spA8); + &sp9C, &this->actor.wallPoly, true, true, true, true, &spA8); if (this->unk_262 != 0) { func_800B90AC(globalCtx, &this->actor, this->actor.wallPoly, spA8, &sp9C); Math_Vec3f_Copy(&this->actor.world.pos, &sp9C); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 4eeeb3894f..6e2ca41863 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -1359,10 +1359,6 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); } -/* - * this matches without OPENDISPS but with it has stack issues, - * might be able to find an alternative match with the macros, so far no success - */ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { EnBigpo* this = THIS; f32 magnitude; @@ -1381,42 +1377,41 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { Math_Vec3f_Copy(&vec1, &gZeroVec3f); } - { - GraphicsContext* gfx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx); - // fully visible OR fully transparent - if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { - Scene_SetRenderModeXlu(globalCtx, 0, 1); - dispHead = gfx->polyOpa.p; - } else { - Scene_SetRenderModeXlu(globalCtx, 1, 2); - dispHead = gfx->polyXlu.p; - } - - gSPDisplayList(&dispHead[0], &sSetupDL[6 * 0x19]); - - gSPSegment(&dispHead[1], 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 0, 255, this->mainColor.a)); - - Matrix_GetStateTranslationAndScaledY(1400.0f, &vec2); - Lights_PointGlowSetInfo(&this->fires[0].info, vec2.x + vec1.x, vec2.y + vec1.y, vec2.z + vec1.z, - this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, this->lanternColor.a); - - gDPSetEnvColor(&dispHead[2], this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, - this->mainColor.a); - - gSPMatrix(&dispHead[3], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - gSPDisplayList(&dispHead[4], &gBigpoDrawLanternMainDL); - - gSPDisplayList(&dispHead[5], &gBigpoDrawLanternPurpleTopDL); - - // fully transparent OR fully invisible - if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { - gfx->polyOpa.p = &dispHead[6]; - } else { - gfx->polyXlu.p = &dispHead[6]; - } + // fully visible OR fully transparent + if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { + Scene_SetRenderModeXlu(globalCtx, 0, 1); + dispHead = POLY_OPA_DISP; + } else { + Scene_SetRenderModeXlu(globalCtx, 1, 2); + dispHead = POLY_XLU_DISP; } + + gSPDisplayList(&dispHead[0], &sSetupDL[6 * 0x19]); + + gSPSegment(&dispHead[1], 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 0, 255, this->mainColor.a)); + + Matrix_GetStateTranslationAndScaledY(1400.0f, &vec2); + Lights_PointGlowSetInfo(&this->fires[0].info, vec2.x + vec1.x, vec2.y + vec1.y, vec2.z + vec1.z, + this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, this->lanternColor.a); + + gDPSetEnvColor(&dispHead[2], this->lanternColor.r, this->lanternColor.g, this->lanternColor.b, this->mainColor.a); + + gSPMatrix(&dispHead[3], Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(&dispHead[4], &gBigpoDrawLanternMainDL); + + gSPDisplayList(&dispHead[5], &gBigpoDrawLanternPurpleTopDL); + + // fully transparent OR fully invisible + if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { + POLY_OPA_DISP = &dispHead[6]; + } else { + POLY_XLU_DISP = &dispHead[6]; + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); } void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 53bdc09953..8faf1cdba6 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -299,7 +299,7 @@ void func_809CD634(EnBji01* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(0xE0000101); globalCtx->nextEntranceIndex = 0x54A0; /* Termina Field from telescope */ gSaveContext.respawn[0].entranceIndex = globalCtx->nextEntranceIndex; - func_80169EFC(globalCtx); /* Load new entrance? */ + func_80169EFC(&globalCtx->state); /* Load new entrance? */ gSaveContext.respawnFlag = -2; this->actionFunc = EnBji01_DoNothing; } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 6bb4827ae2..33b7e30581 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -268,7 +268,7 @@ void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp6C, - &sp50, 1, 0, 0, 1, &sp4C)) { + &sp50, true, false, false, true, &sp4C)) { func_80BFE494(this, 5, 1.0f); Math_Vec3f_Copy(&this->unk_2A4, &sp54); this->unk_2BE = Rand_S16Offset(30, 50); @@ -290,8 +290,8 @@ void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { sp60.x += Math_SinS(this->actor.world.rot.y) * 60.0f; sp60.z += Math_CosS(this->actor.world.rot.y) * 60.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp60, &sp6C, &sp50, 1, 0, 0, 1, - &sp4C)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp60, &sp6C, &sp50, true, + false, false, true, &sp4C)) { this->unk_2C0 = 0; if (Rand_ZeroOne() < 0.5f) { func_80BFE494(this, 19, 1.0f); diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 26e9291d1d..2989bbd02e 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -276,7 +276,7 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp48, &sp60, - &colPoly, 1, 0, 0, 1, &sp44)) { + &colPoly, true, false, false, true, &sp44)) { func_80C0113C(this, 5, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp48); this->unk_2B0 = Rand_S16Offset(30, 50); @@ -295,8 +295,8 @@ void func_80C014E4(EnBomjimb* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp54, &this->actor.world.pos); sp54.x += Math_SinS(this->actor.world.rot.y) * 60.0f; sp54.z += Math_CosS(this->actor.world.rot.y) * 60.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp60, &colPoly, 1, 0, 0, - 1, &sp44)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp60, &colPoly, true, + false, false, true, &sp44)) { this->unk_2AE = 0; if (Rand_ZeroOne() < 0.5f) { func_80C0113C(this, 20, 1.0f); @@ -556,7 +556,8 @@ void func_80C0217C(EnBomjimb* this, GlobalContext* globalCtx) { sp74.y += 20.0f; sp74.z += Math_CosS(this->actor.world.rot.y) * 50.0f; - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp64, &sp70, 1, 0, 0, 1, &sp60)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp74, &sp64, &sp70, true, false, false, + true, &sp60)) { s16 temp = BINANG_SUB((this->actor.world.rot.y - this->actor.yawTowardsPlayer), 0x8000); this->unk_2D6 = temp; 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 8029c4988c..d4d55dd624 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -628,7 +628,7 @@ void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve EnBox* this = THIS; s32 pad; - if (limbIndex == 1) { + if (limbIndex == OBJECT_BOX_CHEST_LIMB_01) { gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestBaseOrnateDL); @@ -641,7 +641,7 @@ void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } else { gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL); } - } else if (limbIndex == 3) { + } else if (limbIndex == OBJECT_BOX_CHEST_LIMB_03) { gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestLidOrnateDL); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 54dd34dbcd..ea70a14807 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -5,6 +5,8 @@ */ #include "z_en_butte.h" +#include "objects/gameplay_field_keep/gameplay_field_keep.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0x00000000 @@ -15,24 +17,40 @@ void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnButte_Update(Actor* thisx, GlobalContext* globalCtx); void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_8091C748(EnButte* this); void func_8091C794(EnButte* this, GlobalContext* globalCtx); +void func_8091CB68(EnButte* this); void func_8091CBB4(EnButte* this, GlobalContext* globalCtx); +void func_8091CF64(EnButte* this); void func_8091CFB4(EnButte* this, GlobalContext* globalCtx); +void func_8091D070(EnButte* this); void func_8091D090(EnButte* this, GlobalContext* globalCtx); -#if 0 -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_8091D2D0[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { 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, + }, { 0, { { 0, 0, 0 }, 5 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_8091D2F4 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, D_8091D2D0, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 1, + sJntSphElementsInit, }; const ActorInit En_Butte_InitVars = { @@ -47,54 +65,389 @@ const ActorInit En_Butte_InitVars = { (ActorFunc)EnButte_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8091D3B0[] = { +typedef struct { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ s16 unk_10; +} EnButteStruct; // size = 0x14 + +EnButteStruct D_8091D324[] = { + { 5, 35, 0.0f, 0.1f, 0.5f, 0 }, + { 10, 45, 1.1f, 0.1f, 0.25f, 1000 }, + { 10, 40, 1.5f, 0.1f, 0.3f, 2000 }, +}; + +EnButteStruct D_8091D360[] = { + { 3, 3, 0.8f, 0.1f, 0.2f, 0 }, + { 10, 20, 2.0f, 0.3f, 1.0f, 0 }, + { 10, 20, 2.4f, 0.3f, 1.0f, 0 }, +}; + +f32 D_8091D39C = 0.0f; + +s16 D_8091D3A0 = 0; + +Vec3f D_8091D3A4 = { 0.0f, 0.0f, -3.0f }; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 700, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 20, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 60, ICHAIN_STOP), }; -#endif +f32 D_8091D3C0[] = { 50.0f, 80.0f, 100.0f }; -extern ColliderJntSphElementInit D_8091D2D0[1]; -extern ColliderJntSphInit D_8091D2F4; -extern InitChainEntry D_8091D3B0[]; +f32 D_8091D3CC[] = { 30.0f, 40.0f, 50.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C0A0.s") +f32 D_8091D3D8[] = { 15.0f, 20.0f, 25.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C124.s") +f32 D_8091D3E4[] = { 7.5f, 10.0f, 12.5f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C140.s") +s32 D_8091D3F0 = 1500; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C178.s") +void func_8091C0A0(EnButte* this, EnButteStruct* arg1) { + if (this->unk_24E == 0) { + if (Rand_ZeroOne() < 0.6f) { + this->unk_24E = 1; + } else { + this->unk_24E = 2; + } + } else { + this->unk_24E = 0; + } + this->unk_24C = Rand_S16Offset(arg1->unk_00, arg1->unk_02); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/EnButte_Init.s") +void func_8091C124(void) { + D_8091D39C = 0.0f; + D_8091D3A0 = 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/EnButte_Destroy.s") +void func_8091C140(void) { + D_8091D39C += 0.003f; + D_8091D3A0 += 0xFA0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C524.s") +void func_8091C178(EnButte* this, GlobalContext* globalCtx) { + Vec3f sp4C; + s32 sp48; + Vec3s sp40; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C5EC.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C6B4.s") + func_8012C240(globalCtx->state.gfxCtx); + sp48 = Math_SinS(D_8091D3A0) * 250.0f; + sp48 = CLAMP(sp48, 0, 255); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C748.s") + func_800DFC90(&sp40, GET_ACTIVE_CAM(globalCtx)); + Matrix_RotateY(sp40.y, MTXMODE_NEW); + Matrix_InsertXRotation_s(sp40.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(sp40.z, MTXMODE_APPLY); + Matrix_MultiplyVector3fByState(&D_8091D3A4, &sp4C); + Matrix_SetStateRotationAndTranslation(this->actor.focus.pos.x + sp4C.x, this->actor.focus.pos.y + sp4C.y, + this->actor.focus.pos.z + sp4C.z, &sp40); + Matrix_Scale(D_8091D39C, D_8091D39C, D_8091D39C, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091C794.s") + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 200, 200, 180, sp48); + gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 210, 255); + gSPDisplayList(POLY_XLU_DISP++, gOwlStatueWhiteFlashDL); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091CB68.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091CBB4.s") +void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnButte* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091CF64.s") + if (ENBUTTE_GET(&this->actor) == ENBUTTE_MINUS1) { + this->actor.params = ENBUTTE_0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091CFB4.s") + this->actor.world.rot.y = Rand_Next(); + this->actor.home.rot.y = this->actor.world.rot.y; + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_ProcessInitChain(&this->actor, sInitChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091D070.s") + if ((ENBUTTE_GET_1(&this->actor) & 0xFF) == ENBUTTE_1) { + this->actor.uncullZoneScale = 200.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/func_8091D090.s") + SkelAnime_Init(globalCtx, &this->skelAnime, &gameplay_field_keep_Skel_002FA0, &gameplay_field_keep_Anim_001D20, + this->jointTable, this->morphTable, 8); + Collider_InitJntSph(globalCtx, &this->collider); + Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colldierElements); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/EnButte_Update.s") + this->collider.elements[0].dim.worldSphere.radius = + this->collider.elements[0].dim.scale * this->collider.elements[0].dim.modelSphere.radius; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Butte/EnButte_Draw.s") + this->actor.colChkInfo.mass = 0; + this->unk_254 = Rand_ZeroOne() * 0xFFFF; + this->unk_256 = Rand_ZeroOne() * 0xFFFF; + this->unk_258 = Rand_ZeroOne() * 0xFFFF; + + Animation_Change(&this->skelAnime, &gameplay_field_keep_Anim_001D20, 1.0f, 0.0f, 0.0f, 1, 0.0f); + func_8091C748(this); + this->actor.shape.rot.x -= 0x2320; + this->unk_250 = 1; +} + +void EnButte_Destroy(Actor* thisx, GlobalContext* globalCtx) { + Collider_DestroyJntSph(globalCtx, &THIS->collider); +} + +void func_8091C524(EnButte* this) { + this->actor.shape.yOffset += + (Math_SinS(this->unk_254) * D_8091D3C0[this->unk_24E]) + (Math_SinS(this->unk_256) * D_8091D3CC[this->unk_24E]); + this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -2000.0f, 2000.0f); +} + +void func_8091C5EC(EnButte* this) { + this->actor.shape.yOffset += + (Math_SinS(this->unk_254) * D_8091D3D8[this->unk_24E]) + (Math_SinS(this->unk_256) * D_8091D3E4[this->unk_24E]); + this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -500.0f, 500.0f); +} + +void func_8091C6B4(EnButte* this) { + s16 temp_a1 = BINANG_ROT180(this->actor.world.rot.y); + s16 temp_v0 = temp_a1 - this->actor.shape.rot.y; + + Math_ScaledStepToS(&this->actor.shape.rot.y, temp_a1, ABS_ALT(temp_v0) >> 3); + this->actor.shape.rot.x = (s16)(Math_SinS(this->unk_258) * 600.0f) - 0x2320; +} + +void func_8091C748(EnButte* this) { + func_8091C0A0(this, &D_8091D324[this->unk_24E]); + this->actionFunc = func_8091C794; +} + +void func_8091C794(EnButte* this, GlobalContext* globalCtx) { + EnButteStruct* sp4C = &D_8091D324[this->unk_24E]; + f32 distSq; + Player* player = GET_PLAYER(globalCtx); + f32 distFromHomeSq = Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, + this->actor.home.pos.x, this->actor.home.pos.z); + f32 playSpeed; + f32 sp38; + s32 pad; + s16 sp32; + s16 yaw; + + func_8091C524(this); + Math_SmoothStepToF(&this->actor.speedXZ, sp4C->unk_04, sp4C->unk_08, sp4C->unk_0C, 0.0f); + + if (this->unk_24F == 1) { + distSq = SQ(100.0f); + sp32 = 0x3E8; + } else { + distSq = SQ(35.0f); + sp32 = 0x258; + } + + sp38 = 0.0f; + this->unk_25C = this->actor.home.pos.y; + + if ((this->unk_24E != 0) && ((distSq < distFromHomeSq) || (this->unk_24C < 4))) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); + if (!Math_ScaledStepToS(&this->actor.world.rot.y, yaw, sp4C->unk_10)) { + sp38 = 0.5f; + } + } else if ((this->unk_24F == 0) && (this->actor.child != NULL) && (&this->actor != this->actor.child)) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); + if (!Math_ScaledStepToS(&this->actor.world.rot.y, yaw, sp32)) { + sp38 = 0.3f; + } + } else if (this->unk_24F == 1) { + if (!Math_ScaledStepToS(&this->actor.world.rot.y, + (s32)((Rand_ZeroOne() - 0.5f) * 0x6000) + this->actor.yawTowardsPlayer + 0x8000, + sp32)) { + sp38 = 0.4f; + } + } else { + this->actor.world.rot.y += (s16)(Math_SinS(this->unk_254) * 100.0f); + } + + func_8091C6B4(this); + + playSpeed = + (((this->actor.speedXZ * 0.5f) + (Rand_ZeroOne() * 0.2f)) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + + ((1.0f - Math_SinS(this->unk_256)) * 0.3f) + sp38; + this->skelAnime.playSpeed = CLAMP(playSpeed, 0.2f, 1.5f); + + SkelAnime_Update(&this->skelAnime); + + if (this->unk_24C <= 0) { + func_8091C0A0(this, &D_8091D324[this->unk_24E]); + } + + if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (player->itemActionParam == 7) && (this->unk_252 <= 0) && + ((Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x, + this->actor.home.pos.z) < SQ(120.0f)) || + (this->actor.xzDistToPlayer < 60.0f))) { + func_8091CB68(this); + this->unk_24F = 2; + } else if (this->actor.xzDistToPlayer < 120.0f) { + this->unk_24F = 1; + } else { + this->unk_24F = 0; + } +} + +void func_8091CB68(EnButte* this) { + func_8091C0A0(this, &D_8091D360[this->unk_24E]); + this->actionFunc = func_8091CBB4; +} + +void func_8091CBB4(EnButte* this, GlobalContext* globalCtx) { + EnButteStruct* sp5C = &D_8091D360[this->unk_24E]; + Player* player = GET_PLAYER(globalCtx); + f32 playSpeed; + Vec3f sp48; + f32 distSq; + f32 sp40; + s32 pad; + s16 pad2; + s16 yaw; + + func_8091C5EC(this); + Math_SmoothStepToF(&this->actor.speedXZ, sp5C->unk_04, sp5C->unk_08, sp5C->unk_0C, 0.0f); + sp40 = 0.0f; + + if ((this->unk_24E != 0) && (this->unk_24C < 12)) { + sp48.x = player->swordInfo[0].tip.x + (Math_SinS(player->actor.shape.rot.y) * 10.0f); + sp48.y = player->swordInfo[0].tip.y; + sp48.z = player->swordInfo[0].tip.z + (Math_CosS(player->actor.shape.rot.y) * 10.0f); + + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &sp48); + if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw + (s32)(Rand_ZeroOne() * D_8091D3F0), 0x7D0)) { + if ((globalCtx->gameplayFrames & 0x30) == 0x30) { + this->actor.world.rot.y += (s16)(Math_SinS(this->unk_254) * 60.0f); + } + } else { + sp40 = 0.3f; + } + } + + if (player->swordInfo[0].tip.y < player->actor.world.pos.y + 30.0f) { + this->unk_25C = player->actor.world.pos.y + 30.0f; + } else { + this->unk_25C = player->swordInfo[0].tip.y; + } + + func_8091C6B4(this); + + playSpeed = ((this->actor.speedXZ * 0.5f) + (Rand_ZeroOne() * 0.2f) + ((1.0f - Math_SinS(this->unk_258)) * 0.15f)) + + ((1.0f - Math_SinS(this->unk_256)) * 0.3f) + sp40; + this->skelAnime.playSpeed = CLAMP(playSpeed, 0.2f, 1.5f); + SkelAnime_Update(&this->skelAnime); + + if (this->unk_24C <= 0) { + func_8091C0A0(this, &D_8091D360[this->unk_24E]); + D_8091D3F0 = -D_8091D3F0; + } + + distSq = Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, + this->actor.home.pos.z); + if ((player->itemActionParam != 7) || !(fabsf(player->actor.speedXZ) < 1.8f) || (this->unk_252 > 0) || + !(distSq < SQ(320.0f))) { + func_8091C748(this); + } else if ((distSq > SQ(240.0f)) && + (Math3D_XZDistanceSquared(player->swordInfo[0].tip.x, player->swordInfo[0].tip.z, + this->actor.world.pos.x, this->actor.world.pos.z) < SQ(60.0f))) { + func_8091CF64(this); + } +} + +void func_8091CF64(EnButte* this) { + this->unk_24C = 9; + this->actor.flags |= ACTOR_FLAG_10; + this->skelAnime.playSpeed = 1.0f; + func_8091C124(); + this->actionFunc = func_8091CFB4; +} + +void func_8091CFB4(EnButte* this, GlobalContext* globalCtx) { + SkelAnime_Update(&this->skelAnime); + func_8091C140(); + + if (this->unk_24C == 5) { + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 60, NA_SE_EV_BUTTERFRY_TO_FAIRY); + } else if (this->unk_24C == 4) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, this->actor.focus.pos.x, this->actor.focus.pos.y, + this->actor.focus.pos.z, 0, this->actor.shape.rot.y, 0, 2); + this->unk_250 = 0; + } else if (this->unk_24C <= 0) { + func_8091D070(this); + } +} + +void func_8091D070(EnButte* this) { + this->unk_24C = 64; + this->actionFunc = func_8091D090; + this->actor.draw = NULL; +} + +void func_8091D090(EnButte* this, GlobalContext* globalCtx) { + if (this->unk_24C <= 0) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { + EnButte* this = THIS; + + if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (&this->actor != this->actor.child)) { + this->actor.child = NULL; + } + + if (this->unk_24C > 0) { + this->unk_24C--; + } + + this->unk_254 += 0x222; + this->unk_256 += 0x1000; + this->unk_258 += 0x600; + + if (ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) { + if (GET_PLAYER(globalCtx)->swordState == 0) { + if (this->unk_252 > 0) { + this->unk_252--; + } + } else { + this->unk_252 = 80; + } + } + + this->actionFunc(this, globalCtx); + + if (this->actor.update != NULL) { + Actor_MoveWithGravity(&this->actor); + Math_StepToF(&this->actor.world.pos.y, this->unk_25C, 0.6f); + if (this->actor.xyzDistToPlayerSq < 5000.0f) { + ColliderJntSphElement* element = &this->collider.elements[0]; + + element->dim.worldSphere.center.x = this->actor.world.pos.x; + element->dim.worldSphere.center.y = this->actor.world.pos.y; + element->dim.worldSphere.center.z = this->actor.world.pos.z; + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } + Actor_SetFocus(&this->actor, this->actor.shape.yOffset * this->actor.scale.y); + } +} + +void EnButte_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnButte* this = THIS; + + if (this->unk_250 != 0) { + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, NULL); + } + + if ((ENBUTTE_GET_1(&this->actor) == ENBUTTE_1) && (this->actionFunc == func_8091CFB4)) { + func_8091C178(this, globalCtx); + } +} diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 1de720b8d3..361096961e 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -7,11 +7,30 @@ struct EnButte; typedef void (*EnButteActionFunc)(struct EnButte*, GlobalContext*); +#define ENBUTTE_GET(thisx) ((thisx)->params) +#define ENBUTTE_GET_1(thisx) ((thisx)->params & 1) + +#define ENBUTTE_MINUS1 -1 +#define ENBUTTE_0 0 +#define ENBUTTE_1 1 + typedef struct EnButte { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x104]; + /* 0x0144 */ ColliderJntSph collider; + /* 0x0164 */ ColliderJntSphElement colldierElements[1]; + /* 0x01A4 */ SkelAnime skelAnime; + /* 0x01E8 */ Vec3s jointTable[8]; + /* 0x0218 */ Vec3s morphTable[8]; /* 0x0248 */ EnButteActionFunc actionFunc; - /* 0x024C */ char unk_24C[0x14]; + /* 0x024C */ s16 unk_24C; + /* 0x024E */ u8 unk_24E; + /* 0x024F */ u8 unk_24F; + /* 0x0250 */ u8 unk_250; + /* 0x0252 */ s16 unk_252; + /* 0x0254 */ s16 unk_254; + /* 0x0256 */ s16 unk_256; + /* 0x0258 */ s16 unk_258; + /* 0x025C */ f32 unk_25C; } EnButte; // size = 0x260 extern const ActorInit En_Butte_InitVars; diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index fd42fd3f35..73569c34b6 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -269,7 +269,7 @@ void EnCow_Idle(EnCow* this, GlobalContext* globalCtx) { this->flags &= ~EN_COW_FLAG_WONT_GIVE_MILK; D_801BDAA4 = 0; } else if ((this->actor.xzDistToPlayer < 150.0f) && - ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 25000) { + ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)) < 25000) { D_801BDAA4 = 0; this->actionFunc = EnCow_Talk; this->actor.flags |= ACTOR_FLAG_10000; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index 263469dac7..0648ca4ad0 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -206,7 +206,7 @@ void func_8098933C(EnDg* this, Vec3f* arg1) { } s32 func_80989418(EnDg* this, Path* arg1, s32 arg2) { - Vec3s* sp5C = (Vec3s*)Lib_SegmentedToVirtual(arg1->points); + Vec3s* sp5C = Lib_SegmentedToVirtual(arg1->points); s32 count = arg1->count; s32 idx = arg2; s32 sp50 = false; @@ -243,7 +243,7 @@ s16 func_809895B4(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { f32 diffZ; if (path != NULL) { - points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + points = Lib_SegmentedToVirtual(path->points); points = &points[idx]; diffX = points->x - pos->x; diffZ = points->z - pos->z; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 079abb641e..03afec1fb3 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -280,7 +280,7 @@ void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { if (D_8089E364 == 0) { for (i = 0; i < ARRAY_COUNT(D_8089E33C); i++) { - D_8089E33C[i] = (Gfx*)Lib_SegmentedToVirtual(D_8089E33C[i]); + D_8089E33C[i] = Lib_SegmentedToVirtual(D_8089E33C[i]); } D_8089E364 = 1; } 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 a637174bfb..d074753be5 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -107,7 +107,7 @@ void EnDnb_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hanareyama_obj_Colheader_004D8C); - alloc = (s16*)Lib_SegmentedToVirtual(object_hanareyama_obj_Vec_004710); + alloc = Lib_SegmentedToVirtual(object_hanareyama_obj_Vec_004710); for (i = 0; i < ARRAY_COUNT(this->particles); i++) { func_80A4FDD0(&this->particles[i], this, alloc, i); } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index f05817282f..d51ec8a4d8 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -40,8 +40,6 @@ void func_80A732C8(EnDno* this, GlobalContext* globalCtx); s32 EnDno_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); void EnDno_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); -extern u8 D_801C20C0; - static AnimationSpeedInfo sAnimations[] = { { &object_dno_Anim_000470, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_0008F0, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_000F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_001A50, 1.0f, ANIMMODE_ONCE, 0.0f }, @@ -611,7 +609,7 @@ void func_80A725F8(EnDno* this, GlobalContext* globalCtx) { case 0x802: if (func_80147624(globalCtx)) { - if (gSaveContext.inventory.items[D_801C20C0] == ITEM_MASK_SCENTS) { + if (INV_CONTENT(ITEM_MASK_SCENTS) == ITEM_MASK_SCENTS) { this->unk_458 = GI_RUPEE_RED; } else { this->unk_458 = GI_MASK_SCENTS; diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index 81acb58cf5..8643dfa91a 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -1,7 +1,7 @@ /* * File: z_en_drs.c * Overlay: ovl_En_Drs - * Description: Wedding dress manequin + * Description: Anju's Wedding Dress Mannequin */ #include "z_en_drs.h" @@ -13,11 +13,10 @@ void EnDrs_Init(Actor* thisx, GlobalContext* globalCtx); void EnDrs_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnDrs_Update(Actor* thisx, GlobalContext* globalCtx); +void EnDrs_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80C1E2D4(EnDrs* this, GlobalContext* globalCtx); -void func_80C1E3DC(EnDrs* this, GlobalContext* globalCtx); +void EnDrs_Idle(EnDrs* this, GlobalContext* globalCtx); -#if 0 const ActorInit En_Drs_InitVars = { ACTOR_EN_DRS, ACTORCAT_PROP, @@ -30,36 +29,98 @@ const ActorInit En_Drs_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80C1E5E0 = { - { COLTYPE_HIT1, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT1, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 16, 62, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80C1E60C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -#endif +static AnimationInfoS sAnimations = { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; -extern ColliderCylinderInit D_80C1E5E0; -extern CollisionCheckInfoInit2 D_80C1E60C; +void EnDrs_CollisionUpdate(EnDrs* this, GlobalContext* globalCtx) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} -extern UNK_TYPE D_06000E70; -extern UNK_TYPE D_06005A78; +void EnDrs_Setup(EnDrs* this, GlobalContext* globalCtx) { + s32 pad[2]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/func_80C1E290.s") + if ((this->moonMaskObjBankIndex >= 0) && SubS_IsObjectLoaded(this->moonMaskObjBankIndex, globalCtx)) { + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gWeddingDressMannequinSkel, NULL, this->jointTable, + this->morphTable, WEDDING_DRESS_MANNEQUIN_LIMB_MAX); + SubS_ChangeAnimationByInfoS(&this->skelAnime, &sAnimations, 0); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + Actor_SetScale(&this->actor, 0.01f); + this->actor.draw = EnDrs_Draw; + this->actionFunc = EnDrs_Idle; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/func_80C1E2D4.s") +void EnDrs_Idle(EnDrs* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/func_80C1E3DC.s") +void EnDrs_Init(Actor* thisx, GlobalContext* globalCtx) { + EnDrs* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/EnDrs_Init.s") + this->moonMaskObjBankIndex = SubS_GetObjectIndex(OBJECT_MSMO, globalCtx); + this->actionFunc = EnDrs_Setup; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/EnDrs_Destroy.s") +void EnDrs_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnDrs* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/EnDrs_Update.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/func_80C1E4B0.s") +void EnDrs_Update(Actor* thisx, GlobalContext* globalCtx) { + EnDrs* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Drs/func_80C1E568.s") + this->actionFunc(this, globalCtx); + if (this->actor.draw != NULL) { + SkelAnime_Update(&this->skelAnime); + EnDrs_CollisionUpdate(this, globalCtx); + } +} + +void EnDrs_PostLimbDraw(GlobalContext* globalCtx2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnDrs* this = THIS; + GlobalContext* globalCtx = globalCtx2; + s8 temp = this->moonMaskObjBankIndex; + s8 temp2 = this->actor.objBankIndex; + + // Anju removes the Moon Mask at the start of the Couple's Mask cutscene + // after that it will no longer be rendered. + if (!(gSaveContext.weekEventReg[87] & 2) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { + OPEN_DISPS(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[temp].segment); + gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[temp2].segment); + CLOSE_DISPS(globalCtx->state.gfxCtx); + } +} + +void EnDrs_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnDrs* this = THIS; + + func_8012C5B0(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, EnDrs_PostLimbDraw, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.h b/src/overlays/actors/ovl_En_Drs/z_en_drs.h index 191f272d6e..1f59d601bf 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.h +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.h @@ -2,17 +2,22 @@ #define Z_EN_DRS_H #include "global.h" +#include "objects/object_drs/object_drs.h" +#include "objects/object_msmo/object_msmo.h" struct EnDrs; typedef void (*EnDrsActionFunc)(struct EnDrs*, GlobalContext*); typedef struct EnDrs { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; - /* 0x0188 */ EnDrsActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x80]; -} EnDrs; // size = 0x20C + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ EnDrsActionFunc actionFunc; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ Vec3s jointTable[WEDDING_DRESS_MANNEQUIN_LIMB_MAX]; + /* 0x1F0 */ Vec3s morphTable[WEDDING_DRESS_MANNEQUIN_LIMB_MAX]; + /* 0x208 */ s8 moonMaskObjBankIndex; +} EnDrs; // size = 0x20C */ extern const ActorInit En_Drs_InitVars; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index e2519c7c58..aac2475467 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -176,7 +176,7 @@ void func_809619D0(EnFu* this, GlobalContext* globalCtx) { } this->unk_520 = path->count; - this->unk_538 = (Vec3s*)Lib_SegmentedToVirtual(path->points); + this->unk_538 = Lib_SegmentedToVirtual(path->points); func_809616E0(this, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 8bd7e128bf..ea225846ab 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -266,7 +266,8 @@ void func_80932784(EnFz* this, GlobalContext* globalCtx) { sp44.z = 440.0f; Matrix_MultiplyVector3fByState(&sp44, &this->unk_22C); - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp5C, &this->unk_22C, &sp50, &sp3C, 1, 0, 0, 1, &sp40)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &sp5C, &this->unk_22C, &sp50, &sp3C, true, false, false, true, + &sp40)) { Math_Vec3f_Copy(&this->unk_22C, &sp50); } 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 e06655c69e..252853a249 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -5,6 +5,7 @@ */ #include "z_en_gg2.h" +#include "objects/object_gg/object_gg.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_80) @@ -15,7 +16,17 @@ void EnGg2_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnGg2_Update(Actor* thisx, GlobalContext* globalCtx); void EnGg2_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80B3AE60(EnGg2* this, GlobalContext* globalCtx); +void func_80B3AFB0(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B05C(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B0A0(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B120(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B21C(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B294(EnGg2* this, GlobalContext* globalCtx); +void func_80B3B5D4(EnGg2* this, GlobalContext* globalCtx); +s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_); +f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); + const ActorInit En_Gg2_InitVars = { ACTOR_EN_GG2, ACTORCAT_NPC, @@ -28,48 +39,456 @@ const ActorInit En_Gg2_InitVars = { (ActorFunc)EnGg2_Draw, }; -#endif +AnimationInfo D_80B3BF00[] = { + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f }, + { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f }, + { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, + { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f }, + { &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f }, + { &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, + { &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f }, +}; -extern UNK_TYPE D_0600F578; +Color_RGBA8 D_80B3C080 = { 255, 255, 255, 255 }; +Color_RGBA8 D_80B3C084 = { 255, 150, 0, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3AC50.s") +Vec3f D_80B3C088 = { 0.0f, 0.0f, 0.0f }; +Vec3f D_80B3C094 = { 0.0f, 0.0f, 0.0f }; +Vec3f D_80B3C0A0 = { 1000.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3AC94.s") +TexturePtr D_80B3C0AC[] = { + object_gg_Tex_009260, + object_gg_Tex_009660, + object_gg_Tex_009A60, + object_gg_Tex_009E60, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3ADD8.s") +void func_80B3AC50(EnGg2* this) { + this->actor.focus.pos.x = this->actor.world.pos.x; + this->actor.focus.pos.y = this->actor.world.pos.y + 80.0f; + this->actor.focus.pos.z = this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3AE60.s") + this->actor.focus.rot.x = this->actor.world.rot.x; + this->actor.focus.rot.y = this->actor.world.rot.y; + this->actor.focus.rot.z = this->actor.world.rot.z; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3AFB0.s") +s32 func_80B3AC94(EnGg2* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + Vec3f sp40; + Vec3f sp34; + s16 pitch; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B05C.s") + sp40 = player->actor.world.pos; + sp40.y = player->bodyPartsPos[7].y + 3.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B0A0.s") + sp34 = this->actor.world.pos; + sp34.y += 70.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B120.s") + pitch = Math_Vec3f_Pitch(&sp34, &sp40); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B21C.s") + if ((this->actor.xzDistToPlayer < 250.0f) && (this->actor.xzDistToPlayer > 50.0f) && + CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + Math_SmoothStepToS(&this->unk_2F4, pitch, 4, 0x2AA8, 1); + } else { + Math_SmoothStepToS(&this->unk_2F4, 0, 4, 0x2AA8, 1); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B294.s") + this->unk_2F4 = CLAMP(this->unk_2F4, 0, 0x1C70); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B4B0.s") +void func_80B3ADD8(EnGg2* this) { + s16 temp_v0 = this->unk_2EC - 1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B5D4.s") + if (temp_v0 >= 3) { + this->unk_2EA = 0; + this->unk_2EC = temp_v0; + } else if (temp_v0 == 0) { + this->unk_2EA = 2; + this->unk_2EC = (s32)(Rand_ZeroOne() * 60.0f) + 20; + } else { + this->unk_2EA = 1; + this->unk_2EC = temp_v0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B648.s") +void func_80B3AE60(EnGg2* this, GlobalContext* globalCtx) { + s16 curFrame = this->skelAnime.curFrame; + s16 lastFrame = Animation_GetLastFrame(D_80B3BF00[this->unk_2EE].animation); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B7E4.s") + if (curFrame == lastFrame) { + switch (this->unk_2EE) { + case 0: + this->unk_2EE = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 1); + this->actionFunc = func_80B3B0A0; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3B8A4.s") + case 1: + case 8: + this->unk_2EE = 5; + this->actor.flags &= ~ACTOR_FLAG_1; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5); + this->actionFunc = func_80B3B120; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/EnGg2_Init.s") + case 5: + this->unk_2EE = 6; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->actionFunc = func_80B3B21C; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/EnGg2_Destroy.s") + case 6: + this->unk_2EE = 7; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5); + this->actionFunc = func_80B3B294; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/EnGg2_Update.s") + default: + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->actionFunc = func_80B3AFB0; + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3BD44.s") +void func_80B3AFB0(EnGg2* this, GlobalContext* globalCtx) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + this->unk_2F0 = 1; + this->actionFunc = func_80B3AE60; + } else if ((this->actor.xzDistToPlayer < 100.0f) && (this->actor.xzDistToPlayer > 50.0f) && + CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + func_800B863C(&this->actor, globalCtx); + this->actor.textId = 0xCE4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/func_80B3BDC0.s") +void func_80B3B05C(EnGg2* this, GlobalContext* globalCtx) { + if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + this->actionFunc = func_80B3B5D4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gg2/EnGg2_Draw.s") +void func_80B3B0A0(EnGg2* this, GlobalContext* globalCtx) { + if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + globalCtx->msgCtx.msgMode = 0x43; + globalCtx->msgCtx.unk12023 = 4; + this->unk_2F0 = 0; + this->actionFunc = func_80B3B5D4; + } +} + +void func_80B3B120(EnGg2* this, GlobalContext* globalCtx) { + Vec3s sp30; + + if (this->unk_1D8 != NULL) { + func_80B3B7E4(this->unk_1D8, this->unk_1DC, &this->actor.world.pos, &sp30); + Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); + this->actor.world.rot.x = -this->actor.shape.rot.x; + if (func_80B3B648(this, this->unk_1D8, this->unk_1DC) != 0) { + if (this->unk_1DC >= (this->unk_1D8->count - 2)) { + this->actionFunc = func_80B3AE60; + this->actor.speedXZ = 0.0f; + } else { + this->unk_1DC++; + } + } + Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); + } +} + +void func_80B3B21C(EnGg2* this, GlobalContext* globalCtx) { + this->actor.speedXZ = 0.0f; + if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + this->unk_2E4 = ActorCutscene_GetAdditionalCutscene(this->unk_2E4); + this->actionFunc = func_80B3B5D4; + } +} + +void func_80B3B294(EnGg2* this, GlobalContext* globalCtx) { + Vec3s sp30; + + if (this->unk_2F1 == 0) { + if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + gSaveContext.weekEventReg[20] |= 4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] |= 8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] |= 0x10; + } + + if (this->unk_1D8 != NULL) { + func_80B3B7E4(this->unk_1D8, this->unk_1DC, &this->actor.world.pos, &sp30); + Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); + this->actor.world.rot.x = -this->actor.shape.rot.x; + + if (func_80B3B648(this, this->unk_1D8, this->unk_1DC)) { + if (this->unk_1DC < (this->unk_1D8->count - 1)) { + this->unk_1DC++; + } else { + this->unk_2F1 = 1; + if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + gSaveContext.weekEventReg[20] |= 4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] |= 8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] |= 0x10; + } + } + } + } + } + Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 1.0f); +} + +void func_80B3B4B0(EnGg2* this, GlobalContext* globalCtx) { + Vec3f sp64; + Color_RGBA8 sp60 = D_80B3C080; + Color_RGBA8 sp5C = D_80B3C084; + s32 i; + + for (i = 0; i < 5; i++) { + sp64.x = (Rand_Centered() * 50.0f) + this->unk_304.x; + sp64.y = this->unk_304.y; + sp64.z = (Rand_Centered() * 50.0f) + this->unk_304.z; + EffectSsKiraKira_SpawnDispersed(globalCtx, &sp64, &D_80B3C088, &D_80B3C094, &sp60, &sp5C, 3000, 40); + } +} + +void func_80B3B5D4(EnGg2* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(this->unk_2E4)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2E4, &this->actor); + this->actionFunc = func_80B3AE60; + } else { + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + } + ActorCutscene_SetIntentToPlay(this->unk_2E4); + } +} + +s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 sp58 = path->count; + s32 arg2 = arg2_; + s32 ret = false; + f32 phi_f12; + f32 phi_f14; + f32 sp44; + f32 sp40; + f32 sp3C; + Vec3f sp30; + + Math_Vec3s_ToVec3f(&sp30, &points[arg2]); + + if (arg2 == 0) { + phi_f12 = points[1].x - points[0].x; + phi_f14 = points[1].z - points[0].z; + } else if ((sp58 - 1) == arg2) { + phi_f12 = points[sp58 - 1].x - points[sp58 - 2].x; + phi_f14 = points[sp58 - 1].z - points[sp58 - 2].z; + } else { + phi_f12 = points[arg2 + 1].x - points[arg2 - 1].x; + phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z; + } + + func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + + if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { + ret = true; + } + return ret; +} + +f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { + Vec3s* points; + Vec3f sp20; + + if (path != NULL) { + points = Lib_SegmentedToVirtual(path->points); + points = &points[arg1]; + sp20.x = points->x; + sp20.y = points->y; + sp20.z = points->z; + } + + arg3->y = Math_Vec3f_Yaw(arg2, &sp20); + arg3->x = Math_Vec3f_Pitch(arg2, &sp20); + return sp20.y - arg2->y; +} + +void func_80B3B8A4(EnGg2* this) { + f32 sp1C; + + if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) { + this->unk_2F2 += 0x62C; + sp1C = 1100.0f; + } else { + this->unk_2F2 += 0x7BC; + sp1C = 950.0f; + } + + this->actor.shape.yOffset = Math_SinS(this->unk_2F2) * sp1C; + this->actor.shape.shadowScale = 30.0f - (Math_SinS(this->unk_2F2) * 5.0f); + this->unk_2F6 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; +} + +void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + EnGg2* this = THIS; + + if (INV_CONTENT(ITEM_MASK_GORON) == ITEM_MASK_GORON) { + Actor_MarkForDeath(&this->actor); + return; + } + + if (gSaveContext.weekEventReg[91] & 0x10) { + Actor_MarkForDeath(&this->actor); + return; + } + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); + this->actor.bgCheckFlags |= 0x400; + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, + this->morphTable, 20); + this->unk_1D8 = func_8013D648(globalCtx, ENGG2_GET_FC00(&this->actor), 0x3F); + this->actor.flags &= ~ACTOR_FLAG_80; + this->unk_2F0 = 0; + this->unk_2F1 = 0; + this->unk_2F2 = 0; + this->unk_2F4 = 0; + this->unk_2F6 = 0; + this->unk_2E4 = this->actor.cutscene; + this->unk_2EC = 20; + this->unk_2EA = 0; + + if (globalCtx->sceneNum == SCENE_11GORONNOSATO) { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + this->unk_2EE = 0; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->actionFunc = func_80B3AFB0; + } else if (globalCtx->sceneNum == SCENE_17SETUGEN) { + if ((gSaveContext.weekEventReg[20] & 4) && !(gSaveContext.weekEventReg[20] & 8) && + !(gSaveContext.weekEventReg[20] & 0x10)) { + gSaveContext.weekEventReg[20] &= (u8)~4; + this->unk_2EE = 8; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->actionFunc = func_80B3B05C; + } else { + Actor_MarkForDeath(&this->actor); + } + } else if (globalCtx->sceneNum == SCENE_10YUKIYAMANOMURA) { + if (!(gSaveContext.weekEventReg[20] & 4) && (gSaveContext.weekEventReg[20] & 8) && + !(gSaveContext.weekEventReg[20] & 0x10)) { + gSaveContext.weekEventReg[20] &= (u8)~8; + this->unk_2EE = 8; + Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); + this->actionFunc = func_80B3B05C; + } else { + Actor_MarkForDeath(&this->actor); + } + } else { + gSaveContext.weekEventReg[20] &= (u8)~4; + gSaveContext.weekEventReg[20] &= (u8)~8; + gSaveContext.weekEventReg[20] &= (u8)~0x10; + Actor_MarkForDeath(&this->actor); + } +} + +void EnGg2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void EnGg2_Update(Actor* thisx, GlobalContext* globalCtx) { + EnGg2* this = THIS; + + if (globalCtx->actorCtx.unk4 == 100) { + this->actor.flags |= ACTOR_FLAG_80; + 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_1; + } + + this->actionFunc(this, globalCtx); + + func_80B3AC50(this); + func_80B3AC94(this, globalCtx); + Actor_MoveWithoutGravity(&this->actor); + SkelAnime_Update(&this->skelAnime); + func_80B3B8A4(this); + func_800E9250(globalCtx, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos); + + if ((this->unk_2EE == 5) || (this->unk_2EE == 7)) { + func_800B9010(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG); + if ((globalCtx->actorCtx.unk4 == 100) && ((globalCtx->state.frames % 4) == 0)) { + func_80B3B4B0(this, globalCtx); + } + } + + func_80B3ADD8(this); +} + +s32 func_80B3BD44(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnGg2* this = THIS; + + if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) { + if (limbIndex == 1) { + Matrix_RotateY(this->unk_2F6, MTXMODE_APPLY); + } + + if (limbIndex == 2) { + Matrix_InsertZRotation_s(this->unk_2F4, MTXMODE_APPLY); + } + } + return false; +} + +void func_80B3BDC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + EnGg2* this = THIS; + + if (limbIndex == 4) { + Matrix_MultiplyVector3fByState(&D_80B3C0A0, &this->unk_304); + } +} + +void EnGg2_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnGg2* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80) || (this->unk_2F0 == 1)) { + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80B3C0AC[this->unk_2EA])); + + POLY_XLU_DISP = + SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, func_80B3BD44, func_80B3BDC0, &this->actor, POLY_XLU_DISP); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h index dc46842728..0fea448221 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h @@ -7,11 +7,32 @@ struct EnGg2; typedef void (*EnGg2ActionFunc)(struct EnGg2*, GlobalContext*); +#define ENGG2_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) + typedef struct EnGg2 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x90]; + /* 0x0144 */ UNK_TYPE1 unk144[0x4C]; + /* 0x0190 */ SkelAnime skelAnime; /* 0x01D4 */ EnGg2ActionFunc actionFunc; - /* 0x01D8 */ char unk_1D8[0x138]; + /* 0x01D8 */ Path* unk_1D8; + /* 0x01DC */ s32 unk_1DC; + /* 0x01E0 */ Vec3s unk_1E0; + /* 0x01E6 */ Vec3s unk_1E6; + /* 0x01EC */ Vec3s jointTable[20]; + /* 0x0264 */ Vec3s morphTable[20]; + /* 0x02DC */ UNK_TYPE1 unk2DC[0x8]; + /* 0x02E4 */ s16 unk_2E4; + /* 0x02E6 */ UNK_TYPE1 unk2E6[4]; + /* 0x02EA */ s16 unk_2EA; + /* 0x02EC */ s16 unk_2EC; + /* 0x02EE */ s16 unk_2EE; + /* 0x02F0 */ u8 unk_2F0; + /* 0x02F1 */ u8 unk_2F1; + /* 0x02F2 */ s16 unk_2F2; + /* 0x02F4 */ s16 unk_2F4; + /* 0x02F6 */ s16 unk_2F6; + /* 0x02F8 */ UNK_TYPE1 unk2F8[0xC]; + /* 0x0304 */ Vec3f unk_304; } EnGg2; // size = 0x310 extern const ActorInit En_Gg2_InitVars; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index dc063bd353..094de1c620 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -907,7 +907,7 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if ((actor != NULL) && (actor->update != NULL)) { if (this->unk_234 != NULL) { - sp48 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp48 = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp3C, &sp48[this->unk_234->count - 2]); Math_Vec3s_ToVec3f(&sp30, &sp48[this->unk_234->count - 1]); this->actor.shape.shadowDraw = NULL; @@ -938,7 +938,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if ((door != NULL) && (door->dyna.actor.update != NULL)) { if (this->unk_234 != NULL) { - sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp4C = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp40, &sp4C[0]); Math_Vec3s_ToVec3f(&sp34, &sp4C[1]); Math_Vec3f_Copy(&this->unk_278, &sp40); @@ -1080,7 +1080,7 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } if (this->unk_234 != NULL) { - sp48 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp48 = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp3C, &sp48[this->unk_234->count - 2]); Math_Vec3s_ToVec3f(&sp30, &sp48[this->unk_234->count - 1]); this->actor.shape.shadowDraw = NULL; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 771f0ab83a..00355cb457 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -301,7 +301,7 @@ void func_80A1143C(EnGoStruct ptr[], Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg void func_80A115B4(EnGoStruct ptr[], GlobalContext* globalCtx) { static TexturePtr D_80A16644[] = { - &gDust8Tex, &gDust7Tex, &gDust6Tex, &gDust5Tex, &gDust4Tex, &gDust3Tex, &gDust2Tex, &gDust1Tex, + gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; static Color_RGBA8 D_80A16664[] = { { 255, 255, 255, 0 }, @@ -1449,7 +1449,11 @@ void func_80A146CC(EnGo* this, GlobalContext* globalCtx) { } void func_80A14798(EnGo* this, GlobalContext* globalCtx) { - s32 sp38[2] = { 0x0000003E, 0x00000F64 }; + EffectTireMarkInit sp38 = { + 0, + 62, + { 0, 0, 15, 100 }, + }; if ((this->unk_288 < 0) || SubS_IsObjectLoaded(this->unk_288, globalCtx) || (this->unk_289 < 0) || SubS_IsObjectLoaded(this->unk_289, globalCtx)) { @@ -1464,7 +1468,7 @@ void func_80A14798(EnGo* this, GlobalContext* globalCtx) { Collider_InitAndSetSphere(globalCtx, &this->colliderSphere, &this->actor, &sSphereInit); Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - Effect_Add(globalCtx, &this->unk_3E8, 4, 0, 0, &sp38); + Effect_Add(globalCtx, &this->unk_3E8, EFFECT_TIRE_MARK, 0, 0, &sp38); this->actor.targetMode = 1; this->unk_3A4 = 0.01f; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 704167822f..610d85b8b8 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -992,7 +992,7 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 200; func_8093EB58(this, globalCtx); - this->unk_1D0 = (Vec3s*)Lib_SegmentedToVirtual(sp2C->points); + this->unk_1D0 = Lib_SegmentedToVirtual(sp2C->points); func_8093EE18(this, globalCtx); func_8093EE64(this, this->actor.home.rot.y); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 9f4bdb7285..7dc4e69682 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -262,7 +262,7 @@ void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { } void func_80997FF0(EnGs* this, GlobalContext* globalCtx) { - if (SubS_StartActorCutscene(&this->actor, globalCtx->unk_1879C[0], -1, SUBS_CUTSCENE_NORMAL)) { + if (SubS_StartActorCutscene(&this->actor, globalCtx->playerActorCsIds[0], -1, SUBS_CUTSCENE_NORMAL)) { func_80998040(this, globalCtx); } } @@ -339,7 +339,7 @@ void func_8099807C(EnGs* this, GlobalContext* globalCtx) { void func_80998300(EnGs* this, GlobalContext* globalCtx) { if (this->actor.cutscene != -1) { - ActorCutscene_Stop(globalCtx->unk_1879C[0]); + ActorCutscene_Stop(globalCtx->playerActorCsIds[0]); } } @@ -1025,8 +1025,8 @@ void EnGs_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.flags & ACTOR_FLAG_40) || (this->unk_19A & 0x100) || (this->unk_19A & 0x200)) { func_80999BC8(&this->actor, globalCtx); Actor_GetScreenPos(globalCtx, &this->actor, &sp2E, &sp2C); - if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > 320) || (sp2C < 0) || - (sp2C > 240)) { + if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || + (sp2C > SCREEN_HEIGHT)) { this->unk_216 = 0; } else if (this->unk_21C > 0) { func_800BC848(&this->actor, globalCtx, this->unk_21C, this->unk_21E); diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index c05a06a569..14bbf6a995 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -5,6 +5,7 @@ */ #include "z_en_heishi.h" +#include "objects/object_sdn/object_sdn.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,9 +16,19 @@ void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx); void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80BE9214(EnHeishi* this, GlobalContext* globalCtx); +void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex); +void EnHeishi_SetHeadRotation(EnHeishi* this); +void EnHeishi_SetupIdle(EnHeishi* this); +void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx); + +typedef enum { + /* 0 */ HEISHI_ANIMATION_STAND_HAND_ON_HIP, + /* 1 */ HEISHI_ANIMATION_CHEER_WITH_SPEAR, + /* 2 */ HEISHI_ANIMATION_WAVE, + /* 3 */ HEISHI_ANIMATION_SIT_AND_REACH, + /* 4 */ HEISHI_ANIMATION_STAND_UP +} EnHeishiAnimationIndex; -#if 0 const ActorInit En_Heishi_InitVars = { ACTOR_EN_HEISHI, ACTORCAT_NPC, @@ -30,33 +41,151 @@ const ActorInit En_Heishi_InitVars = { (ActorFunc)EnHeishi_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BE9450 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, 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_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 20, 60, 0, { 0, 0, 0 } }, }; -#endif +void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx) { + EnHeishi* this = THIS; -extern ColliderCylinderInit D_80BE9450; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, + this->morphTable, HEISHI_LIMB_MAX); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->paramsCopy = this->actor.params; + this->yawTowardsPlayer = this->actor.world.rot.y; -extern UNK_TYPE D_06003BFC; + if (this->paramsCopy == 0) { + this->shouldSetHeadRotation = 1; + if (!(gSaveContext.weekEventReg[63] & 0x80) && !((gSaveContext.day == 3) && gSaveContext.isNight)) { + Actor_MarkForDeath(&this->actor); + } + } else { + this->colliderCylinder.dim.radius = 30; + this->colliderCylinder.dim.height = 60; + this->colliderCylinder.dim.yShift = 0; + if ((gSaveContext.weekEventReg[63] & 0x80) || ((gSaveContext.day == 3) && gSaveContext.isNight)) { + Actor_MarkForDeath(&this->actor); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Init.s") + this->actor.targetMode = 6; + this->actor.gravity = -3.0f; + Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit); + this->actor.flags |= ACTOR_FLAG_8000000; + EnHeishi_SetupIdle(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Destroy.s") +void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnHeishi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE90BC.s") + Collider_DestroyCylinder(globalCtx, &this->colliderCylinder); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE9148.s") +void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex) { + static AnimationHeader* sAnimations[] = { + &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, + }; + static u8 sAnimModes[] = { + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, + }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE91DC.s") + this->animIndex = animIndex; + this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + sAnimModes[this->animIndex], -10.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE9214.s") +void EnHeishi_SetHeadRotation(EnHeishi* this) { + s16 yawDiff = this->yawTowardsPlayer - this->actor.world.rot.y; + s32 absYawDiff = ABS_ALT(yawDiff); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Update.s") + this->headRotXTarget = 0; + if ((this->actor.xzDistToPlayer < 200.0f) && (absYawDiff < 0x4E20)) { + this->headRotXTarget = this->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_Heishi/func_80BE9380.s") +void EnHeishi_SetupIdle(EnHeishi* this) { + s8 animIndex = HEISHI_ANIMATION_STAND_HAND_ON_HIP; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Draw.s") + EnHeishi_ChangeAnimation(this, animIndex); + this->unk278 = animIndex; + this->actionFunc = EnHeishi_Idle; +} + +void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx) { +} + +void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnHeishi* this = THIS; + + SkelAnime_Update(&this->skelAnime); + if (this->timer != 0) { + this->timer--; + } + + this->actor.shape.rot.y = this->actor.world.rot.y; + if ((this->paramsCopy != 0) && (gSaveContext.day == 3) && gSaveContext.isNight) { + Actor_MarkForDeath(&this->actor); + } else { + this->actionFunc(this, globalCtx); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 29); + Actor_SetScale(&this->actor, 0.01f); + if (this->shouldSetHeadRotation) { + EnHeishi_SetHeadRotation(this); + } + + Actor_SetFocus(&this->actor, 60.0f); + Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 3000, 0); + Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 1000, 0); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); + } +} + +s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnHeishi* this = THIS; + + if (limbIndex == HEISHI_LIMB_HEAD) { + rot->x += this->headRotX; + rot->y += this->headRotY; + rot->z += this->headRotZ; + } + + return false; +} + +void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnHeishi* this = THIS; + + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnHeishi_OverrideLimbDraw, NULL, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h index 8ceb74a007..de65bac725 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h @@ -7,13 +7,48 @@ struct EnHeishi; typedef void (*EnHeishiActionFunc)(struct EnHeishi*, GlobalContext*); +typedef enum { + /* 0 */ HEISHI_LIMB_NONE, + /* 1 */ HEISHI_LIMB_ROOT, + /* 2 */ HEISHI_LIMB_PELVIS, + /* 3 */ HEISHI_LIMB_LEFT_THIGH, + /* 4 */ HEISHI_LIMB_LEFT_CALF, + /* 5 */ HEISHI_LIMB_LEFT_FOOT, + /* 6 */ HEISHI_LIMB_RIGHT_THIGH, + /* 7 */ HEISHI_LIMB_RIGHT_CALF, + /* 8 */ HEISHI_LIMB_RIGHT_FOOT, + /* 9 */ HEISHI_LIMB_TORSO, + /* 10 */ HEISHI_LIMB_LEFT_SHOULDER, + /* 11 */ HEISHI_LIMB_LEFT_FOREARM, + /* 12 */ HEISHI_LIMB_LEFT_HAND, + /* 13 */ HEISHI_LIMB_RIGHT_SHOULDER, + /* 14 */ HEISHI_LIMB_RIGHT_FOREARM, + /* 15 */ HEISHI_LIMB_RIGHT_HAND_WITH_SPEAR, + /* 16 */ HEISHI_LIMB_HEAD, + /* 17 */ HEISHI_LIMB_MAX +} EnHeishiLimbs; + typedef struct EnHeishi { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x110]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[HEISHI_LIMB_MAX]; + /* 0x01EE */ Vec3s morphTable[HEISHI_LIMB_MAX]; /* 0x0254 */ EnHeishiActionFunc actionFunc; - /* 0x0258 */ char unk_258[0x78]; + /* 0x0258 */ s16 headRotY; + /* 0x025A */ s16 headRotX; + /* 0x025C */ s16 headRotZ; + /* 0x025E */ s16 headRotYTarget; + /* 0x0260 */ s16 headRotXTarget; + /* 0x0262 */ s16 headRotZTarget; + /* 0x0264 */ s32 animIndex; + /* 0x0268 */ s32 paramsCopy; + /* 0x026C */ s32 shouldSetHeadRotation; + /* 0x0270 */ s16 timer; + /* 0x0272 */ s16 yawTowardsPlayer; + /* 0x0274 */ f32 frameCount; + /* 0x0278 */ s16 unk278; // set and not used + /* 0x027C */ UNK_TYPE1 unk_27C[0x8]; + /* 0x0284 */ ColliderCylinder colliderCylinder; } EnHeishi; // size = 0x2D0 -extern const ActorInit En_Heishi_InitVars; - #endif // Z_EN_HEISHI_H diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index e84a18bef8..5a1ec5a182 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -1208,7 +1208,6 @@ s32 func_808F5674(GlobalContext* globalCtx, EnIn* this, s32 arg2) { s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { s16 rotDiff; s16 yawDiff; - s16 yawDiffA; Player* player; if (*arg3 == 4) { @@ -1253,9 +1252,8 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { if (!func_800B8934(globalCtx, &this->actor)) { return 0; } - yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - yawDiffA = ABS_ALT(yawDiff); - if (yawDiffA >= 0x4300) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); + if (yawDiff >= 0x4300) { return 0; } if (this->actor.xyzDistToPlayerSq > SQ(160.0f) && !this->actor.isTargeted) { diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index 340c186ef9..b31436bb46 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -514,7 +514,7 @@ void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } } -void EnJa_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnJa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { EnJa* this = THIS; s32 phi_v1; s32 phi_v0; @@ -602,7 +602,7 @@ void EnJa_Draw(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnJa_OverrideLimbDraw, EnJa_PostLimbDraw, - EnJa_TransformDraw, &this->actor); + EnJa_TransformLimbDraw, &this->actor); CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index f1d1737e45..d7e113cb31 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -46,9 +46,6 @@ void EnKakasi_SetupSongTeach(EnKakasi* this, GlobalContext* globalCtx); void EnKakasi_SetupDialogue(EnKakasi* this); -void EnKakasi_PostLimbDraw(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, - struct Actor* thisx); - static ColliderCylinderInit D_80971D80 = { { COLTYPE_NONE, @@ -336,8 +333,8 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { u32 saveContextDay = gSaveContext.day; - s16 passedValue1; - s16 passedValue2; + s16 x; + s16 y; // first talk to scarecrow dialogue this->actor.textId = 0x1644; @@ -352,9 +349,9 @@ void EnKakasi_IdleStanding(EnKakasi* this, GlobalContext* globalCtx) { return; } if (globalCtx->actorCtx.unk5 & 0x4) { - Actor_GetScreenPos(globalCtx, &this->actor, &passedValue1, &passedValue2); - if (this->actor.projectedPos.z > -20.0f && passedValue1 > 0 && passedValue1 < 0x140 && passedValue2 > 0 && - passedValue2 < 0xF0 && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { + Actor_GetScreenPos(globalCtx, &this->actor, &x, &y); + if (this->actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && + this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { // faster shaking EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; @@ -934,9 +931,9 @@ void EnKakasi_DancingNightAway(EnKakasi* this, GlobalContext* globalCtx) { if (this->unk204 == 0) { player = GET_PLAYER(globalCtx); - func_80169DCC(globalCtx, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, &player->unk_3C0, - player->unk_3CC); - func_80169EFC(globalCtx); + Play_SetRespawnData(&globalCtx->state, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, + &player->unk_3C0, player->unk_3CC); + func_80169EFC(&globalCtx->state); if (0) {} if (gSaveContext.time > CLOCK_TIME(18, 0) || gSaveContext.time < CLOCK_TIME(6, 0)) { diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 8ff09e32b3..fd676186ef 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -5,6 +5,7 @@ */ #include "z_en_mm3.h" +#include "objects/object_mm/object_mm.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -15,7 +16,19 @@ void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx); void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80A6F270(EnMm3* this); +void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx); +void func_80A6F9C8(EnMm3* this); +void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FBA0(EnMm3* this); +void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FE1C(EnMm3* this); +void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FED8(EnMm3* this); +void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx); +s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx); +void func_80A70084(EnMm3* this, GlobalContext* globalCtx); + const ActorInit En_Mm3_InitVars = { ACTOR_EN_MM3, ACTORCAT_NPC, @@ -28,61 +41,532 @@ const ActorInit En_Mm3_InitVars = { (ActorFunc)EnMm3_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A703F0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +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 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 63, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80A7041C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -#endif +static AnimationInfo sAnimations[] = { + { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, 2, -7.0f }, + { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, 2, -7.0f }, + { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, 0, -12.0f }, + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, 0, -12.0f }, { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, 2, -10.0f }, +}; -extern ColliderCylinderInit D_80A703F0; -extern CollisionCheckInfoInit2 D_80A7041C; +#include "overlays/ovl_En_Mm3/ovl_En_Mm3.c" -extern UNK_TYPE D_0600A4E0; +Vec3f D_80A704F0 = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Init.s") +TexturePtr D_80A704FC[] = { object_mm_Tex_002950, object_mm_Tex_002750 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Destroy.s") +void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMm3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F22C.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, + this->morphTable, 16); + Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0), + 0.0f, 2, 0.0f); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actor.parent = NULL; + this->actor.targetMode = 0; + this->unk_1DC = 1; + this->unk_2B4 = 0; + this->unk_2AE = 0; + this->unk_2B0 &= ~1; + this->actor.world.pos.y = this->actor.floorHeight; + func_80A6F270(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F270.s") +void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnMm3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F2C8.s") + gSaveContext.weekEventReg[63] &= (u8)~1; + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F3B4.s") +s32 func_80A6F22C(EnMm3* this) { + s16 abs = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F5E4.s") + abs = ABS_ALT(abs); + if (abs < 0x4000) { + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F9C8.s") +void func_80A6F270(EnMm3* this) { + this->unk_1DC = 1; + this->unk_2B0 &= ~1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + this->actionFunc = func_80A6F2C8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F9DC.s") +void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + Message_StartTextbox(globalCtx, 0x278A, &this->actor); + this->unk_2B4 = 0x278A; + func_80A6F9C8(this); + } else if (func_80A6F22C(this)) { + func_800B8614(&this->actor, globalCtx, 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FBA0.s") + Math_SmoothStepToS(&this->unk_2A0.x, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A0.y, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A6.x, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A6.y, 0, 5, 0x1000, 0x100); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FBFC.s") +void func_80A6F3B4(EnMm3* this, GlobalContext* globalCtx) { + if (func_80147624(globalCtx)) { + switch (this->unk_2B4) { + case 0x278E: + if (globalCtx->msgCtx.choiceIndex == 0) { + if (this->unk_2B2 & 0x20) { + if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + func_801159EC(-globalCtx->msgCtx.unk1206C); + } else { + play_sound(NA_SE_SY_ERROR); + Message_StartTextbox(globalCtx, 0x279C, &this->actor); + this->unk_2B4 = 0x279C; + func_80151BB4(globalCtx, 0xB); + } + } else { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + } + } else { + func_8019F230(); + Message_StartTextbox(globalCtx, 0x278F, &this->actor); + this->unk_2B4 = 0x278F; + func_80151BB4(globalCtx, 0xB); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FE1C.s") + case 0x279A: + if (globalCtx->msgCtx.choiceIndex == 0) { + if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + func_801159EC(-globalCtx->msgCtx.unk1206C); + } else { + play_sound(NA_SE_SY_ERROR); + Message_StartTextbox(globalCtx, 0x279C, &this->actor); + this->unk_2B4 = 0x279C; + func_80151BB4(globalCtx, 0xB); + } + } else { + func_8019F230(); + Message_StartTextbox(globalCtx, 0x279B, &this->actor); + this->unk_2B4 = 0x279B; + func_80151BB4(globalCtx, 0xB); + } + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FE30.s") +void func_80A6F5E4(EnMm3* this, GlobalContext* globalCtx) { + if (((this->unk_2B4 != 0x2791) || (this->unk_2AC == 0)) && func_80147624(globalCtx)) { + switch (this->unk_2B4) { + case 0x278A: + if (func_80A6FFAC(this, globalCtx)) { + Message_StartTextbox(globalCtx, 0x279D, &this->actor); + this->unk_2B4 = 0x279D; + } else { + func_80A70084(this, globalCtx); + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + Message_StartTextbox(globalCtx, 0x27A0, &this->actor); + this->unk_2B4 = 0x27A0; + } else { + Message_StartTextbox(globalCtx, 0x278B, &this->actor); + this->unk_2B4 = 0x278B; + } + } + this->unk_1DC = 0; + this->unk_2B0 |= 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FED8.s") + case 0x278B: + case 0x27A0: + this->unk_2AE = 0; + Message_StartTextbox(globalCtx, 0x278C, &this->actor); + this->unk_2B4 = 0x278C; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FEEC.s") + case 0x278C: + Message_StartTextbox(globalCtx, 0x278D, &this->actor); + this->unk_2B4 = 0x278D; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FFAC.s") + case 0x279D: + this->unk_2AE = 0; + Message_StartTextbox(globalCtx, 0x279E, &this->actor); + this->unk_2B4 = 0x279E; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A70084.s") + case 0x279E: + this->unk_2B2 |= 0x20; + Message_StartTextbox(globalCtx, 0x279F, &this->actor); + this->unk_2B4 = 0x279F; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Update.s") + case 0x278D: + case 0x279F: + Message_StartTextbox(globalCtx, 0x278E, &this->actor); + this->unk_2B4 = 0x278E; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A701E0.s") + case 0x2791: + if (gSaveContext.unk_3DE0[0] == 1000) { + Message_StartTextbox(globalCtx, 0x2792, &this->actor); + this->unk_2B4 = 0x2792; + } else if ((gSaveContext.unk_3DE0[0] >= 1500)) { + Message_StartTextbox(globalCtx, 0x2797, &this->actor); + this->unk_2B4 = 0x2797; + } else if ((gSaveContext.unk_3DE0[0] <= 1050) && (gSaveContext.unk_3DE0[0] >= 950)) { + Message_StartTextbox(globalCtx, 0x2795, &this->actor); + this->unk_2B4 = 0x2795; + } else { + Message_StartTextbox(globalCtx, 0x2796, &this->actor); + this->unk_2B4 = 0x2796; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A702B0.s") + case 0x2792: + Message_StartTextbox(globalCtx, 0x2793, &this->actor); + this->unk_2B4 = 0x2793; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Draw.s") + case 0x2793: + func_801477B4(globalCtx); + func_80A6FE1C(this); + func_80A6FE30(this, globalCtx); + break; + + case 0x2795: + case 0x2796: + case 0x2797: + if (gSaveContext.weekEventReg[63] & 2) { + Message_StartTextbox(globalCtx, 0x279B, &this->actor); + this->unk_2B4 = 0x279B; + func_80151BB4(globalCtx, 0xB); + } else { + Message_StartTextbox(globalCtx, 0x2798, &this->actor); + this->unk_2B4 = 0x2798; + } + break; + + case 0x2798: + Message_StartTextbox(globalCtx, 0x2799, &this->actor); + this->unk_2B4 = 0x2799; + break; + + case 0x2799: + Message_StartTextbox(globalCtx, 0x279A, &this->actor); + this->unk_2B4 = 0x279A; + break; + } + } else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) { + this->unk_2AC--; + if (this->unk_2AC == 0) { + if (gSaveContext.unk_3DE0[0] == 1000) { + func_801A3098(0x922); + } else { + play_sound(NA_SE_SY_ERROR); + } + } + } +} + +void func_80A6F9C8(EnMm3* this) { + this->actionFunc = func_80A6F9DC; +} + +void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { + this->unk_2B0 &= ~2; + + switch (Message_GetState(&globalCtx->msgCtx)) { + case 0: + case 1: + case 2: + break; + + case 3: + this->unk_2B0 |= 2; + break; + + case 4: + func_80A6F3B4(this, globalCtx); + break; + + case 5: + func_80A6F5E4(this, globalCtx); + break; + + case 6: + if (func_80147624(globalCtx)) { + if (this->unk_2B4 == 0x2790) { + Player* player = GET_PLAYER(globalCtx); + + player->stateFlags1 |= 0x20; + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + func_8010EA9C(0, 2); + } else { + func_8010EA9C(0, 0); + } + func_801477B4(globalCtx); + play_sound(NA_SE_SY_START_SHOT); + func_80A6FBA0(this); + } else { + gSaveContext.weekEventReg[63] &= (u8)~1; + gSaveContext.weekEventReg[63] &= (u8)~2; + func_80A6F270(this); + } + } + break; + } + + if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + } + + if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && + Animation_OnFrame(&this->skelAnime, 8.0f) && (this->unk_2AE == 0)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LIE_DOWN_ON_BED); + this->unk_2AE = 1; + } +} + +void func_80A6FBA0(EnMm3* this) { + func_801A5BD0(0x6F); + func_801A0238(0, 5); + gSaveContext.weekEventReg[63] |= 1; + gSaveContext.weekEventReg[63] &= (u8)~2; + this->actionFunc = func_80A6FBFC; +} + +void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + OSTime a; + OSTime b; + + if (gSaveContext.unk_3DD0[0] == 0x10) { + player->stateFlags1 &= ~0x20; + this->actor.flags |= ACTOR_FLAG_10000; + if (gSaveContext.unk_3DE0[0] >= 0x5DD) { + gSaveContext.unk_3DE0[0] = 0x5DC; + } else { + a = gSaveContext.unk_3DE0[0]; + if (a >= (OSTime)(995 - XREG(16))) { + b = gSaveContext.unk_3DE0[0]; + if ((OSTime)(XREG(17) + 1005) >= b) { + gSaveContext.unk_3DE0[0] = 1000; + } + } + } + } else if (gSaveContext.unk_3DE0[0] >= 0x5DD) { + gSaveContext.unk_3DD0[0] = 15; + gSaveContext.unk_3DC8 = osGetTime(); + } + + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + func_801A5BD0(0); + func_801A0238(0x7F, 5); + Message_StartTextbox(globalCtx, 0x2791, &this->actor); + this->unk_2B4 = 0x2791; + this->unk_2AC = 7; + gSaveContext.unk_3DD0[0] = 0; + this->actor.flags &= ~ACTOR_FLAG_10000; + play_sound(NA_SE_SY_START_SHOT); + func_80A6F9C8(this); + } else { + func_800B8614(&this->actor, globalCtx, this->actor.xzDistToPlayer + 10.0f); + func_80123E90(globalCtx, &this->actor); + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + play_sound(NA_SE_SY_STOPWATCH_TIMER_INF - SFX_FLAG); + } else { + play_sound(NA_SE_SY_STOPWATCH_TIMER_3 - SFX_FLAG); + } + } +} + +void func_80A6FE1C(EnMm3* this) { + this->actionFunc = func_80A6FE30; +} + +void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + if (!(gSaveContext.weekEventReg[77] & 1)) { + gSaveContext.weekEventReg[77] |= 1; + } + this->actor.parent = NULL; + func_80A6FED8(this); + } else if (gSaveContext.weekEventReg[77] & 1) { + Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + } else { + Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + } +} + +void func_80A6FED8(EnMm3* this) { + this->actionFunc = func_80A6FEEC; +} + +void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + player->stateFlags1 &= ~0x20; + Message_StartTextbox(globalCtx, 0x2794, &this->actor); + this->unk_2B4 = 0x2794; + func_80151BB4(globalCtx, 0xB); + func_80151BB4(globalCtx, 0x2B); + this->actor.flags &= ~ACTOR_FLAG_10000; + func_80A6F9C8(this); + } else { + func_800B85E0(&this->actor, globalCtx, 200.0f, -1); + } +} + +s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { + switch (gSaveContext.playerForm) { + case 4: + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + if (this->unk_2B2 & 0x10) { + return true; + } + } else if (this->unk_2B2 & 1) { + return true; + } + break; + + case 3: + if (this->unk_2B2 & 2) { + return true; + } + break; + + case 2: + if (this->unk_2B2 & 4) { + return true; + } + break; + + case 1: + if (this->unk_2B2 & 8) { + return true; + } + break; + } + + return false; +} + +void func_80A70084(EnMm3* this, GlobalContext* globalCtx) { + switch (gSaveContext.playerForm) { + case 4: + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + this->unk_2B2 |= 0x10; + this->unk_2B2 |= 1; + } else { + this->unk_2B2 |= 1; + } + break; + + case 3: + this->unk_2B2 |= 2; + break; + + case 2: + this->unk_2B2 |= 4; + break; + + case 1: + this->unk_2B2 |= 8; + break; + } +} + +void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMm3* this = THIS; + + this->actionFunc(this, globalCtx); + + SkelAnime_Update(&this->skelAnime); + + if (this->unk_2B0 & 1) { + func_800E9250(globalCtx, &this->actor, &this->unk_2A0, &this->unk_2A6, this->actor.focus.pos); + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} + +s32 EnMm3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnMm3* this = THIS; + + if (limbIndex == 8) { + rot->x += this->unk_2A6.y; + rot->y -= this->unk_2A6.x; + } else if (limbIndex == 15) { + rot->x += this->unk_2A0.y; + rot->z += this->unk_2A0.x; + if ((this->unk_2B0 & 2) && ((globalCtx->gameplayFrames % 3) == 0)) { + Matrix_InsertTranslation(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + } + return false; +} + +void EnMm3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnMm3* this = THIS; + + if (limbIndex == 15) { + Matrix_MultiplyVector3fByState(&D_80A704F0, &this->actor.focus.pos); + } +} + +void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnMm3* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A704FC[this->unk_1DC])); + gSPSegment(POLY_OPA_DISP++, 0x0C, sEnMm3DL); + + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnMm3_OverrideLimbDraw, EnMm3_PostLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h index b3a8c28938..fe2e7ba06e 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h @@ -9,9 +9,20 @@ typedef void (*EnMm3ActionFunc)(struct EnMm3*, GlobalContext*); typedef struct EnMm3 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x90]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ ColliderCylinder collider; /* 0x01D4 */ EnMm3ActionFunc actionFunc; - /* 0x01D8 */ char unk_1D8[0xE0]; + /* 0x01D8 */ UNK_TYPE1 unk1D8[4]; + /* 0x01DC */ s32 unk_1DC; + /* 0x01E0 */ Vec3s jointTable[16]; + /* 0x0240 */ Vec3s morphTable[16]; + /* 0x02A0 */ Vec3s unk_2A0; + /* 0x02A6 */ Vec3s unk_2A6; + /* 0x02AC */ s16 unk_2AC; + /* 0x02AE */ s16 unk_2AE; + /* 0x02B0 */ u16 unk_2B0; + /* 0x02B2 */ u16 unk_2B2; + /* 0x02B4 */ u16 unk_2B4; } EnMm3; // size = 0x2B8 extern const ActorInit En_Mm3_InitVars; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 8ce5507737..c87e30329f 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -58,7 +58,7 @@ void func_8096B104(EnOkarinaEffect* this, GlobalContext* globalCtx) { void func_8096B174(EnOkarinaEffect* this, GlobalContext* globalCtx) { DECR(this->unk144); if (!globalCtx->pauseCtx.state && !globalCtx->gameOverCtx.state && !globalCtx->msgCtx.unk11F10 && - !FrameAdvance_IsEnabled(globalCtx) && this->unk144 == 0) { + !FrameAdvance_IsEnabled(&globalCtx->state) && this->unk144 == 0) { EnOkarinaEffect_SetupAction(this, func_8096B1FC); } } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index f7f41a2c13..6eb555ef15 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -1038,7 +1038,7 @@ void EnOt_Draw(Actor* thisx, GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); - AnimatedMat_Draw(globalCtx, (AnimatedMaterial*)Lib_SegmentedToVirtual(object_ot_Matanimheader_0005F8)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(object_ot_Matanimheader_0005F8)); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnOt_PostLimbDraw, &this->actor); Matrix_InsertTranslation(this->unk_378.x, this->unk_378.y, this->unk_378.z, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index ceacff185d..f7eb614906 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -408,7 +408,7 @@ s32 func_8095B06C(EnOwl* this) { void func_8095B0C8(EnOwl* this) { s32 pad; - Vec3s* points = (Vec3s*)Lib_SegmentedToVirtual(this->path->points); + Vec3s* points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_3F8; this->unk_3EC = Math_FAtan2F(points->z - this->actor.world.pos.z, points->x - this->actor.world.pos.x); @@ -542,7 +542,7 @@ void func_8095B76C(EnOwl* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; if (sp44 < SQ(this->actor.speedXZ)) { this->actor.speedXZ = 0.0f; - points = (Vec3s*)Lib_SegmentedToVirtual(this->path->points); + points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_3F8; do { diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 4f6f5ceb38..f6da4cba28 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -797,8 +797,8 @@ void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx2) { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderTris.base); for (i = 1; i >= 0; i--) { - if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &sp70, 1, - 1, 0, 1, &sp6C)) { + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &sp70, + true, true, false, true, &sp6C)) { func_800BBFB0(globalCtx, &sp74, 0.0f, 1, 300, 150, 1); func_80897258(globalCtx, this, &sp74, 0.0f, 1.5f); } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 10648fa3f7..7792e578f4 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -919,7 +919,7 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if ((sp2C != NULL) && (sp2C->update != NULL)) { if (this->unk_234 != NULL) { - sp48 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp48 = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp3C, &sp48[this->unk_234->count - 2]); Math_Vec3s_ToVec3f(&sp30, &sp48[this->unk_234->count - 1]); this->actor.shape.shadowDraw = NULL; @@ -950,7 +950,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if ((door != NULL) && (door->dyna.actor.update != NULL)) { if (this->unk_234 != 0) { - sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp4C = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp40, &sp4C[0]); Math_Vec3s_ToVec3f(&sp34, &sp4C[1]); Math_Vec3f_Copy(&this->unk_26C, &sp40); @@ -1074,7 +1074,7 @@ s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } if ((this->unk_234 != 0) && (this->unk_234->count >= 2)) { - sp30 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp30 = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp40, &sp30[0]); Math_Vec3s_ToVec3f(&sp34, &sp30[1]); this->actor.world.rot.y = Math_Vec3f_Yaw(&sp40, &sp34); @@ -1127,7 +1127,7 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } if ((this->unk_234 != 0) && (this->unk_234->count >= 2)) { - sp30 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points); + sp30 = Lib_SegmentedToVirtual(this->unk_234->points); Math_Vec3s_ToVec3f(&sp40, &sp30[this->unk_234->count - 1]); Math_Vec3s_ToVec3f(&sp34, &sp30[this->unk_234->count - 2]); this->actor.world.rot.y = Math_Vec3f_Yaw(&sp34, &sp40); 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 52223aaae7..d6c9d70655 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 @@ -147,7 +147,7 @@ void EnPoFusen_Destroy(Actor* thisx, GlobalContext* globalCtx) { } u16 EnPoFusen_CheckParent(EnPoFusen* this, GlobalContext* globalCtx) { - struct Actor* actorPtr; + Actor* actorPtr; actorPtr = globalCtx->actorCtx.actorLists[ACTORCAT_NPC].first; if (GET_IS_FUSE_TYPE_PARAM(this)) { diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index f89204a151..2a86294dc6 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -5,6 +5,8 @@ */ #include "z_en_prz.h" +#include "objects/object_pr/object_pr.h" +#include "overlays/actors/ovl_En_Pr/z_en_pr.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) @@ -15,9 +17,15 @@ void EnPrz_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx); void EnPrz_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_80A771C0 = { +void func_80A76388(EnPrz* this); +void func_80A763E8(EnPrz* this, GlobalContext* globalCtx); +void func_80A76604(EnPrz* this, GlobalContext* globalCtx); +void func_80A76634(EnPrz* this, GlobalContext* globalCtx); +void func_80A76748(EnPrz* this); +void func_80A767A8(EnPrz* this, GlobalContext* globalCtx); +void func_80A76B14(EnPrz* this, GlobalContext* globalCtx); + +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -52,10 +60,25 @@ static DamageTable D_80A771C0 = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A771F4 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK4, { 0x20000000, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +f32 D_80A771E0[] = { 40.0f, 40.0f, 40.0f, 30.0f, 30.0f }; + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK4, + { 0x20000000, 0x00, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 10, 10, 0, { 0, 0, 0 } }, }; @@ -71,45 +94,436 @@ const ActorInit En_Prz_InitVars = { (ActorFunc)EnPrz_Draw, }; -#endif +AnimationHeader* D_80A77240[] = { &object_pr_Anim_004340, &object_pr_Anim_004274 }; -extern DamageTable D_80A771C0; -extern ColliderCylinderInit D_80A771F4; +u8 D_80A77248[] = { 0, 0 }; -extern UNK_TYPE D_06004340; +Vec3f D_80A7724C = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/EnPrz_Init.s") +void EnPrz_Init(Actor* thisx, GlobalContext* globalCtx) { + EnPrz* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/EnPrz_Destroy.s") + this->unk_20C = 0.01f; + this->unk_1E4 = this->actor.world.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A75F18.s") + Actor_SetScale(&this->actor, 0.01f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A75FA4.s") + this->actor.targetMode = 3; + this->unk_1E8 = 255; + this->actor.hintId = 0x5B; + this->actor.colChkInfo.damageTable = &sDamageTable; + this->actor.colChkInfo.health = 1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76070.s") + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, + this->morphTable, 5); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A762C0.s") + this->unk_1E6 = ENPRZ_GET(&this->actor); + this->actor.shape.yOffset = 500.0f; + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76388.s") + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + Math_Vec3f_Copy(&this->unk_1D8, &this->actor.world.pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A763E8.s") + this->unk_220 = &this->actor; + this->unk_1EC = 255; + this->unk_202 = randPlusMinusPoint5Scaled((this->unk_1E6 * 100.0f) + 1000.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76604.s") + func_80A76388(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76634.s") +void EnPrz_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76748.s") +void func_80A75F18(EnPrz* this, s32 arg1) { + this->unk_204 = arg1; + Animation_Change(&this->skelAnime, D_80A77240[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A77240[arg1]), + D_80A77248[arg1], -2.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A767A8.s") +s32 func_80A75FA4(EnPrz* this, GlobalContext* globalCtx) { + WaterBox* sp2C; + f32 temp_f0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76A1C.s") + if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &this->unk_210, &sp2C)) { + temp_f0 = BREG(10) + (this->unk_210 - 10.0f); + if (temp_f0 < this->actor.world.pos.y) { + this->unk_1D8.y = temp_f0; + return 1; + } + } else { + temp_f0 = this->actor.floorHeight + 35.0f; + if (this->actor.world.pos.y < temp_f0) { + this->unk_1D8.y = temp_f0; + return 2; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76B14.s") + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/EnPrz_Update.s") +void func_80A76070(EnPrz* this, s16 arg1, GlobalContext* globalCtx) { + s16 temp_s0 = arg1 - this->actor.world.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76F70.s") + temp_s0 *= 0.01f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/func_80A76FCC.s") + if (temp_s0 > 100) { + temp_s0 = 100; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Prz/EnPrz_Draw.s") + if (temp_s0 < -100) { + temp_s0 = -100; + } + + if (fabsf(this->actor.world.rot.y - (f32)arg1) < (randPlusMinusPoint5Scaled(20.0f) + 100.0f)) { + Math_ApproachZeroF(&this->unk_218, 0.5f, 20.0f); + } else { + Math_ApproachF(&this->unk_218, temp_s0, 0.5f, 5.0f); + } + + temp_s0 = fabsf(this->unk_218) * 0.1f; + if (temp_s0 < 2) { + temp_s0 = 2; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, arg1, temp_s0, this->unk_202 + 0x1388, 0); + func_80A75FA4(this, globalCtx); + Math_ApproachF(&this->actor.world.pos.y, this->unk_1D8.y, 0.5f, 1.0f); + temp_s0 = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk_1D8) * 0.5f; + + if (fabsf(this->actor.world.pos.y - this->unk_208) > 4.0f) { + Math_SmoothStepToS(&this->actor.world.rot.x, temp_s0, 1, BREG(48) + 0x1F4, 0); + } else { + Math_SmoothStepToS(&this->actor.world.rot.x, 0, 1, BREG(52) + 0xBB8, 0); + } +} + +s32 func_80A762C0(EnPrz* this, GlobalContext* globalCtx) { + CollisionPoly* sp54; + Vec3f sp48; + s32 sp44; + Vec3f sp38; + + Math_Vec3f_Copy(&sp38, &this->actor.world.pos); + + sp38.x += Math_SinS(this->actor.world.rot.y) * 40.0f; + sp38.z += Math_CosS(this->actor.world.rot.y) * 40.0f; + + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp38, &sp48, &sp54, true, false, false, + true, &sp44)) { + return true; + } + return false; +} + +void func_80A76388(EnPrz* this) { + this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + func_80A75F18(this, 0); + this->unk_1EA = 1; + this->actionFunc = func_80A763E8; +} + +void func_80A763E8(EnPrz* this, GlobalContext* globalCtx) { + Actor* sp3C = this->actor.parent; + Player* player = GET_PLAYER(globalCtx); + s16 yaw; + s32 pad; + + if (&this->actor == this->unk_220) { + return; + } + + if ((player->stateFlags1 & 0x8000000) && (this->unk_1F2 == 0)) { + func_80A76748(this); + return; + } + + if (func_80A762C0(this, globalCtx)) { + func_80A76604(this, globalCtx); + return; + } + + if ((this->unk_220 != NULL) && (this->unk_220->update == NULL)) { + this->unk_220 = this->actor.parent; + } + + if ((this->unk_1EE == 0) && (this->unk_1F2 == 0)) { + s16 rot; + + this->unk_214 = randPlusMinusPoint5Scaled(40.0f); + + rot = BINANG_ROT180(this->unk_220->world.rot.y); + this->unk_1D8.x += Math_SinS(rot) * this->unk_214; + this->unk_1D8.y = randPlusMinusPoint5Scaled(40.0f) + (this->unk_220->world.pos.y + 40.0f); + rot = BINANG_ROT180(this->unk_220->world.rot.y); + this->unk_1D8.z += Math_CosS(rot) * this->unk_214; + + this->unk_1EE = Rand_S16Offset(20, 30); + } else if (sqrtf(SQ(this->actor.world.pos.x - sp3C->world.pos.x) + + SQ(this->actor.world.pos.z - sp3C->world.pos.z)) > 100.0f) { + Math_Vec3f_Copy(&this->unk_1D8, &sp3C->world.pos); + } + + if (1) {} + + if ((Rand_ZeroOne() < 0.1f) && (this->unk_1C8 == 0)) { + this->unk_1C8 = 1; + } + + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8); + func_80A76070(this, yaw, globalCtx); +} + +void func_80A76604(EnPrz* this, GlobalContext* globalCtx) { + this->unk_1EE = 0; + this->unk_1E4 = BINANG_ADD(this->actor.world.rot.y, 0x4000); + this->unk_1EA = 2; + this->actionFunc = func_80A76634; +} + +void func_80A76634(EnPrz* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + func_80A76070(this, this->unk_1E4, globalCtx); + + if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, this->unk_1E4)) < 0x100) { + if (func_80A762C0(this, globalCtx) != 0) { + this->unk_1E4 += 0x1500; + this->unk_1E4 += (s16)Rand_ZeroFloat(5000.0f); + } else if ((player->stateFlags1 & 0x8000000) && (player->actor.floorHeight < 30.0f)) { + this->actionFunc = func_80A763E8; + } else { + this->unk_1EE = 10; + this->unk_1EA = 1; + this->actionFunc = func_80A763E8; + } + } +} + +void func_80A76748(EnPrz* this) { + this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + this->unk_1EE = 0; + this->unk_1EA = 3; + this->skelAnime.playSpeed = 2.0f; + this->actionFunc = func_80A767A8; +} + +void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + EnPr* pr = (EnPr*)this->actor.parent; + f32 sqrt; + s32 pad[2]; + u8 playerForm; + + if (func_80A762C0(this, globalCtx)) { + func_80A75F18(this, 0); + this->actor.speedXZ = randPlusMinusPoint5Scaled(1.0f) + 4.0f; + func_80A76604(this, globalCtx); + return; + } + + sqrt = sqrtf(SQ(player->actor.world.pos.x - this->actor.parent->home.pos.x) + + SQ(player->actor.world.pos.z - this->actor.parent->home.pos.z)); + + if (!(player->stateFlags1 & 0x8000000) || (pr->unk_2C8 < sqrt)) { + this->unk_1F2 = 100; + this->skelAnime.playSpeed = 1.0f; + func_80A76388(this); + return; + } + + if ((this->actor.xzDistToPlayer < 200.0f) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 80.0f)) { + if (this->unk_204 != 1) { + func_80A75F18(this, 1); + } + this->skelAnime.playSpeed = 1.0f; + } else { + if (this->unk_204 != 0) { + func_80A75F18(this, 0); + } + this->skelAnime.playSpeed = 2.0f; + } + + if (this->unk_1EE == 0) { + this->unk_1EE = Rand_S16Offset(2, 3); + Math_Vec3f_Copy(&this->unk_1D8, &player->actor.world.pos); + } + + if ((Rand_ZeroOne() < 0.1f) && (this->unk_1C8 == 0)) { + this->unk_1C8 = 1; + } + + playerForm = gSaveContext.playerForm; + this->unk_1D8.y = + (player->actor.world.pos.y + D_80A771E0[playerForm]) + randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f); + func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), globalCtx); +} + +void func_80A76A1C(EnPrz* this) { + this->unk_1E8 = 0; + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BUBLEWALK_DEAD); + + this->unk_1EE = Rand_S16Offset(100, 30); + this->unk_1FC = 0x4000; + + if (Rand_ZeroOne() < 0.5f) { + this->unk_1FC = -0x4000; + } + + this->unk_1FE = this->actor.world.rot.y; + this->actor.speedXZ = Rand_ZeroFloat(0.5f); + this->actor.world.rot.y = randPlusMinusPoint5Scaled(0x8000); + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 30); + this->unk_1EE = 50; + func_80A75F18(this, 0); + this->unk_1EA = 7; + this->actionFunc = func_80A76B14; +} + +void func_80A76B14(EnPrz* this, GlobalContext* globalCtx) { + WaterBox* sp7C; + s32 i; + Vec3f sp6C; + s32 phi_s0 = false; + + Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 5, 0x2710, 0x3E8); + Math_SmoothStepToS(&this->actor.shape.rot.z, this->unk_1FC, 5, 0x2710, 0x3E8); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_1FE, 5, 0x2710, 0x3E8); + + if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &this->unk_210, &sp7C)) { + if ((this->unk_210 - 15.0f) <= this->actor.world.pos.y) { + phi_s0 = true; + } else { + Math_ApproachF(&this->actor.world.pos.y, this->unk_210 - 14.0f, 0.3f, 1.0f); + } + } + + if ((this->unk_1EE == 0) || phi_s0) { + Math_SmoothStepToS(&this->unk_1EC, 0, 1, 15, 50); + + if (this->unk_1EC < 2) { + for (i = 0; i < 10; i++) { + Math_Vec3f_Copy(&sp6C, &this->actor.world.pos); + + sp6C.x += randPlusMinusPoint5Scaled(20.0f); + sp6C.y += randPlusMinusPoint5Scaled(5.0f); + sp6C.z += randPlusMinusPoint5Scaled(20.0f); + + EffectSsBubble_Spawn(globalCtx, &sp6C, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + } + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnPrz_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnPrz* this = THIS; + s32 sp44 = false; + Vec3f sp38; + + if (this->unk_1EA != 7) { + SkelAnime_Update(&this->skelAnime); + } + + this->actionFunc(this, globalCtx); + + if (this->unk_1EE != 0) { + this->unk_1EE--; + } + + if (this->unk_1F2 != 0) { + this->unk_1F2--; + } + + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 10.0f, 10.0f, 0x1D); + + if (this->unk_1EA != 7) { + Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); + } + + if (this->unk_1EA != 7) { + if (this->collider.base.acFlags & AC_HIT) { + Actor_ApplyDamage(&this->actor); + if (this->actor.colChkInfo.health <= 0) { + sp44 = true; + } + } + + if (sp44 || (this->actor.parent == NULL) || (this->actor.parent->colChkInfo.health <= 0)) { + this->collider.base.acFlags &= ~AC_HIT; + if (this->unk_1EA != 7) { + func_80A76A1C(this); + return; + } + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + + if (this->unk_1C8 != 0) { + Math_Vec3f_Copy(&sp38, &this->unk_1CC); + this->unk_1C8 = 0; + + sp38.x += randPlusMinusPoint5Scaled(20.0f); + sp38.y += randPlusMinusPoint5Scaled(5.0f); + sp38.z += randPlusMinusPoint5Scaled(20.0f); + + EffectSsBubble_Spawn(globalCtx, &sp38, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); + } + } +} + +s32 func_80A76F70(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnPrz* this = THIS; + + if (limbIndex == 2) { + rot->y += (s16)this->unk_218 * -100; + } + return false; +} + +void func_80A76FCC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + Vec3f sp1C = D_80A7724C; + EnPrz* this = THIS; + + if (limbIndex == 2) { + Matrix_InsertTranslation(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_MultiplyVector3fByState(&sp1C, &this->unk_1CC); + } +} + +void EnPrz_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnPrz* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + if (this->unk_1EC == 255) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1E8, this->unk_1E8, this->unk_1E8, this->unk_1EC); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk_1EC); + + Scene_SetRenderModeXlu(globalCtx, 0, 1); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, func_80A76F70, func_80A76FCC, &this->actor); + } else { + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk_1EC); + + Scene_SetRenderModeXlu(globalCtx, 1, 2); + POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, NULL, NULL, &this->actor, POLY_XLU_DISP); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.h b/src/overlays/actors/ovl_En_Prz/z_en_prz.h index a4e5840902..28f8152a83 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.h +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.h @@ -7,13 +7,39 @@ struct EnPrz; typedef void (*EnPrzActionFunc)(struct EnPrz*, GlobalContext*); +#define ENPRZ_GET(thisx) ((thisx)->params & 0xFF) + typedef struct EnPrz { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x80]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[5]; + /* 0x01A6 */ Vec3s morphTable[5]; /* 0x01C4 */ EnPrzActionFunc actionFunc; - /* 0x01C8 */ char unk_1C8[0x58]; + /* 0x01C8 */ u8 unk_1C8; + /* 0x01CC */ Vec3f unk_1CC; + /* 0x01D8 */ Vec3f unk_1D8; + /* 0x01E4 */ s16 unk_1E4; + /* 0x01E6 */ s16 unk_1E6; + /* 0x01E8 */ s16 unk_1E8; + /* 0x01EA */ s16 unk_1EA; + /* 0x01EC */ s16 unk_1EC; + /* 0x01EE */ s16 unk_1EE; + /* 0x01F0 */ UNK_TYPE1 unk1F0[2]; + /* 0x01F2 */ s16 unk_1F2; + /* 0x01F4 */ UNK_TYPE1 unk1F4[8]; + /* 0x01FC */ s16 unk_1FC; + /* 0x01FE */ s16 unk_1FE; + /* 0x0200 */ UNK_TYPE1 unk200[2]; + /* 0x0202 */ s16 unk_202; + /* 0x0204 */ s32 unk_204; + /* 0x0208 */ f32 unk_208; + /* 0x020C */ f32 unk_20C; + /* 0x0210 */ f32 unk_210; + /* 0x0214 */ f32 unk_214; + /* 0x0218 */ f32 unk_218; + /* 0x021C */ UNK_TYPE1 unk21C[4]; /* 0x0220 */ Actor* unk_220; - /* 0x0224 */ char unk_224[0x4C]; + /* 0x0224 */ ColliderCylinder collider; } EnPrz; // size = 0x270 extern const ActorInit En_Prz_InitVars; diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 34ba306528..b490d8d1dc 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -1,10 +1,15 @@ /* * File: z_en_racedog.c * Overlay: ovl_En_Racedog - * Description: Racetrack Dog + * Description: The dogs that run around the racetrack during the dog race. + * + * Note that the dogs milling about the Doggy Racetrack prior to and after the + * race are actually En_Dg. This actor is solely concerned with the dogs that + * actually perform the race by running around the track. */ #include "z_en_racedog.h" +#include "objects/object_dog/object_dog.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80000000) @@ -17,8 +22,25 @@ void EnRacedog_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80B24C14(EnRacedog* this, GlobalContext* globalCtx); void func_80B24CB4(EnRacedog* this, GlobalContext* globalCtx); +void func_80B24E14(EnRacedog* this); +void func_80B24F08(EnRacedog* this); +void func_80B251EC(EnRacedog* this); +void func_80B252F8(EnRacedog* this); +void func_80B2538C(EnRacedog* this); +void func_80B25448(EnRacedog* this); +s32 func_80B25490(EnRacedog* this, Vec2f* arg1); +void func_80B255AC(EnRacedog* this, GlobalContext* globalCtx); +void func_80B256BC(EnRacedog* this); + +typedef struct { + f32 unk_00; + f32 unk_04; + s16 unk_08; + s16 unk_0A; + s16 unk_0C; + s16 unk_0E; +} UnkRacedogStruct; -#if 0 const ActorInit En_Racedog_InitVars = { ACTOR_EN_RACEDOG, ACTORCAT_NPC, @@ -31,18 +53,60 @@ const ActorInit En_Racedog_InitVars = { (ActorFunc)EnRacedog_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B25E98 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static s16 D_80B25D40 = 0; + +static s16 D_80B25D44 = -1; + +static s16 D_80B25D48 = 0; + +static s16 D_80B25D4C = -1; + +static f32 D_80B25D50[][2] = { + { 0.0f, 0.0f }, { 5.0f, 5.5f }, { 5.0f, 5.0f }, { 5.5f, 5.0f }, { 4.5f, 5.5f }, { 6.0f, 4.0f }, { 4.0f, 6.0f }, +}; + +static UnkRacedogStruct D_80B25D88[] = { + { -1.0f, 1.20000004768f, 3, 0, 9, 0x3539 }, { -1.0f, 1.20000004768f, 1, 1, 9, 0x353A }, + { -1.0f, 1.20000004768f, 5, 2, 10, 0x353B }, { -1.0f, 1.20000004768f, 2, 3, 9, 0x353C }, + { -1.0f, 1.20000004768f, 4, 4, 8, 0x353D }, { -1.0f, 1.20000004768f, 2, 5, 9, 0x353E }, + { -1.0f, 1.20000004768f, 3, 6, 9, 0x353F }, { -1.0f, 1.20000004768f, 1, 7, 9, 0x3540 }, + { -1.0f, 1.20000004768f, 1, 8, 9, 0x3541 }, { -1.0f, 1.20000004768f, 6, 9, 8, 0x3542 }, + { -1.0f, 1.20000004768f, 2, 10, 9, 0x3543 }, { -1.0f, 1.20000004768f, 3, 11, 9, 0x3544 }, + { -1.0f, 1.20000004768f, 1, 12, 9, 0x3545 }, { -1.0f, 1.20000004768f, 4, 13, 8, 0x3546 }, +}; + +static UnkRacedogStruct D_80B25E68 = { -1.0f, 1.0, 0, -1, 0, 0x353E }; + +static Vec2f D_80B25E78[] = { + { -3914.0f, 1283.0f }, + { -3747.0f, 1104.0f }, + { -3717.0f, 1169.0f }, + { -3897.0f, 1308.0f }, +}; + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 13, 19, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80B25EC4 = { 0, 0, 0, 0, 1 }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, 1 }; -// static DamageTable sDamageTable = { -static DamageTable D_80B25ED0 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -77,63 +141,532 @@ static DamageTable D_80B25ED0 = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B25FF0[] = { +static AnimationInfoS D_80B25EF0[] = { + { &object_dog_Anim_0021C8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dog_Anim_0021C8, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, + { &object_dog_Anim_001BD8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dog_Anim_000998, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, + { &object_dog_Anim_001FB0, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, + { &object_dog_Anim_001FB0, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, + { &object_dog_Anim_001048, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, + { &object_dog_Anim_001348, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, + { &object_dog_Anim_001048, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, + { &object_dog_Anim_001048, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, + { &object_dog_Anim_001048, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, + { &object_dog_Anim_0021C8, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, + { &object_dog_Anim_001560, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dog_Anim_001A84, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dog_Anim_0017C0, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dog_Anim_0021C8, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP), }; -#endif +void func_80B24630(SkelAnime* skelAnime, AnimationInfoS arg1[], s32 arg2) { + f32 frameCount; -extern ColliderCylinderInit D_80B25E98; -extern CollisionCheckInfoInit2 D_80B25EC4; -extern DamageTable D_80B25ED0; -extern InitChainEntry D_80B25FF0[]; + arg1 += arg2; + if (arg1->frameCount < 0) { + frameCount = Animation_GetLastFrame(arg1->animation); + } else { + frameCount = arg1->frameCount; + } -extern UNK_TYPE D_06000618; -extern UNK_TYPE D_060080F0; + Animation_Change(skelAnime, arg1->animation, arg1->playSpeed + (BREG(88) * 0.1f), arg1->startFrame, frameCount, + arg1->mode, arg1->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B24630.s") +void func_80B246F4(EnRacedog* this, GlobalContext* globalCtx) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 26.0f, 10.0f, 0.0f, 5); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B246F4.s") +s16 func_80B2478C(Path* path, s32 arg1, Vec3f* pos, f32* arg3) { + Vec3s* point; + f32 phi_f14; + f32 sp1C; + f32 xDiff; + f32 zDiff; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B2478C.s") + if (path != NULL) { + point = Lib_SegmentedToVirtual(path->points); + point = &point[arg1]; + phi_f14 = (randPlusMinusPoint5Scaled(100.0f) + point->x) - pos->x; + sp1C = (randPlusMinusPoint5Scaled(100.0f) + point->z) - pos->z; + xDiff = point->x - pos->x; + zDiff = point->z - pos->z; + } else { + phi_f14 = 0.0f; + sp1C = 0.0f; + xDiff = 0.0f; + zDiff = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B248B8.s") + *arg3 = SQ(xDiff) + SQ(zDiff); + return RADF_TO_BINANG(Math_Acot2F(sp1C, phi_f14)); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/EnRacedog_Init.s") +void func_80B248B8(EnRacedog* this, Vec3f* arg1) { + f32 sp20; + f32 sp1C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/EnRacedog_Destroy.s") + if (this->actor.floorPoly != NULL) { + sp20 = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + sp1C = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B24C14.s") + arg1->x = -Math_Acot2F(1.0f, -sp1C * sp20); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B24CB4.s") +void EnRacedog_Init(Actor* thisx, GlobalContext* globalCtx) { + EnRacedog* this = THIS; + ColliderCylinder* collider = &this->collider; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B24E14.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_dog_Skel_0080F0, NULL, this->jointTable, this->morphTable, + 13); + Collider_InitCylinder(globalCtx, collider); + Collider_SetCylinder(globalCtx, collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B24F08.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + this->unk_1E0 = func_8013D648(globalCtx, ENRACEDOG_GET_PATH(&this->actor), 0x3F); + Actor_SetScale(&this->actor, 0.0075f); + this->actor.gravity = -3.0f; + if (ENRACEDOG_GET_3E0(&this->actor) < 14) { + this->unk_290 = ENRACEDOG_GET_3E0(&this->actor); + } else { + Actor_MarkForDeath(&this->actor); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B251EC.s") + this->unk_2BC = 0xFF; + this->unk_2C0 = 0x32; + this->unk_288 = 0xC; + this->unk_2A0.x = 0.0f; + this->unk_2A0.y = 0.0f; + this->unk_2A0.z = 0.0f; + this->unk_2C4 = 1.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B252F8.s") + if ((D_80B25D88[this->unk_290].unk_0E >= 0x353F) && (this->unk_290 == (s16)Rand_ZeroFloat(20.0f))) { + this->unk_28C = 5; + } else { + this->unk_28C = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B2538C.s") + this->unk_28A = 60; + this->unk_28A += this->unk_28C; + this->unk_298 = D_80B25D50[D_80B25D88[this->unk_290].unk_08][0]; + this->unk_29C = 0; + this->unk_2B8 = -1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B25448.s") + func_80B24E14(this); + this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_20; + D_80B25E68 = D_80B25D88[(s16)((gSaveContext.eventInf[0] & 0xF8) >> 3)]; + this->unk_292 = D_80B25E68.unk_0A; + func_80B24630(&this->skelAnime, D_80B25EF0, 0); + D_80B25EF0->playSpeed = Rand_ZeroFloat(0.5f) + 1.0f; + this->actionFunc = func_80B24C14; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B25490.s") +void EnRacedog_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnRacedog* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B255AC.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B256BC.s") +void func_80B24C14(EnRacedog* this, GlobalContext* globalCtx) { + s16 phi_v1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/EnRacedog_Update.s") + if (this->unk_28A == 0) { + phi_v1 = 0; + } else { + this->unk_28A--; + phi_v1 = this->unk_28A; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B2583C.s") + if (phi_v1 == 0) { + this->unk_28A = Rand_S16Offset(50, 50); + if (this->unk_28C == 0) { + play_sound(NA_SE_SY_START_SHOT); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B258D8.s") + func_80B24630(&this->skelAnime, D_80B25EF0, 2); + this->actionFunc = func_80B24CB4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B25A74.s") +void func_80B24CB4(EnRacedog* this, GlobalContext* globalCtx) { + s16 phi_a1; + f32 sp30; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/func_80B25A90.s") + this->collider.dim.radius = 15; + if (this->unk_1E0 != 0) { + phi_a1 = func_80B2478C(this->unk_1E0, this->unk_1E8, &this->actor.world.pos, &sp30); + if (this->actor.bgCheckFlags & 8) { + phi_a1 = this->actor.wallYaw; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Racedog/EnRacedog_Draw.s") + Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + + if (sp30 <= 2500.0f) { + this->unk_1E8++; + if (this->unk_1E8 >= (this->unk_1E0->count - 1)) { + this->unk_1E8 = 0; + } + } + + func_80B24F08(this); + if ((this->unk_1E8 >= ((this->unk_1E0->count / 4) * 3)) && (this->unk_290 == D_80B25D4C)) { + D_80B25D48++; + } + + func_80B252F8(this); + func_80B2538C(this); + Actor_MoveWithGravity(&this->actor); + } + + func_80B25448(this); + func_80B256BC(this); + func_80B255AC(this, globalCtx); +} + +void func_80B24E14(EnRacedog* this) { + if (this->unk_290 % 2) { + D_80B25D88[this->unk_290].unk_0E = + (((gSaveContext.weekEventReg[42 + (this->unk_290 / 2)]) & (0x10 | 0x20 | 0x40 | 0x80)) >> 4) + 0x3539; + } else { + D_80B25D88[this->unk_290].unk_0E = + ((gSaveContext.weekEventReg[42 + (this->unk_290 / 2)]) & (1 | 2 | 4 | 8)) + 0x3539; + } + + if ((D_80B25D88[this->unk_290].unk_0E >= 0x3547) || (D_80B25D88[this->unk_290].unk_0E < 0x3539)) { + D_80B25D88[this->unk_290].unk_0E = 0x353E; + } + if (D_80B25D88[this->unk_290].unk_0E == 0x3547) { + D_80B25D88[this->unk_290].unk_0E = 0x3538; + } +} + +void func_80B24F08(EnRacedog* this) { + s32 temp_a0; + s32 temp_v1 = this->unk_1E0->count; + + if (this->unk_2B8 < this->unk_1E8) { + this->unk_2B8 = this->unk_1E8; + if (this->unk_1E8 == 0) { + this->unk_298 = D_80B25D50[D_80B25D88[this->unk_290].unk_08][0]; + } else { + temp_a0 = temp_v1 / 4; + if (this->unk_1E8 < temp_a0) { + if (D_80B25D88[this->unk_290].unk_08 == 5) { + this->unk_298 = D_80B25D50[D_80B25D88[this->unk_290].unk_08][0] + randPlusMinusPoint5Scaled(1.0f); + } else { + this->unk_298 = 5.0f + randPlusMinusPoint5Scaled(1.0f); + } + + if ((D_80B25D88[this->unk_290].unk_0E < 0x353E) && (this->unk_290 != D_80B25D4C)) { + this->unk_298 *= D_80B25D88[this->unk_290].unk_04; + } + } else if (this->unk_1E8 < (temp_a0 * 3)) { + if (this->unk_1E8 < D_80B25D88[this->unk_290].unk_0C) { + this->unk_298 = 5.0f + randPlusMinusPoint5Scaled(1.0f); + } else { + this->unk_298 = D_80B25D50[D_80B25D88[this->unk_290].unk_08][1] + randPlusMinusPoint5Scaled(1.0f); + + if ((D_80B25D88[this->unk_290].unk_0E < 0x353E) && (this->unk_290 != D_80B25D4C)) { + this->unk_298 *= D_80B25D88[this->unk_290].unk_04; + } + } + } else if (this->unk_1E8 < temp_v1) { + func_80B251EC(this); + } else { + this->unk_298 = randPlusMinusPoint5Scaled(1.0f) + 5.0f; + } + } + } + + if ((this->unk_1E8 != 0) || (this->unk_29C != 0)) { + this->actor.shape.rot.y = this->actor.world.rot.y; + } + + Math_ApproachF(&this->actor.speedXZ, this->unk_298, 0.5f, 3.0f); + + if (this->unk_290 == this->unk_292) { + if (this->actor.speedXZ > 7.5f) { + this->actor.speedXZ = 7.5f; + } + } else { + if (this->actor.speedXZ > 7.0f) { + this->actor.speedXZ = 7.0f; + } + } +} + +void func_80B251EC(EnRacedog* this) { + f32 temp; + + if (D_80B25D88[this->unk_290].unk_00 == -1.0f) { + if (D_80B25D48 < 100.0f) { + D_80B25D88[this->unk_290].unk_00 = 200.0f / (200.0f - D_80B25D48); + } else { + D_80B25D88[this->unk_290].unk_00 = 2.0f; + } + } + + if (D_80B25D88[this->unk_290].unk_0E < 0x3542) { + temp = D_80B25D88[this->unk_290].unk_00; + this->unk_298 = temp * D_80B25D50[D_80B25D88[this->unk_290].unk_08][1]; + } + + if ((D_80B25D88[this->unk_290].unk_0E < 0x353E) && (this->unk_290 != D_80B25D4C)) { + this->unk_298 *= D_80B25D88[this->unk_290].unk_04; + } +} + +void func_80B252F8(EnRacedog* this) { + if ((this->unk_1E8 >= 9) && (this->unk_29C == 0)) { + this->unk_29C = 1; + } + + if ((this->unk_1E8 >= 0xB) && (this->unk_29C == 1)) { + this->unk_29C = 2; + } + + if (((this->unk_1E8 >= D_80B25D44) || (this->unk_29C <= 0)) && (this->unk_1E8 > D_80B25D44)) { + D_80B25D44 = this->unk_1E8; + D_80B25D4C = this->unk_290; + } +} + +void func_80B2538C(EnRacedog* this) { + if (func_80B25490(this, D_80B25E78) && this->unk_29C == 2) { + D_80B25D40++; + if (D_80B25D40 == 1) { + Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); + play_sound(NA_SE_SY_START_SHOT); + } + + this->unk_29C = 3; + if (this->unk_290 == this->unk_292) { + gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 7) | (D_80B25D40 * 8); + } + } +} + +void func_80B25448(EnRacedog* this) { + if (this->actor.speedXZ < 3.0f) { + D_80B25EF0[2].playSpeed = 0.9f; + } else { + D_80B25EF0[2].playSpeed = 1.0f; + } +} + +s32 func_80B25490(EnRacedog* this, Vec2f* arg1) { + f32 xDistToTopFront; + f32 zDistToTopFront; + f32 xDistToBottomFront; + f32 xDistToBottomBack; + f32 zDistToBottomBack; + f32 zDistToBottomFront; + f32 zDistToTopBack; + f32 xDistToTopBack; + f32 temp_f0; + f32 temp; + + xDistToTopFront = this->actor.world.pos.x - arg1[0].x; + zDistToTopFront = this->actor.world.pos.z - arg1[0].y; + xDistToBottomFront = this->actor.world.pos.x - arg1[1].x; + zDistToBottomFront = this->actor.world.pos.z - arg1[1].y; + xDistToBottomBack = this->actor.world.pos.x - arg1[2].x; + zDistToBottomBack = this->actor.world.pos.z - arg1[2].y; + xDistToTopBack = this->actor.world.pos.x - arg1[3].x; + zDistToTopBack = this->actor.world.pos.z - arg1[3].y; + + temp_f0 = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); + temp = (((xDistToBottomFront * zDistToBottomBack) - (xDistToBottomBack * zDistToBottomFront))); + if (temp_f0 * temp < 0.0f) { + return false; + } + + temp_f0 = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); + temp = ((xDistToBottomBack * zDistToTopBack) - (xDistToTopBack * zDistToBottomBack)); + if (temp_f0 * temp < 0.0f) { + return false; + } + + temp_f0 = ((xDistToTopFront * zDistToBottomFront) - (xDistToBottomFront * zDistToTopFront)); + temp = ((xDistToTopBack * zDistToTopFront) - (xDistToTopFront * zDistToTopBack)); + if (temp_f0 * temp < 0.0f) { + return false; + } + + return true; +} + +void func_80B255AC(EnRacedog* this, GlobalContext* globalCtx) { + s16 curFrame = this->skelAnime.curFrame; + s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; + Vec3f sp38; + + if (((this->unk_290 + curFrame) % mod) == 0) { + sp38.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f); + sp38.y = this->actor.world.pos.y; + sp38.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f); + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &sp38, 10.0f, 0, 2.0f, 300, 0, true); + } +} + +void func_80B256BC(EnRacedog* this) { + s16 curFrame = this->skelAnime.curFrame; + + if ((curFrame == 1) || (curFrame == 7)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); + } +} + +void EnRacedog_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnRacedog* this = THIS; + Vec3f sp2C = { 0.0f, 0.0f, 0.0f }; + + this->unk_292 = D_80B25E68.unk_0A; + + this->actionFunc(this, globalCtx); + + func_80B246F4(this, globalCtx); + func_80B248B8(this, &sp2C); + Math_ApproachF(&this->unk_2AC.x, sp2C.x, 0.2f, 0.1f); + + if (this->unk_2A0.x > 0.0f) { + if ((this->unk_2AC.x < 0.0f) && (this->unk_2AC.x > -0.1f)) { + this->skelAnime.curFrame = 4.0f; + this->actor.velocity.y = 5.5f; + } + } + + if (!(this->actor.bgCheckFlags & 1)) { + this->skelAnime.curFrame = 0.0f; + } + + this->unk_2A0 = this->unk_2AC; + SkelAnime_Update(&this->skelAnime); +} + +void func_80B2583C(EnRacedog* this) { + s16 phi_v1; + + if (this->unk_288 >= 7) { + this->unk_2BC -= 0x10; + this->unk_2C0 += 8; + this->unk_2C4 += 0.05f; + } else { + this->unk_2BC += 0x10; + this->unk_2C0 -= 8; + this->unk_2C4 -= 0.05f; + } + + if (this->unk_288 == 0) { + phi_v1 = 0; + } else { + this->unk_288--; + phi_v1 = this->unk_288; + } + + if (phi_v1 == 0) { + this->unk_288 = 0xC; + } +} + +void func_80B258D8(EnRacedog* this, GlobalContext* globalCtx) { + Vec3s sp48 = gZeroVec3s; + s32 phi_v0 = (this->unk_290 == this->unk_292) ? true : false; + + if (phi_v0) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + func_80B2583C(this); + Matrix_SetStateRotationAndTranslation(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, + this->actor.world.pos.z, &sp48); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 255, 255, this->unk_2BC, 0, 255); + gDPSetEnvColor(POLY_OPA_DISP++, 255, this->unk_2C0, 0, 255); + Matrix_Scale(this->unk_2C4 * 2.0f, this->unk_2C4 * 2.0f, this->unk_2C4 * 2.0f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_dog_DL_000618); + gSPDisplayList(POLY_OPA_DISP++, object_dog_DL_000550); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } +} + +s32 EnRacedog_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + return false; +} + +void EnRacedog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + s32 pad; + EnRacedog* this = THIS; + Vec3f sp1C = { 0.0f, 20.0f, 0.0f }; + + if (limbIndex == 5) { + Matrix_MultiplyVector3fByState(&sp1C, &this->actor.focus.pos); + } + + if (limbIndex == 12) { + func_80B258D8(this, globalCtx); + } +} + +void EnRacedog_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnRacedog* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + switch (D_80B25D88[this->unk_290].unk_08) { + case 3: + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); + break; + case 1: + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 0); + break; + case 5: + gDPSetEnvColor(POLY_OPA_DISP++, 79, 79, 143, 0); + break; + case 6: + gDPSetEnvColor(POLY_OPA_DISP++, 255, 207, 47, 0); + break; + case 4: + gDPSetEnvColor(POLY_OPA_DISP++, 143, 79, 47, 0); + break; + case 2: + gDPSetEnvColor(POLY_OPA_DISP++, 143, 143, 143, 0); + break; + default: + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); + break; + } + + Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); + Matrix_RotateStateAroundXAxis(this->unk_2AC.x); + Matrix_InsertZRotation_s(this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRacedog_OverrideLimbDraw, EnRacedog_PostLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h index 4008ba4e15..2f9f9b06b9 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h @@ -3,21 +3,40 @@ #include "global.h" +#define ENRACEDOG_GET_3E0(thisx) (((thisx)->params & 0x3E0) >> 5) +#define ENRACEDOG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) + struct EnRacedog; typedef void (*EnRacedogActionFunc)(struct EnRacedog*, GlobalContext*); typedef struct EnRacedog { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnRacedogActionFunc actionFunc; - /* 0x0148 */ char unk_148[0xA0]; - /* 0x01E8 */ s32 unk_1E8; - /* 0x01EC */ char unk_1EC[0xA4]; - /* 0x0290 */ s16 unk_290; - /* 0x0292 */ s16 unk_292; - /* 0x0294 */ char unk_294[0x8]; - /* 0x029C */ s16 unk_29C; - /* 0x029E */ char unk_29E[0x2A]; + /* 0x000 */ Actor actor; + /* 0x144 */ EnRacedogActionFunc actionFunc; + /* 0x148 */ UNK_TYPE1 unk_148[0x4]; + /* 0x14C */ SkelAnime skelAnime; + /* 0x190 */ ColliderCylinder collider; + /* 0x1DC */ UNK_TYPE1 unk_1DC[0x4]; + /* 0x1E0 */ Path* unk_1E0; + /* 0x1E4 */ UNK_TYPE1 unk_1E4[0x4]; + /* 0x1E8 */ s32 unk_1E8; + /* 0x1EC */ Vec3s jointTable[13]; + /* 0x23A */ Vec3s morphTable[13]; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ s16 unk_28C; + /* 0x28A */ UNK_TYPE1 unk_28E[0x2]; + /* 0x290 */ s16 unk_290; + /* 0x292 */ s16 unk_292; + /* 0x294 */ UNK_TYPE1 unk_294[0x4]; + /* 0x298 */ f32 unk_298; + /* 0x29C */ s16 unk_29C; + /* 0x2A0 */ Vec3f unk_2A0; + /* 0x2AC */ Vec3f unk_2AC; + /* 0x2B8 */ s32 unk_2B8; + /* 0x2BC */ s32 unk_2BC; + /* 0x2C0 */ s32 unk_2C0; + /* 0x2C4 */ f32 unk_2C4; } EnRacedog; // size = 0x2C8 extern const ActorInit En_Racedog_InitVars; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index b2850d7d1f..f29f3b6a7f 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -564,8 +564,8 @@ void func_80B71910(EnRailSkb* this) { } void func_80B71954(EnRailSkb* this, GlobalContext* globalCtx) { - s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->actor.world.pos); - f32 sp30 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->actor.world.pos); + s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); + f32 sp30 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); Math_SmoothStepToS(&this->actor.shape.rot.y, sp36, 1, 0x71C, 0xB6); this->actor.world.rot = this->actor.shape.rot; @@ -582,24 +582,24 @@ void func_80B71A08(EnRailSkb* this) { } void func_80B71A58(EnRailSkb* this, GlobalContext* globalCtx) { - s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->actor.world.pos); + s16 sp36 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - if (this->unk_2E8 < this->unk_22C->actor.colChkInfo.health) { - this->unk_22C->actor.colChkInfo.health--; + if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) { + this->unk_22C->dyna.actor.colChkInfo.health--; } else { - this->unk_22C->actor.colChkInfo.health--; + this->unk_22C->dyna.actor.colChkInfo.health--; func_80B71B6C(this); } } if (Animation_OnFrame(&this->skelAnime, 3.0f)) { - if (this->unk_2E8 < this->unk_22C->actor.colChkInfo.health) { - this->unk_22C->actor.colChkInfo.health--; + if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) { + this->unk_22C->dyna.actor.colChkInfo.health--; } else { - this->unk_22C->actor.colChkInfo.health--; + this->unk_22C->dyna.actor.colChkInfo.health--; func_80B71B6C(this); } } @@ -616,7 +616,7 @@ void func_80B71B6C(EnRailSkb* this) { void func_80B71BB8(EnRailSkb* this, GlobalContext* globalCtx) { s32 pad; s32 i; - f32 sp34 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->actor.world.pos); + f32 sp34 = Math_Vec3f_DistXZ(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos); if (this->unk_3F2 > 0) { this->unk_3F2--; @@ -624,15 +624,15 @@ void func_80B71BB8(EnRailSkb* this, GlobalContext* globalCtx) { } Math_SmoothStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->actor.world.pos), 1, 0x71C, 0xB6); + Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_22C->dyna.actor.world.pos), 1, 0x71C, 0xB6); - if ((this->actor.bgCheckFlags & 1) && (this->unk_22C->actor.colChkInfo.health == 0)) { + if ((this->actor.bgCheckFlags & 1) && (this->unk_22C->dyna.actor.colChkInfo.health == 0)) { Actor_MoveWithGravity(&this->actor); } else { this->actor.velocity.y += this->actor.gravity; this->actor.world.pos.y += this->actor.velocity.y; - Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_22C->actor.world.pos.x, 0.6f, 1.6f, 0.1f); - Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_22C->actor.world.pos.z, 0.6f, 1.6f, 0.1f); + Math_SmoothStepToF(&this->actor.world.pos.x, this->unk_22C->dyna.actor.world.pos.x, 0.6f, 1.6f, 0.1f); + Math_SmoothStepToF(&this->actor.world.pos.z, this->unk_22C->dyna.actor.world.pos.z, 0.6f, 1.6f, 0.1f); } if (this->actor.bgCheckFlags & 2) { diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 71d08787e2..57f4b9bcdc 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -875,7 +875,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx2) { Vec3f spA4; f32 temp_f20; - matrix = GRAPH_ALLOC(globalCtx->state.gfxCtx, 256); + matrix = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(Mtx) * 4); OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 6b299ae9af..a357151708 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -892,7 +892,7 @@ void func_80ADCD3C(EnSellnuts* this, GlobalContext* globalCtx) { } s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) { - Vec3s* points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + Vec3s* points = Lib_SegmentedToVirtual(path->points); s32 count = path->count; s32 var = arg2; s32 ret = false; @@ -929,7 +929,7 @@ f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { Vec3s* points; if (path != NULL) { - points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + points = Lib_SegmentedToVirtual(path->points); points = &points[arg1]; sp20.x = points->x; sp20.y = points->y; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index c47c8fb672..6d886fad3f 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -2,6 +2,7 @@ * File: z_en_shn.c * Overlay: ovl_En_Shn * Description: Swamp Tourist Center Guide + * Shashin(Shn) ~ Photo */ #include "z_en_shn.h" @@ -14,11 +15,42 @@ void EnShn_Init(Actor* thisx, GlobalContext* globalCtx); void EnShn_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnShn_Update(Actor* thisx, GlobalContext* globalCtx); void EnShn_Draw(Actor* thisx, GlobalContext* globalCtx); - void func_80AE69E8(EnShn* this, GlobalContext* globalCtx); void func_80AE6A64(EnShn* this, GlobalContext* globalCtx); +s32 func_80AE6704(EnShn* this, GlobalContext* globalCtx); + +// Could be something related to text/dialogue? +static UNK_TYPE D_80AE6F00[] = { + 0x00170800, 0x0B0E09C4, 0x0C0F09C5, 0x0C111708, 0x03018C04, 0x018E1901, 0x860F00FF, 0x1E001300, 0x00011501, + 0x47280012, 0x28001928, 0x002D2800, 0x5D280093, 0x28003319, 0x00472C09, 0xE70C2F00, 0x000C1210, 0x2C09CB0C, + 0x2F00000C, 0x0F09CC0C, 0x0F09CD0C, 0x0500A500, 0xCB00CB2C, 0x09D10C2F, 0x00000C0F, 0x09D20C19, 0xFFE62C09, + 0xD30C2F00, 0x000C0F09, 0xD40C0F09, 0xD50C0500, 0x9200B200, 0xB22C09D9, 0x0C2F0000, 0x0C0F09DA, 0x0C102C09, + 0xE80C2F00, 0x000C0F09, 0xE90C0F09, 0xEA0C0057, 0x04001712, 0x06000C00, 0x0013000C, 0x0C115704, 0x0700000E, + 0x09EB0C12, 0x16101206, 0x00060000, 0x1300060C, 0x07FFEC2C, 0x09EC0C2F, 0x00000C0F, 0x09ED0C0F, 0x09EE0C00, + 0x57040017, 0x1206000C, 0x00001300, 0x0C0C1157, 0x04070000, 0x0E09EF0C, 0x12161012, 0x06000600, 0x00130006, + 0x0C07FFEC, 0x12060004, 0x00001300, 0x040C0700, 0x000E09CE, 0x0C161012, 0x06000200, 0x00130002, 0x0C070000, + 0x0E09D80C, 0x16100C0F, 0x09CF0C1C, 0x05011509, 0x0000100E, 0x09D60C19, 0xFFF10037, 0x40001C2C, 0x09DB0C2F, + 0x00000C0F, 0x09DC0C0F, 0x09DD0C0F, 0x09DE0C0F, 0x09DF0C11, 0x3740102C, 0x09E00C2F, 0x00000C0F, 0x09E10C0F, + 0x09E20C10, 0x00374000, 0x180E09DB, 0x0C0F09DC, 0x0C0F09DD, 0x0C0F09DE, 0x0C0F09DF, 0x0C113740, 0x100E09E0, + 0x0C0F09E1, 0x0C0F09E2, 0x0C100E09, 0xC90C0F09, 0xCA0C100E, 0x09C60C10, 0x001402FF, 0xED0E09C8, 0x0C19FE69 +}; + +static UNK_TYPE D_80AE70B0[] = { 0x0E09D00C, 0x16100000 }; + +static UNK_TYPE D_80AE70B8[] = { + 0x28001228, 0x00152800, 0x28280055, 0x28008A28, 0x002D1900, 0x402C09E7, 0x0C12102C, 0x09CB2F00, 0x000C0F09, + 0xCC0C0F09, 0xCD0C0500, 0xA000C600, 0xC62C09D1, 0x2F00000C, 0x0F09D20C, 0x19FFE72C, 0x09D32F00, 0x000C0F09, + 0xD40C0F09, 0xD50C0500, 0x8F00AF00, 0xAF2C09D9, 0x2F00000C, 0x0F09DA0C, 0x102C09E8, 0x2F00000C, 0x0F09E90C, + 0x0F09EA0C, 0x00570400, 0x17120600, 0x0C000013, 0x000C0C11, 0x57040700, 0x000E09EB, 0x0C121610, 0x12060006, + 0x00001300, 0x060C07FF, 0xEC2C09EC, 0x2F00000C, 0x0F09ED0C, 0x0F09EE0C, 0x00570800, 0x17120600, 0x0C000013, + 0x000C0C11, 0x57080700, 0x000E09EF, 0x0C121610, 0x12060006, 0x00001300, 0x060C07FF, 0xEC120600, 0x04000013, + 0x00040C07, 0x00000E09, 0xCE0C1610, 0x12060002, 0x00001300, 0x020C0700, 0x000E09D8, 0x0C16100C, 0x0F09CF0C, + 0x1C050115, 0x09000010, 0x0E09D60C, 0x19FFF100, +}; + +static UNK_TYPE D_80AE71C4[] = { 0x00374000, 0x1C2C09DB, 0x0C2F0000, 0x0C0F09DC, 0x0C0F09DD, 0x0C0F09DE, 0x0C0F09DF, + 0x0C113740, 0x102C09E0, 0x0C2F0000, 0x0C0F09E1, 0x0C0F09E2, 0x0C100000 }; -#if 0 const ActorInit En_Shn_InitVars = { ACTOR_EN_SHN, ACTORCAT_NPC, @@ -31,47 +63,379 @@ const ActorInit En_Shn_InitVars = { (ActorFunc)EnShn_Draw, }; -#endif +static AnimationInfoS sAnimations[] = { + { &object_shn_Anim_00D9D0, 1.0f, 0, -1, 0, 0 }, + { &object_shn_Anim_00D9D0, 1.0f, 0, -1, 0, -4 }, + { &object_shn_Anim_00E6C4, 1.0f, 0, -1, 0, 0 }, + { &object_shn_Anim_00E6C4, 1.0f, 0, -1, 0, -4 }, +}; -extern UNK_TYPE D_0600B738; -extern UNK_TYPE D_0600E7D0; +static s32 D_80AE7258[] = { 0, 2, 3, 8, 10, 1 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6130.s") +void func_80AE6130(EnShn* this) { + this->skelAnime.playSpeed = this->playSpeed; + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE615C.s") +s32 func_80AE615C(EnShn* this, s32 arg1) { + s32 phi_v0 = 0; + s32 phi_v1 = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE61C0.s") + if (arg1 != this->unk_2E8) { + phi_v0 = 1; + } + if (phi_v0 != 0) { + this->unk_2E8 = arg1; + phi_v1 = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + this->playSpeed = this->skelAnime.playSpeed; + } + return phi_v1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE625C.s") +s32 EnShn_IsFacingPlayer(EnShn* this) { + s16 phi_v1; + f32 range; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE626C.s") + if (this->unk_2C8 == 0) { + phi_v1 = 0; + } else { + this->unk_2C8--; + phi_v1 = this->unk_2C8; + } + if (phi_v1 == 0) { + this->unk_2EC ^= 1; + this->unk_2C8 = Rand_S16Offset(0x1E, 0x1E); + } + if (this->unk_2EC != 0) { + range = 120.0f; + } else { + range = 80.0f; + } + return Actor_IsFacingAndNearPlayer(&this->actor, range, 0x238C); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE63A8.s") +Player* EnShn_GetPlayer(EnShn* this, GlobalContext* globalCtx) { + return GET_PLAYER(globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6488.s") +void func_80AE626C(EnShn* this) { + s32 topPad; + Vec3f playerPos; + Vec3f shnPos; + s32 bottomPad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE65F4.s") + Math_Vec3f_Copy(&playerPos, &this->shnPlayerRef->actor.world.pos); + Math_Vec3f_Copy(&shnPos, &this->actor.world.pos); + Math_ApproachS(&this->unk_2BC, (Math_Vec3f_Yaw(&shnPos, &playerPos) - this->actor.shape.rot.y), 4, 0x2AA8); + this->unk_2BC = CLAMP(this->unk_2BC, -0x1FFE, 0x1FFE); + Math_Vec3f_Copy(&shnPos, &this->actor.focus.pos); + if (this->shnPlayerRef->actor.id == ACTOR_PLAYER) { + playerPos.y = this->shnPlayerRef->bodyPartsPos[7].y + 3.0f; + } else { + Math_Vec3f_Copy(&playerPos, &this->shnPlayerRef->actor.focus.pos); + } + Math_ApproachS(&this->unk_2BA, Math_Vec3f_Pitch(&shnPos, &playerPos), 4, 0x2AA8); + this->unk_2BA = CLAMP(this->unk_2BA, -0x1554, 0x1554); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6704.s") +void func_80AE63A8(EnShn* this, GlobalContext* globalCtx) { + s16 phi_v1; + s16 phi_v1_2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6880.s") + this->shnPlayerRef = EnShn_GetPlayer(this, globalCtx); + if ((this->unk_1D8 & 8) && (this->shnPlayerRef != NULL)) { + if (this->unk_2CA == 0) { + phi_v1 = 0; + } else { + this->unk_2CA--; + phi_v1 = this->unk_2CA; + } + if (phi_v1 == 0) { + func_80AE626C(this); + this->unk_1D8 &= ~0x20; + this->unk_1D8 |= 0x10; + return; + } + } + if (this->unk_1D8 & 0x10) { + this->unk_1D8 &= ~0x10; + this->unk_2BA = 0; + this->unk_2BC = 0; + this->unk_2CA = 20; + return; + } + if (this->unk_2CA == 0) { + phi_v1_2 = 0; + } else { + this->unk_2CA--; + phi_v1_2 = this->unk_2CA; + } + if (phi_v1_2 == 0) { + this->unk_1D8 |= 0x20; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE68F0.s") +void func_80AE6488(EnShn* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s32 tempMsgState; + f32 phi_f0_2; + f32 phi_f0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE69E8.s") + tempMsgState = Message_GetState(&globalCtx->msgCtx); + this->unk_2D4 += (this->unk_2D0 != 0.0f) ? 40.0f : -40.0f; + this->unk_2D4 = CLAMP(this->unk_2D4, 0.0f, 80.0f); + Matrix_InsertTranslation(this->unk_2D4, 0.0f, 0.0f, 1); + if ((&this->actor == player->targetActor) && + ((globalCtx->msgCtx.unk11F04 < 0xFF) || (globalCtx->msgCtx.unk11F04 >= 0x201)) && (tempMsgState == 3) && + (this->msgState == 3)) { + if (globalCtx->state.frames % 2 == 0) { + if (this->unk_2D0 != 0.0f) { + this->unk_2D0 = 0.0f; + } else { + this->unk_2D0 = 1.0f; + } + } + } else { + this->unk_2D0 = 0.0f; + } + this->msgState = tempMsgState; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6A64.s") +s32 func_80AE65F4(EnShn* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + u16 temp = globalCtx->msgCtx.unk11F04; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/EnShn_Init.s") + if (player->stateFlags1 & 0x40) { + if (this->unk_1DA != temp) { + if ((this->unk_1D8 & 0x80) || (this->unk_1D8 & 0x100)) { + this->unk_1D8 |= 8; + func_80AE615C(this, 1); + } + if (temp == 0x9C5) { + if (1) {} + this->unk_1D8 |= 8; + func_80AE615C(this, 1); + } + } + this->unk_1DA = temp; + this->unk_1D8 |= 0x40; + } else if (this->unk_1D8 & 0x40) { + if (!(gSaveContext.weekEventReg[23] & 8)) { + func_80AE615C(this, 3); + } + this->unk_1DA = 0; + this->unk_1D8 &= ~0x40; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/EnShn_Destroy.s") +s32 func_80AE6704(EnShn* thisx, GlobalContext* globalCtx) { + EnShn* this = THIS; + s32 ret = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/EnShn_Update.s") + switch (this->unk_2C6) { + case 0: + if (!CHECK_QUEST_ITEM(QUEST_UNK_19)) { + this->unk_2C6 = 6; + ret = 1; + } else { + this->unk_2C6++; + } + break; + case 1: + case 2: + case 3: + case 4: + case 5: + if (func_8013A4C4(D_80AE7258[this->unk_2C6])) { + this->unk_2C6 = 6; + ret = 1; + REMOVE_QUEST_ITEM(QUEST_UNK_19); + } else { + this->unk_2C6++; + } + break; + case 6: + gSaveContext.weekEventReg[90] &= (u8)~0x40; + func_800B7298(globalCtx, &this->actor, 7); + globalCtx->nextEntranceIndex = 0x8460; + gSaveContext.nextCutsceneIndex = 0; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 3; + gSaveContext.nextTransition = 7; + this->unk_2C6++; + break; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6CF0.s") +UNK_TYPE* func_80AE6880(EnShn* this, GlobalContext* globalCtx) { + if (this->unk_2BE != 0) { + return D_80AE70B0; + } + if (this->unk_1D8 & 0x80) { + this->unk_2D8 = func_80AE6704; + return D_80AE70B8; + } + if (this->unk_1D8 & 0x100) { + return D_80AE71C4; + } + this->unk_2D8 = func_80AE6704; + return D_80AE6F00; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6D40.s") +s32 func_80AE68F0(EnShn* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s32 ret = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/func_80AE6D90.s") + if (this->unk_1D8 & 7) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + this->unk_1D8 &= ~0x180; + if (player->exchangeItemId == EXCH_ITEM_13) { + this->unk_1D8 |= 0x80; + this->unk_2E4 = player->exchangeItemId; + } else if (player->exchangeItemId != EXCH_ITEM_NONE) { + this->unk_1D8 |= 0x100; + this->unk_2E4 = player->exchangeItemId; + } + SubS_UpdateFlags(&this->unk_1D8, 0, 7); + this->unk_1DC = func_80AE6880(this, globalCtx); + this->unk_2C6 = 0; + if (gSaveContext.weekEventReg[23] & 8) { + this->unk_1D8 |= 8; + } + this->actionFunc = func_80AE6A64; + ret = 1; + } + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Shn/EnShn_Draw.s") +void func_80AE69E8(EnShn* this, GlobalContext* globalCtx) { + Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); + if ((gSaveContext.weekEventReg[23] & 8) && EnShn_IsFacingPlayer(this)) { + this->unk_1D8 |= 8; + } else { + this->unk_1D8 &= ~0x8; + } +} + +void func_80AE6A64(EnShn* this, GlobalContext* globalCtx) { + s16 yawBetweenActors; + Vec3f playerPos; + Vec3f shnPos; + + if (func_8010BF58(&this->actor, globalCtx, this->unk_1DC, this->unk_2D8, &this->unk_1E0)) { + SubS_UpdateFlags(&this->unk_1D8, 3, 7); + this->unk_1D8 &= ~8; + this->unk_1D8 |= 0x20; + this->unk_2CA = 20; + this->unk_1E0 = 0; + this->unk_2BE = 0; + this->actionFunc = func_80AE69E8; + } else if (this->shnPlayerRef != 0) { + Math_Vec3f_Copy(&playerPos, &this->shnPlayerRef->actor.world.pos); + Math_Vec3f_Copy(&shnPos, &this->actor.world.pos); + yawBetweenActors = Math_Vec3f_Yaw(&shnPos, &playerPos); + Math_ApproachS(&this->actor.shape.rot.y, yawBetweenActors, 4, 0x2AA8); + } +} + +void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) { + EnShn* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, NULL, this->jointTable, this->morphTable, + OBJECT_SHN_LIMB_MAX); + this->unk_2E8 = -1; + if (gSaveContext.weekEventReg[23] & 8) { + func_80AE615C(this, 0); + } else { + func_80AE615C(this, 2); + } + this->actor.targetMode = 6; + Actor_SetScale(&this->actor, 0.01f); + this->unk_2E0 = 0; + this->unk_2D8 = 0; + this->unk_1D8 = 0; + if (gSaveContext.entranceIndex != 0xA820) { + SubS_UpdateFlags(&this->unk_1D8, 3, 7); + this->unk_2BE = 0; + } else { + SubS_UpdateFlags(&this->unk_1D8, 4, 7); + this->unk_2BE = 1; + } + this->actionFunc = func_80AE69E8; +} + +void EnShn_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void EnShn_Update(Actor* thisx, GlobalContext* globalCtx) { + EnShn* this = THIS; + + func_80AE68F0(this, globalCtx); + this->actionFunc(this, globalCtx); + func_80AE65F4(this, globalCtx); + func_80AE6130(this); + func_80AE63A8(this, globalCtx); + this->unk_2E0 = 0; + func_8013C964(&this->actor, globalCtx, 120.0f, 40.0f, 0, this->unk_1D8 & 7); +} + +s32 EnShn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnShn* this = THIS; + + if (limbIndex == OBJECT_SHN_LIMB_HEAD) { + func_80AE6488(this, globalCtx); + *dList = gObjectShnSwampGuideHead; + } + return false; +} + +Vec3f D_80AE7270 = { 1200.0f, 0.0f, 0.0f }; +void EnShn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + if (limbIndex == OBJECT_SHN_LIMB_HEAD) { + Matrix_MultiplyVector3fByState(&D_80AE7270, &thisx->focus.pos); + Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot); + } +} + +void EnShn_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { + EnShn* this = THIS; + s32 phi_v0; + s32 phi_v1; + + if (!(this->unk_1D8 & 0x20)) { + if (this->unk_1D8 & 0x10) { + phi_v1 = 1; + } else { + phi_v1 = 0; + } + phi_v0 = 1; + } else { + phi_v1 = 0; + phi_v0 = 0; + } + + if (limbIndex == OBJECT_SHN_LIMB_HEAD) { + func_8013AD9C((this->unk_2BA + 0x4000), (this->unk_2BC + this->actor.shape.rot.y + 0x4000), &this->unk_1E8, + &this->unk_1F4, phi_v0, phi_v1); + Matrix_StatePop(); + Matrix_InsertTranslation(this->unk_1E8.x, this->unk_1E8.y, this->unk_1E8.z, 0); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); + Matrix_RotateY(this->unk_1F4.y, 1); + Matrix_InsertXRotation_s(this->unk_1F4.x, 1); + Matrix_InsertZRotation_s(this->unk_1F4.z, 1); + Matrix_StatePush(); + } +} + +void EnShn_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnShn* this = THIS; + + func_8012C5B0(globalCtx->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnShn_OverrideLimbDraw, EnShn_PostLimbDraw, + EnShn_TransformLimbDraw, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.h b/src/overlays/actors/ovl_En_Shn/z_en_shn.h index b5d98919d9..bb54a88152 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.h +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.h @@ -2,15 +2,44 @@ #define Z_EN_SHN_H #include "global.h" +#include "objects/object_shn/object_shn.h" struct EnShn; typedef void (*EnShnActionFunc)(struct EnShn*, GlobalContext*); typedef struct EnShn { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnShnActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x1A8]; + /* 0x000 */ Actor actor; + /* 0x144 */ EnShnActionFunc actionFunc; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ UNK_TYPE1 pad_18C[0x4C]; + /* 0x1D8 */ u16 unk_1D8; + /* 0x1DA */ u16 unk_1DA; + /* 0x1DC */ UNK_TYPE* unk_1DC; + /* 0x1E0 */ s32 unk_1E0; + /* 0x1E4 */ Player* shnPlayerRef; + /* 0x1E8 */ Vec3f unk_1E8; + /* 0x1F4 */ Vec3s unk_1F4; + /* 0x1FA */ Vec3s jointTable[OBJECT_SHN_LIMB_MAX]; + /* 0x25A */ Vec3s morphTable[OBJECT_SHN_LIMB_MAX]; + /* 0x2BA */ s16 unk_2BA; + /* 0x2BC */ s16 unk_2BC; + /* 0x2BE */ s16 unk_2BE; + /* 0x2C0 */ s16 unk_2C0; + /* 0x2C2 */ s16 unk_2C2; + /* 0x2C4 */ s16 unk_2C4; + /* 0x2C6 */ s16 unk_2C6; + /* 0x2C8 */ s16 unk_2C8; + /* 0x2CA */ s16 unk_2CA; + /* 0x2CC */ f32 playSpeed; + /* 0x2D0 */ f32 unk_2D0; + /* 0x2D4 */ f32 unk_2D4; + /* 0x2D8 */ s32 unk_2D8; + /* 0x2DC */ s32 msgState; + /* 0x2E0 */ s32 unk_2E0; + /* 0x2E4 */ s32 unk_2E4; + /* 0x2E8 */ s32 unk_2E8; + /* 0x2EC */ s32 unk_2EC; } EnShn; // size = 0x2F0 extern const ActorInit En_Shn_InitVars; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 166f0377e6..4984c61609 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -814,10 +814,10 @@ void func_809964DC(EnSkb* this, GlobalContext* globalCtx) { } } -s32 func_80996544(EnSkbVec2f arg0, EnSkbVec2f arg1) { +s32 func_80996544(Vec2f arg0, Vec2f arg1) { s32 ret; - if ((arg1.x * arg0.z) < (arg0.x * arg1.z)) { + if ((arg1.x * arg0.y) < (arg0.x * arg1.y)) { ret = 1; } else { ret = -1; @@ -829,8 +829,8 @@ s32 func_80996544(EnSkbVec2f arg0, EnSkbVec2f arg1) { s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { s32 temp_s2; s32 j; - EnSkbVec2f sp60; - EnSkbVec2f sp58; + Vec2f sp60; + Vec2f sp58; s32 sp54 = true; f32 worldZ; s32 i = 0; @@ -840,9 +840,9 @@ s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { worldX = this->actor.world.pos.x; sp60.x = D_80997468[0].z - worldZ; - sp60.z = D_80997468[0].x - worldX; + sp60.y = D_80997468[0].x - worldX; sp58.x = D_80997468[1].z - worldZ; - sp58.z = D_80997468[1].x - worldX; + sp58.y = D_80997468[1].x - worldX; j = 1; temp_s2 = func_80996544(sp60, sp58); @@ -856,9 +856,9 @@ s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { j = 0; } sp60.x = D_80997468[i].z - worldZ; - sp60.z = D_80997468[i].x - worldX; + sp60.y = D_80997468[i].x - worldX; sp58.x = D_80997468[j].z - worldZ; - sp58.z = D_80997468[j].x - worldX; + sp58.y = D_80997468[j].x - worldX; if (func_80996544(sp60, sp58) != temp_s2) { sp54 = false; break; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 59186808dc..0e31345610 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -9,11 +9,6 @@ typedef void (*EnSkbActionFunc)(struct EnSkb*, GlobalContext*); #define ENSKB_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) -typedef struct { - f32 x; - f32 z; -} EnSkbVec2f; - typedef struct EnSkb { /* 0x0000 */ Actor actor; /* 0x0144 */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index c05c589be3..ecf1f814be 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1255,7 +1255,7 @@ s16 EnSob1_GetXZAngleAndDistanceSqToPoint(Path* path, s32 pointIdx, Vec3f* pos, f32 diffZ; if (path != NULL) { - points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + points = Lib_SegmentedToVirtual(path->points); points = &points[pointIdx]; diffX = points->x - pos->x; diffZ = points->z - pos->z; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index fbd391f32a..4c0983545e 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -151,8 +151,8 @@ s32 EnSsh_CheckCeilingPos(EnSsh* this, GlobalContext* globalCtx) { posB.x = this->actor.world.pos.x; posB.y = this->actor.world.pos.y + 1000.0f; posB.z = this->actor.world.pos.z; - if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, 0, 0, 1, - 1, &bgId)) { + if (!BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &posB, &this->ceilingPos, &poly, false, + false, true, true, &bgId)) { return false; } return true; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 07b1df03fb..733ecb8a66 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -510,7 +510,7 @@ s16 func_80BAB698(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { f32 diffZ; if (path != NULL) { - points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + points = Lib_SegmentedToVirtual(path->points); points = &points[idx]; diffX = points->x - pos->x; diffZ = points->z - pos->z; @@ -691,7 +691,7 @@ s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg if ((sp48 == NULL) || (this->unk404 == NULL)) { return 0; } - sp28 = (Vec3s*)Lib_SegmentedToVirtual(this->unk404->points); + sp28 = Lib_SegmentedToVirtual(this->unk404->points); Math_Vec3s_ToVec3f(&sp38, &sp28[0]); Math_Vec3s_ToVec3f(&sp2C, &sp28[1]); this->unk434 = sp44 - unkStruct->unk4; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index abf7b3a407..14e4dfc8b6 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -921,7 +921,7 @@ void func_808DAA60(EnSw* this, GlobalContext* globalCtx) { Vec3f sp34; f32 temp_f16; - sp44 = (Vec3s*)Lib_SegmentedToVirtual(this->unk_1E4->points); + sp44 = Lib_SegmentedToVirtual(this->unk_1E4->points); sp40 = 0; if (DECR(this->unk_454) == 0) { 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 ca3e3d6942..1b6397f25e 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 @@ -5,6 +5,8 @@ */ #include "z_en_syateki_crow.h" +#include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" +#include "objects/object_crow/object_crow.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) @@ -15,7 +17,15 @@ void EnSyatekiCrow_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSyatekiCrow_Update(Actor* thisx, GlobalContext* globalCtx); void EnSyatekiCrow_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_809CA5D4(EnSyatekiCrow* this); +void func_809CA67C(EnSyatekiCrow* this, GlobalContext* globalCtx); +void func_809CA71C(EnSyatekiCrow* this); +void func_809CA840(EnSyatekiCrow* this, GlobalContext* globalCtx); +void func_809CA8E4(EnSyatekiCrow* this, GlobalContext* globalCtx); +void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx); + +static Vec3f D_809CB050 = { 0.0f, 0.0f, 0.0f }; + const ActorInit En_Syateki_Crow_InitVars = { ACTOR_EN_SYATEKI_CROW, ACTORCAT_ENEMY, @@ -28,60 +38,287 @@ const ActorInit En_Syateki_Crow_InitVars = { (ActorFunc)EnSyatekiCrow_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_809CB07C[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 1, { { 0, 60, 0 }, 50 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_809CB0A0 = { - { COLTYPE_HIT3, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, D_809CB07C, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 1, + sJntSphElementsInit, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_809CB0B0[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 3000, ICHAIN_CONTINUE), ICHAIN_S8(hintId, 88, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -#endif +static Vec3f D_809CB0C0 = { 0.0f, 20.0f, 0.0f }; -extern ColliderJntSphElementInit D_809CB07C[1]; -extern ColliderJntSphInit D_809CB0A0; -extern InitChainEntry D_809CB0B0[]; +static Vec3f D_809CB0CC = { 0.0f, 0.0f, 0.0f }; -extern UNK_TYPE D_060000F0; +static Vec3f D_809CB0D8 = { 2500.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/EnSyatekiCrow_Init.s") +void EnSyatekiCrow_Init(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + EnSyatekiCrow* this = THIS; + Path* path; + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + s32 temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/EnSyatekiCrow_Destroy.s") + path = syatekiMan->path; + while (path->unk2 != 0) { + path = &globalCtx->setupPathList[path->unk1]; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CA5D4.s") + temp = 0; + while (temp < EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)) { + temp++; + path = &globalCtx->setupPathList[path->unk1]; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CA67C.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_crow_Skel_0010C0, &object_crow_Anim_0000F0, + this->jointTable, this->morphTable, 9); + Collider_InitJntSph(globalCtx, &this->unk_23C); + Collider_SetJntSph(globalCtx, &this->unk_23C, &this->actor, &sJntSphInit, &this->unk_25C); + this->unk_23C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; + ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CA71C.s") + if ((path == NULL) || (EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor) >= 0x80)) { + Actor_MarkForDeath(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CA840.s") + this->unk_1C8 = Lib_SegmentedToVirtual(path->points); + this->unk_1CC = 1; + this->unk_1CE = path->count; + this->unk_1C4 = 0x14; + this->unk_1BC = 0; + func_809CA5D4(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CA8E4.s") +void EnSyatekiCrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnSyatekiCrow* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CAAF8.s") + Collider_DestroyJntSph(globalCtx, &this->unk_23C); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CABC0.s") +void func_809CA5D4(EnSyatekiCrow* this) { + Actor_SetScale(&this->actor, 0.03f); + this->actor.speedXZ = 0.0f; + this->actor.gravity = 0.0f; + this->actor.world = this->actor.home; + this->actor.prevPos = this->actor.home.pos; + this->actor.shape.rot = this->actor.world.rot; + this->unk_1CC = 1; + this->actor.draw = NULL; + this->actionFunc = func_809CA67C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CACD0.s") +void func_809CA67C(EnSyatekiCrow* this, GlobalContext* globalCtx) { + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/EnSyatekiCrow_Update.s") + if ((syatekiMan->unk_26A == 1) && (this->unk_1C2 == 1) && + (syatekiMan->unk_274 & (1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)))) { + func_809CA71C(this); + } else if (syatekiMan->unk_26A != 1) { + this->unk_1C2 = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CAE5C.s") + if ((syatekiMan->unk_274 == 0) && (syatekiMan->unk_274 == 0)) { + this->unk_1C2 = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/func_809CAF2C.s") +void func_809CA71C(EnSyatekiCrow* this) { + Vec3f sp24; + s16 temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Crow/EnSyatekiCrow_Draw.s") + this->actor.world.pos.x = this->unk_1C8[0].x; + this->actor.world.pos.y = this->unk_1C8[0].y; + this->actor.world.pos.z = this->unk_1C8[0].z; + sp24.x = this->unk_1C8[this->unk_1CC].x; + sp24.y = this->unk_1C8[this->unk_1CC].y; + sp24.z = this->unk_1C8[this->unk_1CC].z; + temp = Math_Vec3f_Yaw(&this->actor.world.pos, &sp24); + this->actor.world.rot.y = temp; + this->actor.shape.rot.y = temp; + temp = Math_Vec3f_Pitch(&this->actor.world.pos, &sp24); + this->actor.shape.rot.x = temp; + this->actor.world.rot.x = temp; + this->actor.draw = EnSyatekiCrow_Draw; + this->actionFunc = func_809CA840; +} + +void func_809CA840(EnSyatekiCrow* this, GlobalContext* globalCtx) { + if (((EN_SYATEKI_CROW_GET_PARAM_F(&this->actor) * 20) + 20) < this->unk_1BC) { + Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_KAICHO_CRY); + this->unk_1BC = 0; + this->actor.speedXZ = EN_SYATEKI_CROW_GET_PARAM_F0(&this->actor) + 6.0f; + this->actor.gravity = -0.5f; + this->actionFunc = func_809CA8E4; + } else { + this->unk_1BC++; + } +} + +void func_809CA8E4(EnSyatekiCrow* this, GlobalContext* globalCtx) { + Vec3f sp34; + f32 sp30; + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + + if (syatekiMan->unk_26A != 1) { + func_809CA5D4(this); + return; + } + + sp34.x = this->unk_1C8[this->unk_1CC].x; + sp34.y = this->unk_1C8[this->unk_1CC].y; + sp34.z = this->unk_1C8[this->unk_1CC].z; + + sp30 = Math_Vec3f_DistXZ(&this->actor.world.pos, &sp34); + this->unk_1C0 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34); + this->unk_1BE = Math_Vec3f_Pitch(&this->actor.world.pos, &sp34); + + if (sp30 > 100.0f) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_1C0, 5, 0x3000, 0x100); + this->actor.shape.rot.y = this->actor.world.rot.y; + Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk_1BE, 5, 0x3000, 0x100); + this->actor.world.rot.x = -this->actor.shape.rot.x; + } else if (this->unk_1CC < (this->unk_1CE - 1)) { + this->unk_1CC++; + } else { + this->unk_1C2 = 0; + syatekiMan->unk_274 &= ~(1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)); + func_809CA5D4(this); + } + + SkelAnime_Update(&this->skelAnime); + this->actor.shape.yOffset = (fabsf(this->skelAnime.curFrame - 3.0f) * 150.0f) + 1700.0f; + if ((syatekiMan->unk_26C % 90) == 0) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); + } +} + +void func_809CAAF8(EnSyatekiCrow* this) { + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + + syatekiMan->unk_280 += 60; + this->unk_1C2 = 0; + this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); + this->actor.velocity.y = 0.0f; + Animation_Change(&this->skelAnime, &object_crow_Anim_0000F0, 0.4f, 0.0f, 0.0f, 1, -3.0f); + this->actor.bgCheckFlags &= ~1; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + this->actionFunc = func_809CABC0; +} + +void func_809CABC0(EnSyatekiCrow* this, GlobalContext* globalCtx) { + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + this->actor.colorFilterTimer = 40; + + if (this->actor.colorFilterParams & 0x4000) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); + this->actor.shape.rot.z += 0x1780; + } + + if (this->unk_1C4 > 20) { + func_800B3030(globalCtx, &this->actor.world.pos, &D_809CB050, &D_809CB050, this->actor.scale.x * 10000.0f, 0, + 0); + syatekiMan->unk_27A++; + syatekiMan->unk_274 &= ~(1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)); + func_809CA5D4(this); + } + + this->unk_1C4++; +} + +void func_809CACD0(EnSyatekiCrow* this, GlobalContext* globalCtx) { + if (this->actionFunc == func_809CA8E4) { + if (this->unk_23C.base.acFlags & AC_HIT) { + play_sound(NA_SE_SY_TRE_BOX_APPEAR); + this->unk_1C4 = 0; + this->unk_23C.base.acFlags &= ~AC_HIT; + EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_809CB0C0, &D_809CB0CC, 5, 1); + func_809CAAF8(this); + } else { + this->unk_23C.elements->dim.worldSphere.center.x = this->actor.world.pos.x; + this->unk_23C.elements->dim.worldSphere.center.y = + sJntSphInit.elements[0].dim.modelSphere.center.y + this->actor.world.pos.y; + this->unk_23C.elements->dim.worldSphere.center.z = this->actor.world.pos.z; + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_23C.base); + } + } +} + +void EnSyatekiCrow_Update(Actor* thisx, GlobalContext* globalCtx) { + EnSyatekiCrow* this = THIS; + + this->actionFunc(this, globalCtx); + + if (this->actionFunc != func_809CABC0) { + Actor_MoveWithoutGravity(&this->actor); + } else { + Actor_MoveWithGravity(&this->actor); + } + + func_809CACD0(this, globalCtx); +} + +s32 EnSyatekiCrow_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnSyatekiCrow* this = THIS; + + if (limbIndex == 7) { + rot->y += (s16)(3072.0f * sin_rad(this->skelAnime.curFrame * 0.7853982f)); + } else if (limbIndex == 8) { + rot->y += (s16)(5120.0f * sin_rad((this->skelAnime.curFrame + 2.5f) * 0.7853982f)); + } + + return false; +} + +void EnSyatekiCrow_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnSyatekiCrow* this = THIS; + Vec3f* sp1C; + + if (limbIndex == 2) { + Matrix_MultiplyVector3fByState(&D_809CB0D8, &this->unk_144[0]); + this->unk_144[0].y -= 20.0f; + } else if ((limbIndex == 4) || (limbIndex == 6) || (limbIndex == 8)) { + sp1C = &this->unk_144[(limbIndex >> 1) - 1]; + Matrix_MultiplyVector3fByState(&D_809CB050, sp1C); + sp1C->y -= 20.0f; + } +} + +void EnSyatekiCrow_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnSyatekiCrow* this = THIS; + + func_8012C28C(globalCtx->state.gfxCtx); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnSyatekiCrow_OverrideLimbDraw, EnSyatekiCrow_PostLimbDraw, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index 48c9305ddd..8946e213fb 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -3,15 +3,31 @@ #include "global.h" +#define EN_SYATEKI_CROW_GET_PARAM_F(thisx) ((thisx)->params & 0xF) +#define EN_SYATEKI_CROW_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_CROW_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) + struct EnSyatekiCrow; typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, GlobalContext*); typedef struct EnSyatekiCrow { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x74]; - /* 0x01B8 */ EnSyatekiCrowActionFunc actionFunc; - /* 0x01BC */ char unk_1BC[0xE0]; + /* 0x000 */ Actor actor; + /* 0x144 */ Vec3f unk_144[4]; + /* 0x174 */ SkelAnime skelAnime; + /* 0x1B8 */ EnSyatekiCrowActionFunc actionFunc; + /* 0x1BC */ s16 unk_1BC; + /* 0x1BE */ s16 unk_1BE; + /* 0x1C0 */ s16 unk_1C0; + /* 0x1C2 */ s16 unk_1C2; + /* 0x1C4 */ s16 unk_1C4; + /* 0x1C8 */ Vec3s* unk_1C8; + /* 0x1CC */ s16 unk_1CC; + /* 0x1CE */ s16 unk_1CE; + /* 0x1D0 */ Vec3s jointTable[9]; + /* 0x206 */ Vec3s morphTable[9]; + /* 0x23C */ ColliderJntSph unk_23C; + /* 0x25C */ ColliderJntSphElement unk_25C; } EnSyatekiCrow; // size = 0x29C extern const ActorInit En_Syateki_Crow_InitVars; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index d461712e2f..ae1f01934e 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -132,11 +132,11 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_shn_Skel_00E7D0, &object_shn_Anim_00DFEC, - this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, &object_shn_Anim_00DFEC, this->jointTable, + this->morphTable, OBJECT_SHN_LIMB_MAX); } else { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_shn_Skel_00E7D0, &object_shn_Anim_00D9D0, - this->jointTable, this->morphTable, 16); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, &object_shn_Anim_00D9D0, this->jointTable, + this->morphTable, OBJECT_SHN_LIMB_MAX); } this->actor.colChkInfo.cylRadius = 100; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 4dfaa44d09..a22faeb59e 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -5,6 +5,8 @@ */ #include "z_en_tab.h" +#include "objects/gameplay_keep/gameplay_keep.h" +#include "objects/object_tab/object_tab.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -18,7 +20,39 @@ void EnTab_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80BE127C(EnTab* this, GlobalContext* globalCtx); void func_80BE1348(EnTab* this, GlobalContext* globalCtx); -#if 0 +s32 D_80BE18D0[] = { + 0x0C000320, 0x0A00151B, 0x02093212, 0x010F0212, 0x00060003, 0x0400000E, 0x12000600, 0x020E0932, 0x12010105, + 0x0A001519, 0x02093215, 0x050D0215, 0x37050501, 0x050E1537, 0x0505020E, 0x09321505, 0x01050000, +}; + +s32 D_80BE1914[] = { + 0x003A0200, 0x080E2AF9, 0x0C113A02, 0x100E2AFA, 0x0C150900, 0x000E2AFB, + 0x0C003401, 0x00090F2A, 0xFD0C0F2A, 0xFE0C100F, 0x2AFC0C10, +}; + +s32 D_80BE1940[] = { + 0x003F0400, 0x080E2B3D, 0x0C113F04, 0x100E2B3E, 0x0C0F2AFA, 0x0C150900, + 0x000E2AFB, 0x0C003401, 0x00090F2A, 0xFD0C0F2A, 0xFE0C100F, 0x2AFC0C10, +}; + +s32 D_80BE1970[] = { 0x003A0100, 0x080E2AFF, 0x0C113A01, 0x100E2B00, 0x0C100000 }; + +s32 D_80BE1984[] = { 0x00500100, 0x080E2B3F, 0x0C115001, 0x100E2B40, 0x0C100000 }; + +s32 D_80BE1998[] = { 0x0E2B090C, 0x10000000 }; + +s32 D_80BE19A0[] = { + 0x0E2B0A0C, 0x05004E00, 0x00004E30, 0x2800050E, 0x2B0E0C10, 0x0E2B0B0C, 0x05000000, 0x08001008, 0x00140026, + 0x19000E08, 0x00C8000F, 0x19000631, 0x0E2B0D0C, 0x10320E2B, 0x0C0C1030, 0x1214FF38, 0x06009100, 0x00130091, + 0x0C103012, 0x14FFEC06, 0x00920000, 0x1300920C, 0x10300034, 0x0100050E, 0x2B0F0C10, 0x0E2B110C, 0x10000000, +}; + +s32 D_80BE1A0C[] = { + 0x0E2B0A0C, 0x05004E00, 0x00004E30, 0x2800050E, 0x2B0E0C10, 0x0E2B0B0C, 0x05000000, 0x08001008, 0x00140026, + 0x19000E08, 0x00C8000F, 0x19000631, 0x0E2B0D0C, 0x10320E2B, 0x0C0C1030, 0x1214FF38, 0x06009100, 0x00130091, + 0x0C103012, 0x14FFEC06, 0x00920000, 0x1300920C, 0x10300034, 0x0100050E, 0x2B100C10, 0x0E2B110C, 0x10000000, +}; + const ActorInit En_Tab_InitVars = { ACTOR_EN_TAB, ACTORCAT_NPC, @@ -31,75 +65,555 @@ const ActorInit En_Tab_InitVars = { (ActorFunc)EnTab_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BE1A98 = { - { COLTYPE_HIT1, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT1, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 14, 62, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80BE1AC4 = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -#endif +AnimationInfoS D_80BE1AD0[] = { + { &object_tab_Anim_000758, 1.0f, 0, -1, 0, 0 }, + { &object_tab_Anim_0086AC, 1.0f, 0, -1, 0, 0 }, +}; -extern ColliderCylinderInit D_80BE1A98; -extern CollisionCheckInfoInit2 D_80BE1AC4; +Vec3f D_80BE1AF0 = { -28.0f, -8.0f, -195.0f }; -extern UNK_TYPE D_06007F78; +Vec3s D_80BE1AFC = { 0, 0, 0 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE04E0.s") +Vec3f D_80BE1B04 = { 161.0f, 0.0f, -10.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0590.s") +Vec3s D_80BE1B10 = { 0, 0xC000, 0 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE05BC.s") +Vec3f D_80BE1B18 = { 800.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0620.s") +TexturePtr D_80BE1B24[] = { + object_tab_Tex_006428, + object_tab_Tex_006928, + object_tab_Tex_006D28, + object_tab_Tex_006928, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0664.s") +EnGm* func_80BE04E0(EnTab* this, GlobalContext* globalCtx, u8 actorCat, s16 actorId) { + Actor* foundActor = NULL; + Actor* tempActor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE06DC.s") + while (true) { + foundActor = SubS_FindActor(globalCtx, foundActor, actorCat, actorId); + if ((foundActor == NULL) || (((EnTab*)foundActor != this) && (foundActor->update != NULL))) { + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0778.s") + tempActor = foundActor->next; + if (tempActor == NULL) { + foundActor = NULL; + break; + } + foundActor = tempActor; + }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE07A0.s") + return (EnGm*)foundActor; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE09A8.s") +void func_80BE0590(EnTab* this) { + this->skelAnime.playSpeed = this->unk_300; + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0A98.s") +s32 func_80BE05BC(EnTab* this, s32 arg1) { + s32 phi_v0 = false; + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0C04.s") + if (arg1 != this->unk_32C) { + phi_v0 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0D38.s") + if (phi_v0) { + this->unk_32C = arg1; + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80BE1AD0, arg1); + this->unk_300 = this->skelAnime.playSpeed; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0D60.s") +void func_80BE0620(EnTab* this, GlobalContext* globalCtx) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0E04.s") + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0F04.s") +void func_80BE0664(EnTab* this) { + if (DECR(this->unk_31C) == 0) { + this->unk_31E++; + if (this->unk_31E > 3) { + this->unk_31C = Rand_S16Offset(30, 30); + this->unk_31E = 0; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE0FC4.s") +s32 func_80BE06DC(EnTab* this, GlobalContext* globalCtx) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE1060.s") + if (this->unk_2FC & 7) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + SubS_UpdateFlags(&this->unk_2FC, 0, 7); + ret = true; + this->unk_320 = 0; + this->unk_328 = NULL; + this->actor.child = &GET_PLAYER(globalCtx)->actor; + this->unk_2FC |= 8; + this->actionFunc = func_80BE1348; + } + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE10BC.s") +Actor* func_80BE0778(EnTab* this, GlobalContext* globalCtx) { + Actor* actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE1224.s") + if (this->unk_1D8 == 1) { + actor = this->actor.child; + } else { + actor = &GET_PLAYER(globalCtx)->actor; + } + return actor; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE127C.s") +void func_80BE07A0(EnTab* this) { + s32 pad; + Vec3f sp40; + Vec3f sp34; + s16 sp32; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE1348.s") + Math_Vec3f_Copy(&sp40, &this->unk_1E0->world.pos); + Math_Vec3f_Copy(&sp34, &this->actor.world.pos); + sp32 = Math_Vec3f_Yaw(&sp34, &sp40); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/EnTab_Init.s") + Math_ApproachS(&this->unk_314, (sp32 - this->unk_318) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_314 = CLAMP(this->unk_314, -0x1FFE, 0x1FFE); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/EnTab_Destroy.s") + Math_ApproachS(&this->unk_318, (sp32 - this->unk_314) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_318 = CLAMP(this->unk_318, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/EnTab_Update.s") + Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); + if (this->unk_1E0->id == ACTOR_PLAYER) { + sp40.y = ((Player*)this->unk_1E0)->bodyPartsPos[7].y + 3.0f; + } else { + Math_Vec3f_Copy(&sp40, &this->unk_1E0->focus.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE1648.s") + Math_ApproachS(&this->unk_312, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_316, 4, 0x2AA8); + this->unk_312 = CLAMP(this->unk_312, -0x1554, 0x1554); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE16B4.s") + Math_ApproachS(&this->unk_316, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_312, 4, 0x2AA8); + this->unk_316 = CLAMP(this->unk_316, -0xE38, 0xE38); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/func_80BE1704.s") +void func_80BE09A8(EnTab* this, GlobalContext* globalCtx) { + this->unk_1E0 = func_80BE0778(this, globalCtx); + if ((this->unk_2FC & 8) && (this->unk_1E0 != 0) && (DECR(this->unk_324) == 0)) { + func_80BE07A0(this); + this->unk_316 = 0; + this->unk_318 = 0; + this->unk_2FC &= ~0x40; + this->unk_2FC |= 0x10; + } else if (this->unk_2FC & 0x10) { + this->unk_2FC &= ~0x10; + this->unk_312 = 0; + this->unk_314 = 0; + this->unk_316 = 0; + this->unk_318 = 0; + this->unk_324 = 20; + } else if (DECR(this->unk_324) == 0) { + this->unk_2FC |= 0x40; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tab/EnTab_Draw.s") +void func_80BE0A98(EnTab* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s32 sp20 = Message_GetState(&globalCtx->msgCtx); + + this->unk_308 += (this->unk_304 != 0.0f) ? 40.0f : -40.0f; + this->unk_308 = CLAMP(this->unk_308, 0.0f, 80.0f); + + Matrix_InsertTranslation(this->unk_308, 0.0f, 0.0f, MTXMODE_APPLY); + + if ((&this->actor == player->targetActor) && + ((globalCtx->msgCtx.unk11F04 < 0xFF) || (globalCtx->msgCtx.unk11F04 > 0x200)) && (sp20 == 3) && + (this->unk_334 == 3)) { + if ((globalCtx->state.frames % 2) == 0) { + if (this->unk_304 != 0.0f) { + this->unk_304 = 0.0f; + } else { + this->unk_304 = 1.0f; + } + } + } else { + this->unk_304 = 0.0f; + } + this->unk_334 = sp20; +} + +s32 func_80BE0C04(EnTab* this, Actor* actor, f32 arg2) { + Vec3f sp44; + Vec3f sp38; + s32 ret = false; + f32 sp30; + s16 sp2E; + + if (actor != NULL) { + Math_Vec3f_Copy(&sp38, &this->actor.world.pos); + Math_Vec3f_Copy(&sp44, &actor->world.pos); + sp2E = Math_Vec3f_Yaw(&sp38, &sp44); + + if (this->unk_338) { + sp30 = arg2; + } else { + sp30 = arg2 * 0.5f; + } + if ((Math_Vec3f_DistXZ(&sp44, &sp38) < sp30) && (ABS_ALT(BINANG_SUB(sp2E, this->actor.shape.rot.y)) < 0x38E0)) { + ret = true; + } + + if (DECR(this->unk_322) == 0) { + this->unk_338 ^= true; + this->unk_322 = Rand_S16Offset(60, 60); + } + } + return ret; +} + +s32 func_80BE0D38(EnTab* this, GlobalContext* globalCtx) { + return Interface_HasEmptyBottle(); +} + +s32 func_80BE0D60(EnTab* this, GlobalContext* globalCtx) { + s32 pad; + s32 ret = false; + + this->unk_320++; + if (this->unk_320 == 1) { + globalCtx->setPlayerTalkAnim(globalCtx, &gameplay_keep_Linkanim_00D568, 2); + } else if (this->unk_320 > 20) { + globalCtx->setPlayerTalkAnim(globalCtx, NULL, 0); + this->unk_320 = 0; + ret = true; + } + return ret; +} + +s32* func_80BE0E04(EnTab* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (player->transformation == PLAYER_FORM_DEKU) { + return D_80BE1984; + } + + switch (this->unk_1D8) { + case 2: + this->unk_328 = func_80BE0D38; + if (Player_GetMask(globalCtx) != PLAYER_MASK_ROMANI) { + return D_80BE1998; + } + + if (gSaveContext.day == 3) { + return D_80BE1A0C; + } + return D_80BE19A0; + + case 1: + this->unk_328 = func_80BE0D60; + if (Player_GetMask(globalCtx) == PLAYER_MASK_ROMANI) { + return D_80BE1940; + } + + if (Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) { + return D_80BE1970; + } + return D_80BE1914; + } + + return NULL; +} + +s32 func_80BE0F04(EnTab* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { + s32 ret = false; + EnGm* sp28 = func_80BE04E0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_GM); + + if (sp28) { + Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1AF0); + Math_Vec3s_Copy(&this->actor.world.rot, &D_80BE1AFC); + Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); + this->actor.targetMode = 0; + SubS_UpdateFlags(&this->unk_2FC, 3, 7); + this->unk_2FC |= (0x40 | 0x20); + this->unk_30C = 30; + this->unk_1E4 = sp28; + func_80BE05BC(this, 0); + ret = true; + } + return ret; +} + +s32 func_80BE0FC4(EnTab* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { + s32 pad; + + Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1B04); + Math_Vec3s_Copy(&this->actor.world.rot, &D_80BE1B10); + Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); + this->actor.targetMode = 6; + SubS_UpdateFlags(&this->unk_2FC, 3, 7); + this->unk_2FC |= (0x40 | 0x20); + this->unk_30C = 0x50; + func_80BE05BC(this, 1); + return true; +} + +s32 func_80BE1060(EnTab* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { + s32 ret; + + this->unk_2FC = 0; + + switch (arg2->unk0) { + case 1: + ret = func_80BE0F04(this, globalCtx, arg2); + break; + + case 2: + ret = func_80BE0FC4(this, globalCtx, arg2); + break; + + default: + ret = false; + break; + } + return ret; +} + +s32 func_80BE10BC(EnTab* this, GlobalContext* globalCtx) { + s32 pad; + Player* player = GET_PLAYER(globalCtx); + f32 dist; + Actor* tempActor; + + switch (this->unk_1D8) { + case 1: + if ((player->stateFlags1 & 0x40) && !(globalCtx->msgCtx.unk11F04 <= 0x2B00) && + (globalCtx->msgCtx.unk11F04 < 0x2B08)) { + this->actor.child = &this->unk_1E4->actor; + this->unk_2FC |= 8; + } else { + dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_1E4->actor.world.pos); + + if ((gSaveContext.weekEventReg[75] & 1) || (this->unk_1E4->actor.draw == NULL) || !(dist < 160.0f)) { + tempActor = &GET_PLAYER(globalCtx)->actor; + this->actor.child = tempActor; + } else { + tempActor = &this->unk_1E4->actor; + this->actor.child = tempActor; + } + + if (func_80BE0C04(this, tempActor, 160.0f)) { + this->unk_2FC |= 8; + } else { + this->unk_2FC &= ~8; + } + } + break; + + case 2: + if (func_80BE0C04(this, &GET_PLAYER(globalCtx)->actor, 200.0f)) { + this->unk_2FC |= 8; + } else { + this->unk_2FC &= ~8; + } + break; + } + + return false; +} + +void func_80BE1224(EnTab* this, GlobalContext* globalCtx) { + if ((this->unk_1D8 == 1) || (this->unk_1D8 == 2)) { + func_80BE10BC(this, globalCtx); + } + Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); +} + +void func_80BE127C(EnTab* this, GlobalContext* globalCtx) { + u32* unk_14 = &gSaveContext.unk_14; + struct_80133038_arg2 sp18; + + this->unk_31A = REG(15) + *unk_14; + + if (!func_80133038(globalCtx, D_80BE18D0, &sp18) || + ((this->unk_1D8 != sp18.unk0) && !func_80BE1060(this, globalCtx, &sp18))) { + this->actor.shape.shadowDraw = NULL; + this->actor.flags &= ~ACTOR_FLAG_1; + sp18.unk0 = 0; + } else { + this->actor.shape.shadowDraw = ActorShadow_DrawCircle; + this->actor.flags |= ACTOR_FLAG_1; + } + this->unk_1D8 = sp18.unk0; + func_80BE1224(this, globalCtx); +} + +void func_80BE1348(EnTab* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f sp40; + Vec3f sp34; + + if (func_8010BF58(&this->actor, globalCtx, func_80BE0E04(this, globalCtx), this->unk_328, &this->unk_1DC)) { + SubS_UpdateFlags(&this->unk_2FC, 3, 7); + this->unk_2FC &= ~8; + this->unk_2FC |= 0x40; + this->unk_324 = 20; + this->unk_1DC = 0; + this->actionFunc = func_80BE127C; + } else if (this->unk_1E0 != 0) { + Math_Vec3f_Copy(&sp40, &this->unk_1E0->world.pos); + Math_Vec3f_Copy(&sp34, &this->actor.world.pos); + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp34, &sp40), 4, 0x2AA8); + } +} + +void EnTab_Init(Actor* thisx, GlobalContext* globalCtx) { + EnTab* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_tab_Skel_007F78, NULL, this->jointTable, this->morphTable, + 20); + this->unk_32C = -1; + func_80BE05BC(this, 0); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + Actor_SetScale(&this->actor, 0.01f); + + this->unk_1D8 = 0; + this->unk_328 = NULL; + this->unk_2FC = 0; + this->unk_2FC |= 0x40; + this->actor.gravity = -1.0f; + + this->actionFunc = func_80BE127C; + this->actionFunc(this, globalCtx); +} + +void EnTab_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnTab* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void EnTab_Update(Actor* thisx, GlobalContext* globalCtx) { + EnTab* this = THIS; + f32 radius; + f32 height; + + func_80BE06DC(this, globalCtx); + + this->actionFunc(this, globalCtx); + + if (this->unk_1D8 != 0) { + func_80BE0590(this); + func_80BE0664(this); + func_80BE09A8(this, globalCtx); + + radius = this->collider.dim.radius + this->unk_30C; + height = this->collider.dim.height + 10; + + func_8013C964(&this->actor, globalCtx, radius, height, 0, this->unk_2FC & 7); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); + func_80BE0620(this, globalCtx); + } +} + +s32 EnTab_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnTab* this = THIS; + + if (limbIndex == 9) { + func_80BE0A98(this, globalCtx); + } + + if ((this->unk_32C == 1) && (limbIndex == 18)) { + *dList = NULL; + } + return false; +} + +void EnTab_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnTab* this = THIS; + + if (limbIndex == 9) { + Matrix_MultiplyVector3fByState(&D_80BE1B18, &this->actor.focus.pos); + Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); + } +} + +void EnTab_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { + EnTab* this = THIS; + s32 phi_v0; + s32 phi_v1; + + if (!(this->unk_2FC & 0x40)) { + if (this->unk_2FC & 0x10) { + phi_v1 = 1; + } else { + phi_v1 = 0; + } + phi_v0 = 1; + } else { + phi_v1 = 0; + phi_v0 = 0; + } + + if (limbIndex == 9) { + func_8013AD9C(BINANG_ADD(this->unk_312 + this->unk_316, 0x4000), + BINANG_ADD(this->unk_314 + this->unk_318 + this->actor.shape.rot.y, 0x4000), this->unk_1E8, + this->unk_200, phi_v0, phi_v1); + Matrix_StatePop(); + Matrix_InsertTranslation(this->unk_1E8[0].x, this->unk_1E8[0].y, this->unk_1E8[0].z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateY(this->unk_200[0].y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->unk_200[0].x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->unk_200[0].z, MTXMODE_APPLY); + Matrix_StatePush(); + } +} + +void EnTab_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnTab* this = THIS; + + if (this->unk_1D8 != 0) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BE1B24[this->unk_31E])); + + SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnTab_OverrideLimbDraw, EnTab_PostLimbDraw, + EnTab_TransformDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } +} diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.h b/src/overlays/actors/ovl_En_Tab/z_en_tab.h index 45f6a057d9..266949fe8e 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.h +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.h @@ -2,16 +2,47 @@ #define Z_EN_TAB_H #include "global.h" +#include "overlays/actors/ovl_En_Gm/z_en_gm.h" struct EnTab; typedef void (*EnTabActionFunc)(struct EnTab*, GlobalContext*); +typedef s32 (*EnTabUnkFunc)(struct EnTab*, GlobalContext*); typedef struct EnTab { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x44]; + /* 0x0144 */ SkelAnime skelAnime; /* 0x0188 */ EnTabActionFunc actionFunc; - /* 0x018C */ char unk_18C[0x1B0]; + /* 0x018C */ ColliderCylinder collider; + /* 0x01D8 */ u8 unk_1D8; + /* 0x01DC */ s32 unk_1DC; + /* 0x01E0 */ Actor* unk_1E0; + /* 0x01E4 */ EnGm* unk_1E4; + /* 0x01E8 */ Vec3f unk_1E8[2]; + /* 0x0200 */ Vec3s unk_200[2]; + /* 0x020C */ Vec3s jointTable[20]; + /* 0x0284 */ Vec3s morphTable[20]; + /* 0x02FC */ u16 unk_2FC; + /* 0x0300 */ f32 unk_300; + /* 0x0304 */ f32 unk_304; + /* 0x0308 */ f32 unk_308; + /* 0x030C */ s16 unk_30C; + /* 0x030E */ UNK_TYPE1 unk30E[4]; + /* 0x0312 */ s16 unk_312; + /* 0x0314 */ s16 unk_314; + /* 0x0316 */ s16 unk_316; + /* 0x0318 */ s16 unk_318; + /* 0x031A */ s16 unk_31A; + /* 0x031C */ s16 unk_31C; + /* 0x031E */ s16 unk_31E; + /* 0x0320 */ s16 unk_320; + /* 0x0322 */ s16 unk_322; + /* 0x0324 */ s16 unk_324; + /* 0x0328 */ EnTabUnkFunc unk_328; + /* 0x032C */ s32 unk_32C; + /* 0x0330 */ UNK_TYPE1 unk330[4]; + /* 0x0334 */ s32 unk_334; + /* 0x0338 */ s32 unk_338; } EnTab; // size = 0x33C extern const ActorInit En_Tab_InitVars; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 7913231237..6886d2b29e 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -399,9 +399,9 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { func_80A41FA4(this, globalCtx); } else { gSaveContext.unk_3F64 = 0.0f; - func_80169DCC(globalCtx, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, - &player->unk_3C0, player->unk_3CC); - func_80169EFC(globalCtx); + Play_SetRespawnData(&globalCtx->state, 0, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, 0xBFF, + &player->unk_3C0, player->unk_3CC); + func_80169EFC(&globalCtx->state); if (player->stateFlags1 & 0x800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; @@ -440,16 +440,16 @@ void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && ((gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (globalCtx->sceneNum == SCENE_CLOCKTOWER))) { - s32 phi_v0; + s32 playerParams; u32 entranceIndex = gSaveContext.entranceIndex; if ((globalCtx->actorCtx.unk5 & 2)) { - phi_v0 = 0xCFF; + playerParams = 0xCFF; } else { - phi_v0 = 0xBFF; + playerParams = 0xBFF; } - func_80169DCC(globalCtx, 1, entranceIndex, player->unk_3CE, phi_v0, &player->unk_3C0, - player->unk_3CC); + Play_SetRespawnData(&globalCtx->state, 1, entranceIndex, player->unk_3CE, playerParams, + &player->unk_3C0, player->unk_3CC); if ((globalCtx->sceneNum == SCENE_TENMON_DAI) || (globalCtx->sceneNum == SCENE_00KEIKOKU)) { globalCtx->nextEntranceIndex = 0x5400; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 98ea88f83b..3789bb99ab 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -32,9 +32,22 @@ const ActorInit En_Torch2_InitVars = { }; static ColliderCylinderInit sCylinderInit = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1 | OC1_TYPE_2, - OC2_TYPE_2, COLSHAPE_CYLINDER }, - { ELEMTYPE_UNK2, { 0x00100000, 0, 0 }, { 0xF7CFFFFF, 0, 0 }, TOUCH_NONE, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON }, + { + COLTYPE_METAL, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_1 | OC1_TYPE_2, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK2, + { 0x00100000, 0, 0 }, + { 0xF7CFFFFF, 0, 0 }, + TOUCH_NONE, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 20, 60, 0, { 0, 0, 0 } }, }; @@ -74,7 +87,8 @@ void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnTorch2* this = THIS; Collider_DestroyCylinder(globalCtx, &this->collider); - func_80169DCC(globalCtx, this->actor.params + 3, 0xFF, 0, 0xBFF, &this->actor.world.pos, this->actor.shape.rot.y); + Play_SetRespawnData(&globalCtx->state, this->actor.params + 3, 0xFF, 0, 0xBFF, &this->actor.world.pos, + this->actor.shape.rot.y); globalCtx->actorCtx.unk254[this->actor.params] = 0; } @@ -146,10 +160,9 @@ void EnTorch2_UpdateDeath(Actor* thisx, GlobalContext* globalCtx) { } } -void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx) { +void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; EnTorch2* this = THIS; - - GlobalContext* unused = globalCtx; Gfx* gfx = sShellDLists[thisx->params]; OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h index 70e5cd7cfb..744a7975c9 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h @@ -14,19 +14,19 @@ typedef struct EnTorch2 { } EnTorch2; // size = 0x194 typedef enum { - TORCH2_PARAM_HUMAN, - TORCH2_PARAM_GORON, - TORCH2_PARAM_ZORA, - TORCH2_PARAM_DEKU, - TORCH2_PARAM_FIERCE_DEITY, + /* 0 */ TORCH2_PARAM_HUMAN, + /* 1 */ TORCH2_PARAM_GORON, + /* 2 */ TORCH2_PARAM_ZORA, + /* 3 */ TORCH2_PARAM_DEKU, + /* 4 */ TORCH2_PARAM_FIERCE_DEITY, } EnTorch2Param; typedef enum { - TORCH2_STATE_INITIALIZED, - TORCH2_STATE_FADING_IN, - TORCH2_STATE_SOLID, - TORCH2_STATE_IDLE, - TORCH2_STATE_DYING, + /* 0 */ TORCH2_STATE_INITIALIZED, + /* 1 */ TORCH2_STATE_FADING_IN, + /* 2 */ TORCH2_STATE_SOLID, + /* 3 */ TORCH2_STATE_IDLE, + /* 4 */ TORCH2_STATE_DYING, } EnTorch2State; extern const ActorInit En_Torch2_InitVars; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 746aec8830..9334180cdb 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -184,7 +184,8 @@ void EnToto_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - if (globalCtx->sceneNum == SCENE_MILK_BAR && (gSaveContext.time >= 0x4000 && gSaveContext.time < 0xE555)) { + if (globalCtx->sceneNum == SCENE_MILK_BAR && + (gSaveContext.time >= CLOCK_TIME(6, 0) && gSaveContext.time < CLOCK_TIME(21, 30))) { Actor_MarkForDeath(&this->actor); return; } @@ -250,7 +251,9 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { return; } - if ((globalCtx->sceneNum == SCENE_MILK_BAR && !(gSaveContext.time >= 0x4000 && gSaveContext.time < 0xED02)) || + //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro + if ((globalCtx->sceneNum == SCENE_MILK_BAR && + !(gSaveContext.time >= CLOCK_TIME(6, 0) && gSaveContext.time < 0xED02)) || (globalCtx->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; @@ -503,7 +506,6 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); EnTotoUnkStruct2* temp_s0; s32 i; - u16 tmp; func_80BA3C88(this); if (player->actor.world.pos.z > -270.0f) { @@ -527,8 +529,8 @@ s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { if (this->unk2B1 < 10) { this->unk2B1++; if (this->unk2B1 >= 10) { - tmp = gSaveContext.playerForm; // Needed for regalloc possible FAKE MATCH - Message_StartTextbox(globalCtx, D_80BA50DC[tmp - 1].unk2, NULL); + Message_StartTextbox(globalCtx, D_80BA50DC[((void)0, gSaveContext.playerForm) - 1].unk2, + NULL); } } return 0; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index f17a6a80f4..9560ea8427 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -904,7 +904,7 @@ void EnTrt2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V } } -void EnTrt2_UnkDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +void EnTrt2_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { EnTrt2* this = THIS; if (limbIndex == 21) { @@ -934,7 +934,7 @@ void func_80AD56E8(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTrt2_OverrideLimbDraw, EnTrt2_PostLimbDraw, - EnTrt2_UnkDraw, &this->actor); + EnTrt2_TransformLimbDraw, &this->actor); CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index db7b7a1fc0..31f87f6037 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -722,7 +722,7 @@ s32 func_80A87400(EnTru* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.speedXZ, 30.0f, 0.2f, 1000.0f); if (this->path != NULL) { - sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->path->points); + sp4C = Lib_SegmentedToVirtual(this->path->points); if (func_8013BD40(&this->actor, this->path, this->unk_384)) { if (this->unk_384 > this->unk_384 + 1) { this->unk_384 = this->path->count - 2; @@ -944,7 +944,7 @@ s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { sp4C.z = 40.0f; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, sp3E, &sp4C, &sp40); func_80A85620(this->unk_394, &sp40, 2.0f, 0.08f, 60.0f); - func_8016A268(globalCtx, 1, 160, 160, 160, 0); + func_8016A268(&globalCtx->state, 1, 160, 160, 160, 0); this->unk_370 = 20; this->unk_372 = 10; this->unk_364++; diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index 3c19559afe..ffbb9526b8 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -113,7 +113,7 @@ void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { void func_80A66384(EnWarpUzu* this, GlobalContext* globalCtx) { globalCtx->nextEntranceIndex = 0x22A0; gSaveContext.respawn[0].entranceIndex = globalCtx->nextEntranceIndex; - func_80169EFC(globalCtx); + func_80169EFC(&globalCtx->state); gSaveContext.respawnFlag = -2; this->actionFunc = EnWarpUzu_DoNothing; } 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 b15cb51194..7e025ce434 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 @@ -452,7 +452,8 @@ void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { - if ((gSaveContext.time >= 0x4AAA) && (gSaveContext.time < 0xBAAA) && (globalCtx->envCtx.unk_F2[2] == 0)) { + if ((gSaveContext.time >= CLOCK_TIME(7, 0)) && (gSaveContext.time < CLOCK_TIME(17, 30)) && + (globalCtx->envCtx.unk_F2[2] == 0)) { D_801BDBB0 = 1; func_800FD78C(globalCtx); @@ -485,7 +486,7 @@ void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.msgMode != 0) && (globalCtx->msgCtx.unk11F04 == 0x5E6) && - (!FrameAdvance_IsEnabled(globalCtx)) && (globalCtx->sceneLoadFlag == 0) && + (!FrameAdvance_IsEnabled(&globalCtx->state)) && (globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { oldTime = gSaveContext.time; diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 18f5f13e3a..08a49d8914 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -67,7 +67,7 @@ void func_80B965D0(EnZot* this, GlobalContext* globalCtx) { s32 i; if ((this->path != NULL) && (this->path->count >= 5)) { - Vec3s* points = (Vec3s*)Lib_SegmentedToVirtual(this->path->points); + Vec3s* points = Lib_SegmentedToVirtual(this->path->points); for (i = 0; i < ARRAY_COUNT(this->unk_2D8); i++, points++) { if (this->unk_2D8[i] == NULL) { @@ -520,20 +520,21 @@ void func_80B975F8(EnZot* this, GlobalContext* globalCtx) { } void func_80B9765C(EnZot* this, GlobalContext* globalCtx) { - if (1) { - do { } while (0); } - func_80B96D4C(this); if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { - u16 temp = globalCtx->msgCtx.unk11F04; - u32 temp2; + s32 requiredScopeTemp; - if ((temp == 0x1262) || (temp == 0x1267) || (temp == 0x126A) || (temp == 0x126B)) { - temp2 = temp; - func_80151938(globalCtx, temp2 + 1); - } else { - func_801477B4(globalCtx); - this->actionFunc = func_80B97708; + switch (globalCtx->msgCtx.unk11F04) { + case 0x1262: + case 0x1267: + case 0x126A: + case 0x126B: + func_80151938(globalCtx, globalCtx->msgCtx.unk11F04 + 1); + break; + default: + func_801477B4(globalCtx); + this->actionFunc = func_80B97708; + break; } } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index d61b3f7719..467a81de0c 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -147,8 +147,8 @@ s32 func_80936D58(ObjBean* this, GlobalContext* globalCtx) { Math_Vec3f_Sum(&this->dyna.actor.world.pos, &spAC, &spA0); Math_Vec3f_Diff(&this->dyna.actor.world.pos, &spAC, &sp94); - if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &spA0, &sp94, &sp88, &this->dyna.actor.floorPoly, 1, 1, 1, 1, &spB8, - &this->dyna.actor)) { + if (BgCheck_EntityLineTest2(&globalCtx->colCtx, &spA0, &sp94, &sp88, &this->dyna.actor.floorPoly, true, true, true, + true, &spB8, &this->dyna.actor)) { this->dyna.actor.world.pos.x = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.x) * 1.9f) + sp88.x; this->dyna.actor.world.pos.y = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.y) * 1.9f) + sp88.y; this->dyna.actor.world.pos.z = (COLPOLY_GET_NORMAL(this->dyna.actor.floorPoly->normal.z) * 1.9f) + sp88.z; diff --git a/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c b/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c index 0de07e0135..5109cf2849 100644 --- a/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c +++ b/src/overlays/actors/ovl_Obj_Ending/z_obj_ending.c @@ -44,7 +44,7 @@ void ObjEnding_Init(Actor* thisx, GlobalContext* globalCtx) { this->modelInfo = &sModelInfo[thisx->params]; animMat = this->modelInfo->animMat; if (animMat != NULL) { - this->animMat = (AnimatedMaterial*)Lib_SegmentedToVirtual(animMat); + this->animMat = Lib_SegmentedToVirtual(animMat); } } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index f347b6a6df..4b96d3a77c 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -5,6 +5,7 @@ */ #include "z_obj_hakaisi.h" +#include "objects/object_hakaisi/object_hakaisi.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_20) @@ -15,7 +16,27 @@ void ObjHakaisi_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjHakaisi_Update(Actor* thisx, GlobalContext* globalCtx); void ObjHakaisi_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80B1444C(ObjHakaisi* this); +void func_80B14460(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14510(ObjHakaisi* this); +void func_80B14524(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14558(ObjHakaisi* this); +void func_80B1456C(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B145F4(ObjHakaisi* this); +void func_80B14648(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B149A8(ObjHakaisi* this); +void func_80B149C0(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B14A24(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec); +void func_80B14B6C(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec, s16 arg3); +void func_80B14CF8(GlobalContext* globalCtx, Vec3f vec, s16 arg2, s16 arg3, s32 arg4); +void func_80B14F4C(ObjHakaisi* this, GlobalContext* globalCtx, s32 arg2); +void func_80B151E0(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B15254(Actor* thisx, GlobalContext* globalCtx); +void func_80B15264(ObjHakaisi* this); +void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx); +void func_80B1544C(Actor* thisx, GlobalContext* globalCtx); +void func_80B154A0(Actor* thisx, GlobalContext* globalCtx); + const ActorInit Obj_Hakaisi_InitVars = { ACTOR_OBJ_HAKAISI, ACTORCAT_PROP, @@ -28,57 +49,395 @@ const ActorInit Obj_Hakaisi_InitVars = { (ActorFunc)ObjHakaisi_Draw, }; -#endif +Vec3f D_80B155B0 = { 0.0f, 25.0f, 30.0f }; -extern UNK_TYPE D_06001F10; -extern UNK_TYPE D_060021B0; -extern UNK_TYPE D_06002650; -extern UNK_TYPE D_06002FC4; +Vec3f D_80B155BC[] = { { 0.0f, 65.0f, 8.0f }, { 0.0f, 35.0f, 8.0f }, { 0.0f, 15.0f, 8.0f } }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/ObjHakaisi_Init.s") +Vec3f D_80B155E0 = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/ObjHakaisi_Destroy.s") +Vec3f D_80B155EC = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B1444C.s") +Color_RGBA8 D_80B155F8 = { 170, 130, 90, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14460.s") +Color_RGBA8 D_80B155FC = { 100, 60, 20, 0 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14510.s") +Vec3f D_80B15600 = { 1.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14524.s") +void ObjHakaisi_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + ObjHakaisi* this = THIS; + CollisionHeader* sp7C = NULL; + MtxF sp3C; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14558.s") + switch (OBJHAKAISI_GET_FF(&this->dyna.actor)) { + case 0: + this->dyna.actor.textId = 0x13F9; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B1456C.s") + case 1: + this->dyna.actor.textId = 0x13FA; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B145F4.s") + case 2: + this->dyna.actor.textId = 0x13FB; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14648.s") + case 3: + this->dyna.actor.textId = 0x13FC; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B149A8.s") + case 4: + case 5: + func_80B151E0(this, globalCtx); + return; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B149C0.s") + default: + this->dyna.actor.textId = 0x1412; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14A24.s") + Actor_SetScale(&this->dyna.actor, 1.0f); + this->dyna.actor.targetMode = 0; + this->dyna.actor.colChkInfo.health = 30; + if (OBJHAKAISI_GET_FF(&this->dyna.actor) == 3) { + this->dyna.actor.draw = NULL; + func_80B1444C(this); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14B6C.s") + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&object_hakaisi_Colheader_002FC4, &sp7C); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14CF8.s") + this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp7C); + this->unk_19A = 0; + this->unk_198 = 0; + this->switchFlag = OBJHAKAISI_GET_SWITCHFLAG(thisx); + this->unk_196 = this->dyna.actor.cutscene; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B14F4C.s") + if (this->switchFlag == 0xFF) { + this->switchFlag = -1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/ObjHakaisi_Update.s") + if ((this->switchFlag != -1) && Flags_GetSwitch(globalCtx, this->switchFlag)) { + Actor_MarkForDeath(&this->dyna.actor); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/ObjHakaisi_Draw.s") + Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B151E0.s") + if (this->dyna.actor.floorPoly == NULL) { + Actor_MarkForDeath(&this->dyna.actor); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B15254.s") + func_800C0094(this->dyna.actor.floorPoly, this->dyna.actor.world.pos.x, this->dyna.actor.floorHeight, + this->dyna.actor.world.pos.z, &sp3C); + Matrix_SetCurrentState(&sp3C); + Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); + Matrix_CopyCurrentState(&sp3C); + func_8018219C(&sp3C, &this->dyna.actor.shape.rot, 1); + this->dyna.actor.world.rot = this->dyna.actor.shape.rot; + Matrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); + Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); + Matrix_MultiplyVector3fByState(&D_80B155B0, &this->dyna.actor.focus.pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B15264.s") + for (i = 0; i < ARRAY_COUNT(D_80B155BC); i++) { + Matrix_MultiplyVector3fByState(&D_80B155BC[i], &this->unk_160[i]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B15330.s") + func_80B1444C(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B1544C.s") +void ObjHakaisi_Destroy(Actor* thisx, GlobalContext* globalCtx) { + ObjHakaisi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hakaisi/func_80B154A0.s") + if (OBJHAKAISI_GET_FF(&this->dyna.actor) != 3) { + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + } +} + +void func_80B1444C(ObjHakaisi* this) { + this->actionFunc = func_80B14460; +} + +void func_80B14460(ObjHakaisi* this, GlobalContext* globalCtx) { + s16 sp26 = BINANG_SUB(this->dyna.actor.shape.rot.y, this->dyna.actor.yawTowardsPlayer); + + if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state)) { + func_80B14510(this); + } else if (this->dyna.actor.textId != 0) { + if (ABS_ALT(sp26) < 0x2000) { + func_800B8614(&this->dyna.actor, globalCtx, 100.0f); + } + } + + if (this->unk_198 == 1) { + func_80B14558(this); + } +} + +void func_80B14510(ObjHakaisi* this) { + this->actionFunc = func_80B14524; +} + +void func_80B14524(ObjHakaisi* this, GlobalContext* globalCtx) { + if (Actor_TextboxIsClosing(&this->dyna.actor, globalCtx)) { + func_80B1444C(this); + } +} + +void func_80B14558(ObjHakaisi* this) { + this->actionFunc = func_80B1456C; +} + +void func_80B1456C(ObjHakaisi* this, GlobalContext* globalCtx) { + if (this->unk_196 != -1) { + if (ActorCutscene_GetCanPlayNext(this->unk_196)) { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_196, &this->dyna.actor); + } else { + ActorCutscene_SetIntentToPlay(this->unk_196); + } + } + if (this->dyna.actor.colChkInfo.health < 30) { + func_80B145F4(this); + func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + } +} + +void func_80B145F4(ObjHakaisi* this) { + this->unk_19A = 0; + this->dyna.actor.flags |= ACTOR_FLAG_8000000; + this->dyna.actor.flags &= ~ACTOR_FLAG_1; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + this->actionFunc = func_80B14648; +} + +void func_80B14648(ObjHakaisi* this, GlobalContext* globalCtx) { + if (this->unk_19A < 2) { + func_80B14CF8(globalCtx, this->unk_160[this->unk_194], 100, 30, 5); + } + + this->unk_19A++; + + if (this->dyna.actor.colChkInfo.health == 0) { + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 70); + Flags_SetSwitch(globalCtx, this->switchFlag); + this->dyna.actor.draw = NULL; + func_80B149A8(this); + } + + if (this->unk_19E != this->dyna.actor.colChkInfo.health) { + if ((this->unk_19E > 20) && (this->dyna.actor.colChkInfo.health <= 20)) { + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14F4C(this, globalCtx, 0); + func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 40); + this->unk_194 = 1; + } else if ((this->unk_19E > 10) && (this->dyna.actor.colChkInfo.health <= 10)) { + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14A24(this, globalCtx, this->unk_160[this->unk_194]); + func_80B14B6C(this, globalCtx, this->unk_160[this->unk_194], 60); + this->unk_194 = 2; + } + this->unk_19A = 0; + this->dyna.actor.shape.yOffset -= 3.0f; + } + + Math_ApproachZeroF(&this->dyna.actor.shape.yOffset, 0.8f, 100.0f); + this->unk_19E = this->dyna.actor.colChkInfo.health; +} + +void func_80B149A8(ObjHakaisi* this) { + this->unk_19A = 0; + this->actionFunc = func_80B149C0; +} + +void func_80B149C0(ObjHakaisi* this, GlobalContext* globalCtx) { + if (this->unk_19A < 60) { + this->unk_19A++; + } else if ((this->unk_196 != -1) && !ActorCutscene_GetCanPlayNext(this->unk_196)) { + ActorCutscene_Stop(this->unk_196); + } +} + +void func_80B14A24(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec) { + s32 i; + + func_80B14CF8(globalCtx, vec, 100, 30, 5); + + for (i = 0; i < 5; i++) { + vec.x += Rand_Centered() * 20.0f; + vec.y += Rand_ZeroOne() * 5.0f; + vec.z += Rand_Centered() * 20.0f; + EffectSsHahen_SpawnBurst(globalCtx, &vec, 5.0f, 0, 20, 15, 3, OBJECT_HAKAISI, 10, object_hakaisi_DL_0021B0); + } +} + +void func_80B14B6C(ObjHakaisi* this, GlobalContext* globalCtx, Vec3f vec, s16 arg3) { + s32 i; + s16 temp_s1; + Vec3f sp6C; + + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + + for (i = 0; i < 5; i++) { + temp_s1 = Rand_Next(); + + sp6C.x = (Math_SinS(temp_s1) * 15.0f) + vec.x; + sp6C.y = (Rand_ZeroOne() * 3.0f) + vec.y; + sp6C.z = (Math_CosS(temp_s1) * 15.0f) + vec.z; + + EffectSsHahen_SpawnBurst(globalCtx, &sp6C, 10.0f, 0, arg3, 30, 2, OBJECT_HAKAISI, 15, object_hakaisi_DL_0021B0); + } + + func_80B14CF8(globalCtx, vec, 100, 50, 20); +} + +void func_80B14CF8(GlobalContext* globalCtx, Vec3f vec, s16 arg2, s16 arg3, s32 arg4) { + s32 i; + s16 temp_s0; + Vec3f spAC; + Vec3f spA0 = D_80B155E0; + Vec3f sp94 = D_80B155EC; + f32 temp_f20; + f32 temp_f22; + + for (i = 0; i < arg4; i++) { + temp_f20 = Rand_ZeroOne() * 30.0f; + temp_f22 = Rand_ZeroOne() * 1.5f; + temp_s0 = Rand_Next(); + + spAC.x = (Math_SinS(temp_s0) * temp_f20) + vec.x; + spAC.y = (Rand_Centered() * 4.0f) + vec.y; + spAC.z = (Math_CosS(temp_s0) * temp_f20) + vec.z; + + spA0.x += temp_f22 * Math_SinS(temp_s0); + spA0.y += Rand_Centered() + 0.5f; + spA0.z += temp_f22 * Math_CosS(temp_s0); + + sp94.x = -0.1f * spA0.x; + sp94.y = -0.1f * spA0.y; + sp94.z = -0.1f * spA0.z; + + func_800B0EB0(globalCtx, &spAC, &spA0, &sp94, &D_80B155F8, &D_80B155FC, arg2, arg3, 10); + } +} + +void func_80B14F4C(ObjHakaisi* this, GlobalContext* globalCtx, s32 arg2) { + if (arg2 == 0) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y + 55.0f, this->dyna.actor.world.pos.z - 10.0f, + this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 4); + } else { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x + 20.0f, + this->dyna.actor.world.pos.y + 30.0f, this->dyna.actor.world.pos.z - 10.0f, + this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 5); + } +} + +void ObjHakaisi_Update(Actor* thisx, GlobalContext* globalCtx) { + ObjHakaisi* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void ObjHakaisi_Draw(Actor* thisx, GlobalContext* globalCtx) { + ObjHakaisi* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + if (this->unk_194 == 0) { + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_002650); + } else if (this->unk_194 == 1) { + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_0029C0); + } else { + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_002CC0); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80B151E0(ObjHakaisi* this, GlobalContext* globalCtx) { + this->dyna.actor.update = func_80B1544C; + this->dyna.actor.draw = func_80B154A0; + this->dyna.actor.destroy = func_80B15254; + Actor_SetScale(&this->dyna.actor, 0.1f); + this->dyna.actor.shape.yOffset = 100.0f; + this->dyna.actor.flags &= ~ACTOR_FLAG_1; + func_80B15264(this); +} + +void func_80B15254(Actor* thisx, GlobalContext* globalCtx) { +} + +void func_80B15264(ObjHakaisi* this) { + s32 pad; + s16 sp32 = Rand_Next(); + + Matrix_InsertRotation(Rand_Next(), Rand_Next(), Rand_Next(), MTXMODE_NEW); + Matrix_MultiplyVector3fByState(&D_80B15600, &this->unk_184); + this->dyna.actor.gravity = -1.0f; + this->unk_19C = Rand_Next() >> 0x12; + this->dyna.actor.velocity.x = Math_SinS(sp32) * 4.0f; + this->dyna.actor.velocity.z = Math_CosS(sp32) * 4.0f; + this->dyna.actor.velocity.y = 7.0f; + this->actionFunc = func_80B15330; +} + +void func_80B15330(ObjHakaisi* this, GlobalContext* globalCtx) { + s32 pad; + MtxF sp34; + + this->dyna.actor.velocity.y += this->dyna.actor.gravity; + Actor_UpdatePos(&this->dyna.actor); + + if (this->dyna.actor.bgCheckFlags & 2) { + func_80B14B6C(this, globalCtx, this->dyna.actor.world.pos, 40); + func_80B14CF8(globalCtx, this->dyna.actor.world.pos, 100, 30, 10); + Actor_MarkForDeath(&this->dyna.actor); + } + + Matrix_InsertRotationAroundUnitVector_s(this->unk_19C, &this->unk_184, MTXMODE_NEW); + Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->dyna.actor.shape.rot.x, MTXMODE_APPLY); + Matrix_InsertZRotation_s(this->dyna.actor.shape.rot.z, MTXMODE_APPLY); + Matrix_CopyCurrentState(&sp34); + + func_8018219C(&sp34, &this->dyna.actor.shape.rot, 0); +} + +void func_80B1544C(Actor* thisx, GlobalContext* globalCtx) { + ObjHakaisi* this = THIS; + + this->actionFunc(this, globalCtx); + + Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); +} + +void func_80B154A0(Actor* thisx, GlobalContext* globalCtx) { + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + if (OBJHAKAISI_GET_FF(thisx) == 4) { + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_001F10); + } else { + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_hakaisi_DL_0021B0); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h index 5c6f1a64ae..4f1d1ada9a 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h @@ -7,13 +7,21 @@ struct ObjHakaisi; typedef void (*ObjHakaisiActionFunc)(struct ObjHakaisi*, GlobalContext*); +#define OBJHAKAISI_GET_FF(thisx) ((thisx)->params & 0xFF) +#define OBJHAKAISI_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFF00) >> 8) + typedef struct ObjHakaisi { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x18]; + /* 0x0000 */ DynaPolyActor dyna; /* 0x015C */ ObjHakaisiActionFunc actionFunc; - /* 0x0160 */ char unk_160[0x38]; + /* 0x0160 */ Vec3f unk_160[3]; + /* 0x0184 */ Vec3f unk_184; + /* 0x0190 */ s32 switchFlag; + /* 0x0194 */ s16 unk_194; + /* 0x0196 */ s16 unk_196; /* 0x0198 */ s16 unk_198; - /* 0x019A */ char unk_19A[0x6]; + /* 0x019A */ s16 unk_19A; + /* 0x019C */ s16 unk_19C; + /* 0x019E */ u8 unk_19E; } ObjHakaisi; // size = 0x1A0 extern const ActorInit Obj_Hakaisi_InitVars; diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c index c06543f07a..1ce6faa7d5 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c @@ -37,14 +37,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 180, ICHAIN_STOP), }; -static Vec3f iceSmokeAccel = { 0.0f, 0.0f, 0.0f }; +static Vec3f sIceSmokeAccel = { 0.0f, 0.0f, 0.0f }; void ObjHsStump_Init(Actor* thisx, GlobalContext* globalCtx) { ObjHsStump* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->isHidden = OBJHSSTUMP_GET_ISHIDDEN(thisx); - this->switchFlag = OBJHSSTUMP_GET_SWITCHFLAG(thisx); // Must be thisx to match + this->switchFlag = OBJHSSTUMP_GET_SWITCHFLAG(thisx); DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hsstump_Colheader_0011B0); switch (this->isHidden) { @@ -87,43 +87,43 @@ void ObjHsStump_Appear(ObjHsStump* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = (Math_SinS(this->rotAngle * 2) * this->rotFactor) + this->dyna.actor.home.rot.z; this->rotAngle += 0x2000; } - if (this->framesAppeared < 11) { + if (this->framesAppeared <= 10) { if (this->framesAppeared == 0) { s32 i; - f32 angle; + f32 angleDeg; s16 numDirections = 4; Vec3f iceSmokePosOffset; Vec3f iceSmokeVelOffset; s16 offsetAngle; Vec3f iceSmokeVel; - f32 angleBinary; + f32 angleBrad; Vec3f iceSmokePos; iceSmokePosOffset.x = 1.0f; iceSmokePosOffset.y = 0.5f; iceSmokePosOffset.z = 0.0f; + iceSmokeVelOffset.x = 1.0f; iceSmokeVelOffset.y = 0.5f; iceSmokeVelOffset.z = 0.0f; - angle = 360.0f / numDirections; - i = angle * (0x10000 / 360.0f); - angleBinary = i; + angleDeg = (360.0f / numDirections); + angleBrad = (s32)(angleDeg * (0x10000 / 360.0f)); for (i = 0; i < numDirections; i++) { - offsetAngle = i * angleBinary; + offsetAngle = i * angleBrad; Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, offsetAngle, &iceSmokePosOffset, &iceSmokePos); Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, offsetAngle, &iceSmokeVelOffset, &iceSmokeVel); - EffectSsIceSmoke_Spawn(globalCtx, &iceSmokePos, &iceSmokeVel, &iceSmokeAccel, 100); + EffectSsIceSmoke_Spawn(globalCtx, &iceSmokePos, &iceSmokeVel, &sIceSmokeAccel, 100); } } } if (this->framesAppeared >= 10) { - Math_SmoothStepToF(&this->dyna.actor.scale.x, 0.17999999f, 1.0f, 0.01f, 0.001f); + Math_SmoothStepToF(&this->dyna.actor.scale.x, 18.0f * 0.01f, 1.0f, 0.01f, 0.001f); Actor_SetScale(&this->dyna.actor, this->dyna.actor.scale.x); } - if (this->dyna.actor.scale.x == 0.17999999f) { + if (this->dyna.actor.scale.x == 18.0f * 0.01f) { this->isHidden = false; func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); ObjHsStump_SetupIdle(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 627338400a..28de274f5e 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -460,7 +460,7 @@ s32 func_80A24118(ObjIceblock* this, GlobalContext* globalCtx, f32 arg2, Vec3f* spD0.y = spDC.y; spD0.z = temp_f26 + spDC.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spDC, &spD0, &spB8, &spA8, 1, 0, 0, 1, &spAC, + if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spDC, &spD0, &spB8, &spA8, true, false, false, true, &spAC, &this->dyna.actor, 0.0f)) { temp_f20 = Math3D_Vec3fDistSq(&spDC, &spB8); if (temp_f20 < phi_f20) { @@ -536,7 +536,7 @@ s32 func_80A243E0(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg0) { spE0.y = spEC.y; spE0.z = temp_f30 + spEC.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spEC, &spE0, &spC8, &spB8, 1, 0, 0, 1, &spBC, + if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spEC, &spE0, &spC8, &spB8, true, false, false, true, &spBC, &this->dyna.actor, 0.0f)) { temp_f12 = Math3D_Vec3fDistSq(&spEC, &spC8); if (temp_f12 < phi_f22) { @@ -600,7 +600,7 @@ s32 func_80A246D8(ObjIceblock* this, GlobalContext* globalCtx, Vec3f* arg2) { spB4.y = spC0.y; spB4.z = (Math_CosS(phi_s3) * temp_f20) + spC0.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spC0, &spB4, &sp9C, &sp94, 1, 0, 0, 1, &sp98, + if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &spC0, &spB4, &sp9C, &sp94, true, false, false, true, &sp98, &this->dyna.actor, 0.0f)) { ret = true; temp_v0 = (ObjIceblock*)DynaPoly_GetActor(&globalCtx->colCtx, sp98); diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index 6d06195d14..81090139ba 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -16,8 +16,6 @@ void ObjMilkBin_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx); void ObjMilkBin_Draw(Actor* thisx, GlobalContext* globalCtx); -// gMilkBinMilkJarDL - const ActorInit Obj_Milk_Bin_InitVars = { ACTOR_OBJ_MILK_BIN, ACTORCAT_PROP, diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 2d1149715f..359d474f1f 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -345,8 +345,8 @@ s32 ObjOshihiki_CheckWall(GlobalContext* globalCtx, s16 angle, f32 direction, Ob faceVtxNext.y = faceVtx.y; faceVtxNext.z = (maxDist * cs) + faceVtx.z; - if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, 1, 0, 0, 1, &bgId, - &this->dyna.actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &faceVtx, &faceVtxNext, &posResult, &outPoly, true, false, + false, true, &bgId, &this->dyna.actor, 0.0f)) { return true; } } diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 0acdf1bca1..24f3fe0d6e 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -89,7 +89,7 @@ void ObjRaillift_Init(Actor* thisx, GlobalContext* globalCtx) { this->curPoint = OBJRAILLIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; - this->points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + this->points = Lib_SegmentedToVirtual(path->points); ObjRaillift_UpdatePosition(this, this->curPoint); if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(globalCtx, OBJRAILLIFT_GET_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index a1cc93b9fd..ff0c8d2700 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -68,7 +68,7 @@ void func_80973D3C(ObjRoomtimer* this, GlobalContext* globalCtx) { this->actionFunc = func_80973DE0; } else if (this->actor.params != 0x1FF && gSaveContext.unk_3DD0[4] == 0) { play_sound(NA_SE_OC_ABYSS); - func_80169EFC(globalCtx); + func_80169EFC(&globalCtx->state); Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c index 70bb72454d..91bc39495e 100644 --- a/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c +++ b/src/overlays/actors/ovl_Obj_Yado/z_obj_yado.c @@ -38,7 +38,7 @@ void ObjYado_Init(Actor* thisx, GlobalContext* globalCtx) { ObjYado* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - D_80C16470 = (AnimatedMaterial*)Lib_SegmentedToVirtual(object_yado_obj_Matanimheader_0012E8); + D_80C16470 = Lib_SegmentedToVirtual(object_yado_obj_Matanimheader_0012E8); this->isNight = gSaveContext.isNight; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 6a5fa04231..bc3e3c1e8b 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -12,6 +12,11 @@ extern UNK_TYPE D_06008860; extern UNK_TYPE D_0600BDD8; extern UNK_TYPE D_060178D0; +void Player_Init(Actor* thisx, GlobalContext* globalCtx); +void Player_Destroy(Actor* thisx, GlobalContext* globalCtx); +void Player_Update(Actor* thisx, GlobalContext* globalCtx); +void Player_Draw(Actor* thisx, GlobalContext* globalCtx); + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_8082DA90.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_8082DABC.s") @@ -728,7 +733,7 @@ extern UNK_TYPE D_060178D0; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80841A50.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80841AC4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Init.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80842510.s") @@ -754,15 +759,15 @@ extern UNK_TYPE D_060178D0; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80844EF8.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808460B8.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808463C0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80846460.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80846528.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Draw.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_808470D4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/Player_Destroy.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_player_actor/func_80847190.s") diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 2c18ac2d04..0d50455010 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -409,6 +409,11 @@ animdict = { "func_800A81F0": "EffectBlure_AddVertex", "func_800A8514": "EffectBlure_AddSpace", "Effect_GetParams": "Effect_GetByIndex", + "convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber", + "func_80169D40": "Play_SaveCycleSceneFlags", + "func_80169DCC": "Play_SetRespawnData", + "func_80169E6C": "Play_SetupRespawnPoint", + "func_8016A0AC": "Play_IsUnderwater", "func_800F5A8C": "Environment_LerpWeight", "func_801A3F54": "Audio_SetCutsceneFlag", "func_801518B0": "Message_StartTextbox", diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py index e0b7705ea0..103860ed2e 100755 --- a/tools/disasm/disasm.py +++ b/tools/disasm/disasm.py @@ -18,6 +18,14 @@ parser.add_argument( default=False, help="Decompile all files regardless of whether they are used or not", ) +parser.add_argument( + "-files", + "--files", + dest="files", + nargs="+", + required=False, + help="Optional list of files to diassemble separated by a space. This is a whitelist, all files will be skipped besides the ones listed here if used.", +) args = parser.parse_args() jobs = args.jobs @@ -26,7 +34,7 @@ ASM_OUT = "asm/" DATA_OUT = "data/" -def discard_decomped_files(files_spec): +def discard_decomped_files(files_spec, include_files): root_path = Path(__file__).parent.parent.parent with open(root_path / "spec", "r") as f: @@ -38,6 +46,12 @@ def discard_decomped_files(files_spec): for f in files_spec: name, _, type, _, file_list = f + force_include = False + if include_files: + if not any([x in name for x in include_files]): + continue + force_include = True + # Find the beginseg for this file i = 0 while i < len(spec): @@ -92,6 +106,7 @@ def discard_decomped_files(files_spec): if "GLOBAL_ASM" in f2.read(): include = True + include |= force_include if include: new_files[offset] = file included = True @@ -2191,16 +2206,23 @@ for segment in files_spec: full_file_list[segment[0]] = new if args.full: + new_spec = [] for segment in files_spec: + if args.files and not any( + [file_name in segment[0] for file_name in args.files] + ): + continue for offset, name in segment[4].items(): if name == "": name = f"{segment[2]}_{offset:08X}" segment[4][offset] = name + new_spec.append(segment) + files_spec = new_spec else: # Prune old_file_count = sum([len(f[4].keys()) for f in files_spec]) - files_spec = discard_decomped_files(files_spec) + files_spec = discard_decomped_files(files_spec, args.files) new_file_count = sum([len(f[4].keys()) for f in files_spec]) @@ -2413,193 +2435,201 @@ rodata_symbols_regex = re.compile(r"(?<=\n)glabel (.+)(?=\n)") asm_symbols_regex = re.compile(r"%(?:lo|hi)\((.+?)\)") # Split files and migrate rodata that should be migrated -for root, dirs, files in os.walk(ASM_OUT): - for f in files: - if "non_matchings" in root: - continue - asm_path = os.path.join(root, f) - rodata_path = ( - asm_path.replace(ASM_OUT + "overlays/", DATA_OUT) - .replace(ASM_OUT, DATA_OUT) - .replace(".text.s", ".rodata.s") +for file in Path(ASM_OUT).glob("**/*.s"): + asm_path = str(file) + + if "non_matchings" in asm_path: + continue + + if file.parts[1] == "overlays": + name = file.parts[2] + else: + name = file.parts[1] + + if not any([name == section[-1]["name"] for section in all_sections]): + continue + + rodata_path = ( + asm_path.replace(ASM_OUT + "overlays/", DATA_OUT) + .replace(ASM_OUT, DATA_OUT) + .replace(".text.s", ".rodata.s") + ) + + print(asm_path) + + asm = "" + with open(asm_path, "r") as infile: + asm = infile.read() + + rodata = "" + if os.path.exists(rodata_path): + # print(rodata_path) + with open(rodata_path, "r") as rodata_file: + rodata = rodata_file.read() + + rodata_info = list(zip(rodata_syms(rodata), rodata_blocks(rodata))) + + # populate rdata and late_rodata lists + first_late_rodata = find_late_rodata_start(rodata_info) + rdata_info = [] + late_rodata_info = [] + target = rdata_info # first populate rdata + for sym, block in rodata_info: + # now populate late_rodata, if there is any + if sym == first_late_rodata: + target = late_rodata_info + target.append((sym, block)) + + # print([(sym,block.split("\n")[1:]) for sym,block in zip(rdata_syms,rdata_blocks)]) + + function_info = list( + zip( + [s.replace("glabel", "").strip() for s in func_regex.findall(asm)], + func_regex.split(asm)[1:], ) + ) - print(asm_path) + rdata_map = {} + late_rodata_map = {} - asm = "" - with open(asm_path, "r") as infile: - asm = infile.read() + # pass 1 to resolve rodata splits + if rodata != "": + last_fn = None - rodata = "" - if os.path.exists(rodata_path): - # print(rodata_path) - with open(rodata_path, "r") as rodata_file: - rodata = rodata_file.read() + referenced_in = {} # key=rodata label , value=function label - rodata_info = list(zip(rodata_syms(rodata), rodata_blocks(rodata))) + for sym, _ in rodata_info: + all_refs = [ + label for label, body in function_info if "%lo(" + sym + ")" in body + ] + # ignore multiple refs, take only the first + referenced_in.update({sym: all_refs[0] if len(all_refs) != 0 else None}) - # populate rdata and late_rodata lists - first_late_rodata = find_late_rodata_start(rodata_info) - rdata_info = [] - late_rodata_info = [] - target = rdata_info # first populate rdata - for sym, block in rodata_info: - # now populate late_rodata, if there is any - if sym == first_late_rodata: - target = late_rodata_info - target.append((sym, block)) + def do_splits(out_dict, info): + first = True + last_ref = None + cr = None + for sym, block in info: + ref = referenced_in[sym] + if first: + cr = ref or sym - # print([(sym,block.split("\n")[1:]) for sym,block in zip(rdata_syms,rdata_blocks)]) + if ref is not None and not first: + if ref != last_ref: + # existing function + cr = ref + elif last_ref is not None: + # new GLOBAL_ASM + cr = sym - function_info = list( - zip( - [s.replace("glabel", "").strip() for s in func_regex.findall(asm)], - func_regex.split(asm)[1:], - ) - ) + # add to output + if cr not in out_dict.keys(): + out_dict.update({cr: []}) + out_dict[cr].append((sym, block)) - rdata_map = {} - late_rodata_map = {} + # setup next iter + last_ref = ref + first = False + + do_splits(rdata_map, rdata_info) + do_splits(late_rodata_map, late_rodata_info) + + # all output files, order is irrelevant at this point + all_output = set([label for label, _ in function_info]).union( + set(rdata_map.keys()), set(late_rodata_map.keys()) + ) + + # pass 2 to output splits + for label in all_output: + fn_body = dict(function_info).get(label, None) + + text_out = "" + rodata_out = "" + + if fn_body is not None: + text_out = "glabel " + label.strip() + "\n" + fn_body.strip() + "\n" - # pass 1 to resolve rodata splits if rodata != "": - last_fn = None + rdata = rdata_map.get(label, None) + late_rodata = late_rodata_map.get(label, None) - referenced_in = {} # key=rodata label , value=function label - - for sym, _ in rodata_info: - all_refs = [ - label for label, body in function_info if "%lo(" + sym + ")" in body - ] - # ignore multiple refs, take only the first - referenced_in.update({sym: all_refs[0] if len(all_refs) != 0 else None}) - - def do_splits(out_dict, info): - first = True - last_ref = None - cr = None - for sym, block in info: - ref = referenced_in[sym] - if first: - cr = ref or sym - - if ref is not None and not first: - if ref != last_ref: - # existing function - cr = ref - elif last_ref is not None: - # new GLOBAL_ASM - cr = sym - - # add to output - if cr not in out_dict.keys(): - out_dict.update({cr: []}) - out_dict[cr].append((sym, block)) - - # setup next iter - last_ref = ref - first = False - - do_splits(rdata_map, rdata_info) - do_splits(late_rodata_map, late_rodata_info) - - # all output files, order is irrelevant at this point - all_output = set([label for label, _ in function_info]).union( - set(rdata_map.keys()), set(late_rodata_map.keys()) - ) - - # pass 2 to output splits - for label in all_output: - fn_body = dict(function_info).get(label, None) - - text_out = "" - rodata_out = "" - - if fn_body is not None: - text_out = "glabel " + label.strip() + "\n" + fn_body.strip() + "\n" - - if rodata != "": - rdata = rdata_map.get(label, None) - late_rodata = late_rodata_map.get(label, None) - - # check for late_rodata_alignment - late_rodata_alignment = "" - if fn_body is not None and late_rodata is not None: - ratio = late_rodata_size( - [block for _, block in late_rodata] - ) / text_block_size(fn_body) - if ratio > 1.0 / 3: - # print(f"{label} : {ratio}") - # TODO hack: getting the address from a comment - first_block_split = late_rodata[0][1].split(" */ .") - vaddr = None - if first_block_split[1].startswith( - "float" - ) or first_block_split[1].startswith("double"): - vaddr = first_block_split[0].split(" ")[-2] - else: - vaddr = first_block_split[0].split(" ")[-1] - assert vaddr is not None - vaddr = int(vaddr, 16) - if vaddr not in [ - 0x801E0E28, - 0x80C1C2B0, - 0x80AA7820, - 0x80AA3CC0, - 0x80AA418C, - 0x80BE0160, - 0x80B591D8, - 0x80B59610, - 0x80B59780, - 0x80964E00, - 0x80964F10, - 0x80BB40A0, - 0x80952038, - 0x80AFB920, - 0x80AFBBFC, - 0x80AFBE28, - 0x80983320, - ]: - # hacks for especially badly behaved rodata, TODO these are ALL jumptables associated with - # comparatively tiny functions, can we swat these programmatically? - late_rodata_alignment = f".late_rodata_alignment {'8' if vaddr % 8 == 0 else '4'}\n" - - rdata_out = "" - if rdata is not None: - rdata_out = ".rdata\n" + "".join([block for _, block in rdata]) - - late_rodata_out = "" - if late_rodata is not None: - late_rodata_out = ( - ".late_rodata\n" - + late_rodata_alignment - + "".join([block for _, block in late_rodata]) - ) - - rodata_out = ( - rdata_out - + late_rodata_out - + ( - "\n.text\n" - if ( - (rdata is not None or late_rodata is not None) - and fn_body is not None + # check for late_rodata_alignment + late_rodata_alignment = "" + if fn_body is not None and late_rodata is not None: + ratio = late_rodata_size( + [block for _, block in late_rodata] + ) / text_block_size(fn_body) + if ratio > 1.0 / 3: + # print(f"{label} : {ratio}") + # TODO hack: getting the address from a comment + first_block_split = late_rodata[0][1].split(" */ .") + vaddr = None + if first_block_split[1].startswith("float") or first_block_split[ + 1 + ].startswith("double"): + vaddr = first_block_split[0].split(" ")[-2] + else: + vaddr = first_block_split[0].split(" ")[-1] + assert vaddr is not None + vaddr = int(vaddr, 16) + if vaddr not in [ + 0x801E0E28, + 0x80C1C2B0, + 0x80AA7820, + 0x80AA3CC0, + 0x80AA418C, + 0x80BE0160, + 0x80B591D8, + 0x80B59610, + 0x80B59780, + 0x80964E00, + 0x80964F10, + 0x80BB40A0, + 0x80952038, + 0x80AFB920, + 0x80AFBBFC, + 0x80AFBE28, + 0x80983320, + ]: + # hacks for especially badly behaved rodata, TODO these are ALL jumptables associated with + # comparatively tiny functions, can we swat these programmatically? + late_rodata_alignment = ( + f".late_rodata_alignment {'8' if vaddr % 8 == 0 else '4'}\n" ) - else "" - ) + + rdata_out = "" + if rdata is not None: + rdata_out = ".rdata\n" + "".join([block for _, block in rdata]) + + late_rodata_out = "" + if late_rodata is not None: + late_rodata_out = ( + ".late_rodata\n" + + late_rodata_alignment + + "".join([block for _, block in late_rodata]) ) - all_out = rodata_out + text_out - - # write it out - out_path = ( - root.replace(ASM_OUT, f"{ASM_OUT}/non_matchings/") - + "/" - + ((f.replace(".text.s", "") + "/") if "overlays" not in root else "") + rodata_out = ( + rdata_out + + late_rodata_out + + ( + "\n.text\n" + if ( + (rdata is not None or late_rodata is not None) + and fn_body is not None + ) + else "" + ) ) - os.makedirs(out_path, exist_ok=True) - with open(out_path + label + ".s", "w") as outfile: - outfile.write(all_out.strip() + "\n") - # remove rodata and unsplit file - # TODO + all_out = rodata_out + text_out + + # write it out + out_path = Path(asm_path.replace(ASM_OUT, f"{ASM_OUT}non_matchings/")).parent + if out_path.parts[2] not in ("overlays", "makerom"): + out_path /= file.name.split(".")[0] + out_path.mkdir(parents=True, exist_ok=True) + + out_path /= label + ".s" + with open(out_path, "w") as outfile: + outfile.write(all_out.strip() + "\n") diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index fc9f9fc534..a43ef93f45 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -562,7 +562,7 @@ 0x801C5E30 : "z_vr_box", 0x801C5FC0 : "z_sram_NES", 0x801D0470 : "z_message_nes", - 0x801D0B50 : "", + 0x801D0B50 : "z_player_call", 0x801D0B70 : "z_kaleido_manager", 0x801D0BB0 : "", 0x801D0C80 : "z_fbdemo", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 67f9906094..33bd070229 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2887,11 +2887,11 @@ 0x8015E750:("func_8015E750",), 0x8015E7EC:("func_8015E7EC",), 0x8015F8A8:("func_8015F8A8",), - 0x80160A90:("func_80160A90",), - 0x80160AF8:("func_80160AF8",), - 0x80160B40:("func_80160B40",), - 0x80160B80:("func_80160B80",), - 0x80160BC0:("func_80160BC0",), + 0x80160A90:("PlayerCall_InitFuncPtrs",), + 0x80160AF8:("PlayerCall_Init",), + 0x80160B40:("PlayerCall_Destroy",), + 0x80160B80:("PlayerCall_Update",), + 0x80160BC0:("PlayerCall_Draw",), 0x80160C00:("ShrinkWindow_SetLetterboxTarget",), 0x80160C14:("ShrinkWindow_GetLetterboxTarget",), 0x80160C28:("ShrinkWindow_SetLetterboxMagnitude",), @@ -3024,10 +3024,10 @@ 0x80169BF8:("func_80169BF8",), 0x80169C64:("Play_GetCsCamDataSetting",), 0x80169C84:("Play_GetCsCamDataVec3s",), - 0x80169CBC:("convert_scene_number_among_shared_scenes",), - 0x80169D40:("func_80169D40",), - 0x80169DCC:("func_80169DCC",), - 0x80169E6C:("func_80169E6C",), + 0x80169CBC:("Play_GetOriginalSceneNumber",), + 0x80169D40:("Play_SaveCycleSceneFlags",), + 0x80169DCC:("Play_SetRespawnData",), + 0x80169E6C:("Play_SetupRespawnPoint",), 0x80169ECC:("func_80169ECC",), 0x80169EFC:("func_80169EFC",), 0x80169F78:("func_80169F78",), @@ -3035,9 +3035,9 @@ 0x80169FFC:("func_80169FFC",), 0x8016A01C:("FrameAdvance_IsEnabled",), 0x8016A02C:("func_8016A02C",), - 0x8016A0AC:("func_8016A0AC",), + 0x8016A0AC:("Play_IsUnderwater",), 0x8016A168:("func_8016A168",), - 0x8016A178:("func_8016A178",), + 0x8016A178:("Play_AssignPlayerActorCsIdsFromScene",), 0x8016A268:("func_8016A268",), 0x8016A2C8:("Play_Init",), 0x8016AC10:("func_8016AC10",), @@ -4602,7 +4602,7 @@ 0x80841744:("func_80841744",), 0x8084182C:("func_8084182C",), 0x80841A50:("func_80841A50",), - 0x80841AC4:("func_80841AC4",), + 0x80841AC4:("Player_Init",), 0x80842510:("func_80842510",), 0x808425B4:("func_808425B4",), 0x808426F0:("func_808426F0",), @@ -4615,11 +4615,11 @@ 0x80844784:("func_80844784",), 0x80844D80:("func_80844D80",), 0x80844EF8:("func_80844EF8",), - 0x808460B8:("func_808460B8",), + 0x808460B8:("Player_Update",), 0x808463C0:("func_808463C0",), 0x80846460:("func_80846460",), - 0x80846528:("func_80846528",), - 0x808470D4:("func_808470D4",), + 0x80846528:("Player_Draw",), + 0x808470D4:("Player_Destroy",), 0x80847190:("func_80847190",), 0x8084748C:("func_8084748C",), 0x808475B4:("func_808475B4",), @@ -7655,7 +7655,7 @@ 0x8095376C:("func_8095376C",), 0x80953848:("func_80953848",), 0x80953888:("EnHs_Draw",), - 0x80953A90:("func_80953A90",), + 0x80953A90:("BgIngate_FindActor",), 0x80953B40:("func_80953B40",), 0x80953BEC:("func_80953BEC",), 0x80953DA8:("func_80953DA8",), @@ -9134,8 +9134,8 @@ 0x809CABC0:("func_809CABC0",), 0x809CACD0:("func_809CACD0",), 0x809CADE8:("EnSyatekiCrow_Update",), - 0x809CAE5C:("func_809CAE5C",), - 0x809CAF2C:("func_809CAF2C",), + 0x809CAE5C:("EnSyatekiCrow_OverrideLimbDraw",), + 0x809CAF2C:("EnSyatekiCrow_PostLimbDraw",), 0x809CAFEC:("EnSyatekiCrow_Draw",), 0x809CB200:("EnBoj04_Init",), 0x809CB210:("EnBoj04_Destroy",), @@ -10956,8 +10956,8 @@ 0x80A6FFAC:("func_80A6FFAC",), 0x80A70084:("func_80A70084",), 0x80A70134:("EnMm3_Update",), - 0x80A701E0:("func_80A701E0",), - 0x80A702B0:("func_80A702B0",), + 0x80A701E0:("EnMm3_OverrideLimbDraw",), + 0x80A702B0:("EnMm3_PostLimbDraw",), 0x80A702F0:("EnMm3_Draw",), 0x80A706F0:("BgCraceMovebg_Init",), 0x80A7090C:("func_80A7090C",), @@ -12208,7 +12208,7 @@ 0x80AD5394:("func_80AD5394",), 0x80AD54C8:("EnTrt2_OverrideLimbDraw",), 0x80AD5584:("EnTrt2_PostLimbDraw",), - 0x80AD566C:("EnTrt2_UnkDraw",), + 0x80AD566C:("EnTrt2_TransformLimbDraw",), 0x80AD56E8:("func_80AD56E8",), 0x80AD5BB0:("ObjTokeiStep_SetSysMatrix",), 0x80AD5BE8:("ObjTokeiStep_AddQuake",), @@ -12461,8 +12461,8 @@ 0x80AE5990:("EnFsn_Draw",), 0x80AE6130:("func_80AE6130",), 0x80AE615C:("func_80AE615C",), - 0x80AE61C0:("func_80AE61C0",), - 0x80AE625C:("func_80AE625C",), + 0x80AE61C0:("EnShn_IsFacingPlayer",), + 0x80AE625C:("EnShn_GetPlayer",), 0x80AE626C:("func_80AE626C",), 0x80AE63A8:("func_80AE63A8",), 0x80AE6488:("func_80AE6488",), @@ -12475,9 +12475,9 @@ 0x80AE6B30:("EnShn_Init",), 0x80AE6C4C:("EnShn_Destroy",), 0x80AE6C5C:("EnShn_Update",), - 0x80AE6CF0:("func_80AE6CF0",), - 0x80AE6D40:("func_80AE6D40",), - 0x80AE6D90:("func_80AE6D90",), + 0x80AE6CF0:("EnShn_OverrideLimbDraw",), + 0x80AE6D40:("EnShn_PostLimbDraw",), + 0x80AE6D90:("EnShn_TransformLimbDraw",), 0x80AE6E8C:("EnShn_Draw",), 0x80AE73A0:("EnStopheishi_Init",), 0x80AE74E0:("EnStopheishi_Destroy",), @@ -13297,8 +13297,8 @@ 0x80B25708:("EnRacedog_Update",), 0x80B2583C:("func_80B2583C",), 0x80B258D8:("func_80B258D8",), - 0x80B25A74:("func_80B25A74",), - 0x80B25A90:("func_80B25A90",), + 0x80B25A74:("EnRacedog_OverrideLimbDraw",), + 0x80B25A90:("EnRacedog_PostLimbDraw",), 0x80B25B14:("EnRacedog_Draw",), 0x80B262A0:("EnKendoJs_Init",), 0x80B264FC:("EnKendoJs_Destroy",), @@ -15505,7 +15505,7 @@ 0x80BC24C4:("EnJa_Update",), 0x80BC25E0:("EnJa_OverrideLimbDraw",), 0x80BC2620:("EnJa_PostLimbDraw",), - 0x80BC2B30:("EnJa_TransformDraw",), + 0x80BC2B30:("EnJa_TransformLimbDraw",), 0x80BC2CE4:("EnJa_Draw",), 0x80BC2EA4:("func_80BC2EA4",), 0x80BC3154:("func_80BC3154",), @@ -16057,9 +16057,9 @@ 0x80BE1424:("EnTab_Init",), 0x80BE1524:("EnTab_Destroy",), 0x80BE1550:("EnTab_Update",), - 0x80BE1648:("func_80BE1648",), - 0x80BE16B4:("func_80BE16B4",), - 0x80BE1704:("func_80BE1704",), + 0x80BE1648:("EnTab_OverrideLimbDraw",), + 0x80BE16B4:("EnTab_PostLimbDraw",), + 0x80BE1704:("EnTab_TransformDraw",), 0x80BE1810:("EnTab_Draw",), 0x80BE1C80:("func_80BE1C80",), 0x80BE1CEC:("EnNimotsu_Init",), @@ -16161,12 +16161,12 @@ 0x80BE8D94:("EnBaisen_Draw",), 0x80BE8F20:("EnHeishi_Init",), 0x80BE9090:("EnHeishi_Destroy",), - 0x80BE90BC:("func_80BE90BC",), - 0x80BE9148:("func_80BE9148",), - 0x80BE91DC:("func_80BE91DC",), - 0x80BE9214:("func_80BE9214",), + 0x80BE90BC:("EnHeishi_ChangeAnimation",), + 0x80BE9148:("EnHeishi_SetHeadRotation",), + 0x80BE91DC:("EnHeishi_SetupIdle",), + 0x80BE9214:("EnHeishi_Idle",), 0x80BE9224:("EnHeishi_Update",), - 0x80BE9380:("func_80BE9380",), + 0x80BE9380:("EnHeishi_OverrideLimbDraw",), 0x80BE93D8:("EnHeishi_Draw",), 0x80BE9510:("EnDemoheishi_Init",), 0x80BE95C0:("EnDemoheishi_Destroy",), @@ -16317,7 +16317,7 @@ 0x80BF2E04:("EnIg_Update",), 0x80BF2EDC:("EnIg_OverrideLimbDraw",), 0x80BF2EFC:("EnIg_PostLimbDraw",), - 0x80BF302C:("EnIg_UnkDraw",), + 0x80BF302C:("EnIg_TransformLimbDraw",), 0x80BF312C:("EnIg_Draw",), 0x80BF3920:("func_80BF3920",), 0x80BF3C64:("func_80BF3C64",), @@ -16974,14 +16974,14 @@ 0x80C1E108:("DmNb_Update",), 0x80C1E168:("DmNb_TransformLimbDraw",), 0x80C1E17C:("DmNb_Draw",), - 0x80C1E290:("func_80C1E290",), - 0x80C1E2D4:("func_80C1E2D4",), - 0x80C1E3DC:("func_80C1E3DC",), + 0x80C1E290:("EnDrs_CollisionUpdate",), + 0x80C1E2D4:("EnDrs_Setup",), + 0x80C1E3DC:("EnDrs_Idle",), 0x80C1E3EC:("EnDrs_Init",), 0x80C1E424:("EnDrs_Destroy",), 0x80C1E450:("EnDrs_Update",), - 0x80C1E4B0:("func_80C1E4B0",), - 0x80C1E568:("func_80C1E568",), + 0x80C1E4B0:("EnDrs_PostLimbDraw",), + 0x80C1E568:("EnDrs_Draw",), 0x80C1E690:("EnEndingHero_Init",), 0x80C1E738:("EnEndingHero_Destroy",), 0x80C1E748:("func_80C1E748",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index f6f7ba3219..633f86d35a 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2179,7 +2179,7 @@ 0x801D0D58:("D_801D0D58","UNK_TYPE2","",0x2), 0x801D0D5C:("D_801D0D5C","UNK_TYPE2","",0x2), 0x801D0D60:("D_801D0D60","Input*","",0x4), - 0x801D0D64:("D_801D0D64","UNK_TYPE2","",0x2), + 0x801D0D64:("D_801D0D64","s16","[10]",0x14), 0x801D0D7A:("D_801D0D7A","UNK_TYPE1","",0x1), 0x801D0D80:("D_801D0D80","UNK_TYPE1","",0x1), 0x801D11F4:("D_801D11F4","UNK_TYPE1","",0x1), @@ -4095,10 +4095,10 @@ 0x801F6B1E:("D_801F6B1E","UNK_TYPE1","",0x1), 0x801F6B20:("D_801F6B20","UNK_TYPE1","",0x1), 0x801F6B22:("D_801F6B22","UNK_TYPE1","",0x1), - 0x801F6B30:("D_801F6B30","UNK_TYPE1","",0x1), - 0x801F6B34:("D_801F6B34","UNK_TYPE1","",0x1), - 0x801F6B38:("D_801F6B38","UNK_TYPE1","",0x1), - 0x801F6B3C:("D_801F6B3C","UNK_TYPE1","",0x1), + 0x801F6B30:("sPlayerCallInitFunc","UNK_TYPE1","",0x1), + 0x801F6B34:("sPlayerCallDestroyFunc","UNK_TYPE1","",0x1), + 0x801F6B38:("sPlayerCallUpdateFunc","UNK_TYPE1","",0x1), + 0x801F6B3C:("sPlayerCallDrawFunc","UNK_TYPE1","",0x1), 0x801F6B40:("gShrinkWindowContext","ShrinkWindowContext","",0x4), 0x801F6B44:("gShrinkWindowContextPtr","ShrinkWindowContext*","",0x4), 0x801F6B50:("D_801F6B50","UNK_TYPE4","",0x4), @@ -14055,25 +14055,18 @@ 0x80B245CC:("D_80B245CC","UNK_TYPE4","",0x4), 0x80B245D0:("D_80B245D0","f32","",0x4), 0x80B25D20:("En_Racedog_InitVars","UNK_TYPE1","",0x1), - 0x80B25D40:("D_80B25D40","UNK_TYPE2","",0x2), - 0x80B25D44:("D_80B25D44","UNK_TYPE2","",0x2), - 0x80B25D48:("D_80B25D48","UNK_TYPE2","",0x2), - 0x80B25D4C:("D_80B25D4C","UNK_TYPE2","",0x2), - 0x80B25D50:("D_80B25D50","f32","",0x4), - 0x80B25D54:("D_80B25D54","f32","",0x4), - 0x80B25D88:("D_80B25D88","UNK_TYPE1","",0x1), - 0x80B25D90:("D_80B25D90","UNK_TYPE1","",0x1), - 0x80B25D94:("D_80B25D94","UNK_TYPE1","",0x1), - 0x80B25D96:("D_80B25D96","UNK_TYPE1","",0x1), - 0x80B25E68:("D_80B25E68","UNK_TYPE4","",0x4), - 0x80B25E72:("D_80B25E72","UNK_TYPE2","",0x2), - 0x80B25E78:("D_80B25E78","UNK_TYPE1","",0x1), - 0x80B25E98:("D_80B25E98","UNK_TYPE1","",0x1), - 0x80B25EC4:("D_80B25EC4","UNK_TYPE1","",0x1), - 0x80B25ED0:("D_80B25ED0","UNK_TYPE1","",0x1), - 0x80B25EF0:("D_80B25EF0","UNK_PTR","",0x4), - 0x80B25EF4:("D_80B25EF4","UNK_TYPE1","",0x1), - 0x80B25F14:("D_80B25F14","UNK_TYPE1","",0x1), + 0x80B25D40:("D_80B25D40","s16","",0x2), + 0x80B25D44:("D_80B25D44","s16","",0x2), + 0x80B25D48:("D_80B25D48","s16","",0x2), + 0x80B25D4C:("D_80B25D4C","s16","",0x2), + 0x80B25D50:("D_80B25D50","f32","",0x38), + 0x80B25D88:("D_80B25D88","UNK_TYPE1","",0xE0), + 0x80B25E68:("D_80B25E68","UNK_TYPE1","",0x10), + 0x80B25E78:("D_80B25E78","f32","",0x20), + 0x80B25E98:("D_80B25E98","UNK_TYPE1","",0x2C), + 0x80B25EC4:("D_80B25EC4","UNK_TYPE1","",0xC), + 0x80B25ED0:("D_80B25ED0","UNK_TYPE1","",0x20), + 0x80B25EF0:("D_80B25EF0","UNK_TYPE1","",0x100), 0x80B25FF0:("D_80B25FF0","UNK_TYPE1","",0x1), 0x80B25FF4:("D_80B25FF4","UNK_TYPE4","",0x4), 0x80B26000:("D_80B26000","UNK_TYPE4","",0x4), @@ -16173,9 +16166,9 @@ 0x80BE8E4C:("D_80BE8E4C","UNK_TYPE1","",0x1), 0x80BE8E58:("D_80BE8E58","UNK_TYPE1","",0x1), 0x80BE9430:("En_Heishi_InitVars","UNK_TYPE1","",0x1), - 0x80BE9450:("D_80BE9450","UNK_TYPE1","",0x1), - 0x80BE947C:("D_80BE947C","UNK_TYPE1","",0x1), - 0x80BE9490:("D_80BE9490","UNK_TYPE1","",0x1), + 0x80BE9450:("sCylinderInit","UNK_TYPE1","",0x1), + 0x80BE947C:("sAnimations","UNK_TYPE1","",0x1), + 0x80BE9490:("sAnimModes","UNK_TYPE1","",0x1), 0x80BE9A30:("En_Demo_heishi_InitVars","UNK_TYPE1","",0x1), 0x80BE9A50:("sCylinderInit","UNK_TYPE1","",0x1), 0x80BE9A7C:("sTextIds","UNK_TYPE1","",0x1), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 8ec9f8ca33..109d1df8af 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2401,11 +2401,11 @@ asm/non_matchings/code/z_message_nes/func_8015B198.s,func_8015B198,0x8015B198,0x asm/non_matchings/code/z_message_staff/func_8015E750.s,func_8015E750,0x8015E750,0x27 asm/non_matchings/code/z_message_staff/func_8015E7EC.s,func_8015E7EC,0x8015E7EC,0x42F asm/non_matchings/code/z_message_staff/func_8015F8A8.s,func_8015F8A8,0x8015F8A8,0x47A -asm/non_matchings/code/z_player_call/func_80160A90.s,func_80160A90,0x80160A90,0x1A -asm/non_matchings/code/z_player_call/func_80160AF8.s,func_80160AF8,0x80160AF8,0x12 -asm/non_matchings/code/z_player_call/func_80160B40.s,func_80160B40,0x80160B40,0x10 -asm/non_matchings/code/z_player_call/func_80160B80.s,func_80160B80,0x80160B80,0x10 -asm/non_matchings/code/z_player_call/func_80160BC0.s,func_80160BC0,0x80160BC0,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_InitFuncPtrs.s,PlayerCall_InitFuncPtrs,0x80160A90,0x1A +asm/non_matchings/code/z_player_call/PlayerCall_Init.s,PlayerCall_Init,0x80160AF8,0x12 +asm/non_matchings/code/z_player_call/PlayerCall_Destroy.s,PlayerCall_Destroy,0x80160B40,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_Update.s,PlayerCall_Update,0x80160B80,0x10 +asm/non_matchings/code/z_player_call/PlayerCall_Draw.s,PlayerCall_Draw,0x80160BC0,0x10 asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxTarget.s,ShrinkWindow_SetLetterboxTarget,0x80160C00,0x5 asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxTarget.s,ShrinkWindow_GetLetterboxTarget,0x80160C14,0x5 asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxMagnitude.s,ShrinkWindow_SetLetterboxMagnitude,0x80160C28,0x5 @@ -2538,10 +2538,10 @@ asm/non_matchings/code/z_play/Play_CameraGetUID.s,Play_CameraGetUID,0x80169BC4,0 asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s,Play_GetCsCamDataSetting,0x80169C64,0x8 asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s,Play_GetCsCamDataVec3s,0x80169C84,0xE -asm/non_matchings/code/z_play/convert_scene_number_among_shared_scenes.s,convert_scene_number_among_shared_scenes,0x80169CBC,0x21 -asm/non_matchings/code/z_play/func_80169D40.s,func_80169D40,0x80169D40,0x23 -asm/non_matchings/code/z_play/func_80169DCC.s,func_80169DCC,0x80169DCC,0x28 -asm/non_matchings/code/z_play/func_80169E6C.s,func_80169E6C,0x80169E6C,0x18 +asm/non_matchings/code/z_play/Play_GetOriginalSceneNumber.s,Play_GetOriginalSceneNumber,0x80169CBC,0x21 +asm/non_matchings/code/z_play/Play_SaveCycleSceneFlags.s,Play_SaveCycleSceneFlags,0x80169D40,0x23 +asm/non_matchings/code/z_play/Play_SetRespawnData.s,Play_SetRespawnData,0x80169DCC,0x28 +asm/non_matchings/code/z_play/Play_SetupRespawnPoint.s,Play_SetupRespawnPoint,0x80169E6C,0x18 asm/non_matchings/code/z_play/func_80169ECC.s,func_80169ECC,0x80169ECC,0xC asm/non_matchings/code/z_play/func_80169EFC.s,func_80169EFC,0x80169EFC,0x1F asm/non_matchings/code/z_play/func_80169F78.s,func_80169F78,0x80169F78,0x19 @@ -2549,7 +2549,7 @@ asm/non_matchings/code/z_play/func_80169FDC.s,func_80169FDC,0x80169FDC,0x8 asm/non_matchings/code/z_play/func_80169FFC.s,func_80169FFC,0x80169FFC,0x8 asm/non_matchings/code/z_play/FrameAdvance_IsEnabled.s,FrameAdvance_IsEnabled,0x8016A01C,0x4 asm/non_matchings/code/z_play/func_8016A02C.s,func_8016A02C,0x8016A02C,0x20 -asm/non_matchings/code/z_play/func_8016A0AC.s,func_8016A0AC,0x8016A0AC,0x2F +asm/non_matchings/code/z_play/Play_IsUnderwater.s,Play_IsUnderwater,0x8016A0AC,0x2F asm/non_matchings/code/z_play/func_8016A168.s,func_8016A168,0x8016A168,0x4 asm/non_matchings/code/z_play/func_8016A178.s,func_8016A178,0x8016A178,0x3C asm/non_matchings/code/z_play/func_8016A268.s,func_8016A268,0x8016A268,0x18 diff --git a/undefined_syms.txt b/undefined_syms.txt index d0ef176fd1..a003b1ae3d 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -649,11 +649,6 @@ D_06009830 = 0x06009830; D_0600ACB8 = 0x0600ACB8; D_0600BF40 = 0x0600BF40; -// ovl_Bg_Hakugin_Switch - -D_06000268 = 0x06000268; -D_060005C8 = 0x060005C8; - // ovl_Bg_Icefloe D_060001E0 = 0x060001E0; @@ -697,11 +692,6 @@ D_06012700 = 0x06012700; D_06012728 = 0x06012728; D_06012788 = 0x06012788; -// ovl_Bg_Ingate - -D_060006B0 = 0x060006B0; -D_060016DC = 0x060016DC; - // ovl_Bg_Keikoku_Saku D_06001640 = 0x06001640; @@ -1263,20 +1253,11 @@ D_0600D640 = 0x0600D640; D_06002950 = 0x06002950; -// ovl_En_Dno - -D_801C20C0 = 0x801C20C0; - // ovl_En_Dragon D_06004398 = 0x06004398; D_060048B8 = 0x060048B8; -// ovl_En_Drs - -D_06000E70 = 0x06000E70; -D_06005A78 = 0x06005A78; - // ovl_En_Ds2n D_06008038 = 0x06008038; @@ -1328,6 +1309,7 @@ D_06003DC8 = 0x06003DC8; // ovl_En_Fishing +D_060029C0 = 0x060029C0; D_0600007C = 0x0600007C; D_0600CFE0 = 0x0600CFE0; D_06011058 = 0x06011058; @@ -1367,15 +1349,6 @@ D_0600A344 = 0x0600A344; D_06001EFC = 0x06001EFC; D_0600A808 = 0x0600A808; -// ovl_En_Gg2 - -D_0600F578 = 0x0600F578; -D_0600F6C0 = 0x0600F6C0; - -// ovl_En_Goron_Oyu - -D_06000988 = 0x06000988; - // ovl_En_Grasshopper D_06000F9C = 0x06000F9C; @@ -1393,11 +1366,6 @@ D_060000C0 = 0x060000C0; D_06000444 = 0x06000444; D_06002FD0 = 0x06002FD0; -// ovl_En_Heishi - -D_06003BFC = 0x06003BFC; -D_0600D640 = 0x0600D640; - // ovl_En_Hgo D_0600B644 = 0x0600B644; @@ -1626,11 +1594,6 @@ D_06002EC0 = 0x06002EC0; D_06001C38 = 0x06001C38; D_06006CA0 = 0x06006CA0; -// ovl_En_Mm3 - -D_060096E8 = 0x060096E8; -D_0600A4E0 = 0x0600A4E0; - // ovl_En_Mnk D_06003584 = 0x06003584; @@ -1705,8 +1668,9 @@ D_06009930 = 0x06009930; D_0600A844 = 0x0600A844; D_06012768 = 0x06012768; -// ovl_En_Prz +// ovl_En_Pr2 +D_06003904 = 0x06003904; D_06004188 = 0x06004188; D_06004340 = 0x06004340; @@ -1714,12 +1678,6 @@ D_06004340 = 0x06004340; D_06001A80 = 0x06001A80; -// ovl_En_Racedog - -D_06000550 = 0x06000550; -D_06000618 = 0x06000618; -D_060080F0 = 0x060080F0; - // ovl_En_Raf D_06000108 = 0x06000108; @@ -1750,11 +1708,6 @@ D_0600D8D8 = 0x0600D8D8; D_060000F0 = 0x060000F0; D_060010C0 = 0x060010C0; -// ovl_En_Shn - -D_0600B738 = 0x0600B738; -D_0600E7D0 = 0x0600E7D0; - // ovl_En_Slime D_060004C0 = 0x060004C0; @@ -1800,11 +1753,6 @@ D_0600D640 = 0x0600D640; D_06006C18 = 0x06006C18; D_0600D640 = 0x0600D640; -// ovl_En_Syateki_Crow - -D_060000F0 = 0x060000F0; -D_060010C0 = 0x060010C0; - // ovl_En_Syateki_Dekunuts D_06001E50 = 0x06001E50; @@ -1823,10 +1771,6 @@ D_060091A8 = 0x060091A8; D_06011AC8 = 0x06011AC8; D_06012DE0 = 0x06012DE0; -// ovl_En_Tab - -D_06007F78 = 0x06007F78; - // ovl_En_Takaraya D_06000968 = 0x06000968; @@ -2006,15 +1950,6 @@ D_06001AA8 = 0x06001AA8; D_06000158 = 0x06000158; D_06001C00 = 0x06001C00; -// ovl_Obj_Hakaisi - -D_06001F10 = 0x06001F10; -D_060021B0 = 0x060021B0; -D_06002650 = 0x06002650; -D_060029C0 = 0x060029C0; -D_06002CC0 = 0x06002CC0; -D_06002FC4 = 0x06002FC4; - // ovl_Obj_Hariko D_06000080 = 0x06000080;