diff --git a/README.md b/README.md index 24b94be99..0dfb48d9f 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ md5sum: WARNING: 1 computed checksum did NOT match This means that something is wrong with the ROM's contents. Either the baserom files are incorrect due to a bad ROM, or some of the code is not matching. -Running `make init` will also make the `./expected` directory and copy all of the files there, which will be useful when running the diff script. The diff script is useful in decompiling functions and can be ran with this command: `./tools/asm-differ/diff.py -wmo3 ` +Running `make init` will also make the `./expected` directory and copy all of the files there, which will be useful when running the diff script. The diff script is useful in decompiling functions and can be run with this command: `./tools/asm-differ/diff.py -wmo3 ` **Note**: to speed up the build, you can pass `-jN` to `make setup` and `make`, where N is the number of threads to use in the build, e.g. `make -j4`. The generally-accepted wisdom is to use the number of virtual cores your computer has, which is the output of `nproc` (which should be installed as part of `coreutils`). The disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass `-jN`). @@ -144,4 +144,4 @@ Please note that is is our strict policy that *Anyone who wishes to contribute t Most discussions happen on our [Discord Server](https://discord.zelda64.dev), where you are welcome to ask if you need help getting started, or if you have any questions regarding this project or ZeldaRET's other decompilation projects. -For more information on getting started, see our [Contributing Guide](CONTRIBUTING.md), [Style Guide](docs/STYLE.md) and our [Code Review Guidelines](docs/REVIEWING.md) to see what code quality guidelines we follow. +For more information on getting started, see our [Contributing Guide](docs/CONTRIBUTING.md), [Style Guide](docs/STYLE.md) and our [Code Review Guidelines](docs/REVIEWING.md) to see what code quality guidelines we follow. diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index f0de8666c..11b6a0861 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -924,12 +924,14 @@ - + + - + + @@ -970,16 +972,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -1004,15 +1006,15 @@ - - - - - - - - - + + + + + + + + + @@ -1041,9 +1043,9 @@ - - - + + + diff --git a/assets/xml/objects/object_al.xml b/assets/xml/objects/object_al.xml index d0f6a6cbb..dc28bcf6b 100644 --- a/assets/xml/objects/object_al.xml +++ b/assets/xml/objects/object_al.xml @@ -1,71 +1,71 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml index f039e0114..3d8f7c385 100644 --- a/assets/xml/objects/object_ani.xml +++ b/assets/xml/objects/object_ani.xml @@ -36,13 +36,13 @@ - + - + diff --git a/assets/xml/objects/object_bat.xml b/assets/xml/objects/object_bat.xml index 35a5c158d..5a685024e 100644 --- a/assets/xml/objects/object_bat.xml +++ b/assets/xml/objects/object_bat.xml @@ -1,17 +1,21 @@  + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bba.xml b/assets/xml/objects/object_bba.xml index 144c685e4..c3c5a5c1b 100644 --- a/assets/xml/objects/object_bba.xml +++ b/assets/xml/objects/object_bba.xml @@ -18,7 +18,7 @@ - + diff --git a/assets/xml/objects/object_bigokuta.xml b/assets/xml/objects/object_bigokuta.xml index 21ead0501..2c54c6a61 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_bigslime.xml b/assets/xml/objects/object_bigslime.xml index 5b7530add..7195c20c7 100644 --- a/assets/xml/objects/object_bigslime.xml +++ b/assets/xml/objects/object_bigslime.xml @@ -65,30 +65,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bji.xml b/assets/xml/objects/object_bji.xml index b41ac1546..0fec0c8c3 100644 --- a/assets/xml/objects/object_bji.xml +++ b/assets/xml/objects/object_bji.xml @@ -3,21 +3,23 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -36,22 +38,27 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bjt.xml b/assets/xml/objects/object_bjt.xml index 6266711ab..59a71dcee 100644 --- a/assets/xml/objects/object_bjt.xml +++ b/assets/xml/objects/object_bjt.xml @@ -1,23 +1,28 @@  - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bsmask.xml b/assets/xml/objects/object_bsmask.xml index e776cde1a..ea94aa89e 100644 --- a/assets/xml/objects/object_bsmask.xml +++ b/assets/xml/objects/object_bsmask.xml @@ -1,28 +1,36 @@  + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_d_hsblock.xml b/assets/xml/objects/object_d_hsblock.xml index e9f90c011..b43647dc3 100644 --- a/assets/xml/objects/object_d_hsblock.xml +++ b/assets/xml/objects/object_d_hsblock.xml @@ -1,10 +1,11 @@  + - - - - - - + + + + + + diff --git a/assets/xml/objects/object_d_lift.xml b/assets/xml/objects/object_d_lift.xml index bcd707d68..475f7fd3e 100644 --- a/assets/xml/objects/object_d_lift.xml +++ b/assets/xml/objects/object_d_lift.xml @@ -3,9 +3,9 @@ - - - - + + + + diff --git a/assets/xml/objects/object_dog.xml b/assets/xml/objects/object_dog.xml index 89eba9c96..6941cb36c 100644 --- a/assets/xml/objects/object_dog.xml +++ b/assets/xml/objects/object_dog.xml @@ -17,7 +17,7 @@ - + diff --git a/assets/xml/objects/object_fsn.xml b/assets/xml/objects/object_fsn.xml index 2ed2b5d08..e3ae8db1b 100644 --- a/assets/xml/objects/object_fsn.xml +++ b/assets/xml/objects/object_fsn.xml @@ -53,8 +53,8 @@ - - + + diff --git a/assets/xml/objects/object_fu_kaiten.xml b/assets/xml/objects/object_fu_kaiten.xml index bce80f68c..37a7ec4bc 100644 --- a/assets/xml/objects/object_fu_kaiten.xml +++ b/assets/xml/objects/object_fu_kaiten.xml @@ -12,6 +12,7 @@ - + + diff --git a/assets/xml/objects/object_gi_arrow.xml b/assets/xml/objects/object_gi_arrow.xml index ab3bcbde9..5fcfeb6eb 100644 --- a/assets/xml/objects/object_gi_arrow.xml +++ b/assets/xml/objects/object_gi_arrow.xml @@ -1,7 +1,13 @@  + + + + - - - + + + + + diff --git a/assets/xml/objects/object_gi_arrowcase.xml b/assets/xml/objects/object_gi_arrowcase.xml index ae10b4faa..87d8c29fb 100644 --- a/assets/xml/objects/object_gi_arrowcase.xml +++ b/assets/xml/objects/object_gi_arrowcase.xml @@ -1,12 +1,20 @@  + + + + - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bean.xml b/assets/xml/objects/object_gi_bean.xml index e19b48d14..ed9d2b7a6 100644 --- a/assets/xml/objects/object_gi_bean.xml +++ b/assets/xml/objects/object_gi_bean.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_bigbomb.xml b/assets/xml/objects/object_gi_bigbomb.xml index 27d2a0741..042736edc 100644 --- a/assets/xml/objects/object_gi_bigbomb.xml +++ b/assets/xml/objects/object_gi_bigbomb.xml @@ -1,10 +1,17 @@  + - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bomb_1.xml b/assets/xml/objects/object_gi_bomb_1.xml index 98af21873..174927ca6 100644 --- a/assets/xml/objects/object_gi_bomb_1.xml +++ b/assets/xml/objects/object_gi_bomb_1.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_bomb_2.xml b/assets/xml/objects/object_gi_bomb_2.xml index ecd07c048..f5b3af67f 100644 --- a/assets/xml/objects/object_gi_bomb_2.xml +++ b/assets/xml/objects/object_gi_bomb_2.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_bombpouch.xml b/assets/xml/objects/object_gi_bombpouch.xml index 06eff7ced..2e9969cbd 100644 --- a/assets/xml/objects/object_gi_bombpouch.xml +++ b/assets/xml/objects/object_gi_bombpouch.xml @@ -1,12 +1,20 @@  + + + + - - - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bosskey.xml b/assets/xml/objects/object_gi_bosskey.xml index ae5ac2e75..5d4bda5c0 100644 --- a/assets/xml/objects/object_gi_bosskey.xml +++ b/assets/xml/objects/object_gi_bosskey.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_bottle.xml b/assets/xml/objects/object_gi_bottle.xml index 95a7b8bce..e978697ab 100644 --- a/assets/xml/objects/object_gi_bottle.xml +++ b/assets/xml/objects/object_gi_bottle.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_bottle_04.xml b/assets/xml/objects/object_gi_bottle_04.xml index f215d4059..ab90eb89d 100644 --- a/assets/xml/objects/object_gi_bottle_04.xml +++ b/assets/xml/objects/object_gi_bottle_04.xml @@ -1,12 +1,21 @@  + - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_15.xml b/assets/xml/objects/object_gi_bottle_15.xml index afea0f6ca..486e042a9 100644 --- a/assets/xml/objects/object_gi_bottle_15.xml +++ b/assets/xml/objects/object_gi_bottle_15.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_16.xml b/assets/xml/objects/object_gi_bottle_16.xml index 7ee7f3640..ab736f087 100644 --- a/assets/xml/objects/object_gi_bottle_16.xml +++ b/assets/xml/objects/object_gi_bottle_16.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_21.xml b/assets/xml/objects/object_gi_bottle_21.xml index 779b474cd..32cbd8e75 100644 --- a/assets/xml/objects/object_gi_bottle_21.xml +++ b/assets/xml/objects/object_gi_bottle_21.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_22.xml b/assets/xml/objects/object_gi_bottle_22.xml index d61397014..bbc2ea452 100644 --- a/assets/xml/objects/object_gi_bottle_22.xml +++ b/assets/xml/objects/object_gi_bottle_22.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_bottle_red.xml b/assets/xml/objects/object_gi_bottle_red.xml index c2f189dce..b52781d8d 100644 --- a/assets/xml/objects/object_gi_bottle_red.xml +++ b/assets/xml/objects/object_gi_bottle_red.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_bow.xml b/assets/xml/objects/object_gi_bow.xml index b7d62e12d..f5ba88dfa 100644 --- a/assets/xml/objects/object_gi_bow.xml +++ b/assets/xml/objects/object_gi_bow.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_camera.xml b/assets/xml/objects/object_gi_camera.xml index 81641ca30..5e94bf88b 100644 --- a/assets/xml/objects/object_gi_camera.xml +++ b/assets/xml/objects/object_gi_camera.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_compass.xml b/assets/xml/objects/object_gi_compass.xml index 49f7cf87e..9c724fc59 100644 --- a/assets/xml/objects/object_gi_compass.xml +++ b/assets/xml/objects/object_gi_compass.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_fieldmap.xml b/assets/xml/objects/object_gi_fieldmap.xml index bdb77ad0b..f4d6369a9 100644 --- a/assets/xml/objects/object_gi_fieldmap.xml +++ b/assets/xml/objects/object_gi_fieldmap.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_fish.xml b/assets/xml/objects/object_gi_fish.xml index 339f2d144..7c9f4be1f 100644 --- a/assets/xml/objects/object_gi_fish.xml +++ b/assets/xml/objects/object_gi_fish.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_ghost.xml b/assets/xml/objects/object_gi_ghost.xml index 813ba7d4e..3ea6ca582 100644 --- a/assets/xml/objects/object_gi_ghost.xml +++ b/assets/xml/objects/object_gi_ghost.xml @@ -1,11 +1,21 @@  + + + + - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_glasses.xml b/assets/xml/objects/object_gi_glasses.xml index 571f0ea6d..e089e2c8d 100644 --- a/assets/xml/objects/object_gi_glasses.xml +++ b/assets/xml/objects/object_gi_glasses.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_gold_dust.xml b/assets/xml/objects/object_gi_gold_dust.xml index ed787b2b2..523134bae 100644 --- a/assets/xml/objects/object_gi_gold_dust.xml +++ b/assets/xml/objects/object_gi_gold_dust.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_golonmask.xml b/assets/xml/objects/object_gi_golonmask.xml index c845fd0bd..87e65396e 100644 --- a/assets/xml/objects/object_gi_golonmask.xml +++ b/assets/xml/objects/object_gi_golonmask.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_heart.xml b/assets/xml/objects/object_gi_heart.xml index 0917876aa..1d9e72459 100644 --- a/assets/xml/objects/object_gi_heart.xml +++ b/assets/xml/objects/object_gi_heart.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_hearts.xml b/assets/xml/objects/object_gi_hearts.xml index 442ba21c7..0f5387cae 100644 --- a/assets/xml/objects/object_gi_hearts.xml +++ b/assets/xml/objects/object_gi_hearts.xml @@ -1,7 +1,13 @@  + + + + - - - + + + + + diff --git a/assets/xml/objects/object_gi_hookshot.xml b/assets/xml/objects/object_gi_hookshot.xml index 37a0b4642..54dbcdd74 100644 --- a/assets/xml/objects/object_gi_hookshot.xml +++ b/assets/xml/objects/object_gi_hookshot.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_insect.xml b/assets/xml/objects/object_gi_insect.xml index a7c3107ea..bba46991d 100644 --- a/assets/xml/objects/object_gi_insect.xml +++ b/assets/xml/objects/object_gi_insect.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_key.xml b/assets/xml/objects/object_gi_key.xml index bf4cdb727..2f4511f1d 100644 --- a/assets/xml/objects/object_gi_key.xml +++ b/assets/xml/objects/object_gi_key.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_ki_tan_mask.xml b/assets/xml/objects/object_gi_ki_tan_mask.xml index 313576631..3898630da 100644 --- a/assets/xml/objects/object_gi_ki_tan_mask.xml +++ b/assets/xml/objects/object_gi_ki_tan_mask.xml @@ -1,7 +1,15 @@  + + + + - - - + + + + + + + diff --git a/assets/xml/objects/object_gi_liquid.xml b/assets/xml/objects/object_gi_liquid.xml index bec768cfe..ed26c4267 100644 --- a/assets/xml/objects/object_gi_liquid.xml +++ b/assets/xml/objects/object_gi_liquid.xml @@ -1,19 +1,29 @@  + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_loach.xml b/assets/xml/objects/object_gi_loach.xml index c9c81f0b9..4ffcbfe73 100644 --- a/assets/xml/objects/object_gi_loach.xml +++ b/assets/xml/objects/object_gi_loach.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_longsword.xml b/assets/xml/objects/object_gi_longsword.xml index 6be60d411..5385b9639 100644 --- a/assets/xml/objects/object_gi_longsword.xml +++ b/assets/xml/objects/object_gi_longsword.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_m_arrow.xml b/assets/xml/objects/object_gi_m_arrow.xml index 6351783b5..595ad25d6 100644 --- a/assets/xml/objects/object_gi_m_arrow.xml +++ b/assets/xml/objects/object_gi_m_arrow.xml @@ -1,9 +1,17 @@  + + + + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_magicmushroom.xml b/assets/xml/objects/object_gi_magicmushroom.xml index ae6cbeb49..1d26dfa63 100644 --- a/assets/xml/objects/object_gi_magicmushroom.xml +++ b/assets/xml/objects/object_gi_magicmushroom.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_magicpot.xml b/assets/xml/objects/object_gi_magicpot.xml index 2abd48eef..459f010f4 100644 --- a/assets/xml/objects/object_gi_magicpot.xml +++ b/assets/xml/objects/object_gi_magicpot.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_map.xml b/assets/xml/objects/object_gi_map.xml index 250bb4613..c0cb2e070 100644 --- a/assets/xml/objects/object_gi_map.xml +++ b/assets/xml/objects/object_gi_map.xml @@ -1,7 +1,17 @@  + + + + - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask03.xml b/assets/xml/objects/object_gi_mask03.xml index 561ddef83..3bc62ba8e 100644 --- a/assets/xml/objects/object_gi_mask03.xml +++ b/assets/xml/objects/object_gi_mask03.xml @@ -1,13 +1,20 @@  + - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask05.xml b/assets/xml/objects/object_gi_mask05.xml index 307a3b2f4..c6bf0baad 100644 --- a/assets/xml/objects/object_gi_mask05.xml +++ b/assets/xml/objects/object_gi_mask05.xml @@ -1,11 +1,18 @@  + - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask06.xml b/assets/xml/objects/object_gi_mask06.xml index 256d9a91e..7d24b1d92 100644 --- a/assets/xml/objects/object_gi_mask06.xml +++ b/assets/xml/objects/object_gi_mask06.xml @@ -1,10 +1,17 @@  + - - - - - - + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask09.xml b/assets/xml/objects/object_gi_mask09.xml index d6db047d5..76efc6922 100644 --- a/assets/xml/objects/object_gi_mask09.xml +++ b/assets/xml/objects/object_gi_mask09.xml @@ -1,12 +1,19 @@  + - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask10.xml b/assets/xml/objects/object_gi_mask10.xml index adb3ee1d2..e7083f94b 100644 --- a/assets/xml/objects/object_gi_mask10.xml +++ b/assets/xml/objects/object_gi_mask10.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask11.xml b/assets/xml/objects/object_gi_mask11.xml index 46de5c2cd..e7b175b4d 100644 --- a/assets/xml/objects/object_gi_mask11.xml +++ b/assets/xml/objects/object_gi_mask11.xml @@ -1,14 +1,21 @@  + - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask12.xml b/assets/xml/objects/object_gi_mask12.xml index dced8d8eb..2f1508b9d 100644 --- a/assets/xml/objects/object_gi_mask12.xml +++ b/assets/xml/objects/object_gi_mask12.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask13.xml b/assets/xml/objects/object_gi_mask13.xml index b6d2c7733..8f5e7bf8f 100644 --- a/assets/xml/objects/object_gi_mask13.xml +++ b/assets/xml/objects/object_gi_mask13.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask14.xml b/assets/xml/objects/object_gi_mask14.xml index a3c96bb9d..0b9b5be28 100644 --- a/assets/xml/objects/object_gi_mask14.xml +++ b/assets/xml/objects/object_gi_mask14.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask15.xml b/assets/xml/objects/object_gi_mask15.xml index bc612c075..1f29f1bef 100644 --- a/assets/xml/objects/object_gi_mask15.xml +++ b/assets/xml/objects/object_gi_mask15.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask16.xml b/assets/xml/objects/object_gi_mask16.xml index 57124d4d4..4a0650cdd 100644 --- a/assets/xml/objects/object_gi_mask16.xml +++ b/assets/xml/objects/object_gi_mask16.xml @@ -1,11 +1,16 @@  + - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask17.xml b/assets/xml/objects/object_gi_mask17.xml index a509ca27e..a4df99986 100644 --- a/assets/xml/objects/object_gi_mask17.xml +++ b/assets/xml/objects/object_gi_mask17.xml @@ -1,13 +1,20 @@  + - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask18.xml b/assets/xml/objects/object_gi_mask18.xml index 8e1c8ca54..ad0364290 100644 --- a/assets/xml/objects/object_gi_mask18.xml +++ b/assets/xml/objects/object_gi_mask18.xml @@ -1,12 +1,19 @@  + - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask20.xml b/assets/xml/objects/object_gi_mask20.xml index 8b87c44fa..f04bb157e 100644 --- a/assets/xml/objects/object_gi_mask20.xml +++ b/assets/xml/objects/object_gi_mask20.xml @@ -1,11 +1,18 @@  + - - - - - - - + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask21.xml b/assets/xml/objects/object_gi_mask21.xml index 175d22b85..4696963ad 100644 --- a/assets/xml/objects/object_gi_mask21.xml +++ b/assets/xml/objects/object_gi_mask21.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask22.xml b/assets/xml/objects/object_gi_mask22.xml index 7b3a49e53..54b0c5595 100644 --- a/assets/xml/objects/object_gi_mask22.xml +++ b/assets/xml/objects/object_gi_mask22.xml @@ -1,13 +1,20 @@  + - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_mask23.xml b/assets/xml/objects/object_gi_mask23.xml index 458b7c825..6efa0147b 100644 --- a/assets/xml/objects/object_gi_mask23.xml +++ b/assets/xml/objects/object_gi_mask23.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_melody.xml b/assets/xml/objects/object_gi_melody.xml index d7617e7a6..4d4696528 100644 --- a/assets/xml/objects/object_gi_melody.xml +++ b/assets/xml/objects/object_gi_melody.xml @@ -1,11 +1,14 @@  + - - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_milk.xml b/assets/xml/objects/object_gi_milk.xml index 137dae777..0e2c37efa 100644 --- a/assets/xml/objects/object_gi_milk.xml +++ b/assets/xml/objects/object_gi_milk.xml @@ -1,7 +1,15 @@  + + + + - - - + + + + + + + diff --git a/assets/xml/objects/object_gi_mssa.xml b/assets/xml/objects/object_gi_mssa.xml index 6b61b00f5..ce1ae8c42 100644 --- a/assets/xml/objects/object_gi_mssa.xml +++ b/assets/xml/objects/object_gi_mssa.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_nuts.xml b/assets/xml/objects/object_gi_nuts.xml index 073e7db8f..d142cc8bd 100644 --- a/assets/xml/objects/object_gi_nuts.xml +++ b/assets/xml/objects/object_gi_nuts.xml @@ -1,6 +1,14 @@  + + + + - - + + + + + + diff --git a/assets/xml/objects/object_gi_nutsmask.xml b/assets/xml/objects/object_gi_nutsmask.xml index e34a593f2..c6df5804a 100644 --- a/assets/xml/objects/object_gi_nutsmask.xml +++ b/assets/xml/objects/object_gi_nutsmask.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_ocarina.xml b/assets/xml/objects/object_gi_ocarina.xml index 7b968a491..5856529e6 100644 --- a/assets/xml/objects/object_gi_ocarina.xml +++ b/assets/xml/objects/object_gi_ocarina.xml @@ -1,7 +1,15 @@  + + + + - - - + + + + + + + diff --git a/assets/xml/objects/object_gi_purse.xml b/assets/xml/objects/object_gi_purse.xml index 49cf9fd37..d24da1add 100644 --- a/assets/xml/objects/object_gi_purse.xml +++ b/assets/xml/objects/object_gi_purse.xml @@ -1,17 +1,24 @@  + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_rabit_mask.xml b/assets/xml/objects/object_gi_rabit_mask.xml index 172c080f1..16f536976 100644 --- a/assets/xml/objects/object_gi_rabit_mask.xml +++ b/assets/xml/objects/object_gi_rabit_mask.xml @@ -1,7 +1,15 @@  + + + + - - - + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve00.xml b/assets/xml/objects/object_gi_reserve00.xml index 1527a2630..3476ab719 100644 --- a/assets/xml/objects/object_gi_reserve00.xml +++ b/assets/xml/objects/object_gi_reserve00.xml @@ -1,11 +1,20 @@  + - - - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve01.xml b/assets/xml/objects/object_gi_reserve01.xml index c31c76698..5c6bb4d18 100644 --- a/assets/xml/objects/object_gi_reserve01.xml +++ b/assets/xml/objects/object_gi_reserve01.xml @@ -1,14 +1,21 @@  + - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_b_00.xml b/assets/xml/objects/object_gi_reserve_b_00.xml index 1c1e54390..1e2c37821 100644 --- a/assets/xml/objects/object_gi_reserve_b_00.xml +++ b/assets/xml/objects/object_gi_reserve_b_00.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_b_01.xml b/assets/xml/objects/object_gi_reserve_b_01.xml index 574763ee9..2bd1b2af2 100644 --- a/assets/xml/objects/object_gi_reserve_b_01.xml +++ b/assets/xml/objects/object_gi_reserve_b_01.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_c_00.xml b/assets/xml/objects/object_gi_reserve_c_00.xml index 86c6b15fb..f9cca9676 100644 --- a/assets/xml/objects/object_gi_reserve_c_00.xml +++ b/assets/xml/objects/object_gi_reserve_c_00.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_reserve_c_01.xml b/assets/xml/objects/object_gi_reserve_c_01.xml index da1530970..b88f74df5 100644 --- a/assets/xml/objects/object_gi_reserve_c_01.xml +++ b/assets/xml/objects/object_gi_reserve_c_01.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_rupy.xml b/assets/xml/objects/object_gi_rupy.xml index 69cd8bf5c..98d5714d6 100644 --- a/assets/xml/objects/object_gi_rupy.xml +++ b/assets/xml/objects/object_gi_rupy.xml @@ -1,18 +1,26 @@  + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_schedule.xml b/assets/xml/objects/object_gi_schedule.xml index e5025a993..9350bdcc3 100644 --- a/assets/xml/objects/object_gi_schedule.xml +++ b/assets/xml/objects/object_gi_schedule.xml @@ -1,11 +1,16 @@  + - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_seahorse.xml b/assets/xml/objects/object_gi_seahorse.xml index f35e2edc9..acc1e184d 100644 --- a/assets/xml/objects/object_gi_seahorse.xml +++ b/assets/xml/objects/object_gi_seahorse.xml @@ -1,12 +1,19 @@  + - - - - - - - - + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_shield_2.xml b/assets/xml/objects/object_gi_shield_2.xml index eb9fec8d2..e3b990bcf 100644 --- a/assets/xml/objects/object_gi_shield_2.xml +++ b/assets/xml/objects/object_gi_shield_2.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_shield_3.xml b/assets/xml/objects/object_gi_shield_3.xml index 8e011bb92..19f23203b 100644 --- a/assets/xml/objects/object_gi_shield_3.xml +++ b/assets/xml/objects/object_gi_shield_3.xml @@ -1,10 +1,15 @@  + - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_soldout.xml b/assets/xml/objects/object_gi_soldout.xml index 8a733af02..109a65072 100644 --- a/assets/xml/objects/object_gi_soldout.xml +++ b/assets/xml/objects/object_gi_soldout.xml @@ -1,6 +1,11 @@  + - - + + + + + + diff --git a/assets/xml/objects/object_gi_soul.xml b/assets/xml/objects/object_gi_soul.xml index 945670888..942062535 100644 --- a/assets/xml/objects/object_gi_soul.xml +++ b/assets/xml/objects/object_gi_soul.xml @@ -1,8 +1,16 @@  + + + + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_stick.xml b/assets/xml/objects/object_gi_stick.xml index c038af357..859e4f641 100644 --- a/assets/xml/objects/object_gi_stick.xml +++ b/assets/xml/objects/object_gi_stick.xml @@ -1,5 +1,11 @@  + + + + - + + + diff --git a/assets/xml/objects/object_gi_stonemask.xml b/assets/xml/objects/object_gi_stonemask.xml index 9d3b62b8c..497ace2df 100644 --- a/assets/xml/objects/object_gi_stonemask.xml +++ b/assets/xml/objects/object_gi_stonemask.xml @@ -1,8 +1,13 @@  + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_sutaru.xml b/assets/xml/objects/object_gi_sutaru.xml index 3b991123e..1a425dd2a 100644 --- a/assets/xml/objects/object_gi_sutaru.xml +++ b/assets/xml/objects/object_gi_sutaru.xml @@ -1,6 +1,12 @@  + + + + - - + + + + diff --git a/assets/xml/objects/object_gi_sword_1.xml b/assets/xml/objects/object_gi_sword_1.xml index a03de82d5..3f1bd41c0 100644 --- a/assets/xml/objects/object_gi_sword_1.xml +++ b/assets/xml/objects/object_gi_sword_1.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_2.xml b/assets/xml/objects/object_gi_sword_2.xml index 045936ef2..6a2bb445b 100644 --- a/assets/xml/objects/object_gi_sword_2.xml +++ b/assets/xml/objects/object_gi_sword_2.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_3.xml b/assets/xml/objects/object_gi_sword_3.xml index 79a207991..b347c33cf 100644 --- a/assets/xml/objects/object_gi_sword_3.xml +++ b/assets/xml/objects/object_gi_sword_3.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_sword_4.xml b/assets/xml/objects/object_gi_sword_4.xml index b5c826dc3..7732259c6 100644 --- a/assets/xml/objects/object_gi_sword_4.xml +++ b/assets/xml/objects/object_gi_sword_4.xml @@ -1,9 +1,14 @@  + - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_gi_truth_mask.xml b/assets/xml/objects/object_gi_truth_mask.xml index 52fdaaf65..cbc818cea 100644 --- a/assets/xml/objects/object_gi_truth_mask.xml +++ b/assets/xml/objects/object_gi_truth_mask.xml @@ -1,8 +1,16 @@  + + + + - - - - + + + + + + + + diff --git a/assets/xml/objects/object_gi_zoramask.xml b/assets/xml/objects/object_gi_zoramask.xml index c5ba218b4..7deefdf71 100644 --- a/assets/xml/objects/object_gi_zoramask.xml +++ b/assets/xml/objects/object_gi_zoramask.xml @@ -1,11 +1,16 @@  + - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/objects/object_harfgibud.xml b/assets/xml/objects/object_harfgibud.xml index a97e42c00..361bbe74c 100644 --- a/assets/xml/objects/object_harfgibud.xml +++ b/assets/xml/objects/object_harfgibud.xml @@ -5,23 +5,25 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -35,47 +37,51 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -91,25 +97,27 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 0b68303da..7042bf10b 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -1,106 +1,105 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_kamejima.xml b/assets/xml/objects/object_kamejima.xml index 9b45ad478..425e4643d 100644 --- a/assets/xml/objects/object_kamejima.xml +++ b/assets/xml/objects/object_kamejima.xml @@ -1,5 +1,8 @@  + + + diff --git a/assets/xml/objects/object_lastday.xml b/assets/xml/objects/object_lastday.xml index 9988ec1f8..e447edfbf 100644 --- a/assets/xml/objects/object_lastday.xml +++ b/assets/xml/objects/object_lastday.xml @@ -1,5 +1,8 @@  + + + diff --git a/assets/xml/objects/object_ma1.xml b/assets/xml/objects/object_ma1.xml index 3d0ea1fcc..4d60bb95f 100644 --- a/assets/xml/objects/object_ma1.xml +++ b/assets/xml/objects/object_ma1.xml @@ -1,96 +1,116 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ma2.xml b/assets/xml/objects/object_ma2.xml index a61eff4e0..5e642f340 100644 --- a/assets/xml/objects/object_ma2.xml +++ b/assets/xml/objects/object_ma2.xml @@ -1,85 +1,101 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nnh.xml b/assets/xml/objects/object_nnh.xml index 1bb833cf0..f7f546e25 100644 --- a/assets/xml/objects/object_nnh.xml +++ b/assets/xml/objects/object_nnh.xml @@ -1,10 +1,15 @@  + + - - - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_osn.xml b/assets/xml/objects/object_osn.xml index b31660e6a..2cb8315ea 100644 --- a/assets/xml/objects/object_osn.xml +++ b/assets/xml/objects/object_osn.xml @@ -112,6 +112,6 @@ - + diff --git a/assets/xml/objects/object_pamera.xml b/assets/xml/objects/object_pamera.xml index 6b457ab8b..28f73983e 100644 --- a/assets/xml/objects/object_pamera.xml +++ b/assets/xml/objects/object_pamera.xml @@ -1,26 +1,28 @@  - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -38,29 +40,31 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index f42fe1664..61bc0b404 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -1,53 +1,70 @@  + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sdn.xml b/assets/xml/objects/object_sdn.xml index 219436b02..88c62434e 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_sekihig.xml b/assets/xml/objects/object_sekihig.xml index dab91d71b..bb995bed4 100644 --- a/assets/xml/objects/object_sekihig.xml +++ b/assets/xml/objects/object_sekihig.xml @@ -1,16 +1,16 @@  - - - - - + + + + + - - - - - - + + + + + + diff --git a/assets/xml/objects/object_sekihil.xml b/assets/xml/objects/object_sekihil.xml index e3c7bcc42..fb9903875 100644 --- a/assets/xml/objects/object_sekihil.xml +++ b/assets/xml/objects/object_sekihil.xml @@ -1,16 +1,16 @@  - + - + - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_sekihin.xml b/assets/xml/objects/object_sekihin.xml index f2982169b..104f5f133 100644 --- a/assets/xml/objects/object_sekihin.xml +++ b/assets/xml/objects/object_sekihin.xml @@ -1,17 +1,17 @@  - - - - + + + + - + - - - - - - + + + + + + diff --git a/assets/xml/objects/object_sekihiz.xml b/assets/xml/objects/object_sekihiz.xml index 0f8ef7c43..9563d8b42 100644 --- a/assets/xml/objects/object_sekihiz.xml +++ b/assets/xml/objects/object_sekihiz.xml @@ -1,9 +1,9 @@  - - - - - + + + + + diff --git a/assets/xml/objects/object_st.xml b/assets/xml/objects/object_st.xml index 2dabce2f8..b8b39f94f 100644 --- a/assets/xml/objects/object_st.xml +++ b/assets/xml/objects/object_st.xml @@ -33,8 +33,8 @@ - - + + diff --git a/assets/xml/objects/object_stk2.xml b/assets/xml/objects/object_stk2.xml index 2aab5947e..d9bde796d 100644 --- a/assets/xml/objects/object_stk2.xml +++ b/assets/xml/objects/object_stk2.xml @@ -27,10 +27,10 @@ - - - - + + + + @@ -96,7 +96,7 @@ - + diff --git a/assets/xml/objects/object_um.xml b/assets/xml/objects/object_um.xml index 5717124a7..aa979bf75 100644 --- a/assets/xml/objects/object_um.xml +++ b/assets/xml/objects/object_um.xml @@ -10,26 +10,31 @@ - + + + - + - + + + + @@ -49,31 +54,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -85,7 +94,19 @@ - + + + + + + + + + + + + + @@ -100,6 +121,6 @@ - + diff --git a/assets/xml/objects/object_zog.xml b/assets/xml/objects/object_zog.xml index 627bb676a..15265596d 100644 --- a/assets/xml/objects/object_zog.xml +++ b/assets/xml/objects/object_zog.xml @@ -9,17 +9,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Bigslime.xml b/assets/xml/overlays/ovl_En_Bigslime.xml index 9526daea6..fe92a87fb 100644 --- a/assets/xml/overlays/ovl_En_Bigslime.xml +++ b/assets/xml/overlays/ovl_En_Bigslime.xml @@ -1,20 +1,14 @@ - + - - - - - - diff --git a/assets/xml/overlays/ovl_En_Sth2.xml b/assets/xml/overlays/ovl_En_Sth2.xml new file mode 100644 index 000000000..23140ad71 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Sth2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/include/PR/gbi.h b/include/PR/gbi.h index f7b249af8..2c29420ea 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -17,24 +17,24 @@ # define F3DEX_GBI # endif #define G_NOOP 0x00 -#define G_RDPHALF_2 0xf1 -#define G_SETOTHERMODE_H 0xe3 -#define G_SETOTHERMODE_L 0xe2 -#define G_RDPHALF_1 0xe1 -#define G_SPNOOP 0xe0 -#define G_ENDDL 0xdf -#define G_DL 0xde -#define G_LOAD_UCODE 0xdd -#define G_MOVEMEM 0xdc -#define G_MOVEWORD 0xdb -#define G_MTX 0xda -#define G_GEOMETRYMODE 0xd9 -#define G_POPMTX 0xd8 -#define G_TEXTURE 0xd7 -#define G_DMA_IO 0xd6 -#define G_SPECIAL_1 0xd5 -#define G_SPECIAL_2 0xd4 -#define G_SPECIAL_3 0xd3 +#define G_RDPHALF_2 0xF1 +#define G_SETOTHERMODE_H 0xE3 +#define G_SETOTHERMODE_L 0xE2 +#define G_RDPHALF_1 0xE1 +#define G_SPNOOP 0xE0 +#define G_ENDDL 0xDF +#define G_DL 0xDE +#define G_LOAD_UCODE 0xDD +#define G_MOVEMEM 0xDC +#define G_MOVEWORD 0xDB +#define G_MTX 0xDA +#define G_GEOMETRYMODE 0xD9 +#define G_POPMTX 0xD8 +#define G_TEXTURE 0xD7 +#define G_DMA_IO 0xD6 +#define G_SPECIAL_1 0xD5 +#define G_SPECIAL_2 0xD4 +#define G_SPECIAL_3 0xD3 #define G_VTX 0x01 #define G_MODIFYVTX 0x02 @@ -89,38 +89,38 @@ #define G_SPRITE2D_DRAW (G_IMMFIRST-2) /* RDP commands: */ -#define G_NOOP 0xc0 /* 0 */ +#define G_NOOP 0xC0 /* 0 */ #endif /* F3DEX_GBI_2 */ /* RDP commands: */ -#define G_SETCIMG 0xff /* -1 */ -#define G_SETZIMG 0xfe /* -2 */ -#define G_SETTIMG 0xfd /* -3 */ -#define G_SETCOMBINE 0xfc /* -4 */ -#define G_SETENVCOLOR 0xfb /* -5 */ -#define G_SETPRIMCOLOR 0xfa /* -6 */ -#define G_SETBLENDCOLOR 0xf9 /* -7 */ -#define G_SETFOGCOLOR 0xf8 /* -8 */ -#define G_SETFILLCOLOR 0xf7 /* -9 */ -#define G_FILLRECT 0xf6 /* -10 */ -#define G_SETTILE 0xf5 /* -11 */ -#define G_LOADTILE 0xf4 /* -12 */ -#define G_LOADBLOCK 0xf3 /* -13 */ -#define G_SETTILESIZE 0xf2 /* -14 */ -#define G_LOADTLUT 0xf0 /* -16 */ -#define G_RDPSETOTHERMODE 0xef /* -17 */ -#define G_SETPRIMDEPTH 0xee /* -18 */ -#define G_SETSCISSOR 0xed /* -19 */ -#define G_SETCONVERT 0xec /* -20 */ -#define G_SETKEYR 0xeb /* -21 */ -#define G_SETKEYGB 0xea /* -22 */ -#define G_RDPFULLSYNC 0xe9 /* -23 */ -#define G_RDPTILESYNC 0xe8 /* -24 */ -#define G_RDPPIPESYNC 0xe7 /* -25 */ -#define G_RDPLOADSYNC 0xe6 /* -26 */ -#define G_TEXRECTFLIP 0xe5 /* -27 */ -#define G_TEXRECT 0xe4 /* -28 */ +#define G_SETCIMG 0xFF /* -1 */ +#define G_SETZIMG 0xFE /* -2 */ +#define G_SETTIMG 0xFD /* -3 */ +#define G_SETCOMBINE 0xFC /* -4 */ +#define G_SETENVCOLOR 0xFB /* -5 */ +#define G_SETPRIMCOLOR 0xFA /* -6 */ +#define G_SETBLENDCOLOR 0xF9 /* -7 */ +#define G_SETFOGCOLOR 0xF8 /* -8 */ +#define G_SETFILLCOLOR 0xF7 /* -9 */ +#define G_FILLRECT 0xF6 /* -10 */ +#define G_SETTILE 0xF5 /* -11 */ +#define G_LOADTILE 0xF4 /* -12 */ +#define G_LOADBLOCK 0xF3 /* -13 */ +#define G_SETTILESIZE 0xF2 /* -14 */ +#define G_LOADTLUT 0xF0 /* -16 */ +#define G_RDPSETOTHERMODE 0xEF /* -17 */ +#define G_SETPRIMDEPTH 0xEE /* -18 */ +#define G_SETSCISSOR 0xED /* -19 */ +#define G_SETCONVERT 0xEC /* -20 */ +#define G_SETKEYR 0xEB /* -21 */ +#define G_SETKEYGB 0xEA /* -22 */ +#define G_RDPFULLSYNC 0xE9 /* -23 */ +#define G_RDPTILESYNC 0xE8 /* -24 */ +#define G_RDPPIPESYNC 0xE7 /* -25 */ +#define G_RDPLOADSYNC 0xE6 /* -26 */ +#define G_TEXRECTFLIP 0xE5 /* -27 */ +#define G_TEXRECT 0xE4 /* -28 */ /* @@ -131,14 +131,14 @@ * These id's are -56, -52, -54, -50, -55, -51, -53, -49, ... * edge, shade, texture, zbuff bits: estz */ -#define G_TRI_FILL 0xc8 /* fill triangle: 11001000 */ -#define G_TRI_SHADE 0xcc /* shade triangle: 11001100 */ -#define G_TRI_TXTR 0xca /* texture triangle: 11001010 */ -#define G_TRI_SHADE_TXTR 0xce /* shade, texture triangle: 11001110 */ -#define G_TRI_FILL_ZBUFF 0xc9 /* fill, zbuff triangle: 11001001 */ -#define G_TRI_SHADE_ZBUFF 0xcd /* shade, zbuff triangle: 11001101 */ -#define G_TRI_TXTR_ZBUFF 0xcb /* texture, zbuff triangle: 11001011 */ -#define G_TRI_SHADE_TXTR_ZBUFF 0xcf /* shade, txtr, zbuff trngl: 11001111 */ +#define G_TRI_FILL 0xC8 /* fill triangle: 11001000 */ +#define G_TRI_SHADE 0xCC /* shade triangle: 11001100 */ +#define G_TRI_TXTR 0xCA /* texture triangle: 11001010 */ +#define G_TRI_SHADE_TXTR 0xCE /* shade, texture triangle: 11001110 */ +#define G_TRI_FILL_ZBUFF 0xC9 /* fill, zbuff triangle: 11001001 */ +#define G_TRI_SHADE_ZBUFF 0xCD /* shade, zbuff triangle: 11001101 */ +#define G_TRI_TXTR_ZBUFF 0xCB /* texture, zbuff triangle: 11001011 */ +#define G_TRI_SHADE_TXTR_ZBUFF 0xCF /* shade, txtr, zbuff trngl: 11001111 */ /* * A TRI_FILL triangle is just the edges. You need to set the DP @@ -178,13 +178,13 @@ /* gets added to RDP command, in order to test for addres fixup: */ #define G_RDP_ADDR_FIXUP 3 /* |RDP cmds| <= this, do addr fixup */ #ifdef _LANGUAGE_ASSEMBLY -#define G_RDP_TEXRECT_CHECK ((-1*G_TEXRECTFLIP)& 0xff) +#define G_RDP_TEXRECT_CHECK ((-1*G_TEXRECTFLIP)& 0xFF) #endif /* macros for command parsing: */ #define GDMACMD(x) (x) #define GIMMCMD(x) (G_IMMFIRST-(x)) -#define GRDPCMD(x) (0xff-(x)) +#define GRDPCMD(x) (0xFF-(x)) #define G_DMACMDSIZ 128 #define G_IMMCMDSIZ 64 @@ -211,11 +211,11 @@ * Note : this number is NOT the viewport z-scale constant. * See the comment next to G_MAXZ for more info. */ -#define G_MAXFBZ 0x3fff /* 3b exp, 11b mantissa */ +#define G_MAXFBZ 0x3FFF /* 3b exp, 11b mantissa */ -#define GPACK_RGBA5551(r, g, b, a) ((((r)<<8) & 0xf800) | \ - (((g)<<3) & 0x7c0) | \ - (((b)>>2) & 0x3e) | ((a) & 0x1)) +#define GPACK_RGBA5551(r, g, b, a) ((((r)<<8) & 0xF800) | \ + (((g)<<3) & 0x7C0) | \ + (((b)>>2) & 0x3E) | ((a) & 0x1)) #define GPACK_IA16(i, a) (((i) << 8) | (a)) #define GPACK_ZDZ(z, dz) ((z) << 2 | (dz)) @@ -590,7 +590,7 @@ #define ZMODE_OPA 0 #define ZMODE_INTER 0x400 #define ZMODE_XLU 0x800 -#define ZMODE_DEC 0xc00 +#define ZMODE_DEC 0xC00 #define CVG_X_ALPHA 0x1000 #define ALPHA_CVG_SEL 0x2000 #define FORCE_BL 0x4000 @@ -1075,7 +1075,7 @@ typedef struct { * but we don't have the ucode to do that... * */ -#define G_MAXZ 0x03ff /* 10 bits of integer screen-Z precision */ +#define G_MAXZ 0x03FF /* 10 bits of integer screen-Z precision */ /* * The viewport structure elements have 2 bits of fraction, necessary @@ -1131,17 +1131,17 @@ typedef union { # define G_MV_LOOKATX 0x84 # define G_MV_L0 0x86 # define G_MV_L1 0x88 -# define G_MV_L2 0x8a -# define G_MV_L3 0x8c -# define G_MV_L4 0x8e +# define G_MV_L2 0x8A +# define G_MV_L3 0x8C +# define G_MV_L4 0x8E # define G_MV_L5 0x90 # define G_MV_L6 0x92 # define G_MV_L7 0x94 # define G_MV_TXTATT 0x96 -# define G_MV_MATRIX_1 0x9e /* NOTE: this is in moveword table */ +# define G_MV_MATRIX_1 0x9E /* NOTE: this is in moveword table */ # define G_MV_MATRIX_2 0x98 -# define G_MV_MATRIX_3 0x9a -# define G_MV_MATRIX_4 0x9c +# define G_MV_MATRIX_3 0x9A +# define G_MV_MATRIX_4 0x9C #endif /* F3DEX_GBI_2 */ /* @@ -1157,22 +1157,22 @@ typedef union { #define G_MW_CLIP 0x04 #define G_MW_SEGMENT 0x06 #define G_MW_FOG 0x08 -#define G_MW_LIGHTCOL 0x0a +#define G_MW_LIGHTCOL 0x0A #ifdef F3DEX_GBI_2 -# define G_MW_FORCEMTX 0x0c +# define G_MW_FORCEMTX 0x0C #else /* F3DEX_GBI_2 */ -# define G_MW_POINTS 0x0c +# define G_MW_POINTS 0x0C #endif /* F3DEX_GBI_2 */ -#define G_MW_PERSPNORM 0x0e +#define G_MW_PERSPNORM 0x0E /* * These are offsets from the address in the dmem table */ #define G_MWO_NUMLIGHT 0x00 #define G_MWO_CLIP_RNX 0x04 -#define G_MWO_CLIP_RNY 0x0c +#define G_MWO_CLIP_RNY 0x0C #define G_MWO_CLIP_RPX 0x14 -#define G_MWO_CLIP_RPY 0x1c +#define G_MWO_CLIP_RPY 0x1C #define G_MWO_SEGMENT_0 0x00 #define G_MWO_SEGMENT_1 0x01 #define G_MWO_SEGMENT_2 0x02 @@ -1183,30 +1183,30 @@ typedef union { #define G_MWO_SEGMENT_7 0x07 #define G_MWO_SEGMENT_8 0x08 #define G_MWO_SEGMENT_9 0x09 -#define G_MWO_SEGMENT_A 0x0a -#define G_MWO_SEGMENT_B 0x0b -#define G_MWO_SEGMENT_C 0x0c -#define G_MWO_SEGMENT_D 0x0d -#define G_MWO_SEGMENT_E 0x0e -#define G_MWO_SEGMENT_F 0x0f +#define G_MWO_SEGMENT_A 0x0A +#define G_MWO_SEGMENT_B 0x0B +#define G_MWO_SEGMENT_C 0x0C +#define G_MWO_SEGMENT_D 0x0D +#define G_MWO_SEGMENT_E 0x0E +#define G_MWO_SEGMENT_F 0x0F #define G_MWO_FOG 0x00 #define G_MWO_aLIGHT_1 0x00 #define G_MWO_bLIGHT_1 0x04 #ifdef F3DEX_GBI_2 #define G_MWO_aLIGHT_2 0x18 -#define G_MWO_bLIGHT_2 0x1c +#define G_MWO_bLIGHT_2 0x1C #define G_MWO_aLIGHT_3 0x30 #define G_MWO_bLIGHT_3 0x34 #define G_MWO_aLIGHT_4 0x48 -#define G_MWO_bLIGHT_4 0x4c +#define G_MWO_bLIGHT_4 0x4C #define G_MWO_aLIGHT_5 0x60 #define G_MWO_bLIGHT_5 0x64 #define G_MWO_aLIGHT_6 0x78 -#define G_MWO_bLIGHT_6 0x7c +#define G_MWO_bLIGHT_6 0x7C #define G_MWO_aLIGHT_7 0x90 #define G_MWO_bLIGHT_7 0x94 -#define G_MWO_aLIGHT_8 0xa8 -#define G_MWO_bLIGHT_8 0xac +#define G_MWO_aLIGHT_8 0xA8 +#define G_MWO_bLIGHT_8 0xAC #else #define G_MWO_aLIGHT_2 0x20 #define G_MWO_bLIGHT_2 0x24 @@ -1216,33 +1216,33 @@ typedef union { #define G_MWO_bLIGHT_4 0x64 #define G_MWO_aLIGHT_5 0x80 #define G_MWO_bLIGHT_5 0x84 -#define G_MWO_aLIGHT_6 0xa0 -#define G_MWO_bLIGHT_6 0xa4 -#define G_MWO_aLIGHT_7 0xc0 -#define G_MWO_bLIGHT_7 0xc4 -#define G_MWO_aLIGHT_8 0xe0 -#define G_MWO_bLIGHT_8 0xe4 +#define G_MWO_aLIGHT_6 0xA0 +#define G_MWO_bLIGHT_6 0xA4 +#define G_MWO_aLIGHT_7 0xC0 +#define G_MWO_bLIGHT_7 0xC4 +#define G_MWO_aLIGHT_8 0xE0 +#define G_MWO_bLIGHT_8 0xE4 #endif #define G_MWO_MATRIX_XX_XY_I 0x00 #define G_MWO_MATRIX_XZ_XW_I 0x04 #define G_MWO_MATRIX_YX_YY_I 0x08 -#define G_MWO_MATRIX_YZ_YW_I 0x0c +#define G_MWO_MATRIX_YZ_YW_I 0x0C #define G_MWO_MATRIX_ZX_ZY_I 0x10 #define G_MWO_MATRIX_ZZ_ZW_I 0x14 #define G_MWO_MATRIX_WX_WY_I 0x18 -#define G_MWO_MATRIX_WZ_WW_I 0x1c +#define G_MWO_MATRIX_WZ_WW_I 0x1C #define G_MWO_MATRIX_XX_XY_F 0x20 #define G_MWO_MATRIX_XZ_XW_F 0x24 #define G_MWO_MATRIX_YX_YY_F 0x28 -#define G_MWO_MATRIX_YZ_YW_F 0x2c +#define G_MWO_MATRIX_YZ_YW_F 0x2C #define G_MWO_MATRIX_ZX_ZY_F 0x30 #define G_MWO_MATRIX_ZZ_ZW_F 0x34 #define G_MWO_MATRIX_WX_WY_F 0x38 -#define G_MWO_MATRIX_WZ_WW_F 0x3c +#define G_MWO_MATRIX_WZ_WW_F 0x3C #define G_MWO_POINT_RGBA 0x10 #define G_MWO_POINT_ST 0x14 #define G_MWO_POINT_XYSCREEN 0x18 -#define G_MWO_POINT_ZSCREEN 0x1c +#define G_MWO_POINT_ZSCREEN 0x1C /* * Light structure. @@ -2373,14 +2373,14 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_CULLDL, 24, 8) | \ - ((0x0f & (vstart))*40); \ - _g->words.w1 = (unsigned int)((0x0f & ((vend)+1))*40); \ + ((0x0FF& (vstart))*40); \ + _g->words.w1 = (unsigned int)((0x0F & ((vend)+1))*40); \ } #define gsSPCullDisplayList(vstart,vend) \ { \ - _SHIFTL(G_CULLDL, 24, 8) | ((0x0f & (vstart))*40), \ - ((0x0f & ((vend)+1))*40) \ + _SHIFTL(G_CULLDL, 24, 8) | ((0x0F & (vstart))*40), \ + ((0x0F & ((vend)+1))*40) \ } #endif @@ -2393,17 +2393,17 @@ _DW({ \ * Clipping Macros */ #define FR_NEG_FRUSTRATIO_1 0x00000001 -#define FR_POS_FRUSTRATIO_1 0x0000ffff +#define FR_POS_FRUSTRATIO_1 0x0000FFFF #define FR_NEG_FRUSTRATIO_2 0x00000002 -#define FR_POS_FRUSTRATIO_2 0x0000fffe +#define FR_POS_FRUSTRATIO_2 0x0000FFFE #define FR_NEG_FRUSTRATIO_3 0x00000003 -#define FR_POS_FRUSTRATIO_3 0x0000fffd +#define FR_POS_FRUSTRATIO_3 0x0000FFFD #define FR_NEG_FRUSTRATIO_4 0x00000004 -#define FR_POS_FRUSTRATIO_4 0x0000fffc +#define FR_POS_FRUSTRATIO_4 0x0000FFFC #define FR_NEG_FRUSTRATIO_5 0x00000005 -#define FR_POS_FRUSTRATIO_5 0x0000fffb +#define FR_POS_FRUSTRATIO_5 0x0000FFFB #define FR_NEG_FRUSTRATIO_6 0x00000006 -#define FR_POS_FRUSTRATIO_6 0x0000fffa +#define FR_POS_FRUSTRATIO_6 0x0000FFFA /* * r should be one of: FRUSTRATIO_1, FRUSTRATIO_2, FRUSTRATIO_3, ... FRUSTRATIO_6 */ @@ -2867,18 +2867,18 @@ _DW({ \ gsSPLookAtY((char *)(la)+16) #define gDPSetHilite1Tile(pkt, tile, hilite, width, height) \ - gDPSetTileSize(pkt, tile, (hilite)->h.x1 & 0xfff, (hilite)->h.y1 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x1) & 0xfff, ((((height)-1)*4)+(hilite)->h.y1) & 0xfff) + gDPSetTileSize(pkt, tile, (hilite)->h.x1 & 0xFFF, (hilite)->h.y1 & 0xFFF, \ + ((((width)-1)*4)+(hilite)->h.x1) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y1) & 0xFFF) #define gsDPSetHilite1Tile(tile, hilite, width, height) \ - gsDPSetTileSize(tile, (hilite)->h.x1 & 0xfff, (hilite)->h.y1 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x1) & 0xfff, ((((height)-1)*4)+(hilite)->h.y1) & 0xfff) + gsDPSetTileSize(tile, (hilite)->h.x1 & 0xFFF, (hilite)->h.y1 & 0xFFF, \ + ((((width)-1)*4)+(hilite)->h.x1) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y1) & 0xFFF) #define gDPSetHilite2Tile(pkt, tile, hilite, width, height) \ - gDPSetTileSize(pkt, tile, (hilite)->h.x2 & 0xfff, (hilite)->h.y2 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x2) & 0xfff, ((((height)-1)*4)+(hilite)->h.y2) & 0xfff) + gDPSetTileSize(pkt, tile, (hilite)->h.x2 & 0xFFF, (hilite)->h.y2 & 0xFFF, \ + ((((width)-1)*4)+(hilite)->h.x2) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y2) & 0xFFF) #define gsDPSetHilite2Tile(tile, hilite, width, height) \ - gsDPSetTileSize(tile, (hilite)->h.x2 & 0xfff, (hilite)->h.y2 & 0xfff, \ - ((((width)-1)*4)+(hilite)->h.x2) & 0xfff, ((((height)-1)*4)+(hilite)->h.y2) & 0xfff) + gsDPSetTileSize(tile, (hilite)->h.x2 & 0xFFF, (hilite)->h.y2 & 0xFFF, \ + ((((width)-1)*4)+(hilite)->h.x2) & 0xFFF, ((((height)-1)*4)+(hilite)->h.y2) & 0xFFF) /* * FOG macros @@ -4333,7 +4333,7 @@ _DW({ \ { \ gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \ gDPTileSync(pkt); \ - gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xf)*16)), \ + gDPSetTile(pkt, 0, 0, 0, (256+(((pal)&0xF)*16)), \ G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0); \ gDPLoadSync(pkt); \ gDPLoadTLUTCmd(pkt, G_TX_LOADTILE, 15); \ @@ -4344,7 +4344,7 @@ _DW({ \ #define gDPLoadTLUT_pal16(pkt, pal, dram) \ \ - _gDPLoadTextureBlock(pkt, dram, (256+(((pal)&0xf)*16)), \ + _gDPLoadTextureBlock(pkt, dram, (256+(((pal)&0xF)*16)), \ G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \ pal, 0, 0, 0, 0, 0, 0) @@ -4361,7 +4361,7 @@ _DW({ \ \ gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \ gsDPTileSync(), \ - gsDPSetTile(0, 0, 0, (256+(((pal)&0xf)*16)), \ + gsDPSetTile(0, 0, 0, (256+(((pal)&0xF)*16)), \ G_TX_LOADTILE, 0 , 0, 0, 0, 0, 0, 0), \ gsDPLoadSync(), \ gsDPLoadTLUTCmd(G_TX_LOADTILE, 15), \ @@ -4371,7 +4371,7 @@ _DW({ \ #define gsDPLoadTLUT_pal16(pal, dram) \ \ - _gsDPLoadTextureBlock(dram, (256+(((pal)&0xf)*16)), \ + _gsDPLoadTextureBlock(dram, (256+(((pal)&0xF)*16)), \ G_IM_FMT_RGBA, G_IM_SIZ_16b, 4*16, 1, \ pal, 0, 0, 0, 0, 0, 0) diff --git a/include/PR/mbi.h b/include/PR/mbi.h index 736018c56..0577165e7 100644 --- a/include/PR/mbi.h +++ b/include/PR/mbi.h @@ -87,7 +87,7 @@ **************************************************************************/ #define NUM_SEGMENTS (16) -#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff) +#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00FFFFFF) #define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28) #define SEGMENT_ADDR(num, off) (((num) << 24) + (off)) diff --git a/include/functions.h b/include/functions.h index 94f977dfa..9233edc1d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -130,6 +130,7 @@ u32 StackCheck_Check(StackEntry* entry); void MtxConv_F2L(Mtx* m1, MtxF* m2); void MtxConv_L2F(MtxF* m1, Mtx* m2); + void __assert(const char* file, u32 lineNum); // void func_800862B4(void); void* SystemArena_MallocMin1(u32 size); @@ -893,11 +894,15 @@ void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyn void CollisionHeader_SegmentedToVirtual(CollisionHeader* header); void CollisionHeader_GetVirtual(CollisionHeader* meshSegPtr, CollisionHeader** param_2); void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play); -u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 dataIdx); -u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u16 SurfaceType_GetCameraSType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u16 SurfaceType_GetNumCameras(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); + +u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); +u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); +u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId); +Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); + u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 func_800C99D4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); @@ -929,8 +934,8 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceChkDist, WaterBox** outWaterBox, s32* bgId); f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId); -u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); -void func_800CA6B8(CollisionContext* colCtx, WaterBox* waterBox); +u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); +void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); @@ -974,7 +979,7 @@ f32 func_800CB700(Camera* camera); // void func_800CB7F8(void); // void func_800CB828(void); // void func_800CB854(void); -// void func_800CB880(void); +// void Camera_IsSwimming(void); // void func_800CB8C8(void); // void func_800CB8F4(void); // void func_800CB924(void); @@ -997,10 +1002,10 @@ f32 func_800CB700(Camera* camera); // void func_800CC488(void); // void func_800CC56C(void); // void func_800CC5C8(void); -// void func_800CC740(void); -// void func_800CC7A8(void); -// void func_800CC804(void); -// void func_800CC874(void); +// void Camera_GetBgCamOrActorCsCamSetting(void); +// void Camera_GetBgCamOrActorCsCamFuncData(void); +// void Camera_GetBgCamIndex(void); +// void Camera_GetWaterBoxBgCamSetting(void); // void func_800CC938(void); // void func_800CC958(void); // void func_800CC9C0(void); @@ -1389,30 +1394,8 @@ s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd); s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd); u8 Cutscene_IsPlaying(PlayState* play); -void GetItem_Draw(PlayState* play, s16 index); -void func_800EE364(PlayState* play, s16 index); -void func_800EE400(PlayState* play, s16 index); -void func_800EE5FC(PlayState* play, s16 index); -void func_800EE7D8(PlayState* play, s16 index); -void func_800EE940(PlayState* play, s16 index); -void func_800EEA48(PlayState* play, s16 index); -void func_800EEC18(PlayState* play, s16 index); -void func_800EED20(PlayState* play, s16 index); -void func_800EEE34(PlayState* play, s16 index); -void func_800EEF4C(PlayState* play, s16 index); -void func_800EF054(PlayState* play, s16 index); -void func_800EF0F0(PlayState* play, s16 index); -void func_800EF1F4(PlayState* play, s16 index); -void func_800EF2AC(PlayState* play, s16 index); -void func_800EF364(PlayState* play, s16 index); -void func_800EF4D4(PlayState* play, s16 index); -void func_800EF65C(PlayState* play, s16 index); -void func_800EF780(PlayState* play, s16 index); -void func_800EF89C(PlayState* play, s16 index); -void func_800EF984(PlayState* play, s16 index); -void func_800EFAB8(PlayState* play, s16 index); -void func_800EFBFC(PlayState* play, s16 index); -void func_800EFD44(PlayState* play, s16 index); +void GetItem_Draw(PlayState* play, s16 drawId); + void EffFootmark_Init(PlayState* play); void EffFootmark_Add(PlayState* play, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); void EffFootmark_Update(PlayState* play); @@ -1447,9 +1430,9 @@ s16 ActorCutscene_GetCurrentIndex(void); ActorCutscene* ActorCutscene_GetCutscene(s16 index); s16 ActorCutscene_GetAdditionalCutscene(s16 index); s16 ActorCutscene_GetLength(s16 index); -s32 func_800F2138(s8 arg0); +s32 func_800F2138(s32 arg0); s32 func_800F2178(s16 arg0); -s16 ActorCutscene_GetCurrentCamera(s16 index); +s16 ActorCutscene_GetCurrentSubCamId(s16 index); s16 func_800F21CC(void); s32 func_800F22C4(s16 param_1, Actor* actor); void ActorCutscene_SetReturnCamera(s16 index); @@ -1621,7 +1604,7 @@ void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src); void func_801000A4(u16 sfxId); void func_801000CC(u16 sfxId); void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId); -void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, Vec3f* src, Vec3f* dst); +void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 rotAngle, Vec3f* src, Vec3f* dst); void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst); f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed); void Lib_Nop801004FC(void); @@ -2239,7 +2222,7 @@ s32 Entrance_GetSceneNum(u16 entranceIndex); s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex); s32 Entrance_GetSpawnNum(u16 entranceIndex); s32 Entrance_GetTransitionFlags(u16 entranceIndex); -s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result); +s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output); void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx); @@ -2615,7 +2598,7 @@ s32 Play_CreateSubCamera(PlayState* play); s32 Play_GetActiveCamId(PlayState* play); void Play_CameraChangeStatus(PlayState* play, s16 camId, s16 status); void Play_ClearCamera(PlayState* play, s16 camId); -Camera* Play_GetCamera(PlayState* play, s16 index); +Camera* Play_GetCamera(PlayState* play, s16 camId); s32 Play_CameraSetAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); void Play_CameraSetAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); void Play_CameraSetFov(PlayState* play, s16 camId, f32 fov); @@ -2624,8 +2607,8 @@ void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId); // void func_80169A50(void); void Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting); void func_80169AFC(PlayState* play, s16 camId, s16 arg2); -s16 Play_GetCsCamDataSetting(PlayState* play, s32 camId); -Vec3s* Play_GetCsCamDataVec3s(PlayState* play, s32 camId); +u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); +Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); 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); @@ -3116,8 +3099,8 @@ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* ret u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts); void AudioLoad_DiscardSeqFonts(s32 seqId); void func_8018FA60(u32 tableType, u32 id, s32 arg2, s32 arg3); -s32 AudioLoad_SyncIniPlayer(s32 playerIdx, s32 seqId, s32 arg2); -s32 AudioLoad_SyncInitSetSeqqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks); +s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2); +s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks); void AudioLoad_ProcessLoads(s32 resetStatus); void AudioLoad_SetDmaHandler(DmaHandler callback); void AudioLoad_Init(void* heap, u32 heapSize); @@ -3190,43 +3173,17 @@ void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer); void AudioEffects_NoteVibratoUpdate(Note* note); void AudioEffects_NoteVibratoInit(Note* note); void AudioEffects_NotePortamentoInit(Note* note); -void AudioEffects_AdsrInit(AdsrState* adsr, AdsrEnvelope* envelope, s16* volOut); +void AudioEffects_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut); f32 AudioEffects_AdsrUpdate(AdsrState* adsr); -// void func_801974D0(void); -// void func_80197538(void); -// void func_80197714(void); -// void func_80197880(void); -// void func_801979D8(void); -// void func_80197A54(void); void AudioSeq_SequenceChannelDisable(SequenceChannel* channel); -// void func_80197B14(void); -// void func_80197C0C(void); -// void func_80197C8C(void); void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer); void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer); void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item); void* AudioSeq_AudioListPopBack(AudioListItem* list); -// void func_80197E88(void); -// void func_80197F28(void); -// void func_80197F3C(void); -// void func_80197F74(void); -// void func_80197FB4(void); -// void func_801980D0(void); -// void func_8019815C(void); -// void func_8019825C(void); -// void func_80198640(void); -// void func_80198CE0(void); -// void func_801990F4(void); -// void func_80199124(void); -// void func_80199198(void); -// void func_80199244(void); -void func_80199268(s32* param_1); -// void func_8019A0BC(void); -// void func_8019AA3C(void); -// void func_8019AAF0(void); +void AudioSeq_ProcessSequences(s32 arg0); +void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer); void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer); -void AudioSeq_InitSequencePlayerChannels(s32 playerIdx); -// void func_8019ACEC(void); +void AudioSeq_InitSequencePlayerChannels(s32 playerIndex); void AudioSeq_InitSequencePlayers(void); void func_8019AE40(s32 param_1, s32 param_2, u32 param_3, s32 param_4); void func_8019AEC0(UNK_PTR param_1, UNK_PTR param_2); @@ -3348,7 +3305,7 @@ void func_801A1DB8(Vec3f* vec, u8 seqId, f32 arg2); // void func_801A1E0C(void); void func_801A1F00(u8 arg0, u16 seqId); void func_801A1F88(void); -void func_801A1FB4(u8 playerIdx, Vec3f* pos, u16 seqId, f32 maxDist); +void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist); // void func_801A2090(void); void func_801A246C(u8 param_1, u8 param_2); // void func_801A2544(void); @@ -3466,7 +3423,7 @@ void Audio_QueueSeqCmd(u32 cmd); // void func_801A89D0(void); s32 func_801A8A50(s32 param1); // void func_801A8ABC(void); -void Audio_SetVolumeScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer); +void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); // void func_801A8D5C(void); // void func_801A8E90(void); // void func_801A9768(void); diff --git a/include/libc/stdint.h b/include/libc/stdint.h index 1696615a7..20288d40d 100644 --- a/include/libc/stdint.h +++ b/include/libc/stdint.h @@ -11,19 +11,19 @@ typedef u32 uintptr_t; #define INT32_MIN (-0x80000000) #define INT64_MIN (-0x8000000000000000) -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffff +#define INT8_MAX 0x7F +#define INT16_MAX 0x7FFF +#define INT32_MAX 0x7FFFFFFF +#define INT64_MAX 0x7FFFFFFFFFFFFFFF -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffff -#define UINT64_MAX 0xffffffffffffffff +#define UINT8_MAX 0xFF +#define UINT16_MAX 0xFFFF +#define UINT32_MAX 0xFFFFFFFF +#define UINT64_MAX 0xFFFFFFFFFFFFFFFF #define INTPTR_MIN (-0x80000000) -#define INTPTR_MAX 0x7fffffff -#define UINTPTR_MAX 0xffffffff +#define INTPTR_MAX 0x7FFFFFFF +#define UINTPTR_MAX 0xFFFFFFFF #endif /* STDINT_H */ diff --git a/include/macros.h b/include/macros.h index f4d165b12..5d1829c4c 100644 --- a/include/macros.h +++ b/include/macros.h @@ -25,28 +25,10 @@ (curState)->nextGameStateInit = (GameStateFunc)newInit; \ (curState)->nextGameStateSize = sizeof(newStruct) -#define SET_FULLSCREEN_VIEWPORT(view) \ - { \ - Viewport viewport; \ - viewport.bottomY = SCREEN_HEIGHT; \ - viewport.rightX = SCREEN_WIDTH; \ - viewport.topY = 0; \ - viewport.leftX = 0; \ - View_SetViewport(view, &viewport); \ - } \ - (void)0 - #define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].first) #define GET_FIRST_ENEMY(play) ((Actor*)(play)->actorCtx.actorLists[ACTORCAT_ENEMY].first) -// linkAge still exists in MM, but is always set to 0 (always adult) -// There are remnants of these macros from OOT, but they are essentially useless -#define LINK_IS_CHILD (gSaveContext.save.linkAge == 1) -#define LINK_IS_ADULT (gSaveContext.save.linkAge == 0) - -#define CURRENT_DAY (((void)0, gSaveContext.save.day) % 5) - #define CLOCK_TIME(hr, min) (s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)) #define CLOCK_TIME_MINUTE (CLOCK_TIME(0, 1)) #define DAY_LENGTH (CLOCK_TIME(24, 0)) @@ -57,66 +39,6 @@ #define TIME_TO_MINUTES_ALT_F(time) ((time) / (0x10000 / (24.0f * 60.0f))) #define CLOCK_TIME_ALT_F(hr, min) (((hr) * 60.0f + (min)) / (24.0f * 60.0f / 0x10000)) -#define SLOT(item) gItemSlots[item] -#define AMMO(item) gSaveContext.save.inventory.ammo[SLOT(item)] -#define INV_CONTENT(item) gSaveContext.save.inventory.items[SLOT(item)] -#define GET_INV_CONTENT(item) ((void)0, gSaveContext.save.inventory.items)[SLOT(item)] - -#define CUR_FORM ((gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.save.playerForm) - -#define GET_SAVE_EQUIPS_EQUIPMENT ((void)0, gSaveContext.save.equips.equipment) -#define GET_SAVE_INVENTORY_UPGRADES ((void)0, gSaveContext.save.inventory.upgrades) -#define GET_SAVE_INVENTORY_QUEST_ITEMS ((void)0, gSaveContext.save.inventory.questItems) - -#define GET_CUR_EQUIP_VALUE(equip) ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipMasks[equip]) >> gEquipShifts[equip]) - -#define CUR_UPG_VALUE(upg) ((gSaveContext.save.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) -#define GET_CUR_UPG_VALUE(upg) ((GET_SAVE_INVENTORY_UPGRADES & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) - -#define SET_EQUIP_VALUE(equip, value) (gSaveContext.save.equips.equipment = ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipNegMasks[equip]) | (u16)((u16)(value) << gEquipShifts[equip]))) - -#define BUTTON_ITEM_EQUIP(form, button) (gSaveContext.save.equips.buttonItems[form][button]) -#define CUR_FORM_EQUIP(button) BUTTON_ITEM_EQUIP(CUR_FORM, button) - -#define C_SLOT_EQUIP(form, button) (gSaveContext.save.equips.cButtonSlots[form][button]) -#define CHECK_QUEST_ITEM(item) (GET_SAVE_INVENTORY_QUEST_ITEMS & gBitFlags[item]) -#define SET_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS | gBitFlags[item])) -#define REMOVE_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) - -#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) -#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) -#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.inventory.dungeonKeys[(void)0, dungeonIndex]) - -#define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) -#define GET_CUR_FORM_BTN_SLOT(btn) ((u8)((btn) == EQUIP_SLOT_B ? C_SLOT_EQUIP(CUR_FORM, btn) : C_SLOT_EQUIP(0, btn))) - - -#define SET_CUR_FORM_BTN_ITEM(btn, item) \ - if ((btn) == EQUIP_SLOT_B) { \ - BUTTON_ITEM_EQUIP(CUR_FORM, (btn)) = (item); \ - } else { \ - BUTTON_ITEM_EQUIP(0, (btn)) = (item); \ - } \ - (void)0 - -#define SET_CUR_FORM_BTN_SLOT(btn, item) \ - if ((btn) == EQUIP_SLOT_B) { \ - C_SLOT_EQUIP(CUR_FORM, (btn)) = (item); \ - } else { \ - C_SLOT_EQUIP(0, (btn)) = (item); \ - } \ - (void)0 - -#define STOLEN_ITEM_NONE (0) - -#define STOLEN_ITEM_1 ((gSaveContext.save.stolenItems & 0xFF000000) >> 0x18) -#define STOLEN_ITEM_2 ((gSaveContext.save.stolenItems & 0x00FF0000) >> 0x10) - -#define SET_STOLEN_ITEM_1(itemId) \ - (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0xFF000000) | ((itemId & 0xFF) << 0x18)) -#define SET_STOLEN_ITEM_2(itemId) \ - (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10)) - #define CAPACITY(upg, value) gUpgradeCapacities[upg][value] #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) diff --git a/include/message_data_static.h b/include/message_data_static.h index f69e17232..d139c4621 100644 --- a/include/message_data_static.h +++ b/include/message_data_static.h @@ -3,7 +3,7 @@ #include "PR/ultratypes.h" -typedef struct MessageTableEntry{ +typedef struct MessageTableEntry { /* 0x0 */ u16 textId; /* 0x2 */ u8 typePos; /* 0x4 */ const char* segment; diff --git a/include/ultra64/gs2dex.h b/include/ultra64/gs2dex.h index 5c0bc7175..1e77f1cd3 100644 --- a/include/ultra64/gs2dex.h +++ b/include/ultra64/gs2dex.h @@ -20,7 +20,7 @@ extern "C" { * Background *---------------------------------------------------------------------------*/ #define G_BGLT_LOADBLOCK 0x0033 -#define G_BGLT_LOADTILE 0xfff4 +#define G_BGLT_LOADTILE 0xFFF4 #define G_BG_FLAG_FLIPS 0x01 #define G_BG_FLAG_FLIPT 0x10 @@ -155,7 +155,7 @@ typedef union { * Loading into TMEM *---------------------------------------------------------------------------*/ #define G_OBJLT_TXTRBLOCK 0x00001033 -#define G_OBJLT_TXTRTILE 0x00fc1034 +#define G_OBJLT_TXTRTILE 0x00FC1034 #define G_OBJLT_TLUT 0x00000030 #define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1) @@ -220,9 +220,9 @@ typedef struct { *===========================================================================*/ /* GBI Header */ #ifdef F3DEX_GBI_2 -#define G_OBJ_RECTANGLE_R 0xda -#define G_OBJ_MOVEMEM 0xdc -#define G_RDPHALF_0 0xe4 +#define G_OBJ_RECTANGLE_R 0xDA +#define G_OBJ_MOVEMEM 0xDC +#define G_RDPHALF_0 0xE4 #define G_OBJ_RECTANGLE 0x01 #define G_OBJ_SPRITE 0x02 #define G_SELECT_DL 0x04 @@ -231,22 +231,22 @@ typedef struct { #define G_OBJ_LDTX_RECT 0x07 #define G_OBJ_LDTX_RECT_R 0x08 #define G_BG_1CYC 0x09 -#define G_BG_COPY 0x0a -#define G_OBJ_RENDERMODE 0x0b +#define G_BG_COPY 0x0A +#define G_OBJ_RENDERMODE 0x0B #else #define G_BG_1CYC 0x01 #define G_BG_COPY 0x02 #define G_OBJ_RECTANGLE 0x03 #define G_OBJ_SPRITE 0x04 #define G_OBJ_MOVEMEM 0x05 -#define G_SELECT_DL 0xb0 -#define G_OBJ_RENDERMODE 0xb1 -#define G_OBJ_RECTANGLE_R 0xb2 -#define G_OBJ_LOADTXTR 0xc1 -#define G_OBJ_LDTX_SPRITE 0xc2 -#define G_OBJ_LDTX_RECT 0xc3 -#define G_OBJ_LDTX_RECT_R 0xc4 -#define G_RDPHALF_0 0xe4 +#define G_SELECT_DL 0xB0 +#define G_OBJ_RENDERMODE 0xB1 +#define G_OBJ_RECTANGLE_R 0xB2 +#define G_OBJ_LOADTXTR 0xC1 +#define G_OBJ_LDTX_SPRITE 0xC2 +#define G_OBJ_LDTX_RECT 0xC3 +#define G_OBJ_LDTX_RECT_R 0xC4 +#define G_RDPHALF_0 0xE4 #endif /*---------------------------------------------------------------------------* @@ -293,16 +293,16 @@ typedef struct { * Select Display List *---------------------------------------------------------------------------*/ #define gSPSelectDL(pkt, mptr, sid, flag, mask) \ -{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ +{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \ gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); } #define gsSPSelectDL(mptr, sid, flag, mask) \ -{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ +{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \ gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); } #define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \ -{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ +{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \ gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); } #define gsSPSelectBranchDL(mptr, sid, flag, mask) \ -{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \ +{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xFFFF, (sid)); \ gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); } /*---------------------------------------------------------------------------* diff --git a/include/ultra64/vi.h b/include/ultra64/vi.h index ca9b8e45e..7737b58b4 100644 --- a/include/ultra64/vi.h +++ b/include/ultra64/vi.h @@ -63,7 +63,7 @@ typedef struct { /* 0x02 */ u16 retraceCount; /* 0x04 */ void* buffer; /* 0x08 */ OSViMode* modep; - /* 0x0c */ u32 features; + /* 0x0C */ u32 features; /* 0x10 */ OSMesgQueue* mq; /* 0x14 */ OSMesg* msg; /* 0x18 */ __OSViScale x; diff --git a/include/variables.h b/include/variables.h index 5547f2eb0..558037457 100644 --- a/include/variables.h +++ b/include/variables.h @@ -870,7 +870,6 @@ extern EffectShieldParticleInit shieldParticleInitWood; extern u8 D_801BB12C; -extern s801BB170 D_801BB170[118]; // extern UNK_TYPE1 D_801BC210; extern Gfx D_801BC240[9]; extern Gfx D_801BC288[3]; @@ -917,7 +916,7 @@ extern u8 kanfontOrdering[92]; // extern UNK_TYPE1 D_801BDBA0; // extern UNK_TYPE1 D_801BDBA4; // extern UNK_TYPE1 D_801BDBA8; -extern u8 D_801BDBB0; +extern u8 gWeatherMode; // extern UNK_TYPE1 D_801BDBB4; // extern UNK_TYPE1 D_801BDBB8; // extern UNK_TYPE1 D_801BDBBC; @@ -1554,16 +1553,12 @@ extern s16 gHighPassFilterData[]; extern s16 gBandStopFilterData[]; extern s16 gBandPassFilterData[]; extern s16* gWaveSamples[9]; -extern UNK_PTR D_801D4D98; -extern UNK_PTR D_801D4DB0; extern f32 gBendPitchOneOctaveFrequencies[256]; -// extern UNK_TYPE1 D_801D4FB4; -// extern UNK_TYPE4 gBendPitchTwoSemitonesFrequencies; -// extern UNK_TYPE4 D_801D53B4; -// extern UNK_TYPE1 gPitchFrequencies; -// extern UNK_TYPE1 gDefaultShortNoteVelocityTable; -// extern UNK_TYPE1 gDefaultShortNoteGateTimeTable; -// extern UNK_TYPE1 gDefaultEnvelope; +extern f32 gBendPitchTwoSemitonesFrequencies[]; +extern f32 gPitchFrequencies[]; +extern u8 gDefaultShortNoteVelocityTable[]; +extern u8 gDefaultShortNoteGateTimeTable[]; +extern EnvelopePoint gDefaultEnvelope[]; extern NoteSubEu gZeroNoteSub; extern NoteSubEu gDefaultNoteSub; extern u16 gHeadsetPanQuantization[]; diff --git a/include/z64.h b/include/z64.h index 6fdff9951..7e53f281f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -39,6 +39,7 @@ #include "z64light.h" #include "z64map.h" #include "z64math.h" +#include "z64message.h" #include "z64object.h" #include "z64ocarina.h" #include "z64player.h" @@ -48,6 +49,7 @@ #include "z64skin.h" #include "z64subs.h" #include "z64transition.h" +#include "z64view.h" #include "regs.h" #define Z_THREAD_ID_IDLE 1 @@ -168,25 +170,6 @@ typedef struct FireObjLightParams { /* 0x5 */ Color_RGB8 maxColorAdj; } FireObjLightParams; // size = 0x8 -#define FONT_CHAR_TEX_WIDTH 16 -#define FONT_CHAR_TEX_HEIGHT 16 -//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` -#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture - -// Font textures are loaded into here -typedef struct { - /* 0x00000 */ u8 charBuf[2][FONT_CHAR_TEX_SIZE * 120]; - /* 0x07800 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; - /* 0x07880 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; - /* 0x11880 */ union { - u8 schar[640]; - u16 wchar[640]; - } msgBuf; - /* 0x11D80 */ u8* messageStart; - /* 0x11D84 */ u8* messageEnd; - /* 0x11D88 */ u8 unk_11D88; // current Char Buffer ? -} Font; // size = 0x11D8C - // Game Info aka. Static Context // Data normally accessed through REG macros (see regs.h) typedef struct { @@ -310,13 +293,6 @@ typedef struct { /* 0x3 */ s8 pillarboxMagnitude; } ShrinkWindowContext; // size = 0x4 -typedef struct { - /* 0x0 */ s32 topY; - /* 0x4 */ s32 bottomY; - /* 0x8 */ s32 leftX; - /* 0xC */ s32 rightX; -} Viewport; // size = 0x10 - typedef void(*osCreateThread_func)(void*); typedef enum { @@ -422,34 +398,6 @@ typedef struct { /* 0x10 */ Vec3f projectedPos; } SoundSource; // size = 0x1C -typedef struct { - /* 0x000 */ u32 magic; - /* 0x004 */ GraphicsContext* gfxCtx; - /* 0x008 */ Viewport viewport; - /* 0x018 */ f32 fovy; - /* 0x01C */ f32 zNear; - /* 0x020 */ f32 zFar; - /* 0x024 */ f32 scale; - /* 0x028 */ Vec3f eye; - /* 0x034 */ Vec3f at; - /* 0x040 */ Vec3f up; - /* 0x04C */ UNK_TYPE1 pad4C[0x4]; - /* 0x050 */ Vp vp; - /* 0x060 */ Mtx projection; - /* 0x0A0 */ Mtx viewing; - /* 0x0E0 */ Mtx unkE0; - /* 0x120 */ Mtx* projectionPtr; - /* 0x124 */ Mtx* viewingPtr; - /* 0x128 */ Vec3f distortionDirRot; - /* 0x134 */ Vec3f distortionScale; - /* 0x140 */ f32 distortionSpeed; - /* 0x144 */ Vec3f curDistortionDirRot; - /* 0x150 */ Vec3f curDistortionScale; - /* 0x15C */ u16 normal; - /* 0x160 */ u32 flags; // bit 3: Render to an orthographic perspective - /* 0x164 */ s32 unk164; -} View; // size = 0x168 - typedef void(*fault_update_input_func)(Input* input); typedef struct { @@ -476,7 +424,7 @@ typedef struct { /* 0x1D0 */ OSMesgQueue loadQueue; /* 0x1E8 */ OSMesg loadMsg; /* 0x1EC */ u16 state; - /* 0x1EE */ u16 debugState; + /* 0x1EE */ u16 debugEditor; /* 0x1F0 */ u8 unk_1F0; /* 0x1F4 */ Vec3f eye; /* 0x200 */ u16 unk_200; @@ -494,8 +442,8 @@ typedef struct { /* 0x226 */ s16 offsetY; /* 0x228 */ s32 unk_228; /* 0x22C */ s32 unk_22C; - /* 0x230 */ s32 unk_230; - /* 0x234 */ s32 unk_234; + /* 0x230 */ s32 stickRelX; + /* 0x234 */ s32 stickRelY; /* 0x238 */ s16 unk_238[5]; /* 0x242 */ s16 unk_242[5]; /* 0x24C */ s16 unk_24C[5]; @@ -865,102 +813,63 @@ typedef struct { /* 0x24 */ u32 flags; } PreRenderParams; // size = 0x28 -typedef struct { - /* 0x00 */ u8 unk00; - /* 0x01 */ u8 unk01; -} MsgCtx11F00; +#define TRANS_TRIGGER_OFF 0 // transition is not active +#define TRANS_TRIGGER_START 20 // start transition (exiting an area) +#define TRANS_TRIGGER_END -20 // transition is ending (arriving in a new area) -typedef struct { - /* 0x00000 */ View view; - /* 0x00168 */ Font font; - /* 0x11EF4 */ char unk_11EF4[0x4]; - /* 0x11EF8 */ UNK_PTR unk11EF8; - /* 0x11EFC */ UNK_TYPE1 unk11EFC[0x4]; - /* 0x11F00 */ MsgCtx11F00* unk11F00; - /* 0x11F04 */ u16 currentTextId; - /* 0x11F06 */ UNK_TYPE1 pad11F06[0x4]; - /* 0x11F0A */ u8 unk11F0A; - /* 0x11F0B */ UNK_TYPE1 pad11F0B[0x5]; - /* 0x11F10 */ s32 unk11F10; - /* 0x11F14 */ UNK_TYPE1 pad11F14[0x6]; - /* 0x11F1A */ s16 unk11F1A[3]; - /* 0x11F20 */ UNK_TYPE1 pad11F20[0x2]; - /* 0x11F22 */ u8 msgMode; - /* 0x11F23 */ UNK_TYPE1 pad11F23; - /* 0x11F24 */ union { - u8 schar[206]; - u16 wchar[103]; - } decodedBuffer; - /* 0x11FF2 */ u16 unk11FF2; - /* 0x11FF4 */ s16 unk11FF4; - /* 0x11FF6 */ s16 unk11FF6; - /* 0x11FF8 */ UNK_TYPE1 unk11FF8[0x6]; - /* 0x11FFE */ s16 unk11FFE[0x3]; - /* 0x12004 */ s16 unk12004; - /* 0x12006 */ s16 unk12006; - /* 0x12008 */ u8 unk12008[0x16]; - /* 0x1201E */ s16 unk1201E; - /* 0x12020 */ u8 unk12020; - /* 0x12021 */ u8 choiceIndex; - /* 0x12022 */ u8 unk12022; - /* 0x12023 */ u8 unk12023; - /* 0x12024 */ s16 unk12024; - /* 0x12026 */ u16 unk12026; - /* 0x12028 */ u16 songPlayed; - /* 0x1202A */ u16 ocarinaMode; - /* 0x1202C */ u16 ocarinaAction; - /* 0x1202E */ u16 unk1202E; - /* 0x12030 */ s16 unk_12030; - /* 0x12032 */ UNK_TYPE1 unk_12032[0x2]; - /* 0x12034 */ UNK_TYPE1 pad12034[0x6]; - /* 0x1203A */ s16 unk1203A; - /* 0x1203C */ s16 unk1203C; - /* 0x1203E */ s16 pad1203E; - /* 0x12040 */ Actor* unkActor; - /* 0x12044 */ s16 unk12044; - /* 0x12046 */ s16 unk12046; - /* 0x12048 */ u8 unk12048; // EnKakasi - /* 0x12049 */ UNK_TYPE1 pad12049[0x1]; - /* 0x1204A */ s16 unk1204A[0x5]; - /* 0x12054 */ s16 unk12054[3]; // First, second and third digits in lottery code guess - /* 0x1205A */ UNK_TYPE1 pad1205A[0xE]; - /* 0x12068 */ s16 unk12068; - /* 0x1206A */ s16 unk1206A; - /* 0x1206C */ s32 unk1206C; - /* 0x12070 */ s32 unk12070; - /* 0x12074 */ UNK_TYPE1 pad12074[0x4]; - /* 0x12078 */ s32 bankRupeesSelected; - /* 0x1207C */ s32 bankRupees; - /* 0x12080 */ MessageTableEntry* messageEntryTable; - /* 0x12084 */ MessageTableEntry* messageEntryTableNes; - /* 0x12088 */ UNK_TYPE4 unk12088; - /* 0x1208C */ MessageTableEntry* messageTableStaff; - /* 0x12090 */ s16 unk12090; - /* 0x12092 */ s16 unk12092; - /* 0x12094 */ s8 unk12094; - /* 0x12095 */ UNK_TYPE1 unk12095[0x3]; - /* 0x12098 */ f32 unk12098; // Text_Scale? - /* 0x1209C */ s16 unk1209C; - /* 0x1209E */ UNK_TYPE1 unk1209E[0x2]; - /* 0x120A0 */ s32 unk120A0; - /* 0x120A4 */ UNK_TYPE1 unk120A4[0xC]; - /* 0x120B0 */ u8 unk120B0; - /* 0x120B1 */ u8 unk120B1; - /* 0x120B2 */ u8 unk120B2[0xC]; - /* 0x120BE */ s16 unk120BE; - /* 0x120C0 */ s16 unk120C0; - /* 0x120C2 */ s16 unk120C2; - /* 0x120C4 */ s32 unk120C4; - /* 0x120C8 */ s16 unk120C8; - /* 0x120CA */ s16 unk120CA; - /* 0x120CC */ s16 unk120CC; - /* 0x120CE */ s16 unk120CE; - /* 0x120D0 */ s16 unk120D0; - /* 0x120D2 */ s16 unk120D2; - /* 0x120D4 */ s16 unk120D4; - /* 0x120D6 */ s16 unk120D6; - /* 0x120D8 */ UNK_TYPE1 pad120D8[0x8]; -} MessageContext; // size = 0x120E0 +typedef enum { + /* 0 */ TRANS_MODE_OFF, + /* 1 */ TRANS_MODE_01, + /* 2 */ TRANS_MODE_02, + /* 3 */ TRANS_MODE_03, + /* 4 */ TRANS_MODE_04, + /* 5 */ TRANS_MODE_05, + /* 6 */ TRANS_MODE_06, + /* 7 */ TRANS_MODE_07, + /* 8 */ TRANS_MODE_08, + /* 9 */ TRANS_MODE_09, + /* 10 */ TRANS_MODE_10, + /* 11 */ TRANS_MODE_11, + /* 12 */ TRANS_MODE_12, + /* 13 */ TRANS_MODE_13, + /* 14 */ TRANS_MODE_14, + /* 15 */ TRANS_MODE_15, + /* 16 */ TRANS_MODE_16, + /* 17 */ TRANS_MODE_17 +} TransitionMode; + +typedef enum { + /* 0 */ TRANS_TYPE_00, + /* 1 */ TRANS_TYPE_01, + /* 2 */ TRANS_TYPE_02, + /* 3 */ TRANS_TYPE_03, + /* 4 */ TRANS_TYPE_04, + /* 5 */ TRANS_TYPE_05, + /* 6 */ TRANS_TYPE_06, + /* 7 */ TRANS_TYPE_07, + /* 8 */ TRANS_TYPE_08, + /* 9 */ TRANS_TYPE_09, + /* 10 */ TRANS_TYPE_10, + /* 11 */ TRANS_TYPE_11, + /* 12 */ TRANS_TYPE_12, + /* 13 */ TRANS_TYPE_13, + /* 14 */ TRANS_TYPE_14, + /* 15 */ TRANS_TYPE_15, + /* 16 */ TRANS_TYPE_16, + /* 17 */ TRANS_TYPE_17, + /* 18 */ TRANS_TYPE_18, + /* 19 */ TRANS_TYPE_19, + /* 20 */ TRANS_TYPE_20, + /* 21 */ TRANS_TYPE_21, + /* 64 */ TRANS_TYPE_64 = 64, + /* 70 */ TRANS_TYPE_70 = 70, + /* 72 */ TRANS_TYPE_72 = 72, + /* 73 */ TRANS_TYPE_73, + /* 80 */ TRANS_TYPE_80 = 80, + /* 86 */ TRANS_TYPE_86 = 86 +} TransitionType; + +#define TRANS_NEXT_TYPE_DEFAULT 0xFF typedef struct FaultAddrConvClient { /* 0x0 */ struct FaultAddrConvClient* next; @@ -1066,22 +975,8 @@ typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*); typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); -typedef void(*draw_func)(PlayState* play, s16 index); - typedef void(*room_draw_func)(PlayState* play, Room* room, u32 flags); -typedef struct { - /* 0x00 */ draw_func unk0; - /* 0x04 */ u32 unk4; - /* 0x08 */ u32 unk8; - /* 0x0C */ u32 unkC; - /* 0x10 */ u32 unk10; - /* 0x14 */ u32 unk14; - /* 0x18 */ u32 unk18; - /* 0x1C */ u32 unk1C; - /* 0x20 */ u32 unk20; -} s801BB170; // size = 0x24 - typedef struct { /* 0x00 */ Vec3f atOffset; /* 0x0C */ Vec3f eyeOffset; @@ -1326,7 +1221,7 @@ struct PlayState { /* 0x1884C */ RomFile* roomList; /* 0x18850 */ ActorEntry* linkActorEntry; /* 0x18854 */ ActorEntry* setupActorList; - /* 0x18858 */ CsCamData* csCamData; + /* 0x18858 */ ActorCsCamInfo* actorCsCamList; /* 0x1885C */ EntranceEntry* setupEntranceList; /* 0x18860 */ u16* setupExitList; /* 0x18864 */ Path* setupPathList; @@ -1341,7 +1236,7 @@ struct PlayState { /* 0x1887C */ s8 unk_1887C; // shootingGalleryStatus? /* 0x1887D */ s8 unk_1887D; /* 0x1887E */ s8 unk_1887E; - /* 0x1887F */ u8 unk_1887F; // fadeTransition + /* 0x1887F */ u8 transitionType; // fadeTransition /* 0x18880 */ u8 unk_18880; /* 0x18884 */ CollisionCheckContext colChkCtx; /* 0x18B20 */ u16 envFlags[20]; @@ -1433,21 +1328,21 @@ enum fram_command { Writes Contents in FLASHRAM_MODE_WRITE After execution, sets FRAM_MODE to FRAM_MODE_NOP */ FRAM_COMMAND_EXECUTE = 0xD2000000, - /* flashram->erase_offset = (command & 0xffff) * 128; */ + /* flashram->erase_offset = (command & 0xFFFF) * 128; */ FRAM_COMMAND_SET_ERASE_SECTOR_OFFSET = 0x4B000000, /* flashram->mode = FLASHRAM_MODE_ERASE; - flashram->status = 0x1111800800c20000LL; */ + flashram->status = 0x1111800800C20000LL; */ FRAM_COMMAND_SET_MODE_ERASE_AND_STATUS = 0x78000000, - /* flashram->erase_offset = (command & 0xffff) * 128; - flashram->status = 0x1111800400c20000LL; */ + /* flashram->erase_offset = (command & 0xFFFF) * 128; + flashram->status = 0x1111800400C20000LL; */ FRAM_COMMAND_SET_ERASE_SECTOR_OFFSET_AND_STATUS = 0xA5000000, /* flashram->mode = FLASHRAM_MODE_WRITE; */ FRAM_COMMAND_SET_MODE_WRITE = 0xB4000000, /* flashram->mode = FLASHRAM_MODE_STATUS; - flashram->status = 0x1111800100c20000LL; */ + flashram->status = 0x1111800100C20000LL; */ FRAM_COMMAND_SET_MODE_STATUS_AND_STATUS = 0xE1000000, /* flashram->mode = FLASHRAM_MODE_READ; - flashram->status = 0x11118004f0000000LL; */ + flashram->status = 0x11118004F0000000LL; */ FRAM_COMMAND_SET_MODE_READ_AND_STATUS = 0xF0000000, /* unk */ FRAM_COMMAND_UNK_ERASE_OPERATION = 0x3C000000 diff --git a/include/z64actor.h b/include/z64actor.h index fb20412da..1e525c941 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -226,7 +226,7 @@ typedef enum { /* 0x00 */ ITEM00_RUPEE_GREEN, /* 0x01 */ ITEM00_RUPEE_BLUE, /* 0x02 */ ITEM00_RUPEE_RED, - /* 0x03 */ ITEM00_HEART, + /* 0x03 */ ITEM00_RECOVERY_HEART, /* 0x04 */ ITEM00_BOMBS_A, /* 0x05 */ ITEM00_ARROWS_10, /* 0x06 */ ITEM00_HEART_PIECE, @@ -268,7 +268,7 @@ typedef struct EnItem00 { /* 0x000 */ Actor actor; /* 0x144 */ EnItem00ActionFunc actionFunc; /* 0x148 */ s16 collectibleFlag; - /* 0x14A */ s16 unk14A; + /* 0x14A */ s16 getItemId; /* 0x14C */ s16 unk14C; /* 0x14E */ s16 unk14E; /* 0x150 */ s16 unk150; @@ -1138,7 +1138,7 @@ typedef enum { #define ACTOR_FLAG_2000 (1 << 13) // #define ACTOR_FLAG_4000 (1 << 14) -// +//! Carried by arrow #define ACTOR_FLAG_8000 (1 << 15) // #define ACTOR_FLAG_10000 (1 << 16) diff --git a/include/z64audio.h b/include/z64audio.h index 5dd78f73a..af104b6c2 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -8,9 +8,16 @@ #define TATUMS_PER_BEAT 48 #define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t)(ptr) != (uintptr_t)&gAudioContext.sequenceChannelNone) +#define SEQ_NUM_CHANNELS 16 #define MAX_CHANNELS_PER_BANK 3 +#define MUTE_FLAGS_3 (1 << 3) // prevent further noteSubEus from playing +#define MUTE_FLAGS_4 (1 << 4) // stop something in seqLayer scripts +#define MUTE_FLAGS_SOFTEN (1 << 5) // lower volume, by default to half +#define MUTE_FLAGS_STOP_NOTES (1 << 6) // prevent further notes from playing +#define MUTE_FLAGS_STOP_SCRIPT (1 << 7) // stop processing sequence/channel scripts + #define AUDIO_LERPIMP(v0, v1, t) (v0 + ((v1 - v0) * t)) #define ADSR_DISABLE 0 @@ -86,12 +93,12 @@ typedef enum { } AudioCacheType; typedef enum { - /* 0 */ LOAD_STATUS_0, - /* 1 */ LOAD_STATUS_1, - /* 2 */ LOAD_STATUS_2, // Samples/Seqplayer - /* 3 */ LOAD_STATUS_3, // Sequences - /* 4 */ LOAD_STATUS_4, // SoundFonts - /* 5 */ LOAD_STATUS_5 // Permanent + /* 0 */ LOAD_STATUS_NOT_LOADED, + /* 1 */ LOAD_STATUS_IN_PROGRESS, + /* 2 */ LOAD_STATUS_COMPLETE, + /* 3 */ LOAD_STATUS_DISCARDABLE, + /* 4 */ LOAD_STATUS_MAYBE_DISCARDABLE, + /* 5 */ LOAD_STATUS_PERMANENT } AudioLoadStatus; typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction); @@ -139,7 +146,7 @@ typedef struct { typedef struct { /* 0x0 */ s16 delay; /* 0x2 */ s16 arg; -} AdsrEnvelope; // size = 0x4 +} EnvelopePoint; // size = 0x4 typedef struct { /* 0x00 */ u32 start; @@ -231,19 +238,19 @@ typedef struct { /* 0x00 */ u8 loaded; /* 0x01 */ u8 normalRangeLo; /* 0x02 */ u8 normalRangeHi; - /* 0x03 */ u8 releaseRate; - /* 0x04 */ AdsrEnvelope* envelope; + /* 0x03 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable + /* 0x04 */ EnvelopePoint* envelope; /* 0x08 */ SoundFontSound lowNotesSound; /* 0x10 */ SoundFontSound normalNotesSound; /* 0x18 */ SoundFontSound highNotesSound; } Instrument; // size = 0x20 typedef struct { - /* 0x00 */ u8 releaseRate; + /* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable /* 0x01 */ u8 pan; /* 0x02 */ u8 loaded; /* 0x04 */ SoundFontSound sound; - /* 0x14 */ AdsrEnvelope* envelope; + /* 0x14 */ EnvelopePoint* envelope; } Drum; // size = 0x18 typedef struct { @@ -277,11 +284,11 @@ typedef struct { /* 0x000 */ u8 applyBend : 1; /* 0x001 */ u8 state; /* 0x002 */ u8 noteAllocPolicy; - /* 0x003 */ u8 muteBehavior; + /* 0x003 */ u8 muteFlags; /* 0x004 */ u8 seqId; /* 0x005 */ u8 defaultFont; /* 0x006 */ u8 unk_06[1]; - /* 0x007 */ s8 playerIdx; + /* 0x007 */ s8 playerIndex; /* 0x008 */ u16 tempo; // tatums per minute /* 0x00A */ u16 tempoAcc; /* 0x00C */ s16 unk_0C; @@ -289,7 +296,7 @@ typedef struct { /* 0x010 */ u16 delay; /* 0x012 */ u16 fadeTimer; /* 0x014 */ u16 fadeTimerUnkEu; - /* 0x016 */ u16 unk_16; // New to MM + /* 0x016 */ u16 unk_16; union { /* 0x018 */ u8* seqData; /* 0x018 */ u16* seqData16; @@ -313,9 +320,9 @@ typedef struct { } SequencePlayer; // size = 0x160 typedef struct { - /* 0x0 */ u8 releaseRate; + /* 0x0 */ u8 decayIndex; // index used to obtain adsr decay rate from adsrDecayTable /* 0x1 */ u8 sustain; - /* 0x4 */ AdsrEnvelope* envelope; + /* 0x4 */ EnvelopePoint* envelope; } AdsrSettings; // size = 0x8 typedef struct { @@ -337,7 +344,7 @@ typedef struct { /* 0x10 */ f32 current; /* 0x14 */ f32 target; /* 0x18 */ char unk_18[4]; - /* 0x1C */ AdsrEnvelope* envelope; + /* 0x1C */ EnvelopePoint* envelope; } AdsrState; // size = 0x20 typedef struct { @@ -356,7 +363,7 @@ typedef union { typedef struct { /* 0x00 */ u8 reverb; - /* 0x01 */ u8 unk_1; + /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x02 */ u8 pan; /* 0x03 */ u8 unk_3; // Possibly part of stereo? /* 0x04 */ Stereo stereo; @@ -397,7 +404,7 @@ typedef struct SequenceChannel { /* 0x01 */ u8 asByte; } changes; /* 0x02 */ u8 noteAllocPolicy; - /* 0x03 */ u8 muteBehavior; + /* 0x03 */ u8 muteFlags; /* 0x04 */ u8 reverb; // or dry/wet mix /* 0x05 */ u8 notePriority; // 0-3 /* 0x06 */ u8 someOtherPriority; @@ -406,12 +413,12 @@ typedef struct SequenceChannel { /* 0x09 */ u8 bookOffset; /* 0x0A */ u8 newPan; /* 0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128) - /* 0x0C */ u8 unk_0C; + /* 0x0C */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x0D */ u8 velocityRandomVariance; /* 0x0E */ u8 gateTimeRandomVariance; /* 0x0F */ u8 unk_0F; - /* 0x10 */ u8 unk_10; // New to MM - /* 0x11 */ u8 unk_11; // New to MM + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 unk_11; /* 0x12 */ VibratoSubStruct vibrato; /* 0x20 */ u16 delay; /* 0x22 */ u16 unk_20; @@ -434,11 +441,11 @@ typedef struct SequenceChannel { /* 0x80 */ AdsrSettings adsr; /* 0x88 */ NotePool notePool; /* 0xC8 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib, "io ports" - /* 0xD0 */ u8* unk_D0; // New to MM + /* 0xD0 */ u8* sfxState; /* 0xD4 */ s16* filter; /* 0xD8 */ Stereo stereo; - /* 0xDC */ s32 unk_DC; // New to MM - /* 0xE0 */ s32 unk_E0; // New to MM + /* 0xDC */ s32 unk_DC; + /* 0xE0 */ s32 unk_E0; } SequenceChannel; // size = 0xE4 // Might also be known as a Track, according to sm64 debug strings (?). @@ -531,7 +538,7 @@ typedef struct { /* 0x04 */ u8 reverbVol; /* 0x05 */ u8 numParts; /* 0x06 */ u16 samplePosFrac; - /* 0x08 */ u16 unk_08; // New to MM + /* 0x08 */ u16 unk_08; /* 0x0C */ s32 samplePosInt; /* 0x10 */ NoteSynthesisBuffers* synthesisBuffers; /* 0x14 */ s16 curVolLeft; @@ -596,7 +603,7 @@ typedef struct { /* 0x01 */ u8 hasTwoParts : 1; /* 0x01 */ u8 usesHeadsetPanEffects2 : 1; } bitField1; - /* 0x02 */ u8 unk_2; + /* 0x02 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x03 */ u8 headsetPanRight; /* 0x04 */ u8 headsetPanLeft; /* 0x05 */ u8 reverbVol; @@ -611,8 +618,8 @@ typedef struct { /* 0x10 */ s16* samples; // used for synthetic waves } sound; /* 0x14 */ s16* filter; - /* 0x18 */ u8 unk_18; // New to MM - /* 0x19 */ u8 unk_19; // New to MM + /* 0x18 */ u8 unk_18; + /* 0x19 */ u8 unk_19; /* 0x1A */ UNK_TYPE1 pad_1A[0x6]; } NoteSubEu; // size = 0x20 @@ -965,7 +972,7 @@ typedef struct { /* 0x4448 */ volatile u8 resetStatus; /* 0x4449 */ u8 audioResetSpecIdToLoad; /* 0x444C */ s32 audioResetFadeOutFramesLeft; - /* 0x4450 */ f32* unk_3520; // fadeOutVelocities for ADSR + /* 0x4450 */ f32* adsrDecayTable; // A table on the audio heap that stores decay rates used for ADSR /* 0x4454 */ u8* audioHeap; /* 0x4458 */ size_t audioHeapSize; /* 0x445C */ Note* notes; @@ -994,7 +1001,7 @@ typedef struct { typedef struct { /* 0x00 */ u8 reverbVol; - /* 0x01 */ u8 unk_1; + /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x02 */ u8 pan; /* 0x03 */ u8 unk_3; /* 0x04 */ Stereo stereo; @@ -1050,7 +1057,7 @@ typedef struct { /* 0x218 */ u8 unk_4C; /* 0x219 */ u8 unk_4D; /* 0x21A */ u8 unk_4E; - /* 0x21B */ u8 unk_21B; // New to MM + /* 0x21B */ u8 unk_21B; } unk_D_8016E750; // size = 0x21C typedef struct { diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 2849ce490..f0d24fd6f 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -89,10 +89,21 @@ typedef struct CollisionPoly { } CollisionPoly; // size = 0x10 typedef struct { - /* 0x0 */ u16 setting; - /* 0x2 */ s16 numData; - /* 0x4 */ Vec3s* data; -} CamData; // size = 0x8 (BgCamData) + /* 0x0 */ u16 setting; // camera setting described by CameraSettingType enum + /* 0x2 */ s16 count; // only used when `bgCamFuncData` is a list of points used for crawlspaces (unused oot legacy) + /* 0x4 */ Vec3s* bgCamFuncData; // s16 data grouped in threes (ex. Vec3s), is usually of type `BgCamFuncData` +} BgCamInfo; // size = 0x8 + +typedef BgCamInfo CamData; // TODO: ZAPD compatibility + +// The structure used for all instances of s16 data from `BgCamInfo`. +typedef struct { + /* 0x00 */ Vec3s pos; + /* 0x06 */ Vec3s rot; + /* 0x0C */ s16 fov; + /* 0x0E */ s16 unk_0E; + /* 0x10 */ s16 unk_10; +} BgCamFuncData; // size = 0x12 typedef struct { /* 0x0 */ Vec3s minPos; @@ -137,7 +148,7 @@ typedef struct { /* 0x14 */ u16 numPolygons; /* 0x18 */ CollisionPoly* polyList; /* 0x1C */ SurfaceType* surfaceTypeList; - /* 0x20 */ CamData* cameraDataList; + /* 0x20 */ CamData* bgCamList; /* 0x24 */ u16 numWaterBoxes; /* 0x28 */ WaterBox* waterBoxes; } CollisionHeader; // size = 0x2C diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 41518505a..aa0681de5 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -178,7 +178,7 @@ typedef struct { /* 0x0C */ f32 unk_0C; /* 0x10 */ u16 frames; /* 0x12 */ u16 currentCsIndex; - /* 0x14 */ s32 csCamId; + /* 0x14 */ s32 subCamId; /* 0x18 */ u16 unk_18; /* 0x1A */ u8 unk_1A; /* 0x1B */ u8 unk_1B; diff --git a/include/z64item.h b/include/z64item.h index 8ae2f6455..6693431fb 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -163,7 +163,7 @@ typedef enum { /* 0x21 */ ITEM_ZORA_EGG, /* 0x22 */ ITEM_GOLD_DUST, /* 0x23 */ ITEM_MUSHROOM, - /* 0x24 */ ITEM_SEA_HORSE, + /* 0x24 */ ITEM_SEAHORSE, /* 0x25 */ ITEM_CHATEAU, /* 0x26 */ ITEM_HYLIAN_LOACH, /* 0x27 */ ITEM_OBABA_DRINK, @@ -175,7 +175,7 @@ typedef enum { /* 0x2D */ ITEM_ROOM_KEY, /* 0x2E */ ITEM_LETTER_MAMA, /* 0x2F */ ITEM_LETTER_TO_KAFEI, - /* 0x30 */ ITEM_PENDANT_MEMORIES, + /* 0x30 */ ITEM_PENDANT_OF_MEMORIES, /* 0x31 */ ITEM_TINGLE_MAP, /* 0x32 */ ITEM_MASK_DEKU, /* 0x33 */ ITEM_MASK_GORON, @@ -256,7 +256,7 @@ typedef enum { /* 0x80 */ ITEM_INVALID_5, /* 0x81 */ ITEM_INVALID_6, /* 0x82 */ ITEM_INVALID_7, - /* 0x83 */ ITEM_HEART, + /* 0x83 */ ITEM_RECOVERY_HEART, /* 0x84 */ ITEM_RUPEE_GREEN, /* 0x85 */ ITEM_RUPEE_BLUE, /* 0x86 */ ITEM_RUPEE_10, @@ -288,7 +288,7 @@ typedef enum { /* 0xA0 */ ITEM_MILK, /* 0xA1 */ ITEM_GOLD_DUST_2, /* 0xA2 */ ITEM_HYLIAN_LOACH_2, - /* 0xA3 */ ITEM_SEA_HORSE_CAUGHT, + /* 0xA3 */ ITEM_SEAHORSE_CAUGHT, /* 0xF0 */ ITEM_F0 = 0xF0, /* 0xF1 */ ITEM_F1, /* 0xF2 */ ITEM_F2, @@ -316,11 +316,15 @@ typedef enum { /* 0x0A */ GI_RECOVERY_HEART, /* 0x0C */ GI_HEART_PIECE = 0x0C, /* 0x0D */ GI_HEART_CONTAINER, + /* 0x0E */ GI_MAGIC_SMALL, + /* 0x0F */ GI_MAGIC_LARGE, /* 0x11 */ GI_STRAY_FAIRY = 0x11, /* 0x14 */ GI_BOMBS_1 = 0x14, /* 0x15 */ GI_BOMBS_5, /* 0x16 */ GI_BOMBS_10, - /* 0x19 */ GI_STICKS_1 = 0x19, + /* 0x17 */ GI_BOMBS_20, + /* 0x18 */ GI_BOMBS_30, + /* 0x19 */ GI_STICKS_1, /* 0x1A */ GI_BOMBCHUS_10, /* 0x1B */ GI_BOMB_BAG_20, /* 0x1C */ GI_BOMB_BAG_30, @@ -332,28 +336,58 @@ typedef enum { /* 0x22 */ GI_QUIVER_30, /* 0x23 */ GI_QUIVER_40, /* 0x24 */ GI_QUIVER_50, - /* 0x25 */ GI_25 = 0x25, - /* 0x28 */ GI_NUTS_1 = 0x28, - /* 0x2A */ GI_NUTS_10 = 0x2A, + /* 0x25 */ GI_ARROW_FIRE, + /* 0x26 */ GI_ARROW_ICE, + /* 0x27 */ GI_ARROW_LIGHT, + /* 0x28 */ GI_NUTS_1, + /* 0x29 */ GI_NUTS_5, + /* 0x2A */ GI_NUTS_10, + /* 0x2E */ GI_BOMBCHUS_20 = 0x2E, /* 0x32 */ GI_SHIELD_HERO = 0x32, /* 0x33 */ GI_SHIELD_MIRROR, - /* 0x35 */ GI_MAGIC_BEANS = 0x35, + /* 0x34 */ GI_POWDER_KEG, + /* 0x35 */ GI_MAGIC_BEANS, /* 0x36 */ GI_BOMBCHUS_1, - /* 0x3A */ GI_BOMBCHUS_5 = 0x3A, - /* 0x3C */ GI_KEY_SMALL = 0x3C, + /* 0x37 */ GI_SWORD_KOKIRI, + /* 0x38 */ GI_SWORD_RAZOR, + /* 0x39 */ GI_SWORD_GILDED, + /* 0x3A */ GI_BOMBCHUS_5, + /* 0x3B */ GI_SWORD_GREAT_FAIRY, + /* 0x3C */ GI_KEY_SMALL, /* 0x3D */ GI_KEY_BOSS, /* 0x3E */ GI_MAP, /* 0x3F */ GI_COMPASS, + /* 0x41 */ GI_HOOKSHOT = 0x41, + /* 0x42 */ GI_LENS, + /* 0x43 */ GI_PICTO_BOX, /* 0x4C */ GI_OCARINA = 0x4C, - /* 0x50 */ GI_50 = 0x50, - /* 0x52 */ GI_SCALE_GOLD = 0x52, // Assumed, used in En_Fishing - /* 0x59 */ GI_BOTTLE_POTION_RED = 0x59, + /* 0x50 */ GI_BOMBERS_NOTEBOOK = 0x50, + /* 0x52 */ GI_SKULL_TOKEN = 0x52, + /* 0x55 */ GI_REMAINS_ODOLWA = 0x55, + /* 0x56 */ GI_REMAINS_GOHT, + /* 0x57 */ GI_REMAINS_GYORG, + /* 0x58 */ GI_REMAINS_TWINMOLD, + /* 0x59 */ GI_POTION_RED_BOTTLE, // ITEM_LONGSHOT /* 0x5A */ GI_BOTTLE, /* 0x5B */ GI_POTION_RED, /* 0x5C */ GI_POTION_GREEN, /* 0x5D */ GI_POTION_BLUE, /* 0x5E */ GI_FAIRY, - /* 0x60 */ GI_MILK_BOTTLE = 0x60, + /* 0x5F */ GI_DEKU_PRINCESS, + /* 0x60 */ GI_MILK_BOTTLE, + /* 0x61 */ GI_MILK_HALF, + /* 0x62 */ GI_FISH, + /* 0x63 */ GI_BUG, + /* 0x64 */ GI_BLUE_FIRE, + /* 0x65 */ GI_POE, + /* 0x66 */ GI_BIG_POE, + /* 0x67 */ GI_SPRING_WATER, + /* 0x68 */ GI_HOT_SPRING_WATER, + /* 0x69 */ GI_ZORA_EGG, + /* 0x6A */ GI_GOLD_DUST, + /* 0x6B */ GI_MUSHROOM, + /* 0x6E */ GI_SEAHORSE = 0x6E, + /* 0x6F */ GI_CHATEAU_BOTTLE, /* 0x76 */ GI_ICE_TRAP = 0x76, /* 0x78 */ GI_MASK_DEKU = 0x78, /* 0x79 */ GI_MASK_GORON, @@ -381,81 +415,173 @@ typedef enum { /* 0x8F */ GI_MASK_KAFEIS_MASK, /* 0x91 */ GI_CHATEAU = 0x91, /* 0x92 */ GI_MILK, - /* 0x93 */ GI_GOLD_DUST, - /* 0x94 */ GI_EEL, // Unused bottled eel - /* 0x95 */ GI_SEAHORSE, + /* 0x93 */ GI_GOLD_DUST_2, + /* 0x94 */ GI_HYLIAN_LOACH, // Unused bottled eel + /* 0x95 */ GI_SEAHORSE_CAUGHT, /* 0x96 */ GI_MOON_TEAR, /* 0x97 */ GI_DEED_LAND, /* 0x98 */ GI_DEED_SWAMP, /* 0x99 */ GI_DEED_MOUNTAIN, /* 0x9A */ GI_DEED_OCEAN, - /* 0x9B */ GI_SWORD_GREAT_FAIRY, - /* 0x9C */ GI_SWORD_KOKIRI, - /* 0x9D */ GI_SWORD_RAZOR, - /* 0x9E */ GI_SWORD_GILDED, - /* 0x9F */ GI_SHIELD_HERO_2, // Code that treats this as hero's shield is unused, so take with a grain of salt - /* 0xA1 */ GI_LETTER_TO_MAMA = 0xA1, + /* 0x9B */ GI_SWORD_GREAT_FAIRY_STOLEN, + /* 0x9C */ GI_SWORD_KOKIRI_STOLEN, + /* 0x9D */ GI_SWORD_RAZOR_STOLEN, + /* 0x9E */ GI_SWORD_GILDED_STOLEN, + /* 0x9F */ GI_SHIELD_HERO_STOLEN, // Code that treats this as hero's shield is unused, implied as intended to be stolen + /* 0xA0 */ GI_ROOM_KEY, + /* 0xA1 */ GI_LETTER_TO_MAMA, /* 0xA9 */ GI_BOTTLE_STOLEN = 0xA9, // buy back stolen bottle /* 0xAA */ GI_LETTER_TO_KAFEI, /* 0xAB */ GI_PENDANT_OF_MEMORIES, - /* 0xBA */ GI_MAX = 0xBA + /* 0xB4 */ GI_TINGLE_MAP_CLOCK_TOWN = 0xB4, + /* 0xB5 */ GI_TINGLE_MAP_WOODFALL, + /* 0xB6 */ GI_TINGLE_MAP_SNOWHEAD, + /* 0xB7 */ GI_TINGLE_MAP_ROMANI_RANCH, + /* 0xB8 */ GI_TINGLE_MAP_GREAT_BAY, + /* 0xB9 */ GI_TINGLE_MAP_STONE_TOWER, + /* 0xBA */ GI_MAX } GetItemID; typedef enum { /* 0x00 */ GID_BOTTLE, - /* 0x01 */ GID_01, - /* 0x02 */ GID_02, - /* 0x03 */ GID_03, - /* 0x0A */ GID_COMPASS = 0x0A, - /* 0x0E */ GID_0E = 0x0E, - /* 0x0F */ GID_0F, - /* 0x10 */ GID_MASK_ALL_NIGHT = 0x10, + /* 0x01 */ GID_KEY_SMALL, + /* 0x02 */ GID_MASK_KAMARO, + /* 0x03 */ GID_MASK_COUPLE, + /* 0x04 */ GID_04, + /* 0x05 */ GID_05, + /* 0x06 */ GID_06, + /* 0x07 */ GID_07, + /* 0x08 */ GID_RECOVERY_HEART, + /* 0x09 */ GID_KEY_BOSS, + /* 0x0A */ GID_COMPASS, + /* 0x0B */ GID_BOMBERS_NOTEBOOK, + /* 0x0C */ GID_MASK_STONE, + /* 0x0D */ GID_MASK_KAFEIS_MASK, + /* 0x0E */ GID_MASK_CIRCUS_LEADER, + /* 0x0F */ GID_MASK_BREMEN, + /* 0x10 */ GID_MASK_ALL_NIGHT, /* 0x11 */ GID_NUTS, - /* 0x13 */ GID_13 = 0x13, - /* 0x17 */ GID_BOMB_BAG_20 = 0x17, + /* 0x12 */ GID_HEART_CONTAINER, + /* 0x13 */ GID_HEART_PIECE, + /* 0x14 */ GID_QUIVER_30, + /* 0x15 */ GID_QUIVER_40, + /* 0x16 */ GID_QUIVER_50, + /* 0x17 */ GID_BOMB_BAG_20, /* 0x18 */ GID_BOMB_BAG_30, /* 0x19 */ GID_BOMB_BAG_40, - /* 0x1A */ GID_STICK = 0x1A, + /* 0x1A */ GID_STICK, /* 0x1B */ GID_DUNGEON_MAP, - /* 0x1E */ GID_BOMB = 0x1E, - /* 0x23 */ GID_ARROWS_SMALL = 0x23, + /* 0x1C */ GID_MAGIC_SMALL, + /* 0x1D */ GID_MAGIC_LARGE, + /* 0x1E */ GID_BOMB, + /* 0x1F */ GID_STONE_OF_AGONY, + /* 0x20 */ GID_WALLET_ADULT, + /* 0x21 */ GID_WALLET_GIANT, + /* 0x22 */ GID_MASK_DON_GERO, + /* 0x23 */ GID_ARROWS_SMALL, /* 0x24 */ GID_ARROWS_MEDIUM, /* 0x25 */ GID_ARROWS_LARGE, /* 0x26 */ GID_BOMBCHU, /* 0x27 */ GID_SHIELD_HERO, - /* 0x30 */ GID_POTION_GREEN = 0x30, + /* 0x28 */ GID_HOOKSHOT, + /* 0x29 */ GID_29, + /* 0x2A */ GID_OCARINA, + /* 0x2B */ GID_MILK, + /* 0x2C */ GID_MASK_KEATON, + /* 0x2D */ GID_TINGLE_MAP, + /* 0x2E */ GID_BOW, + /* 0x2F */ GID_LENS, + /* 0x30 */ GID_POTION_GREEN, /* 0x31 */ GID_POTION_RED, /* 0x32 */ GID_POTION_BLUE, /* 0x33 */ GID_SHIELD_MIRROR, - /* 0x39 */ GID_39 = 0x39, - /* 0x3A */ GID_3A, + /* 0x34 */ GID_MAGIC_BEANS, + /* 0x35 */ GID_FISH, + /* 0x36 */ GID_LETTER_MAMA, + /* 0x37 */ GID_37, + /* 0x38 */ GID_SWORD_BGS, + /* 0x39 */ GID_MASK_SUN, + /* 0x3A */ GID_MASK_BLAST, /* 0x3B */ GID_FAIRY, - /* 0x3E */ GID_3E = 0x3E, - /* 0x44 */ GID_44 = 0x44, - /* 0x45 */ GID_45, - /* 0x47 */ GID_47 = 0x47, - /* 0x4F */ GID_4F = 0x4F, - /* 0x50 */ GID_50, - /* 0x51 */ GID_51, - /* 0x53 */ GID_53 = 0x53, - /* 0x55 */ GID_SWORD_KOKIRI = 0x55, - /* 0x66 */ GID_SWORD_RAZOR = 0x66, + /* 0x3C */ GID_MASK_SCENTS, + /* 0x3D */ GID_MASK_CAPTAIN, + /* 0x3E */ GID_MASK_BUNNY, + /* 0x3F */ GID_MASK_TRUTH, + /* 0x40 */ GID_DEED_SWAMP, + /* 0x41 */ GID_DEED_MOUNTAIN, + /* 0x42 */ GID_RUPEE_HUGE, + /* 0x43 */ GID_DEED_OCEAN, + /* 0x44 */ GID_MASK_GORON, + /* 0x45 */ GID_MASK_ZORA, + /* 0x46 */ GID_46, + /* 0x47 */ GID_ARROW_FIRE, + /* 0x48 */ GID_ARROW_ICE, + /* 0x49 */ GID_ARROW_LIGHT, + /* 0x4A */ GID_SKULL_TOKEN, + /* 0x4B */ GID_BUG, + /* 0x4C */ GID_4C, + /* 0x4D */ GID_POE, + /* 0x4E */ GID_FAIRY_2, + /* 0x4F */ GID_RUPEE_GREEN, + /* 0x50 */ GID_RUPEE_BLUE, + /* 0x51 */ GID_RUPEE_RED, + /* 0x52 */ GID_BIG_POE, + /* 0x53 */ GID_RUPEE_PURPLE, + /* 0x54 */ GID_RUPEE_SILVER, + /* 0x55 */ GID_SWORD_KOKIRI, + /* 0x56 */ GID_SKULL_TOKEN_2, + /* 0x57 */ GID_57, + /* 0x58 */ GID_ZORA_EGG, + /* 0x59 */ GID_MOON_TEAR, + /* 0x5A */ GID_DEED_LAND, + /* 0x5B */ GID_MASK_DEKU, + /* 0x5C */ GID_REMAINS_ODOLWA, + /* 0x5D */ GID_POWDER_KEG, + /* 0x5E */ GID_GOLD_DUST, + /* 0x5F */ GID_SEAHORSE, + /* 0x60 */ GID_60, + /* 0x61 */ GID_HYLIAN_LOACH, + /* 0x62 */ GID_SEAHORSE_CAUGHT, + /* 0x63 */ GID_REMAINS_GOHT, + /* 0x64 */ GID_REMAINS_GYORG, + /* 0x65 */ GID_REMAINS_TWINMOLD, + /* 0x66 */ GID_SWORD_RAZOR, /* 0x67 */ GID_SWORD_GILDED, /* 0x68 */ GID_SWORD_GREAT_FAIRY, - /* 0x6A */ GID_MASK_GREAT_FAIRY = 0x6A, - /* 0x6B */ GID_6B, - /* 0x70 */ GID_70 = 0x70, - /* 0x71 */ GID_71 + /* 0x69 */ GID_MASK_GARO, + /* 0x6A */ GID_MASK_GREAT_FAIRY, + /* 0x6B */ GID_MASK_GIBDO, + /* 0x6C */ GID_ROOM_KEY, + /* 0x6D */ GID_LETTER_TO_KAFEI, + /* 0x6E */ GID_PENDANT_OF_MEMORIES, + /* 0x6F */ GID_MUSHROOM, + /* 0x70 */ GID_MASK_ROMANI, + /* 0x71 */ GID_MASK_POSTMAN, + /* 0x72 */ GID_MASK_GIANT, + /* 0x73 */ GID_CHATEAU, + /* 0x74 */ GID_PICTO_BOX, + /* 0x75 */ GID_MASK_FIERCE_DEITY, + /* 0x76 */ GID_MAX } GetItemDrawID; +// This enum may not be real, and actionparam is just used directly. +// Keep using it for now. // TODO: fill 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 + /* 0x2A */ EXCH_ITEM_MOON_TEAR = 0x2A, + /* 0x2B */ EXCH_ITEM_DEED_LAND, + /* 0x2C */ EXCH_ITEM_ROOM_KEY, + /* 0x2D */ EXCH_ITEM_LETTER_TO_KAFEI, + /* 0x2E */ EXCH_ITEM_2E, + /* 0x2F */ EXCH_ITEM_DEED_SWAMP, + /* 0x30 */ EXCH_ITEM_DEED_MOUNTAIN, + /* 0x31 */ EXCH_ITEM_DEED_OCEAN, + /* 0x32 */ EXCH_ITEM_32, + /* 0x33 */ EXCH_ITEM_LETTER_MAMA } ExchangeItemID; #endif diff --git a/include/z64message.h b/include/z64message.h new file mode 100644 index 000000000..19657d838 --- /dev/null +++ b/include/z64message.h @@ -0,0 +1,179 @@ +#ifndef Z64MESSAGE_H +#define Z64MESSAGE_H + +#include "PR/ultratypes.h" +#include "z64view.h" +#include "unk.h" + +struct Actor; +struct MessageTableEntry; +struct OcarinaStaff; + +typedef enum TextState { + /* 0 */ TEXT_STATE_NONE, + /* 1 */ TEXT_STATE_1, + /* 2 */ TEXT_STATE_CLOSING, + /* 3 */ TEXT_STATE_3, + /* 4 */ TEXT_STATE_CHOICE, + /* 5 */ TEXT_STATE_5, + /* 6 */ TEXT_STATE_DONE, + /* 7 */ TEXT_STATE_7, + /* 8 */ TEXT_STATE_8, + /* 9 */ TEXT_STATE_9, + /* 10 */ TEXT_STATE_10, + /* 11 */ TEXT_STATE_11, + /* 12 */ TEXT_STATE_12, + /* 13 */ TEXT_STATE_13, + /* 14 */ TEXT_STATE_14, + /* 15 */ TEXT_STATE_15, + /* 16 */ TEXT_STATE_16, + /* 17 */ TEXT_STATE_17, + /* 18 */ TEXT_STATE_18 +} TextState; + + +#define FONT_CHAR_TEX_WIDTH 16 +#define FONT_CHAR_TEX_HEIGHT 16 +//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` +#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture + +// TODO: should Font be in its own header or is it fine to have it here? +// Font textures are loaded into here +typedef struct { + /* 0x00000 */ union { + u8 charBuf[2][FONT_CHAR_TEX_SIZE * 120]; + u64 force_structure_alignment_charTex; + }; + /* 0x07800 */ union { + u8 iconBuf[FONT_CHAR_TEX_SIZE]; + u64 force_structure_alignment_icon; + }; + /* 0x07880 */ union { + u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; + u64 force_structure_alignment_font; + }; + /* 0x11880 */ union { + char schar[1280]; // msgBuf + u16 wchar[640]; // msgBufWide + u64 force_structure_alignment_msg; + } msgBuf; + /* 0x11D80 */ u8* messageStart; + /* 0x11D84 */ u8* messageEnd; + /* 0x11D88 */ u8 unk_11D88; // current Char Buffer ? +} Font; // size = 0x11D90 + +typedef struct MessageContext { + /* 0x00000 */ View view; + /* 0x00168 */ Font font; + /* 0x11EF8 */ UNK_PTR unk11EF8; + /* 0x11EFC */ UNK_TYPE1 unk11EFC[0x4]; + /* 0x11F00 */ struct OcarinaStaff* unk11F00; + /* 0x11F04 */ u16 currentTextId; + /* 0x11F06 */ UNK_TYPE1 unk11F06[0x2]; + /* 0x11F08 */ u16 unk11F08; + /* 0x11F0A */ u8 unk11F0A; + /* 0x11F0B */ s8 unk11F0B; + /* 0x11F0C */ s8 unk11F0C; + /* 0x11F0B */ UNK_TYPE1 unk11F0D[0x3]; + /* 0x11F10 */ s32 msgLength; + /* 0x11F14 */ u16 unk11F14; + /* 0x11F16 */ u16 unk11F16; + /* 0x11F18 */ s8 unk11F18; + /* 0x11F19 */ UNK_TYPE1 unk11F19[0x1]; + /* 0x11F1A */ s16 unk11F1A[3]; + /* 0x11F20 */ UNK_TYPE1 unk11F20[0x2]; + /* 0x11F22 */ u8 msgMode; // TODO: MessageMode enum + /* 0x11F23 */ UNK_TYPE1 unk11F23; + /* 0x11F24 */ union { + char schar[200]; + u16 wchar[100]; + } decodedBuffer; + /* 0x11FEC */ u16 msgBufPos; + /* 0x11FEE */ s16 unk11FEE; + /* 0x11FF0 */ s16 unk11FF0; + /* 0x11FF2 */ u16 unk11FF2; + /* 0x11FF4 */ s16 unk11FF4; + /* 0x11FF6 */ s16 unk11FF6; + /* 0x11FF8 */ s16 unk11FF8; + /* 0x11FFA */ s16 unk11FFA; + /* 0x11FFC */ s16 unk11FFC; + /* 0x11FFE */ s16 unk11FFE[0x3]; + /* 0x12004 */ s16 unk12004; + /* 0x12006 */ s16 unk12006; + /* 0x12008 */ s16 unk12008; + /* 0x1200A */ UNK_TYPE2 unk1200A; + /* 0x1200C */ s16 unk1200C; + /* 0x1200E */ s16 unk1200E; + /* 0x12010 */ s16 unk12010; + /* 0x12012 */ s16 unk12012; + /* 0x12014 */ s16 unk12014; + /* 0x12014 */ s16 unk12016; + /* 0x12018 */ s16 unk12018; // messageR + /* 0x1201A */ s16 unk1201A; // messageG + /* 0x1201C */ s16 unk1201C; // messageB + /* 0x1201E */ s16 unk1201E; // messageA + /* 0x12020 */ u8 unk12020; // probably textboxEndType + /* 0x12021 */ u8 choiceIndex; + /* 0x12022 */ u8 unk12022; + /* 0x12023 */ u8 stateTimer; + /* 0x12024 */ s16 unk12024; + /* 0x12026 */ u16 unk12026; + /* 0x12028 */ u16 songPlayed; + /* 0x1202A */ u16 ocarinaMode; + /* 0x1202C */ u16 ocarinaAction; + /* 0x1202E */ u16 unk1202E; + /* 0x12030 */ s16 unk_12030; + /* 0x12032 */ UNK_TYPE1 unk_12032[0x2]; + /* 0x12034 */ s16 unk12034; + /* 0x12036 */ s16 unk12036; + /* 0x12038 */ s16 unk12038; + /* 0x1203A */ s16 unk1203A; + /* 0x1203C */ s16 unk1203C; + /* 0x1203E */ s16 unk1203E; + /* 0x12040 */ struct Actor* unkActor; + /* 0x12044 */ s16 unk12044; + /* 0x12046 */ s16 unk12046; + /* 0x12048 */ u8 unk12048; // EnKakasi + /* 0x12049 */ UNK_TYPE1 unk12049[0x1]; + /* 0x1204A */ s16 unk1204A[0x5]; + /* 0x12054 */ s16 unk12054[6]; // First, second and third digits in lottery code guess + /* 0x1205A */ UNK_TYPE1 unk12060[0x8]; + /* 0x12068 */ s16 unk12068; + /* 0x1206A */ s16 unk1206A; + /* 0x1206C */ s32 unk1206C; + /* 0x12070 */ s32 unk12070; + /* 0x12074 */ s32 unk12074; + /* 0x12078 */ s32 bankRupeesSelected; + /* 0x1207C */ s32 bankRupees; + /* 0x12080 */ struct MessageTableEntry* messageEntryTable; + /* 0x12084 */ struct MessageTableEntry* messageEntryTableNes; + /* 0x12088 */ UNK_TYPE4 unk12088; + /* 0x1208C */ struct MessageTableEntry* messageTableStaff; + /* 0x12090 */ s16 unk12090; + /* 0x12092 */ s16 unk12092; + /* 0x12094 */ s8 unk12094; + /* 0x12095 */ UNK_TYPE1 unk12095[0x3]; + /* 0x12098 */ f32 unk12098; // Text_Scale? + /* 0x1209C */ s16 unk1209C; + /* 0x1209E */ UNK_TYPE1 unk1209E[0x2]; + /* 0x120A0 */ s32 unk120A0; + /* 0x120A4 */ s16 unk120A4[6]; + /* 0x120B0 */ u8 unk120B0; + /* 0x120B1 */ u8 unk120B1; + /* 0x120B2 */ u8 unk120B2[0xC]; + /* 0x120BE */ s16 unk120BE; + /* 0x120C0 */ s16 unk120C0; + /* 0x120C2 */ s16 unk120C2; + /* 0x120C4 */ s32 unk120C4; + /* 0x120C8 */ s16 unk120C8; + /* 0x120CA */ s16 unk120CA; + /* 0x120CC */ s16 unk120CC; + /* 0x120CE */ s16 unk120CE; + /* 0x120D0 */ s16 unk120D0; + /* 0x120D2 */ s16 unk120D2; + /* 0x120D4 */ s16 unk120D4; + /* 0x120D6 */ s16 unk120D6; + /* 0x120D8 */ UNK_TYPE1 unk120D8[0x8]; +} MessageContext; // size = 0x120E0 + +#endif diff --git a/include/z64object.h b/include/z64object.h index 34035306b..3b221088a 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -207,7 +207,7 @@ typedef enum { /* 0x0C3 */ OBJECT_GI_SHIELD_3, /* 0x0C4 */ OBJECT_UNSET_C4, /* 0x0C5 */ OBJECT_UNSET_C5, - /* 0x0C6 */ OBJECT_GI_MAGIC_BEANS, + /* 0x0C6 */ OBJECT_GI_BEAN, /* 0x0C7 */ OBJECT_GI_FISH, /* 0x0C8 */ OBJECT_UNSET_C8, /* 0x0C9 */ OBJECT_UNSET_C9, diff --git a/include/z64ocarina.h b/include/z64ocarina.h index 56ab48312..8cc82b51a 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -116,7 +116,7 @@ typedef struct { /* 0x1 */ u8 buttonIndex[8]; } OcarinaSongButtons; // size = 0x9 -typedef struct { +typedef struct OcarinaStaff { /* 0x0 */ u8 buttonIndex; /* 0x1 */ u8 state; // original name: "status" /* 0x2 */ u8 pos; // original name: "locate" diff --git a/include/z64player.h b/include/z64player.h index 86adaea1e..0f74f5a6c 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -98,7 +98,7 @@ typedef enum { /* 0x19 */ PLAYER_AP_BOTTLE_ZORA_EGG, /* 0x1A */ PLAYER_AP_BOTTLE_DEKU_PRINCESS, /* 0x1B */ PLAYER_AP_BOTTLE_GOLD_DUST, - /* 0x1D */ PLAYER_AP_BOTTLE_SEA_HORSE = 0x1D, + /* 0x1D */ PLAYER_AP_BOTTLE_SEAHORSE = 0x1D, /* 0x1E */ PLAYER_AP_BOTTLE_MUSHROOM, /* 0x1F */ PLAYER_AP_BOTTLE_HYLIAN_LOACH, /* 0x20 */ PLAYER_AP_BOTTLE_BUG, @@ -120,7 +120,7 @@ typedef enum { /* 0x30 */ PLAYER_AP_DEED_MOUNTAIN, /* 0x31 */ PLAYER_AP_DEED_OCEAN, /* 0x33 */ PLAYER_AP_LETTER_MAMA = 0x33, - /* 0x36 */ PLAYER_AP_PENDANT_MEMORIES = 0x36, + /* 0x36 */ PLAYER_AP_PENDANT_OF_MEMORIES = 0x36, /* 0x3A */ PLAYER_AP_MASK_TRUTH = 0x3A, /* 0x3B */ PLAYER_AP_MASK_KAFEIS_MASK, /* 0x3C */ PLAYER_AP_MASK_ALL_NIGHT, diff --git a/include/z64save.h b/include/z64save.h index 8339e6ce1..cd0187987 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -76,7 +76,7 @@ typedef enum { typedef enum { /* 0 */ TIMER_ID_0, - /* 1 */ TIMER_ID_1, + /* 1 */ TIMER_ID_1, // minigame timer /* 2 */ TIMER_ID_2, /* 3 */ TIMER_ID_3, // countdown until mooncrash /* 4 */ TIMER_ID_4, @@ -110,9 +110,9 @@ typedef struct Inventory { /* 0x30 */ s8 ammo[24]; // "item_count" /* 0x48 */ u32 upgrades; // "non_equip_register" some bits are wallet upgrades /* 0x4C */ u32 questItems; // "collect_register" - /* 0x50 */ u8 dungeonItems[10]; // "key_compass_map" - /* 0x5A */ s8 dungeonKeys[9]; // "key_register" - /* 0x59 */ s8 defenseHearts; + /* 0x50 */ u8 dungeonItems[10]; // "key_compass_map" + /* 0x5A */ s8 dungeonKeys[9]; // "key_register" + /* 0x63 */ s8 defenseHearts; /* 0x64 */ s8 strayFairies[10]; // "orange_fairy" /* 0x6E */ char dekuPlaygroundPlayerName[3][8]; // "degnuts_memory_name" Stores playerName (8 char) over (3 days) when getting a new high score } Inventory; // size = 0x88 @@ -223,7 +223,7 @@ typedef struct Save { /* 0x0EE8 */ u32 unk_EE8; /* 0x0EEC */ u32 horseBackBalloonHighScore; /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) - /* 0x0EF4 */ u32 unk_EF4; // Shooting Gallery Man Flags + /* 0x0EF4 */ u32 shootingGalleryHighScores; // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits. /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" /* 0x0F5C */ u32 mapsVisited; // "area_arrival" /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" @@ -303,16 +303,16 @@ typedef struct SaveContext { /* 0x3F3F */ u8 unk_3F3F; // "flash_flag" /* 0x3F40 */ SaveOptions options; /* 0x3F46 */ u16 unk_3F46; // "NottoriBgm" - /* 0x3F48 */ u8 unk_3F48; // "fade_go" + /* 0x3F48 */ u8 cutsceneTransitionControl; // "fade_go" /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime" /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" /* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no" /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" - /* 0x3F50 */ u8 fadeDuration; // "fade_speed" - /* 0x3F51 */ u8 fadeSpeed; // "wipe_speed" transition related - /* 0x3F52 */ u16 environmentTime; // "kankyo_time" + /* 0x3F50 */ u8 transFadeDuration; // "fade_speed" + /* 0x3F51 */ u8 transWipeSpeed; // "wipe_speed" transition related + /* 0x3F52 */ u16 skyboxTime; // "kankyo_time" /* 0x3F54 */ u8 dogIsLost; // "dog_event_flag" - /* 0x3F55 */ u8 nextTransition; // "next_wipe" + /* 0x3F55 */ u8 nextTransitionType; // "next_wipe" /* 0x3F56 */ s16 worldMapArea; // "area_type" /* 0x3F58 */ s16 sunsSongState; // "sunmoon_flag" /* 0x3F5A */ s16 healthAccumulator; // "life_mode" @@ -336,6 +336,85 @@ typedef enum SunsSongState { /* 3 */ SUNSSONG_SPECIAL // time does not advance, but signals the song was played. used for freezing redeads } SunsSongState; +// linkAge still exists in MM, but is always set to 0 (always adult) +// There are remnants of these macros from OOT, but they are essentially useless +#define LINK_IS_CHILD (gSaveContext.save.linkAge == 1) +#define LINK_IS_ADULT (gSaveContext.save.linkAge == 0) + +#define CURRENT_DAY (((void)0, gSaveContext.save.day) % 5) + +#define SLOT(item) gItemSlots[item] +#define AMMO(item) gSaveContext.save.inventory.ammo[SLOT(item)] +#define INV_CONTENT(item) gSaveContext.save.inventory.items[SLOT(item)] +#define GET_INV_CONTENT(item) ((void)0, gSaveContext.save.inventory.items)[SLOT(item)] + +#define CUR_FORM ((gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.save.playerForm) + +#define GET_SAVE_EQUIPS_EQUIPMENT ((void)0, gSaveContext.save.equips.equipment) +#define GET_SAVE_INVENTORY_UPGRADES ((void)0, gSaveContext.save.inventory.upgrades) +#define GET_SAVE_INVENTORY_QUEST_ITEMS ((void)0, gSaveContext.save.inventory.questItems) + +#define GET_CUR_EQUIP_VALUE(equip) ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipMasks[equip]) >> gEquipShifts[equip]) + +#define CUR_UPG_VALUE(upg) ((gSaveContext.save.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) +#define GET_CUR_UPG_VALUE(upg) ((GET_SAVE_INVENTORY_UPGRADES & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) + +#define SET_EQUIP_VALUE(equip, value) (gSaveContext.save.equips.equipment = ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipNegMasks[equip]) | (u16)((u16)(value) << gEquipShifts[equip]))) + +#define BUTTON_ITEM_EQUIP(form, button) (gSaveContext.save.equips.buttonItems[form][button]) +#define CUR_FORM_EQUIP(button) BUTTON_ITEM_EQUIP(CUR_FORM, button) + +#define C_SLOT_EQUIP(form, button) (gSaveContext.save.equips.cButtonSlots[form][button]) +#define CHECK_QUEST_ITEM(item) (GET_SAVE_INVENTORY_QUEST_ITEMS & gBitFlags[item]) +#define SET_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS | gBitFlags[item])) +#define REMOVE_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) + +#define GET_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) >> QUEST_HEART_PIECE_COUNT) +#define EQ_MAX_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)) +#define LEQ_MAX_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) <= (4 << QUEST_HEART_PIECE_COUNT)) +#define INCREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems += (1 << QUEST_HEART_PIECE_COUNT)) +#define DECREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems -= (1 << QUEST_HEART_PIECE_COUNT)) +#define RESET_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT)) + +#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) +#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) +#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.inventory.dungeonKeys[(void)0, dungeonIndex]) + +#define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) +#define GET_CUR_FORM_BTN_SLOT(btn) ((u8)((btn) == EQUIP_SLOT_B ? C_SLOT_EQUIP(CUR_FORM, btn) : C_SLOT_EQUIP(0, btn))) + + +#define SET_CUR_FORM_BTN_ITEM(btn, item) \ + if ((btn) == EQUIP_SLOT_B) { \ + BUTTON_ITEM_EQUIP(CUR_FORM, (btn)) = (item); \ + } else { \ + BUTTON_ITEM_EQUIP(0, (btn)) = (item); \ + } \ + (void)0 + +#define SET_CUR_FORM_BTN_SLOT(btn, item) \ + if ((btn) == EQUIP_SLOT_B) { \ + C_SLOT_EQUIP(CUR_FORM, (btn)) = (item); \ + } else { \ + C_SLOT_EQUIP(0, (btn)) = (item); \ + } \ + (void)0 + +#define STOLEN_ITEM_NONE (0) + +#define STOLEN_ITEM_1 ((gSaveContext.save.stolenItems & 0xFF000000) >> 0x18) +#define STOLEN_ITEM_2 ((gSaveContext.save.stolenItems & 0x00FF0000) >> 0x10) + +#define SET_STOLEN_ITEM_1(itemId) \ + (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0xFF000000) | ((itemId & 0xFF) << 0x18)) +#define SET_STOLEN_ITEM_2(itemId) \ + (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10)) + +#define GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() ((s32)(gSaveContext.save.shootingGalleryHighScores & 0xFFFF)) +#define GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() ((s32)((gSaveContext.save.shootingGalleryHighScores & 0xFFFF0000) >> 0x10)) +#define SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = (gSaveContext.save.shootingGalleryHighScores & 0xFFFF0000) | ((u16)(score))) +#define SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = ((gSaveContext.save.shootingGalleryHighScores) & 0xFFFF) | ((u16)(score) << 0x10)) + typedef enum { /* 0 */ DUNGEON_INDEX_WOODFALL_TEMPLE, /* 1 */ DUNGEON_INDEX_SNOWHEAD_TEMPLE, @@ -370,7 +449,7 @@ void func_80147150(SramContext* sramCtx); void func_80147198(SramContext* sramCtx); extern s32 D_801C6798[]; -extern u8 D_801C67B0[24]; +extern u8 gAmmoItems[]; extern s32 D_801C67C8[]; extern s32 D_801C67E8[]; extern s32 D_801C67F0[]; diff --git a/include/z64scene.h b/include/z64scene.h index 55a530db3..297bb2672 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -489,19 +489,20 @@ typedef struct { /* 0x08 */ UNK_TYPE2 unk8; } MinimapChest; // size = 0xA +// TODO: consider merging with bgCamInfo? typedef struct { - /* 0x0 */ s16 setting; - /* 0x2 */ s16 numData; - /* 0x4 */ Vec3s* data; -} CsCamData; // size = 0x8 + /* 0x0 */ s16 setting; // camera setting described by CameraSettingType enum + /* 0x2 */ s16 count; + /* 0x4 */ Vec3s* actorCsCamFuncData; // s16 data grouped in threes +} ActorCsCamInfo; // size = 0x8 -typedef CsCamData CsCameraEntry; // TODO: Remove once ZAPD updates its structs +typedef ActorCsCamInfo CsCameraEntry; // TODO: Remove once ZAPD updates its structs typedef union { /* Command: N/A */ SCmdBase base; /* Command: 0x00 */ SCmdSpawnList spawnList; /* Command: 0x01 */ SCmdActorList actorList; - /* Command: 0x02 */ SCmdCsCameraList csCameraList; + /* Command: 0x02 */ SCmdCsCameraList actorCsCamList; /* Command: 0x03 */ SCmdColHeader colHeader; /* Command: 0x04 */ SCmdRoomList roomList; /* Command: 0x05 */ SCmdWindSettings windSettings; diff --git a/include/z64schedule.h b/include/z64schedule.h index f5dfb2be8..8dba85d4d 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -3,37 +3,45 @@ #include "ultra64.h" -/* - Schedule is a subsystem that acts as a way to make decisions based on the - time and scene (and a limited selection of items). It is utilized by writing - a script that is encoded into bytecode and ran, returning the result in a - struct. The returned result can be a value or a encoded time value. +/** + * Schedule is a subsystem that acts as a way to make decisions based on the + * time and scene (and a limited selection of items). It is utilized by writing + * a script that is encoded into bytecode and run, returning the result in a + * struct. The returned result can be a value or a encoded time value. + * + * The scripts contain 2 kinds of instructions: + * - Checks with branches (relative offsets, either 1-byte offsets (short, *_S), + * or 2-byte offsets (long, *_L)) + * - Returns + * + * Scripts are stored as u8[]. They are built using the macros are the bottom of + * this file. The scheduledis.py script can be used to convert any scripts in + * actor data into the macros. + */ - The scripts contain 2 kinds of instructions: - - Checks with branches (relative offsets, either 1-byte offsets (short, *_S), - or 2-byte offsets (long, *_L)) - - Returns - - Scripts are stored as u8[]. They are built using the macros are the bottom of - this file. The scheduledis.py script can be used to convert any scripts in - actor data into the macros. -*/ +/** + * Actors that use this system generally create 3 functions to interact with it. + * + * - FollowSchedule: The action function an actor sets to follow the schedule. + * - ProcessScheduleOutput: Holds the logic of processing the output received by running the schedule script, called by FollowSchedule + * - HandleSchedule: Holds the actual logic of how to actually follow the schedule based on the processed output, called by FollowSchedule + */ // Macro to convert the time format used in the save struct into the format used in Schedule #define SCHEDULE_CONVERT_TIME(time) ((time) - 0x10000 / 360 * 90) #define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time) typedef enum { - /* 00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch - /* 01 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch - /* 02 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch - /* 03 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch - /* 04 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct) - /* 05 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything - /* 06 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value - /* 07 */ SCHEDULE_CMD_ID_NOP, // No-Op - /* 08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch - /* 09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value + /* 0 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch + /* 1 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch + /* 2 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch + /* 3 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch + /* 4 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct) + /* 5 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything + /* 6 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value + /* 7 */ SCHEDULE_CMD_ID_NOP, // No-Op + /* 8 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch + /* 9 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value /* 10 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch /* 11 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch /* 12 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch @@ -56,7 +64,7 @@ typedef struct { /* 0x4 */ s32 time0; /* 0x8 */ s32 time1; /* 0xC */ s32 hasResult; -} ScheduleResult; // size = 0x10 +} ScheduleOutput; // size = 0x10 typedef struct { /* 0x0 */ u8 cmd; diff --git a/include/z64subs.h b/include/z64subs.h index 60c3e7151..ff9404e9d 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -122,7 +122,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween void SubS_DrawShadowTex(Actor* actor, struct GameState* gameState, u8* tex); s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax); -s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* turnTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options); +s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trackTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options); s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB); diff --git a/include/z64view.h b/include/z64view.h new file mode 100644 index 000000000..98ca1ab19 --- /dev/null +++ b/include/z64view.h @@ -0,0 +1,57 @@ +#ifndef Z64VIEW_H +#define Z64VIEW_H + +#include "PR/ultratypes.h" +#include "PR/gbi.h" +#include "z64math.h" +#include "unk.h" + +struct GraphicsContext; + +typedef struct Viewport { + /* 0x00 */ s32 topY; // uly (upper left y) + /* 0x04 */ s32 bottomY; // lry (lower right y) + /* 0x08 */ s32 leftX; // ulx (upper left x) + /* 0x0C */ s32 rightX; // lrx (lower right x) +} Viewport; // size = 0x10 + +typedef struct View { + /* 0x000 */ u32 magic; // string literal "VIEW" / 0x56494557 + /* 0x004 */ struct GraphicsContext* gfxCtx; + /* 0x008 */ Viewport viewport; + /* 0x018 */ f32 fovy; // vertical field of view in degrees + /* 0x01C */ f32 zNear; // distance to near clipping plane + /* 0x020 */ f32 zFar; // distance to far clipping plane + /* 0x024 */ f32 scale; // scale for matrix elements + /* 0x028 */ Vec3f eye; + /* 0x034 */ Vec3f at; + /* 0x040 */ Vec3f up; + /* 0x04C */ UNK_TYPE1 pad4C[0x4]; + /* 0x050 */ Vp vp; + /* 0x060 */ Mtx projection; + /* 0x0A0 */ Mtx viewing; + /* 0x0E0 */ Mtx unkE0; + /* 0x120 */ Mtx* projectionPtr; + /* 0x124 */ Mtx* viewingPtr; + /* 0x128 */ Vec3f distortionDirRot; + /* 0x134 */ Vec3f distortionScale; + /* 0x140 */ f32 distortionSpeed; + /* 0x144 */ Vec3f curDistortionDirRot; + /* 0x150 */ Vec3f curDistortionScale; + /* 0x15C */ u16 normal; // used to normalize the projection matrix + /* 0x160 */ u32 flags; // bit 3: Render to an orthographic perspective + /* 0x164 */ s32 unk164; +} View; // size = 0x168 + +#define SET_FULLSCREEN_VIEWPORT(view) \ + { \ + Viewport viewport; \ + viewport.bottomY = SCREEN_HEIGHT; \ + viewport.rightX = SCREEN_WIDTH; \ + viewport.topY = 0; \ + viewport.leftX = 0; \ + View_SetViewport(view, &viewport); \ + } \ + (void)0 + +#endif diff --git a/spec b/spec index 231da54ae..dc2138945 100644 --- a/spec +++ b/spec @@ -461,7 +461,6 @@ beginseg include "build/data/code/z_debug_mode.bss.o" include "build/src/code/z_demo.o" include "build/src/code/z_draw.o" - include "build/data/code/z_draw.data.o" include "build/src/code/z_eff_footmark.o" include "build/data/code/z_eff_footmark.data.o" include "build/src/code/z_sound_source.o" @@ -620,7 +619,6 @@ beginseg include "build/src/code/audio/audio_playback.o" include "build/src/code/audio/audio_effects.o" include "build/src/code/audio/audio_seqplayer.o" - include "build/data/code/audio_seqplayer.data.o" include "build/data/code/audio_dramStack.data.o" include "build/asm/code/code_8019AE40.text.o" // handwritten pad_text @@ -709,7 +707,6 @@ beginseg include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.o" - include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.data.o" include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.bss.o" include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.reloc.o" endseg @@ -1370,8 +1367,7 @@ beginseg name "ovl_En_Ik" compress include "build/src/overlays/actors/ovl_En_Ik/z_en_ik.o" - include "build/data/ovl_En_Ik/ovl_En_Ik.data.o" - include "build/data/ovl_En_Ik/ovl_En_Ik.reloc.o" + include "build/src/overlays/actors/ovl_En_Ik/ovl_En_Ik_reloc.o" endseg beginseg @@ -1456,24 +1452,21 @@ beginseg name "ovl_Obj_Lift" compress include "build/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.o" - include "build/data/ovl_Obj_Lift/ovl_Obj_Lift.data.o" - include "build/data/ovl_Obj_Lift/ovl_Obj_Lift.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Lift/ovl_Obj_Lift_reloc.o" endseg beginseg name "ovl_Obj_Hsblock" compress include "build/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.o" - include "build/data/ovl_Obj_Hsblock/ovl_Obj_Hsblock.data.o" - include "build/data/ovl_Obj_Hsblock/ovl_Obj_Hsblock.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Hsblock/ovl_Obj_Hsblock_reloc.o" endseg beginseg name "ovl_En_Okarina_Tag" compress include "build/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.o" - include "build/data/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag.data.o" - include "build/data/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag.reloc.o" + include "build/src/overlays/actors/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag_reloc.o" endseg beginseg @@ -1790,8 +1783,7 @@ beginseg name "ovl_Effect_Ss_G_Spk" compress include "build/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.o" - include "build/data/ovl_Effect_Ss_G_Spk/ovl_Effect_Ss_G_Spk.data.o" - include "build/data/ovl_Effect_Ss_G_Spk/ovl_Effect_Ss_G_Spk.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_G_Spk/ovl_Effect_Ss_G_Spk_reloc.o" endseg beginseg @@ -1813,8 +1805,7 @@ beginseg name "ovl_Effect_Ss_G_Ripple" compress include "build/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.o" - include "build/data/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple.data.o" - include "build/data/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_G_Ripple/ovl_Effect_Ss_G_Ripple_reloc.o" endseg beginseg @@ -1828,8 +1819,7 @@ beginseg name "ovl_Effect_Ss_G_Fire" compress include "build/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.o" - include "build/data/ovl_Effect_Ss_G_Fire/ovl_Effect_Ss_G_Fire.data.o" - include "build/data/ovl_Effect_Ss_G_Fire/ovl_Effect_Ss_G_Fire.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_G_Fire/ovl_Effect_Ss_G_Fire_reloc.o" endseg beginseg @@ -2246,8 +2236,7 @@ beginseg name "ovl_Bg_Fire_Wall" compress include "build/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.o" - include "build/data/ovl_Bg_Fire_Wall/ovl_Bg_Fire_Wall.data.o" - include "build/data/ovl_Bg_Fire_Wall/ovl_Bg_Fire_Wall.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Fire_Wall/ovl_Bg_Fire_Wall_reloc.o" endseg beginseg @@ -2760,17 +2749,14 @@ beginseg name "ovl_En_Bat" compress include "build/src/overlays/actors/ovl_En_Bat/z_en_bat.o" - include "build/data/ovl_En_Bat/ovl_En_Bat.data.o" - include "build/data/ovl_En_Bat/ovl_En_Bat.bss.o" - include "build/data/ovl_En_Bat/ovl_En_Bat.reloc.o" + include "build/src/overlays/actors/ovl_En_Bat/ovl_En_Bat_reloc.o" endseg beginseg name "ovl_En_Sekihi" compress include "build/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.o" - include "build/data/ovl_En_Sekihi/ovl_En_Sekihi.data.o" - include "build/data/ovl_En_Sekihi/ovl_En_Sekihi.reloc.o" + include "build/src/overlays/actors/ovl_En_Sekihi/ovl_En_Sekihi_reloc.o" endseg beginseg @@ -2799,8 +2785,7 @@ beginseg name "ovl_Eff_Change" compress include "build/src/overlays/actors/ovl_Eff_Change/z_eff_change.o" - include "build/data/ovl_Eff_Change/ovl_Eff_Change.data.o" - include "build/data/ovl_Eff_Change/ovl_Eff_Change.reloc.o" + include "build/src/overlays/actors/ovl_Eff_Change/ovl_Eff_Change_reloc.o" endseg beginseg @@ -3048,8 +3033,7 @@ beginseg name "ovl_Obj_Purify" compress include "build/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.o" - include "build/data/ovl_Obj_Purify/ovl_Obj_Purify.data.o" - include "build/data/ovl_Obj_Purify/ovl_Obj_Purify.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Purify/ovl_Obj_Purify_reloc.o" endseg beginseg @@ -3147,16 +3131,14 @@ beginseg name "ovl_Dm_Char03" compress include "build/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.o" - include "build/data/ovl_Dm_Char03/ovl_Dm_Char03.data.o" - include "build/data/ovl_Dm_Char03/ovl_Dm_Char03.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char03/ovl_Dm_Char03_reloc.o" endseg beginseg name "ovl_Dm_Char04" compress include "build/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.o" - include "build/data/ovl_Dm_Char04/ovl_Dm_Char04.data.o" - include "build/data/ovl_Dm_Char04/ovl_Dm_Char04.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char04/ovl_Dm_Char04_reloc.o" endseg beginseg @@ -3346,8 +3328,7 @@ beginseg name "ovl_Obj_Ocarinalift" compress include "build/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.o" - include "build/data/ovl_Obj_Ocarinalift/ovl_Obj_Ocarinalift.data.o" - include "build/data/ovl_Obj_Ocarinalift/ovl_Obj_Ocarinalift.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Ocarinalift/ovl_Obj_Ocarinalift_reloc.o" endseg beginseg @@ -3468,8 +3449,7 @@ beginseg name "ovl_Bg_Fu_Mizu" compress include "build/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.o" - include "build/data/ovl_Bg_Fu_Mizu/ovl_Bg_Fu_Mizu.data.o" - include "build/data/ovl_Bg_Fu_Mizu/ovl_Bg_Fu_Mizu.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Fu_Mizu/ovl_Bg_Fu_Mizu_reloc.o" endseg beginseg @@ -4080,8 +4060,7 @@ beginseg name "ovl_Obj_Um" compress include "build/src/overlays/actors/ovl_Obj_Um/z_obj_um.o" - include "build/data/ovl_Obj_Um/ovl_Obj_Um.data.o" - include "build/data/ovl_Obj_Um/ovl_Obj_Um.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Um/ovl_Obj_Um_reloc.o" endseg beginseg @@ -4505,9 +4484,7 @@ beginseg name "ovl_Eff_Kamejima_Wave" compress include "build/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.o" - include "build/data/ovl_Eff_Kamejima_Wave/ovl_Eff_Kamejima_Wave.data.o" - include "build/data/ovl_Eff_Kamejima_Wave/ovl_Eff_Kamejima_Wave.bss.o" - include "build/data/ovl_Eff_Kamejima_Wave/ovl_Eff_Kamejima_Wave.reloc.o" + include "build/src/overlays/actors/ovl_Eff_Kamejima_Wave/ovl_Eff_Kamejima_Wave_reloc.o" endseg beginseg @@ -4574,8 +4551,11 @@ beginseg name "ovl_Bg_Haka_Bombwall" compress include "build/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.o" - include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.data.o" - include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.reloc.o" + #ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall_reloc.o" + #else + include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.reloc.o" + #endif endseg beginseg @@ -4759,8 +4739,7 @@ beginseg name "ovl_Eff_Lastday" compress include "build/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.o" - include "build/data/ovl_Eff_Lastday/ovl_Eff_Lastday.data.o" - include "build/data/ovl_Eff_Lastday/ovl_Eff_Lastday.reloc.o" + include "build/src/overlays/actors/ovl_Eff_Lastday/ovl_Eff_Lastday_reloc.o" endseg beginseg @@ -4810,8 +4789,7 @@ beginseg name "ovl_En_Sth2" compress include "build/src/overlays/actors/ovl_En_Sth2/z_en_sth2.o" - include "build/data/ovl_En_Sth2/ovl_En_Sth2.data.o" - include "build/data/ovl_En_Sth2/ovl_En_Sth2.reloc.o" + include "build/src/overlays/actors/ovl_En_Sth2/ovl_En_Sth2_reloc.o" endseg beginseg @@ -4840,8 +4818,7 @@ beginseg name "ovl_En_Bjt" compress include "build/src/overlays/actors/ovl_En_Bjt/z_en_bjt.o" - include "build/data/ovl_En_Bjt/ovl_En_Bjt.data.o" - include "build/data/ovl_En_Bjt/ovl_En_Bjt.reloc.o" + include "build/src/overlays/actors/ovl_En_Bjt/ovl_En_Bjt_reloc.o" endseg beginseg @@ -5075,8 +5052,7 @@ beginseg name "ovl_Dm_Al" compress include "build/src/overlays/actors/ovl_Dm_Al/z_dm_al.o" - include "build/data/ovl_Dm_Al/ovl_Dm_Al.data.o" - include "build/data/ovl_Dm_Al/ovl_Dm_Al.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Al/ovl_Dm_Al_reloc.o" endseg beginseg diff --git a/src/boot_O2/gfxprint.c b/src/boot_O2/gfxprint.c index 557887abd..b52675829 100644 --- a/src/boot_O2/gfxprint.c +++ b/src/boot_O2/gfxprint.c @@ -83,7 +83,7 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { if (this->flags & GFXP_FLAG_RAINBOW) { gDPSetTextureLUT(this->dList++, G_TT_RGBA16); gDPSetCycleType(this->dList++, G_CYC_2CYCLE); - gDPSetRenderMode(this->dList++, G_RM_OPA_CI, G_RM_XLU_SURF2); + gDPSetRenderMode(this->dList++, G_RM_PASS, G_RM_XLU_SURF2); gDPSetCombineMode(this->dList++, G_CC_INTERFERENCE, G_CC_PASS2); } else { gDPSetTextureLUT(this->dList++, G_TT_IA16); diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index bc7e8d34a..e648275b6 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -269,9 +269,9 @@ void Fault_DrawCornerRec(u16 color) { void Fault_PrintFReg(s32 idx, f32* value) { u32 raw = *(u32*)value; - s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f; + s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F; - if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) { + if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) { FaultDrawer_Printf("F%02d:%14.7e ", idx, *value); } else { FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw); @@ -320,7 +320,7 @@ void osSyncPrintfFPCR(u32 value) { void Fault_PrintThreadContext(OSThread* t) { __OSThreadContext* ctx; - s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10; if (causeStrIdx == 0x17) { causeStrIdx = 0x10; } @@ -383,11 +383,11 @@ void Fault_PrintThreadContext(OSThread* t) { void osSyncPrintfThreadContext(OSThread* t) { __OSThreadContext* ctx; - s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10; if (causeStrIdx == 0x17) { causeStrIdx = 0x10; } - if (causeStrIdx == 0x1f) { + if (causeStrIdx == 0x1F) { causeStrIdx = 0x11; } @@ -416,29 +416,29 @@ void osSyncPrintfThreadContext(OSThread* t) { osSyncPrintfFReg(6, &ctx->fp6.f.f_even); osSyncPrintf("\n"); osSyncPrintfFReg(8, &ctx->fp8.f.f_even); - osSyncPrintfFReg(0xa, &ctx->fp10.f.f_even); + osSyncPrintfFReg(10, &ctx->fp10.f.f_even); osSyncPrintf("\n"); - osSyncPrintfFReg(0xc, &ctx->fp12.f.f_even); - osSyncPrintfFReg(0xe, &ctx->fp14.f.f_even); + osSyncPrintfFReg(12, &ctx->fp12.f.f_even); + osSyncPrintfFReg(14, &ctx->fp14.f.f_even); osSyncPrintf("\n"); - osSyncPrintfFReg(0x10, &ctx->fp16.f.f_even); - osSyncPrintfFReg(0x12, &ctx->fp18.f.f_even); + osSyncPrintfFReg(16, &ctx->fp16.f.f_even); + osSyncPrintfFReg(18, &ctx->fp18.f.f_even); osSyncPrintf("\n"); - osSyncPrintfFReg(0x14, &ctx->fp20.f.f_even); - osSyncPrintfFReg(0x16, &ctx->fp22.f.f_even); + osSyncPrintfFReg(20, &ctx->fp20.f.f_even); + osSyncPrintfFReg(22, &ctx->fp22.f.f_even); osSyncPrintf("\n"); - osSyncPrintfFReg(0x18, &ctx->fp24.f.f_even); - osSyncPrintfFReg(0x1a, &ctx->fp26.f.f_even); + osSyncPrintfFReg(24, &ctx->fp24.f.f_even); + osSyncPrintfFReg(26, &ctx->fp26.f.f_even); osSyncPrintf("\n"); - osSyncPrintfFReg(0x1c, &ctx->fp28.f.f_even); - osSyncPrintfFReg(0x1e, &ctx->fp30.f.f_even); + osSyncPrintfFReg(28, &ctx->fp28.f.f_even); + osSyncPrintfFReg(30, &ctx->fp30.f.f_even); osSyncPrintf("\n"); } OSThread* Fault_FindFaultedThread() { OSThread* iter = __osGetActiveQueue(); while (iter->priority != -1) { - if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) { + if (iter->priority > 0 && iter->priority < 0x7F && (iter->flags & 3)) { return iter; } iter = iter->tlnext; @@ -459,7 +459,7 @@ void Fault_Wait5Seconds(void) { void Fault_WaitForButtonCombo(void) { Input* input = &sFaultContext->padInput[0]; - FaultDrawer_SetForeColor(0xffff); + FaultDrawer_SetForeColor(0xFFFF); FaultDrawer_SetBackColor(1); do { do { @@ -480,8 +480,8 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { if (alignedAddr < (u32*)0x80000000) { alignedAddr = (u32*)0x80000000; } - if (alignedAddr > (u32*)0x807fff00) { - alignedAddr = (u32*)0x807fff00; + if (alignedAddr > (u32*)0x807FFF00) { + alignedAddr = (u32*)0x807FFF00; } alignedAddr = (u32*)((u32)alignedAddr & ~3); @@ -513,8 +513,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) { if (addr < 0x80000000) { addr = 0x80000000; } - if (addr > 0x807fff00) { - addr = 0x807fff00; + if (addr > 0x807FFF00) { + addr = 0x807FFF00; } addr &= ~0xF; @@ -696,7 +696,7 @@ void Fault_ResumeThread(OSThread* t) { t->context.cause = 0; t->context.fpcsr = 0; t->context.pc += 4; - *(u32*)t->context.pc = 0xd; + *(u32*)t->context.pc = 0x0000000D; // write in a break instruction osWritebackDCache((void*)t->context.pc, 4); osInvalICache((void*)t->context.pc, 4); osStartThread(t); diff --git a/src/boot_O2_g3/yaz0.c b/src/boot_O2_g3/yaz0.c index 80d819acc..5f8e5a0ed 100644 --- a/src/boot_O2_g3/yaz0.c +++ b/src/boot_O2_g3/yaz0.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" u8 sYaz0DataBuffer[0x400]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 0afb1df68..46fd8ee6b 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -191,8 +191,6 @@ void func_80170774(PreRender* this, Gfx** gfxp) { func_8016FF70(this, gfxp, this->zbufSave, this->zbuf); } -#ifdef NON_MATCHING -// just regalloc void func_80170798(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 y; @@ -235,6 +233,10 @@ void func_80170798(PreRender* this, Gfx** gfxp) { gDPLoadMultiTile(gfx++, this->cvgSave, 0x0160, rtile, G_IM_FMT_I, G_IM_SIZ_8b, this->width, this->height, uls, ult, lrs, lrt, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + //! FAKE + if (1) {} + // The two if (1) {}'s above can be removed with do {} while(0) around macros + if (1) {} if (1) {} gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 1 << 10, 1 << 10); @@ -247,9 +249,6 @@ void func_80170798(PreRender* this, Gfx** gfxp) { *gfxp = gfx; } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_80170798.s") -#endif void func_80170AE0(PreRender* this, Gfx** gfxp, s32 alpha) { func_8016FF90(this, gfxp, this->fbufSave, this->fbuf, 255, 255, 255, alpha); diff --git a/src/code/audio/audio_data.c b/src/code/audio/audio_data.c index c43018922..7238a4bfa 100644 --- a/src/code/audio/audio_data.c +++ b/src/code/audio/audio_data.c @@ -850,11 +850,11 @@ u8 gDefaultShortNoteGateTimeTable[] = { 229, 203, 177, 151, 139, 126, 113, 100, 87, 74, 61, 48, 36, 23, 10, 0, }; -AdsrEnvelope gDefaultEnvelope[] = { +EnvelopePoint gDefaultEnvelope[] = { { 1, 32000 }, { 1000, 32000 }, - { -1, 0 }, - { 0, 0 }, + { ADSR_HANG, 0 }, + { ADSR_DISABLE, 0 }, }; NoteSubEu gZeroNoteSub = { 0 }; diff --git a/src/code/audio/audio_effects.c b/src/code/audio/audio_effects.c index 2dcef2237..ab9228bbf 100644 --- a/src/code/audio/audio_effects.c +++ b/src/code/audio/audio_effects.c @@ -7,7 +7,7 @@ void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 reca if (channel->changes.s.volume || recalculateVolume) { channelVolume = channel->volume * channel->volumeScale * channel->seqPlayer->appliedFadeVolume; - if (channel->seqPlayer->muted && (channel->muteBehavior & 0x20)) { + if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_SOFTEN)) { channelVolume = channel->seqPlayer->muteVolumeScale * channelVolume; } channel->appliedVolume = channelVolume * channelVolume; @@ -218,7 +218,7 @@ void AudioEffects_NotePortamentoInit(Note* note) { note->playbackState.portamento = note->playbackState.parentLayer->portamento; } -void AudioEffects_AdsrInit(AdsrState* adsr, AdsrEnvelope* envelope, s16* volOut) { +void AudioEffects_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* volOut) { adsr->action.asByte = 0; adsr->delay = 0; adsr->envelope = envelope; diff --git a/src/code/audio/audio_heap.c b/src/code/audio/audio_heap.c index b06f6a577..7d3ea8ba6 100644 --- a/src/code/audio/audio_heap.c +++ b/src/code/audio/audio_heap.c @@ -21,45 +21,45 @@ f32 func_8018B0F0(f32 arg0) { void func_8018B10C(void) { s32 i; - gAudioContext.unk_3520[255] = func_8018B0F0(0.25f); - gAudioContext.unk_3520[254] = func_8018B0F0(0.33f); - gAudioContext.unk_3520[253] = func_8018B0F0(0.5f); - gAudioContext.unk_3520[252] = func_8018B0F0(0.66f); - gAudioContext.unk_3520[251] = func_8018B0F0(0.75f); + gAudioContext.adsrDecayTable[255] = func_8018B0F0(0.25f); + gAudioContext.adsrDecayTable[254] = func_8018B0F0(0.33f); + gAudioContext.adsrDecayTable[253] = func_8018B0F0(0.5f); + gAudioContext.adsrDecayTable[252] = func_8018B0F0(0.66f); + gAudioContext.adsrDecayTable[251] = func_8018B0F0(0.75f); for (i = 128; i < 251; i++) { - gAudioContext.unk_3520[i] = func_8018B0F0(251 - i); + gAudioContext.adsrDecayTable[i] = func_8018B0F0(251 - i); } for (i = 16; i < 128; i++) { - gAudioContext.unk_3520[i] = func_8018B0F0(4 * (143 - i)); + gAudioContext.adsrDecayTable[i] = func_8018B0F0(4 * (143 - i)); } for (i = 1; i < 16; i++) { - gAudioContext.unk_3520[i] = func_8018B0F0(60 * (23 - i)); + gAudioContext.adsrDecayTable[i] = func_8018B0F0(60 * (23 - i)); } - gAudioContext.unk_3520[0] = 0.0f; + gAudioContext.adsrDecayTable[0] = 0.0f; } void AudioHeap_ResetLoadStatus(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gAudioContext.fontLoadStatus); i++) { - if (gAudioContext.fontLoadStatus[i] != LOAD_STATUS_5) { - gAudioContext.fontLoadStatus[i] = LOAD_STATUS_0; + if (gAudioContext.fontLoadStatus[i] != LOAD_STATUS_PERMANENT) { + gAudioContext.fontLoadStatus[i] = LOAD_STATUS_NOT_LOADED; } } for (i = 0; i < ARRAY_COUNT(gAudioContext.sampleFontLoadStatus); i++) { - if (gAudioContext.sampleFontLoadStatus[i] != LOAD_STATUS_5) { - gAudioContext.sampleFontLoadStatus[i] = LOAD_STATUS_0; + if (gAudioContext.sampleFontLoadStatus[i] != LOAD_STATUS_PERMANENT) { + gAudioContext.sampleFontLoadStatus[i] = LOAD_STATUS_NOT_LOADED; } } for (i = 0; i < ARRAY_COUNT(gAudioContext.seqLoadStatus); i++) { - if (gAudioContext.seqLoadStatus[i] != LOAD_STATUS_5) { - gAudioContext.seqLoadStatus[i] = LOAD_STATUS_0; + if (gAudioContext.seqLoadStatus[i] != LOAD_STATUS_PERMANENT) { + gAudioContext.seqLoadStatus[i] = LOAD_STATUS_NOT_LOADED; } } } @@ -302,7 +302,7 @@ void AudioHeap_PopCache(s32 tableType) { AudioHeap_DiscardFont(persistent->entries[persistent->numEntries - 1].id); } - loadStatus[persistent->entries[persistent->numEntries - 1].id] = LOAD_STATUS_0; + loadStatus[persistent->entries[persistent->numEntries - 1].id] = LOAD_STATUS_NOT_LOADED; persistent->numEntries--; } @@ -409,12 +409,12 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } loadStatusEntry0 = - (temporaryCache->entries[0].id == -1) ? LOAD_STATUS_0 : loadStatus[temporaryCache->entries[0].id]; + (temporaryCache->entries[0].id == -1) ? LOAD_STATUS_NOT_LOADED : loadStatus[temporaryCache->entries[0].id]; loadStatusEntry1 = - (temporaryCache->entries[1].id == -1) ? LOAD_STATUS_0 : loadStatus[temporaryCache->entries[1].id]; + (temporaryCache->entries[1].id == -1) ? LOAD_STATUS_NOT_LOADED : loadStatus[temporaryCache->entries[1].id]; if (tableType == FONT_TABLE) { - if (loadStatusEntry0 == LOAD_STATUS_4) { + if (loadStatusEntry0 == LOAD_STATUS_MAYBE_DISCARDABLE) { for (i = 0; i < gAudioContext.numNotes; i++) { if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[0].id) && gAudioContext.notes[i].noteSubEu.bitField0.enabled) { @@ -423,12 +423,12 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } if (i == gAudioContext.numNotes) { - AudioLoad_SetFontLoadStatus(temporaryCache->entries[0].id, LOAD_STATUS_3); - loadStatusEntry0 = LOAD_STATUS_3; + AudioLoad_SetFontLoadStatus(temporaryCache->entries[0].id, LOAD_STATUS_DISCARDABLE); + loadStatusEntry0 = LOAD_STATUS_DISCARDABLE; } } - if (loadStatusEntry1 == LOAD_STATUS_4) { + if (loadStatusEntry1 == LOAD_STATUS_MAYBE_DISCARDABLE) { for (i = 0; i < gAudioContext.numNotes; i++) { if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[1].id) && gAudioContext.notes[i].noteSubEu.bitField0.enabled) { @@ -437,26 +437,26 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } if (i == gAudioContext.numNotes) { - AudioLoad_SetFontLoadStatus(temporaryCache->entries[1].id, LOAD_STATUS_3); - loadStatusEntry1 = LOAD_STATUS_3; + AudioLoad_SetFontLoadStatus(temporaryCache->entries[1].id, LOAD_STATUS_DISCARDABLE); + loadStatusEntry1 = LOAD_STATUS_DISCARDABLE; } } } - if (loadStatusEntry0 == LOAD_STATUS_0) { + if (loadStatusEntry0 == LOAD_STATUS_NOT_LOADED) { temporaryCache->nextSide = 0; - } else if (loadStatusEntry1 == LOAD_STATUS_0) { + } else if (loadStatusEntry1 == LOAD_STATUS_NOT_LOADED) { temporaryCache->nextSide = 1; - } else if ((loadStatusEntry0 == LOAD_STATUS_3) && (loadStatusEntry1 == LOAD_STATUS_3)) { + } else if ((loadStatusEntry0 == LOAD_STATUS_DISCARDABLE) && (loadStatusEntry1 == LOAD_STATUS_DISCARDABLE)) { // Use the opposite side from last time. - } else if (loadStatusEntry0 == LOAD_STATUS_3) { + } else if (loadStatusEntry0 == LOAD_STATUS_DISCARDABLE) { temporaryCache->nextSide = 0; - } else if (loadStatusEntry1 == LOAD_STATUS_3) { + } else if (loadStatusEntry1 == LOAD_STATUS_DISCARDABLE) { temporaryCache->nextSide = 1; } else { // Check if there is a side which isn't in active use, if so, evict that one. if (tableType == SEQUENCE_TABLE) { - if (loadStatusEntry0 == LOAD_STATUS_2) { + if (loadStatusEntry0 == LOAD_STATUS_COMPLETE) { for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) { if (gAudioContext.seqPlayers[i].enabled && gAudioContext.seqPlayers[i].seqId == temporaryCache->entries[0].id) { @@ -470,7 +470,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } } - if (loadStatusEntry1 == LOAD_STATUS_2) { + if (loadStatusEntry1 == LOAD_STATUS_COMPLETE) { for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) { if (gAudioContext.seqPlayers[i].enabled && gAudioContext.seqPlayers[i].seqId == temporaryCache->entries[1].id) { @@ -484,7 +484,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } } } else if (tableType == FONT_TABLE) { - if (loadStatusEntry0 == LOAD_STATUS_2) { + if (loadStatusEntry0 == LOAD_STATUS_COMPLETE) { for (i = 0; i < gAudioContext.numNotes; i++) { if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[0].id) && gAudioContext.notes[i].noteSubEu.bitField0.enabled) { @@ -497,7 +497,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { } } - if (loadStatusEntry1 == LOAD_STATUS_2) { + if (loadStatusEntry1 == LOAD_STATUS_COMPLETE) { for (i = 0; i < gAudioContext.numNotes; i++) { if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[1].id) && gAudioContext.notes[i].noteSubEu.bitField0.enabled) { @@ -514,15 +514,15 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { // No such luck. Evict the side that wasn't chosen last time, except // if it is being loaded into. if (temporaryCache->nextSide == 0) { - if (loadStatusEntry0 == LOAD_STATUS_1) { - if (loadStatusEntry1 == LOAD_STATUS_1) { + if (loadStatusEntry0 == LOAD_STATUS_IN_PROGRESS) { + if (loadStatusEntry1 == LOAD_STATUS_IN_PROGRESS) { goto fail; } temporaryCache->nextSide = 1; } } else { - if (loadStatusEntry1 == LOAD_STATUS_1) { - if (loadStatusEntry0 == LOAD_STATUS_1) { + if (loadStatusEntry1 == LOAD_STATUS_IN_PROGRESS) { + if (loadStatusEntry0 == LOAD_STATUS_IN_PROGRESS) { goto fail; } temporaryCache->nextSide = 0; @@ -544,7 +544,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { AudioHeap_DiscardSampleBank(temporaryCache->entries[side].id); } - loadStatus[temporaryCache->entries[side].id] = LOAD_STATUS_0; + loadStatus[temporaryCache->entries[side].id] = LOAD_STATUS_NOT_LOADED; if (tableType == FONT_TABLE) { AudioHeap_DiscardFont(temporaryCache->entries[side].id); @@ -564,7 +564,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { AudioHeap_DiscardSampleBank(temporaryCache->entries[1].id); } - loadStatus[temporaryCache->entries[1].id] = LOAD_STATUS_0; + loadStatus[temporaryCache->entries[1].id] = LOAD_STATUS_NOT_LOADED; switch (tableType) { case SEQUENCE_TABLE: @@ -594,7 +594,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) { AudioHeap_DiscardSampleBank(temporaryCache->entries[0].id); } - loadStatus[temporaryCache->entries[0].id] = LOAD_STATUS_0; + loadStatus[temporaryCache->entries[0].id] = LOAD_STATUS_NOT_LOADED; switch (tableType) { case SEQUENCE_TABLE: @@ -1042,8 +1042,8 @@ void AudioHeap_Init(void) { AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(u64)); } - // Initialize unk_3520 (fadeOutVelocities for ADSR) - gAudioContext.unk_3520 = AudioHeap_Alloc(&gAudioContext.miscPool, 0x100 * sizeof(f32)); + // Initialize adsrDecayTable (fadeOutVelocities for ADSR) + gAudioContext.adsrDecayTable = AudioHeap_Alloc(&gAudioContext.miscPool, 0x100 * sizeof(f32)); func_8018B10C(); // Initialize reverbs diff --git a/src/code/audio/audio_load.c b/src/code/audio/audio_load.c index 8b70eadd7..b4997a94e 100644 --- a/src/code/audio/audio_load.c +++ b/src/code/audio/audio_load.c @@ -29,7 +29,7 @@ typedef struct { } AudioRelocInfo; // size = 0x18 void AudioLoad_DiscardFont(s32 fontId); -s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2); +s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2); u8* AudioLoad_SyncLoadSeq(s32 seqId); u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad); SoundFontData* AudioLoad_SyncLoadFont(u32 fontId); @@ -301,9 +301,9 @@ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) { s32 AudioLoad_IsFontLoadComplete(s32 fontId) { if (fontId == 0xFF) { return true; - } else if (gAudioContext.fontLoadStatus[fontId] >= LOAD_STATUS_2) { + } else if (gAudioContext.fontLoadStatus[fontId] >= LOAD_STATUS_COMPLETE) { return true; - } else if (gAudioContext.fontLoadStatus[AudioLoad_GetRealTableIndex(FONT_TABLE, fontId)] >= LOAD_STATUS_2) { + } else if (gAudioContext.fontLoadStatus[AudioLoad_GetRealTableIndex(FONT_TABLE, fontId)] >= LOAD_STATUS_COMPLETE) { return true; } else { return false; @@ -313,9 +313,10 @@ s32 AudioLoad_IsFontLoadComplete(s32 fontId) { s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { if (seqId == 0xFF) { return true; - } else if (gAudioContext.seqLoadStatus[seqId] >= LOAD_STATUS_2) { + } else if (gAudioContext.seqLoadStatus[seqId] >= LOAD_STATUS_COMPLETE) { return true; - } else if (gAudioContext.seqLoadStatus[AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId)] >= LOAD_STATUS_2) { + } else if (gAudioContext.seqLoadStatus[AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId)] >= + LOAD_STATUS_COMPLETE) { return true; } else { return false; @@ -325,10 +326,10 @@ s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { s32 AudioLoad_IsSampleLoadComplete(s32 sampleBankId) { if (sampleBankId == 0xFF) { return true; - } else if (gAudioContext.sampleFontLoadStatus[sampleBankId] >= LOAD_STATUS_2) { + } else if (gAudioContext.sampleFontLoadStatus[sampleBankId] >= LOAD_STATUS_COMPLETE) { return true; } else if (gAudioContext.sampleFontLoadStatus[AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId)] >= - LOAD_STATUS_2) { + LOAD_STATUS_COMPLETE) { return true; } else { return false; @@ -336,32 +337,32 @@ s32 AudioLoad_IsSampleLoadComplete(s32 sampleBankId) { } void AudioLoad_SetFontLoadStatus(s32 fontId, s32 loadStatus) { - if ((fontId != 0xFF) && (gAudioContext.fontLoadStatus[fontId] != LOAD_STATUS_5)) { + if ((fontId != 0xFF) && (gAudioContext.fontLoadStatus[fontId] != LOAD_STATUS_PERMANENT)) { gAudioContext.fontLoadStatus[fontId] = loadStatus; } } void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 loadStatus) { - if ((seqId != 0xFF) && (gAudioContext.seqLoadStatus[seqId] != LOAD_STATUS_5)) { + if ((seqId != 0xFF) && (gAudioContext.seqLoadStatus[seqId] != LOAD_STATUS_PERMANENT)) { gAudioContext.seqLoadStatus[seqId] = loadStatus; } } void AudioLoad_SetSampleFontLoadStatusAndApplyCaches(s32 sampleBankId, s32 loadStatus) { if (sampleBankId != 0xFF) { - if (gAudioContext.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_5) { + if (gAudioContext.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_PERMANENT) { gAudioContext.sampleFontLoadStatus[sampleBankId] = loadStatus; } - if ((gAudioContext.sampleFontLoadStatus[sampleBankId] == LOAD_STATUS_5) || - (gAudioContext.sampleFontLoadStatus[sampleBankId] == LOAD_STATUS_2)) { + if ((gAudioContext.sampleFontLoadStatus[sampleBankId] == LOAD_STATUS_PERMANENT) || + (gAudioContext.sampleFontLoadStatus[sampleBankId] == LOAD_STATUS_COMPLETE)) { AudioHeap_ApplySampleBankCache(sampleBankId); } } } void AudioLoad_SetSampleFontLoadStatus(s32 sampleBankId, s32 loadStatus) { - if ((sampleBankId != 0xFF) && (gAudioContext.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_5)) { + if ((sampleBankId != 0xFF) && (gAudioContext.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_PERMANENT)) { gAudioContext.sampleFontLoadStatus[sampleBankId] = loadStatus; } } @@ -510,7 +511,7 @@ void AudioLoad_DiscardSeqFonts(s32 seqId) { fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.sequenceFontTable[index++]); if (AudioHeap_SearchPermanentCache(FONT_TABLE, fontId) == NULL) { AudioLoad_DiscardFont(fontId); - AudioLoad_SetFontLoadStatus(fontId, LOAD_STATUS_0); + AudioLoad_SetFontLoadStatus(fontId, LOAD_STATUS_NOT_LOADED); } } } @@ -553,31 +554,31 @@ void func_8018FA60(u32 tableType, u32 id, s32 type, s32 data) { } } -s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) { +s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2) { if (gAudioContext.resetTimer != 0) { return 0; } - gAudioContext.seqPlayers[playerIdx].skipTicks = 0; - AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, arg2); + gAudioContext.seqPlayers[playerIndex].skipTicks = 0; + AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, arg2); // Intentionally missing return. Returning the result of the above function // call matches but is UB because it too is missing a return, and using the // result of a non-void function that has failed to return a value is UB. // The callers of this function do not use the return value, so it's fine. } -s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) { +s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks) { if (gAudioContext.resetTimer != 0) { return 0; } - gAudioContext.seqPlayers[playerIdx].skipTicks = skipTicks; - AudioLoad_SyncInitSeqPlayerInternal(playerIdx, seqId, 0); + gAudioContext.seqPlayers[playerIndex].skipTicks = skipTicks; + AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, 0); // Missing return, see above. } -s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { - SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx]; +s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) { + SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIndex]; u8* seqData; s32 index; s32 numFonts; @@ -620,7 +621,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { seqPlayer->scriptState.depth = 0; seqPlayer->delay = 0; seqPlayer->finished = false; - seqPlayer->playerIdx = playerIdx; + seqPlayer->playerIndex = playerIndex; //! @bug missing return (but the return value is not used so it's not UB) } @@ -628,7 +629,7 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) { s32 pad; s32 didAllocate; - if (gAudioContext.seqLoadStatus[AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId)] == LOAD_STATUS_1) { + if (gAudioContext.seqLoadStatus[AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId)] == LOAD_STATUS_IN_PROGRESS) { return NULL; } @@ -649,8 +650,8 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad addr = AudioLoad_SearchCaches(SAMPLE_TABLE, realTableId); if (addr != NULL) { - if (gAudioContext.sampleFontLoadStatus[realTableId] != LOAD_STATUS_1) { - AudioLoad_SetSampleFontLoadStatus(realTableId, LOAD_STATUS_2); + if (gAudioContext.sampleFontLoadStatus[realTableId] != LOAD_STATUS_IN_PROGRESS) { + AudioLoad_SetSampleFontLoadStatus(realTableId, LOAD_STATUS_COMPLETE); } *outMedium = MEDIUM_RAM; @@ -682,7 +683,7 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) { AudioRelocInfo relocInfo; s32 realFontId = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId); - if (gAudioContext.fontLoadStatus[realFontId] == LOAD_STATUS_1) { + if (gAudioContext.fontLoadStatus[realFontId] == LOAD_STATUS_IN_PROGRESS) { return NULL; } @@ -730,7 +731,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) { ramAddr = AudioLoad_SearchCaches(tableType, realId); if (ramAddr != NULL) { *didAllocate = false; - loadStatus = LOAD_STATUS_2; + loadStatus = LOAD_STATUS_COMPLETE; } else { table = AudioLoad_GetLoadTable(tableType); size = table->entries[realId].size; @@ -793,7 +794,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) { AudioLoad_SyncDma(romAddr, ramAddr, size, medium); } - loadStatus = (cachePolicy == CACHE_LOAD_PERMANENT) ? LOAD_STATUS_5 : LOAD_STATUS_2; + loadStatus = (cachePolicy == CACHE_LOAD_PERMANENT) ? LOAD_STATUS_PERMANENT : LOAD_STATUS_COMPLETE; } switch (tableType) { @@ -1032,19 +1033,19 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, switch (tableType) { case SEQUENCE_TABLE: - if (gAudioContext.seqLoadStatus[realId] == LOAD_STATUS_1) { + if (gAudioContext.seqLoadStatus[realId] == LOAD_STATUS_IN_PROGRESS) { return NULL; } break; case FONT_TABLE: - if (gAudioContext.fontLoadStatus[realId] == LOAD_STATUS_1) { + if (gAudioContext.fontLoadStatus[realId] == LOAD_STATUS_IN_PROGRESS) { return NULL; } break; case SAMPLE_TABLE: - if (gAudioContext.sampleFontLoadStatus[realId] == LOAD_STATUS_1) { + if (gAudioContext.sampleFontLoadStatus[realId] == LOAD_STATUS_IN_PROGRESS) { return NULL; } break; @@ -1052,8 +1053,8 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, ramAddr = AudioLoad_SearchCaches(tableType, realId); if (ramAddr != NULL) { - loadStatus = LOAD_STATUS_2; - osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_0), OS_MESG_NOBLOCK); + loadStatus = LOAD_STATUS_COMPLETE; + osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK); } else { table = AudioLoad_GetLoadTable(tableType); size = table->entries[realId].size; @@ -1061,7 +1062,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, medium = table->entries[id].medium; cachePolicy = table->entries[id].cachePolicy; romAddr = table->entries[realId].romAddr; - loadStatus = LOAD_STATUS_2; + loadStatus = LOAD_STATUS_COMPLETE; switch (cachePolicy) { case CACHE_LOAD_PERMANENT: @@ -1069,7 +1070,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, if (ramAddr == NULL) { return ramAddr; } - loadStatus = LOAD_STATUS_5; + loadStatus = LOAD_STATUS_PERMANENT; break; case CACHE_LOAD_PERSISTENT: @@ -1119,7 +1120,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, MK_ASYNC_MSG(retData, tableType, realId, loadStatus)); } - loadStatus = LOAD_STATUS_1; + loadStatus = LOAD_STATUS_IN_PROGRESS; } switch (tableType) { diff --git a/src/code/audio/audio_playback.c b/src/code/audio/audio_playback.c index 6ae5696f1..c7789bd36 100644 --- a/src/code/audio/audio_playback.c +++ b/src/code/audio/audio_playback.c @@ -98,7 +98,7 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at sub->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f)); sub->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f)); - sub->unk_2 = attrs->unk_1; + sub->gain = attrs->gain; sub->filter = attrs->filter; sub->unk_07 = attrs->unk_14; sub->unk_0E = attrs->unk_16; @@ -125,7 +125,7 @@ void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRat } void AudioPlayback_NoteInit(Note* note) { - if (note->playbackState.parentLayer->adsr.releaseRate == 0) { + if (note->playbackState.parentLayer->adsr.decayIndex == 0) { AudioEffects_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope, ¬e->playbackState.adsrVolScaleUnused); } else { @@ -189,7 +189,7 @@ void AudioPlayback_ProcessNotes(void) { playbackState->unk_04 = 1; continue; } else if (playbackState->parentLayer->channel->seqPlayer->muted && - (playbackState->parentLayer->channel->muteBehavior & 0x40)) { + (playbackState->parentLayer->channel->muteFlags & MUTE_FLAGS_STOP_NOTES)) { // do nothing } else { goto out; @@ -257,7 +257,7 @@ void AudioPlayback_ProcessNotes(void) { subAttrs.pan = attrs->pan; subAttrs.reverbVol = attrs->reverb; subAttrs.stereo = attrs->stereo; - subAttrs.unk_1 = attrs->unk_1; + subAttrs.gain = attrs->gain; subAttrs.filter = attrs->filter; subAttrs.unk_14 = attrs->unk_4; subAttrs.unk_16 = attrs->unk_6; @@ -290,9 +290,9 @@ void AudioPlayback_ProcessNotes(void) { } if (layer->unk_0A.s.bit_9 == 1) { - subAttrs.unk_1 = channel->unk_0C; + subAttrs.gain = channel->gain; } else { - subAttrs.unk_1 = 0; + subAttrs.gain = 0; if (1) {} } @@ -301,7 +301,7 @@ void AudioPlayback_ProcessNotes(void) { subAttrs.unk_16 = channel->unk_20; bookOffset = channel->bookOffset & 0x7; - if (channel->seqPlayer->muted && (channel->muteBehavior & 8)) { + if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_3)) { subAttrs.frequency = 0.0f; subAttrs.velocity = 0.0f; } @@ -506,9 +506,9 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { } if (layer->unk_0A.s.bit_9 == 1) { - attrs->unk_1 = chan->unk_0C; + attrs->gain = chan->gain; } else { - attrs->unk_1 = 0; + attrs->gain = 0; } attrs->filter = chan->filter; @@ -522,7 +522,7 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { attrs->unk_6 = chan->unk_20; attrs->unk_4 = chan->unk_0F; - if (chan->seqPlayer->muted && (chan->muteBehavior & 8)) { + if (chan->seqPlayer->muted && (chan->muteFlags & MUTE_FLAGS_3)) { note->noteSubEu.bitField0.finished = true; } @@ -546,10 +546,10 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) { } else { note->playbackState.unk_04 = 1; note->playbackState.adsr.action.s.decay = true; - if (layer->adsr.releaseRate == 0) { - note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->channel->adsr.releaseRate]; + if (layer->adsr.decayIndex == 0) { + note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex]; } else { - note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->adsr.releaseRate]; + note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->adsr.decayIndex]; } note->playbackState.adsr.sustain = ((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f; diff --git a/src/code/audio/audio_seqplayer.c b/src/code/audio/audio_seqplayer.c index e57ad19b5..d504f9f3a 100644 --- a/src/code/audio/audio_seqplayer.c +++ b/src/code/audio/audio_seqplayer.c @@ -1,73 +1,2312 @@ +/** + * @file audio_seqplayer.c + * + * Manages audio sequence players, interprets and executes sequence instructions used to write .seq files + * + * Sequence Instructions: + * - A customized assembly language based on MIDI + * - All sequences are written using these instructions + * - There are 3 different sets of instructions + * 1) Sequence Instructions + * 2) Channel Instructions + * 3) Layer Instruction + * - All three sets share a common pool of control flow instructions (>= 0xF2). + * Otherwise, each set of instructions has its own command interpreter + */ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_801974D0.s") +#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) +#define PORTAMENTO_MODE(x) ((x).mode & ~0x80) -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197538.s") +#define PROCESS_SCRIPT_END -1 -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197714.s") +typedef enum { + /* 0 */ PORTAMENTO_MODE_OFF, + /* 1 */ PORTAMENTO_MODE_1, + /* 2 */ PORTAMENTO_MODE_2, + /* 3 */ PORTAMENTO_MODE_3, + /* 4 */ PORTAMENTO_MODE_4, + /* 5 */ PORTAMENTO_MODE_5 +} PortamentoMode; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197880.s") +u8 AudioSeq_ScriptReadU8(SeqScriptState* state); +s16 AudioSeq_ScriptReadS16(SeqScriptState* state); +u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state); +void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer); +s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound); +s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer); +s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd); +s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd); +u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr); -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_801979D8.s") +/** + * sSeqInstructionArgsTable is a table for each sequence instruction + * that contains both how many arguments an instruction takes, as well + * as the type of each argument + * + * sSeqInstructionArgsTable is bitpacked as follows: + * abcUUUnn + * + * n - number of arguments that the sequence instruction takes + * + * a - bitFlag for the type of arg0 if it exists + * b - bitFlag for the type of arg1 if it exists + * c - bitFlag for the type of arg2 if it exists + * + * bitFlag on - argument is s16 + * bitFlag off - argument is u8 + * + * U - Unused + */ -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197A54.s") +// CMD_ARGS_(NUMBER_OF_ARGS) +#define CMD_ARGS_0() 0 +#define CMD_ARGS_1(arg0Type) (((sizeof(arg0Type) - 1) << 7) | 1) +#define CMD_ARGS_2(arg0Type, arg1Type) (((sizeof(arg0Type) - 1) << 7) | ((sizeof(arg1Type) - 1) << 6) | 2) +#define CMD_ARGS_3(arg0Type, arg1Type, arg2Type) \ + (((sizeof(arg0Type) - 1) << 7) | ((sizeof(arg1Type) - 1) << 6) | ((sizeof(arg2Type) - 1) << 5) | 3) -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelDisable.s") +u8 sSeqInstructionArgsTable[] = { + CMD_ARGS_1(s16), // 0xA0 (channel:) + CMD_ARGS_0(), // 0xA1 (channel:) + CMD_ARGS_1(s16), // 0xA2 (channel:) + CMD_ARGS_0(), // 0xA3 (channel:) + CMD_ARGS_1(u8), // 0xA4 (channel:) + CMD_ARGS_0(), // 0xA5 (channel:) + CMD_ARGS_2(u8, s16), // 0xA6 (channel:) + CMD_ARGS_1(u8), // 0xA7 (channel:) + CMD_ARGS_2(s16, s16), // 0xA8 (channel: random range large) + CMD_ARGS_0(), // 0xA9 () + CMD_ARGS_0(), // 0xAA () + CMD_ARGS_0(), // 0xAB () + CMD_ARGS_0(), // 0xAC () + CMD_ARGS_0(), // 0xAD () + CMD_ARGS_0(), // 0xAE () + CMD_ARGS_0(), // 0xAF () + CMD_ARGS_1(s16), // 0xB0 (channel: set filter) + CMD_ARGS_0(), // 0xB1 (channel: clear filter) + CMD_ARGS_1(s16), // 0xB2 (channel: dynread sequence large) + CMD_ARGS_1(u8), // 0xB3 (channel: load filter) + CMD_ARGS_0(), // 0xB4 (channel: set dyntable large) + CMD_ARGS_0(), // 0xB5 (channel: read dyntable large) + CMD_ARGS_0(), // 0xB6 (channel: read dyntable) + CMD_ARGS_1(s16), // 0xB7 (channel: random large) + CMD_ARGS_1(u8), // 0xB8 (channel: random) + CMD_ARGS_1(u8), // 0xB9 (channel: set velocity random variance) + CMD_ARGS_1(u8), // 0xBA (channel: set gatetime random variance) + CMD_ARGS_2(u8, s16), // 0xBB (channel:) + CMD_ARGS_1(s16), // 0xBC (channel: add large) + CMD_ARGS_1(s16), // 0xBD (channel:) + CMD_ARGS_1(u8), // 0xBE (channel:) + CMD_ARGS_0(), // 0xBF () + CMD_ARGS_0(), // 0xC0 () + CMD_ARGS_1(u8), // 0xC1 (channel: set instrument) + CMD_ARGS_1(s16), // 0xC2 (channel: set dyntable) + CMD_ARGS_0(), // 0xC3 (channel: large notes off) + CMD_ARGS_0(), // 0xC4 (channel: large notes on) + CMD_ARGS_0(), // 0xC5 (channel: dyn set dyntable) + CMD_ARGS_1(u8), // 0xC6 (channel: set soundFont) + CMD_ARGS_2(u8, s16), // 0xC7 (channel: write into sequence script) + CMD_ARGS_1(u8), // 0xC8 (channel: subtract -> set value) + CMD_ARGS_1(u8), // 0xC9 (channel: `bit and` -> set value) + CMD_ARGS_1(u8), // 0xCA (channel: set mute behavior) + CMD_ARGS_1(s16), // 0xCB (channel: read sequence -> set value) + CMD_ARGS_1(u8), // 0xCC (channel: set value) + CMD_ARGS_1(u8), // 0xCD (channel: disable channel) + CMD_ARGS_1(s16), // 0xCE (channel:) + CMD_ARGS_1(s16), // 0xCF (channel: write large into sequence script) + CMD_ARGS_1(u8), // 0xD0 (channel: stereo headset effects) + CMD_ARGS_1(u8), // 0xD1 (channel: set note allocation policy) + CMD_ARGS_1(u8), // 0xD2 (channel: set sustain) + CMD_ARGS_1(u8), // 0xD3 (channel: large bend pitch) + CMD_ARGS_1(u8), // 0xD4 (channel: set reverb) + CMD_ARGS_1(u8), // 0xD5 () + CMD_ARGS_1(u8), // 0xD6 () + CMD_ARGS_1(u8), // 0xD7 (channel: set vibrato rate) + CMD_ARGS_1(u8), // 0xD8 (channel: set vibrato extent) + CMD_ARGS_1(u8), // 0xD9 (channel: set decay index) + CMD_ARGS_1(s16), // 0xDA (channel: set envelope) + CMD_ARGS_1(u8), // 0xDB (channel: transpose) + CMD_ARGS_1(u8), // 0xDC (channel: set pan mix) + CMD_ARGS_1(u8), // 0xDD (channel: set pan) + CMD_ARGS_1(s16), // 0xDE (channel: set freqscale) + CMD_ARGS_1(u8), // 0xDF (channel: set volume) + CMD_ARGS_1(u8), // 0xE0 (channel: set volume scale) + CMD_ARGS_3(u8, u8, u8), // 0xE1 (channel: set vibratorate linear) + CMD_ARGS_3(u8, u8, u8), // 0xE2 (channel: set vibrato extent linear) + CMD_ARGS_1(u8), // 0xE3 (channel: set vibrato delay) + CMD_ARGS_0(), // 0xE4 (channel: dyncall) + CMD_ARGS_1(u8), // 0xE5 (channel: set reverb index) + CMD_ARGS_1(u8), // 0xE6 (channel: set book offset) + CMD_ARGS_1(s16), // 0xE7 (channel:) + CMD_ARGS_3(u8, u8, u8), // 0xE8 (channel:) + CMD_ARGS_1(u8), // 0xE9 (channel: set note priority) + CMD_ARGS_0(), // 0xEA (channel: stop script) + CMD_ARGS_2(u8, u8), // 0xEB (channel: set soundFont and instrument) + CMD_ARGS_0(), // 0xEC (channel: reset vibrato) + CMD_ARGS_1(u8), // 0xED (channel: set hilo gain) + CMD_ARGS_1(u8), // 0xEE (channel: small bend pitch) + CMD_ARGS_2(s16, u8), // 0xEF () + CMD_ARGS_0(), // 0xF0 (channel: unreserve notes) + CMD_ARGS_1(u8), // 0xF1 (channel: reserve notes) + // Control flow instructions (>= 0xF2) can only have 0 or 1 args + CMD_ARGS_1(u8), // 0xF2 (branch relative if less than zero) + CMD_ARGS_1(u8), // 0xF3 (branch relative if equal to zero) + CMD_ARGS_1(u8), // 0xF4 (jump relative) + CMD_ARGS_1(s16), // 0xF5 (branch if greater than or equal to zero) + CMD_ARGS_0(), // 0xF6 (break) + CMD_ARGS_0(), // 0xF7 (loop end) + CMD_ARGS_1(u8), // 0xF8 (loop) + CMD_ARGS_1(s16), // 0xF9 (branch if less than zero) + CMD_ARGS_1(s16), // 0xFA (branch if equal to zero) + CMD_ARGS_1(s16), // 0xFB (jump) + CMD_ARGS_1(s16), // 0xFC (call and jump to a function) + CMD_ARGS_0(), // 0xFD (delay n frames) + CMD_ARGS_0(), // 0xFE (delay 1 frame) + CMD_ARGS_0(), // 0xFF (end script) +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197B14.s") +/** + * Read and return the argument from the sequence script for a control flow instruction. + * Control flow instructions (>= 0xF2) can only have 0 or 1 args. + * + * @return the argument value for a control flow instruction, or 0 if there is no argument + */ +u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { + u8 highBits = sSeqInstructionArgsTable[cmd - 0xA0]; + u8 lowBits = highBits & 3; + u16 cmdArg = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197C0C.s") + // only 1 argument + if (lowBits == 1) { + if (!(highBits & 0x80)) { + cmdArg = AudioSeq_ScriptReadU8(state); + } else { + cmdArg = AudioSeq_ScriptReadS16(state); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197C8C.s") + return cmdArg; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisableAsFinished.s") +/** + * Read and execute the control flow sequence instructions + * + * @return number of frames until next instruction. -1 signals termination + */ +s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* state, s32 cmd, s32 cmdArg) { + u32 depth; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisable.s") + switch (cmd) { + case 0xFF: // end script + if (state->depth == 0) { + return PROCESS_SCRIPT_END; + } + state->pc = state->stack[--state->depth]; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPushBack.s") + case 0xFD: // delay n frames + return AudioSeq_ScriptReadCompressedU16(state); -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPopBack.s") + case 0xFE: // delay 1 frame + return 1; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197E88.s") + case 0xFC: // call and jump to a function + state->stack[depth = state->depth++] = state->pc; + state->pc = seqPlayer->seqData + (u16)cmdArg; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197F28.s") + case 0xF8: // loop + state->remLoopIters[depth = state->depth] = cmdArg; + state->stack[state->depth++] = state->pc; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197F3C.s") + case 0xF7: // loop end + state->remLoopIters[state->depth - 1]--; + if (state->remLoopIters[state->depth - 1] != 0) { + state->pc = state->stack[state->depth - 1]; + } else { + state->depth--; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197F74.s") + case 0xF6: // break + state->depth--; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80197FB4.s") + case 0xF5: // branch if greater than or equal to zero + case 0xF9: // branch if less than zero + case 0xFA: // branch if equal to zero + case 0xFB: // jump + if ((cmd == 0xFA) && (state->value != 0)) { + break; + } + if ((cmd == 0xF9) && (state->value >= 0)) { + break; + } + if ((cmd == 0xF5) && (state->value < 0)) { + break; + } + state->pc = seqPlayer->seqData + (u16)cmdArg; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_801980D0.s") + case 0xF2: // branch relative if less than zero + case 0xF3: // branch relative if equal to zero + case 0xF4: // jump relative + if ((cmd == 0xF3) && (state->value != 0)) { + break; + } + if ((cmd == 0xF2) && (state->value >= 0)) { + break; + } + state->pc += (s8)(cmdArg & 0xFF); + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019815C.s") + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019825C.s") +void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80198640.s") + if (channel == &gAudioContext.sequenceChannelNone) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80198CE0.s") + channel->enabled = false; + channel->finished = false; + channel->stopScript = false; + channel->stopSomething2 = false; + channel->hasInstrument = false; + channel->stereoHeadsetEffects = false; + channel->transposition = 0; + channel->largeNotes = false; + channel->bookOffset = 0; + channel->stereo.asByte = 0; + channel->changes.asByte = 0xFF; + channel->scriptState.depth = 0; + channel->newPan = 0x40; + channel->panChannelWeight = 0x80; + channel->unk_10 = 0xFF; + channel->velocityRandomVariance = 0; + channel->gateTimeRandomVariance = 0; + channel->noteUnused = NULL; + channel->reverbIndex = 0; + channel->reverb = 0; + channel->gain = 0; + channel->notePriority = 3; + channel->someOtherPriority = 1; + channel->delay = 0; + channel->adsr.envelope = gDefaultEnvelope; + channel->adsr.decayIndex = 0xF0; + channel->adsr.sustain = 0; + channel->vibrato.vibratoRateTarget = 0x800; + channel->vibrato.vibratoRateStart = 0x800; + channel->vibrato.vibratoExtentTarget = 0; + channel->vibrato.vibratoExtentStart = 0; + channel->vibrato.vibratoRateChangeDelay = 0; + channel->vibrato.vibratoExtentChangeDelay = 0; + channel->vibrato.vibratoDelay = 0; + channel->filter = NULL; + channel->unk_20 = 0; + channel->unk_0F = 0; + channel->volume = 1.0f; + channel->volumeScale = 1.0f; + channel->freqScale = 1.0f; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_801990F4.s") + for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) { + channel->soundScriptIO[i] = -1; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80199124.s") + channel->unused = false; + AudioPlayback_InitNoteLists(&channel->notePool); + channel->unk_DC = 0; + channel->unk_E0 = 0; + channel->sfxState = NULL; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80199198.s") +s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { + SequenceLayer* layer; + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80199244.s") + if (channel->layers[layerIndex] == NULL) { + layer = AudioSeq_AudioListPopBack(&gAudioContext.layerFreeList); + channel->layers[layerIndex] = layer; + if (layer == NULL) { + channel->layers[layerIndex] = NULL; + return -1; + } + } else { + AudioPlayback_SeqLayerNoteDecay(channel->layers[layerIndex]); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_80199268.s") + layer = channel->layers[layerIndex]; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019A0BC.s") + layer->channel = channel; + layer->adsr = channel->adsr; + layer->adsr.decayIndex = 0; + layer->unk_09 = channel->reverb; + layer->enabled = true; + layer->finished = false; + layer->stopSomething = false; + layer->continuousNotes = false; + layer->bit3 = false; + layer->ignoreDrumPan = false; + layer->bit1 = false; + layer->notePropertiesNeedInit = false; + layer->gateTime = 0x80; + layer->unk_08 = 0x80; + layer->stereo.asByte = 0; + layer->portamento.mode = PORTAMENTO_MODE_OFF; + layer->scriptState.depth = 0; + layer->pan = 0x40; + layer->transposition = 0; + layer->delay = 0; + layer->gateDelay = 0; + layer->delay2 = 0; + layer->note = NULL; + layer->instrument = NULL; + layer->instOrWave = 0xFF; + layer->unk_0A.asByte = 0xFFFF; + layer->vibrato.vibratoRateTarget = 0x800; + layer->vibrato.vibratoRateStart = 0x800; + layer->vibrato.vibratoExtentTarget = 0; + layer->vibrato.vibratoExtentStart = 0; + layer->vibrato.vibratoRateChangeDelay = 0; + layer->vibrato.vibratoExtentChangeDelay = 0; + layer->vibrato.vibratoDelay = 0; + layer->freqScale = 1.0f; + layer->bend = 1.0f; + layer->velocitySquare2 = 0.0f; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019AA3C.s") + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019AAF0.s") +void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { + if (layer != NULL) { + if ((layer->channel != &gAudioContext.sequenceChannelNone) && (layer->channel->seqPlayer->finished == true)) { + AudioPlayback_SeqLayerNoteRelease(layer); + } else { + AudioPlayback_SeqLayerNoteDecay(layer); + } + layer->enabled = false; + layer->finished = true; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_ResetSequencePlayer.s") +void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { + SequenceLayer* layer = channel->layers[layerIndex]; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayerChannels.s") + if (layer != NULL) { + AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &layer->listItem); + AudioSeq_SeqLayerDisable(layer); + channel->layers[layerIndex] = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/func_8019ACEC.s") +void AudioSeq_SequenceChannelDisable(SequenceChannel* channel) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayers.s") + channel->finished = true; + + for (i = 0; i < 4; i++) { + AudioSeq_SeqLayerFree(channel, i); + } + + AudioPlayback_NotePoolClear(&channel->notePool); + channel->enabled = false; +} + +void AudioSeq_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channelBits) { + SequenceChannel* channel; + s32 i; + + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + if (channelBits & 1) { + channel = seqPlayer->channels[i]; + channel->fontId = seqPlayer->defaultFont; + channel->muteFlags = seqPlayer->muteFlags; + channel->noteAllocPolicy = seqPlayer->noteAllocPolicy; + } + channelBits = channelBits >> 1; + } +} + +void AudioSeq_SequencePlayerDisableChannels(SequencePlayer* seqPlayer, u16 channelBitsUnused) { + SequenceChannel* channel; + s32 i; + + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + channel = seqPlayer->channels[i]; + if (IS_SEQUENCE_CHANNEL_VALID(channel) == 1) { + AudioSeq_SequenceChannelDisable(channel); + } + } +} + +void AudioSeq_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, void* script) { + SequenceChannel* channel = seqPlayer->channels[channelIndex]; + s32 i; + + channel->enabled = true; + channel->finished = false; + channel->scriptState.depth = 0; + channel->scriptState.pc = script; + channel->delay = 0; + + for (i = 0; i < ARRAY_COUNT(channel->layers); i++) { + if (channel->layers[i] != NULL) { + AudioSeq_SeqLayerFree(channel, i); + } + } +} + +void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) { + seqPlayer->finished = true; + AudioSeq_SequencePlayerDisable(seqPlayer); +} + +void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { + AudioSeq_SequencePlayerDisableChannels(seqPlayer, 0xFFFF); + AudioPlayback_NotePoolClear(&seqPlayer->notePool); + if (!seqPlayer->enabled) { + return; + } + + seqPlayer->enabled = false; + seqPlayer->finished = true; + + if (AudioLoad_IsSeqLoadComplete(seqPlayer->seqId)) { + AudioLoad_SetSeqLoadStatus(seqPlayer->seqId, LOAD_STATUS_DISCARDABLE); + } + + if (AudioLoad_IsFontLoadComplete(seqPlayer->defaultFont)) { + AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE); + } + + if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[0].id) { + gAudioContext.fontCache.temporary.nextSide = 1; + } else if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[1].id) { + gAudioContext.fontCache.temporary.nextSide = 0; + } +} + +void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { + if (item->prev == NULL) { + list->prev->next = item; + item->prev = list->prev; + item->next = list; + list->prev = item; + list->u.count++; + item->pool = list->pool; + } +} + +void* AudioSeq_AudioListPopBack(AudioListItem* list) { + AudioListItem* item = list->prev; + + if (item == list) { + return NULL; + } + + item->prev->next = list; + list->prev = item->prev; + item->prev = NULL; + list->u.count--; + + return item->u.value; +} + +void AudioSeq_InitLayerFreelist(void) { + s32 i; + + gAudioContext.layerFreeList.prev = &gAudioContext.layerFreeList; + gAudioContext.layerFreeList.next = &gAudioContext.layerFreeList; + gAudioContext.layerFreeList.u.count = 0; + gAudioContext.layerFreeList.pool = NULL; + + for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) { + gAudioContext.sequenceLayers[i].listItem.u.value = &gAudioContext.sequenceLayers[i]; + gAudioContext.sequenceLayers[i].listItem.prev = NULL; + AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &gAudioContext.sequenceLayers[i].listItem); + } +} + +u8 AudioSeq_ScriptReadU8(SeqScriptState* state) { + return *(state->pc++); +} + +s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { + s16 ret = *(state->pc++) << 8; + + ret = *(state->pc++) | ret; + return ret; +} + +u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { + u16 ret = *(state->pc++); + + if (ret & 0x80) { + ret = (ret << 8) & 0x7F00; + ret = *(state->pc++) | ret; + } + return ret; +} + +void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { + s32 cmd; + + if (!layer->enabled) { + return; + } + + if (layer->delay > 1) { + layer->delay--; + if (!layer->stopSomething && (layer->delay <= layer->gateDelay)) { + AudioPlayback_SeqLayerNoteDecay(layer); + layer->stopSomething = true; + } + return; + } + + AudioSeq_SeqLayerProcessScriptStep1(layer); + + do { + cmd = AudioSeq_SeqLayerProcessScriptStep2(layer); + if (cmd == PROCESS_SCRIPT_END) { + return; + } + + cmd = AudioSeq_SeqLayerProcessScriptStep3(layer, cmd); + + } while ((cmd == -1) && (layer->delay == 0)); + + if (cmd != PROCESS_SCRIPT_END) { + // returns `sameSound` instead of a command + cmd = AudioSeq_SeqLayerProcessScriptStep4(layer, cmd); + } + + if (cmd != PROCESS_SCRIPT_END) { + AudioSeq_SeqLayerProcessScriptStep5(layer, cmd); + } + + if (layer->stopSomething == true) { + if ((layer->note != NULL) || layer->continuousNotes) { + AudioPlayback_SeqLayerNoteDecay(layer); + } + } +} + +void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { + if (!layer->continuousNotes) { + AudioPlayback_SeqLayerNoteDecay(layer); + } else if ((layer->note != NULL) && (layer->note->playbackState.wantedParentLayer == layer)) { + AudioPlayback_SeqLayerNoteDecay(layer); + } + + if ((PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_1) || + (PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2)) { + layer->portamento.mode = PORTAMENTO_MODE_OFF; + } + layer->notePropertiesNeedInit = true; +} + +s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound) { + Note* note; + + if ((layer->continuousNotes == true) && (layer->bit1 == true)) { + return 0; + } + + if ((layer->continuousNotes == true) && (layer->note != NULL) && layer->bit3 && (sameSound == true) && + (layer->note->playbackState.parentLayer == layer)) { + if (layer->sound == NULL) { + AudioPlayback_InitSyntheticWave(layer->note, layer); + } + } else { + if (!sameSound) { + AudioPlayback_SeqLayerNoteDecay(layer); + } + + layer->note = AudioPlayback_AllocNote(layer); + + if (layer->note != NULL) { + note = layer->note; + + if (note->playbackState.parentLayer == layer) { + AudioEffects_NoteVibratoInit(note); + } + } + } + + if ((layer->note != NULL) && (layer->note->playbackState.parentLayer == layer)) { + note = layer->note; + + AudioEffects_NotePortamentoInit(note); + } + + return 0; +} + +s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { + SequenceChannel* channel = layer->channel; + SeqScriptState* state = &layer->scriptState; + SequencePlayer* seqPlayer = channel->seqPlayer; + u8 cmd; + u8 cmdArg8; + u16 cmdArg16; + u16 velocity; + + while (true) { + cmd = AudioSeq_ScriptReadU8(state); + + // Note Commands + // To be processed in AudioSeq_SeqLayerProcessScriptStep3 + if (cmd <= 0xC0) { + return cmd; + } + + // Control Flow Commands + if (cmd >= 0xF2) { + cmdArg16 = AudioSeq_GetScriptControlFlowArgument(state, cmd); + + if (AudioSeq_HandleScriptFlowControl(seqPlayer, state, cmd, cmdArg16) == 0) { + continue; + } + AudioSeq_SeqLayerDisable(layer); + return PROCESS_SCRIPT_END; + } + + switch (cmd) { + case 0xC1: // layer: set short note velocity + case 0xCA: // layer: set pan + cmdArg8 = *(state->pc++); + if (cmd == 0xC1) { + layer->velocitySquare = SQ(cmdArg8) / SQ(127.0f); + } else { + layer->pan = cmdArg8; + } + break; + + case 0xC9: // layer: set short note gatetime + case 0xC2: // layer: set transposition in semitones + cmdArg8 = *(state->pc++); + if (cmd == 0xC9) { + layer->gateTime = cmdArg8; + } else { + layer->transposition = cmdArg8; + } + break; + + case 0xC4: // layer: continuous notes on + case 0xC5: // layer: continuous notes off + if (cmd == 0xC4) { + layer->continuousNotes = true; + } else { + layer->continuousNotes = false; + } + layer->bit1 = false; + AudioPlayback_SeqLayerNoteDecay(layer); + break; + + case 0xC3: // layer: set short note default delay + cmdArg16 = AudioSeq_ScriptReadCompressedU16(state); + layer->shortNoteDefaultDelay = cmdArg16; + break; + + case 0xC6: // layer: set instrument + cmd = AudioSeq_ScriptReadU8(state); + if (cmd >= 0x7E) { + if (cmd == 0x7E) { + // Sfxs + layer->instOrWave = 1; + } else if (cmd == 0x7F) { + // Drums + layer->instOrWave = 0; + } else { + // Synthetic Wave + layer->instOrWave = cmd; + layer->instrument = NULL; + } + + if (cmd == 0xFF) { + layer->adsr.decayIndex = 0; + } + } else { + // Instrument + if ((layer->instOrWave = AudioSeq_GetInstrument(channel, cmd, &layer->instrument, &layer->adsr)) == + 0) { + layer->instOrWave = 0xFF; + } + } + break; + + case 0xC7: // layer: enable portamento + layer->portamento.mode = AudioSeq_ScriptReadU8(state); + + cmd = AudioSeq_ScriptReadU8(state); + cmd += channel->transposition; + cmd += layer->transposition; + cmd += seqPlayer->transposition; + + if (cmd >= 0x80) { + cmd = 0; + } + + layer->portamentoTargetNote = cmd; + + // If special, the next param is u8 instead of var + if (PORTAMENTO_IS_SPECIAL(layer->portamento)) { + layer->portamentoTime = *(state->pc++); + break; + } + + cmdArg16 = AudioSeq_ScriptReadCompressedU16(state); + layer->portamentoTime = cmdArg16; + break; + + case 0xC8: // layer: disable portamento + layer->portamento.mode = PORTAMENTO_MODE_OFF; + break; + + case 0xCB: // layer: set envelope and decay index + cmdArg16 = AudioSeq_ScriptReadS16(state); + layer->adsr.envelope = (EnvelopePoint*)(seqPlayer->seqData + cmdArg16); + // fallthrough + case 0xCF: // layer: set decay index + layer->adsr.decayIndex = AudioSeq_ScriptReadU8(state); + break; + + case 0xCC: // layer: ignore drum pan + layer->ignoreDrumPan = true; + break; + + case 0xCD: // layer: stereo effects + layer->stereo.asByte = AudioSeq_ScriptReadU8(state); + break; + + case 0xCE: // layer: bend pitch + cmdArg8 = AudioSeq_ScriptReadU8(state); + layer->bend = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)]; + break; + + case 0xF0: // layer: + cmdArg16 = AudioSeq_ScriptReadS16(state); + layer->unk_0A.asByte &= (cmdArg16 ^ 0xFFFF); + break; + + case 0xF1: // layer: + layer->unk_08 = AudioSeq_ScriptReadU8(state); + break; + + default: + switch (cmd & 0xF0) { + case 0xD0: // layer: set short note velocity from table + velocity = seqPlayer->shortNoteVelocityTable[cmd & 0xF]; + layer->velocitySquare = SQ(velocity) / SQ(127.0f); + break; + + case 0xE0: // layer: set short note gatetime from table + layer->gateTime = seqPlayer->shortNoteGateTimeTable[cmd & 0xF]; + break; + } + } + } +} + +s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { + s32 sameSound = true; + s32 instOrWave; + s32 speed; + f32 temp_f14; + f32 temp_f2; + Portamento* portamento; + f32 freqScale; + f32 freqScale2; + SoundFontSound* sound; + Instrument* instrument; + Drum* drum; + s32 pad; + SequenceChannel* channel; + SequencePlayer* seqPlayer; + u8 semitone = cmd; + u16 sfxId; + s32 semitone2; + s32 vel; + f32 time; + f32 tuning; + s32 speed2; + + instOrWave = layer->instOrWave; + channel = layer->channel; + seqPlayer = channel->seqPlayer; + + if (instOrWave == 0xFF) { + if (!channel->hasInstrument) { + return PROCESS_SCRIPT_END; + } + instOrWave = channel->instOrWave; + } + + switch (instOrWave) { + case 0: + // Drums + semitone += channel->transposition + layer->transposition; + layer->semitone = semitone; + + drum = AudioPlayback_GetDrum(channel->fontId, semitone); + if (drum == NULL) { + layer->stopSomething = true; + layer->delay2 = layer->delay; + return PROCESS_SCRIPT_END; + } + + sound = &drum->sound; + layer->adsr.envelope = drum->envelope; + layer->adsr.decayIndex = drum->adsrDecayIndex; + if (!layer->ignoreDrumPan) { + layer->pan = drum->pan; + } + + layer->sound = sound; + layer->freqScale = sound->tuning; + break; + + case 1: + // Sfxs + layer->semitone = semitone; + sfxId = (layer->transposition << 6) + semitone; + + sound = AudioPlayback_GetSfx(channel->fontId, sfxId); + if (sound == NULL) { + layer->stopSomething = true; + layer->delay2 = layer->delay + 1; + return PROCESS_SCRIPT_END; + } + + layer->sound = sound; + layer->freqScale = sound->tuning; + break; + + default: + semitone += seqPlayer->transposition + channel->transposition + layer->transposition; + semitone2 = semitone; + + layer->semitone = semitone; + if (semitone >= 0x80) { + layer->stopSomething = true; + return PROCESS_SCRIPT_END; + } + + if (layer->instOrWave == 0xFF) { + instrument = channel->instrument; + } else { + instrument = layer->instrument; + } + + if (layer->portamento.mode != PORTAMENTO_MODE_OFF) { + portamento = &layer->portamento; + vel = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote; + + if (instrument != NULL) { + sound = AudioPlayback_InstrumentGetSound(instrument, vel); + sameSound = (layer->sound == sound); + layer->sound = sound; + tuning = sound->tuning; + } else { + layer->sound = NULL; + tuning = 1.0f; + if (instOrWave >= 0xC0) { + layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound; + } + } + + temp_f2 = gPitchFrequencies[semitone2] * tuning; + temp_f14 = gPitchFrequencies[layer->portamentoTargetNote] * tuning; + + switch (PORTAMENTO_MODE(*portamento)) { + case PORTAMENTO_MODE_1: + case PORTAMENTO_MODE_3: + case PORTAMENTO_MODE_5: + freqScale2 = temp_f2; + freqScale = temp_f14; + break; + + case PORTAMENTO_MODE_2: + case PORTAMENTO_MODE_4: + freqScale = temp_f2; + freqScale2 = temp_f14; + break; + + default: + freqScale = temp_f2; + freqScale2 = temp_f2; + break; + } + + portamento->extent = (freqScale2 / freqScale) - 1.0f; + + if (PORTAMENTO_IS_SPECIAL(*portamento)) { + speed = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal; + if (layer->delay != 0) { + speed = speed * 0x100 / (layer->delay * layer->portamentoTime); + } + } else { + speed = 0x20000 / (layer->portamentoTime * gAudioContext.audioBufferParameters.updatesPerFrame); + } + + if (speed >= 0x7FFF) { + speed = 0x7FFF; + } else if (speed < 1) { + speed = 1; + } + + portamento->speed = speed; + portamento->cur = 0; + layer->freqScale = freqScale; + if (PORTAMENTO_MODE(*portamento) == PORTAMENTO_MODE_5) { + layer->portamentoTargetNote = semitone; + } + break; + } + + if (instrument != NULL) { + sound = AudioPlayback_InstrumentGetSound(instrument, semitone); + sameSound = (sound == layer->sound); + layer->sound = sound; + layer->freqScale = gPitchFrequencies[semitone2] * sound->tuning; + } else { + layer->sound = NULL; + layer->freqScale = gPitchFrequencies[semitone2]; + if (instOrWave >= 0xC0) { + layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound; + } + } + break; + } + + layer->delay2 = layer->delay; + layer->freqScale *= layer->bend; + + if (layer->delay == 0) { + if (layer->sound != NULL) { + time = layer->sound->sample->loop->end; + } else { + time = 0.0f; + } + time *= seqPlayer->tempo; + time *= gAudioContext.unk_2870; + time /= layer->freqScale; + if (1) {} + if (time > 0x7FFE) { + time = 0x7FFE; + } + + layer->gateDelay = 0; + layer->delay = (u16)(s32)time + 1; + + if (layer->portamento.mode != PORTAMENTO_MODE_OFF) { + // (It's a bit unclear if 'portamento' has actually always been + // set when this is reached...) + if (PORTAMENTO_IS_SPECIAL(*portamento)) { + speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal; + speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime); + if (speed2 >= 0x7FFF) { + speed2 = 0x7FFF; + } else if (speed2 < 1) { + speed2 = 1; + } + portamento->speed = speed2; + } + } + } + return sameSound; +} + +s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { + SeqScriptState* state = &layer->scriptState; + u16 delay; + s32 velocity; + SequenceChannel* channel = layer->channel; + SequencePlayer* seqPlayer = channel->seqPlayer; + s32 intDelta; + f32 floatDelta; + + if (cmd == 0xC0) { // layer: delay + layer->delay = AudioSeq_ScriptReadCompressedU16(state); + layer->stopSomething = true; + layer->bit1 = false; + return PROCESS_SCRIPT_END; + } + + layer->stopSomething = false; + + if (channel->largeNotes == true) { + switch (cmd & 0xC0) { + case 0x00: // layer: large note 0 + delay = AudioSeq_ScriptReadCompressedU16(state); + velocity = *(state->pc++); + layer->gateTime = *(state->pc++); + layer->lastDelay = delay; + break; + + case 0x40: // layer: large note 1 + delay = AudioSeq_ScriptReadCompressedU16(state); + velocity = *(state->pc++); + layer->gateTime = 0; + layer->lastDelay = delay; + break; + + case 0x80: // layer: large note 2 + delay = layer->lastDelay; + velocity = *(state->pc++); + layer->gateTime = *(state->pc++); + break; + } + + if ((velocity > 0x7F) || (velocity < 0)) { + velocity = 0x7F; + } + layer->velocitySquare = SQ((f32)velocity) / SQ(127.0f); + cmd -= (cmd & 0xC0); + } else { + switch (cmd & 0xC0) { + case 0x00: // layer: small note 0 + delay = AudioSeq_ScriptReadCompressedU16(state); + layer->lastDelay = delay; + break; + + case 0x40: // layer: small note 1 + delay = layer->shortNoteDefaultDelay; + break; + + case 0x80: // layer: small note 2 + delay = layer->lastDelay; + break; + } + cmd -= (cmd & 0xC0); + } + + if (channel->velocityRandomVariance != 0) { + floatDelta = layer->velocitySquare * (gAudioContext.audioRandom % channel->velocityRandomVariance) / 100.0f; + if ((gAudioContext.audioRandom & 0x8000) != 0) { + floatDelta = -floatDelta; + } + + layer->velocitySquare2 = layer->velocitySquare + floatDelta; + + if (layer->velocitySquare2 < 0.0f) { + layer->velocitySquare2 = 0.0f; + } else if (layer->velocitySquare2 > 1.0f) { + layer->velocitySquare2 = 1.0f; + } + } else { + layer->velocitySquare2 = layer->velocitySquare; + } + + layer->delay = delay; + layer->gateDelay = (layer->gateTime * delay) >> 8; + + if (channel->gateTimeRandomVariance != 0) { + //! @bug should probably be gateTimeRandomVariance + intDelta = (layer->gateDelay * (gAudioContext.audioRandom % channel->velocityRandomVariance)) / 100; + if ((gAudioContext.audioRandom & 0x4000) != 0) { + intDelta = -intDelta; + } + + layer->gateDelay += intDelta; + if (layer->gateDelay < 0) { + layer->gateDelay = 0; + } else if (layer->gateDelay > layer->delay) { + layer->gateDelay = layer->delay; + } + } + + if ((seqPlayer->muted && (channel->muteFlags & (MUTE_FLAGS_STOP_NOTES | MUTE_FLAGS_4))) || + channel->stopSomething2) { + layer->stopSomething = true; + return PROCESS_SCRIPT_END; + } + + if (seqPlayer->skipTicks != 0) { + layer->stopSomething = true; + return PROCESS_SCRIPT_END; + } + + return cmd; +} + +void AudioSeq_SetChannelPriorities(SequenceChannel* channel, u8 priority) { + if ((priority & 0xF) != 0) { + channel->notePriority = priority & 0xF; + } + + priority = priority >> 4; + if (priority != 0) { + channel->someOtherPriority = priority; + } +} + +u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr) { + Instrument* inst = AudioPlayback_GetInstrumentInner(channel->fontId, instId); + + if (inst == NULL) { + *instOut = NULL; + return 0; + } + + adsr->envelope = inst->envelope; + adsr->decayIndex = inst->adsrDecayIndex; + + *instOut = inst; + + // temporarily offset instrument id by 2 so that instId 0, 1 + // can be reserved by drums and sfxs respectively. + instId += 2; + + return instId; +} + +void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { + if (instId >= 0x80) { + // Synthetic Waves + channel->instOrWave = instId; + channel->instrument = NULL; + } else if (instId == 0x7F) { + // Drums + channel->instOrWave = 0; + channel->instrument = (Instrument*)1; // invalid pointer, never dereferenced + } else if (instId == 0x7E) { + // Sfxs + channel->instOrWave = 1; + channel->instrument = (Instrument*)2; // invalid pointer, never dereferenced + } else { + // Instruments + if ((channel->instOrWave = AudioSeq_GetInstrument(channel, instId, &channel->instrument, &channel->adsr)) == + 0) { + channel->hasInstrument = false; + return; + } + } + + channel->hasInstrument = true; +} + +void AudioSeq_SequenceChannelSetVolume(SequenceChannel* channel, u8 volume) { + channel->volume = (s32)volume / 127.0f; +} + +void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { + s32 i; + u8* data; + u32 rand; + SequencePlayer* seqPlayer; + + if (channel->stopScript) { + goto exit_loop; + } + + seqPlayer = channel->seqPlayer; + if (seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_STOP_SCRIPT)) { + return; + } + + if (channel->delay >= 2) { + channel->delay--; + goto exit_loop; + } + + while (true) { + SeqScriptState* scriptState = &channel->scriptState; + s32 param; + s16 temp1; + u16 cmdArgU16; + u32 cmdArgs[3]; + s8 cmdArgS8; + u8 cmd = AudioSeq_ScriptReadU8(scriptState); + u8 lowBits; + u8 highBits; + s32 delay; + s32 temp2; + u8 phi_v0_3; + u8 new_var; + u8 depth; + u8* seqData = seqPlayer->seqData; + u32 new_var2; + + // Commands 0xA0 - 0xFF + if (cmd >= 0xA0) { + highBits = sSeqInstructionArgsTable[cmd - 0xA0]; + lowBits = highBits & 3; + + // read in arguments for the instruction + for (i = 0; i < lowBits; i++, highBits <<= 1) { + if (!(highBits & 0x80)) { + cmdArgs[i] = AudioSeq_ScriptReadU8(scriptState); + } else { + cmdArgs[i] = AudioSeq_ScriptReadS16(scriptState); + } + } + + // Control Flow Commands + if (cmd >= 0xF2) { + delay = AudioSeq_HandleScriptFlowControl(seqPlayer, scriptState, cmd, cmdArgs[0]); + + if (delay != 0) { + if (delay == PROCESS_SCRIPT_END) { + AudioSeq_SequenceChannelDisable(channel); + } else { + channel->delay = delay; + } + break; + } + continue; + } + + switch (cmd) { + case 0xEA: // channel: stop script + channel->stopScript = true; + goto exit_loop; + + case 0xF1: // channel: reserve notes + AudioPlayback_NotePoolClear(&channel->notePool); + cmd = (u8)cmdArgs[0]; + AudioPlayback_NotePoolFill(&channel->notePool, cmd); + break; + + case 0xF0: // channel: unreserve notes + AudioPlayback_NotePoolClear(&channel->notePool); + break; + + case 0xC2: // channel: set dyntable + cmdArgU16 = (u16)cmdArgs[0]; + channel->dynTable = (void*)&seqPlayer->seqData[cmdArgU16]; + break; + + case 0xC5: // channel: dyn set dyntable + if (scriptState->value != -1) { + data = (*channel->dynTable)[scriptState->value]; + cmdArgU16 = (u16)((data[0] << 8) + data[1]); + scriptState->pc = (void*)&seqPlayer->seqData[cmdArgU16]; + } + break; + + case 0xEB: // channel: set soundFont and instrument + cmd = (u8)cmdArgs[0]; + + if (seqPlayer->defaultFont != 0xFF) { + cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId]; + lowBits = gAudioContext.sequenceFontTable[cmdArgU16]; + cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd]; + } + + if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) { + channel->fontId = cmd; + } + + cmdArgs[0] = cmdArgs[1]; + // fallthrough + case 0xC1: // channel: set instrument + cmd = (u8)cmdArgs[0]; + AudioSeq_SetInstrument(channel, cmd); + break; + + case 0xC3: // channel: large notes off + channel->largeNotes = false; + break; + + case 0xC4: // channel: large notes on + channel->largeNotes = true; + break; + + case 0xDF: // channel: set volume + cmd = (u8)cmdArgs[0]; + AudioSeq_SequenceChannelSetVolume(channel, cmd); + channel->changes.s.volume = true; + break; + + case 0xE0: // channel: set volume scale + cmd = (u8)cmdArgs[0]; + channel->volumeScale = (f32)(s32)cmd / 128.0f; + channel->changes.s.volume = true; + break; + + case 0xDE: // channel: set freqscale + cmdArgU16 = (u16)cmdArgs[0]; + channel->freqScale = (f32)(s32)cmdArgU16 / 0x8000; + channel->changes.s.freqScale = true; + break; + + case 0xD3: // channel: large bend pitch + cmd = (u8)cmdArgs[0]; + cmd += 0x80; + channel->freqScale = gBendPitchOneOctaveFrequencies[cmd]; + channel->changes.s.freqScale = true; + break; + + case 0xEE: // channel: small bend pitch + cmd = (u8)cmdArgs[0]; + cmd += 0x80; + channel->freqScale = gBendPitchTwoSemitonesFrequencies[cmd]; + channel->changes.s.freqScale = true; + break; + + case 0xDD: // channel: set pan + cmd = (u8)cmdArgs[0]; + channel->newPan = cmd; + channel->changes.s.pan = true; + break; + + case 0xDC: // channel: set pan mix + cmd = (u8)cmdArgs[0]; + channel->panChannelWeight = cmd; + channel->changes.s.pan = true; + break; + + case 0xDB: // channel: transpose + cmdArgS8 = (s8)cmdArgs[0]; + channel->transposition = cmdArgS8; + break; + + case 0xDA: // channel: set envelope + cmdArgU16 = (u16)cmdArgs[0]; + channel->adsr.envelope = (EnvelopePoint*)&seqPlayer->seqData[cmdArgU16]; + break; + + case 0xD9: // channel: set decay index + cmd = (u8)cmdArgs[0]; + channel->adsr.decayIndex = cmd; + break; + + case 0xD8: // channel: set vibrato extent + cmd = (u8)cmdArgs[0]; + channel->vibrato.vibratoExtentTarget = cmd * 8; + channel->vibrato.vibratoExtentStart = 0; + channel->vibrato.vibratoExtentChangeDelay = 0; + break; + + case 0xD7: // channel: set vibrato rate + cmd = (u8)cmdArgs[0]; + channel->vibrato.vibratoRateChangeDelay = 0; + channel->vibrato.vibratoRateTarget = cmd * 32; + channel->vibrato.vibratoRateStart = cmd * 32; + break; + + case 0xE2: // channel: set vibrato extent linear + cmd = (u8)cmdArgs[0]; + channel->vibrato.vibratoExtentStart = cmd * 8; + cmd = (u8)cmdArgs[1]; + channel->vibrato.vibratoExtentTarget = cmd * 8; + cmd = (u8)cmdArgs[2]; + channel->vibrato.vibratoExtentChangeDelay = cmd * 16; + break; + + case 0xE1: // channel: set vibratorate linear + cmd = (u8)cmdArgs[0]; + channel->vibrato.vibratoRateStart = cmd * 32; + cmd = (u8)cmdArgs[1]; + channel->vibrato.vibratoRateTarget = cmd * 32; + cmd = (u8)cmdArgs[2]; + channel->vibrato.vibratoRateChangeDelay = cmd * 16; + break; + + case 0xE3: // channel: set vibrato delay + cmd = (u8)cmdArgs[0]; + channel->vibrato.vibratoDelay = cmd * 16; + break; + + case 0xD4: // channel: set reverb + cmd = (u8)cmdArgs[0]; + channel->reverb = cmd; + break; + + case 0xC6: // channel: set soundFont + cmd = (u8)cmdArgs[0]; + + if (seqPlayer->defaultFont != 0xFF) { + cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId]; + lowBits = gAudioContext.sequenceFontTable[cmdArgU16]; + cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd]; + } + + if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) { + channel->fontId = cmd; + } + break; + + case 0xC7: // channel: write into sequence script + cmd = (u8)cmdArgs[0]; + cmdArgU16 = (u16)cmdArgs[1]; + seqData = &seqPlayer->seqData[cmdArgU16]; + seqData[0] = (u8)scriptState->value + cmd; + break; + + case 0xC8: // channel: subtract -> set value + case 0xCC: // channel: set value + case 0xC9: // channel: `bit and` -> set value + cmdArgS8 = (s8)cmdArgs[0]; + + if (cmd == 0xC8) { + scriptState->value -= cmdArgS8; + } else if (cmd == 0xCC) { + scriptState->value = cmdArgS8; + } else { + scriptState->value &= cmdArgS8; + } + break; + + case 0xCD: // channel: disable channel + cmd = (u8)cmdArgs[0]; + AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmd]); + break; + + case 0xCA: // channel: set mute behavior + cmd = (u8)cmdArgs[0]; + channel->muteFlags = cmd; + channel->changes.s.volume = true; + break; + + case 0xCB: // channel: read sequence -> set value + cmdArgU16 = (u16)cmdArgs[0]; + scriptState->value = *(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value)); + break; + + case 0xCE: // channel: + cmdArgU16 = (u16)cmdArgs[0]; + channel->unk_22 = cmdArgU16; + break; + + case 0xCF: // channel: write large into sequence script + cmdArgU16 = (u16)cmdArgs[0]; + seqData = &seqPlayer->seqData[cmdArgU16]; + seqData[0] = (channel->unk_22 >> 8) & 0xFF; + seqData[1] = channel->unk_22 & 0xFF; + break; + + case 0xD0: // channel: stereo headset effects + cmd = (u8)cmdArgs[0]; + if (cmd & 0x80) { + channel->stereoHeadsetEffects = true; + } else { + channel->stereoHeadsetEffects = false; + } + channel->stereo.asByte = cmd & 0x7F; + break; + + case 0xD1: // channel: set note allocation policy + cmd = (u8)cmdArgs[0]; + channel->noteAllocPolicy = cmd; + break; + + case 0xD2: // channel: set sustain + cmd = (u8)cmdArgs[0]; + channel->adsr.sustain = cmd; + break; + + case 0xE5: // channel: set reverb index + cmd = (u8)cmdArgs[0]; + channel->reverbIndex = cmd; + break; + + case 0xE4: // channel: dyncall + if (scriptState->value != -1) { + data = (*channel->dynTable)[scriptState->value]; + depth = scriptState->depth; + //! @bug: Missing a stack depth check here + scriptState->stack[depth] = scriptState->pc; + scriptState->depth++; + cmdArgU16 = (u16)((data[0] << 8) + data[1]); + scriptState->pc = seqPlayer->seqData + cmdArgU16; + } + break; + + case 0xE6: // channel: set book offset + cmd = (u8)cmdArgs[0]; + channel->bookOffset = cmd; + break; + + case 0xE7: // channel: + cmdArgU16 = (u16)cmdArgs[0]; + data = &seqPlayer->seqData[cmdArgU16]; + channel->muteFlags = data[0]; + data += 3; + channel->noteAllocPolicy = data[-2]; + AudioSeq_SetChannelPriorities(channel, data[-1]); + channel->transposition = (s8)data[0]; + data += 4; + channel->newPan = data[-3]; + channel->panChannelWeight = data[-2]; + channel->reverb = data[-1]; + channel->reverbIndex = data[0]; + //! @bug: Not marking reverb state as changed + channel->changes.s.pan = true; + break; + + case 0xE8: // channel: + channel->muteFlags = cmdArgs[0]; + channel->noteAllocPolicy = cmdArgs[1]; + cmd = (u8)cmdArgs[2]; + AudioSeq_SetChannelPriorities(channel, cmd); + channel->transposition = (s8)AudioSeq_ScriptReadU8(scriptState); + channel->newPan = AudioSeq_ScriptReadU8(scriptState); + channel->panChannelWeight = AudioSeq_ScriptReadU8(scriptState); + channel->reverb = AudioSeq_ScriptReadU8(scriptState); + channel->reverbIndex = AudioSeq_ScriptReadU8(scriptState); + //! @bug: Not marking reverb state as changed + channel->changes.s.pan = true; + break; + + case 0xEC: // channel: reset vibrato + channel->vibrato.vibratoExtentTarget = 0; + channel->vibrato.vibratoExtentStart = 0; + channel->vibrato.vibratoExtentChangeDelay = 0; + channel->vibrato.vibratoRateTarget = 0; + channel->vibrato.vibratoRateStart = 0; + channel->vibrato.vibratoRateChangeDelay = 0; + channel->filter = NULL; + channel->gain = 0; + channel->adsr.sustain = 0; + channel->velocityRandomVariance = 0; + channel->gateTimeRandomVariance = 0; + channel->unk_0F = 0; + channel->unk_20 = 0; + channel->bookOffset = 0; + channel->unk_DC = 0; + channel->unk_E0 = 0; + channel->freqScale = 1.0f; + break; + + case 0xE9: // channel: set note priority + AudioSeq_SetChannelPriorities(channel, (u8)cmdArgs[0]); + break; + + case 0xED: // channel: set hilo gain + cmd = (u8)cmdArgs[0]; + channel->gain = cmd; + break; + + case 0xB0: // channel: set filter + cmdArgU16 = (u16)cmdArgs[0]; + data = seqPlayer->seqData + cmdArgU16; + channel->filter = (s16*)data; + break; + + case 0xB1: // channel: clear filter + channel->filter = NULL; + break; + + case 0xB3: // channel: load filter + cmd = cmdArgs[0]; + + if (channel->filter != NULL) { + lowBits = (cmd >> 4) & 0xF; // LowPassCutoff + cmd &= 0xF; // HighPassCutoff + AudioHeap_LoadFilter(channel->filter, lowBits, cmd); + } + break; + + case 0xB2: // channel: dynread sequence large + cmdArgU16 = (u16)cmdArgs[0]; + channel->unk_22 = *(u16*)(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value * 2)); + break; + + case 0xB4: // channel: set dyntable large + channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22]; + break; + + case 0xB5: // channel: read dyntable large + channel->unk_22 = ((u16*)(channel->dynTable))[scriptState->value]; + break; + + case 0xB6: // channel: read dyntable + scriptState->value = (*channel->dynTable)[0][scriptState->value]; + break; + + case 0xB7: // channel: random large + channel->unk_22 = (cmdArgs[0] == 0) ? (gAudioContext.audioRandom & 0xFFFF) + : (gAudioContext.audioRandom % cmdArgs[0]); + break; + + case 0xB8: // channel: random value + scriptState->value = (cmdArgs[0] == 0) ? (gAudioContext.audioRandom & 0xFFFF) + : (gAudioContext.audioRandom % cmdArgs[0]); + break; + + case 0xA8: // channel: random range large (only cmd that differs from OoT) + rand = Audio_NextRandom(); + channel->unk_22 = (cmdArgs[0] == 0) ? (rand & 0xFFFF) : (rand % cmdArgs[0]); + channel->unk_22 += cmdArgs[1]; + temp2 = (channel->unk_22 / 0x100) + 0x80; + param = channel->unk_22 % 0x100; + channel->unk_22 = (temp2 << 8) | param; + break; + + case 0xB9: // channel: set velocity random variance + channel->velocityRandomVariance = cmdArgs[0]; + break; + + case 0xBA: // channel: set gatetime random variance + channel->gateTimeRandomVariance = cmdArgs[0]; + break; + + case 0xBB: // channel: + channel->unk_0F = cmdArgs[0]; + channel->unk_20 = cmdArgs[1]; + break; + + case 0xBC: // channel: add large + channel->unk_22 += cmdArgs[0]; + break; + + case 0xBD: // channel: + channel->unk_DC = cmdArgs[0]; + break; + + case 0xBE: // channel: + if (cmdArgs[0] < 5) { + if (1) {} + if (gAudioContext.unk_29A8[cmdArgs[0]] != NULL) { + D_80208E6C = gAudioContext.unk_29A8[cmdArgs[0]]; + scriptState->value = D_80208E6C(scriptState->value, channel); + } + } + break; + + case 0xA0: // channel: + case 0xA1: // channel: + case 0xA2: // channel: + case 0xA3: // channel: + if ((cmd == 0xA0) || (cmd == 0xA2)) { + cmdArgU16 = (u16)cmdArgs[0]; + } else { + cmdArgU16 = channel->unk_22; + } + + if (channel->sfxState != NULL) { + if ((cmd == 0xA0) || (cmd == 0xA1)) { + scriptState->value = channel->sfxState[cmdArgU16]; + } else { + channel->sfxState[cmdArgU16] = scriptState->value; + } + } + break; + + case 0xA4: // channel: + channel->unk_10 = cmdArgs[0]; + break; + + case 0xA5: // channel: + scriptState->value += channel->unk_11; + break; + + case 0xA6: // channel: + cmd = (u8)cmdArgs[0]; + cmdArgU16 = (u16)cmdArgs[1]; + seqData = seqPlayer->seqData + (u32)(cmdArgU16 + channel->unk_11); + seqData[0] = (u8)scriptState->value + cmd; + break; + + case 0xA7: // channel: + new_var2 = (cmdArgs[0] & 0x80); + new_var = (scriptState->value & 0x80); + + if (!new_var2) { + phi_v0_3 = scriptState->value << (cmdArgs[0] & 0xF); + } else { + phi_v0_3 = scriptState->value >> (cmdArgs[0] & 0xF); + } + + if (cmdArgs[0] & 0x40) { + phi_v0_3 &= (u8)~0x80; + phi_v0_3 |= new_var; + } + + scriptState->value = phi_v0_3; + break; + } + continue; + } + + // Commands 0x70 - 0x9F + if (cmd >= 0x70) { + lowBits = cmd & 0x7; + + if (((cmd & 0xF8) != 0x70) && (lowBits >= 4)) { + lowBits = 0; + } + + switch (cmd & 0xF8) { + case 0x80: // channel: test layer is finished + if (channel->layers[lowBits] != NULL) { + scriptState->value = channel->layers[lowBits]->finished; + } else { + scriptState->value = -1; + } + break; + + case 0x88: // channel: set layer + cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); + if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { + channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16]; + } + break; + + case 0x90: // channel: free layer + AudioSeq_SeqLayerFree(channel, lowBits); + break; + + case 0x98: // channel: dynset layer + if ((scriptState->value != -1) && (AudioSeq_SeqChannelSetLayer(channel, lowBits) != -1)) { + data = (*channel->dynTable)[scriptState->value]; + cmdArgU16 = (data[0] << 8) + data[1]; + channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16]; + } + break; + + case 0x70: // channel: io write value + channel->soundScriptIO[lowBits] = scriptState->value; + break; + + case 0x78: // channel: set layer relative + temp1 = AudioSeq_ScriptReadS16(scriptState); + if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { + channel->layers[lowBits]->scriptState.pc = &scriptState->pc[temp1]; + } + break; + } + continue; + } + + // Commands 0x00 - 0x6F + lowBits = cmd & 0xF; + + switch (cmd & 0xF0) { + case 0x00: // channel: delay short + channel->delay = lowBits; + if (lowBits == 0) { + break; + } + goto exit_loop; + + case 0x10: // channel: load sample + if (lowBits < 8) { + channel->soundScriptIO[lowBits] = -1; + if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, + &channel->soundScriptIO[lowBits]) == -1) {} + } else { + lowBits -= 8; + channel->soundScriptIO[lowBits] = -1; + if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100, + &channel->soundScriptIO[lowBits]) == -1) {} + } + break; + + case 0x60: // channel: io read value + scriptState->value = channel->soundScriptIO[lowBits]; + if (lowBits < 2) { + channel->soundScriptIO[lowBits] = -1; + } + break; + + case 0x50: // channel: io read value subtract + scriptState->value -= channel->soundScriptIO[lowBits]; + break; + + case 0x20: // channel: start channel + cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); + AudioSeq_SequenceChannelEnable(seqPlayer, lowBits, &seqPlayer->seqData[cmdArgU16]); + break; + + case 0x30: // channel: io write value 2 + cmd = AudioSeq_ScriptReadU8(scriptState); + seqPlayer->channels[lowBits]->soundScriptIO[cmd] = scriptState->value; + break; + + case 0x40: // channel: io read value 2 + cmd = AudioSeq_ScriptReadU8(scriptState); + scriptState->value = seqPlayer->channels[lowBits]->soundScriptIO[cmd]; + break; + } + } +exit_loop: + + for (i = 0; i < ARRAY_COUNT(channel->layers); i++) { + if (channel->layers[i] != NULL) { + AudioSeq_SeqLayerProcessScript(channel->layers[i]); + } + } +} + +void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { + u8 cmd; + u8 cmdLowBits; + SeqScriptState* seqScript = &seqPlayer->scriptState; + s16 tempS; + u16 temp; + s32 i; + s32 value; + u8* data1; + u8* data2; + u8* data3; + u8* data4; + s32 tempoChange; + s32 j; + SequenceChannel* channel; + u16* new_var; + s32 delay; + + if (!seqPlayer->enabled) { + return; + } + + if (!AudioLoad_IsSeqLoadComplete(seqPlayer->seqId) || !AudioLoad_IsFontLoadComplete(seqPlayer->defaultFont)) { + // These function calls serve no purpose + if (AudioLoad_IsSeqLoadComplete(seqPlayer->seqId)) {} + if (AudioLoad_IsSeqLoadComplete(seqPlayer->defaultFont)) {} + + AudioSeq_SequencePlayerDisable(seqPlayer); + return; + } + + AudioLoad_SetSeqLoadStatus(seqPlayer->seqId, LOAD_STATUS_COMPLETE); + AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_COMPLETE); + + if (seqPlayer->muted && (seqPlayer->muteFlags & MUTE_FLAGS_STOP_SCRIPT)) { + return; + } + + seqPlayer->scriptCounter++; + + tempoChange = seqPlayer->tempo + seqPlayer->unk_0C; + if (tempoChange > gAudioContext.tempoInternalToExternal) { + tempoChange = gAudioContext.tempoInternalToExternal; + } + + seqPlayer->tempoAcc += tempoChange; + + if (seqPlayer->tempoAcc < gAudioContext.tempoInternalToExternal) { + return; + } + + seqPlayer->tempoAcc -= (u16)gAudioContext.tempoInternalToExternal; + seqPlayer->unk_16++; + + if (seqPlayer->stopScript == true) { + return; + } + + if (seqPlayer->delay > 1) { + seqPlayer->delay--; + } else { + seqPlayer->recalculateVolume = true; + + while (true) { + cmd = AudioSeq_ScriptReadU8(seqScript); + + // 0xF2 and above are "flow control" commands, including termination. + if (cmd >= 0xF2) { + delay = AudioSeq_HandleScriptFlowControl( + seqPlayer, seqScript, cmd, AudioSeq_GetScriptControlFlowArgument(&seqPlayer->scriptState, cmd)); + + if (delay != 0) { + if (delay == -1) { + AudioSeq_SequencePlayerDisable(seqPlayer); + } else { + seqPlayer->delay = delay; + } + break; + } + continue; + } + + // Commands 0xC0 - 0xF1 + if (cmd >= 0xC0) { + switch (cmd) { + case 0xF1: // seqPlayer: reserve notes + AudioPlayback_NotePoolClear(&seqPlayer->notePool); + cmd = AudioSeq_ScriptReadU8(seqScript); + AudioPlayback_NotePoolFill(&seqPlayer->notePool, cmd); + break; + + case 0xF0: // seqPlayer: unreserve notes + AudioPlayback_NotePoolClear(&seqPlayer->notePool); + break; + + case 0xDF: // seqPlayer: transpose + seqPlayer->transposition = 0; + // fallthrough + case 0xDE: // seqPlayer: transpose relative + seqPlayer->transposition += (s8)AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xDD: // seqPlayer: set tempo + seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; + if (seqPlayer->tempo > gAudioContext.tempoInternalToExternal) { + seqPlayer->tempo = gAudioContext.tempoInternalToExternal; + } + + if ((s16)seqPlayer->tempo <= 0) { + seqPlayer->tempo = 1; + } + break; + + case 0xDC: // seqPlayer: add tempo + seqPlayer->unk_0C = (s8)AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; + break; + + case 0xDA: // seqPlayer: change volume + cmd = AudioSeq_ScriptReadU8(seqScript); + temp = AudioSeq_ScriptReadS16(seqScript); + switch (cmd) { + case 0: + case 1: + if (seqPlayer->state != 2) { + seqPlayer->fadeTimerUnkEu = temp; + seqPlayer->state = cmd; + } + break; + + case 2: + seqPlayer->fadeTimer = temp; + seqPlayer->state = cmd; + seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32)seqPlayer->fadeTimer; + break; + } + break; + + case 0xDB: // seqPlayer: set volume + value = AudioSeq_ScriptReadU8(seqScript); + switch (seqPlayer->state) { + case 1: + seqPlayer->state = 0; + seqPlayer->fadeVolume = 0.0f; + // fallthrough + case 0: + seqPlayer->fadeTimer = seqPlayer->fadeTimerUnkEu; + if (seqPlayer->fadeTimerUnkEu != 0) { + seqPlayer->fadeVelocity = + ((value / 127.0f) - seqPlayer->fadeVolume) / (s32)seqPlayer->fadeTimer; + } else { + seqPlayer->fadeVolume = value / 127.0f; + } + break; + + case 2: + break; + } + break; + + case 0xD9: // seqPlayer: set volume scale + seqPlayer->fadeVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; + break; + + case 0xD7: // seqPlayer: initialize channels + temp = AudioSeq_ScriptReadS16(seqScript); + AudioSeq_SequencePlayerSetupChannels(seqPlayer, temp); + break; + + case 0xD6: // seqPlayer: disable channels + AudioSeq_ScriptReadS16(seqScript); + break; + + case 0xD5: // seqPlayer: set mute scale + seqPlayer->muteVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; + break; + + case 0xD4: // seqPlayer: mute + seqPlayer->muted = true; + break; + + case 0xD3: // seqPlayer: set mute behavior + seqPlayer->muteFlags = AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xD1: // seqPlayer: set short note gatetime table + case 0xD2: // seqPlayer: set short note velocity table + temp = AudioSeq_ScriptReadS16(seqScript); + data3 = &seqPlayer->seqData[temp]; + if (cmd == 0xD2) { + seqPlayer->shortNoteVelocityTable = data3; + } else { + seqPlayer->shortNoteGateTimeTable = data3; + } + break; + + case 0xD0: // seqPlayer: set note allocation policy + seqPlayer->noteAllocPolicy = AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xCE: // seqPlayer: random value + cmd = AudioSeq_ScriptReadU8(seqScript); + if (cmd == 0) { + seqScript->value = (gAudioContext.audioRandom >> 2) & 0xFF; + } else { + seqScript->value = (gAudioContext.audioRandom >> 2) % cmd; + } + break; + + case 0xCD: // seqPlayer: dyncall + temp = AudioSeq_ScriptReadS16(seqScript); + if ((seqScript->value != -1) && (seqScript->depth != 3)) { + data1 = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1)); + seqScript->stack[seqScript->depth] = seqScript->pc; + seqScript->depth++; + temp = (data1[0] << 8) + data1[1]; + seqScript->pc = &seqPlayer->seqData[temp]; + } + break; + + case 0xCC: // seqPlayer: set value + seqScript->value = AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xC9: // seqPlayer: `bit and` -> set value + seqScript->value &= AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xC8: // seqPlayer: subtract -> set value + seqScript->value -= AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xC7: // seqPlayer: write into sequence script + cmd = AudioSeq_ScriptReadU8(seqScript); + temp = AudioSeq_ScriptReadS16(seqScript); + data2 = &seqPlayer->seqData[temp]; + *data2 = (u8)seqScript->value + cmd; + break; + + case 0xC2: // seqPlayer: + temp = AudioSeq_ScriptReadS16(seqScript); + if (seqScript->value != -1) { + data4 = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1)); + + temp = (data4[0] << 8) + data4[1]; + seqScript->pc = &seqPlayer->seqData[temp]; + } + break; + + case 0xC6: // seqPlayer: stop script + seqPlayer->stopScript = true; + return; + + case 0xC5: // seqPlayer: + seqPlayer->unk_16 = AudioSeq_ScriptReadS16(seqScript); + break; + + case 0xEF: // seqPlayer: + AudioSeq_ScriptReadS16(seqScript); + AudioSeq_ScriptReadU8(seqScript); + break; + + case 0xC4: // seqPlayer: start sequence + cmd = AudioSeq_ScriptReadU8(seqScript); + if (cmd == 0xFF) { + cmd = seqPlayer->playerIndex; + if (seqPlayer->state == 2) { + break; + } + } + + cmdLowBits = AudioSeq_ScriptReadU8(seqScript); + AudioLoad_SyncInitSeqPlayer(cmd, cmdLowBits, 0); + if (cmd == (u8)seqPlayer->playerIndex) { + return; + } + break; + + case 0xC3: // seqPlayer: + temp = AudioSeq_ScriptReadS16(seqScript); + if (seqScript->value != -1) { + new_var = (u16*)(seqPlayer->seqData + (u32)(temp + seqScript->value * 2)); + temp = *new_var; + + for (i = 0; i < ARRAY_COUNT(seqPlayer->channels); i++) { + seqPlayer->channels[i]->stopSomething2 = temp & 1; + temp = temp >> 1; + } + } + break; + } + continue; + } + + // Commands 0x00 - 0xBF + cmdLowBits = cmd & 0x0F; + + switch (cmd & 0xF0) { + case 0x00: // seqPlayer: test channel disabled + seqScript->value = seqPlayer->channels[cmdLowBits]->enabled ^ 1; + break; + + case 0x50: // seqPlayer: io read value subtract + seqScript->value -= seqPlayer->soundScriptIO[cmdLowBits]; + break; + + case 0x70: // seqPlayer: io write value + seqPlayer->soundScriptIO[cmdLowBits] = seqScript->value; + break; + + case 0x80: // seqPlayer: io read value + seqScript->value = seqPlayer->soundScriptIO[cmdLowBits]; + if (cmdLowBits < 2) { + seqPlayer->soundScriptIO[cmdLowBits] = -1; + } + break; + + case 0x40: // seqPlayer: disable channel + AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmdLowBits]); + break; + + case 0x90: // seqPlayer: start channel + temp = AudioSeq_ScriptReadS16(seqScript); + AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqPlayer->seqData[temp]); + break; + + case 0xA0: // seqPlayer: start channel relative + tempS = AudioSeq_ScriptReadS16(seqScript); + AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqScript->pc[tempS]); + break; + + case 0xB0: // seqPlayer: load sequence + cmd = AudioSeq_ScriptReadU8(seqScript); + temp = AudioSeq_ScriptReadS16(seqScript); + data2 = &seqPlayer->seqData[temp]; + AudioLoad_SlowLoadSeq(cmd, data2, &seqPlayer->soundScriptIO[cmdLowBits]); + break; + + case 0x60: // seqPlayer: async load + cmd = AudioSeq_ScriptReadU8(seqScript); + value = cmd; + temp = AudioSeq_ScriptReadU8(seqScript); + AudioLoad_ScriptLoad(value, temp, &seqPlayer->soundScriptIO[cmdLowBits]); + break; + } + } + } + + for (j = 0; j < SEQ_NUM_CHANNELS; j++) { + channel = seqPlayer->channels[j]; + if (channel->enabled) { + AudioSeq_SequenceChannelProcessScript(channel); + } + } +} + +void AudioSeq_ProcessSequences(s32 arg0) { + SequencePlayer* seqPlayer; + u32 i; + + gAudioContext.noteSubEuOffset = + (gAudioContext.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.numNotes; + + for (i = 0; i < (u32)gAudioContext.audioBufferParameters.numSequencePlayers; i++) { + seqPlayer = &gAudioContext.seqPlayers[i]; + if (seqPlayer->enabled == true) { + AudioSeq_SequencePlayerProcessSequence(seqPlayer); + AudioEffects_SequencePlayerProcessSound(seqPlayer); + } + } + + AudioPlayback_ProcessNotes(); +} + +void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer) { + while (seqPlayer->skipTicks > 0) { + AudioSeq_SequencePlayerProcessSequence(seqPlayer); + AudioEffects_SequencePlayerProcessSound(seqPlayer); + seqPlayer->skipTicks--; + } +} + +void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { + s32 i; + + AudioSeq_SequencePlayerDisable(seqPlayer); + seqPlayer->stopScript = false; + seqPlayer->delay = 0; + seqPlayer->state = 1; + seqPlayer->fadeTimer = 0; + seqPlayer->fadeTimerUnkEu = 0; + seqPlayer->tempoAcc = 0; + seqPlayer->tempo = 120 * TATUMS_PER_BEAT; // 120 BPM + seqPlayer->unk_0C = 0; + seqPlayer->transposition = 0; + seqPlayer->noteAllocPolicy = 0; + seqPlayer->shortNoteVelocityTable = gDefaultShortNoteVelocityTable; + seqPlayer->shortNoteGateTimeTable = gDefaultShortNoteGateTimeTable; + seqPlayer->scriptCounter = 0; + seqPlayer->unk_16 = 0; + seqPlayer->fadeVolume = 1.0f; + seqPlayer->fadeVelocity = 0.0f; + seqPlayer->volume = 0.0f; + seqPlayer->muteVolumeScale = 0.5f; + + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + AudioSeq_InitSequenceChannel(seqPlayer->channels[i]); + } +} + +void AudioSeq_InitSequencePlayerChannels(s32 playerIndex) { + SequenceChannel* channel; + SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIndex]; + s32 i; + s32 j; + + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(SequenceChannel)); + if (seqPlayer->channels[i] == NULL) { + seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone; + } else { + channel = seqPlayer->channels[i]; + channel->seqPlayer = seqPlayer; + channel->enabled = false; + channel->unk_11 = i; + for (j = 0; j < ARRAY_COUNT(channel->layers); j++) { + channel->layers[j] = NULL; + } + } + + AudioSeq_InitSequenceChannel(seqPlayer->channels[i]); + } +} + +void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { + s32 i; + s32 j; + + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone; + } + + seqPlayer->enabled = false; + seqPlayer->muted = false; + seqPlayer->fontDmaInProgress = false; + seqPlayer->seqDmaInProgress = false; + seqPlayer->applyBend = false; + + for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) { + seqPlayer->soundScriptIO[j] = -1; + } + + seqPlayer->muteFlags = MUTE_FLAGS_SOFTEN | MUTE_FLAGS_STOP_NOTES; + seqPlayer->fadeVolumeScale = 1.0f; + seqPlayer->bend = 1.0f; + + AudioPlayback_InitNoteLists(&seqPlayer->notePool); + AudioSeq_ResetSequencePlayer(seqPlayer); +} + +void AudioSeq_InitSequencePlayers(void) { + s32 i; + + AudioSeq_InitLayerFreelist(); + + for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) { + gAudioContext.sequenceLayers[i].channel = NULL; + gAudioContext.sequenceLayers[i].enabled = false; + } + + for (i = 0; i < ARRAY_COUNT(gAudioContext.seqPlayers); i++) { + AudioSeq_InitSequencePlayer(&gAudioContext.seqPlayers[i]); + } +} diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index afb377943..2298a0875 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -133,7 +133,7 @@ void* gItemIcons[] = { 0x08021000, // ITEM_ZORA_EGG 0x08022000, // ITEM_GOLD_DUST 0x08023000, // ITEM_MUSHROOM - 0x08024000, // ITEM_SEA_HORSE + 0x08024000, // ITEM_SEAHORSE 0x08025000, // ITEM_CHATEAU 0x08026000, // ITEM_HYLIAN_LOACH 0x08027000, // ITEM_OBABA_DRINK @@ -145,7 +145,7 @@ void* gItemIcons[] = { 0x0802D000, // ITEM_ROOM_KEY 0x0802E000, // ITEM_LETTER_MAMA 0x0802F000, // ITEM_LETTER_TO_KAFEI - 0x08030000, // ITEM_PENDANT_MEMORIES + 0x08030000, // ITEM_PENDANT_OF_MEMORIES 0x08031000, // ITEM_TINGLE_MAP 0x08032000, // ITEM_MASK_DEKU 0x08033000, // ITEM_MASK_GORON @@ -268,7 +268,7 @@ u8 gItemSlots[] = { SLOT_BOTTLE_1, // ITEM_ZORA_EGG SLOT_BOTTLE_1, // ITEM_GOLD_DUST SLOT_BOTTLE_1, // ITEM_MUSHROOM - SLOT_BOTTLE_1, // ITEM_SEA_HORSE + SLOT_BOTTLE_1, // ITEM_SEAHORSE SLOT_BOTTLE_1, // ITEM_CHATEAU SLOT_BOTTLE_1, // ITEM_HYLIAN_LOACH SLOT_BOTTLE_1, // ITEM_OBABA_DRINK @@ -280,7 +280,7 @@ u8 gItemSlots[] = { SLOT_TRADE_KEY_MAMA, // ITEM_ROOM_KEY SLOT_TRADE_KEY_MAMA, // ITEM_LETTER_MAMA SLOT_TRADE_COUPLE, // ITEM_LETTER_TO_KAFEI - SLOT_TRADE_COUPLE, // ITEM_PENDANT_MEMORIES + SLOT_TRADE_COUPLE, // ITEM_PENDANT_OF_MEMORIES SLOT_TRADE_COUPLE, // ITEM_TINGLE_MAP SLOT_MASK_DEKU, // ITEM_MASK_DEKU SLOT_MASK_GORON, // ITEM_MASK_GORON @@ -348,7 +348,7 @@ s16 gItemPrices[] = { 20, // ITEM_ZORA_EGG 200, // ITEM_GOLD_DUST 5, // ITEM_MUSHROOM - 0, // ITEM_SEA_HORSE + 0, // ITEM_SEAHORSE 200, // ITEM_CHATEAU 20, // ITEM_HYLIAN_LOACH 0, // ITEM_OBABA_DRINK @@ -360,7 +360,7 @@ s16 gItemPrices[] = { 0, // ITEM_ROOM_KEY 0, // ITEM_LETTER_MAMA 0, // ITEM_LETTER_KAFEI - 0, // ITEM_PENDANT_MEMORIES + 0, // ITEM_PENDANT_OF_MEMORIES 0, // ITEM_TINGLE_MAP }; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 20818c06e..0bc978160 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -10,6 +10,7 @@ * Hold Start and press B: clear all weekEventReg and eventInf flags */ #include "global.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" static FlagSetEntry sFlagEntries[] = { { &gSaveContext.save.weekEventReg[0], "week_event_reg[0]" }, @@ -255,7 +256,7 @@ void FlagSet_Update(GameState* gameState) { // Pressing B will exit } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - play->pauseCtx.debugState = 0; + play->pauseCtx.debugEditor = DEBUG_EDITOR_NONE; } } diff --git a/src/code/graph.c b/src/code/graph.c index 80be689be..9b9de7d7c 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -67,7 +67,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { if (gameStateInit == (GameStateFunc)TitleSetup_Init) { return &gGameStateOverlayTable[0]; } - if (gameStateInit == (GameStateFunc)Select_Init) { + if (gameStateInit == (GameStateFunc)MapSelect_Init) { return &gGameStateOverlayTable[1]; } if (gameStateInit == (GameStateFunc)Title_Init) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 6b76524f1..bc64fbe3d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1886,7 +1886,7 @@ s32 func_800B863C(Actor* actor, PlayState* play) { } s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 2) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { actor->flags &= ~ACTOR_FLAG_100; return true; } @@ -4515,7 +4515,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 currentMatrix = Matrix_GetCurrent(); // Apply sfx along with damage effect - if ((actor != NULL) && (effectAlpha > 0.05f) && (play->gameOverCtx.state == 0)) { + if ((actor != NULL) && (effectAlpha > 0.05f) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { if (type == ACTOR_DRAW_DMGEFF_FIRE) { Actor_PlaySfxAtPos(actor, NA_SE_EV_BURN_OUT - SFX_FLAG); } else if (type == ACTOR_DRAW_DMGEFF_BLUE_FIRE) { diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7aaae22bc..e73dd7f6e 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,5 +1,6 @@ #include "global.h" #include "vt.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #define DYNA_RAYCAST_FLOORS 1 #define DYNA_RAYCAST_WALLS 2 @@ -1191,7 +1192,7 @@ void BgCheck_GetSubdivisionMinBounds(CollisionContext* colCtx, Vec3f* pos, s32* /** * Get positive bias subdivision indices - * increments indicies if `pos` is within BGCHECK_SUBDIV_OVERLAP units of the postive subdivision boundary + * increments indices if `pos` is within BGCHECK_SUBDIV_OVERLAP units of the positive subdivision boundary * `sx`, `sy`, `sz` returns the subdivision x, y, z indices */ void BgCheck_GetSubdivisionMaxBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz) { @@ -3295,7 +3296,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) { pauseState = dynaRaycast->play->pauseCtx.state != 0; if (!pauseState) { - pauseState = dynaRaycast->play->pauseCtx.debugState != 0; + pauseState = dynaRaycast->play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE; } if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) { curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform; @@ -3961,8 +3962,8 @@ void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader) { if (colHeader->surfaceTypeList) { colHeader->surfaceTypeList = Lib_SegmentedToVirtual(colHeader->surfaceTypeList); } - if (colHeader->cameraDataList) { - colHeader->cameraDataList = Lib_SegmentedToVirtual(colHeader->cameraDataList); + if (colHeader->bgCamList) { + colHeader->bgCamList = Lib_SegmentedToVirtual(colHeader->bgCamList); } if (colHeader->waterBoxes) { colHeader->waterBoxes = Lib_SegmentedToVirtual(colHeader->waterBoxes); @@ -4025,128 +4026,142 @@ u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, } /** - * SurfaceType return CamData Index + * SurfaceType get index of bgCam */ -u32 SurfaceType_GetCamDataIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) & 0xFF; } /** - * CamData return camera setting + * BgCam get setting of bgCam */ -u16 func_800C9728(CollisionContext* colCtx, u32 camId, s32 bgId) { - u16 result; +u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId) { + u16 camSetting; CollisionHeader* colHeader; - CamData* camData; + BgCamInfo* bgCamList; colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); if (colHeader == NULL) { - return 0; + return CAM_SET_NONE; } - camData = colHeader->cameraDataList; - result = camData[camId].setting; - return result; + + bgCamList = colHeader->bgCamList; + camSetting = bgCamList[bgCamIndex].setting; + + return camSetting; } /** - * SurfaceType return camera setting + * BgCam Get the camera setting of bgCam */ -u16 SurfaceType_GetCameraSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); - CamData* camData; + BgCamInfo* bgCamList; + SurfaceType* surfaceTypes; + + if (colHeader == NULL) { + return CAM_SET_NONE; + } + + bgCamList = colHeader->bgCamList; + if (bgCamList == NULL) { + return CAM_SET_NONE; + } + + surfaceTypes = colHeader->surfaceTypeList; + if (surfaceTypes == NULL) { + return CAM_SET_NONE; + } + + return BgCheck_GetBgCamSettingImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId); +} + +/** + * BgCam Get the total count of Vec3s data from bgCamFuncData + */ +u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId) { + CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); + BgCamInfo* bgCamList; + + if (colHeader == NULL) { + return 0; + } + + bgCamList = colHeader->bgCamList; + if (bgCamList == NULL) { + return 0; + } + + return bgCamList[bgCamIndex].count; +} + +/** + * BgCam Get the total count of Vec3s data from bgCamFuncData + */ +u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); + BgCamInfo* bgCamList; SurfaceType* surfaceTypes; if (colHeader == NULL) { return 0; } - camData = colHeader->cameraDataList; - if (camData == NULL) { + + bgCamList = colHeader->bgCamList; + if (bgCamList == NULL) { return 0; } + surfaceTypes = colHeader->surfaceTypeList; if (surfaceTypes == NULL) { return 0; } - return func_800C9728(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId); + + return BgCheck_GetBgCamCountImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId); } /** - * CamData get number of camera data blocks + * BgCam Get Vec3s data from bgCamFuncData */ -u16 func_800C97F8(CollisionContext* colCtx, u32 camId, s32 bgId) { +Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId) { CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); - CamData* camData; - - if (colHeader == NULL) { - return 0; - } - - camData = colHeader->cameraDataList; - if (camData == NULL) { - return 0; - } - return camData[camId].numData; -} - -/** - * SurfaceType get number of camera data blocks - */ -u16 func_800C9844(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); - CamData* camData; - SurfaceType* surfaceTypes; - - if (colHeader == NULL) { - return 0; - } - camData = colHeader->cameraDataList; - if (camData == NULL) { - return 0; - } - surfaceTypes = colHeader->surfaceTypeList; - if (surfaceTypes == NULL) { - return 0; - } - return func_800C97F8(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId); -} - -/** - * CamData get data - */ -Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) { - CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); - CamData* cameraDataList; + BgCamInfo* bgCamList; if (colHeader == NULL) { return NULL; } - cameraDataList = colHeader->cameraDataList; - if (cameraDataList == NULL) { + + bgCamList = colHeader->bgCamList; + if (bgCamList == NULL) { return NULL; } - return Lib_SegmentedToVirtual(cameraDataList[camId].data); + + return Lib_SegmentedToVirtual(bgCamList[bgCamIndex].bgCamFuncData); } /** - * SurfaceType Get data + * BgCam Get Vec3s data from bgCamFuncData */ -Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); - CamData* camData; + BgCamInfo* bgCamList; SurfaceType* surfaceTypes; if (colHeader == NULL) { return NULL; } - camData = colHeader->cameraDataList; - if (camData == NULL) { + + bgCamList = colHeader->bgCamList; + if (bgCamList == NULL) { return NULL; } + surfaceTypes = colHeader->surfaceTypeList; if (surfaceTypes == NULL) { return NULL; } - return func_800C98CC(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId); + + return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId); } /** @@ -4540,41 +4555,46 @@ f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId) { } /** - * WaterBox get CamData index + * WaterBox get BgCam index */ -u32 WaterBox_GetCamDataIndex(CollisionContext* colCtx, WaterBox* waterBox) { +u32 WaterBox_GetBgCamIndex(CollisionContext* colCtx, WaterBox* waterBox) { u32 prop = waterBox->properties >> 0; return prop & 0xFF; } /** - * WaterBox get CamData camera setting + * WaterBox get BgCam setting */ -u16 WaterBox_GetCameraSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId) { +u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId) { s32 pad[2]; - u16 result = 0; + u16 camSetting = CAM_SET_NONE; CollisionHeader* colHeader; - CamData* camData; - s32 camId; + BgCamInfo* bgCamList; + s32 bgCamIndex; colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); if (colHeader == NULL) { - return result; - } - camId = WaterBox_GetCamDataIndex(colCtx, waterBox); - camData = colHeader->cameraDataList; - - if (camData == NULL) { - return result; + return camSetting; } - result = camData[camId].setting; - return result; + bgCamIndex = WaterBox_GetBgCamIndex(colCtx, waterBox); + bgCamList = colHeader->bgCamList; + + if (bgCamList == NULL) { + return camSetting; + } + + camSetting = bgCamList[bgCamIndex].setting; + + return camSetting; } -void func_800CA6B8(CollisionContext* colCtx, WaterBox* waterBox) { - WaterBox_GetCameraSetting(colCtx, waterBox, BGCHECK_SCENE); +/** + * WaterBox get scene BgCam setting + */ +void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox) { + WaterBox_GetBgCamSetting(colCtx, waterBox, BGCHECK_SCENE); } /** diff --git a/src/code/z_camera.c b/src/code/z_camera.c index aaf68c759..63a06b512 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -38,7 +38,22 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB854.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB880.s") +s32 Camera_IsSwimming(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (focalActor == &GET_PLAYER(camera->play)->actor) { + if (((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_8000) { + // Swimming as Zora + return 999; + } else { + // Swimming as Human or Fierce Deity + return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_8000000; + } + } else { + // Camera not focused on player + return 0; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB8C8.s") @@ -84,13 +99,78 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC5C8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC740.s") +#define CAM_DATA_IS_BG (1 << 12) // if not set, then cam data is for actor cutscenes -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC7A8.s") +/** + * Returns the CameraSettingType of the camera from either the bgCam or the actorCsCam at index `camDataId` + */ +s16 Camera_GetBgCamOrActorCsCamSetting(Camera* camera, u32 camDataId) { + if (camDataId & CAM_DATA_IS_BG) { + return BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, camDataId & ~CAM_DATA_IS_BG, BGCHECK_SCENE); + } else { + return Play_GetActorCsCamSetting(camera->play, camDataId); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC804.s") +/** + * Returns either the bgCam data or the actorCsCam data at index `camDataId` + */ +Vec3s* Camera_GetBgCamOrActorCsCamFuncData(Camera* camera, u32 camDataId) { + if (camDataId & CAM_DATA_IS_BG) { + return BgCheck_GetBgCamFuncDataImpl(&camera->play->colCtx, camDataId & ~CAM_DATA_IS_BG, BGCHECK_SCENE); + } else { + return Play_GetActorCsCamFuncData(camera->play, camDataId); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC874.s") +/** + * Gets the bgCam index for the poly `poly`, returns -1 if + * there is no camera data for that poly. + */ +s32 Camera_GetBgCamIndex(Camera* camera, s32* bgId, CollisionPoly* poly) { + s32 bgCamIndex = SurfaceType_GetBgCamIndex(&camera->play->colCtx, poly, *bgId); + s32 ret; + + if (BgCheck_GetBgCamSettingImpl(&camera->play->colCtx, bgCamIndex, *bgId) == CAM_SET_NONE) { + ret = -1; + } else { + ret = bgCamIndex; + } + + return ret; +} + +/** + * Gets the Camera setting for the water box the player is in. + * Returns -1 if the player is not in a water box, or does not have a swimming state. + * Returns -2 if there is no bgCam index for the water box. + * Returns the camera setting otherwise. + */ +s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { + PosRot playerPosShape; + WaterBox* waterBox; + s32 camSetting; + s32 bgId; + + Actor_GetWorldPosShapeRot(&playerPosShape, camera->focalActor); + *waterY = playerPosShape.pos.y; + + if (!WaterBox_GetSurfaceImpl(camera->play, &camera->play->colCtx, playerPosShape.pos.x, playerPosShape.pos.z, + waterY, &waterBox, &bgId)) { + // player's position is not in a waterbox + *waterY = playerPosShape.pos.y; + return -1; + } + + if (!Camera_IsSwimming(camera)) { + return -1; + } + + camSetting = WaterBox_GetBgCamSetting(&camera->play->colCtx, waterBox, bgId); + + // -2: no bgCam index + return (camSetting == CAM_SET_NONE) ? -2 : camSetting; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CC938.s") diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 1ca8e6d95..7adb24bdd 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -13,10 +13,11 @@ void SaveContext_Init(void) { gSaveContext.cutsceneTrigger = 0; gSaveContext.unk_3F4D = 0; gSaveContext.nextDayTime = 0xFFFF; - gSaveContext.environmentTime = 0; + gSaveContext.skyboxTime = 0; gSaveContext.dogIsLost = true; - gSaveContext.nextTransition = 0xFF; + gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; gSaveContext.prevHudMode = HUD_MODE_ALL; + gSaveContext.options.language = 1; gSaveContext.options.audioSetting = 0; gSaveContext.options.zTargetSetting = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 7370c0445..5d86d1edb 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -82,7 +82,7 @@ CutsceneStateHandler sCsStateHandlers2[] = { }; void Cutscene_Update2(PlayState* play, CutsceneContext* csCtx) { - if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == 0x14)) { + if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) { gSaveContext.cutsceneTrigger = 0; } @@ -293,8 +293,8 @@ void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* if (isStartFrame) { play->nextEntranceIndex = 0x1C00; gSaveContext.nextCutsceneIndex = 0xFFF8; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } break; case 0x1C: @@ -554,7 +554,7 @@ void Cutscene_Command_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdDayT nextTime = hourAsMinutes + minutes; gSaveContext.save.time = nextTime; - gSaveContext.environmentTime = nextTime; + gSaveContext.skyboxTime = nextTime; } } @@ -562,7 +562,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* csCtx->state = CS_STATE_4; func_80165690(); Audio_SetCutsceneFlag(false); - gSaveContext.unk_3F48 = 1; + gSaveContext.cutsceneTransitionControl = 1; if ((gSaveContext.gameMode != 0) && (csCtx->frames != cmd->startFrame)) { gSaveContext.hudModeDimOnlyDisabledButtons = true; @@ -572,7 +572,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* if (cmd->base == 1) { play->nextEntranceIndex = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntranceIndex; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; if (gSaveContext.gameMode != 1) { Scene_SetExitFade(play); } else { @@ -580,7 +580,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* if (D_801BB12C >= 2) { D_801BB12C = 0; } - play->unk_1887F = 4; + play->transitionType = TRANS_TYPE_04; } if ((play->nextEntranceIndex & 0xF) > 0) { @@ -605,26 +605,26 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB case 0x1F: if (gSaveContext.save.weekEventReg[20] & 2) { play->nextEntranceIndex = 0x3010; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } else { play->nextEntranceIndex = 0x8600; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } break; case 0x44: if (gSaveContext.save.weekEventReg[33] & 0x80) { play->nextEntranceIndex = 0xAE70; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } else { play->nextEntranceIndex = 0xAE00; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } break; @@ -632,16 +632,16 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB gSaveContext.save.weekEventReg[55] |= 0x80; play->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; break; case 0x36: gSaveContext.save.weekEventReg[52] |= 0x20; play->nextEntranceIndex = 0x2000; gSaveContext.nextCutsceneIndex = 0xFFF1; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; break; } } @@ -667,7 +667,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C00; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 3: @@ -680,7 +680,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C10; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 4: @@ -693,7 +693,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C20; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 5: @@ -706,7 +706,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C30; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 6: @@ -719,7 +719,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C50; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 7: @@ -732,14 +732,14 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C60; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 8: // Ikana canyon play->nextEntranceIndex = 0x2000; gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 9: @@ -752,7 +752,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C70; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 10: @@ -765,7 +765,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C40; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; case 11: @@ -778,7 +778,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->nextEntranceIndex = 0x1C80; gSaveContext.nextCutsceneIndex = 0xFFF9; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; break; } } @@ -880,7 +880,7 @@ void Cutscene_Command_TransitionFX(PlayState* play, CutsceneContext* csCtx, CsCm break; case 9: - gSaveContext.unk_3F48 = 1; + gSaveContext.cutsceneTransitionControl = 1; break; case 10: @@ -998,7 +998,7 @@ s32 Cutscene_CountNormalMasks(void) { // Command 0xA: Textbox void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdTextbox* cmd) { static s32 D_801BB160 = CS_TEXTBOX_TYPE_DEFAULT; - u8 dialogState; + u8 talkState; s32 pad; u16 originalCsFrames; s32 pad2; @@ -1048,10 +1048,11 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText // a textbox that is expected to be closed by the user is still open. originalCsFrames = csCtx->frames; - dialogState = Message_GetState(&play->msgCtx); - if ((dialogState != 2) && (dialogState != 0) && (dialogState != 7) && (dialogState != 8)) { + talkState = Message_GetState(&play->msgCtx); + if ((talkState != TEXT_STATE_CLOSING) && (talkState != TEXT_STATE_NONE) && (talkState != TEXT_STATE_7) && + (talkState != TEXT_STATE_8)) { csCtx->frames--; - if ((dialogState == 4) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { if (cmd->base == 0x33BD) { func_8019F230(); @@ -1089,12 +1090,12 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } } - if (dialogState == 5 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_80152434(play, cmd->base); } } - if ((dialogState == 2) && (D_801BB160 == CS_TEXTBOX_TYPE_3)) { + if ((talkState == TEXT_STATE_CLOSING) && (D_801BB160 == CS_TEXTBOX_TYPE_3)) { csCtx->frames--; D_801BB124++; } @@ -1176,7 +1177,8 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc bcopy(cutscenePtr, &cutsceneEndFrame, sizeof(s32)); cutscenePtr += sizeof(s32); - if (((u16)cutsceneEndFrame < csCtx->frames) && (play->transitionTrigger != 0x14) && (csCtx->state != CS_STATE_4)) { + if (((u16)cutsceneEndFrame < csCtx->frames) && (play->transitionTrigger != TRANS_TRIGGER_START) && + (csCtx->state != CS_STATE_4)) { csCtx->state = CS_STATE_3; return; } @@ -1474,8 +1476,8 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { Audio_SetCutsceneFlag(true); csCtx->frames = 0xFFFF; - csCtx->csCamId = ActorCutscene_GetCurrentCamera(0x7F); - func_8016119C(Play_GetCamera(play, csCtx->csCamId), &sCutsceneCameraInfo); + csCtx->subCamId = ActorCutscene_GetCurrentSubCamId(0x7F); + func_8016119C(Play_GetCamera(play, csCtx->subCamId), &sCutsceneCameraInfo); csCtx->unk_18 = 0xFFFF; if (gSaveContext.cutsceneTrigger == 0) { @@ -1492,11 +1494,9 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { } } -#ifdef NON_MATCHING // HandleFlags? -// regalloc void func_800EDBE0(PlayState* play) { - CutsceneEntry* temp_a3; + s32 pad; s16 sp2A; SceneTableEntry* sp24; s32 temp_v0_3; @@ -1506,15 +1506,16 @@ void func_800EDBE0(PlayState* play) { if (sp2A != -1) { temp_v0_3 = func_800F2138(sp2A); if (temp_v0_3 != -1) { - temp_a3 = ((void)0, play->csCtx.sceneCsList); - if ((temp_a3[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { - if (temp_a3[temp_v0_3].unk7 == 0xFE) { + if ((play->csCtx.sceneCsList[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { + if (play->csCtx.sceneCsList[temp_v0_3].unk7 == 0xFE) { ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; - } else if (!((1 << (temp_a3[temp_v0_3].unk7 % 8)) & - gSaveContext.save.weekEventReg[temp_a3[temp_v0_3].unk7 / 8])) { - gSaveContext.save.weekEventReg[(temp_a3[temp_v0_3].unk7 / 8)] |= - 1 << (temp_a3[temp_v0_3].unk7 % 8); + } else if (!(((void)0, + gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & + (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)))) { + gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = + ((void)0, gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | + (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)); ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; } @@ -1528,7 +1529,8 @@ void func_800EDBE0(PlayState* play) { if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { sp24 = play->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { - if ((Entrance_GetTransitionFlags(gSaveContext.sceneSetupIndex + gSaveContext.save.entranceIndex) & + if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entranceIndex) + + ((void)0, gSaveContext.sceneSetupIndex)) & 0x4000) != 0) { func_80151A68(play, sp24->titleTextId); } @@ -1537,9 +1539,6 @@ void func_800EDBE0(PlayState* play) { gSaveContext.showTitleCard = true; } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EDBE0.s") -#endif void func_800EDDB0(PlayState* play) { } diff --git a/src/code/z_draw.c b/src/code/z_draw.c index b31f796b7..4167b4cea 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -1,49 +1,843 @@ +/** + * @file z_draw.c + * @brief Draw get-item models + */ #include "global.h" +#include "assets/objects/object_gi_arrow/object_gi_arrow.h" +#include "assets/objects/object_gi_arrowcase/object_gi_arrowcase.h" +#include "assets/objects/object_gi_bean/object_gi_bean.h" +#include "assets/objects/object_gi_bigbomb/object_gi_bigbomb.h" +#include "assets/objects/object_gi_bomb_1/object_gi_bomb_1.h" +#include "assets/objects/object_gi_bomb_2/object_gi_bomb_2.h" +#include "assets/objects/object_gi_bombpouch/object_gi_bombpouch.h" +#include "assets/objects/object_gi_bosskey/object_gi_bosskey.h" +#include "assets/objects/object_gi_bottle_04/object_gi_bottle_04.h" +#include "assets/objects/object_gi_bottle_15/object_gi_bottle_15.h" +#include "assets/objects/object_gi_bottle_16/object_gi_bottle_16.h" +#include "assets/objects/object_gi_bottle_21/object_gi_bottle_21.h" +#include "assets/objects/object_gi_bottle_22/object_gi_bottle_22.h" +#include "assets/objects/object_gi_bottle_red/object_gi_bottle_red.h" +#include "assets/objects/object_gi_bottle/object_gi_bottle.h" +#include "assets/objects/object_gi_bow/object_gi_bow.h" +#include "assets/objects/object_gi_camera/object_gi_camera.h" +#include "assets/objects/object_gi_compass/object_gi_compass.h" +#include "assets/objects/object_gi_fieldmap/object_gi_fieldmap.h" +#include "assets/objects/object_gi_fish/object_gi_fish.h" +#include "assets/objects/object_gi_ghost/object_gi_ghost.h" +#include "assets/objects/object_gi_glasses/object_gi_glasses.h" +#include "assets/objects/object_gi_gold_dust/object_gi_gold_dust.h" +#include "assets/objects/object_gi_golonmask/object_gi_golonmask.h" +#include "assets/objects/object_gi_heart/object_gi_heart.h" +#include "assets/objects/object_gi_hearts/object_gi_hearts.h" +#include "assets/objects/object_gi_hookshot/object_gi_hookshot.h" +#include "assets/objects/object_gi_insect/object_gi_insect.h" +#include "assets/objects/object_gi_key/object_gi_key.h" +#include "assets/objects/object_gi_ki_tan_mask/object_gi_ki_tan_mask.h" +#include "assets/objects/object_gi_liquid/object_gi_liquid.h" +#include "assets/objects/object_gi_loach/object_gi_loach.h" +#include "assets/objects/object_gi_longsword/object_gi_longsword.h" +#include "assets/objects/object_gi_m_arrow/object_gi_m_arrow.h" +#include "assets/objects/object_gi_magicmushroom/object_gi_magicmushroom.h" +#include "assets/objects/object_gi_magicpot/object_gi_magicpot.h" +#include "assets/objects/object_gi_map/object_gi_map.h" +#include "assets/objects/object_gi_mask03/object_gi_mask03.h" +#include "assets/objects/object_gi_mask05/object_gi_mask05.h" +#include "assets/objects/object_gi_mask06/object_gi_mask06.h" +#include "assets/objects/object_gi_mask09/object_gi_mask09.h" +#include "assets/objects/object_gi_mask10/object_gi_mask10.h" +#include "assets/objects/object_gi_mask11/object_gi_mask11.h" +#include "assets/objects/object_gi_mask12/object_gi_mask12.h" +#include "assets/objects/object_gi_mask13/object_gi_mask13.h" +#include "assets/objects/object_gi_mask14/object_gi_mask14.h" +#include "assets/objects/object_gi_mask15/object_gi_mask15.h" +#include "assets/objects/object_gi_mask16/object_gi_mask16.h" +#include "assets/objects/object_gi_mask17/object_gi_mask17.h" +#include "assets/objects/object_gi_mask18/object_gi_mask18.h" +#include "assets/objects/object_gi_mask20/object_gi_mask20.h" +#include "assets/objects/object_gi_mask21/object_gi_mask21.h" +#include "assets/objects/object_gi_mask22/object_gi_mask22.h" +#include "assets/objects/object_gi_mask23/object_gi_mask23.h" +#include "assets/objects/object_gi_melody/object_gi_melody.h" +#include "assets/objects/object_gi_milk/object_gi_milk.h" +#include "assets/objects/object_gi_mssa/object_gi_mssa.h" +#include "assets/objects/object_gi_nuts/object_gi_nuts.h" +#include "assets/objects/object_gi_nutsmask/object_gi_nutsmask.h" +#include "assets/objects/object_gi_ocarina/object_gi_ocarina.h" +#include "assets/objects/object_gi_purse/object_gi_purse.h" +#include "assets/objects/object_gi_rabit_mask/object_gi_rabit_mask.h" +#include "assets/objects/object_gi_reserve_b_00/object_gi_reserve_b_00.h" +#include "assets/objects/object_gi_reserve_b_01/object_gi_reserve_b_01.h" +#include "assets/objects/object_gi_reserve_c_00/object_gi_reserve_c_00.h" +#include "assets/objects/object_gi_reserve_c_01/object_gi_reserve_c_01.h" +#include "assets/objects/object_gi_reserve00/object_gi_reserve00.h" +#include "assets/objects/object_gi_reserve01/object_gi_reserve01.h" +#include "assets/objects/object_gi_rupy/object_gi_rupy.h" +#include "assets/objects/object_gi_schedule/object_gi_schedule.h" +#include "assets/objects/object_gi_seahorse/object_gi_seahorse.h" +#include "assets/objects/object_gi_shield_2/object_gi_shield_2.h" +#include "assets/objects/object_gi_shield_3/object_gi_shield_3.h" +#include "assets/objects/object_gi_soldout/object_gi_soldout.h" +#include "assets/objects/object_gi_soul/object_gi_soul.h" +#include "assets/objects/object_gi_stick/object_gi_stick.h" +#include "assets/objects/object_gi_stonemask/object_gi_stonemask.h" +#include "assets/objects/object_gi_sutaru/object_gi_sutaru.h" +#include "assets/objects/object_gi_sword_1/object_gi_sword_1.h" +#include "assets/objects/object_gi_sword_2/object_gi_sword_2.h" +#include "assets/objects/object_gi_sword_3/object_gi_sword_3.h" +#include "assets/objects/object_gi_sword_4/object_gi_sword_4.h" +#include "assets/objects/object_gi_truth_mask/object_gi_truth_mask.h" +#include "assets/objects/object_gi_zoramask/object_gi_zoramask.h" +#include "assets/objects/object_bsmask/object_bsmask.h" +#include "assets/objects/object_st/object_st.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/GetItem_Draw.s") +void GetItem_DrawBombchu(PlayState* play, s16 drawId); +void GetItem_DrawPoes(PlayState* play, s16 drawId); +void GetItem_DrawFairyBottle(PlayState* play, s16 drawId); +void GetItem_DrawSkullToken(PlayState* play, s16 drawId); +void GetItem_DrawCompass(PlayState* play, s16 drawId); +void GetItem_DrawPotion(PlayState* play, s16 drawId); +void GetItem_DrawGoronSword(PlayState* play, s16 drawId); +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId); +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId); +void GetItem_DrawFish(PlayState* play, s16 drawId); +void GetItem_DrawOpa0(PlayState* play, s16 drawId); +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId); +void GetItem_DrawOpa01(PlayState* play, s16 drawId); +void GetItem_DrawXlu01(PlayState* play, s16 drawId); +void GetItem_DrawSeahorse(PlayState* play, s16 drawId); +void GetItem_DrawFairyContainer(PlayState* play, s16 drawId); +void GetItem_DrawMoonsTear(PlayState* play, s16 drawId); +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId); +void GetItem_DrawUpgrades(PlayState* play, s16 drawId); +void GetItem_DrawRupee(PlayState* play, s16 drawId); +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId); +void GetItem_DrawWallet(PlayState* play, s16 drawId); +void GetItem_DrawRemains(PlayState* play, s16 drawId); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EE364.s") +typedef struct { + /* 0x00 */ void (*drawFunc)(PlayState*, s16); + /* 0x04 */ void* drawResources[8]; // Either display lists (Gfx*) or matrices (Mtx*) +} DrawItemTableEntry; // size = 0x24 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EE400.s") +static DrawItemTableEntry sDrawItemTable[] = { + // GID_BOTTLE, OBJECT_GI_BOTTLE + { GetItem_DrawOpa0Xlu1, { gGiEmptyBottleCorkDL, gGiEmptyBottleGlassDL } }, + // GID_KEY_SMALL, OBJECT_GI_KEY + { GetItem_DrawOpa0, { gGiSmallKeyDL } }, + // GID_MASK_KAMARO, OBJECT_GI_MASK17 + { GetItem_DrawOpa01, { gGiKamaroMaskDL, gGiKamaroMaskEmptyDL } }, + // GID_MASK_COUPLE, OBJECT_GI_MASK13 + { GetItem_DrawOpa0Xlu1, { gGiCouplesMaskFullDL, gGiCouplesMaskHalfDL } }, + // GID_04, OBJECT_GI_MELODY + { GetItem_DrawXlu01, { gGiSerenadeColorDL, gGiSongNoteDL } }, + // GID_05, OBJECT_GI_MELODY + { GetItem_DrawXlu01, { gGiRequiemColorDL, gGiSongNoteDL } }, + // GID_06, OBJECT_GI_MELODY + { GetItem_DrawXlu01, { gGiNocturneColorDL, gGiSongNoteDL } }, + // GID_07, OBJECT_GI_MELODY + { GetItem_DrawXlu01, { gGiPreludeColorDL, gGiSongNoteDL } }, + // GID_RECOVERY_HEART, OBJECT_GI_HEART + { GetItem_DrawRecoveryHeart, { gGiRecoveryHeartDL } }, + // GID_KEY_BOSS, OBJECT_GI_KEY_BOSS + { GetItem_DrawOpa0Xlu1, { gGiBossKeyDL, gGiBossKeyGemDL } }, + // GID_COMPASS, OBJECT_GI_COMPASS + { GetItem_DrawCompass, { gGiCompassDL, gGiCompassGlassDL } }, + // GID_BOMBERS_NOTEBOOK, OBJECT_GI_SCHEDULE + { GetItem_DrawOpa0Xlu1, { gGiBombersNotebookEmptyDL, gGiBombersNotebookDL } }, + // GID_MASK_STONE, OBJECT_GI_STONEMASK + { GetItem_DrawOpa0Xlu1, { gGiStoneMaskEmptyDL, gGiStoneMaskDL } }, + // GID_MASK_KAFEIS_MASK, OBJECT_GI_MASK05 + { GetItem_DrawOpa01, { gGiKafeiMaskDL, gGiKafeiMaskEmptyDL } }, + // GID_MASK_CIRCUS_LEADER, OBJECT_GI_MASK11 + { GetItem_DrawOpa0Xlu1, { gGiCircusLeaderMaskFaceDL, gGiCircusLeaderMaskEyebrowsDL } }, + // GID_MASK_BREMEN, OBJECT_GI_MASK20 + { GetItem_DrawOpa01, { gGiBremenMaskDL, gGiBremenMaskEmptyDL } }, + // GID_MASK_ALL_NIGHT, OBJECT_GI_MASK06 + { GetItem_DrawOpa0Xlu1, { gGiAllNightMaskEyesDL, gGiAllNightMaskFaceDL } }, + // GID_NUTS, OBJECT_GI_NUTS + { GetItem_DrawDekuNuts, { gGiNutDL } }, + // GID_HEART_CONTAINER, OBJECT_GI_HEARTS + { GetItem_DrawXlu01, { gGiHeartBorderDL, gGiHeartContainerDL } }, + // GID_HEART_PIECE, OBJECT_GI_HEARTS + { GetItem_DrawXlu01, { gGiHeartBorderDL, gGiHeartPieceDL } }, + // GID_QUIVER_30, OBJECT_GI_ARROWCASE + { GetItem_DrawUpgrades, { gGiQuiverInnerDL, gGiQuiver30InnerColorDL, gGiQuiver30OuterColorDL, gGiQuiverOuterDL } }, + // GID_QUIVER_40, OBJECT_GI_ARROWCASE + { GetItem_DrawUpgrades, { gGiQuiverInnerDL, gGiQuiver40InnerColorDL, gGiQuiver40OuterColorDL, gGiQuiverOuterDL } }, + // GID_QUIVER_50, OBJECT_GI_ARROWCASE + { GetItem_DrawUpgrades, { gGiQuiverInnerDL, gGiQuiver50InnerColorDL, gGiQuiver50OuterColorDL, gGiQuiverOuterDL } }, + // GID_BOMB_BAG_20, OBJECT_GI_BOMBPOUCH + { GetItem_DrawUpgrades, { gGiBombBagDL, gGiBombBag20BagColorDL, gGiBombBag20RingColorDL, gGiBombBagRingDL } }, + // GID_BOMB_BAG_30, OBJECT_GI_BOMBPOUCH + { GetItem_DrawUpgrades, { gGiBombBagDL, gGiBombBag30BagColorDL, gGiBombBag30RingColorDL, gGiBombBagRingDL } }, + // GID_BOMB_BAG_40, OBJECT_GI_BOMBPOUCH + { GetItem_DrawUpgrades, { gGiBombBagDL, gGiBombBag40BagColorDL, gGiBombBag40RingColorDL, gGiBombBagRingDL } }, + // GID_STICK, OBJECT_GI_STICK + { GetItem_DrawOpa0, { gGiStickDL } }, + // GID_DUNGEON_MAP, OBJECT_GI_MAP + { GetItem_DrawOpa0, { gGiDungeonMapDL } }, + // GID_MAGIC_SMALL, OBJECT_GI_MAGICPOT + { GetItem_DrawOpa0, { gGiMagicJarSmallDL } }, + // GID_MAGIC_LARGE, OBJECT_GI_MAGICPOT + { GetItem_DrawOpa0, { gGiMagicJarLargeDL } }, + // GID_BOMB, OBJECT_GI_BOMB_1 + { GetItem_DrawOpa0, { gGiBombDL } }, + // GID_STONE_OF_AGONY, OBJECT_GI_MAP + { GetItem_DrawOpa0, { gGiStoneOfAgonyDL } }, + // GID_WALLET_ADULT, OBJECT_GI_PURSE + { GetItem_DrawWallet, + { gGiWalletDL, gGiAdultWalletColorDL, gGiAdultWalletRupeeOuterColorDL, gGiWalletRupeeOuterDL, + gGiAdultWalletStringColorDL, gGiWalletStringDL, gGiAdultWalletRupeeInnerColorDL, gGiWalletRupeeInnerDL } }, + // GID_WALLET_GIANT, OBJECT_GI_PURSE + { GetItem_DrawWallet, + { gGiWalletDL, gGiGiantsWalletColorDL, gGiGiantsWalletRupeeOuterColorDL, gGiWalletRupeeOuterDL, + gGiGiantsWalletStringColorDL, gGiWalletStringDL, gGiGiantsWalletRupeeInnerColorDL, gGiWalletRupeeInnerDL } }, + // GID_MASK_DON_GERO, OBJECT_GI_MASK16 + { GetItem_DrawOpa0Xlu1, { gGiDonGeroMaskFaceDL, gGiDonGeroMaskBodyDL } }, + // GID_ARROWS_SMALL, OBJECT_GI_ARROW + { GetItem_DrawOpa0, { gGiArrowSmallDL } }, + // GID_ARROWS_MEDIUM, OBJECT_GI_ARROW + { GetItem_DrawOpa0, { gGiArrowMediumDL } }, + // GID_ARROWS_LARGE, OBJECT_GI_ARROW + { GetItem_DrawOpa0, { gGiArrowLargeDL } }, + // GID_BOMBCHU, OBJECT_GI_BOMB_2 + { GetItem_DrawBombchu, { gGiBombchuDL } }, + // GID_SHIELD_HERO, OBJECT_GI_SHIELD_2 + { GetItem_DrawOpa0Xlu1, { gGiHerosShieldEmblemDL, gGiHerosShieldDL } }, + // GID_HOOKSHOT, OBJECT_GI_HOOKSHOT + { GetItem_DrawOpa01, { gGiHookshotEmptyDL, gGiHookshotDL } }, + // GID_29, OBJECT_GI_HOOKSHOT + { GetItem_DrawOpa01, { gGiHookshotEmptyDL, gGiHookshotDL } }, + // GID_OCARINA, OBJECT_GI_OCARINA + { GetItem_DrawOpa0Xlu1, { gGiOcarinaOfTimeDL, gGiOcarinaOfTimeHolesDL } }, + // GID_MILK, OBJECT_GI_MILK + { GetItem_DrawOpa0Xlu1, { gGiMilkBottleContentsDL, gGiMilkBottleGlassDL } }, + // GID_MASK_KEATON, OBJECT_GI_KI_TAN_MASK + { GetItem_DrawOpa0Xlu1, { gGiKeatonMaskDL, gGiKeatonMaskEyesDL } }, + // GID_TINGLE_MAP, OBJECT_GI_FIELDMAP + { GetItem_DrawOpa01, { gGiTingleMapDL, gGiTingleMapEmptyDL } }, + // GID_BOW, OBJECT_GI_BOW + { GetItem_DrawOpa01, { gGiBowHandleDL, gGiBowStringDL } }, + // GID_LENS, OBJECT_GI_GLASSES + { GetItem_DrawOpa0Xlu1, { gGiLensDL, gGiLensGlassDL } }, + // GID_POTION_GREEN, OBJECT_GI_LIQUID + { GetItem_DrawPotion, + { gGiPotionContainerPotDL, gGiPotionContainerGreenPotColorDL, gGiPotionContainerGreenLiquidColorDL, + gGiPotionContainerLiquidDL, gGiPotionContainerGreenPatternColorDL, gGiPotionContainerPatternDL } }, + // GID_POTION_RED, OBJECT_GI_LIQUID + { GetItem_DrawPotion, + { gGiPotionContainerPotDL, gGiPotionContainerRedPotColorDL, gGiPotionContainerRedLiquidColorDL, + gGiPotionContainerLiquidDL, gGiPotionContainerRedPatternColorDL, gGiPotionContainerPatternDL } }, + // GID_POTION_BLUE, OBJECT_GI_LIQUID + { GetItem_DrawPotion, + { gGiPotionContainerPotDL, gGiPotionContainerBluePotColorDL, gGiPotionContainerBlueLiquidColorDL, + gGiPotionContainerLiquidDL, gGiPotionContainerBluePatternColorDL, gGiPotionContainerPatternDL } }, + // GID_SHIELD_MIRROR, OBJECT_GI_SHIELD_3 + { GetItem_DrawOpa0Xlu1, { gGiMirrorShieldEmptyDL, gGiMirrorShieldDL } }, + // GID_MAGIC_BEANS, OBJECT_GI_BEAN + { GetItem_DrawOpa0, { gGiBeanDL } }, + // GID_FISH, OBJECT_GI_FISH + { GetItem_DrawFish, { gGiFishContainerDL } }, + // GID_LETTER_MAMA, OBJECT_GI_RESERVE_B_01 + { GetItem_DrawOpa0Xlu1, { gGiLetterToMamaEnvelopeLetterDL, gGiLetterToMamaInscriptionsDL } }, + // GID_37 + { GetItem_DrawOpa0, { NULL } }, + // GID_SWORD_BGS, OBJECT_GI_LONGSWORD + { GetItem_DrawGoronSword, { gGiBiggoronSwordDL } }, + // GID_MASK_SUN, OBJECT_GI_MSSA + { GetItem_DrawOpa0Xlu1, { gGiSunMaskFaceDL, gGiSunMaskEyesSidePatternsDL } }, + // GID_MASK_BLAST, OBJECT_GI_MASK21 + { GetItem_DrawOpa0Xlu1, { gGiBlastMaskEmptyDL, gGiBlastMaskDL } }, + // GID_FAIRY, OBJECT_GI_BOTTLE_04 + { GetItem_DrawFairyContainer, + { gGiFairyBottleEmptyDL, gGiFairyBottleGlassCorkDL, gGiFairyBottleContentsDL, &gGiFairyBottleBillboardRotMtx } }, + // GID_MASK_SCENTS, OBJECT_GI_MASK22 + { GetItem_DrawOpa01, { gGiMaskOfScentsFaceDL, gGiMaskOfScentsTeethDL } }, + // GID_MASK_CAPTAIN, OBJECT_GI_MASK18 + { GetItem_DrawOpa01, { gGiCaptainsHatBodyDL, gGiCaptainsHatFaceDL } }, + // GID_MASK_BUNNY, OBJECT_GI_RABIT_MASK + { GetItem_DrawOpa0Xlu1, { gGiBunnyHoodDL, gGiBunnyHoodEyesDL } }, + // GID_MASK_TRUTH, OBJECT_GI_TRUTH_MASK + { GetItem_DrawOpa0Xlu1, { gGiMaskOfTruthDL, gGiMaskOfTruthAccentsDL } }, + // GID_DEED_SWAMP, OBJECT_GI_RESERVE01 + { GetItem_DrawOpa01, { gGiTitleDeedEmptyDL, gGiTitleDeedSwampColorDL } }, + // GID_DEED_MOUNTAIN, OBJECT_GI_RESERVE01 + { GetItem_DrawOpa01, { gGiTitleDeedEmptyDL, gGiTitleDeedMountainColorDL } }, + // GID_RUPEE_HUGE, OBJECT_GI_RUPY + { GetItem_DrawRupee, { gGiRupeeInnerDL, gGiGoldRupeeInnerColorDL, gGiRupeeOuterDL, gGiGoldRupeeOuterColorDL } }, + // GID_DEED_OCEAN, OBJECT_GI_RESERVE01 + { GetItem_DrawOpa01, { gGiTitleDeedEmptyDL, gGiTitleDeedOceanColorDL } }, + // GID_MASK_GORON, OBJECT_GI_GOLONMASK + { GetItem_DrawOpa0Xlu1, { gGiGoronMaskEmptyDL, gGiGoronMaskDL } }, + // GID_MASK_ZORA, OBJECT_GI_ZORAMASK + { GetItem_DrawOpa01, { gGiZoraMaskEmptyDL, gGiZoraMaskDL } }, + // GID_46 + { GetItem_DrawBombchu, { NULL } }, + // GID_ARROW_FIRE, OBJECT_GI_M_ARROW + { GetItem_DrawMagicArrow, { gGiMagicArrowAmmoDL, gGiMagicArrowFireColorDL, gGiMagicArrowGlowDL } }, + // GID_ARROW_ICE, OBJECT_GI_M_ARROW + { GetItem_DrawMagicArrow, { gGiMagicArrowAmmoDL, gGiMagicArrowIceColorDL, gGiMagicArrowGlowDL } }, + // GID_ARROW_LIGHT, OBJECT_GI_M_ARROW + { GetItem_DrawMagicArrow, { gGiMagicArrowAmmoDL, gGiMagicArrowLightColorDL, gGiMagicArrowGlowDL } }, + // GID_SKULL_TOKEN, OBJECT_GI_SUTARU + { GetItem_DrawSkullToken, { gGiSkulltulaTokenDL, gGiSkulltulaTokenFlameDL } }, + // GID_BUG, OBJECT_GI_INSECT + { GetItem_DrawOpa0Xlu1, { gGiBugContainerContentsDL, gGiBugContainerGlassDL } }, + // GID_4C + { GetItem_DrawOpa0Xlu1, { NULL } }, + // GID_POE, OBJECT_GI_GHOST + { GetItem_DrawPoes, + { gGiPoeContainerLidDL, gGiPoeContainerGlassDL, gGiPoeContainerContentsDL, gGiPoeContainerPoeColorDL } }, + // GID_FAIRY_2, OBJECT_GI_SOUL + { GetItem_DrawFairyBottle, { gGiFairyContainerBaseCapDL, gGiFairyContainerGlassDL, gGiFairyContainerContentsDL } }, + // GID_RUPEE_GREEN, OBJECT_GI_RUPY + { GetItem_DrawSmallRupee, + { gGiRupeeInnerDL, gGiGreenRupeeInnerColorDL, gGiRupeeOuterDL, gGiGreenRupeeOuterColorDL } }, + // GID_RUPEE_BLUE, OBJECT_GI_RUPY + { GetItem_DrawSmallRupee, + { gGiRupeeInnerDL, gGiBlueRupeeInnerColorDL, gGiRupeeOuterDL, gGiBlueRupeeOuterColorDL } }, + // GID_RUPEE_RED, OBJECT_GI_RUPY + { GetItem_DrawSmallRupee, { gGiRupeeInnerDL, gGiRedRupeeInnerColorDL, gGiRupeeOuterDL, gGiRedRupeeOuterColorDL } }, + // GID_BIG_POE, OBJECT_GI_GHOST + { GetItem_DrawPoes, + { gGiPoeContainerLidDL, gGiPoeContainerGlassDL, gGiPoeContainerContentsDL, gGiPoeContainerBigPoeColorDL } }, + // GID_RUPEE_PURPLE, OBJECT_GI_RUPY + { GetItem_DrawRupee, { gGiRupeeInnerDL, gGiPurpleRupeeInnerColorDL, gGiRupeeOuterDL, gGiPurpleRupeeOuterColorDL } }, + // GID_RUPEE_SILVER, OBJECT_GI_RUPY + { GetItem_DrawRupee, { gGiRupeeInnerDL, gGiSilverRupeeInnerColorDL, gGiRupeeOuterDL, gGiSilverRupeeOuterColorDL } }, + // GID_SWORD_KOKIRI, OBJECT_GI_SWORD_1 + { GetItem_DrawOpa01, { gGiKokiriSwordBladeHiltDL, gGiKokiriSwordGuardDL } }, + // GID_SKULL_TOKEN_2, OBJECT_ST + { GetItem_DrawSkullToken, { gSkulltulaTokenDL, gSkulltulaTokenFlameDL } }, + // GID_57, OBJECT_GI_BOTTLE_RED + { GetItem_DrawOpa0Xlu1, { gGiRedPotionBottleEmptyDL, gGiRedPotionBottleDL } }, + // GID_ZORA_EGG, OBJECT_GI_BOTTLE_15 + { GetItem_DrawOpa0Xlu1, { gGiZoraEggBottleContentsDL, gGiZoraEggBottleGlassAndCorkDL } }, + // GID_MOON_TEAR, OBJECT_GI_RESERVE00 + { GetItem_DrawMoonsTear, { gGiMoonsTearItemDL, gGiMoonsTearGlowDL } }, + // GID_DEED_LAND, OBJECT_GI_RESERVE01 + { GetItem_DrawOpa01, { gGiTitleDeedEmptyDL, gGiTitleDeedLandColorDL } }, + // GID_MASK_DEKU, OBJECT_GI_NUTSMASK + { GetItem_DrawOpa0Xlu1, { gGiDekuMaskEmptyDL, gGiDekuMaskDL } }, + // GID_REMAINS_ODOLWA, OBJECT_BSMASK + { GetItem_DrawRemains, { gRemainsOdolwaDL, gRemainsOdolwaDL } }, + // GID_POWDER_KEG, OBJECT_GI_BIGBOMB + { GetItem_DrawOpa0Xlu1, { gGiPowderKegBarrelDL, gGiPowderKegGoronSkullAndFuseDL } }, + // GID_GOLD_DUST, OBJECT_GI_GOLD_DUST + { GetItem_DrawOpa01, { gGiGoldDustPowderDL, gGiGoldDustPowderEmptyDL } }, + // GID_SEAHORSE, OBJECT_GI_BOTTLE_16 + { GetItem_DrawOpa0Xlu1, { gGiSeahorseBottleEmptyDL, gGiSeahorseBottleGlassAndCorkDL } }, + // GID_60, OBJECT_GI_BOTTLE_22 + { GetItem_DrawOpa0Xlu1, { gGiHylianLoachBottleContentsDL, gGiHylianLoachBottleGlassCorkWaterDL } }, + // GID_HYLIAN_LOACH, OBJECT_GI_LOACH + { GetItem_DrawOpa0Xlu1, { gGiHylianLoachEmptyDL, gGiHylianLoachDL } }, + // GID_SEAHORSE_CAUGHT, OBJECT_GI_SEAHORSE + { GetItem_DrawSeahorse, { gGiSeahorseEmptyDL, gGiSeahorseBodyDL, gGiSeahorseGlowDL, &gGiSeahorseBillboardRotMtx } }, + // GID_REMAINS_GOHT, OBJECT_BSMASK + { GetItem_DrawRemains, { gRemainsGohtDL, gRemainsGohtDL } }, + // GID_REMAINS_GYORG, OBJECT_BSMASK + { GetItem_DrawRemains, { gRemainsGyorgDL, gRemainsGyorgDL } }, + // GID_REMAINS_TWINMOLD, OBJECT_BSMASK + { GetItem_DrawRemains, { gRemainsTwinmoldDL, gRemainsTwinmoldDL } }, + // GID_SWORD_RAZOR, OBJECT_GI_SWORD_2 + { GetItem_DrawOpa01, { gGiRazorSwordDL, gGiRazorSwordEmptyDL } }, + // GID_SWORD_GILDED, OBJECT_GI_SWORD_3 + { GetItem_DrawOpa01, { gGiGildedSwordDL, gGiGildedSwordEmptyDL } }, + // GID_SWORD_GREAT_FAIRY, OBJECT_GI_SWORD_4 + { GetItem_DrawOpa0Xlu1, { gGiGreatFairySwordBladeDL, gGiGreatFairySwordHiltEmblemDL } }, + // GID_MASK_GARO, OBJECT_GI_MASK09 + { GetItem_DrawOpa0Xlu1, { gGiGarosMaskCloakDL, gGiGarosMaskFaceDL } }, + // GID_MASK_GREAT_FAIRY, OBJECT_GI_MASK14 + { GetItem_DrawOpa0Xlu1, { gGiGreatFairyMaskFaceDL, gGiGreatFairyMaskLeavesDL } }, + // GID_MASK_GIBDO, OBJECT_GI_MASK15 + { GetItem_DrawOpa0Xlu1, { gGiGibdoMaskEmptyDL, gGiGibdoMaskDL } }, + // GID_ROOM_KEY, OBJECT_GI_RESERVE_B_00 + { GetItem_DrawOpa0Xlu1, { gGiRoomKeyEmptyDL, gGiRoomKeyDL } }, + // GID_LETTER_TO_KAFEI, OBJECT_GI_RESERVE_C_00 + { GetItem_DrawOpa0Xlu1, { gGiLetterToKafeiEnvelopeLetterDL, gGiLetterToKafeiInscriptionsDL } }, + // GID_PENDANT_OF_MEMORIES, OBJECT_GI_RESERVE_C_01 + { GetItem_DrawOpa0Xlu1, { gGiPendantOfMemoriesEmptyDL, gGiPendantOfMemoriesDL } }, + // GID_MUSHROOM, OBJECT_GI_MAGICMUSHROOM + { GetItem_DrawOpa0Xlu1, { gGiMagicMushroomEmptyDL, gGiMagicMushroomDL } }, + // GID_MASK_ROMANI, OBJECT_GI_MASK10 + { GetItem_DrawOpa0Xlu1, { gGiRomaniMaskCapDL, gGiRomaniMaskNoseEyeDL } }, + // GID_MASK_POSTMAN, OBJECT_GI_MASK12 + { GetItem_DrawOpa0Xlu1, { gGiPostmanHatCapDL, gGiPostmanHatBunnyLogoDL } }, + // GID_MASK_GIANT, OBJECT_GI_MASK23 + { GetItem_DrawOpa01, { gGiGiantMaskEmptyDL, gGiGiantMaskDL } }, + // GID_CHATEAU, OBJECT_GI_BOTTLE_21 + { GetItem_DrawOpa0Xlu1, { gGiChateauRomaniBottleEmptyDL, gGiChateauRomaniBottleDL } }, + // GID_PICTO_BOX, OBJECT_GI_CAMERA + { GetItem_DrawOpa0Xlu1, { gGiPictoBoxFrameDL, gGiPictoBoxBodyAndLensDL } }, + // GID_MASK_FIERCE_DEITY, OBJECT_GI_MASK03 + { GetItem_DrawOpa01, { gGiFierceDeityMaskFaceDL, gGiFierceDeityMaskHairAndHatDL } }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EE5FC.s") +/** + * Draw "Get Item" Model + * Calls the corresponding draw function for the given draw ID + */ +void GetItem_Draw(PlayState* play, s16 drawId) { + sDrawItemTable[drawId].drawFunc(play, drawId); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EE7D8.s") +void GetItem_DrawBombchu(PlayState* play, s16 drawId) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EE940.s") + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EEA48.s") + func_8012C214(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EEC18.s") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EED20.s") + CLOSE_DISPS(play->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EEE34.s") +void GetItem_DrawPoes(PlayState* play, s16 drawId) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EEF4C.s") + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF054.s") + func_8012C28C(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF0F0.s") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF1F4.s") + func_8012C2DC(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF2AC.s") + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF364.s") + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0, 16, + 32, 1, play->state.frames, -(play->state.frames * 6), 16, 32)); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF4D4.s") + Matrix_Push(); + Matrix_ReplaceRotation(&play->billboardMtxF); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF65C.s") + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[3]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF780.s") + Matrix_Pop(); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF89C.s") + CLOSE_DISPS(play->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EF984.s") +void GetItem_DrawFairyBottle(PlayState* play, s16 drawId) { + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EFAB8.s") + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EFBFC.s") + func_8012C28C(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_draw/func_800EFD44.s") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 0, 32, + 32, 1, play->state.frames, -(play->state.frames * 6), 32, 32)); + + Matrix_Push(); + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawSkullToken(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, -(play->state.frames * 5), + 32, 32, 1, play->state.frames * 0, play->state.frames * 0, 32, 64)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawCompass(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 5); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawPotion(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -play->state.frames, play->state.frames, 32, 32, 1, + -play->state.frames, play->state.frames, 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[2]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[3]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[4]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[5]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawGoronSword(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 1, play->state.frames * 0, 32, + 32, 1, play->state.frames * 0, play->state.frames * 0, 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawDekuNuts(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 6, play->state.frames * 6, 32, + 32, 1, play->state.frames * 6, play->state.frames * 6, 32, 32)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, -(play->state.frames * 3), + 32, 32, 1, play->state.frames * 0, -(play->state.frames * 2), 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[0]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawFish(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, play->state.frames * 0, play->state.frames * 1, 32, + 32, 1, play->state.frames * 0, play->state.frames * 1, 32, 32)); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[0]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draw `drawResources[0]` as Opa + */ +void GetItem_DrawOpa0(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draw `drawResources[0]` as Opa and `drawResources[1]` as Xlu + */ +void GetItem_DrawOpa0Xlu1(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draw `drawResources[0]` and `drawResources[1]` as Opa + */ +void GetItem_DrawOpa01(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draw `drawResources[0]` and `drawResources[1]` as Xlu + */ +void GetItem_DrawXlu01(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[0]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawSeahorse(PlayState* play, s16 drawId) { + s32 pad; + MtxF mtx; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + Matrix_MtxToMtxF(Lib_SegmentedToVirtual(sDrawItemTable[drawId].drawResources[3]), &mtx); + Matrix_Mult(&mtx, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawFairyContainer(PlayState* play, s16 drawId) { + s32 pad; + MtxF mtx; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gGiFairyBottleTexAnim)); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + Matrix_MtxToMtxF(Lib_SegmentedToVirtual(sDrawItemTable[drawId].drawResources[3]), &mtx); + Matrix_Mult(&mtx, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawMoonsTear(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gGiMoonsTearTexAnim)); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawMagicArrow(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawUpgrades(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[2]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[3]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawRupee(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[3]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + func_8012C2DC(play->state.gfxCtx); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[3]); + gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].drawResources[2]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawWallet(PlayState* play, s16 drawId) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[1]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[2]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[3]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[4]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[5]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[6]); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[7]); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void GetItem_DrawRemains(PlayState* play, s16 drawId) { + s32 pad; + s8 objectIndex; + + OPEN_DISPS(play->state.gfxCtx); + + objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_BSMASK); + + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIndex].segment); + + func_8012C28C(play->state.gfxCtx); + Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]); + + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 60a15c3cc..b6a5c46fa 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -335,7 +335,7 @@ void EffectSsGSpk_SpawnAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* v initParams.actor = actor; initParams.scale = scale; initParams.scaleStep = scaleStep; - initParams.updateMode = 0; + initParams.updateMode = GSPK_UPDATEMODE_NORMAL; EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams); } @@ -353,7 +353,7 @@ void EffectSsGSpk_SpawnNoAccel(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* initParams.actor = actor; initParams.scale = scale; initParams.scaleStep = scaleStep; - initParams.updateMode = 1; + initParams.updateMode = GSPK_UPDATEMODE_NO_ACCEL; EffectSs_Spawn(play, EFFECT_SS_G_SPK, 128, &initParams); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 10c33090c..0637f6392 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -1,6 +1,7 @@ #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_gi_hearts/object_gi_hearts.h" +#include "overlays/actors/ovl_En_Elforg/z_en_elforg.h" #define FLAGS 0x00000000 @@ -78,14 +79,14 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { if (this->actor.params == ITEM00_HEART_PIECE) { sp30 = 0; this->collectibleFlag = 0; - this->actor.params = ITEM00_HEART; + this->actor.params = ITEM00_RECOVERY_HEART; } else { Actor_MarkForDeath(&this->actor); return; } } if (this->actor.params == ITEM00_3_HEARTS) { - this->actor.params = ITEM00_HEART; + this->actor.params = ITEM00_RECOVERY_HEART; } Actor_ProcessInitChain(&this->actor, sInitChain); @@ -117,7 +118,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { sp30 = -1; } break; - case ITEM00_HEART: + case ITEM00_RECOVERY_HEART: this->actor.home.rot.z = randPlusMinusPoint5Scaled(65535.0f); shadowOffset = 430.0f; Actor_SetScale(&this->actor, 0.02f); @@ -183,7 +184,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, shadowOffset, ActorShadow_DrawCircle, shadowScale); this->actor.shape.shadowAlpha = 180; this->actor.focus.pos = this->actor.world.pos; - this->unk14A = GI_NONE; + this->getItemId = GI_NONE; if (sp30 < 0) { this->actionFunc = EnItem00_WaitForHeartObject; @@ -219,8 +220,8 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { case ITEM00_RUPEE_HUGE: Item_Give(play, ITEM_RUPEE_HUGE); break; - case ITEM00_HEART: - Item_Give(play, ITEM_HEART); + case ITEM00_RECOVERY_HEART: + Item_Give(play, ITEM_RECOVERY_HEART); break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: @@ -286,7 +287,8 @@ void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play) { } void func_800A640C(EnItem00* this, PlayState* play) { - if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->unk152 < 0)) || + if ((this->actor.params <= ITEM00_RUPEE_RED) || + ((this->actor.params == ITEM00_RECOVERY_HEART) && (this->unk152 < 0)) || (this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) { this->actor.shape.rot.y = this->actor.shape.rot.y + 960; } else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) && @@ -366,7 +368,7 @@ void func_800A6780(EnItem00* this, PlayState* play) { this->unk152++; - if (this->actor.params == ITEM00_HEART) { + if (this->actor.params == ITEM00_RECOVERY_HEART) { if (this->actor.velocity.y < 0.0f) { this->actor.speedXZ = 0.0f; this->actor.gravity = -0.4f; @@ -416,12 +418,12 @@ void func_800A6780(EnItem00* this, PlayState* play) { void func_800A6A40(EnItem00* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->unk14A != GI_NONE) { + if (this->getItemId != GI_NONE) { if (Actor_HasParent(&this->actor, play) == 0) { - Actor_PickUp(&this->actor, play, this->unk14A, 50.0f, 80.0f); + Actor_PickUp(&this->actor, play, this->getItemId, 50.0f, 80.0f); this->unk152++; } else { - this->unk14A = GI_NONE; + this->getItemId = GI_NONE; } } @@ -434,7 +436,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) { if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y = this->actor.shape.rot.y + 960; - } else if (this->actor.params == ITEM00_HEART) { + } else if (this->actor.params == ITEM00_RECOVERY_HEART) { this->actor.shape.rot.y = 0; } @@ -532,8 +534,8 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { case ITEM00_NUTS_10: getItemId = GI_NUTS_10; break; - case ITEM00_HEART: - Item_Give(play, ITEM_HEART); + case ITEM00_RECOVERY_HEART: + Item_Give(play, ITEM_RECOVERY_HEART); break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: @@ -628,7 +630,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, this->unk154); - this->unk14A = GI_NONE; + this->getItemId = GI_NONE; this->actionFunc = func_800A6A40; } @@ -656,7 +658,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { case ITEM00_HEART_CONTAINER: EnItem00_DrawHeartContainer(this, play); break; - case ITEM00_HEART: + case ITEM00_RECOVERY_HEART: if (this->unk152 < 0) { if (this->unk152 == -1) { s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART); @@ -667,7 +669,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { } } else { Matrix_Scale(16.0f, 16.0f, 16.0f, MTXMODE_APPLY); - GetItem_Draw(play, 8); + GetItem_Draw(play, GID_RECOVERY_HEART); } break; } @@ -792,8 +794,8 @@ void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001290); - gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001470); + gSPDisplayList(POLY_XLU_DISP++, gGiHeartBorderDL); + gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -825,7 +827,7 @@ s16 func_800A7650(s16 dropId) { return ITEM00_NO_DROP; } - if (dropId == ITEM00_HEART) { + if (dropId == ITEM00_RECOVERY_HEART) { if (((void)0, gSaveContext.save.playerData.healthCapacity) == ((void)0, gSaveContext.save.playerData.health)) { return ITEM00_RUPEE_GREEN; } @@ -850,7 +852,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { if (paramFF == ITEM00_3_HEARTS) { for (i = 0; i < 3; i++) { - spawnedActor = Item_DropCollectible(play, spawnPos, param7F00 | ITEM00_HEART | param8000); + spawnedActor = Item_DropCollectible(play, spawnPos, param7F00 | ITEM00_RECOVERY_HEART | param8000); } } else if (paramFF == ITEM00_MUSHROOM_CLOUD) { param7F00 >>= 8; @@ -867,8 +869,9 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) { SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); } } else { - spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); + spawnedActor = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, + 0, STRAY_FAIRY_PARAMS(((param7F00 >> 8) & 0x7F), 0, STRAY_FAIRY_TYPE_COLLECTIBLE)); if (param20000 == 0) { if (!Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F)) { SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); @@ -924,8 +927,9 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) << 9) & 0xFE00) | 0x102); } else { - spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, - spawnPos->z, 0, 0, 0, ((((param7F00 >> 8) & 0x7F) & 0x7F) << 9) | 7); + spawnedActor = + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, + 0, STRAY_FAIRY_PARAMS(((param7F00 >> 8) & 0x7F), 0, STRAY_FAIRY_TYPE_COLLECTIBLE)); } if (Flags_GetCollectible(play, (param7F00 >> 8) & 0x7F) == 0) { SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); @@ -955,61 +959,61 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) { } u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = { - ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, - ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_HEART, - ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, - ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, - ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_MASK, - ITEM00_MASK, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_FLEXIBLE, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, - ITEM00_HEART, ITEM00_HEART, ITEM00_HEART, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, - ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_RUPEE_BLUE, - ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, - ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, - ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, - ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, - ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, - ITEM00_ARROWS_30, ITEM00_ARROWS_30, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, - ITEM00_MAGIC_LARGE, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_BOMBS_A, - ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, - ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, - ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, - ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, - ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, - ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NUTS_1, ITEM00_NUTS_1, - ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_STICK, - ITEM00_STICK, ITEM00_NO_DROP, ITEM00_HEART, ITEM00_HEART, ITEM00_FLEXIBLE, - ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, - ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_30, ITEM00_BOMBS_A, ITEM00_NO_DROP, - ITEM00_STICK, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_HEART, ITEM00_HEART, - ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_HEART, ITEM00_HEART, ITEM00_MAGIC_SMALL, - ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, + ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_RECOVERY_HEART, + ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_NO_DROP, + ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, ITEM00_MASK, ITEM00_MASK, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_MAGIC_SMALL, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_FLEXIBLE, ITEM00_MASK, + ITEM00_MASK, ITEM00_MASK, ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_FLEXIBLE, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_GREEN, + ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_RUPEE_BLUE, + ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, + ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, + ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, ITEM00_RUPEE_RED, + ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, + ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, + ITEM00_ARROWS_30, ITEM00_ARROWS_30, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, + ITEM00_MAGIC_LARGE, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_BOMBS_A, + ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_BOMBS_A, + ITEM00_BOMBS_A, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, + ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, + ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, + ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, + ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_LARGE, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NUTS_1, ITEM00_NUTS_1, + ITEM00_NO_DROP, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_STICK, + ITEM00_STICK, ITEM00_NO_DROP, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_FLEXIBLE, + ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_NO_DROP, + ITEM00_ARROWS_10, ITEM00_ARROWS_10, ITEM00_ARROWS_30, ITEM00_BOMBS_A, ITEM00_NO_DROP, + ITEM00_STICK, ITEM00_MAGIC_SMALL, ITEM00_MAGIC_LARGE, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, + ITEM00_FLEXIBLE, ITEM00_RUPEE_GREEN, ITEM00_RECOVERY_HEART, ITEM00_RECOVERY_HEART, ITEM00_MAGIC_SMALL, + ITEM00_MASK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_NO_DROP, ITEM00_NO_DROP, }; u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER] = { @@ -1050,7 +1054,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP dropId = ITEM00_ARROWS_10; break; case PLAYER_FORM_ZORA: - dropId = ITEM00_HEART; + dropId = ITEM00_RECOVERY_HEART; break; case PLAYER_FORM_GORON: dropId = ITEM00_MAGIC_SMALL; @@ -1071,7 +1075,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP dropQuantity = 1; } else if (fromActor->dropFlag & 2) { params = 0x10; - dropId = ITEM00_HEART; + dropId = ITEM00_RECOVERY_HEART; dropQuantity = 1; } else if (fromActor->dropFlag & 0x20) { dropId = ITEM00_RUPEE_PURPLE; @@ -1090,11 +1094,11 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP if (gSaveContext.save.playerData.health <= 0x30) { params = 0x10; - dropId = ITEM00_HEART; + dropId = ITEM00_RECOVERY_HEART; dropQuantity = 3; } else if (gSaveContext.save.playerData.health <= 0x50) { params = 0x10; - dropId = ITEM00_HEART; + dropId = ITEM00_RECOVERY_HEART; dropQuantity = 1; } else if ((gSaveContext.save.playerData.magicLevel != 0) && (gSaveContext.save.playerData.magic == 0)) { params = 0xD0; @@ -1156,13 +1160,13 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP } s32 D_801AE194[32] = { - ITEM00_NO_DROP, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_RUPEE_RED, - ITEM00_RUPEE_PURPLE, ITEM00_NO_DROP, ITEM00_RUPEE_HUGE, ITEM00_COMPASS, ITEM00_MUSHROOM_CLOUD, - ITEM00_HEART, ITEM00_3_HEARTS, ITEM00_HEART_PIECE, ITEM00_HEART_CONTAINER, ITEM00_MAGIC_SMALL, - ITEM00_MAGIC_LARGE, ITEM00_FLEXIBLE, ITEM00_BIG_FAIRY, ITEM00_NO_DROP, ITEM00_NUTS_10, - ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_STICK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, - ITEM00_ARROWS_10, ITEM00_ARROWS_30, + ITEM00_NO_DROP, ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_NO_DROP, ITEM00_RUPEE_RED, + ITEM00_RUPEE_PURPLE, ITEM00_NO_DROP, ITEM00_RUPEE_HUGE, ITEM00_COMPASS, ITEM00_MUSHROOM_CLOUD, + ITEM00_RECOVERY_HEART, ITEM00_3_HEARTS, ITEM00_HEART_PIECE, ITEM00_HEART_CONTAINER, ITEM00_MAGIC_SMALL, + ITEM00_MAGIC_LARGE, ITEM00_FLEXIBLE, ITEM00_BIG_FAIRY, ITEM00_NO_DROP, ITEM00_NUTS_10, + ITEM00_NO_DROP, ITEM00_BOMBS_A, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_STICK, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, ITEM00_NO_DROP, + ITEM00_ARROWS_10, ITEM00_ARROWS_30, }; s32 func_800A8150(s32 index) { diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 1c61431b9..7128368ac 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -42,7 +42,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F2178.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentCamera.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentSubCamId.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F21CC.s") diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index e1fb63fa1..f77fc5158 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -187,7 +187,7 @@ void FireObj_UpdateLight(PlayState* play, FireObjLight* light, FireObj* fire) { if (fire->state == FIRE_STATE_3) { Lights_PointSetColorAndRadius(&light->lightInfo, 0, 0, 0, -1); } else { - radius = ((fire->yScale * 140.0f * fire->sizeInv) + 60.0f); + radius = (fire->yScale * 140.0f * fire->sizeInv) + 60.0f; Lights_PointGlowSetInfo(&light->lightInfo, fire->position.x, (fire->position.y + (fire->yScale * 6500.0f)), fire->position.z, diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 26a17a84a..2df62a054 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -15,7 +15,7 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), - GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)), + GAMESTATE_OVERLAY(select, MapSelect_Init, MapSelect_Destroy, sizeof(MapSelectState)), GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)), GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Fini, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 946fb0faf..50705f6f3 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -72,7 +72,7 @@ void GameOver_Update(PlayState* play) { if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; } - gSaveContext.nextTransition = 2; + gSaveContext.nextTransitionType = TRANS_TYPE_02; gSaveContext.save.playerData.health = 0x30; gameOverCtx->state++; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index c40154bc7..d7905e4dd 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); @@ -33,7 +34,7 @@ void KaleidoScopeCall_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { if (pauseCtx->state == 1 || pauseCtx->state == 19) { if (ShrinkWindow_GetLetterboxMagnitude() == 0) { R_PAUSE_MENU_MODE = 1; @@ -62,7 +63,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeUpdateFunc(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { KaleidoManager_ClearOvl(kaleidoScopeOvl); KaleidoScopeCall_LoadPlayer(); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 39ab17ca4..9b8aaac36 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -1,8 +1,8 @@ #include "global.h" #include "z64rumble.h" -#include "overlays/gamestates/ovl_file_choose/z_file_choose.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" -s16 D_801BDB00[] = { PAUSE_1, PAUSE_2, PAUSE_3, PAUSE_0 }; +s16 D_801BDB00[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_MASK, PAUSE_ITEM }; f32 sKaleidoSetupEyeX[] = { -64.0f, 0.0f, 64.0f, 0.0f }; f32 sKaleidoSetupEyeZ[] = { 0.0f, -64.0f, 0.0f, 64.0f }; @@ -70,8 +70,9 @@ void KaleidoSetup_Update(PlayState* play) { if (msgCtx && msgCtx) {} } - if ((pauseCtx->state == 0) && (pauseCtx->debugState == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { - if ((play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if ((pauseCtx->state == 0) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) { if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && @@ -109,7 +110,7 @@ void KaleidoSetup_Init(PlayState* play) { bzero(pauseCtx, sizeof(PauseContext)); - pauseCtx->pageIndex = PAUSE_0; + pauseCtx->pageIndex = PAUSE_ITEM; pauseCtx->unk_21C = 160.0f; pauseCtx->unk_218 = 160.0f; @@ -120,18 +121,18 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_20C = 936.0f; pauseCtx->unk_220 = -314.0f; - pauseCtx->unk_238[PAUSE_1] = XREG(94) + 3; + pauseCtx->unk_238[PAUSE_MAP] = XREG(94) + 3; pauseCtx->unk_258 = 11; pauseCtx->unk_25A = 0; - pauseCtx->cursorItem[PAUSE_0] = 999; - pauseCtx->cursorItem[PAUSE_1] = XREG(94) + 3; - pauseCtx->cursorItem[PAUSE_2] = 999; - pauseCtx->cursorItem[PAUSE_3] = 999; + pauseCtx->cursorItem[PAUSE_ITEM] = 999; + pauseCtx->cursorItem[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorItem[PAUSE_QUEST] = 999; + pauseCtx->cursorItem[PAUSE_MASK] = 999; - pauseCtx->unk_268[PAUSE_0] = 0; - pauseCtx->unk_268[PAUSE_1] = XREG(94) + 3; + pauseCtx->unk_268[PAUSE_ITEM] = 0; + pauseCtx->unk_268[PAUSE_MAP] = XREG(94) + 3; pauseCtx->unk_284 = 2; pauseCtx->unk_2A0 = -1; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index aaf4bc7d9..03e6c395c 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -651,15 +651,15 @@ void Lib_PlaySfxAtPos(Vec3f* pos, u16 sfxId) { Audio_PlaySfxAtPos(pos, sfxId); } -void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 a, Vec3f* src, Vec3f* dst) { - f32 sp1C; - f32 f0; +void Lib_Vec3f_TranslateAndRotateY(Vec3f* translation, s16 rotAngle, Vec3f* src, Vec3f* dst) { + f32 cos; + f32 sin; - sp1C = Math_CosS(a); - f0 = Math_SinS(a); - dst->x = translation->x + (src->x * sp1C + src->z * f0); + cos = Math_CosS(rotAngle); + sin = Math_SinS(rotAngle); + dst->x = translation->x + (src->x * cos + src->z * sin); dst->y = translation->y + src->y; - dst->z = translation->z + (src->z * sp1C - src->x * f0); + dst->z = translation->z + (src->z * cos - src->x * sin); } void Lib_LerpRGB(Color_RGB8* a, Color_RGB8* b, f32 t, Color_RGB8* dst) { @@ -688,7 +688,7 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed) { start->z = start->z + f2 * diff.z; } else { Math_Vec3f_Copy(start, target); - f0 = 0; + f0 = 0.0f; } return f0; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index cfd8131fe..d2a3a254c 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } }; @@ -398,8 +399,8 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) { if (interfaceCtx->lifeSizeChange <= 0) { interfaceCtx->lifeSizeChange = 0; interfaceCtx->lifeSizeChangeDirection = 0; - if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && - LifeMeter_IsCritical() && !Play_InCsMode(play)) { + if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && + (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && LifeMeter_IsCritical() && !Play_InCsMode(play)) { play_sound(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 9baff91f1..5135a3c41 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -1,4 +1,5 @@ #include "global.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" s16 sMinimapInitPosX = 0; s16 sMinimapInitPosZ = 0; @@ -238,7 +239,7 @@ void Map_Update(PlayState* play) { func_80105B34(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 650287b45..8fac7223e 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,5 +1,6 @@ #include "global.h" #include "message_data_static.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #if 0 @@ -99,8 +100,8 @@ s32 Message_ShouldAdvanceSilent(PlayState* play) { void func_801477B4(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if (play->msgCtx.unk11F10 != 0) { - msgCtx->unk12023 = 2; + if (play->msgCtx.msgLength != 0) { + msgCtx->stateTimer = 2; msgCtx->msgMode = 0x43; msgCtx->unk12020 = 0; play_sound(NA_SE_PL_WALK_GROUND - SFX_FLAG); @@ -229,7 +230,7 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) s32 k = *offset; f32 f = *arg3; - Font_LoadChar(play, 0x838B, k); // 0x838b = ル in JISX0213 + Font_LoadChar(play, 0x838B, k); // 0x838B = ル in JISX0213 k += FONT_CHAR_TEX_SIZE; msgCtx->decodedBuffer.wchar[t] = 0x838B; t += 1; @@ -279,7 +280,7 @@ void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { phi_v0 = 0xA; } else { - phi_v0 = play->pauseCtx.unk_238[4]; + phi_v0 = play->pauseCtx.unk_238[PAUSE_WORLD_MAP]; } temp_s6 = *(&D_801D0250 + (phi_v0 * 2)); phi_s0 = 0; @@ -325,7 +326,7 @@ void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor) { func_80150D08(play, textId); msgCtx->unkActor = Actor; msgCtx->msgMode = 1; - msgCtx->unk12023 = 0; + msgCtx->stateTimer = 0; msgCtx->unk12024 = 0; play->msgCtx.ocarinaMode = 0; } @@ -334,11 +335,11 @@ void func_80151938(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; - msgCtx->unk11F10 = 0; + msgCtx->msgLength = 0; func_80150D08(play, textId); func_80150A84(play); msgCtx->msgMode = 5; - msgCtx->unk12023 = 8; + msgCtx->stateTimer = 8; msgCtx->unk12024 = 0; if (interfaceCtx->unk_222 == 0) { @@ -354,24 +355,24 @@ void func_80151938(PlayState* play, u16 textId) { msgCtx->unk12004 = 0x22; msgCtx->unk12006 = 0x15E; func_80149C18(play); - msgCtx->unk12023 = 1; + msgCtx->stateTimer = 1; } } void func_80151A68(PlayState* play, u16 textId) { MessageContext* msgCtx = &play->msgCtx; - msgCtx->unk11F10 = 0; + msgCtx->msgLength = 0; func_80150D08(play, textId); func_80150A84(play); func_8015B198(play); msgCtx->msgMode = 0x45; msgCtx->unk12024 = 0; msgCtx->unk1203C = msgCtx->unk1203A = msgCtx->unk1201E = 0; - msgCtx->unk12023 = 0x1E; + msgCtx->stateTimer = 30; // Day/Dawn/Night.. Messages - if ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId < 0x1BB7)) { + if ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6)) { XREG(74) = 0x6A; XREG(75) = 0; XREG(77) = 0x58; @@ -438,7 +439,73 @@ void func_80152464(PlayState* play, u16 arg1) { func_80151DA4(play, arg1); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_GetState.s") +/** + * @return u8 A value of the TextState enum representing the current state of the on-screen message + */ +u8 Message_GetState(MessageContext* msgCtx) { + if (msgCtx->msgLength == 0) { + return TEXT_STATE_NONE; + } + + if (msgCtx->msgMode == 0x42) { + if (msgCtx->unk11F14 != 0xFFFF) { + return TEXT_STATE_1; + } + + if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { + return TEXT_STATE_CHOICE; + } + if ((msgCtx->unk12020 == 0x40) || (msgCtx->unk12020 == 0x42) || (msgCtx->unk12020 == 0x30)) { + return TEXT_STATE_5; + } + if (msgCtx->unk12020 == 0x41) { + return TEXT_STATE_16; + } + if ((msgCtx->unk12020 >= 0x50) && (msgCtx->unk12020 < 0x58)) { + return TEXT_STATE_3; + } + if ((msgCtx->unk12020 == 0x60) || (msgCtx->unk12020 == 0x61)) { + return TEXT_STATE_14; + } + if (msgCtx->unk12020 == 0x62) { + return TEXT_STATE_15; + } + if (msgCtx->unk12020 == 0x63) { + return TEXT_STATE_17; + } + if (msgCtx->unk12020 == 0x12) { + return TEXT_STATE_18; + } + return TEXT_STATE_DONE; + } + + if (msgCtx->msgMode == 0x41) { + return TEXT_STATE_10; + } + if (msgCtx->msgMode == 0x1B) { + return TEXT_STATE_7; + } + if ((msgCtx->ocarinaMode == 3) || (msgCtx->msgMode == 0x37)) { + return TEXT_STATE_8; + } + if (msgCtx->msgMode == 0x20) { + return TEXT_STATE_9; + } + if ((msgCtx->msgMode == 0x21) || (msgCtx->msgMode == 0x3A)) { + return TEXT_STATE_11; + } + if (msgCtx->msgMode == 0x3D) { + return TEXT_STATE_12; + } + if (msgCtx->msgMode == 0x40) { + return TEXT_STATE_13; + } + if ((msgCtx->msgMode == 0x43) && (msgCtx->stateTimer == 1) && (msgCtx->unk120B1 == 0)) { + return TEXT_STATE_CLOSING; + } + + return TEXT_STATE_3; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8015268C.s") @@ -522,7 +589,7 @@ void Message_Init(PlayState* play) { func_801586A4(play); play->msgCtx.ocarinaMode = 0; messageCtx->msgMode = 0; - messageCtx->unk11F10 = 0; + messageCtx->msgLength = 0; messageCtx->currentTextId = 0; messageCtx->unk12020 = 0; messageCtx->choiceIndex = 0; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 491427cef..9231ca9b9 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -1,5 +1,6 @@ #include "global.h" #include "message_data_static.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #if 0 @@ -256,7 +257,7 @@ void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decod if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) { currentArea = 10; } else { - currentArea = play->pauseCtx.unk_238[4]; + currentArea = play->pauseCtx.unk_238[PAUSE_WORLD_MAP]; } stringLimit = D_801D07C4[currentArea]; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 7041c5d63..59000f8ec 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2,7 +2,7 @@ #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" #include "misc/story_static/story_static.h" -#include "overlays/gamestates/ovl_file_choose/z_file_choose.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" u8 func_800FE4A8(); s32 func_801234D4(PlayState* play); @@ -1669,7 +1669,7 @@ void func_80110038(PlayState* play) { gSaveContext.curHudMode = HUD_MODE_IDLE; } - if ((play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if (ActorCutscene_GetCurrentIndex() == -1) { Interface_ChangeHudMode(HUD_MODE_ALL); } @@ -1833,7 +1833,7 @@ void func_80110038(PlayState* play) { } else { if (interfaceCtx->restrictions.tradeItems != 0) { if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && - (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_MEMORIES)) || + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { @@ -1844,7 +1844,7 @@ void func_80110038(PlayState* play) { } } else if (interfaceCtx->restrictions.tradeItems == 0) { if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && - (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_MEMORIES)) || + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { @@ -1891,7 +1891,7 @@ void func_80110038(PlayState* play) { if (interfaceCtx->restrictions.all != 0) { if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && - (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_MEMORIES)) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && @@ -1906,7 +1906,7 @@ void func_80110038(PlayState* play) { } } else if (interfaceCtx->restrictions.all == 0) { if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && - (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_MEMORIES)) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && @@ -1928,7 +1928,8 @@ void func_80110038(PlayState* play) { } } - if (phi_t3 && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if (phi_t3 && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF)) { gSaveContext.curHudMode = HUD_MODE_IDLE; Interface_ChangeHudMode(HUD_MODE_ALL); } @@ -2008,10 +2009,11 @@ void func_80111CB4(PlayState* play) { } } - if (play->transitionMode != 0) { + if (play->transitionMode != TRANS_MODE_OFF) { Interface_ChangeHudMode(HUD_MODE_OFF); } else if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entranceIndex == 0x6400) && - (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == 0)) { + (Cutscene_GetSceneSetupIndex(play) != 0) && + (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_ChangeHudMode(HUD_MODE_A_B_MINIMAP); } else if ((gSaveContext.minigameState == 1) && (gSaveContext.eventInf[3] & 0x20)) { Interface_ChangeHudMode(HUD_MODE_B_MINIMAP); @@ -2066,10 +2068,10 @@ void func_80111CB4(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; Interface_ChangeHudMode(HUD_MODE_A_HEARTS_MAGIC_MINIMAP_WITH_DIM_BTN); - if (play->transitionMode != 0) { + if (play->transitionMode != TRANS_MODE_OFF) { Interface_ChangeHudMode(HUD_MODE_OFF); } else if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entranceIndex == 0x6400) && - (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == 0)) { + (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_ChangeHudMode(HUD_MODE_A_B_MINIMAP); } else if (gSaveContext.minigameState == 1) { Interface_ChangeHudMode(HUD_MODE_B_FAST); @@ -2136,13 +2138,13 @@ void func_80111CB4(PlayState* play) { } } } else if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entranceIndex == 0x8E10) && - (play->transitionTrigger == 0) && (play->transitionMode == 0)) { + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; Interface_ChangeHudMode(HUD_MODE_A_B_MINIMAP); - } else if ((gSaveContext.save.entranceIndex == 0xD010) && (play->transitionTrigger == 0) && - (play->transitionMode == 0)) { + } else if ((gSaveContext.save.entranceIndex == 0xD010) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF)) { gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; @@ -2164,7 +2166,7 @@ void func_80111CB4(PlayState* play) { } if (sp28) { gSaveContext.curHudMode = HUD_MODE_IDLE; - if ((play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { Interface_ChangeHudMode(HUD_MODE_ALL); } } @@ -2548,7 +2550,7 @@ u8 Item_Give(PlayState* play, u8 item) { SET_QUEST_ITEM(item - ITEM_REMAINS_ODOLWA + QUEST_REMAINS_ODOWLA); return ITEM_NONE; - } else if (item == ITEM_HEART) { + } else if (item == ITEM_RECOVERY_HEART) { Health_ChangeBy(play, 0x10); return item; @@ -2608,7 +2610,7 @@ u8 Item_Give(PlayState* play, u8 item) { } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_OBABA_DRINK)) || (item == ITEM_CHATEAU_2) || (item == ITEM_MILK) || (item == ITEM_GOLD_DUST_2) || (item == ITEM_HYLIAN_LOACH_2) || - (item == ITEM_SEA_HORSE_CAUGHT)) { + (item == ITEM_SEAHORSE_CAUGHT)) { slot = SLOT(item); if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_MILK_HALF)) { @@ -2624,8 +2626,8 @@ u8 Item_Give(PlayState* play, u8 item) { } else if (item == ITEM_HYLIAN_LOACH_2) { item = ITEM_HYLIAN_LOACH; - } else if (item == ITEM_SEA_HORSE_CAUGHT) { - item = ITEM_SEA_HORSE; + } else if (item == ITEM_SEAHORSE_CAUGHT) { + item = ITEM_SEAHORSE; } slot = SLOT(item); @@ -2665,7 +2667,7 @@ u8 Item_Give(PlayState* play, u8 item) { } else if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_MASK_GIANT)) { temp = INV_CONTENT(item); INV_CONTENT(item) = item; - if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_PENDANT_MEMORIES) && (temp != ITEM_NONE)) { + if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_PENDANT_OF_MEMORIES) && (temp != ITEM_NONE)) { for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { if (temp == GET_CUR_FORM_BTN_ITEM(i)) { SET_CUR_FORM_BTN_ITEM(i, item); @@ -2769,8 +2771,8 @@ u8 Item_CheckObtainabilityImpl(u8 item) { } else if (item == ITEM_HEART_CONTAINER) { return ITEM_NONE; - } else if (item == ITEM_HEART) { - return ITEM_HEART; + } else if (item == ITEM_RECOVERY_HEART) { + return ITEM_RECOVERY_HEART; } else if ((item == ITEM_MAGIC_SMALL) || (item == ITEM_MAGIC_LARGE)) { if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { @@ -2796,7 +2798,7 @@ u8 Item_CheckObtainabilityImpl(u8 item) { } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_OBABA_DRINK)) || (item == ITEM_CHATEAU_2) || (item == ITEM_MILK) || (item == ITEM_GOLD_DUST_2) || (item == ITEM_HYLIAN_LOACH_2) || - (item == ITEM_SEA_HORSE_CAUGHT)) { + (item == ITEM_SEAHORSE_CAUGHT)) { bottleSlot = SLOT(item); if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_MILK_HALF)) { @@ -2812,8 +2814,8 @@ u8 Item_CheckObtainabilityImpl(u8 item) { } else if (item == ITEM_HYLIAN_LOACH_2) { item = ITEM_HYLIAN_LOACH; - } else if (item == ITEM_SEA_HORSE_CAUGHT) { - item = ITEM_SEA_HORSE; + } else if (item == ITEM_SEAHORSE_CAUGHT) { + item = ITEM_SEAHORSE; } bottleSlot = SLOT(item); @@ -2942,7 +2944,7 @@ void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn) { Interface_LoadItemIconImpl(play, btn); - play->pauseCtx.cursorItem[PAUSE_0] = item; + play->pauseCtx.cursorItem[PAUSE_ITEM] = item; gSaveContext.buttonStatus[btn] = BTN_ENABLED; if (item == ITEM_HOT_SPRING_WATER) { @@ -3497,8 +3499,9 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_LENS: // Slowly consume magic while lens is on - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == 0) && - (play->gameOverCtx.state == 0) && (play->transitionTrigger == 0) && (play->transitionMode == 0) && + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { if ((gSaveContext.save.playerData.magic == 0) || @@ -3538,8 +3541,9 @@ void Magic_Update(PlayState* play) { gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA; // fallthrough case MAGIC_STATE_CONSUME_GORON_ZORA: - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == 0) && - (play->gameOverCtx.state == 0) && (play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if (!Play_InCsMode(play)) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { @@ -3559,8 +3563,9 @@ void Magic_Update(PlayState* play) { break; case MAGIC_STATE_CONSUME_GIANTS_MASK: - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (msgCtx->msgMode == 0) && - (play->gameOverCtx.state == 0) && (play->transitionTrigger == 0) && (play->transitionMode == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if (!Play_InCsMode(play)) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { @@ -3728,7 +3733,7 @@ void Interface_DrawItemButtons(PlayState* play) { D_801BF9E8[1] * 2, D_801BF9E8[1] * 2, 0xFF, 0xF0, 0, interfaceCtx->cRightAlpha); if ((pauseCtx->state < 8) || (pauseCtx->state >= 19)) { - if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { + if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { OVERLAY_DISP = func_8010D2D4(OVERLAY_DISP, 0x88, 0x11, 0x16, 0x16, 0x5B6, 0x5B6, 0xFF, 0x82, 0x3C, interfaceCtx->startAlpha); // Start Button Texture, Color & Label @@ -3744,7 +3749,7 @@ void Interface_DrawItemButtons(PlayState* play) { } } - if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && + if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == 0) && (D_801BF884 == 0)) { if (sCUpInvisible == 0) { // C-Up Button Texture, Color & Label (Tatl Text) @@ -4256,7 +4261,7 @@ void Interface_DrawClock(PlayState* play) { D_801BFB30 = 0; } - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { func_8012C654(play->state.gfxCtx); @@ -5173,8 +5178,8 @@ void func_8011C808(PlayState* play) { gSaveContext.save.time = 0x400A; play->nextEntranceIndex = 0x54C0; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; } void func_8011C898(u64 timer, s16* timerArr) { @@ -5228,11 +5233,12 @@ void Interface_DrawTimers(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (play->gameOverCtx.state == 0) && + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == 0) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && - !(player->stateFlags1 & 0x200) && (play->transitionTrigger == 0) && (play->transitionMode == 0) && - !Play_InCsMode(play)) { + !(player->stateFlags1 & 0x200) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { if (D_801BF968) { spD0 = osGetTime(); @@ -5411,7 +5417,7 @@ void Interface_DrawTimers(PlayState* play) { if ((play->sceneNum == SCENE_OKUJOU) && (gSaveContext.sceneSetupIndex == 3)) { play->nextEntranceIndex = 0x5410; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } else { func_8011C808(play); } @@ -5659,10 +5665,12 @@ void Interface_UpdateTimers(PlayState* play) { u64 var3; s32 pad[2]; - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (play->gameOverCtx.state == 0) && + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && - (play->transitionTrigger == 0) && (play->transitionMode == 0) && !Play_InCsMode(play)) { + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !Play_InCsMode(play)) { if (D_801BF96C) { var3 = osGetTime(); @@ -5724,7 +5732,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { func_8012C654(play->state.gfxCtx); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_212 == 8) { // Load Carrot Icon @@ -5891,7 +5899,7 @@ void Interface_Draw(PlayState* play) { gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment); gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); - if (pauseCtx->debugState == 0) { + if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { Interface_InitVertices(play); func_801170B8(interfaceCtx); @@ -6111,7 +6119,7 @@ void Interface_Draw(PlayState* play) { func_80118BA4(play); func_80119030(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if ((interfaceCtx->unk_280 != 0) && (interfaceCtx->unk_280 < 20)) { // Minigame Countdown if (((u32)interfaceCtx->unk_280 % 2) == 0) { @@ -6293,8 +6301,8 @@ void Interface_Update(PlayState* play) { s16 risingAlpha; u16 action; - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { - if (play->gameOverCtx.state == 0) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { func_80111CB4(play); } } @@ -6467,7 +6475,7 @@ void Interface_Update(PlayState* play) { } } - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (interfaceCtx->isMinigamePerfect) { if (interfaceCtx->minigameRewardType == 1) { func_8011B5C0(play); @@ -6480,7 +6488,7 @@ void Interface_Update(PlayState* play) { } // Update Minigame State - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (interfaceCtx->unk_280) { switch (interfaceCtx->unk_280) { case 1: // minigame countdown 3 @@ -6615,7 +6623,7 @@ void Interface_Update(PlayState* play) { if (gSaveContext.timerState[TIMER_ID_5] == TIMER_STATE_OFF) { if ((D_801BF8DC == 1) || (D_801BF8DC == 4)) { if (CUR_FORM != PLAYER_FORM_ZORA) { - if (play->gameOverCtx.state == 0) { + if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { if ((gSaveContext.save.playerData.health >> 1) != 0) { gSaveContext.timerState[TIMER_ID_5] = TIMER_STATE_8; gSaveContext.timerX[TIMER_ID_5] = 115; diff --git a/src/code/z_play.c b/src/code/z_play.c index f76998e10..6d90048f5 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -108,9 +108,17 @@ s32 Play_InCsMode(PlayState* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s") +u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex) { + ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s") + return actorCsCamList->setting; +} + +Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex) { + ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex]; + + return Lib_SegmentedToVirtual(actorCsCamList->actorCsCamFuncData); +} /** * Converts the number of a scene to its "original" equivalent, the default version of the area which the player first @@ -215,8 +223,8 @@ void func_80169EFC(GameState* thisx) { this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; gSaveContext.respawnFlag = 1; func_80169ECC(this); - this->transitionTrigger = 0x14; - this->unk_1887F = 2; + this->transitionTrigger = TRANS_TRIGGER_START; + this->transitionType = TRANS_TYPE_02; } // Gameplay_LoadToLastEntrance ? @@ -227,8 +235,8 @@ void func_80169F78(GameState* thisx) { this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; gSaveContext.respawnFlag = -1; func_80169ECC(this); - this->transitionTrigger = 0x14; - this->unk_1887F = 2; + this->transitionTrigger = TRANS_TRIGGER_START; + this->transitionType = TRANS_TYPE_02; } // Gameplay_TriggerRespawn ? diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 36227cd16..004b4f7ab 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -404,9 +404,9 @@ void func_80123140(PlayState* play, Player* player) { s32 Player_InBlockingCsMode(PlayState* play, Player* player) { return (player->stateFlags1 & (PLAYER_STATE1_20000000 | PLAYER_STATE1_200 | PLAYER_STATE1_80)) || - player->csMode != 0 || play->transitionTrigger == 0x14 || play->transitionMode != 0 || - (player->stateFlags1 & PLAYER_STATE1_1) || (player->stateFlags3 & PLAYER_STATE3_80) || - play->actorCtx.unk268 != 0; + (player->csMode != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || + (play->transitionMode != TRANS_MODE_OFF) || (player->stateFlags1 & PLAYER_STATE1_1) || + (player->stateFlags3 & PLAYER_STATE3_80) || (play->actorCtx.unk268 != 0); } s32 Player_InCsMode(PlayState* play) { diff --git a/src/code/z_room.c b/src/code/z_room.c index b8646a2d0..169d6d5b5 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -58,7 +58,7 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { } else if (mesh->format == 2) { func_8012E32C(play, room, flags); } else { - __assert("../z_room.c", 0x3c5); + __assert("../z_room.c", 965); } } @@ -85,9 +85,8 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { roomCtx->unk31 = 1; size = play->roomList[index].vromEnd - play->roomList[index].vromStart; - roomCtx->activeRoomVram = - (void*)(((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) & - 0xfffffff0); + roomCtx->activeRoomVram = (void*)(ALIGN16((u32)roomCtx->roomMemPages[roomCtx->activeMemPage] - + (size + 8) * roomCtx->activeMemPage - 7)); osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1); DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0, @@ -114,7 +113,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && (play->sceneNum != SCENE_IKNINSIDE)) { - play->envCtx.lightSettingOverride = 0xff; + play->envCtx.lightSettingOverride = 0xFF; play->envCtx.unk_E0 = 0; } func_800FEAB0(); @@ -143,7 +142,7 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.segment = NULL; func_800BA798(play, &play->actorCtx); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (-1 < roomCtx->currRoom.num) { + if (roomCtx->currRoom.num > -1) { Map_InitRoomData(play, roomCtx->currRoom.num); Minimap_SavePlayerRoomInitInfo(play); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1a2773a05..cf40d6049 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -173,9 +173,9 @@ void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) { play->actorCtx.unkC = 0; } -// SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes +// SceneTableEntry Header Command 0x02: List of camera data for actor cutscenes void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { - play->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment); + play->actorCsCamList = Lib_SegmentedToVirtual(cmd->actorCsCamList.segment); } // SceneTableEntry Header Command 0x03: Collision Header @@ -192,8 +192,8 @@ void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { colHeader->surfaceTypeList = Lib_SegmentedToVirtual(colHeader->surfaceTypeList); } - if (colHeader->cameraDataList != NULL) { - colHeader->cameraDataList = Lib_SegmentedToVirtual(colHeader->cameraDataList); + if (colHeader->bgCamList != NULL) { + colHeader->bgCamList = Lib_SegmentedToVirtual(colHeader->bgCamList); } if (colHeader->waterBoxes != NULL) { @@ -237,9 +237,9 @@ void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; - play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1; - play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1; - play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1; + play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; + play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; + play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1; } // SceneTableEntry Header Command 0x0A: Mesh Header @@ -376,7 +376,7 @@ void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x10: Time Settings void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { if (cmd->timeSettings.hour != 0xFF && cmd->timeSettings.min != 0xFF) { - gSaveContext.environmentTime = gSaveContext.save.time = + gSaveContext.skyboxTime = gSaveContext.save.time = (u16)(((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f); } @@ -398,20 +398,17 @@ void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { play->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f; play->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f; - if (play->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) { - gSaveContext.environmentTime = gSaveContext.save.time; + if ((play->envCtx.timeIncrement == 0) && (gSaveContext.save.cutscene < 0xFFF0)) { + gSaveContext.skyboxTime = gSaveContext.save.time; - if (gSaveContext.environmentTime >= CLOCK_TIME(4, 0) && gSaveContext.environmentTime < CLOCK_TIME(6, 30)) { - gSaveContext.environmentTime = CLOCK_TIME(5, 0); - } else if (gSaveContext.environmentTime >= CLOCK_TIME(6, 30) && - gSaveContext.environmentTime < CLOCK_TIME(8, 0)) { - gSaveContext.environmentTime = CLOCK_TIME(8, 0); - } else if (gSaveContext.environmentTime >= CLOCK_TIME(16, 0) && - gSaveContext.environmentTime < CLOCK_TIME(17, 0)) { - gSaveContext.environmentTime = CLOCK_TIME(17, 0); - } else if (gSaveContext.environmentTime >= CLOCK_TIME(18, 0) && - gSaveContext.environmentTime < CLOCK_TIME(19, 0)) { - gSaveContext.environmentTime = CLOCK_TIME(19, 0); + if ((gSaveContext.skyboxTime >= CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) { + gSaveContext.skyboxTime = CLOCK_TIME(5, 0); + } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(6, 30)) && (gSaveContext.skyboxTime < CLOCK_TIME(8, 0))) { + gSaveContext.skyboxTime = CLOCK_TIME(8, 0); + } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(16, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(17, 0))) { + gSaveContext.skyboxTime = CLOCK_TIME(17, 0); + } else if ((gSaveContext.skyboxTime >= CLOCK_TIME(18, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(19, 0))) { + gSaveContext.skyboxTime = CLOCK_TIME(19, 0); } } } @@ -530,7 +527,7 @@ void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd) { * Sets the exit fade from the next entrance index. */ void Scene_SetExitFade(PlayState* play) { - play->unk_1887F = Entrance_GetTransitionFlags(play->nextEntranceIndex) & 0x7F; + play->transitionType = Entrance_GetTransitionFlags(play->nextEntranceIndex) & 0x7F; } /** diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c index 2380cef13..cfc6293ba 100644 --- a/src/code/z_schedule.c +++ b/src/code/z_schedule.c @@ -6,7 +6,7 @@ (dest) = (temp) * (0x10000 / 60 / 24.0f); \ (dest) = SCHEDULE_CONVERT_TIME(dest); -s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckFlagS* cmd = (ScheduleCmdCheckFlagS*)*script; u16 flag = (cmd->flagByte << 8) | cmd->flagMask; @@ -17,7 +17,7 @@ s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) { return false; } -s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckFlagL* cmd = (ScheduleCmdCheckFlagL*)*script; u16 flag = (cmd->flagByte << 8) | cmd->flagMask; @@ -28,7 +28,7 @@ s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) { return false; } -s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleOutput* output) { s32 inRange = false; ScheduleCmdCheckTimeRangeS* cmd = (ScheduleCmdCheckTimeRangeS*)*script; f32 f; @@ -54,7 +54,7 @@ s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* resul return false; } -s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleOutput* output) { s32 inRange = false; ScheduleCmdCheckTimeRangeL* cmd = (ScheduleCmdCheckTimeRangeL*)*script; f32 f; @@ -80,33 +80,33 @@ s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* resul return false; } -s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdReturnValueL* cmd = (ScheduleCmdReturnValueL*)*script; //! @bug result is a u8, value is truncated - result->result = (cmd->retH << 8) | cmd->retL; - result->hasResult = true; + output->result = (cmd->retH << 8) | cmd->retL; + output->hasResult = true; return true; } -s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleResult* result) { - result->hasResult = false; +s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleOutput* output) { + output->hasResult = false; return true; } -s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleResult* result) { - result->hasResult = true; +s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleOutput* output) { + output->hasResult = true; return true; } -s32 Schedule_Nop(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_Nop(PlayState* play, u8** script, ScheduleOutput* output) { return false; } -s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckMiscS* cmd = (ScheduleCmdCheckMiscS*)*script; if (((cmd->which == SCHEDULE_CHECK_MISC_ROOM_KEY) && (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_ROOM_KEY)) || @@ -119,16 +119,16 @@ s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) { return false; } -s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdReturnValueS* cmd = (ScheduleCmdReturnValueS*)*script; - result->result = cmd->result; - result->hasResult = true; + output->result = cmd->result; + output->hasResult = true; return true; } -s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script; s16 scene = (cmd->sceneH << 8) | cmd->sceneL; @@ -139,7 +139,7 @@ s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* resu return false; } -s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script; s16 scene = (cmd->sceneH << 8) | cmd->sceneL; @@ -150,7 +150,7 @@ s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* resu return false; } -s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInDayS* cmd = (ScheduleCmdCheckNotInDayS*)*script; s16 day = (cmd->dayH << 8) | cmd->dayL; @@ -161,7 +161,7 @@ s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result return false; } -s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInDayL* cmd = (ScheduleCmdCheckNotInDayL*)*script; s16 day = (cmd->dayH << 8) | cmd->dayL; @@ -172,7 +172,7 @@ s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result return false; } -s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdReturnTime* cmd = (ScheduleCmdReturnTime*)*script; f32 f; u16 time0; @@ -183,15 +183,15 @@ s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) { SCHEDULE_CALC_TIME(cmd->time1Hr, cmd->time1Min, time1, f); time1--; - result->result = cmd->result; - result->time0 = time0; - result->time1 = time1; - result->hasResult = true; + output->result = cmd->result; + output->time0 = time0; + output->time1 = time1; + output->hasResult = true; return true; } -s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckBeforeTimeS* cmd = (ScheduleCmdCheckBeforeTimeS*)*script; f32 f; u16 testTime; @@ -208,7 +208,7 @@ s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* resu return false; } -s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckBeforeTimeL* cmd = (ScheduleCmdCheckBeforeTimeL*)*script; f32 f; u16 testTime; @@ -225,21 +225,21 @@ s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* resu return false; } -s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdBranchS* cmd = (ScheduleCmdBranchS*)*script; *script += cmd->offset; return false; } -s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleResult* result) { +s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdBranchL* cmd = (ScheduleCmdBranchL*)*script; *script += (s16)((cmd->offsetH << 8) | cmd->offsetL); return false; } -static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleResult*) = { +static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleOutput*) = { Schedule_CheckFlagS, Schedule_CheckFlagL, Schedule_CheckTimeRangeS, Schedule_CheckTimeRangeL, Schedule_ReturnValueL, Schedule_ReturnNone, Schedule_ReturnEmpty, Schedule_Nop, Schedule_CheckMiscS, Schedule_ReturnValueS, Schedule_CheckNotInSceneS, Schedule_CheckNotInSceneL, @@ -269,15 +269,15 @@ static u8 sScheduleCmdSizes[] = { sizeof(ScheduleCmdBranchL), }; -s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result) { +s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output) { u8 size; s32 stop; do { size = sScheduleCmdSizes[*script]; - stop = (*sScheduleCmdFuncs[*script])(play, &script, result); + stop = (*sScheduleCmdFuncs[*script])(play, &script, output); script += size; } while (!stop); - return result->hasResult; + return output->hasResult; } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index dfe5b2bd5..2d67e2adf 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -148,10 +148,31 @@ s32 D_801C6798[] = { 0x00000020, 0x00001470, 0x000028C0, 0x00003D10, 0x00005160, 0x000065B0, }; -u8 D_801C67B0[24] = { - ITEM_NONE, ITEM_BOW, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_BOMB, ITEM_BOMBCHU, - ITEM_STICK, ITEM_NUT, ITEM_MAGIC_BEANS, ITEM_NONE, ITEM_POWDER_KEG, ITEM_PICTO_BOX, ITEM_NONE, ITEM_NONE, - ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, +u8 gAmmoItems[] = { + ITEM_NONE, // SLOT_OCARINA + ITEM_BOW, // SLOT_BOW + ITEM_NONE, // SLOT_ARROW_FIRE + ITEM_NONE, // SLOT_ARROW_ICE + ITEM_NONE, // SLOT_ARROW_LIGHT + ITEM_NONE, // SLOT_TRADE_DEED + ITEM_BOMB, // SLOT_BOMB + ITEM_BOMBCHU, // SLOT_BOMBCHU + ITEM_STICK, // SLOT_STICK + ITEM_NUT, // SLOT_NUT + ITEM_MAGIC_BEANS, // SLOT_MAGIC_BEANS + ITEM_NONE, // SLOT_TRADE_KEY_MAMA + ITEM_POWDER_KEG, // SLOT_POWDER_KEG + ITEM_PICTO_BOX, // SLOT_PICTO_BOX + ITEM_NONE, // SLOT_LENS + ITEM_NONE, // SLOT_HOOKSHOT + ITEM_NONE, // SLOT_SWORD_GREAT_FAIRY + ITEM_NONE, // SLOT_TRADE_COUPLE + ITEM_NONE, // SLOT_BOTTLE_1 + ITEM_NONE, // SLOT_BOTTLE_2 + ITEM_NONE, // SLOT_BOTTLE_3 + ITEM_NONE, // SLOT_BOTTLE_4 + ITEM_NONE, // SLOT_BOTTLE_5 + ITEM_NONE, // SLOT_BOTTLE_6 }; s32 D_801C67C8[] = { 0, 0x40, 0x80, 0xC0, 0x100, 0x180, 0x200, 0x280 }; @@ -199,8 +220,8 @@ void Sram_ClearHighscores(void) { gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF) | 0x130000; gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF0000) | 0xA; gSaveContext.save.horseBackBalloonHighScore = 6000; // 60 seconds - gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF0000) | 0x27; - gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF) | 0xA0000; + SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(39); + SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(10); gSaveContext.save.dekuPlaygroundHighScores[0] = 7500; // 75 seconds gSaveContext.save.dekuPlaygroundHighScores[1] = 7500; // 75 seconds @@ -330,8 +351,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { } } - for (i = 0; i < ARRAY_COUNT(D_801C67B0); i++) { - if (D_801C67B0[i] != ITEM_NONE) { + for (i = 0; i < ARRAY_COUNT(gAmmoItems); i++) { + if (gAmmoItems[i] != ITEM_NONE) { if ((gSaveContext.save.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) { item = gSaveContext.save.inventory.items[i]; AMMO(item) = 0; @@ -412,7 +433,7 @@ void Sram_SaveEndOfCycle(PlayState* play) { Inventory_DeleteItem(ITEM_LONGSHOT, SLOT_TRADE_COUPLE); for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) { - if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) { + if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_OF_MEMORIES) { SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE); Interface_LoadItemIconImpl(play, j); } @@ -433,7 +454,7 @@ void Sram_SaveEndOfCycle(PlayState* play) { Sram_ClearHighscores(); for (i = 0; i < 8; i++) { - gSaveContext.save.inventory.dungeonItems[i] &= (u8)~1; + gSaveContext.save.inventory.dungeonItems[i] &= (u8)~1; // remove boss key DUNGEON_KEY_COUNT(i) = 0; gSaveContext.save.inventory.strayFairies[i] = 0; } @@ -812,8 +833,8 @@ void Sram_InitDebugSave(void) { Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum)); if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)]; - C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)]; + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm)]; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm)]; } gSaveContext.save.hasTatl = true; @@ -891,13 +912,11 @@ void func_80144A94(SramContext* sramCtx) { u16 D_801C6A58[] = { 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30 }; -#ifdef NON_MATCHING -// Small regalloc between v0/t6/t7 void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { s32 i; s32 pad; s32 phi_t1; - s32 pad1[2]; + s32 pad1; s32 fileNum; if (gSaveContext.unk_3F3F) { @@ -963,12 +982,11 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; } } else { - gSaveContext.save.entranceIndex = D_801C6A58[gSaveContext.save.owlSaveLocation]; - if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x84A0 && (gSaveContext.save.weekEventReg[20] & 2)) { + gSaveContext.save.entranceIndex = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; + if ((gSaveContext.save.entranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { // Unconfirmed weekEventReg: "Woodfall Temple Prison Entrance raised / Water cleansed" gSaveContext.save.entranceIndex = 0xCA0; - } else if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x9A80 && - (gSaveContext.save.weekEventReg[33] & 0x80)) { + } else if ((gSaveContext.save.entranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { // Unconfirmed weekEventReg: "Mountain Village Unfrozen" gSaveContext.save.entranceIndex = 0xAE80; } @@ -992,9 +1010,6 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { func_80147314(sramCtx, fileNum); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_OpenSave.s") -#endif // Similar to func_80145698, but accounts for owl saves? void func_8014546C(SramContext* sramCtx) { diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index f8c6b1a21..afc7f7168 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -480,13 +480,13 @@ void SubS_TimePathing_ComputeInitialY(PlayState* play, Path* path, s32 waypoint, } } -Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 max) { +Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 limit) { Path* path; s32 i = 0; do { path = &play->setupPathList[pathIndex]; - if (i >= max) { + if (i >= limit) { break; } pathIndex = path->unk1; @@ -830,43 +830,52 @@ s32 func_8013C964(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 it xzRange = actor->xzDistToPlayer + 1.0f; ret = Actor_PickUp(actor, play, itemId, xzRange, yRange); break; + case 2: if ((fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 3: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 4: yRange = fabsf(actor->playerHeightRel) + 1.0f; xzRange = actor->xzDistToPlayer + 1.0f; xzDistToPlayerTemp = actor->xzDistToPlayer; actor->xzDistToPlayer = 0.0f; - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); actor->xzDistToPlayer = xzDistToPlayerTemp; break; + case 5: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isTargeted) { - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + case 6: //! @bug: Both x and y conditionals are always true, || should be an && if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { - actor->flags |= 0x10000; + actor->flags |= ACTOR_FLAG_10000; ret = func_800B8500(actor, play, xzRange, yRange, itemId); } break; + + default: + break; } + return ret; } diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c index 823ff0982..dcb05b3d9 100644 --- a/src/libultra/gu/lookathil.c +++ b/src/libultra/gu/lookathil.c @@ -1,6 +1,6 @@ #include "global.h" -#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xff) +#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xFF) void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */ diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index 11d00ff73..46dd605d4 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -1,7 +1,7 @@ #include "global.h" void guRotateF(float m[4][4], float a, float x, float y, float z) { - static float D_80097F90 = 0.017453292; // TODO this is PI / 180.0, we should define pi somewhere + static float D_80097F90 = M_PI / 180.0f; float sine; float cosine; float ab; diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index b54d894f3..163756e07 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -28,7 +28,7 @@ void osContGetReadData(OSContPad* data) { ptr = (u8*)__osContPifRam.ramarray; for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContReadFormat), data++) { readformat = *(__OSContReadFormat*)ptr; - data->errno = (readformat.rxsize & 0xc0) >> 4; + data->errno = (readformat.rxsize & 0xC0) >> 4; if (data->errno == 0) { data->button = readformat.button; data->stick_x = readformat.stick_x; diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index bd8270993..245183280 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -58,7 +58,7 @@ void __osContGetInitData(u8* pattern, OSContStatus* data) { ptr = (u8*)__osContPifRam.ramarray; for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(requestHeader), data++) { requestHeader = *(__OSContRequestHeader*)ptr; - data->errno = (requestHeader.rxsize & 0xc0) >> 4; + data->errno = (requestHeader.rxsize & 0xC0) >> 4; if (data->errno == 0) { data->type = requestHeader.typel << 8 | requestHeader.typeh; data->status = requestHeader.status; diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c index cbe43ce82..fd7573151 100644 --- a/src/libultra/io/epirawdma.c +++ b/src/libultra/io/epirawdma.c @@ -53,7 +53,7 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr } HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr); - HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1fffffff); + HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1FFFFFFF); switch (direction) { case OS_READ: diff --git a/src/libultra/io/visetxscale.c b/src/libultra/io/visetxscale.c index e6a9ec6bb..0e2cf762d 100644 --- a/src/libultra/io/visetxscale.c +++ b/src/libultra/io/visetxscale.c @@ -10,7 +10,7 @@ void osViSetXScale(f32 value) { __osViNext->state |= 0x2; - nomValue = __osViNext->modep->comRegs.xScale & 0xfff; + nomValue = __osViNext->modep->comRegs.xScale & 0xFFF; __osViNext->x.scale = (u32)(__osViNext->x.factor * nomValue) & 0xFFF; __osRestoreInt(saveMask); diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 3174d5c99..9fbf5ff64 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -4,7 +4,7 @@ typedef struct { /* 0x0 */ u32 ins_00; // lui k0, 0x8000 - /* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39e0 + /* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39E0 /* 0x8 */ u32 ins_08; // jr k0 ; __osException /* 0xC */ u32 ins_0C; // nop } struct_exceptionPreamble; diff --git a/src/libultra/rmon/xldtob.c b/src/libultra/rmon/xldtob.c index 65ffc7a92..460d0951c 100644 --- a/src/libultra/rmon/xldtob.c +++ b/src/libultra/rmon/xldtob.c @@ -9,13 +9,13 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L /* float properties */ #define _D0 0 -#define _DBIAS 0x3ff +#define _DBIAS 0x3FF #define _DLONG 1 #define _DOFF 4 -#define _FBIAS 0x7e +#define _FBIAS 0x7E #define _FOFF 7 #define _FRND 1 -#define _LBIAS 0x3ffe +#define _LBIAS 0x3FFE #define _LOFF 15 /* integer properties */ #define _C2 1 @@ -26,7 +26,7 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L #define INF 1 #define FINITE -1 #define _DFRAC ((1 << _DOFF) - 1) -#define _DMASK (0x7fff & ~_DFRAC) +#define _DMASK (0x7FFF & ~_DFRAC) #define _DMAX ((1 << (15 - _DOFF)) - 1) #define _DNAN (0x8000 | _DMAX << _DOFF | 1 << (_DOFF - 1)) #define _DSIGN 0x8000 diff --git a/src/libultra/rmon/xprintf.c b/src/libultra/rmon/xprintf.c index 6c538a2a8..ddb83652d 100644 --- a/src/libultra/rmon/xprintf.c +++ b/src/libultra/rmon/xprintf.c @@ -51,8 +51,7 @@ int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap) { } fmt = ++s; x.flags = 0; - // TODO the cast isn't necessary because strchr should take it in as const, but it currently doesn't - for (; (t = strchr((char*)fchar, *s)) != NULL; s++) { + for (; (t = strchr(fchar, *s)) != NULL; s++) { x.flags |= fbit[t - fchar]; } if (*s == '*') { diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index 99d5c5a85..555f92798 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -4,6 +4,7 @@ * Description: Great Bay Temple - See-Saw */ +#include "prevent_bss_reordering.h" #include "z_bg_dblue_balance.h" #include "objects/object_dblue_object/object_dblue_object.h" diff --git a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c index 9e87d66bb..1ad295e68 100644 --- a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c +++ b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.c @@ -5,6 +5,8 @@ */ #include "z_bg_fire_wall.h" +#include "objects/object_fwall/object_fwall.h" +#include "overlays/actors/ovl_En_Encount4/z_en_encount4.h" #define FLAGS 0x00000000 @@ -12,14 +14,13 @@ void BgFireWall_Init(Actor* thisx, PlayState* play); void BgFireWall_Destroy(Actor* thisx, PlayState* play); -void BgFireWall_Update(Actor* thisx, PlayState* play); +void BgFireWall_Update(Actor* thisx, PlayState* play2); +void BgFireWall_Draw(Actor* thisx, PlayState* play); void func_809AC638(BgFireWall* this, PlayState* play); void func_809AC68C(BgFireWall* this, PlayState* play); void func_809AC6C0(BgFireWall* this, PlayState* play); -void func_809AC970(BgFireWall* this, PlayState* play); -#if 0 const ActorInit Bg_Fire_Wall_InitVars = { ACTOR_BG_FIRE_WALL, ACTORCAT_BG, @@ -32,41 +33,184 @@ const ActorInit Bg_Fire_Wall_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809ACC60 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_NONE, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x01, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NONE, + BUMP_NONE, + OCELEM_ON, + }, { 34, 85, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_809ACC8C = { 1, 80, 100, MASS_IMMOVABLE }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; -#endif +static TexturePtr sFlameTextures[] = { + gFwallFireball0Tex, gFwallFireball1Tex, gFwallFireball2Tex, gFwallFireball3Tex, + gFwallFireball4Tex, gFwallFireball5Tex, gFwallFireball6Tex, gFwallFireball7Tex, +}; -extern ColliderCylinderInit D_809ACC60; -extern CollisionCheckInfoInit D_809ACC8C; +void BgFireWall_Init(Actor* thisx, PlayState* play) { + BgFireWall* this = THIS; -extern UNK_TYPE D_06000040; + this->unk_14C = this->actor.params; + this->actor.scale.y = 0.005f; + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + this->actor.scale.z = 0.12f; + this->actor.scale.x = 0.12f; + this->unk_15C = 0.09f; + this->unk_158 = 0.1f; + this->unk_160 = 300.0f; + this->texIndex = Rand_S16Offset(0, ARRAY_COUNT(sFlameTextures) - 1); + this->actor.flags |= ACTOR_FLAG_10; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->actionFunc = func_809AC638; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/BgFireWall_Init.s") +void BgFireWall_Destroy(Actor* thisx, PlayState* play) { + BgFireWall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/BgFireWall_Destroy.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC5C0.s") +s32 func_809AC5C0(BgFireWall* thisx, PlayState* play) { + BgFireWall* this = THIS; + Player* player = GET_PLAYER(play); + Vec3f sp1C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC638.s") + Actor_OffsetOfPointInActorCoords(&this->actor, &sp1C, &player->actor.world.pos); + if ((fabsf(sp1C.x) < this->unk_160) && (fabsf(sp1C.z) < (this->unk_160 + 20.0f))) { + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC68C.s") +void func_809AC638(BgFireWall* this, PlayState* play) { + if ((this->unk_14C != 0) || (func_809AC5C0(this, play))) { + this->actor.draw = BgFireWall_Draw; + this->timer = 5; + this->actionFunc = func_809AC68C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC6C0.s") +void func_809AC68C(BgFireWall* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + this->actionFunc = func_809AC6C0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC760.s") +void func_809AC6C0(BgFireWall* this, PlayState* play) { + if ((this->unk_14C != 0) || (func_809AC5C0(this, play))) { + this->unk_15C = 0.09f; + Math_StepToF(&this->actor.scale.y, this->unk_15C + this->unk_154, this->unk_158); + } else if (Math_StepToF(&this->actor.scale.y, 0.005f, this->unk_158)) { + this->actionFunc = func_809AC638; + } else { + this->timer = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC7F8.s") +void func_809AC760(BgFireWall* this, PlayState* play) { + s16 phi_a3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809AC970.s") + if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { + phi_a3 = this->actor.shape.rot.y; + } else { + phi_a3 = (this->actor.shape.rot.y + 0x8000); + } + func_800B8D98(play, &this->actor, BREG(48) + 10.0f, phi_a3, BREG(49) + 5.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/BgFireWall_Update.s") +void func_809AC7F8(BgFireWall* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f sp38; + f32 val = 25.0f; + f32 sin; + f32 cos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fire_Wall/func_809ACB28.s") + Actor_OffsetOfPointInActorCoords(&this->actor, &sp38, &player->actor.world.pos); + sp38.x = CLAMP(sp38.x, -80.0f, 80.0f); + + if (this->step == 0) { + if (sp38.z > 0.0f) { + sp38.z = -val; + this->step = -1.0f; + } else { + sp38.z = val; + this->step = 1.0f; + } + } else { + sp38.z = this->step * 25.0f; + } + + sin = Math_SinS(this->actor.shape.rot.y); + cos = Math_CosS(this->actor.shape.rot.y); + this->collider.dim.pos.x = this->actor.world.pos.x + (sp38.x * cos) + (sp38.z * sin); + this->collider.dim.pos.z = this->actor.world.pos.z - (sp38.x * sin) + (sp38.z * cos); +} + +void func_809AC970(BgFireWall* this, PlayState* play) { + if (Math_StepToF(&this->actor.scale.y, 0.005f, this->unk_158)) { + Actor_MarkForDeath(&this->actor); + } +} + +void BgFireWall_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + BgFireWall* this = THIS; + + this->actionFunc(this, play); + if ((this->unk_14C == 0) || ((this->unk_14C != 0) && (this->actor.xzDistToPlayer < 240.0f))) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + func_809AC760(this, play); + } + } + if (this->actionFunc == func_809AC6C0) { + func_800B9010(&this->actor, NA_SE_EV_FIRE_PLATE - SFX_FLAG); + if ((this->unk_14C == 0) || ((this->unk_14C != 0) && (this->actor.xzDistToPlayer < 240.0f))) { + func_809AC7F8(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + } + this->texIndex = (this->texIndex + 1) % ARRAY_COUNT(sFlameTextures); + if (this->actionFunc != func_809AC970) { + if (this->actor.parent != NULL) { + EnEncount4* parent = (EnEncount4*)this->actor.parent; + if ((parent->actor.update != NULL) && (parent->unk_150 != 0)) { + this->actionFunc = func_809AC970; + } + } + } +} + +void BgFireWall_Draw(Actor* thisx, PlayState* play) { + BgFireWall* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sFlameTextures[this->texIndex])); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x01, 255, 255, 0, 150); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 255); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_fwall_DL_000040); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h index f65fe6e59..018e9f5f1 100644 --- a/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h +++ b/src/overlays/actors/ovl_Bg_Fire_Wall/z_bg_fire_wall.h @@ -10,7 +10,15 @@ typedef void (*BgFireWallActionFunc)(struct BgFireWall*, PlayState*); typedef struct BgFireWall { /* 0x000 */ Actor actor; /* 0x144 */ BgFireWallActionFunc actionFunc; - /* 0x148 */ char unk_148[0x68]; + /* 0x148 */ s16 texIndex; + /* 0x14A */ s16 timer; + /* 0x14C */ s16 unk_14C; + /* 0x150 */ f32 step; + /* 0x154 */ f32 unk_154; + /* 0x158 */ f32 unk_158; + /* 0x15C */ f32 unk_15C; + /* 0x160 */ f32 unk_160; + /* 0x164 */ ColliderCylinder collider; } BgFireWall; // size = 0x1B0 extern const ActorInit Bg_Fire_Wall_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c index 2681d9292..c485927ce 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c +++ b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c @@ -5,6 +5,7 @@ */ #include "z_bg_fu_mizu.h" +#include "objects/object_fu_kaiten/object_fu_kaiten.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -15,7 +16,6 @@ void BgFuMizu_Destroy(Actor* thisx, PlayState* play); void BgFuMizu_Update(Actor* thisx, PlayState* play); void BgFuMizu_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Bg_Fu_Mizu_InitVars = { ACTOR_BG_FU_MIZU, ACTORCAT_BG, @@ -28,17 +28,68 @@ const ActorInit Bg_Fu_Mizu_InitVars = { (ActorFunc)BgFuMizu_Draw, }; -#endif +void BgFuMizu_Init(Actor* thisx, PlayState* play) { + BgFuMizu* this = THIS; + s32 pad; + CollisionHeader* colHeader = NULL; -extern UNK_TYPE D_060037D8; -extern UNK_TYPE D_060037F8; + Actor_SetScale(&this->dyna.actor, 1.0f); + DynaPolyActor_Init(&this->dyna, 1); + CollisionHeader_GetVirtual(&object_fu_kaiten_Colheader_0037F8, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->unk_160 = 0; + this->dyna.actor.world.pos.y = -10.0f + this->dyna.actor.home.pos.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fu_Mizu/BgFuMizu_Init.s") +void BgFuMizu_Destroy(Actor* thisx, PlayState* play) { + BgFuMizu* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fu_Mizu/BgFuMizu_Destroy.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fu_Mizu/func_80ADABA4.s") +s32 func_80ADABA4(BgFuMizu* this, PlayState* play) { + Actor* actor = play->actorCtx.actorLists[ACTORCAT_BG].first; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fu_Mizu/BgFuMizu_Update.s") + while (actor != NULL) { + if ((actor != NULL) && (actor->id == ACTOR_EN_FU_KAGO) && (actor->colChkInfo.health == 0)) { + return false; + } + actor = actor->next; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Fu_Mizu/BgFuMizu_Draw.s") + return true; +} + +void BgFuMizu_Update(Actor* thisx, PlayState* play) { + f32 heightTarget; + BgFuMizu* this = THIS; + + if (this->unk_160 == 0) { + if (func_80ADABA4(this, play)) { + heightTarget = -10.0f + this->dyna.actor.home.pos.y; + } else { + heightTarget = 10.0f + this->dyna.actor.home.pos.y; + } + } else { + heightTarget = 25.0f + this->dyna.actor.home.pos.y; + } + if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, heightTarget, 0.05f, 1.0f, 0.5f) > 1.0f) { + if (this->unk_160 == 1) { + func_800B9010(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN_FIX - SFX_FLAG); + } else { + func_800B9010(&this->dyna.actor, NA_SE_EV_WATER_LEVEL_DOWN_FIX - SFX_FLAG); + } + } +} + +void BgFuMizu_Draw(Actor* thisx, PlayState* play) { + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_fu_kaiten_Matanimheader_0037D8)); + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_fu_kaiten_DL_002FC0); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h index ffb4cc8d8..89b1df323 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h +++ b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.h @@ -6,8 +6,8 @@ struct BgFuMizu; typedef struct BgFuMizu { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x1C]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ UNK_TYPE1 pad15C[0x4]; /* 0x160 */ s16 unk_160; } BgFuMizu; // size = 0x164 diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c index af246eafe..f494131d9 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c @@ -5,6 +5,7 @@ */ #include "z_bg_haka_bombwall.h" +#include "objects/object_haka_obj/object_haka_obj.h" #define FLAGS 0x00000000 @@ -15,7 +16,14 @@ void BgHakaBombwall_Destroy(Actor* thisx, PlayState* play); void BgHakaBombwall_Update(Actor* thisx, PlayState* play); void BgHakaBombwall_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80BD5E6C(BgHakaBombwall* this, PlayState* play); +void func_80BD6260(BgHakaBombwall* this); +void func_80BD6274(BgHakaBombwall* this, PlayState* play); +void BgHakaBombwall_SetupPlayCutscene(BgHakaBombwall* this); +void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play); +void BgHakaBombwall_SetupEndCutscene(BgHakaBombwall* this); +void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play); + const ActorInit Bg_Haka_Bombwall_InitVars = { ACTOR_BG_HAKA_BOMBWALL, ACTORCAT_BG, @@ -28,50 +36,191 @@ const ActorInit Bg_Haka_Bombwall_InitVars = { (ActorFunc)BgHakaBombwall_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BD64A0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 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 }, + { 0x00000008, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 80, 80, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80BD64D4[] = { +static s16 D_80BD64CC[4] = { 24, 15, 10, 5 }; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; +s32 func_80BD5E00(BgHakaBombwall* this) { + if (this->collider.base.acFlags & AC_HIT) { + if ((this->collider.base.ac != NULL) && + (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->collider.base.ac->world.pos) < SQ(80.0f))) { + return true; + } + } + return false; +} + +#ifdef NON_MATCHING +void func_80BD5E6C(BgHakaBombwall* this, PlayState* play) { + s32 i; + Vec3f spE0; + Vec3f spD4; + Vec3f spC8; + Vec3f spBC; + f32 temp_fs0; + f32 phi_fs1; + s16 phi_s0; + s16 gravity; + s16 phi_t0; + + Matrix_Push(); + Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW); + temp_fs0 = 0.0f; + phi_fs1 = 0.0f; + + for (i = 0; i < 30; i++) { + temp_fs0 += 60.0f + (Rand_ZeroOne() * 20.0f); + if (temp_fs0 > 75.0f) { + temp_fs0 -= 150.0f; + } + spC8.x = temp_fs0; + + phi_fs1 += 5; + spC8.y = phi_fs1; + + spC8.z = (Rand_ZeroOne() * 20.0f) - 10.0f; + + spBC.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (temp_fs0 * (4.0f / 75.0f)); + spBC.y = (Rand_ZeroOne() * 7.0f) - 2.0f; + spBC.z = (Rand_ZeroOne() * 4.0f) - 2.0f; + + Matrix_MultVec3f(&spC8, &spE0); + Matrix_MultVec3f(&spBC, &spD4); + + spE0.x += this->dyna.actor.world.pos.x; + spE0.y += this->dyna.actor.world.pos.y; + spE0.z += this->dyna.actor.world.pos.z; + + if ((i & 3) == 0) { + phi_s0 = 32; + func_800BBFB0(play, &spE0, 60.0f, 2, 100, 120, 1); + } else { + phi_s0 = 64; + } + + if (i % 2 != 0) { + phi_s0 |= 1; + phi_t0 = 1; + } else { + phi_t0 = 0; + } + + if (D_80BD64CC[i & 3] >= 16) { + gravity = -550; + } else { + gravity = -450; + } + + EffectSsKakera_Spawn(play, &spE0, &spD4, &spE0, gravity, phi_s0, 30, 0, 0, D_80BD64CC[i & 3], phi_t0, 0, 50, -1, + OBJECT_IKANA_OBJ, object_haka_obj_DL_001680); + } + + Matrix_Pop(); +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E6C.s") #endif -extern ColliderCylinderInit D_80BD64A0; -extern InitChainEntry D_80BD64D4[]; +void BgHakaBombwall_Init(Actor* thisx, PlayState* play) { + s32 pad; + BgHakaBombwall* this = THIS; -extern UNK_TYPE D_06000040; -extern UNK_TYPE D_06000148; -extern UNK_TYPE D_06001680; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, 0); + Collider_InitCylinder(play, &this->collider); + if (Flags_GetSwitch(play, BGHAKABOMBWALL_GET_7F(thisx))) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000148); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + func_80BD6260(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E00.s") +void BgHakaBombwall_Destroy(Actor* thisx, PlayState* play) { + BgHakaBombwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E6C.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Init.s") +void func_80BD6260(BgHakaBombwall* this) { + this->actionFunc = func_80BD6274; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Destroy.s") +void func_80BD6274(BgHakaBombwall* this, PlayState* play) { + if (func_80BD5E00(this)) { + BgHakaBombwall_SetupPlayCutscene(this); + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6260.s") +void BgHakaBombwall_SetupPlayCutscene(BgHakaBombwall* this) { + this->dyna.actor.flags |= ACTOR_FLAG_10; + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + this->actionFunc = BgHakaBombwall_PlayCutscene; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6274.s") +void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + func_80BD5E6C(this, play); + this->dyna.actor.draw = NULL; + Flags_SetSwitch(play, BGHAKABOMBWALL_GET_7F(&this->dyna.actor)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 0x3C, NA_SE_EV_WALL_BROKEN); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + BgHakaBombwall_SetupEndCutscene(this); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD62D0.s") +void BgHakaBombwall_SetupEndCutscene(BgHakaBombwall* this) { + this->csTimer = 30; + this->actionFunc = BgHakaBombwall_EndCutscene; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6314.s") +void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play) { + this->csTimer--; + if (this->csTimer <= 0) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + Actor_MarkForDeath(&this->dyna.actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD63B4.s") +void BgHakaBombwall_Update(Actor* thisx, PlayState* play) { + BgHakaBombwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD63D0.s") + this->actionFunc(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Update.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Draw.s") +void BgHakaBombwall_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_haka_obj_DL_000040); +} diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h index 5e42b689d..6a37e3625 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.h @@ -3,15 +3,17 @@ #include "global.h" +#define BGHAKABOMBWALL_GET_7F(thisx) ((thisx)->params & 0x7F) + struct BgHakaBombwall; typedef void (*BgHakaBombwallActionFunc)(struct BgHakaBombwall*, PlayState*); typedef struct BgHakaBombwall { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x64]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ ColliderCylinder collider; /* 0x1A8 */ BgHakaBombwallActionFunc actionFunc; - /* 0x1AC */ char unk_1AC[0x4]; + /* 0x1AC */ s8 csTimer; } BgHakaBombwall; // size = 0x1B0 extern const ActorInit Bg_Haka_Bombwall_InitVars; 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 2e93c7a3f..d3ce48882 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -123,14 +123,14 @@ s32 func_80953BEC(BgIngate* this) { } s32 func_80953DA8(BgIngate* this, PlayState* play) { - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); if (gSaveContext.eventInf[3] & 0x20) { func_800B7298(play, &this->dyna.actor, 7); } else { gSaveContext.eventInf[4] |= 2; } - Camera_ChangeSetting(camera, CAM_SET_BOAT_CRUISE); + Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE); play->unk_1887C = 0x63; return false; @@ -178,7 +178,7 @@ void func_80953F8C(BgIngate* this, PlayState* play) { void func_80953F9C(BgIngate* this, PlayState* play) { Player* player = GET_PLAYER(play); - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); if (!(gSaveContext.eventInf[4] & 1)) { @@ -214,11 +214,11 @@ void func_80953F9C(BgIngate* this, PlayState* play) { } if (ActorCutscene_GetCurrentIndex() != this->unk16E) { if (ActorCutscene_GetCurrentIndex() != -1) { - Camera_ChangeSetting(camera, CAM_SET_NORMAL0); + Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); player->stateFlags1 |= 0x20; play->actorCtx.unk5 &= ~0x4; } else { - Camera_ChangeSetting(camera, CAM_SET_BOAT_CRUISE); + Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE); player->stateFlags1 &= ~0x20; } } @@ -251,9 +251,9 @@ void func_809542A0(BgIngate* this, PlayState* play) { play->nextEntranceIndex = 0xA810; } gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; this->actionFunc = func_80953F8C; gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800FE498(); @@ -273,7 +273,7 @@ void func_80954340(BgIngate* this, PlayState* play) { void func_809543D4(BgIngate* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (((talkState == 4) || (talkState == 5)) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_CHOICE) || (talkState == TEXT_STATE_5)) && Message_ShouldAdvance(play)) { switch (this->dyna.actor.textId) { case 0x9E4: this->dyna.actor.textId = 0x9E5; diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h index 729dfcea9..c39994d77 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h @@ -15,6 +15,7 @@ typedef struct BgKeikokuSaku { /* 0x160 */ s16 switchFlag; /* 0x162 */ s16 timer; } BgKeikokuSaku; // Size = 0x164 + extern const ActorInit Bg_Keikoku_Saku_InitVars; #endif // Z_BG_KEIKOKU_SAKU_H diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 7b41ba678..e4d3a8c91 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -16,16 +16,16 @@ void Boss02_Init(Actor* thisx, PlayState* play); void Boss02_Destroy(Actor* thisx, PlayState* play); -void Boss02_Update(Actor* thisx, PlayState* play); -void Boss02_Draw(Actor* thisx, PlayState* play); +void Boss02_Twinmold_Update(Actor* thisx, PlayState* play); +void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play); void func_809DAA74(Boss02* this, PlayState* play); void func_809DAA98(Boss02* this, PlayState* play); void func_809DAAA8(Boss02* this, PlayState* play); void func_809DAB78(Boss02* this, PlayState* play); -void func_809DC218(Actor* thisx, PlayState* play); -void func_809DC78C(Actor* thisx, PlayState* play); -void func_809DD0A8(Actor* thisx, PlayState* play); +void Boss02_Tail_Update(Actor* thisx, PlayState* play); +void Boss02_Static_Update(Actor* thisx, PlayState* play); +void Boss02_Static_Draw(Actor* thisx, PlayState* play); void Boss02_UpdateEffects(PlayState* play); void Boss02_DrawEffects(PlayState* play); void func_809DD934(Boss02* this, PlayState* play); @@ -33,15 +33,15 @@ void func_809DEAC4(Boss02* this, PlayState* play); u8 D_809E0420; u8 D_809E0421; -u8 D_809E0422; // 0 when the giant's mask is off, 1 when the giant's mask is on -Boss02* D_809E0424; -Boss02* D_809E0428; -Boss02* D_809E042C; -u8 D_809E0430; -DoorWarp1* D_809E0434; -TwinmoldEffect D_809E0438[150]; +u8 sIsInGiantMode; +Boss02* sRedTwinmold; +Boss02* sBlueTwinmold; +Boss02* sTwinmoldStatic; +u8 sMusicStartTimer; +DoorWarp1* sBlueWarp; +TwinmoldEffect sEffects[150]; -static DamageTable sDamageTable1 = { +static DamageTable sBlueTwinmoldDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -76,7 +76,7 @@ static DamageTable sDamageTable1 = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -static DamageTable sDamageTable2 = { +static DamageTable sRedTwinmoldDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0xF), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -119,8 +119,8 @@ const ActorInit Boss_02_InitVars = { sizeof(Boss02), (ActorFunc)Boss02_Init, (ActorFunc)Boss02_Destroy, - (ActorFunc)Boss02_Update, - (ActorFunc)Boss02_Draw, + (ActorFunc)Boss02_Twinmold_Update, + (ActorFunc)Boss02_Twinmold_Draw, }; f32 D_809DF5B0 = 1.0f; @@ -480,7 +480,7 @@ void func_809DA24C(PlayState* play) { void Boss02_SpawnEffectSand(TwinmoldEffect* effects, Vec3f* pos, f32 scale) { s16 i; - for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + for (i = 0; i < ARRAY_COUNT(sEffects); i++, effects++) { if (effects->type == TWINMOLD_EFFECT_NONE) { effects->type = TWINMOLD_EFFECT_SAND; effects->pos = *pos; @@ -501,7 +501,7 @@ void Boss02_SpawnEffectSand(TwinmoldEffect* effects, Vec3f* pos, f32 scale) { void Boss02_SpawnEffectFragment(TwinmoldEffect* effects, Vec3f* pos) { s16 i; - for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + for (i = 0; i < ARRAY_COUNT(sEffects); i++, effects++) { if (effects->type == TWINMOLD_EFFECT_NONE) { effects->type = TWINMOLD_EFFECT_FRAGMENT; effects->pos = *pos; @@ -523,7 +523,7 @@ void Boss02_SpawnEffectFragment(TwinmoldEffect* effects, Vec3f* pos) { void Boss02_SpawnEffectFlash(TwinmoldEffect* effects, Vec3f* pos) { s16 i; - for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effects++) { + for (i = 0; i < ARRAY_COUNT(sEffects); i++, effects++) { if ((effects->type == TWINMOLD_EFFECT_NONE) || (effects->type == TWINMOLD_EFFECT_FRAGMENT)) { effects->type = TWINMOLD_EFFECT_FLASH; effects->pos = *pos; @@ -549,47 +549,48 @@ void Boss02_Init(Actor* thisx, PlayState* play) { s32 i; s32 pad[2]; - if ((gSaveContext.save.weekEventReg[52] & 0x20) && (this->actor.params == 0)) { - D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 60.0f, - 0.0f, 0, 0, 0, 1); + if ((gSaveContext.save.weekEventReg[52] & 0x20) && (this->actor.params == TWINMOLD_RED)) { + sBlueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 60.0f, + 0.0f, 0, 0, 0, 1); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); } this->actor.targetMode = 10; - this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; - this->unk_1D3C.y = 1.0f; - if (this->actor.params == 200) { - D_809E042C = this; - play->specialEffects = (void*)D_809E0438; - this->actor.update = func_809DC78C; - this->actor.draw = func_809DD0A8; + this->subCamUp.z = this->subCamUp.x = 0.0f; + this->subCamUp.y = 1.0f; + if (this->actor.params == TWINMOLD_STATIC) { + sTwinmoldStatic = this; + play->specialEffects = (void*)sEffects; + this->actor.update = Boss02_Static_Update; + this->actor.draw = Boss02_Static_Draw; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_1D70 = 0.00999999977648f; - if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x20) || (D_809E0434 != NULL)) { + if ((KREG(64) != 0) || (gSaveContext.eventInf[5] & 0x20) || (sBlueWarp != NULL)) { this->unk_1D20 = 0; - D_809E0430 = KREG(15) + 20; + sMusicStartTimer = KREG(15) + 20; } else { this->unk_1D20 = 1; } R_MAGIC_CONSUME_TIMER_GIANT = KREG(14) + 20; this->unk_01AC = 1.0f; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON5, 0.0f, 1000.0f, 0.0f, 0, 0, 0, 0); - } else if (this->actor.params == 100) { - this->actor.update = func_809DC218; + } else if (this->actor.params == TWINMOLD_TAIL) { + this->actor.update = Boss02_Tail_Update; this->actor.draw = NULL; this->actor.hintId = 0x2E; } else { - if (this->actor.params != 35) { - this->actor.params = 0; - Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); - D_809E0424 = this; - D_809E0428 = (Boss02*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, 35); - D_809E0424->actor.colChkInfo.damageTable = &sDamageTable2; - D_809E0428->actor.colChkInfo.damageTable = &sDamageTable1; - D_809E0424->unk_1674 = D_809E0428; - D_809E0428->unk_1674 = D_809E0424; + if (this->actor.params != TWINMOLD_BLUE) { + this->actor.params = TWINMOLD_RED; + Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, TWINMOLD_STATIC); + sRedTwinmold = this; + sBlueTwinmold = + (Boss02*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_02, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, + this->actor.world.rot.y, this->actor.world.rot.z, TWINMOLD_BLUE); + sRedTwinmold->actor.colChkInfo.damageTable = &sRedTwinmoldDamageTable; + sBlueTwinmold->actor.colChkInfo.damageTable = &sBlueTwinmoldDamageTable; + sRedTwinmold->otherTwinmold = sBlueTwinmold; + sBlueTwinmold->otherTwinmold = sRedTwinmold; } this->actor.colChkInfo.mass = MASS_HEAVY; @@ -603,7 +604,7 @@ void Boss02_Init(Actor* thisx, PlayState* play) { this->colliderSphere2Elements); Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); - if (D_809E0434 != NULL) { + if (sBlueWarp != NULL) { func_809DAA74(this, play); } else { func_809DAAA8(this, play); @@ -617,7 +618,8 @@ void Boss02_Init(Actor* thisx, PlayState* play) { this->unk_014C = Rand_ZeroFloat(1000.0f); this->unk_1678 = 22; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, 100); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_02, 0.0f, 0.0f, 0.0f, 0, 0, 0, + TWINMOLD_TAIL); } } @@ -635,14 +637,14 @@ void func_809DAA98(Boss02* this, PlayState* play) { void func_809DAAA8(Boss02* this, PlayState* play) { this->actionFunc = func_809DAB78; Animation_MorphToLoop(&this->skelAnime, &gTwinmoldHeadFlyAnim, 0.0f); - if (D_809E042C->unk_1D20 != 0) { + if (sTwinmoldStatic->unk_1D20 != 0) { this->unk_0144 = 10; } else { this->unk_0144 = 100; this->unk_01A8 = 25.0f; - D_809E042C->unk_1D7E = 100; + sTwinmoldStatic->unk_1D7E = 100; this->actor.world.pos.x = 0.0f; - if (D_809E0424 == this) { + if (sRedTwinmold == this) { this->actor.world.pos.z = -1000.0f; } else { this->actor.world.pos.z = 1400.0f; @@ -666,7 +668,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { f32 phi_f2; s16 temp_s0; s16 temp_s2; - Boss02* spB0 = this->unk_1674; + Boss02* otherTwinmold = this->otherTwinmold; Vec3f spA4; f32 spA0; f32 sp9C; @@ -693,7 +695,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_01A4 = Math_SinS(this->unk_0196) * this->unk_019C; this->actor.world.rot.x = this->actor.shape.rot.x + this->unk_01A4; - if (!(this->unk_014C & 0x1F) && (D_809E042C->unk_1D20 == 0)) { + if (!(this->unk_014C & 0x1F) && (sTwinmoldStatic->unk_1D20 == 0)) { this->unk_01A0 = Rand_ZeroFloat(0x1000) + 0x800; this->unk_019A = Rand_ZeroFloat(0x400) + 0x200; } @@ -716,7 +718,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { Actor_UpdatePos(&this->actor); spD0 = this->actor.world.pos; - if (D_809E0422 != 0) { + if (sIsInGiantMode) { spD0.y = 5000.0f; } else { spD0.y = 2000.0f; @@ -752,9 +754,9 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0B1C[this->unk_014E].z = BINANG_TO_RAD(this->actor.world.rot.z); } - if ((this->unk_0144 < 10) && (spB0->unk_0144 >= 20)) { + if ((this->unk_0144 < 10) && (otherTwinmold->unk_0144 >= 20)) { this->unk_01B0.y = -1000.0f * D_809DF5B0; - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } this->unk_0144 = 3; @@ -774,7 +776,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->actor.world.pos.x = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); this->actor.world.pos.z = randPlusMinusPoint5Scaled(5000.0f * D_809DF5B0); this->actor.world.pos.y = -500.0f * D_809DF5B0; - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->actor.world.pos.y += 3150.0f; } } @@ -807,7 +809,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_01B0.z = 500.0f; } this->unk_01B0.y = Rand_ZeroFloat(800.0f * D_809DF5B0) + (200.0f * D_809DF5B0); - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } } @@ -824,7 +826,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { if (sqrtf(SQ(spCC) + SQ(spC8) + SQ(spC4)) < (phi_f2 * D_809DF5B0)) { this->unk_0144 = 3; this->unk_01B0.y = -3000.0f * D_809DF5B0; - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } this->unk_0146[0] = 150; @@ -846,7 +848,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0144 = 3; this->unk_01B0.x = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.x; this->unk_01B0.y = -3000.0f * D_809DF5B0; - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } this->unk_01B0.z = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + this->actor.world.pos.z; @@ -870,7 +872,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { return; case 11: - if (this == D_809E0424) { + if (this == sRedTwinmold) { this->unk_01B0.x = D_809DF9C0[this->unk_1D1A].x; this->unk_01B0.y = D_809DF9C0[this->unk_1D1A].y; this->unk_01B0.z = D_809DF9C0[this->unk_1D1A].z; @@ -894,7 +896,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { if (this->unk_1D1A > 8) { this->unk_1D1A = 8; } - if (this == D_809E0424) { + if (this == sRedTwinmold) { this->unk_01B0.x = D_809DF9C0[this->unk_1D1A].x; this->unk_01B0.y = D_809DF9C0[this->unk_1D1A].y; this->unk_01B0.z = D_809DF9C0[this->unk_1D1A].z; @@ -915,7 +917,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0146[0] = 50; this->unk_01B0.x = player->actor.world.pos.x + spA4.x; this->unk_01B0.y = randPlusMinusPoint5Scaled(500.0f * D_809DF5B0) + (600.0f * D_809DF5B0); - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_01B0.y += 3150.0f; } this->unk_01B0.z = player->actor.world.pos.z + spA4.z; @@ -933,8 +935,8 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0144 = 21; this->unk_0146[0] = 20; this->unk_0152 = 0; - D_809E042C->unk_1D20 = 102; - D_809E042C->unk_1D5C = 0.0f; + sTwinmoldStatic->unk_1D20 = 102; + sTwinmoldStatic->subCamAtVel = 0.0f; play_sound(NA_SE_EN_INBOSS_DEAD_PRE2_OLD); } else if (!(this->unk_0146[1] & 0xF) && (Rand_ZeroOne() < 0.5f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_INBOSS_DAMAGE_OLD); @@ -974,7 +976,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->actor.speedXZ = 15.0f * D_809DF5B0; } - if (spB0->unk_0144 >= 10) { + if (otherTwinmold->unk_0144 >= 10) { Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000); } @@ -998,10 +1000,10 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0170 = this->unk_017C; this->unk_016C = 30; this->unk_0170.y = this->actor.floorHeight; - D_809E042C->unk_1D20 = 103; - D_809E042C->unk_1D1C = 0; - D_809E042C->unk_0146[0] = 15; - D_809E042C->unk_0150 = 0; + sTwinmoldStatic->unk_1D20 = 103; + sTwinmoldStatic->unk_1D1C = 0; + sTwinmoldStatic->unk_0146[0] = 15; + sTwinmoldStatic->unk_0150 = 0; play_sound(NA_SE_EV_LIGHTNING); for (i = 0; i < 30; i++) { @@ -1052,13 +1054,13 @@ void func_809DAB78(Boss02* this, PlayState* play) { } void func_809DBFB4(Boss02* this, PlayState* play) { - Boss02* temp_s6 = this->unk_1674; + Boss02* otherTwinmold = this->otherTwinmold; s32 temp; s32 i; u8 damage; if (this->unk_0154 == 0) { - if (D_809E0422 != 0) { + if (sIsInGiantMode) { temp = 0; } else { temp = 1; @@ -1078,7 +1080,7 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->unk_015C = 10; } - if (D_809E0422 != 0) { + if (sIsInGiantMode) { this->unk_0152 = 15; } else { this->unk_0152 = 12; @@ -1086,7 +1088,7 @@ void func_809DBFB4(Boss02* this, PlayState* play) { damage = this->actor.colChkInfo.damage; - if (temp_s6->unk_0144 < 20) { + if (otherTwinmold->unk_0144 < 20) { do { do { this->actor.colChkInfo.health -= damage; @@ -1100,17 +1102,17 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->skelAnime.playSpeed = 2.0f; this->unk_0144 = 20; - if (temp_s6->unk_0144 >= 10) { + if (otherTwinmold->unk_0144 >= 10) { Audio_QueueSeqCmd(0x100100FF); } else { - temp_s6->unk_0195 = 1; + otherTwinmold->unk_0195 = 1; } this->unk_0146[1] = BREG(70) + 170; this->unk_0146[0] = 0; this->actor.shape.rot.x = 0x4000; - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { if (this->actor.world.pos.y < -200.0f) { this->actor.world.pos.y = -200.0f; } @@ -1118,12 +1120,12 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->actor.world.pos.y = 3130.0f; } - D_809E042C->unk_1D20 = 100; + sTwinmoldStatic->unk_1D20 = 100; - if (this == D_809E0424) { - D_809E042C->unk_0194 = 0; + if (this == sRedTwinmold) { + sTwinmoldStatic->unk_0194 = 0; } else { - D_809E042C->unk_0194 = 1; + sTwinmoldStatic->unk_0194 = 1; } } } @@ -1132,23 +1134,23 @@ void func_809DBFB4(Boss02* this, PlayState* play) { } } -void func_809DC218(Actor* thisx, PlayState* play) { +void Boss02_Tail_Update(Actor* thisx, PlayState* play) { Boss02* this = THIS; s32 pad; - Vec3f sp24; - CollisionPoly* sp20; + Vec3f pos; + CollisionPoly* outPoly; this->unk_014C++; if ((this->unk_014C + this->actor.params) & 1) { - sp24 = this->actor.world.pos; + pos = this->actor.world.pos; this->actor.focus.pos = this->actor.world.pos; - if (D_809E0422 != 0) { - sp24.y = 5000.0f; + if (sIsInGiantMode) { + pos.y = 5000.0f; } else { - sp24.y = 2000.0f; + pos.y = 2000.0f; } - if ((this->actor.focus.pos.y < BgCheck_EntityRaycastFloor1(&play->colCtx, &sp20, &sp24)) || (D_809E0422 != 0)) { + if ((this->actor.focus.pos.y < BgCheck_EntityRaycastFloor1(&play->colCtx, &outPoly, &pos)) || sIsInGiantMode) { this->actor.flags &= ~ACTOR_FLAG_1; } else { this->actor.flags |= ACTOR_FLAG_1; @@ -1156,19 +1158,19 @@ void func_809DC218(Actor* thisx, PlayState* play) { } } -void Boss02_Update(Actor* thisx, PlayState* play) { +void Boss02_Twinmold_Update(Actor* thisx, PlayState* play) { Vec3f sp3C; Boss02* this = THIS; s32 pad; s16 i; - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { Actor_SetScale(&this->actor, 0.6f); } else { Actor_SetScale(&this->actor, 0.060000001f); } - if (D_809E042C->unk_1D18 == 0) { + if (sTwinmoldStatic->unk_1D18 == 0) { for (i = 0; i < ARRAY_COUNT(this->unk_0146); i++) { if (this->unk_0146[i] != 0) { this->unk_0146[i]--; @@ -1274,18 +1276,18 @@ void Boss02_Update(Actor* thisx, PlayState* play) { } } -void func_809DC78C(Actor* thisx, PlayState* play) { +void Boss02_Static_Update(Actor* thisx, PlayState* play) { Boss02* this = THIS; this->unk_01AC = D_809DF5B0; play->envCtx.sandstormState = 0xD; - if (D_809E0434 != NULL) { + if (sBlueWarp != NULL) { this->unk_1D74 = KREG(23) + -15.0f; D_801F4E30 = 0; play->envCtx.lightSettingOverride = 1; play->skyboxId = 1; - } else if (D_809E0422 == 0) { + } else if (!sIsInGiantMode) { this->unk_1D74 = 0.0f; D_801F4E30 = this->unk_1D7C; play->envCtx.lightSettingOverride = 0; @@ -1303,10 +1305,10 @@ void func_809DC78C(Actor* thisx, PlayState* play) { this->unk_0146[0]--; } - if (D_809E0434 == NULL) { - if (D_809E0430 != 0) { - D_809E0430--; - if (D_809E0430 == 0) { + if (sBlueWarp == NULL) { + if (sMusicStartTimer != 0) { + sMusicStartTimer--; + if (sMusicStartTimer == 0) { Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); } } @@ -1328,7 +1330,7 @@ Gfx* D_809DFA9C[] = { Vec3f D_809DFAF4 = { -10000.0f, -100000.0f, -100000.0f }; -void Boss02_Draw(Actor* thisx, PlayState* play2) { +void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) { PlayState* play = play2; Boss02* this = THIS; s32 i; @@ -1358,7 +1360,7 @@ void Boss02_Draw(Actor* thisx, PlayState* play2) { gSPSegment(POLY_OPA_DISP++, 0x0D, mtx); - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { sp98 = -500.0f; } else { sp98 = 3100.0f; @@ -1452,7 +1454,7 @@ void Boss02_Draw(Actor* thisx, PlayState* play2) { CLOSE_DISPS(play->state.gfxCtx); - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { func_809DA50C(0, &this->colliderSphere2, &D_809DFAF4); func_809DA50C(21, &this->colliderSphere1, &this->unk_147C[0]); } else { @@ -1461,7 +1463,7 @@ void Boss02_Draw(Actor* thisx, PlayState* play2) { } } -void func_809DD0A8(Actor* thisx, PlayState* play) { +void Boss02_Static_Draw(Actor* thisx, PlayState* play) { Boss02_DrawEffects(play); } @@ -1470,13 +1472,13 @@ void Boss02_UpdateEffects(PlayState* play) { f32 floorY; s16 i; - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { floorY = 0.0f; } else { floorY = 3150.0f; } - for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) { if (effect->type) { effect->timer++; effect->pos.x += effect->velocity.x * D_809DF5B0; @@ -1523,7 +1525,7 @@ void Boss02_DrawEffects(PlayState* play) { func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) { if (effect->type == TWINMOLD_EFFECT_SAND) { if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustMaterialDL); @@ -1551,7 +1553,7 @@ void Boss02_DrawEffects(PlayState* play) { } effect = (TwinmoldEffect*)play->specialEffects; - for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + for (i = 0, flag = false; i < ARRAY_COUNT(sEffects); i++, effect++) { if (effect->type == TWINMOLD_EFFECT_FRAGMENT) { if (!flag) { gDPSetCombineLERP(POLY_OPA_DISP++, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0, PRIMITIVE, @@ -1572,7 +1574,7 @@ void Boss02_DrawEffects(PlayState* play) { } effect = (TwinmoldEffect*)play->specialEffects; - for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + for (i = 0, flag = false; i < ARRAY_COUNT(sEffects); i++, effect++) { if (effect->type == TWINMOLD_EFFECT_FLASH) { if (!flag) { //! @bug - dev forgot to set flag to 1, should only apply to first entry? gSPDisplayList(POLY_XLU_DISP++, gLightOrb1DL); @@ -1591,7 +1593,7 @@ void Boss02_DrawEffects(PlayState* play) { } effect = (TwinmoldEffect*)play->specialEffects; - for (i = 0, flag = false; i < ARRAY_COUNT(D_809E0438); i++, effect++) { + for (i = 0, flag = false; i < ARRAY_COUNT(sEffects); i++, effect++) { if (effect->type == TWINMOLD_EFFECT_BLACK_DUST) { if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gTwinmoldDustMaterialDL); @@ -1631,14 +1633,14 @@ void func_809DD934(Boss02* this, PlayState* play) { case 0: if (player->stateFlags1 & 0x100) { Cutscene_Start(play, &play->csCtx); - this->unk_1D22 = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->unk_1D22, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_8016566C(150); this->unk_1D14 = 0; - this->unk_1D5C = 0.0f; + this->subCamAtVel = 0.0f; this->unk_1D58 = 0.0f; - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { this->unk_1D18 = 1; this->unk_1D68 = 10.0f; this->unk_1D64 = 60.0f; @@ -1672,11 +1674,11 @@ void func_809DD934(Boss02* this, PlayState* play) { if (this->unk_1D14 == (u32)(BREG(43) + 60)) { play_sound(NA_SE_PL_TRANSFORM_GIANT); } - Math_ApproachF(&this->unk_1D64, 200.0f, 0.1f, this->unk_1D5C * 640.0f); - Math_ApproachF(&this->unk_1D6C, 273.0f, 0.1f, this->unk_1D5C * 150.0f); - Math_ApproachF(&this->unk_1D70, 0.1f, 0.2f, this->unk_1D5C * 0.1f); - Math_ApproachF(&this->unk_1D74, -100.0f, 1.0f, this->unk_1D5C * 100.0f); - Math_ApproachF(&this->unk_1D5C, 1.0f, 1.0f, 0.001f); + Math_ApproachF(&this->unk_1D64, 200.0f, 0.1f, this->subCamAtVel * 640.0f); + Math_ApproachF(&this->unk_1D6C, 273.0f, 0.1f, this->subCamAtVel * 150.0f); + Math_ApproachF(&this->unk_1D70, 0.1f, 0.2f, this->subCamAtVel * 0.1f); + Math_ApproachF(&this->unk_1D74, -100.0f, 1.0f, this->subCamAtVel * 100.0f); + Math_ApproachF(&this->subCamAtVel, 1.0f, 1.0f, 0.001f); } else { Math_ApproachF(&this->unk_1D64, 30.0f, 0.1f, 1.0f); } @@ -1723,11 +1725,11 @@ void func_809DD934(Boss02* this, PlayState* play) { if (this->unk_1D14 == (u32)(BREG(44) + 10)) { play_sound(NA_SE_PL_TRANSFORM_NORAML); } - Math_ApproachF(&this->unk_1D64, 60.0f, 0.1f, this->unk_1D5C * 640.0f); - Math_ApproachF(&this->unk_1D6C, 23.0f, 0.1f, this->unk_1D5C * 150.0f); + Math_ApproachF(&this->unk_1D64, 60.0f, 0.1f, this->subCamAtVel * 640.0f); + Math_ApproachF(&this->unk_1D6C, 23.0f, 0.1f, this->subCamAtVel * 150.0f); Math_ApproachF(&this->unk_1D70, 0.01f, 0.1f, 0.003f); - Math_ApproachF(&this->unk_1D74, 0.0f, 1.0f, this->unk_1D5C * 100.0f); - Math_ApproachF(&this->unk_1D5C, 2.0f, 1.0f, 0.01f); + Math_ApproachF(&this->unk_1D74, 0.0f, 1.0f, this->subCamAtVel * 100.0f); + Math_ApproachF(&this->subCamAtVel, 2.0f, 1.0f, 0.01f); } if (this->unk_1D14 == 42) { @@ -1748,8 +1750,8 @@ void func_809DD934(Boss02* this, PlayState* play) { block_38: case 20: this->unk_1D18 = 0; - func_80169AFC(play, this->unk_1D22, 0); - this->unk_1D22 = 0; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); this->actor.flags |= ACTOR_FLAG_1; player->stateFlags1 &= ~0x100; @@ -1767,19 +1769,19 @@ void func_809DD934(Boss02* this, PlayState* play) { play->envCtx.lightSettings.fogNear = this->unk_1D74; if (sp57) { - D_809E0422 = 1 - D_809E0422; - if (D_809E0422 == 0) { + sIsInGiantMode = 1 - sIsInGiantMode; + if (!sIsInGiantMode) { D_809DF5B0 = 1.0f; } else { D_809DF5B0 = 0.1f; } this->unk_01AC = D_809DF5B0; - if (D_809E0422 == 0) { - if (D_809E0434 != NULL) { - D_809E0434->unk_203 = 0; - D_809E0434->unk_204 = 1.0f; - D_809E0434->dyna.actor.world.pos.y = 60.0f; + if (!sIsInGiantMode) { + if (sBlueWarp != NULL) { + sBlueWarp->unk_203 = 0; + sBlueWarp->unk_204 = 1.0f; + sBlueWarp->dyna.actor.world.pos.y = 60.0f; } player->actor.world.pos.x *= 10.0f; @@ -1788,70 +1790,70 @@ void func_809DD934(Boss02* this, PlayState* play) { player->unk_B68 = player->actor.world.pos.y; player->actor.world.pos.z *= 10.0f; - if ((D_809E0434 != NULL) && ((SQ(player->actor.world.pos.z) + SQ(player->actor.world.pos.x)) < SQ(60.0f))) { + if ((sBlueWarp != NULL) && ((SQ(player->actor.world.pos.z) + SQ(player->actor.world.pos.x)) < SQ(60.0f))) { player->actor.world.pos.z = 60.0f; player->actor.world.pos.x = 60.0f; } - D_809E0424->actor.world.pos.x *= 10.0f; - D_809E0424->actor.world.pos.y -= 3150.0f; - D_809E0424->actor.world.pos.y *= 10.0f; - D_809E0424->actor.world.pos.z *= 10.0f; + sRedTwinmold->actor.world.pos.x *= 10.0f; + sRedTwinmold->actor.world.pos.y -= 3150.0f; + sRedTwinmold->actor.world.pos.y *= 10.0f; + sRedTwinmold->actor.world.pos.z *= 10.0f; - D_809E0424->unk_0170.x *= 10.0f; - D_809E0424->unk_0170.y -= 3150.0f; - D_809E0424->unk_0170.y *= 10.0f; - D_809E0424->unk_0170.z *= 10.0f; + sRedTwinmold->unk_0170.x *= 10.0f; + sRedTwinmold->unk_0170.y -= 3150.0f; + sRedTwinmold->unk_0170.y *= 10.0f; + sRedTwinmold->unk_0170.z *= 10.0f; for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { - D_809E0424->unk_01BC[i].x *= 10.0f; - D_809E0424->unk_01BC[i].y -= 3150.0f; - D_809E0424->unk_01BC[i].y *= 10.0f; - D_809E0424->unk_01BC[i].z *= 10.0f; + sRedTwinmold->unk_01BC[i].x *= 10.0f; + sRedTwinmold->unk_01BC[i].y -= 3150.0f; + sRedTwinmold->unk_01BC[i].y *= 10.0f; + sRedTwinmold->unk_01BC[i].z *= 10.0f; } - D_809E0424->unk_01B0.x *= 10.0f; - D_809E0424->unk_01B0.y -= 3150.0f; - D_809E0424->unk_01B0.y *= 10.0f; - D_809E0424->unk_01B0.z *= 10.0f; + sRedTwinmold->unk_01B0.x *= 10.0f; + sRedTwinmold->unk_01B0.y -= 3150.0f; + sRedTwinmold->unk_01B0.y *= 10.0f; + sRedTwinmold->unk_01B0.z *= 10.0f; - D_809E0424->unk_017C.y -= 3150.0f; - D_809E0424->unk_017C.y *= 10.0f; - D_809E0424->unk_0188.y -= 3150.0f; - D_809E0424->unk_0188.y *= 10.0f; + sRedTwinmold->unk_017C.y -= 3150.0f; + sRedTwinmold->unk_017C.y *= 10.0f; + sRedTwinmold->unk_0188.y -= 3150.0f; + sRedTwinmold->unk_0188.y *= 10.0f; - D_809E0428->actor.world.pos.x *= 10.0f; - D_809E0428->actor.world.pos.y -= 3150.0f; - D_809E0428->actor.world.pos.y *= 10.0f; - D_809E0428->actor.world.pos.z *= 10.0f; + sBlueTwinmold->actor.world.pos.x *= 10.0f; + sBlueTwinmold->actor.world.pos.y -= 3150.0f; + sBlueTwinmold->actor.world.pos.y *= 10.0f; + sBlueTwinmold->actor.world.pos.z *= 10.0f; - D_809E0428->unk_0170.x *= 10.0f; - D_809E0428->unk_0170.y -= 3150.0f; - D_809E0428->unk_0170.y *= 10.0f; - D_809E0428->unk_0170.z *= 10.0f; + sBlueTwinmold->unk_0170.x *= 10.0f; + sBlueTwinmold->unk_0170.y -= 3150.0f; + sBlueTwinmold->unk_0170.y *= 10.0f; + sBlueTwinmold->unk_0170.z *= 10.0f; for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { - D_809E0428->unk_01BC[i].x *= 10.0f; - D_809E0428->unk_01BC[i].y -= 3150.0f; - D_809E0428->unk_01BC[i].y *= 10.0f; - D_809E0428->unk_01BC[i].z *= 10.0f; + sBlueTwinmold->unk_01BC[i].x *= 10.0f; + sBlueTwinmold->unk_01BC[i].y -= 3150.0f; + sBlueTwinmold->unk_01BC[i].y *= 10.0f; + sBlueTwinmold->unk_01BC[i].z *= 10.0f; } - D_809E0428->unk_01B0.x *= 10.0f; - D_809E0428->unk_01B0.y -= 3150.0f; - D_809E0428->unk_01B0.y *= 10.0f; - D_809E0428->unk_01B0.z *= 10.0f; + sBlueTwinmold->unk_01B0.x *= 10.0f; + sBlueTwinmold->unk_01B0.y -= 3150.0f; + sBlueTwinmold->unk_01B0.y *= 10.0f; + sBlueTwinmold->unk_01B0.z *= 10.0f; - D_809E0428->unk_017C.y -= 3150.0f; - D_809E0428->unk_017C.y *= 10.0f; - D_809E0428->unk_0188.y -= 3150.0f; - D_809E0428->unk_0188.y *= 10.0f; + sBlueTwinmold->unk_017C.y -= 3150.0f; + sBlueTwinmold->unk_017C.y *= 10.0f; + sBlueTwinmold->unk_0188.y -= 3150.0f; + sBlueTwinmold->unk_0188.y *= 10.0f; } else { - if (D_809E0434 != 0) { - D_809E0434->unk_203 = 1; - D_809E0434->unk_204 = 0.1f; - D_809E0434->dyna.actor.world.pos.y = 3155.0f; + if (sBlueWarp != 0) { + sBlueWarp->unk_203 = 1; + sBlueWarp->unk_204 = 0.1f; + sBlueWarp->dyna.actor.world.pos.y = 3155.0f; } player->actor.world.pos.x *= 0.1f; @@ -1860,59 +1862,59 @@ void func_809DD934(Boss02* this, PlayState* play) { player->unk_B68 = player->actor.world.pos.y; player->actor.world.pos.z *= 0.1f; - D_809E0424->actor.world.pos.x *= 0.1f; - D_809E0424->actor.world.pos.y *= 0.1f; - D_809E0424->actor.world.pos.y += 3150.0f; - D_809E0424->actor.world.pos.z *= 0.1f; + sRedTwinmold->actor.world.pos.x *= 0.1f; + sRedTwinmold->actor.world.pos.y *= 0.1f; + sRedTwinmold->actor.world.pos.y += 3150.0f; + sRedTwinmold->actor.world.pos.z *= 0.1f; - D_809E0424->unk_0170.x *= 0.1f; - D_809E0424->unk_0170.y *= 0.1f; - D_809E0424->unk_0170.y += 3150.0f; - D_809E0424->unk_0170.z *= 0.1f; + sRedTwinmold->unk_0170.x *= 0.1f; + sRedTwinmold->unk_0170.y *= 0.1f; + sRedTwinmold->unk_0170.y += 3150.0f; + sRedTwinmold->unk_0170.z *= 0.1f; for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { - D_809E0424->unk_01BC[i].x *= 0.1f; - D_809E0424->unk_01BC[i].y *= 0.1f; - D_809E0424->unk_01BC[i].y += 3150.0f; - D_809E0424->unk_01BC[i].z *= 0.1f; + sRedTwinmold->unk_01BC[i].x *= 0.1f; + sRedTwinmold->unk_01BC[i].y *= 0.1f; + sRedTwinmold->unk_01BC[i].y += 3150.0f; + sRedTwinmold->unk_01BC[i].z *= 0.1f; } - D_809E0424->unk_01B0.x *= 0.1f; - D_809E0424->unk_01B0.y *= 0.1f; - D_809E0424->unk_01B0.y += 3150.0f; - D_809E0424->unk_01B0.z *= 0.1f; + sRedTwinmold->unk_01B0.x *= 0.1f; + sRedTwinmold->unk_01B0.y *= 0.1f; + sRedTwinmold->unk_01B0.y += 3150.0f; + sRedTwinmold->unk_01B0.z *= 0.1f; - D_809E0424->unk_017C.y *= 0.1f; - D_809E0424->unk_017C.y += 3150.0f; - D_809E0424->unk_0188.y *= 0.1f; - D_809E0424->unk_0188.y += 3150.0f; + sRedTwinmold->unk_017C.y *= 0.1f; + sRedTwinmold->unk_017C.y += 3150.0f; + sRedTwinmold->unk_0188.y *= 0.1f; + sRedTwinmold->unk_0188.y += 3150.0f; - D_809E0428->actor.world.pos.x *= 0.1f; - D_809E0428->actor.world.pos.y *= 0.1f; - D_809E0428->actor.world.pos.y += 3150.0f; - D_809E0428->actor.world.pos.z *= 0.1f; + sBlueTwinmold->actor.world.pos.x *= 0.1f; + sBlueTwinmold->actor.world.pos.y *= 0.1f; + sBlueTwinmold->actor.world.pos.y += 3150.0f; + sBlueTwinmold->actor.world.pos.z *= 0.1f; - D_809E0428->unk_0170.x *= 0.1f; - D_809E0428->unk_0170.y *= 0.1f; - D_809E0428->unk_0170.y += 3150.0f; - D_809E0428->unk_0170.z *= 0.1f; + sBlueTwinmold->unk_0170.x *= 0.1f; + sBlueTwinmold->unk_0170.y *= 0.1f; + sBlueTwinmold->unk_0170.y += 3150.0f; + sBlueTwinmold->unk_0170.z *= 0.1f; for (i = 0; i < ARRAY_COUNT(this->unk_01BC); i++) { - D_809E0428->unk_01BC[i].x *= 0.1f; - D_809E0428->unk_01BC[i].y *= 0.1f; - D_809E0428->unk_01BC[i].y += 3150.0f; - D_809E0428->unk_01BC[i].z *= 0.1f; + sBlueTwinmold->unk_01BC[i].x *= 0.1f; + sBlueTwinmold->unk_01BC[i].y *= 0.1f; + sBlueTwinmold->unk_01BC[i].y += 3150.0f; + sBlueTwinmold->unk_01BC[i].z *= 0.1f; } - D_809E0428->unk_01B0.x *= 0.1f; - D_809E0428->unk_01B0.y *= 0.1f; - D_809E0428->unk_01B0.y += 3150.0f; - D_809E0428->unk_01B0.z *= 0.1f; + sBlueTwinmold->unk_01B0.x *= 0.1f; + sBlueTwinmold->unk_01B0.y *= 0.1f; + sBlueTwinmold->unk_01B0.y += 3150.0f; + sBlueTwinmold->unk_01B0.z *= 0.1f; - D_809E0428->unk_017C.y *= 0.1f; - D_809E0428->unk_017C.y += 3150.0f; - D_809E0428->unk_0188.y *= 0.1f; - D_809E0428->unk_0188.y += 3150.0f; + sBlueTwinmold->unk_017C.y *= 0.1f; + sBlueTwinmold->unk_017C.y += 3150.0f; + sBlueTwinmold->unk_0188.y *= 0.1f; + sBlueTwinmold->unk_0188.y += 3150.0f; } player->actor.home.pos = player->actor.world.pos; @@ -1927,15 +1929,15 @@ void func_809DD934(Boss02* this, PlayState* play) { temp_a0_5 = temp_a0_5->next; } { - f32 tmp = D_809E0422 ? 3150.0f : 0.0f; + f32 tmp = sIsInGiantMode ? 3150.0f : 0.0f; - Actor_Spawn(&play->actorCtx, play, ACTOR_BG_INIBS_MOVEBG, 0, tmp, 0, 0, 0, 0, D_809E0422); + Actor_Spawn(&play->actorCtx, play, ACTOR_BG_INIBS_MOVEBG, 0, tmp, 0, 0, 0, 0, sIsInGiantMode); } temp_a0_5 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (temp_a0_5 != NULL) { if ((temp_a0_5->id == ACTOR_EN_TANRON5) || (temp_a0_5->id == ACTOR_ITEM_B_HEART)) { - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { temp_a0_5->world.pos.y -= 3150.0f; temp_a0_5->world.pos.y *= 10.0f; @@ -2015,22 +2017,22 @@ void func_809DD934(Boss02* this, PlayState* play) { break; } - if ((this->unk_1D18 != 0) && (this->unk_1D22 != 0)) { + if ((this->unk_1D18 != 0) && (this->subCamId != SUB_CAM_ID_DONE)) { Matrix_RotateYS(player->actor.shape.rot.y, MTXMODE_NEW); Matrix_MultVecZ(this->unk_1D64, &sp58); - this->unk_1D24.x = player->actor.world.pos.x + sp58.x; - this->unk_1D24.y = player->actor.world.pos.y + sp58.y + this->unk_1D68; - this->unk_1D24.z = player->actor.world.pos.z + sp58.z; + this->subCamEye.x = player->actor.world.pos.x + sp58.x; + this->subCamEye.y = player->actor.world.pos.y + sp58.y + this->unk_1D68; + this->subCamEye.z = player->actor.world.pos.z + sp58.z; - this->unk_1D30.x = player->actor.world.pos.x; - this->unk_1D30.y = player->actor.world.pos.y + this->unk_1D6C; - this->unk_1D30.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + this->unk_1D6C; + this->subCamAt.z = player->actor.world.pos.z; this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY); - Matrix_MultVecY(1.0f, &this->unk_1D3C); - Play_CameraSetAtEyeUp(play, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); + Matrix_MultVecY(1.0f, &this->subCamUp); + Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); ShrinkWindow_SetLetterboxTarget(27); } } @@ -2038,14 +2040,14 @@ void func_809DD934(Boss02* this, PlayState* play) { void func_809DEAC4(Boss02* this, PlayState* play) { Player* player = GET_PLAYER(play); Boss02* sp68; - Vec3f sp5C; + Vec3f subCamEye; f32 sp58 = 0.0f; this->unk_1D1C++; if (this->unk_0194 == 0) { - sp68 = D_809E0424; + sp68 = sRedTwinmold; } else { - sp68 = D_809E0428; + sp68 = sBlueTwinmold; } switch (this->unk_1D20) { @@ -2057,22 +2059,22 @@ void func_809DEAC4(Boss02* this, PlayState* play) { break; } Cutscene_Start(play, &play->csCtx); - this->unk_1D22 = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->unk_1D22, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 2; this->unk_1D1C = 0; case 2: player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; - this->unk_1D24.x = player->actor.world.pos.x - 20.0f; - this->unk_1D24.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 29.0f; - this->unk_1D24.z = player->actor.world.pos.z - 50; + this->subCamEye.x = player->actor.world.pos.x - 20.0f; + this->subCamEye.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 29.0f; + this->subCamEye.z = player->actor.world.pos.z - 50; - this->unk_1D30.x = player->actor.world.pos.x; - this->unk_1D30.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 17.0f; - this->unk_1D30.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 17.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_1D1C >= 30) { if (this->unk_1D1C == 30) { Rumble_Override(0.0f, 50, 200, 1); @@ -2080,7 +2082,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { this->unk_0150 += 0x4000; sp58 = (Math_SinS(this->unk_0150) * (BREG(19) + 5)) * 0.1f; Matrix_RotateZF(Math_SinS(this->unk_1D1C * 0x3000) * ((KREG(28) * 0.001f) + 0.017f), MTXMODE_NEW); - Matrix_MultVecY(1.0f, &this->unk_1D3C); + Matrix_MultVecY(1.0f, &this->subCamUp); func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); } @@ -2090,12 +2092,12 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if (this->unk_1D1C == 45) { func_800B7298(play, &this->actor, 21); - D_809E0430 = KREG(91) + 43; + sMusicStartTimer = KREG(91) + 43; } if (this->unk_1D1C == 85) { - D_809E0424->unk_0144 = 11; - D_809E0424->unk_014C = 0; + sRedTwinmold->unk_0144 = 11; + sRedTwinmold->unk_014C = 0; } if (this->unk_1D1C == 92) { @@ -2114,22 +2116,22 @@ void func_809DEAC4(Boss02* this, PlayState* play) { case 10: if (this->unk_1D1C < 310) { - this->unk_1D48 = sp68->actor.world.pos; - this->unk_1D24.x = (sp68->actor.world.pos.x * 50.0f) * 0.001f; - this->unk_1D24.y = (sp68->actor.world.pos.y * 50.0f) * 0.001f; - if (this->unk_1D24.y < 100.0f) { - this->unk_1D24.y = 100.0f; + this->subCamAtNext = sp68->actor.world.pos; + this->subCamEye.x = (sp68->actor.world.pos.x * 50.0f) * 0.001f; + this->subCamEye.y = (sp68->actor.world.pos.y * 50.0f) * 0.001f; + if (this->subCamEye.y < 100.0f) { + this->subCamEye.y = 100.0f; } - this->unk_1D24.z = (sp68->actor.world.pos.z * 100) * 0.001f; + this->subCamEye.z = (sp68->actor.world.pos.z * 100) * 0.001f; } - Math_ApproachF(&this->unk_1D30.x, this->unk_1D48.x, 0.1f, 3000.0f); - Math_ApproachF(&this->unk_1D30.y, this->unk_1D48.y, 0.1f, 3000.0f); - Math_ApproachF(&this->unk_1D30.z, this->unk_1D48.z, 0.1f, 3000.0f); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, 0.1f, 3000.0f); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, 0.1f, 3000.0f); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, 0.1f, 3000.0f); if (this->unk_1D1C == 100) { - D_809E0428->unk_0144 = 11; - D_809E0428->unk_014C = 0; + sBlueTwinmold->unk_0144 = 11; + sBlueTwinmold->unk_014C = 0; this->unk_0194 = 1; } @@ -2139,14 +2141,14 @@ void func_809DEAC4(Boss02* this, PlayState* play) { } if (this->unk_1D1C == (u32)(BREG(27) + 335)) { - func_80169AFC(play, this->unk_1D22, 0); - this->unk_1D22 = 0; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); this->actor.flags |= ACTOR_FLAG_1; this->unk_1D20 = 0; - D_809E0424->unk_0144 = D_809E0428->unk_0144 = 3; - D_809E0424->unk_0146[0] = D_809E0428->unk_0146[0] = 60; + sRedTwinmold->unk_0144 = sBlueTwinmold->unk_0144 = 3; + sRedTwinmold->unk_0146[0] = sBlueTwinmold->unk_0146[0] = 60; gSaveContext.eventInf[5] |= 0x20; } break; @@ -2154,13 +2156,13 @@ void func_809DEAC4(Boss02* this, PlayState* play) { case 100: if (ActorCutscene_GetCurrentIndex() == -1) { Cutscene_Start(play, &play->csCtx); - this->unk_1D22 = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->unk_1D22, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 101; this->unk_1D1C = 0; - this->unk_1D5C = 1.0f; - this->unk_1D30 = sp68->actor.world.pos; + this->subCamAtVel = 1.0f; + this->subCamAt = sp68->actor.world.pos; } else { break; } @@ -2169,30 +2171,30 @@ void func_809DEAC4(Boss02* this, PlayState* play) { case 102: case_10x: if ((this->unk_1D20 == 101) || (this->unk_1D20 == 103)) { - this->unk_1D48 = sp68->actor.world.pos; + this->subCamAtNext = sp68->actor.world.pos; } else { - this->unk_1D48 = sp68->unk_147C[sp68->unk_1678]; + this->subCamAtNext = sp68->unk_147C[sp68->unk_1678]; } - this->unk_1D24.x = player->actor.world.pos.x; - this->unk_1D24.y = player->actor.world.pos.y + 100.0f; - if (D_809E0422 == 0) { - if (this->unk_1D24.y < 100.0f) { - this->unk_1D24.y = 100.0f; + this->subCamEye.x = player->actor.world.pos.x; + this->subCamEye.y = player->actor.world.pos.y + 100.0f; + if (!sIsInGiantMode) { + if (this->subCamEye.y < 100.0f) { + this->subCamEye.y = 100.0f; } - } else if (this->unk_1D24.y < 3160.0f) { - this->unk_1D24.y = 3160.0f; + } else if (this->subCamEye.y < 3160.0f) { + this->subCamEye.y = 3160.0f; } - if (this->unk_1D48.y < (100.0f * D_809DF5B0)) { - this->unk_1D48.y = (100.0f * D_809DF5B0); + if (this->subCamAtNext.y < (100.0f * D_809DF5B0)) { + this->subCamAtNext.y = (100.0f * D_809DF5B0); } - this->unk_1D24.z = player->actor.world.pos.z; - Math_ApproachF(&this->unk_1D30.x, this->unk_1D48.x, 0.3f, this->unk_1D5C * 500.0f); - Math_ApproachF(&this->unk_1D30.y, this->unk_1D48.y, 0.3f, this->unk_1D5C * 500.0f); - Math_ApproachF(&this->unk_1D30.z, this->unk_1D48.z, 0.3f, this->unk_1D5C * 500.0f); - Math_ApproachF(&this->unk_1D5C, 1.0f, 1.0f, 0.02f); + this->subCamEye.z = player->actor.world.pos.z; + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, 0.3f, this->subCamAtVel * 500.0f); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, 0.3f, this->subCamAtVel * 500.0f); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, 0.3f, this->subCamAtVel * 500.0f); + Math_ApproachF(&this->subCamAtVel, 1.0f, 1.0f, 0.02f); break; case 103: @@ -2200,45 +2202,45 @@ void func_809DEAC4(Boss02* this, PlayState* play) { sp58 = Math_SinS(this->unk_0150); sp58 = (sp58 * this->unk_0146[0]) * 1.5f; if (this->unk_1D1C == 30) { - func_80169AFC(play, this->unk_1D22, 0); - this->unk_1D22 = 0; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); this->unk_1D20 = 0; this->actor.flags |= ACTOR_FLAG_1; sp68->unk_0144 = 10; - if ((D_809E0424->unk_0144 >= 10) && (D_809E0428->unk_0144 >= 10)) { + if ((sRedTwinmold->unk_0144 >= 10) && (sBlueTwinmold->unk_0144 >= 10)) { f32 phi_f0; this->unk_1D7E = 0; - if (D_809E0422 == 0) { + if (!sIsInGiantMode) { Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); phi_f0 = 60.0f; } else { Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 3153.0f, -15.0f, 0, 1, 0, 35); phi_f0 = 3155.0f; } - D_809E0434 = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, - 0.0f, phi_f0, 0.0f, 0, 0, 0, 1); + sBlueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, + 0.0f, phi_f0, 0.0f, 0, 0, 0, 1); - if (D_809E0422 == 0) { - D_809E0434->unk_203 = 0; - D_809E0434->unk_204 = 1.0f; + if (!sIsInGiantMode) { + sBlueWarp->unk_203 = 0; + sBlueWarp->unk_204 = 1.0f; } else { - D_809E0434->unk_203 = 1; - D_809E0434->unk_204 = 0.1f; + sBlueWarp->unk_203 = 1; + sBlueWarp->unk_204 = 0.1f; } } } goto case_10x; } - if ((this->unk_1D20 != 0) && (this->unk_1D22 != 0)) { - sp5C = this->unk_1D24; - sp5C.y += sp58 * D_809DF5B0; - Play_CameraSetAtEyeUp(play, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); - this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; - this->unk_1D3C.y = 1.0f; + if ((this->unk_1D20 != 0) && (this->subCamId != SUB_CAM_ID_DONE)) { + subCamEye = this->subCamEye; + subCamEye.y += sp58 * D_809DF5B0; + Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &subCamEye, &this->subCamUp); + this->subCamUp.z = this->subCamUp.x = 0.0f; + this->subCamUp.y = 1.0f; ShrinkWindow_SetLetterboxTarget(27); } } diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.h b/src/overlays/actors/ovl_Boss_02/z_boss_02.h index 601a3e492..17028912b 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.h +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.h @@ -30,6 +30,13 @@ typedef enum { /* 4 */ TWINMOLD_EFFECT_FLASH, // The flashes of light that appear when the parts of Twinmold explode } TwinmoldEffectType; +typedef enum { + /* 0 */ TWINMOLD_RED, + /* 35 */ TWINMOLD_BLUE = 35, + /* 100 */ TWINMOLD_TAIL = 100, + /* 200 */ TWINMOLD_STATIC = 200, +} TwinmoldParams; + typedef struct Boss02 { /* 0x0000 */ Actor actor; /* 0x0144 */ u8 unk_0144; @@ -68,7 +75,7 @@ typedef struct Boss02 { /* 0x15D4 */ Vec3s jointTable[TWINMOLD_HEAD_LIMB_MAX]; /* 0x1622 */ Vec3s morphTable[TWINMOLD_HEAD_LIMB_MAX]; /* 0x1670 */ Boss02ActionFunc actionFunc; - /* 0x1674 */ struct Boss02* unk_1674; // points to the other's instance + /* 0x1674 */ struct Boss02* otherTwinmold; // points to the other's instance /* 0x1678 */ s32 unk_1678; /* 0x167C */ Vec3f unk_167C; /* 0x1688 */ ColliderJntSph colliderSphere1; @@ -81,14 +88,14 @@ typedef struct Boss02 { /* 0x1D1A */ s16 unk_1D1A; /* 0x1D1C */ u32 unk_1D1C; /* 0x1D20 */ s16 unk_1D20; - /* 0x1D22 */ s16 unk_1D22; - /* 0x1D24 */ Vec3f unk_1D24; - /* 0x1D30 */ Vec3f unk_1D30; - /* 0x1D3C */ Vec3f unk_1D3C; - /* 0x1D48 */ Vec3f unk_1D48; + /* 0x1D22 */ s16 subCamId; + /* 0x1D24 */ Vec3f subCamEye; + /* 0x1D30 */ Vec3f subCamAt; + /* 0x1D3C */ Vec3f subCamUp; + /* 0x1D48 */ Vec3f subCamAtNext; /* 0x1D54 */ f32 unk_1D54; /* 0x1D58 */ f32 unk_1D58; - /* 0x1D5C */ f32 unk_1D5C; + /* 0x1D5C */ f32 subCamAtVel; /* 0x1D60 */ UNK_TYPE1 unk1D60[0x4]; /* 0x1D64 */ f32 unk_1D64; /* 0x1D68 */ f32 unk_1D68; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 37a584f53..449660f7e 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -1150,9 +1150,9 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { if (player->actor.world.pos.y < 1350.0f) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); - this->csCamId = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->csCamId, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->actor.world.rot.y = -0x7B30; this->prevPlayerPos.y = 1850.0f; @@ -1165,34 +1165,34 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { player->actor.world.pos.y = 1850.0f; player->actor.world.rot.y = player->actor.shape.rot.y; - this->csCamAt.y = player->actor.world.pos.y + 30.0f; + this->subCamAt.y = player->actor.world.pos.y + 30.0f; this->csState = 1; this->csTimer = 0; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_2D5 = true; - this->cameraFov = KREG(14) + 60.0f; + this->subCamFov = KREG(14) + 60.0f; case 1: player->actor.world.pos.z = 0.0f; player->actor.world.pos.x = 0.0f; player->actor.speedXZ = 0.0f; - this->csCamEye.x = 100.0f; - this->csCamEye.y = 540.0f; + this->subCamEye.x = 100.0f; + this->subCamEye.y = 540.0f; - this->csCamEye.z = player->actor.world.pos.z + 100.0f; - this->csCamAt.x = player->actor.world.pos.x; + this->subCamEye.z = player->actor.world.pos.z + 100.0f; + this->subCamAt.x = player->actor.world.pos.x; - Math_ApproachF(&this->csCamAt.y, player->actor.world.pos.y + 30.0f, 0.5f, 100.0f); - this->csCamAt.z = player->actor.world.pos.z; + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y + 30.0f, 0.5f, 100.0f); + this->subCamAt.z = player->actor.world.pos.z; if (this->csTimer > 105) { this->csState = 2; this->csTimer = 0; this->unk_240 = 0; func_8016566C(0x96); - this->cameraFov = 80.0f; + this->subCamFov = 80.0f; case 2: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_DEMO_MOVE_OLD - SFX_FLAG); @@ -1263,20 +1263,20 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { func_800B7298(play, &this->actor, 8); } - this->csCamEye.x = player->actor.world.pos.x + 30.0f; - this->csCamEye.y = player->actor.world.pos.y + Player_GetHeight(player) - 4.0f + BREG(17); - this->csCamEye.z = player->actor.world.pos.z - 30.0f; + this->subCamEye.x = player->actor.world.pos.x + 30.0f; + this->subCamEye.y = player->actor.world.pos.y + Player_GetHeight(player) - 4.0f + BREG(17); + this->subCamEye.z = player->actor.world.pos.z - 30.0f; - this->csCamAt.x = player->actor.world.pos.x; - this->csCamAt.y = player->actor.world.pos.y + Player_GetHeight(player) - 18.0f + 6.0f + BREG(18); - this->csCamAt.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + Player_GetHeight(player) - 18.0f + 6.0f + BREG(18); + this->subCamAt.z = player->actor.world.pos.z; if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { - this->csCamEye.y -= 60.0f; - this->csCamAt.y -= 35.0f; + this->subCamEye.y -= 60.0f; + this->subCamAt.y -= 35.0f; } - this->cameraFov = 60.0f; + this->subCamFov = 60.0f; if (this->csTimer == 16) { this->csState = 5; this->csTimer = 0; @@ -1293,13 +1293,13 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { player->actor.shape.rot.y = -0x1470; player->actor.world.rot.y = player->actor.shape.rot.y; - this->csCamEye.x = player->actor.world.pos.x + 30.0f - 90.0f + 300.0f; - this->csCamEye.y = player->actor.world.pos.y + 40.0f + 10.0f; - this->csCamEye.z = player->actor.world.pos.z - 30.0f + 160.0f + 300.0f; + this->subCamEye.x = player->actor.world.pos.x + 30.0f - 90.0f + 300.0f; + this->subCamEye.y = player->actor.world.pos.y + 40.0f + 10.0f; + this->subCamEye.z = player->actor.world.pos.z - 30.0f + 160.0f + 300.0f; - this->csCamAt.x = this->actor.world.pos.x; - this->csCamAt.y = this->actor.world.pos.y - 100.0f; - this->csCamAt.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y - 100.0f; + this->subCamAt.z = this->actor.world.pos.z; if (this->csTimer == 10) { this->actor.velocity.y = 30.0f; @@ -1345,34 +1345,34 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { Boss03_SpawnEffectDroplet(play, &effectPos); } - this->csCamTargetAt.x = this->actor.world.pos.x; - this->csCamTargetAt.y = this->actor.world.pos.y - 100.0f; - this->csCamTargetAt.z = this->actor.world.pos.z; + this->subCamAtNext.x = this->actor.world.pos.x; + this->subCamAtNext.y = this->actor.world.pos.y - 100.0f; + this->subCamAtNext.z = this->actor.world.pos.z; } } else { - Math_ApproachF(&this->csCamEye.x, player->actor.world.pos.x + 30.0f - 90.0f + 300.0f - 90.0f, 0.05f, + Math_ApproachF(&this->subCamEye.x, player->actor.world.pos.x + 30.0f - 90.0f + 300.0f - 90.0f, 0.05f, 3.0f); - Math_ApproachF(&this->csCamEye.y, player->actor.world.pos.y + 40.0f + 10.0f + 90.0f, 0.05f, 3.0f); - Math_ApproachF(&this->csCamEye.z, player->actor.world.pos.z - 30.0f + 160.0f + 300.0f - 90.0f, 0.05f, + Math_ApproachF(&this->subCamEye.y, player->actor.world.pos.y + 40.0f + 10.0f + 90.0f, 0.05f, 3.0f); + Math_ApproachF(&this->subCamEye.z, player->actor.world.pos.z - 30.0f + 160.0f + 300.0f - 90.0f, 0.05f, 3.0f); Math_ApproachF(&this->unk_568, 90.0f, 0.05f, 3.0f); } - Math_ApproachF(&this->csCamAt.x, this->csCamTargetAt.x, 0.5f, 100.0f); - Math_ApproachF(&this->csCamAt.y, this->csCamTargetAt.y + this->unk_568, 0.5f, 100.0f); - Math_ApproachF(&this->csCamAt.z, this->csCamTargetAt.z, 0.5f, 100.0f); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, 0.5f, 100.0f); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y + this->unk_568, 0.5f, 100.0f); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, 0.5f, 100.0f); if (this->csTimer == 145) { - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - camera->eye = this->csCamEye; - camera->eyeNext = this->csCamEye; - camera->at = this->csCamAt; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; - func_80169AFC(play, this->csCamId, 0); + func_80169AFC(play, this->subCamId, 0); Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); - this->csCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; @@ -1395,22 +1395,22 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_APPLY); Matrix_RotateYF(sp5C, MTXMODE_APPLY); Matrix_RotateXS(this->actor.world.rot.x, MTXMODE_APPLY); - Matrix_MultVecZ(100.0f, &this->csCamAt); + Matrix_MultVecZ(100.0f, &this->subCamAt); - this->csCamEye = this->actor.world.pos; + this->subCamEye = this->actor.world.pos; for (i = 0; i < bubblesToSpawnNum; i++) { - effectPos.x = randPlusMinusPoint5Scaled(100.0f) + this->csCamAt.x; - effectPos.y = (randPlusMinusPoint5Scaled(100.0f) + this->csCamAt.y) - 150.0f; - effectPos.z = randPlusMinusPoint5Scaled(100.0f) + this->csCamAt.z; + effectPos.x = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.x; + effectPos.y = (randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.y) - 150.0f; + effectPos.z = randPlusMinusPoint5Scaled(100.0f) + this->subCamAt.z; Boss03_SpawnEffectBubble(play, &effectPos); } } - if (this->csCamId != 0) { - Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); - Play_CameraSetFov(play, this->csCamId, this->cameraFov); + if (this->subCamId != SUB_CAM_ID_DONE) { + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, this->subCamFov); } } @@ -1435,7 +1435,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { s32 pad; f32 pad2; f32 sp64; - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); Player* player; f32 sp4C; @@ -1450,9 +1450,9 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == -1) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); - this->csCamId = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->csCamId, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_2BE = Math_FAtan2F(this->actor.world.pos.z, this->actor.world.pos.x); // Player is above water && Player is standing on ground @@ -1464,15 +1464,15 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { case 1: this->csTimer = 0; this->csState = 2; - this->csCamEye.x = camera->eye.x; - this->csCamEye.y = camera->eye.y; - this->csCamEye.z = camera->eye.z; - this->csCamAt.x = camera->at.x; - this->csCamAt.y = camera->at.y; - this->csCamAt.z = camera->at.z; + this->subCamEye.x = mainCam->eye.x; + this->subCamEye.y = mainCam->eye.y; + this->subCamEye.z = mainCam->eye.z; + this->subCamAt.x = mainCam->at.x; + this->subCamAt.y = mainCam->at.y; + this->subCamAt.z = mainCam->at.z; - aux = this->csCamEye.x - this->actor.world.pos.x; - this->unk_568 = Math_Acot2F(this->csCamEye.z - this->actor.world.pos.z, aux); + aux = this->subCamEye.x - this->actor.world.pos.x; + this->unk_568 = Math_Acot2F(this->subCamEye.z - this->actor.world.pos.z, aux); this->unk_570 = 0.0f; this->unk_56C = 0.0f; @@ -1482,26 +1482,26 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { sp90.y = (50.0f * sp64) + 150.0f; sp90.z = (400.0f * sp64) + 300.0f; - this->csCamTargetAt.x = this->actor.world.pos.x; - this->csCamTargetAt.y = this->actor.world.pos.y; - this->csCamTargetAt.z = this->actor.world.pos.z; + this->subCamAtNext.x = this->actor.world.pos.x; + this->subCamAtNext.y = this->actor.world.pos.y; + this->subCamAtNext.z = this->actor.world.pos.z; this->unk_568 += this->unk_56C; Matrix_RotateYF(this->unk_568, MTXMODE_NEW); - Matrix_MultVec3f(&sp90, &this->csCamTargetEye); + Matrix_MultVec3f(&sp90, &this->subCamEyeNext); - this->csCamTargetEye.x += this->actor.world.pos.x; - this->csCamTargetEye.y += this->waterHeight; - this->csCamTargetEye.z += this->actor.world.pos.z; + this->subCamEyeNext.x += this->actor.world.pos.x; + this->subCamEyeNext.y += this->waterHeight; + this->subCamEyeNext.z += this->actor.world.pos.z; sp4C = 40.0f + aux2; - Math_ApproachF(&this->csCamEye.x, this->csCamTargetEye.x, 0.1f, sp4C); - Math_ApproachF(&this->csCamEye.y, this->csCamTargetEye.y, 0.1f, sp4C); - Math_ApproachF(&this->csCamEye.z, this->csCamTargetEye.z, 0.1f, sp4C); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, 0.1f, sp4C); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, 0.1f, sp4C); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, 0.1f, sp4C); sp4C = 70.0f + aux2; - Math_ApproachF(&this->csCamAt.x, this->csCamTargetAt.x, 0.1f, sp4C); - Math_ApproachF(&this->csCamAt.y, this->csCamTargetAt.y, 0.1f, sp4C); - Math_ApproachF(&this->csCamAt.z, this->csCamTargetAt.z, 0.1f, sp4C); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, 0.1f, sp4C); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, 0.1f, sp4C); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, 0.1f, sp4C); } break; } @@ -1622,12 +1622,12 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { case 2: Math_ApproachZeroF(&this->unk_56C, 1.0f, 0.0005f); if (this->csTimer == 60) { - camera = Play_GetCamera(play, CAM_ID_MAIN); - camera->eye = this->csCamEye; - camera->eyeNext = this->csCamEye; - camera->at = this->csCamAt; - func_80169AFC(play, this->csCamId, 0); - this->csCamId = 0; + mainCam = Play_GetCamera(play, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); this->csState = 3; @@ -1642,8 +1642,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { break; } - if (this->csCamId != 0) { - Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -1664,9 +1664,9 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == -1) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); - this->csCamId = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->csCamId, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->csState = 1; this->unk_2BE = 0xBB8; @@ -1691,11 +1691,11 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y + this->unk_2BE, MTXMODE_APPLY); - Matrix_MultVecZ(340.0f, &this->csCamEye); + Matrix_MultVecZ(340.0f, &this->subCamEye); - this->csCamAt.x = this->actor.world.pos.x; - this->csCamAt.y = this->actor.world.pos.y; - this->csCamAt.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y; + this->subCamAt.z = this->actor.world.pos.z; Math_ApproachS(&this->unk_2BE, -4000, 10, 70); @@ -1715,15 +1715,14 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { } if (this->csTimer >= 150) { - Camera* camera; + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - camera = Play_GetCamera(play, CAM_ID_MAIN); - camera->eye = this->csCamEye; - camera->eyeNext = this->csCamEye; - camera->at = this->csCamAt; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; - func_80169AFC(play, this->csCamId, 0); - this->csCamId = 0; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); @@ -1734,8 +1733,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { break; } - if (this->csCamId != 0) { - Play_CameraSetAtEye(play, this->csCamId, &this->csCamAt, &this->csCamEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.h b/src/overlays/actors/ovl_Boss_03/z_boss_03.h index b10446704..a00dbacff 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.h +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.h @@ -92,16 +92,16 @@ typedef struct Boss03 { /* 0x52C */ f32 floppingAnimLastFrame; /* 0x530 */ u32 csTimer; /* 0x534 */ s16 csState; - /* 0x536 */ s16 csCamId; - /* 0x538 */ Vec3f csCamEye; - /* 0x544 */ Vec3f csCamAt; - /* 0x550 */ Vec3f csCamTargetEye; - /* 0x55C */ Vec3f csCamTargetAt; + /* 0x536 */ s16 subCamId; + /* 0x538 */ Vec3f subCamEye; + /* 0x544 */ Vec3f subCamAt; + /* 0x550 */ Vec3f subCamEyeNext; + /* 0x55C */ Vec3f subCamAtNext; /* 0x568 */ f32 unk_568; /* 0x56C */ f32 unk_56C; /* 0x570 */ f32 unk_570; // set but not used /* 0x574 */ UNK_TYPE1 unk_574[0x04]; - /* 0x578 */ f32 cameraFov; + /* 0x578 */ f32 subCamFov; } Boss03; // size = 0x57C #define GYORG_PARAM_DEFAULT (0) 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 a04e459a2..2fb1e79b7 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -259,19 +259,19 @@ void func_809EC568(Boss04* this, PlayState* play) { this->unk_708 = 10; this->unk_704 = 0; Cutscene_Start(play, &play->csCtx); - this->unk_70A = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->unk_70A, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 7); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; player->actor.shape.rot.y = 0x7FFF; player->actor.world.rot.y = player->actor.shape.rot.y; - Math_Vec3f_Copy(&this->unk_70C, &player->actor.world.pos); - this->unk_70C.y += 100.0f; - Math_Vec3f_Copy(&this->unk_718, &this->actor.world.pos); + Math_Vec3f_Copy(&this->subCamEye, &player->actor.world.pos); + this->subCamEye.y += 100.0f; + Math_Vec3f_Copy(&this->subCamAt, &this->actor.world.pos); func_8016566C(150); - this->unk_744 = 60.0f; + this->subCamFov = 60.0f; boss = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (boss != NULL) { @@ -293,7 +293,7 @@ void func_809EC568(Boss04* this, PlayState* play) { } this->unk_2D0 = 10000.0f; this->unk_2C8 = 300; - Math_ApproachF(&this->unk_744, 20.0f, 0.3f, 11.0f); + Math_ApproachF(&this->subCamFov, 20.0f, 0.3f, 11.0f); if (this->unk_704 == 40) { this->unk_708 = 11; this->unk_704 = 0; @@ -319,9 +319,9 @@ void func_809EC568(Boss04* this, PlayState* play) { case 12: Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_ATTACK - SFX_FLAG); - Math_ApproachF(&this->unk_718.x, this->actor.world.pos.x, 0.5f, 1000.0f); - Math_ApproachF(&this->unk_718.y, this->actor.world.pos.y, 0.5f, 1000.0f); - Math_ApproachF(&this->unk_718.z, this->actor.world.pos.z, 0.5f, 1000.0f); + Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.5f, 1000.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y, 0.5f, 1000.0f); + Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.5f, 1000.0f); if (this->actor.bgCheckFlags & 2) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); this->unk_6F4 = 15; @@ -331,22 +331,22 @@ void func_809EC568(Boss04* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SPLASH); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_JUMP_LEV_OLD - SFX_FLAG); - this->unk_748 = 20; + this->subCamAtOscillator = 20; } break; case 1: player->actor.shape.rot.y = 0x7FFF; player->actor.world.rot.y = player->actor.shape.rot.y; - Matrix_MultVecZ(-100.0f, &this->unk_70C); + Matrix_MultVecZ(-100.0f, &this->subCamEye); - this->unk_70C.x += player->actor.world.pos.x; - this->unk_70C.y = Player_GetHeight(player) + player->actor.world.pos.y + 36.0f; - this->unk_70C.z += player->actor.world.pos.z; + this->subCamEye.x += player->actor.world.pos.x; + this->subCamEye.y = Player_GetHeight(player) + player->actor.world.pos.y + 36.0f; + this->subCamEye.z += player->actor.world.pos.z; - this->unk_718.x = player->actor.world.pos.x; - this->unk_718.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 4.0f; - this->unk_718.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = (Player_GetHeight(player) + player->actor.world.pos.y) - 4.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_704 >= 35) { this->unk_704 = 0; @@ -357,13 +357,13 @@ void func_809EC568(Boss04* this, PlayState* play) { case 2: case 3: - Matrix_MultVecZ(500.0f, &this->unk_70C); - this->unk_70C.x += this->actor.world.pos.x; - this->unk_70C.y += this->actor.world.pos.y - 50.0f; - this->unk_70C.z += this->actor.world.pos.z; - this->unk_718.x = this->actor.world.pos.x; - this->unk_718.z = this->actor.world.pos.z; - this->unk_718.y = (this->actor.world.pos.y - 70.0f) + this->unk_728; + Matrix_MultVecZ(500.0f, &this->subCamEye); + this->subCamEye.x += this->actor.world.pos.x; + this->subCamEye.y += this->actor.world.pos.y - 50.0f; + this->subCamEye.z += this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.z = this->actor.world.pos.z; + this->subCamAt.y = (this->actor.world.pos.y - 70.0f) + this->unk_728; Math_ApproachZeroF(&this->unk_728, 0.05f, this->unk_73C); Math_ApproachF(&this->unk_73C, 3.0f, 1.0f, 0.05f); if (this->unk_704 == 20) { @@ -379,15 +379,15 @@ void func_809EC568(Boss04* this, PlayState* play) { } if (this->unk_704 > 140) { - Camera* sp5C = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->unk_708 = 0; func_809ECD00(this, play); - sp5C->eye = this->unk_70C; - sp5C->eyeNext = this->unk_70C; - sp5C->at = this->unk_718; - func_80169AFC(play, this->unk_70A, 0); - this->unk_70A = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); func_80165690(); @@ -396,18 +396,18 @@ void func_809EC568(Boss04* this, PlayState* play) { break; } - if (this->unk_70A != 0) { - Vec3f sp50; + if (this->subCamId != SUB_CAM_ID_DONE) { + Vec3f subCamAt; ShrinkWindow_SetLetterboxTarget(27); - if (this->unk_748 != 0) { - this->unk_748--; + if (this->subCamAtOscillator != 0) { + this->subCamAtOscillator--; } - Math_Vec3f_Copy(&sp50, &this->unk_718); - sp50.y += Math_SinS(this->unk_748 * 0x4000) * this->unk_748 * 1.5f; - Play_CameraSetAtEye(play, this->unk_70A, &sp50, &this->unk_70C); - Play_CameraSetFov(play, this->unk_70A, this->unk_744); - Math_ApproachF(&this->unk_744, 60.0f, 0.1f, 1.0f); + Math_Vec3f_Copy(&subCamAt, &this->subCamAt); + subCamAt.y += Math_SinS(this->subCamAtOscillator * 0x4000) * this->subCamAtOscillator * 1.5f; + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Math_ApproachF(&this->subCamFov, 60.0f, 0.1f, 1.0f); } this->actor.shape.rot.y = this->actor.yawTowardsPlayer; x = player->actor.world.pos.x - this->actor.world.pos.x; diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.h b/src/overlays/actors/ovl_Boss_04/z_boss_04.h index d4835e42d..c0944ce82 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.h +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.h @@ -63,16 +63,16 @@ typedef struct Boss04 { /* 0x700 */ f32 unk_700; /* 0x704 */ u32 unk_704; /* 0x708 */ s16 unk_708; - /* 0x70A */ s16 unk_70A; - /* 0x70C */ Vec3f unk_70C; - /* 0x718 */ Vec3f unk_718; + /* 0x70A */ s16 subCamId; + /* 0x70C */ Vec3f subCamEye; + /* 0x718 */ Vec3f subCamAt; /* 0x724 */ UNK_TYPE1 unk_724[4]; /* 0x728 */ f32 unk_728; /* 0x72C */ UNK_TYPE1 unk_72C[0x10]; /* 0x73C */ f32 unk_73C; /* 0x740 */ UNK_TYPE1 unk_740[4]; - /* 0x744 */ f32 unk_744; - /* 0x748 */ s16 unk_748; + /* 0x744 */ f32 subCamFov; + /* 0x748 */ s16 subCamAtOscillator; /* 0x74A */ u8 unk_74A; } Boss04; // size = 0x74C diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index c07406760..29506a372 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -200,9 +200,9 @@ void func_809F24C8(Boss06* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); - this->unk_A00 = Play_CreateSubCamera(play); + this->subCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->unk_A00, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); D_809F4970->unk_151 = 1; this->unk_1C9 = 1; this->unk_1C8 = 1; @@ -244,26 +244,26 @@ void func_809F24C8(Boss06* this, PlayState* play) { player->actor.world.rot.y = player->actor.shape.rot.y; } - this->unk_A04.x = player->actor.world.pos.x + 20.0f; - this->unk_A04.y = player->actor.world.pos.y + 20.0f; - this->unk_A04.z = player->actor.world.pos.z + 30.0f; + this->subCamEye.x = player->actor.world.pos.x + 20.0f; + this->subCamEye.y = player->actor.world.pos.y + 20.0f; + this->subCamEye.z = player->actor.world.pos.z + 30.0f; - this->unk_A10.x = player->actor.world.pos.x; - this->unk_A10.y = player->actor.world.pos.y + 26.0f; - this->unk_A10.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + 26.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_1CA >= 75) { temp_v0_2 = play->actorCtx.actorLists[ACTORCAT_BOSS].first; while (temp_v0_2 != NULL) { if ((temp_v0_2->id == ACTOR_EN_KNIGHT) && (&D_809F4970->actor == temp_v0_2) && (D_809F4970->unk_680 != 0)) { - this->unk_A04.x = 1307.0f; - this->unk_A04.y = 142.0f; - this->unk_A04.z = 2897.0f; + this->subCamEye.x = 1307.0f; + this->subCamEye.y = 142.0f; + this->subCamEye.z = 2897.0f; - this->unk_A10.x = 1376.0f; - this->unk_A10.y = 132.0f; - this->unk_A10.z = 2860.0f; + this->subCamAt.x = 1376.0f; + this->subCamAt.y = 132.0f; + this->subCamAt.z = 2860.0f; if (this->unk_1CA == 75) { D_809F4970->unk_148 = 1; @@ -291,25 +291,25 @@ void func_809F24C8(Boss06* this, PlayState* play) { this->actor.world.pos.y - 200.0f, this->actor.world.pos.z - 170.0f, 15, 0, 0, 1); if (ENBOSS06_GET_PARAMS(&this->actor) == 0) { - this->unk_A04.x = this->actor.world.pos.x - 200.0f; + this->subCamEye.x = this->actor.world.pos.x - 200.0f; } else { - this->unk_A04.x = this->actor.world.pos.x + 200.0f; + this->subCamEye.x = this->actor.world.pos.x + 200.0f; } - this->unk_A04.y = (this->actor.world.pos.y - 200.0f) + 100.0f; - this->unk_A04.z = this->actor.world.pos.z - 200.0f; + this->subCamEye.y = (this->actor.world.pos.y - 200.0f) + 100.0f; + this->subCamEye.z = this->actor.world.pos.z - 200.0f; - this->unk_A10.x = this->actor.world.pos.x; - this->unk_A10.y = this->actor.world.pos.y + 80.0f; - this->unk_A10.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y + 80.0f; + this->subCamAt.z = this->actor.world.pos.z; } } else { - this->unk_A10.z = this->actor.world.pos.z; - this->unk_A04.y = this->actor.world.pos.y + 60.0f; - this->unk_A04.x = this->actor.world.pos.x; + this->subCamEye.x = this->actor.world.pos.x; + this->subCamEye.y = this->actor.world.pos.y + 60.0f; + this->subCamEye.z = this->actor.world.pos.z - 210.0f; - this->unk_A04.z = this->actor.world.pos.z - 210.0f; - this->unk_A10.y = this->actor.world.pos.y + 80.0f; - this->unk_A10.x = this->actor.world.pos.x; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y + 80.0f; + this->subCamAt.z = this->actor.world.pos.z; } break; @@ -317,20 +317,20 @@ void func_809F24C8(Boss06* this, PlayState* play) { child = this->actor.child; if (this->unk_1CA == 1) { - this->unk_A1C.x = fabsf(this->unk_A10.x - child->world.pos.x); - this->unk_A1C.y = fabsf(this->unk_A10.y - child->world.pos.y); - this->unk_A1C.z = fabsf(this->unk_A10.z - child->world.pos.z); + this->unk_A1C.x = fabsf(this->subCamAt.x - child->world.pos.x); + this->unk_A1C.y = fabsf(this->subCamAt.y - child->world.pos.y); + this->unk_A1C.z = fabsf(this->subCamAt.z - child->world.pos.z); } - Math_ApproachF(&this->unk_A10.x, child->world.pos.x, 0.15f, this->unk_A1C.x * this->unk_A28); - Math_ApproachF(&this->unk_A10.y, child->world.pos.y, 0.15f, this->unk_A1C.y * this->unk_A28); - Math_ApproachF(&this->unk_A10.z, child->world.pos.z, 0.15f, this->unk_A1C.z * this->unk_A28); + Math_ApproachF(&this->subCamAt.x, child->world.pos.x, 0.15f, this->unk_A1C.x * this->unk_A28); + Math_ApproachF(&this->subCamAt.y, child->world.pos.y, 0.15f, this->unk_A1C.y * this->unk_A28); + Math_ApproachF(&this->subCamAt.z, child->world.pos.z, 0.15f, this->unk_A1C.z * this->unk_A28); Math_ApproachF(&this->unk_A28, 1.0f, 1.0f, 0.001f); if (this->unk_1CA > 80) { func_809F2ED0(this, play); - func_80169AFC(play, this->unk_A00, 0); - this->unk_A00 = 0; + func_80169AFC(play, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); D_809F4970->unk_151 = 0; @@ -338,9 +338,9 @@ void func_809F24C8(Boss06* this, PlayState* play) { break; } - if (this->unk_A00 != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { ShrinkWindow_SetLetterboxTarget(27); - Play_CameraSetAtEye(play, this->unk_A00, &this->unk_A10, &this->unk_A04); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } #else diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.h b/src/overlays/actors/ovl_Boss_06/z_boss_06.h index 7ab5fd857..39d2f900a 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.h +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.h @@ -42,9 +42,9 @@ typedef struct Boss06 { /* 0x1FE */ u8 unk_1FE; /* 0x1FF */ u8 unk_1FF; /* 0x200 */ u8 unk_200[0x800]; - /* 0xA00 */ s16 unk_A00; - /* 0xA04 */ Vec3f unk_A04; - /* 0xA10 */ Vec3f unk_A10; + /* 0xA00 */ s16 subCamId; + /* 0xA04 */ Vec3f subCamEye; + /* 0xA10 */ Vec3f subCamAt; /* 0xA1C */ Vec3f unk_A1C; /* 0xA28 */ f32 unk_A28; /* 0xA2C */ f32 unk_A2C; diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 524414e1c..57a6f3312 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -74,7 +74,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { switch (DEMOSYOTEN_GET_F(&this->actor)) { case DEMOSYOTEN_F_0: func_80183430(&this->unk_144, &object_syoten_Blob_001328, &object_syoten_Blob_00023C, this->unk_174, - this->unk_2A6, 0); + this->unk_2A6, NULL); func_801835EC(&this->unk_144, &object_syoten_Blob_00023C); this->actor.draw = NULL; this->actionFunc = func_80C16A74; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c index a19de97b0..ce3e18ab2 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -15,9 +15,6 @@ void DmAl_Destroy(Actor* thisx, PlayState* play); void DmAl_Update(Actor* thisx, PlayState* play); void DmAl_Draw(Actor* thisx, PlayState* play); -void func_80C1BDD8(DmAl* this, PlayState* play); - -#if 0 const ActorInit Dm_Al_InitVars = { ACTOR_EN_AL, ACTORCAT_NPC, @@ -30,24 +27,135 @@ const ActorInit Dm_Al_InitVars = { (ActorFunc)DmAl_Draw, }; -#endif +static AnimationInfoS sAnimationInfos[] = { + { &object_al_Anim_00DBE0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +}; -extern UNK_TYPE D_0600A0D8; +s32 DmAl_ChangeAnimation(DmAl* this, s32 animationIndex) { + s32 didAnimationChange = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/func_80C1BD90.s") + if (animationIndex != this->animationIndex) { + this->animationIndex = animationIndex; + didAnimationChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfos, animationIndex); + } + return didAnimationChange; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/func_80C1BDD8.s") +void func_80C1BDD8(DmAl* this, PlayState* play) { + s32 D_80C1C280[] = { 0, 0, 0, 0, 0 }; + u16 csAction; + s32 actionIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/DmAl_Init.s") + if (play->csCtx.state != 0) { + if (!this->unk_45C) { + this->action = 0xFF; + this->unk_45C = true; + this->animationIndex2 = this->animationIndex; + } + if (Cutscene_CheckActorAction(play, 0x232)) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x232); + csAction = play->csCtx.actorActions[actionIndex]->action; + if (this->action != (u8)csAction) { + this->action = csAction; + DmAl_ChangeAnimation(this, D_80C1C280[csAction]); + } + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + } + } else if (this->unk_45C) { + this->unk_45C = false; + DmAl_ChangeAnimation(this, this->animationIndex2); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/DmAl_Destroy.s") +void DmAl_Init(Actor* thisx, PlayState* play) { + DmAl* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/DmAl_Update.s") + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gMadameAromaSkel, NULL, this->jointTable, this->morphTable, + MADAME_AROMA_LIMB_MAX); + this->animationIndex = -1; + DmAl_ChangeAnimation(this, MADAME_AROMA_ANIMATION_0); + this->actor.flags &= ~ACTOR_FLAG_1; + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = func_80C1BDD8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/func_80C1C028.s") +void DmAl_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/func_80C1C064.s") +void DmAl_Update(Actor* thisx, PlayState* play) { + DmAl* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/func_80C1C11C.s") + this->actionFunc(this, play); + SkelAnime_Update(&this->skelAnime); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Al/DmAl_Draw.s") +s32 DmAl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* rot, Vec3s* pos, Actor* thisx) { + switch (limbIndex) { + case MADAME_AROMA_LIMB_SHAWL_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_UPPER: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER: + *dList = NULL; + break; + } + return false; +} + +void DmAl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + DmAl* this = THIS; + + switch (limbIndex) { + case MADAME_AROMA_LIMB_SHAWL_MIDDLE: + Matrix_Get(&this->shawlMatrices[0]); + break; + case MADAME_AROMA_LIMB_SHAWL_UPPER: + Matrix_Get(&this->shawlMatrices[1]); + break; + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER_MIDDLE: + Matrix_Get(&this->shawlMatrices[2]); + break; + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER: + Matrix_Get(&this->shawlMatrices[3]); + break; + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER_MIDDLE: + Matrix_Get(&this->shawlMatrices[4]); + break; + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER: + Matrix_Get(&this->shawlMatrices[5]); + break; + default: + break; + } +} + +void DmAl_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { +} + +static Gfx* sDlists[] = { + gMadameAromaShawlMiddleDL, gMadameAromaShawlUpperDL, + gMadameAromaShawlLeftLowerMiddleDL, gMadameAromaShawlLeftLowerDL, + gMadameAromaShawlRightLowerMiddleDL, gMadameAromaShawlRightLowerDL, +}; + +void DmAl_Draw(Actor* thisx, PlayState* play) { + u32 i; + DmAl* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, DmAl_OverrideLimbDraw, DmAl_PostLimbDraw, + DmAl_TransformLimbDraw, &this->actor); + for (i = 0; i < ARRAY_COUNT(this->shawlMatrices); i++) { + Matrix_Put(&this->shawlMatrices[i]); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, sDlists[i]); + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h index 6387511df..f15513177 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h @@ -2,6 +2,7 @@ #define Z_DM_AL_H #include "global.h" +#include "objects/object_al/object_al.h" struct DmAl; @@ -9,11 +10,22 @@ typedef void (*DmAlActionFunc)(struct DmAl*, PlayState*); typedef struct DmAl { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ DmAlActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x2D4]; + /* 0x18C */ MtxF shawlMatrices[6]; + /* 0x30C */ Vec3s jointTable[MADAME_AROMA_LIMB_MAX]; + /* 0x3AE */ Vec3s morphTable[MADAME_AROMA_LIMB_MAX]; + /* 0x450 */ u8 action; + /* 0x454 */ s32 animationIndex; + /* 0x458 */ s32 animationIndex2; + /* 0x45C */ s32 unk_45C; } DmAl; // size = 0x460 +typedef enum { + /* 0x0 */ MADAME_AROMA_ANIMATION_0, + /* 0x1 */ MADAME_AROMA_ANIMATION_1 +} DmAlAnimations; + extern const ActorInit Dm_Al_InitVars; #endif // Z_DM_AL_H diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 2a3144be3..5efd088ae 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -120,13 +120,13 @@ static AnimationInfo sAnimations[] = { { &object_delf_Anim_000E44, 1.0f, 0.0f, -1.0f, 0, 0.0f }, }; -DmChar00Struct D_80AA77A8[] = { +Color_RGBAf D_80AA77A8[] = { { 250.0f, 255.0f, 230.0f, 255.0f }, { 63.0f, 18.0f, 93.0f, 255.0f }, { 255.0f, 235.0f, 220.0f, 255.0f }, }; -DmChar00Struct D_80AA77D8[] = { +Color_RGBAf D_80AA77D8[] = { { 220.0f, 160.0f, 80.0f, 255.0f }, { 250.0f, 40.0f, 10.0f, 255.0f }, { 255.0f, 235.0f, 220.0f, 255.0f }, @@ -899,7 +899,7 @@ s32 DmChar00_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f Vec3f sp1C; if (limbIndex == 6) { - sp28 = ((Math_SinS(this->unk_262 * 0x1000) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * 124.99999f); + sp28 = ((Math_SinS(this->unk_262 * 0x1000) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * (1.0f / 0.008f)); Matrix_MultVec3f(&D_80AA7808, &sp1C); Matrix_Translate(sp1C.x, sp1C.y, sp1C.z, MTXMODE_NEW); Matrix_Scale(sp28, sp28, sp28, MTXMODE_APPLY); @@ -934,13 +934,13 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, &gfx[0]); gDPPipeSync(gfx++); - gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->unk_240.unk_00, (u8)this->unk_240.unk_04, (u8)this->unk_240.unk_08, - (u8)(this->unk_240.unk_0C * 1)); + gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->unk_240.r, (u8)this->unk_240.g, (u8)this->unk_240.b, + (u8)(this->unk_240.a * 1)); gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_ZB_CLD_SURF2); gSPEndDisplayList(gfx); - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->unk_250.unk_00, (u8)(s8)this->unk_250.unk_04, - (u8)(s8)this->unk_250.unk_08, (u8)(s8)((f32)phi_a0 * 1)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->unk_250.r, (u8)(s8)this->unk_250.g, (u8)(s8)this->unk_250.b, + (u8)(s8)((f32)phi_a0 * 1)); gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h index 0a7f2410c..1df0df06d 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h @@ -13,13 +13,6 @@ typedef void (*DmChar00ActionFunc)(struct DmChar00*, PlayState*); #define DMCHAR00_0 0 #define DMCHAR00_1 1 -typedef struct { - /* 0x00 */ f32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_0C; -} DmChar00Struct; // size = 0x10 - typedef struct DmChar00 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,8 +21,8 @@ typedef struct DmChar00 { /* 0x1E2 */ Vec3s morphTable[7]; /* 0x20C */ UNK_TYPE1 unk_20C[0x30]; /* 0x23C */ DmChar00ActionFunc actionFunc; - /* 0x240 */ DmChar00Struct unk_240; - /* 0x250 */ DmChar00Struct unk_250; + /* 0x240 */ Color_RGBAf unk_240; + /* 0x250 */ Color_RGBAf unk_250; /* 0x260 */ u8 unk_260; /* 0x261 */ u8 unk_261; /* 0x262 */ u16 unk_262; diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 08e6dfbcf..1844783ff 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -1,7 +1,7 @@ /* * File: z_dm_char02.c * Overlay: ovl_Dm_Char02 - * Description: Ocarina of Time (dropped from Skull Kid's hand) + * Description: The Ocarina of Time that for the scenes on the Clock Tower's rooftop. */ #include "z_dm_char02.h" @@ -16,7 +16,7 @@ void DmChar02_Destroy(Actor* thisx, PlayState* play); void DmChar02_Update(Actor* thisx, PlayState* play); void DmChar02_Draw(Actor* thisx, PlayState* play); -void func_80AAB04C(DmChar02* this, PlayState* play); +void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play); const ActorInit Dm_Char02_InitVars = { ACTOR_DM_CHAR02, @@ -31,43 +31,52 @@ const ActorInit Dm_Char02_InitVars = { }; +typedef enum { + /* 0 */ DMCHAR02_ANIMATION_HIT_GROUND, + /* 1 */ DMCHAR02_ANIMATION_TURN_AROUND, + /* 2 */ DMCHAR02_ANIMATION_JUGGLE, + /* 3 */ DMCHAR02_ANIMATION_FALL, +} DmChar02AnimationIndex; + static AnimationInfo sAnimations[] = { - { &object_stk2_Anim_00A2BC, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_stk2_Anim_00A4C4, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_stk2_Anim_00A6D4, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_stk2_Anim_00A104, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, + { &gClockTowerOcarinaOfTimeHitGroundAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, + { &gClockTowerOcarinaOfTimeTurnAroundAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, + { &gClockTowerOcarinaOfTimeJuggleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { &gClockTowerOcarinaOfTimeFallAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, }; -void DmChar02_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) { +void DmChar02_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animation, u16 index) { f32 frameCount; - animInfo += index; + animation += index; - if (animInfo->frameCount < 0.0f) { - frameCount = Animation_GetLastFrame(animInfo->animation); + if (animation->frameCount < 0.0f) { + frameCount = Animation_GetLastFrame(animation->animation); } else { - frameCount = animInfo->frameCount; + frameCount = animation->frameCount; } - Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, frameCount, - animInfo->mode, animInfo->morphFrames); + + Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, frameCount, + animation->mode, animation->morphFrames); } -void func_80AAAECC(Actor* actor, PlayState* play) { +void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) { switch (play->csCtx.frames) { case 95: - Actor_PlaySfxAtPos(actor, NA_SE_EV_OCARINA_BOUND_0); - return; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OCARINA_BOUND_0); + break; + case 101: case 105: case 112: - Actor_PlaySfxAtPos(actor, NA_SE_EV_OCARINA_BOUND_1); - return; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OCARINA_BOUND_1); + break; } } -void func_80AAAF2C(DmChar02* this, PlayState* play) { +void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { - func_80AAAECC(&this->actor, play); + DmChar02_PlaySfxForDroppingOcarinaCutscene(this, play); } } @@ -75,13 +84,13 @@ void DmChar02_Init(Actor* thisx, PlayState* play) { DmChar02* this = THIS; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { - this->animIndex = 0; + this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; this->actor.targetArrowOffset = 3000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gClockTowerOcarinaOfTimeSkel, NULL, NULL, NULL, 0); - DmChar02_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + DmChar02_ChangeAnimation(&this->skelAnime, sAnimations, 0); Actor_SetScale(&this->actor, 0.01f); - this->actionFunc = func_80AAB04C; + this->actionFunc = DmChar02_PerformCutsceneActions; } else { Actor_MarkForDeath(&this->actor); } @@ -90,8 +99,8 @@ void DmChar02_Init(Actor* thisx, PlayState* play) { void DmChar02_Destroy(Actor* thisx, PlayState* play) { } -void func_80AAB04C(DmChar02* this, PlayState* play) { - u8 sp2F = true; +void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play) { + u8 shouldChangeAnimation = true; s32 actionIndex; if (Cutscene_CheckActorAction(play, 0x83)) { @@ -99,29 +108,35 @@ void func_80AAB04C(DmChar02* this, PlayState* play) { if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { switch (play->csCtx.actorActions[actionIndex]->action) { default: - this->animIndex = 0; - sp2F = false; + this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; + shouldChangeAnimation = false; break; + case 1: - this->animIndex = 0; + this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; break; + case 2: - this->animIndex = 1; + this->animIndex = DMCHAR02_ANIMATION_TURN_AROUND; break; + case 4: - this->animIndex = 3; + this->animIndex = DMCHAR02_ANIMATION_FALL; break; } - if (sp2F) { - DmChar02_ChangeAnimationByInfo(&this->skelAnime, &sAnimations[this->animIndex], 0); + + if (shouldChangeAnimation) { + DmChar02_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); } } + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->animIndex == 1) { + if (this->animIndex == DMCHAR02_ANIMATION_TURN_AROUND) { this->animIndex++; - DmChar02_ChangeAnimationByInfo(&this->skelAnime, &sAnimations[this->animIndex], 0); + DmChar02_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); } } } @@ -130,7 +145,7 @@ void DmChar02_Update(Actor* thisx, PlayState* play) { DmChar02* this = THIS; SkelAnime_Update(&this->skelAnime); - this->unk2F0 = this->unk2F0; + this->unk_2F0 = this->unk_2F0; this->actionFunc(this, play); if (!Actor_HasParent(&this->actor, play)) { Actor_PickUp(&this->actor, play, GI_OCARINA, 30.0f, 80.0f); @@ -138,7 +153,8 @@ void DmChar02_Update(Actor* thisx, PlayState* play) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; Actor_MarkForDeath(&this->actor); } - func_80AAAF2C(this, play); + + DmChar02_PlaySfxForCutscenes(this, play); } s32 DmChar02_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { @@ -154,19 +170,21 @@ void DmChar02_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void DmChar02_Draw(Actor* thisx, PlayState* play) { s32 pad[2]; DmChar02* this = THIS; - s32 sp30 = false; + s32 shouldDraw = false; if ((play->csCtx.state == 0) && (this->actor.world.pos.y < 100.0f)) { - sp30 = true; + shouldDraw = true; } else if (Cutscene_CheckActorAction(play, 0x6B)) { switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x6B)]->action) { case 0x17: case 0x1C: case 0x26: - sp30 = true; + shouldDraw = true; + break; } } - if (sp30) { + + if (shouldDraw) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmChar02_OverrideLimbDraw, DmChar02_PostLimbDraw, diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h index 246fd5531..697989496 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.h @@ -10,12 +10,12 @@ typedef void (*DmChar02ActionFunc)(struct DmChar02*, PlayState*); typedef struct DmChar02 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ UNK_TYPE1 pad188[0x108]; + /* 0x188 */ UNK_TYPE1 pad_188[0x108]; /* 0x290 */ DmChar02ActionFunc actionFunc; - /* 0x294 */ UNK_TYPE1 pad294[0x4C]; + /* 0x294 */ UNK_TYPE1 pad_294[0x4C]; /* 0x2E0 */ s16 animIndex; - /* 0x2E2 */ UNK_TYPE1 pad2E2[0xE]; - /* 0x2F0 */ u32 unk2F0; + /* 0x2E2 */ UNK_TYPE1 pad_2E2[0xE]; + /* 0x2F0 */ u32 unk_2F0; } DmChar02; // size = 0x2F4 extern const ActorInit Dm_Char02_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c index 0684dbdec..6c44fb5e6 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -5,6 +5,7 @@ */ #include "z_dm_char03.h" +#include "objects/object_osn/object_osn.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -15,11 +16,10 @@ void DmChar03_Destroy(Actor* thisx, PlayState* play); void DmChar03_Update(Actor* thisx, PlayState* play); void DmChar03_Draw(Actor* thisx, PlayState* play); -void func_80AAB5F8(DmChar03* this, PlayState* play); void func_80AAB644(DmChar03* this, PlayState* play); -void func_80AAB700(DmChar03* this, PlayState* play); +void DmChar03_DoNothing(DmChar03* this, PlayState* play); +void func_80AABA84(PlayState* play, DmChar03* this); -#if 0 const ActorInit Dm_Char03_InitVars = { ACTOR_DM_CHAR03, ACTORCAT_ITEMACTION, @@ -32,34 +32,157 @@ const ActorInit Dm_Char03_InitVars = { (ActorFunc)DmChar03_Draw, }; -#endif +AnimationInfo sAnimations[] = { { &object_osn_Anim_020530, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f } }; -extern UNK_TYPE D_06020550; +void DmChar03_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) { + f32 frame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB4A0.s") + animInfo += index; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Init.s") + if (animInfo->frameCount < 0.0f) { + frame = Animation_GetLastFrame(animInfo->animation); + } else { + frame = animInfo->frameCount; + } + Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, frame, animInfo->mode, + animInfo->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Destroy.s") +void DmChar03_Init(Actor* thisx, PlayState* play) { + DmChar03* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB5F8.s") + this->animIndex = 0; + this->actor.targetArrowOffset = 3000.0f; + this->unk_18E = false; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gDekuMaskSkel, NULL, NULL, NULL, 0); + DmChar03_ChangeAnimation(&this->skelAnime, sAnimations, 0); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = DmChar03_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB644.s") +void DmChar03_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB700.s") +void func_80AAB5F8(DmChar03* this, PlayState* play) { + s32 index = Object_GetIndex(&play->objectCtx, OBJECT_GI_NUTSMASK); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB710.s") + if (index >= 0) { + this->objectIndex = index; + this->actionFunc = func_80AAB644; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB838.s") +void func_80AAB644(DmChar03* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x88)) { + s32 index = Cutscene_GetActorActionIndex(play, 0x88); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Update.s") + if (play->csCtx.actorActions[index]->action == 4) { + this->unk_18E = true; + this->offset.x = play->csCtx.actorActions[index]->startPos.x; + this->offset.y = play->csCtx.actorActions[index]->startPos.y; + this->offset.z = play->csCtx.actorActions[index]->startPos.z; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB974.s") +void DmChar03_DoNothing(DmChar03* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB990.s") +void func_80AAB710(DmChar03* this, PlayState* play) { + u8 shouldChangeAnim = true; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AAB9A8.s") + if (Cutscene_CheckActorAction(play, 0x88)) { + s32 index = Cutscene_GetActorActionIndex(play, 0x88); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/DmChar03_Draw.s") + if (play->csCtx.frames == play->csCtx.actorActions[index]->startFrame) { + switch (play->csCtx.actorActions[index]->action) { + case 1: + shouldChangeAnim = false; + break; + case 2: + this->animIndex = 0; + break; + case 3: + this->unk_18E = false; + shouldChangeAnim = false; + Actor_MarkForDeath(&this->actor); + break; + case 4: + Item_Give(play, ITEM_MASK_DEKU); + shouldChangeAnim = false; + this->actionFunc = func_80AAB5F8; + break; + default: + shouldChangeAnim = false; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char03/func_80AABA84.s") + if (shouldChangeAnim) { + DmChar03_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); + } + } + Cutscene_ActorTranslateAndYaw(&this->actor, play, index); + } +} + +void func_80AAB838(DmChar03* this, PlayState* play) { + if (Animation_OnFrame(&this->skelAnime, 5.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_0); + } else if ((Animation_OnFrame(&this->skelAnime, 10.0f)) || (Animation_OnFrame(&this->skelAnime, 18.0f)) || + (Animation_OnFrame(&this->skelAnime, 30.0f)) || (Animation_OnFrame(&this->skelAnime, 38.0f))) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_MASK_BOUND_1); + } +} + +void DmChar03_Update(Actor* thisx, PlayState* play) { + DmChar03* this = THIS; + + if (Cutscene_CheckActorAction(play, 0x88) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action == 2)) { + SkelAnime_Update(&this->skelAnime); + } + this->actionFunc(this, play); + func_80AAB710(this, play); + func_80AAB838(this, play); +} + +s32 DmChar03_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + return false; +} + +void DmChar03_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +} + +void DmChar03_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { +} + +void DmChar03_Draw(Actor* thisx, PlayState* play) { + DmChar03* this = THIS; + + if (!this->unk_18E) { + if ((Cutscene_CheckActorAction(play, 0x88)) && + (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action != 1)) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, DmChar03_OverrideLimbDraw, DmChar03_PostLimbDraw, + DmChar03_TransformLimbDraw, &this->actor); + } + } else { + func_80AABA84(play, this); + } +} + +void func_80AABA84(PlayState* play, DmChar03* this) { + s32 pad; + + if (this->actor.objBankIndex == this->objectIndex) { + Matrix_Translate(this->offset.x, this->offset.y, this->offset.z, MTXMODE_NEW); + Matrix_RotateZYX(0, (play->gameplayFrames * 0x3E8), 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + GetItem_Draw(play, GID_MASK_DEKU); + } + if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) { + this->actor.objBankIndex = this->objectIndex; + } +} diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h index 8d2905ad8..f736220c8 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.h @@ -9,9 +9,12 @@ typedef void (*DmChar03ActionFunc)(struct DmChar03*, PlayState*); typedef struct DmChar03 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ DmChar03ActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x10]; + /* 0x18C */ s16 animIndex; + /* 0x18E */ u8 unk_18E; + /* 0x18F */ u8 objectIndex; + /* 0x190 */ Vec3f offset; } DmChar03; // size = 0x19C extern const ActorInit Dm_Char03_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c index 9bec4b6cc..6c97624a8 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c @@ -5,6 +5,7 @@ */ #include "z_dm_char04.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -15,7 +16,8 @@ void DmChar04_Destroy(Actor* thisx, PlayState* play); void DmChar04_Update(Actor* thisx, PlayState* play); void DmChar04_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80AABE34(DmChar04* this, PlayState* play); + const ActorInit Dm_Char04_InitVars = { ACTOR_DM_CHAR04, ACTORCAT_ITEMACTION, @@ -28,18 +30,127 @@ const ActorInit Dm_Char04_InitVars = { (ActorFunc)DmChar04_Draw, }; -#endif +void DmChar04_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animation, u16 index) { + f32 endFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABC40.s") + animation += index; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Init.s") + if (animation->frameCount < 0.0f) { + endFrame = Animation_GetLastFrame(animation->animation); + } else { + endFrame = animation->frameCount; + } + Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, endFrame, + animation->mode, animation->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Destroy.s") +static AnimationInfo sAnimations[] = { + { &gameplay_keep_Anim_02B2E8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { &gameplay_keep_Anim_029140, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABE34.s") +Color_RGBAf sPrimColors[] = { + { 250.0f, 255.0f, 230.0f, 255.0f }, + { 10.0f, 10.0f, 40.0f, 255.0f }, + { 255.0f, 235.0f, 220.0f, 255.0f }, +}; +Color_RGBAf sEnvColors[] = { + { 220.0f, 160.0f, 80.0f, 255.0f }, + { 120.0f, 255.0f, 255.0f, 255.0f }, + { 255.0f, 235.0f, 220.0f, 255.0f }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Update.s") +void DmChar04_Init(Actor* thisx, PlayState* play) { + DmChar04* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABF74.s") + this->primColors = sPrimColors[this->actor.params]; + this->envColors = sEnvColors[this->actor.params]; + this->actor.targetArrowOffset = 3000.0f; + this->csAction = 0x63; + this->timer = this->actor.params << 0xB; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); + SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, + this->morphTable, 7); + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 15.0f); + DmChar04_ChangeAnim(&this->skelAnime, sAnimations, 0); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = func_80AABE34; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Draw.s") +void DmChar04_Destroy(Actor* thisx, PlayState* play) { +} + +void func_80AABE34(DmChar04* this, PlayState* play) { + u16 params = this->actor.params + 0x71; + + if (Cutscene_CheckActorAction(play, params)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, params); + + if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { + this->csAction = play->csCtx.actorActions[actionIndex]->action; + if (play->csCtx.actorActions[actionIndex]->action == 1) { + this->animationIndex = 0; + } else { + this->animationIndex = 0; + } + DmChar04_ChangeAnim(&this->skelAnime, &sAnimations[this->animationIndex], 0); + } + } + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + } else { + this->csAction = 0x63; + } +} + +void DmChar04_Update(Actor* thisx, PlayState* play) { + DmChar04* this = THIS; + + SkelAnime_Update(&this->skelAnime); + this->actionFunc(this, play); + this->timer++; +} +static Vec3f D_80AAC4F0 = { 0.0f, 0.0f, 0.0f }; + +s32 DmChar04_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + PlayState* play = play2; + f32 sp28; + Vec3f sp1C; + DmChar04* this = THIS; + + if (limbIndex == 6) { + sp28 = ((Math_SinS(this->timer << 0xC) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * (1.0f / 0.008f)); + Matrix_MultVec3f(&D_80AAC4F0, &sp1C); + Matrix_Translate(sp1C.x, sp1C.y, sp1C.z, MTXMODE_NEW); + Matrix_Scale(sp28, sp28, sp28, MTXMODE_APPLY); + } + return false; +} + +void DmChar04_Draw(Actor* thisx, PlayState* play) { + Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); + s32 alpha; + s32 pad; + DmChar04* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C94C(play->state.gfxCtx); + alpha = (this->timer * 50) & 0x1FF; + if (alpha > 255) { + alpha = 511 - alpha; + } + gSPSegment(POLY_XLU_DISP++, 0x08, &gfx[0]); + gDPPipeSync(gfx++); + gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->primColors.r, (u8)this->primColors.g, (u8)this->primColors.b, + (u8)(this->primColors.a * 1)); + gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPEndDisplayList(gfx); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->envColors.r, (u8)(s8)this->envColors.g, (u8)(s8)this->envColors.b, + (u8)(s8)((f32)alpha * 1)); + gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + DmChar04_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP); + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h index b44bad9cd..91de6d567 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h @@ -8,10 +8,16 @@ struct DmChar04; typedef void (*DmChar04ActionFunc)(struct DmChar04*, PlayState*); typedef struct DmChar04 { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0xF8]; - /* 0x23C */ DmChar04ActionFunc actionFunc; - /* 0x240 */ char unk_240[0x24]; + /* 0x0000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[15]; + /* 0x1E2 */ Vec3s morphTable[15]; + /* 0x023C */ DmChar04ActionFunc actionFunc; + /* 0x240 */ Color_RGBAf primColors; + /* 0x250 */ Color_RGBAf envColors; + /* 0x260 */ u8 csAction; + /* 0x261 */ u8 animationIndex; + /* 0x262 */ u16 timer; } DmChar04; // size = 0x264 extern const ActorInit Dm_Char04_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 7f27b584d..40807c77c 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -718,7 +718,7 @@ void func_80AADD9C(PlayState* play, DmChar05* this) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(play, GID_44); + GetItem_Draw(play, GID_MASK_GORON); } if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { @@ -731,7 +731,7 @@ void func_80AADE78(PlayState* play, DmChar05* this) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(play, GID_45); + GetItem_Draw(play, GID_MASK_ZORA); } if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { @@ -744,7 +744,7 @@ void func_80AADF54(PlayState* play, DmChar05* this) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(play, GID_6B); + GetItem_Draw(play, GID_MASK_GIBDO); } if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { @@ -758,7 +758,7 @@ void func_80AAE030(PlayState* play, DmChar05* this) { Matrix_Translate(this->unk_190.x, this->unk_190.y, this->unk_190.z, MTXMODE_NEW); Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(play, GID_03); + GetItem_Draw(play, GID_MASK_COUPLE); } if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { @@ -768,17 +768,18 @@ void func_80AAE030(PlayState* play, DmChar05* this) { } void func_80AAE114(PlayState* play, DmChar05* this) { - s32 sp34; - s16 sp24[] = { - GID_02, GID_MASK_GREAT_FAIRY, GID_70, GID_3A, GID_0E, GID_0F, GID_3E, GID_71, + s32 getItemDrawIndex; + s16 getItemDrawIds[] = { + GID_MASK_KAMARO, GID_MASK_GREAT_FAIRY, GID_MASK_ROMANI, GID_MASK_BLAST, + GID_MASK_CIRCUS_LEADER, GID_MASK_BREMEN, GID_MASK_BUNNY, GID_MASK_POSTMAN, }; - sp34 = DMCHAR05_GET(&this->actor) - DMCHAR05_5; + getItemDrawIndex = DMCHAR05_GET(&this->actor) - DMCHAR05_5; if (this->actor.objBankIndex == this->unk_18F) { Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - GetItem_Draw(play, sp24[sp34]); + GetItem_Draw(play, getItemDrawIds[getItemDrawIndex]); } if (Object_IsLoaded(&play->objectCtx, this->unk_18F)) { diff --git a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h index 5ea5fa36c..39f09856a 100644 --- a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h +++ b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h @@ -10,11 +10,11 @@ typedef void (*DmChar07ActionFunc)(struct DmChar07*, PlayState*); #define DMCHAR07_GET_SPOTLIGHTFLAGS(thisx) (((thisx)->params >> 8) & 0x1F) #define DMCHAR07_GET_TYPE(thisx) ((thisx)->params & 0xFF) -#define DMCHAR07_STAGE_RIGHT_SPOTLIGHT 1 // Deku spotlight -#define DMCHAR07_UPSTAGE_RIGHT_SPOTLIGHT 2 // Goron spotlight -#define DMCHAR07_STAGE_CENTER_SPOTLIGHT 4 // Human spotlight -#define DMCHAR07_UPSTAGE_LEFT_SPOTLIGHT 8 // Zora spotlight -#define DMCHAR07_DOWNSTAGE_CENTER_SPOTLIGHT 16 +#define DMCHAR07_STAGE_RIGHT_SPOTLIGHT (1 << 0) // Deku spotlight +#define DMCHAR07_UPSTAGE_RIGHT_SPOTLIGHT (1 << 1) // Goron spotlight +#define DMCHAR07_STAGE_CENTER_SPOTLIGHT (1 << 2) // Human spotlight +#define DMCHAR07_UPSTAGE_LEFT_SPOTLIGHT (1 << 3) // Zora spotlight +#define DMCHAR07_DOWNSTAGE_CENTER_SPOTLIGHT (1 << 4) typedef enum { /* 0 */ DMCHAR07_STAGE, 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 57f1fb0e0..30cf308b6 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -42,8 +42,8 @@ s32 func_80C1DED0(DmNb* this, s32 arg1) { void func_80C1DF18(DmNb* this, PlayState* play) { s32 sp2C[] = { 0, 0, 0, 0, 0 }; - u16 actionUnk0; - s32 actionIndex; + u16 csAction; + s32 csActionIndex; if (play->csCtx.state != 0) { if (this->unk1F8 == 0) { @@ -51,14 +51,14 @@ void func_80C1DF18(DmNb* this, PlayState* play) { this->unk1F8 = 1; this->unk1F4 = this->unk1F0; } - if (Cutscene_CheckActorAction(play, 562)) { - actionIndex = Cutscene_GetActorActionIndex(play, 562); - actionUnk0 = play->csCtx.actorActions[actionIndex]->action; - if (this->unk1EC != (actionUnk0 & 0xFF)) { - this->unk1EC = actionUnk0; - func_80C1DED0(this, sp2C[actionUnk0]); + if (Cutscene_CheckActorAction(play, 0x232)) { + csActionIndex = Cutscene_GetActorActionIndex(play, 0x232); + csAction = play->csCtx.actorActions[csActionIndex]->action; + if (this->unk1EC != (u8)csAction) { + this->unk1EC = csAction; + func_80C1DED0(this, sp2C[csAction]); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); } } else if (this->unk1F8 != 0) { this->unk1F8 = 0; 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 88439c993..d5e3794ec 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -300,13 +300,13 @@ static AnimationInfo sAnimations[] = { void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { s32 objectIndex; - if (((this->animationId >= SK_ANIMATION_SHAKE_HEAD) && (this->animationId <= SK_ANIMATION_BENT_OVER_HEAD_TWITCH)) || - (this->animationId == SK_ANIMATION_CALL_DOWN_MOON_START) || - (this->animationId == SK_ANIMATION_CALL_DOWN_MOON_LOOP) || - (this->animationId == SK_ANIMATION_TELESCOPE_LOOK_UP_START) || - (this->animationId == SK_ANIMATION_TELESCOPE_LOOK_UP_LOOP)) { + if (((this->animIndex >= SK_ANIMATION_SHAKE_HEAD) && (this->animIndex <= SK_ANIMATION_BENT_OVER_HEAD_TWITCH)) || + (this->animIndex == SK_ANIMATION_CALL_DOWN_MOON_START) || + (this->animIndex == SK_ANIMATION_CALL_DOWN_MOON_LOOP) || + (this->animIndex == SK_ANIMATION_TELESCOPE_LOOK_UP_START) || + (this->animIndex == SK_ANIMATION_TELESCOPE_LOOK_UP_LOOP)) { objectIndex = this->objectStkObjectIndex; - } else if (this->animationId >= SK_ANIMATION_LOOK_UP_AT_GIANTS) { + } else if (this->animIndex >= SK_ANIMATION_LOOK_UP_AT_GIANTS) { objectIndex = this->objectStk3ObjectIndex; } else { objectIndex = this->objectStk2ObjectIndex; @@ -596,7 +596,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla break; } - if ((this->animationId == SK_ANIMATION_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { + if ((this->animIndex == SK_ANIMATION_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { if (Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); } else if (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { @@ -734,7 +734,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { break; } - if (this->animationId == SK_ANIMATION_SHAKE_HEAD) { + if (this->animIndex == SK_ANIMATION_SHAKE_HEAD) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } @@ -742,12 +742,12 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 28.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_RIDE); } - } else if (this->animationId == SK_ANIMATION_LAUGH_AFTER_SNIFF) { + } else if (this->animIndex == SK_ANIMATION_LAUGH_AFTER_SNIFF) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } - } else if ((this->animationId == SK_ANIMATION_SNIFF) && + } else if ((this->animIndex == SK_ANIMATION_SNIFF) && (Animation_OnFrame(&this->skelAnime, 16.0f) || Animation_OnFrame(&this->skelAnime, 23.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_NOSE); } @@ -983,20 +983,20 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { } } - if (this->animationId == SK_ANIMATION_WALK) { + if (this->animIndex == SK_ANIMATION_WALK) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_WALK); } - } else if (this->animationId == SK_ANIMATION_SEARCH_LINK) { + } else if (this->animIndex == SK_ANIMATION_SEARCH_LINK) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 20.0f) || Animation_OnFrame(&this->skelAnime, 27.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_CALM_HIT); } - } else if (this->animationId == SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING) { + } else if (this->animIndex == SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PUT_OUT_ITEM); } - } else if (this->animationId == SK_ANIMATION_PLAY_OCARINA_AND_LAUGH) { + } else if (this->animIndex == SK_ANIMATION_PLAY_OCARINA_AND_LAUGH) { if (Animation_OnFrame(&this->skelAnime, 14.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_UNSKILLFUL_OCARINA); } @@ -1024,7 +1024,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->tatlMessageTimer = 0; this->deflectCount = 0; this->maskType = SK_MASK_TYPE_NORMAL; - this->animationId = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIMATION_IDLE; this->fogR = play->lightCtx.unk7; this->fogG = play->lightCtx.unk8; this->fogB = play->lightCtx.unk9; @@ -1062,7 +1062,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { } } else if (gSaveContext.sceneSetupIndex == 3) { - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; if (gSaveContext.timerState[TIMER_ID_3] == TIMER_STATE_OFF) { // This code is called when the Giants fail to stop the moon. // Starts a 1 minute (60 second) timer until the moon falls. @@ -1075,12 +1075,12 @@ void DmStk_Init(Actor* thisx, PlayState* play) { sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = DmStk_ClockTower_Idle; } else { - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; this->actionFunc = DmStk_ClockTower_DoNothing; } } else { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_READY; - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; this->actor.world.pos.y = 120.0f; sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = DmStk_ClockTower_Idle; @@ -1099,7 +1099,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fogN = 996; this->fogF = 1000; this->fogScale = 0.7f; - this->animationId = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; + this->animIndex = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; this->actionFunc = DmStk_WaitForTelescope; } else { if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { @@ -1123,7 +1123,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->csAction = 99; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); } Actor_SetScale(&this->actor, 0.01f); @@ -1200,9 +1200,9 @@ void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, PlayState* play) { void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, PlayState* play) { if (play->csCtx.state == 0) { - this->animationId = SK_ANIMATION_CALL_DOWN_MOON_LOOP; + this->animIndex = SK_ANIMATION_CALL_DOWN_MOON_LOOP; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); this->actionFunc = DmStk_ClockTower_IdleWithOcarina; } } @@ -1218,8 +1218,8 @@ void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, PlayState* play) { void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* play) { if (play->csCtx.state == 0) { - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); this->actionFunc = DmStk_ClockTower_Idle; } } @@ -1279,8 +1279,8 @@ void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play) { } } - this->animationId = SK_ANIMATION_DEFLECT_ATTACK; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + this->animIndex = SK_ANIMATION_DEFLECT_ATTACK; + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); this->actionFunc = DmStk_ClockTower_WaitForDeflectionToEnd; } @@ -1292,8 +1292,8 @@ void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play) { void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, PlayState* play) { DmStk_ClockTower_AdjustHeightAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); this->actionFunc = DmStk_ClockTower_Idle; } @@ -1325,96 +1325,96 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { switch (play->csCtx.actorActions[actorActionIndex]->action) { case 0: case 1: - this->animationId = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIMATION_IDLE; break; case 2: - this->animationId = SK_ANIMATION_WALK; + this->animIndex = SK_ANIMATION_WALK; break; case 3: - this->animationId = SK_ANIMATION_UNUSED_KICK_OVER_LINK; + this->animIndex = SK_ANIMATION_UNUSED_KICK_OVER_LINK; break; case 4: - this->animationId = SK_ANIMATION_KICK_OVER_LINK; + this->animIndex = SK_ANIMATION_KICK_OVER_LINK; break; case 6: - this->animationId = SK_ANIMATION_PICK_UP_OCARINA; + this->animIndex = SK_ANIMATION_PICK_UP_OCARINA; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 7: - this->animationId = SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING; + this->animIndex = SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 8: - this->animationId = SK_ANIMATION_SHAKE_HEAD; + this->animIndex = SK_ANIMATION_SHAKE_HEAD; break; case 9: - this->animationId = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIMATION_IDLE; this->fadeInState = SK_FADE_IN_STATE_START; break; case 12: - this->animationId = SK_ANIMATION_HIDE_OCARINA_START; + this->animIndex = SK_ANIMATION_HIDE_OCARINA_START; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 13: - this->animationId = SK_ANIMATION_JUMP_WHILE_HIDING_OCARINA; + this->animIndex = SK_ANIMATION_JUMP_WHILE_HIDING_OCARINA; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 14: - this->animationId = SK_ANIMATION_HORSE_RIDE_START; + this->animIndex = SK_ANIMATION_HORSE_RIDE_START; break; case 15: - this->animationId = SK_ANIMATION_HORSE_RIDE_LOOP; + this->animIndex = SK_ANIMATION_HORSE_RIDE_LOOP; break; case 16: - this->animationId = SK_ANIMATION_HORSE_RIDE_AND_ROTATE; + this->animIndex = SK_ANIMATION_HORSE_RIDE_AND_ROTATE; break; case 17: - this->animationId = SK_ANIMATION_RECLINING_FLOAT; + this->animIndex = SK_ANIMATION_RECLINING_FLOAT; break; case 18: - this->animationId = SK_ANIMATION_CURSE_START; + this->animIndex = SK_ANIMATION_CURSE_START; break; case 19: - this->animationId = SK_ANIMATION_LAUGH_START; + this->animIndex = SK_ANIMATION_LAUGH_START; break; case 20: - this->animationId = SK_ANIMATION_RAISE_MASK_START; + this->animIndex = SK_ANIMATION_RAISE_MASK_START; break; case 21: - this->animationId = SK_ANIMATION_LOWER_MASK; + this->animIndex = SK_ANIMATION_LOWER_MASK; break; case 22: - this->animationId = SK_ANIMATION_PLAY_OCARINA_WHILE_FLOATING; + this->animIndex = SK_ANIMATION_PLAY_OCARINA_WHILE_FLOATING; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 23: - this->animationId = SK_ANIMATION_FLOATING_TURN_AROUND; + this->animIndex = SK_ANIMATION_FLOATING_TURN_AROUND; this->handType = SK_HAND_TYPE_JUGGLING_OR_DROPPING_OCARINA; break; case 24: - this->animationId = SK_ANIMATION_CALL_DOWN_MOON_START; + this->animIndex = SK_ANIMATION_CALL_DOWN_MOON_START; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } @@ -1425,148 +1425,148 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { break; case 26: - this->animationId = SK_ANIMATION_SMACK_FAIRY_START; + this->animIndex = SK_ANIMATION_SMACK_FAIRY_START; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 27: - this->animationId = SK_ANIMATION_HIT_BY_BUBBLE; + this->animIndex = SK_ANIMATION_HIT_BY_BUBBLE; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 28: - this->animationId = SK_ANIMATION_DROP_OCARINA; + this->animIndex = SK_ANIMATION_DROP_OCARINA; this->handType = SK_HAND_TYPE_JUGGLING_OR_DROPPING_OCARINA; break; case 30: - this->animationId = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; break; case 31: - this->animationId = SK_ANIMATION_DEFLECT_ATTACK; + this->animIndex = SK_ANIMATION_DEFLECT_ATTACK; break; case 32: - this->animationId = SK_ANIMATION_SURPRISE_START; + this->animIndex = SK_ANIMATION_SURPRISE_START; break; case 33: - this->animationId = SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_START; + this->animIndex = SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_START; break; case 34: - this->animationId = SK_ANIMATION_HOLD_HEAD_AND_SHAKE_START; + this->animIndex = SK_ANIMATION_HOLD_HEAD_AND_SHAKE_START; break; case 35: - this->animationId = SK_ANIMATION_HOLD_HEAD_AND_SCREAM_START; + this->animIndex = SK_ANIMATION_HOLD_HEAD_AND_SCREAM_START; break; case 36: - this->animationId = SK_ANIMATION_HUDDLE_WITH_FAIRIES; + this->animIndex = SK_ANIMATION_HUDDLE_WITH_FAIRIES; break; case 37: - this->animationId = SK_ANIMATION_SEARCH_MASK_SALESMAN; + this->animIndex = SK_ANIMATION_SEARCH_MASK_SALESMAN; break; case 38: - this->animationId = SK_ANIMATION_HOLD_UP_MASK_START; + this->animIndex = SK_ANIMATION_HOLD_UP_MASK_START; break; case 39: - this->animationId = SK_ANIMATION_SHIVER; + this->animIndex = SK_ANIMATION_SHIVER; break; case 40: - this->animationId = SK_ANIMATION_DRAW; + this->animIndex = SK_ANIMATION_DRAW; break; case 41: - this->animationId = SK_ANIMATION_TELESCOPE_LOOK_UP_START; + this->animIndex = SK_ANIMATION_TELESCOPE_LOOK_UP_START; break; case 42: - this->animationId = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; + this->animIndex = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; break; case 43: - this->animationId = SK_ANIMATION_BENT_OVER_LOOK_UP; + this->animIndex = SK_ANIMATION_BENT_OVER_LOOK_UP; break; case 44: - this->animationId = SK_ANIMATION_SPANK; + this->animIndex = SK_ANIMATION_SPANK; break; case 45: - this->animationId = SK_ANIMATION_HIP_SHAKE_AND_JUMP; + this->animIndex = SK_ANIMATION_HIP_SHAKE_AND_JUMP; this->fadeOutState = SK_FADE_OUT_STATE_FADING_OUT; break; case 46: this->handType = SK_HAND_TYPE_HOLDING_FLUTE; - this->animationId = SK_ANIMATION_PLAY_FLUTE; + this->animIndex = SK_ANIMATION_PLAY_FLUTE; break; case 47: - this->animationId = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIMATION_CARTWHEEL; break; case 48: - this->animationId = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIMATION_CARTWHEEL; break; case 49: - this->animationId = SK_ANIMATION_LOOK_UP_AT_GIANTS; + this->animIndex = SK_ANIMATION_LOOK_UP_AT_GIANTS; break; case 50: - this->animationId = SK_ANIMATION_ASHAMED_START; + this->animIndex = SK_ANIMATION_ASHAMED_START; break; case 51: - this->animationId = SK_ANIMATION_LOOK_LEFT_START; + this->animIndex = SK_ANIMATION_LOOK_LEFT_START; break; case 52: - this->animationId = SK_ANIMATION_SNIFF; + this->animIndex = SK_ANIMATION_SNIFF; break; case 53: - this->animationId = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIMATION_CARTWHEEL; break; case 54: - this->animationId = SK_ANIMATION_LIE_FLAT; + this->animIndex = SK_ANIMATION_LIE_FLAT; break; case 55: - this->animationId = SK_ANIMATION_DANGLE_FROM_MASK_START; + this->animIndex = SK_ANIMATION_DANGLE_FROM_MASK_START; break; case 56: - this->animationId = SK_ANIMATION_DROPPED_FROM_MASK; + this->animIndex = SK_ANIMATION_DROPPED_FROM_MASK; break; case 57: - this->animationId = SK_ANIMATION_LOOK_UP_AT_GIANTS; + this->animIndex = SK_ANIMATION_LOOK_UP_AT_GIANTS; break; case 58: - this->animationId = SK_ANIMATION_ASHAMED_START; + this->animIndex = SK_ANIMATION_ASHAMED_START; break; case 59: - this->animationId = SK_ANIMATION_LOOK_LEFT_START; + this->animIndex = SK_ANIMATION_LOOK_LEFT_START; break; case 60: - this->animationId = SK_ANIMATION_SNIFF; + this->animIndex = SK_ANIMATION_SNIFF; break; case 5: @@ -1574,11 +1574,11 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { break; default: - this->animationId = SK_ANIMATION_SHAKE_HEAD; + this->animIndex = SK_ANIMATION_SHAKE_HEAD; break; } - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); } } @@ -1642,7 +1642,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - switch (this->animationId) { + switch (this->animIndex) { case SK_ANIMATION_LOOK_AROUND: case SK_ANIMATION_CURSE_START: case SK_ANIMATION_LAUGH_START: @@ -1666,34 +1666,34 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { case SK_ANIMATION_ASHAMED_START: case SK_ANIMATION_LOOK_LEFT_START: case SK_ANIMATION_SNIFF: - this->animationId++; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + this->animIndex++; + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); break; case SK_ANIMATION_LOWER_MASK: - this->animationId = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIMATION_IDLE; this->maskType = SK_MASK_TYPE_NORMAL; this->handType = SK_HAND_TYPE_DEFAULT; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animationId], 0); + DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); break; } } - if (((this->animationId == SK_ANIMATION_RAISE_MASK_START) && (this->skelAnime.curFrame >= 16.0f)) || - (this->animationId == SK_ANIMATION_RAISE_MASK_LOOP) || (this->animationId == SK_ANIMATION_LOWER_MASK)) { + if (((this->animIndex == SK_ANIMATION_RAISE_MASK_START) && (this->skelAnime.curFrame >= 16.0f)) || + (this->animIndex == SK_ANIMATION_RAISE_MASK_LOOP) || (this->animIndex == SK_ANIMATION_LOWER_MASK)) { this->maskType = SK_MASK_TYPE_RAISED; this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK; - } else if (((this->animationId >= SK_ANIMATION_HUDDLE_WITH_FAIRIES) && (this->animationId <= SK_ANIMATION_DRAW)) || - ((this->animationId >= SK_ANIMATION_PLAY_FLUTE) && (this->animationId <= SK_ANIMATION_CARTWHEEL)) || + } else if (((this->animIndex >= SK_ANIMATION_HUDDLE_WITH_FAIRIES) && (this->animIndex <= SK_ANIMATION_DRAW)) || + ((this->animIndex >= SK_ANIMATION_PLAY_FLUTE) && (this->animIndex <= SK_ANIMATION_CARTWHEEL)) || ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { this->maskType = SK_MASK_TYPE_NO_MASK; - if ((this->animationId == SK_ANIMATION_HOLD_UP_MASK_START) || - (this->animationId == SK_ANIMATION_HOLD_UP_MASK_LOOP)) { + if ((this->animIndex == SK_ANIMATION_HOLD_UP_MASK_START) || + (this->animIndex == SK_ANIMATION_HOLD_UP_MASK_LOOP)) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE; } } - if (this->animationId == SK_ANIMATION_DROPPED_FROM_MASK) { + if (this->animIndex == SK_ANIMATION_DROPPED_FROM_MASK) { this->maskType = SK_MASK_TYPE_NO_MASK; } } @@ -1745,7 +1745,7 @@ void DmStk_ClockTower_Idle(DmStk* this, PlayState* play) { DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; - if (this->animationId == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { + if (this->animIndex == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { this->actor.targetArrowOffset = 3100.0f; } else { this->actor.targetArrowOffset = 200.0f; @@ -1762,7 +1762,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { DmStk* this = THIS; if (DM_STK_GET_TYPE(&this->actor) != DM_STK_TYPE_MAJORAS_MASK) { - if (this->animationId == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { + if (this->animIndex == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { Actor_SetFocus(&this->actor, 40.0f); } else { Actor_SetFocus(&this->actor, 6.0f); @@ -1770,7 +1770,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { DmStk_LoadObjectForAnimation(this, play); - if (this->animationId != SK_ANIMATION_LIE_FLAT) { + if (this->animIndex != SK_ANIMATION_LIE_FLAT) { SkelAnime_Update(&this->skelAnime); } @@ -1815,7 +1815,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { // This code is responsible for making in-game time pass while using the telescope in the Astral Observatory. // Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes. if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && - !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == 0) && + !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15); if (REG(15) != 0) { @@ -1874,8 +1874,8 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if ((this->animationId == SK_ANIMATION_LOOK_LEFT_LOOP) || (this->animationId == SK_ANIMATION_LAUGH_LOOP) || - (this->animationId == SK_ANIMATION_LAUGH_AFTER_SNIFF)) { + if ((this->animIndex == SK_ANIMATION_LOOK_LEFT_LOOP) || (this->animIndex == SK_ANIMATION_LAUGH_LOOP) || + (this->animIndex == SK_ANIMATION_LAUGH_AFTER_SNIFF)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidLaughingHeadDL); gSPDisplayList(POLY_OPA_DISP++, gSkullKidLaughingEyesDL); } else { diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h index 1933c7727..ffea61265 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h @@ -22,7 +22,7 @@ typedef struct DmStk { /* 0x20C */ Vec3s morphTable[SKULL_KID_LIMB_MAX]; // Not used, since it's allocated dynamically instead. /* 0x290 */ DmStkActionFunc actionFunc; /* 0x294 */ ColliderCylinder collider; - /* 0x2E0 */ s16 animationId; + /* 0x2E0 */ s16 animIndex; /* 0x2E4 */ s32 alpha; /* 0x2E8 */ u32 fogR; /* 0x2EC */ u32 fogG; 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 8ddbdd333..7edb7af4d 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -129,8 +129,8 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { s32 grottoType = DOORANA_GET_TYPE(&this->actor); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { - if (this->actor.targetMode != 0 && play->transitionTrigger == 0 && play->transitionMode == 0 && - (player->stateFlags1 & 0x80000000) && player->unk_AE7 == 0) { + if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && (player->stateFlags1 & 0x80000000) && (player->unk_AE7 == 0)) { if (grottoType == DOORANA_TYPE_VISIBLE_SCENE_EXIT) { s32 exitIndex = DOORANA_GET_EXIT_INDEX(&this->actor); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index b198878aa..d8cdf3cc1 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -608,7 +608,7 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND); - quake = Quake_Add(Play_GetCamera(play, 0), 3); + quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); Quake_SetSpeed(quake, -32536); Quake_SetQuakeValues(quake, 2, 0, 0, 0); Quake_SetCountdown(quake, 10); 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 7507a4467..75e0882df 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -356,7 +356,7 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if (Message_GetState(&play->msgCtx) == 4 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); if (play->msgCtx.choiceIndex == 0) { func_8019F208(); @@ -410,8 +410,8 @@ void func_808B958C(DoorWarp1* this, PlayState* play) { this->unk_1D0++; if ((this->unk_1D0 > 120) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) { func_808BA10C(this, play); - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } Math_SmoothStepToF(&this->unk_1A8, 6.0f, 0.2f, 0.02f, 0.01f); @@ -486,7 +486,7 @@ void func_808B98A8(DoorWarp1* this, PlayState* play) { if (DOORWARP1_GET_FF00_1(&this->dyna.actor) != 0xFF) { play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } else { func_80169FDC(&play->state); } @@ -546,7 +546,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { } if (!Actor_HasParent(&this->dyna.actor, play)) { - Actor_PickUp(&this->dyna.actor, play, func_808B849C(this, play) + 84, 30.0f, 80.0f); + Actor_PickUp(&this->dyna.actor, play, (GI_REMAINS_ODOLWA - 1) + func_808B849C(this, play), 30.0f, 80.0f); return; } @@ -579,7 +579,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { } void func_808B9E94(DoorWarp1* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 2) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->unk_1CE = 110; DoorWarp1_SetupAction(this, func_808B9ED8); } @@ -703,49 +703,49 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = phi_v0_3 + 0xFFF0; } - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { switch (phi_v0_2) { case 0: if (gSaveContext.save.weekEventReg[20] & 2) { gSaveContext.save.weekEventReg[7] |= 0x80; play->nextEntranceIndex = 0x3010; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { play->nextEntranceIndex = 0x8600; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } break; case 1: gSaveContext.save.weekEventReg[33] |= 0x80; play->nextEntranceIndex = 0xAE70; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; break; case 3: if (gSaveContext.save.weekEventReg[55] & 0x80) { play->nextEntranceIndex = 0x6A90; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { gSaveContext.save.weekEventReg[55] |= 0x80; play->nextEntranceIndex = 0x6A80; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } break; @@ -753,9 +753,9 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { gSaveContext.save.weekEventReg[52] |= 0x20; play->nextEntranceIndex = 0x20F0; gSaveContext.nextCutsceneIndex = 0xFFF2; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; break; } } @@ -765,7 +765,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { } play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } else { func_80169FDC(&play->state); } diff --git a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c index 127a24ddf..0f5245617 100644 --- a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c +++ b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c @@ -13,8 +13,11 @@ void EffChange_Init(Actor* thisx, PlayState* play); void EffChange_Destroy(Actor* thisx, PlayState* play); void EffChange_Update(Actor* thisx, PlayState* play); +void EffChange_Draw(Actor* thisx, PlayState* play); + +void EffChange_SetColors(EffChange* this, s32 arg1); +void func_80A4C5CC(EffChange* this, PlayState* play); -#if 0 const ActorInit Eff_Change_InitVars = { ACTOR_EFF_CHANGE, ACTORCAT_ITEMACTION, @@ -27,16 +30,118 @@ const ActorInit Eff_Change_InitVars = { (ActorFunc)NULL, }; -#endif +static u8 D_80A4C920[] = { + // prim r g b env r g b + 255, 255, 170, 0, 100, 0, // COLOR_0 + 255, 255, 170, 200, 0, 0, // COLOR_1 + 170, 255, 255, 0, 100, 255, // COLOR_2 + 255, 255, 170, 200, 150, 0, // COLOR_3 + 255, 255, 170, 0, 100, 0, // COLOR_4 + 255, 255, 170, 0, 100, 0, // COLOR_5 + 255, 255, 170, 0, 100, 0, // COLOR_6 + 255, 255, 170, 0, 100, 0 // COLOR_7 +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/EffChange_Init.s") +void EffChange_Init(Actor* thisx, PlayState* play) { + EffChange* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/EffChange_Destroy.s") + this->actionFunc = func_80A4C5CC; + this->actor.draw = EffChange_Draw; + EffChange_SetColors(this, EFFCHANGE_GET_COLORS(thisx)); + Actor_SetScale(&this->actor, 0.075f); + this->primColors[3] = 0; + func_80183430(&this->skeletonInfo, gameplay_keep_Blob_02900C, gameplay_keep_Blob_0281DC, this->jointTable, + this->morphTable, NULL); + func_801834A8(&this->skeletonInfo, gameplay_keep_Blob_0281DC); + this->step = 0; + this->actor.shape.rot.y = 0; + this->skeletonInfo.frameCtrl.unk_C = (2.0f / 3.0f); + ActorCutscene_SetIntentToPlay(0x7B); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/func_80A4C578.s") +void EffChange_Destroy(Actor* thisx, PlayState* play) { + EffChange* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/func_80A4C5CC.s") + func_8018349C(&this->skeletonInfo); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/EffChange_Update.s") +void EffChange_SetColors(EffChange* this, s32 arg1) { + arg1 *= 6; + this->primColors[0] = D_80A4C920[arg1]; + this->primColors[1] = D_80A4C920[arg1 + 1]; + this->primColors[2] = D_80A4C920[arg1 + 2]; + this->envColors[0] = D_80A4C920[arg1 + 3]; + this->envColors[1] = D_80A4C920[arg1 + 4]; + this->envColors[2] = D_80A4C920[arg1 + 5]; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Change/func_80A4C7B0.s") +void func_80A4C5CC(EffChange* this, PlayState* play) { + f32 phi_fv0; + + if (func_80183DE0(&this->skeletonInfo)) { + Actor_MarkForDeath(&this->actor); + ActorCutscene_Stop(0x7B); + func_800FD2B4(play, 0.0f, 850.0f, 0.2f, 0.0f); + } else { + this->step++; + if (this->skeletonInfo.frameCtrl.unk_10 < 20.0f) { + if ((this->primColors[3]) < 242) { + this->primColors[3] += 13; + } else { + this->primColors[3] = 255; + } + } else if (this->skeletonInfo.frameCtrl.unk_10 > 70.0f) { + if ((this->primColors[3]) >= 14) { + this->primColors[3] -= 13; + } else { + this->primColors[3] = 0; + } + } else { + this->primColors[3] = 255; + } + + phi_fv0 = this->primColors[3] * (1.0f / 255.0f); + if (phi_fv0 > 1.0f) { + phi_fv0 = 1.0f; + } else if (phi_fv0 < 0.0f) { + phi_fv0 = 0.0f; + } + func_800FD2B4(play, phi_fv0, 850.0f, 0.2f, 0.0f); + if (ActorCutscene_GetCurrentIndex() != 0x7B) { + if (ActorCutscene_GetCanPlayNext(0x7B)) { + ActorCutscene_Start(0x7B, &this->actor); + } else { + ActorCutscene_SetIntentToPlay(0x7B); + } + } + } +} + +void EffChange_Update(Actor* thisx, PlayState* play) { + EffChange* this = THIS; + + this->actionFunc(this, play); +} + +void EffChange_Draw(Actor* thisx, PlayState* play) { + s32 pad; + Mtx* mtx; + EffChange* this = THIS; + + AnimatedMat_DrawStepXlu(play, Lib_SegmentedToVirtual(&gameplay_keep_Matanimheader_028FEC), this->step); + mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(this->skeletonInfo.unk_18->unk_1 * sizeof(Mtx))); + + if (mtx != NULL) { + func_8012C2DC(play->state.gfxCtx); + Matrix_RotateYS((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), MTXMODE_APPLY); + + OPEN_DISPS(play->state.gfxCtx); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->primColors[0], this->primColors[1], this->primColors[2], + this->primColors[3]); + gDPSetEnvColor(POLY_XLU_DISP++, this->envColors[0], this->envColors[1], this->envColors[2], 255); + func_8018450C(play, &this->skeletonInfo, mtx, NULL, NULL, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); + } +} diff --git a/src/overlays/actors/ovl_Eff_Change/z_eff_change.h b/src/overlays/actors/ovl_Eff_Change/z_eff_change.h index 9860d13eb..aed7e534a 100644 --- a/src/overlays/actors/ovl_Eff_Change/z_eff_change.h +++ b/src/overlays/actors/ovl_Eff_Change/z_eff_change.h @@ -2,6 +2,9 @@ #define Z_EFF_CHANGE_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define EFFCHANGE_GET_COLORS(thisx) ((thisx)->params & 7) struct EffChange; @@ -9,7 +12,12 @@ typedef void (*EffChangeActionFunc)(struct EffChange*, PlayState*); typedef struct EffChange { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x84]; + /* 0x144 */ SkeletonInfo skeletonInfo; + /* 0x174 */ Vec3s jointTable[PINK_DEKU_FLOWER_LIMB_BACK_RIGHT_PETAL]; + /* 0x198 */ Vec3s morphTable[PINK_DEKU_FLOWER_LIMB_BACK_RIGHT_PETAL]; + /* 0x1BC */ s16 step; + /* 0x1BE */ u8 primColors[4]; + /* 0x1C2 */ u8 envColors[4]; /* 0x1C8 */ EffChangeActionFunc actionFunc; } EffChange; // size = 0x1CC diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c index f644ad9dc..83842569f 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c @@ -5,6 +5,7 @@ */ #include "z_eff_kamejima_wave.h" +#include "objects/object_kamejima/object_kamejima.h" #define FLAGS (ACTOR_FLAG_10) @@ -13,8 +14,14 @@ void EffKamejimaWave_Init(Actor* thisx, PlayState* play); void EffKamejimaWave_Destroy(Actor* thisx, PlayState* play); void EffKamejimaWave_Update(Actor* thisx, PlayState* play); +void EffKamejimaWave_Draw(Actor* thisx, PlayState* play); + +void func_80BCEC6C(EffKamejimaWave* this, PlayState* play); +void func_80BCEDE0(EffKamejimaWave* this, PlayState* play); +void func_80BCEBC0(EffKamejimaWave* this, PlayState* play); +void func_80BCED34(EffKamejimaWave* this, PlayState* play); +void EffKamejimaWave_SetVtxAlpha(u8 alpha); -#if 0 const ActorInit Eff_Kamejima_Wave_InitVars = { ACTOR_EFF_KAMEJIMA_WAVE, ACTORCAT_ITEMACTION, @@ -27,26 +34,138 @@ const ActorInit Eff_Kamejima_Wave_InitVars = { (ActorFunc)NULL, }; -#endif +static Color_RGBA8 sPrimColors[] = { + { 255, 240, 255, 255 }, { 255, 255, 255, 255 }, { 255, 240, 230, 255 }, { 140, 170, 220, 255 } +}; +static Color_RGBA8 sEnvColors[] = { + { 130, 80, 90, 255 }, { 90, 120, 130, 255 }, { 130, 80, 70, 255 }, { 40, 60, 110, 255 } +}; -extern UNK_TYPE D_06000000; -extern UNK_TYPE D_06000140; -extern UNK_TYPE D_06001AF0; +s16 sVtxAlpha; +AnimatedMaterial* D_80BCF1C4; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/EffKamejimaWave_Init.s") +void EffKamejimaWave_Init(Actor* thisx, PlayState* play) { + EffKamejimaWave* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/EffKamejimaWave_Destroy.s") + Actor_SetScale(&this->actor, 0.2f); + this->actor.scale.y = 0.0f; + if (EFFKAMEJIMAWAVE_GET_F(thisx) == EFFKAMEJIMAWAVE_PARAMS_1) { + this->actionFunc = func_80BCEDE0; + sVtxAlpha = 255; + } else { + this->actionFunc = func_80BCEC6C; + sVtxAlpha = 255; + } + D_80BCF1C4 = Lib_SegmentedToVirtual(object_kamejima_Matanimheader_001AF0); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCEBC0.s") +void EffKamejimaWave_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCEC6C.s") +void func_80BCEBC0(EffKamejimaWave* this, PlayState* play) { + this->actor.scale.y += this->scaleOffset; + this->scaleOffset -= 0.003f; + this->actor.shape.rot.x += 0x64; + if (this->scaleOffset < 0.0f) { + this->actor.scale.x += 0.003f; + } + if (this->scaleOffset < -0.01f) { + this->scaleOffset = -0.01f; + } + if (this->actor.scale.y < 0.0f) { + this->actor.scale.y = 0.0f; + this->actor.scale.x = 0.2f; + this->actionFunc = func_80BCEC6C; + this->actor.draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCED34.s") +void func_80BCEC6C(EffKamejimaWave* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x1E0)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x1E0)); + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x1E0)]->action == 2) { + this->scaleOffset = 0.05f; + this->actionFunc = func_80BCEBC0; + this->actor.draw = EffKamejimaWave_Draw; + sVtxAlpha = 255; + this->actor.shape.rot.x = 0; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TORTOISE_WAKE_UP); + } + } else { + this->actor.draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCEDE0.s") +void func_80BCED34(EffKamejimaWave* this, PlayState* play) { + this->actor.scale.y += this->scaleOffset; + this->scaleOffset -= 0.002f; + this->actor.shape.rot.x += 0x8C; + if (this->scaleOffset < 0.0f) { + this->actor.scale.x += 0.002f; + } + if (this->scaleOffset < 0.0f) { + this->scaleOffset = 0; + } + if (sVtxAlpha >= 4) { + sVtxAlpha -= 4; + } else { + this->actor.scale.y = 0.0f; + this->actionFunc = func_80BCEDE0; + this->actor.draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/EffKamejimaWave_Update.s") +void func_80BCEDE0(EffKamejimaWave* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x1F6)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x1F6)); + if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x1F6)]->action == 2) { + this->scaleOffset = 0.03f; + this->actor.scale.x = 0.35f; + this->actionFunc = func_80BCED34; + this->actor.draw = EffKamejimaWave_Draw; + this->actor.shape.rot.x = 0; + } + } else { + this->actor.draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCEEBC.s") +void EffKamejimaWave_Update(Actor* thisx, PlayState* play) { + EffKamejimaWave* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Kamejima_Wave/func_80BCEF0C.s") + this->actionFunc(this, play); +} + +void EffKamejimaWave_SetVtxAlpha(u8 alpha) { + Vtx* vtx = Lib_SegmentedToVirtual(&object_kamejima_Vtx_000000); + + vtx[2].v.cn[3] = alpha; + vtx[6].v.cn[3] = alpha; + vtx[8].v.cn[3] = alpha; + vtx[9].v.cn[3] = alpha; + vtx[12].v.cn[3] = alpha; + vtx[16].v.cn[3] = alpha; + vtx[18].v.cn[3] = alpha; + vtx[19].v.cn[3] = alpha; +} + +void EffKamejimaWave_Draw(Actor* thisx, PlayState* play) { + Color_RGBA8 primColor; + Color_RGBA8 envColor; + + func_800FE7A8(sPrimColors, &primColor); + func_800FE7A8(sEnvColors, &envColor); + EffKamejimaWave_SetVtxAlpha(sVtxAlpha); + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + Matrix_Scale(6.0f, 5.0f, 5.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + AnimatedMat_Draw(play, D_80BCF1C4); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, 255); + gSPDisplayList(POLY_XLU_DISP++, object_kamejima_DL_000140); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h index 89f8ccc68..9b4713034 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.h @@ -3,16 +3,24 @@ #include "global.h" +#define EFFKAMEJIMAWAVE_GET_F(thisx) ((thisx)->params & 0xF) + struct EffKamejimaWave; typedef void (*EffKamejimaWaveActionFunc)(struct EffKamejimaWave*, PlayState*); typedef struct EffKamejimaWave { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x8]; + /* 0x144 */ f32 scaleOffset; + /* 0x148 */ UNK_TYPE1 pad148[4]; /* 0x14C */ EffKamejimaWaveActionFunc actionFunc; } EffKamejimaWave; // size = 0x150 +typedef enum params { + /* 0x0 */ EFFKAMEJIMAWAVE_PARAMS_0, + /* 0x1 */ EFFKAMEJIMAWAVE_PARAMS_1 +} EffKamejimaWaveParams; + extern const ActorInit Eff_Kamejima_Wave_InitVars; #endif // Z_EFF_KAMEJIMA_WAVE_H diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c index c700aa220..773e881ed 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c @@ -5,12 +5,13 @@ */ #include "z_eff_lastday.h" +#include "objects/object_lastday/object_lastday.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((EffLastday*)thisx) -void EffLastday_Init(Actor* thisx, PlayState* play); +void EffLastday_Init(Actor* thisx, PlayState* play2); void EffLastday_Destroy(Actor* thisx, PlayState* play); void EffLastday_Update(Actor* thisx, PlayState* play); void EffLastday_Draw(Actor* thisx, PlayState* play); @@ -20,7 +21,13 @@ void func_80BEBDF8(EffLastday* this, PlayState* play); void func_80BEBEB8(EffLastday* this, PlayState* play); void func_80BEBF78(EffLastday* this, PlayState* play); -#if 0 +typedef enum EffLastDayAction { + /* 0x0 */ EFFLASTDAY_ACTION_NONE, + /* 0x1 */ EFFLASTDAY_ACTION_1, + /* 0x2 */ EFFLASTDAY_ACTION_2, + /* 0x3 */ EFFLASTDAY_ACTION_3 +} EffLastDayAction; + const ActorInit Eff_Lastday_InitVars = { ACTOR_EFF_LASTDAY, ACTORCAT_ITEMACTION, @@ -33,25 +40,216 @@ const ActorInit Eff_Lastday_InitVars = { (ActorFunc)EffLastday_Draw, }; -#endif +void EffLastday_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EffLastday* this = THIS; -extern UNK_TYPE D_06000000; -extern UNK_TYPE D_06000510; + Actor_SetScale(&this->actor, 0.1f); + switch (EFFLASTDAY_GET_F(&this->actor)) { + case EFFLASTDAY_PARAMS_1: + this->dList = object_lastday_DL_000510; + this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000608); + this->csActionCmd = 0x1FC; + this->actionFunc = func_80BEBDF8; + Actor_SetScale(&this->actor, 1.0f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Init.s") + case EFFLASTDAY_PARAMS_2: + this->dList = object_lastday_DL_000210; + this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000308); + this->csActionCmd = 0x1FD; + this->actionFunc = func_80BEBEB8; + Actor_SetScale(&this->actor, 0.5f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Destroy.s") + case EFFLASTDAY_PARAMS_3: + this->dList = object_lastday_DL_000060; + this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000148); + this->csActionCmd = 0x1FE; + this->actionFunc = func_80BEBF78; + Actor_SetScale(&this->actor, 0.2f); + this->actor.home.rot.z = 0; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBD0C.s") + default: + this->dList = object_lastday_DL_000370; + this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000448); + this->csActionCmd = 0x1FB; + this->actionFunc = func_80BEBD0C; + Actor_SetScale(&this->actor, 1.0f); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, + EFFLASTDAY_PARAMS_1); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, + EFFLASTDAY_PARAMS_2); + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, + EFFLASTDAY_PARAMS_3); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBDF8.s") +void EffLastday_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBEB8.s") +void func_80BEBD0C(EffLastday* this, PlayState* play) { + u16 csAction; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBF78.s") + if ((Cutscene_CheckActorAction(play, this->csActionCmd))) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; + switch (csAction) { + default: + this->actor.draw = NULL; + this->alpha = 0; + this->step = 0; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Update.s") + case EFFLASTDAY_ACTION_2: + this->actor.draw = NULL; + this->actor.draw = EffLastday_Draw; + if (this->alpha < 255) { + this->alpha += 10; + } + if (this->alpha > 255) { + this->alpha = 255; + } + this->step++; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEC0A4.s") + case EFFLASTDAY_ACTION_3: + this->actor.draw = EffLastday_Draw; + break; + } + } else { + this->actor.draw = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Draw.s") +void func_80BEBDF8(EffLastday* this, PlayState* play) { + u16 csAction; + + if (Cutscene_CheckActorAction(play, this->csActionCmd)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; + switch (csAction) { + default: + this->actor.draw = NULL; + this->step = 0; + break; + + case EFFLASTDAY_ACTION_2: + this->actor.draw = EffLastday_Draw; + this->step++; + break; + + case EFFLASTDAY_ACTION_3: + this->actor.draw = EffLastday_Draw; + break; + } + } else { + this->actor.draw = NULL; + } +} + +void func_80BEBEB8(EffLastday* this, PlayState* play) { + u16 csAction; + + if (Cutscene_CheckActorAction(play, this->csActionCmd)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; + switch (csAction) { + default: + this->actor.draw = NULL; + this->step = 0; + break; + + case EFFLASTDAY_ACTION_2: + this->actor.draw = EffLastday_Draw; + this->step++; + break; + + case EFFLASTDAY_ACTION_3: + this->actor.draw = EffLastday_Draw; + break; + } + } else { + this->actor.draw = NULL; + } +} + +void func_80BEBF78(EffLastday* this, PlayState* play) { + u16 csAction; + + if (Cutscene_CheckActorAction(play, this->csActionCmd)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; + switch (csAction) { + default: + this->actor.draw = NULL; + this->alpha = 0; + this->step = 0; + break; + + case EFFLASTDAY_ACTION_2: + if (!this->actor.home.rot.z) { + this->actor.home.rot.z = true; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_COMING_FIRE); + } + this->actor.draw = EffLastday_Draw; + if (this->alpha < 255) { + this->alpha += 5; + } + if (this->alpha > 255) { + this->alpha = 255; + } + this->step++; + break; + + case EFFLASTDAY_ACTION_3: + + this->actor.draw = EffLastday_Draw; + break; + } + } else { + this->actor.draw = NULL; + } +} + +void EffLastday_Update(Actor* thisx, PlayState* play) { + EffLastday* this = THIS; + + this->actionFunc(this, play); +} + +void EffLastday_SetVtxAlpha(s16 alpha) { + Vtx* vtx = Lib_SegmentedToVirtual(object_lastday_Vtx_000000); + + vtx[0].v.cn[3] = alpha; + vtx[3].v.cn[3] = alpha; + vtx[4].v.cn[3] = alpha; + vtx[5].v.cn[3] = alpha; +} + +void EffLastday_Draw(Actor* thisx, PlayState* play) { + EffLastday* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + switch (EFFLASTDAY_GET_F(thisx)) { + case EFFLASTDAY_PARAMS_1: + case EFFLASTDAY_PARAMS_2: + break; + case EFFLASTDAY_PARAMS_3: + EffLastday_SetVtxAlpha(this->alpha); + break; + default: + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->alpha); + break; + } + AnimatedMat_DrawAlphaStep(play, this->matAnim, 1.0f, this->step); + Gfx_DrawDListXlu(play, this->dList); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h index 0647b0a50..d1f81a184 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h @@ -3,16 +3,29 @@ #include "global.h" +#define EFFLASTDAY_GET_F(thisx) ((thisx)->params & 0xF) + struct EffLastday; typedef void (*EffLastdayActionFunc)(struct EffLastday*, PlayState*); typedef struct EffLastday { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x10]; + /* 0x144 */ Gfx* dList; + /* 0x148 */ AnimatedMaterial* matAnim; + /* 0x14C */ s16 step; + /* 0x14E */ s16 alpha; + /* 0x150 */ s16 csActionCmd; /* 0x154 */ EffLastdayActionFunc actionFunc; } EffLastday; // size = 0x158 +typedef enum EffLastDayParams { + /* 0x0 */ EFFLASTDAY_PARAMS_0, + /* 0x1 */ EFFLASTDAY_PARAMS_1, + /* 0x2 */ EFFLASTDAY_PARAMS_2, + /* 0x3 */ EFFLASTDAY_PARAMS_3 +} EffLastDayParams; + extern const ActorInit Eff_Lastday_InitVars; #endif // Z_EFF_LASTDAY_H diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index fae0025d2..bfc6d197b 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -376,7 +376,7 @@ s32 func_80BD3320(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) { return ret; } -s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3EC4.pos); @@ -388,7 +388,7 @@ s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3ED8.pos); @@ -400,7 +400,7 @@ s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80BD3320(this, play, ACTORCAT_NPC, ACTOR_EN_AN)) { @@ -419,26 +419,26 @@ s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; this->unk_2D8 = 0; - switch (arg2->result) { + switch (scheduleOutput->result) { default: ret = false; break; case 1: - ret = func_80BD3374(this, play, arg2); + ret = func_80BD3374(this, play, scheduleOutput); break; case 2: - ret = func_80BD33FC(this, play, arg2); + ret = func_80BD33FC(this, play, scheduleOutput); break; case 3: - ret = func_80BD3484(this, play, arg2); + ret = func_80BD3484(this, play, scheduleOutput); break; } return ret; @@ -472,7 +472,7 @@ void func_80BD3658(EnAh* this, PlayState* play) { } void func_80BD36B8(EnAh* this, PlayState* play) { - ScheduleResult sp18; + ScheduleOutput sp18; if (!Schedule_RunScript(play, D_80BD3DB0, &sp18) || ((this->unk_1DC != sp18.result) && !func_80BD3548(this, play, &sp18))) { diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index e02bcbea1..faf39aece 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -426,7 +426,7 @@ void func_80BED3BC(EnAkindonuts* this, PlayState* play) { this->unk_32C &= ~0x1; this->unk_32C |= 0x40; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -509,7 +509,7 @@ void func_80BED680(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -604,7 +604,7 @@ void func_80BED8A4(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -687,7 +687,7 @@ void func_80BEDB88(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -777,7 +777,7 @@ void func_80BEDDAC(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -855,7 +855,7 @@ void func_80BEE070(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x161A; this->actionFunc = func_80BEF360; return; @@ -938,7 +938,7 @@ void func_80BEE274(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x1629; this->actionFunc = func_80BEF360; return; @@ -1016,7 +1016,7 @@ void func_80BEE530(EnAkindonuts* this, PlayState* play) { this->unk_32C |= 0x40; this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0x15EF; this->actionFunc = func_80BEF360; return; @@ -1240,14 +1240,14 @@ void func_80BEEE10(EnAkindonuts* this, PlayState* play) { } void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_32C & 1) { this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0; this->actionFunc = func_80BEEE10; } else if (this->unk_32C & 0x20) { @@ -1255,7 +1255,7 @@ void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_32C &= ~0x4; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_338 = 8; this->unk_33C = 0; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); @@ -1264,7 +1264,7 @@ void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { this->unk_2DC(this, play); } } - } else if (temp_v0 == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1279,22 +1279,22 @@ void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { break; } } - } else if (temp_v0 == 16) { + } else if (talkState == TEXT_STATE_16) { func_80BEE73C(this, play); } } void func_80BEF18C(EnAkindonuts* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_33C = 0; this->actionFunc = func_80BEEE10; } } void func_80BEF20C(EnAkindonuts* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 sp24 = this->skelAnime.curFrame; s16 sp22 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); @@ -1310,11 +1310,11 @@ void func_80BEF20C(EnAkindonuts* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 6); } - if ((sp27 == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_32C & 1) { this->unk_32C &= ~0x1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80BEF360; } else { this->unk_2DC(this, play); @@ -1341,7 +1341,7 @@ void func_80BEF360(EnAkindonuts* this, PlayState* play) { } void func_80BEF450(EnAkindonuts* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { func_800B85E0(&this->actor, play, 400.0f, -1); this->actionFunc = func_80BEF4B8; } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index ca5138971..c3b893a5d 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -129,8 +129,9 @@ static AnimationInfoS sAnimations[] = { Vec3f D_80BE0070 = { 1000.0f, 0.0f, 0.0f }; Gfx* D_80BE007C[] = { - object_al_DL_006598, object_al_DL_005920, object_al_DL_005878, - object_al_DL_0057D0, object_al_DL_005728, object_al_DL_005680, + gMadameAromaShawlMiddleDL, gMadameAromaShawlUpperDL, + gMadameAromaShawlLeftLowerMiddleDL, gMadameAromaShawlLeftLowerDL, + gMadameAromaShawlRightLowerMiddleDL, gMadameAromaShawlRightLowerDL, }; Actor* func_80BDE1A0(EnAl* this, PlayState* play, u8 arg0, s16 arg1) { @@ -331,7 +332,7 @@ s32 func_80BDE7FC(EnAl* this, PlayState* play) { case 6: case 8: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); } this->unk_4E6++; sp20 = true; @@ -341,7 +342,7 @@ s32 func_80BDE7FC(EnAl* this, PlayState* play) { case 3: case 5: case 7: - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); this->unk_4E6++; sp20 = true; break; @@ -634,7 +635,7 @@ s32 func_80BDF064(EnAl* this, PlayState* play) { return false; } -s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; Actor* sp20 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); @@ -649,10 +650,10 @@ s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { SubS_UpdateFlags(&this->unk_4C2, 3, 7); - switch (arg2->result) { + switch (scheduleOutput->result) { case 1: func_80BDE27C(this, 0); break; @@ -666,7 +667,7 @@ s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; this->actor.flags |= ACTOR_FLAG_1; @@ -675,14 +676,14 @@ s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleResult* arg2) { this->unk_4C2 = 0; this->unk_4D4 = 40.0f; - switch (arg2->result) { + switch (scheduleOutput->result) { case 3: - ret = func_80BDF244(this, play, arg2); + ret = func_80BDF244(this, play, scheduleOutput); break; case 1: case 2: - ret = func_80BDF308(this, play, arg2); + ret = func_80BDF308(this, play, scheduleOutput); break; default: @@ -745,7 +746,7 @@ void func_80BDF578(EnAl* this, PlayState* play) { } void func_80BDF5E8(EnAl* this, PlayState* play) { - ScheduleResult sp20; + ScheduleOutput sp20; this->unk_4E0 = REG(15) + ((void)0, gSaveContext.save.daySpeed); if (!Schedule_RunScript(play, D_80BDFC70, &sp20) || @@ -780,7 +781,8 @@ void EnAl_Init(Actor* thisx, PlayState* play) { EnAl* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_al_Skel_00A0D8, NULL, this->jointTable, this->morphTable, 27); + SkelAnime_InitFlex(play, &this->skelAnime, &gMadameAromaSkel, NULL, this->jointTable, this->morphTable, + MADAME_AROMA_LIMB_MAX); this->unk_4F8 = -1; func_80BDE27C(this, 1); Collider_InitAndSetCylinder(play, &this->unk_310, &this->actor, &sCylinderInit); @@ -817,16 +819,16 @@ void EnAl_Update(Actor* thisx, PlayState* play) { s32 EnAl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { switch (limbIndex) { - case 3: - case 11: - case 12: - case 13: - case 14: - case 15: + case MADAME_AROMA_LIMB_SHAWL_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_UPPER: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER_MIDDLE: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER: *dList = NULL; break; - case 16: + case MADAME_AROMA_LIMB_HEAD: break; } return false; @@ -836,31 +838,31 @@ void EnAl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnAl* this = THIS; switch (limbIndex) { - case 3: + case MADAME_AROMA_LIMB_SHAWL_MIDDLE: Matrix_Get(&this->unk_190[0]); break; - case 11: + case MADAME_AROMA_LIMB_SHAWL_UPPER: Matrix_Get(&this->unk_190[1]); break; - case 12: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER_MIDDLE: Matrix_Get(&this->unk_190[2]); break; - case 13: + case MADAME_AROMA_LIMB_SHAWL_LEFT_LOWER: Matrix_Get(&this->unk_190[3]); break; - case 14: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER_MIDDLE: Matrix_Get(&this->unk_190[4]); break; - case 15: + case MADAME_AROMA_LIMB_SHAWL_RIGHT_LOWER: Matrix_Get(&this->unk_190[5]); break; - case 16: + case MADAME_AROMA_LIMB_HEAD: Matrix_MultVec3f(&D_80BE0070, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); break; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 3af30fbb3..c1cb31614 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -175,7 +175,7 @@ void EnAni_IdleStanding(EnAni* this, PlayState* play) { void EnAni_Talk(EnAni* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&play->msgCtx) == 2 && play->msgCtx.currentTextId == 0x6DE) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) && play->msgCtx.currentTextId == 0x6DE) { this->actionFunc = EnAni_IdleInPain; } } @@ -308,7 +308,7 @@ void EnAni_Update(Actor* thisx, PlayState* play) { } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->actor.cutscene)), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->actor.cutscene)), &this->actor); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index c1ca6d349..3b825641c 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -118,17 +118,17 @@ void func_809C1158(EnAob01* this, PlayState* play) { } void func_809C11EC(EnAob01* this, PlayState* play) { - s32 unk; + s32 enDgParams; s16 i; func_809C1158(this, play); for (i = 0; i < ARRAY_COUNT(D_809C384C); i++) { - unk = (this->unk_1D8[D_809C384C[i].unk_06]->unk1 << 0xA) | (i << 5); + enDgParams = ENDG_PARAMS(this->unk_1D8[D_809C384C[i].unk_06]->unk1, i); this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_DG, D_809C384C[i].unk_00.x, D_809C384C[i].unk_00.y, D_809C384C[i].unk_00.z, - 0, D_809C384C[i].unk_04 * 182.04445f, 0, unk, 0xFFFF, this->actor.unk20, NULL); + 0, D_809C384C[i].unk_04 * 182.04445f, 0, enDgParams, 0xFFFF, this->actor.unk20, NULL); } } @@ -394,7 +394,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { Rupees_ChangeBy(-this->unk_434); func_800B7298(play, NULL, 7); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_809C1C9C; return; } @@ -417,18 +417,18 @@ void func_809C1C9C(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; func_800FD750(0x40); play->nextEntranceIndex = 0x7C10; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 2; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 7) | (this->unk_432 * 8); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } } void func_809C1D64(EnAob01* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 4) { + if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -453,9 +453,9 @@ void func_809C1D64(EnAob01* this, PlayState* play) { break; } } - } else if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_210 = 0; this->actionFunc = func_809C2060; } @@ -521,7 +521,7 @@ void func_809C2060(EnAob01* this, PlayState* play) { } void func_809C21E0(EnAob01* this, PlayState* play) { - u8 sp2F = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 4000, 1); @@ -561,7 +561,7 @@ void func_809C21E0(EnAob01* this, PlayState* play) { } this->unk_2D2 &= ~8; } - } else if (sp2F == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; switch (play->msgCtx.choiceIndex) { @@ -577,19 +577,19 @@ void func_809C21E0(EnAob01* this, PlayState* play) { break; } } - } else if (sp2F == 5) { + } else if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; if (this->unk_2D2 & 0x10) { this->unk_2D2 &= ~0x10; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_809C2060; } else { func_809C16DC(this, play); } } - } else if ((sp2F == 14) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_14) && Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; this->unk_434 = play->msgCtx.bankRupeesSelected; func_809C16DC(this, play); @@ -674,9 +674,9 @@ void func_809C2788(EnAob01* this, PlayState* play) { if (func_801A8A50(0) != 0x41) { play->nextEntranceIndex = 0x7C10; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 3; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; } } } @@ -746,13 +746,13 @@ void func_809C28B8(EnAob01* this, PlayState* play) { } void func_809C2A64(EnAob01* this, PlayState* play) { - u8 sp2F = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); if (func_809C15BC(this)) { - if ((sp2F == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->unk_434 = 0; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; } if (Actor_HasParent(&this->actor, play)) { @@ -776,9 +776,9 @@ void func_809C2A64(EnAob01* this, PlayState* play) { } void func_809C2BE4(EnAob01* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { if (gSaveContext.save.weekEventReg[63] & 2) { gSaveContext.save.weekEventReg[63] &= (u8)~2; } @@ -805,7 +805,7 @@ void func_809C2C9C(EnAob01* this, PlayState* play) { } void func_809C2D0C(EnAob01* this, PlayState* play) { - u8 sp2F = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 4000, 1); @@ -819,7 +819,7 @@ void func_809C2D0C(EnAob01* this, PlayState* play) { } } - if ((sp2F == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->unk_2D2 &= ~0x40; this->unk_2D2 &= ~0x80; if (this->unk_434 >= 150) { 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 a55f90c46..b720c14d8 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -135,7 +135,7 @@ void EnArrow_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyQuad(play, &this->collider); if ((this->unk_264 != NULL) && (this->unk_264->update != NULL)) { - this->unk_264->flags &= ~0x8000; + this->unk_264->flags &= ~ACTOR_FLAG_8000; } if ((this->actor.params >= ENARROW_3) && (this->actor.params < ENARROW_6) && (this->actor.child == NULL)) { @@ -496,14 +496,14 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { this->unk_264->world.pos.z = ((sp54.z <= sp9C.z) ? 1.0f : -1.0f) + sp9C.z; Math_Vec3f_Diff(&this->unk_264->world.pos, &this->actor.world.pos, &this->unk_268); - this->unk_264->flags &= ~0x8000; + this->unk_264->flags &= ~ACTOR_FLAG_8000; this->unk_264 = NULL; } else { Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_268, &this->unk_264->world.pos); } if ((this->unk_262 != 0) && (this->unk_264 != NULL)) { - this->unk_264->flags &= ~0x8000; + this->unk_264->flags &= ~ACTOR_FLAG_8000; this->unk_264 = NULL; } } else { @@ -588,7 +588,7 @@ void func_8088B88C(PlayState* play, EnArrow* this, EnArrowUnkStruct* arg2) { Matrix_MultVec3f(&sp4C[1], &sp34); if (this->actor.params < ENARROW_8) { sp30 = this->actor.params < ENARROW_6; - if (this->unk_264 == 0) { + if (this->unk_264 == NULL) { sp30 &= func_80126440(play, &this->collider, &this->unk_244, &sp40, &sp34); } else if (sp30 && (sp40.x == this->unk_244.tip.x) && (sp40.y == this->unk_244.tip.y) && (sp40.z == this->unk_244.tip.z) && (sp34.x == this->unk_244.base.x) && diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 2de9d2a1c..b96fb35c0 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -5,29 +5,50 @@ */ #include "z_en_baba.h" -#include "overlays/actors/ovl_En_Ossan/z_en_ossan.h" -#include "objects/object_bba/object_bba.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) #define THIS ((EnBaba*)thisx) +#define BOMB_SHOP_LADY_STATE_END_CONVERSATION (1 << 0) +#define BOMB_SHOP_LADY_STATE_VISIBLE (1 << 1) +#define BOMB_SHOP_LADY_STATE_KNOCKED_OVER (1 << 2) // Don't track player +#define BOMB_SHOP_LADY_STATE_AUTOTALK (1 << 3) +#define BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK (1 << 5) +#define BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK (1 << 6) +#define BOMB_SHOP_LADY_STATE_DRAW_SHADOW (1 << 7) + void EnBaba_Init(Actor* thisx, PlayState* play); void EnBaba_Destroy(Actor* thisx, PlayState* play); void EnBaba_Update(Actor* thisx, PlayState* play); void EnBaba_Draw(Actor* thisx, PlayState* play); -void func_80BA9480(EnBaba* this, PlayState* play); -void func_80BA9758(EnBaba* this, PlayState* play); -void func_80BA9848(EnBaba* this, PlayState* play); -void func_80BA98EC(EnBaba* this, PlayState* play); -void func_80BA9AB8(EnBaba* this, PlayState* play); -void func_80BA9B24(EnBaba* this, PlayState* play); -void func_80BA9B80(EnBaba* this, PlayState* play); -void func_80BA9CD4(EnBaba* this, PlayState* play); -void func_80BA9E00(EnBaba* this, PlayState* play); -void func_80BA9E10(EnBaba* this, PlayState* play); -void func_80BA9E48(EnBaba* this, PlayState* play); +void EnBaba_FinishInit(EnBaba* this, PlayState* play); +void EnBaba_Idle(EnBaba* this, PlayState* play); +void EnBaba_FollowSchedule_Talk(EnBaba* this, PlayState* play); +void EnBaba_Talk(EnBaba* this, PlayState* play); +void EnBaba_GiveBlastMask(EnBaba* this, PlayState* play); +void EnBaba_GaveBlastMask(EnBaba* this, PlayState* play); +void EnBaba_FollowSchedule(EnBaba* this, PlayState* play); +void EnBaba_KnockedOver(EnBaba* this, PlayState* play); +void EnBaba_DoNothing(EnBaba* this, PlayState* play); +void EnBaba_Walk(EnBaba* this, PlayState* play); +void EnBaba_FaceForward(EnBaba* this, PlayState* play); + +typedef enum { + /* 0 */ BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG, + /* 1 */ BOMB_SHOP_LADY_ANIM_IDLE, + /* 2 */ BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG, + /* 3 */ BOMB_SHOP_LADY_ANIM_KNOCKED_OVER, + /* 4 */ BOMB_SHOP_LADY_ANIM_LYING_DOWN, + /* 5 */ BOMB_SHOP_LADY_ANIM_SWAY +} BombShopLadyAnimation; + +typedef enum { + /* 0 */ BOMB_SHOP_LADY_SCH_NONE, + /* 1 */ BOMB_SHOP_LADY_SCH_KNOCKED_OVER, + /* 2 */ BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH +} BombShopLadyScheduleResult; const ActorInit En_Baba_InitVars = { ACTOR_EN_BABA, @@ -47,7 +68,7 @@ static AnimationInfo sAnimations[] = { { &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &gBbaKnockedOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, { &gBbaLyingDownAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gBbaWalkingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, }; static ColliderCylinderInit sCylinderInit = { @@ -107,19 +128,19 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static u8 D_80BAA488[] = { +static u8 sSchedule[] = { /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(1, 0x1D - 0x04), /* 0x04 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_BACKTOWN, 0x1C - 0x08), /* 0x08 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 0, 0, 30, 0x16 - 0x0E), /* 0x0E */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(0, 30, 0x15 - 0x12), - /* 0x12 */ SCHEDULE_CMD_RET_VAL_L(1), + /* 0x12 */ SCHEDULE_CMD_RET_VAL_L(BOMB_SHOP_LADY_SCH_KNOCKED_OVER), /* 0x15 */ SCHEDULE_CMD_RET_NONE(), - /* 0x16 */ SCHEDULE_CMD_RET_TIME(0, 0, 0, 30, 2), + /* 0x16 */ SCHEDULE_CMD_RET_TIME(0, 0, 0, 30, BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH), /* 0x1C */ SCHEDULE_CMD_RET_NONE(), /* 0x1D */ SCHEDULE_CMD_RET_NONE(), }; -s32 D_80BAA4A8[] = { -1, -1, 0 }; +static s32 sSearchTimePathLimit[] = { -1, -1, 0 }; static TrackOptionsSet sTrackOptions = { { 0xFA0, 4, 1, 3 }, @@ -128,142 +149,164 @@ static TrackOptionsSet sTrackOptions = { { 0x1770, 4, 1, 6 }, }; -s32 func_80BA8820(EnBaba* this, PlayState* play) { - this->unk_144 = (EnOssan*)SubS_FindActor(play, &this->unk_144->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN); +s32 EnBaba_FindBombShopkeeper(EnBaba* this, PlayState* play) { + //! The bomb shopkeeper is an EnSob1, but initalizes itself with id `ACTOR_EN_OSSAN` + //! Note if there are other `EnOssan` actors, it may find that instance instead + //! in which case `EnSob1` struct acceses would be incorrect + this->bombShopkeeper = (EnSob1*)SubS_FindActor(play, &this->bombShopkeeper->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN); - if (this->unk_144 != NULL) { + if (this->bombShopkeeper != NULL) { return true; } return false; } -void func_80BA886C(EnBaba* this, PlayState* play) { +void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { Player* player = GET_PLAYER(play); - switch (this->unk_1E0) { + switch (this->textId) { case 0: - if (this->unk_40A & 8) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { if (gSaveContext.save.weekEventReg[33] & 8) { - this->unk_1E0 = 0x2A34; + // Thanks. Can stock Bomb Bags tomorrow + this->textId = 0x2A34; break; } if (gSaveContext.save.weekEventReg[79] & 0x40) { - this->unk_40A |= 1; - this->unk_1E0 = 0x2A33; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // Oh my, learned my lesson. Can't stock Bomb Bags tomorrow + this->textId = 0x2A33; break; } - this->unk_40A |= 1; - this->unk_1E0 = 0x2A32; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // Can't stock Bomb Bags tomorrow + this->textId = 0x2A32; break; } else if (player->transformation == PLAYER_FORM_DEKU) { if (!(gSaveContext.save.weekEventReg[79] & 0x20)) { gSaveContext.save.weekEventReg[79] |= 0x20; - this->unk_40A |= 1; - this->unk_1E0 = 0x2A37; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // Small customer, use bombs as adult + this->textId = 0x2A37; break; } else { - this->unk_40A |= 1; - this->unk_1E0 = 0x2A38; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // use bombs as adult + this->textId = 0x2A38; } break; } else if (!(gSaveContext.save.weekEventReg[33] & 8)) { if (!(gSaveContext.save.weekEventReg[73] & 1)) { - this->unk_1E0 = 0x660; + // Thought could sell Big Bomb Bags + this->textId = 0x660; break; } - this->unk_1E0 = 0x662; + // Can't judge people + this->textId = 0x662; break; } else { if (!(gSaveContext.save.weekEventReg[73] & 2)) { - this->unk_1E0 = 0x65A; + // Someone helped me out + this->textId = 0x65A; break; } - this->unk_1E0 = 0x65E; + // Buy Big Bomb Bag + this->textId = 0x65E; break; } break; case 0x660: - Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); - this->unk_1E0 = 0x661; + Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); + // Don't go by yourself + this->textId = 0x661; break; case 0x661: - Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor); - this->unk_1E0 = 0x662; + Actor_ChangeFocus(&this->bombShopkeeper->actor, play, &this->actor); + // Can't judge people + this->textId = 0x662; break; case 0x662: - Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); - this->unk_1E0 = 0x663; + Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); + // I'll go next time + this->textId = 0x663; gSaveContext.save.weekEventReg[73] |= 1; - this->unk_40A |= 1; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; case 0x65A: - Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); - this->unk_1E0 = 0x65B; + Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); + // Don't pick up Bomb bags at night + this->textId = 0x65B; break; case 0x65B: - Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor); - this->unk_1E0 = 0x65C; + Actor_ChangeFocus(&this->bombShopkeeper->actor, play, &this->actor); + // Lifelong dream to sell Big Bomb Bags + this->textId = 0x65C; break; case 0x65C: - Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); - this->unk_1E0 = 0x65D; + Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); + // I worry about you + this->textId = 0x65D; gSaveContext.save.weekEventReg[73] |= 2; - this->unk_40A |= 1; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; case 0x65E: - Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor); - this->unk_1E0 = 0x65F; - this->unk_40A |= 1; + Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor); + // I worry about you + this->textId = 0x65F; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; case 0x2A34: if (INV_CONTENT(ITEM_MASK_BLAST) == ITEM_MASK_BLAST) { - this->unk_40A |= 1; - this->unk_1E0 = 0x2A36; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // Thank you + this->textId = 0x2A36; break; } - this->unk_40A |= 0x20; - this->unk_1E0 = 0x2A35; + this->stateFlags |= BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK; + // It's a dangerous mask + this->textId = 0x2A35; break; case 0x2A35: - this->unk_40A |= 1; - this->unk_1E0 = 0x2A36; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; + // Thank you + this->textId = 0x2A36; break; case 0x2A30: case 0x2A31: - this->unk_40A |= 1; + this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; } - Message_StartTextbox(play, this->unk_1E0, &this->actor); - if (this->unk_40A & 1) { - if (this->unk_40A & 0x40) { - this->unk_40A &= ~0x40; + Message_StartTextbox(play, this->textId, &this->actor); + if (this->stateFlags & BOMB_SHOP_LADY_STATE_END_CONVERSATION) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK) { + this->stateFlags &= ~BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK; func_80151BB4(play, 0x33); } func_80151BB4(play, 4); } } -void func_80BA8C4C(PlayState* play, u16 nextEntrance) { +void EnBaba_TriggerTransition(PlayState* play, u16 nextEntrance) { play->nextEntranceIndex = nextEntrance; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; + play->transitionTrigger = TRANS_TRIGGER_START; } -void func_80BA8C90(EnBaba* this, PlayState* play) { +void EnBaba_UpdateCollider(EnBaba* this, PlayState* play) { this->collider.dim.pos.x = this->actor.world.pos.x + 5.0f; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z + 22.0f; @@ -272,30 +315,31 @@ void func_80BA8C90(EnBaba* this, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80BA8D2C(EnBaba* this, f32 arg1) { - s16 sp3E; - s32 ret = false; - Vec3f sp2C; +s32 EnBaba_MoveForward(EnBaba* this, f32 speedTarget) { + s16 rotStep; + s32 reachedEnd = false; + Vec3f point; - Math_SmoothStepToF(&this->actor.speedXZ, arg1, 0.4f, 1000.0f, 0.0f); - sp3E = this->actor.speedXZ * 400.0f; - if (SubS_CopyPointFromPath(this->path, this->unk_1E8, &sp2C) && SubS_MoveActorToPoint(&this->actor, &sp2C, sp3E)) { - this->unk_1E8++; - if (this->unk_1E8 >= this->path->count) { - ret = true; + Math_SmoothStepToF(&this->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f); + rotStep = this->actor.speedXZ * 400.0f; + if (SubS_CopyPointFromPath(this->path, this->waypoint, &point) && + SubS_MoveActorToPoint(&this->actor, &point, rotStep)) { + this->waypoint++; + if (this->waypoint >= this->path->count) { + reachedEnd = true; } } - return ret; + return reachedEnd; } -void func_80BA8DF4(EnBaba* this, PlayState* play) { +void EnBaba_UpdateModel(EnBaba* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f point; SkelAnime_Update(&this->skelAnime); if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) && - !(this->unk_40A & 4)) { + !(this->stateFlags & BOMB_SHOP_LADY_STATE_KNOCKED_OVER)) { point.x = player->actor.world.pos.x; point.y = player->bodyPartsPos[7].y + 3.0f; point.z = player->actor.world.pos.z; @@ -311,214 +355,223 @@ void func_80BA8DF4(EnBaba* this, PlayState* play) { Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); } - SubS_FillLimbRotTables(play, this->unk_302, this->unk_326, ARRAY_COUNT(this->unk_302)); + SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY)); - if (this->unk_40A & 2) { - func_80BA8C90(this, play); + if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) { + EnBaba_UpdateCollider(this, play); } } -s32 func_80BA8F88(EnBaba* this, PlayState* play, ScheduleResult* arg2) { - u16 sp26 = SCHEDULE_TIME_NOW; - u16 temp; - u8 sp23 = ENBABA_GET_3F00(&this->actor); +s32 EnBaba_InitTimePath(EnBaba* this, PlayState* play, ScheduleOutput* scheduleOutput) { + u16 now = SCHEDULE_TIME_NOW; + u16 startTime; + u8 pathIndex = BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor); + u16 numWaypoints; - if (D_80BAA4A8[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAA4A8[arg2->result]); + if (sSearchTimePathLimit[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, pathIndex, sSearchTimePathLimit[scheduleOutput->result]); } if (this->timePath == NULL) { return false; } - if ((this->unk_434 != 0) && (this->timePathTimeSpeed >= 0)) { - temp = sp26; + if ((this->scheduleResult != BOMB_SHOP_LADY_SCH_NONE) && (this->timePathTimeSpeed >= 0)) { + startTime = now; } else { - temp = arg2->time0; + startTime = scheduleOutput->time0; } - if (arg2->time1 < temp) { - this->timePathTotalTime = (temp - arg2->time1) + 0xFFFF; + if (scheduleOutput->time1 < startTime) { + this->timePathTotalTime = (startTime - scheduleOutput->time1) + (DAY_LENGTH - 1); } else { - this->timePathTotalTime = arg2->time1 - temp; + this->timePathTotalTime = scheduleOutput->time1 - startTime; } - this->timePathElapsedTime = sp26 - temp; - temp = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); - this->timePathWaypointTime = this->timePathTotalTime / temp; - this->unk_438 = 0; + this->timePathElapsedTime = now - startTime; + + numWaypoints = startTime = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + this->timePathWaypointTime = this->timePathTotalTime / numWaypoints; + + this->timePathIsSetup = false; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); - this->unk_43C = 0; + this->timePathHasReachedEnd = false; + return true; } -s32 func_80BA9110(EnBaba* this, PlayState* play, ScheduleResult* arg2) { - s32 ret; +s32 EnBaba_ProcessScheduleOutput(EnBaba* this, PlayState* play, ScheduleOutput* scheduleOutput) { + s32 success; - switch (arg2->result) { + switch (scheduleOutput->result) { default: - ret = false; + success = false; break; - case 2: - ret = func_80BA8F88(this, play, arg2); + case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH: + success = EnBaba_InitTimePath(this, play, scheduleOutput); break; - case 1: - ret = true; + case BOMB_SHOP_LADY_SCH_KNOCKED_OVER: + success = true; break; } - return ret; + return success; } -s32 func_80BA9160(EnBaba* this, PlayState* play) { - f32 knots[265]; - Vec3f sp70; - Vec3f sp64; - Vec3f timePathTargetPos; - s32 sp54 = 0; - s32 sp50 = 0; +s32 EnBaba_FollowTimePath(EnBaba* this, PlayState* play) { + f32 weightArray[265]; + Vec3f worldPos; + Vec3f timePathPointNew; // used to compute yaw after update + Vec3f timePathPoint; // used in setup and to store a backup before update + s32 prevTimePathElapsedTime = 0; + s32 prevTimePathWaypoint = 0; s32 pad; - SubS_TimePathing_FillKnots(knots, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER); + SubS_TimePathing_FillKnots(weightArray, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER); - if (this->unk_438 == 0) { - timePathTargetPos = gZeroVec3f; + if (!this->timePathIsSetup) { + timePathPoint = gZeroVec3f; SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, - this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, - &timePathTargetPos, this->timePathTimeSpeed); - SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos); - this->actor.world.pos.y = timePathTargetPos.y; - this->unk_438 = 1; + this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, + weightArray, &timePathPoint, this->timePathTimeSpeed); + SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathPoint); + this->actor.world.pos.y = timePathPoint.y; + this->timePathIsSetup = true; } else { - timePathTargetPos = this->timePathTargetPos; + timePathPoint = this->timePathPoint; } - this->actor.world.pos.x = timePathTargetPos.x; - this->actor.world.pos.z = timePathTargetPos.z; + this->actor.world.pos.x = timePathPoint.x; + this->actor.world.pos.z = timePathPoint.z; if (SubS_InCsMode(play)) { - sp54 = this->timePathElapsedTime; - sp50 = this->timePathWaypoint; - timePathTargetPos = this->actor.world.pos; + prevTimePathElapsedTime = this->timePathElapsedTime; + prevTimePathWaypoint = this->timePathWaypoint; + timePathPoint = this->actor.world.pos; } - this->timePathTargetPos = gZeroVec3f; + this->timePathPoint = gZeroVec3f; if (SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime, - this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots, - &this->timePathTargetPos, this->timePathTimeSpeed)) { - this->unk_43C = 1; + this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, + weightArray, &this->timePathPoint, this->timePathTimeSpeed)) { + this->timePathHasReachedEnd = true; } else { - sp70 = this->actor.world.pos; - sp64 = this->timePathTargetPos; - this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); + worldPos = this->actor.world.pos; + timePathPointNew = this->timePathPoint; + this->actor.world.rot.y = Math_Vec3f_Yaw(&worldPos, &timePathPointNew); } if (SubS_InCsMode(play)) { - this->timePathElapsedTime = sp54; - this->timePathWaypoint = sp50; - this->timePathTargetPos = timePathTargetPos; + this->timePathElapsedTime = prevTimePathElapsedTime; + this->timePathWaypoint = prevTimePathWaypoint; + this->timePathPoint = timePathPoint; } return false; } -void func_80BA93AC(EnBaba* this, PlayState* play) { - if (this->unk_434 != 1) { - if (this->unk_434 == 2) { +void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) { + switch (this->scheduleResult) { + case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH: gSaveContext.save.weekEventReg[58] |= 0x40; - this->unk_40A |= 2; - func_80BA9160(this, play); - } - } else { - this->unk_40C = 3; - this->unk_1E0 = 10800; - this->actor.speedXZ = 0.0f; - Enemy_StartFinishingBlow(play, &this->actor); - this->unk_40A |= 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_40C); - this->actionFunc = func_80BA9CD4; + this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; + EnBaba_FollowTimePath(this, play); + break; + + case BOMB_SHOP_LADY_SCH_KNOCKED_OVER: + this->animIndex = BOMB_SHOP_LADY_ANIM_KNOCKED_OVER; + // Ouch + this->textId = 0x2A30; + this->actor.speedXZ = 0.0f; + Enemy_StartFinishingBlow(play, &this->actor); + this->stateFlags |= BOMB_SHOP_LADY_STATE_KNOCKED_OVER; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_KnockedOver; + break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } -void func_80BA9480(EnBaba* this, PlayState* play) { +void EnBaba_FinishInit(EnBaba* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gBbaSkel, &gBbaWalkingHoldingBagAnim, this->jointTable, - this->morphTable, 0x12); + this->morphTable, BBA_LIMB_MAX); this->actor.draw = EnBaba_Draw; - this->unk_40A |= 0x80; + this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW; this->actor.flags |= ACTOR_FLAG_1; if (play->sceneNum == SCENE_BOMYA) { - this->unk_40A |= 2; - this->unk_40C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); - this->actionFunc = func_80BA9758; + this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; + this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_Idle; } else if (play->sceneNum == SCENE_BACKTOWN) { - if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_0) && (gSaveContext.save.entranceIndex != 0xD670) && - ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F)) { + if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) && + (gSaveContext.save.entranceIndex != 0xD670) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) { if ((gSaveContext.save.weekEventReg[58] & 0x40) || - (!(gSaveContext.save.time < CLOCK_TIME(0, 20)) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { + (gSaveContext.save.time >= CLOCK_TIME(0, 20) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { Actor_MarkForDeath(&this->actor); return; } - this->unk_404 = 50; - this->unk_40C = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_80BA9B80; - } else if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_1) && (gSaveContext.save.entranceIndex == 0xD670)) { + this->sakonDeadTimer = 50; + this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_FollowSchedule; + } else if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_IDLE) && + (gSaveContext.save.entranceIndex == 0xD670)) { if (gSaveContext.save.weekEventReg[81] & 2) { Actor_MarkForDeath(&this->actor); return; } - this->unk_40A |= 2; + this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; if (gSaveContext.save.weekEventReg[33] & 8) { - this->unk_40C = 0; + this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG; } else { - this->unk_40C = 1; + this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_40C); - this->unk_40A |= 8; - this->actionFunc = func_80BA9758; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->stateFlags |= BOMB_SHOP_LADY_STATE_AUTOTALK; + this->actionFunc = EnBaba_Idle; } else { Actor_MarkForDeath(&this->actor); return; } } else { - this->unk_40A |= 2; - if (ENBABA_GET_C000(&this->actor) == ENBABA_C000_2) { + this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; + if (BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_SWAY) { this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_40C = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); - this->actionFunc = func_80BA9E00; - } else if ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F) { - this->unk_40C = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_80BA9E10; + this->animIndex = BOMB_SHOP_LADY_ANIM_SWAY; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_DoNothing; + } else if (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F) { + this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_Walk; } else { - this->unk_40C = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); - this->actionFunc = func_80BA9E48; + this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + this->actionFunc = EnBaba_FaceForward; } } } -void func_80BA9758(EnBaba* this, PlayState* play) { - if ((this->unk_40A & 8) || (this->unk_144 != NULL) || func_80BA8820(this, play)) { +void EnBaba_Idle(EnBaba* this, PlayState* play) { + if ((this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) || (this->bombShopkeeper != NULL) || + EnBaba_FindBombShopkeeper(this, play)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80BA886C(this, play); - if (this->unk_40A & 8) { + EnBaba_HandleConversation(this, play); + if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { this->actor.flags &= ~ACTOR_FLAG_10000; } - this->actionFunc = func_80BA98EC; + this->actionFunc = EnBaba_Talk; } else if (this->actor.xzDistToPlayer < 100.0f) { - if (this->unk_40A & 8) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { this->actor.flags |= ACTOR_FLAG_10000; } func_800B8614(&this->actor, play, 100.0f); @@ -526,99 +579,100 @@ void func_80BA9758(EnBaba* this, PlayState* play) { } } -void func_80BA9848(EnBaba* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); +void EnBaba_FollowSchedule_Talk(EnBaba* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; - this->actionFunc = func_80BA9B80; + play->msgCtx.stateTimer = 4; + this->actionFunc = EnBaba_FollowSchedule; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); } -void func_80BA98EC(EnBaba* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); +void EnBaba_Talk(EnBaba* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { - if (this->unk_40A & 1) { - this->unk_40A &= ~1; + if (this->stateFlags & BOMB_SHOP_LADY_STATE_END_CONVERSATION) { + this->stateFlags &= ~BOMB_SHOP_LADY_STATE_END_CONVERSATION; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; - if (this->unk_40A & 8) { + play->msgCtx.stateTimer = 4; + if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(play, 0xD670); + EnBaba_TriggerTransition(play, 0xD670); return; } } else { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(play, 0xD670); + EnBaba_TriggerTransition(play, 0xD670); } } else { - this->unk_1E0 = 0; - this->actionFunc = func_80BA9758; + this->textId = 0; + this->actionFunc = EnBaba_Idle; } - } else if (this->unk_40A & 0x20) { - this->unk_40A &= ~0x20; + } else if (this->stateFlags & BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK) { + this->stateFlags &= ~BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; - this->actionFunc = func_80BA9AB8; + play->msgCtx.stateTimer = 4; + this->actionFunc = EnBaba_GiveBlastMask; } else { - func_80BA886C(this, play); + EnBaba_HandleConversation(this, play); } } - } else if (temp_v0 == 6) { + } else if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play) && (play->msgCtx.unk120B1 == 0)) { gSaveContext.save.weekEventReg[81] |= 2; - func_80BA8C4C(play, 0xD670); + EnBaba_TriggerTransition(play, 0xD670); } } } -void func_80BA9AB8(EnBaba* this, PlayState* play) { +void EnBaba_GiveBlastMask(EnBaba* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->unk_40A |= 0x40; - this->actionFunc = func_80BA9B24; + this->stateFlags |= BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK; + this->actionFunc = EnBaba_GaveBlastMask; } else { Actor_PickUp(&this->actor, play, GI_MASK_BLAST, 300.0f, 300.0f); } } -void func_80BA9B24(EnBaba* this, PlayState* play) { +void EnBaba_GaveBlastMask(EnBaba* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_80BA886C(this, play); - this->actionFunc = func_80BA98EC; + EnBaba_HandleConversation(this, play); + this->actionFunc = EnBaba_Talk; } else { - func_800B85E0(&this->actor, play, 400.0f, -1); + func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); } } -void func_80BA9B80(EnBaba* this, PlayState* play) { - ScheduleResult sp20; +void EnBaba_FollowSchedule(EnBaba* this, PlayState* play) { + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(play, D_80BAA488, &sp20) || - ((this->unk_434 != sp20.result) && !func_80BA9110(this, play, &sp20))) { - this->unk_40A &= ~0x80; + if (!Schedule_RunScript(play, sSchedule, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && + !EnBaba_ProcessScheduleOutput(this, play, &scheduleOutput))) { + this->stateFlags &= ~BOMB_SHOP_LADY_STATE_DRAW_SHADOW; this->actor.flags &= ~ACTOR_FLAG_1; - sp20.result = false; + scheduleOutput.result = BOMB_SHOP_LADY_SCH_NONE; } else { - this->unk_40A |= 0x80; + this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW; this->actor.flags |= ACTOR_FLAG_1; } - this->unk_434 = sp20.result; + this->scheduleResult = scheduleOutput.result; - func_80BA93AC(this, play); + EnBaba_HandleSchedule(this, play); - if (this->unk_40A & 2) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A39, &this->actor); // "I'm sorry" - this->actionFunc = func_80BA9848; + this->actionFunc = EnBaba_FollowSchedule_Talk; } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { func_800B863C(&this->actor, play); } @@ -626,42 +680,42 @@ void func_80BA9B80(EnBaba* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } -void func_80BA9CD4(EnBaba* this, PlayState* play) { - s16 sp2E = this->skelAnime.curFrame; - s16 sp2C = Animation_GetLastFrame(sAnimations[this->unk_40C].animation); +void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { + s16 curFrame = this->skelAnime.curFrame; + s16 endFrame = Animation_GetLastFrame(sAnimations[this->animIndex].animation); this->collider.dim.height = 37; this->collider.dim.radius = 23; - if (this->unk_40C == 3) { + if (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_BBVO00); } - if (sp2E == sp2C) { - this->unk_40C = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + if (curFrame == endFrame) { + this->animIndex = BOMB_SHOP_LADY_ANIM_LYING_DOWN; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); } } else { - if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->unk_404) == 0)) { + if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->sakonDeadTimer) == 0)) { Audio_QueueSeqCmd(0x101400FF); - func_80BA8C4C(play, 0xD670); + EnBaba_TriggerTransition(play, 0xD670); } else { Actor_MoveWithGravity(&this->actor); } } } -void func_80BA9E00(EnBaba* this, PlayState* play) { +void EnBaba_DoNothing(EnBaba* this, PlayState* play) { } -void func_80BA9E10(EnBaba* this, PlayState* play) { - if (func_80BA8D2C(this, 1.0f)) { - this->unk_1E8 = 0; +void EnBaba_Walk(EnBaba* this, PlayState* play) { + if (EnBaba_MoveForward(this, 1.0f)) { + this->waypoint = 0; } } -void func_80BA9E48(EnBaba* this, PlayState* play) { +void EnBaba_FaceForward(EnBaba* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; } @@ -673,13 +727,13 @@ void EnBaba_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->path = SubS_GetPathByIndex(play, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F); + this->path = SubS_GetPathByIndex(play, BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor), 0x3F); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; this->actor.gravity = -4.0f; - this->actionFunc = func_80BA9480; + this->actionFunc = EnBaba_FinishInit; } void EnBaba_Destroy(Actor* thisx, PlayState* play) { @@ -694,46 +748,48 @@ void EnBaba_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - func_80BA8DF4(this, play); + EnBaba_UpdateModel(this, play); } s32 EnBaba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBaba* this = THIS; - if (limbIndex == 6) { + if (limbIndex == BBA_LIMB_NECK) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY); Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); } - if (limbIndex == 5) { + if (limbIndex == BBA_LIMB_UPPER_ROOT) { Matrix_RotateXS(-this->torsoRot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY); } - if ((limbIndex == 6) && (this->unk_1E2 != 0) && ((play->state.frames % 2) == 0)) { + if ((limbIndex == BBA_LIMB_NECK) && (this->inMsgState3 != 0) && ((play->state.frames % 2) == 0)) { Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); } - if ((limbIndex == 5) || (limbIndex == 10) || (limbIndex == 14)) { - rot->y += (s16)(Math_SinS(this->unk_302[limbIndex]) * 200.0f); - rot->z += (s16)(Math_CosS(this->unk_326[limbIndex]) * 200.0f); + if ((limbIndex == BBA_LIMB_UPPER_ROOT) || (limbIndex == BBA_LIMB_LEFT_UPPER_ARM) || + (limbIndex == BBA_LIMB_RIGHT_UPPER_ARM)) { + rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f); } - if (((this->unk_40C == 1) || (this->unk_40C == 3) || (this->unk_40C == 4) || - (ENBABA_GET_C000(&this->actor) == ENBABA_C000_2)) && - (limbIndex == 8)) { + if (((this->animIndex == BOMB_SHOP_LADY_ANIM_IDLE) || (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) || + (this->animIndex == BOMB_SHOP_LADY_ANIM_LYING_DOWN) || + (BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_SWAY)) && + (limbIndex == BBA_LIMB_BAG)) { *dList = NULL; } - return 0; + return false; } void EnBaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnBaba* this = THIS; Vec3f sp18 = { 0.0f, 0.0f, 0.0f }; - if (limbIndex == 7) { + if (limbIndex == BBA_LIMB_HEAD) { this->actor.focus.pos.x = this->actor.world.pos.x; this->actor.focus.pos.y = this->actor.world.pos.y; this->actor.focus.pos.z = this->actor.world.pos.z; @@ -747,10 +803,10 @@ void EnBaba_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnBaba_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBaba* this = THIS; - Vec3f sp4C; - Vec3f sp40; + Vec3f pos; + Vec3f scale; - if (this->unk_40A & 2) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) { OPEN_DISPS(play->state.gfxCtx); func_8012C5B0(play->state.gfxCtx); @@ -761,18 +817,19 @@ void EnBaba_Draw(Actor* thisx, PlayState* play) { this->skelAnime.dListCount, EnBaba_OverrideLimbDraw, EnBaba_PostLimbDraw, EnBaba_TransformLimbDraw, &this->actor); - if (this->unk_40A & 0x80) { - if ((this->unk_40C == 3) || (this->unk_40C == 4)) { + if (this->stateFlags & BOMB_SHOP_LADY_STATE_DRAW_SHADOW) { + if ((this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) || + (this->animIndex == BOMB_SHOP_LADY_ANIM_LYING_DOWN)) { func_8012C2DC(play->state.gfxCtx); - sp4C.x = this->actor.world.pos.x + 20.0f; - sp4C.y = this->actor.world.pos.y; - sp4C.z = this->actor.world.pos.z + 20.0f; + pos.x = this->actor.world.pos.x + 20.0f; + pos.y = this->actor.world.pos.y; + pos.z = this->actor.world.pos.z + 20.0f; } else { - sp4C = this->actor.world.pos; + pos = this->actor.world.pos; } - sp40.x = sp40.y = sp40.z = 0.3f; - func_800BC620(&sp4C, &sp40, 255, play); + scale.x = scale.y = scale.z = 0.3f; + func_800BC620(&pos, &scale, 255, play); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.h b/src/overlays/actors/ovl_En_Baba/z_en_baba.h index 0b39fc50b..2335dcb70 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.h +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.h @@ -2,58 +2,60 @@ #define Z_EN_BABA_H #include "global.h" +#include "overlays/actors/ovl_En_Sob1/z_en_sob1.h" +#include "objects/object_bba/object_bba.h" struct EnBaba; typedef void (*EnBabaActionFunc)(struct EnBaba*, PlayState*); -#define ENBABA_GET_3F00(thisx) (((thisx)->params & 0x3F00) >> 8) -#define ENBABA_GET_C000(thisx) (((thisx)->params & 0xC000) >> 0xE) +#define BOMB_SHOP_LADY_GET_PATH_INDEX(thisx) (((thisx)->params & 0x3F00) >> 8) +#define BOMB_SHOP_LADY_GET_TYPE(thisx) (((thisx)->params & 0xC000) >> 0xE) -#define ENBABA_3F00_3F 0x3F - -enum { - /* 0 */ ENBABA_C000_0, - /* 1 */ ENBABA_C000_1, - /* 2 */ ENBABA_C000_2, -}; +// Types BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE and BOMB_SHOP_LADY_TYPE_IDLE can only be used in SCENE_BACKTOWN +// Type BOMB_SHOP_LADY_TYPE_SWAY can be used anywhere except SCENE_BACKTOWN and SCENE_BOMYA +typedef enum { + /* 0 */ BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE, + /* 1 */ BOMB_SHOP_LADY_TYPE_IDLE, + /* 2 */ BOMB_SHOP_LADY_TYPE_SWAY +} BombShopLadyType; typedef struct EnBaba { /* 0x000 */ Actor actor; - /* 0x144 */ struct EnOssan* unk_144; + /* 0x144 */ EnSob1* bombShopkeeper; /* 0x148 */ EnBabaActionFunc actionFunc; /* 0x14C */ UNK_TYPE1 unk14C[4]; /* 0x150 */ SkelAnime skelAnime; /* 0x194 */ ColliderCylinder collider; - /* 0x1E0 */ u16 unk_1E0; - /* 0x1E2 */ u8 unk_1E2; + /* 0x1E0 */ u16 textId; + /* 0x1E2 */ u8 inMsgState3; /* 0x1E4 */ Path* path; - /* 0x1E8 */ s16 unk_1E8; + /* 0x1E8 */ s16 waypoint; /* 0x1EA */ UNK_TYPE1 unk1EA[0x1C]; - /* 0x206 */ Vec3s jointTable[18]; - /* 0x272 */ Vec3s morphTable[18]; + /* 0x206 */ Vec3s jointTable[BBA_LIMB_MAX]; + /* 0x272 */ Vec3s morphTable[BBA_LIMB_MAX]; /* 0x2DE */ Vec3s trackTarget; /* 0x2E4 */ Vec3s headRot; /* 0x2EA */ Vec3s torsoRot; /* 0x2F0 */ UNK_TYPE1 unk2F0[0x12]; - /* 0x302 */ s16 unk_302[18]; - /* 0x326 */ s16 unk_326[18]; + /* 0x302 */ s16 limbRotTableY[18]; + /* 0x326 */ s16 limbRotTableZ[18]; /* 0x34A */ UNK_TYPE1 unk34A[0xBA]; - /* 0x404 */ s16 unk_404; + /* 0x404 */ s16 sakonDeadTimer; /* 0x406 */ UNK_TYPE1 unk406[4]; - /* 0x40A */ u16 unk_40A; - /* 0x40C */ s32 unk_40C; + /* 0x40A */ u16 stateFlags; + /* 0x40C */ s32 animIndex; /* 0x410 */ Path* timePath; - /* 0x414 */ Vec3f timePathTargetPos; + /* 0x414 */ Vec3f timePathPoint; /* 0x420 */ f32 timePathProgress; /* 0x424 */ s32 timePathTotalTime; /* 0x428 */ s32 timePathWaypointTime; /* 0x42C */ s32 timePathWaypoint; /* 0x430 */ s32 timePathElapsedTime; - /* 0x434 */ u8 unk_434; + /* 0x434 */ u8 scheduleResult; /* 0x436 */ s16 timePathTimeSpeed; - /* 0x438 */ s32 unk_438; - /* 0x43C */ s32 unk_43C; + /* 0x438 */ s32 timePathIsSetup; + /* 0x43C */ s32 timePathHasReachedEnd; } EnBaba; // size = 0x440 extern const ActorInit En_Baba_InitVars; diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index e91fc61f6..e14bc8ce5 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -222,7 +222,7 @@ void func_80BE8AAC(EnBaisen* this, PlayState* play) { EnBaisen_ChangeAnimation(this, 0); } } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->textIdIndex++; if (this->textIdIndex < 6) { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index c85cd3410..e81608721 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -5,22 +5,29 @@ */ #include "z_en_bat.h" +#include "objects/object_bat/object_bat.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) #define THIS ((EnBat*)thisx) +#define BAD_BAT_FLAP_FRAME 5 + void EnBat_Init(Actor* thisx, PlayState* play); void EnBat_Destroy(Actor* thisx, PlayState* play); void EnBat_Update(Actor* thisx, PlayState* play); void EnBat_Draw(Actor* thisx, PlayState* play); -void func_80A438D4(EnBat* this, PlayState* play); -void func_80A4392C(EnBat* this, PlayState* play); -void func_80A43CE8(EnBat* this, PlayState* play); -void func_80A44114(EnBat* this, PlayState* play); +s32 EnBat_IsGraveyardOnSecondDay(PlayState* play); +void EnBat_SetupPerch(EnBat* this); +void EnBat_Perch(EnBat* this, PlayState* play); +void EnBat_SetupFlyIdle(EnBat* this); +void EnBat_FlyIdle(EnBat* this, PlayState* play); +void EnBat_SetupDiveAttack(EnBat* this); +void EnBat_DiveAttack(EnBat* this, PlayState* play); +void EnBat_Die(EnBat* this, PlayState* play); +void EnBat_Stunned(EnBat* this, PlayState* play); -#if 0 const ActorInit En_Bat_InitVars = { ACTOR_EN_BAT, ACTORCAT_ENEMY, @@ -33,99 +40,522 @@ const ActorInit En_Bat_InitVars = { (ActorFunc)EnBat_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_80A44A00 = { - { COLTYPE_HIT3, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, }, +static ColliderSphereInit sSphereInit = { + { + COLTYPE_HIT3, + AT_NONE | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_SPHERE, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_HARD, + BUMP_ON, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 15 }, 100 }, }; -// static DamageTable sDamageTable = { -static DamageTable D_80A44A2C = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0x0), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), +typedef enum { + /* 0 */ BAD_BAT_DMGEFF_NONE, + /* 1 */ BAD_BAT_DMGEFF_STUN, + /* 2 */ BAD_BAT_DMGEFF_FIRE, + /* 3 */ BAD_BAT_DMGEFF_ICE, + /* 4 */ BAD_BAT_DMGEFF_LIGHT, + /* 5 */ BAD_BAT_DMGEFF_ELECTRIC +} BatDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, BAD_BAT_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, BAD_BAT_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, BAD_BAT_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, BAD_BAT_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, BAD_BAT_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, BAD_BAT_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, BAD_BAT_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, BAD_BAT_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, BAD_BAT_DMGEFF_NONE), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A44A4C = { 1, 15, 30, 10 }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 30, 10 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A44A54[] = { +static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, 96, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -#endif +static Gfx* sWingsDLs[] = { + gBadBatWingsFrame0DL, gBadBatWingsFrame1DL, gBadBatWingsFrame2DL, gBadBatWingsFrame3DL, gBadBatWingsFrame4DL, + gBadBatWingsFrame5DL, gBadBatWingsFrame6DL, gBadBatWingsFrame7DL, gBadBatWingsFrame8DL, +}; -extern ColliderSphereInit D_80A44A00; -extern DamageTable D_80A44A2C; -extern CollisionCheckInfoInit D_80A44A4C; -extern InitChainEntry D_80A44A54[]; +#define BAD_BAT_MAX_NUMBER_ATTACKING 3 -extern UNK_TYPE D_060000A0; +s32 sNumberAttacking; //!< Limit number attacking player to at most `BAD_BAT_MAX_NUMBER_ATTACKING` +s32 sAlreadySpawned; //!< used for those spawned with room -1 in Graveyard to avoid respawn on room change -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/EnBat_Init.s") +void EnBat_Init(Actor* thisx, PlayState* play) { + EnBat* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/EnBat_Destroy.s") + Actor_ProcessInitChain(thisx, sInitChain); + Collider_InitAndSetSphere(play, &this->collider, thisx, &sSphereInit); + this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; + CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); + ActorShape_Init(&thisx->shape, 2000.0f, ActorShadow_DrawCircle, 25.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A437CC.s") + this->animationFrame = Rand_ZeroOne() * 9.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A43810.s") + this->paramFlags = BAD_BAT_GET_PARAMFLAGS(thisx); + this->switchFlag = BAD_BAT_GET_SWITCHFLAG(thisx); + thisx->params = BAD_BAT_GET_TYPE(thisx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A43870.s") + thisx->depthInWater = BGCHECK_Y_MIN; + Actor_SetFocus(thisx, 20.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A438D4.s") + if (sAlreadySpawned) { + Actor_MarkForDeath(thisx); + } else if (EnBat_IsGraveyardOnSecondDay(play)) { + if (Flags_GetSwitch(play, this->switchFlag)) { + Actor_MarkForDeath(thisx); + } else { + this->actor.room = -1; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A438F8.s") + if (this->paramFlags & BAD_BAT_PARAMFLAG_PERCH) { + thisx->params = 0; + EnBat_SetupPerch(this); + } else { + if (thisx->params == 0x1F) { + thisx->params = 0; + } + EnBat_SetupFlyIdle(this); + while (BAD_BAT_GET_NUMBER_TO_SPAWN(thisx) > 1) { + Actor_SpawnAsChildAndCutscene( + &play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + randPlusMinusPoint5Scaled(200.0f), + thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), + thisx->world.pos.z + randPlusMinusPoint5Scaled(200.0f), randPlusMinusPoint5Scaled(0x2000), + 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), -1, thisx->unk20, + NULL); + BAD_BAT_GET_NUMBER_TO_SPAWN(thisx)--; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A4392C.s") +void EnBat_Destroy(Actor* thisx, PlayState* play) { + EnBat* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A43CA0.s") + Collider_DestroySphere(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A43CE8.s") +s32 EnBat_IsGraveyardOnSecondDay(PlayState* play) { + if ((CURRENT_DAY == 2) && (play->sceneNum == SCENE_BOTI)) { + return true; + } else { + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A43F60.s") +void EnBat_StepAnimation(EnBat* this, s32 frameStep) { + s32 prevFrame = this->animationFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A44114.s") + this->animationFrame += frameStep; + if (this->animationFrame >= ARRAY_COUNT(sWingsDLs)) { + this->animationFrame -= ARRAY_COUNT(sWingsDLs); + } + if ((prevFrame < BAD_BAT_FLAP_FRAME) && (this->animationFrame >= BAD_BAT_FLAP_FRAME)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_FLY); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A44294.s") +void EnBat_SetupPerch(EnBat* this) { + this->collider.base.acFlags |= AC_ON; + this->collider.base.atFlags |= AT_ON; + this->collider.dim.worldSphere.center.x = this->actor.focus.pos.x; + this->collider.dim.worldSphere.center.y = this->actor.focus.pos.y; + this->collider.dim.worldSphere.center.z = this->actor.focus.pos.z; + this->actor.speedXZ = 0.0f; + this->actionFunc = EnBat_Perch; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A4431C.s") +void EnBat_Perch(EnBat* this, PlayState* play) { + EnBat_StepAnimation(this, 1); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/func_80A443D8.s") +void EnBat_SetupFlyIdle(EnBat* this) { + this->timer = 100; + this->collider.base.acFlags |= AC_ON; + this->actor.speedXZ = 3.5f; + this->actionFunc = EnBat_FlyIdle; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/EnBat_Update.s") +void EnBat_FlyIdle(EnBat* this, PlayState* play) { + s32 finishedRotStep; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bat/EnBat_Draw.s") + EnBat_StepAnimation(this, 1); + + finishedRotStep = Math_ScaledStepToS(&this->actor.shape.rot.y, this->yawTarget, 0x300); + + if (this->actor.bgCheckFlags & 8) { + this->actor.bgCheckFlags &= ~8; + this->yawTarget = this->actor.wallYaw; + } else if (Math3D_XZDistanceSquared(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x, + this->actor.home.pos.z) > SQ(300.0f)) { + this->yawTarget = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } else if (finishedRotStep && (Rand_ZeroOne() < 0.015f)) { + this->yawTarget = + this->actor.shape.rot.y + (((s32)(0x1000 * Rand_ZeroOne()) + 0x1000) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)); + } + + finishedRotStep = Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); + + if ((this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > -40.0f)) { + this->pitchTarget = -0x1000; + } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f)) { + this->pitchTarget = -((s32)(0x800 * Rand_ZeroOne()) + 0x800); + } else if ((this->actor.home.pos.y + 100.0f) < this->actor.world.pos.y) { + this->pitchTarget = (s32)(0x800 * Rand_ZeroOne()) + 0x800; + } else if ((finishedRotStep) && (Rand_ZeroOne() < 0.015f)) { + this->pitchTarget += (s16)(((s32)(0x400 * Rand_ZeroOne()) + 0x400) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1)); + this->pitchTarget = CLAMP(this->pitchTarget, -0x1000, 0x1000); + } + + if (this->timer != 0) { + this->timer--; + } + if ((this->actor.xzDistToPlayer < 300.0f) && (this->timer == 0) && (Player_GetMask(play) != PLAYER_MASK_STONE) && + (sNumberAttacking < BAD_BAT_MAX_NUMBER_ATTACKING) && + (!(this->paramFlags & BAD_BAT_PARAMFLAG_CHECK_HEIGHTREL) || (fabsf(this->actor.playerHeightRel) < 150.0f))) { + EnBat_SetupDiveAttack(this); + } +} + +void EnBat_SetupDiveAttack(EnBat* this) { + this->collider.base.atFlags |= AT_ON; + this->timer = 300; + this->actor.speedXZ = 4.0f; + sNumberAttacking++; + this->actionFunc = EnBat_DiveAttack; +} + +void EnBat_DiveAttack(EnBat* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 isFacingPlayer; + Vec3f preyPos; + + EnBat_StepAnimation(this, 2); + isFacingPlayer = Actor_IsFacingPlayer(&this->actor, 0x2800); + + if (isFacingPlayer) { + s16 pitchTarget; + + preyPos.x = player->actor.world.pos.x; + preyPos.y = player->actor.world.pos.y + 20.0f; + preyPos.z = player->actor.world.pos.z; + + pitchTarget = Actor_PitchToPoint(&this->actor, &preyPos); + pitchTarget = CLAMP(pitchTarget, -0x3000, 0x3000); + Math_SmoothStepToS(&this->actor.shape.rot.x, pitchTarget, 2, 0x400, 0x40); + } else { + Math_SmoothStepToS(&this->actor.shape.rot.x, -0x800, 2, 0x100, 0x10); + } + if (isFacingPlayer || (this->actor.xzDistToPlayer > 80.0f)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00, 0xC0); + } + + this->timer--; + + if ((this->timer == 0) || (this->collider.base.atFlags & AT_HIT) || (Player_GetMask(play) == PLAYER_MASK_STONE) || + (this->actor.bgCheckFlags & 1) || (player->stateFlags1 & PLAYER_STATE1_800000) || + (this->actor.depthInWater > -40.0f)) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_ATTACK); + } + this->collider.base.atFlags &= ~AT_ON; + sNumberAttacking--; + EnBat_SetupFlyIdle(this); + } else if ((this->actor.bgCheckFlags & 8) && + (ABS_ALT(BINANG_SUB(this->actor.wallYaw, this->actor.yawTowardsPlayer)) > 0x6800)) { + sNumberAttacking--; + this->collider.base.atFlags &= ~AT_ON; + this->actor.bgCheckFlags &= ~8; + this->yawTarget = this->actor.wallYaw; + EnBat_SetupFlyIdle(this); + } +} + +void EnBat_SetupDie(EnBat* this, PlayState* play) { + this->actor.flags &= ~ACTOR_FLAG_1; + Enemy_StartFinishingBlow(play, &this->actor); + this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); + this->actor.bgCheckFlags &= ~1; + this->actor.velocity.y = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FFLY_DEAD); + + if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_ICE) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->drawDmgEffAlpha = 1.0f; + this->drawDmgEffFrozenSteamScale = 60.0f * (0.45f / 40.0f); + this->drawDmgEffScale = 0.45f; + } else if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_LIGHT) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.45f; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_SMALL_LIGHT_RAYS); + } else if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_FIRE) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.45f; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); + + if (this->actor.flags & ACTOR_FLAG_8000) { + this->actor.speedXZ = 0.0f; + } + + this->collider.base.acFlags &= ~AC_ON; + this->actor.flags |= ACTOR_FLAG_10; + this->actionFunc = EnBat_Die; +} + +void EnBat_Die(EnBat* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + this->actor.colorFilterTimer = 40; + + if (!(this->actor.flags & ACTOR_FLAG_8000)) { // Carried by arrow + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); + this->actor.shape.rot.z += 0x1780; + } + + if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartPoss, ARRAY_COUNT(this->bodyPartPoss), 2, 0.2f, + 0.2f); + } + + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 100, 0, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 11, NA_SE_EN_EXTINCT); + Actor_MarkForDeath(&this->actor); + + if (this->actor.room == -1) { + Actor* enemy = NULL; + + // Search for other EnBats. If find none, set switch flag. + do { + enemy = SubS_FindActor(play, enemy, ACTORCAT_ENEMY, ACTOR_EN_BAT); + if (enemy != NULL) { + if (enemy != &this->actor) { + break; + } + enemy = enemy->next; + } + } while (enemy != NULL); + + if (enemy == NULL) { + Flags_SetSwitch(play, this->switchFlag); + } + } + } + } +} + +void EnBat_SetupStunned(EnBat* this) { + if (this->actionFunc != EnBat_Stunned) { + this->actor.shape.yOffset = 700.0f; + this->actor.velocity.y = 0.0f; + this->actor.speedXZ = 0.0f; + this->actor.world.pos.y += 13.0f; + } + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 255, 0, this->timer); + this->actionFunc = EnBat_Stunned; +} + +void EnBat_Stunned(EnBat* this, PlayState* play) { + Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); + if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + EnBat_SetupFlyIdle(this); + } + } else { + this->actor.colorFilterTimer = 40; + if (this->drawDmgEffAlpha > 0.0f) { + this->drawDmgEffAlpha = 2.0f; + } + } +} + +void EnBat_UpdateDamage(EnBat* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + + Actor_SetDropFlag(&this->actor, &this->collider.info); + this->collider.base.atFlags &= ~AT_ON; + + if (this->actionFunc == EnBat_DiveAttack) { + sNumberAttacking--; + } + + if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_ELECTRIC) { + this->timer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; + this->drawDmgEffAlpha = 2.0f; + this->drawDmgEffScale = 0.45f; + EnBat_SetupStunned(this); + } else if (this->actor.colChkInfo.damageEffect == BAD_BAT_DMGEFF_STUN) { + this->timer = 40; + EnBat_SetupStunned(this); + } else { + Actor_ApplyDamage(&this->actor); + EnBat_SetupDie(this, play); + } + } +} + +void EnBat_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnBat* this = THIS; + + if (this->actor.room == -1) { + sAlreadySpawned = true; + } + + EnBat_UpdateDamage(this, play); + this->actionFunc(this, play); + + if (this->actionFunc != EnBat_Stunned) { + Math_StepToF(&this->actor.shape.yOffset, 2000.0f, 200.0f); + } + + if (this->actionFunc != EnBat_Perch) { + Vec3f prevPos; + + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actor.world.rot.x = -this->actor.shape.rot.x; + Math_Vec3f_Copy(&prevPos, &this->actor.prevPos); + + if ((this->actor.colChkInfo.health != 0) && (this->actionFunc != EnBat_Stunned)) { + Actor_MoveWithoutGravity(&this->actor); + } else { + Actor_MoveWithGravity(&this->actor); + } + + if (this->actionFunc == EnBat_DiveAttack) { + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 5); + } else if ((this->actionFunc != EnBat_FlyIdle) || + ((this->actor.xzDistToPlayer < 400.0f) && (this->actor.projectedPos.z > 0.0f))) { + if (this->paramFlags & BAD_BAT_PARAMFLAG_0) { + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 5); + } else { + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 4); + } + } else { + Math_Vec3f_Copy(&this->actor.prevPos, &prevPos); + } + + Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); + this->collider.dim.worldSphere.center.x = this->actor.focus.pos.x; + this->collider.dim.worldSphere.center.y = this->actor.focus.pos.y; + this->collider.dim.worldSphere.center.z = this->actor.focus.pos.z; + } + + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + if (this->actionFunc == EnBat_DiveAttack) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + if (this->drawDmgEffAlpha > 0.0f) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); + this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.225f; + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.45f); + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.45f, 0.45f / 40.0f)) { + func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } + } +} + +void EnBat_Draw(Actor* thisx, PlayState* play) { + EnBat* this = THIS; + Gfx* gfx; + + // Draw body and wings + if (this->actor.projectedPos.z > 0.0f) { + OPEN_DISPS(play->state.gfxCtx); + + gfx = POLY_OPA_DISP; + + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[2], gBadBatSetupDL); + gSPDisplayList(&gfx[3], gBadBatBodyDL); + gSPDisplayList(&gfx[4], sWingsDLs[this->animationFrame]); + + POLY_OPA_DISP = &gfx[5]; + + CLOSE_DISPS(play->state.gfxCtx); + } + + // Draw damage effects + if (this->drawDmgEffAlpha > 0.0f) { + s16 rollAngle; + + if (this->animationFrame < BAD_BAT_FLAP_FRAME - 1) { + rollAngle = this->animationFrame * (15 * (0x10000 / 360)); + } else { + rollAngle = (this->animationFrame >= BAD_BAT_FLAP_FRAME) + ? (this->animationFrame * (15 * (0x10000 / 360))) - (120 * (0x10000 / 360)) + : 0; + } + Matrix_MultZero(&this->bodyPartPoss[0]); + Matrix_RotateZS(rollAngle, MTXMODE_APPLY); + Matrix_MultVecX(1700.0f, &this->bodyPartPoss[1]); + Matrix_RotateZS(-2 * rollAngle, MTXMODE_APPLY); + Matrix_MultVecX(-1700.0f, &this->bodyPartPoss[2]); + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartPoss, ARRAY_COUNT(this->bodyPartPoss), + this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, + this->drawDmgEffType); + } +} diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.h b/src/overlays/actors/ovl_En_Bat/z_en_bat.h index 76356e83c..4f4ada810 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.h +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.h @@ -3,6 +3,22 @@ #include "global.h" +#define BAD_BAT_GET_TYPE(thisx) (((thisx)->params >> 0) & 0x1F) +#define BAD_BAT_GET_PARAMFLAGS(thisx) (((thisx)->params >> 5) & 7) +#define BAD_BAT_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0xFF) +#define BAD_BAT_PARAMS(switchFlag, paramflags, type) ((type) | ((paramflags) << 5) | ((switchFlag) << 8)) + +//! PARAMFLAGS +//! Affects which flags are used in Actor_UpdateBgCheckInfo in certain circumstances +#define BAD_BAT_PARAMFLAG_0 (1 << 0) +//! Whether to apply a height range check to attack +#define BAD_BAT_PARAMFLAG_CHECK_HEIGHTREL (1 << 1) +//! Spawn as perching instead of flying +#define BAD_BAT_PARAMFLAG_PERCH (1 << 2) + +#define BAD_BAT_GET_NUMBER_TO_SPAWN(thisx) ((thisx)->params) +#define BAD_BAT_SPAWN_COUNT(n) (n) + struct EnBat; typedef void (*EnBatActionFunc)(struct EnBat*, PlayState*); @@ -10,7 +26,18 @@ typedef void (*EnBatActionFunc)(struct EnBat*, PlayState*); typedef struct EnBat { /* 0x000 */ Actor actor; /* 0x144 */ EnBatActionFunc actionFunc; - /* 0x148 */ char unk_148[0x94]; + /* 0x148 */ u8 drawDmgEffType; + /* 0x149 */ u8 paramFlags; + /* 0x14A */ s16 switchFlag; + /* 0x14C */ s16 timer; + /* 0x14E */ s16 pitchTarget; + /* 0x150 */ s16 yawTarget; + /* 0x152 */ s16 animationFrame; //!< Manual animation using displaylists + /* 0x154 */ f32 drawDmgEffScale; + /* 0x158 */ f32 drawDmgEffFrozenSteamScale; + /* 0x15C */ f32 drawDmgEffAlpha; + /* 0x160 */ Vec3f bodyPartPoss[3]; + /* 0x184 */ ColliderSphere collider; } EnBat; // size = 0x1DC extern const ActorInit En_Bat_InitVars; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 071e879aa..7bfbf596c 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -162,7 +162,7 @@ void EnBba01_FinishInit(EnHy* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnBba01_Draw; this->waitingOnInit = false; - if (ENBBA01_GET_PATH(&this->actor) == ENBBA01_NO_PATH) { + if (ENBBA01_GET_PATH(&this->actor) == 0x3F) { this->actionFunc = EnBba01_FaceFoward; } else { this->actionFunc = EnBba01_Walk; @@ -185,17 +185,19 @@ void EnBba01_Talk(EnHy* this, PlayState* play) { u8 talkState; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); + talkState = Message_GetState(&play->msgCtx); - this->inMsgState3 = (talkState == 3) ? true : false; + this->inMsgState3 = (talkState == TEXT_STATE_3) ? true : false; switch (talkState) { - case 0: + case TEXT_STATE_NONE: yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); if (yaw < 0x64) { Message_StartTextbox(play, this->textId, NULL); } break; - case 2: + + case TEXT_STATE_CLOSING: this->actor.textId = 0; this->trackTarget = this->prevTrackTarget; this->headRot = this->prevHeadRot; @@ -225,7 +227,7 @@ void EnBba01_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->enHy.actor.flags &= ~ACTOR_FLAG_1; - this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH); + this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH(&this->enHy.actor), 0x3F); this->enHy.waitingOnInit = true; Actor_SetScale(&this->enHy.actor, 0.01f); this->enHy.actionFunc = EnBba01_FinishInit; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h index 04bab2ff1..c9030f112 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h @@ -8,7 +8,6 @@ struct EnBba01; typedef void (*EnBba01ActionFunc)(struct EnBba01*, PlayState*); #define ENBBA01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) -#define ENBBA01_NO_PATH 0x3F typedef struct EnBba01 { /* 0x000 */ EnHy enHy; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 22e87d2a5..2b1111809 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -5,7 +5,6 @@ */ #include "z_en_bigokuta.h" -#include "assets/objects/object_bigokuta/object_bigokuta.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -113,9 +112,9 @@ void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta_SetupIdle(this); } - this->camAt.x = (Math_SinS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.x; - this->camAt.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->camAt.z = (Math_CosS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.z; + this->subCamAt.x = (Math_SinS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.x; + this->subCamAt.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; + this->subCamAt.z = (Math_CosS(this->actor.home.rot.y) * 66.0f) + this->actor.world.pos.z; this->unkFunc = func_80AC2B4C; // set but never called } @@ -127,40 +126,40 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->bodyCollider); } -void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* at, Vec3f* eye) { +void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* subCamAt, Vec3f* subCamEye) { s16 angle; ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - Play_CameraSetAtEye(play, this->camId, at, eye); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + Play_CameraSetAtEye(play, this->subCamId, subCamAt, subCamEye); - angle = BINANG_SUB(Actor_YawToPoint(&this->actor, eye), this->actor.home.rot.y); + angle = BINANG_SUB(Actor_YawToPoint(&this->actor, subCamEye), this->actor.home.rot.y); if (angle > 0) { angle = BINANG_ADD(this->actor.home.rot.y, 0x1800); } else { angle = BINANG_SUB(this->actor.home.rot.y, 0x1800); } - this->camEye.x = (Math_SinS(angle) * 250.0f) + this->camAt.x; - this->camEye.y = this->camAt.y + 100.0f; - this->camEye.z = (Math_CosS(angle) * 250.0f) + this->camAt.z; + this->subCamEye.x = (Math_SinS(angle) * 250.0f) + this->subCamAt.x; + this->subCamEye.y = this->subCamAt.y + 100.0f; + this->subCamEye.z = (Math_CosS(angle) * 250.0f) + this->subCamAt.z; } void EnBigokuta_MoveCamera(EnBigokuta* this, PlayState* play) { - Camera* camera = Play_GetCamera(play, this->camId); + Camera* subCam = Play_GetCamera(play, this->subCamId); - Math_Vec3f_StepTo(&camera->eye, &this->camEye, 20.0f); - Math_Vec3f_StepTo(&camera->at, &this->camAt, 20.0f); - Play_CameraSetAtEye(play, this->camId, &camera->at, &camera->eye); + Math_Vec3f_StepTo(&subCam->eye, &this->subCamEye, 20.0f); + Math_Vec3f_StepTo(&subCam->at, &this->subCamAt, 20.0f); + Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCam->eye); } void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { - Camera* camera; + Camera* subCam; - if (this->camId != 0) { - camera = Play_GetCamera(play, this->camId); - Play_CameraSetAtEye(play, 0, &camera->at, &camera->eye); - this->camId = 0; + if (this->subCamId != SUB_CAM_ID_DONE) { + subCam = Play_GetCamera(play, this->subCamId); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->actor.cutscene); } } @@ -267,12 +266,12 @@ void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { if (this->actor.cutscene != -1) { - if (this->camId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { EnBigokuta_MoveCamera(this, play); } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - Camera* camera = Play_GetCamera(play, 0); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - EnBigokuta_SetupCutsceneCamera(this, play, &camera->at, &camera->eye); + EnBigokuta_SetupCutsceneCamera(this, play, &mainCam->at, &mainCam->eye); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -584,7 +583,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } rot->x -= rotX; } - } else if (limbIndex == BIGOKUTA_LIMB_SNOUT_CENTER) { + } else if (limbIndex == BIGOKUTA_LIMB_CENTER_SNOUT) { EnBigokuta* this = THIS; if (this->actionFunc == EnBigokuta_PlayDeathEffects) { diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index 027c8fa31..ba59e9a97 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -2,36 +2,13 @@ #define Z_EN_BIGOKUTA_H #include "global.h" +#include "assets/objects/object_bigokuta/object_bigokuta.h" struct EnBigokuta; typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); typedef void (*EnBigokutaUnkFunc)(PlayState*, struct EnBigokuta*); -typedef enum { - /* 00 */ BIGOKUTA_LIMB_NONE, - /* 01 */ BIGOKUTA_LIMB_BODY, - /* 02 */ BIGOKUTA_LIMB_ARM_BASE_RIGHT_FRONT, - /* 03 */ BIGOKUTA_LIMB_ARM_END_RIGHT_FRONT, - /* 04 */ BIGOKUTA_LIMB_ARM_BASE_LEFT_FRONT, - /* 05 */ BIGOKUTA_LIMB_ARM_END_LEFT_FRONT, - /* 06 */ BIGOKUTA_LIMB_ARM_BASE_RIGHT_BACK, - /* 07 */ BIGOKUTA_LIMB_ARM_END_RIGHT_BACK, - /* 08 */ BIGOKUTA_LIMB_ARM_BASE_LEFT_BACK, - /* 09 */ BIGOKUTA_LIMB_ARM_END_LEFT_BACK, - /* 10 */ BIGOKUTA_LIMB_HEAD, - /* 11 */ BIGOKUTA_LIMB_TENTACLE_BASE_LEFT, - /* 12 */ BIGOKUTA_LIMB_TENTACLE_TIP_LEFT, - /* 13 */ BIGOKUTA_LIMB_TENTACLE_BASE_RIGHT, - /* 14 */ BIGOKUTA_LIMB_TENTACLE_TIP_RIGHT, - /* 15 */ BIGOKUTA_LIMB_WEAK_POINT_LEFT, - /* 16 */ BIGOKUTA_LIMB_WEAK_POINT_RIGHT, - /* 17 */ BIGOKUTA_LIMB_SNOUT_CENTER, - /* 18 */ BIGOKUTA_LIMB_SNOUT_RIGHT, - /* 19 */ BIGOKUTA_LIMB_SNOUT_LEFT, - /* 20 */ BIGOKUTA_LIMB_MAX -} ObjectBigokutaLimbs; - typedef struct EnBigokuta { /* 0x000 */ Actor actor; /* 0x144 */ EnBigokutaUnkFunc unkFunc; // possibly something to do with photographing @@ -39,7 +16,7 @@ typedef struct EnBigokuta { /* 0x18C */ EnBigokutaActionFunc actionFunc; /* 0x190 */ u8 drawDmgEffType; /* 0x192 */ s16 timer; - /* 0x194 */ s16 camId; + /* 0x194 */ s16 subCamId; /* 0x196 */ s16 cutscene; /* 0x198 */ Vec3s jointTable[BIGOKUTA_LIMB_MAX]; /* 0x210 */ Vec3s morphTable[BIGOKUTA_LIMB_MAX]; @@ -48,8 +25,8 @@ typedef struct EnBigokuta { /* 0x290 */ f32 drawDmgEffFrozenSteamScale; // only affects DRAWEFFECT_ICE /* 0x294 */ Vec3f playerPos; /* 0x2A0 */ Vec3f playerHoldPos; - /* 0x2AC */ Vec3f camAt; - /* 0x2B8 */ Vec3f camEye; + /* 0x2AC */ Vec3f subCamAt; + /* 0x2B8 */ Vec3f subCamEye; /* 0x2C4 */ Vec3f limbPos[13]; /* 0x360 */ ColliderCylinder shellCollider; /* 0x3AC */ ColliderCylinder bodyCollider; 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 087328c4d..6ba8eac96 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -271,14 +271,14 @@ void EnBigpo_UpdateSpin(EnBigpo* this) { void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, PlayState* play) { Camera* subCam; - if (this->cutsceneSubCamId != CAM_ID_MAIN) { - subCam = Play_GetCamera(play, this->cutsceneSubCamId); + if (this->subCamId != SUB_CAM_ID_DONE) { + subCam = Play_GetCamera(play, this->subCamId); subCam->eye.y -= this->actor.velocity.y; if (this->actor.velocity.y > 0.0f) { subCam->eye.x -= 1.5f * Math_SinS(this->actor.yawTowardsPlayer); subCam->eye.z -= 1.5f * Math_CosS(this->actor.yawTowardsPlayer); } - Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCam->eye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } } @@ -303,7 +303,7 @@ void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_Start(this->actor.cutscene, &this->actor); func_800B724C(play, &this->actor, 7); - this->cutsceneSubCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); if (this->actor.params == ENBIGPO_REGULAR) { // and SUMMONED, got switched earlier EnBigpo_SpawnCutsceneStage1(this, play); } else { // ENBIGPO_REVEALEDFIRE @@ -332,13 +332,13 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, PlayState* play) { this->actor.scale.y = 0.015f; this->actor.scale.z = 0.0f; - if (this->cutsceneSubCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { Vec3f subCamEye; subCamEye.x = ((this->actor.world.pos.x - this->fires[0].pos.x) * 1.8f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = ((this->actor.world.pos.z - this->fires[0].pos.z) * 1.8f) + this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_SpawnCutsceneStage2; } @@ -459,9 +459,9 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->idleTimer--; if (this->idleTimer == 0) { - subCam = Play_GetCamera(play, this->cutsceneSubCamId); + subCam = Play_GetCamera(play, this->subCamId); Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); - this->cutsceneSubCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; if (this->actor.params == ENBIGPO_SUMMONED) { dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); if (dampe != NULL) { @@ -953,12 +953,11 @@ void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, PlayState* play) { EnBigpo_SetupFlameCircleCutscene(firePo); } - // Setup sub camera - if (this->cutsceneSubCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { subCamEye.x = (Math_SinS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = (Math_CosS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->cutsceneSubCamId, &this->actor.focus.pos, &subCamEye); + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_DoNothing; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index 36762f45d..248c9356c 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -35,7 +35,7 @@ typedef struct EnBigpo { /* 0x208 */ s16 unk208; // facing rotY? /* 0x20A */ s16 rotVelocity; /* 0x20C */ s16 unk20C; // is this counting the number of frames the player is ztargeting them? - /* 0x20E */ s16 cutsceneSubCamId; + /* 0x20E */ s16 subCamId; /* 0x210 */ s16 switchFlags; /* 0x212 */ s16 hoverHeightCycleTimer; // sin wave up and down bobbing /* 0x214 */ f32 fireRadius; // distance from center during conjunction cutscene diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 69686feab..6f48cdb7a 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -153,7 +153,7 @@ static Vtx sBigslimeTargetVtx[BIGSLIME_NUM_VTX] = { * Purpose: indices to calculate/update normal vector for lighting calculations * "EnBigslimeTri" struct based on "Tri" struct from gbi.h, but without the flag */ -static EnBigslimeTri sEnbigslimeTri[BIGSLIME_NUM_FACES] = { +static EnBigslimeTri sBigslimeTri[BIGSLIME_NUM_FACES] = { { 0, 2, 1 }, { 1, 7, 6 }, { 1, 2, 7 }, { 2, 8, 7 }, { 6, 17, 16 }, { 6, 7, 17 }, { 8, 19, 18 }, { 7, 8, 18 }, { 7, 18, 17 }, { 9, 21, 20 }, { 0, 3, 2 }, { 2, 9, 8 }, { 2, 3, 9 }, { 3, 10, 9 }, { 8, 20, 19 }, { 8, 9, 20 }, { 10, 22, 21 }, { 9, 10, 21 }, @@ -436,13 +436,13 @@ void EnBigslime_UpdateSurfaceNorm(EnBigslime* this) { } for (i = 0; i < BIGSLIME_NUM_FACES; i++) { - dynamicVtx0 = &sBigslimeDynamicVtx[this->dynamicVtxState][sEnbigslimeTri[i].v[0]]; - dynamicVtx12 = &sBigslimeDynamicVtx[this->dynamicVtxState][sEnbigslimeTri[i].v[1]]; + dynamicVtx0 = &sBigslimeDynamicVtx[this->dynamicVtxState][sBigslimeTri[i].v[0]]; + dynamicVtx12 = &sBigslimeDynamicVtx[this->dynamicVtxState][sBigslimeTri[i].v[1]]; vecTriEdge1.x = dynamicVtx12->n.ob[0] - dynamicVtx0->n.ob[0]; vecTriEdge1.y = dynamicVtx12->n.ob[1] - dynamicVtx0->n.ob[1]; vecTriEdge1.z = dynamicVtx12->n.ob[2] - dynamicVtx0->n.ob[2]; - dynamicVtx12 = &sBigslimeDynamicVtx[this->dynamicVtxState][sEnbigslimeTri[i].v[2]]; + dynamicVtx12 = &sBigslimeDynamicVtx[this->dynamicVtxState][sBigslimeTri[i].v[2]]; vecTriEdge2.x = dynamicVtx12->n.ob[0] - dynamicVtx0->n.ob[0]; vecTriEdge2.y = dynamicVtx12->n.ob[1] - dynamicVtx0->n.ob[1]; vecTriEdge2.z = dynamicVtx12->n.ob[2] - dynamicVtx0->n.ob[2]; @@ -450,9 +450,9 @@ void EnBigslime_UpdateSurfaceNorm(EnBigslime* this) { Math3D_CrossProduct(&vecTriEdge1, &vecTriEdge2, &vecTriNorm); EnBigslime_Vec3fNormalize(&vecTriNorm); - Math_Vec3f_Sum(&vtxNorm[sEnbigslimeTri[i].v[0]], &vecTriNorm, &vtxNorm[sEnbigslimeTri[i].v[0]]); - Math_Vec3f_Sum(&vtxNorm[sEnbigslimeTri[i].v[1]], &vecTriNorm, &vtxNorm[sEnbigslimeTri[i].v[1]]); - Math_Vec3f_Sum(&vtxNorm[sEnbigslimeTri[i].v[2]], &vecTriNorm, &vtxNorm[sEnbigslimeTri[i].v[2]]); + Math_Vec3f_Sum(&vtxNorm[sBigslimeTri[i].v[0]], &vecTriNorm, &vtxNorm[sBigslimeTri[i].v[0]]); + Math_Vec3f_Sum(&vtxNorm[sBigslimeTri[i].v[1]], &vecTriNorm, &vtxNorm[sBigslimeTri[i].v[1]]); + Math_Vec3f_Sum(&vtxNorm[sBigslimeTri[i].v[2]], &vecTriNorm, &vtxNorm[sBigslimeTri[i].v[2]]); } for (i = 0; i < BIGSLIME_NUM_VTX; i++) { @@ -842,10 +842,10 @@ void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, PlayState* play) { void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { Camera* subCam; - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); - this->subCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); func_800B724C(play, &this->actor, 6); @@ -1018,7 +1018,7 @@ void EnBigslime_SetupMoveOnCeiling(EnBigslime* this) { this->actor.gravity = 0.0f; this->actor.velocity.y = 20.0f; - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->actor.speedXZ = 0.0f; this->ceilingMoveTimer = 20; } else { @@ -1042,7 +1042,7 @@ void EnBigslime_MoveOnCeiling(EnBigslime* this, PlayState* play) { EnBigslime_Scale(this, pitch, 0.04f, 0.04f); EnBigslime_UpdateWavySurface(this); - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (this->ceilingMoveTimer == 0) { EnBigslime_EndCutscene(this, play); this->ceilingMoveTimer = 320; @@ -2545,7 +2545,7 @@ void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { func_800B724C(play, &this->actor, 7); } - this->subCamId = ActorCutscene_GetCurrentCamera(this->cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->cutscene); if (this->actor.colChkInfo.health == 0) { EnBigslime_SetupCutsceneDefeat(this, play); } else if ((this->actionFuncStored == EnBigslime_DamageGekko) || @@ -3053,7 +3053,7 @@ void EnBigslime_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultZero(&this->limbPos[limbPosIndex[limbIndex]]); } - if (limbIndex == GEKKO_LIMB_R_ANKLE) { + if (limbIndex == GEKKO_LIMB_RIGHT_ANKLE) { Matrix_MultVec3f(&rightFootOffsetRef, &rightFootOffset); this->gekkoCollider.dim.pos.y = rightFootOffset.y; } 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 c3d0691e7..a84e9e430 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 @@ -5,7 +5,6 @@ */ #include "z_en_bji_01.h" -#include "objects/object_bji/object_bji.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -90,7 +89,7 @@ void func_809CCE98(EnBji01* this, PlayState* play) { void func_809CCEE8(EnBji01* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x444); - if (this->actor.params == ENBJI01_PARAMS_DEFAULT) { + if (this->actor.params == SHIKASHI_TYPE_DEFAULT) { if ((this->actor.xzDistToPlayer <= 60.0f) && (this->actor.playerHeightRel <= 10.0f)) { this->actor.flags |= ACTOR_FLAG_10000; } else { @@ -99,7 +98,7 @@ void func_809CCEE8(EnBji01* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_809CD028(this, play); } else { if (this->moonsTear != NULL) { @@ -118,8 +117,8 @@ void func_809CD028(EnBji01* this, PlayState* play) { f32 timeBeforeMoonCrash; switch (this->actor.params) { - case ENBJI01_PARAMS_DEFAULT: - case ENBJI01_PARAMS_FINISHED_CONVERSATION: + case SHIKASHI_TYPE_DEFAULT: + case SHIKASHI_TYPE_FINISHED_CONVERSATION: switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: if (gSaveContext.save.weekEventReg[17] & 0x10) { @@ -154,7 +153,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { break; } break; - case ENBJI01_PARAMS_LOOKED_THROUGH_TELESCOPE: + case SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE: switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: if (gSaveContext.save.weekEventReg[74] & 0x80) { @@ -198,17 +197,17 @@ void func_809CD028(EnBji01* this, PlayState* play) { void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x444); func_809CCDE0(this, play); if (this->actor.shape.rot.y == this->actor.yawTowardsPlayer) { Message_StartTextbox(play, this->textId, &this->actor); } break; - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; - this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; + this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); @@ -233,7 +232,7 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { } } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; switch (play->msgCtx.currentTextId) { @@ -276,14 +275,14 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { case 0x5F8: func_801477B4(play); this->actor.flags &= ~ACTOR_FLAG_10000; - this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; + this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; func_809CCE98(this, play); break; } } break; - case 6: - this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION; + case TEXT_STATE_DONE: + this->actor.params = SHIKASHI_TYPE_FINISHED_CONVERSATION; this->actor.flags &= ~ACTOR_FLAG_10000; func_809CCE98(this, play); break; @@ -330,8 +329,8 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { EnBji01* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_bji_Skel_00578C, &object_bji_Anim_000FDC, this->jointTable, - this->morphTable, BJI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gShikashiSkel, &object_bji_Anim_000FDC, this->jointTable, + this->morphTable, SHIKASHI_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -346,14 +345,14 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { switch (gSaveContext.save.entranceIndex) { case 0x4C00: /* Observatory from ECT */ case 0x4C10: /* Observatory from Termina Field door */ - this->actor.params = ENBJI01_PARAMS_DEFAULT; + this->actor.params = SHIKASHI_TYPE_DEFAULT; func_809CCE98(this, play); break; case 0x4C20: /* Observatory from Termina Field telescope */ this->actor.flags |= ACTOR_FLAG_10000; func_801A5BD0(0); Audio_QueueSeqCmd(0xE0000100); - this->actor.params = ENBJI01_PARAMS_LOOKED_THROUGH_TELESCOPE; + this->actor.params = SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE; func_809CCE98(this, play); break; default: @@ -374,7 +373,7 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { s32 pad; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, (Actor*)this, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { @@ -394,20 +393,20 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBji01* this = THIS; - if ((limbIndex == BJI_LIMB_NONE) && ((play->gameplayFrames % 2) != 0)) { + if ((limbIndex == SHIKASHI_LIMB_NONE) && ((play->gameplayFrames % 2) != 0)) { *dList = NULL; } - if (limbIndex == BJI_LIMB_NONE) { + if (limbIndex == SHIKASHI_LIMB_NONE) { rot->x = rot->x; rot->y = rot->y; rot->z = rot->z; } switch (limbIndex) { - case BJI_LIMB_TORSO: + case SHIKASHI_LIMB_TORSO: rot->x += this->torsoXRotStep; rot->z += this->torsoZRotStep; break; - case BJI_LIMB_HEAD: + case SHIKASHI_LIMB_HEAD: rot->x += this->headXRotStep; rot->z += this->headZRotStep; break; @@ -421,7 +420,7 @@ void EnBji01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro Vec3f sp20; s32 temp_f4 = 0; - if (limbIndex == BJI_LIMB_HEAD) { + if (limbIndex == SHIKASHI_LIMB_HEAD) { Math_Vec3f_Copy(&sp20, &D_809CDCC8); sp20.x += temp_f4 * 0.1f; sp20.y += temp_f4 * 0.1f; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h index 113db6a38..ac738bc71 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h @@ -3,44 +3,25 @@ #include "global.h" #include "overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h" +#include "objects/object_bji/object_bji.h" struct EnBji01; typedef void (*EnBji01ActionFunc)(struct EnBji01*, PlayState*); typedef enum { - /* 00 */ BJI_LIMB_NONE, - /* 01 */ BJI_LIMB_ROOT, - /* 02 */ BJI_LIMB_THIGH_LEFT, - /* 03 */ BJI_LIMB_LEG_LEFT, - /* 04 */ BJI_LIMB_FOOT_LEFT, - /* 05 */ BJI_LIMB_THIGH_RIGHT, - /* 06 */ BJI_LIMB_LEG_RIGHT, - /* 07 */ BJI_LIMB_FOOT_RIGHT, - /* 08 */ BJI_LIMB_TORSO, - /* 09 */ BJI_LIMB_ARM_LEFT, - /* 10 */ BJI_LIMB_FOREARM_LEFT, - /* 11 */ BJI_LIMB_HAND_LEFT, - /* 12 */ BJI_LIMB_ARM_RIGHT, - /* 13 */ BJI_LIMB_FOREARM_RIGHT, - /* 14 */ BJI_LIMB_HAND_RIGHT, - /* 15 */ BJI_LIMB_HEAD, - /* 16 */ BJI_LIMB_MAX -} ObjectBjiLimbs; - -typedef enum { - /* 00 */ ENBJI01_PARAMS_DEFAULT, - /* 01 */ ENBJI01_PARAMS_FINISHED_CONVERSATION, - /* 03 */ ENBJI01_PARAMS_LOOKED_THROUGH_TELESCOPE = 3 -} EnBji01Params; + /* 0 */ SHIKASHI_TYPE_DEFAULT, + /* 1 */ SHIKASHI_TYPE_FINISHED_CONVERSATION, + /* 3 */ SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE = 3 +} ShikashiType; typedef struct EnBji01 { /* 0x000 */ Actor actor; /* 0x144 */ EnBji01ActionFunc actionFunc; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ Vec3s jointTable[BJI_LIMB_MAX]; - /* 0x238 */ Vec3s morphTable[BJI_LIMB_MAX]; + /* 0x1D8 */ Vec3s jointTable[SHIKASHI_LIMB_MAX]; + /* 0x238 */ Vec3s morphTable[SHIKASHI_LIMB_MAX]; /* 0x298 */ s32 animationIndex; /* 0x29C */ s16 eyeTexIndex; /* 0x29E */ s16 blinkSeqIndex; diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index 3400e5f52..91c6d6a4f 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -15,10 +15,37 @@ void EnBjt_Destroy(Actor* thisx, PlayState* play); void EnBjt_Update(Actor* thisx, PlayState* play); void EnBjt_Draw(Actor* thisx, PlayState* play); -void func_80BFDA48(EnBjt* this, PlayState* play); -void func_80BFDAE8(EnBjt* this, PlayState* play); +void EnBjt_Talk(EnBjt* this, PlayState* play); +void EnBjt_FollowSchedule(EnBjt* this, PlayState* play); + +#define TOILET_HAND_STATE_TALKING (1 << 3) // Actually talking to Player +#define TOILET_HAND_STATE_TEXTBOX (1 << 4) // Whenever a textbox is on screen +#define TOILET_HAND_STATE_APPEARING (1 << 7) // Appearing +#define TOILET_HAND_STATE_VANISHING (1 << 8) // Vanishing +#define TOILET_HAND_STATE_VISIBLE (1 << 9) // Out + +typedef enum { + /* 0 */ TOILET_HAND_SCH_NONE, + /* 1 */ TOILET_HAND_SCH_AVAILABLE +} ToiletHandScheduleResult; + +static u8 sScheduleScript[] = { + /* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_YADOYA, 0x11 - 0x04), + /* 0x04 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 0, 6, 0, 0x0B - 0x0A), + /* 0x0A */ SCHEDULE_CMD_RET_NONE(), + /* 0x0B */ SCHEDULE_CMD_RET_TIME(0, 0, 6, 0, TOILET_HAND_SCH_AVAILABLE), + /* 0x11 */ SCHEDULE_CMD_RET_NONE(), +}; + +static u8 sMsgEventScript[] = { + 0x0E, 0x29, 0x48, 0x0C, 0x0E, 0x00, 0xFF, 0x2B, 0x00, 0x00, 0x00, 0x52, 0x00, 0x5F, 0x2C, 0x29, 0x4A, 0x0C, 0x2F, + 0x00, 0x00, 0x0C, 0x15, 0x09, 0x00, 0x00, 0x0E, 0x29, 0x4B, 0x0C, 0x15, 0x09, 0x00, 0x00, 0x0E, 0x29, 0x4C, 0x0C, + 0x12, 0x00, 0x49, 0x08, 0x00, 0x1D, 0x09, 0x00, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x00, 0x13, 0x00, 0x0C, 0x2F, 0x00, + 0x00, 0x2E, 0x2D, 0x00, 0x28, 0x2D, 0x00, 0x0D, 0x0C, 0x11, 0x49, 0x08, 0x11, 0x5A, 0x80, 0x10, 0x09, 0x00, 0x00, + 0x06, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x02, 0x2F, 0x00, 0x00, 0x2E, 0x2D, 0x00, 0x0D, 0x0C, 0x11, 0x5A, 0x80, + 0x10, 0x2C, 0x29, 0x49, 0x0C, 0x2F, 0x00, 0x00, 0x0C, 0x2D, 0x00, 0x0D, 0x12, 0x10, 0x2D, 0x00, 0x0D, 0x12, 0x10, +}; -#if 0 const ActorInit En_Bjt_InitVars = { ACTOR_EN_BJT, ACTORCAT_NPC, @@ -31,49 +58,407 @@ const ActorInit En_Bjt_InitVars = { (ActorFunc)EnBjt_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BFDF48 = { - { 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, + }, { 10, 68, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80BFDF74 = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -#endif +typedef enum { + /* -1 */ TOILET_HAND_ANIM_NONE = -1, + /* 0 */ TOILET_HAND_ANIM_WAITING, + /* 1 */ TOILET_HAND_ANIM_WAITING_MORPH, // Same as TOILET_HAND_ANIM_WAITING, but with morph frames + /* 2 */ TOILET_HAND_ANIM_WAGGING_FINGER, // Wrong + /* 3 */ TOILET_HAND_ANIM_THUMBS_UP, // Right + /* 4 */ TOILET_HAND_ANIM_OPEN_HAND, + /* 5 */ TOILET_HAND_ANIM_FIST // i.e. holding the reward +} ToiletHandAnimations; -extern ColliderCylinderInit D_80BFDF48; -extern CollisionCheckInfoInit2 D_80BFDF74; +static AnimationInfoS sAnimationInfos[] = { + /* 0 */ { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + /* 1 */ { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + /* 2 */ { &gToiletHandWaggingFingerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + /* 3 */ { &gToiletHandThumbsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + /* 4 */ { &gToiletHandOpenHandAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + /* 5 */ { &gToiletHandFistAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +}; -extern UNK_TYPE D_06002390; +void EnBjt_UpdateSkelAnime(EnBjt* this) { + this->skelAnime.playSpeed = this->animPlaySpeed; + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD2E0.s") +s32 EnBjt_ChangeAnimation(EnBjt* this, s32 animIndex) { + s32 changeAnim = false; + s32 changed = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD30C.s") + if ((animIndex == TOILET_HAND_ANIM_WAITING) || (animIndex == TOILET_HAND_ANIM_WAITING_MORPH)) { + if (!((this->curAnimIndex == TOILET_HAND_ANIM_WAITING) || + (this->curAnimIndex == TOILET_HAND_ANIM_WAITING_MORPH))) { + changeAnim = true; + } + } else if (this->curAnimIndex != animIndex) { + changeAnim = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD3A4.s") + if (changeAnim) { + this->curAnimIndex = animIndex; + changed = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfos, animIndex); + this->animPlaySpeed = this->skelAnime.playSpeed; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD434.s") + return changed; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD4FC.s") +void EnBjt_UpdateCollision(EnBjt* this, PlayState* play) { + static Vec3f sColliderBasePos = { 0.0f, 8.0f, 10.0f }; + s32 pad; + Vec3f pos; + f32 height; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD5E4.s") + if (this->stateFlags & (TOILET_HAND_STATE_APPEARING | TOILET_HAND_STATE_VISIBLE)) { + Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &sColliderBasePos, &pos); + Math_Vec3f_ToVec3s(&this->collider.dim.pos, &pos); + height = this->actor.focus.pos.y - this->actor.world.pos.y; + this->collider.dim.height = height; + this->collider.dim.radius = 32; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD6BC.s") +s32 EnBjt_TakeItem(s32 exchangeItem) { + switch (exchangeItem) { + case EXCH_ITEM_LETTER_TO_KAFEI: + Inventory_DeleteItem(ITEM_LETTER_TO_KAFEI, SLOT(ITEM_LETTER_TO_KAFEI)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD8F0.s") + case EXCH_ITEM_DEED_SWAMP: + Inventory_DeleteItem(ITEM_DEED_SWAMP, SLOT(ITEM_DEED_SWAMP)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFD984.s") + case EXCH_ITEM_DEED_MOUNTAIN: + Inventory_DeleteItem(ITEM_DEED_MOUNTAIN, SLOT(ITEM_DEED_MOUNTAIN)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFDA48.s") + case EXCH_ITEM_DEED_OCEAN: + Inventory_DeleteItem(ITEM_DEED_OCEAN, SLOT(ITEM_DEED_OCEAN)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/func_80BFDAE8.s") + case EXCH_ITEM_DEED_LAND: + Inventory_DeleteItem(ITEM_DEED_LAND, SLOT(ITEM_DEED_LAND)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/EnBjt_Init.s") + case EXCH_ITEM_LETTER_MAMA: + Inventory_DeleteItem(ITEM_LETTER_MAMA, SLOT(ITEM_LETTER_MAMA)); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/EnBjt_Destroy.s") + default: + break; + } + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/EnBjt_Update.s") +#define FULLY_GROWN_SCALE 0.017f -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bjt/EnBjt_Draw.s") +/** + * @return boolean true if scale is set to final value + */ +s32 EnBjt_Appear(EnBjt* this) { + s32 finished = false; + + if (!this->playedSfx) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_HAND_APPEAR); + this->playedSfx = true; + } + + Math_ApproachF(&this->actor.scale.x, FULLY_GROWN_SCALE, 0.21f, 0.3f); + if ((FULLY_GROWN_SCALE - this->actor.scale.x) < FULLY_GROWN_SCALE / 100.0f) { + this->actor.scale.x = FULLY_GROWN_SCALE; + this->stateFlags |= TOILET_HAND_STATE_VISIBLE; + this->stateFlags &= ~TOILET_HAND_STATE_APPEARING; + finished = true; + } + this->heightOffset = (this->actor.scale.x / FULLY_GROWN_SCALE) * 4.0f; + this->actor.world.pos.y = this->actor.home.pos.y + this->heightOffset; + Actor_SetScale(&this->actor, this->actor.scale.x); + + return finished; +} + +/** + * @return boolean true if scale is set to final value + */ +s32 EnBjt_Vanish(EnBjt* this) { + s32 finished = false; + + if (!this->playedSfx) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_HAND_VANISH); + this->playedSfx = true; + } + + Math_ApproachF(&this->actor.scale.x, 0.0f, 0.21f, 0.3f); + if (this->actor.scale.x < FULLY_GROWN_SCALE / 100.0f) { + this->actor.scale.x = 0.0f; + this->stateFlags &= ~TOILET_HAND_STATE_VANISHING; + finished = true; + } + this->heightOffset = (this->actor.scale.x / FULLY_GROWN_SCALE) * 4.0f; + this->actor.world.pos.y = this->actor.home.pos.y + this->heightOffset; + Actor_SetScale(&this->actor, this->actor.scale.x); + + return finished; +} + +typedef enum { + /* 0 */ TOILET_HAND_BEHAVIOUR_WAIT_FOR_ITEM, // and check if item is suitable + /* 1 */ TOILET_HAND_BEHAVIOUR_TAKE_ITEM, // take paper and disappear to use it + /* 2 */ TOILET_HAND_BEHAVIOUR_USE_ITEM, // using paper, flushing + /* 3 */ TOILET_HAND_BEHAVIOUR_REAPPEAR, // reappear with reward + /* 4 */ TOILET_HAND_BEHAVIOUR_REWARD_GIVEN, +} ToiletHandBehaviour; + +// msgevent callback/communication. Follow and choose parts of script to run +s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { + Player* player = GET_PLAYER(play); + EnBjt* this = THIS; + s32 itemAP; + s32 scriptBranch = 0; + + switch (this->behaviour) { + case TOILET_HAND_BEHAVIOUR_WAIT_FOR_ITEM: + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + if (!Message_ShouldAdvance(play)) { + break; + } + // Fallthrough + case TEXT_STATE_16: + itemAP = func_80123810(play); + if ((itemAP == EXCH_ITEM_DEED_LAND) || (itemAP == EXCH_ITEM_LETTER_TO_KAFEI) || + (itemAP == EXCH_ITEM_DEED_SWAMP) || (itemAP == EXCH_ITEM_DEED_MOUNTAIN) || + (itemAP == EXCH_ITEM_DEED_OCEAN) || (itemAP == EXCH_ITEM_LETTER_MAMA)) { + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAITING_MORPH); + this->playedSfx = false; + this->behaviour++; + scriptBranch = 1; // Right item + } else if (itemAP < 0) { + this->playedSfx = false; + this->behaviour++; + scriptBranch = 3; // Not showing item + } else if (itemAP != 0) { + this->playedSfx = false; + this->behaviour++; + scriptBranch = 2; // Wrong item + } + break; + + default: + break; + } + break; + + case TOILET_HAND_BEHAVIOUR_TAKE_ITEM: + if (player->exchangeItemId != EXCH_ITEM_NONE) { + EnBjt_TakeItem(player->exchangeItemId); + player->exchangeItemId = EXCH_ITEM_NONE; + } + if (EnBjt_Vanish(this)) { + this->timer = 60; + this->behaviour++; + scriptBranch = 1; // Right item + } + break; + + case TOILET_HAND_BEHAVIOUR_USE_ITEM: + if (DECR(this->timer) == 0) { + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_FIST); // change while not visible + this->playedSfx = false; + this->behaviour++; + } else if (this->timer == 10) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_TOILET_WATER); + } + break; + + case TOILET_HAND_BEHAVIOUR_REAPPEAR: + if (EnBjt_Appear(this)) { + this->behaviour++; + scriptBranch = 1; // Right item + } + break; + + case TOILET_HAND_BEHAVIOUR_REWARD_GIVEN: + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_OPEN_HAND); + this->behaviour++; + scriptBranch = 1; // Right item + break; + + default: + break; + } + + return scriptBranch; +} + +s32 EnBjt_CheckTalk(EnBjt* this, PlayState* play) { + s32 ret = false; + + if ((this->stateFlags & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->stateFlags |= TOILET_HAND_STATE_TALKING; + SubS_UpdateFlags(&this->stateFlags, 0, 7); + this->msgEventCallback = EnBjt_ChooseBehaviour; + this->behaviour = 0; + this->actionFunc = EnBjt_Talk; + ret = true; + } + return ret; +} + +s32 EnBjt_ChooseAnimation(EnBjt* this, PlayState* play) { + Player* player = GET_PLAYER(play); + u16 curTextId = play->msgCtx.currentTextId; + + if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400)) { // Talking, show item? + this->stateFlags |= TOILET_HAND_STATE_TEXTBOX; + if (this->textId != curTextId) { + switch (curTextId) { + case 0x2949: // Wrong item + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAGGING_FINGER); + break; + + case 0x294A: // Right item + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_THUMBS_UP); + break; + + default: + break; + } + } + this->textId = curTextId; + } else if (this->stateFlags & TOILET_HAND_STATE_TEXTBOX) { + this->stateFlags &= ~TOILET_HAND_STATE_TEXTBOX; + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAITING); + } + return 0; +} + +// Action function, based on msgEvent +void EnBjt_Talk(EnBjt* this, PlayState* play) { + s16 yaw = this->actor.yawTowardsPlayer; + + // TODO: Casting to remove warning for now + if (func_8010BF58(&this->actor, play, (s32)sMsgEventScript, this->msgEventCallback, &this->msgEventArg4)) { + this->actor.flags &= ~ACTOR_FLAG_100; + SubS_UpdateFlags(&this->stateFlags, 3, 7); + this->stateFlags &= ~TOILET_HAND_STATE_TALKING; + this->msgEventArg4 = 0; + this->actionFunc = EnBjt_FollowSchedule; + } else { + Math_ApproachS(&this->actor.shape.rot.y, yaw, 4, 0x2AA8); + } +} + +// Change state based on schedule and stateFlags +void EnBjt_FollowSchedule(EnBjt* this, PlayState* play) { + ScheduleOutput scheduleOutput; + + if (!Schedule_RunScript(play, sScheduleScript, &scheduleOutput)) { + scheduleOutput.result = TOILET_HAND_SCH_NONE; + } + if (scheduleOutput.result == TOILET_HAND_SCH_AVAILABLE) { + if (this->stateFlags & TOILET_HAND_STATE_APPEARING) { + if (EnBjt_Appear(this)) { + SubS_UpdateFlags(&this->stateFlags, 3, 7); + } + } else if (this->stateFlags & TOILET_HAND_STATE_VANISHING) { + EnBjt_Vanish(this); + } else if (this->stateFlags & TOILET_HAND_STATE_VISIBLE) { + // Vanish if player goes too far away or heart piece given + if ((fabsf(this->actor.playerHeightRel) > 70.0f) || (this->actor.xzDistToPlayer > 140.0f) || + (gSaveContext.save.weekEventReg[90] & 0x80)) { + SubS_UpdateFlags(&this->stateFlags, 0, 7); + this->playedSfx = false; + this->stateFlags &= ~TOILET_HAND_STATE_VISIBLE; + this->stateFlags |= TOILET_HAND_STATE_VANISHING; + } + } else { + // Appear if player approaches and heart piece not given + if ((fabsf(this->actor.playerHeightRel) < 20.0f) && (this->actor.xzDistToPlayer < 70.0f) && + !(gSaveContext.save.weekEventReg[90] & 0x80)) { + this->stateFlags |= TOILET_HAND_STATE_APPEARING; + this->playedSfx = false; + } + } + this->scheduleResult = scheduleOutput.result; + } else { + this->actor.flags |= ACTOR_FLAG_8000000; + Actor_SetScale(&this->actor, 0.0f); + this->stateFlags = 0; + this->msgEventCallback = NULL; + this->scheduleResult = TOILET_HAND_SCH_NONE; + } +} + +void EnBjt_Init(Actor* thisx, PlayState* play) { + EnBjt* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gToiletHandSkel, NULL, this->jointTable, this->morphTable, + TOILET_HAND_LIMB_MAX); + + this->curAnimIndex = TOILET_HAND_ANIM_NONE; + EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAITING); + + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + this->actor.flags |= ACTOR_FLAG_8000000; + Actor_SetScale(&this->actor, 0.0f); + + this->scheduleResult = TOILET_HAND_SCH_NONE; + this->stateFlags = 0; + this->actionFunc = EnBjt_FollowSchedule; +} + +void EnBjt_Destroy(Actor* thisx, PlayState* play) { +} + +void EnBjt_Update(Actor* thisx, PlayState* play) { + EnBjt* this = THIS; + + EnBjt_CheckTalk(this, play); + this->actionFunc(this, play); + EnBjt_ChooseAnimation(this, play); + + if (this->scheduleResult != TOILET_HAND_SCH_NONE) { + EnBjt_UpdateSkelAnime(this); + func_8013C964(&this->actor, play, 60.0f, 10.0f, EXCH_ITEM_NONE, this->stateFlags & 7); + Actor_SetFocus(&this->actor, 26.0f); + EnBjt_UpdateCollision(this, play); + } +} + +void EnBjt_Draw(Actor* thisx, PlayState* play) { + EnBjt* this = THIS; + + if (this->scheduleResult != TOILET_HAND_SCH_NONE) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + NULL, NULL, &this->actor); + } +} diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h index 33bc33bad..d1aabb999 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h @@ -2,18 +2,36 @@ #define Z_EN_BJT_H #include "global.h" +#include "objects/object_bjt/object_bjt.h" struct EnBjt; typedef void (*EnBjtActionFunc)(struct EnBjt*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnBjt { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnBjtActionFunc actionFunc; - /* 0x18C */ char unk_18C[0xD0]; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ u8 scheduleResult; + /* 0x1DC */ s32 msgEventArg4; + /* 0x1E0 */ Vec3s jointTable[TOILET_HAND_LIMB_MAX]; + /* 0x20A */ Vec3s morphTable[TOILET_HAND_LIMB_MAX]; + /* 0x234 */ u16 stateFlags; + /* 0x236 */ u16 textId; + /* 0x238 */ f32 animPlaySpeed; + /* 0x23C */ f32 heightOffset; + /* 0x240 */ s16 behaviour; + /* 0x242 */ s16 timer; + /* 0x244 */ UNK_TYPE1 unk_244[4]; + /* 0x248 */ s32 playedSfx; // to only play once + /* 0x24C */ MsgEventFunc msgEventCallback; + /* 0x250 */ s32 curAnimIndex; + /* 0x254 */ UNK_TYPE1 pad_254[8]; } EnBjt; // size = 0x25C + extern const ActorInit En_Bjt_InitVars; #endif // Z_EN_BJT_H diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 81578e3f6..b87f43b37 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -237,7 +237,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { } } - if ((this->unk_2BC == 0) && (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((this->unk_2BC == 0) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Player* player = GET_PLAYER(play); s32 pad; s32 sp28 = false; @@ -248,7 +248,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { case 0: this->unk_2C0 = 1; D_809C6104 = 1; - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->unk_2D0)), + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->unk_2D0)), &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; @@ -273,7 +273,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { sp28 = true; } else { this->unk_2C0 = 3; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_809C493C(this, 1, 1.0f); D_809C6100 = 1; if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -301,7 +301,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { if (this->unk_2B8 != 2) { ActorCutscene_Stop(this->unk_2D0); } - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_809C493C(this, 1, 1.0f); D_809C6100 = 1; this->actionFunc = func_809C5B1C; @@ -330,12 +330,13 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { void func_809C51B4(EnBomBowlMan* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->msgCtx.unk120B1 == 0) && ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == 6))) { + if ((play->msgCtx.unk120B1 == 0) && + ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x56; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_86; + gSaveContext.nextTransitionType = TRANS_TYPE_03; gSaveContext.save.weekEventReg[75] &= (u8)~0x40; if (player->transformation == PLAYER_FORM_HUMAN) { gSaveContext.save.weekEventReg[84] |= 0x80; @@ -409,7 +410,7 @@ void func_809C5524(EnBomBowlMan* this, PlayState* play) { } void func_809C5598(EnBomBowlMan* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); if ((this->actor.textId == 0x72F) || (this->actor.textId == 0x730)) { this->actor.textId = 0x731; @@ -447,7 +448,8 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A0); if (this->unk_2C2 == 0) { - if ((play->msgCtx.unk120B1 == 0) && ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == 6))) { + if ((play->msgCtx.unk120B1 == 0) && + ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { this->unk_2C2 = 1; func_809C4B6C(this); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -493,7 +495,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } void func_809C59A4(EnBomBowlMan* this, PlayState* play) { - Actor_PickUp(&this->actor, play, GI_50, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); this->unk_29C = 1; this->actionFunc = func_809C59F0; } @@ -510,7 +512,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) { func_800B8500(&this->actor, play, 400.0f, 400.0f, -1); this->actionFunc = func_809C5AA4; } else { - Actor_PickUp(&this->actor, play, GI_50, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); } } @@ -550,7 +552,7 @@ void func_809C5BA0(EnBomBowlMan* this) { void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { f32 sp2C = this->skelAnime.curFrame; - s32 sp28; + s32 subCam; if ((D_809C6104 != 0) && (this->unk_2F8 != 15)) { func_809C493C(this, 15, 1.0f); @@ -571,13 +573,13 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { } if (this->unk_2F4 == 0) { - sp28 = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->unk_2D2)); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->unk_2D2)); if (D_809C6100 > 5) { Player* player = GET_PLAYER(play); func_801477B4(play); - Camera_SetTargetActor(sp28, &this->unk_2D8[0]->actor); + Camera_SetTargetActor(subCam, &this->unk_2D8[0]->actor); func_809C493C(this, 13, 1.0f); D_809C6100 = 0; if (player->transformation == PLAYER_FORM_HUMAN) { @@ -592,7 +594,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { } else { s32 idx = D_809C6100 - 1; - Camera_SetTargetActor(sp28, &this->unk_2D8[1 + idx]->actor); + Camera_SetTargetActor(subCam, &this->unk_2D8[1 + idx]->actor); } } } diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 10b952244..7d4fbbafb 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -175,7 +175,7 @@ void func_80C038B4(EnBombers* this) { void func_80C039A8(EnBombers* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->unk_2A6 = 5; + this->unk_2A6 = TEXT_STATE_5; switch (player->transformation) { case PLAYER_FORM_HUMAN: @@ -296,7 +296,7 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { if (!Text_GetFaceReaction(play, 0x12)) { func_80C039A8(this, play); } else { - this->unk_2A6 = 5; + this->unk_2A6 = TEXT_STATE_5; this->actor.textId = Text_GetFaceReaction(play, 0x12); } @@ -337,11 +337,11 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { if ((this->unk_2A6 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { sp2A = 0; func_801477B4(play); - this->unk_2A6 = 5; + this->unk_2A6 = TEXT_STATE_5; if ((this->actor.textId == 0x73D) || (this->actor.textId == 0x73E) || (this->actor.textId == 0x73F)) { this->actor.textId = 0x740; - this->unk_2A6 = 4; + this->unk_2A6 = TEXT_STATE_CHOICE; sp2A = 1; } else if (this->actor.textId == 0x740) { if (play->msgCtx.choiceIndex == 0) { @@ -361,7 +361,7 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { sp2A = 1; } else if (this->actor.textId == 0x74B) { this->actor.textId = 0x74C; - this->unk_2A6 = 4; + this->unk_2A6 = TEXT_STATE_CHOICE; sp2A = 1; } else if (this->actor.textId == 0x74C) { if (play->msgCtx.choiceIndex == 1) { @@ -446,7 +446,7 @@ void func_80C04354(EnBombers* this, PlayState* play) { void func_80C043C8(EnBombers* this, PlayState* play) { Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x3E8, 0); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80C042F8(this); } diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 95c413baf..265388ff7 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -146,12 +146,12 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: this->textIdIndex = 1; - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; break; case PLAYER_FORM_DEKU: case PLAYER_FORM_HUMAN: this->textIdIndex = 2; - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; break; } if (this->unk_2AC != 0) { @@ -213,8 +213,8 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { default: break; } - if ((this->unk_2CE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { - if (this->unk_2CE == 0xF) { + if ((this->talkState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if (this->talkState == TEXT_STATE_15) { s32 i; s32 correctDigits; @@ -234,7 +234,7 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { this->actor.textId = sTextIds[this->textIdIndex]; func_80151938(play, this->actor.textId); Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; return; } } @@ -258,7 +258,7 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { this->textIdIndex = 3; this->actor.textId = sTextIds[this->textIdIndex]; func_80151938(play, this->actor.textId); - this->unk_2CE = 0xF; + this->talkState = TEXT_STATE_15; break; case 3: for (j = 0; j < ARRAY_COUNT(this->correctDigitSlots); j++) { @@ -268,16 +268,16 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); this->actor.textId = sTextIds[this->textIdIndex]; func_80151938(play, this->actor.textId); - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; break; case 4: this->textIdIndex = 5; this->actor.textId = sTextIds[this->textIdIndex]; func_80151938(play, this->actor.textId); - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; break; case 6: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80C050B8(this, play); break; } @@ -324,7 +324,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { this->actor.speedXZ = 0.0f; if (fabsf(this->actor.world.rot.y - this->actor.yawTowardsPlayer) < 100.0f) { func_801477B4(play); - this->unk_2CE = 5; + this->talkState = TEXT_STATE_5; this->textIdIndex = 7; EnBombers2_ChangeAnim(this, 6, 1.0f); this->unk_2A8 = 0; diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index a645fe2af..0a62fd704 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -37,7 +37,7 @@ typedef struct EnBombers2 { /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 textIdIndex; /* 0x2C4 */ s16 correctDigitSlots[5]; - /* 0x2CE */ s16 unk_2CE; + /* 0x2CE */ s16 talkState; /* 0x2D0 */ ColliderCylinder collider; } EnBombers2; // size = 0x31C 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 c9f086eb2..75ad8576d 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -581,7 +581,7 @@ void func_80BFF4F4(EnBomjima* this) { } void func_80BFF52C(EnBomjima* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); if (play->msgCtx.choiceIndex == 0) { Player* player = GET_PLAYER(play); @@ -624,7 +624,7 @@ void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (this->unk_2CC <= curFrame) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80BFE494(this, 1, 1.0f); this->actionFunc = func_80BFF754; @@ -729,7 +729,7 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { } void func_80BFFB40(EnBomjima* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80BFE494(this, 15, 1.0f); D_80C009F0 = 100; @@ -759,9 +759,9 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { func_801477B4(play); play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 20; - play->unk_1887F = 0x56; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_86; + gSaveContext.nextTransitionType = TRANS_TYPE_03; ActorCutscene_Stop(this->unk_2D4[1]); } } @@ -916,7 +916,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { break; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->collider.dim.radius = 10; this->collider.dim.height = 30; if ((this->unk_2A0 == 4) || (this->unk_2CA == 1) || ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) { 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 8548cd22b..078988d9d 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -214,7 +214,7 @@ s32 func_80C012FC(EnBomjimb* this, PlayState* play) { Player* player = GET_PLAYER(play); if (!Play_InCsMode(play) && (this->actor.xzDistToPlayer < 40.0f) && - (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 50.0f) && (play->msgCtx.unk11F10 == 0)) { + (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 50.0f) && (play->msgCtx.msgLength == 0)) { this->actor.speedXZ = 0.0f; func_80C02740(this, play); return true; @@ -759,7 +759,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { player->actor.freezeTimer = 3; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); if ((this->unk_2CA == 8) && (gSaveContext.save.bombersCaughtNum >= 5)) { func_80C02CA4(this, play); @@ -778,7 +778,7 @@ void func_80C02BCC(EnBomjimb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 5000, 0); if (this->unk_2C0 == 0) { player->actor.freezeTimer = 3; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->unk_2C0 = 1; player->stateFlags1 &= ~0x10000000; @@ -793,13 +793,13 @@ void func_80C02CA4(EnBomjimb* this, PlayState* play) { play->nextEntranceIndex = play->setupExitList[this->unk_2B2]; gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } else { play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(5); gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x56; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_86; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } gSaveContext.save.weekEventReg[75] |= 0x40; gSaveContext.save.weekEventReg[83] |= 4; 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 81ddc423a..bfc242060 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -218,9 +218,9 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.x = 0; } thisx->shape.rot.x = this->dyna.actor.world.rot.x; - this->getItem = ENBOX_GET_ITEM(thisx); + this->getItemId = ENBOX_GET_ITEM(thisx); - if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItem == GI_NONE) { + if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItemId == GI_NONE) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); @@ -272,7 +272,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; } - if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + if ((this->getItemId == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { this->dyna.actor.flags |= ACTOR_FLAG_10; } @@ -485,10 +485,10 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { func_801A3098(0x2B | 0x900); } - if (this->getItem == GI_STRAY_FAIRY) { + if (this->getItemId == GI_STRAY_FAIRY) { this->movementFlags |= ENBOX_MOVE_0x20; } else { - if ((this->getItem == GI_HEART_PIECE) || (this->getItem == GI_BOTTLE)) { + if ((this->getItemId == GI_HEART_PIECE) || (this->getItemId == GI_BOTTLE)) { Flags_SetCollectible(play, this->collectableFlag); } Flags_SetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)); @@ -498,17 +498,17 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > -50.0f && offset.z < 0.0f && fabsf(offset.y) < 10.0f && fabsf(offset.x) < 20.0f && Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) { - if (((this->getItem == GI_HEART_PIECE) || (this->getItem == GI_BOTTLE)) && + if (((this->getItemId == GI_HEART_PIECE) || (this->getItemId == GI_BOTTLE)) && Flags_GetCollectible(play, this->collectableFlag)) { - this->getItem = GI_RECOVERY_HEART; + this->getItemId = GI_RECOVERY_HEART; } - if ((this->getItem == GI_MASK_CAPTAIN) && (INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN)) { - this->getItem = GI_RECOVERY_HEART; + if ((this->getItemId == GI_MASK_CAPTAIN) && (INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN)) { + this->getItemId = GI_RECOVERY_HEART; } - if ((this->getItem == GI_MASK_GIANT) && (INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT)) { - this->getItem = GI_RECOVERY_HEART; + if ((this->getItemId == GI_MASK_GIANT) && (INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT)) { + this->getItemId = GI_RECOVERY_HEART; } - Actor_PickUpNearby(&this->dyna.actor, play, -this->getItem); + Actor_PickUpNearby(&this->dyna.actor, play, -this->getItemId); } if (Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { EnBox_SetupAction(this, EnBox_Open); @@ -538,7 +538,7 @@ void EnBox_Open(EnBox* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_ELFORG, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, - ((ENBOX_GET_CHEST_FLAG(&this->dyna.actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_CHEST); + STRAY_FAIRY_PARAMS(ENBOX_GET_CHEST_FLAG(&this->dyna.actor), 0, STRAY_FAIRY_TYPE_CHEST)); } else if (this->movementFlags & ENBOX_MOVE_0x40) { this->movementFlags &= ~ENBOX_MOVE_0x40; } @@ -603,7 +603,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) { this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND; EnBox_ClipToGround(this, play); } - if ((this->getItem == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + if ((this->getItemId == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { play->actorCtx.unk5 |= 8; } this->actionFunc(this, play); @@ -615,7 +615,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); } Actor_SetFocus(&this->dyna.actor, 40.0f); - if ((this->getItem == GI_ICE_TRAP) && (this->actionFunc == EnBox_Open) && (this->skelAnime.curFrame > 45.0f) && + if ((this->getItemId == GI_ICE_TRAP) && (this->actionFunc == EnBox_Open) && (this->skelAnime.curFrame > 45.0f) && (this->iceSmokeTimer < 100)) { EnBox_SpawnIceSmoke(this, play); } @@ -633,7 +633,7 @@ void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestBaseOrnateDL); } else if (Actor_IsSmallChest(this)) { - if (this->getItem == GI_KEY_SMALL) { + if (this->getItemId == GI_KEY_SMALL) { gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL); } else { gSPDisplayList((*gfx)++, &gBoxChestBaseDL); @@ -646,7 +646,7 @@ void EnBox_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (this->type == ENBOX_TYPE_BIG_ORNATE) { gSPDisplayList((*gfx)++, &gBoxChestLidOrnateDL); } else if (Actor_IsSmallChest(this)) { - if (this->getItem == GI_KEY_SMALL) { + if (this->getItemId == GI_KEY_SMALL) { gSPDisplayList((*gfx)++, &gBoxChestLidGildedDL); } else { gSPDisplayList((*gfx)++, &gBoxChestLidDL); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index 0ea7fe8de..cd164c924 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -62,7 +62,7 @@ typedef struct EnBox { /* 0x1F4 */ func_80867BDC_a0 unk_1F4; /* 0x218 */ s16 cutsceneIdxA; /* 0x21A */ s16 cutsceneIdxB; - /* 0x21C */ s32 getItem; + /* 0x21C */ s32 getItemId; /* 0x220 */ s32 collectableFlag; } EnBox; // size = 0x224 diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index ef520ce40..3ad9f3bd1 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -579,7 +579,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { } player->actor.speedXZ = 0.0f; - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; @@ -588,13 +588,13 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); this->cameraState = 0; - this->subCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; this->activeTimer = 20; } break; } - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index a0f597229..a9aa59c7b 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -152,7 +152,7 @@ void EnCne01_FinishInit(EnHy* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnCne01_Draw; this->waitingOnInit = false; - if (ENCNE01_GET_PATH(&this->actor) == ENCNE01_NO_PATH) { + if (ENCNE01_GET_PATH(&this->actor) == 0x3F) { this->actionFunc = EnCne01_FaceForward; } else { this->actionFunc = EnCne01_Walk; @@ -175,17 +175,19 @@ void EnCne01_Talk(EnHy* this, PlayState* play) { u8 talkState; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); + talkState = Message_GetState(&play->msgCtx); - this->inMsgState3 = (talkState == 3) ? true : false; + this->inMsgState3 = (talkState == TEXT_STATE_3) ? true : false; switch (talkState) { - case 0: + case TEXT_STATE_NONE: yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); if (yaw < 0x64) { Message_StartTextbox(play, this->textId, NULL); } break; - case 2: + + case TEXT_STATE_CLOSING: this->actor.textId = 0; this->trackTarget = this->prevTrackTarget; this->headRot = this->prevHeadRot; @@ -215,7 +217,7 @@ void EnCne01_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->enHy.actor.flags &= ~ACTOR_FLAG_1; - this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH); + this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH(&this->enHy.actor), 0x3F); this->enHy.waitingOnInit = true; Actor_SetScale(&this->enHy.actor, 0.01f); this->enHy.actionFunc = EnCne01_FinishInit; diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h index c2ce1c861..0b9e1e08b 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h @@ -8,7 +8,6 @@ struct EnCne01; typedef void (*EnCne01ActionFunc)(struct EnCne01*, PlayState*); #define ENCNE01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) -#define ENCNE01_NO_PATH 0x3F typedef struct EnCne01 { /* 0x000 */ EnHy enHy; diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index 9857d9403..54a78442c 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -138,7 +138,7 @@ void func_80AFDE00(EnColMan* this, PlayState* play) { } void EnColMan_SetHeartPieceCollectedAndKill(EnColMan* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[56] |= 2; Actor_MarkForDeath(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index c5dfbb63e..902f01931 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -200,7 +200,7 @@ void EnCow_UpdateAnimation(EnCow* this, PlayState* play) { } void EnCow_TalkEnd(EnCow* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_801477B4(play); this->actionFunc = EnCow_Idle; @@ -224,7 +224,7 @@ void EnCow_GiveMilkWait(EnCow* this, PlayState* play) { } void EnCow_GiveMilk(EnCow* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_10000; func_801477B4(play); this->actionFunc = EnCow_GiveMilkWait; @@ -233,7 +233,7 @@ void EnCow_GiveMilk(EnCow* this, PlayState* play) { } void EnCow_CheckForEmptyBottle(EnCow* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { func_80151938(play, 0x32C9); // Text to give milk. this->actionFunc = EnCow_GiveMilk; diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 29a4c62bf..e6980ba4f 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -68,42 +68,53 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 30, 30 }; +typedef enum { + /* 0 */ GUAY_DMGEFF_NONE, + /* 1 */ GUAY_DMGEFF_STUN, + /* 2 */ GUAY_DMGEFF_FIRE, + /* 3 */ GUAY_DMGEFF_ICE, + /* 4 */ GUAY_DMGEFF_LIGHT, + /* 5 */ GUAY_DMGEFF_ELECTRIC, +} GuayDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0x0), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), + /* Deku Nut */ DMG_ENTRY(0, GUAY_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, GUAY_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, GUAY_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, GUAY_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, GUAY_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, GUAY_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, GUAY_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, GUAY_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, GUAY_DMGEFF_NONE), }; -static s32 D_8099C0CC = 0; +#define GUAY_NUMBER_OF_DEAD_TO_SPAWN_MEGAGUAY 10 + +static s32 sDeadCount = 0; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE), @@ -122,7 +133,9 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - D_8099C0CC = 0; + + sDeadCount = 0; + if (this->actor.parent != NULL) { this->actor.flags &= ~ACTOR_FLAG_1; } @@ -162,40 +175,40 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { } if (this->actor.bgCheckFlags & 8) { - this->aimRotY = this->actor.wallYaw; + this->yawTarget = this->actor.wallYaw; } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { - this->aimRotY = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + this->yawTarget = Actor_YawToPoint(&this->actor, &this->actor.home.pos); } - if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->aimRotY, 5, 0x300, 0x10) == 0) && onInitialAnimFrame && + if ((Math_SmoothStepToS(&this->actor.shape.rot.y, this->yawTarget, 5, 0x300, 0x10) == 0) && onInitialAnimFrame && (Rand_ZeroOne() < 0.1f)) { yaw = (Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y); if (yaw > 0) { - this->aimRotY += Rand_S16Offset(0x1000, 0x1000); + this->yawTarget += Rand_S16Offset(0x1000, 0x1000); } else { - this->aimRotY -= Rand_S16Offset(0x1000, 0x1000); + this->yawTarget -= Rand_S16Offset(0x1000, 0x1000); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); } if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & 1)) { - this->aimRotX = -0x1000; + this->pitchTarget = -0x1000; } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 50.0f)) { - this->aimRotX = -Rand_S16Offset(0x800, 0x800); + this->pitchTarget = -Rand_S16Offset(0x800, 0x800); } else if (this->actor.world.pos.y > (this->actor.home.pos.y + 50.0f)) { - this->aimRotX = Rand_S16Offset(0x800, 0x800); + this->pitchTarget = Rand_S16Offset(0x800, 0x800); } - if ((Math_SmoothStepToS(&this->actor.shape.rot.x, this->aimRotX, 0xA, 0x100, 8) == 0) && onInitialAnimFrame && + if ((Math_SmoothStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0xA, 0x100, 8) == 0) && onInitialAnimFrame && (Rand_ZeroOne() < 0.1f)) { if (this->actor.home.pos.y < this->actor.world.pos.y) { - this->aimRotX -= Rand_S16Offset(0x400, 0x400); + this->pitchTarget -= Rand_S16Offset(0x400, 0x400); } else { - this->aimRotX += Rand_S16Offset(0x400, 0x400); + this->pitchTarget += Rand_S16Offset(0x400, 0x400); } - this->aimRotX = CLAMP(this->aimRotX, -0x1000, 0x1000); + this->pitchTarget = CLAMP(this->pitchTarget, -0x1000, 0x1000); } if (this->actor.bgCheckFlags & 1) { @@ -206,7 +219,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { this->timer--; } if ((this->timer == 0) && - (((this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x800000)) || (dist < 300.0f)) && + (((this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_800000)) || (dist < 300.0f)) && (this->actor.depthInWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { if (dist < this->actor.xzDistToPlayer) { this->actor.child = this->actor.parent; @@ -227,9 +240,7 @@ void EnCrow_SetupDiveAttack(EnCrow* this) { void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 isFacingActor; - Vec3f pos; - s16 pitch; - s16 pitchTarget; + Vec3f targetPos; SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -238,27 +249,30 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { isFacingActor = Actor_ActorAIsFacingActorB(&this->actor, this->actor.child, 0x2800); if (isFacingActor) { + s16 pitchTarget; + if (&player->actor == this->actor.child) { - pos.y = this->actor.child->world.pos.y + 20.0f; + targetPos.y = this->actor.child->world.pos.y + 20.0f; } else { - pos.y = this->actor.child->world.pos.y + 40.0f; + targetPos.y = this->actor.child->world.pos.y + 40.0f; } - pos.x = this->actor.child->world.pos.x; - pos.z = this->actor.child->world.pos.z; - pitch = Actor_PitchToPoint(&this->actor, &pos); - pitchTarget = CLAMP(pitch, -0x3000, 0x3000); - Math_SmoothStepToS(&this->actor.shape.rot.x, pitchTarget, 2, 0x400, 64); + targetPos.x = this->actor.child->world.pos.x; + targetPos.z = this->actor.child->world.pos.z; + pitchTarget = Actor_PitchToPoint(&this->actor, &targetPos); + pitchTarget = CLAMP(pitchTarget, -0x3000, 0x3000); + Math_SmoothStepToS(&this->actor.shape.rot.x, pitchTarget, 2, 0x400, 0x40); } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, -0x800, 2, 0x100, 16); + Math_SmoothStepToS(&this->actor.shape.rot.x, -0x800, 2, 0x100, 0x10); } if (isFacingActor || (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) > 80.0f)) { Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->actor.child), 4, 0xC00, 0xC0); } + if (((this->timer == 0) || ((&player->actor != this->actor.child) && (this->actor.child->home.rot.z != 0)) || ((&player->actor == this->actor.child) && - ((Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags1 & 0x800000))) || + ((Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags1 & PLAYER_STATE1_800000))) || ((this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9))) || (this->actor.depthInWater > -40.0f)) { @@ -271,9 +285,9 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { } void EnCrow_CheckIfFrozen(EnCrow* this, PlayState* play) { - if (this->deathMode == 10) { - this->deathMode = 0; - this->effectAlpha = 0.0f; + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->drawDmgEffAlpha = 0.0f; Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, 4, 2, 0.2f, 0.2f); } } @@ -291,22 +305,22 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { this->actor.world.pos.y += 20.0f * scale; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); - if (this->actor.colChkInfo.damageEffect == 3) { - this->deathMode = 10; // Ice arrows - this->effectAlpha = 1.0f; - this->effectScale = 0.75f; - this->steamScale = 0.5f; - } else if (this->actor.colChkInfo.damageEffect == 4) { - this->deathMode = 20; // Light Arrows - this->effectAlpha = 4.0f; - this->steamScale = 0.5f; + if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_ICE) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->drawDmgEffAlpha = 1.0f; + this->drawDmgEffScale = 0.75f; + this->drawDmgEffFrozenSteamScale = 0.5f; + } else if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_LIGHT) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffFrozenSteamScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.elements->info.bumper.hitPos.x, this->collider.elements->info.bumper.hitPos.y, this->collider.elements->info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); - } else if (this->actor.colChkInfo.damageEffect == 2) { - this->deathMode = 0; // Fire arrows - this->effectAlpha = 4.0f; - this->steamScale = 0.5f; + } else if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_FIRE) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffFrozenSteamScale = 0.5f; } Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); @@ -325,7 +339,7 @@ void EnCrow_Damaged(EnCrow* this, PlayState* play) { this->actor.colorFilterTimer = 40; if (!(this->actor.flags & ACTOR_FLAG_8000)) { - if (this->deathMode != 10) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; } @@ -351,14 +365,14 @@ void EnCrow_SetupDie(EnCrow* this) { void EnCrow_Die(EnCrow* this, PlayState* play) { f32 stepScale; - if (this->actor.params != 0) { + if (this->actor.params != GUAY_TYPE_NORMAL) { stepScale = 0.006f; } else { stepScale = 0.002f; } - if (Math_StepToF(&this->actor.scale.x, 0.0f, stepScale) != 0) { - if (this->actor.params == 0) { - D_8099C0CC++; + if (Math_StepToF(&this->actor.scale.x, 0.0f, stepScale)) { + if (this->actor.params == GUAY_TYPE_NORMAL) { + sDeadCount++; Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); } else { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x90); @@ -370,11 +384,11 @@ void EnCrow_Die(EnCrow* this, PlayState* play) { void EnCrow_SetupTurnAway(EnCrow* this) { this->timer = 100; - this->aimRotX = -0x1000; + this->pitchTarget = -0x1000; this->actor.speedXZ = 3.5f; - this->aimRotY = this->actor.yawTowardsPlayer + 0x8000; + this->yawTarget = this->actor.yawTowardsPlayer + 0x8000; this->skelAnime.playSpeed = 2.0f; - if (this->actor.colChkInfo.damageEffect == 1) { + if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_STUN) { Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); } else { Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); @@ -387,13 +401,13 @@ void EnCrow_TurnAway(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & 8) { - this->aimRotY = this->actor.wallYaw; + this->yawTarget = this->actor.wallYaw; } else { - this->aimRotY = this->actor.yawTowardsPlayer + 0x8000; + this->yawTarget = this->actor.yawTowardsPlayer + 0x8000; } - Math_SmoothStepToS(&this->actor.shape.rot.y, this->aimRotY, 3, 0xC00, 0xC0); - Math_SmoothStepToS(&this->actor.shape.rot.x, this->aimRotX, 5, 0x100, 0x10); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->yawTarget, 3, 0xC00, 0xC0); + Math_SmoothStepToS(&this->actor.shape.rot.x, this->pitchTarget, 5, 0x100, 0x10); if (this->timer != 0) { this->timer--; @@ -405,12 +419,12 @@ void EnCrow_TurnAway(EnCrow* this, PlayState* play) { } void EnCrow_SetupRespawn(EnCrow* this) { - if (D_8099C0CC == 10) { - this->actor.params = 1; - D_8099C0CC = 0; + if (sDeadCount == GUAY_NUMBER_OF_DEAD_TO_SPAWN_MEGAGUAY) { + this->actor.params = GUAY_TYPE_MEGA; + sDeadCount = 0; this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius * 0.03f * 100.0f; } else { - this->actor.params = 0; + this->actor.params = GUAY_TYPE_NORMAL; this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; } Animation_PlayLoop(&this->skelAnime, &gGuayFlyAnim); @@ -421,12 +435,12 @@ void EnCrow_SetupRespawn(EnCrow* this) { this->actor.draw = NULL; this->actor.shape.yOffset = 2000.0f; this->actor.targetArrowOffset = 2000.0; - this->effectAlpha = 0.0f; + this->drawDmgEffAlpha = 0.0f; this->actionFunc = EnCrow_Respawn; } void EnCrow_Respawn(EnCrow* this, PlayState* play) { - f32 target; + f32 scaleTarget; if (this->timer != 0) { this->timer--; @@ -434,12 +448,12 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) { if (this->timer == 0) { SkelAnime_Update(&this->skelAnime); this->actor.draw = EnCrow_Draw; - if (this->actor.params != 0) { - target = 0.03f; + if (this->actor.params != GUAY_TYPE_NORMAL) { + scaleTarget = 0.03f; } else { - target = 0.01f; + scaleTarget = 0.01f; } - if (Math_StepToF(&this->actor.scale.x, target, target * 0.1f)) { + if (Math_StepToF(&this->actor.scale.x, scaleTarget, scaleTarget * 0.1f)) { this->actor.flags |= ACTOR_FLAG_1; this->actor.flags &= ~ACTOR_FLAG_10; this->actor.colChkInfo.health = 1; @@ -450,18 +464,17 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) { } void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { - if (this->collider.base.acFlags & AT_HIT) { this->collider.base.acFlags &= ~AT_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements->info); - if (this->actor.colChkInfo.damageEffect == 1) { + if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_STUN) { EnCrow_SetupTurnAway(this); - } else if (this->actor.colChkInfo.damageEffect == 5) { - this->deathMode = 31; // Stunned via deku nuts or zora barrier - this->effectAlpha = 2.0f; - this->steamScale = 0.5f; + } else if (this->actor.colChkInfo.damageEffect == GUAY_DMGEFF_ELECTRIC) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; + this->drawDmgEffAlpha = 2.0f; + this->drawDmgEffFrozenSteamScale = 0.5f; EnCrow_SetupTurnAway(this); } else { @@ -475,7 +488,7 @@ void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { void EnCrow_Update(Actor* thisx, PlayState* play) { f32 pad; - EnCrow* this = (EnCrow*)thisx; + EnCrow* this = THIS; f32 height; f32 scale; @@ -517,23 +530,23 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { if ((this->actor.colChkInfo.health != 0) && (Animation_OnFrame(&this->skelAnime, 3.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } - if (this->effectAlpha > 0.0f) { - if (this->deathMode != 10) { - Math_StepToF(&this->effectAlpha, 0.0f, 0.05f); - this->steamScale = (this->effectAlpha + 1.0f) * 0.25f; - if (this->steamScale > 0.5f) { - this->steamScale = 0.5f; + if (this->drawDmgEffAlpha > 0.0f) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); + this->drawDmgEffFrozenSteamScale = (this->drawDmgEffAlpha + 1.0f) * 0.25f; + if (this->drawDmgEffFrozenSteamScale > 0.5f) { + this->drawDmgEffFrozenSteamScale = 0.5f; } else { - this->steamScale = this->steamScale; + this->drawDmgEffFrozenSteamScale = this->drawDmgEffFrozenSteamScale; } - } else if (Math_StepToF(&this->effectScale, 0.5f, 0.0125f) == 0) { + } else if (!Math_StepToF(&this->drawDmgEffScale, 0.5f, 0.5f * 0.025f)) { func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - EnCrow* this = (EnCrow*)thisx; + EnCrow* this = THIS; if (this->actor.colChkInfo.health != 0) { if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) { @@ -546,25 +559,23 @@ s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* } void EnCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnCrow* this = (EnCrow*)thisx; + EnCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_BODY) { Matrix_MultVecX(2500.0f, this->bodyPartsPos); - return; - } - if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || - (limbIndex == OBJECT_CROW_LIMB_TAIL)) { + } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || + (limbIndex == OBJECT_CROW_LIMB_TAIL)) { Matrix_MultZero(&this->bodyPartsPos[(limbIndex >> 1) - 1]); } } void EnCrow_Draw(Actor* thisx, PlayState* play) { - EnCrow* this = (EnCrow*)thisx; + EnCrow* this = THIS; func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnCrow_OverrideLimbDraw, EnCrow_PostLimbDraw, &this->actor); Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), - this->actor.scale.x * 100.0f * this->steamScale, this->effectScale, this->effectAlpha, - this->deathMode); + this->actor.scale.x * 100.0f * this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, + this->drawDmgEffAlpha, this->drawDmgEffType); } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 306f41055..86ffba903 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -4,6 +4,11 @@ #include "global.h" #include "objects/object_crow/object_crow.h" +typedef enum { + /* 0 */ GUAY_TYPE_NORMAL, + /* 1 */ GUAY_TYPE_MEGA +} GuayType; + struct EnCrow; typedef void (*EnCrowActionFunc)(struct EnCrow*, PlayState*); @@ -12,18 +17,18 @@ typedef struct EnCrow { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnCrowActionFunc actionFunc; - /* 0x18C */ u8 deathMode; + /* 0x18C */ u8 drawDmgEffType; /* 0x18E */ s16 timer; - /* 0x190 */ s16 aimRotX; - /* 0x192 */ s16 aimRotY; + /* 0x190 */ s16 pitchTarget; + /* 0x192 */ s16 yawTarget; /* 0x194 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; /* 0x1CA */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x200 */ ColliderJntSph collider; /* 0x220 */ ColliderJntSphElement colliderItems[1]; /* 0x260 */ Vec3f bodyPartsPos[4]; - /* 0x290 */ f32 effectAlpha; - /* 0x294 */ f32 steamScale; - /* 0x298 */ f32 effectScale; + /* 0x290 */ f32 drawDmgEffAlpha; + /* 0x294 */ f32 drawDmgEffFrozenSteamScale; + /* 0x298 */ f32 drawDmgEffScale; } EnCrow; // size = 0x29C extern const ActorInit En_Crow_InitVars; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 6e879b50e..2e7442fa4 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -244,7 +244,7 @@ void func_80943BDC(EnDaiku* this, PlayState* play) { } } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80943820(this); } diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index f8b42045f..b7b46b5af 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -294,7 +294,7 @@ void func_80BE6B40(EnDaiku2* this, PlayState* play) { void func_80BE6BC0(EnDaiku2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0x0); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { s32 day = gSaveContext.save.day - 1; func_801477B4(play); diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c index 5507dff34..4b6eae5bb 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c @@ -5,7 +5,6 @@ */ #include "z_en_demo_heishi.h" -#include "objects/object_sdn/object_sdn.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -69,8 +68,8 @@ void EnDemoheishi_Init(Actor* thisx, PlayState* play) { EnDemoheishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, this->morphTable, - 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable, + SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 6; this->actor.gravity = -3.0f; @@ -143,7 +142,7 @@ void EnDemoheishi_SetupTalk(EnDemoheishi* this) { } void EnDemoheishi_Talk(EnDemoheishi* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); EnDemoheishi_SetupIdle(this); } @@ -175,7 +174,7 @@ void EnDemoheishi_Update(Actor* thisx, PlayState* play) { s32 EnDemoheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnDemoheishi* this = THIS; - if (limbIndex == DEMOHEISHI_LIMB_HEAD) { + if (limbIndex == SOLDIER_LIMB_HEAD) { rot->x += this->headRotX; rot->y += this->headRotY; rot->z += this->headRotZ; diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h index f67cbe074..c14fa5326 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.h @@ -2,37 +2,17 @@ #define Z_EN_DEMO_HEISHI_H #include "global.h" +#include "objects/object_sdn/object_sdn.h" struct EnDemoheishi; typedef void (*EnDemoheishiActionFunc)(struct EnDemoheishi*, PlayState*); -typedef enum { - /* 0 */ DEMOHEISHI_LIMB_NONE, - /* 1 */ DEMOHEISHI_LIMB_ROOT, - /* 2 */ DEMOHEISHI_LIMB_PELVIS, - /* 3 */ DEMOHEISHI_LIMB_LEFT_THIGH, - /* 4 */ DEMOHEISHI_LIMB_LEFT_SHIN, - /* 5 */ DEMOHEISHI_LIMB_LEFT_FOOT, - /* 6 */ DEMOHEISHI_LIMB_RIGHT_THIGH, - /* 7 */ DEMOHEISHI_LIMB_RIGHT_SHIN, - /* 8 */ DEMOHEISHI_LIMB_RIGHT_FOOT, - /* 9 */ DEMOHEISHI_LIMB_TORSO, - /* 10 */ DEMOHEISHI_LIMB_LEFT_SHOULDER, - /* 11 */ DEMOHEISHI_LIMB_LEFT_FOREARM, - /* 12 */ DEMOHEISHI_LIMB_LEFT_HAND, - /* 13 */ DEMOHEISHI_LIMB_RIGHT_SHOULDER, - /* 14 */ DEMOHEISHI_LIMB_RIGHT_FOREARM, - /* 15 */ DEMOHEISHI_LIMB_RIGHT_HAND_WITH_SPEAR, - /* 16 */ DEMOHEISHI_LIMB_HEAD, - /* 17 */ DEMOHEISHI_LIMB_MAX -} EnDemoheishiLimbs; - typedef struct EnDemoheishi { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[DEMOHEISHI_LIMB_MAX]; - /* 0x1EE */ Vec3s morphTable[DEMOHEISHI_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[SOLDIER_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[SOLDIER_LIMB_MAX]; /* 0x254 */ EnDemoheishiActionFunc actionFunc; /* 0x258 */ s16 headRotY; /* 0x25A */ s16 headRotX; 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 716d822fb..8b9d67e64 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -15,26 +15,26 @@ void EnDg_Destroy(Actor* thisx, PlayState* play); void EnDg_Update(Actor* thisx, PlayState* play); void EnDg_Draw(Actor* thisx, PlayState* play); -void func_8098A468(EnDg* this, PlayState* play); -void func_8098A55C(EnDg* this, PlayState* play); -void func_8098A618(EnDg* this, PlayState* play); -void func_8098A70C(EnDg* this, PlayState* play); -void func_8098A89C(EnDg* this, PlayState* play); -void func_8098A938(EnDg* this, PlayState* play); -void func_8098AB48(EnDg* this, PlayState* play); -void func_8098AC34(EnDg* this, PlayState* play); -void func_8098AF44(EnDg* this, PlayState* play); -void func_8098AF98(EnDg* this, PlayState* play); -void func_8098B004(EnDg* this, PlayState* play); -void func_8098B198(EnDg* this, PlayState* play); -void func_8098B28C(EnDg* this, PlayState* play); -void func_8098B390(EnDg* this, PlayState* play); -void func_8098B560(EnDg* this, PlayState* play); -void func_8098B88C(EnDg* this, PlayState* play); -void func_8098BA64(EnDg* this, PlayState* play); -void func_8098BB10(EnDg* this, PlayState* play); -void func_8098BBEC(EnDg* this, PlayState* play); -void func_8098BC54(EnDg* this, PlayState* play); +void EnDg_IdleMove(EnDg* this, PlayState* play); +void EnDg_IdleBark(EnDg* this, PlayState* play); +void EnDg_BackAwayFromGoron(EnDg* this, PlayState* play); +void EnDg_RunAwayFromGoron(EnDg* this, PlayState* play); +void EnDg_BarkAtGoron(EnDg* this, PlayState* play); +void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play); +void EnDg_SitNextToPlayer(EnDg* this, PlayState* play); +void EnDg_JumpAttack(EnDg* this, PlayState* play); +void EnDg_SetupBremenMaskApproachPlayer(EnDg* this, PlayState* play); +void EnDg_Fall(EnDg* this, PlayState* play); +void EnDg_ApproachPlayer(EnDg* this, PlayState* play); +void EnDg_SlowlyBackUpBeforeAttacking(EnDg* this, PlayState* play); +void EnDg_BackAwayFromPlayer(EnDg* this, PlayState* play); +void EnDg_BarkAtPlayer(EnDg* this, PlayState* play); +void EnDg_Swim(EnDg* this, PlayState* play); +void EnDg_JumpOutOfWater(EnDg* this, PlayState* play); +void EnDg_Held(EnDg* this, PlayState* play); +void EnDg_Thrown(EnDg* this, PlayState* play); +void EnDg_SetupTalk(EnDg* this, PlayState* play); +void EnDg_Talk(EnDg* this, PlayState* play); const ActorInit En_Dg_InitVars = { ACTOR_EN_DG, @@ -48,14 +48,37 @@ const ActorInit En_Dg_InitVars = { (ActorFunc)EnDg_Draw, }; -static u8 D_8098C2A0 = 0; +#define DOG_FLAG_NONE 0 +#define DOG_FLAG_HELD (1 << 0) +#define DOG_FLAG_JUMP_ATTACKING (1 << 1) +#define DOG_FLAG_SWIMMING (1 << 2) +#define DOG_FLAG_BOUNCED (1 << 3) +#define DOG_FLAG_THROWN (1 << 4) +#define DOG_FLAG_FOLLOWING_BREMEN_MASK (1 << 5) -typedef struct { - s16 unk_00; - s16 unk_02; -} D_8098C2A4_s; +#define ENDG_INDEX_NO_BREMEN_MASK_FOLLOWER 99 -static D_8098C2A4_s D_8098C2A4 = { 0x0063, 0x0000 }; +typedef enum { + /* 0 */ DOG_GRAB_STATE_NONE, + /* 1 */ DOG_GRAB_STATE_HELD, + /* 2 */ DOG_GRAB_STATE_THROWN_OR_SITTING_AFTER_THROW, +} DogGrabState; + +typedef enum { + /* 0 */ DOG_BEHAVIOR_INITIAL, // Gets immediately replaced by DOG_BEHAVIOR_DEFAULT in EnDg_Update + /* 1 */ DOG_BEHAVIOR_HUMAN, // Gets immediately replaced by DOG_BEHAVIOR_DEFAULT in EnDg_Update + /* 2 */ DOG_BEHAVIOR_GORON, + /* 3 */ DOG_BEHAVIOR_GORON_WAIT, + /* 4 */ DOG_BEHAVIOR_ZORA, + /* 5 */ DOG_BEHAVIOR_ZORA_WAIT, + /* 6 */ DOG_BEHAVIOR_DEKU, + /* 7 */ DOG_BEHAVIOR_DEKU_WAIT, + /* 8 */ DOG_BEHAVIOR_DEFAULT, +} DogBehavior; + +static u8 sIsAnyDogHeld = false; + +static s16 sBremenMaskFollowerIndex = ENDG_INDEX_NO_BREMEN_MASK_FOLLOWER; /** * Stores the state for the dogs milling about at the Doggy Racetrack. @@ -80,7 +103,7 @@ static RacetrackDogInfo sRacetrackDogInfo[] = { /** * Stores the RacetrackDogInfo for the dog that is selected by the player. These values are just - * placeholders, and the actual value gets grabbed from sRacetrackDogInfo in func_80989E18. + * placeholders, and the actual value gets grabbed from sRacetrackDogInfo in EnDg_TryPickUp. */ static RacetrackDogInfo sSelectedRacetrackDogInfo = { DOG_COLOR_DEFAULT, -1, 0x353E }; @@ -141,6 +164,26 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; +typedef enum { + /* 0 */ DOG_ANIMATION_WALK_AFTER_TALKING, + /* 1 */ DOG_ANIMATION_WALK, + /* 2 */ DOG_ANIMATION_RUN, + /* 3 */ DOG_ANIMATION_BARK, + /* 4 */ DOG_ANIMATION_SIT_DOWN_ONCE, // unused + /* 5 */ DOG_ANIMATION_SIT_DOWN, + /* 6 */ DOG_ANIMATION_LYING_DOWN_START_1, // unused + /* 7 */ DOG_ANIMATION_LYING_DOWN_LOOP, // unused + /* 8 */ DOG_ANIMATION_LYING_DOWN_START_2, // unused + /* 9 */ DOG_ANIMATION_LYING_DOWN_START_3, // unused + /* 10 */ DOG_ANIMATION_LYING_DOWN_START_4, // unused + /* 11 */ DOG_ANIMATION_WALK_BACKWARDS, + /* 12 */ DOG_ANIMATION_JUMP, + /* 13 */ DOG_ANIMATION_LONG_JUMP, // unused + /* 14 */ DOG_ANIMATION_JUMP_ATTACK, + /* 15 */ DOG_ANIMATION_SWIM, + /* 16 */ DOG_ANIMATION_MAX +} DogAnimationIndex; + static AnimationInfoS sAnimations[] = { { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, { &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, @@ -149,41 +192,44 @@ static AnimationInfoS sAnimations[] = { { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDogJump2Anim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, }; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP), }; -void func_80989140(SkelAnime* skelAnime, AnimationInfoS arg1[], s32 arg2) { +void EnDg_ChangeAnimation(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 index) { f32 frameCount; - arg1 += arg2; - if (arg1->frameCount < 0) { - frameCount = Animation_GetLastFrame(arg1->animation); + animationInfo += index; + if (animationInfo->frameCount < 0) { + frameCount = Animation_GetLastFrame(animationInfo->animation); } else { - frameCount = arg1->frameCount; + frameCount = animationInfo->frameCount; } - Animation_Change(skelAnime, arg1->animation, arg1->playSpeed + (BREG(88) * 0.1f), arg1->startFrame, frameCount, - arg1->mode, arg1->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed + (BREG(88) * 0.1f), + animationInfo->startFrame, frameCount, animationInfo->mode, animationInfo->morphFrames); } -void func_80989204(EnDg* this, PlayState* play) { +void EnDg_UpdateCollision(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); this->collider.dim.pos.x = this->actor.world.pos.x; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z; Collider_UpdateCylinder(&this->actor, &this->collider); - if ((player->transformation == PLAYER_FORM_DEKU) && (this->actionFunc == func_8098AC34)) { + + if ((player->transformation == PLAYER_FORM_DEKU) && (this->actionFunc == EnDg_JumpAttack)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } else { Collider_ResetCylinderAT(play, &this->collider.base); } - if ((this->unk_290 != 1) && !(this->unk_280 & 2)) { + // The check for DOG_FLAG_JUMP_ATTACKING here makes it so the dog passes through the + // player if it hits them with their jump attack. + if ((this->grabState != DOG_GRAB_STATE_HELD) && !(this->dogFlags & DOG_FLAG_JUMP_ATTACKING)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } else { Collider_ResetCylinderOC(play, &this->collider.base); @@ -192,63 +238,67 @@ void func_80989204(EnDg* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } -void func_8098933C(EnDg* this, Vec3f* arg1) { - f32 sp24; - f32 sp20; - f32 sp1C; +void EnDg_GetFloorRot(EnDg* this, Vec3f* floorRot) { + f32 nx; + f32 ny; + f32 nz; if (this->actor.floorPoly != NULL) { - sp24 = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - sp20 = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - sp1C = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); sinf(0.0f); cosf(0.0f); - arg1->x = -Math_Acot2F(1.0f, -sp1C * sp20); - arg1->z = Math_Acot2F(1.0f, -sp24 * sp20); + floorRot->x = -Math_Acot2F(1.0f, -nz * ny); + floorRot->z = Math_Acot2F(1.0f, -nx * ny); } } -s32 func_80989418(EnDg* this, Path* arg1, s32 arg2) { - Vec3s* sp5C = Lib_SegmentedToVirtual(arg1->points); - s32 count = arg1->count; - s32 idx = arg2; - s32 sp50 = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 pathCount = path->count; + s32 currentPoint = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &sp5C[idx]); - if (idx == 0) { - phi_f12 = sp5C[1].x - sp5C[0].x; - phi_f14 = sp5C[1].z - sp5C[0].z; - } else if (idx == count - 1) { - phi_f12 = sp5C[count - 1].x - sp5C[count - 2].x; - phi_f14 = sp5C[count - 1].z - sp5C[count - 2].z; + Math_Vec3s_ToVec3f(&point, &points[currentPoint]); + if (currentPoint == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (currentPoint == pathCount - 1) { + diffX = points[pathCount - 1].x - points[pathCount - 2].x; + diffZ = points[pathCount - 1].z - points[pathCount - 2].z; } else { - phi_f12 = sp5C[idx + 1].x - sp5C[idx - 1].x; - phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; + diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; + diffZ = points[currentPoint + 1].z - points[currentPoint - 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) { - sp50 = true; + func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + + if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return sp50; + return reached; } -s16 func_809895B4(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { +/** + * Returns the Y-rotation the dog should have to move to the next point along its path. + */ +s16 EnDg_GetYRotation(Path* path, s32 index, Vec3f* pos, f32* distSq) { Vec3s* points; f32 diffX; f32 diffZ; if (path != NULL) { points = Lib_SegmentedToVirtual(path->points); - points = &points[idx]; + points = &points[index]; diffX = points->x - pos->x; diffZ = points->z - pos->z; } else { @@ -256,34 +306,38 @@ s16 func_809895B4(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { diffZ = 0.0f; } - *distSQ = SQ(diffX) + SQ(diffZ); + *distSq = SQ(diffX) + SQ(diffZ); return RADF_TO_BINANG(Math_Acot2F(diffZ, diffX)); } -void func_80989674(EnDg* this, PlayState* play) { - s16 phi_a1; - f32 sp30; +/** + * Updates the dog's Y-rotation and speed so that it moves along its path. + */ +void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { + s16 yRotation; + f32 distSq; if (this->path != NULL) { - phi_a1 = func_809895B4(this->path, this->unk_1E0, &this->actor.world.pos, &sp30); + yRotation = EnDg_GetYRotation(this->path, this->currentPoint, &this->actor.world.pos, &distSq); if (this->actor.bgCheckFlags & 8) { - phi_a1 = this->actor.wallYaw; + yRotation = this->actor.wallYaw; } - Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - if (func_80989418(this, this->path, this->unk_1E0)) { - if (this->unk_1E0 >= (this->path->count - 1)) { - this->unk_1E0 = 0; + if (EnDg_HasReachedPoint(this, this->path, this->currentPoint)) { + if (this->currentPoint >= (this->path->count - 1)) { + this->currentPoint = 0; } else { - this->unk_1E0++; + this->currentPoint++; } } - if ((this->index == 21) || ((this->index == 20) && (play->sceneNum == SCENE_OMOYA))) { + if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); - } else if (this->index == 20) { + } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else if (play->sceneNum == SCENE_CLOCKTOWER) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); @@ -297,197 +351,232 @@ void func_80989674(EnDg* this, PlayState* play) { } } -void func_80989864(EnDg* this, PlayState* play) { - s16 frame = this->skelAnime.curFrame; +void EnDg_SpawnFloorDustRing(EnDg* this, PlayState* play) { + s16 curFrame = this->skelAnime.curFrame; s16 mod = (this->actor.speedXZ > 6.0f) ? 2 : 3; - Vec3f sp38; + Vec3f pos; - if (((this->index + frame) % mod) == 0) { - sp38.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; - sp38.y = this->actor.world.pos.y; - sp38.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; - Actor_SpawnFloorDustRing(play, &this->actor, &sp38, 10.0f, 0, 2.0f, 300, 0, 1); + if (((this->index + curFrame) % mod) == 0) { + pos.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; + pos.y = this->actor.world.pos.y; + pos.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; + Actor_SpawnFloorDustRing(play, &this->actor, &pos, 10.0f, 0, 2.0f, 300, 0, true); } } -void func_80989974(EnDg* this) { +void EnDg_PlaySfxWalk(EnDg* this) { if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); } } -void func_809899C8(EnDg* this, f32 arg1) { - if (Animation_OnFrame(&this->skelAnime, arg1)) { +void EnDg_PlaySfxBark(EnDg* this, f32 frame) { + if (Animation_OnFrame(&this->skelAnime, frame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); } } -void func_80989A08(EnDg* this, f32 arg1) { - if (Animation_OnFrame(&this->skelAnime, arg1)) { +void EnDg_PlaySfxAngryBark(EnDg* this, f32 frame) { + if (Animation_OnFrame(&this->skelAnime, frame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); } } -void func_80989A48(EnDg* this) { +void EnDg_PlaySfxWhine(EnDg* this) { if (Animation_OnFrame(&this->skelAnime, 23.0f) || Animation_OnFrame(&this->skelAnime, 28.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_WHINE); } } -void func_80989A9C(EnDg* this, f32 arg1) { - if (Animation_OnFrame(&this->skelAnime, arg1)) { +void EnDg_PlaySfxGrowl(EnDg* this, f32 frame) { + if (Animation_OnFrame(&this->skelAnime, frame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } } -void func_80989ADC(EnDg* this, PlayState* play) { +void EnDg_SetupIdleMove(EnDg* this, PlayState* play) { if (!(this->actor.bgCheckFlags & 0x20)) { - if ((this->index == 21) || ((this->index == 20) && (play->sceneNum == SCENE_OMOYA))) { - func_80989140(&this->skelAnime, sAnimations, 1); - } else if (this->index == 20) { - func_80989140(&this->skelAnime, sAnimations, 2); + if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); } else if (play->sceneNum == SCENE_CLOCKTOWER) { - func_80989140(&this->skelAnime, sAnimations, 2); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { - func_80989140(&this->skelAnime, sAnimations, 1); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); } else { - func_80989140(&this->skelAnime, sAnimations, 2); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); } - this->actionFunc = func_8098A468; + + this->actionFunc = EnDg_IdleMove; } } -void func_80989BF8(EnDg* this) { +/** + * Updates the text ID in sRacetrackDogInfo based on what was set in the weekEventRegs by + * En_Aob_01. This makes it sp the proper message can be displayed when the player picks up + * the dog with the Mask of Truth equipped. + */ +void EnDg_UpdateTextId(EnDg* this) { if (this->index < 14) { + // Assuming that the weekEventRegs haven't been tampered with, then this will produce a text ID in + // the range of 0x3538 to 0x3545. if (this->index % 2) { sRacetrackDogInfo[this->index].textId = - 0x3538 + ((gSaveContext.save.weekEventReg[42 + (this->index / 2)] & (0x10 | 0x20 | 0x40 | 0x80)) >> 4); + 0x3538 + ((gSaveContext.save.weekEventReg[42 + (this->index / 2)] & 0xF0) >> 4); } else { sRacetrackDogInfo[this->index].textId = - 0x3538 + (gSaveContext.save.weekEventReg[42 + (this->index / 2)] & (1 | 2 | 4 | 8)); + 0x3538 + (gSaveContext.save.weekEventReg[42 + (this->index / 2)] & 0x0F); } } else { Actor_MarkForDeath(&this->actor); } - if ((sRacetrackDogInfo[this->index].textId >= 0x3547) || (sRacetrackDogInfo[this->index].textId < 0x3538)) { + // As a sanity check, this makes sure the text ID is something in the expected range of 0x3538 to 0x3546. + if ((sRacetrackDogInfo[this->index].textId > 0x3546) || (sRacetrackDogInfo[this->index].textId < 0x3538)) { sRacetrackDogInfo[this->index].textId = 0x353E; } + // Text ID 0x353D is the text for the Romani Ranch dog, which is in the middle of the race dog block. If + // the dog ends up with this text ID, adjust it so the dog says a different message indcating it's in + // good condition. if (sRacetrackDogInfo[this->index].textId == 0x353D) { sRacetrackDogInfo[this->index].textId = 0x3538; } } -void func_80989D38(EnDg* this, PlayState* play) { - if (this->index == 21) { +void EnDg_StartTextBox(EnDg* this, PlayState* play) { + if (this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) { if (CURRENT_DAY == 1) { + // Stupid master... Message_StartTextbox(play, 0x91C, NULL); } else { + // I miss the ranch... Message_StartTextbox(play, 0x91E, NULL); } - } else if ((this->index >= 0) && (this->index < 14)) { + } else if ((this->index >= ENDG_INDEX_RACETRACK_0) && (this->index <= ENDG_INDEX_RACETRACK_13)) { Message_StartTextbox(play, sRacetrackDogInfo[this->index].textId, NULL); - } else if (this->index == 20) { + } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { + // I wonder if I can stop practicing... Message_StartTextbox(play, 0x353D, NULL); } else { + // Where did that Deku Scrub go? Message_StartTextbox(play, 0x627, NULL); } } -void func_80989E18(EnDg* this, PlayState* play) { - RacetrackDogInfo* temp; - - if ((D_8098C2A0 != 0) && !(this->unk_280 & 1)) { +/** + * Checks to see if the player picked up the dog and sets the appropriate state if they did. + */ +void EnDg_TryPickUp(EnDg* this, PlayState* play) { + if (sIsAnyDogHeld && !(this->dogFlags & DOG_FLAG_HELD)) { this->actor.flags |= ACTOR_FLAG_8000000; - this->unk_280 |= 1; - } else if ((D_8098C2A0 == 0) && (this->unk_280 & 1)) { + this->dogFlags |= DOG_FLAG_HELD; + } else if (!sIsAnyDogHeld && (this->dogFlags & DOG_FLAG_HELD)) { this->actor.flags &= ~ACTOR_FLAG_8000000; - this->unk_280 &= ~1; + this->dogFlags &= ~DOG_FLAG_HELD; } if (Actor_HasParent(&this->actor, play)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); - this->unk_290 = 1; + this->grabState = DOG_GRAB_STATE_HELD; sSelectedRacetrackDogInfo = sRacetrackDogInfo[this->index]; - if (D_8098C2A0 == 0) { + if (!sIsAnyDogHeld) { this->actor.flags |= ACTOR_FLAG_8000000; - D_8098C2A0 = 1; - this->unk_280 |= 1; + sIsAnyDogHeld = true; + this->dogFlags |= DOG_FLAG_HELD; } - func_80989140(&this->skelAnime, sAnimations, 5); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SIT_DOWN); this->actor.flags &= ~ACTOR_FLAG_1; this->actor.speedXZ = 0.0f; if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 100.0f); - this->actionFunc = func_8098BBEC; + this->actionFunc = EnDg_SetupTalk; } else { - this->actionFunc = func_8098BA64; + this->actionFunc = EnDg_Held; } } else { Actor_LiftActor(&this->actor, play); } } -s32 func_80989FC8(PlayState* play) { - EnDg* enemy = (EnDg*)play->actorCtx.actorLists[ACTORCAT_ENEMY].first; +/** + * Returns true if it finds a dog to follow the player around while they're marching with + * the Bremen Mask. The index of the dog it finds is stored in sBremenMaskFollowerIndex. + */ +s32 EnDg_FindFollowerForBremenMask(PlayState* play) { + Actor* enemy = play->actorCtx.actorLists[ACTORCAT_ENEMY].first; f32 minDist = 9999.0f; f32 dist; while (enemy != NULL) { - if (enemy->actor.id == ACTOR_EN_DG) { - if (enemy->actor.isTargeted) { - D_8098C2A4.unk_00 = enemy->index; + if (enemy->id == ACTOR_EN_DG) { + if (enemy->isTargeted) { + sBremenMaskFollowerIndex = ((EnDg*)enemy)->index; return true; } - dist = enemy->actor.xzDistToPlayer; + dist = enemy->xzDistToPlayer; if (dist < minDist) { - D_8098C2A4.unk_00 = enemy->index; + sBremenMaskFollowerIndex = ((EnDg*)enemy)->index; minDist = dist; } } - enemy = (EnDg*)enemy->actor.next; + + enemy = enemy->next; } - if (D_8098C2A4.unk_00 != 99) { + if (sBremenMaskFollowerIndex != ENDG_INDEX_NO_BREMEN_MASK_FOLLOWER) { return true; } return false; } -void func_8098A064(EnDg* this, PlayState* play) { +/** + * This checks for two conditions: + * - If the player has started marching with the Bremen Mask, then it makes the dog + * start following the player around (assuming it's the best candidate found in + * EnDg_FindFollowerForBremenMask above). + * - If the player has stopped marching with the Bremen Mask, and this dog was + * following them around, then it returns the dog to its idle state. + */ +void EnDg_CheckForBremenMaskMarch(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags3 & 0x20000000) { - if (D_8098C2A4.unk_00 == 99) { - func_80989FC8(play); + if (player->stateFlags3 & 0x20000000) { // bremen mask march + if (sBremenMaskFollowerIndex == ENDG_INDEX_NO_BREMEN_MASK_FOLLOWER) { + EnDg_FindFollowerForBremenMask(play); } - if (this->index == D_8098C2A4.unk_00) { - if (!(this->unk_280 & 0x20)) { - this->unk_280 |= 0x20; - func_80989140(&this->skelAnime, sAnimations, 1); - this->actionFunc = func_8098AF44; - } else if ((this->actionFunc == func_8098B004) || (this->actionFunc == func_8098AB48)) { - if (DECR(this->unk_292) == 0) { - this->unk_292 = 10; + if (this->index == sBremenMaskFollowerIndex) { + if (!(this->dogFlags & DOG_FLAG_FOLLOWING_BREMEN_MASK)) { + this->dogFlags |= DOG_FLAG_FOLLOWING_BREMEN_MASK; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + this->actionFunc = EnDg_SetupBremenMaskApproachPlayer; + } else if ((this->actionFunc == EnDg_ApproachPlayer) || (this->actionFunc == EnDg_SitNextToPlayer)) { + if (DECR(this->bremenBarkTimer) == 0) { + this->bremenBarkTimer = 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); } } } - } else if (this->index == D_8098C2A4.unk_00) { - this->unk_280 &= ~0x20; - D_8098C2A4.unk_00 = 99; - func_80989ADC(this, play); - this->actionFunc = func_8098A468; + } else if (this->index == sBremenMaskFollowerIndex) { + this->dogFlags &= ~DOG_FLAG_FOLLOWING_BREMEN_MASK; + sBremenMaskFollowerIndex = ENDG_INDEX_NO_BREMEN_MASK_FOLLOWER; + EnDg_SetupIdleMove(this, play); + this->actionFunc = EnDg_IdleMove; } } -s32 func_8098A1B4(EnDg* this, PlayState* play) { +/** + * Returns true if the player is not human and the dog is close enough to start + * reacting to their current form. + */ +s32 EnDg_ShouldReactToNonHumanPlayer(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); switch (player->transformation) { @@ -496,7 +585,7 @@ s32 func_8098A1B4(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 300.0f) { return true; } - + // fallthrough case PLAYER_FORM_DEKU: if (this->actor.xzDistToPlayer < 250.0f) { return true; @@ -507,144 +596,167 @@ s32 func_8098A1B4(EnDg* this, PlayState* play) { return false; } -void func_8098A234(EnDg* this, PlayState* play) { +/** + * Sets the appropriate actionFunc given the player's current form and the dog's current behavior. + * Specifically, it makes sure that the dog doesn't start reacting to the player's form until the + * player starts moving a bit. This was presumably done so the player could more easily react to + * the dog changing its behavior; it would be strange if the dog attacked the player the instant + * they put on the Deku Mask, for example. + */ +void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); if (!(this->actor.bgCheckFlags & 0x20)) { switch (player->transformation) { case PLAYER_FORM_HUMAN: - if (this->unk_28C != 1) { - this->unk_28C = 1; - this->unk_280 &= ~2; - func_80989ADC(this, play); + if (this->behavior != DOG_BEHAVIOR_HUMAN) { + this->behavior = DOG_BEHAVIOR_HUMAN; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + EnDg_SetupIdleMove(this, play); } break; case PLAYER_FORM_ZORA: - this->unk_280 &= ~2; - if ((this->unk_28C != 4) && (player->actor.speedXZ > 1.0f)) { - this->unk_28C = 4; - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098B004; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + if ((this->behavior != DOG_BEHAVIOR_ZORA) && (player->actor.speedXZ > 1.0f)) { + this->behavior = DOG_BEHAVIOR_ZORA; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_ApproachPlayer; } - if ((this->unk_28C != 5) && (this->unk_28C != 4)) { - this->unk_28C = 5; - func_80989ADC(this, play); + if ((this->behavior != DOG_BEHAVIOR_ZORA_WAIT) && (this->behavior != DOG_BEHAVIOR_ZORA)) { + this->behavior = DOG_BEHAVIOR_ZORA_WAIT; + EnDg_SetupIdleMove(this, play); } break; case PLAYER_FORM_GORON: - this->unk_280 &= ~2; - if ((this->unk_28C != 2) && (player->actor.speedXZ > 1.0f)) { - this->unk_28C = 2; - func_80989140(&this->skelAnime, sAnimations, 11); - this->unk_282 = 50; - this->actionFunc = func_8098A618; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + if ((this->behavior != DOG_BEHAVIOR_GORON) && (player->actor.speedXZ > 1.0f)) { + this->behavior = DOG_BEHAVIOR_GORON; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + this->timer = 50; + this->actionFunc = EnDg_BackAwayFromGoron; } - if ((this->unk_28C != 3) && (this->unk_28C != 2)) { - this->unk_28C = 3; - func_80989ADC(this, play); + if ((this->behavior != DOG_BEHAVIOR_GORON_WAIT) && (this->behavior != DOG_BEHAVIOR_GORON)) { + this->behavior = DOG_BEHAVIOR_GORON_WAIT; + EnDg_SetupIdleMove(this, play); } break; case PLAYER_FORM_DEKU: - this->unk_280 &= ~2; - if ((this->unk_28C != 6) && (player->actor.speedXZ > 1.0f)) { - this->unk_28C = 6; - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098A938; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + if ((this->behavior != DOG_BEHAVIOR_DEKU) && (player->actor.speedXZ > 1.0f)) { + this->behavior = DOG_BEHAVIOR_DEKU; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_ApproachPlayerToAttack; } - if ((this->unk_28C != 7) && (this->unk_28C != 6)) { - this->unk_28C = 7; - func_80989ADC(this, play); + if ((this->behavior != DOG_BEHAVIOR_DEKU_WAIT) && (this->behavior != DOG_BEHAVIOR_DEKU)) { + this->behavior = DOG_BEHAVIOR_DEKU_WAIT; + EnDg_SetupIdleMove(this, play); } break; } } } -void func_8098A468(EnDg* this, PlayState* play) { +/** + * Moves the dog along its path, stopping to bark at random intervals. + */ +void EnDg_IdleMove(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; - func_80989674(this, play); + EnDg_MoveAlongPath(this, play); Actor_MoveWithGravity(&this->actor); if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, play); + EnDg_TryPickUp(this, play); } - func_8098A064(this, play); - func_80989974(this); + EnDg_CheckForBremenMaskMarch(this, play); + EnDg_PlaySfxWalk(this); if (!(this->actor.bgCheckFlags & 1)) { - this->actionFunc = func_8098AF98; + this->actionFunc = EnDg_Fall; } - if (DECR(this->unk_282) == 0) { - this->unk_282 = Rand_S16Offset(20, 20); - func_80989140(&this->skelAnime, sAnimations, 3); - this->actionFunc = func_8098A55C; + if (DECR(this->timer) == 0) { + this->timer = Rand_S16Offset(20, 20); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + this->actionFunc = EnDg_IdleBark; } } -void func_8098A55C(EnDg* this, PlayState* play) { +/** + * Stops and barks, before returning to moving along its path. + */ +void EnDg_IdleBark(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, play); + EnDg_TryPickUp(this, play); } - func_809899C8(this, 13.0f); - func_809899C8(this, 19.0f); + EnDg_PlaySfxBark(this, 13.0f); + EnDg_PlaySfxBark(this, 19.0f); + if (!(this->actor.bgCheckFlags & 1)) { - this->actionFunc = func_8098AF98; + this->actionFunc = EnDg_Fall; } - if (DECR(this->unk_282) == 0) { - this->unk_282 = Rand_S16Offset(60, 60); - func_80989ADC(this, play); + if (DECR(this->timer) == 0) { + this->timer = Rand_S16Offset(60, 60); + EnDg_SetupIdleMove(this, play); } } -void func_8098A618(EnDg* this, PlayState* play) { +/** + * Slowly back away from the player while growling. After a short time backing away, + * this function will make the dog away from the player. + */ +void EnDg_BackAwayFromGoron(EnDg* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; - if (DECR(this->unk_282) == 0) { - this->unk_282 = 50; - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098A70C; + if (DECR(this->timer) == 0) { + this->timer = 50; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_RunAwayFromGoron; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); if (this->actor.bgCheckFlags & 8) { this->actor.shape.rot.y = this->actor.wallYaw; } + this->actor.world.rot.y = this->actor.shape.rot.y; Math_ApproachF(&this->actor.speedXZ, -1.5f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } - func_80989974(this); - func_80989A9C(this, 0); + EnDg_PlaySfxWalk(this); + EnDg_PlaySfxGrowl(this, 0); } -void func_8098A70C(EnDg* this, PlayState* play) { +/** + * Quickly run away from the player. Once the dog is far enough from the player, + * this function will make them start barking at them. + */ +void EnDg_RunAwayFromGoron(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 phi_a1; + s16 yRotation; if (this->actor.xzDistToPlayer < 250.0f) { Math_ApproachS(&this->actor.shape.rot.y, -this->actor.yawTowardsPlayer, 4, 0xC00); if (this->actor.bgCheckFlags & 8) { - phi_a1 = this->actor.wallYaw; + yRotation = this->actor.wallYaw; } else { - phi_a1 = 0; + yRotation = 0; } - Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.world.rot.y = this->actor.shape.rot.y; if (player->actor.speedXZ != 0.0f) { Math_ApproachF(&this->actor.speedXZ, player->actor.speedXZ, 0.2f, 1.0f); @@ -652,8 +764,8 @@ void func_8098A70C(EnDg* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } } else { - func_80989140(&this->skelAnime, sAnimations, 3); - this->actionFunc = func_8098A89C; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + this->actionFunc = EnDg_BarkAtGoron; } if (this->actor.speedXZ > 7.0f) { @@ -661,7 +773,8 @@ void func_8098A70C(EnDg* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - func_80989974(this); + EnDg_PlaySfxWalk(this); + if (Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_CRY); } else if (Animation_OnFrame(&this->skelAnime, 6.0f)) { @@ -669,20 +782,23 @@ void func_8098A70C(EnDg* this, PlayState* play) { } } -void func_8098A89C(EnDg* this, PlayState* play) { +/** + * Bark at the player until they get close enough, at which point the dog starts backing away. + */ +void EnDg_BarkAtGoron(EnDg* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 250.0f) { - func_80989140(&this->skelAnime, sAnimations, 11); - this->unk_282 = 50; - this->actionFunc = func_8098A618; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + this->timer = 50; + this->actionFunc = EnDg_BackAwayFromGoron; } - func_80989A08(this, 13.0f); - func_80989A08(this, 19.0f); + EnDg_PlaySfxAngryBark(this, 13.0f); + EnDg_PlaySfxAngryBark(this, 19.0f); } -void func_8098A938(EnDg* this, PlayState* play) { +void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; @@ -695,16 +811,16 @@ void func_8098A938(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 70.0f) { Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 1.0f); if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - s16 y = ABS_ALT(player->actor.shape.rot.y - this->actor.shape.rot.y); + s16 yawDiff = ABS_ALT(player->actor.shape.rot.y - this->actor.shape.rot.y); - this->unk_28E = 20; - if (y < 0x4000) { - func_80989140(&this->skelAnime, sAnimations, 14); - this->actionFunc = func_8098AC34; + this->attackTimer = 20; + if (yawDiff < 0x4000) { + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + this->actionFunc = EnDg_JumpAttack; } else { - func_80989140(&this->skelAnime, sAnimations, 11); - sAnimations[11].playSpeed = -1.0f; - this->actionFunc = func_8098B198; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + sAnimations[DOG_ANIMATION_WALK_BACKWARDS].playSpeed = -1.0f; + this->actionFunc = EnDg_SlowlyBackUpBeforeAttacking; } } } else { @@ -713,102 +829,121 @@ void func_8098A938(EnDg* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - func_80989974(this); - func_80989A08(this, 5.0f); + EnDg_PlaySfxWalk(this); + EnDg_PlaySfxAngryBark(this, 5.0f); } -void func_8098AAAC(EnDg* this, PlayState* play) { - this->unk_280 &= ~8; +/** + * Makes the dog run around for a bit after attacking before it + * starts to approach the player for another attack. + */ +void EnDg_RunAfterAttacking(EnDg* this, PlayState* play) { + this->dogFlags &= ~DOG_FLAG_BOUNCED; Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.1f, 0.5f); Actor_MoveWithGravity(&this->actor); - if (DECR(this->unk_28E) == 0) { - this->unk_28E = 20; - this->actionFunc = func_8098A938; + if (DECR(this->attackTimer) == 0) { + this->attackTimer = 20; + this->actionFunc = EnDg_ApproachPlayerToAttack; } - func_80989974(this); - func_80989A08(this, 3.0f); + EnDg_PlaySfxWalk(this); + EnDg_PlaySfxAngryBark(this, 3.0f); } -void func_8098AB48(EnDg* this, PlayState* play) { +/** + * Makes the dog sit next to the player until they get too far away, at which point + * it will attempt to approach them again. + */ +void EnDg_SitNextToPlayer(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); if (!(this->actor.bgCheckFlags & 1)) { - this->actionFunc = func_8098AF98; + this->actionFunc = EnDg_Fall; } if (this->actor.xzDistToPlayer < 50.0f) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); this->actor.world.rot.y = this->actor.shape.rot.y; } else { - if (player->stateFlags3 & 0x20000000) { - func_80989140(&this->skelAnime, sAnimations, 1); + if (player->stateFlags3 & 0x20000000) { // bremen mask march + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); } else { - func_80989140(&this->skelAnime, sAnimations, 2); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); } - this->actionFunc = func_8098B004; + + this->actionFunc = EnDg_ApproachPlayer; } - func_8098A064(this, play); - if (!(this->unk_280 & 0x20)) { - func_80989A48(this); + EnDg_CheckForBremenMaskMarch(this, play); + + // If we're in this function, the player is either marching with the Bremen Mask, or + // they're a Zora. The below code will make the dog repeatedly whine in the latter case. + if (!(this->dogFlags & DOG_FLAG_FOLLOWING_BREMEN_MASK)) { + EnDg_PlaySfxWhine(this); } } -void func_8098AC34(EnDg* this, PlayState* play) { - s16 sp26 = this->skelAnime.curFrame; +void EnDg_JumpAttack(EnDg* this, PlayState* play) { + s16 curFrame = this->skelAnime.curFrame; if ((this->actor.xyzDistToPlayerSq < 800.0f) && (this->collider.base.atFlags & AT_BOUNCED)) { - this->unk_28E = 60; - this->unk_280 &= ~2; - this->unk_280 |= 8; + this->attackTimer = 60; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + this->dogFlags |= DOG_FLAG_BOUNCED; this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speedXZ *= -1.0f; - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098AAAC; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_RunAfterAttacking; return; } - if (DECR(this->unk_28E) == 0) { - this->unk_28E = 60; - this->unk_280 &= ~2; - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098AAAC; + if (DECR(this->attackTimer) == 0) { + this->attackTimer = 60; + this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_RunAfterAttacking; } - if (sp26 < 9) { + if (curFrame < 9) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - sAnimations[14].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + sAnimations[DOG_ANIMATION_JUMP_ATTACK].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; } - func_80989864(this, play); + + EnDg_SpawnFloorDustRing(this, play); } else { - this->unk_280 |= 2; + this->dogFlags |= DOG_FLAG_JUMP_ATTACKING; if (Animation_OnFrame(&this->skelAnime, 9.0f)) { f32 rand = randPlusMinusPoint5Scaled(1.5f); - sAnimations[14].playSpeed = 1.2f; + sAnimations[DOG_ANIMATION_JUMP_ATTACK].playSpeed = 1.2f; this->actor.velocity.y = 2.0f * rand + 3.0f; this->actor.speedXZ = 8.0f + rand; - } else if (sp26 >= 0x15) { + } else if (curFrame > 20) { Math_ApproachF(&this->actor.speedXZ, 2.5f, 0.2f, 1.0f); } - if (sp26 >= 0x18) { - func_80989864(this, play); + + if (curFrame > 23) { + EnDg_SpawnFloorDustRing(this, play); } + Actor_MoveWithGravity(&this->actor); } - func_80989A9C(this, 10.0f); + EnDg_PlaySfxGrowl(this, 10.0f); } -// Unused? -void func_8098AE58(EnDg* this, PlayState* play) { +/** + * An unused function that will make the dog walk slowly towards the player until they're + * in a specific range, at which point they will bark at them. This might be part of an + * unused or early variation of how dogs react to Goron Link. + */ +void EnDg_WalkToPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - func_80989140(&this->skelAnime, sAnimations, 11); - this->actionFunc = func_8098B28C; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + this->actionFunc = EnDg_BackAwayFromPlayer; } else if (this->actor.xzDistToPlayer < 200.0f) { - func_80989140(&this->skelAnime, sAnimations, 3); - this->actionFunc = func_8098B390; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + this->actionFunc = EnDg_BarkAtPlayer; } else { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -816,29 +951,33 @@ void func_8098AE58(EnDg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - func_80989974(this); - func_809899C8(this, 5.0f); + EnDg_PlaySfxWalk(this); + EnDg_PlaySfxBark(this, 5.0f); } -void func_8098AF44(EnDg* this, PlayState* play) { +void EnDg_SetupBremenMaskApproachPlayer(EnDg* this, PlayState* play) { if (func_801A46F8() == 1) { - this->unk_292 = 10; + this->bremenBarkTimer = 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_BARK); - this->actionFunc = func_8098B004; + this->actionFunc = EnDg_ApproachPlayer; } } -void func_8098AF98(EnDg* this, PlayState* play) { +void EnDg_Fall(EnDg* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098A468; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_IdleMove; } Actor_MoveWithGravity(&this->actor); - func_809899C8(this, 3.0f); + EnDg_PlaySfxBark(this, 3.0f); } -void func_8098B004(EnDg* this, PlayState* play) { +/** + * Approach the player non-aggressively. If the player stops moving, then + * eventually the dog will sit down next to them. + */ +void EnDg_ApproachPlayer(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); this->actor.velocity.y = 0.0f; @@ -851,9 +990,9 @@ void func_8098B004(EnDg* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 40.0f) { - func_80989140(&this->skelAnime, sAnimations, 5); - this->actionFunc = func_8098AB48; - } else if (player->stateFlags3 & 0x20000000) { + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SIT_DOWN); + this->actionFunc = EnDg_SitNextToPlayer; + } else if (player->stateFlags3 & 0x20000000) { // bremen mask march if ((this->actor.xzDistToPlayer > 40.0f) && (player->linearVelocity == 0.0f)) { Math_ApproachF(&this->actor.speedXZ, 1.5f, 0.2f, 1.0f); } else { @@ -863,41 +1002,54 @@ void func_8098B004(EnDg* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } - func_8098A064(this, play); + EnDg_CheckForBremenMaskMarch(this, play); Actor_MoveWithGravity(&this->actor); - func_80989974(this); - if (!(this->unk_280 & 0x20)) { - func_809899C8(this, 3.0f); + EnDg_PlaySfxWalk(this); + + // If we're in this function, the player is either marching with the Bremen Mask, or + // they're a Zora. The below code will make the dog repeatedly bark in the latter case. + if (!(this->dogFlags & DOG_FLAG_FOLLOWING_BREMEN_MASK)) { + EnDg_PlaySfxBark(this, 3.0f); } } -void func_8098B198(EnDg* this, PlayState* play) { +/** + * Makes the dog slowly back up and face the player before performing a jump attack. Used to + * give the dog a bit of time to correct its angle if they were unlikely to hit the player. + */ +void EnDg_SlowlyBackUpBeforeAttacking(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 72.0f) { - func_80989140(&this->skelAnime, sAnimations, 14); - this->actionFunc = func_8098AC34; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + this->actionFunc = EnDg_JumpAttack; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); if (this->actor.bgCheckFlags & 8) { this->actor.shape.rot.y = this->actor.wallYaw; - func_80989140(&this->skelAnime, sAnimations, 14); - this->actionFunc = func_8098AC34; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + this->actionFunc = EnDg_JumpAttack; } this->actor.world.rot.y = this->actor.shape.rot.y; Math_ApproachF(&this->actor.speedXZ, -1.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); - func_80989974(this); - func_80989A9C(this, 4.0f); + EnDg_PlaySfxWalk(this); + EnDg_PlaySfxGrowl(this, 4.0f); } -void func_8098B28C(EnDg* this, PlayState* play) { +/** + * An unused function that will make the dog back away from the player while growling. + * It is quite similar to EnDg_BackAwayFromGoron; perhaps this is an earlier version of it? + * Unlike that function, this will make the dog approach the player if they move too far away. + * It also lacks the behavior where the dog runs away in a panic after a short time. + */ +void EnDg_BackAwayFromPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 200.0f) { - func_80989140(&this->skelAnime, sAnimations, 1); - this->actionFunc = func_8098AE58; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + this->actionFunc = EnDg_WalkToPlayer; } else if (this->actor.xzDistToPlayer > 150.0f) { - func_80989140(&this->skelAnime, sAnimations, 3); - this->actionFunc = func_8098B390; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + this->actionFunc = EnDg_BarkAtPlayer; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); if (this->actor.bgCheckFlags & 8) { @@ -909,69 +1061,86 @@ void func_8098B28C(EnDg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - func_80989974(this); + EnDg_PlaySfxWalk(this); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); } -void func_8098B390(EnDg* this, PlayState* play) { +/** + * An unused function that will make the dog bark at the player endlessly. + * It is quite similar to EnDg_BarkAtGoron; perhaps this is an earlier version of it? + * Unlike that function, this will make the dog approach the player if they move too far away. + * It also mixes in multiple growls into the bark. + */ +void EnDg_BarkAtPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - func_80989140(&this->skelAnime, sAnimations, 11); - this->actionFunc = func_8098B28C; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + this->actionFunc = EnDg_BackAwayFromPlayer; } else if (this->actor.xzDistToPlayer > 200.0f) { - func_80989140(&this->skelAnime, sAnimations, 1); - this->actionFunc = func_8098AE58; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + this->actionFunc = EnDg_WalkToPlayer; } - func_80989A9C(this, 0.0f); - func_80989A9C(this, 1.0f); - func_80989A9C(this, 2.0f); - func_80989A9C(this, 3.0f); - func_809899C8(this, 5.0f); + EnDg_PlaySfxGrowl(this, 0.0f); + EnDg_PlaySfxGrowl(this, 1.0f); + EnDg_PlaySfxGrowl(this, 2.0f); + EnDg_PlaySfxGrowl(this, 3.0f); + EnDg_PlaySfxBark(this, 5.0f); } -void func_8098B464(EnDg* this, PlayState* play) { - Vec3f sp2C; +/** + * Makes a splash effect and plays the splash sfx when the dog enters the water, then + * makes them start swimming. + */ +void EnDg_SetupSwim(EnDg* this, PlayState* play) { + Vec3f pos; + + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; + pos.z = this->actor.world.pos.z + 20.0f; + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 800); + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); - sp2C.x = this->actor.world.pos.x; - sp2C.y = this->actor.world.pos.y + this->actor.depthInWater; - sp2C.z = this->actor.world.pos.z + 20.0f; - EffectSsGSplash_Spawn(play, &sp2C, NULL, NULL, 0, 800); - EffectSsGRipple_Spawn(play, &sp2C, 100, 500, 30); if (this->actor.depthInWater > 0.0f) { this->actor.gravity = 0.0f; this->actor.velocity.y = -3.0f; - this->unk_284 = 10; + this->swimTimer = 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMB_DROP_WATER); - this->actionFunc = func_8098B560; + this->actionFunc = EnDg_Swim; } Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } -void func_8098B560(EnDg* this, PlayState* play) { - Vec3f sp54; +/** + * Makes the dog swim until it either: + * - Touches land, at which point it will just resume its idle movement. + * - Touches a wall, at which point it will attempt to jump out of the water. + */ +void EnDg_Swim(EnDg* this, PlayState* play) { + Vec3f ripplePos; Vec3f pos; - s16 sp46 = 0; + s16 yRotation = 0; WaterBox* waterBox; f32 waterSurface; CollisionPoly* poly; - f32 sp34; + f32 floorHeight; - sp54.x = this->actor.world.pos.x; - sp54.y = this->actor.world.pos.y + this->actor.depthInWater; - sp54.z = this->actor.world.pos.z + 20.0f; + ripplePos.x = this->actor.world.pos.x; + ripplePos.y = this->actor.world.pos.y + this->actor.depthInWater; + ripplePos.z = this->actor.world.pos.z + 20.0f; pos.x = (Math_SinS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.x; pos.y = this->actor.home.pos.y + 100.0f; pos.z = (Math_CosS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.z; - if (DECR(this->unk_284) == 0) { - if (!(this->unk_280 & 4)) { - this->unk_280 |= 4; + if (DECR(this->swimTimer) == 0) { + if (!(this->dogFlags & DOG_FLAG_SWIMMING)) { + this->dogFlags |= DOG_FLAG_SWIMMING; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); } - this->unk_284 = 5; - EffectSsGRipple_Spawn(play, &sp54, 100, 500, 30); + + this->swimTimer = 5; + EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 30); } if (this->actor.depthInWater > 15.0f) { @@ -980,52 +1149,63 @@ void func_8098B560(EnDg* this, PlayState* play) { this->actor.velocity.y = -0.5f; } - sp34 = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos); + floorHeight = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &pos); + + // The below code checks *only* that the dog is touching a wall, which can result in + // some strange behavior if the dog is touching a wall that is too tall for it to jump + // over. For example, if the player throws the dog at a tall wall next to some water, + // this code will make the dog "skip" along the water's surface, assuming the floor + // height is low enough to make it try to jump out. if (this->actor.bgCheckFlags & 8) { if (!WaterBox_GetSurface1(play, &play->colCtx, pos.x, pos.z, &waterSurface, &waterBox)) { - if (sp34 > -100.0f) { - this->unk_280 &= ~4; - this->actionFunc = func_8098B88C; + if (floorHeight > -100.0f) { + this->dogFlags &= ~DOG_FLAG_SWIMMING; + this->actionFunc = EnDg_JumpOutOfWater; } else { - sp46 = this->actor.wallYaw; + yRotation = this->actor.wallYaw; } - } else if (sp34 > -100.0f) { - if (waterSurface < sp34) { - this->unk_280 &= ~4; - this->actionFunc = func_8098B88C; + } else if (floorHeight > -100.0f) { + if (waterSurface < floorHeight) { + this->dogFlags &= ~DOG_FLAG_SWIMMING; + this->actionFunc = EnDg_JumpOutOfWater; } else { - sp46 = this->actor.wallYaw; + yRotation = this->actor.wallYaw; } } else { - sp46 = this->actor.wallYaw; + yRotation = this->actor.wallYaw; } } else if ((this->actor.bgCheckFlags & 1) && !(this->actor.bgCheckFlags & 0x20)) { this->actor.gravity = -3.0f; - this->unk_280 &= ~4; - this->unk_28C = 8; - this->unk_282 = Rand_S16Offset(60, 60); + this->dogFlags &= ~DOG_FLAG_SWIMMING; + this->behavior = DOG_BEHAVIOR_DEFAULT; + this->timer = Rand_S16Offset(60, 60); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); - func_80989140(&this->skelAnime, sAnimations, 2); + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); - this->actionFunc = func_8098A468; + this->actionFunc = EnDg_IdleMove; } - Math_SmoothStepToS(&this->actor.world.rot.y, sp46, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); Actor_MoveWithGravity(&this->actor); } -void func_8098B88C(EnDg* this, PlayState* play) { - Vec3f sp34; +/** + * This function attempts to get the dog out of water by making it jump near walls. + * The point of this is seemingly to let the dog escape the shallow water pools in + * South Clock Town. + */ +void EnDg_JumpOutOfWater(EnDg* this, PlayState* play) { + Vec3f pos; - sp34.x = this->actor.world.pos.x; - sp34.y = this->actor.world.pos.y + this->actor.depthInWater; - sp34.z = this->actor.world.pos.z + 20.0f; + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; + pos.z = this->actor.world.pos.z + 20.0f; - if (DECR(this->unk_284) == 0) { - this->unk_284 = 5; - EffectSsGRipple_Spawn(play, &sp34, 100, 500, 30); + if (DECR(this->swimTimer) == 0) { + this->swimTimer = 5; + EffectSsGRipple_Spawn(play, &pos, 100, 500, 30); } if (this->actor.depthInWater > 15.0f) { @@ -1035,19 +1215,19 @@ void func_8098B88C(EnDg* this, PlayState* play) { } if (this->actor.bgCheckFlags & 8) { - this->actor.world.pos.y = sp34.y; + this->actor.world.pos.y = pos.y; this->actor.velocity.y = 10.0f; - EffectSsGSplash_Spawn(play, &sp34, NULL, NULL, 0, 800); + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 800); } if (!(this->actor.bgCheckFlags & 0x20)) { - this->unk_28C = 8; + this->behavior = DOG_BEHAVIOR_DEFAULT; this->actor.velocity.y = 10.0f; this->actor.gravity = -3.0f; - this->unk_282 = Rand_S16Offset(60, 60); + this->timer = Rand_S16Offset(60, 60); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); - func_80989140(&this->skelAnime, sAnimations, 2); - this->actionFunc = func_8098A468; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + this->actionFunc = EnDg_IdleMove; Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else { Math_ApproachF(&this->actor.speedXZ, 0.5f, 0.2f, 1.0f); @@ -1056,63 +1236,64 @@ void func_8098B88C(EnDg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } -void func_8098BA64(EnDg* this, PlayState* play) { +void EnDg_Held(EnDg* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { - this->unk_290 = 2; + this->grabState = DOG_GRAB_STATE_THROWN_OR_SITTING_AFTER_THROW; this->actor.flags |= ACTOR_FLAG_1; - if (D_8098C2A0 != 0) { + if (sIsAnyDogHeld) { this->actor.flags &= ~ACTOR_FLAG_8000000; - D_8098C2A0 = 0; - this->unk_280 &= ~1; + sIsAnyDogHeld = false; + this->dogFlags &= ~DOG_FLAG_HELD; } + this->selectedDogIndex = -1; sSelectedRacetrackDogInfo.index = this->selectedDogIndex; - this->unk_28A = 100; + this->sitAfterThrowTimer = 100; Actor_MoveWithGravity(&this->actor); - this->unk_280 |= 0x10; - this->actionFunc = func_8098BB10; + this->dogFlags |= DOG_FLAG_THROWN; + this->actionFunc = EnDg_Thrown; } } -void func_8098BB10(EnDg* this, PlayState* play) { +void EnDg_Thrown(EnDg* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->actor.bgCheckFlags & 1) { - if (this->unk_280 & 0x10) { - this->unk_280 &= ~0x10; + if (this->dogFlags & DOG_FLAG_THROWN) { + this->dogFlags &= ~DOG_FLAG_THROWN; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MONKEY_WALK); } this->actor.speedXZ = 0.0f; this->actor.gravity = -3.0f; if (player->transformation == PLAYER_FORM_HUMAN) { - func_80989E18(this, play); + EnDg_TryPickUp(this, play); } } - if (DECR(this->unk_28A) == 0) { - this->unk_290 = 0; - func_80989ADC(this, play); - this->actionFunc = func_8098A468; + if (DECR(this->sitAfterThrowTimer) == 0) { + this->grabState = DOG_GRAB_STATE_NONE; + EnDg_SetupIdleMove(this, play); + this->actionFunc = EnDg_IdleMove; } Actor_MoveWithGravity(&this->actor); } -void func_8098BBEC(EnDg* this, PlayState* play) { +void EnDg_SetupTalk(EnDg* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80989D38(this, play); - this->actionFunc = func_8098BC54; + EnDg_StartTextBox(this, play); + this->actionFunc = EnDg_Talk; } else { func_800B8614(&this->actor, play, 100.0f); } } -void func_8098BC54(EnDg* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 2) { - func_80989140(&this->skelAnime, sAnimations, 0); - this->actionFunc = func_8098BA64; +void EnDg_Talk(EnDg* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_AFTER_TALKING); + this->actionFunc = EnDg_Held; } } @@ -1126,22 +1307,24 @@ void EnDg_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); + this->path = SubS_GetPathByIndex(play, ENDG_GET_PATH(&this->actor), 0x3F); Actor_SetScale(&this->actor, 0.0075f); this->actor.targetMode = 1; this->actor.gravity = -3.0f; - this->unk_282 = Rand_S16Offset(60, 60); - this->unk_280 = 0; - this->unk_28E = 20; - this->unk_284 = 10; + this->timer = Rand_S16Offset(60, 60); + this->dogFlags = DOG_FLAG_NONE; + this->attackTimer = 20; + this->swimTimer = 10; this->index = ENDG_GET_INDEX(&this->actor); - this->unk_28C = 0; - this->unk_290 = 0; + this->behavior = DOG_BEHAVIOR_INITIAL; + this->grabState = DOG_GRAB_STATE_NONE; if (play->sceneNum == SCENE_F01_B) { - this->unk_28A = 100; - func_80989BF8(this); + this->sitAfterThrowTimer = 100; + EnDg_UpdateTextId(this); } - func_80989ADC(this, play); + + EnDg_SetupIdleMove(this, play); } void EnDg_Destroy(Actor* thisx, PlayState* play) { @@ -1154,27 +1337,27 @@ void EnDg_Update(Actor* thisx, PlayState* play) { EnDg* this = THIS; Player* player = GET_PLAYER(play); s32 pad; - Vec3f sp28 = { 0.0f, 0.0f, 0.0f }; + Vec3f floorRot = { 0.0f, 0.0f, 0.0f }; this->selectedDogIndex = sSelectedRacetrackDogInfo.index; if (!(player->stateFlags1 & 0x20) || (play->sceneNum != SCENE_CLOCKTOWER)) { - if (func_8098A1B4(this, play)) { - func_8098A234(this, play); - } else if (this->unk_28C != 8) { - this->unk_28C = 8; - func_80989ADC(this, play); + if (EnDg_ShouldReactToNonHumanPlayer(this, play)) { + EnDg_ChooseActionForForm(this, play); + } else if (this->behavior != DOG_BEHAVIOR_DEFAULT) { + this->behavior = DOG_BEHAVIOR_DEFAULT; + EnDg_SetupIdleMove(this, play); } if ((this->actor.bgCheckFlags & 0x40) && Actor_HasNoParent(&this->actor, play)) { - func_80989140(&this->skelAnime, sAnimations, 15); - this->actionFunc = func_8098B464; + EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SWIM); + this->actionFunc = EnDg_SetupSwim; } this->actionFunc(this, play); - func_80989204(this, play); - func_8098933C(this, &sp28); - Math_ApproachF(&this->unk_294.x, sp28.x, 0.2f, 0.1f); - Math_ApproachF(&this->unk_294.z, sp28.z, 0.2f, 0.1f); + EnDg_UpdateCollision(this, play); + EnDg_GetFloorRot(this, &floorRot); + Math_ApproachF(&this->curRot.x, floorRot.x, 0.2f, 0.1f); + Math_ApproachF(&this->curRot.z, floorRot.z, 0.2f, 0.1f); SkelAnime_Update(&this->skelAnime); } } @@ -1185,14 +1368,14 @@ s32 EnDg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnDg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnDg* this = THIS; - Vec3f sp20 = { 0.0f, 20.0f, 0.0f }; + Vec3f sFocusOffset = { 0.0f, 20.0f, 0.0f }; if (limbIndex == DOG_LIMB_HEAD) { - if (this->actionFunc == func_8098BBEC) { - sp20.x = 5000.0f; - Matrix_MultVec3f(&sp20, &this->actor.focus.pos); - } else if (this->actionFunc != func_8098BC54) { - Matrix_MultVec3f(&sp20, &this->actor.focus.pos); + if (this->actionFunc == EnDg_SetupTalk) { + sFocusOffset.x = 5000.0f; + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); + } else if (this->actionFunc != EnDg_Talk) { + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } } @@ -1237,8 +1420,8 @@ void EnDg_Draw(Actor* thisx, PlayState* play) { } Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateXFApply(this->unk_294.x); - Matrix_RotateZF(this->unk_294.z, MTXMODE_APPLY); + Matrix_RotateXFApply(this->curRot.x); + Matrix_RotateZF(this->curRot.z, MTXMODE_APPLY); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.h b/src/overlays/actors/ovl_En_Dg/z_en_dg.h index 43e65b5f8..2b2bdd7cb 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.h +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.h @@ -19,7 +19,28 @@ struct EnDg; typedef void (*EnDgActionFunc)(struct EnDg*, PlayState*); #define ENDG_GET_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5) -#define ENDG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENDG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) +#define ENDG_PARAMS(path, index) ((path << 10) | (index << 5)) + +typedef enum { + /* 0 */ ENDG_INDEX_RACETRACK_0, + /* 1 */ ENDG_INDEX_RACETRACK_1, + /* 2 */ ENDG_INDEX_RACETRACK_2, + /* 3 */ ENDG_INDEX_RACETRACK_3, + /* 4 */ ENDG_INDEX_RACETRACK_4, + /* 5 */ ENDG_INDEX_RACETRACK_5, + /* 6 */ ENDG_INDEX_RACETRACK_6, + /* 7 */ ENDG_INDEX_RACETRACK_7, + /* 8 */ ENDG_INDEX_RACETRACK_8, + /* 9 */ ENDG_INDEX_RACETRACK_9, + /* 10 */ ENDG_INDEX_RACETRACK_10, + /* 11 */ ENDG_INDEX_RACETRACK_11, + /* 12 */ ENDG_INDEX_RACETRACK_12, + /* 13 */ ENDG_INDEX_RACETRACK_13, + /* 20 */ ENDG_INDEX_ROMANI_RANCH = 20, + /* 21 */ ENDG_INDEX_SWAMP_SPIDER_HOUSE, + /* 31 */ ENDG_INDEX_SOUTH_CLOCK_TOWN = 31 +} EnDgIndex; typedef struct EnDg { /* 0x000 */ Actor actor; @@ -28,20 +49,20 @@ typedef struct EnDg { /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ ColliderCylinder collider; /* 0x1DC */ Path* path; - /* 0x1E0 */ s32 unk_1E0; + /* 0x1E0 */ s32 currentPoint; /* 0x1E4 */ Vec3s jointTable[DOG_LIMB_MAX]; /* 0x232 */ Vec3s morphTable[DOG_LIMB_MAX]; - /* 0x280 */ u16 unk_280; - /* 0x282 */ s16 unk_282; - /* 0x284 */ s16 unk_284; + /* 0x280 */ u16 dogFlags; + /* 0x282 */ s16 timer; + /* 0x284 */ s16 swimTimer; /* 0x286 */ s16 index; /* 0x288 */ s16 selectedDogIndex; - /* 0x28A */ s16 unk_28A; - /* 0x28C */ s16 unk_28C; - /* 0x28E */ s16 unk_28E; - /* 0x290 */ s16 unk_290; - /* 0x292 */ s16 unk_292; - /* 0x294 */ Vec3f unk_294; + /* 0x28A */ s16 sitAfterThrowTimer; + /* 0x28C */ s16 behavior; + /* 0x28E */ s16 attackTimer; + /* 0x290 */ s16 grabState; + /* 0x292 */ s16 bremenBarkTimer; + /* 0x294 */ Vec3f curRot; } EnDg; // size = 0x2A0 extern const ActorInit En_Dg_InitVars; 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 31ede6a6d..c9719f613 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -362,11 +362,11 @@ void func_8089A9B0(EnDinofos* this, PlayState* play) { } void func_8089ABF4(EnDinofos* this, PlayState* play) { - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { Camera* subCam = Play_GetCamera(play, this->subCamId); Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); - this->subCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { func_800B724C(play, &this->actor, 6); @@ -1210,7 +1210,7 @@ void func_8089D318(EnDinofos* this, PlayState* play) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } - this->subCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y; 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 cbe44d834..c9d263b80 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -322,7 +322,7 @@ void func_80A71C3C(EnDno* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80A71E54(this, play); } else if (this->actor.xzDistToPlayer < 60.0f) { func_800B8614(&this->actor, play, 60.0f); @@ -356,7 +356,7 @@ void func_80A71E54(EnDno* this, PlayState* play) { void func_80A71F18(EnDno* this, PlayState* play) { Math_ScaledStepToS(&this->unk_466, 0, 0x16C); switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: if (!(this->unk_3B0 & 0x10) || Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xE38)) { switch (this->textId) { @@ -380,7 +380,7 @@ void func_80A71F18(EnDno* this, PlayState* play) { } break; - case 3: + case TEXT_STATE_3: if (play->msgCtx.currentTextId == 0x80B) { switch (this->unk_32C) { case 16: @@ -402,9 +402,9 @@ void func_80A71F18(EnDno* this, PlayState* play) { } break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: switch (play->msgCtx.currentTextId) { case 0x80B: switch (this->unk_32C) { @@ -537,7 +537,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { func_80A71424(&this->unk_466, 0, 0, 0, 0x2000, 0x16C); switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: switch (this->unk_328) { case 0: if (this->unk_32C == 14) { @@ -569,9 +569,9 @@ void func_80A725F8(EnDno* this, PlayState* play) { } break; - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: if (((play->msgCtx.currentTextId == 0x800) || (play->msgCtx.currentTextId == 0x801)) && (this->unk_32C == 8)) { Math_SmoothStepToF(&this->unk_454, 1.0f, 1.0f, 0.1f, 0.01f); @@ -593,9 +593,9 @@ void func_80A725F8(EnDno* this, PlayState* play) { } break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: switch (play->msgCtx.currentTextId) { case 0x800: case 0x801: @@ -610,11 +610,11 @@ void func_80A725F8(EnDno* this, PlayState* play) { case 0x802: if (Message_ShouldAdvance(play)) { if (INV_CONTENT(ITEM_MASK_SCENTS) == ITEM_MASK_SCENTS) { - this->unk_458 = GI_RUPEE_RED; + this->getItemId = GI_RUPEE_RED; } else { - this->unk_458 = GI_MASK_SCENTS; + this->getItemId = GI_MASK_SCENTS; } - Actor_PickUp(&this->actor, play, this->unk_458, 60.0f, 60.0f); + Actor_PickUp(&this->actor, play, this->getItemId, 60.0f, 60.0f); func_801477B4(play); func_80A72B84(this, play); } @@ -678,7 +678,7 @@ void func_80A72BA4(EnDno* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80A72598; } else { - Actor_PickUp(&this->actor, play, this->unk_458, 60.0f, 60.0f); + Actor_PickUp(&this->actor, play, this->getItemId, 60.0f, 60.0f); } } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.h b/src/overlays/actors/ovl_En_Dno/z_en_dno.h index 9c7861974..bf357cad6 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.h +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.h @@ -48,7 +48,7 @@ typedef struct EnDno { /* 0x44F */ UNK_TYPE1 unk_44F[0x3]; /* 0x452 */ s16 unk_452; /* 0x454 */ f32 unk_454; - /* 0x458 */ s32 unk_458; + /* 0x458 */ s32 getItemId; /* 0x45C */ s16 unk_45C; /* 0x460 */ Actor* unk_460; /* 0x464 */ u16 textId; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index f3b098af6..3d084d849 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -296,7 +296,7 @@ void func_80B3D2D4(EnDnp* this, PlayState* play) { void func_80B3D338(EnDnp* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->unk_32E != 0) && (Message_GetState(&play->msgCtx) == 2)) { + if ((this->unk_32E != 0) && (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING)) { Actor_MarkForDeath(&this->actor); } else if (this->unk_32E == 0) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index b5ae2ac92..36a8b6911 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -343,7 +343,7 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { this->unk_390 = 70.0f; if (Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && - (Message_GetState(&play->msgCtx) == 0) && (ActorCutscene_GetCurrentIndex() == -1)) { + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (ActorCutscene_GetCurrentIndex() == -1)) { if ((DECR(this->unk_384) == 0) && (gSaveContext.save.weekEventReg[29] & 0x40)) { Message_StartTextbox(play, 0x969, NULL); this->unk_384 = 200; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 4255a769e..92dbc1126 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -441,9 +441,9 @@ void func_8092D330(EnDns* this, PlayState* play) { this->unk_2C6 &= ~0x100; play->nextEntranceIndex = 0x5010; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 076ad3221..133fdd6d5 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -532,7 +532,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { this->dyna.actor.textId = baseTextId + textIdOffset; } } else if ((this->unk_1A4 == 5) && (playerPosRelToDoor.z > 0.0f)) { - ScheduleResult sp30; + ScheduleOutput sp30; if (Schedule_RunScript(play, D_8086778C[this->switchFlag], &sp30) != 0) { this->dyna.actor.textId = sp30.result + 0x1800; diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index 7b703c0f5..ece3c0903 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -445,11 +445,11 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { } } -void EnDragon_CameraSetAtEye(EnDragon* this, PlayState* play, Vec3f eye, Vec3f at) { - this->cameraId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); - Math_Vec3f_Copy(&this->cameraEye, &eye); - Math_Vec3f_Copy(&this->cameraAt, &at); - Play_CameraSetAtEye(play, this->cameraId, &this->cameraAt, &this->cameraEye); +void EnDragon_SetSubCamEyeAt(EnDragon* this, PlayState* play, Vec3f subCamEye, Vec3f subCamAt) { + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + Math_Vec3f_Copy(&this->subCamEye, &subCamEye); + Math_Vec3f_Copy(&this->subCamAt, &subCamAt); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { @@ -476,12 +476,12 @@ void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { } } -static Vec3f sCameraEyePerPython[] = { +static Vec3f sSubCamEyePerPython[] = { { 1600.0f, 0.0f, 1400.0f }, { 1400.0f, 0.0f, 400.0f }, { 1800.0f, 0.0f, 1400.f }, { 1100.0f, -200.0f, 1500.0f }, { 2000.0f, 0.0f, 1500.0f }, { 1900.0f, 0.0f, 1800.0f }, { 1700.0f, 0.0f, 1100.0f }, { 1700.0f, 0.0f, 1100.0f }, }; -static Vec3f sCameraAtPerPython[] = { +static Vec3f sSubCamAtPerPython[] = { { 300.0f, -100.0f, 1300.0f }, { 1500.0f, 0.0f, 2400.0f }, { 300.0f, -100.0f, 1300.0f }, { 1900.0f, 500.0f, 600.0f }, { -1000.0f, 0.0f, 1000.0f }, { 1200.0f, 0.0f, 1500.0f }, { 1100.0f, 0.0f, 2000.0f }, { 1100.0f, 0.0f, 2000.0f }, }; @@ -492,10 +492,10 @@ static s32 sMaxGrabTimerPerPython[] = { 5, 5, 5, 4, 5, 8, 5, 5 }; void EnDragon_Grab(EnDragon* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f sp50; // used as both the extended position and the camera eye - Vec3f at; + Vec3f pos; // used as both the extended position and the camera eye + Vec3f subCamAt; - this->cameraId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); SkelAnime_Update(&this->skelAnime); if (this->grabTimer == 0) { @@ -507,10 +507,10 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { Math_Vec3f_Copy(&player->actor.world.pos, &this->playerGrabPositionTemp); } - Math_Vec3f_Copy(&sp50, &this->burrowEntrancePos); - sp50.x += Math_SinS(this->actor.world.rot.y) * -930.0f; - sp50.z += Math_CosS(this->actor.world.rot.y) * -930.0f; - Math_Vec3f_Copy(&this->actor.world.pos, &sp50); + Math_Vec3f_Copy(&pos, &this->burrowEntrancePos); + pos.x += Math_SinS(this->actor.world.rot.y) * -930.0f; + pos.z += Math_CosS(this->actor.world.rot.y) * -930.0f; + Math_Vec3f_Copy(&this->actor.world.pos, &pos); this->jawZRotation = 0x1450; this->actor.speedXZ = 60.0f; } @@ -519,17 +519,18 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, sZRotPerPython[this->pythonIndex], 0xA, 0x1F4, 0x14); EnDragon_SpawnBubbles(this, play, this->jawPos); - Math_Vec3f_Copy(&sp50, &this->burrowEntrancePos); - sp50.x += Math_SinS(this->actor.world.rot.y) * sCameraEyePerPython[this->pythonIndex].x; - sp50.y += sCameraEyePerPython[this->pythonIndex].y; - sp50.z += Math_CosS(this->actor.world.rot.y) * sCameraEyePerPython[this->pythonIndex].z; + Math_Vec3f_Copy(&pos, &this->burrowEntrancePos); - Math_Vec3f_Copy(&at, &this->actor.world.pos); - at.x += Math_SinS(this->actor.world.rot.y) * sCameraAtPerPython[this->pythonIndex].x; - at.y += sCameraAtPerPython[this->pythonIndex].y; - at.z += Math_CosS(this->actor.world.rot.y) * sCameraAtPerPython[this->pythonIndex].z; + pos.x += Math_SinS(this->actor.world.rot.y) * sSubCamEyePerPython[this->pythonIndex].x; + pos.y += sSubCamEyePerPython[this->pythonIndex].y; + pos.z += Math_CosS(this->actor.world.rot.y) * sSubCamEyePerPython[this->pythonIndex].z; - EnDragon_CameraSetAtEye(this, play, sp50, at); + Math_Vec3f_Copy(&subCamAt, &this->actor.world.pos); + subCamAt.x += Math_SinS(this->actor.world.rot.y) * sSubCamAtPerPython[this->pythonIndex].x; + subCamAt.y += sSubCamAtPerPython[this->pythonIndex].y; + subCamAt.z += Math_CosS(this->actor.world.rot.y) * sSubCamAtPerPython[this->pythonIndex].z; + + EnDragon_SetSubCamEyeAt(this, play, pos, subCamAt); if (this->grabTimer > sMaxGrabTimerPerPython[this->pythonIndex]) { if (this->state == DEEP_PYTHON_GRAB_STATE_START) { @@ -560,8 +561,8 @@ void EnDragon_SetupAttack(EnDragon* this) { void EnDragon_Attack(EnDragon* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 currentFrame = this->skelAnime.curFrame; - Vec3f sp4C; // used as both the extended position and the camera eye - Vec3f at; + Vec3f pos; // used as both the extended position and the camera eye + Vec3f subCamAt; SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 0xA, 0x1388, 0); @@ -575,17 +576,17 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { CollisionCheck_GreenBlood(play, NULL, &player->actor.world.pos); } - Math_Vec3f_Copy(&sp4C, &this->actor.world.pos); - sp4C.x += Math_SinS(this->actor.world.rot.y) * 3000.0f; - sp4C.y += 600.0f; - sp4C.z += Math_CosS(this->actor.world.rot.y) * 3000.0f; + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.x += Math_SinS(this->actor.world.rot.y) * 3000.0f; + pos.y += 600.0f; + pos.z += Math_CosS(this->actor.world.rot.y) * 3000.0f; - Math_Vec3f_Copy(&at, &this->actor.world.pos); - at.x += Math_SinS(this->actor.world.rot.y) * 1200.0f; - at.y += -100.0f; - at.z += Math_CosS(this->actor.world.rot.y) * 1200.0f; + Math_Vec3f_Copy(&subCamAt, &this->actor.world.pos); + subCamAt.x += Math_SinS(this->actor.world.rot.y) * 1200.0f; + subCamAt.y += -100.0f; + subCamAt.z += Math_CosS(this->actor.world.rot.y) * 1200.0f; - EnDragon_CameraSetAtEye(this, play, sp4C, at); + EnDragon_SetSubCamEyeAt(this, play, pos, subCamAt); player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; player->actor.world.rot.x = player->actor.shape.rot.x = this->actor.world.rot.x; @@ -593,12 +594,12 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { Math_Vec3f_Copy(&player->actor.world.pos, &this->playerGrabPosition); this->jawZRotation = 0xC8; - Math_Vec3f_Copy(&sp4C, &this->burrowEntrancePos); - sp4C.x += Math_SinS(this->actor.world.rot.y) * -530.0f; - sp4C.z += Math_CosS(this->actor.world.rot.y) * -530.0f; - Math_ApproachF(&this->actor.world.pos.x, sp4C.x, 0.3f, 200.0f); - Math_ApproachF(&this->actor.world.pos.y, sp4C.y, 0.3f, 200.0f); - Math_ApproachF(&this->actor.world.pos.z, sp4C.z, 0.3f, 200.0f); + Math_Vec3f_Copy(&pos, &this->burrowEntrancePos); + pos.x += Math_SinS(this->actor.world.rot.y) * -530.0f; + pos.z += Math_CosS(this->actor.world.rot.y) * -530.0f; + Math_ApproachF(&this->actor.world.pos.x, pos.x, 0.3f, 200.0f); + Math_ApproachF(&this->actor.world.pos.y, pos.y, 0.3f, 200.0f); + Math_ApproachF(&this->actor.world.pos.z, pos.z, 0.3f, 200.0f); if ((this->state <= DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BITE); diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h index 1e6a0aa3c..b12c63dd0 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h @@ -31,8 +31,8 @@ typedef struct EnDragon { /* 0x254 */ Vec3f jawPos; /* 0x260 */ Vec3f burrowEntrancePos; // Vertically and horizontally centered on the burrow opening. Set by Bg_Sinkai_Kabe /* 0x26C */ Vec3f playerGrabPosition; - /* 0x278 */ Vec3f cameraEye; - /* 0x278 */ Vec3f cameraAt; + /* 0x278 */ Vec3f subCamEye; + /* 0x278 */ Vec3f subCamAt; /* 0x290 */ Vec3f playerGrabPositionTemp; /* 0x29C */ Vec3f focusPos; /* 0x2A8 */ s16 jawZRotation; @@ -50,7 +50,7 @@ typedef struct EnDragon { /* 0x2C0 */ s16 grabCutsceneIndex; /* 0x2C2 */ s16 deathCutsceneIndex; /* 0x2C4 */ UNK_TYPE1 unk_2C4[0x4]; - /* 0x2C8 */ s16 cameraId; + /* 0x2C8 */ s16 subCamId; /* 0x2CA */ s16 grabTimer; // Counts up from the time a grab starts until the time the actor begins attacking /* 0x2CC */ s16 unk_2CC; // Initialized, but never used /* 0x2CE */ UNK_TYPE1 unk_2CE[0x2]; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 6269958ec..d15827ba8 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1359,7 +1359,7 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { func_8088FA38(this, play); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { if (play->msgCtx.currentTextId == 0x202) { switch (play->msgCtx.choiceIndex) { @@ -1385,10 +1385,10 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { - case 576: + case 0x240: func_80151938(play, 0x245); break; @@ -1434,7 +1434,7 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { } break; - case 2: + case TEXT_STATE_CLOSING: func_8088FDCC(this); break; } @@ -1555,7 +1555,7 @@ s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p if (this->fairyFlags & 0x200) { scale *= 2.0f; } - scale *= this->actor.scale.x * 124.99999f; + scale *= this->actor.scale.x * (1.0f / 0.008f); Matrix_MultVec3f(&zeroVec, &sp34); Matrix_Translate(sp34.x, sp34.y, sp34.z, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c index e02ac1118..d0bc05b8b 100644 --- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c +++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c @@ -73,10 +73,10 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - childActor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELFORG, this->actor.world.pos.x, - this->actor.world.pos.y + 12.0f, this->actor.world.pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, - ((ENELFBUB_GET_SWITCHFLAG(&this->actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_BUBBLE); + childActor = Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_ELFORG, this->actor.world.pos.x, this->actor.world.pos.y + 12.0f, + this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, + STRAY_FAIRY_PARAMS(ENELFBUB_GET_SWITCHFLAG(&this->actor), 0, STRAY_FAIRY_TYPE_BUBBLE)); if (childActor != NULL) { childActor->parent = &this->actor; } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index aa0be1762..cde9358ae 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -241,7 +241,7 @@ void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) { s32 pad; s32 i; Actor* elforg; - s32 temp; + s32 params; Vec3f sp6C; Player* player = GET_PLAYER(play); @@ -252,16 +252,16 @@ void func_80A39DC8(EnElfgrp* this, PlayState* play, s32 arg2, s32 arg3) { if (arg3 == 0) { sp6C = this->actor.world.pos; sp6C.y += 20.0f; - temp = ((this->unk_147 & 7) << 6) | STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN; + params = STRAY_FAIRY_PARAMS(0, this->unk_147, STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN); } else { sp6C = player->actor.world.pos; sp6C.y += 20.0f; - temp = ((this->unk_147 & 7) << 6) | STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN; + params = STRAY_FAIRY_PARAMS(0, this->unk_147, STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN); } for (i = 0; i < arg2; i++) { elforg = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELFORG, randPlusMinusPoint5Scaled(20.0f) + sp6C.x, sp6C.y, - randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, temp); + randPlusMinusPoint5Scaled(20.0f) + sp6C.z, 0, 0, 0, params); if (elforg == NULL) { continue; } @@ -284,8 +284,8 @@ s32 func_80A39F50(PlayState* play) { } elfOrg = (EnElforg*)itemAction; - if (!(elfOrg->flags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME)) { - elfOrg->flags |= STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME; + if (!(elfOrg->strayFairyFlags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME)) { + elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME; } itemAction = itemAction->next; } @@ -307,8 +307,8 @@ s32 func_80A39FBC(PlayState* play) { } elfOrg = (EnElforg*)itemAction; - if (!(elfOrg->flags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN)) { - elfOrg->flags |= STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; + if (!(elfOrg->strayFairyFlags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN)) { + elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; if (phi_v1 >= 100) { return phi_v1; } @@ -336,7 +336,7 @@ void func_80A3A044(PlayState* play) { elfOrg = (EnElforg*)itemAction; elfOrg->actor.home.rot.x = 0x14; - elfOrg->flags |= STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS; + elfOrg->strayFairyFlags |= STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS; itemAction = itemAction->next; } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 915eb1d6c..04ad98f8f 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -5,7 +5,6 @@ */ #include "z_en_elforg.h" -#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -70,34 +69,37 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { s32 pad; EnElforg* this = THIS; - Actor_SetScale(&this->actor, 0.01f); - this->flags = 0; + Actor_SetScale(thisx, 0.01f); + this->strayFairyFlags = 0; this->direction = 0; SkelAnime_InitFlex(play, &this->skelAnime, &gStrayFairySkel, &gStrayFairyFlyingAnim, this->jointTable, this->jointTable, STRAY_FAIRY_LIMB_MAX); this->skelAnime.playSpeed = 1.0f; - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - this->actor.shape.shadowAlpha = 255; + ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); + thisx->shape.shadowAlpha = 255; - switch (STRAY_FAIRY_TYPE(&this->actor)) { + switch (STRAY_FAIRY_TYPE(thisx)) { case STRAY_FAIRY_TYPE_CLOCK_TOWN: if (gSaveContext.save.weekEventReg[8] & 0x80) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(thisx); return; } break; + case STRAY_FAIRY_TYPE_COLLECTIBLE: - if (Flags_GetCollectible(play, STRAY_FAIRY_FLAG(&this->actor))) { - Actor_MarkForDeath(&this->actor); + if (Flags_GetCollectible(play, STRAY_FAIRY_FLAG(thisx))) { + Actor_MarkForDeath(thisx); return; } break; + default: - if (Flags_GetSwitch(play, STRAY_FAIRY_FLAG(&this->actor))) { - Actor_MarkForDeath(&this->actor); + if (Flags_GetSwitch(play, STRAY_FAIRY_FLAG(thisx))) { + Actor_MarkForDeath(thisx); return; } break; + case STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN: case STRAY_FAIRY_TYPE_BUBBLE: case STRAY_FAIRY_TYPE_CHEST: @@ -108,44 +110,48 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { if (Map_IsInDungeonOrBossArea(play)) { this->area = gSaveContext.dungeonIndex + STRAY_FAIRY_AREA_WOODFALL; } else { - // Needs to be thisx in order to match this->area = STRAY_FAIRY_GET_NON_DUNGEON_AREA(thisx); } - switch (STRAY_FAIRY_TYPE(&this->actor)) { + switch (STRAY_FAIRY_TYPE(thisx)) { case STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN: EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloatingFairyFountain; this->targetSpeedXZ = Rand_ZeroFloat(2.0f) + 1.0f; this->targetDistanceFromHome = Rand_ZeroFloat(100.0f) + 50.0f; break; + case STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN: EnElforg_InitializeParams(this); this->actionFunc = EnElforg_TurnInFairy; this->secondaryTimer = 60; break; + case STRAY_FAIRY_TYPE_BUBBLE: this->timer = 0; this->actionFunc = EnElforg_TrappedByBubble; break; + case STRAY_FAIRY_TYPE_ENEMY: this->actionFunc = EnElforg_SetupTrappedByEnemy; EnElforg_SetupTrappedByEnemy(this, play); - this->actor.draw = NULL; + thisx->draw = NULL; break; + case STRAY_FAIRY_TYPE_COLLIDER: this->actionFunc = EnElforg_HiddenByCollider; - this->actor.draw = NULL; - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); + thisx->draw = NULL; + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sCylinderInit); + Collider_UpdateCylinder(thisx, &this->collider); break; + default: EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloating; break; } - this->actor.shape.rot.y = 0; + thisx->shape.rot.y = 0; } void EnElforg_Destroy(Actor* thisx, PlayState* play) { @@ -216,6 +222,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) { zDifference = this->actor.world.pos.z - homePos->z; targetAngle = Math_FAtan2F(-zDifference, -xDifference); xzDistance = sqrtf(SQ(xDifference) + SQ(zDifference)); + if ((this->targetDistanceFromHome + 10.0f) < xzDistance) { angleAdjustment = 0x1000; } else if ((this->targetDistanceFromHome - 10.0f) > xzDistance) { @@ -223,6 +230,7 @@ void EnElforg_MoveToTargetFairyFountain(EnElforg* this, Vec3f* homePos) { } else { angleAdjustment = 0x4000; } + targetAngle += angleAdjustment; Math_SmoothStepToS(&this->actor.world.rot.y, targetAngle, 2, 4000, 1000); EnElforg_ApproachTargetSpeedXZ(this); @@ -240,6 +248,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) { this->actor.shape.yOffset += 100.0f * Math_SinS(this->timer << 9); EnElforg_ApproachTargetYPosition(this, targetPos); targetAngle = Math_FAtan2F(-(this->actor.world.pos.z - targetPos->z), -(this->actor.world.pos.x - targetPos->x)); + if (this->targetSpeedXZ > 2.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, targetAngle, 2, 0x400, 0x100); } else { @@ -248,6 +257,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) { targetAngle += 0x2000; Math_SmoothStepToS(&this->actor.world.rot.y, targetAngle, 10, 0x200, 0x80); } + EnElforg_ApproachTargetSpeedXZ(this); Actor_MoveWithGravity(&this->actor); } @@ -258,6 +268,7 @@ void func_80ACCBB8(EnElforg* this, PlayState* play) { void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); + if ((this->actor.parent == NULL) || (this->actor.parent->update == NULL)) { EnElforg_InitializeParams(this); this->actionFunc = EnElforg_FreeFloating; @@ -266,6 +277,7 @@ void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) { this->actor.world.pos = this->actor.parent->world.pos; this->actor.world.pos.y += 12.0f; } + func_80ACCBB8(this, play); } @@ -282,10 +294,12 @@ void EnElforg_TurnInFairy(EnElforg* this, PlayState* play) { this->actor.shape.yOffset *= 0.9f; this->actor.speedXZ = 5.0f; EnElforg_ApproachTargetYPosition(this, &player->bodyPartsPos[0]); + xzDistToPlayer = this->actor.xzDistToPlayer; if (xzDistToPlayer < 0.0f) { xzDistToPlayer = 10.0f; } + newAngle = 0x28000 / xzDistToPlayer; Math_SmoothStepToF(&xzDistToPlayer, 40.0f, 0.2f, 100.0f, 1.0f); rotationTemp = this->actor.yawTowardsPlayer - newAngle; @@ -303,7 +317,7 @@ void EnElforg_TurnInFairy(EnElforg* this, PlayState* play) { this->targetSpeedXZ = 3.0f; this->targetDistanceFromHome = 50.0f; this->actionFunc = EnElforg_FreeFloatingFairyFountain; - this->flags &= ~STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; + this->strayFairyFlags &= ~STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN; } } @@ -313,19 +327,21 @@ void EnElforg_QuicklyCircleFairyFountain(EnElforg* this, PlayState* play) { if (this->secondaryTimer <= 30) { this->actionFunc = EnElforg_TurnInFairy; } + this->secondaryTimer--; } void EnElforg_FreeFloatingFairyFountain(EnElforg* this, PlayState* play) { s32 pad; - if (this->flags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME) { + if (this->strayFairyFlags & STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME) { // This happens when "turning in" the last batch of Stray Fairies to // a Fairy Fountain. The ones being "turned in" will fly very // quickly to the center of the fountain. if (this->targetSpeedXZ < 8.0f) { this->targetSpeedXZ += 0.1f; } + if (this->targetDistanceFromHome > 0.0f) { this->targetDistanceFromHome -= 2.0f; } @@ -335,22 +351,27 @@ void EnElforg_FreeFloatingFairyFountain(EnElforg* this, PlayState* play) { } else { this->targetSpeedXZ = Rand_ZeroFloat(2.0f) + 1.0f; } + this->targetDistanceFromHome = Rand_ZeroFloat(100.0f) + 50.0f; } + SkelAnime_Update(&this->skelAnime); EnElforg_MoveToTargetFairyFountain(this, &this->actor.home.pos); - if (this->flags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN) { + + if (this->strayFairyFlags & STRAY_FAIRY_FLAG_CIRCLES_QUICKLY_IN_FOUNTAIN) { // A small number of fairies will do this when the player walks into // the center of the fountain to be healed. this->actionFunc = EnElforg_QuicklyCircleFairyFountain; } - if (this->flags & STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS) { + + if (this->strayFairyFlags & STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS) { // This happens right before the Great Fairy appears once all // Stray Fairies are saved. if (this->actor.home.rot.x > 0) { EnElforg_SpawnSparkles(this, play, 10); this->actor.home.rot.x--; } + Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); if (this->actor.scale.x < 0.001f) { Actor_MarkForDeath(&this->actor); @@ -369,6 +390,7 @@ void EnElforg_CirclePlayer(EnElforg* this, PlayState* play) { } else { distanceFromPlayer = 20.0f; } + this->actor.world.pos.x = (Math_SinS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.x; this->actor.world.pos.z = (Math_CosS(this->timer << 12) * distanceFromPlayer) + playerActor->world.pos.z; this->actor.world.pos.y = player->bodyPartsPos[0].y; @@ -381,6 +403,7 @@ void EnElforg_FairyCollected(EnElforg* this, PlayState* play) { Actor_MarkForDeath(&this->actor); return; } + func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } @@ -445,9 +468,11 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { case STRAY_FAIRY_TYPE_COLLECTIBLE: Flags_SetCollectible(play, STRAY_FAIRY_FLAG(&this->actor)); break; + case STRAY_FAIRY_TYPE_CHEST: Flags_SetTreasure(play, STRAY_FAIRY_FLAG(&this->actor)); break; + default: Flags_SetSwitch(play, STRAY_FAIRY_FLAG(&this->actor)); break; @@ -456,6 +481,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { if (STRAY_FAIRY_TYPE(&this->actor) == STRAY_FAIRY_TYPE_CLOCK_TOWN) { player->actor.freezeTimer = 100; player->stateFlags1 |= 0x20000000; + // Bring me back to North Clock Town! Message_StartTextbox(play, 0x579, NULL); this->actionFunc = EnElforg_ClockTownFairyCollected; ActorCutscene_SetIntentToPlay(0x7C); @@ -464,6 +490,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { if (Map_IsInDungeonOrBossArea(play)) { gSaveContext.save.inventory.strayFairies[gSaveContext.dungeonIndex]++; + // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { func_801A3098(NA_BGM_GET_ITEM | 0x900); @@ -474,12 +501,13 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 7); func_80ACCBB8(this, play); if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { - if (!(this->flags & STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED)) { + if (!(this->strayFairyFlags & STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED)) { play_sound(NA_SE_SY_FAIRY_MASK_SUCCESS); } - this->flags |= STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED; + + this->strayFairyFlags |= STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED; } else { - this->flags &= ~STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED; + this->strayFairyFlags &= ~STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED; } } } @@ -499,6 +527,7 @@ Actor* EnElforg_GetHoldingEnemy(EnElforg* this, PlayState* play) { return enemy; } } + return NULL; } @@ -523,6 +552,7 @@ void EnElforg_TrappedByEnemy(EnElforg* this, PlayState* play) { this->actor.world.pos.z = posTemp; this->actor.home.pos.z = posTemp; } + func_80ACCBB8(this, play); } @@ -546,6 +576,7 @@ void EnElforg_HiddenByCollider(EnElforg* this, PlayState* play) { } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } + func_80ACCBB8(this, play); } @@ -598,19 +629,24 @@ void EnElforg_Draw(Actor* thisx, PlayState* play) { case STRAY_FAIRY_AREA_WOODFALL: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyWoodfallTexAnim)); break; + case STRAY_FAIRY_AREA_SNOWHEAD: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairySnowheadTexAnim)); break; + case STRAY_FAIRY_AREA_GREAT_BAY: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyGreatBayTexAnim)); break; + case STRAY_FAIRY_AREA_STONE_TOWER: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyStoneTowerTexAnim)); break; + default: AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gStrayFairyClockTownTexAnim)); break; } + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); POLY_XLU_DISP = diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h index 55695240f..5de48e955 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h @@ -2,10 +2,12 @@ #define Z_EN_ELFORG_H #include "global.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define STRAY_FAIRY_TYPE(thisx) ((thisx)->params & 0xF) #define STRAY_FAIRY_GET_NON_DUNGEON_AREA(thisx) (((thisx)->params & 0x1C0) >> 6) #define STRAY_FAIRY_FLAG(thisx) (((thisx)->params & 0xFE00) >> 9) +#define STRAY_FAIRY_PARAMS(flag, nonDungeonArea, type) (((flag & 0x7F) << 9) | ((nonDungeonArea & 7) << 6) | (type & 0xF)) #define STRAY_FAIRY_FLAG_MOVES_QUICKLY_TO_HOME (1 << 0) #define STRAY_FAIRY_FLAG_SPARKLES_AND_SHRINKS (1 << 1) @@ -13,40 +15,26 @@ #define STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED (1 << 3) typedef enum { - STRAY_FAIRY_TYPE_FREE_FLOATING, // The ones just floating around - STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN, // The ones already present when you enter a Fairy Fountain - STRAY_FAIRY_TYPE_BUBBLE, // The ones trapped in bubbles - STRAY_FAIRY_TYPE_CLOCK_TOWN, // The free-floating Stray Fairies in Clock Town - STRAY_FAIRY_TYPE_ENEMY, // The ones trapped inside enemies - STRAY_FAIRY_TYPE_COLLIDER, // Unused in retail. The fairy is hidden until the collider is hit - STRAY_FAIRY_TYPE_CHEST, // The ones in treasure chests - STRAY_FAIRY_TYPE_COLLECTIBLE, // The ones in boxes, pots, beehives, etc. - STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN // The ones you "turn in" by walking into a Fairy Fountain + /* 0 */ STRAY_FAIRY_TYPE_FREE_FLOATING, // The ones just floating around + /* 1 */ STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN, // The ones already present when you enter a Fairy Fountain + /* 2 */ STRAY_FAIRY_TYPE_BUBBLE, // The ones trapped in bubbles + /* 3 */ STRAY_FAIRY_TYPE_CLOCK_TOWN, // The free-floating Stray Fairies in Clock Town + /* 4 */ STRAY_FAIRY_TYPE_ENEMY, // The ones trapped inside enemies + /* 5 */ STRAY_FAIRY_TYPE_COLLIDER, // Unused in retail. The fairy is hidden until the collider is hit + /* 6 */ STRAY_FAIRY_TYPE_CHEST, // The ones in treasure chests + /* 7 */ STRAY_FAIRY_TYPE_COLLECTIBLE, // The ones in boxes, pots, beehives, etc. + /* 8 */ STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN // The ones you "turn in" by walking into a Fairy Fountain } StrayFairyType; typedef enum { - STRAY_FAIRY_AREA_CLOCK_TOWN, - STRAY_FAIRY_AREA_WOODFALL, - STRAY_FAIRY_AREA_SNOWHEAD, - STRAY_FAIRY_AREA_GREAT_BAY, - STRAY_FAIRY_AREA_STONE_TOWER, - STRAY_FAIRY_AREA_MAX + /* 0 */ STRAY_FAIRY_AREA_CLOCK_TOWN, + /* 1 */ STRAY_FAIRY_AREA_WOODFALL, + /* 2 */ STRAY_FAIRY_AREA_SNOWHEAD, + /* 3 */ STRAY_FAIRY_AREA_GREAT_BAY, + /* 4 */ STRAY_FAIRY_AREA_STONE_TOWER, + /* 5 */ STRAY_FAIRY_AREA_MAX } StrayFairyArea; -typedef enum { - /* 0 */ STRAY_FAIRY_LIMB_NONE, - /* 1 */ STRAY_FAIRY_LIMB_RIGHT_FACING_HEAD, - /* 2 */ STRAY_FAIRY_LIMB_LEFT_WING, - /* 3 */ STRAY_FAIRY_LIMB_RIGHT_WING, - /* 4 */ STRAY_FAIRY_LIMB_GLOW, - /* 5 */ STRAY_FAIRY_LIMB_TORSO, - /* 6 */ STRAY_FAIRY_LIMB_RIGHT_ARM, - /* 7 */ STRAY_FAIRY_LIMB_PELVIS_AND_LEGS, - /* 8 */ STRAY_FAIRY_LIMB_LEFT_ARM, - /* 9 */ STRAY_FAIRY_LIMB_LEFT_FACING_HEAD, - /* 10 */ STRAY_FAIRY_LIMB_MAX, -} StrayFairyLimbs; - struct EnElforg; typedef void (*EnElforgActionFunc)(struct EnElforg*, PlayState*); @@ -57,7 +45,7 @@ typedef struct EnElforg { /* 0x188 */ Vec3s jointTable[STRAY_FAIRY_LIMB_MAX]; /* 0x1C4 */ ColliderCylinder collider; /* 0x210 */ Actor* enemy; - /* 0x214 */ u16 flags; + /* 0x214 */ u16 strayFairyFlags; /* 0x216 */ s16 direction; // negative when facing right, positive when facing left /* 0x218 */ s16 area; /* 0x21C */ s32 timer; diff --git a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h index 013c907a5..499da9663 100644 --- a/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h +++ b/src/overlays/actors/ovl_En_Encount4/z_en_encount4.h @@ -8,12 +8,13 @@ struct EnEncount4; typedef void (*EnEncount4ActionFunc)(struct EnEncount4*, PlayState*); typedef struct EnEncount4 { - /* 0x000 */ Actor actor; - /* 0x144 */ EnEncount4ActionFunc actionFunc; - /* 0x148 */ char unk_148[0x4]; - /* 0x14C */ s16 unk_14C; - /* 0x14E */ s16 unk_14E; - /* 0x150 */ char unk_150[0x8]; + /* 0x0000 */ Actor actor; + /* 0x0144 */ EnEncount4ActionFunc actionFunc; + /* 0x0148 */ char unk_148[0x4]; + /* 0x014C */ s16 unk_14C; + /* 0x014E */ s16 unk_14E; + /* 0x0150 */ s16 unk_150; + /* 0x0152 */ char unk_152[0x6]; } EnEncount4; // size = 0x158 extern const ActorInit En_Encount4_InitVars; diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c index 9a58673d0..716237321 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c @@ -38,7 +38,7 @@ void EnEndingHero4_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 6; this->actor.gravity = -3.0f; - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierCheerWithSpear, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierCheerWithSpear, this->jointTable, this->morphTable, 17); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); func_80C23748(this); diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index e22603b4e..d6da2f978 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -37,9 +37,9 @@ const ActorInit En_Ending_Hero6_InitVars = { }; static FlexSkeletonHeader* sSkeletons[] = { - &object_dt_Skel_00B0CC, &object_bai_Skel_007908, &object_toryo_Skel_007150, - &gSoldierSkeleton, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, - &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, + &object_dt_Skel_00B0CC, &object_bai_Skel_007908, &object_toryo_Skel_007150, &gSoldierSkel, + &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850, + &object_daiku_Skel_00A850, }; static AnimationHeader* sAnimations[] = { diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 09496a4ae..646d8b08c 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -343,9 +343,9 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { } else if (play->csCtx.frames > 1600) { play->nextEntranceIndex = 0x2C00; gSaveContext.nextCutsceneIndex = 0xFFF2; - play->transitionTrigger = 0x14; - play->unk_1887F = 2; - gSaveContext.nextTransition = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_02; + gSaveContext.nextTransitionType = TRANS_TYPE_02; sGiantsCutsceneState = 9; } break; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 9c6044685..d8cbe91f5 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -78,39 +78,48 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit sColChkInfoInit = { 1, 10, 10, 10 }; +typedef enum { + /* 0 */ KEESE_DMGEFF_NONE, + /* 1 */ KEESE_DMGEFF_STUN, + /* 2 */ KEESE_DMGEFF_FIRE, + /* 3 */ KEESE_DMGEFF_ICE, + /* 4 */ KEESE_DMGEFF_LIGHT, + /* 5 */ KEESE_DMGEFF_ELECTRIC +} BatDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0x0), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), + /* Deku Nut */ DMG_ENTRY(0, KEESE_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Goron punch */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, KEESE_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, KEESE_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, KEESE_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, KEESE_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, KEESE_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, KEESE_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, KEESE_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, KEESE_DMGEFF_NONE), }; static InitChainEntry sInitChain[] = { @@ -265,7 +274,7 @@ void EnFirefly_SetupFlyIdle(EnFirefly* this) { this->timer = Rand_S16Offset(70, 100); this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 1.5f; Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300); - this->targetPitch = ((this->maxAltitude < this->actor.world.pos.y) ? 0xC00 : -0xC00) + 0x1554; + this->pitchTarget = ((this->maxAltitude < this->actor.world.pos.y) ? 0xC00 : -0xC00) + 0x1554; this->skelAnime.playSpeed = 1.0f; this->actionFunc = EnFirefly_FlyIdle; } @@ -295,25 +304,25 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { // Climb if too close to ground if (this->actor.world.pos.y < this->actor.floorHeight + 20.0f) { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; // Descend if above maxAltitude } else if (this->maxAltitude < this->actor.world.pos.y) { - this->targetPitch = 0x2154; + this->pitchTarget = 0x2154; // Otherwise ascend or descend at random, biased towards ascending } else if (Rand_ZeroOne() > 0.35f) { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } else { - this->targetPitch = 0x2154; + this->pitchTarget = 0x2154; } } else { if (this->actor.bgCheckFlags & 1) { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + this->pitchTarget = 0x2154; } } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } if (this->actor.bgCheckFlags & 8) { @@ -338,19 +347,19 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); } - if (this->actor.colChkInfo.damageEffect == 3) { + if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_ICE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffAlpha = 1.0f; this->drawDmgEffScale = 0.55f; - this->drawDmgEffFrozenSteamScale = 0.82500005f; - } else if (this->actor.colChkInfo.damageEffect == 4) { + this->drawDmgEffFrozenSteamScale = 0.55f * 1.5f; + } else if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_LIGHT) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_SMALL_LIGHT_RAYS); - } else if (this->actor.colChkInfo.damageEffect == 2) { + } else if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_FIRE) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; @@ -409,7 +418,7 @@ void EnFirefly_Die(EnFirefly* this, PlayState* play) { void EnFirefly_SetupDiveAttack(EnFirefly* this) { this->timer = Rand_S16Offset(70, 100); this->skelAnime.playSpeed = 1.0f; - this->targetPitch = ((this->actor.playerHeightRel > 0.0f) ? -0xC00 : 0xC00) + 0x1554; + this->pitchTarget = ((this->actor.playerHeightRel > 0.0f) ? -0xC00 : 0xC00) + 0x1554; this->actionFunc = EnFirefly_DiveAttack; } @@ -427,7 +436,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { if (this->actor.bgCheckFlags & 8) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } else if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { if (Animation_OnFrame(&this->skelAnime, 4.0f)) { this->skelAnime.playSpeed = 0.0f; @@ -447,19 +456,19 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { } if (this->actor.bgCheckFlags & 1) { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + this->pitchTarget = 0x2154; } else { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } - if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags2 & 0x80) || + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_STONE) || (player->stateFlags2 & PLAYER_STATE2_80) || (player->actor.freezeTimer > 0)) { EnFirefly_SetupFlyAway(this); } @@ -491,7 +500,7 @@ void EnFirefly_Rebound(EnFirefly* this, PlayState* play) { void EnFirefly_SetupFlyAway(EnFirefly* this) { this->timer = 150; - this->targetPitch = 0x954; + this->pitchTarget = 0x954; this->actionFunc = EnFirefly_FlyAway; this->skelAnime.playSpeed = 1.0f; } @@ -513,11 +522,11 @@ void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); if (this->actor.bgCheckFlags & 1) { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + this->pitchTarget = 0x2154; } else { - this->targetPitch = 0x954; + this->pitchTarget = 0x954; } if (this->actor.bgCheckFlags & 8) { @@ -526,7 +535,7 @@ void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x300); } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->pitchTarget, 0x100); } void EnFirefly_SetupStunned(EnFirefly* this) { @@ -632,10 +641,10 @@ void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); - if (this->actor.colChkInfo.damageEffect == 1) { + if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_STUN) { this->timer = 40; EnFirefly_SetupStunned(this); - } else if (this->actor.colChkInfo.damageEffect == 5) { + } else if (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_ELECTRIC) { this->timer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; this->drawDmgEffAlpha = 2.0f; @@ -647,9 +656,9 @@ void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; // Negate effects of fire on Fire Keese and Ice on Ice Keese - if (((this->currentType == KEESE_FIRE) && (this->actor.colChkInfo.damageEffect == 2)) || - ((this->currentType == KEESE_ICE) && (this->actor.colChkInfo.damageEffect == 3))) { - this->actor.colChkInfo.damageEffect = 0; + if (((this->currentType == KEESE_FIRE) && (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_FIRE)) || + ((this->currentType == KEESE_ICE) && (this->actor.colChkInfo.damageEffect == KEESE_DMGEFF_ICE))) { + this->actor.colChkInfo.damageEffect = KEESE_DMGEFF_NONE; } EnFirefly_SetupFall(this, play); @@ -714,7 +723,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.275f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); - } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f)) { + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.55f / 40.0f)) { func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } @@ -755,7 +764,7 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if ((this->currentType != KEESE_FIRE) && (limbIndex == 27)) { gSPDisplayList((*gfx)++, object_firefly_DL_001678); - } else if ((this->unk_2F4 != play->gameplayFrames) && + } else if ((this->lastDrawnFrame != play->gameplayFrames) && ((this->auraType == KEESE_AURA_FIRE) || (this->auraType == KEESE_AURA_ICE)) && ((limbIndex == 15) || (limbIndex == 21))) { if (this->actionFunc != EnFirefly_Die) { @@ -832,7 +841,7 @@ void EnFirefly_Draw(Actor* thisx, PlayState* play) { Actor_DrawDamageEffects(play, NULL, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale * this->actor.scale.y * 200.0f, this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); - this->unk_2F4 = play->gameplayFrames; + this->lastDrawnFrame = play->gameplayFrames; CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index cb6019d5e..ffb295e6a 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -26,14 +26,14 @@ typedef struct EnFirefly { /* 0x18E */ u8 isInvisible; /* 0x18F */ u8 drawDmgEffType; /* 0x190 */ s16 timer; - /* 0x192 */ s16 targetPitch; + /* 0x192 */ s16 pitchTarget; /* 0x194 */ Vec3s jointTable[28]; /* 0x23C */ Vec3s morphTable[28]; /* 0x2E4 */ f32 maxAltitude; /* 0x2E8 */ f32 drawDmgEffAlpha; /* 0x2E8 */ f32 drawDmgEffScale; /* 0x2E8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2F4 */ u32 unk_2F4; + /* 0x2F4 */ u32 lastDrawnFrame; /* 0x2F8 */ Vec3f limbPos[3]; /* 0x31C */ ColliderSphere collider; } EnFirefly; // size = 0x374 diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index a81d6f573..f0e2d5c42 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -435,7 +435,7 @@ void func_80B29128(EnFish2* this) { } void func_80B2913C(EnFish2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80B28B5C(this); } @@ -795,13 +795,13 @@ void func_80B2A01C(EnFish2* this, PlayState* play) { } void func_80B2A094(EnFish2* this, PlayState* play) { - Vec3f sp2C; + Vec3f subCamEye; if (this->unk_2B4 == 0) { D_80B2B2E4 = 1; } - this->unk_2CA = ActorCutscene_GetCurrentCamera(this->unk_2BA[0]); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->unk_2BA[0]); if (D_80B2B2EC != 0) { D_80B2B2EC++; @@ -813,17 +813,17 @@ void func_80B2A094(EnFish2* this, PlayState* play) { } if ((this->unk_350 != NULL) && (this->unk_350->update != NULL)) { - Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); - sp2C.x += Math_SinS(-0x3A98) * 110.0f; - sp2C.z += Math_CosS(-0x3A98) * 110.0f; - Math_Vec3f_Copy(&this->unk_2DC, &sp2C); - Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); - sp2C.x += Math_SinS(-0x3A98) * 10.0f; - sp2C.z += Math_CosS(-0x3A98) * 10.0f; - Math_Vec3f_Copy(&this->unk_2E8, &sp2C); + Math_Vec3f_Copy(&subCamEye, &this->unk_350->world.pos); + subCamEye.x += Math_SinS(-0x3A98) * 110.0f; + subCamEye.z += Math_CosS(-0x3A98) * 110.0f; + Math_Vec3f_Copy(&this->subCamEye, &subCamEye); + Math_Vec3f_Copy(&subCamEye, &this->unk_350->world.pos); + subCamEye.x += Math_SinS(-0x3A98) * 10.0f; + subCamEye.z += Math_CosS(-0x3A98) * 10.0f; + Math_Vec3f_Copy(&this->subCamAt, &subCamEye); } - Play_CameraSetAtEye(play, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_350 == NULL) || (this->unk_350->update == NULL)) { this->unk_350 = NULL; this->unk_2B0++; @@ -835,29 +835,29 @@ void func_80B2A094(EnFish2* this, PlayState* play) { } void func_80B2A23C(EnFish2* this, PlayState* play) { - Vec3f sp2C; + Vec3f subCamAt; - Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); + Math_Vec3f_Copy(&subCamAt, &this->actor.world.pos); if (D_80B2B2E4 == 2) { - sp2C.x += (Math_SinS(-0x3A98) * 180.0f); - sp2C.y += 90.0f; - sp2C.z += Math_CosS(-0x3A98) * 180.0f; - Math_Vec3f_Copy(&this->unk_2DC, &sp2C); - Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); - sp2C.y += 70.0f; - Math_Vec3f_Copy(&this->unk_2E8, &sp2C); + subCamAt.x += (Math_SinS(-0x3A98) * 180.0f); + subCamAt.y += 90.0f; + subCamAt.z += Math_CosS(-0x3A98) * 180.0f; + Math_Vec3f_Copy(&this->subCamEye, &subCamAt); + Math_Vec3f_Copy(&subCamAt, &this->actor.world.pos); + subCamAt.y += 70.0f; + Math_Vec3f_Copy(&this->subCamAt, &subCamAt); } else if (D_80B2B2F4 != NULL) { - Math_Vec3f_Copy(&sp2C, &D_80B2B2F4->world.pos); - sp2C.x += Math_SinS(-0x3A98) * 110.0f; - sp2C.z += Math_CosS(-0x3A98) * 110.0f; - Math_Vec3f_Copy(&this->unk_2DC, &sp2C); - Math_Vec3f_Copy(&sp2C, &D_80B2B2F4->world.pos); - sp2C.x += Math_SinS(-0x3A98) * 10.0f; - sp2C.z += Math_CosS(-0x3A98) * 10.0f; - Math_Vec3f_Copy(&this->unk_2E8, &sp2C); + Math_Vec3f_Copy(&subCamAt, &D_80B2B2F4->world.pos); + subCamAt.x += Math_SinS(-0x3A98) * 110.0f; + subCamAt.z += Math_CosS(-0x3A98) * 110.0f; + Math_Vec3f_Copy(&this->subCamEye, &subCamAt); + Math_Vec3f_Copy(&subCamAt, &D_80B2B2F4->world.pos); + subCamAt.x += Math_SinS(-0x3A98) * 10.0f; + subCamAt.z += Math_CosS(-0x3A98) * 10.0f; + Math_Vec3f_Copy(&this->subCamAt, &subCamAt); } - Play_CameraSetAtEye(play, this->unk_2CA, &this->unk_2E8, &this->unk_2DC); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_2B4 == 0) && (D_80B2B2E4 == 3)) { D_80B2B2E0 = D_80B2B2EC = D_80B2B2E4 = 0; diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h index ca3ad2bc8..5f79700c9 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -32,13 +32,13 @@ typedef struct EnFish2 { /* 0x02C0 */ s32 unk_2C0; /* 0x02C4 */ s32 unk_2C4; /* 0x02C8 */ u8 unk_2C8; - /* 0x02CA */ s16 unk_2CA; + /* 0x02CA */ s16 subCamId; /* 0x02CC */ f32 unk_2CC; /* 0x02D0 */ char unk_2D0[0x4]; /* 0x02D4 */ f32 unk_2D4; /* 0x02D8 */ f32 unk_2D8; - /* 0x02DC */ Vec3f unk_2DC; - /* 0x02E8 */ Vec3f unk_2E8; + /* 0x02DC */ Vec3f subCamEye; + /* 0x02E8 */ Vec3f subCamAt; /* 0x02F4 */ Vec3f unk_2F4; /* 0x0300 */ Vec3f unk_300; /* 0x030C */ Vec3f unk_30C; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 99f3adb8b..92ce19287 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -138,11 +138,11 @@ u8 D_80911E28; Vec3f sSinkingLurePos[SINKING_LURE_SEG_COUNT]; s16 D_80911F20; f32 sProjectedW; -Vec3f sCameraEye; -Vec3f sCameraAt; -s16 sCameraId; +Vec3f sSubCamEye; +Vec3f sSubCamAt; +s16 sSubCamId; f32 D_80911F48; -f32 D_80911F4C; +f32 sSubCamVelFactor; f32 D_80911F50; Vec3f sSinkingLureBasePos; f32 D_80911F64; @@ -1127,8 +1127,8 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { Message_StartTextbox(play, 0x40B3, NULL); } - if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == 5)) { - if (Message_ShouldAdvance(play) || Message_GetState(&play->msgCtx) == 0) { + if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { + if (Message_ShouldAdvance(play) || (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { func_801477B4(play); Rupees_ChangeBy(-50); effect->unk_2C = -1; @@ -2874,7 +2874,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { sp118 = (player->actor.speedXZ * 0.3f) + 0.25f; } - if ((D_80917200 != 0) || (sCameraId != CAM_ID_MAIN) || + if ((D_80917200 != 0) || (sSubCamId != SUB_CAM_ID_DONE) || ((player->actor.world.pos.z > 1150.0f) && (this->unk_150 != 100))) { this->actor.flags &= ~ACTOR_FLAG_1; } else { @@ -3055,7 +3055,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_172[1] = 50; } - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= 0xC01B)) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; @@ -3803,17 +3803,17 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { sp10C.z = 50.0f; } Matrix_RotateYF((player->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW); - Matrix_MultVec3f(&sp10C, &sCameraEye); + Matrix_MultVec3f(&sp10C, &sSubCamEye); - sCameraEye.x += player->actor.world.pos.x; - sCameraEye.y += player->actor.world.pos.y; - sCameraEye.z += player->actor.world.pos.z; + sSubCamEye.x += player->actor.world.pos.x; + sSubCamEye.y += player->actor.world.pos.y; + sSubCamEye.z += player->actor.world.pos.z; - sCameraAt = player->actor.world.pos; + sSubCamAt = player->actor.world.pos; if (sLinkAge != 1) { - sCameraAt.y += 40.0f; + sSubCamAt.y += 40.0f; } else { - sCameraAt.y += 25.0f; + sSubCamAt.y += 25.0f; } if (this->unk_172[0] == 90) { @@ -3855,7 +3855,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (this->unk_172[0] <= 50) { switch (this->unk_1CD) { case 0: - if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Message_ShouldAdvance(play)) { func_801477B4(play); if (play->msgCtx.choiceIndex == 0) { @@ -3886,7 +3887,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } break; case 1: - if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Message_ShouldAdvance(play)) { func_801477B4(play); if (play->msgCtx.choiceIndex != 0) { @@ -4330,7 +4332,7 @@ void EnFishing_UpdatePondProps(PlayState* play) { prop++; } - if (sCameraId == CAM_ID_MAIN) { + if (sSubCamId == SUB_CAM_ID_DONE) { CollisionCheck_SetOC(play, &play->colChkCtx, &sFishingMain->collider.base); } } @@ -4707,7 +4709,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 1: - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); switch (play->msgCtx.choiceIndex) { @@ -4735,7 +4737,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 2: - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80151938(play, 0x407F); this->unk_154 = 4; @@ -4743,17 +4745,17 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 3: - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->unk_154 = 0; } - if (Message_GetState(&play->msgCtx) == 6) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { this->unk_154 = 0; } break; case 4: - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); switch (play->msgCtx.choiceIndex) { @@ -4770,7 +4772,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 5: - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); play->interfaceCtx.unk_27E = 1; @@ -4787,7 +4789,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 10: if (D_8090CD0C != 0) { - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); switch (play->msgCtx.choiceIndex) { @@ -4803,7 +4805,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } } } else { - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); switch (play->msgCtx.choiceIndex) { @@ -4875,7 +4877,8 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 11: - if (((Message_GetState(&play->msgCtx) == 5) || Message_GetState(&play->msgCtx) == 0) && + if (((Message_GetState(&play->msgCtx) == TEXT_STATE_5) || + Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && Message_ShouldAdvance(play)) { s32 getItemId; @@ -4935,7 +4938,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } else { if ((D_809171CC >= 60.0f) && !(gSaveContext.save.unk_EE4 & 0x800)) { gSaveContext.save.unk_EE4 |= 0x800; - getItemId = GI_SCALE_GOLD; + getItemId = GI_SKULL_TOKEN; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } } @@ -4951,14 +4954,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 20: - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->unk_154 = 0; } break; case 21: - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { func_801477B4(play); switch (play->msgCtx.choiceIndex) { @@ -4978,7 +4981,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 22: - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_154 = 0; if (D_8090CD0C != 0) { D_8090CD08 = 1; @@ -4994,13 +4997,13 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->unk_154 = 24; } else { - Actor_PickUp(&this->actor, play, GI_SCALE_GOLD, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, GI_SKULL_TOKEN, 2000.0f, 1000.0f); } break; case 24: D_8090CCF4 = false; - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (D_809171D0 == 0) { this->unk_154 = 0; } else { @@ -5034,7 +5037,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { f32 target; f32 camAtFraction; f32 lureDistXZ; - Camera* camera; + Camera* mainCam; Player* player = GET_PLAYER(play); Input* input = CONTROLLER1(&play->state); @@ -5050,13 +5053,13 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { SkelAnime_Update(&this->skelAnime); - if ((D_8090CD04 != 0) || Message_GetState(&play->msgCtx)) { + if ((D_8090CD04 != 0) || Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { this->actor.flags &= ~ACTOR_FLAG_1; } else { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_20); } - if ((this->actor.xzDistToPlayer < 120.0f) || Message_GetState(&play->msgCtx)) { + if ((this->actor.xzDistToPlayer < 120.0f) || Message_GetState(&play->msgCtx) != TEXT_STATE_NONE) { headRotTarget = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; } else { headRotTarget = 0; @@ -5152,21 +5155,20 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { break; case 1: - sCameraId = Play_CreateSubCamera(play); + sSubCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sCameraId, CAM_STATUS_ACTIVE); - camera = Play_GetCamera(play, CAM_ID_MAIN); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; D_8090CD4C = 2; Interface_ChangeHudMode(HUD_MODE_A_B_MINIMAP); - D_80911F4C = 0.0f; + sSubCamVelFactor = 0.0f; // fallthrough - case 2: ShrinkWindow_SetLetterboxTarget(27); @@ -5186,9 +5188,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { camAtFraction = 0.1f; } - Math_ApproachF(&sCameraAt.x, sLurePos.x, camAtFraction, fabsf(spFC.x) * D_80911F4C); - Math_ApproachF(&sCameraAt.y, sLurePos.y, camAtFraction, 50.0f * D_80911F4C); - Math_ApproachF(&sCameraAt.z, sLurePos.z, camAtFraction, fabsf(spFC.z) * D_80911F4C); + Math_ApproachF(&sSubCamAt.x, sLurePos.x, camAtFraction, fabsf(spFC.x) * sSubCamVelFactor); + Math_ApproachF(&sSubCamAt.y, sLurePos.y, camAtFraction, 50.0f * sSubCamVelFactor); + Math_ApproachF(&sSubCamAt.z, sLurePos.z, camAtFraction, fabsf(spFC.z) * sSubCamVelFactor); sp114.x = 0.0f - D_80911F50; if (sLinkAge != 1) { @@ -5256,22 +5258,22 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sp114.z = 100.0f; Matrix_MultVec3f(&sp114, &spFC); - Math_ApproachF(&sCameraEye.x, sp108.x, 0.3f, fabsf(spFC.x) * D_80911F4C); - Math_ApproachF(&sCameraEye.y, sp108.y, 0.3f, 20.0f * D_80911F4C); - Math_ApproachF(&sCameraEye.z, sp108.z, 0.3f, fabsf(spFC.z) * D_80911F4C); + Math_ApproachF(&sSubCamEye.x, sp108.x, 0.3f, fabsf(spFC.x) * sSubCamVelFactor); + Math_ApproachF(&sSubCamEye.y, sp108.y, 0.3f, 20.0f * sSubCamVelFactor); + Math_ApproachF(&sSubCamEye.z, sp108.z, 0.3f, fabsf(spFC.z) * sSubCamVelFactor); break; case 3: { - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; } - func_80169AFC(play, sCameraId, 0); + func_80169AFC(play, sSubCamId, 0); Cutscene_End(play, &play->csCtx); D_8090CD4C = 0; - sCameraId = CAM_ID_MAIN; + sSubCamId = SUB_CAM_ID_DONE; func_800F6834(play, 0); play->envCtx.lightSettings.fogNear = 0; player->unk_B28 = -5; @@ -5280,37 +5282,39 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 10: Cutscene_Start(play, &play->csCtx); - sCameraId = Play_CreateSubCamera(play); + sSubCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sCameraId, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); - camera = Play_GetCamera(play, CAM_ID_MAIN); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + + mainCam = Play_GetCamera(play, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; + Message_StartTextbox(play, 0x409E, NULL); D_8090CD4C = 11; Rumble_Override(0.0f, 150, 10, 10); // fallthrough - case 11: player->actor.world.pos.z = 1360.0f; player->actor.speedXZ = 0.0f; - if (Message_GetState(&play->msgCtx) == 0) { - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; - func_80169AFC(play, sCameraId, 0); + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; + + func_80169AFC(play, sSubCamId, 0); Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); D_8090CD4C = 0; - sCameraId = CAM_ID_MAIN; + sSubCamId = SUB_CAM_ID_DONE; D_8090CD50 = 30; func_800F6834(play, 0); play->envCtx.lightSettings.fogNear = 0; @@ -5319,23 +5323,23 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 20: Cutscene_Start(play, &play->csCtx); - sCameraId = Play_CreateSubCamera(play); + sSubCamId = Play_CreateSubCamera(play); Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sCameraId, CAM_STATUS_ACTIVE); + Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); - camera = Play_GetCamera(play, CAM_ID_MAIN); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + + mainCam = Play_GetCamera(play, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; Message_StartTextbox(play, 0x409A, NULL); D_8090CD4C = 21; D_80911F48 = 45.0f; D_8090CD50 = 10; // fallthrough - case 21: if ((D_8090CD50 == 0) && Message_ShouldAdvance(play)) { D_8090CD4C = 22; @@ -5380,22 +5384,23 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sp114.z = -35.0f; } - Matrix_MultVec3f(&sp114, &sCameraEye); - sCameraEye.x += player->actor.world.pos.x; - sCameraEye.y += player->actor.world.pos.y; - sCameraEye.z += player->actor.world.pos.z; + Matrix_MultVec3f(&sp114, &sSubCamEye); + sSubCamEye.x += player->actor.world.pos.x; + sSubCamEye.y += player->actor.world.pos.y; + sSubCamEye.z += player->actor.world.pos.z; - sCameraAt = player->actor.world.pos; + sSubCamAt = player->actor.world.pos; if (sLinkAge != 1) { - sCameraAt.y += 62.0f; + sSubCamAt.y += 62.0f; } else { - sCameraAt.y += 40.0f; + sSubCamAt.y += 40.0f; } if (D_8090CD50 == 0) { - if ((Message_GetState(&play->msgCtx) == 4) || Message_GetState(&play->msgCtx) == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) || + Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Message_ShouldAdvance(play)) { - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); func_801477B4(play); if (play->msgCtx.choiceIndex == 0) { @@ -5403,14 +5408,14 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_809171D6 = 0; } - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; - func_80169AFC(play, sCameraId, 0); + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; + func_80169AFC(play, sSubCamId, 0); Cutscene_End(play, &play->csCtx); func_800B7298(play, &this->actor, 6); // arg2 changed from 7 to 6 in MM D_8090CD4C = 0; - sCameraId = CAM_ID_MAIN; + sSubCamId = SUB_CAM_ID_DONE; player->unk_B28 = -5; D_80917200 = 5; D_8090CD54 = 0; @@ -5426,11 +5431,11 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { break; } - if (sCameraId != CAM_ID_MAIN) { - Play_CameraSetAtEye(play, sCameraId, &sCameraAt, &sCameraEye); - Math_ApproachF(&D_80911F4C, 1.0f, 1.0f, 0.02f); + if (sSubCamId != SUB_CAM_ID_DONE) { + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); + Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); - if (sCameraEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { + if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { func_800F6834(play, 1); if (D_809171CA != 0) { play->envCtx.lightSettings.fogNear = -0xB2; @@ -5484,7 +5489,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_809171CB--; } - if ((D_809171CB == 1) && Message_GetState(&play->msgCtx) == 0 && ((D_8090CD00 & 0xFFF) == 0xFFF)) { + if ((D_809171CB == 1) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && ((D_8090CD00 & 0xFFF) == 0xFFF)) { D_809171CB = 200; if (Rand_ZeroOne() < 0.5f) { @@ -5529,7 +5534,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { if ((u8)D_8090CCD0 > 0) { s32 pad; s16 i; - Camera* camera = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); Vec3f pos; Vec3f rot; Vec3f projectedPos; @@ -5537,7 +5542,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { rot.x = 1.6707964f; rot.y = 1.0f; - rot.z = (Camera_GetInputDirYaw(camera) * -(M_PI / 32768)) + rot.y; + rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y; for (i = 0; i < (u8)D_8090CCD0; i++) { pos.x = randPlusMinusPoint5Scaled(700.0f) + play->view.eye.x; diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 650acd53a..ff9315a54 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -53,20 +53,20 @@ typedef enum { } EnFsnCutsceneState; typedef enum { - /* 00 */ FSN_ANIMATION_IDLE, - /* 01 */ FSN_ANIMATION_SCRATCH_BACK, - /* 02 */ FSN_ANIMATION_TURN_AROUND_FORWARD, - /* 03 */ FSN_ANIMATION_TURN_AROUND_REVERSE, - /* 04 */ FSN_ANIMATION_HANDS_ON_COUNTER_START, - /* 05 */ FSN_ANIMATION_HANDS_ON_COUNTER_LOOP, - /* 06 */ FSN_ANIMATION_HAND_ON_FACE_START, - /* 07 */ FSN_ANIMATION_HAND_ON_FACE_LOOP, - /* 08 */ FSN_ANIMATION_LEAN_FORWARD_START, - /* 09 */ FSN_ANIMATION_LEAN_FORWARD_LOOP, - /* 10 */ FSN_ANIMATION_SLAM_COUNTER_START, - /* 11 */ FSN_ANIMATION_SLAM_COUNTER_LOOP, - /* 12 */ FSN_ANIMATION_MAKE_OFFER, - /* 13 */ FSN_ANIMATION_MAX + /* 0 */ FSN_ANIM_IDLE, + /* 1 */ FSN_ANIM_SCRATCH_BACK, + /* 2 */ FSN_ANIM_TURN_AROUND_FORWARD, + /* 3 */ FSN_ANIM_TURN_AROUND_REVERSE, + /* 4 */ FSN_ANIM_HANDS_ON_COUNTER_START, + /* 5 */ FSN_ANIM_HANDS_ON_COUNTER_LOOP, + /* 6 */ FSN_ANIM_HAND_ON_FACE_START, + /* 7 */ FSN_ANIM_HAND_ON_FACE_LOOP, + /* 8 */ FSN_ANIM_LEAN_FORWARD_START, + /* 9 */ FSN_ANIM_LEAN_FORWARD_LOOP, + /* 10 */ FSN_ANIM_SLAM_COUNTER_START, + /* 11 */ FSN_ANIM_SLAM_COUNTER_LOOP, + /* 12 */ FSN_ANIM_MAKE_OFFER, + /* 13 */ FSN_ANIM_MAX } FsnAnimation; const ActorInit En_Fsn_InitVars = { @@ -209,7 +209,7 @@ void EnFsn_HandleConversationBackroom(EnFsn* this, PlayState* play) { } void EnFsn_HandleSetupResumeInteraction(EnFsn* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play) && + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play) && this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { Actor_ProcessTalkRequest(&this->actor, &play->state); func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); @@ -392,7 +392,7 @@ void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { } Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; @@ -711,7 +711,7 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) { this->stickAnimTween = this->arrowAnimTween = 0.0f; } this->blinkTimer = 20; - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_START; + this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_START; this->eyeTextureIdx = 0; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); this->actionFunc = EnFsn_Idle; @@ -720,11 +720,11 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) { void EnFsn_Idle(EnFsn* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->animationIndex == FSN_ANIMATION_HANDS_ON_COUNTER_START) { + if (this->animationIndex == FSN_ANIM_HANDS_ON_COUNTER_START) { s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); if (curFrame == frameCount) { - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP; + this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } return; @@ -762,24 +762,24 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { if (this->flags & ENFSN_ANGRY) { this->flags &= ~ENFSN_ANGRY; - this->animationIndex = FSN_ANIMATION_SLAM_COUNTER_LOOP; + this->animationIndex = FSN_ANIM_SLAM_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } else { - if (this->animationIndex == FSN_ANIMATION_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) { + if (this->animationIndex == FSN_ANIM_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); } if (this->flags & ENFSN_CALM_DOWN) { this->flags &= ~ENFSN_CALM_DOWN; - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP; + this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } else if (this->flags & ENFSN_OFFER_FINAL_PRICE) { this->flags &= ~ENFSN_OFFER_FINAL_PRICE; - this->animationIndex = FSN_ANIMATION_MAKE_OFFER; + this->animationIndex = FSN_ANIM_MAKE_OFFER; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } else { - if (this->animationIndex == FSN_ANIMATION_MAKE_OFFER) { + if (this->animationIndex == FSN_ANIM_MAKE_OFFER) { if (curFrame == frameCount) { - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP; + this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } else { if (Animation_OnFrame(&this->skelAnime, 28.0f)) { @@ -822,7 +822,7 @@ void EnFsn_StartBuying(EnFsn* this, PlayState* play) { Player* player = GET_PLAYER(play); EnFsn_HandleLookToShopkeeperBuyingCutscene(this); - if (talkState == 5 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x29CC: this->actor.textId = 0x29CD; @@ -849,7 +849,7 @@ void EnFsn_StartBuying(EnFsn* this, PlayState* play) { void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { switch (this->actor.textId) { case 0x29CC: @@ -880,7 +880,7 @@ void EnFsn_AskBuyOrSell(EnFsn* this, PlayState* play) { break; } } - } else if (talkState == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { @@ -919,7 +919,7 @@ void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) { s32 itemActionParam; u8 buttonItem; - if (Message_GetState(&play->msgCtx) == 16) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { if (player->heldItemButton == 0) { @@ -955,12 +955,12 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); Player* player = GET_PLAYER(play); - if (talkState == 4 && Message_ShouldAdvance(play)) { + if (talkState == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; @@ -1106,7 +1106,7 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; EnFsn_UpdateCursorPos(this, play); - if (talkstate == 5) { + if (talkstate == TEXT_STATE_5) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) { EnFsn_CursorLeftRight(this); @@ -1160,7 +1160,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { item->buyFanfareFunc(play, item); Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; @@ -1191,13 +1191,13 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { void EnFsn_SetupEndInteraction(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { EnFsn_EndInteraction(this, play); } else { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; } } else { EnFsn_EndInteraction(this, play); @@ -1208,7 +1208,7 @@ void EnFsn_SetupEndInteraction(EnFsn* this, PlayState* play) { void EnFsn_SelectItem(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (EnFsn_TakeItemOffShelf(this) && talkState == 4) { + if (EnFsn_TakeItemOffShelf(this) && talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnFsn_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { @@ -1225,7 +1225,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) { } void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; func_80151938(play, this->items[this->cursorIdx]->actor.textId); } @@ -1246,7 +1246,7 @@ void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1263,13 +1263,13 @@ void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { break; } } - } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { + } else if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { EnFsn_EndInteraction(this, play); } else { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; } } else { EnFsn_EndInteraction(this, play); @@ -1292,7 +1292,7 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -1310,13 +1310,13 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { break; } } - } else if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { + } else if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { EnFsn_EndInteraction(this, play); } else { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; } } else { EnFsn_EndInteraction(this, play); @@ -1328,7 +1328,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); u8 cursorIdx; - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && (!Message_ShouldAdvance(play) || !EnFsn_FacingShopkeeperDialogResult(this, play)) && @@ -1342,7 +1342,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { play_sound(NA_SE_SY_CURSOR); } } - } else if (talkState == 5 && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actor.textId = 0x29D6; Message_StartTextbox(play, this->actor.textId, &this->actor); if (play) {} @@ -1350,7 +1350,7 @@ void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) { } void EnFsn_SetupEndInteractionImmediately(EnFsn* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { EnFsn_EndInteraction(this, play); } } @@ -1366,16 +1366,16 @@ void EnFsn_IdleBackroom(EnFsn* this, PlayState* play) { } void EnFsn_ConverseBackroom(EnFsn* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->flags & ENFSN_END_CONVERSATION) { this->flags &= ~ENFSN_END_CONVERSATION; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnFsn_IdleBackroom; } else if (this->flags & ENFSN_GIVE_ITEM) { this->flags &= ~ENFSN_GIVE_ITEM; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnFsn_GiveItem; } else { EnFsn_HandleConversationBackroom(this, play); @@ -1430,7 +1430,7 @@ void EnFsn_Init(Actor* thisx, PlayState* play) { this->eyeTextureIdx = 0; this->actor.flags |= ACTOR_FLAG_1; this->actor.targetMode = 0; - this->animationIndex = FSN_ANIMATION_IDLE; + this->animationIndex = FSN_ANIM_IDLE; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); this->actionFunc = EnFsn_IdleBackroom; } 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 04e498715..65ccb7177 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -577,24 +577,24 @@ void func_809628BC(EnFu* this) { } void func_809628D0(EnFu* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - switch (sp27) { - case 0: - case 1: - case 2: - case 3: + switch (talkState) { + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: + case TEXT_STATE_CHOICE: func_80962588(this, play); break; - case 5: + case TEXT_STATE_5: func_80962660(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->unk_54A = 1; switch (this->unk_552) { @@ -617,7 +617,7 @@ void func_809628D0(EnFu* this, PlayState* play) { break; } - if (sp27 != 3) { + if (talkState != TEXT_STATE_3) { func_80964190(this, play); func_8096426C(this, play); } @@ -840,8 +840,9 @@ void func_80963350(EnFu* this, PlayState* play) { static s32 D_80964C24 = 0; BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; - if ((this->unk_54A == 0) && (((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) || - ((Message_GetState(&play->msgCtx) == 2) && (play->msgCtx.unk12023 == 1)))) { + if ((this->unk_54A == 0) && + (((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) || + ((Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) && (play->msgCtx.stateTimer == 1)))) { func_801477B4(play); this->unk_54A = 2; D_80964C24 = 1; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 12104c324..dbad05713 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -357,16 +357,16 @@ void func_80B0FD8C(EnGb2* this, PlayState* play) { void func_80B0FE18(PlayState* play) { func_800FD750(0x38); play->nextEntranceIndex = 0x9C10; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; + play->transitionTrigger = TRANS_TRIGGER_START; } void func_80B0FE7C(PlayState* play) { play->nextEntranceIndex = 0x9C20; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; + play->transitionTrigger = TRANS_TRIGGER_START; } void func_80B0FEBC(EnGb2* this, PlayState* play) { @@ -386,13 +386,13 @@ void func_80B0FEBC(EnGb2* this, PlayState* play) { } void func_80B0FFA8(EnGb2* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_26E = 0x14D1; this->unk_288 = 30; gSaveContext.eventInf[4] &= (u8)~0x80; @@ -403,7 +403,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (this->unk_26E == 0x14D5) { switch (play->msgCtx.choiceIndex) { case 0: @@ -432,7 +432,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { func_8019F208(); Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; func_800B7298(play, NULL, 7); this->actionFunc = func_80B11344; break; @@ -548,13 +548,13 @@ void func_80B10584(EnGb2* this, PlayState* play) { } void func_80B10634(EnGb2* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_26C &= ~2; if (this->unk_26E == 0x14DD) { this->unk_26E = 0x14DE; @@ -572,7 +572,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees < this->unk_288) { @@ -584,7 +584,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { func_8019F208(); Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; func_800B7298(play, NULL, 7); this->actionFunc = func_80B11344; } @@ -746,11 +746,11 @@ void func_80B10DAC(EnGb2* this, PlayState* play) { } void func_80B10E98(EnGb2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { this->unk_26C &= ~2; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if ((this->unk_26E != 0x14E8) && (this->unk_26E != 0x14EA)) { ActorCutscene_Stop(this->unk_282[this->unk_290]); this->actionFunc = func_80B10B5C; @@ -790,10 +790,10 @@ void func_80B11048(EnGb2* this, PlayState* play) { } void func_80B110F8(EnGb2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_26C & 2) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_26C &= ~2; this->actionFunc = func_80B10A48; } else { diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index fa0294147..b3e98dde3 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -543,7 +543,7 @@ void func_80BB2520(EnGeg* this, PlayState* play) { } void func_80BB26EC(EnGeg* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD5E: this->unk_49A = this->unk_49C[1]; @@ -553,7 +553,7 @@ void func_80BB26EC(EnGeg* this, PlayState* play) { case 0xD61: ActorCutscene_Stop(this->unk_498); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; this->actionFunc = func_80BB221C; return; @@ -565,18 +565,18 @@ void func_80BB26EC(EnGeg* this, PlayState* play) { } void func_80BB27D4(EnGeg* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD63: play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB221C; break; case 0xD69: this->unk_49A = this->unk_49C[6]; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB2520; break; @@ -584,7 +584,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { case 0xD6F: case 0xD8A: play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB31B8; break; @@ -592,7 +592,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { case 0xD75: case 0xD8B: play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; this->unk_49A = this->unk_49C[7]; this->actionFunc = func_80BB2520; @@ -607,7 +607,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { } void func_80BB2944(EnGeg* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 curFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_4AC].animation); @@ -616,10 +616,10 @@ void func_80BB2944(EnGeg* this, PlayState* play) { this->unk_4AC = 6; func_80BB2020(this, play); } - } else if ((sp27 == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD67) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_49A = this->unk_49C[4]; this->actionFunc = func_80BB2520; } else { @@ -630,13 +630,13 @@ void func_80BB2944(EnGeg* this, PlayState* play) { } void func_80BB2A54(EnGeg* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD65) { ActorCutscene_Stop(this->unk_498); this->unk_230 &= ~0x10; this->unk_244 = 65; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB347C; } else { this->unk_496 = func_80BB16D0(this); diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index 7040bdfa0..5aca35895 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -247,10 +247,10 @@ void func_80B35450(EnGg* this, PlayState* play) { } void func_80B3556C(EnGg* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_2E6 == 4) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_308 = 0; this->actor.flags &= ~ACTOR_FLAG_80; func_80B35250(this); 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 51aea1b13..9726a693a 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -172,9 +172,9 @@ void func_80B3B05C(EnGg2* this, PlayState* play) { } void func_80B3B0A0(EnGg2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_2F0 = 0; this->actionFunc = func_80B3B5D4; } diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index d139d3fe3..585f5df17 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -472,25 +472,30 @@ void EnGinkoMan_SetupDialogue(EnGinkoMan* this) { void EnGinkoMan_Dialogue(EnGinkoMan* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 2: + case TEXT_STATE_CLOSING: EnGinkoMan_SetupIdle(this); break; - case 4: + + case TEXT_STATE_CHOICE: EnGinkoMan_WaitForDialogueInput(this, play); break; - case 5: + + case TEXT_STATE_5: EnGinkoMan_DepositDialogue(this, play); break; - case 6: + + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->isStampChecked = false; EnGinkoMan_SetupIdle(this); } break; - case 14: + + case TEXT_STATE_14: EnGinkoMan_WaitForRupeeCount(this, play); break; - case 0: + + case TEXT_STATE_NONE: default: break; } @@ -547,7 +552,7 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupDialogue(this); } else if (this->curTextId == 0x45D) { // saved up 5000 rupees for HP - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (!(gSaveContext.save.weekEventReg[59] & 8)) { gSaveContext.save.weekEventReg[59] |= 8; } diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index bc95efecd..74486b30c 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -138,16 +138,16 @@ static ShopItemEntry sShopItemEntries[] = { EnGirlA_BuyBottleItem, EnGirlA_BuyFanfare }, { OBJECT_GI_BOTTLE, GID_BOTTLE, func_800B8050, 1, 0x29F8, 0x29F9, GI_BOTTLE_STOLEN, EnGirlA_CanBuyBottleStolen, EnGirlA_BuyBottle, EnGirlA_BuyFanfare }, - { OBJECT_GI_SWORD_4, GID_SWORD_GREAT_FAIRY, func_800B8050, 4, 0x29F2, 0x29F3, GI_SWORD_GREAT_FAIRY, + { OBJECT_GI_SWORD_4, GID_SWORD_GREAT_FAIRY, func_800B8050, 4, 0x29F2, 0x29F3, GI_SWORD_GREAT_FAIRY_STOLEN, EnGirlA_CanBuySword, EnGirlA_BuySword, EnGirlA_BuyFanfare }, - { OBJECT_GI_SWORD_1, GID_SWORD_KOKIRI, func_800B8050, 1, 0x29F4, 0x29F5, GI_SWORD_KOKIRI, EnGirlA_CanBuySword, + { OBJECT_GI_SWORD_1, GID_SWORD_KOKIRI, func_800B8050, 1, 0x29F4, 0x29F5, GI_SWORD_KOKIRI_STOLEN, + EnGirlA_CanBuySword, EnGirlA_BuySword, EnGirlA_BuyFanfare }, + { OBJECT_GI_SWORD_2, GID_SWORD_RAZOR, func_800B8050, 2, 0x29F4, 0x29F5, GI_SWORD_RAZOR_STOLEN, EnGirlA_CanBuySword, EnGirlA_BuySword, EnGirlA_BuyFanfare }, - { OBJECT_GI_SWORD_2, GID_SWORD_RAZOR, func_800B8050, 2, 0x29F4, 0x29F5, GI_SWORD_RAZOR, EnGirlA_CanBuySword, - EnGirlA_BuySword, EnGirlA_BuyFanfare }, - { OBJECT_GI_SWORD_3, GID_SWORD_GILDED, func_800B8050, 3, 0x29F4, 0x29F5, GI_SWORD_GILDED, EnGirlA_CanBuySword, - EnGirlA_BuySword, EnGirlA_BuyFanfare }, - { OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x29F6, 0x29F7, GI_SHIELD_HERO_2, EnGirlA_CanBuyShieldHero, - EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare }, + { OBJECT_GI_SWORD_3, GID_SWORD_GILDED, func_800B8050, 3, 0x29F4, 0x29F5, GI_SWORD_GILDED_STOLEN, + EnGirlA_CanBuySword, EnGirlA_BuySword, EnGirlA_BuyFanfare }, + { OBJECT_GI_SHIELD_2, GID_SHIELD_HERO, func_800B8050, 1, 0x29F6, 0x29F7, GI_SHIELD_HERO_STOLEN, + EnGirlA_CanBuyShieldHero, EnGirlA_BuyShieldHero, EnGirlA_BuyFanfare }, { OBJECT_GI_SHIELD_3, GID_SHIELD_MIRROR, func_800B8050, 1, 0x29F6, 0x29F7, GI_SHIELD_MIRROR, EnGirlA_CanBuyShieldMirror, EnGirlA_BuyShieldMirror, EnGirlA_BuyFanfare }, }; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index bc3bc5388..52c875a7b 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -456,9 +456,6 @@ s32 func_80B5100C(EnGk* this, PlayState* play) { } s32 func_80B5123C(EnGk* this, PlayState* play) { - s16 temp_v0; - s16 phi_v1; - if (DECR(this->unk_34E) != 0) { this->unk_31E = 0; this->unk_320 = 0; @@ -660,9 +657,9 @@ void func_80B51760(EnGk* this, PlayState* play) { } void func_80B51970(EnGk* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (((temp_v0 == 6) || (temp_v0 == 5)) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_DONE) || (talkState == TEXT_STATE_5)) && Message_ShouldAdvance(play)) { if ((this->unk_31C == 0xE84) || (this->unk_31C == 0xE99)) { ActorCutscene_Stop(this->unk_318); this->unk_318 = ActorCutscene_GetAdditionalCutscene(this->unk_318); @@ -710,9 +707,9 @@ void func_80B51970(EnGk* this, PlayState* play) { } void func_80B51B40(EnGk* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 6) { + if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play)) { if (this->unk_1E4 & 1) { this->unk_1E4 &= ~1; @@ -724,9 +721,9 @@ void func_80B51B40(EnGk* this, PlayState* play) { if (this->unk_31C == 0xE8F) { play->nextEntranceIndex = 0xD010; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; Magic_Add(play, ((void)0, gSaveContext.magicFillTarget) + (gSaveContext.save.playerData.isDoubleMagicAcquired + 1) * MAGIC_NORMAL_METER); } else { @@ -741,7 +738,7 @@ void func_80B51B40(EnGk* this, PlayState* play) { this->unk_1E4 |= 2; } } - } else if ((temp_v0 == 4) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); @@ -873,9 +870,9 @@ void func_80B5202C(EnGk* this, PlayState* play) { } void func_80B5216C(EnGk* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80B51698; } } @@ -928,7 +925,7 @@ void func_80B52340(EnGk* this, PlayState* play) { } void func_80B52430(EnGk* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { switch (this->unk_31C) { case 0xE93: this->unk_31C = 0xE89; @@ -1027,7 +1024,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { Actor_MarkForDeath(&this->actor); } else { this->unk_318 = this->actor.cutscene; - this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 15); + this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF); this->actionFunc = func_80B51760; } } else if (play->sceneNum == SCENE_GORONRACE) { 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 a23e5f784..0a49db1d1 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -466,7 +466,7 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { ActorCutscene_Stop(sp2A); } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); } this->unk_3E0++; ret = true; @@ -474,7 +474,7 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { case 1: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); } this->unk_3E0++; ret = true; @@ -491,7 +491,7 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { } s32 func_8094E69C(EnGm* this, PlayState* play) { - Camera* camera; + Camera* subCam; s16 sp4A = func_8094E4D0(this, 0); s16 sp48; Vec3f sp3C; @@ -533,8 +533,8 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { if (func_8094E454(this, sp4A)) { case 4: case 6: - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp4A)); - Camera_SetTargetActor(camera, &this->actor); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp4A)); + Camera_SetTargetActor(subCam, &this->actor); this->unk_3E0++; ret = true; } @@ -544,8 +544,8 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp4A)); - Camera_SetTargetActor(camera, this->actor.child); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp4A)); + Camera_SetTargetActor(subCam, this->actor.child); } this->unk_3E0++; ret = true; @@ -857,11 +857,11 @@ void func_8094F2E8(EnGm* this) { void func_8094F3D0(EnGm* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp28 = Message_GetState(&play->msgCtx); - s32 var = play->msgCtx.currentTextId; + s32 talkState = Message_GetState(&play->msgCtx); + s32 textId = play->msgCtx.currentTextId; - if ((&this->actor == player->targetActor) && ((var < 0xFF) || (var > 0x200)) && (sp28 == 3) && - (this->unk_3F0 == 3)) { + if ((&this->actor == player->targetActor) && ((textId < 0xFF) || (textId > 0x200)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3)) { if ((play->state.frames % 3) == 0) { if (this->unk_3AC == 120.0f) { this->unk_3AC = 0.0f; @@ -872,9 +872,10 @@ void func_8094F3D0(EnGm* this, PlayState* play) { } else { this->unk_3AC = 0.0f; } + Math_SmoothStepToF(&this->unk_3B0, this->unk_3AC, 0.8f, 40.0f, 10.0f); Matrix_Translate(this->unk_3B0, 0.0f, 0.0f, MTXMODE_APPLY); - this->unk_3F0 = sp28; + this->prevTalkState = talkState; } s32 func_8094F4EC(EnGm* this, PlayState* play) { @@ -969,7 +970,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { return false; } -s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s16 arg4) { +s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 arg3, s16 arg4) { u8 sp4F = ENGM_GET_FF(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -981,8 +982,8 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s1 this->timePath = NULL; actor = func_8094DEE0(this, play, arg3, arg4); - if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]); + if (D_80951A0C[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]); } if ((actor != NULL) && (actor->update != NULL)) { @@ -999,7 +1000,7 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s1 return ret; } -s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = ENGM_GET_FF(&this->actor); EnDoor* door; @@ -1010,10 +1011,10 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_8094DF90(play, arg2->result); + door = func_8094DF90(play, scheduleOutput->result); - if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[arg2->result]); + if (D_80951A0C[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[scheduleOutput->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -1032,8 +1033,8 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) { this->unk_261 = 75; } - this->unk_3B8 = arg2->time1 - arg2->time0; - this->unk_3BA = sp56 - arg2->time0; + this->unk_3B8 = scheduleOutput->time1 - scheduleOutput->time0; + this->unk_3BA = sp56 - scheduleOutput->time0; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; @@ -1045,16 +1046,17 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = ENGM_GET_FF(&this->actor); - s32 pad; + u16 tmp; + s16 pad; s32 ret = false; this->timePath = NULL; - if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[arg2->result]); + if (D_80951A0C[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1065,18 +1067,18 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { if ((this->unk_258 < 9) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) { phi_v1 = sp2E; } else { - phi_v1 = arg2->time0; + phi_v1 = scheduleOutput->time0; } - if (arg2->time1 < phi_v1) { - this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF; + if (scheduleOutput->time1 < phi_v1) { + this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF; } else { - this->timePathTotalTime = arg2->time1 - phi_v1; + this->timePathTotalTime = scheduleOutput->time1 - phi_v1; } this->timePathElapsedTime = sp2E - phi_v1; - phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); - this->timePathWaypointTime = this->timePathTotalTime / phi_v1; + tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + this->timePathWaypointTime = this->timePathTotalTime / tmp; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk_3A4 &= ~0x8; @@ -1091,11 +1093,11 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80951D90 = { 64.0f, 0.0f, -122.0f }; s32 ret = false; - if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TAB)) { + if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TAB)) { if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90); SubS_UpdateFlags(&this->unk_3A4, 3, 7); @@ -1111,10 +1113,10 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { + if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { func_8094E054(this, play, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= 0x100; @@ -1124,12 +1126,13 @@ s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; Actor* al; al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); - if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { + if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && + (al->update != NULL)) { func_8094E054(this, play, 11); SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_268 = al; @@ -1145,7 +1148,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80951D9C = { 64.0f, 0.0f, -122.0f }; u8 sp4F = ENGM_GET_FF(&this->actor); Vec3s* sp48; @@ -1156,8 +1159,8 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) { this->timePath = NULL; - if (D_80951A0C[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]); + if (D_80951A0C[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]); } if (this->timePath != NULL) { @@ -1187,7 +1190,7 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80950088(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80950088(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80951DA8 = { 278.0f, 0.0f, 223.0f }; static Vec3s D_80951DB4 = { 0x0000, 0xC000, 0x0000 }; s32 pad; @@ -1202,7 +1205,7 @@ s32 func_80950088(EnGm* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80950120(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80950120(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80951DBC = { -525.0f, 214.0f, 515.0f }; static Vec3s D_80951DC8 = { 0x0000, 0x38E0, 0x0000 }; s32 pad; @@ -1217,7 +1220,7 @@ s32 func_80950120(EnGm* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_809501B8(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_809501B8(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80951DD0 = { -334.0f, 225.0f, 903.0f }; static Vec3s D_80951DDC = { 0x0000, 0x7FFF, 0x0000 }; s32 pad; @@ -1238,7 +1241,7 @@ s32 func_809501B8(EnGm* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80950280(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 phi_v1; this->actor.flags |= ACTOR_FLAG_1; @@ -1249,33 +1252,33 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) { this->unk_3CC = 8; this->unk_3B4 = 40.0f; - switch (arg2->result) { + switch (scheduleOutput->result) { case 1: - phi_v1 = func_8094FD88(this, play, arg2); + phi_v1 = func_8094FD88(this, play, scheduleOutput); break; case 2: - phi_v1 = func_8094FE10(this, play, arg2); + phi_v1 = func_8094FE10(this, play, scheduleOutput); break; case 3: - phi_v1 = func_8094FCC4(this, play, arg2); + phi_v1 = func_8094FCC4(this, play, scheduleOutput); break; case 5: - phi_v1 = func_8094FF04(this, play, arg2); + phi_v1 = func_8094FF04(this, play, scheduleOutput); break; case 6: - phi_v1 = func_80950088(this, play, arg2); + phi_v1 = func_80950088(this, play, scheduleOutput); break; case 7: - phi_v1 = func_809501B8(this, play, arg2); + phi_v1 = func_809501B8(this, play, scheduleOutput); break; case 8: - phi_v1 = func_80950120(this, play, arg2); + phi_v1 = func_80950120(this, play, scheduleOutput); break; case 9: @@ -1290,7 +1293,7 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) { case 18: case 19: case 20: - phi_v1 = func_8094F904(this, play, arg2); + phi_v1 = func_8094F904(this, play, scheduleOutput); break; case 21: @@ -1303,7 +1306,7 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) { case 28: case 29: case 30: - phi_v1 = func_8094FAC4(this, play, arg2); + phi_v1 = func_8094FAC4(this, play, scheduleOutput); break; default: @@ -1576,7 +1579,7 @@ void func_80950C24(EnGm* this, PlayState* play) { } void func_80950CDC(EnGm* this, PlayState* play) { - ScheduleResult sp20; + ScheduleOutput sp20; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 528352a65..0f74de16b 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -33,7 +33,7 @@ typedef struct EnGm { /* 0x262 */ s8 unk_262; /* 0x264 */ s32* unk_264; /* 0x268 */ Actor* unk_268; - /* 0x26C */ UNK_TYPE1 unk26C[0xC]; + /* 0x26C */ UNK_TYPE1 unk_26C[0xC]; /* 0x278 */ Vec3f unk_278; /* 0x284 */ Vec3f unk_284; /* 0x290 */ Vec3f unk_290; @@ -69,7 +69,7 @@ typedef struct EnGm { /* 0x3E4 */ EnGmUnkFunc unk_3E4; /* 0x3E8 */ s32 unk_3E8; /* 0x3EC */ UNK_TYPE1 unk3EC[0x4]; - /* 0x3F0 */ s32 unk_3F0; + /* 0x3F0 */ s32 prevTalkState; /* 0x3F4 */ s32 unk_3F4; /* 0x3F8 */ s32 unk_3F8; /* 0x3FC */ s32 unk_3FC; 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 c1be4f1a9..7f9485d37 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -181,7 +181,7 @@ void func_80997D14(EnGs* this, PlayState* play) { void func_80997D38(EnGs* this, PlayState* play) { static f32 D_8099A408[] = { 40.0f, 60.0f, 40.0f, 40.0f }; - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (this->actor.xzDistToPlayer <= D_8099A408[this->actor.params]) { func_8013E8F8(&this->actor, play, D_8099A408[this->actor.params], D_8099A408[this->actor.params], EXCH_ITEM_NONE, 0x2000, 0x2000); @@ -205,18 +205,18 @@ void func_80997DEC(EnGs* this, PlayState* play) { void func_80997E4C(EnGs* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: Message_StartTextbox(play, this->unk_210, &this->actor); break; - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x20D0: @@ -533,7 +533,8 @@ s32 func_80998A48(EnGs* this, PlayState* play) { } else if (this->unk_19D == 1) { if (func_80998334(this, play, &this->unk_1DC, &this->unk_1E0, &this->unk_1D4, 0.8f, 0.007f, 0.001f, 7, 0) == 0.0f) { - if ((this->actor.params != ENGS_0) && !Play_InCsMode(play) && (Message_GetState(&play->msgCtx) == 0)) { + if ((this->actor.params != ENGS_0) && !Play_InCsMode(play) && + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { this->unk_216 = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FAIVE_LUPY_COUNT); Message_StartTextbox(play, 0x20D2, NULL); @@ -656,7 +657,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { if (this->unk_19D == 2) { this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); - if ((this->unk_1D4++ <= 40) ^ 1) { + if (this->unk_1D4++ > 40) { this->unk_1DC = this->unk_1B0[0].y - 1.0f; this->unk_1E0 = 1.5f; this->unk_1E4 = this->unk_1B0[1].y - 1.0f; @@ -824,7 +825,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); - if ((this->unk_1D4++ < 40) ^ 1) { + if (this->unk_1D4++ >= 40) { this->unk_19A |= 0x10; this->actor.uncullZoneForward = 12000.0f; @@ -1005,7 +1006,7 @@ void EnGs_Update(Actor* thisx, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->collider.base.acFlags &= ~AC_HIT; func_80997DEC(this, play); } else if (func_800B8718(&this->actor, &play->state)) { diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index d4dc9a17e..843657b60 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -223,7 +223,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, yaw, 1, 0xBB8, 0); } - if (Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { this->targetHeadPos.y = 0; this->targetHeadPos.x = 0; if ((this->guardTextIndex == 3) && (this->animIndex == WAIT_HEAD_TILT_ANIM)) { @@ -255,7 +255,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) { EnGuardNuts_SetupWait(this); } } - } else if ((Message_GetState(&play->msgCtx) >= 3) && (D_80ABBE20 == 0)) { + } else if ((Message_GetState(&play->msgCtx) >= TEXT_STATE_3) && (D_80ABBE20 == 0)) { if ((this->guardTextIndex == 0) || (this->guardTextIndex == 3) || (this->guardTextIndex >= 7)) { if (this->timer == 0) { this->timer = 2; diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 76b445fbb..8fe8d58f7 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -191,7 +191,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } else if (this->unusedTimer == 0) { this->unusedTimer = 6; - if (Message_GetState(&play->msgCtx) != 5) { + if (Message_GetState(&play->msgCtx) != TEXT_STATE_5) { if (this->unk266 == 0) { if (this->headZRotTarget != 0) { this->headZRotTarget = 0; @@ -207,7 +207,7 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { } } } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->headZRotTarget = 0; if ((this->textIdIndex == 13) || (this->textIdIndex == 14)) { 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 74693be4e..aba6b4f90 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -5,7 +5,6 @@ */ #include "z_en_heishi.h" -#include "objects/object_sdn/object_sdn.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -65,8 +64,8 @@ void EnHeishi_Init(Actor* thisx, PlayState* play) { EnHeishi* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable, this->morphTable, - HEISHI_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gSoldierSkel, &gSoldierWave, this->jointTable, this->morphTable, + SOLDIER_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->paramsCopy = this->actor.params; this->yawTowardsPlayer = this->actor.world.rot.y; @@ -174,7 +173,7 @@ void EnHeishi_Update(Actor* thisx, PlayState* play) { s32 EnHeishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHeishi* this = THIS; - if (limbIndex == HEISHI_LIMB_HEAD) { + if (limbIndex == SOLDIER_LIMB_HEAD) { rot->x += this->headRotX; rot->y += this->headRotY; rot->z += this->headRotZ; 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 6e5d65e8f..1758ceae6 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.h @@ -2,37 +2,17 @@ #define Z_EN_HEISHI_H #include "global.h" +#include "objects/object_sdn/object_sdn.h" struct EnHeishi; typedef void (*EnHeishiActionFunc)(struct EnHeishi*, PlayState*); -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 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[HEISHI_LIMB_MAX]; - /* 0x1EE */ Vec3s morphTable[HEISHI_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[SOLDIER_LIMB_MAX]; + /* 0x1EE */ Vec3s morphTable[SOLDIER_LIMB_MAX]; /* 0x254 */ EnHeishiActionFunc actionFunc; /* 0x258 */ s16 headRotY; /* 0x25A */ s16 headRotX; diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 1e73cda44..c247a3402 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -1,11 +1,10 @@ /* * File: z_en_hg.c * Overlay: ovl_En_Hg - * Description: Pamela's Father (Human) + * Description: Pamela's Father (Gibdo) */ #include "z_en_hg.h" -#include "objects/object_harfgibud/object_harfgibud.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) @@ -121,8 +120,8 @@ void EnHg_Init(Actor* thisx, PlayState* play) { s32 i; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_harfgibud_Skel_008580, &object_harfgibud_Anim_00260C, - this->jointTable, this->morphTable, HG_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gHarfgibudGibdoSkel, &object_harfgibud_Anim_00260C, this->jointTable, + this->morphTable, HARFGIBUD_GIBDO_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); @@ -176,7 +175,7 @@ void func_80BCF4AC(EnHg* this, PlayState* play) { s32 pad; this->actor.speedXZ = 1.6f; - if (!(player->stateFlags2 & 0x08000000) && Message_GetState(&play->msgCtx) == 0) { + if (!(player->stateFlags2 & 0x08000000) && Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (((this->skelAnime.curFrame > 9.0f) && (this->skelAnime.curFrame < 16.0f)) || ((this->skelAnime.curFrame > 44.0f) && (this->skelAnime.curFrame < 51.0f))) { Actor_MoveWithGravity(&this->actor); @@ -215,7 +214,7 @@ void func_80BCF6D0(EnHg* this, PlayState* play) { } void func_80BCF710(EnHg* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x24F, &this->actor); } else { @@ -401,9 +400,9 @@ s32 EnHg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnHg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnHg* this = THIS; - if (limbIndex == HG_LIMB_HEAD) { + if (limbIndex == HARFGIBUD_GIBDO_LIMB_EYEBROWS) { Matrix_Get(&this->unk1D8); - } else if (limbIndex == HG_LIMB_PELVIS) { + } else if (limbIndex == HARFGIBUD_GIBDO_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); } } @@ -417,6 +416,6 @@ void EnHg_Draw(Actor* thisx, PlayState* play) { EnHg_OverrideLimbDraw, EnHg_PostLimbDraw, &this->actor); Matrix_Put(&this->unk1D8); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_harfgibud_DL_005E28); + gSPDisplayList(POLY_OPA_DISP++, gHarfgibudGibdoEyebrowsDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.h b/src/overlays/actors/ovl_En_Hg/z_en_hg.h index 75703ccbd..288314379 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.h +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.h @@ -2,34 +2,13 @@ #define Z_EN_HG_H #include "global.h" +#include "objects/object_harfgibud/object_harfgibud.h" + struct EnHg; typedef void (*EnHgActionFunc)(struct EnHg*, PlayState*); -typedef enum { - /* 00 */ HG_LIMB_NONE, - /* 01 */ HG_LIMB_ABDOMEN, - /* 02 */ HG_LIMB_CHEST, - /* 03 */ HG_LIMB_SHOULDER_LEFT, - /* 04 */ HG_LIMB_ARM_LEFT, - /* 05 */ HG_LIMB_HAND_LEFT, - /* 06 */ HG_LIMB_SHOULDER_RIGHT, - /* 07 */ HG_LIMB_ARM_RIGHT, - /* 08 */ HG_LIMB_HAND_RIGHT, - /* 09 */ HG_LIMB_EYEBROW, - /* 10 */ HG_LIMB_HEAD, - /* 11 */ HG_LIMB_PELVIS, - /* 12 */ HG_LIMB_THIGH_LEFT, - /* 13 */ HG_LIMB_LEG_LEFT, - /* 14 */ HG_LIMB_FOOT_LEFT, - /* 15 */ HG_LIMB_THIGH_RIGHT, - /* 16 */ HG_LIMB_LEG_RIGHT, - /* 17 */ HG_LIMB_FOOT_RIGHT, - /* 19 */ HG_LIMB_UNK, - /* 20 */ HG_LIMB_MAX, -} ObjectHgLimbs; - typedef struct EnHg { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; @@ -38,8 +17,8 @@ typedef struct EnHg { /* 0x1D8 */ MtxF unk1D8; /* 0x218 */ s32 unk218; /* 0x21C */ s32 currentAnimation; - /* 0x220 */ Vec3s jointTable[HG_LIMB_MAX]; - /* 0x292 */ Vec3s morphTable[HG_LIMB_MAX]; + /* 0x220 */ Vec3s jointTable[HARFGIBUD_GIBDO_LIMB_MAX]; + /* 0x292 */ Vec3s morphTable[HARFGIBUD_GIBDO_LIMB_MAX]; /* 0x304 */ UNK_TYPE1 pad304[0xC]; /* 0x310 */ u16 cutscenes[4]; } EnHg; // size = 0x318 diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index 9a38aba97..c8de1f210 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -1,11 +1,10 @@ /* * File: z_en_hgo.c * Overlay: ovl_En_Hgo - * Description: Pamela's Father (Gibdo) + * Description: Pamela's Father (Human) */ #include "z_en_hgo.h" -#include "objects/object_harfgibud/object_harfgibud.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) @@ -83,8 +82,8 @@ void EnHgo_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_harfgibud_Skel_012A58, &object_harfgibud_Anim_00B644, - this->jointTable, this->morphTable, HGO_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gHarfgibudHumanSkel, &object_harfgibud_Anim_00B644, this->jointTable, + this->morphTable, HARFGIBUD_HUMAN_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&thisx->colChkInfo, NULL, &sColChkInfoInit); @@ -175,20 +174,24 @@ void EnHgo_SetupDialogueHandler(EnHgo* this) { void EnHgo_DefaultDialogueHandler(EnHgo* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; - case 5: + + case TEXT_STATE_5: func_80BD06FC(this, play); break; - case 6: + + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80BD049C(this); } + break; } + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x71C, 0xB6); this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -315,7 +318,7 @@ s32 func_80BD0898(EnHgo* this, PlayState* play) { } void func_80BD0B8C(EnHgo* this, PlayState* play) { - Actor_TrackPlayer(play, &this->actor, &this->unk_300, &this->unk_306, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); if (this->unk_30E > 2) { this->unk_30E--; } else if (this->unk_30E == 2) { @@ -337,7 +340,7 @@ void EnHgo_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); if (func_80BD0898(this, play)) { - Actor_TrackNone(&this->unk_300, &this->unk_306); + Actor_TrackNone(&this->headRot, &this->torsoRot); } else if (this->actionFunc != func_80BD0410) { if (this->actionFunc != func_80BD0434) { Collider_UpdateCylinder(&this->actor, &this->collider); @@ -350,9 +353,9 @@ void EnHgo_Update(Actor* thisx, PlayState* play) { s32 EnHgo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnHgo* this = THIS; - if (limbIndex == HGO_LIMB_PELVIS) { - rot->x += this->unk_300.y; - rot->z += this->unk_300.x; + if (limbIndex == HARFGIBUD_HUMAN_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; } return false; } @@ -360,7 +363,7 @@ s32 EnHgo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnHgo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* pos, Actor* thisx) { EnHgo* this = THIS; - if (limbIndex == HGO_LIMB_PELVIS) { + if (limbIndex == HARFGIBUD_HUMAN_LIMB_HEAD) { Matrix_Get(&this->unk_1D8); Matrix_MultZero(&this->actor.focus.pos); } @@ -376,6 +379,6 @@ void EnHgo_Draw(Actor* thisx, PlayState* play) { EnHgo_OverrideLimbDraw, &EnHgo_PostLimbDraw, &this->actor); Matrix_Put(&this->unk_1D8); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_harfgibud_DL_00F248); + gSPDisplayList(POLY_OPA_DISP++, gHarfgibudHumanEyebrowsDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h index 994dabcfb..34e4ebdc4 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h @@ -2,35 +2,12 @@ #define Z_EN_HGO_H #include "global.h" +#include "objects/object_harfgibud/object_harfgibud.h" struct EnHgo; typedef void (*EnHgoActionFunc)(struct EnHgo*, PlayState*); -// Shares the same setup as en_hg -typedef enum { - /* 00 */ HGO_LIMB_NONE, - /* 01 */ HGO_LIMB_ABDOMEN, - /* 02 */ HGO_LIMB_CHEST, - /* 03 */ HGO_LIMB_SHOULDER_LEFT, - /* 04 */ HGO_LIMB_ARM_LEFT, - /* 05 */ HGO_LIMB_HAND_LEFT, - /* 06 */ HGO_LIMB_SHOULDER_RIGHT, - /* 07 */ HGO_LIMB_ARM_RIGHT, - /* 08 */ HGO_LIMB_HAND_RIGHT, - /* 09 */ HGO_LIMB_EYEBROW, - /* 10 */ HGO_LIMB_HEAD, - /* 11 */ HGO_LIMB_PELVIS, - /* 12 */ HGO_LIMB_THIGH_LEFT, - /* 13 */ HGO_LIMB_LEG_LEFT, - /* 14 */ HGO_LIMB_FOOT_LEFT, - /* 15 */ HGO_LIMB_THIGH_RIGHT, - /* 16 */ HGO_LIMB_LEG_RIGHT, - /* 17 */ HGO_LIMB_FOOT_RIGHT, - /* 18 */ HGO_LIMB_UNK, - /* 19 */ HGO_LIMB_MAX, -} ObjectHgoLimbs; - typedef struct EnHgo { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; @@ -38,10 +15,10 @@ typedef struct EnHgo { /* 0x1D4 */ EnHgoActionFunc actionFunc; /* 0x1D8 */ MtxF unk_1D8; /* 0x218 */ s32 unk_218; - /* 0x21C */ Vec3s jointTable[HGO_LIMB_MAX]; - /* 0x28E */ Vec3s morphTable[HGO_LIMB_MAX]; - /* 0x300 */ Vec3s unk_300; - /* 0x306 */ Vec3s unk_306; + /* 0x21C */ Vec3s jointTable[HARFGIBUD_HUMAN_LIMB_MAX]; + /* 0x28E */ Vec3s morphTable[HARFGIBUD_HUMAN_LIMB_MAX]; + /* 0x300 */ Vec3s headRot; + /* 0x306 */ Vec3s torsoRot; // Set, but not used /* 0x30C */ s16 unk_30C; /* 0x30E */ s16 unk_30E; /* 0x310 */ s16 unk_310; diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index 9df183a9e..e07b8ac70 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -223,7 +223,7 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) { this->unk_218 = 30; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80BDB268(this); } diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index f5b34cc7a..ee337e9a9 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -425,29 +425,29 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { this->unk_3DE = 0; switch (Message_GetState(&play->msgCtx)) { - case 3: + case TEXT_STATE_3: if ((play->gameplayFrames % 2) != 0) { this->unk_3DE = 1; } break; - case 4: + case TEXT_STATE_CHOICE: func_80C20B88(this, play); break; - case 5: + case TEXT_STATE_5: func_80C20C24(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80C2075C(this); } break; - case 0: - case 1: - case 2: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: break; } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 9676ce20c..0e85e7dc5 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -162,7 +162,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_INVISIBLE_MONKEY - SFX_FLAG); } } - if ((play->transitionTrigger != 0) || (play->transitionMode != 0)) { + if ((play->transitionTrigger != TRANS_TRIGGER_OFF) || (play->transitionMode != TRANS_MODE_OFF)) { this->alpha = 255; } else { f32 enHollBottom = EN_HOLL_BOTTOM_DEFAULT; @@ -191,7 +191,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { play->nextEntranceIndex = play->setupExitList[EN_HOLL_GET_EXIT_LIST_INDEX(&this->actor)]; gSaveContext.unk_3DBB = 1; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; play->unk_1878C(play); } else { this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide ^ 1].room; @@ -309,7 +309,8 @@ void EnHoll_Update(Actor* thisx, PlayState* play) { EnHoll* this = THIS; Player* player = GET_PLAYER(play); - if ((play->transitionTrigger == 0) && (play->transitionMode == 0) && !(player->stateFlags1 & 0x200)) { + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !(player->stateFlags1 & 0x200)) { this->actionFunc(this, play); } } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index de4ae14f4..9e528cf3b 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -6,6 +6,8 @@ #include "z_en_horse.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_In/z_en_in.h" +#include "overlays/actors/ovl_Obj_Um/z_obj_um.h" #include "overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h" #include "objects/object_horse_link_child/object_horse_link_child.h" @@ -122,7 +124,9 @@ static AnimationHeader** sAnimationHeaders[] = { NULL, NULL, sEponaAnimHeaders, sHniAnimHeaders, sHniAnimHeaders, }; -static f32 sPlaybackSpeeds[] = { 2.0f / 3.0f, 2.0f / 3.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 2.0f / 3.0f, 2.0f / 3.0f }; +static f32 sPlaybackSpeeds[] = { + 2.0f / 3.0f, 2.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 3.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, +}; static SkeletonHeader* sSkeletonHeaders[] = { NULL, NULL, &object_horse_link_child_Skel_00A480, NULL, NULL, @@ -468,7 +472,7 @@ void EnHorse_PlayWalkingSound(EnHorse* this) { return; } - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_WALK); @@ -482,7 +486,7 @@ void EnHorse_PlayWalkingSound(EnHorse* this) { } void func_8087C178(EnHorse* this) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -490,7 +494,7 @@ void func_8087C178(EnHorse* this) { } void func_8087C1C0(EnHorse* this) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -546,19 +550,19 @@ s32 func_8087C38C(PlayState* play, EnHorse* this, Vec3f* arg2) { void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { if ((this->animationIdx == ENHORSE_ANIM_IDLE) && - (((this->curFrame > 35.0f) && (this->type == HORSE_EPONA)) || - ((this->curFrame > 28.0f) && (this->type == HORSE_HNI)) || - ((this->curFrame > 25.0f) && (this->type == HORSE_2))) && + (((this->curFrame > 35.0f) && (this->type == HORSE_TYPE_EPONA)) || + ((this->curFrame > 28.0f) && (this->type == HORSE_TYPE_HNI)) || + ((this->curFrame > 25.0f) && (this->type == HORSE_TYPE_2))) && !(this->stateFlags & ENHORSE_SANDDUST_SOUND)) { this->stateFlags |= ENHORSE_SANDDUST_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } } else if ((this->animationIdx == 3) && (this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -694,8 +698,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->unk_3E8 = 0.0f; this->unk_528 = 100.0f; - if (ENHORSE_GET_8000(&this->actor)) { - this->type = HORSE_4; + if (ENHORSE_IS_DONKEY_TYPE(&this->actor)) { + this->type = HORSE_TYPE_DONKEY; this->unk_528 = 80.0f; this->boostSpeed = 12; if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { @@ -704,8 +708,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } this->unk_1EC |= 1; thisx->update = func_8087D540; - } else if (ENHORSE_GET_4000(&this->actor)) { - this->type = HORSE_2; + } else if (ENHORSE_IS_4000_TYPE(&this->actor)) { + this->type = HORSE_TYPE_2; this->unk_528 = 64.8f; this->boostSpeed = 15; if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HORSE_LINK_CHILD)) < 0) { @@ -717,8 +721,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } else { thisx->update = func_8087D540; } - } else if (ENHORSE_GET_2000(&this->actor)) { - this->type = HORSE_3; + } else if (ENHORSE_IS_BANDIT_TYPE(&this->actor)) { + this->type = HORSE_TYPE_BANDIT; this->boostSpeed = 12; if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HA)) < 0) { Actor_MarkForDeath(&this->actor); @@ -727,14 +731,14 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->unk_1EC |= 1; thisx->update = func_8087D540; } else { - this->type = HORSE_EPONA; + this->type = HORSE_TYPE_EPONA; this->boostSpeed = 15; Actor_MarkForDeath(&this->actor); } - thisx->params &= ~0xE000; - if (thisx->params == 0x1FFF) { - thisx->params = ENHORSE_1; + this->actor.params &= ~(ENHORSE_PARAM_DONKEY | ENHORSE_PARAM_4000 | ENHORSE_PARAM_BANDIT); + if (this->actor.params == 0x1FFF) { + this->actor.params = ENHORSE_1; } if (thisx->params == ENHORSE_3) { @@ -780,9 +784,9 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->action = ENHORSE_ACT_IDLE; thisx->speedXZ = 0.0f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { sJntSphInit.elements[0].dim.limb = 13; - } else if ((this->type == HORSE_3) || (this->type == HORSE_4)) { + } else if ((this->type == HORSE_TYPE_BANDIT) || (this->type == HORSE_TYPE_DONKEY)) { sJntSphInit.elements[0].dim.limb = 10; } @@ -793,19 +797,19 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Collider_InitJntSph(play, &this->colliderJntSph); Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { this->colliderCylinder1.dim.radius = this->colliderCylinder1.dim.radius * 0.8f; this->colliderCylinder2.dim.radius = this->colliderCylinder2.dim.radius * 0.8f; this->colliderJntSph.elements[0].dim.modelSphere.radius *= 0.6f; - } else if (this->type == HORSE_4) { + } else if (this->type == HORSE_TYPE_DONKEY) { this->colliderCylinder1.dim.radius = 50; } CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Actor_SetScale(&this->actor, 0.00648f); - } else if (this->type == HORSE_4) { + } else if (this->type == HORSE_TYPE_DONKEY) { Actor_SetScale(&this->actor, 0.008f); } else { Actor_SetScale(&this->actor, 0.01f); @@ -889,7 +893,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { thisx->world.rot.z = thisx->shape.rot.z; thisx->home.rot.z = thisx->shape.rot.z; this->unk_3EC = thisx->world.rot.y; - this->unk_538 = 0; + this->unk_538 = OBJ_UM_ANIM_TROT; if (this->unk_1EC & 0x100) { this->colliderCylinder1.base.colType = COLTYPE_HIT3; @@ -903,6 +907,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } } +// EnHorse_WaitForObject void func_8087D540(Actor* thisx, PlayState* play) { EnHorse* this = THIS; @@ -911,7 +916,7 @@ void func_8087D540(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); this->actor.update = EnHorse_Update; if (this->unk_1EC & 1) { - if (this->type == HORSE_3) { + if (this->type == HORSE_TYPE_BANDIT) { SkelAnime_InitFlex(play, &this->skin.skelAnime, &object_ha_Skel_008C68, NULL, this->jointTable, this->morphTable, OBJECT_HA_1_LIMB_MAX); } else { @@ -1097,11 +1102,11 @@ void EnHorse_StartMountedIdle(EnHorse* this) { this->action = ENHORSE_ACT_MOUNTED_TURN; this->animationIdx = ENHORSE_ANIM_IDLE; - if (((this->curFrame > 35.0f) && (this->type == HORSE_EPONA)) || - ((this->curFrame > 28.0f) && (this->type == HORSE_HNI))) { + if (((this->curFrame > 35.0f) && (this->type == HORSE_TYPE_EPONA)) || + ((this->curFrame > 28.0f) && (this->type == HORSE_TYPE_HNI))) { if (!(this->stateFlags & ENHORSE_SANDDUST_SOUND)) { this->stateFlags |= ENHORSE_SANDDUST_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); @@ -1152,7 +1157,7 @@ void EnHorse_MountedIdleWhinney(EnHorse* this) { Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, curFrame, Animation_GetLastFrame(sAnimationHeaders[this->type][1]), ANIMMODE_ONCE, -3.0f); if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); @@ -1437,7 +1442,7 @@ void EnHorse_StartRearing(EnHorse* this) { if (sAnimationHeaders[this->type][this->animationIdx] == NULL) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -1451,7 +1456,7 @@ void EnHorse_StartRearing(EnHorse* this) { this->stateFlags &= ~ENHORSE_LAND2_SOUND; if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -1471,7 +1476,7 @@ void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -1511,7 +1516,7 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { if (sAnimationHeaders[this->type][this->animationIdx] == NULL) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -1523,7 +1528,7 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { EnHorse_StartMountedIdleResetAnim(this); } - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); @@ -1548,7 +1553,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { if ((Rand_ZeroOne() > 0.5f) && ((gSaveContext.save.entranceIndex != 0x6400) || !Cutscene_GetSceneSetupIndex(play))) { if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -1681,7 +1686,7 @@ void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { y = jointTable->y; this->riderPos.y -= ((y * 0.01f) * this->unk_528) * 0.01f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); @@ -1740,7 +1745,7 @@ void EnHorse_LowJump(EnHorse* this, PlayState* play) { if (SkelAnime_Update(&this->skin.skelAnime) || ((curFrame > 17.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); @@ -1779,7 +1784,7 @@ void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { this->riderPos.y -= ((y * 0.01f) * this->unk_528) * 0.01f; this->stateFlags |= ENHORSE_CALC_RIDER_POS; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); @@ -1837,7 +1842,7 @@ void EnHorse_HighJump(EnHorse* this, PlayState* play) { if (SkelAnime_Update(&this->skin.skelAnime) || ((curFrame > 23.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); @@ -1862,10 +1867,10 @@ void EnHorse_InitInactive(EnHorse* this) { } void EnHorse_Inactive(EnHorse* this, PlayState* play) { - if ((D_801BDAA4 != 0) && (this->type == HORSE_2)) { + if ((D_801BDAA4 != 0) && (this->type == HORSE_TYPE_2)) { D_801BDAA4 = 0; if (EnHorse_Spawn(this, play)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } this->stateFlags &= ~ENHORSE_INACTIVE; @@ -1901,7 +1906,7 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta } else { if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); @@ -1909,7 +1914,7 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta } } else if (this->animationIdx == ENHORSE_ANIM_REARING) { if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -1942,11 +1947,11 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { this->actor.speedXZ = 0.0f; EnHorse_IdleAnimSounds(this, play); - if ((D_801BDAA4 != 0) && (this->type == HORSE_2)) { + if ((D_801BDAA4 != 0) && (this->type == HORSE_TYPE_2)) { D_801BDAA4 = 0; if (!func_8087C38C(play, this, &this->actor.world.pos)) { if (EnHorse_Spawn(this, play)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); @@ -1955,7 +1960,7 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { EnHorse_SetFollowAnimation(this, play); } } else { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); @@ -2067,7 +2072,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if ((this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -2099,7 +2104,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { if (this->followTimer > 300) { EnHorse_StartIdleRidable(this); if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -2179,14 +2184,14 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { animSpeed = this->actor.speedXZ * 0.5f; } else if (this->animationIdx == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -2259,7 +2264,7 @@ void func_80881290(EnHorse* this, PlayState* play) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->jumpStartY = this->actor.world.pos.y; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); @@ -2299,7 +2304,7 @@ void func_80881398(EnHorse* this, PlayState* play) { if (animeUpdated || ((curFrame > 17.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); @@ -2371,14 +2376,14 @@ void func_8088168C(EnHorse* this) { animSpeed = this->actor.speedXZ * 0.5f; } else if (this->animationIdx == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -2516,7 +2521,7 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { this->riderPos.y -= y * 0.01f * this->unk_528 * 0.01f; this->stateFlags |= ENHORSE_ANIM_HIGH_JUMP; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_JUMP); @@ -2566,7 +2571,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { ((curFrame > 19.0f) && (this->actor.world.pos.y < ((this->actor.floorHeight - this->actor.velocity.y) + 80.0f)))) { this->cutsceneFlags |= 1; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_LAND); @@ -2595,7 +2600,7 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* act this->cutsceneFlags &= ~4; this->stateFlags &= ~ENHORSE_LAND2_SOUND; if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -2610,7 +2615,7 @@ void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -2688,7 +2693,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* this->stateFlags &= ~ENHORSE_LAND2_SOUND; if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -2703,7 +2708,7 @@ void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* act if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -2860,7 +2865,7 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { animSpeed = this->actor.speedXZ * 0.5f; } else if (this->animationIdx == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -2868,7 +2873,7 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { Rumble_Request(0.0f, 60, 8, 255); } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); @@ -2908,8 +2913,8 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (((this->hbaFlags & 1) || (this->hbaTimer > 45)) && (sp28 != 1) && (gSaveContext.minigameState != 3)) { gSaveContext.save.cutscene = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x40; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_64; } if (play->interfaceCtx.hbaAmmo) {} @@ -2952,9 +2957,9 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { s32 animFinished; s16 yaw; - if ((D_801BDAA4 != 0) || (this->type == HORSE_HNI)) { + if ((D_801BDAA4 != 0) || (this->type == HORSE_TYPE_HNI)) { EnHorse_StartIdleRidable(this); - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_NEIGH); @@ -3059,7 +3064,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { } else { this->animationIdx = ENHORSE_ANIM_WHINNEY; if (this->stateFlags & ENHORSE_DRAW) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); @@ -3331,12 +3336,12 @@ void func_80884994(EnHorse* this) { } void func_80884A40(EnHorse* this, PlayState* play) { - s32 sp44[] = { 5, 6, 0 }; + s32 sp44[] = { ENHORSE_ANIM_TROT, ENHORSE_ANIM_GALLOP, ENHORSE_ANIM_IDLE }; s32 sp40; s32 temp_v0; if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { - temp_v0 = 0; + temp_v0 = ENHORSE_ANIM_IDLE; } else { temp_v0 = this->animationIdx; } @@ -3366,9 +3371,9 @@ void func_80884A40(EnHorse* this, PlayState* play) { 0.0f); } - if ((this->unk_538 == 0) || (this->unk_538 == 1)) { + if ((this->unk_538 == OBJ_UM_ANIM_TROT) || (this->unk_538 == OBJ_UM_ANIM_GALLOP)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_RUN); - } else if (this->unk_538 == 2) { + } else if (this->unk_538 == OBJ_UM_ANIM_IDLE) { if (this->animationIdx == ENHORSE_ANIM_IDLE) { EnHorse_IdleAnimSounds(this, play); } else if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { @@ -3392,6 +3397,7 @@ void func_80884D04(EnHorse* this, PlayState* play) { Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, 0.0f); } +// Action func: EnHorse_UpdateBandit? void func_80884E0C(EnHorse* this, PlayState* play) { f32 playSpeed = (this->unk_56C * 0.2f * 0.5f) + 1.0f; Vec3f pos; @@ -3408,8 +3414,8 @@ void func_80884E0C(EnHorse* this, PlayState* play) { } this->unk_57C = this->actor.world.pos; - this->actor.world.pos.x = this->unk_570.x; - this->actor.world.pos.z = this->unk_570.z; + this->actor.world.pos.x = this->banditPosition.x; + this->actor.world.pos.z = this->banditPosition.z; this->unk_56C = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos); if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) { @@ -3429,7 +3435,7 @@ void func_80884E0C(EnHorse* this, PlayState* play) { } this->actor.world.pos.y += this->actor.velocity.y * 0.5f; } else { - this->actor.world.pos.y = this->unk_570.y; + this->actor.world.pos.y = this->banditPosition.y; } } @@ -3536,7 +3542,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { return; } - if (this->type != HORSE_2) { + if (this->type != HORSE_TYPE_2) { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, 30.0f, 55.0f, &frontPos); } else { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, 15.0f, 30.0f, &frontPos); @@ -3555,7 +3561,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { return; } - if (this->type != HORSE_2) { + if (this->type != HORSE_TYPE_2) { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, -30.0f, 55.0f, &backPos); } else { EnHorse_Vec3fOffset(&this->actor.world.pos, this->actor.shape.rot.y, -15.0f, 30.0f, &backPos); @@ -3732,7 +3738,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((this->actor.bgCheckFlags & 8) && (Math_CosS(this->actor.wallYaw - this->actor.world.rot.y) < -0.3f)) { if (this->actor.speedXZ > 4.0f) { this->actor.speedXZ -= 1.0f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); @@ -3749,7 +3755,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { this->unk_3E8 += ((-10.0f / this->actor.scale.y) - this->unk_3E8) * 0.5f; if (this->actor.speedXZ > 2.0f) { this->actor.speedXZ -= 1.0f; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_SANDDUST); @@ -3990,7 +3996,7 @@ void func_80886C00(EnHorse* this, PlayState* play) { this->boostTimer = 0; if (this->numBoosts == 0) { this->boostRegenTime = 140; - } else if (this->type == HORSE_EPONA) { + } else if (this->type == HORSE_TYPE_EPONA) { if (this->stateFlags & ENHORSE_FIRST_BOOST_REGEN) { this->boostRegenTime = 60; this->stateFlags &= ~ENHORSE_FIRST_BOOST_REGEN; @@ -4001,7 +4007,7 @@ void func_80886C00(EnHorse* this, PlayState* play) { this->boostRegenTime = 70; } } else if ((this->stateFlags & ENHORSE_DRAW) && (Rand_ZeroOne() < 0.1f)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -4056,7 +4062,7 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { if (this->boostTimer == 8) { if ((Rand_ZeroOne() < 0.25f) && (this->stateFlags & ENHORSE_DRAW)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -4175,9 +4181,9 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { Vec3f dustVel = { 0.0f, 1.0f, 0.0f }; Player* player = GET_PLAYER(play); - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Actor_SetScale(&this->actor, 0.00648f); - } else if (this->type == HORSE_4) { + } else if (this->type == HORSE_TYPE_DONKEY) { Actor_SetScale(&this->actor, 0.008f); } else { Actor_SetScale(&this->actor, 0.01f); @@ -4258,7 +4264,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } if ((this->colliderJntSph.base.acFlags & AC_HIT) && (this->stateFlags & ENHORSE_DRAW)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } else { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); @@ -4290,7 +4296,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { Collider_UpdateCylinder(&this->actor, &this->colliderCylinder1); Collider_UpdateCylinder(&this->actor, &this->colliderCylinder2); - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { this->colliderCylinder1.dim.pos.x = (s16)(Math_SinS(thisx->shape.rot.y) * 11.0f) + this->colliderCylinder1.dim.pos.x; this->colliderCylinder1.dim.pos.z = @@ -4456,7 +4462,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { f32 sp34; if (!(this->stateFlags & ENHORSE_CALC_RIDER_POS)) { - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetVertexPos(skin, 5, 120, &this->riderPos); this->riderPos.y += 13.0f; } else { @@ -4471,7 +4477,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { this->stateFlags &= ~ENHORSE_CALC_RIDER_POS; } - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 13, &sp7C, &sp38); } else { Skin_GetLimbPos(skin, 13, &sp7C, &sp38); @@ -4492,7 +4498,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (((curFrame > 10.0f) && (curFrame < 13.0f)) || ((curFrame > 25.0f) && (curFrame < 33.0f))) { if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 2; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 20, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 20, &hoofOffset, &sp64); @@ -4502,7 +4508,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 1; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 28, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 28, &hoofOffset, &sp64); @@ -4514,7 +4520,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (((curFrame > 6.0f) && (curFrame < 10.0f)) || ((curFrame > 23.0f) && (curFrame < 29.0f))) { if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 8; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 36, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 37, &hoofOffset, &sp64); @@ -4526,7 +4532,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if ((((curFrame > 7.0f) && (curFrame < 14.0f)) || ((curFrame > 26.0f) && (curFrame < 30.0f))) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 4; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 44, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 45, &hoofOffset, &sp64); @@ -4536,7 +4542,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { if ((curFrame > 14.0f) && (curFrame < 16.0f) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 1; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 28, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 28, &hoofOffset, &sp64); @@ -4544,7 +4550,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorse_RandomOffset(&sp64, 5.0f, &this->frontRightHoof); } else if ((curFrame > 8.0f) && (curFrame < 10.0f) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 2; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 20, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 20, &hoofOffset, &sp64); @@ -4552,7 +4558,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorse_RandomOffset(&sp64, 10.0f, &this->frontLeftHoof); } else if ((curFrame > 1.0f) && (curFrame < 3.0f) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 4; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 44, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 45, &hoofOffset, &sp64); @@ -4560,7 +4566,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorse_RandomOffset(&sp64, 10.0f, &this->backRightHoof); } else if ((curFrame > 26.0f) && (curFrame < 28.0f) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 8; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 36, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 37, &hoofOffset, &sp64); @@ -4571,7 +4577,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { (Rand_ZeroOne() < (1.0f - ((curFrame - 6.0f) * (1.0f / 17.0f))))) { if (Rand_ZeroOne() < 0.05f) { this->dustFlags |= 8; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 36, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 37, &hoofOffset, &sp64); @@ -4580,7 +4586,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 4; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 44, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 45, &hoofOffset, &sp64); @@ -4591,7 +4597,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (Rand_ZeroOne() < (1.0f - ((curFrame - 5.0f) * 0.04f))) { if (Rand_ZeroOne() < 0.05f) { this->dustFlags |= 8; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 36, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 37, &hoofOffset, &sp64); @@ -4601,7 +4607,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 4; - if (this->type == HORSE_2) { + if (this->type == HORSE_TYPE_2) { Skin_GetLimbPos(skin, 44, &hoofOffset, &sp64); } else { Skin_GetLimbPos(skin, 45, &hoofOffset, &sp64); @@ -4649,12 +4655,12 @@ s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* OPEN_DISPS(play->state.gfxCtx); - if ((limbIndex != 13) || (this->type != HORSE_EPONA)) { - if ((limbIndex == 13) && (this->type == HORSE_2)) { + if ((limbIndex != 13) || (this->type != HORSE_TYPE_EPONA)) { + if ((limbIndex == 13) && (this->type == HORSE_TYPE_2)) { u8 idx = D_80889210[this->blinkTimer]; gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80889204[idx])); - } else if ((this->type == HORSE_HNI) && (this->stateFlags & ENHORSE_FLAG_18) && (limbIndex == 30)) { + } else if ((this->type == HORSE_TYPE_HNI) && (this->stateFlags & ENHORSE_FLAG_18) && (limbIndex == 30)) { drawOriginalLimb = false; } } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index a05e1a2c5..9f32331c6 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -3,11 +3,11 @@ #include "global.h" #include "z64skin.h" -#include "overlays/actors/ovl_En_In/z_en_in.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_ha/object_ha.h" struct EnHorse; +struct EnIn; typedef void (*EnHorseActionFunc)(struct EnHorse*, PlayState*); typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, PlayState*); @@ -97,18 +97,22 @@ typedef enum { } EnHorseAnimationIndex; typedef enum { - /* 0 */ HORSE_EPONA, - /* 1 */ HORSE_HNI, - /* 2 */ HORSE_2, - /* 3 */ HORSE_3, - /* 4 */ HORSE_4 + /* 0 */ HORSE_TYPE_EPONA, + /* 1 */ HORSE_TYPE_HNI, + /* 2 */ HORSE_TYPE_2, + /* 3 */ HORSE_TYPE_BANDIT, + /* 4 */ HORSE_TYPE_DONKEY // Cremia's donkey } HorseType; -#define ENHORSE_GET_2000(thisx) ((thisx)->params & 0x2000) -#define ENHORSE_GET_4000(thisx) ((thisx)->params & 0x4000) -#define ENHORSE_GET_8000(thisx) ((thisx)->params & 0x8000) +#define ENHORSE_PARAM_BANDIT 0x2000 +#define ENHORSE_PARAM_4000 0x4000 +#define ENHORSE_PARAM_DONKEY 0x8000 -enum { +#define ENHORSE_IS_BANDIT_TYPE(thisx) ((thisx)->params & ENHORSE_PARAM_BANDIT) +#define ENHORSE_IS_4000_TYPE(thisx) ((thisx)->params & ENHORSE_PARAM_4000) +#define ENHORSE_IS_DONKEY_TYPE(thisx) ((thisx)->params & ENHORSE_PARAM_DONKEY) + +typedef enum { /* 0 */ ENHORSE_0, /* 1 */ ENHORSE_1, /* 2 */ ENHORSE_2, @@ -130,7 +134,13 @@ enum { /* 18 */ ENHORSE_18, /* 19 */ ENHORSE_19, /* 20 */ ENHORSE_20, -}; +} EnHorseParam; + +/** + * `paramtype` should be `ENHORSE_PARAM_BANDIT`, `ENHORSE_PARAM_4000` or `ENHORSE_PARAM_DONKEY` + * `lower` should be a value of the enum `EnHorseParam` + */ +#define ENHORSE_PARAMS(type, lower) ((type) | (lower)) typedef struct EnHorse { /* 0x000 */ Actor actor; @@ -180,7 +190,7 @@ typedef struct EnHorse { /* 0x384 */ u16 cutsceneFlags; /* 0x388 */ s32 inRace; /* 0x38C */ struct EnIn* rider; - /* 0x390 */ UNK_TYPE1 unk390[0x4]; + /* 0x390 */ UNK_TYPE1 unk_390[0x4]; /* 0x394 */ u16 unk_394; /* 0x398 */ f32 unk_398; /* 0x39C */ s32 unk_39C; @@ -193,7 +203,7 @@ typedef struct EnHorse { /* 0x3C8 */ Vec3f backRightHoof; /* 0x3D4 */ Vec3f backLeftHoof; /* 0x3E0 */ s32 unk_3E0; - /* 0x3E4 */ UNK_TYPE1 unk3E4[0x4]; + /* 0x3E4 */ UNK_TYPE1 unk_3E4[0x4]; /* 0x3E8 */ f32 unk_3E8; /* 0x3EC */ s16 unk_3EC; /* 0x3EE */ Vec3s jointTable[OBJECT_HA_1_LIMB_MAX]; @@ -205,13 +215,19 @@ typedef struct EnHorse { /* 0x538 */ s32 unk_538; /* 0x53C */ s32 unk_53C; /* 0x540 */ Vec3f unk_540; - /* 0x54C */ UNK_TYPE1 unk54C[0x4]; + /* 0x54C */ UNK_TYPE unk_54C; /* 0x550 */ s32 unk_550; - /* 0x554 */ UNK_TYPE1 unk554[0x18]; + /* 0x554 */ UNK_TYPE unk_554; + /* 0x558 */ UNK_TYPE unk_558; + /* 0x55C */ s32 unk_55C; // maybe currentDistanceToCart... it isn't really a distance tho + /* 0x560 */ s32 unk_560; // maybe initialDistanceToCart + /* 0x564 */ s32 unk_564; // set but not used + /* 0x568 */ f32 unk_568; // set but not used /* 0x56C */ f32 unk_56C; - /* 0x570 */ Vec3f unk_570; + /* 0x570 */ Vec3f banditPosition; // Milk run minigame bandit /* 0x57C */ Vec3f unk_57C; - /* 0x588 */ UNK_TYPE1 unk588[0x4]; + /* 0x588 */ s16 unk_588; + /* 0x58A */ UNK_TYPE1 unk_58A[0x2]; // struct padding? /* 0x58C */ s32 unk_58C; /* 0x590 */ s32 unk_590; } EnHorse; // size = 0x594 diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 1cd96bd32..d9e52ee8d 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -109,8 +109,8 @@ s32 func_808F8C70(EnHorseGameCheck* this, PlayState* play) { s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { PlayState* play = play2; s32 pad; - Vec3f sp4C = { -1262.0f, 15.0f, 780.0f }; - Vec3f sp40 = { -1262.0f, -26.0f, 470.0f }; + Vec3f mainCamEye = { -1262.0f, 15.0f, 780.0f }; + Vec3f mainCamAt = { -1262.0f, -26.0f, 470.0f }; this->unk_164 = 0; this->unk_168 = 0; @@ -124,22 +124,22 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { func_8010E9F0(TIMER_ID_4, 0); play->interfaceCtx.unk_280 = 1; - this->horse1 = - (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, 0x2004); + this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, + ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_4)); if (this->horse1 == NULL) { __assert("../z_en_horse_game_check.c", 1517); } - this->horse2 = - (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, 0x2005); + this->horse2 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, + ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_5)); if (this->horse2 == NULL) { __assert("../z_en_horse_game_check.c", 1526); } this->unk_17C = -1; Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FREE0); - Play_CameraSetAtEye(play, 0, &sp40, &sp4C); - Play_CameraSetFov(play, 0, 45.0f); + Play_CameraSetAtEye(play, CAM_ID_MAIN, &mainCamAt, &mainCamEye); + Play_CameraSetFov(play, CAM_ID_MAIN, 45.0f); func_800FE484(); return false; } @@ -157,15 +157,15 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { } if (GET_RACE_FLAGS == RACE_FLAG_3) { - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 2; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } else if (GET_RACE_FLAGS == RACE_FLAG_2) { - play->unk_1887F = 0x50; - gSaveContext.nextTransition = 3; + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } else if (GET_RACE_FLAGS == RACE_FLAG_4) { SET_RACE_FLAGS(RACE_FLAG_3); - play->unk_1887F = 2; - gSaveContext.nextTransition = 2; + play->transitionType = TRANS_TYPE_02; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } D_801BDA9C = 0; @@ -173,7 +173,7 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { D_801BDAA0 = 1; } play->nextEntranceIndex = 0xCE20; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; return false; } diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index dfb114c9e..15a735128 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -174,7 +174,7 @@ void func_80953098(EnHs* this, PlayState* play) { } void func_80953180(EnHs* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x33F4: // text: laughing that they are all roosters (!) case 0x33F6: // text: Grog regrets not being able to see his chicks reach adult hood @@ -196,7 +196,7 @@ void func_80953180(EnHs* this, PlayState* play) { break; case 0x33F5: // He heard from his gramps (?) the moon is going to fall - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->actionFunc = func_80952FE0; this->stateTimer = 0; this->headRot.z = 0; @@ -217,7 +217,7 @@ void EnHs_DoNothing(EnHs* this, PlayState* play) { void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play) { if (DECR(this->stateTimer) == 0) { play->nextEntranceIndex = play->setupExitList[HS_GET_EXIT_INDEX(&this->actor)]; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[25] |= 8; this->actionFunc = EnHs_DoNothing; } diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 072ec01d4..cf24adfd0 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -362,7 +362,7 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { case 2: case 4: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); } this->unk_3F6++; @@ -376,7 +376,7 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { ActorCutscene_Stop(sp2A); this->unk_3F6 = 5; } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); } this->unk_3F6++; ret = true; @@ -496,7 +496,7 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { return false; } -s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s32 arg4) { +s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s32 arg3, s32 arg4) { u8 sp4F = ENIG_GET_FF(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -508,8 +508,8 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s sp2C = func_80BF1150(this, play, arg3, arg4); this->timePath = NULL; - if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]); + if (D_80BF3318[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -526,10 +526,10 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s return sp24; } -s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 sp2C = 0; - if (func_80BF1C44(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { + if (func_80BF1C44(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) { func_80BF1284(this, 0); SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x20; @@ -539,7 +539,7 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleResult* arg2) { return sp2C; } -s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = ENIG_GET_FF(&this->actor); EnDoor* door; @@ -550,10 +550,10 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_80BF1200(play, arg2->result); + door = func_80BF1200(play, scheduleOutput->result); - if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[arg2->result]); + if (D_80BF3318[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[scheduleOutput->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -572,8 +572,8 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) { this->unk_2A4 = 75; } - this->unk_3E0 = arg2->time1 - arg2->time0; - this->unk_3E2 = sp56 - arg2->time0; + this->unk_3E0 = scheduleOutput->time1 - scheduleOutput->time0; + this->unk_3E2 = sp56 - scheduleOutput->time0; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_3D0 |= 0x100; func_80BF1284(this, 3); @@ -584,17 +584,18 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = ENIG_GET_FF(&this->actor); - s32 pad; + u16 tmp; + s16 pad; s32 ret = false; this->timePath = NULL; - if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[arg2->result]); + if (D_80BF3318[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -605,20 +606,20 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) { if ((this->scheduleResult < 10) && (this->scheduleResult != 0) && (this->timePathTimeSpeed >= 0)) { phi_v1 = sp2E; } else { - phi_v1 = arg2->time0; + phi_v1 = scheduleOutput->time0; } - if (arg2->time1 < phi_v1) { - this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF; + if (scheduleOutput->time1 < phi_v1) { + this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF; } else { - this->timePathTotalTime = arg2->time1 - phi_v1; + this->timePathTotalTime = scheduleOutput->time1 - phi_v1; } this->timePathElapsedTime = sp2E - phi_v1; - phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); - this->timePathWaypointTime = this->timePathTotalTime / phi_v1; + this->timePathWaypointTime = this->timePathTotalTime / tmp; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); @@ -633,7 +634,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { u8 sp4F = ENIG_GET_FF(&this->actor); Vec3f sp40; Vec3f sp34; @@ -643,8 +644,8 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) { this->timePath = NULL; - if (D_80BF3318[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]); + if (D_80BF3318[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -656,7 +657,7 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) { Math_Vec3f_Copy(&this->actor.world.pos, &sp40); Math_Vec3f_Copy(&this->actor.prevPos, &sp40); - switch (arg2->result) { + switch (scheduleOutput->result) { case 2: this->actor.home.rot.y = this->actor.world.rot.y; this->actor.home.rot.y += 0x8000; @@ -678,20 +679,20 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; this->actor.targetMode = 0; this->unk_3D0 = 0; this->actor.flags |= ACTOR_FLAG_1; - switch (arg2->result) { + switch (scheduleOutput->result) { case 5: case 6: case 7: case 8: case 9: - ret = func_80BF1DF4(this, play, arg2); + ret = func_80BF1DF4(this, play, scheduleOutput); break; case 10: @@ -699,16 +700,16 @@ s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleResult* arg2) { case 12: case 13: case 14: - ret = func_80BF1FA8(this, play, arg2); + ret = func_80BF1FA8(this, play, scheduleOutput); break; case 2: case 4: - ret = func_80BF219C(this, play, arg2); + ret = func_80BF219C(this, play, scheduleOutput); break; case 3: - ret = func_80BF1D78(this, play, arg2); + ret = func_80BF1D78(this, play, scheduleOutput); break; } return ret; @@ -873,7 +874,7 @@ void func_80BF2A50(EnIg* this, PlayState* play) { } void func_80BF2AF8(EnIg* this, PlayState* play) { - ScheduleResult sp20; + ScheduleOutput sp20; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 33497bdcd..f1f8aff6e 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -16,7 +16,64 @@ void EnIk_Destroy(Actor* thisx, PlayState* play); void EnIk_Update(Actor* thisx, PlayState* play); void EnIk_Draw(Actor* thisx, PlayState* play); -#if 0 +void EnIk_Thaw(EnIk* this, PlayState* play); +s32 EnIk_IsChangingAction(EnIk* this, PlayState* play); +s32 EnIk_ChooseAttack(EnIk* this); +void EnIk_CheckActions(EnIk* this, PlayState* play); +void EnIk_SetupIdle(EnIk* this); +void EnIk_Idle(EnIk* this, PlayState* play); +void EnIk_SetupWalk(EnIk* this); +void EnIk_WalkTowardsPlayer(EnIk* this, PlayState* play); +void EnIk_SetupRun(EnIk* this); +void EnIk_RunTowardsPlayer(EnIk* this, PlayState* play); +void EnIk_SetupVerticalAttack(EnIk* this); +void EnIk_VerticalAttack(EnIk* this, PlayState* play); +void EnIk_SetupTakeOutAxe(EnIk* this); +void EnIk_TakeOutAxe(EnIk* this, PlayState* play); +void EnIk_SetupHorizontalDoubleAttack(EnIk* this); +void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play); +void EnIk_SetupSingleHorizontalAttack(EnIk* this); +void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play); +void EnIk_SetupEndHorizontalAttack(EnIk* this); +void EnIk_EndHorizontalAttack(EnIk* this, PlayState* play); +void EnIk_SetupBlock(EnIk* this); +void EnIk_Block(EnIk* this, PlayState* play); +void EnIk_SetupReactToAttack(EnIk* this, s32 arg1); +void EnIk_ReactToAttack(EnIk* this, PlayState* play); +void EnIk_SetupDie(EnIk* this); +void EnIk_Die(EnIk* this, PlayState* play); +void EnIk_Frozen(EnIk* this, PlayState* play); +void EnIk_SetupCutscene(EnIk* this); +void EnIk_PlayCutscene(EnIk* this, PlayState* play); +void EnIk_UpdateDamage(EnIk* this, PlayState* play); +void EnIk_UpdateArmor(EnIk* this, PlayState* play); + +typedef struct { + /* 0x0 */ Gfx* unk00; + /* 0x4 */ s16 unk04; +} EnIkUnkStruct; // size = 0x8 + +EnIkUnkStruct sIronKnuckleArmorMarkings[] = { + { gIronKnuckleHelmetMarkingDL, 0x0000 }, + { gIronKnuckleFrontTorsoArmorMarkingDL, 0x0000 }, + { gIronKnuckleRearTorsoArmorMarkingDL, 0x7FFF }, + { gIronKnuckleRivetsMarking2DL, 0x4000 }, + { gIronKnuckleRivetsMarking1DL, 0xC000 }, + { NULL, 0x4000 }, + { NULL, 0xC000 }, +}; + +// sIronKnuckleArmorType[PARAM_VALUE][ARMOR_SECTIONS] +// ARMOR SECTIONS: +// 1 - Main armor +// 2 - Armor Accent (Side of armor and boot tips) +// 3 - Axe Color +static Gfx* sIronKnuckleArmorType[3][3] = { + { gIronKnuckleTanArmorMaterialDL, gIronKnuckleBronzeArmorMaterialDL, gIronKnuckleSilverArmorMaterialDL }, + { gIronKnuckleBlackArmorMaterialDL, gIronKnuckleBrownArmorMaterialDL, gIronKnuckleBrownArmorMaterialDL }, + { gIronKnuckleWhiteArmorMaterialDL, gIronKnuckleGoldArmorMaterialDL, gIronKnuckleGoldArmorMaterialDL }, +}; + const ActorInit En_Ik_InitVars = { ACTOR_EN_IK, ACTORCAT_ENEMY, @@ -29,219 +86,1014 @@ const ActorInit En_Ik_InitVars = { (ActorFunc)EnIk_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_8092C01C = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_METAL, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK2, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 25, 80, 0, { 0, 0, 0 } }, }; -// static ColliderTrisElementInit sTrisElementsInit[2] = { -static ColliderTrisElementInit D_8092C048[2] = { +static ColliderTrisElementInit sTrisElementsInit[2] = { { - { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK2, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { -10.0f, 14.0f, 2.0f }, { -10.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, }, { - { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK2, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, }, }; -// static ColliderTrisInit sTrisInit = { -static ColliderTrisInit D_8092C0C0 = { - { COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_TRIS, }, - ARRAY_COUNT(sTrisElementsInit), D_8092C048, // sTrisElementsInit, +static ColliderTrisInit sTrisInit = { + { + COLTYPE_METAL, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_TRIS, + }, + ARRAY_COUNT(sTrisElementsInit), + sTrisElementsInit, }; -// static ColliderQuadInit sQuadInit = { -static ColliderQuadInit D_8092C0D0 = { - { COLTYPE_NONE, AT_NONE | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_TYPE_2, COLSHAPE_QUAD, }, - { ELEMTYPE_UNK0, { 0x20000000, 0x04, 0x40 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, BUMP_NONE, OCELEM_NONE, }, +static ColliderQuadInit sQuadInit = { + { + COLTYPE_NONE, + AT_NONE | AT_TYPE_ENEMY, + AC_NONE, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_QUAD, + }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x04, 0x40 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, + BUMP_NONE, + OCELEM_NONE, + }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -// static DamageTable sDamageTable = { -static DamageTable D_8092C120 = { - /* Deku Nut */ DMG_ENTRY(0, 0xF), - /* Deku Stick */ DMG_ENTRY(0, 0xF), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(0, 0xF), - /* Normal arrow */ DMG_ENTRY(0, 0xF), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xF), - /* Goron punch */ DMG_ENTRY(2, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(3, 0x0), - /* Fire arrow */ DMG_ENTRY(0, 0xF), - /* Ice arrow */ DMG_ENTRY(0, 0xF), - /* Light arrow */ DMG_ENTRY(1, 0x4), - /* Goron spikes */ DMG_ENTRY(0, 0xF), - /* Deku spin */ DMG_ENTRY(0, 0xF), - /* Deku bubble */ DMG_ENTRY(0, 0xF), - /* Deku launch */ DMG_ENTRY(0, 0xF), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0xF), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(0, 0xF), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), +typedef enum { + /* 0x0 */ DMG_EFF_NONE, + /* 0x4 */ DMG_EFF_FIRE = 0x2, + /* 0x0 */ DMG_EFF_ICE, + /* 0x4 */ DMG_EFF_LIGHT_SPARKS, + /* 0xF */ DMG_EFF_IMMUNE = 0xF, + +} EnIkDmgEff; + +static DamageTable sDamageTableArmor = { + /* Deku Nut */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Deku Stick */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Horse trample */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Explosives */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Zora boomerang */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Normal arrow */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Hookshot */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Goron punch */ DMG_ENTRY(2, DMG_EFF_NONE), + /* Sword */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Goron pound */ DMG_ENTRY(3, DMG_EFF_NONE), + /* Fire arrow */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Ice arrow */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Light arrow */ DMG_ENTRY(1, DMG_EFF_LIGHT_SPARKS), + /* Goron spikes */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Deku spin */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Deku bubble */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Deku launch */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Zora barrier */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Normal shield */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Light ray */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Thrown object */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Zora punch */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Spin attack */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Sword beam */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Unblockable */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, DMG_EFF_NONE), }; -// static DamageTable sDamageTable = { -static DamageTable D_8092C140 = { - /* Deku Nut */ DMG_ENTRY(0, 0x0), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xF), - /* Goron punch */ DMG_ENTRY(2, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(3, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(0, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), +static DamageTable sDamageTableNoArmor = { + /* Deku Nut */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Deku Stick */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Horse trample */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Explosives */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, DMG_EFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Hookshot */ DMG_ENTRY(0, DMG_EFF_IMMUNE), + /* Goron punch */ DMG_ENTRY(2, DMG_EFF_NONE), + /* Sword */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Goron pound */ DMG_ENTRY(3, DMG_EFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, DMG_EFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, DMG_EFF_ICE), + /* Light arrow */ DMG_ENTRY(2, DMG_EFF_LIGHT_SPARKS), + /* Goron spikes */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Deku spin */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Deku launch */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Zora barrier */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Normal shield */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Light ray */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Thrown object */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Zora punch */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Spin attack */ DMG_ENTRY(1, DMG_EFF_NONE), + /* Sword beam */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Unblockable */ DMG_ENTRY(0, DMG_EFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DMG_EFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, DMG_EFF_NONE), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_8092C160 = { 18, 25, 80, MASS_HEAVY }; +static CollisionCheckInfoInit sColChkInfoInit = { 18, 25, 80, MASS_HEAVY }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8092C168[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2916, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 12, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -#endif +static EffectBlureInit2 sBlureInit = { + 0, 8, 0, { 255, 255, 150, 200 }, { 255, 255, 255, 64 }, { 255, 255, 150, 0 }, { 255, 255, 255, 0 }, 8, + 0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, +}; -extern ColliderCylinderInit D_8092C01C; -extern ColliderTrisElementInit D_8092C048[2]; -extern ColliderTrisInit D_8092C0C0; -extern ColliderQuadInit D_8092C0D0; -extern DamageTable D_8092C120; -extern DamageTable D_8092C140; -extern CollisionCheckInfoInit D_8092C160; -extern InitChainEntry D_8092C168[]; +void EnIk_Init(Actor* thisx, PlayState* play) { + static s32 sDisplayListDesegmented = false; + s32 i; + EnIk* this = THIS; -extern UNK_TYPE D_06000CE8; -extern UNK_TYPE D_060015F8; -extern UNK_TYPE D_06001ABC; -extern UNK_TYPE D_06002484; -extern UNK_TYPE D_0600391C; -extern UNK_TYPE D_06004A04; -extern UNK_TYPE D_06005254; -extern UNK_TYPE D_060057F4; -extern UNK_TYPE D_06006294; + Actor_ProcessInitChain(&this->actor, sInitChain); + SkelAnime_InitFlex(play, &this->skelAnime, &gIronKnuckleSkel, &gIronKnuckleWalkAnim, this->jointTable, + this->morphTable, IRON_KNUCKLE_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->shieldColliderItems); + Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableArmor, &sColChkInfoInit); + this->actor.params = IK_GET_ARMOR_TYPE(&this->actor); + this->actor.params--; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/EnIk_Init.s") + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &sBlureInit); + if (!sDisplayListDesegmented) { + for (i = 0; i < ARRAY_COUNT(sIronKnuckleArmorType); i++) { + sIronKnuckleArmorType[i][0] = Lib_SegmentedToVirtual(sIronKnuckleArmorType[i][0]); + sIronKnuckleArmorType[i][1] = Lib_SegmentedToVirtual(sIronKnuckleArmorType[i][1]); + sIronKnuckleArmorType[i][2] = Lib_SegmentedToVirtual(sIronKnuckleArmorType[i][2]); + } + sDisplayListDesegmented = true; + } + EnIk_SetupIdle(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/EnIk_Destroy.s") +void EnIk_Destroy(Actor* thisx, PlayState* play) { + EnIk* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929AF8.s") + Collider_DestroyTris(play, &this->colliderTris); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyQuad(play, &this->colliderQuad); + Effect_Destroy(play, this->effectIndex); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929B6C.s") +void EnIk_Freeze(EnIk* this) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->drawDmgEffScale = 0.65f; + this->drawDmgEffFrozenSteamScale = 97.5f * 0.01f; + this->drawDmgEffAlpha = 1.0f; + this->timer = 80; + this->actor.flags &= ~ACTOR_FLAG_400; + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 80); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929BEC.s") +void EnIk_Thaw(EnIk* this, PlayState* play) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + this->drawDmgEffAlpha = 0.0f; + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.3f, 0.2f); + this->actor.flags |= ACTOR_FLAG_400; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929C80.s") +void EnIk_HitArmor(EnIk* this, PlayState* play) { + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.65f; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->colliderCylinder.info.bumper.hitPos.x, + this->colliderCylinder.info.bumper.hitPos.y, this->colliderCylinder.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929D04.s") +s32 EnIk_IsChangingAction(EnIk* this, PlayState* play) { + if ((this->drawArmorFlags) && (this->actionFunc != EnIk_Block) && + func_800BE184(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { + EnIk_SetupBlock(this); + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929E2C.s") +s32 EnIk_ChooseAttack(EnIk* this) { + s32 absYawDiff; + s32 detectionThreshold; // angle threshold an Iron Knuckle will use to trigger a horizontal attack -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929E88.s") + if ((this->actor.xzDistToPlayer < 100.0f) && (fabsf(this->actor.playerHeightRel) < 150.0f)) { -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929F20.s") + detectionThreshold = (this->drawArmorFlags == 0) ? 0xAAA : 0x3FFC; + absYawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_80929FC8.s") + if (detectionThreshold >= absYawDiff) { + if (Rand_ZeroOne() < 0.5f) { + EnIk_SetupVerticalAttack(this); + return true; + } + EnIk_SetupHorizontalDoubleAttack(this); + return true; + } else if ((this->drawArmorFlags) || ((absYawDiff > 0x4000) && (Rand_ZeroOne() < 0.1f))) { + EnIk_SetupSingleHorizontalAttack(this); + return true; + } + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A020.s") +void EnIk_CheckActions(EnIk* this, PlayState* play) { + if (!EnIk_IsChangingAction(this, play) && !EnIk_ChooseAttack(this)) { + if (this->drawArmorFlags) { + EnIk_SetupRun(this); + } else { + EnIk_SetupWalk(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A124.s") +void EnIk_SetupIdle(EnIk* this) { + f32 frameCount = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A188.s") + if (this->drawArmorFlags) { + this->timer = 10; + } else { + this->timer = 0; + } + Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, frameCount, frameCount, + ANIMMODE_ONCE, this->timer); + this->actionFunc = EnIk_Idle; + this->actor.speedXZ = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A28C.s") +void EnIk_Idle(EnIk* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + SkelAnime_Update(&this->skelAnime); + if (this->timer == 0) { + EnIk_CheckActions(this, play); + } + } else if (this->colliderCylinder.base.acFlags & AC_HIT) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); + func_801A2E54(NA_BGM_MINI_BOSS); + this->actor.hintId = 0x35; + this->colliderCylinder.base.acFlags &= ~AC_HIT; + this->invincibilityFrames = 12; + EnIk_SetupWalk(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A33C.s") +void EnIk_SetupWalk(EnIk* this) { + Animation_MorphToLoop(&this->skelAnime, &gIronKnuckleWalkAnim, -4.0f); + this->actor.speedXZ = 0.9f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = EnIk_WalkTowardsPlayer; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A570.s") +void EnIk_WalkTowardsPlayer(EnIk* this, PlayState* play) { + s16 yawDiff; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A5BC.s") + SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + } + yawDiff = this->actor.wallYaw - this->actor.shape.rot.y; + if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(yawDiff) >= 0x4000)) { + yawDiff = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; + Math_ScaledStepToS(&this->actor.shape.rot.y, yawDiff, 0x320); + } else { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x320); + } + this->actor.world.rot.y = this->actor.shape.rot.y; + if (!EnIk_IsChangingAction(this, play)) { + EnIk_ChooseAttack(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A680.s") +void EnIk_SetupRun(EnIk* this) { + Animation_MorphToLoop(&this->skelAnime, &gIronKnuckleRunAnim, -4.0f); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TWINROBA_SHOOT_VOICE); + this->actor.speedXZ = 2.5f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = EnIk_RunTowardsPlayer; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A754.s") +void EnIk_RunTowardsPlayer(EnIk* this, PlayState* play) { + s16 yawDiff; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A8D8.s") + SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 9.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + } + yawDiff = this->actor.wallYaw - this->actor.shape.rot.y; + if ((this->actor.bgCheckFlags & 8) && (ABS_ALT(yawDiff) >= 0x4000)) { + yawDiff = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; + Math_ScaledStepToS(&this->actor.shape.rot.y, yawDiff, 0x4B0); + } else { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x4B0); + } + this->actor.world.rot.y = this->actor.shape.rot.y; + if (!EnIk_IsChangingAction(this, play)) { + EnIk_ChooseAttack(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092A994.s") +void EnIk_SetupVerticalAttack(EnIk* this) { + s32 pad; + f32 playbackSpeed; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AA6C.s") + this->actor.speedXZ = 0.0f; + if (this->drawArmorFlags) { + playbackSpeed = 1.5f; + } else { + playbackSpeed = 1.2f; + } + Animation_Change(&this->skelAnime, &gIronKnuckleVerticalAttackAnim, playbackSpeed, 0.0f, + Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), 3, -4.0f); + this->timer = 0; + this->blurEffectSpawnLock = -1; + this->actionFunc = EnIk_VerticalAttack; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AB14.s") +void EnIk_VerticalAttack(EnIk* this, PlayState* play) { + Vec3f particlePos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AB50.s") + this->timer++; + if (!(this->skelAnime.curFrame < 7.0f) || !EnIk_IsChangingAction(this, play)) { + if (Animation_OnFrame(&this->skelAnime, 15.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092ABD8.s") + } else if (Animation_OnFrame(&this->skelAnime, 21.0f)) { + particlePos.x = (Math_SinS((this->actor.shape.rot.y + 0x6A4)) * 70.0f) + this->actor.world.pos.x; + particlePos.z = (Math_CosS((this->actor.shape.rot.y + 0x6A4)) * 70.0f) + this->actor.world.pos.z; + particlePos.y = this->actor.world.pos.y; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); + Camera_AddQuake(GET_ACTIVE_CAM(play), 2, 25, 5); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + CollisionCheck_SpawnShieldParticles(play, &particlePos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AC4C.s") + if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { + this->colliderQuad.base.atFlags |= AT_ON; + if (this->drawArmorFlags) { + this->actor.speedXZ = sin_rad((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; + } + } else { + this->colliderQuad.base.atFlags &= ~AT_ON; + this->actor.speedXZ = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092ACFC.s") + if ((this->drawArmorFlags) && (this->skelAnime.curFrame < 13.0f)) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x5DC); + this->actor.world.rot.y = this->actor.shape.rot.y; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092ADB4.s") + if (SkelAnime_Update(&this->skelAnime)) { + EnIk_SetupTakeOutAxe(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AE14.s") +void EnIk_SetupTakeOutAxe(EnIk* this) { + Animation_PlayOnce(&this->skelAnime, &gIronKnuckleEndVerticalAttackAnim); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_PULLOUT); + this->actionFunc = EnIk_TakeOutAxe; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AFB4.s") +void EnIk_TakeOutAxe(EnIk* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime)) { + if (this->skelAnime.animation == &gIronKnuckleRecoverVerticalAttackAnim) { + EnIk_CheckActions(this, play); + } else { + Animation_Change( + &this->skelAnime, &gIronKnuckleRecoverVerticalAttackAnim, (this->drawArmorFlags) ? 1.5f : 1.0f, 0.0f, + Animation_GetLastFrame(&gIronKnuckleRecoverVerticalAttackAnim.common), ANIMMODE_ONCE_INTERP, 0.0f); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092AFD4.s") +void EnIk_SetupHorizontalDoubleAttack(EnIk* this) { + this->actor.speedXZ = 0.0f; + Animation_Change(&this->skelAnime, &gIronKnuckleHorizontalAttackAnim, (this->drawArmorFlags) ? 1.3f : 1.0f, 0.0f, + Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim.common), ANIMMODE_ONCE_INTERP, + (this->drawArmorFlags) ? 4.0f : 10.0f); + this->timer = 0; + this->blurEffectSpawnLock = -1; + this->actionFunc = EnIk_HorizontalDoubleAttack; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B03C.s") +void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { + f32 phi_f2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B098.s") + this->timer++; + if ((Animation_OnFrame(&this->skelAnime, 1.0f)) || (Animation_OnFrame(&this->skelAnime, 13.0f))) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + } + if (((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 9.0f)) || + ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f))) { + if (this->drawArmorFlags) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x5DC); + this->actor.world.rot.y = this->actor.shape.rot.y; + if (this->skelAnime.curFrame > 12.0f) { + phi_f2 = this->skelAnime.curFrame - 12.0f; + } else { + phi_f2 = this->skelAnime.curFrame - 1.0f; + } + this->actor.speedXZ = sin_rad((M_PI / 8) * phi_f2) * 4.5f; + } + this->colliderQuad.base.atFlags |= AT_ON; + } else { + this->colliderQuad.base.atFlags &= ~AT_ON; + this->actor.speedXZ = 0.0f; + } + if (SkelAnime_Update(&this->skelAnime)) { + EnIk_SetupEndHorizontalAttack(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B1B4.s") +void EnIk_SetupSingleHorizontalAttack(EnIk* this) { + f32 playSpeed; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B46C.s") + this->actor.speedXZ = 0.0f; + if (this->drawArmorFlags) { + this->actor.world.rot.z = 0x1000; + playSpeed = 1.3f; + } else { + this->actor.world.rot.z = 0xB00; + playSpeed = 1.0f; + } + Animation_Change(&this->skelAnime, &gIronKnuckleHorizontalAttackAnim, playSpeed, 12.0f, + Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim.common), ANIMMODE_ONCE_INTERP, 5.0f); + this->timer = 0; + this->blurEffectSpawnLock = -1; + this->actionFunc = EnIk_SingleHorizontalAttack; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/EnIk_Update.s") +void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play) { + this->timer++; + if (Animation_OnFrame(&this->skelAnime, 13.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); + } + if ((this->skelAnime.curFrame > 12.0f) && (this->skelAnime.curFrame < 20.0f)) { + this->colliderQuad.base.atFlags |= AT_ON; + } else { + this->colliderQuad.base.atFlags &= ~AT_ON; + } + this->actor.shape.rot.y += this->actor.world.rot.z; + this->actor.world.rot.y = this->actor.shape.rot.y; + if (SkelAnime_Update(&this->skelAnime)) { + EnIk_SetupEndHorizontalAttack(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B900.s") +void EnIk_SetupEndHorizontalAttack(EnIk* this) { + Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, (this->drawArmorFlags) ? 2.0f : 1.0f, 0.0f, + Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim), ANIMMODE_ONCE_INTERP, -4.0f); + this->actionFunc = EnIk_EndHorizontalAttack; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092B93C.s") +void EnIk_EndHorizontalAttack(EnIk* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime)) { + EnIk_CheckActions(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/func_8092BC6C.s") +void EnIk_SetupBlock(EnIk* this) { + this->actor.speedXZ = 0.0f; + Animation_Change(&this->skelAnime, &gIronKnuckleBlockAnim, 2.0f, 0.0f, + Animation_GetLastFrame(&gIronKnuckleBlockAnim), ANIMMODE_ONCE, -2.0f); + this->timer = 20; + this->actionFunc = EnIk_Block; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ik/EnIk_Draw.s") +void EnIk_Block(EnIk* this, PlayState* play) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); + if (SkelAnime_Update(&this->skelAnime)) { + this->timer--; + if (this->timer == 0) { + EnIk_CheckActions(this, play); + } + } +} + +void EnIk_SetupReactToAttack(EnIk* this, s32 arg1) { + s16 temp_v0; + + if (arg1) { + func_800BE504(&this->actor, &this->colliderCylinder); + } + this->actor.speedXZ = 6.0f; + temp_v0 = (this->actor.world.rot.y - this->actor.shape.rot.y) + 0x8000; + if (ABS_ALT(temp_v0) <= 0x4000) { + Animation_MorphToPlayOnce(&this->skelAnime, &gIronKnuckleFrontHitAnim, -4.0f); + } else { + Animation_MorphToPlayOnce(&this->skelAnime, &gIronKnuckleBackHitAnim, -4.0f); + } + this->actionFunc = EnIk_ReactToAttack; +} + +void EnIk_ReactToAttack(EnIk* this, PlayState* play) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); + if (this->subCamId != SUB_CAM_ID_DONE) { + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); + } + if (SkelAnime_Update(&this->skelAnime)) { + if (this->subCamId != SUB_CAM_ID_DONE) { + ActorCutscene_Stop(this->actor.cutscene); + this->subCamId = SUB_CAM_ID_DONE; + EnIk_SetupIdle(this); + } else { + EnIk_CheckActions(this, play); + } + } else { + this->actor.colorFilterTimer = 12; + this->invincibilityFrames = 12; + } +} + +void EnIk_SetupDie(EnIk* this) { + this->actor.speedXZ = 0.0f; + Animation_MorphToPlayOnce(&this->skelAnime, &gIronKnuckleDeathAnim, -4.0f); + this->timer = 24; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DEAD); + this->actionFunc = EnIk_Die; +} + +void EnIk_Die(EnIk* this, PlayState* play) { + static Vec3f sEffectVelAndAccel = { 0.0f, 0.5f, 0.0f }; + s32 i; + Vec3f effectPos; + + this->invincibilityFrames = 12; + if (SkelAnime_Update(&this->skelAnime)) { + if (this->timer == 24) { + SoundSource_PlaySfxEachFrameAtFixedWorldPos(play, &this->actor.world.pos, 35, + NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + } + + if (this->timer != 0) { + this->timer--; + for (i = 6 - (this->timer >> 2); i >= 0; i--) { + effectPos.x = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.x; + effectPos.z = randPlusMinusPoint5Scaled(80.0f) + this->actor.world.pos.z; + effectPos.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + func_800B3030(play, &effectPos, &sEffectVelAndAccel, &sEffectVelAndAccel, 100, 0, 2); + } + if (this->timer == 0) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); + ActorCutscene_Stop(this->actor.cutscene); + Actor_MarkForDeath(&this->actor); + } + } + } else if (Animation_OnFrame(&this->skelAnime, 23.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_WALK); + } +} + +void EnIk_SetupFrozen(EnIk* this) { + this->invincibilityFrames = 0; + this->actionFunc = EnIk_Frozen; + this->actor.speedXZ = 0.0f; +} + +void EnIk_Frozen(EnIk* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + EnIk_Thaw(this, play); + if (this->actor.colChkInfo.health == 0) { + EnIk_SetupCutscene(this); + } else { + EnIk_CheckActions(this, play); + } + } +} + +void EnIk_SetupCutscene(EnIk* this) { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + this->actor.speedXZ = 0.0f; + if (this->actor.colChkInfo.health != 0) { + func_800BE504(&this->actor, &this->colliderCylinder); + } + this->actionFunc = EnIk_PlayCutscene; +} + +void EnIk_PlayCutscene(EnIk* this, PlayState* play) { + Vec3f subCamEye; + + this->invincibilityFrames = 12; + if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (this->actor.cutscene != -1) { + ActorCutscene_StartAndSetFlag(this->actor.cutscene, &this->actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + subCamEye.x = (Math_SinS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.x; + subCamEye.y = this->actor.focus.pos.y + 20.0f; + subCamEye.z = (Math_CosS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.z; + Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + } + if (this->actor.colChkInfo.health != 0) { + EnIk_SetupReactToAttack(this, false); + } else { + EnIk_SetupDie(this); + } + } else { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } +} + +void EnIk_UpdateDamage(EnIk* this, PlayState* play) { + s32 pad; + + if (this->actionFunc == EnIk_Idle) { + return; + } + if (this->colliderTris.base.acFlags & AC_BOUNCED) { + f32 frame = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; + + if (this->skelAnime.curFrame < frame) { + this->skelAnime.curFrame = frame; + } + this->colliderTris.base.acFlags &= ~AC_BOUNCED; + this->colliderCylinder.base.acFlags &= ~AC_HIT; + } else if (this->colliderCylinder.base.acFlags & AC_HIT) { + s32 isArmorBroken = false; + + Actor_SetDropFlag(&this->actor, &this->colliderCylinder.info); + this->colliderCylinder.base.acFlags &= ~AC_HIT; + if ((this->actor.colChkInfo.damageEffect != DMG_EFF_IMMUNE) && + ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || + (!(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 12); + this->invincibilityFrames = 12; + EnIk_Thaw(this, play); + this->colliderQuad.base.atFlags &= ~AT_ON; + if (Actor_ApplyDamage(&this->actor) == 0) { + if (this->drawArmorFlags == 0) { + this->actor.colChkInfo.health = 9; + isArmorBroken = true; + } else { + Enemy_StartFinishingBlow(play, &this->actor); + func_801A2ED8(); + } + } + if (isArmorBroken == true) { + this->drawArmorFlags = 1; + this->colliderCylinder.base.colType = 3; + this->actor.colChkInfo.damageTable = &sDamageTableNoArmor; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); + EnIk_SetupCutscene(this); + } else if (this->drawArmorFlags) { + if (this->actor.colChkInfo.damageEffect == DMG_EFF_ICE) { + EnIk_Freeze(this); + EnIk_SetupFrozen(this); + if (this->actor.colChkInfo.health == 0) { + this->timer = 3; + this->invincibilityFrames = 12; + } + } else { + if (this->actor.colChkInfo.damageEffect == DMG_EFF_FIRE) { + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.65f; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } else if (this->actor.colChkInfo.damageEffect == DMG_EFF_LIGHT_SPARKS) { + EnIk_HitArmor(this, play); + } + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); + if (this->actor.colChkInfo.health != 0) { + EnIk_SetupReactToAttack(this, true); + } else { + EnIk_SetupCutscene(this); + } + } + } else { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); + if (this->actor.colChkInfo.damageEffect == 4) { + EnIk_HitArmor(this, play); + } + } + } + } +} + +void EnIk_UpdateArmor(EnIk* this, PlayState* play) { + s32 pad; + s32 i; + IronKnuckleEffect* ikEffect; + Vec3f effectPos; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + ikEffect = &this->effects[i]; + + if (ikEffect->enabled) { + Math_Vec3f_Sum(&ikEffect->pos, &ikEffect->vel, &ikEffect->pos); + ikEffect->vel.y += -1.5f; + if (ikEffect->pos.y < this->actor.floorHeight) { + ikEffect->enabled = false; + ikEffect->pos.y = this->actor.floorHeight; + + for (i = 0; i < 4; i++) { + effectPos.x = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.x; + effectPos.y = Rand_ZeroFloat(20.0f) + ikEffect->pos.y; + effectPos.z = randPlusMinusPoint5Scaled(20.0f) + ikEffect->pos.z; + func_800B3030(play, &effectPos, &gZeroVec3f, &gZeroVec3f, 40, 7, 2); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &ikEffect->pos, 11, NA_SE_EN_EXTINCT); + } + } + } +} + +void EnIk_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnIk* this = THIS; + + if (this->actionFunc != EnIk_PlayCutscene) { + EnIk_UpdateDamage(this, play); + } else { + this->colliderTris.base.acFlags &= ~AC_BOUNCED; + this->colliderCylinder.base.acFlags &= ~AC_HIT; + } + this->actionFunc(this, play); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); + this->actor.focus.rot.y = this->actor.shape.rot.y; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + if (this->invincibilityFrames == 0) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + } else { + this->invincibilityFrames--; + } + if (this->colliderQuad.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); + } + if (this->actionFunc == EnIk_Block) { + f32 cos; + f32 sin; + Vec3f sp5C; + Vec3f sp50; + Vec3f sp44; + + cos = Math_CosS(this->actor.shape.rot.y); + sin = Math_SinS(this->actor.shape.rot.y); + + sp44.x = (this->actor.world.pos.x - (30.0f * cos)) + (20.0f * sin); + sp44.y = this->actor.world.pos.y; + sp44.z = this->actor.world.pos.z + (30.0f * sin) + (20.0f * cos); + + sp50.x = this->actor.world.pos.x + (30.0f * cos) + (20.0f * sin); + sp50.y = this->actor.world.pos.y + 80.0f; + sp50.z = (this->actor.world.pos.z - (30.0f * sin)) + (20.0f * cos); + + sp5C.x = sp44.x; + sp5C.y = sp50.y; + sp5C.z = sp44.z; + + Collider_SetTrisVertices(&this->colliderTris, 0, &sp44, &sp50, &sp5C); + sp5C.x = sp50.x; + sp5C.y = sp44.y; + sp5C.z = sp50.z; + Collider_SetTrisVertices(&this->colliderTris, 1, &sp44, &sp5C, &sp50); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); + } + if (this->drawDmgEffAlpha > 0.0f) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); + this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.325f; + if ((this->drawDmgEffAlpha + 1.0f) * 0.325f > 0.65f) { + this->drawDmgEffScale = 0.65f; + } else { + this->drawDmgEffScale = this->drawDmgEffScale; + } + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.65f, 0.01625f)) { + func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } + } + EnIk_UpdateArmor(this, play); +} + +s8 D_8092C1A8[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 5, 4, 6, 1, 2, -1, -1, 0, 0, +}; + +s32 EnIk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnIk* this = THIS; + + if (this->drawArmorFlags) { + if (D_8092C1A8[limbIndex] > 0) { + *dList = NULL; + } + } + return false; +} + +void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f D_8092C1C8 = { 2000.0f, -200.0f, -5200.0f }; + static Vec3f D_8092C1D4 = { 300.0f, -200.0f, 0.0f }; + static s8 limbPosIndex[] = { + -1, -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, -1, 6, -1, -1, 7, + -1, -1, 8, -1, 9, 10, -1, 11, -1, 12, -1, -1, -1, -1, 0, 0, + }; + + EnIk* this = THIS; + s32 index = D_8092C1A8[limbIndex]; + Gfx* xlu; + IronKnuckleEffect* ikEffect; + s16 sp76; + Vec3f vtxC; + Vec3f vtxD; + Vec3f vtxB; + Vec3f vtxA; + MtxF* mf; + + if (this->drawArmorFlags == 0x1) { + if (index > 0) { + ikEffect = &this->effects[index]; + mf = Matrix_GetCurrent(); + ikEffect->pos.x = mf->mf[3][0]; + ikEffect->pos.y = mf->mf[3][1]; + ikEffect->pos.z = mf->mf[3][2]; + Matrix_MtxFToYXZRot(mf, &ikEffect->rot, false); + ikEffect->enabled = true; + sp76 = sIronKnuckleArmorMarkings[index].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); + ikEffect->vel.x = Math_SinS(sp76) * 5.0f; + ikEffect->vel.y = 6.0f; + ikEffect->vel.z = Math_CosS(sp76) * 5.0f; + ikEffect->dList = *dList; + } + if (limbIndex == IRON_KNUCKLE_LIMB_WAIST) { + this->drawArmorFlags |= 0x2; + } + } + + if (limbIndex == IRON_KNUCKLE_LIMB_ROOT) { + Matrix_MultZero(&this->actor.focus.pos); + this->colliderCylinder.dim.pos.x = this->actor.focus.pos.x; + this->colliderCylinder.dim.pos.y = this->actor.world.pos.y; + this->colliderCylinder.dim.pos.z = this->actor.focus.pos.z; + } + + if ((limbIndex == IRON_KNUCKLE_LIMB_AXE) && (this->blurEffectSpawnLock != this->timer) && + ((this->actionFunc == EnIk_VerticalAttack) || (this->actionFunc == EnIk_HorizontalDoubleAttack) || + (this->actionFunc == EnIk_SingleHorizontalAttack))) { + Math_Vec3f_Copy(&vtxC, &this->colliderQuad.dim.quad[0]); + Math_Vec3f_Copy(&vtxD, &this->colliderQuad.dim.quad[1]); + Matrix_MultVec3f(&D_8092C1C8, &vtxB); + Matrix_MultVec3f(&D_8092C1D4, &vtxA); + Collider_SetQuadVertices(&this->colliderQuad, &vtxA, &vtxB, &vtxC, &vtxD); + if (this->colliderQuad.base.atFlags & AT_ON) { + EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vtxB, &vtxA); + } + this->blurEffectSpawnLock = this->timer; + } + + if (limbPosIndex[limbIndex] != -1) { + Matrix_MultZero(&this->limbPos[limbPosIndex[limbIndex]]); + } + + if ((index == 0) || + ((index != -1) && (this->drawArmorFlags == 0) && (sIronKnuckleArmorMarkings[index].unk00 != 0))) { + OPEN_DISPS(play->state.gfxCtx); + + xlu = POLY_XLU_DISP; + + gSPMatrix(&xlu[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&xlu[1], sIronKnuckleArmorMarkings[index].unk00); + POLY_XLU_DISP = &xlu[2]; + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void EnIk_UpdateArmorDraw(EnIk* this, PlayState* play) { + Gfx* gfxOpa; + Gfx* gfxXlu; + s32 sp54; + IronKnuckleEffect* ikEffect; + s32 i; + + if (this->drawArmorFlags == (0x1 | 0x2)) { + sp54 = 0; + + OPEN_DISPS(play->state.gfxCtx); + gfxOpa = POLY_OPA_DISP; + gfxXlu = POLY_XLU_DISP; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + ikEffect = &this->effects[i]; + if (ikEffect->enabled) { + Matrix_SetTranslateRotateYXZ(ikEffect->pos.x, ikEffect->pos.y, ikEffect->pos.z, &ikEffect->rot); + Matrix_Scale(0.012f, 0.012f, 0.012f, MTXMODE_APPLY); + + gSPMatrix(gfxOpa++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxOpa++, ikEffect->dList); + + if (sIronKnuckleArmorMarkings[i].unk00 != NULL) { + gSPMatrix(gfxXlu++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxXlu++, sIronKnuckleArmorMarkings[i].unk00); + } + } else { + sp54++; + } + } + + if (sp54 == ARRAY_COUNT(this->effects)) { + this->drawArmorFlags = (0x1 | 0x4); + } + + POLY_XLU_DISP = gfxXlu; + POLY_OPA_DISP = gfxOpa; + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void EnIk_Draw(Actor* thisx, PlayState* play) { + static Vec3f D_8092C200 = { 0.53f, 0.53f, 0.53f }; + EnIk* this = THIS; + Gfx* gfx; + Gfx** gfxArmorType; + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_800B8050(&this->actor, play, 0); + func_800B8118(&this->actor, play, 0); + gfx = POLY_XLU_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + POLY_XLU_DISP = &gfx[1]; + gfx = POLY_OPA_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gfxArmorType = sIronKnuckleArmorType[this->actor.params]; + gSPSegment(&gfx[1], 0x08, gfxArmorType[0]); + gSPSegment(&gfx[2], 0x09, gfxArmorType[1]); + gSPSegment(&gfx[3], 0x0A, gfxArmorType[2]); + POLY_OPA_DISP = &gfx[4]; + + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnIk_OverrideLimbDraw, EnIk_PostLimbDraw, &this->actor); + EnIk_UpdateArmorDraw(this, play); + if (this->actor.colorFilterTimer != 0) { + func_800AE5A0(play); + } + func_800BC620(&this->actor.focus.pos, &D_8092C200, 255, play); + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 39dfff7b9..a02c4845e 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -2,16 +2,50 @@ #define Z_EN_IK_H #include "global.h" +#include "objects/object_ik/object_ik.h" struct EnIk; typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); +#define IK_GET_ARMOR_TYPE(thisx) ((thisx)->params & 0xFF) + +typedef enum { + /* 1 */ IK_TYPE_SILVER = 1, + /* 2 */ IK_TYPE_BLACK, + /* 3 */ IK_TYPE_WHITE +} EnIkType; + +typedef struct { + /* 0x00 */ Gfx* dList; + /* 0x04 */ Vec3f pos; + /* 0x10 */ Vec3f vel; + /* 0x1C */ Vec3s rot; + /* 0x24 */ s32 enabled; +} IronKnuckleEffect; // size = 0x28 + typedef struct EnIk { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x1AC]; - /* 0x2F0 */ EnIkActionFunc actionFunc; - /* 0x2F4 */ char unk_2F4[0x374]; + /* 0x0000 */ Actor actor; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[IRON_KNUCKLE_LIMB_MAX]; + /* 0x023C */ Vec3s morphTable[IRON_KNUCKLE_LIMB_MAX]; + /* 0x02F0 */ EnIkActionFunc actionFunc; + /* 0x02F4 */ u8 drawArmorFlags; // Value is 0 when Iron knuckle has armor, then changes to 5 for when armor is lost + /* 0x02F5 */ u8 drawDmgEffType; + /* 0x02F6 */ s16 timer; + /* 0x02F8 */ s16 blurEffectSpawnLock; + /* 0x02FA */ s16 subCamId; + /* 0x02FC */ s16 invincibilityFrames; + /* 0x0300 */ s32 effectIndex; + /* 0x0304 */ f32 drawDmgEffAlpha; + /* 0x0308 */ f32 drawDmgEffScale; + /* 0x030C */ f32 drawDmgEffFrozenSteamScale; + /* 0x0310 */ Vec3f limbPos[13]; + /* 0x03AC */ ColliderCylinder colliderCylinder; + /* 0x03F8 */ ColliderQuad colliderQuad; + /* 0x0478 */ ColliderTris colliderTris; + /* 0x0498 */ ColliderTrisElement shieldColliderItems[2]; + /* 0x0550 */ IronKnuckleEffect effects[7]; } EnIk; // size = 0x668 extern const ActorInit En_Ik_InitVars; 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 fe9beb23a..e7d37de26 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -820,8 +820,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); play->nextEntranceIndex = 0xCE50; - play->unk_1887F = 5; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_05; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[57] |= 1; break; case 0x3478: @@ -1067,8 +1067,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); play->nextEntranceIndex = 0xCE50; - play->unk_1887F = 5; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_05; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[57] |= 1; break; case 0x349D: @@ -1181,12 +1181,12 @@ s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { s32 ret = false; switch (Message_GetState(&play->msgCtx)) { - case 2: + case TEXT_STATE_CLOSING: func_808F4054(play, this, arg2, this->actor.textId); ret = true; break; - case 4: - case 5: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: if (Message_ShouldAdvance(play) && func_808F4414(play, this, arg2)) { func_801477B4(play); ret = true; @@ -1473,23 +1473,22 @@ void EnIn_Update(Actor* thisx, PlayState* play) { void func_808F6334(EnIn* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 newUnk4C8; + s32 talkState = Message_GetState(&play->msgCtx); - newUnk4C8 = Message_GetState(&play->msgCtx); this->unk4C4 += this->unk4C0 != 0.0f ? 40.0f : -40.0f; this->unk4C4 = CLAMP(this->unk4C4, 0.0f, 80.0f); Matrix_Translate(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY); - if (&this->actor == player->targetActor && - !(play->msgCtx.currentTextId >= 0xFF && play->msgCtx.currentTextId <= 0x200) && newUnk4C8 == 3 && - this->unk4C8 == 3) { + if ((&this->actor == player->targetActor) && + !((play->msgCtx.currentTextId >= 0xFF) && (play->msgCtx.currentTextId <= 0x200)) && + (talkState == TEXT_STATE_3) && (this->prevTalkState == TEXT_STATE_3)) { if (!(play->state.frames & 1)) { this->unk4C0 = this->unk4C0 != 0.0f ? 0.0f : 1.0f; } } else { this->unk4C0 = 0.0f; } - this->unk4C8 = newUnk4C8; + this->prevTalkState = talkState; } s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 6ffbfdf8d..6c6a2f3dd 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -59,7 +59,7 @@ typedef struct EnIn { /* 0x4B4 */ Vec3f unk4B4; /* 0x4C0 */ f32 unk4C0; /* 0x4C0 */ f32 unk4C4; - /* 0x4C0 */ s32 unk4C8; + /* 0x4C0 */ s32 prevTalkState; } EnIn; // size = 0x4CC extern const ActorInit En_In_InitVars; diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 3ffee6649..0ea6d71dd 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -255,29 +255,28 @@ static Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; static s32 D_80B4E940 = 0; -static TexturePtr D_80B4E944[] = { - object_ma1_Tex_00FFC8, object_ma1_Tex_0107C8, object_ma1_Tex_010FC8, object_ma1_Tex_0117C8, object_ma1_Tex_011FC8, +static TexturePtr sRomaniEyeTextures[] = { + gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, }; -static TexturePtr D_80B4E958[] = { - object_ma1_Tex_0127C8, - object_ma1_Tex_012BC8, - object_ma1_Tex_012FC8, - object_ma1_Tex_0133C8, +static TexturePtr sRomaniMouthTextures[] = { + gRomaniMouthHappyTex, + gRomaniMouthFrownTex, + gRomaniMouthHangingOpenTex, + gRomaniMouthSmileTex, }; static s8 D_80B4E968 = 0; -static TexturePtr D_80B4E96C[] = { - object_ma2_Tex_011AD8, object_ma2_Tex_0122D8, object_ma2_Tex_012AD8, - object_ma2_Tex_0132D8, object_ma2_Tex_013AD8, object_ma2_Tex_0142D8, +static TexturePtr sCremiaEyeTextures[] = { + gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, }; -static TexturePtr D_80B4E984[] = { - object_ma2_Tex_014AD8, - object_ma2_Tex_014ED8, - object_ma2_Tex_0152D8, - object_ma2_Tex_0156D8, +static TexturePtr sCremiaMouthTextures[] = { + gCremiaMouthNormalTex, + gCremiaMouthSlightSmileTex, + gCremiaMouthFrownTex, + gCremiaMouthHangingOpenTex, }; static s8 D_80B4E994 = 0; @@ -327,7 +326,7 @@ static unkstructInvadepoh1 D_80B4EA24[] = { { 1, 1.0f }, }; -static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3c }; +static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C }; static unkstructInvadepoh3 D_80B4EA40 = { 1, @@ -1198,11 +1197,11 @@ void func_80B44F58(void) { if (!D_80B4E968) { D_80B4E968 = true; - for (i = 0, iter = D_80B4E944; i < ARRAY_COUNT(D_80B4E944); i++, iter++) { + for (i = 0, iter = sRomaniEyeTextures; i < ARRAY_COUNT(sRomaniEyeTextures); i++, iter++) { *iter = Lib_SegmentedToVirtual(*iter); } - for (i = 0, iter = D_80B4E958; i < ARRAY_COUNT(D_80B4E958); i++, iter++) { + for (i = 0, iter = sRomaniMouthTextures; i < ARRAY_COUNT(sRomaniMouthTextures); i++, iter++) { *iter = Lib_SegmentedToVirtual(*iter); } } @@ -1214,11 +1213,11 @@ void func_80B44FEC(void) { if (!D_80B4E994) { D_80B4E994 = true; - for (i = 0, iter = D_80B4E96C; i < ARRAY_COUNT(D_80B4E96C); i++, iter++) { + for (i = 0, iter = sCremiaEyeTextures; i < ARRAY_COUNT(sCremiaEyeTextures); i++, iter++) { *iter = Lib_SegmentedToVirtual(*iter); } - for (i = 0, iter = D_80B4E984; i < ARRAY_COUNT(D_80B4E984); i++, iter++) { + for (i = 0, iter = sCremiaMouthTextures; i < ARRAY_COUNT(sCremiaMouthTextures); i++, iter++) { *iter = Lib_SegmentedToVirtual(*iter); } } @@ -1997,9 +1996,9 @@ void func_80B47108(EnInvadepoh* this, PlayState* play) { if (this->actionTimer <= 0) { play->nextEntranceIndex = 0x6460; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x49; - gSaveContext.nextTransition = 0x48; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_73; + gSaveContext.nextTransitionType = TRANS_TYPE_72; D_801BDAA0 = 1; D_801BDA9C = 0; func_80B47248(this); @@ -2015,9 +2014,9 @@ void func_80B471E0(EnInvadepoh* this, PlayState* play) { if (D_80B4E998) { play->nextEntranceIndex = 0x6470; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x48; - gSaveContext.nextTransition = 0x48; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_72; + gSaveContext.nextTransitionType = TRANS_TYPE_72; func_80B47248(this); } } @@ -2038,9 +2037,9 @@ void func_80B47278(EnInvadepoh* this) { void func_80B47298(EnInvadepoh* this, PlayState* play) { play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x48; - gSaveContext.nextTransition = 0x48; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_72; + gSaveContext.nextTransitionType = TRANS_TYPE_72; gSaveContext.save.weekEventReg[89] |= 0x10; func_80B47304(this); } @@ -2427,7 +2426,7 @@ void func_80B4827C(Actor* thisx, PlayState* play) { void func_80B482D4(EnInvadepoh* this) { this->actionTimer = 40; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_002A8C, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); this->actor.draw = NULL; this->actionFunc = func_80B48324; } @@ -2443,7 +2442,7 @@ void func_80B48324(EnInvadepoh* this, PlayState* play) { void func_80B48374(EnInvadepoh* this) { this->actionTimer = 60; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_002A8C, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); this->actor.draw = func_80B4E324; this->actionFunc = func_80B483CC; } @@ -2475,7 +2474,7 @@ void func_80B4843C(EnInvadepoh* this) { this->behaviorInfo.unk44 = 0.1f; this->behaviorInfo.unk48 = 2000; this->actionTimer = 50; - Animation_Change(&this->skelAnime, &object_ma1_Anim_007328, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); + Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); this->actor.draw = func_80B4E324; this->actionFunc = func_80B484EC; } @@ -2505,7 +2504,7 @@ void func_80B48588(EnInvadepoh* this) { this->behaviorInfo.unk42 = 0; this->behaviorInfo.unk44 = 0.28f; this->behaviorInfo.unk48 = 7000; - Animation_MorphToPlayOnce(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actor.draw = func_80B4E324; this->actionFunc = func_80B48610; } @@ -2522,10 +2521,10 @@ void func_80B48620(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); this->actor.update = func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, this->jointTable, - this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 5000, 0.05f, 0.3f, 0.12f); - Animation_PlayLoop(&this->skelAnime, &object_ma1_Anim_009E58); + Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); func_80B482D4(this); } } @@ -2558,7 +2557,7 @@ void func_80B487B4(EnInvadepoh* this) { substruct->unk26.z = 0; substruct->unk30 = 0.1f; substruct->unk2C = 800; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_014088, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); this->actionFunc = func_80B48848; } @@ -2618,7 +2617,7 @@ void func_80B48948(EnInvadepoh* this) { substruct->unk2C = 1000; } - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actionFunc = func_80B48AD4; } @@ -2689,7 +2688,7 @@ void func_80B48DE4(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; this->actor.speedXZ = 0.0f; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->behaviorInfo.unk4C = 0; substruct->unk30 = 0.05f; substruct->unk2C = 1200; @@ -2726,8 +2725,8 @@ void func_80B48FB0(Actor* thisx, PlayState* play) { this->actor.update = func_80B490F0; this->actor.draw = func_80B4E324; this->actor.textId = 0x3330; - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_009E58, this->jointTable, - this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03, 0.3, 0.03); func_80B444F4(this, play); EnInvadepoh_SetPathPointToWorldPos(this, 0); @@ -2996,7 +2995,7 @@ void func_80B49B1C(Actor* thisx, PlayState* play) { void func_80B49BD0(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_014088, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -3040,7 +3039,7 @@ void func_80B49DA0(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 2000; this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->actionFunc = func_80B49DFC; } @@ -3078,8 +3077,8 @@ void func_80B49F88(Actor* thisx, PlayState* play) { this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, - this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03, 0.3, 0.03); func_80B44540(this, play); func_80B44570(this); @@ -3145,7 +3144,7 @@ void func_80B4A1B8(Actor* thisx, PlayState* play) { void func_80B4A2C0(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -3204,7 +3203,7 @@ void func_80B4A350(EnInvadepoh* this, PlayState* play) { void func_80B4A570(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToPlayOnce(&this->skelAnime, &object_ma1_Anim_002A8C, -10.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -3223,7 +3222,7 @@ void func_80B4A5E4(EnInvadepoh* this, PlayState* play) { void func_80B4A614(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_014088, 0.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -3266,7 +3265,7 @@ void func_80B4A7C0(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 2000; this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, 0.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); this->actionFunc = func_80B4A81C; } @@ -3309,8 +3308,8 @@ void func_80B4A9C8(Actor* thisx, PlayState* play) { this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, - this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); func_80B44620(this, play); if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) { @@ -3402,7 +3401,7 @@ void func_80B4ADB8(EnInvadepoh* this) { } void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x3331) { if (gSaveContext.save.weekEventReg[22] & 2) { EnInvadepoh_SetTextID(this, play, 0x3334); @@ -3468,7 +3467,8 @@ void func_80B4B048(EnInvadepoh* this, PlayState* play) { if (play->msgCtx.unk120B1 == 0) { if (play->msgCtx.msgMode == 0) { D_80B4E998 = 1; - } else if ((Message_GetState(&play->msgCtx) == 6) || (Message_GetState(&play->msgCtx) == 5)) { + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || + (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { D_80B4E998 = 1; } } @@ -3484,9 +3484,9 @@ void func_80B4B0C4(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); this->actor.update = func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, - this->morphTable, 23); - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); substruct = &this->behaviorInfo; func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 2000, 0.08f, 0.3f, 0.03f); substruct->unk30 = 0.08f; @@ -3692,17 +3692,14 @@ void func_80B4BA84(Actor* thisx, PlayState* play) { sp2C = this->unk3BC; this->unk3BC = func_80B44234(this, &D_80B5040C->actor.world.pos); if (sp2C != this->unk3BC) { - phi_v0 = this->pathIndex; phi_v0 = this->unk3BC - this->pathIndex; - temp_v0_3 = phi_v0; - if (temp_v0_3 < 0) { + if (phi_v0 < 0) { phi_v0 += this->endPoint; } - temp_v0_3 = this->endPoint >> 1; - if (temp_v0_3 < phi_v0) { + if ((this->endPoint >> 1) < phi_v0) { this->direction = DIRECTION_BACKWARD; - } else if (phi_v0 < temp_v0_3) { + } else if (phi_v0 < (this->endPoint >> 1)) { this->direction = DIRECTION_FORWARD; } } @@ -3720,7 +3717,7 @@ void func_80B4BA84(Actor* thisx, PlayState* play) { void func_80B4BBE0(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToLoop(&this->skelAnime, &object_ma2_Anim_016720, -6.0f); + Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -3801,7 +3798,7 @@ void func_80B4BC4C(EnInvadepoh* this, PlayState* play) { void func_80B4BFFC(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &object_ma2_Anim_00A174, -6.0f); + Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->behaviorInfo.unk4C = 0; this->actionFunc = func_80B4C058; } @@ -3833,7 +3830,7 @@ void func_80B4C058(EnInvadepoh* this, PlayState* play) { void func_80B4C1BC(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &object_ma2_Anim_00A174, -6.0f); + Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); this->behaviorInfo.unk4C = 0; this->actionFunc = func_80B4C218; } @@ -3873,8 +3870,8 @@ void func_80B4C3A0(Actor* thisx, PlayState* play) { this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma2_Skel_015C28, &object_ma2_Anim_016720, this->jointTable, - this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, + CREMIA_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); this->actor.textId = 0x33CD; if (currentTime < 0xD5A0) { @@ -3936,7 +3933,7 @@ void func_80B4C5C0(Actor* thisx, PlayState* play) { void func_80B4C6C8(EnInvadepoh* this) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_014088, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); substruct->unk26.x = 0; substruct->unk26.y = 0; substruct->unk26.z = 0; @@ -4019,7 +4016,7 @@ void func_80B4C730(EnInvadepoh* this, PlayState* play) { void func_80B4CAB0(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 4000; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->behaviorInfo.unk4C = 0; this->actionFunc = func_80B4CB0C; } @@ -4048,7 +4045,7 @@ void func_80B4CB0C(EnInvadepoh* this, PlayState* play) { void func_80B4CC70(EnInvadepoh* this) { this->behaviorInfo.unk30 = 0.08f; this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &object_ma1_Anim_009E58, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); this->behaviorInfo.unk4C = 0; this->actionFunc = func_80B4CCCC; } @@ -4087,8 +4084,8 @@ void func_80B4CE54(Actor* thisx, PlayState* play) { this->actor.objBankIndex = this->bankIndex; Actor_SetObjectDependency(play, &this->actor); func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, &object_ma1_Anim_014088, this->jointTable, - this->morphTable, 23); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, + ROMANI_LIMB_MAX); func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); func_80B446D0(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -4470,13 +4467,13 @@ void func_80B4E1B0(Actor* thisx, PlayState* play) { } s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 14) { + if (limbIndex == ROMANI_LIMB_HEAD) { EnInvadepoh* this = THIS; // both of these needed to match rot->x += this->behaviorInfo.unk20.y; rot->y += this->behaviorInfo.unk20.z; rot->z += this->behaviorInfo.unk20.x; - } else if (limbIndex == 13) { + } else if (limbIndex == ROMANI_LIMB_TORSO) { EnInvadepoh* this = THIS; // both of these needed to match rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); @@ -4488,11 +4485,11 @@ s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnInvadepoh* this = THIS; - if (limbIndex == 19) { + if (limbIndex == ROMANI_LIMB_LEFT_HAND) { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 14) { + } else if (limbIndex == ROMANI_LIMB_HEAD) { Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); } } @@ -4502,8 +4499,8 @@ void func_80B4E324(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E958[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E944[this->behaviorInfo.unk0.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->behaviorInfo.unk10.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->behaviorInfo.unk0.unkF]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4E200, func_80B4E2AC, &this->actor); CLOSE_DISPS(play->state.gfxCtx); @@ -4597,8 +4594,8 @@ void func_80B4E7BC(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, D_80B4E984[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4E96C[this->behaviorInfo.unk0.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->behaviorInfo.unk10.unkF]); + gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->behaviorInfo.unk0.unkF]); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B4E6E4, func_80B4E784, &this->actor); CLOSE_DISPS(play->state.gfxCtx); 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 153edf853..aa2dce882 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -216,11 +216,11 @@ s32 func_80BC1D70(EnJa* this, PlayState* play) { void func_80BC1E40(EnJa* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp20 = Message_GetState(&play->msgCtx); + s32 talkState = Message_GetState(&play->msgCtx); f32 phi_f0; - if (((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && - (this->unk_374 == 3) && (&this->actor == player->targetActor)) { + if (((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3) && (&this->actor == player->targetActor)) { if ((play->state.frames % 2) == 0) { if (this->unk_348 != 0.0f) { this->unk_348 = 0.0f; @@ -236,10 +236,10 @@ void func_80BC1E40(EnJa* this, PlayState* play) { this->unk_34C = CLAMP(this->unk_34C, 0.0f, 120.0f); Matrix_Translate(this->unk_34C, 0.0f, 0.0f, MTXMODE_APPLY); - this->unk_374 = sp20; + this->prevTalkState = talkState; } -s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80BC1AE0(this, play)) { @@ -252,7 +252,7 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_80BC1AE0(this, play)) { @@ -269,19 +269,19 @@ s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; this->unk_340 = 0; - switch (arg2->result) { + switch (scheduleOutput->result) { case 1: - ret = func_80BC1FC8(this, play, arg2); - if (ret == 1) {} + ret = func_80BC1FC8(this, play, scheduleOutput); + if (ret == true) {} break; case 2: - ret = func_80BC203C(this, play, arg2); + ret = func_80BC203C(this, play, scheduleOutput); break; } return ret; @@ -299,7 +299,7 @@ void func_80BC2150(EnJa* this, PlayState* play) { } void func_80BC21A8(EnJa* this, PlayState* play) { - ScheduleResult sp18; + ScheduleOutput sp18; this->unk_35C = REG(15) + ((void)0, gSaveContext.save.daySpeed); if (!Schedule_RunScript(play, D_80BC35F0, &sp18) || diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.h b/src/overlays/actors/ovl_En_Ja/z_en_ja.h index 6eeca985a..e2fd8287f 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.h +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.h @@ -56,8 +56,8 @@ typedef struct EnJa { /* 0x366 */ s16 unk_366; /* 0x368 */ void* unk_368; /* 0x36C */ s32 unk_36C; - /* 0x370 */ UNK_TYPE1 unk370[4]; - /* 0x374 */ s32 unk_374; + /* 0x370 */ UNK_TYPE1 unk_370[4]; + /* 0x374 */ s32 prevTalkState; } EnJa; // size = 0x378 extern const ActorInit En_Ja_InitVars; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index a66992637..add52b0e4 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -358,11 +358,11 @@ void EnJg_GoronShrineIdle(EnJg* this, PlayState* play) { } void EnJg_GoronShrineTalk(EnJg* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if ((this->textId == 0xDCC) || (this->textId == 0xDDD) || (this->textId == 0xDE0)) { // There is nothing more to say after these lines, so end the current conversation. play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_GoronShrineIdle; } else { @@ -415,7 +415,7 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { * set his speed to 0, causing him to walk in place. */ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { - u8 messageState = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -425,9 +425,9 @@ void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } } else if (this->animationIndex == EN_JG_ANIMATION_SURPRISE_LOOP) { - if ((messageState == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->animationIndex = EN_JG_ANIMATION_WALK; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); @@ -470,7 +470,7 @@ void EnJg_Walk(EnJg* this, PlayState* play) { } void EnJg_Talk(EnJg* this, PlayState* play) { - u8 messageState = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); u16 temp; @@ -480,12 +480,12 @@ void EnJg_Talk(EnJg* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); } - if ((messageState == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { temp = this->textId; if ((temp == 0xDB4) || (temp == 0xDB5) || (temp == 0xDC4) || (temp == 0xDC6)) { // There is nothing more to say after these lines, so end the current conversation. play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; return; @@ -497,7 +497,7 @@ void EnJg_Talk(EnJg* this, PlayState* play) { // The player hasn't talked to the Goron Child at least once, so they can't learn // the Lullaby Intro. End the current conversation with the player. play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->actionFunc = EnJg_SetupWalk; } else if (((gSaveContext.save.weekEventReg[24] & 0x40)) || @@ -511,7 +511,7 @@ void EnJg_Talk(EnJg* this, PlayState* play) { // already have the Lullaby or Lullaby Intro. End the current conversation and // start the cutscene that teaches the Lullaby Intro. play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; this->cutscene = EnJg_GetCutsceneForTeachingLullabyIntro(this); if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -600,9 +600,9 @@ void EnJg_FrozenIdle(EnJg* this, PlayState* play) { } void EnJg_EndFrozenInteraction(EnJg* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnJg_FrozenIdle; } } diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 57da759e1..8b5292692 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -251,21 +251,21 @@ void func_80C14030(EnJgameTsn* this) { void func_80C14044(EnJgameTsn* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: + case TEXT_STATE_CHOICE: func_80C14684(this, play); break; - case 5: + case TEXT_STATE_5: func_80C147B4(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { ActorCutscene_Stop(this->actor.cutscene); @@ -368,9 +368,9 @@ void func_80C144E4(EnJgameTsn* this) { void func_80C144F8(EnJgameTsn* this, PlayState* play) { play->nextEntranceIndex = 0x68D0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x50; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } void func_80C14540(EnJgameTsn* this) { 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 78b74a2f1..31fe29369 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -4,6 +4,7 @@ * Description: Pierre the Scarecorw */ +#include "prevent_bss_reordering.h" #include "z_en_kakasi.h" #include "objects/object_ka/object_ka.h" @@ -78,7 +79,7 @@ const ActorInit En_Kakasi_InitVars = { (ActorFunc)EnKakasi_Draw, }; -static Vec3f D_80971DCC[] = { +Vec3f D_80971DCC[] = { { 0.0f, 60.0f, 60.0f }, { 40.0f, 40.0f, 50.0f }, { -40.0f, 40.0f, 50.0f }, { 40.0f, 20.0f, 110.0f }, { -40.0f, 20.0f, 110.0f }, { 0.0f, 80.0f, 60.0f }, { 50.0f, 40.0f, -30.0f }, { -50.0f, 40.0f, -30.0f }, { 0.0f, 50.0f, 60.0f }, @@ -157,7 +158,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.z = 0; this->actor.targetMode = 0; if (this->actor.world.rot.x > 0 && this->actor.world.rot.x < 8) { - this->actor.targetMode = this->actor.world.rot.x - 1; + this->actor.targetMode = GET_KAKASI_TARGETMODE(thisx); } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -256,19 +257,19 @@ void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { * something to do with cutscene camera? */ void func_8096FAAC(EnKakasi* this, PlayState* play) { - if (this->cutsceneCamId != CAM_ID_MAIN) { - Math_ApproachF(&this->unk214.x, this->unk238.x, 0.4f, 4.0f); - Math_ApproachF(&this->unk214.y, this->unk238.y, 0.4f, 4.0f); - Math_ApproachF(&this->unk214.z, this->unk238.z, 0.4f, 4.0f); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, 0.4f, 4.0f); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, 0.4f, 4.0f); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, 0.4f, 4.0f); - Math_ApproachF(&this->unk220.x, this->unk244.x, 0.4f, 4.0f); - Math_ApproachF(&this->unk220.y, this->unk244.y, 0.4f, 4.0f); - Math_ApproachF(&this->unk220.z, this->unk244.z, 0.4f, 4.0f); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, 0.4f, 4.0f); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, 0.4f, 4.0f); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, 0.4f, 4.0f); - Math_ApproachF(&this->unk20C, this->unk210, 0.3f, 10.0f); + Math_ApproachF(&this->subCamFov, this->subCamFovNext, 0.3f, 10.0f); - Play_CameraSetAtEye(play, this->cutsceneCamId, &this->unk220, &this->unk214); - Play_CameraSetFov(play, this->cutsceneCamId, this->unk20C); + Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_CameraSetFov(play, this->subCamId, this->subCamFov); } } @@ -309,7 +310,7 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { // dialogue after skipped time 'did you feel that? went by in an instant' this->actor.textId = 0x1653; gSaveContext.save.weekEventReg[83] &= (u8)~1; - this->unkMsgState1AC = 5; + this->talkState = TEXT_STATE_5; player->stateFlags1 |= 0x20; this->actor.flags |= ACTOR_FLAG_10000; } @@ -381,7 +382,7 @@ void EnKakasi_SetupDialogue(EnKakasi* this) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->unkMsgState1AC = 5; + this->talkState = TEXT_STATE_5; this->unkState196 = 1; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); this->actionFunc = EnKakasi_RegularDialogue; @@ -415,9 +416,9 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->unkState1A8 = 0; } - if ((this->unkMsgState1AC == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->talkState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { func_801477B4(play); - if (this->unkMsgState1AC == 5) { + if (this->talkState == TEXT_STATE_5) { // bad song input if (this->unkState196 == 2 && this->actor.textId == 0x1647) { func_800B7298(play, &this->actor, 6); @@ -458,7 +459,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->actionFunc = EnKakasi_DancingRemark; } else { ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); this->actionFunc = EnKakasi_DancingRemark; } } @@ -469,7 +470,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->unkMsgState1AC = 4; + this->talkState = TEXT_STATE_CHOICE; } else if (this->actor.textId == 0x1644) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { @@ -495,14 +496,14 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->actor.textId = 0x1655; } else if (this->actor.textId == 0x1655) { this->actor.textId = 0x1656; - this->unkMsgState1AC = 4; + this->talkState = TEXT_STATE_CHOICE; } else if (this->actor.textId == 0x1658) { this->actor.textId = 0x1659; } else if (this->actor.textId == 0x165A) { this->actor.textId = 0x165B; } else if (this->actor.textId == 0x165B) { this->actor.textId = 0x165C; - this->unkMsgState1AC = 4; + this->talkState = TEXT_STATE_CHOICE; } else if (this->actor.textId == 0x165E) { this->actor.textId = 0x165F; @@ -511,7 +512,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { return; } } else { - this->unkMsgState1AC = 5; + this->talkState = TEXT_STATE_5; if (play->msgCtx.choiceIndex == 1) { func_8019F208(); @@ -547,9 +548,9 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { this->actor.textId = 0x1646; Message_StartTextbox(play, this->actor.textId, &this->actor); - this->cutsceneCamId = CAM_ID_MAIN; - this->unk20C = 0.0f; - this->unk210 = 60.0f; + this->subCamId = SUB_CAM_ID_DONE; + this->subCamFov = 0.0f; + this->subCamFovNext = 60.0f; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); this->unkState196 = 2; this->actionFunc = EnKakasi_OcarinaRemark; @@ -560,7 +561,7 @@ void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { * before actually teaching */ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_80152434(play, 0x35); this->unkState1A8 = 0; if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -575,7 +576,7 @@ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { } else { this->unkState1A8 = 1; ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); this->actionFunc = EnKakasi_TeachingSong; } @@ -598,7 +599,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { return; } ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); this->unkState1A8 = 1; this->unkState1A8 = 1; @@ -606,15 +607,15 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { if (this->unkState1A8 == 1) { this->unk22C.y = this->actor.home.pos.y + 50.0f; - this->unk238.x = D_80971DCC[this->unk190].x; - this->unk238.y = D_80971DCC[this->unk190].y; - this->unk238.z = D_80971DCC[this->unk190].z; + this->subCamEyeNext.x = D_80971DCC[this->unk190].x; + this->subCamEyeNext.y = D_80971DCC[this->unk190].y; + this->subCamEyeNext.z = D_80971DCC[this->unk190].z; - Math_Vec3f_Copy(&tempVec, &this->unk238); - OLib_DbCameraVec3fSum(&this->actor.home, &tempVec, &this->unk238, 1); - Math_Vec3f_Copy(&this->unk244, &this->unk22C); - Math_Vec3f_Copy(&this->unk214, &this->unk238); - Math_Vec3f_Copy(&this->unk220, &this->unk244); + Math_Vec3f_Copy(&tempVec, &this->subCamEyeNext); + OLib_DbCameraVec3fSum(&this->actor.home, &tempVec, &this->subCamEyeNext, 1); + Math_Vec3f_Copy(&this->subCamAtNext, &this->unk22C); + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); func_8096FAAC(this, play); func_8096FBB8(this, play); @@ -625,10 +626,10 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; - this->cutsceneCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; this->actor.textId = 0x1647; this->unkState1A8 = 2; - this->unkMsgState1AC = 5; + this->talkState = TEXT_STATE_5; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); this->actionFunc = EnKakasi_RegularDialogue; @@ -659,12 +660,12 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->unk190 = 0; this->unkCounter1A4 = 0; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); - this->cutsceneCamId = CAM_ID_MAIN; - this->unkMsgState1AC = 5; + this->subCamId = SUB_CAM_ID_DONE; + this->talkState = TEXT_STATE_5; this->unkState1A8 = 1; this->actionFunc = EnKakasi_PostSongLearnDialogue; - this->unk20C = 0.0f; - this->unk210 = 60.0f; + this->subCamFov = 0.0f; + this->subCamFovNext = 60.0f; } void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { @@ -712,34 +713,34 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); func_800B7298(play, &this->actor, 0x56); this->unkState1A8 = 1; } - if (this->cutsceneCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->unk22C.y = this->actor.home.pos.y + 50.0f; EnKakasi_CheckPlayerPosition(this, play); - this->unk238.x = D_80971FA0[this->unk190].x; - this->unk238.y = D_80971FA0[this->unk190].y; - this->unk238.z = D_80971FA0[this->unk190].z; - Math_Vec3f_Copy(&vec3fCopy, &this->unk238); - OLib_DbCameraVec3fSum(&this->actor.home, &vec3fCopy, &this->unk238, 1); - this->unk244.x = D_80971FE8[this->unk190].x + this->unk22C.x; - this->unk244.y = D_80971FE8[this->unk190].y + this->unk22C.y; - this->unk244.z = D_80971FE8[this->unk190].z + this->unk22C.z; - Math_Vec3f_Copy(&this->unk214, &this->unk238); - Math_Vec3f_Copy(&this->unk220, &this->unk244); + this->subCamEyeNext.x = D_80971FA0[this->unk190].x; + this->subCamEyeNext.y = D_80971FA0[this->unk190].y; + this->subCamEyeNext.z = D_80971FA0[this->unk190].z; + Math_Vec3f_Copy(&vec3fCopy, &this->subCamEyeNext); + OLib_DbCameraVec3fSum(&this->actor.home, &vec3fCopy, &this->subCamEyeNext, 1); + this->subCamAtNext.x = D_80971FE8[this->unk190].x + this->unk22C.x; + this->subCamAtNext.y = D_80971FE8[this->unk190].y + this->unk22C.y; + this->subCamAtNext.z = D_80971FE8[this->unk190].z + this->unk22C.z; + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); } func_8096FAAC(this, play); - if ((this->unkState1A8 != 0) && (Message_GetState(&play->msgCtx) == this->unkMsgState1AC) && + if ((this->unkState1A8 != 0) && (Message_GetState(&play->msgCtx) == this->talkState) && Message_ShouldAdvance(play)) { func_801477B4(play); - if (this->unkMsgState1AC == 5) { + if (this->talkState == TEXT_STATE_5) { this->unk190++; if (this->unk190 > 5) { this->unk190 = 5; @@ -754,7 +755,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } else if (this->actor.textId == 0x1649) { this->actor.textId = 0x1660; - this->unkMsgState1AC = 4; + this->talkState = TEXT_STATE_CHOICE; } else if (this->actor.textId == 0x164A) { this->actor.textId = 0x164B; @@ -771,7 +772,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } } else { - this->unkMsgState1AC = 5; + this->talkState = TEXT_STATE_5; if (play->msgCtx.choiceIndex == 1) { func_8019F208(); // play 0x4808 sfx (decide) and calls func_801A75E8 this->actor.textId = 0x164A; @@ -798,7 +799,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); } else { ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->cutsceneCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { @@ -811,8 +812,8 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { void EnKakasi_SetupDanceNightAway(EnKakasi* this) { this->unk190 = 0; this->unkCounter1A4 = 0; - this->unk20C = 0.0f; - this->unk210 = 60.0f; + this->subCamFov = 0.0f; + this->subCamFovNext = 60.0f; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); func_8016566C(0xB4); @@ -829,19 +830,19 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); this->unk22C.y = this->actor.home.pos.y + 50.0f; - this->unk238.x = D_80971E38[this->unk190].x; - this->unk238.y = D_80971E38[this->unk190].y; - this->unk238.z = D_80971E38[this->unk190].z; - Math_Vec3f_Copy(&localVec3f, &this->unk238); - OLib_DbCameraVec3fSum(&this->actor.home, &localVec3f, &this->unk238, 1); + this->subCamEyeNext.x = D_80971E38[this->unk190].x; + this->subCamEyeNext.y = D_80971E38[this->unk190].y; + this->subCamEyeNext.z = D_80971E38[this->unk190].z; + Math_Vec3f_Copy(&localVec3f, &this->subCamEyeNext); + OLib_DbCameraVec3fSum(&this->actor.home, &localVec3f, &this->subCamEyeNext, 1); if (1) {} - this->unk244.x = D_80971EEC[this->unk190].x + this->unk22C.x; - this->unk244.y = D_80971EEC[this->unk190].y + this->unk22C.y; - this->unk244.z = D_80971EEC[this->unk190].z + this->unk22C.z; + this->subCamAtNext.x = D_80971EEC[this->unk190].x + this->unk22C.x; + this->subCamAtNext.y = D_80971EEC[this->unk190].y + this->unk22C.y; + this->subCamAtNext.z = D_80971EEC[this->unk190].z + this->unk22C.z; if (this->unk190 != 6 && this->unk190 != 7) { - Math_Vec3f_Copy(&this->unk214, &this->unk238); - Math_Vec3f_Copy(&this->unk220, &this->unk244); + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); } if (this->unk190 >= 7 && this->unk190 != 0xE) { this->actor.shape.rot.y += 0x800; @@ -960,8 +961,8 @@ void EnKakasi_SetupDigAway(EnKakasi* this) { } this->unk190 = 0; this->unkCounter1A4 = 0; - this->unk210 = 60.0f; - this->unk20C = 60.0f; + this->subCamFovNext = 60.0f; + this->subCamFov = 60.0f; Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); this->unkState196 = 4; this->actionFunc = EnKakasi_DiggingAway; @@ -971,19 +972,19 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Vec3f tempunk238; Vec3f tempWorldPos; - if (this->cutsceneCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->unk22C.y = this->actor.home.pos.y + 50.0f; - this->unk238.x = D_80972030.x; - this->unk238.y = D_80972030.y; - this->unk238.z = D_80972030.z; + this->subCamEyeNext.x = D_80972030.x; + this->subCamEyeNext.y = D_80972030.y; + this->subCamEyeNext.z = D_80972030.z; - Math_Vec3f_Copy(&tempunk238, &this->unk238); - OLib_DbCameraVec3fSum(&this->actor.home, &tempunk238, &this->unk238, 1); - this->unk244.x = ((f32)D_8097203C.x) + this->unk22C.x; // cast req - this->unk244.y = ((f32)D_8097203C.y) + this->unk22C.y; - this->unk244.z = ((f32)D_8097203C.z) + this->unk22C.z; - Math_Vec3f_Copy(&this->unk214, &this->unk238); - Math_Vec3f_Copy(&this->unk220, &this->unk244); + Math_Vec3f_Copy(&tempunk238, &this->subCamEyeNext); + OLib_DbCameraVec3fSum(&this->actor.home, &tempunk238, &this->subCamEyeNext, 1); + this->subCamAtNext.x = ((f32)D_8097203C.x) + this->unk22C.x; // cast req + this->subCamAtNext.y = ((f32)D_8097203C.y) + this->unk22C.y; + this->subCamAtNext.z = ((f32)D_8097203C.z) + this->unk22C.z; + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); func_8096FAAC(this, play); } @@ -1101,7 +1102,7 @@ void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play) { void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); EnKakasi_SetupIdleRisen(this); } @@ -1124,7 +1125,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { if (this->unk1BC.x != 0.0f || this->unk1BC.z != 0.0f) { Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk1BC); this->actor.focus.pos.y += 10.0f; - if (this->cutsceneCamId == CAM_ID_MAIN) { + if (this->subCamId == CAM_ID_MAIN) { Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } else { Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.home.rot); diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index 20e75e09f..c1a788d46 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -21,7 +21,7 @@ typedef struct EnKakasi { /* 0x1A0 */ s32 animIndex; /* 0x1A4 */ s32 unkCounter1A4; // counter, counts up to F while he digs away, reused elsewhere /* 0x1A8 */ s32 unkState1A8; - /* 0x1AC */ s16 unkMsgState1AC; // might be dialog state, compared against func(msgCtx) + /* 0x1AC */ s16 talkState; /* 0x1AE */ s16 actorCutscenes[3]; /* 0x1B4 */ f32 animeFrameCount; /* 0x1B8 */ f32 unkHeight; @@ -29,14 +29,14 @@ typedef struct EnKakasi { /* 0x1C8 */ UNK_TYPE1 pad1C8[0x3C]; /* 0x204 */ s16 unk204; // set to A, F, 0x14, 0x28 frequently /* 0x206 */ UNK_TYPE1 pad206[2]; - /* 0x208 */ s16 cutsceneCamId; - /* 0x20C */ f32 unk20C; // passed to unknown function - /* 0x210 */ f32 unk210; // used as a target for 20C to approach - /* 0x214 */ Vec3f unk214; // copied from unk238 regularly - /* 0x220 */ Vec3f unk220; //EnKakasi_TeachingSong - /* 0x22C */ Vec3f unk22C; //actor home copied to here - /* 0x238 */ Vec3f unk238; //copied from D_80971E38[unk190] - /* 0x244 */ Vec3f unk244; + /* 0x208 */ s16 subCamId; + /* 0x20C */ f32 subCamFov; + /* 0x210 */ f32 subCamFovNext; + /* 0x214 */ Vec3f subCamEye; + /* 0x220 */ Vec3f subCamAt; + /* 0x22C */ Vec3f unk22C; + /* 0x238 */ Vec3f subCamEyeNext; + /* 0x244 */ Vec3f subCamAtNext; /* 0x250 */ f32 songSummonDist; /* 0x254 */ ColliderCylinder collider; } EnKakasi; // size = 0x2A0 @@ -47,5 +47,6 @@ extern const ActorInit En_Kakasi_InitVars; #define GET_KAKASI_SUMMON_DISTANCE(thisx) (((thisx)->params >> 0x8) & 0xFF) #define GET_KAKASI_ABOVE_GROUND(thisx) ((thisx)->params & 0x1) +#define GET_KAKASI_TARGETMODE(thisx) ((thisx)->world.rot.x - 1) #endif // Z_EN_KAKASI_H diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index b52c24e16..5ac9e5211 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -317,15 +317,15 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) { Player* player = GET_PLAYER(play); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: func_80B26758(this, play); break; - case 5: + case TEXT_STATE_5: func_80B269A4(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { if (this->unk_288 == 0x272C) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); @@ -339,10 +339,10 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) { func_80B26538(this); } - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; } } @@ -509,7 +509,7 @@ void func_80B2714C(EnKendoJs* this) { void func_80B27188(EnKendoJs* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_288 == 0x2729) { func_80B26F14(this, play); } else if (!func_80B26F6C(this, play)) { diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 78e27e6cb..9a63f38a1 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -455,7 +455,7 @@ void func_80B4163C(EnKgy* this, PlayState* play) { void func_80B417B8(EnKgy* this, PlayState* play) { func_80B4163C(this, play); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80B413C8(this); this->actor.flags &= ~ACTOR_FLAG_100; @@ -479,7 +479,7 @@ void func_80B41858(EnKgy* this, PlayState* play) { void func_80B418C4(EnKgy* this, PlayState* play) { func_80B4163C(this, play); if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play) && + (Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play) && ((play->msgCtx.currentTextId == 0xC4E) || (play->msgCtx.currentTextId == 0xC4F))) { func_801477B4(play); this->actor.textId = 0xC4F; @@ -513,7 +513,7 @@ void func_80B41A48(EnKgy* this, PlayState* play) { this->unk_2E4--; } else { play->nextEntranceIndex = play->setupExitList[ENKGY_GET_1F(&this->actor)]; - play->transitionTrigger = 20; + play->transitionTrigger = TRANS_TRIGGER_START; } } @@ -522,7 +522,7 @@ void func_80B41ACC(EnKgy* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&play->msgCtx) == 0x10) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { itemActionParam = func_80123810(play); if (itemActionParam != PLAYER_AP_NONE) { this->actionFunc = func_80B41E18; @@ -554,7 +554,7 @@ void func_80B41ACC(EnKgy* this, PlayState* play) { this->actor.textId = 0xC47; } player->actor.textId = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); } } @@ -603,7 +603,7 @@ void func_80B41D64(EnKgy* this, PlayState* play) { } void func_80B41E18(EnKgy* this, PlayState* play) { - u16 temp; + u16 textId; s32 pad; Player* player = GET_PLAYER(play); @@ -613,11 +613,11 @@ void func_80B41E18(EnKgy* this, PlayState* play) { if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && func_80B40E54(this) == 0) { switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { - temp = play->msgCtx.currentTextId; + textId = play->msgCtx.currentTextId; - switch (temp) { + switch (textId) { case 0xC3B: switch (play->msgCtx.choiceIndex) { case 0: @@ -633,7 +633,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 1: func_8019F230(); - func_80B40EBC(this, play, temp); + func_80B40EBC(this, play, textId); break; } break; @@ -655,21 +655,21 @@ void func_80B41E18(EnKgy* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - temp = play->msgCtx.currentTextId; + textId = play->msgCtx.currentTextId; - switch (temp) { + switch (textId) { case 0xC35: - play->msgCtx.unk11F10 = 0; - this->actor.textId = temp; + play->msgCtx.msgLength = 0; + this->actor.textId = textId; this->unk_29C |= 4; this->unk_2E8 = 3; func_80B40E38(this); break; case 0xC36: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); this->actor.textId = func_80B41460(); break; @@ -694,7 +694,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC3C: case 0xC3F: case 0xC4C: - func_80B40EBC(this, play, temp); + func_80B40EBC(this, play, textId); break; case 0xC3D: @@ -706,13 +706,13 @@ void func_80B41E18(EnKgy* this, PlayState* play) { break; case 0xC40: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 0); this->actor.textId = 0xC43; break; case 0xC42: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 0); this->actor.textId = 0xC43; CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; @@ -726,7 +726,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { this->unk_29C |= 0x10; case 0xC45: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 3); this->actor.textId = 0xFF; this->actionFunc = func_80B41ACC; @@ -746,7 +746,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); player->exchangeItemId = EXCH_ITEM_NONE; this->unk_29C &= ~0x8; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); if (this->unk_29C & 0x10) { this->actor.textId = 0xC56; @@ -762,19 +762,19 @@ void func_80B41E18(EnKgy* this, PlayState* play) { player->exchangeItemId = EXCH_ITEM_NONE; this->unk_29C &= ~8; } - func_80B40EBC(this, play, temp); + func_80B40EBC(this, play, textId); break; case 0xC48: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 0); - this->actor.textId = temp + 1; + this->actor.textId = textId + 1; break; case 0xC49: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); - this->actor.textId = temp + 1; + this->actor.textId = textId + 1; break; case 0xC4A: @@ -803,9 +803,9 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC51: case 0xC53: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 0); - this->actor.textId = temp + 1; + this->actor.textId = textId + 1; func_80B40D30(play); break; @@ -854,7 +854,7 @@ void func_80B425A0(EnKgy* this, PlayState* play) { void func_80B42660(EnKgy* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80B413C8(this); this->actor.flags &= ~ACTOR_FLAG_100; @@ -883,7 +883,7 @@ void func_80B42714(EnKgy* this, PlayState* play) { void func_80B427C8(EnKgy* this, PlayState* play) { s32 pad; - u16 temp_a2; + u16 textId; if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_2D2 == 5) { @@ -895,26 +895,26 @@ void func_80B427C8(EnKgy* this, PlayState* play) { } if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - temp_a2 = play->msgCtx.currentTextId; + (Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + textId = play->msgCtx.currentTextId; - switch (temp_a2) { + switch (textId) { case 0xC30: - play->msgCtx.unk11F10 = 0; - this->actor.textId = temp_a2; + play->msgCtx.msgLength = 0; + this->actor.textId = textId; this->unk_29C |= 4; this->unk_2E8 = 3; break; case 0xC31: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); - this->actor.textId = temp_a2 + 1; + this->actor.textId = textId + 1; break; case 0xC32: case 0xC33: - func_80B40EBC(this, play, temp_a2); + func_80B40EBC(this, play, textId); break; case 0xC34: @@ -953,7 +953,7 @@ void func_80B4296C(EnKgy* this, PlayState* play) { } void func_80B42A8C(EnKgy* this, PlayState* play) { - u16 temp_a2; + u16 textId; s32 pad; if (SkelAnime_Update(&this->skelAnime)) { @@ -967,21 +967,21 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { } if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0) && - (Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - temp_a2 = play->msgCtx.currentTextId; - switch (temp_a2) { + (Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + textId = play->msgCtx.currentTextId; + switch (textId) { case 0xC1D: case 0xC2D: - play->msgCtx.unk11F10 = 0; - this->actor.textId = temp_a2; + play->msgCtx.msgLength = 0; + this->actor.textId = textId; this->unk_29C |= 4; this->unk_2E8 = 3; break; case 0xC1E: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 1); - this->actor.textId = temp_a2 + 1; + this->actor.textId = textId + 1; func_80B40E38(this); break; @@ -989,39 +989,39 @@ void func_80B42A8C(EnKgy* this, PlayState* play) { case 0xC23: case 0xC24: case 0xC27: - func_80B40EBC(this, play, temp_a2); + func_80B40EBC(this, play, textId); break; case 0xC20: case 0xC28: func_80B40BC0(this, 1); - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->unk_29C |= 4; this->unk_2E8 = 3; - this->actor.textId = temp_a2; + this->actor.textId = textId; func_80B40E38(this); break; case 0xC21: case 0xC29: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 0); - this->actor.textId = temp_a2 + 1; + this->actor.textId = textId + 1; break; case 0xC22: case 0xC26: case 0xC2B: case 0xC2E: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 1); - this->actor.textId = temp_a2 + 1; + this->actor.textId = textId + 1; break; case 0xC25: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80B41368(this, play, 2); - this->actor.textId = temp_a2 + 1; + this->actor.textId = textId + 1; break; case 0xC2A: diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 0df5e93fc..df95a6988 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -183,24 +183,24 @@ void EnKujiya_SetupTalk(EnKujiya* this) { void EnKujiya_Talk(EnKujiya* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: break; - case 4: + case TEXT_STATE_CHOICE: EnKujiya_HandlePlayerChoice(this, play); break; - case 5: + case TEXT_STATE_5: EnKujiya_ChooseNextDialogue(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { EnKujiya_SetupWait(this); } break; - case 17: + case TEXT_STATE_17: if (Message_ShouldAdvance(play)) { Inventory_SaveLotteryCodeGuess(play); Message_StartTextbox(play, 0x2B60, &this->actor); @@ -227,7 +227,7 @@ void EnKujiya_SetupFinishGivePrize(EnKujiya* this) { } void EnKujiya_FinishGivePrize(EnKujiya* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { EnKujiya_SetupWait(this); } } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 73cf73c36..435d31972 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -209,7 +209,7 @@ void func_80A5B508(void) { sp74[7] = (spAC - temp_f20) * temp_f22 * temp_f24 * temp_f2; for (i = 0; i < ARRAY_COUNT(D_80A60908); i++) { - ptr = (f32*)&D_80A60908[i].mf[0]; + ptr = &D_80A60908[i].xx; tempf1 = sp74[(i + 0) & 7]; tempf2 = sp74[(i + 1) & 7]; @@ -242,8 +242,8 @@ void func_80A5B508(void) { void func_80A5B954(MtxF* matrix, f32 arg1) { s32 i; MtxF* temp = Matrix_GetCurrent(); - f32* tmp = (f32*)&temp->mf[0]; - f32* tmp2 = (f32*)&matrix->mf[0]; + f32* tmp = &temp->xx; + f32* tmp2 = &matrix->xx; for (i = 0; i < 16; i++) { *tmp++ += *tmp2++ * arg1; diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index fd3e93ccf..7441a14fd 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -293,12 +293,12 @@ void EnLookNuts_SetupSendPlayerToSpawn(EnLookNuts* this) { void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(this->spawnIndex); gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[17] |= 4; } } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 51131b05e..9cbd090fa 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -5,7 +5,6 @@ */ #include "z_en_ma4.h" -#include "objects/object_ma1/object_ma1.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) @@ -90,14 +89,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 D_80AC00DC = { 0, 0, 0, 0, MASS_IMMOVABLE }; static TexturePtr sEyeTextures[] = { - object_ma1_Tex_00FFC8, object_ma1_Tex_0107C8, object_ma1_Tex_010FC8, object_ma1_Tex_0117C8, object_ma1_Tex_011FC8, + gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, }; static TexturePtr sMouthTextures[] = { - object_ma1_Tex_0127C8, - object_ma1_Tex_012BC8, - object_ma1_Tex_012FC8, - object_ma1_Tex_0133C8, + gRomaniMouthHappyTex, + gRomaniMouthFrownTex, + gRomaniMouthHangingOpenTex, + gRomaniMouthSmileTex, }; void EnMa4_UpdateEyes(EnMa4* this) { @@ -113,26 +112,26 @@ void EnMa4_UpdateEyes(EnMa4* this) { } static AnimationSpeedInfo sAnimationInfo[] = { - { &object_ma1_Anim_009E58, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_009E58, 1.0f, ANIMMODE_LOOP, -6.0f }, // Idle anim - { &object_ma1_Anim_002A8C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_002A8C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Looking around anim - { &object_ma1_Anim_018948, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_ma1_Anim_018948, 1.0f, ANIMMODE_ONCE, -6.0f }, // Starts holding hands anim - { &object_ma1_Anim_01B76C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_01B76C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Holnding hands anim - { &object_ma1_Anim_007328, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_007328, 1.0f, ANIMMODE_LOOP, -6.0f }, // Walking anim - { &object_ma1_Anim_014088, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_014088, 1.0f, ANIMMODE_LOOP, -6.0f }, // - { &object_ma1_Anim_015B7C, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_ma1_Anim_015B7C, 1.0f, ANIMMODE_ONCE, -6.0f }, // Shoot arrow anim - { &object_ma1_Anim_007D98, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_007D98, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting anim - { &object_ma1_Anim_00852C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_00852C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting traumatized anim - { &object_ma1_Anim_008F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_008F6C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting sad anim + { &gRomaniIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniIdleAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniLookAroundAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniLookAroundAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSingStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gRomaniSingStartAnim, 1.0f, ANIMMODE_ONCE, -6.0f }, + { &gRomaniSingLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSingLoopAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniRunAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniRunAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniWalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniWalkAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniShootBowAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gRomaniShootBowAnim, 1.0f, ANIMMODE_ONCE, -6.0f }, + { &gRomaniSittingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSittingHeadShakeAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingHeadShakeAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, }; void EnMa4_ChangeAnim(EnMa4* this, s32 index) { @@ -145,9 +144,9 @@ void func_80ABDD9C(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 flag; - if (this->unk_1D8.unk_00 == 0 && ((this->skelAnime.animation == &object_ma1_Anim_007328) || - (this->skelAnime.animation == &object_ma1_Anim_002A8C) || - (this->skelAnime.animation == &object_ma1_Anim_015B7C))) { + if (this->unk_1D8.unk_00 == 0 && + ((this->skelAnime.animation == &gRomaniRunAnim) || (this->skelAnime.animation == &gRomaniLookAroundAnim) || + (this->skelAnime.animation == &gRomaniShootBowAnim))) { flag = 1; } else { flag = (this->type == MA4_TYPE_ALIENS_WON && this->actionFunc != EnMa4_DialogueHandler) ? 1 : 0; @@ -183,8 +182,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, - MA1_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, NULL, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -300,7 +298,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); Actor_MoveWithGravity(&this->actor); - if (this->skelAnime.animation == &object_ma1_Anim_007328) { // Walking animation + if (this->skelAnime.animation == &gRomaniRunAnim) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ROMANI_WALK); } @@ -628,31 +626,29 @@ void EnMa4_SetupDialogueHandler(EnMa4* this) { } void EnMa4_DialogueHandler(EnMa4* this, PlayState* play) { - s32 temp_v0; - switch (Message_GetState(&play->msgCtx)) { default: break; - case 4: // Player answered a question + case TEXT_STATE_CHOICE: // Player answered a question EnMa4_HandlePlayerChoice(this, play); break; - case 5: // End message block + case TEXT_STATE_5: // End message block EnMa4_ChooseNextDialogue(this, play); break; - case 6: // End conversation + case TEXT_STATE_DONE: // End conversation if (Message_ShouldAdvance(play)) { if ((play->msgCtx.unk120B1 == 0) || !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { EnMa4_SetupWait(this); } } - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; } @@ -668,9 +664,9 @@ void EnMa4_SetupBeginHorsebackGame(EnMa4* this) { void EnMa4_BeginHorsebackGame(EnMa4* this, PlayState* play) { play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x50; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) { @@ -760,14 +756,14 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) { play->nextEntranceIndex = 0x6410; gSaveContext.nextCutsceneIndex = 0; sFrameCounter = 0; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; if (this->poppedBalloonCounter == 10) { - play->unk_1887F = 0x50; - gSaveContext.nextTransition = 3; + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 2; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } this->poppedBalloonCounter = 0; @@ -865,9 +861,9 @@ void EnMa4_SetupBeginDescribeThemCs(EnMa4* this) { void EnMa4_BeginDescribeThemCs(EnMa4* this, PlayState* play) { play->nextEntranceIndex = 0x6400; gSaveContext.nextCutsceneIndex = 0xFFF5; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { @@ -1033,12 +1029,12 @@ s32 EnMa4_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p EnMa4* this = THIS; Vec3s sp4; - if (limbIndex == MA1_LIMB_HEAD) { + if (limbIndex == ROMANI_LIMB_HEAD) { sp4 = this->unk_1D8.unk_08; rot->x = rot->x + sp4.y; rot->z = rot->z + sp4.x; } - if (limbIndex == MA1_LIMB_TORSO) { + if (limbIndex == ROMANI_LIMB_TORSO) { sp4 = this->unk_1D8.unk_0E; rot->x = rot->x - sp4.y; rot->z = rot->z - sp4.x; @@ -1051,12 +1047,12 @@ void EnMa4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnMa4* this = THIS; Vec3f sp28 = { 800.0f, 0.0f, 0.0f }; - if (limbIndex == MA1_LIMB_HEAD) { + if (limbIndex == ROMANI_LIMB_HEAD) { Matrix_MultVec3f(&sp28, &this->actor.focus.pos); - } else if (limbIndex == MA1_LIMB_HAND_LEFT) { + } else if (limbIndex == ROMANI_LIMB_LEFT_HAND) { if (this->hasBow == true) { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); CLOSE_DISPS(play->state.gfxCtx); } } @@ -1068,7 +1064,7 @@ void EnMa4_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); if (this->type == MA4_TYPE_ALIENS_WON) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_000A20); + gSPDisplayList(POLY_OPA_DISP++, gRomaniWoodenBoxDL); } func_8012C28C(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h index 41936445b..148e2ef30 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h @@ -2,7 +2,7 @@ #define Z_EN_MA4_H #include "global.h" -#include "overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h" +#include "objects/object_ma1/object_ma1.h" struct EnMa4; @@ -15,9 +15,9 @@ typedef struct EnMa4 { /* 0x18C */ ColliderCylinder collider; /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; /* 0x200 */ Vec3s* pathPoints; - /* 0x204 */ Vec3s jointTable[MA1_LIMB_MAX]; + /* 0x204 */ Vec3s jointTable[ROMANI_LIMB_MAX]; /* 0x28E */ UNK_TYPE1 unk28E[0x6]; - /* 0x294 */ Vec3s morphTable[MA1_LIMB_MAX]; + /* 0x294 */ Vec3s morphTable[ROMANI_LIMB_MAX]; /* 0x31E */ UNK_TYPE1 unk31E[0x6]; /* 0x324 */ s16 pathIndex; /* 0x326 */ s16 pathPointsCount; diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 9866f4a67..48817003a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -5,7 +5,7 @@ */ #include "z_en_ma_yto.h" -#include "objects/object_ma2/object_ma2.h" +#include "overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) @@ -106,30 +106,41 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { }; static AnimationSpeedInfo sAnimationInfo[] = { - { &object_ma2_Anim_00A174, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_00A174, 1.0f, ANIMMODE_LOOP, -6.0f }, // - { &object_ma2_Anim_00AF7C, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_ma2_Anim_00AF7C, 1.0f, ANIMMODE_ONCE, -6.0f }, // - { &object_ma2_Anim_000CC0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_000CC0, 1.0f, ANIMMODE_LOOP, -6.0f }, // - { &object_ma2_Anim_016720, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_016720, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_005314, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_005314, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_0093E8, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_0093E8, 1.0f, ANIMMODE_LOOP, -10.0f }, // - { &object_ma2_Anim_007E28, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_007E28, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_0070EC, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_0070EC, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_003D54, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_003D54, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_001FD0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_001FD0, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_0030B4, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_0030B4, 1.0f, ANIMMODE_LOOP, -8.0f }, // - { &object_ma2_Anim_004370, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_ma2_Anim_004370, 1.0f, ANIMMODE_LOOP, -8.0f }, // + { &gCremiaIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaIdleAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gCremiaSpreadArmsStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gCremiaSpreadArmsStartAnim, 1.0f, ANIMMODE_ONCE, -6.0f }, + { &gCremiaSpreadArmsLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaSpreadArmsLoopAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gCremiaWalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaWalkAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaThinkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaThinkAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaPetCowAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaPetCowAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gCremiaSittingPetCowAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaSittingPetCowAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaSittingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaSittingAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaHugStartAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaHugStartAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaHugLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaHugLoopAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, + { &gCremiaClapAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gCremiaClapAnim, 1.0f, ANIMMODE_LOOP, -8.0f }, }; static TexturePtr sMouthTextures[] = { - object_ma2_Tex_014AD8, - object_ma2_Tex_014ED8, - object_ma2_Tex_0152D8, - object_ma2_Tex_0156D8, + gCremiaMouthNormalTex, + gCremiaMouthSlightSmileTex, + gCremiaMouthFrownTex, + gCremiaMouthHangingOpenTex, }; static TexturePtr sEyesTextures[] = { - object_ma2_Tex_011AD8, object_ma2_Tex_0122D8, object_ma2_Tex_012AD8, - object_ma2_Tex_0132D8, object_ma2_Tex_013AD8, object_ma2_Tex_0142D8, + gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, }; void EnMaYto_Init(Actor* thisx, PlayState* play) { @@ -157,8 +168,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma2_Skel_015C28, NULL, this->jointTable, this->morphTable, - MA2_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, NULL, this->jointTable, this->morphTable, CREMIA_LIMB_MAX); EnMaYto_InitAnimation(this, play); Collider_InitCylinder(play, &this->collider); @@ -409,30 +419,30 @@ void EnMaYto_SetupDefaultDialogueHandler(EnMaYto* this) { void EnMaYto_DefaultDialogueHandler(EnMaYto* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: EnMaYto_DefaultHandlePlayerChoice(this, play); break; - case 5: + case TEXT_STATE_5: EnMaYto_DefaultChooseNextDialogue(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->unk31E = 0; EnMaYto_SetupDefaultWait(this); } break; - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3000, 0x100); - if (this->textId == 0x3395 && this->skelAnime.animation == &object_ma2_Anim_00AF7C && + if (this->textId == 0x3395 && this->skelAnime.animation == &gCremiaSpreadArmsStartAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 4); } @@ -541,24 +551,24 @@ void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this) { void EnMaYto_DinnerDialogueHandler(EnMaYto* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: EnMaYto_DinnerHandlePlayerChoice(this, play); break; - case 5: + case TEXT_STATE_5: EnMaYto_DinnerChooseNextDialogue(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { EnMaYto_SetupDinnerWait(this); } break; - case 0: - case 1: - case 2: - case 3: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; } } @@ -731,22 +741,22 @@ void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this) { void EnMaYto_BarnDialogueHandler(EnMaYto* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: EnMaYto_BarnChooseNextDialogue(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->unk31E = 0; EnMaYto_SetupBarnWait(this); } break; - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; } } @@ -911,15 +921,15 @@ void EnMaYto_SetupAfterMilkRunDialogueHandler(EnMaYto* this) { void EnMaYto_AfterMilkRunDialogueHandler(EnMaYto* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 6: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: + case TEXT_STATE_DONE: break; - case 5: + case TEXT_STATE_5: EnMaYto_AfterMilkRunChooseNextDialogue(this, play); break; } @@ -1049,7 +1059,7 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { } Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); - if (D_80B915F0 == 2 && this->skelAnime.animation == &object_ma2_Anim_001FD0 && + if (D_80B915F0 == 2 && this->skelAnime.animation == &gCremiaHugStartAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 20); } @@ -1063,14 +1073,14 @@ void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this) { } void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 || Message_GetState(&play->msgCtx) == 5) { - if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE || Message_GetState(&play->msgCtx) == TEXT_STATE_5) { + if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == TEXT_STATE_5) { func_800B7298(play, &this->actor, 7); func_801477B4(play); } } - if (Message_GetState(&play->msgCtx) == 0 && play->msgCtx.unk120B1 == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE && play->msgCtx.unk120B1 == 0) { EnMaYto_SetupPostMilkRunEnd(this); } } @@ -1088,9 +1098,9 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) { play->nextEntranceIndex = 0x6480; } gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x50; - gSaveContext.nextTransition = 3; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_80; + gSaveContext.nextTransitionType = TRANS_TYPE_03; } void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { @@ -1425,20 +1435,19 @@ s32 EnMaYto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnMaYto* this = THIS; Vec3s sp4; - if (limbIndex == MA2_LIMB_HEAD) { + if (limbIndex == CREMIA_LIMB_HEAD) { sp4 = this->unk_1D8.unk_08; rot->x += sp4.y; rot->z += sp4.x; - } else if (limbIndex == MA2_LIMB_TORSO) { - if (this->skelAnime.animation != &object_ma2_Anim_007E28 && - this->skelAnime.animation != &object_ma2_Anim_003D54) { + } else if (limbIndex == CREMIA_LIMB_TORSO) { + if (this->skelAnime.animation != &gCremiaSittingPetCowAnim && + this->skelAnime.animation != &gCremiaSittingLookDownAnim) { sp4 = this->unk_1D8.unk_0E; rot->x += sp4.y; - if (this->skelAnime.animation == &object_ma2_Anim_00A174 || - this->skelAnime.animation == &object_ma2_Anim_0070EC || - this->skelAnime.animation == &object_ma2_Anim_003D54) { + if (this->skelAnime.animation == &gCremiaIdleAnim || this->skelAnime.animation == &gCremiaSittingAnim || + this->skelAnime.animation == &gCremiaSittingLookDownAnim) { rot->z += sp4.x; } } @@ -1449,7 +1458,7 @@ s32 EnMaYto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnMaYto_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMaYto* this = THIS; - if (limbIndex == MA2_LIMB_HEAD) { + if (limbIndex == CREMIA_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); } } @@ -1461,7 +1470,7 @@ void EnMaYto_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); if (this->type == MA_YTO_TYPE_BARN && (gSaveContext.save.weekEventReg[22] & 1)) { // Aliens defeated gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBox); + gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBoxDL); } func_8012C28C(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h index 25eb2bed5..7f2c50fb3 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.h @@ -2,38 +2,12 @@ #define Z_EN_MA_YTO_H #include "global.h" -#include "overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h" +#include "objects/object_ma2/object_ma2.h" struct EnMaYto; typedef void (*EnMaYtoActionFunc)(struct EnMaYto*, PlayState*); -typedef enum { - /* 00 */ MA2_LIMB_NONE, - /* 01 */ MA2_LIMB_ROOT, - /* 02 */ MA2_LIMB_TORSO, - /* 03 */ MA2_LIMB_ARM_LEFT, - /* 04 */ MA2_LIMB_FOREARM_LEFT, - /* 05 */ MA2_LIMB_HAND_LEFT, - /* 06 */ MA2_LIMB_ARM_RIGHT, - /* 07 */ MA2_LIMB_FOREARM_RIGHT, - /* 08 */ MA2_LIMB_HAND_RIGHT, - /* 09 */ MA2_LIMB_HEAD, - /* 10 */ MA2_LIMB_HAIR, - /* 11 */ MA2_LIMB_PELVIS, - /* 12 */ MA2_LIMB_TIGHT_LEFT, - /* 13 */ MA2_LIMB_LEG_LEFT, - /* 14 */ MA2_LIMB_FOOT_LEFT, - /* 15 */ MA2_LIMB_TIGHT_RIGHT, - /* 16 */ MA2_LIMB_LEG_RIGHT, - /* 17 */ MA2_LIMB_FOOT_RIGHT, - /* 18 */ MA2_LIMB_DRESS_0, - /* 19 */ MA2_LIMB_DRESS_1, - /* 20 */ MA2_LIMB_DRESS_2, - /* 21 */ MA2_LIMB_DRESS_3, - /* 22 */ MA2_LIMB_MAX -} ObjectMa2Limbs; - typedef struct EnMaYto { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -42,8 +16,8 @@ typedef struct EnMaYto { /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; /* 0x200 */ s32 unk200; // unused /* 0x204 */ s32 type; - /* 0x208 */ Vec3s jointTable[MA2_LIMB_MAX]; - /* 0x28C */ Vec3s morphTable[MA2_LIMB_MAX]; + /* 0x208 */ Vec3s jointTable[CREMIA_LIMB_MAX]; + /* 0x28C */ Vec3s morphTable[CREMIA_LIMB_MAX]; /* 0x310 */ s16 unk310; // state? /* 0x312 */ UNK_TYPE1 unk_312[0x2]; /* 0x314 */ s16 currentAnim; // Used only in DefaultWait diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index bac7fc53b..72357758a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -5,7 +5,6 @@ */ #include "z_en_ma_yts.h" -#include "objects/object_ma1/object_ma1.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) @@ -79,39 +78,39 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { }; static AnimationSpeedInfo sAnimationInfo[] = { - { &object_ma1_Anim_009E58, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_009E58, 1.0f, ANIMMODE_LOOP, -6.0f }, // Idle anim - { &object_ma1_Anim_018948, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_ma1_Anim_018948, 1.0f, ANIMMODE_ONCE, -6.0f }, // Starts holding hands anim - { &object_ma1_Anim_01B76C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_01B76C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Holnding hands anim - { &object_ma1_Anim_007328, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_007328, 1.0f, ANIMMODE_LOOP, -6.0f }, // Walking anim - { &object_ma1_Anim_014088, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_014088, 1.0f, ANIMMODE_LOOP, -6.0f }, // - { &object_ma1_Anim_002A8C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_002A8C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Looking around anim - { &object_ma1_Anim_015B7C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_015B7C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Shoot arrow anim - { &object_ma1_Anim_007D98, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_007D98, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting anim - { &object_ma1_Anim_00852C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_00852C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting traumatized anim - { &object_ma1_Anim_008F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_ma1_Anim_008F6C, 1.0f, ANIMMODE_LOOP, -6.0f }, // Sitting sad anim - { &object_ma1_Anim_0180DC, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_ma1_Anim_0180DC, 1.0f, ANIMMODE_ONCE, -6.0f }, // Turns around anim + { &gRomaniIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniIdleAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSingStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gRomaniSingStartAnim, 1.0f, ANIMMODE_ONCE, -6.0f }, + { &gRomaniSingLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSingLoopAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniRunAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniRunAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniWalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniWalkAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniLookAroundAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniLookAroundAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniShootBowAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniShootBowAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSittingAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSittingHeadShakeAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingHeadShakeAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gRomaniSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, + { &gRomaniTurnAroundAndFlickHairAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gRomaniTurnAroundAndFlickHairAnim, 1.0f, ANIMMODE_ONCE, -6.0f }, }; static TexturePtr sMouthTextures[] = { - object_ma1_Tex_0127C8, - object_ma1_Tex_012BC8, - object_ma1_Tex_012FC8, - object_ma1_Tex_0133C8, + gRomaniMouthHappyTex, + gRomaniMouthFrownTex, + gRomaniMouthHangingOpenTex, + gRomaniMouthSmileTex, }; static TexturePtr sEyeTextures[] = { - object_ma1_Tex_00FFC8, object_ma1_Tex_0107C8, object_ma1_Tex_010FC8, object_ma1_Tex_0117C8, object_ma1_Tex_011FC8, + gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, }; void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) { @@ -225,8 +224,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ma1_Skel_013928, NULL, this->jointTable, this->morphTable, - MA1_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, NULL, this->jointTable, this->morphTable, ROMANI_LIMB_MAX); EnMaYts_InitAnimation(this, play); Collider_InitCylinder(play, &this->collider); @@ -354,21 +352,21 @@ void EnMaYts_SetupDialogueHandler(EnMaYts* this) { void EnMaYts_DialogueHandler(EnMaYts* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 5: // End message block + case TEXT_STATE_5: // End message block EnMaYts_ChooseNextDialogue(this, play); break; - case 6: // End conversation + case TEXT_STATE_DONE: // End conversation if (Message_ShouldAdvance(play)) { EnMaYts_SetupStartDialogue(this); } break; - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; } } @@ -505,14 +503,13 @@ s32 EnMaYts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnMaYts* this = THIS; Vec3s sp4; - if (limbIndex == MA1_LIMB_HEAD) { + if (limbIndex == ROMANI_LIMB_HEAD) { sp4 = this->unk_1D8.unk_08; rot->x += sp4.y; - if ((this->skelAnime.animation == &object_ma1_Anim_009E58) || - (this->skelAnime.animation == &object_ma1_Anim_007D98)) { + if ((this->skelAnime.animation == &gRomaniIdleAnim) || (this->skelAnime.animation == &gRomaniSittingAnim)) { rot->z += sp4.x; } - } else if (limbIndex == MA1_LIMB_TORSO) { + } else if (limbIndex == ROMANI_LIMB_TORSO) { sp4 = this->unk_1D8.unk_0E; rot->x += sp4.y; rot->z += sp4.x; @@ -524,12 +521,12 @@ s32 EnMaYts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* void EnMaYts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMaYts* this = THIS; - if (limbIndex == MA1_LIMB_HEAD) { + if (limbIndex == ROMANI_LIMB_HEAD) { Matrix_MultZero(&this->actor.focus.pos); - } else if (limbIndex == MA1_LIMB_HAND_LEFT) { + } else if (limbIndex == ROMANI_LIMB_LEFT_HAND) { if (this->hasBow == true) { OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0003B0); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); CLOSE_DISPS(play->state.gfxCtx); } } @@ -556,7 +553,7 @@ void EnMaYts_DrawSleeping(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_ma1_DL_0043A0); + gSPDisplayList(POLY_OPA_DISP++, gRomaniSleepingDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h index a16a5e5d8..c3da6b71d 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.h @@ -2,38 +2,12 @@ #define Z_EN_MA_YTS_H #include "global.h" +#include "objects/object_ma1/object_ma1.h" struct EnMaYts; typedef void (*EnMaYtsActionFunc)(struct EnMaYts*, PlayState*); -typedef enum { - /* 00 */ MA1_LIMB_NONE, - /* 01 */ MA1_LIMB_ROOT, - /* 02 */ MA1_LIMB_PELVIS, - /* 03 */ MA1_LIMB_TIGHT_LEFT, - /* 04 */ MA1_LIMB_LEG_LEFT, - /* 05 */ MA1_LIMB_FOOT_LEFT, - /* 06 */ MA1_LIMB_TIGHT_RIGHT, - /* 07 */ MA1_LIMB_LEG_RIGHT, - /* 08 */ MA1_LIMB_FOOT_RIGHT, - /* 09 */ MA1_LIMB_DRESS_0, - /* 00 */ MA1_LIMB_DRESS_1, - /* 11 */ MA1_LIMB_DRESS_2, - /* 12 */ MA1_LIMB_DRESS_3, - /* 13 */ MA1_LIMB_TORSO, - /* 14 */ MA1_LIMB_HEAD, - /* 15 */ MA1_LIMB_HAIR_TOP, - /* 16 */ MA1_LIMB_HAIR_BOTTOM, - /* 17 */ MA1_LIMB_ARM_LEFT, - /* 18 */ MA1_LIMB_FOREARM_LEFT, - /* 19 */ MA1_LIMB_HAND_LEFT, - /* 20 */ MA1_LIMB_ARM_RIGHT, - /* 21 */ MA1_LIMB_FOREARM_RIGHT, - /* 22 */ MA1_LIMB_HAND_RIGHT, - /* 23 */ MA1_LIMB_MAX -} ObjectMa1Limbs; - typedef struct EnMaYts { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -41,9 +15,9 @@ typedef struct EnMaYts { /* 0x18C */ ColliderCylinder collider; /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; /* 0x200 */ s32 unk_200; // Set, but not used - /* 0x204 */ Vec3s jointTable[MA1_LIMB_MAX]; + /* 0x204 */ Vec3s jointTable[ROMANI_LIMB_MAX]; /* 0x28E */ char unk_28E[0x6]; - /* 0x294 */ Vec3s morphTable[MA1_LIMB_MAX]; + /* 0x294 */ Vec3s morphTable[ROMANI_LIMB_MAX]; /* 0x31E */ char unk_31E[0x8]; /* 0x326 */ s16 blinkTimer; /* 0x328 */ s16 overrideEyeTexIndex; // If non-zero, then this index will be used instead of eyeTexIndex diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 0581bab41..0e1323e27 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -161,8 +161,8 @@ void EnMag_Init(Actor* thisx, PlayState* play) { gSaveContext.hudModeDimOnlyDisabledButtons = false; this->state = MAG_STATE_FADE_IN_MASK; sInputDelayTimer = 20; - gSaveContext.fadeDuration = 1; - gSaveContext.fadeSpeed = 255; + gSaveContext.transFadeDuration = 1; + gSaveContext.transWipeSpeed = 255; } Font_LoadOrderedFont(&this->font); @@ -245,8 +245,8 @@ void EnMag_Update(Actor* thisx, PlayState* play) { this->unk11F00 = 0; this->unk11F02 = 30; sInputDelayTimer = 20; - gSaveContext.fadeDuration = 1; - gSaveContext.fadeSpeed = 255; + gSaveContext.transFadeDuration = 1; + gSaveContext.transWipeSpeed = 255; } } } else { @@ -381,7 +381,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_START) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { - if (play->transitionTrigger != 0x14) { + if (play->transitionTrigger != TRANS_TRIGGER_START) { Audio_SetCutsceneFlag(false); D_801BB12C++; if (D_801BB12C >= 2) { @@ -389,8 +389,8 @@ void EnMag_Update(Actor* thisx, PlayState* play) { } play_sound(NA_SE_SY_PIECE_OF_HEART); gSaveContext.gameMode = 2; // Go to FileChoose - play->transitionTrigger = 0x14; - play->unk_1887F = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_02; play->nextEntranceIndex = 0x1C00; gSaveContext.save.cutscene = 0; gSaveContext.sceneSetupIndex = 0; diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.h b/src/overlays/actors/ovl_En_Mag/z_en_mag.h index c116ae98d..d55d63ccb 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.h +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.h @@ -9,7 +9,6 @@ typedef struct EnMag { /* 0x00000 */ Actor actor; /* 0x00144 */ UNK_TYPE1 unk144[0x2C]; /* 0x00170 */ Font font; - /* 0x11EFC */ UNK_TYPE1 unk11EFC[4]; /* 0x11F00 */ s16 unk11F00; // Set and not used. /* 0x11F02 */ s16 unk11F02; // Set and not used. /* 0x11F04 */ s16 state; // State of whole actor, uses EnMagState enum diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index e42c36da4..ad8bd2468 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -258,7 +258,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { EnMinifrog_SetJumpState(this); switch (play->msgCtx.currentTextId) { @@ -496,13 +496,13 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { EnMinifrog_TurnToPlayer(this); EnMinifrog_Jump(this); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // Yes func_8019F208(); this->actionFunc = EnMinifrog_BeginChoirCutscene; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; break; case 1: // No func_8019F230(); @@ -511,7 +511,8 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { } } break; - case 5: + + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { EnMinifrog_SetJumpState(this); switch (play->msgCtx.currentTextId) { @@ -530,7 +531,7 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { break; case 0xD77: // "Let us begin our chorus" this->actionFunc = EnMinifrog_BeginChoirCutscene; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; break; case 0xD7C: // "The conducting was spectacular. And all of our members rose to the occasion!" if (gSaveContext.save.weekEventReg[35] & 0x80) { // Obtained Heart Piece @@ -554,6 +555,7 @@ void EnMinifrog_YellowFrogDialog(EnMinifrog* this, PlayState* play) { break; } } + break; } } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 89c1be02e..03dda25ad 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -168,14 +168,14 @@ void func_809596A0(EnMk* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { func_801477B4(play); this->actionFunc = func_80959774; } break; - case 2: + case TEXT_STATE_CLOSING: this->actionFunc = func_80959774; break; } @@ -268,10 +268,10 @@ void func_80959A24(EnMk* this, PlayState* play) { this->unk_27A |= 1; switch (Message_GetState(&play->msgCtx)) { - case 2: + case TEXT_STATE_CLOSING: break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0xFA1: diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 46c53796b..d049bdba0 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -46,15 +46,17 @@ void EnMm2_Destroy(Actor* thisx, PlayState* play) { * Action function whilst Link is reading the letter. */ void EnMm2_Reading(EnMm2* this, PlayState* play) { - u8 talkState = Message_GetState(&play->msgCtx); + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + this->actionFunc = EnMm2_WaitForRead; + } + break; - if (talkState != 2) { - if (talkState == 5 && Message_ShouldAdvance(play)) { - func_801477B4(play); + case TEXT_STATE_CLOSING: this->actionFunc = EnMm2_WaitForRead; - } - } else { - this->actionFunc = EnMm2_WaitForRead; + break; } } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 553e216ba..8b2e44601 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -315,24 +315,24 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { this->unk_2B0 &= ~2; switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: break; - case 3: + case TEXT_STATE_3: this->unk_2B0 |= 2; break; - case 4: + case TEXT_STATE_CHOICE: func_80A6F3B4(this, play); break; - case 5: + case TEXT_STATE_5: func_80A6F5E4(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { if (this->unk_2B4 == 0x2790) { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index f6169b325..0a3573516 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -98,13 +98,13 @@ void EnMs_Wait(EnMs* this, PlayState* play) { void EnMs_Talk(EnMs* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->actionFunc = EnMs_Wait; } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { func_801477B4(play); Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, @@ -113,7 +113,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { } break; - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // yes @@ -140,6 +140,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { } } break; + default: break; } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 7de90998b..c7731230a 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -229,9 +229,9 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { /** * Exits the race and returns the player back to "normal" gameplay. - * Whether the player won or lost the race is determined by arg1 and nextTransition. + * Whether the player won or lost the race is determined by transitionType and nextTransitionType. */ -s32 EnMttag_ExitRace(PlayState* play, s32 arg1, s32 nextTransition) { +s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; play->nextEntranceIndex = 0xD020; if (gSaveContext.save.weekEventReg[33] & 0x80) { @@ -242,9 +242,9 @@ s32 EnMttag_ExitRace(PlayState* play, s32 arg1, s32 nextTransition) { gSaveContext.nextCutsceneIndex = 0; } - play->transitionTrigger = 0x14; - play->unk_1887F = arg1; - gSaveContext.nextTransition = nextTransition; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = transitionType; + gSaveContext.nextTransitionType = nextTransitionType; func_801477B4(play); return 1; } @@ -398,10 +398,10 @@ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) { if (DECR(this->timer) == 0) { if ((gSaveContext.eventInf[1] & 2)) { // Player won - EnMttag_ExitRace(play, 3, 3); + EnMttag_ExitRace(play, TRANS_TYPE_03, TRANS_TYPE_03); } else { // A non-player Goron won - EnMttag_ExitRace(play, 2, 2); + EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02); } Actor_MarkForDeath(&this->actor); @@ -416,7 +416,7 @@ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) { void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (((talkState == 5 && Message_ShouldAdvance(play)) || talkState == 2)) { + if (((talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) || talkState == TEXT_STATE_CLOSING)) { if (this->shouldRestartRace) { play->nextEntranceIndex = 0xD010; @@ -428,9 +428,9 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; } - play->transitionTrigger = 0x14; - play->unk_1887F = 2; - gSaveContext.nextTransition = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_02; + gSaveContext.nextTransitionType = TRANS_TYPE_02; func_801477B4(play); func_800B7298(play, &this->actor, 7); Magic_Add(play, ((void)0, gSaveContext.magicFillTarget) + @@ -442,7 +442,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { gSaveContext.eventInf[1] &= (u8)~8; gSaveContext.eventInf[2] = ((gSaveContext.eventInf[2] & 0xF) + 1) | (gSaveContext.eventInf[2] & 0xF0); } else { - EnMttag_ExitRace(play, 2, 2); + EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02); } Actor_MarkForDeath(&this->actor); } @@ -453,12 +453,12 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { * responded to the Goron Elder's son's question. */ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { // Exit the race func_8019F230(); gSaveContext.timerState[TIMER_ID_4] = TIMER_STATE_OFF; - EnMttag_ExitRace(play, 2, 2); + EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02); gSaveContext.eventInf[1] &= (u8)~8; gSaveContext.eventInf[1] |= 4; Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 159ed6eb0..7011b264d 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -198,7 +198,7 @@ void EnMuto_SetupDialogue(EnMuto* this, PlayState* play) { void EnMuto_InDialogue(EnMuto* this, PlayState* play) { if (!this->isInMayorsRoom) { this->yawTowardsTarget = this->actor.yawTowardsPlayer; - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); if (this->actor.textId == 0x62C) { diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c index 41ae5d99c..5597bf9f6 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c @@ -16,10 +16,10 @@ void EnNnh_Destroy(Actor* thisx, PlayState* play); void EnNnh_Update(Actor* thisx, PlayState* play); void EnNnh_Draw(Actor* thisx, PlayState* play); -void func_80C08828(EnNnh* this); -void func_80C0883C(EnNnh* this, PlayState* play); -void func_80C088A4(EnNnh* this); -void func_80C088B8(EnNnh* this, PlayState* play); +void EnNnh_SetupWaitForDialogue(EnNnh* this); +void EnNnh_WaitForDialogue(EnNnh* this, PlayState* play); +void EnNnh_SetupDialogue(EnNnh* this); +void EnNnh_Dialogue(EnNnh* this, PlayState* play); const ActorInit En_Nnh_InitVars = { ACTOR_EN_NNH, @@ -62,7 +62,7 @@ void EnNnh_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 1; this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; - func_80C08828(this); + EnNnh_SetupWaitForDialogue(this); } void EnNnh_Destroy(Actor* thisx, PlayState* play) { @@ -71,26 +71,26 @@ void EnNnh_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80C08828(EnNnh* this) { - this->actionFunc = func_80C0883C; +void EnNnh_SetupWaitForDialogue(EnNnh* this) { + this->actionFunc = EnNnh_WaitForDialogue; } -void func_80C0883C(EnNnh* this, PlayState* play) { +void EnNnh_WaitForDialogue(EnNnh* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x228, &this->actor); - func_80C088A4(this); - return; + EnNnh_SetupDialogue(this); + } else { + func_800B8614(&this->actor, play, 100.0f); } - func_800B8614(&this->actor, play, 100.0f); } -void func_80C088A4(EnNnh* this) { - this->actionFunc = func_80C088B8; +void EnNnh_SetupDialogue(EnNnh* this) { + this->actionFunc = EnNnh_Dialogue; } -void func_80C088B8(EnNnh* this, PlayState* play) { +void EnNnh_Dialogue(EnNnh* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80C08828(this); + EnNnh_SetupWaitForDialogue(this); } } @@ -109,5 +109,5 @@ void EnNnh_Draw(Actor* thisx, PlayState* play) { func_8012C28C(gfxCtx); gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, object_nnh_DL_001510); + gSPDisplayList(gfxCtx->polyOpa.p++, gButlerSonMainBodyDL); } 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 426951a9c..ae3b3f04c 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 @@ -5,6 +5,7 @@ */ #include "z_en_okarina_effect.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000) @@ -57,8 +58,8 @@ void func_8096B104(EnOkarinaEffect* this, PlayState* play) { void func_8096B174(EnOkarinaEffect* this, PlayState* play) { DECR(this->unk144); - if (!play->pauseCtx.state && !play->gameOverCtx.state && !play->msgCtx.unk11F10 && - !FrameAdvance_IsEnabled(&play->state) && this->unk144 == 0) { + if ((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->msgCtx.msgLength == 0) && !FrameAdvance_IsEnabled(&play->state) && (this->unk144 == 0)) { EnOkarinaEffect_SetupAction(this, func_8096B1FC); } } @@ -66,7 +67,7 @@ void func_8096B174(EnOkarinaEffect* this, PlayState* play) { void func_8096B1FC(EnOkarinaEffect* this, PlayState* play) { if (play->envCtx.unk_F2[4]) { if ((play->state.frames & 3) == 0) { - --play->envCtx.unk_F2[4]; + play->envCtx.unk_F2[4]--; if (play->envCtx.unk_F2[4] == 8) { func_800FD858(play); } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 23f7640a2..40cb4ba24 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -17,7 +17,6 @@ void EnOkarinaTag_Update(Actor* thisx, PlayState* play); void func_8093E518(EnOkarinaTag* this, PlayState* play); void func_8093E68C(EnOkarinaTag* this, PlayState* play); -#if 0 const ActorInit En_Okarina_Tag_InitVars = { ACTOR_EN_OKARINA_TAG, ACTORCAT_SWITCH, @@ -30,14 +29,122 @@ const ActorInit En_Okarina_Tag_InitVars = { (ActorFunc)NULL, }; -#endif +void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Destroy.s") +void EnOkarinaTag_Init(Actor* thisx, PlayState* play) { + EnOkarinaTag* this = THIS; + f32 zRot = 0.0f; + s32 i = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Init.s") + this->actor.flags &= ~ACTOR_FLAG_1; + this->unk148 = ENOKARINATAG_GET_F800(thisx); + this->unk14A = ENOKARINATAG_GET_780(thisx); + this->switchFlags = ENOKARINATAG_GET_SWITCHFLAGS(thisx); + if (this->actor.world.rot.z > 0) { + zRot = this->actor.world.rot.z; + while (zRot > 10.0f) { + zRot -= 10.0f; + i++; + } + } + this->unk154 = zRot * 50.0f; + this->unk158 = i * 50.0f; + if (this->switchFlags == 0x7F) { + this->switchFlags = -1; + } + if (this->unk14A == 0xF) { + this->unk14A = -1; + } + this->actor.targetMode = 1; + this->actionFunc = func_8093E518; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/func_8093E518.s") +void func_8093E518(EnOkarinaTag* this, PlayState* play) { + f32 xzRange; + f32 yRange; + s16 yDiff; + u16 var_v1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/func_8093E68C.s") + if (this->switchFlags >= 0) { + if (this->unk148 == 0) { + if (Flags_GetSwitch(play, this->switchFlags)) { + return; + } + } + if (this->unk148 == 1) { + if (!Flags_GetSwitch(play, this->switchFlags)) { + return; + } + } + } + var_v1 = this->unk14A; + if (var_v1 == 6) { + var_v1 = 0xA; + if (gSaveContext.save.unk_F65 == 0) { + return; + } + } + if (this->unk14A == -1) { + var_v1 = 0; + } + if (func_800B8718(&this->actor, &play->state)) { + func_80152434(play, var_v1 + 0x29); + this->actionFunc = func_8093E68C; + } else { + yDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)); + if (yDiff >= 0x4300) { + this->unk150 = 0; + return; + } + xzRange = this->unk154; + this->unk150 = 1; + if (xzRange == 0.0f) { + xzRange = 50000.0f; + } + yRange = this->unk158; + if (yRange == 0.0f) { + yRange = 50000.0f; + } + func_800B874C(&this->actor, play, xzRange, yRange); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Update.s") +void func_8093E68C(EnOkarinaTag* this, PlayState* play) { + if (play->msgCtx.ocarinaMode == 4) { + this->actionFunc = func_8093E518; + } else { + if ((play->msgCtx.ocarinaMode == 3) || + ((this->unk14A == -1) && + ((play->msgCtx.ocarinaMode == 5) || (play->msgCtx.ocarinaMode == 6) || (play->msgCtx.ocarinaMode == 7) || + (play->msgCtx.ocarinaMode == 8) || (play->msgCtx.ocarinaMode == 0xA) || (play->msgCtx.ocarinaMode == 9) || + (play->msgCtx.ocarinaMode == 0xF)))) { + if (this->switchFlags >= 0) { + switch (this->unk148) { + case 0: + Flags_SetSwitch(play, this->switchFlags); + break; + case 1: + Flags_UnsetSwitch(play, this->switchFlags); + break; + case 2: + if (Flags_GetSwitch(play, this->switchFlags)) { + Flags_UnsetSwitch(play, this->switchFlags); + } else { + Flags_SetSwitch(play, this->switchFlags); + } + break; + } + } + play->msgCtx.ocarinaMode = 4; + play_sound(NA_SE_SY_CORRECT_CHIME); + this->actionFunc = func_8093E518; + } + } +} + +void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { + EnOkarinaTag* this = THIS; + + this->actionFunc(this, play); +} diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 6825adb4d..8dd51805c 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -7,10 +7,19 @@ struct EnOkarinaTag; typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*); +#define ENOKARINATAG_GET_SWITCHFLAGS(thisx) (((thisx)->params & 0x7F)) +#define ENOKARINATAG_GET_780(thisx) (((thisx)->params >> 0x7) & 0xF) +#define ENOKARINATAG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F) + typedef struct EnOkarinaTag { /* 0x000 */ Actor actor; /* 0x144 */ EnOkarinaTagActionFunc actionFunc; - /* 0x148 */ char unk_148[0x14]; + /* 0x148 */ s16 unk148; + /* 0x14A */ s16 unk14A; + /* 0x14C */ s32 switchFlags; + /* 0x150 */ s8 unk150; + /* 0x154 */ f32 unk154; + /* 0x158 */ f32 unk158; } EnOkarinaTag; // size = 0x15C extern const ActorInit En_Okarina_Tag_InitVars; diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index 095dbfaa9..59b3140bc 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -102,7 +102,7 @@ void func_80B11F78(EnOnpuman* this, PlayState* play) { void func_80B1202C(EnOnpuman* this, PlayState* play2) { PlayState* play = play2; - if ((Message_GetState(&play->msgCtx) == 5) && (Message_ShouldAdvance(play))) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && (Message_ShouldAdvance(play))) { switch (play->msgCtx.currentTextId) { case 0x8D4: this->unk_2A4 |= 1; @@ -138,7 +138,7 @@ void func_80B1202C(EnOnpuman* this, PlayState* play2) { } void func_80B1217C(EnOnpuman* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && (Message_ShouldAdvance(play))) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && (Message_ShouldAdvance(play))) { this->actionFunc = func_80B121D8; func_801477B4(play); } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index 4817091b7..445787abe 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -759,13 +759,13 @@ void func_80AD16A8(EnOsn* this, PlayState* play) { } void func_80AD19A0(EnOsn* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if ((temp_v0 == 6 || temp_v0 == 5) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_DONE) || (talkState == TEXT_STATE_5)) && Message_ShouldAdvance(play)) { if (this->unk_1EA & 0x20) { this->unk_1EA &= ~0x20; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80AD14C8; } else { func_80AD10FC(this, play); diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 68a097ea9..2c7e4f06a 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -301,7 +301,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; @@ -563,7 +563,7 @@ void EnOssan_Hello(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); EnOssan_RotateHead(this, play); - if (talkState == 5 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if ((this->animationIndex == ANI_ANIMATION_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { this->animationIndex = ANI_ANIMATION_STANDING_NORMAL_LOOP_2; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 1); @@ -580,7 +580,7 @@ void EnOssan_Hello(EnOssan* this, PlayState* play) { return; } } - if ((talkState == 10) && (this->actor.params == ENOSSAN_PART_TIME_WORKER) && + if ((talkState == TEXT_STATE_10) && (this->actor.params == ENOSSAN_PART_TIME_WORKER) && (player->transformation == PLAYER_FORM_ZORA) && Message_ShouldAdvance(play)) { this->animationIndex = ANI_ANIMATION_APOLOGY_LOOP; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, ANI_ANIMATION_APOLOGY_LOOP); @@ -629,7 +629,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state)) && (!Message_ShouldAdvance(play) || !EnOssan_FacingShopkeeperDialogResult(this, play))) { @@ -665,7 +665,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_TalkToShopkeeper(EnOssan* this, PlayState* play) { AnimationInfoS* animations = sAnimations[this->actor.params]; - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if ((this->animationIndex == ANI_ANIMATION_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { this->animationIndex = ANI_ANIMATION_STANDING_NORMAL_LOOP_2; SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 1); @@ -852,7 +852,7 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) { this->drawCursor = 0xFF; this->stickRightPrompt.isEnabled = true; EnOssan_UpdateCursorPos(play, this); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal) { @@ -910,7 +910,7 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; EnOssan_UpdateCursorPos(play, this); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { if (this->moveHorizontal != 0) { @@ -983,7 +983,7 @@ void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; @@ -1051,7 +1051,7 @@ void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { void EnOssan_SelectItem(EnOssan* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (EnOssan_TakeItemOffShelf(this) && talkState == 4) { + if (EnOssan_TakeItemOffShelf(this) && (talkState == TEXT_STATE_CHOICE)) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnOssan_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { @@ -1069,7 +1069,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) { } void EnOssan_CannotBuy(EnOssan* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; func_80151938(play, this->items[this->cursorIdx]->actor.textId); } @@ -1078,7 +1078,7 @@ void EnOssan_CannotBuy(EnOssan* this, PlayState* play) { void EnOssan_CanBuy(EnOssan* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; @@ -1098,9 +1098,9 @@ void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) { } void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; EnOssan_SetupAction(this, EnOssan_ItemPurchased); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1118,7 +1118,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); EnGirlA* item; - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); @@ -1142,7 +1142,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { } } } - } else if (talkState == 5 && Message_ShouldAdvance(play)) { + } else if (talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) { EnOssan_ResetItemPosition(this); item = this->items[this->cursorIdx]; item->restockFunc(play, item); 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 e708b22af..ad10226ed 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -377,12 +377,12 @@ void func_80B5BFB8(EnOt* this, PlayState* play) { void func_80B5C154(EnOt* this, PlayState* play) { if (gSaveContext.save.weekEventReg[32] & 1) { - this->unk_38C = GI_RUPEE_RED; + this->getItemId = GI_RUPEE_RED; } else { - this->unk_38C = GI_HEART_PIECE; + this->getItemId = GI_HEART_PIECE; gSaveContext.save.weekEventReg[32] |= 1; } - Actor_PickUp(&this->actor, play, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; } @@ -392,7 +392,7 @@ void func_80B5C1CC(EnOt* this, PlayState* play) { func_80B5C244(this, play); func_80B5C244(this->unk_360, play); } else { - Actor_PickUp(&this->actor, play, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_PickUp(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } @@ -644,7 +644,7 @@ void func_80B5CD40(EnOt* this, PlayState* play) { s32 temp; switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: temp = Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -655,14 +655,14 @@ void func_80B5CD40(EnOt* this, PlayState* play) { } break; - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1069)) { this->unk_32C |= 4; ActorCutscene_Stop(this->cutscenes[0]); @@ -740,10 +740,10 @@ void func_80B5D160(EnOt* this, PlayState* play) { s32 temp; switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: temp = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; - if (!temp) { + if (temp == 0) { switch (this->unk_384) { case 0: if ((this->unk_33C != 1) && (this->unk_33C == 2)) { @@ -778,14 +778,14 @@ void func_80B5D160(EnOt* this, PlayState* play) { } break; - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { default: diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.h b/src/overlays/actors/ovl_En_Ot/z_en_ot.h index 6f4bf2105..e123b8871 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -52,7 +52,7 @@ typedef struct EnOt { /* 0x378 */ Vec3f unk_378; /* 0x384 */ u8 unk_384; /* 0x388 */ s32 unk_388; - /* 0x38C */ s32 unk_38C; + /* 0x38C */ s32 getItemId; /* 0x390 */ s16 unk_390; /* 0x394 */ Vec3f unk_394; /* 0x3A0 */ s16 unk_3A0; 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 99dd2c0b3..6b9bce5ab 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -324,7 +324,7 @@ void func_8095ACEC(EnOwl* this) { } void func_8095AD54(EnOwl* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case OWL_REPEAT: func_80151938(play, 0x7D1); @@ -340,14 +340,14 @@ void func_8095AD54(EnOwl* this, PlayState* play) { } void func_8095AE00(EnOwl* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_80151938(play, 0x7D2); this->actionFunc = func_8095AD54; } } void func_8095AE60(EnOwl* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_80151938(play, 0x7D1); this->actionFunc = func_8095AE00; } @@ -363,7 +363,7 @@ void func_8095AEC0(EnOwl* this, PlayState* play) { void func_8095AF2C(EnOwl* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { if (play->msgCtx.currentTextId == 0xBFE) { func_8095ACEC(this); @@ -375,7 +375,7 @@ void func_8095AF2C(EnOwl* this, PlayState* play) { } break; - case 6: + case TEXT_STATE_DONE: func_8095ACEC(this); this->actionFunc = func_8095ABF0; break; @@ -606,7 +606,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { func_8095A920(this, play); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0xBEC: @@ -645,7 +645,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0xBEA: diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 6c5433b78..603d08fb5 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -5,9 +5,8 @@ */ #include "z_en_pamera.h" -#include "../ovl_En_Bom/z_en_bom.h" -#include "../ovl_En_Door/z_en_door.h" -#include "objects/object_pamera/object_pamera.h" +#include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "overlays/actors/ovl_En_Door/z_en_door.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -136,8 +135,8 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { Vec3f sp44; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_pamera_Skel_008448, &object_pamera_Anim_0005BC, this->jointTable, - this->morphTable, PAMERA_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gPamelaSkel, &object_pamera_Anim_0005BC, this->jointTable, + this->morphTable, PAMELA_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit2); @@ -241,7 +240,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 1800) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0]) && (this->cutscenes[0] != -1)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->cutscenes[0])), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[0])), &this->actor); this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); @@ -428,7 +427,7 @@ void func_80BD90AC(EnPamera* this, PlayState* play) { (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { if ((ActorCutscene_GetCanPlayNext(this->cutscenes[1])) && ((this->cutscenes[1] != -1))) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(this->cutscenes[1])), + Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[1])), &this->actor); EnPamera_LookDownWell(this); } else if (this->cutscenes[1] != -1) { @@ -511,9 +510,9 @@ void func_80BD94E0(EnPamera* this, PlayState* play) { if ((this->actionFunc != func_80BD8B70) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD909C) && (this->actionFunc != func_80BD8D1C) && ((this->actionFunc != func_80BD8DB0) || (this->actor.speedXZ == 3.0f))) { - Actor_TrackPlayer(play, &this->actor, &this->limb9Rot, &this->limb8Rot, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Actor_TrackNone(&this->limb9Rot, &this->limb8Rot); + Actor_TrackNone(&this->headRot, &this->torsoRot); } } @@ -534,9 +533,9 @@ void EnPamera_Update(Actor* thisx, PlayState* play) { s32 EnPamera_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPamera* this = THIS; - if (limbIndex == PAMERA_LIMB_HAIR) { - rot->x += this->limb9Rot.y; - rot->z += this->limb9Rot.x; + if (limbIndex == PAMELA_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; } return false; } @@ -544,7 +543,7 @@ s32 EnPamera_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f void EnPamera_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnPamera* this = THIS; - if (limbIndex == PAMERA_LIMB_HAIR) { + if (limbIndex == PAMELA_LIMB_HEAD) { Matrix_MultVec3f(&D_80BDA5F0, &this->actor.focus.pos); } } @@ -628,20 +627,23 @@ void func_80BD9A9C(EnPamera* this) { void EnPamera_HandleDialogue(EnPamera* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; - case 5: + + case TEXT_STATE_5: func_80BD9B4C(this, play); break; - case 6: + + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80BD9938(this); } break; + default: break; } @@ -683,9 +685,9 @@ void func_80BD9B4C(EnPamera* this, PlayState* play) { void func_80BD9C70(EnPamera* this, PlayState* play) { play->nextEntranceIndex = 0x2020; - play->transitionTrigger = 0x14; - play->unk_1887F = 0x46; - gSaveContext.nextTransition = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_70; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } s32 func_80BD9CB8(EnPamera* this, PlayState* play) { @@ -855,7 +857,7 @@ void func_80BDA344(Actor* thisx, PlayState* play) { if (!(gSaveContext.save.weekEventReg[61] & 4)) { gSaveContext.save.weekEventReg[61] |= 4; } - Actor_TrackNone(&this->limb9Rot, &this->limb8Rot); + Actor_TrackNone(&this->headRot, &this->torsoRot); } else { func_80BD94E0(this, play); if (this->actionFunc == func_80BD994C) { diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h index 0cebc213f..cf5611c4e 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h @@ -2,36 +2,10 @@ #define Z_EN_PAMERA_H #include "global.h" +#include "objects/object_pamera/object_pamera.h" struct EnPamera; -typedef enum { - /* 00 */ PAMERA_LIMB_NONE, - /* 01 */ PAMERA_LIMB_ROOT, - /* 02 */ PAMERA_LIMB_SHOULDER_LEFT, - /* 03 */ PAMERA_LIMB_FOREARM_LEFT, - /* 04 */ PAMERA_LIMB_HAND_LEFT, - /* 05 */ PAMERA_LIMB_SHOULDER_RIGHT, - /* 06 */ PAMERA_LIMB_FOREARM_RIGHT, - /* 07 */ PAMERA_LIMB_HAND_RIGHT, - /* 08 */ PAMERA_LIMB_HEAD_FRONT_AND_TOP, - /* 09 */ PAMERA_LIMB_HAIR, - /* 10 */ PAMERA_LIMB_TORSO_FRONT, - /* 11 */ PAMERA_LIMB_NECK, - /* 12 */ PAMERA_LIMB_THIGH_LEFT, - /* 13 */ PAMERA_LIMB_LEG_LEFT, - /* 14 */ PAMERA_LIMB_FOOT_LEFT, - /* 15 */ PAMERA_LIMB_THIGH_RIGHT, - /* 16 */ PAMERA_LIMB_LEG_RIGHT, - /* 17 */ PAMERA_LIMB_FOOT_RIGHT, - /* 18 */ PAMERA_DRESS_FRONT, - /* 19 */ PAMERA_DRESS_BACK, - /* 20 */ PAMERA_DRESS_SIDES, - /* 21 */ PAMERA_LIMB_UNK, - /* 22 */ PAMERA_LIMB_UNK2, - /* 23 */ PAMERA_LIMB_MAX -} ObjectPameraLimbs; - typedef void (*EnPameraActionFunc)(struct EnPamera*, PlayState*); typedef void (*EnPameraSetupFunc)(struct EnPamera*, PlayState*); @@ -46,10 +20,10 @@ typedef struct EnPamera { /* 0x1E4 */ s32 pathPointsCount; /* 0x1E8 */ s32 pathId; /* 0x1EC */ s32 unk_1EC; - /* 0x1F0 */ Vec3s jointTable[PAMERA_LIMB_MAX]; - /* 0x27A */ Vec3s morphTable[PAMERA_LIMB_MAX]; - /* 0x304 */ Vec3s limb9Rot; - /* 0x30A */ Vec3s limb8Rot; + /* 0x1F0 */ Vec3s jointTable[PAMELA_LIMB_MAX]; + /* 0x27A */ Vec3s morphTable[PAMELA_LIMB_MAX]; + /* 0x304 */ Vec3s headRot; + /* 0x30A */ Vec3s torsoRot; // Set, but not used /* 0x310 */ s16 unk_310; /* 0x312 */ s16 unk_312; /* 0x314 */ s16 unk_314; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 77cf49acc..420d40b78 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -8,7 +8,6 @@ #include "z64rumble.h" #include "overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_bigslime/object_bigslime.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -339,10 +338,10 @@ void EnPametfrog_ShakeCamera(EnPametfrog* this, PlayState* play, f32 magShakeXZ, void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { Camera* subCam; - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); - this->subCamId = CAM_ID_MAIN; + this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); func_800B724C(play, &this->actor, 6); } @@ -827,7 +826,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); this->actor.world.pos.x += 30.0f * Math_SinS(yaw); this->actor.world.pos.z += 30.0f * Math_CosS(yaw); - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { xzDist = sqrtf(SQXZ(this->unk_2DC)); if (xzDist > 0.001f) { xzDist = 200.0f / xzDist; @@ -857,7 +856,7 @@ void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { } } else { this->spinYaw += 0xF00; - if (this->subCamId != CAM_ID_MAIN) { + if (this->subCamId != SUB_CAM_ID_DONE) { Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &Play_GetCamera(play, this->subCamId)->eye); } @@ -1006,7 +1005,7 @@ void EnPametfrog_SetupCutscene(EnPametfrog* this) { void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentCamera(this->cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->cutscene); func_800B724C(play, &this->actor, 7); if (this->actor.colChkInfo.health == 0) { if (this->actor.params == GEKKO_PRE_SNAPPER) { @@ -1370,16 +1369,16 @@ void EnPametfrog_Update(Actor* thisx, PlayState* play) { /* value -1: Limb Not used * value 0: GEKKO_LIMB_WAIST - * value 1: GEKKO_LIMB_L_SHIN - * value 2: GEKKO_LIMB_L_FOOT - * value 3: GEKKO_LIMB_R_SHIN - * value 4: GEKKO_LIMB_R_FOOT - * value 5: GEKKO_LIMB_L_UPPER_ARM - * value 6: GEKKO_LIMB_L_FOREARM - * value 7: GEKKO_LIMB_L_HAND - * value 8: GEKKO_LIMB_R_UPPER_ARM - * value 9: GEKKO_LIMB_R_FOREARM - * value 10: GEKKO_LIMB_R_HAND + * value 1: GEKKO_LIMB_LEFT_SHIN + * value 2: GEKKO_LIMB_LEFT_FOOT + * value 3: GEKKO_LIMB_RIGHT_SHIN + * value 4: GEKKO_LIMB_RIGHT_FOOT + * value 5: GEKKO_LIMB_LEFT_UPPER_ARM + * value 6: GEKKO_LIMB_LEFT_FOREARM + * value 7: GEKKO_LIMB_LEFT_HAND + * value 8: GEKKO_LIMB_RIGHT_UPPER_ARM + * value 9: GEKKO_LIMB_RIGHT_FOREARM + * value 10: GEKKO_LIMB_RIGHT_HAND * value 11: GEKKO_LIMB_JAW */ static s8 limbPosIndex[] = { diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 2b5626109..3f3e82165 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -2,6 +2,7 @@ #define Z_EN_PAMETFROG_H #include "global.h" +#include "objects/object_bigslime/object_bigslime.h" struct EnPametfrog; @@ -20,34 +21,6 @@ typedef enum { /* 0x9 */ GEKKO_DEFEAT, } EnPametfrogState; -typedef enum { - /* 0x00 */ GEKKO_LIMB_NONE, - /* 0x01 */ GEKKO_LIMB_ROOT, - /* 0x02 */ GEKKO_LIMB_WAIST, - /* 0x03 */ GEKKO_LIMB_L_THIGH, - /* 0x04 */ GEKKO_LIMB_L_SHIN, - /* 0x05 */ GEKKO_LIMB_L_ANKLE, - /* 0x06 */ GEKKO_LIMB_L_FOOT, - /* 0x07 */ GEKKO_LIMB_R_THIGH, - /* 0x08 */ GEKKO_LIMB_R_SHIN, - /* 0x09 */ GEKKO_LIMB_R_ANKLE, - /* 0x0A */ GEKKO_LIMB_R_FOOT, - /* 0x0B */ GEKKO_LIMB_TORSO, - /* 0x0C */ GEKKO_LIMB_L_UPPER_ARM, - /* 0x0D */ GEKKO_LIMB_L_FOREARM, - /* 0x0E */ GEKKO_LIMB_L_WRIST, - /* 0x0F */ GEKKO_LIMB_L_HAND, - /* 0x10 */ GEKKO_LIMB_R_UPPER_ARM, - /* 0x11 */ GEKKO_LIMB_R_FOREARM, - /* 0x12 */ GEKKO_LIMB_R_WRIST, - /* 0x13 */ GEKKO_LIMB_R_HAND, - /* 0x14 */ GEKKO_LIMB_HEAD, - /* 0x15 */ GEKKO_LIMB_JAW, - /* 0x16 */ GEKKO_LIMB_L_EYE, - /* 0x17 */ GEKKO_LIMB_R_EYE, - /* 0x18 */ GEKKO_LIMB_MAX, -} EnPametfrogLimb; - typedef struct EnPametfrog { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; 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 b5e4f95a6..e1eadb5cf 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -833,7 +833,7 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { case 4: case 6: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); } this->unk_378++; ret = true; @@ -845,7 +845,7 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { if ((gSaveContext.save.weekEventReg[86] & 8) && (this->unk_378 == 3)) { ActorCutscene_Stop(sp2A); } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); } this->unk_378++; ret = true; @@ -875,7 +875,7 @@ s32 func_80AF8348(EnPm* this, PlayState* play) { case 4: case 6: case 8: - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); this->unk_378++; ret = true; break; @@ -885,7 +885,7 @@ s32 func_80AF8348(EnPm* this, PlayState* play) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); } this->unk_378++; ret = true; @@ -1132,11 +1132,11 @@ void func_80AF8BA8(s32 arg0) { void func_80AF8C68(EnPm* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp28 = Message_GetState(&play->msgCtx); - u16 temp_a0 = play->msgCtx.currentTextId; + s32 talkState = Message_GetState(&play->msgCtx); + u16 textId = play->msgCtx.currentTextId; - if ((player->targetActor == &this->actor) && ((temp_a0 < 255) || (temp_a0 > 512)) && (sp28 == 3) && - (this->unk_388 == 3)) { + if ((player->targetActor == &this->actor) && ((textId < 0xFF) || (textId > 0x200)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3)) { if ((play->state.frames % 3) == 0) { if (this->unk_360 == 120.0f) { this->unk_360 = 0.0f; @@ -1149,7 +1149,7 @@ void func_80AF8C68(EnPm* this, PlayState* play) { } Math_SmoothStepToF(&this->unk_364, this->unk_360, 0.8f, 40.0f, 10.0f); Matrix_Translate(this->unk_364, 0.0f, 0.0f, MTXMODE_APPLY); - this->unk_388 = sp28; + this->prevTalkState = talkState; } s32 func_80AF8D84(EnPm* this, PlayState* play) { @@ -1167,20 +1167,20 @@ s32 func_80AF8D84(EnPm* this, PlayState* play) { s32 func_80AF8DD4(EnPm* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 temp = play->msgCtx.currentTextId; + u16 textId = play->msgCtx.currentTextId; s32 pad; if (player->stateFlags1 & (0x400 | 0x40)) { this->unk_356 |= 0x400; - if (this->unk_358 != temp) { + if (this->unk_358 != textId) { if ((this->unk_384 == 0) || (this->unk_384 == 1)) { func_80AF7E98(this, 7); } - if ((temp == 0x277C) || (temp == 0x277D)) { + if ((textId == 0x277C) || (textId == 0x277D)) { func_80AF7E98(this, 10); } } - this->unk_358 = temp; + this->unk_358 = textId; } else { if (this->unk_356 & 0x400) { this->unk_358 = 0; @@ -1196,7 +1196,7 @@ s32 func_80AF8DD4(EnPm* this, PlayState* play) { return 0; } -s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat, s16 actorId) { +s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCat, s16 actorId) { u8 sp4F = this->actor.params & 0xFF; Vec3s* sp48; Vec3f sp3C; @@ -1207,8 +1207,8 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat this->timePath = NULL; sp2C = func_80AF7CB0(this, play, actorCat, actorId); - if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]); + if (D_80AFB430[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -1226,7 +1226,7 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat return ret; } -s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; u8 sp55 = this->actor.params & 0xFF; EnDoor* door; @@ -1237,9 +1237,9 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - door = func_80AF7D60(play, arg2->result); - if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[arg2->result]); + door = func_80AF7D60(play, scheduleOutput->result); + if (D_80AFB430[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[scheduleOutput->result]); } if ((door != NULL) && (door->dyna.actor.update != NULL)) { @@ -1258,8 +1258,8 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) { this->unk_260 = 0x4B; } - this->unk_36C = arg2->time1 - arg2->time0; - this->unk_36E = sp56 - arg2->time0; + this->unk_36C = scheduleOutput->time1 - scheduleOutput->time0; + this->unk_36E = sp56 - scheduleOutput->time0; this->actor.flags &= ~ACTOR_FLAG_1; if (gSaveContext.save.weekEventReg[90] & 8) { this->unk_356 |= 0x800; @@ -1274,17 +1274,18 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; u8 sp2B = this->actor.params & 0xFF; - s32 pad; + u16 tmp; + s16 pad; s32 ret = false; this->timePath = NULL; - if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[arg2->result]); + if (D_80AFB430[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1295,18 +1296,18 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { if ((this->unk_258 < 38) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) { phi_v1 = sp2E; } else { - phi_v1 = arg2->time0; + phi_v1 = scheduleOutput->time0; } - if (arg2->time1 < phi_v1) { - this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF; + if (scheduleOutput->time1 < phi_v1) { + this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF; } else { - this->timePathTotalTime = arg2->time1 - phi_v1; + this->timePathTotalTime = scheduleOutput->time1 - phi_v1; } this->timePathElapsedTime = sp2E - phi_v1; - phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); - this->timePathWaypointTime = this->timePathTotalTime / phi_v1; + tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + this->timePathWaypointTime = this->timePathTotalTime / tmp; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk_356 &= ~8; @@ -1316,7 +1317,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { Flags_UnsetSwitch(play, 0); } - switch (arg2->result) { + switch (scheduleOutput->result) { case 83: case 84: case 85: @@ -1355,7 +1356,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u8 sp4F = this->actor.params & 0xFF; Vec3f sp40; Vec3f sp34; @@ -1364,8 +1365,8 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; this->timePath = NULL; - if (D_80AFB430[arg2->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]); + if (D_80AFB430[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -1376,7 +1377,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) { Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); Math_Vec3f_Copy(&this->actor.world.pos, &sp40); Math_Vec3f_Copy(&this->actor.prevPos, &sp40); - if (arg2->result == 24) { + if (scheduleOutput->result == 24) { Flags_UnsetSwitch(play, 0); Flags_UnsetSwitch(play, 1); this->unk_394 = EXCH_ITEM_NONE; @@ -1388,7 +1389,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u8 sp4F = this->actor.params & 0xFF; Vec3f sp40; Vec3f sp34; @@ -1397,13 +1398,13 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 ret = false; s32 phi_a3 = -1; - switch (arg2->result) { + switch (scheduleOutput->result) { case 3: case 4: case 5: case 6: case 7: - phi_a3 = arg2->result - 3; + phi_a3 = scheduleOutput->result - 3; break; case 19: @@ -1416,7 +1417,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { } this->timePath = NULL; - phi_a3 = D_80AFB430[arg2->result]; + phi_a3 = D_80AFB430[scheduleOutput->result]; if (phi_a3 >= 0) { this->timePath = SubS_GetAdditionalPath(play, sp4F, phi_a3); } @@ -1430,7 +1431,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { Math_Vec3f_Copy(&this->actor.world.pos, &sp40); Math_Vec3f_Copy(&this->actor.prevPos, &sp40); - switch (arg2->result) { + switch (scheduleOutput->result) { case 27: Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_SetSwitch(play, 0); @@ -1462,7 +1463,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { gSaveContext.save.weekEventReg[60] |= 4; default: - if (arg2->result == 0x1D) { + if (scheduleOutput->result == 29) { this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y); } SubS_UpdateFlags(&this->unk_356, 3, 7); @@ -1475,7 +1476,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MM3, 116.0f, 26.0f, -219.0f, 0, -0x3F46, 0, @@ -1486,7 +1487,7 @@ s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { static Vec3f D_80AFB8EC = { 116.0f, 26.0f, -219.0f }; static Vec3s D_80AFB8F8 = { 0x0000, 0xC0BA, 0x0000 }; s32 pad; @@ -1498,7 +1499,7 @@ s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) { this->actor.targetMode = 6; this->actor.gravity = -1.0f; this->unk_368 = 80.0f; - if (arg2->result == 14) { + if (scheduleOutput->result == 14) { this->unk_356 &= ~0x200; func_80AF7E98(this, 13); } else { @@ -1508,10 +1509,10 @@ s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { + if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; @@ -1526,10 +1527,10 @@ s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TEST3)) { + if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TEST3)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; @@ -1544,10 +1545,10 @@ s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AL)) { + if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AL)) { SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x9000; this->unk_356 |= 0x20; @@ -1562,7 +1563,7 @@ s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; this->actor.flags |= ACTOR_FLAG_1; @@ -1571,25 +1572,25 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { this->unk_356 = 0; this->unk_368 = 40.0f; - switch (arg2->result) { + switch (scheduleOutput->result) { case 16: - ret = func_80AF9A0C(this, play, arg2); + ret = func_80AF9A0C(this, play, scheduleOutput); break; case 17: - ret = func_80AF9AB0(this, play, arg2); + ret = func_80AF9AB0(this, play, scheduleOutput); break; case 28: - ret = func_80AF9B54(this, play, arg2); + ret = func_80AF9B54(this, play, scheduleOutput); break; case 24: - ret = func_80AF94AC(this, play, arg2); + ret = func_80AF94AC(this, play, scheduleOutput); break; case 29: - ret = func_80AF95E8(this, play, arg2); + ret = func_80AF95E8(this, play, scheduleOutput); break; case 1: @@ -1604,7 +1605,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { case 35: case 36: case 37: - ret = func_80AF9008(this, play, arg2); + ret = func_80AF9008(this, play, scheduleOutput); break; case 3: @@ -1617,11 +1618,11 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { case 23: case 25: case 27: - ret = func_80AF95E8(this, play, arg2); + ret = func_80AF95E8(this, play, scheduleOutput); break; case 8: - ret = func_80AF98A0(this, play, arg2); + ret = func_80AF98A0(this, play, scheduleOutput); break; case 9: @@ -1629,7 +1630,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { case 20: case 21: case 22: - ret = func_80AF992C(this, play, arg2); + ret = func_80AF992C(this, play, scheduleOutput); break; case 38: @@ -1686,7 +1687,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { case 89: case 90: case 91: - ret = func_80AF91E8(this, play, arg2); + ret = func_80AF91E8(this, play, scheduleOutput); break; default: @@ -1699,7 +1700,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) { s32 func_80AF9D04(EnPm* this, PlayState* play) { EnDoor* door = (EnDoor*)func_80AF7D60(play, this->unk_258); Vec3f sp38; - Vec3f* sp28; + s32 pad; f32 temp; if (!SubS_InCsMode(play) && (this->timePathTimeSpeed != 0)) { @@ -1988,7 +1989,7 @@ void func_80AFA4D0(EnPm* this, PlayState* play) { }; u16 time = gSaveContext.save.time; u16 sp3C = 0; - ScheduleResult sp2C; + ScheduleOutput sp2C; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); if (this->unk_38C != 0) { diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.h b/src/overlays/actors/ovl_En_Pm/z_en_pm.h index 4de822535..de7359d93 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.h +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.h @@ -50,12 +50,12 @@ typedef struct EnPm { /* 0x37C */ EnPmFunc unk_37C; /* 0x380 */ s32 unk_380; /* 0x384 */ s32 unk_384; - /* 0x388 */ s32 unk_388; + /* 0x388 */ s32 prevTalkState; /* 0x38C */ s32 unk_38C; - /* 0x390 */ UNK_TYPE1 unk390[0x4]; + /* 0x390 */ UNK_TYPE1 unk_390[0x4]; /* 0x394 */ s32 unk_394; /* 0x398 */ s32 unk_398; - /* 0x39C */ UNK_TYPE1 unk39C[0x4]; + /* 0x39C */ UNK_TYPE1 unk_39C[0x4]; } EnPm; // size = 0x3A0 extern const ActorInit En_Pm_InitVars; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 9a70ce02c..4ee47164f 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1,12 +1,11 @@ /* * File: z_en_po_sisters.c * Overlay: ovl_En_Po_Sisters - * Description: Poe Sisters + * Description: Poe Sisters (fought in a mini-game in Ikana for a HP) */ #include "z_en_po_sisters.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_po_sisters/object_po_sisters.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) @@ -17,49 +16,49 @@ void EnPoSisters_Destroy(Actor* thisx, PlayState* play); void EnPoSisters_Update(Actor* thisx, PlayState* play); void EnPoSisters_Draw(Actor* thisx, PlayState* play); -void func_80B1AA88(EnPoSisters* this); -void func_80B1AAE8(EnPoSisters* this, PlayState* play); -void func_80B1ABB8(EnPoSisters* this, PlayState* play); -void func_80B1AC40(EnPoSisters* this); -void func_80B1ACB8(EnPoSisters* this, PlayState* play); -void func_80B1AE28(EnPoSisters* this); -void func_80B1AE3C(EnPoSisters* this, PlayState* play); -void func_80B1AF8C(EnPoSisters* this); -void func_80B1B020(EnPoSisters* this, PlayState* play); -void func_80B1B0E0(EnPoSisters* this); -void func_80B1B168(EnPoSisters* this, PlayState* play); -void func_80B1B2F0(EnPoSisters* this, PlayState* play); -void func_80B1B444(EnPoSisters* this, PlayState* play); -void func_80B1B5B4(EnPoSisters* this); -void func_80B1B628(EnPoSisters* this, PlayState* play); -void func_80B1B70C(EnPoSisters* this); -void func_80B1B7BC(EnPoSisters* this, PlayState* play); -void func_80B1B860(EnPoSisters* this, PlayState* play); -void func_80B1B940(EnPoSisters* this, PlayState* play); -void func_80B1BA3C(EnPoSisters* this); -void func_80B1BA90(EnPoSisters* this, PlayState* play); -void func_80B1BC4C(EnPoSisters* this, PlayState* play); -void func_80B1BCA0(EnPoSisters* this, PlayState* play); -void func_80B1BCF0(EnPoSisters* this, PlayState* play); -void func_80B1BE4C(EnPoSisters* this, s32 arg1); -void func_80B1BF2C(EnPoSisters* this, PlayState* play); -void func_80B1C030(EnPoSisters* this); -void func_80B1C0A4(EnPoSisters* this, PlayState* play); -void func_80B1C2E8(EnPoSisters* this); -void func_80B1C340(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupObserverIdle(EnPoSisters* this); +void EnPoSisters_ObserverIdle(EnPoSisters* this, PlayState* play); +void EnPoSisters_AimlessIdleFlying2(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupAimlessIdleFlying(EnPoSisters* this); +void EnPoSisters_AimlessIdleFlying(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupInvestigating(EnPoSisters* this); +void EnPoSisters_Investigating(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupSpinUp(EnPoSisters* this); +void EnPoSisters_SpinUp(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupSpinAttack(EnPoSisters* this); +void EnPoSisters_SpinAttack(EnPoSisters* this, PlayState* play); +void EnPoSisters_AttackConnectDrift(EnPoSisters* this, PlayState* play); +void EnPoSisters_DamageFlinch(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupFlee(EnPoSisters* this); +void EnPoSisters_Flee(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupSpinToInvis(EnPoSisters* this); +void EnPoSisters_SpinToInvis(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupSpinBackToVisible(EnPoSisters* this, PlayState* play); +void EnPoSisters_SpinBackToVisible(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupDeathStage1(EnPoSisters* this); +void EnPoSisters_DeathStage1(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupDeathStage2(EnPoSisters* this, PlayState* play); +void EnPoSisters_DeathStage2(EnPoSisters* this, PlayState* play); +void EnPoSisters_SpawnMegClones(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegCloneVanish(EnPoSisters* this, PlayState* play); +void EnPoSisters_MegCloneWaitForSpinBack(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupMegSurroundPlayer(EnPoSisters* this); +void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play); +void EnPoSisters_SetupSpawnPo(EnPoSisters* this); +void EnPoSisters_PoeSpawn(EnPoSisters* this, PlayState* play); -static Color_RGBA8 D_80B1DA30[] = { - { 255, 170, 255, 255 }, - { 255, 200, 0, 255 }, - { 0, 170, 255, 255 }, - { 170, 255, 0, 255 }, +static Color_RGBA8 sPoSisterFlameColors[] = { + { 255, 170, 255, 255 }, // Meg + { 255, 200, 0, 255 }, // Jo + { 0, 170, 255, 255 }, // Beth + { 170, 255, 0, 255 }, // Amy }; -static Color_RGBA8 D_80B1DA40[] = { - { 100, 0, 255, 255 }, - { 255, 0, 0, 255 }, - { 0, 0, 255, 255 }, - { 0, 150, 0, 255 }, +static Color_RGBA8 sPoSisterEnvColors[] = { + { 100, 0, 255, 255 }, // Meg + { 255, 0, 0, 255 }, // Jo + { 0, 0, 255, 255 }, // Beth + { 0, 150, 0, 255 }, // Amy }; const ActorInit En_Po_Sisters_InitVars = { @@ -94,41 +93,50 @@ static ColliderCylinderInit sCylinderInit = { { 18, 60, 15, { 0, 0, 0 } }, }; +// health:6, mass:50 static CollisionCheckInfoInit sColChkInfoInit = { 6, 25, 60, 50 }; +typedef enum { + /* 0x0 */ POSISTERS_DAMAGEEFFECT_NOEFFECT, + /* 0x1 */ POSISTERS_DAMAGEEFFECT_UNKDMG12, // set in DamageTable, but unused + /* 0x4 */ POSISTERS_DAMAGEEFFECT_LIGHTARROWS = 0x4, + /* 0xE */ POSISTERS_DAMAGEEFFECT_SPINATTACK = 0xE, + /* 0xF */ POSISTERS_DAMAGEEFFECT_DEKUNUT = 0xF, +} PoSisterDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0xF), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0x0), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0x0), - /* Fire arrow */ DMG_ENTRY(1, 0x0), - /* Ice arrow */ DMG_ENTRY(1, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0xE), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), + /* Deku Nut */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_DEKUNUT), + /* Deku Stick */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Horse trample */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Explosives */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Zora boomerang */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Normal arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Hookshot */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Goron punch */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Sword */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Goron pound */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Fire arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Ice arrow */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Light arrow */ DMG_ENTRY(2, POSISTERS_DAMAGEEFFECT_LIGHTARROWS), + /* Goron spikes */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Deku spin */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Deku bubble */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Deku launch */ DMG_ENTRY(2, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_UNKDMG12), + /* Zora barrier */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Normal shield */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Light ray */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Thrown object */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Zora punch */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Spin attack */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_SPINATTACK), + /* Sword beam */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Normal Roll */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Unblockable */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, POSISTERS_DAMAGEEFFECT_NOEFFECT), + /* Powder Keg */ DMG_ENTRY(1, POSISTERS_DAMAGEEFFECT_NOEFFECT), }; static InitChainEntry sInitChain[] = { @@ -136,52 +144,70 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_STOP), }; +// clang-format off +// PoSisters have their own flags variable for cross function behavior detection +#define POSISTERS_FLAG_CLEAR (0) +#define POSISTERS_FLAG_CHECK_AC (1 << 0) +#define POSISTERS_FLAG_UPDATE_SHAPE_ROT (1 << 1) +#define POSISTERS_FLAG_CHECK_Z_TARGET (1 << 2) // meg doesnt go invis if you ztarget her for too long +#define POSISTERS_FLAG_MATCH_PLAYER_HEIGHT (1 << 3) // the po is attempting to level with player's height +#define POSISTERS_FLAG_UPDATE_BGCHECK_INFO (1 << 4) +#define POSISTERS_FLAG_UPDATE_FIRES (1 << 5) // firePos updated to match limb in PostLimbDraw +#define POSISTERS_FLAG_REAL_MEG_ROTATION (1 << 6) // real meg rotates different than her clones for one cycle +#define POSISTERS_FLAG_DRAW_TORCH (1 << 7) +// clang-format on + void EnPoSisters_Init(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 50.0f); - SkelAnime_Init(play, &this->skelAnime, &object_po_sisters_Skel_0065C8, &object_po_sisters_Anim_0014CC, - this->jointTable, this->morphTable, 12); - this->unk_226 = 255; - this->unk_227 = 255; - this->unk_228 = 210; - this->unk_229 = 255; + SkelAnime_Init(play, &this->skelAnime, &gPoSistersSkel, &gPoeSistersSwayAnim, this->jointTable, this->morphTable, + POSISTERS_LIMB_MAX); + + this->color.r = 255; + this->color.g = 255; + this->color.b = 210; + this->color.a = 255; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->unk_18C = ENPOSISTERS_GET_300(thisx); - this->actor.hintId = this->unk_18C + 80; - this->unk_18D = ENPOSISTERS_GET_C00(thisx); - this->unk_18E = 32; - this->unk_18F = 20; - this->unk_190 = 1; - this->unk_191 = 0x20; - this->unk_2EC = 110.0f; - thisx->flags &= ~1; + this->type = ENPOSISTERS_GET_TYPE(thisx); + this->actor.hintId = this->type + 80; + this->megCloneId = ENPOSISTERS_GET_MEG_CLONE_ID(thisx); + this->floatingBobbingTimer = 32; + this->zTargetTimer = 20; + this->fireCount = 1; + this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; + this->megDistToPlayer = 110.0f; + thisx->flags &= ~ACTOR_FLAG_1; - if (ENPOSISTERS_GET_1000(&this->actor)) { - func_80B1AA88(this); - } else if (this->unk_18C == 0) { - if (this->unk_18D == 0) { + if (ENPOSISTERS_GET_OBSERVER_FLAG(&this->actor)) { + // if flagged observer, they are a floating prop spawned by EnGb2 (po hut proprieter) + EnPoSisters_SetupObserverIdle(this); + } else if (this->type == POSISTER_TYPE_MEG) { + if (this->megCloneId == POSISTER_MEG_REAL) { this->actor.colChkInfo.health = 8; this->collider.info.toucher.damage = 16; this->collider.base.ocFlags1 = (OC1_TYPE_PLAYER | OC1_ON); - func_80B1BCF0(this, play); - func_80B1C2E8(this); + EnPoSisters_SpawnMegClones(this, play); + EnPoSisters_SetupSpawnPo(this); } else { this->actor.flags &= ~(ACTOR_FLAG_200 | ACTOR_FLAG_4000); this->collider.info.elemType = ELEMTYPE_UNK4; this->collider.info.bumper.dmgFlags |= (0x40000 | 0x1); this->collider.base.ocFlags1 = OC1_NONE; - func_80B1BE4C(this, false); + EnPoSisters_MegCloneVanish(this, NULL); } } else { - func_80B1C2E8(this); + EnPoSisters_SetupSpawnPo(this); } + + // ! @Weird: this actor doesn't accept params in this range, so params is just cleared this->actor.params &= 0xFF; } @@ -192,58 +218,66 @@ void EnPoSisters_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80B1A648(EnPoSisters* this, s32 arg1, Vec3f* pos) { +/** + * For some reason, it uses both deathTimer (param) and this->deathTimer. + */ +void EnPoSisters_UpdateDeathFlameSwirl(EnPoSisters* this, s32 deathTimerParam, Vec3f* pos) { s32 i; - Vec3f* ptr; - f32 temp_f20 = arg1; + Vec3f* firePos; + f32 deathTimerParamF = deathTimerParam; - for (i = 0; i < this->unk_190; i++) { - ptr = &this->unk_22C[i]; - ptr->x = Math_SinS(this->actor.shape.rot.y + (this->unk_192 * 0x800) + (i * 0x2000)) * (SQ(temp_f20) * 0.1f) + - pos->x; - ptr->z = Math_CosS(this->actor.shape.rot.y + (this->unk_192 * 0x800) + (i * 0x2000)) * (SQ(temp_f20) * 0.1f) + - pos->z; - ptr->y = pos->y + temp_f20; + for (i = 0; i < this->fireCount; i++) { + firePos = &this->firePos[i]; + firePos->x = Math_SinS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * + (SQ(deathTimerParamF) * 0.1f) + + pos->x; + firePos->z = Math_CosS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * + (SQ(deathTimerParamF) * 0.1f) + + pos->z; + firePos->y = pos->y + deathTimerParamF; } } -void func_80B1A768(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MatchPlayerXZ(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 sp20; + f32 dist; - if ((this->unk_18D == 0) || (this->actionFunc != func_80B1B444)) { - if (((player->meleeWeaponState == 0) || (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) && + if (this->megCloneId == POSISTER_MEG_REAL || this->actionFunc != EnPoSisters_DamageFlinch) { + if ((player->meleeWeaponState == 0 || player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && ((player->actor.world.pos.y - player->actor.floorHeight) < 1.0f)) { - Math_StepToF(&this->unk_2EC, 110.0f, 3.0f); + Math_StepToF(&this->megDistToPlayer, 110.0f, 3.0f); } else { - Math_StepToF(&this->unk_2EC, 170.0f, 10.0f); + Math_StepToF(&this->megDistToPlayer, 170.0f, 10.0f); } - sp20 = this->unk_2EC; - } else if (this->unk_18D != 0) { // An else would be sufficient - sp20 = this->actor.parent->xzDistToPlayer; + dist = this->megDistToPlayer; + } else if (this->megCloneId != POSISTER_MEG_REAL) { + dist = this->actor.parent->xzDistToPlayer; } - this->actor.world.pos.x = (Math_SinS(BINANG_ROT180(this->actor.shape.rot.y)) * sp20) + player->actor.world.pos.x; - this->actor.world.pos.z = (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * sp20) + player->actor.world.pos.z; + this->actor.world.pos.x = (Math_SinS(BINANG_ROT180(this->actor.shape.rot.y)) * dist) + player->actor.world.pos.x; + this->actor.world.pos.z = (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * dist) + player->actor.world.pos.z; } -void func_80B1A894(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MatchPlayerY(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); + // equalize to player height Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + 5.0f, 0.5f, 3.0f); - if (this->unk_18E == 0) { - this->unk_18E = 32; - if (this->unk_18E) {} + if (this->floatingBobbingTimer == 0) { + this->floatingBobbingTimer = 32; + //! FAKE: + if (this->floatingBobbingTimer) {} } - if (this->unk_18E != 0) { - this->unk_18E--; - } + DECR(this->floatingBobbingTimer); - this->actor.world.pos.y += (2.0f + (0.5f * Rand_ZeroOne())) * Math_SinS(this->unk_18E * 0x800); - if ((this->unk_229 == 255) && (this->actionFunc != func_80B1B168) && (this->actionFunc != func_80B1B020)) { - if (this->actionFunc == func_80B1B628) { + // random float/flying wobble + this->actor.world.pos.y += (2.0f + (0.5f * Rand_ZeroOne())) * Math_SinS(this->floatingBobbingTimer * 0x800); + + // fully opaque + if (this->color.a == 255 && this->actionFunc != EnPoSisters_SpinAttack && this->actionFunc != EnPoSisters_SpinUp) { + if (this->actionFunc == EnPoSisters_Flee) { func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } else { func_800B9010(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); @@ -251,614 +285,645 @@ void func_80B1A894(EnPoSisters* this, PlayState* play) { } } -void func_80B1A9B0(EnPoSisters* this, PlayState* play) { - if (this->actor.isTargeted && (this->unk_229 == 255)) { - if (this->unk_18F != 0) { - this->unk_18F--; - } +// check for z target +void EnPoSisters_CheckZTarget(EnPoSisters* this, PlayState* play) { + if (this->actor.isTargeted && (this->color.a == 255)) { + DECR(this->zTargetTimer); } else { - this->unk_18F = 20; + this->zTargetTimer = 20; } - if (this->unk_229 == 0) { - if (this->unk_194 != 0) { - this->unk_194--; - } + if (this->color.a == 0) { + DECR(this->invisibleTimer); } - if ((this->actionFunc != func_80B1B020) && (this->actionFunc != func_80B1B168) && - (this->actionFunc != func_80B1B444)) { - if (this->unk_18F == 0) { - func_80B1B70C(this); - } else if ((this->unk_194 == 0) && (this->unk_229 == 0)) { - func_80B1B860(this, play); + if ((this->actionFunc != EnPoSisters_SpinUp) && (this->actionFunc != EnPoSisters_SpinAttack) && + (this->actionFunc != EnPoSisters_DamageFlinch)) { + if (this->zTargetTimer == 0) { + EnPoSisters_SetupSpinToInvis(this); + } else if ((this->invisibleTimer == 0) && (this->color.a == 0)) { + EnPoSisters_SetupSpinBackToVisible(this, play); } } } -void func_80B1AA88(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_0014CC, -3.0f); +void EnPoSisters_SetupObserverIdle(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); this->actor.speedXZ = 0.0f; - this->unk_192 = Rand_S16Offset(100, 50); - this->actionFunc = func_80B1AAE8; + this->laughTimer = Rand_S16Offset(100, 50); + this->actionFunc = EnPoSisters_ObserverIdle; } -void func_80B1AAE8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_ObserverIdle(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (DECR(this->unk_192) == 0) { - this->unk_192 = Rand_S16Offset(100, 50); + if (DECR(this->laughTimer) == 0) { + this->laughTimer = Rand_S16Offset(100, 50); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); } } -void func_80B1AB5C(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_0014CC, -3.0f); - this->unk_192 = Rand_S16Offset(2, 3); +/** + * Change animation, but keep flying idle in straight line. Flying through walls possible. + * + * This is never reached because conditions are never met in EnPoSisters_AimlessIdleFlying + */ +void EnPoSisters_SetupAimlessIdleFlying2(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersSwayAnim, -3.0f); + this->idleFlyingAnimationCounter = Rand_S16Offset(2, 3); this->actor.speedXZ = 0.0f; - this->actionFunc = func_80B1ABB8; + this->actionFunc = EnPoSisters_AimlessIdleFlying2; } -void func_80B1ABB8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_AimlessIdleFlying2(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->unk_192 != 0) { - this->unk_192--; - } + DECR(this->idleFlyingAnimationCounter); } - if ((this->unk_192 == 0) || (this->actor.xzDistToPlayer < 600.0f)) { - func_80B1AC40(this); + if ((this->idleFlyingAnimationCounter == 0) || (this->actor.xzDistToPlayer < 600.0f)) { + EnPoSisters_SetupAimlessIdleFlying(this); } } -void func_80B1AC40(EnPoSisters* this) { - if (this->actionFunc != func_80B1AE3C) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000D40, -3.0f); +/** + * Flying in a straight line, until wall or player comes near. + */ +void EnPoSisters_SetupAimlessIdleFlying(EnPoSisters* this) { + if (this->actionFunc != EnPoSisters_Investigating) { + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); } - this->unk_192 = Rand_S16Offset(15, 3); - this->unk_191 |= (0x6 | 0x1); - this->actionFunc = func_80B1ACB8; + this->idleFlyingAnimationCounter = Rand_S16Offset(15, 3); + this->poSisterFlags |= (POSISTERS_FLAG_CHECK_Z_TARGET | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); + this->actionFunc = EnPoSisters_AimlessIdleFlying; } -void func_80B1ACB8(EnPoSisters* this, PlayState* play) { +void EnPoSisters_AimlessIdleFlying(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speedXZ, 1.0f, 0.2f); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->unk_192 != 0) { - this->unk_192--; - } + DECR(this->idleFlyingAnimationCounter); } if ((this->actor.xzDistToPlayer < 600.0f) && (fabsf(this->actor.playerHeightRel + 5.0f) < 30.0f)) { - func_80B1AE28(this); - } else if ((this->unk_192 == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f)) { - func_80B1AB5C(this); + EnPoSisters_SetupInvestigating(this); + } else if ((this->idleFlyingAnimationCounter == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f)) { + // ! @bug: this is never reached because speedXZ is reduced + // at the same rate it is increased at the top of this function + EnPoSisters_SetupAimlessIdleFlying2(this); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & 8) { // touching a wall Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); } else if (Actor_XZDistanceToPoint(&this->actor, &this->actor.home.pos) > 600.0f) { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x71C); } } -void func_80B1AE28(EnPoSisters* this) { - this->actionFunc = func_80B1AE3C; +/** + * Not yet agressive, gently flying/steering toward the player. + */ +void EnPoSisters_SetupInvestigating(EnPoSisters* this) { + this->actionFunc = EnPoSisters_Investigating; } -void func_80B1AE3C(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Investigating(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 sp22; + s16 yawDiff; SkelAnime_Update(&this->skelAnime); - sp22 = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; + yawDiff = this->actor.yawTowardsPlayer - player->actor.shape.rot.y; Math_StepToF(&this->actor.speedXZ, 2.0f, 0.2f); - if (sp22 > 0x3000) { + if (yawDiff > 0x3000) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x3000, 0x71C); - } else if (sp22 < -0x3000) { + } else if (yawDiff < -0x3000) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer - 0x3000, 0x71C); } else { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); } if ((this->actor.xzDistToPlayer < 320.0f) && (fabsf(this->actor.playerHeightRel + 5.0f) < 30.0f)) { - func_80B1AF8C(this); + EnPoSisters_SetupSpinUp(this); } else if (this->actor.xzDistToPlayer > 720.0f) { - func_80B1AC40(this); + EnPoSisters_SetupAimlessIdleFlying(this); } } -void func_80B1AF8C(EnPoSisters* this) { - if (this->unk_229 != 0) { +/** + * Gaining speed for spin attack before the actual attack, winding up. + */ +void EnPoSisters_SetupSpinUp(EnPoSisters* this) { + if (this->color.a != 0) { this->collider.base.colType = COLTYPE_METAL; this->collider.base.acFlags |= AC_HARD; } - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000114, -5.0f); + Animation_MorphToLoop(&this->skelAnime, &gPoSistersAttackAnim, -5.0f); this->actor.speedXZ = 0.0f; - this->unk_192 = Animation_GetLastFrame(&object_po_sisters_Anim_000114.common) * 3 + 3; - this->unk_191 &= ~2; - this->actionFunc = func_80B1B020; + this->spinupTimer = Animation_GetLastFrame(&gPoSistersAttackAnim.common) * 3 + 3; + this->poSisterFlags &= ~POSISTERS_FLAG_UPDATE_SHAPE_ROT; + this->actionFunc = EnPoSisters_SpinUp; } -void func_80B1B020(EnPoSisters* this, PlayState* play) { +void EnPoSisters_SpinUp(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_192 != 0) { - this->unk_192--; - } - - this->actor.shape.rot.y += ((s32)((this->skelAnime.endFrame + 1.0f) * 3.0f) - this->unk_192) * 0x180; - - if ((this->unk_192 == 18) || (this->unk_192 == 7)) { + DECR(this->spinupTimer); + this->actor.shape.rot.y += ((s32)((this->skelAnime.endFrame + 1.0f) * 3.0f) - this->spinupTimer) * 0x180; + if ((this->spinupTimer == 18) || (this->spinupTimer == 7)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); - } else if (this->unk_192 == 0) { - func_80B1B0E0(this); + } else if (this->spinupTimer == 0) { + EnPoSisters_SetupSpinAttack(this); } } -void func_80B1B0E0(EnPoSisters* this) { +void EnPoSisters_SetupSpinAttack(EnPoSisters* this) { this->actor.speedXZ = 5.0f; - if (this->unk_18C == 0) { + if (this->type == POSISTER_TYPE_MEG) { this->collider.base.colType = COLTYPE_METAL; this->collider.base.acFlags |= AC_HARD; - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000114, -5.0f); + Animation_MorphToLoop(&this->skelAnime, &gPoSistersAttackAnim, -5.0f); } - this->unk_192 = 5; + + this->spinTimer = 5; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->unk_191 |= 8; - this->actionFunc = func_80B1B168; + this->poSisterFlags |= POSISTERS_FLAG_MATCH_PLAYER_HEIGHT; + this->actionFunc = EnPoSisters_SpinAttack; } -void func_80B1B168(EnPoSisters* this, PlayState* play) { +void EnPoSisters_SpinAttack(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->unk_192 != 0) { - this->unk_192--; - } + DECR(this->spinTimer); } this->actor.shape.rot.y += (s32)(1152.0f * this->skelAnime.endFrame); - if (this->unk_192 == 0) { + if (this->spinTimer == 0) { s16 rotY = this->actor.shape.rot.y - this->actor.world.rot.y; if (ABS_ALT(rotY) < 0x1000) { - if (this->unk_18C != 0) { + if (this->type != POSISTER_TYPE_MEG) { this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; - func_80B1AC40(this); + EnPoSisters_SetupAimlessIdleFlying(this); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, play); + EnPoSisters_MegCloneVanish(this, play); } } } + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_ROLL); } } -void func_80B1B280(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000D40, -3.0f); +/** + * Attack has connected with player. + */ +void EnPoSisters_SetupAttackConnect(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); this->actor.world.rot.y = BINANG_ROT180(this->actor.yawTowardsPlayer); - if (this->unk_18C != 0) { + if (this->type != POSISTER_TYPE_MEG) { this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; } - this->actionFunc = func_80B1B2F0; + + this->actionFunc = EnPoSisters_AttackConnectDrift; } -void func_80B1B2F0(EnPoSisters* this, PlayState* play) { +void EnPoSisters_AttackConnectDrift(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y -= (s16)(this->actor.speedXZ * 10.0f * 128.0f); - if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f)) { + + if (Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f)) { // wait to stop moving this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->unk_18C != 0) { - func_80B1AC40(this); + if (this->type != POSISTER_TYPE_MEG) { + EnPoSisters_SetupAimlessIdleFlying(this); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, play); + EnPoSisters_MegCloneVanish(this, play); } } } -void func_80B1B3A8(EnPoSisters* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_po_sisters_Anim_0008C0, -3.0f); +void EnPoSisters_SetupDamageFlinch(EnPoSisters* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersDamagedAnim, -3.0f); if (this->collider.base.ac != NULL) { func_800BE504(&this->actor, &this->collider); } - if (this->unk_18C != 0) { + if (this->type != POSISTER_TYPE_MEG) { this->actor.speedXZ = 10.0f; } - this->unk_191 &= ~(0x8 | 0x2 | 0x1); + this->poSisterFlags &= + ~(POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16); - this->actionFunc = func_80B1B444; + this->actionFunc = EnPoSisters_DamageFlinch; } -void func_80B1B444(EnPoSisters* this, PlayState* play) { - s32 temp_f18; - +void EnPoSisters_DamageFlinch(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_8000)) { if (this->actor.colChkInfo.health != 0) { - if (this->unk_18C != 0) { - func_80B1B5B4(this); - } else if (this->unk_18D != 0) { - func_80B1BE4C(this, 0); + if (this->type != POSISTER_TYPE_MEG) { + EnPoSisters_SetupFlee(this); + } else if (this->megCloneId != POSISTER_MEG_REAL) { + EnPoSisters_MegCloneVanish(this, NULL); } else { - func_80B1BE4C(this, play); + EnPoSisters_MegCloneVanish(this, play); } } else { - func_80B1BA3C(this); + EnPoSisters_SetupDeathStage1(this); } } - if (this->unk_18D != 0) { + if (this->megCloneId != POSISTER_MEG_REAL) { + s32 alpha; + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y, - (this->unk_18D == 2) ? 0x800 : 0x400); - temp_f18 = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; - this->unk_229 = CLAMP(temp_f18, 0, 255); + (this->megCloneId == POSISTER_MEG_CLONE2) ? 0x800 : 0x400); + alpha = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; + this->color.a = CLAMP(alpha, 0, 255); this->actor.world.pos.y = this->actor.parent->world.pos.y; - func_80B1A768(this, play); - } else if (this->unk_18C != 0) { + EnPoSisters_MatchPlayerXZ(this, play); + + } else if (this->type != POSISTER_TYPE_MEG) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); } } -void func_80B1B5B4(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000A54, -3.0f); +void EnPoSisters_SetupFlee(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &gPoSistersFleeAnim, -3.0f); this->actor.world.rot.y = BINANG_ROT180(this->actor.shape.rot.y); - this->unk_192 = 5; - this->unk_191 |= (0x8 | 0x2 | 0x1); + this->fleeTimer = 5; + this->poSisterFlags |= + (POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC); this->actor.speedXZ = 5.0f; - this->actionFunc = func_80B1B628; + this->actionFunc = EnPoSisters_Flee; } -void func_80B1B628(EnPoSisters* this, PlayState* play) { +void EnPoSisters_Flee(EnPoSisters* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.world.rot.y, BINANG_ROT180(this->actor.yawTowardsPlayer), 0x71C); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->unk_192 != 0) { - this->unk_192--; - } + DECR(this->fleeTimer); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & 8) { // touching a wall this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_191 |= 2; - func_80B1B70C(this); - } else if ((this->unk_192 == 0) && (this->actor.xzDistToPlayer > 480.0f)) { + this->poSisterFlags |= POSISTERS_FLAG_UPDATE_SHAPE_ROT; + EnPoSisters_SetupSpinToInvis(this); + } else if (this->fleeTimer == 0 && this->actor.xzDistToPlayer > 480.0f) { this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B1AC40(this); + EnPoSisters_SetupAimlessIdleFlying(this); } } -void func_80B1B70C(EnPoSisters* this) { - Animation_Change(&this->skelAnime, &object_po_sisters_Anim_00119C, 1.5f, 0.0f, - Animation_GetLastFrame(&object_po_sisters_Anim_00119C.common), ANIMMODE_ONCE, -3.0f); - this->unk_194 = 100; +void EnPoSisters_SetupSpinToInvis(EnPoSisters* this) { + Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, + Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim.common), ANIMMODE_ONCE, -3.0f); + this->invisibleTimer = 100; // 5 seconds this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_191 &= ~(0x4 | 0x1); + this->poSisterFlags &= ~(POSISTERS_FLAG_CHECK_Z_TARGET | POSISTERS_FLAG_CHECK_AC); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DISAPPEAR); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - this->actionFunc = func_80B1B7BC; + this->actionFunc = EnPoSisters_SpinToInvis; } -void func_80B1B7BC(EnPoSisters* this, PlayState* play) { - s32 temp_f18; - +void EnPoSisters_SpinToInvis(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk_229 = 0; + this->color.a = 0; this->collider.info.bumper.dmgFlags = (0x40000 | 0x1); - func_80B1AC40(this); + EnPoSisters_SetupAimlessIdleFlying(this); } else { - temp_f18 = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; - this->unk_229 = CLAMP(temp_f18, 0, 255); + s32 alpha = ((this->skelAnime.endFrame - this->skelAnime.curFrame) * 255.0f) / this->skelAnime.endFrame; + + this->color.a = CLAMP(alpha, 0, 255); } } -void func_80B1B860(EnPoSisters* this, PlayState* play) { - Animation_Change(&this->skelAnime, &object_po_sisters_Anim_00119C, 1.5f, 0.0f, - Animation_GetLastFrame(&object_po_sisters_Anim_00119C.common), ANIMMODE_ONCE, -3.0f); - if (this->unk_18C == 0) { - this->unk_2EC = 110.0f; - func_80B1A768(this, play); - this->unk_229 = 0; +void EnPoSisters_SetupSpinBackToVisible(EnPoSisters* this, PlayState* play) { + Animation_Change(&this->skelAnime, &gPoeSistersAppearDisappearAnim, 1.5f, 0.0f, + Animation_GetLastFrame(&gPoeSistersAppearDisappearAnim.common), ANIMMODE_ONCE, -3.0f); + if (this->type == POSISTER_TYPE_MEG) { + this->megDistToPlayer = 110.0f; + EnPoSisters_MatchPlayerXZ(this, play); + this->color.a = 0; this->actor.draw = EnPoSisters_Draw; } else { this->actor.world.rot.y = this->actor.shape.rot.y; } - this->unk_192 = 15; + this->spinInvisibleTimer = 15; this->actor.speedXZ = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); - this->unk_191 &= ~0x1; - this->actionFunc = func_80B1B940; + this->poSisterFlags &= ~POSISTERS_FLAG_CHECK_AC; + this->actionFunc = EnPoSisters_SpinBackToVisible; } -void func_80B1B940(EnPoSisters* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) != 0) { - this->unk_229 = 255; - if (this->unk_18C != 0) { - this->unk_191 |= 1; +void EnPoSisters_SpinBackToVisible(EnPoSisters* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime)) { + this->color.a = 255; // fully visible + if (this->type != POSISTER_TYPE_MEG) { + this->poSisterFlags |= POSISTERS_FLAG_CHECK_AC; this->collider.info.bumper.dmgFlags = ~(0x8000000 | 0x200000 | 0x100000 | 0x40000 | 0x1); - if (this->unk_192 != 0) { - this->unk_192--; - } - if (this->unk_192 == 0) { - this->unk_18F = 20; - func_80B1AC40(this); + DECR(this->spinInvisibleTimer); + + if (this->spinInvisibleTimer == 0) { + this->zTargetTimer = 20; + EnPoSisters_SetupAimlessIdleFlying(this); } } else { - func_80B1C030(this); + EnPoSisters_SetupMegSurroundPlayer(this); } } else { - s32 temp_f18 = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; + s32 alpha = (this->skelAnime.curFrame * 255.0f) / this->skelAnime.endFrame; - this->unk_229 = CLAMP(temp_f18, 0, 255); - if (this->unk_18C == 0) { - func_80B1A768(this, play); + this->color.a = CLAMP(alpha, 0, 255); + if (this->type == POSISTER_TYPE_MEG) { + EnPoSisters_MatchPlayerXZ(this, play); } } } -void func_80B1BA3C(EnPoSisters* this) { - this->unk_192 = 0; +void EnPoSisters_SetupDeathStage1(EnPoSisters* this) { + this->deathTimer = 0; this->actor.speedXZ = 0.0f; this->actor.world.pos.y += 42.0f; this->actor.shape.yOffset = -6000.0f; this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_191 = 0; - this->actionFunc = func_80B1BA90; + this->poSisterFlags = POSISTERS_FLAG_CLEAR; + this->actionFunc = EnPoSisters_DeathStage1; } -void func_80B1BA90(EnPoSisters* this, PlayState* play) { +void EnPoSisters_DeathStage1(EnPoSisters* this, PlayState* play) { s32 i; - s32 end = this->unk_190; + s32 end = this->fireCount; - this->unk_192++; + this->deathTimer++; end++; - if (end > ARRAY_COUNT(this->unk_22C)) { - this->unk_190 = 8; + if (end > ARRAY_COUNT(this->firePos)) { + this->fireCount = 8; } else { - this->unk_190 = end; + this->fireCount = end; } - for (end = this->unk_190 - 1; end > 0; end--) { - this->unk_22C[end] = this->unk_22C[end - 1]; + for (end = this->fireCount - 1; end > 0; end--) { + this->firePos[end] = this->firePos[end - 1]; } - this->unk_22C[0].x = - (Math_SinS((this->actor.shape.rot.y + (this->unk_192 * 0x3000)) - 0x4000) * (3000.0f * this->actor.scale.x)) + - this->actor.world.pos.x; - this->unk_22C[0].z = - (Math_CosS((this->actor.shape.rot.y + (this->unk_192 * 0x3000)) - 0x4000) * (3000.0f * this->actor.scale.x)) + - this->actor.world.pos.z; - if (this->unk_192 < 8) { - this->unk_22C[0].y = this->unk_22C[1].y - 9.0f; + this->firePos[0].x = (Math_SinS((this->actor.shape.rot.y + (this->deathTimer * 0x3000)) - 0x4000) * + (3000.0f * this->actor.scale.x)) + + this->actor.world.pos.x; + this->firePos[0].z = (Math_CosS((this->actor.shape.rot.y + (this->deathTimer * 0x3000)) - 0x4000) * + (3000.0f * this->actor.scale.x)) + + this->actor.world.pos.z; + + if (this->deathTimer < 8) { + this->firePos[0].y = this->firePos[1].y - 9.0f; } else { - this->unk_22C[0].y = this->unk_22C[1].y + 2.0f; - if (this->unk_192 >= 16) { + this->firePos[0].y = this->firePos[1].y + 2.0f; + if (this->deathTimer >= 16) { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f)) { - func_80B1BC4C(this, play); + EnPoSisters_SetupDeathStage2(this, play); } this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; } } - if (this->unk_192 == 16) { + if (this->deathTimer == 16) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WIZ_DISAPPEAR); } } -void func_80B1BC4C(EnPoSisters* this, PlayState* play) { - this->unk_192 = 0; - this->actor.world.pos.y = this->unk_22C[0].y; - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x80); - this->actionFunc = func_80B1BCA0; +/** + * Fading away, the fire has split and circles outward and away. + */ +void EnPoSisters_SetupDeathStage2(EnPoSisters* this, PlayState* play) { + this->deathTimer = 0; + this->actor.world.pos.y = this->firePos[0].y; + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, (0x8 << 4)); // drop table 8 + this->actionFunc = EnPoSisters_DeathStage2; } -void func_80B1BCA0(EnPoSisters* this, PlayState* play) { - this->unk_192++; - if (this->unk_192 == 32) { +void EnPoSisters_DeathStage2(EnPoSisters* this, PlayState* play) { + this->deathTimer++; + + if (this->deathTimer == 32) { Actor_MarkForDeath(&this->actor); } else { - func_80B1A648(this, this->unk_192, &this->actor.world.pos); + EnPoSisters_UpdateDeathFlameSwirl(this, this->deathTimer, &this->actor.world.pos); } } -void func_80B1BCF0(EnPoSisters* this, PlayState* play) { - Actor* sp4C = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x400); - Actor* sp48 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x800); - Actor* sp44 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xC00); +void EnPoSisters_SpawnMegClones(EnPoSisters* this, PlayState* play) { + Actor* clone1 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, + this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, + 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE1, POSISTER_TYPE_MEG)); + Actor* clone2 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, + this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, + 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE2, POSISTER_TYPE_MEG)); + Actor* clone3 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PO_SISTERS, + this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, + 0, ENPOSISTERS_PARAMS(false, POSISTER_MEG_CLONE3, POSISTER_TYPE_MEG)); - if ((sp4C == NULL) || (sp48 == NULL) || (sp44 == NULL)) { - if (sp4C != NULL) { - Actor_MarkForDeath(sp4C); + // if we cannot spawn all clones: abort + if ((clone1 == NULL) || (clone2 == NULL) || (clone3 == NULL)) { + if (clone1 != NULL) { + Actor_MarkForDeath(clone1); } - - if (sp48 != NULL) { - Actor_MarkForDeath(sp48); + if (clone2 != NULL) { + Actor_MarkForDeath(clone2); } - - if (sp44 != NULL) { - Actor_MarkForDeath(sp44); + if (clone3 != NULL) { + Actor_MarkForDeath(clone3); } Actor_MarkForDeath(&this->actor); } } -void func_80B1BE4C(EnPoSisters* this, s32 arg1) { - Vec3f sp34; +/** + * Meg and her clones vanish instantly and surround the player, instead of slowing fading while spinning to get + * Invulnerability. + * + * PlayState is an optional parameter, passed only when drawing the fire flash as they vanish. + */ +void EnPoSisters_MegCloneVanish(EnPoSisters* this, PlayState* play) { + Vec3f pos; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_194 = 100; - this->unk_191 = 0x20; + this->invisibleTimer = 100; // 5 seconds + this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; this->collider.base.colType = COLTYPE_HIT3; this->collider.base.acFlags &= ~AC_HARD; - if (arg1) { - sp34.x = this->actor.world.pos.x; - sp34.y = this->actor.world.pos.y + 45.0f; - sp34.z = this->actor.world.pos.z; - func_800B3030(arg1, &sp34, &gZeroVec3f, &gZeroVec3f, 150, 0, 3); + + if (play != NULL) { + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 45.0f; + pos.z = this->actor.world.pos.z; + func_800B3030(play, &pos, &gZeroVec3f, &gZeroVec3f, 150, 0, 3); // spawns EffectSsDeadDb } - Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); - this->actionFunc = func_80B1BF2C; + + Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); // light OFF + this->actionFunc = EnPoSisters_MegCloneWaitForSpinBack; } -void func_80B1BF2C(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegCloneWaitForSpinBack(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); EnPoSisters* parent = (EnPoSisters*)this->actor.parent; - if (this->unk_18D == 0) { - if (this->unk_194 != 0) { - this->unk_194--; - } - - if (this->unk_194 == 0) { + if (this->megCloneId == POSISTER_MEG_REAL) { + DECR(this->invisibleTimer); + if (this->invisibleTimer == 0) { s32 rand = Rand_ZeroFloat(4.0f); this->actor.shape.rot.y = (rand * 0x4000) + this->actor.yawTowardsPlayer; this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80B1B860(this, play); + EnPoSisters_SetupSpinBackToVisible(this, play); } - } else if (parent->actionFunc == func_80B1B940) { - this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->unk_18D * 0x4000); + + } else if (parent->actionFunc == EnPoSisters_SpinBackToVisible) { + this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->megCloneId * 0x4000); this->actor.world.pos.y = player->actor.world.pos.y + 5.0f; - func_80B1B860(this, play); - } else if (parent->actionFunc == func_80B1BA90) { + EnPoSisters_SetupSpinBackToVisible(this, play); + + } else if (parent->actionFunc == EnPoSisters_DeathStage1) { Actor_MarkForDeath(&this->actor); } } -void func_80B1C030(EnPoSisters* this) { - Animation_MorphToLoop(&this->skelAnime, &object_po_sisters_Anim_000D40, -3.0f); - this->unk_229 = 255; - this->unk_192 = 300; - this->unk_194 = 3; - this->unk_191 |= (0x8 | 0x1); +void EnPoSisters_SetupMegSurroundPlayer(EnPoSisters* this) { + Animation_MorphToLoop(&this->skelAnime, &gPoeSistersFloatAnim, -3.0f); + this->color.a = 255; + this->megSurroundTimer = 300; // 15 seconds + this->megClonesRemaining = 3; + this->poSisterFlags |= (POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_CHECK_AC); this->actor.flags |= ACTOR_FLAG_1; - this->actionFunc = func_80B1C0A4; + this->actionFunc = EnPoSisters_MegSurroundPlayer; } -void func_80B1C0A4(EnPoSisters* this, PlayState* play) { +void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play) { EnPoSisters* parent; - if (this->unk_192 != 0) { - this->unk_192--; - } + DECR(this->megSurroundTimer); - if (this->unk_194 > 0) { - if (this->unk_192 >= 16) { - SkelAnime_Update(&this->skelAnime); - if (this->unk_18D == 0) { - if (ABS_ALT(16 - this->unk_18E) < 14) { - this->actor.shape.rot.y += - (s16)((0x580 - (this->unk_194 * 0x180)) * fabsf(Math_SinS(this->unk_18E * 0x800))); - } - - if ((this->unk_192 >= 284) || (this->unk_192 < 31)) { - this->unk_191 |= 0x40; - } else { - this->unk_191 &= ~0x40; - } - } else { - this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->unk_18D * 0x4000); + if (this->megClonesRemaining > 0 && this->megSurroundTimer >= 16) { + SkelAnime_Update(&this->skelAnime); + if (this->megCloneId == POSISTER_MEG_REAL) { + if (ABS_ALT(16 - this->floatingBobbingTimer) < 14) { + // every x frames rotate around player, the fewer meg clones remaining the faster they spin + this->actor.shape.rot.y += (s16)((0x580 - (this->megClonesRemaining * 0x180)) * + fabsf(Math_SinS(this->floatingBobbingTimer * 0x800))); } + + // twirl the real meg backwards for a bit for visual tell to player + if ((this->megSurroundTimer >= 284) || (this->megSurroundTimer <= 30)) { + this->poSisterFlags |= POSISTERS_FLAG_REAL_MEG_ROTATION; + } else { + this->poSisterFlags &= ~POSISTERS_FLAG_REAL_MEG_ROTATION; + } + } else { + this->actor.shape.rot.y = this->actor.parent->shape.rot.y + (this->megCloneId * 0x4000); } } - if (this->unk_18D == 0) { - if ((this->unk_192 >= 284) || ((this->unk_192 < 31) && (this->unk_192 >= 16))) { - this->unk_191 |= 0x40; + if (this->megCloneId == POSISTER_MEG_REAL) { + if ((this->megSurroundTimer >= 284) || ((this->megSurroundTimer <= 30) && (this->megSurroundTimer >= 16))) { + this->poSisterFlags |= POSISTERS_FLAG_REAL_MEG_ROTATION; } else { - this->unk_191 &= ~0x40; + this->poSisterFlags &= ~POSISTERS_FLAG_REAL_MEG_ROTATION; } } - if (this->unk_192 == 0) { - if (this->unk_18D == 0) { - func_80B1B0E0(this); + if (this->megSurroundTimer == 0) { + if (this->megCloneId == POSISTER_MEG_REAL) { + EnPoSisters_SetupSpinAttack(this); } else { - func_80B1BE4C(this, play); + EnPoSisters_MegCloneVanish(this, play); } - } else if (this->unk_18D != 0) { + } else if (this->megCloneId != POSISTER_MEG_REAL) { parent = (EnPoSisters*)this->actor.parent; - if (parent->actionFunc == func_80B1B444) { - func_80B1B3A8(this); + if (parent->actionFunc == EnPoSisters_DamageFlinch) { + // flinch clones if you hit the real meg + EnPoSisters_SetupDamageFlinch(this); } - } else if (this->unk_194 == 0) { - this->unk_194 = -15; - } else if (this->unk_194 < 0) { - this->unk_194++; - if (this->unk_194 == 0) { - func_80B1B0E0(this); + } else if (this->megClonesRemaining == 0) { + // all meg clones have been killed, meg waits 15 frames then spin attacks + // timer is negative because megClonesRemaining and megAttackTimer are the same union'd variable + this->megAttackTimer = -15; + } else if (this->megAttackTimer < 0) { + this->megAttackTimer++; + if (this->megAttackTimer == 0) { + EnPoSisters_SetupSpinAttack(this); } } - func_80B1A768(this, play); + + EnPoSisters_MatchPlayerXZ(this, play); } -void func_80B1C2E8(EnPoSisters* this) { - Animation_PlayOnce(&this->skelAnime, &object_po_sisters_Anim_00119C); +/** + * First ActionFunc for all Combat variants (including Meg) + */ +void EnPoSisters_SetupSpawnPo(EnPoSisters* this) { + Animation_PlayOnce(&this->skelAnime, &gPoeSistersAppearDisappearAnim); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_APPEAR); - this->unk_229 = 0; - this->unk_191 = 0x20; - this->actionFunc = func_80B1C340; + this->color.a = 0; + this->poSisterFlags = POSISTERS_FLAG_UPDATE_FIRES; + this->actionFunc = EnPoSisters_PoeSpawn; } -void func_80B1C340(EnPoSisters* this, PlayState* play) { +void EnPoSisters_PoeSpawn(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk_229 = 255; + this->color.a = 255; this->actor.flags |= ACTOR_FLAG_1; - this->unk_191 |= (0x10 | 0x8); - if (this->unk_18C == 0) { - func_80B1BE4C(this, play); + this->poSisterFlags |= (POSISTERS_FLAG_UPDATE_BGCHECK_INFO | POSISTERS_FLAG_MATCH_PLAYER_HEIGHT); + if (this->type == POSISTER_TYPE_MEG) { + EnPoSisters_MegCloneVanish(this, play); } else { - func_80B1AC40(this); + EnPoSisters_SetupAimlessIdleFlying(this); } } else { - f32 temp = this->skelAnime.curFrame / this->skelAnime.endFrame; - s32 temp_f16 = 255.0f * temp; + f32 alphaPercent = this->skelAnime.curFrame / this->skelAnime.endFrame; + s32 alpha = 255.0f * alphaPercent; - this->unk_229 = CLAMP(temp_f16, 0, 255); + this->color.a = CLAMP(alpha, 0, 255); } } -void func_80B1C408(EnPoSisters* this, PlayState* play) { - Vec3f sp3C; +void EnPoSisters_CheckCollision(EnPoSisters* this, PlayState* play) { + Vec3f pos; if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.info); - if (this->unk_18D != 0) { - ((EnPoSisters*)this->actor.parent)->unk_194--; + if (this->megCloneId != POSISTER_MEG_REAL) { + ((EnPoSisters*)this->actor.parent)->megClonesRemaining--; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH2); - func_80B1BE4C(this, play); + EnPoSisters_MegCloneVanish(this, play); if (Rand_ZeroOne() < 0.2f) { - sp3C.x = this->actor.world.pos.x; - sp3C.y = this->actor.world.pos.y; - sp3C.z = this->actor.world.pos.z; - Item_DropCollectible(play, &sp3C, ITEM00_ARROWS_10); + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y; + pos.z = this->actor.world.pos.z; + Item_DropCollectible(play, &pos, ITEM00_ARROWS_10); } } else if (this->collider.base.colType != 9) { - if (this->actor.colChkInfo.damageEffect == 0xF) { + if (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_DEKUNUT) { this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_191 |= 2; - func_80B1B860(this, play); - } else if ((this->unk_18C == 0) && (this->actor.colChkInfo.damageEffect == 0xE) && - (this->actionFunc == func_80B1C0A4)) { - if (this->unk_194 == 0) { - this->unk_194 = -45; + this->poSisterFlags |= POSISTERS_FLAG_UPDATE_SHAPE_ROT; + EnPoSisters_SetupSpinBackToVisible(this, play); + } else if ((this->type == POSISTER_TYPE_MEG) && + (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_SPINATTACK) && + (this->actionFunc == EnPoSisters_MegSurroundPlayer)) { + if (this->megClonesRemaining == 0) { + // all meg clones have been killed, meg waits 45 frames then spin attacks + // timer is negative because megClonesRemaining and megAttackTimer are the same union'd variable + this->megAttackTimer = -45; } } else { if (Actor_ApplyDamage(&this->actor)) { @@ -868,14 +933,14 @@ void func_80B1C408(EnPoSisters* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_SISTER_DEAD); } - if (this->actor.colChkInfo.damageEffect == 4) { + if (this->actor.colChkInfo.damageEffect == POSISTERS_DAMAGEEFFECT_LIGHTARROWS) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.5f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); } - func_80B1B3A8(this); + EnPoSisters_SetupDamageFlinch(this); } } } @@ -884,29 +949,29 @@ void func_80B1C408(EnPoSisters* this, PlayState* play) { void EnPoSisters_Update(Actor* thisx, PlayState* play) { s32 pad; EnPoSisters* this = THIS; - f32 temp_f2; + f32 alpha; Vec3f checkPos; s32 bgId; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_80B1B280(this); + EnPoSisters_SetupAttackConnect(this); } - func_80B1C408(this, play); - if (this->unk_191 & 0x4) { - func_80B1A9B0(this, play); + EnPoSisters_CheckCollision(this, play); + if (this->poSisterFlags & POSISTERS_FLAG_CHECK_Z_TARGET) { + EnPoSisters_CheckZTarget(this, play); } this->actionFunc(this, play); - if (this->unk_191 & 0x8) { - func_80B1A894(this, play); + if (this->poSisterFlags & POSISTERS_FLAG_MATCH_PLAYER_HEIGHT) { + EnPoSisters_MatchPlayerY(this, play); } Actor_MoveWithGravity(&this->actor); - if (this->unk_191 & 0x10) { + if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_BGCHECK_INFO) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); } else { checkPos.x = this->actor.world.pos.x; @@ -916,15 +981,15 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &checkPos); } - this->actor.shape.shadowAlpha = this->unk_229; + this->actor.shape.shadowAlpha = this->color.a; Actor_SetFocus(&this->actor, 40.0f); if (this->drawDmgEffAlpha > 0.0f) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); - if (this->unk_229 != 255) { - temp_f2 = this->unk_229 * (1.0f / 255); - if (temp_f2 < this->unk_229) { - this->drawDmgEffAlpha = temp_f2; + if (this->color.a != 255) { + alpha = this->color.a * (1.0f / 255); + if (alpha < this->color.a) { + this->drawDmgEffAlpha = alpha; } } @@ -932,83 +997,87 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.5f); } - if (this->unk_191 & (0x10 | 0x8 | 0x4 | 0x2 | 0x1)) { + if (this->poSisterFlags & + (POSISTERS_FLAG_UPDATE_BGCHECK_INFO | POSISTERS_FLAG_MATCH_PLAYER_HEIGHT | POSISTERS_FLAG_CHECK_Z_TARGET | + POSISTERS_FLAG_UPDATE_SHAPE_ROT | POSISTERS_FLAG_CHECK_AC)) { Collider_UpdateCylinder(&this->actor, &this->collider); - if ((this->actionFunc == func_80B1B168) || (this->actionFunc == func_80B1B020)) { - this->unk_190++; - this->unk_190 = CLAMP_MAX(this->unk_190, ARRAY_COUNT(this->unk_22C)); - } else if (this->actionFunc != func_80B1BA90) { - this->unk_190 = CLAMP_MIN(this->unk_190 - 1, 1); + if ((this->actionFunc == EnPoSisters_SpinAttack) || (this->actionFunc == EnPoSisters_SpinUp)) { + this->fireCount++; + this->fireCount = CLAMP_MAX(this->fireCount, ARRAY_COUNT(this->firePos)); + } else if (this->actionFunc != EnPoSisters_DeathStage1) { + this->fireCount = CLAMP_MIN(this->fireCount - 1, 1); } - if (this->actionFunc == func_80B1B168) { + if (this->actionFunc == EnPoSisters_SpinAttack) { this->actor.flags |= ACTOR_FLAG_1000000; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->unk_191 & 0x1) { + if (this->poSisterFlags & POSISTERS_FLAG_CHECK_AC) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - if (this->actionFunc != func_80B1BF2C) { + if (this->actionFunc != EnPoSisters_MegCloneWaitForSpinBack) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (this->actionFunc == func_80B1B628) { + if (this->actionFunc == EnPoSisters_Flee) { this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); - } else if (this->unk_191 & 0x2) { + } else if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_SHAPE_ROT) { this->actor.shape.rot.y = this->actor.world.rot.y; } } } -void func_80B1C974(EnPoSisters* this) { - if (this->skelAnime.animation == &object_po_sisters_Anim_000114) { - this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 255); - this->unk_227 = CLAMP_MIN(this->unk_227 - 5, 50); - this->unk_228 = CLAMP_MIN(this->unk_228 - 5, 0); - } else if (this->skelAnime.animation == &object_po_sisters_Anim_000A54) { - this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 80); - this->unk_227 = CLAMP_MAX(this->unk_227 + 5, 255); - this->unk_228 = CLAMP_MAX(this->unk_228 + 5, 225); - } else if (this->skelAnime.animation == &object_po_sisters_Anim_0008C0) { +void EnPoSisters_UpdateColors(EnPoSisters* this) { + if (this->skelAnime.animation == &gPoSistersAttackAnim) { + this->color.r = CLAMP_MAX(this->color.r + 5, 255); + this->color.g = CLAMP_MIN(this->color.g - 5, 50); + this->color.b = CLAMP_MIN(this->color.b - 5, 0); + } else if (this->skelAnime.animation == &gPoSistersFleeAnim) { + this->color.r = CLAMP_MAX(this->color.r + 5, 80); + this->color.g = CLAMP_MAX(this->color.g + 5, 255); + this->color.b = CLAMP_MAX(this->color.b + 5, 225); + } else if (this->skelAnime.animation == &gPoeSistersDamagedAnim) { + // flash every other frame after taking damage if (this->actor.colorFilterTimer & 0x2) { - this->unk_226 = 0; - this->unk_227 = 0; - this->unk_228 = 0; + this->color.r = 0; + this->color.g = 0; + this->color.b = 0; } else { - this->unk_226 = 80; - this->unk_227 = 255; - this->unk_228 = 225; + this->color.r = 80; + this->color.g = 255; + this->color.b = 225; } } else { - this->unk_226 = CLAMP_MAX(this->unk_226 + 5, 255); - this->unk_227 = CLAMP_MAX(this->unk_227 + 5, 255); + this->color.r = CLAMP_MAX(this->color.r + 5, 255); + this->color.g = CLAMP_MAX(this->color.g + 5, 255); - if (this->unk_228 > 210) { - if (this->unk_228 && this->unk_228 && this->unk_228) {} - this->unk_228 = CLAMP_MIN(this->unk_228 - 5, 210); + if (this->color.b > 210) { + //! FAKE: + if (this->color.b && this->color.b && this->color.b) {} + this->color.b = CLAMP_MIN(this->color.b - 5, 210); } else { - this->unk_228 = CLAMP_MAX(this->unk_228 + 5, 210); + this->color.b = CLAMP_MAX(this->color.b + 5, 210); } } } s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static Gfx* D_80B1DACC[] = { - object_po_sisters_DL_001DE0, - object_po_sisters_DL_002F88, - object_po_sisters_DL_003628, - object_po_sisters_DL_003DC8, + static Gfx* gPoSisterBodyDisplayLists[] = { + gPoSistersMegBodyDL, + gPoSistersJoelleBodyDL, + gPoSistersBethBodyDL, + gPoSistersAmyBodyDL, }; - static Gfx* D_80B1DADC[] = { - object_po_sisters_DL_001CB0, - object_po_sisters_DL_002EB8, - object_po_sisters_DL_003880, - object_po_sisters_DL_004020, + static Gfx* gPoSisterFaceDisplayLists[] = { + gPoSistersMegFaceDL, + gPoSistersJoelleFaceDL, + gPoSistersBethFaceDL, + gPoSistersAmyFaceDL, }; - static Color_RGBA8 D_80B1DAEC[] = { + static Color_RGBA8 gPoSisterColors[] = { { 80, 0, 100, 0 }, { 80, 15, 0, 0 }, { 0, 70, 50, 0 }, @@ -1016,167 +1085,178 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve }; EnPoSisters* this = THIS; - if ((limbIndex == 1) && (this->unk_191 & 0x40)) { - if (this->unk_192 >= 284) { - rot->x += (this->unk_192 - 284) * 0x1000; + if (limbIndex == POSISTERS_LIMB_ROOT && (this->poSisterFlags & POSISTERS_FLAG_REAL_MEG_ROTATION)) { + if (this->megSurroundTimer >= 284) { + rot->x += (this->megSurroundTimer - 284) * 0x1000; } else { - rot->x += (this->unk_192 - 15) * 0x1000; + rot->x += (this->megSurroundTimer - 15) * 0x1000; } } - if ((this->unk_229 == 0) || (limbIndex == 8) || ((this->actionFunc == func_80B1BA90) && (this->unk_192 >= 8))) { + if ((this->color.a == 0) || (limbIndex == POSISTERS_LIMB_TORCH) || + ((this->actionFunc == EnPoSisters_DeathStage1) && (this->deathTimer >= 8))) { *dList = NULL; - } else if (limbIndex == 9) { - *dList = D_80B1DACC[this->unk_18C]; - } else if (limbIndex == 10) { - *dList = D_80B1DADC[this->unk_18C]; + } else if (limbIndex == POSISTERS_LIMB_MAIN_BODY) { + *dList = gPoSisterBodyDisplayLists[this->type]; + } else if (limbIndex == POSISTERS_LIMB_FACE) { + *dList = gPoSisterFaceDisplayLists[this->type]; gDPPipeSync((*gfx)++); - gDPSetEnvColor((*gfx)++, this->unk_226, this->unk_227, this->unk_228, this->unk_229); - } else if (limbIndex == 11) { - Color_RGBA8* colour = &D_80B1DAEC[this->unk_18C]; + gDPSetEnvColor((*gfx)++, this->color.r, this->color.g, this->color.b, this->color.a); + } else if (limbIndex == POSISTERS_LIMB_LOWER_BODY) { + Color_RGBA8* color = &gPoSisterColors[this->type]; gDPPipeSync((*gfx)++); - gDPSetEnvColor((*gfx)++, colour->r, colour->g, colour->b, this->unk_229); + gDPSetEnvColor((*gfx)++, color->r, color->g, color->b, this->color.a); } return false; } +#define POSISTER_LIMBPOS_INVALID -1 + void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { static Vec3f D_80B1DAFC = { 1000.0f, -1700.0f, 0.0f }; static s8 D_80B1DB08[] = { - -1, -1, 0, 1, 2, -1, 3, -1, -1, -1, -1, -1, + POSISTER_LIMBPOS_INVALID, + POSISTER_LIMBPOS_INVALID, + 0, + 1, + 2, + POSISTER_LIMBPOS_INVALID, + 3, + POSISTER_LIMBPOS_INVALID, + POSISTER_LIMBPOS_INVALID, + POSISTER_LIMBPOS_INVALID, + POSISTER_LIMBPOS_INVALID, + POSISTER_LIMBPOS_INVALID, }; EnPoSisters* this = THIS; s32 end; - f32 temp_f2; + f32 brightness; - if (D_80B1DB08[limbIndex] != -1) { + if (D_80B1DB08[limbIndex] != POSISTER_LIMBPOS_INVALID) { Matrix_MultZero(&this->limbPos[D_80B1DB08[limbIndex]]); - } else if (limbIndex == 9) { + } else if (limbIndex == POSISTERS_LIMB_MAIN_BODY) { Matrix_MultVecY(-2500.0f, &this->limbPos[4]); Matrix_MultVecY(3000.0f, &this->limbPos[5]); - } else if (limbIndex == 10) { + } else if (limbIndex == POSISTERS_LIMB_FACE) { Matrix_MultVecY(-4000.0f, &this->limbPos[6]); - } else if (limbIndex == 11) { + } else if (limbIndex == POSISTERS_LIMB_LOWER_BODY) { Matrix_MultVecX(3000.0f, &this->limbPos[7]); } - if ((this->actionFunc == func_80B1BA90) && (this->unk_192 >= 8) && (limbIndex == 9)) { + if (this->actionFunc == EnPoSisters_DeathStage1 && this->deathTimer >= 8 && limbIndex == POSISTERS_LIMB_MAIN_BODY) { gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList((*gfx)++, object_po_sisters_DL_0046E0); + gSPDisplayList((*gfx)++, gPoSistersBurnBodyDL); } - if (limbIndex == 8) { - if (this->unk_191 & 0x20) { - for (end = this->unk_190 - 1; end > 0; end--) { - this->unk_22C[end] = this->unk_22C[end - 1]; + if (limbIndex == POSISTERS_LIMB_TORCH) { + if (this->poSisterFlags & POSISTERS_FLAG_UPDATE_FIRES) { + for (end = this->fireCount - 1; end > 0; end--) { + this->firePos[end] = this->firePos[end - 1]; } - Matrix_MultVec3f(&D_80B1DAFC, this->unk_22C); + Matrix_MultVec3f(&D_80B1DAFC, this->firePos); } - if (this->unk_190 > 0) { - Color_RGBA8* sp38 = &D_80B1DA30[this->unk_18C]; + if (this->fireCount > 0) { + Color_RGBA8* flameColor = &sPoSisterFlameColors[this->type]; - temp_f2 = Rand_ZeroFloat(0.3f) + 0.7f; + brightness = Rand_ZeroFloat(0.3f) + 0.7f; // flickering torch light level - if (this->actionFunc == func_80B1BCA0) { - Lights_PointNoGlowSetInfo(&this->lightInfo, this->unk_22C[0].x, this->unk_22C[0].y + 15.0f, - this->unk_22C[0].z, sp38->r * temp_f2, sp38->g * temp_f2, sp38->b * temp_f2, - 200); + if (this->actionFunc == EnPoSisters_DeathStage2) { + Lights_PointNoGlowSetInfo(&this->lightInfo, this->firePos[0].x, this->firePos[0].y + 15.0f, + this->firePos[0].z, flameColor->r * brightness, flameColor->g * brightness, + flameColor->b * brightness, 200); } else { - Lights_PointGlowSetInfo(&this->lightInfo, this->unk_22C[0].x, this->unk_22C[0].y + 15.0f, - this->unk_22C[0].z, sp38->r * temp_f2, sp38->g * temp_f2, sp38->b * temp_f2, - 200); + Lights_PointGlowSetInfo(&this->lightInfo, this->firePos[0].x, this->firePos[0].y + 15.0f, + this->firePos[0].z, flameColor->r * brightness, flameColor->g * brightness, + flameColor->b * brightness, 200); } } else { Lights_PointSetColorAndRadius(&this->lightInfo, 0, 0, 0, 0); } - if (!(this->unk_191 & 0x80)) { - Matrix_Get(&this->unk_358); + if (!(this->poSisterFlags & POSISTERS_FLAG_DRAW_TORCH)) { + Matrix_Get(&this->mtxf); } } } void EnPoSisters_Draw(Actor* thisx, PlayState* play) { EnPoSisters* this = THIS; - Color_RGBA8* temp_s1 = &D_80B1DA40[this->unk_18C]; - Color_RGBA8* temp_s7 = &D_80B1DA30[this->unk_18C]; + Color_RGBA8* sisterEnvColor = &sPoSisterEnvColors[this->type]; + Color_RGBA8* flameColor = &sPoSisterFlameColors[this->type]; s32 pad; s32 i; - s32 phi_s5; - f32 phi_f20; + u8 alpha; + f32 scale; s32 pad2; OPEN_DISPS(play->state.gfxCtx); - func_80B1C974(this); + EnPoSisters_UpdateColors(this); func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - if ((this->unk_229 == 255) || (this->unk_229 == 0)) { - gDPSetEnvColor(POLY_OPA_DISP++, this->unk_226, this->unk_227, this->unk_228, this->unk_229); - gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); + if ((this->color.a == 255) || (this->color.a == 0)) { + gDPSetEnvColor(POLY_OPA_DISP++, this->color.r, this->color.g, this->color.b, this->color.a); + gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0); // empty POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_OPA_DISP); } else { - gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->unk_229); - gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->color.a); + gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88); // xlu only DL POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPoSisters_OverrideLimbDraw, EnPoSisters_PostLimbDraw, &this->actor, POLY_XLU_DISP); } - if (!(this->unk_191 & 0x80)) { - Matrix_Put(&this->unk_358); + if (!(this->poSisterFlags & POSISTERS_FLAG_DRAW_TORCH)) { + Matrix_Put(&this->mtxf); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_po_sisters_DL_0027B0); + gSPDisplayList(POLY_OPA_DISP++, gPoSistersDrawTorchDL); } gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) % 512, 32, 128)); - gDPSetEnvColor(POLY_XLU_DISP++, temp_s1->r, temp_s1->g, temp_s1->b, temp_s1->a); + gDPSetEnvColor(POLY_XLU_DISP++, sisterEnvColor->r, sisterEnvColor->g, sisterEnvColor->b, sisterEnvColor->a); - if (this->actionFunc == func_80B1BCA0) { - phi_s5 = (((-this->unk_192 * 255) + 0x1FE0) / 32) & 0xFF; - phi_f20 = 0.0056000003f; + if (this->actionFunc == EnPoSisters_DeathStage2) { + alpha = ((-this->deathTimer * 255) + 0x1FE0) / 32; + scale = (7 / 1.2500 * 0.001f); } else { - phi_s5 = 0; - phi_f20 = this->actor.scale.x * 0.5f; + alpha = 0; + scale = this->actor.scale.x * 0.5f; } - for (i = 0; i < this->unk_190; i++) { - if (this->actionFunc != func_80B1BCA0) { - phi_s5 = ((-i * 31) + 248) & 0xFF; + for (i = 0; i < this->fireCount; i++) { + if (this->actionFunc != EnPoSisters_DeathStage2) { + alpha = (-i * 31) + 248; } gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, flameColor->r, flameColor->g, flameColor->b, alpha); - Matrix_Translate(this->unk_22C[i].x, this->unk_22C[i].y, this->unk_22C[i].z, MTXMODE_NEW); + Matrix_Translate(this->firePos[i].x, this->firePos[i].y, this->firePos[i].z, MTXMODE_NEW); Matrix_RotateZYX(0, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), 0, MTXMODE_APPLY); - if (this->actionFunc == func_80B1BA90) { - f32 phi_f0; - - phi_f20 = ((this->unk_192 - i) * 0.025f) + 0.5f; - phi_f0 = CLAMP(phi_f20, 0.5f, 0.8f); - phi_f20 = phi_f0 * 0.007f; + if (this->actionFunc == EnPoSisters_DeathStage1) { + scale = ((this->deathTimer - i) * 0.025f) + 0.5f; + scale = CLAMP(scale, 0.5f, 0.8f) * 0.007f; } - Matrix_Scale(phi_f20, phi_f20, phi_f20, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); } Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), - this->actor.scale.x * 142.857131958f * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, + this->actor.scale.x * (1.0f / 0.007f) * this->drawDmgEffScale, 0.0f, this->drawDmgEffAlpha, ACTOR_DRAW_DMGEFF_LIGHT_ORBS); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 67e84d0dc..368ad9da1 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -2,42 +2,70 @@ #define Z_EN_PO_SISTERS_H #include "global.h" +#include "objects/object_po_sisters/object_po_sisters.h" struct EnPoSisters; typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); -#define ENPOSISTERS_GET_300(thisx) (((thisx)->params >> 8) & 3) -#define ENPOSISTERS_GET_C00(thisx) (((thisx)->params >> 0xA) & 3) -#define ENPOSISTERS_GET_1000(thisx) ((thisx)->params & 0x1000) +#define ENPOSISTERS_GET_OBSERVER_FLAG(thisx) ((thisx)->params & 0x1000) +#define ENPOSISTERS_GET_MEG_CLONE_ID(thisx) (((thisx)->params >> 0xA) & 3) +#define ENPOSISTERS_GET_TYPE(thisx) (((thisx)->params >> 8) & 3) + +#define ENPOSISTERS_PARAMS(observerFlag, megClone, type) (((observerFlag) << 0xC) | ((megClone & 3) << 0xA) | ((type & 3) << 8)) + +typedef enum { + /* 0 */ POSISTER_TYPE_MEG, // purple + /* 1 */ POSISTER_TYPE_JO, // red + /* 2 */ POSISTER_TYPE_BETH, // blue + /* 3 */ POSISTER_TYPE_AMY, // green +} EnPoSisterType; + +typedef enum { + /* 0 */ POSISTER_MEG_REAL, + /* 1 */ POSISTER_MEG_CLONE1, + /* 2 */ POSISTER_MEG_CLONE2, + /* 3 */ POSISTER_MEG_CLONE3, +} EnPoSisterMegCloneID; typedef struct EnPoSisters { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnPoSistersActionFunc actionFunc; - /* 0x18C */ u8 unk_18C; - /* 0x18D */ u8 unk_18D; - /* 0x18E */ u8 unk_18E; - /* 0x18F */ u8 unk_18F; - /* 0x190 */ u8 unk_190; - /* 0x191 */ u8 unk_191; - /* 0x192 */ s16 unk_192; - /* 0x194 */ s16 unk_194; - /* 0x196 */ Vec3s jointTable[12]; - /* 0x1DE */ Vec3s morphTable[12]; - /* 0x226 */ u8 unk_226; - /* 0x227 */ u8 unk_227; - /* 0x228 */ u8 unk_228; - /* 0x229 */ u8 unk_229; - /* 0x22C */ Vec3f unk_22C[8]; - /* 0x28C */ Vec3f limbPos[8]; - /* 0x2EC */ f32 unk_2EC; + /* 0x18C */ u8 type; + /* 0x18D */ u8 megCloneId; + /* 0x18E */ u8 floatingBobbingTimer; // counts down from 32 to zero, reset + /* 0x18F */ u8 zTargetTimer; // how many frames the player is z targeting, if zero -> invis + /* 0x190 */ u8 fireCount; + /* 0x191 */ u8 poSisterFlags; + /* 0x192 */ union { + s16 stateTimer; // generic name for resets + s16 spinTimer; // frames of spinning since spin attack starts, when zero checks collision + s16 fleeTimer; // after being hit, 5 frames of flying away + s16 deathTimer; // (incr) controls timings of the death cutscene, reset between the two stages + s16 laughTimer; // if observer, will laugh once in awhile + s16 spinupTimer; // frames of spinning up (gaining speed) for attack (jo/beth/amy attack) + s16 megSurroundTimer; // frames of meg circling the player menacingly until spin attack + s16 spinInvisibleTimer; // frames of spining away to invisible and back to visible + s16 idleFlyingAnimationCounter; // count: animations completed since entering actionFunc + }; + /* 0x194 */ union { + s16 invisibleTimer; // frames until coming back to fight from invisible (all combat variants) + s16 megAttackTimer; // delay until meg spin attacks player (negative frames counting up to 0) + s16 megClonesRemaining; // positive count of meg clones remaining + }; + /* 0x196 */ Vec3s jointTable[POSISTERS_LIMB_MAX]; + /* 0x1DE */ Vec3s morphTable[POSISTERS_LIMB_MAX]; + /* 0x226 */ Color_RGBA8 color; + /* 0x22C */ Vec3f firePos[8]; + /* 0x28C */ Vec3f limbPos[8]; // passed to Actor_DrawDamageEffects + /* 0x2EC */ f32 megDistToPlayer; /* 0x2F0 */ f32 drawDmgEffAlpha; /* 0x2F4 */ f32 drawDmgEffScale; /* 0x2F8 */ LightNode* lightNode; /* 0x2FC */ LightInfo lightInfo; /* 0x30C */ ColliderCylinder collider; - /* 0x358 */ MtxF unk_358; + /* 0x358 */ MtxF mtxf; } EnPoSisters; // size = 0x398 extern const ActorInit En_Po_Sisters_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 7b7d7a76b..529ac9f4e 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -30,11 +30,11 @@ void EnRacedog_CheckForFinish(EnRacedog* this); void EnRacedog_UpdateRunAnimationPlaySpeed(EnRacedog* this); s32 EnRacedog_IsOverFinishLine(EnRacedog* this, Vec2f* arg1); void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play); -void EnRacedog_PlayWalkSfx(EnRacedog* this); +void EnRacedog_PlaySfxWalk(EnRacedog* this); /** - * Dogs can be in three conditions, which is indicated by the message it says when - * you pick it up prior to entering the race. + * Dogs can be in three conditions, which is, for the most part, indicated by the + * message it says when you pick it up prior to entering the race. * If it starts with "Ruff!", it's in good condition. * If it starts with "Rrr-Ruff!", it's in normal condition. * If it starts with "Hoo-whine", it's in bad condition. @@ -42,30 +42,21 @@ void EnRacedog_PlayWalkSfx(EnRacedog* this); * - 0x3538 - 0x353D: Good condition * - 0x353E - 0x3541: Normal condition * - 0x3542 - 0x3546: Bad condition + * + * There are two caveats, though, that are useful to keep in mind: + * - Because of differences between how EnDg computes the text ID and how EnRacedog + * computes it, there are two dogs whose text upon picking them up does not + * accurately reflect their condition during the race. Check the comment above + * EnRacedog_UpdateTextId for more information on this phenomenon. + * - Note that text ID 0x353D is actually used for the Romani Ranch dog; its text + * just so happens to be in the middle of the race dog text block. In EnDg, the + * dog that gets this text ID will instead use text ID 0x3538 when the player + * picks it up. Since EnRacedog cannot be picked up, however, it can use 0x353D + * as an additional good condition text ID. */ #define DOG_IS_IN_GOOD_CONDITION(this) (sDogInfo[this->index].textId < 0x353E) #define DOG_IS_IN_BAD_CONDITION(this) (sDogInfo[this->index].textId >= 0x3542) -typedef enum { - /* 0 */ RACEDOG_ANIMATION_IDLE, - /* 1 */ RACEDOG_ANIMATION_WALK_1, - /* 2 */ RACEDOG_ANIMATION_RUN, - /* 3 */ RACEDOG_ANIMATION_BARK, - /* 4 */ RACEDOG_ANIMATION_SIT_DOWN_1, - /* 5 */ RACEDOG_ANIMATION_SIT_DOWN_2, - /* 6 */ RACEDOG_ANIMATION_LYING_DOWN_START_1, - /* 7 */ RACEDOG_ANIMATION_LYING_DOWN_LOOP, - /* 8 */ RACEDOG_ANIMATION_LYING_DOWN_START_2, - /* 9 */ RACEDOG_ANIMATION_LYING_DOWN_START_3, - /* 10 */ RACEDOG_ANIMATION_LYING_DOWN_START_4, - /* 11 */ RACEDOG_ANIMATION_WALK_2, - /* 12 */ RACEDOG_ANIMATION_JUMP, - /* 13 */ RACEDOG_ANIMATION_LONG_JUMP, - /* 14 */ RACEDOG_ANIMATION_JUMP_2, - /* 15 */ RACEDOG_ANIMATION_WALK_3, - /* 16 */ RACEDOG_ANIMATION_MAX -} RacedogAnimationIndex; - /** * Stores various information for each dog in the race, mostly related to speed. */ @@ -212,6 +203,26 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; +typedef enum { + /* 0 */ RACEDOG_ANIMATION_IDLE, + /* 1 */ RACEDOG_ANIMATION_WALK_1, // unused + /* 2 */ RACEDOG_ANIMATION_RUN, + /* 3 */ RACEDOG_ANIMATION_BARK, // unused + /* 4 */ RACEDOG_ANIMATION_SIT_DOWN_ONCE, // unused + /* 5 */ RACEDOG_ANIMATION_SIT_DOWN, // unused + /* 6 */ RACEDOG_ANIMATION_LYING_DOWN_START_1, // unused + /* 7 */ RACEDOG_ANIMATION_LYING_DOWN_LOOP, // unused + /* 8 */ RACEDOG_ANIMATION_LYING_DOWN_START_2, // unused + /* 9 */ RACEDOG_ANIMATION_LYING_DOWN_START_3, // unused + /* 10 */ RACEDOG_ANIMATION_LYING_DOWN_START_4, // unused + /* 11 */ RACEDOG_ANIMATION_WALK_BACKWARDS, // unused + /* 12 */ RACEDOG_ANIMATION_JUMP, + /* 13 */ RACEDOG_ANIMATION_LONG_JUMP, // unused + /* 14 */ RACEDOG_ANIMATION_JUMP_ATTACK, // unused + /* 15 */ RACEDOG_ANIMATION_SWIM, // unused + /* 16 */ RACEDOG_ANIMATION_MAX +} RacedogAnimationIndex; + static AnimationInfoS sAnimations[] = { { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, { &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, @@ -220,7 +231,7 @@ static AnimationInfoS sAnimations[] = { { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDogJump2Anim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, }; static InitChainEntry sInitChain[] = { @@ -255,27 +266,27 @@ void EnRacedog_UpdateCollision(EnRacedog* this, PlayState* play) { */ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ) { Vec3s* point; - f32 xDiffRand; - f32 zDiffRand; - f32 xDiff; - f32 zDiff; + f32 diffXRand; + f32 diffZRand; + f32 diffX; + f32 diffZ; if (path != NULL) { point = Lib_SegmentedToVirtual(path->points); point = &point[pointIndex]; - xDiffRand = (randPlusMinusPoint5Scaled(100.0f) + point->x) - pos->x; - zDiffRand = (randPlusMinusPoint5Scaled(100.0f) + point->z) - pos->z; - xDiff = point->x - pos->x; - zDiff = point->z - pos->z; + diffXRand = (randPlusMinusPoint5Scaled(100.0f) + point->x) - pos->x; + diffZRand = (randPlusMinusPoint5Scaled(100.0f) + point->z) - pos->z; + diffX = point->x - pos->x; + diffZ = point->z - pos->z; } else { - xDiffRand = 0.0f; - zDiffRand = 0.0f; - xDiff = 0.0f; - zDiff = 0.0f; + diffXRand = 0.0f; + diffZRand = 0.0f; + diffX = 0.0f; + diffZ = 0.0f; } - *distSQ = SQ(xDiff) + SQ(zDiff); - return RADF_TO_BINANG(Math_Acot2F(zDiffRand, xDiffRand)); + *distSQ = SQ(diffX) + SQ(diffZ); + return RADF_TO_BINANG(Math_Acot2F(diffZRand, diffXRand)); } void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) { @@ -409,7 +420,7 @@ void EnRacedog_Race(EnRacedog* this, PlayState* play) { } EnRacedog_UpdateRunAnimationPlaySpeed(this); - EnRacedog_PlayWalkSfx(this); + EnRacedog_PlaySfxWalk(this); EnRacedog_SpawnFloorDustRing(this, play); } @@ -417,18 +428,26 @@ void EnRacedog_Race(EnRacedog* this, PlayState* play) { * Updates the text ID in sDogInfo based on what was set in the weekEventRegs by * En_Aob_01. This makes it so sDogInfo can be used in other functions to determine * the condition of the dog. + * + * Note that the text IDs generated by this function are off-by-one compared to the + * similar function in EnDg. The end result of this is that one of the dogs that says + * it's in good condition when you pick it up is actually in normal condition once the + * race starts, and one of the dogs that says it's in normal condition when you pick + * it up is actually in bad condition. It's unknown whether this is a simple oversight + * or an intentional choice to introduce a bit of extra variance to the race. */ void EnRacedog_UpdateTextId(EnRacedog* this) { + // Assuming that the weekEventRegs haven't been tampered with, then this will produce a text ID in the + // range of 0x3539 to 0x3546. if (this->index % 2) { sDogInfo[this->index].textId = - (((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & (0x10 | 0x20 | 0x40 | 0x80)) >> 4) + 0x3539; + (((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & 0xF0) >> 4) + 0x3539; } else { - sDogInfo[this->index].textId = - ((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & (1 | 2 | 4 | 8)) + 0x3539; + sDogInfo[this->index].textId = ((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & 0x0F) + 0x3539; } - // This makes sure the text ID is something in the range of 0x3539 to 0x3547. - if ((sDogInfo[this->index].textId >= 0x3547) || (sDogInfo[this->index].textId < 0x3539)) { + // As a sanity check, this makes sure the text ID is something in the expected range of 0x3539 to 0x3546. + if ((sDogInfo[this->index].textId > 0x3546) || (sDogInfo[this->index].textId < 0x3539)) { sDogInfo[this->index].textId = 0x353E; } @@ -650,7 +669,7 @@ void EnRacedog_SpawnFloorDustRing(EnRacedog* this, PlayState* play) { } } -void EnRacedog_PlayWalkSfx(EnRacedog* this) { +void EnRacedog_PlaySfxWalk(EnRacedog* this) { s16 curFrame = this->skelAnime.curFrame; if ((curFrame == 1) || (curFrame == 7)) { 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 8044a6c98..1c8756148 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 @@ -513,26 +513,26 @@ void func_80B717E0(EnRailSkb* this, PlayState* play) { this->unk_3FA = 0; switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: break; - case 3: + case TEXT_STATE_3: if ((play->gameplayFrames % 2) != 0) { this->unk_3FA = 1; } break; - case 4: + case TEXT_STATE_CHOICE: func_80B72100(this, play); break; - case 5: + case TEXT_STATE_5: func_80B71F3C(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80B71650(this); } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 5da1d95b0..1a197d6b5 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -968,14 +968,14 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { } } else { switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { Message_StartTextbox(play, 0x13B3, &this->actor); this->textId = 0x13B3; } break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->textId = 0; this->isInvincible = false; @@ -983,11 +983,11 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { } break; - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; } } diff --git a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c index bb5e3b9bc..d817d1df4 100644 --- a/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c +++ b/src/overlays/actors/ovl_En_Recepgirl/z_en_recepgirl.c @@ -141,10 +141,10 @@ void EnRecepgirl_Talk(EnRecepgirl* this, PlayState* play) { } talkState = Message_GetState(&play->msgCtx); - if (talkState == 2) { + if (talkState == TEXT_STATE_CLOSING) { this->actor.textId = 0x2ADC; // hear directions again? EnRecepgirl_SetupWait(this); - } else if ((talkState == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->actor.textId == 0x2AD9) { // "Welcome..." Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); 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 db1115746..8fc202ddd 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -313,7 +313,7 @@ void func_808FA4F4(EnRr* this, PlayState* play) { sp34 = false; } - if (sp34 && (Message_GetState(&play->msgCtx) == 0)) { + if (sp34 && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { Message_StartTextbox(play, 0xF6, NULL); } diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index ad336d13a..2954bc041 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -312,14 +312,14 @@ void func_80BCB52C(EnScopenuts* this, PlayState* play) { } void func_80BCB6D0(EnScopenuts* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->unk_328 & 1) { this->unk_328 &= ~1; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_328 &= ~4; this->unk_348 = 8; @@ -330,7 +330,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { Message_StartTextbox(play, this->unk_33C, &this->actor); } } - } else if (temp_v0 == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -342,7 +342,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { } else { func_8019F208(); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Rupees_ChangeBy(-this->unk_358); this->actionFunc = func_80BCB90C; } @@ -359,7 +359,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { break; } } - } else if (temp_v0 == 6) { + } else if (talkState == TEXT_STATE_DONE) { func_800B85E0(&this->actor, play, 400.0f, -1); this->actionFunc = func_80BCB980; } diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index e33da1073..8e0ad276c 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -5,6 +5,11 @@ */ #include "z_en_sekihi.h" +#include "objects/object_sekihil/object_sekihil.h" +#include "objects/object_sekihig/object_sekihig.h" +#include "objects/object_sekihin/object_sekihin.h" +#include "objects/object_sekihiz/object_sekihiz.h" +#include "objects/object_zog/object_zog.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -13,13 +18,12 @@ void EnSekihi_Init(Actor* thisx, PlayState* play); void EnSekihi_Destroy(Actor* thisx, PlayState* play); void EnSekihi_Update(Actor* thisx, PlayState* play); +void EnSekihi_Draw(Actor* thisx, PlayState* play); void func_80A44DE8(EnSekihi* this, PlayState* play); -void func_80A44F40(EnSekihi* this, PlayState* play); void func_80A450B0(EnSekihi* this, PlayState* play); -void func_80A45130(EnSekihi* this, PlayState* play); +void EnSekihi_DoNothing(EnSekihi* this, PlayState* play); -#if 0 const ActorInit En_Sekihi_InitVars = { ACTOR_EN_SEKIHI, ACTORCAT_PROP, @@ -32,20 +36,150 @@ const ActorInit En_Sekihi_InitVars = { (ActorFunc)NULL, }; -#endif +static s16 sObjectIds[] = { OBJECT_SEKIHIL, OBJECT_SEKIHIG, OBJECT_SEKIHIN, OBJECT_SEKIHIZ, OBJECT_ZOG }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Init.s") +static Gfx* sOpaDLists[] = { + gGraveTriforceSymbolDL, gGraveGoronSymbolDL, gGraveKokiriSymbolDL, gTombSongOfSoaringDL, gMikauGraveDL, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Destroy.s") +static Gfx* sXluDLists[] = { + gSunSongTriforceSymbolDL, gSunSongGoronSymbolDL, gSunSongKokiriSymbolDL, gSekihizEmptyDL, gMikauGraveDirtDL, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A44DE8.s") +static u16 sTextIds[] = { 0, 0, 0, 0, 0x1018 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A44F40.s") +void EnSekihi_Init(Actor* thisx, PlayState* play) { + EnSekihi* this = THIS; + s32 params = ENSIKIHI_GET_TYPE(thisx); + s32 objectIndex; + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A450B0.s") + if ((params < SEKIHI_TYPE_0 || params >= SEKIHI_TYPE_MAX) || sOpaDLists[params] == NULL) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= 30)) { + gSaveContext.save.weekEventReg[13] |= 0x20; + } + objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]); + if (objectIndex >= 0) { + this->objectIndex = objectIndex; + } + this->actionFunc = func_80A44DE8; + this->opaDList = sOpaDLists[params]; + this->xluDList = sXluDLists[params]; + this->dyna.actor.textId = sTextIds[params]; + this->dyna.actor.focus.pos.y = this->dyna.actor.world.pos.y + 60.0f; + Actor_SetScale(&this->dyna.actor, 0.1f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A45130.s") +void EnSekihi_Destroy(Actor* thisx, PlayState* play) { + EnSekihi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Update.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A45164.s") +void func_80A44DE8(EnSekihi* this, PlayState* play) { + CollisionHeader* colHeader = NULL; + s32 params; + CollisionHeader* colHeaders[] = { + &gSekihilCol, &gSekihigCol, &gSekihinCol, &gSekihizCol, &gObjectZogCol, + }; + + params = ENSIKIHI_GET_TYPE(&this->dyna.actor); + if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) { + this->dyna.actor.objBankIndex = this->objectIndex; + this->dyna.actor.draw = EnSekihi_Draw; + if (params == SEKIHI_TYPE_4) { + this->actionFunc = func_80A450B0; + } else { + this->actionFunc = EnSekihi_DoNothing; + } + + Actor_SetObjectDependency(play, &this->dyna.actor); + DynaPolyActor_Init(&this->dyna, 0); + if (colHeaders[params] != NULL) { + CollisionHeader_GetVirtual(colHeaders[params], &colHeader); + } + + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + if ((params == SEKIHI_TYPE_4) && (INV_CONTENT(ITEM_MASK_ZORA) != ITEM_MASK_ZORA)) { + Actor_MarkForDeath(&this->dyna.actor); + } + } +} + +void func_80A44F40(EnSekihi* this, PlayState* play) { + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1019)) { + switch (play->msgCtx.choiceIndex) { + case 0: + func_8019F208(); + func_80151938(play, 0x101A); + break; + case 1: + func_8019F208(); + func_80151938(play, 0x101B); + break; + case 2: + func_8019F230(); + func_801477B4(play); + this->actionFunc = func_80A450B0; + break; + } + } else { + break; + } + break; + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.currentTextId) { + case 0x1018: + func_80151938(play, play->msgCtx.currentTextId + 1); + break; + case 0x101A: + case 0x101B: + func_801477B4(play); + this->actionFunc = func_80A450B0; + break; + } + } + break; + } +} + +void func_80A450B0(EnSekihi* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { + this->actionFunc = func_80A44F40; + } else if ((this->dyna.actor.xzDistToPlayer < 100.0f) && (Player_IsFacingActor(&this->dyna.actor, 0x2600, play))) { + func_800B8614(&this->dyna.actor, play, 120.0f); + } +} + +void EnSekihi_DoNothing(EnSekihi* this, PlayState* play) { +} + +void EnSekihi_Update(Actor* thisx, PlayState* play) { + EnSekihi* this = THIS; + + this->actionFunc(this, play); +} + +void EnSekihi_Draw(Actor* thisx, PlayState* play) { + EnSekihi* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + if (this->xluDList != NULL) { + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gSPDisplayList(POLY_XLU_DISP++, this->xluDList); + } + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C28C(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, this->opaDList); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h index 44d3873e9..e626b616d 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.h @@ -3,16 +3,29 @@ #include "global.h" +#define ENSIKIHI_GET_TYPE(thisx) ((thisx)->params & 0xF) + struct EnSekihi; typedef void (*EnSekihiActionFunc)(struct EnSekihi*, PlayState*); typedef struct EnSekihi { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x24]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ Gfx* opaDList; + /* 0x160 */ Gfx* xluDList; + /* 0x164 */ s8 objectIndex; /* 0x168 */ EnSekihiActionFunc actionFunc; } EnSekihi; // size = 0x16C +typedef enum SekihiType { + /* 0x0 */ SEKIHI_TYPE_0, + /* 0x1 */ SEKIHI_TYPE_1, + /* 0x2 */ SEKIHI_TYPE_2, + /* 0x3 */ SEKIHI_TYPE_3, + /* 0x4 */ SEKIHI_TYPE_4, + /* 0x5 */ SEKIHI_TYPE_MAX +} SekihiType; + extern const ActorInit En_Sekihi_InitVars; #endif // Z_EN_SEKIHI_H 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 3faeedd7e..aacfa5685 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -341,7 +341,7 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_2A) { + if (Player_GetExchangeItemId(play) == EXCH_ITEM_MOON_TEAR) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; this->actionFunc = func_80ADBAB8; @@ -382,7 +382,7 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { } else if (((this->actor.xzDistToPlayer < 80.0f) && (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || this->actor.isTargeted) { - func_800B85E0(&this->actor, play, 80.0f, EXCH_ITEM_2A); + func_800B85E0(&this->actor, play, 80.0f, EXCH_ITEM_MOON_TEAR); if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -416,13 +416,13 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { void func_80ADB924(EnSellnuts* this, PlayState* play) { Player* player = GET_PLAYER(play); - u8 msgState = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s32 item; - if (msgState == 0x10) { + if (talkState == TEXT_STATE_16) { item = func_80123810(play); if (item > EXCH_ITEM_NONE) { - if (item == EXCH_ITEM_2A) { + if (item == EXCH_ITEM_MOON_TEAR) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; player->exchangeItemId = item; @@ -438,7 +438,7 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { func_80151938(play, this->unk_340); this->actionFunc = func_80ADB0D8; } - } else if ((msgState == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_340 == D_80ADD910[this->unk_33A]) { this->unk_340 = D_80ADD938[this->unk_33A]; func_80151938(play, this->unk_340); @@ -452,7 +452,7 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { } void func_80ADBAB8(EnSellnuts* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -468,9 +468,9 @@ void func_80ADBAB8(EnSellnuts* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 6); } - if ((sp27 == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = func_80ADBBEC; func_800B7298(play, NULL, 0x13); } @@ -497,7 +497,7 @@ void func_80ADBC60(EnSellnuts* this, PlayState* play) { } void func_80ADBCE4(EnSellnuts* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; this->actionFunc = func_80ADBC60; @@ -505,7 +505,7 @@ void func_80ADBCE4(EnSellnuts* this, PlayState* play) { } void func_80ADBD64(EnSellnuts* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); @@ -514,9 +514,9 @@ void func_80ADBD64(EnSellnuts* this, PlayState* play) { SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); } - if ((sp27 == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_338 &= ~2; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_34C = 8; @@ -556,9 +556,9 @@ void func_80ADBE80(EnSellnuts* this, PlayState* play) { } void func_80ADBFA0(EnSellnuts* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if (this->unk_34C == 0) { this->actionFunc = func_80ADB544; } else { @@ -719,9 +719,9 @@ void func_80ADC5A4(EnSellnuts* this, PlayState* play) { void func_80ADC6D0(EnSellnuts* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -737,7 +737,7 @@ void func_80ADC6D0(EnSellnuts* this, PlayState* play) { } void func_80ADC7B4(EnSellnuts* this, PlayState* play) { - s32 temp = Message_GetState(&play->msgCtx); + s32 talkState = Message_GetState(&play->msgCtx); if (this->unk_366 == 0) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -749,9 +749,9 @@ void func_80ADC7B4(EnSellnuts* this, PlayState* play) { } ActorCutscene_SetIntentToPlay(this->cutscene); } - } else if ((this->unk_366 == 1) && (temp == 5) && Message_ShouldAdvance(play)) { + } else if ((this->unk_366 == 1) && (talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_366 = 0; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); 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 50337f31e..817648daa 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -17,7 +17,6 @@ void EnShn_Update(Actor* thisx, PlayState* play); void EnShn_Draw(Actor* thisx, PlayState* play); void func_80AE69E8(EnShn* this, PlayState* play); void func_80AE6A64(EnShn* this, PlayState* play); -s32 func_80AE6704(EnShn* this, PlayState* play); // Could be something related to text/dialogue? static UNK_TYPE D_80AE6F00[] = { @@ -177,17 +176,16 @@ void func_80AE63A8(EnShn* this, PlayState* play) { void func_80AE6488(EnShn* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 tempMsgState; + s32 talkState = Message_GetState(&play->msgCtx); f32 phi_f0_2; f32 phi_f0; - tempMsgState = Message_GetState(&play->msgCtx); this->unk_2D4 += (this->unk_2D0 != 0.0f) ? 40.0f : -40.0f; this->unk_2D4 = CLAMP(this->unk_2D4, 0.0f, 80.0f); Matrix_Translate(this->unk_2D4, 0.0f, 0.0f, MTXMODE_APPLY); if ((&this->actor == player->targetActor) && - ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId >= 0x201)) && (tempMsgState == 3) && - (this->msgState == 3)) { + ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId >= 0x201)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3)) { if (play->state.frames % 2 == 0) { if (this->unk_2D0 != 0.0f) { this->unk_2D0 = 0.0f; @@ -198,7 +196,7 @@ void func_80AE6488(EnShn* this, PlayState* play) { } else { this->unk_2D0 = 0.0f; } - this->msgState = tempMsgState; + this->prevTalkState = talkState; } s32 func_80AE65F4(EnShn* this, PlayState* play) { @@ -229,7 +227,7 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { return false; } -s32 func_80AE6704(EnShn* thisx, PlayState* play) { +s32 func_80AE6704(Actor* thisx, PlayState* play) { EnShn* this = THIS; s32 ret = 0; @@ -260,9 +258,9 @@ s32 func_80AE6704(EnShn* thisx, PlayState* play) { func_800B7298(play, &this->actor, 7); play->nextEntranceIndex = 0x8460; gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = 0x14; - play->unk_1887F = 3; - gSaveContext.nextTransition = 7; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_07; this->unk_2C6++; break; } 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 eb0e46ee7..e373abde2 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.h +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.h @@ -7,6 +7,7 @@ struct EnShn; typedef void (*EnShnActionFunc)(struct EnShn*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnShn { /* 0x000 */ Actor actor; @@ -34,8 +35,8 @@ typedef struct EnShn { /* 0x2CC */ f32 playSpeed; /* 0x2D0 */ f32 unk_2D0; /* 0x2D4 */ f32 unk_2D4; - /* 0x2D8 */ s32 unk_2D8; - /* 0x2DC */ s32 msgState; + /* 0x2D8 */ MsgEventFunc unk_2D8; + /* 0x2DC */ s32 prevTalkState; /* 0x2E0 */ s32 unk_2E0; /* 0x2E4 */ s32 unk_2E4; /* 0x2E8 */ s32 unk_2E8; 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 9a55b388d..21df2d8f9 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -363,14 +363,14 @@ void func_80995068(EnSkb* this, PlayState* play) { void func_80995190(EnSkb* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { Message_StartTextbox(play, 0x13F7, &this->actor); if (this->unk_3DE == 2) { @@ -379,7 +379,7 @@ void func_80995190(EnSkb* this, PlayState* play) { } break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { this->actionFunc = func_80995244; } 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 2d0f3d95b..627250635 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -441,7 +441,7 @@ void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { } Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; @@ -506,7 +506,7 @@ void EnSob1_SetupLookToShopkeeperFromShelf(PlayState* play, EnSob1* this) { } void EnSob1_EndingInteraction(EnSob1* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { EnSob1_EndInteraction(play, this); } } @@ -610,7 +610,7 @@ void EnSob1_Hello(EnSob1* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if ((talkState == 5) && Message_ShouldAdvance(play) && + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play) && !EnSob1_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if (this->welcomeTextId == 0x68A) { // Welcome text when wearing Kafei's mask EnSob1_EndInteraction(play, this); @@ -659,7 +659,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else { - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnSob1_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if (!Message_ShouldAdvance(play) || !EnSob1_FacingShopkeeperDialogResult(this, play)) { @@ -680,7 +680,7 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { } void EnSob1_TalkingToShopkeeper(EnSob1* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { EnSob1_StartShopping(play, this); } } @@ -911,7 +911,7 @@ void EnSob1_BrowseShelf(EnSob1* this, PlayState* play) { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; EnSob1_UpdateCursorPos(play, this); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnSob1_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { EnSob1_CursorLeftRight(play, this); @@ -930,7 +930,7 @@ void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; @@ -1019,7 +1019,7 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { void EnSob1_SelectItem(EnSob1* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (EnSob1_TakeItemOffShelf(this) && talkState == 4) { + if (EnSob1_TakeItemOffShelf(this) && (talkState == TEXT_STATE_CHOICE)) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnSob1_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { @@ -1037,7 +1037,7 @@ void EnSob1_SelectItem(EnSob1* this, PlayState* play) { } void EnSob1_CannotBuy(EnSob1* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; func_80151938(play, this->items[this->cursorIndex]->actor.textId); @@ -1048,7 +1048,7 @@ void EnSob1_CannotBuy(EnSob1* this, PlayState* play) { void EnSob1_CanBuy(EnSob1* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnSob1_ResetItemPosition(this); item = this->items[this->cursorIndex]; @@ -1068,9 +1068,9 @@ void EnSob1_BuyItemWithFanfare(EnSob1* this, PlayState* play) { } void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; EnSob1_SetupAction(this, EnSob1_ItemPurchased); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1087,7 +1087,7 @@ void EnSob1_ContinueShopping(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); EnGirlA* item; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { EnSob1_ResetItemPosition(this); item = this->items[this->cursorIndex]; item->restockFunc(play, item); 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 031fd14e8..d7c41603e 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -683,7 +683,7 @@ void EnSsh_Wait(EnSsh* this, PlayState* play) { void EnSsh_Talk(EnSsh* this, PlayState* play) { EnSsh_Bob(this, play); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x904: case 0x905: diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 2e9d6ed27..664a74aa1 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -200,7 +200,7 @@ void func_80B67148(EnSth* this, PlayState* play) { void func_80B671A0(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = func_80B67208; func_801477B4(play); } @@ -312,7 +312,7 @@ void func_80B67540(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1134: @@ -382,7 +382,7 @@ void func_80B67540(EnSth* this, PlayState* play) { } break; - case 2: + case TEXT_STATE_CLOSING: this->actionFunc = func_80B677BC; this->unk_29C |= 2; break; @@ -403,7 +403,7 @@ void func_80B677BC(EnSth* this, PlayState* play) { void func_80B67838(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = func_80B678A8; func_801477B4(play); } @@ -494,7 +494,7 @@ void func_80B67C1C(EnSth* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x90C: func_80B670A4(this, 2); diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c index 4cf9cb5fd..3ce5ba447 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c @@ -13,8 +13,11 @@ void EnSth2_Init(Actor* thisx, PlayState* play); void EnSth2_Destroy(Actor* thisx, PlayState* play); void EnSth2_Update(Actor* thisx, PlayState* play); +void EnSth2_Draw(Actor* thisx, PlayState* play2); + +void EnSth2_UpdateSkelAnime(EnSth2* this, PlayState* play); +void EnSth2_UpdateActionFunc(Actor* thisx, PlayState* play); -#if 0 const ActorInit En_Sth2_InitVars = { ACTOR_EN_STH2, ACTORCAT_NPC, @@ -27,22 +30,95 @@ const ActorInit En_Sth2_InitVars = { (ActorFunc)NULL, }; -#endif +#include "overlays/ovl_En_Sth2/ovl_En_Sth2.c" -extern UNK_TYPE D_060031F8; +void EnSth2_Init(Actor* thisx, PlayState* play) { + EnSth2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/EnSth2_Init.s") + this->objIndex = Object_GetIndex(&play->objectCtx, OBJECT_STH); + Actor_SetScale(&this->actor, 0.01f); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); + this->unused = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/EnSth2_Destroy.s") + if (play->actorCtx.unk5 & 2) { + this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20); + } else { + Actor_MarkForDeath(&this->actor); + return; + } + this->actionFunc = EnSth2_UpdateSkelAnime; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/func_80BF75A0.s") +void EnSth2_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/EnSth2_Update.s") +void EnSth2_UpdateSkelAnime(EnSth2* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/func_80BF7688.s") +void EnSth2_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnSth2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/func_80BF76AC.s") + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + this->actor.objBankIndex = this->objIndex; + Actor_SetObjectDependency(play, &this->actor); + SkelAnime_InitFlex(play, &this->skelAnime, &object_sth_Skel_0031F8, &gEnSth2WavingHandAnim, this->jointTable, + this->morphTable, OBJECT_STH_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gEnSth2WavingHandAnim); + this->actor.update = EnSth2_UpdateActionFunc; + this->actor.draw = EnSth2_Draw; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/func_80BF77AC.s") +void EnSth2_UpdateActionFunc(Actor* thisx, PlayState* play) { + EnSth2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sth2/func_80BF7814.s") + this->actionFunc(this, play); +} + +s32 EnSth2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + s32 pad; + + if (limbIndex == OBJECT_STH_LIMB_0F) { + *dList = gEnSth2HeadDL; + } + if ((limbIndex == OBJECT_STH_LIMB_08) || (limbIndex == OBJECT_STH_LIMB_0A) || (limbIndex == OBJECT_STH_LIMB_0D)) { + rot->y += (s16)(Math_SinS((play->state.frames * ((limbIndex * 50) + 0x814))) * 200.0f); + rot->z += (s16)(Math_CosS((play->state.frames * ((limbIndex * 50) + 0x940))) * 200.0f); + } + return false; +} + +void EnSth2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f focusOffset = { 700.0f, 400.0f, 0.0f }; + + if (limbIndex == OBJECT_STH_LIMB_0F) { + Matrix_MultVec3f(&focusOffset, &thisx->focus.pos); + + OPEN_DISPS(play->state.gfxCtx); + + gSPDisplayList(POLY_OPA_DISP++, gEnSth2HairDL); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void EnSth2_Draw(Actor* thisx, PlayState* play2) { + static Color_RGB8 sEnvColors[] = { + { 190, 110, 0 }, { 0, 180, 110 }, { 0, 255, 80 }, { 255, 160, 60 }, { 190, 230, 250 }, { 240, 230, 120 }, + }; + PlayState* play = play2; + EnSth2* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, + Gfx_EnvColor(play->state.gfxCtx, sEnvColors[1].r, sEnvColors[1].g, sEnvColors[1].b, 255)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 90, 110, 130, 255)); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnSth2_OverrideLimbDraw, EnSth2_PostLimbDraw, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h index 1788c486c..1166c9d29 100644 --- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h +++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.h @@ -2,12 +2,20 @@ #define Z_EN_STH2_H #include "global.h" +#include "objects/object_sth/object_sth.h" struct EnSth2; +typedef void (*EnSth2ActionFunc)(struct EnSth2*, PlayState*); + typedef struct EnSth2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x10C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[OBJECT_STH_LIMB_MAX]; + /* 0x1E8 */ Vec3s morphTable[OBJECT_STH_LIMB_MAX]; + /* 0x248 */ s16 unused; + /* 0x24A */ u8 objIndex; + /* 0x24C */ EnSth2ActionFunc actionFunc; } EnSth2; // size = 0x250 extern const ActorInit En_Sth2_InitVars; 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 36e57f0b6..3fed1f8f2 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -224,9 +224,9 @@ Actor* EnSuttari_GetActorById(PlayState* play, s16 actorId) { void EnSuttari_SetNextEntrance(PlayState* play, u16 nextEntranceIndex) { play->nextEntranceIndex = nextEntranceIndex; - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; + play->transitionTrigger = TRANS_TRIGGER_START; } void EnSuttari_UpdateTime(void) { @@ -673,16 +673,14 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { } } -s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { +s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp26 = SCHEDULE_TIME_NOW; - u16 pad1; - u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); - u16 pad2; - s32 sp1C = D_80BAE8F8[scheduleResult->result]; u16 phi_a0; + u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); + u16 tmp; - if (sp1C >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp23, sp1C); + if (D_80BAE8F8[scheduleOutput->result] >= 0) { + this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAE8F8[scheduleOutput->result]); } if (this->timePath == NULL) { return 0; @@ -690,23 +688,23 @@ s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu if ((this->unk428 != 0 && this->unk428 < 0xC) && (this->timePathTimeSpeed >= 0)) { phi_a0 = sp26; } else { - phi_a0 = scheduleResult->time0; + phi_a0 = scheduleOutput->time0; } - if (scheduleResult->time1 < phi_a0) { - this->timePathTotalTime = (phi_a0 - scheduleResult->time1) + 0xFFFF; + if (scheduleOutput->time1 < phi_a0) { + this->timePathTotalTime = (phi_a0 - scheduleOutput->time1) + 0xFFFF; } else { - this->timePathTotalTime = scheduleResult->time1 - phi_a0; + this->timePathTotalTime = scheduleOutput->time1 - phi_a0; } this->timePathElapsedTime = sp26 - phi_a0; - phi_a0 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + tmp = phi_a0 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); this->unk42C = 0; - this->timePathWaypointTime = this->timePathTotalTime / phi_a0; + this->timePathWaypointTime = this->timePathTotalTime / tmp; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk430 = 0; return 1; } -s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { +s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 pad; EnDoor* sp48; u8 sp47 = ENSUTTARI_GET_PATH(&this->actor); @@ -720,7 +718,7 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu return 0; } sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR); - sp24 = D_80BAE8F8[scheduleResult->result]; + sp24 = D_80BAE8F8[scheduleOutput->result]; if ((sp48 != NULL) && (sp24 >= 0)) { this->timePath = SubS_GetAdditionalPath(play, sp47, sp24); } @@ -730,9 +728,9 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu sp28 = Lib_SegmentedToVirtual(this->timePath->points); Math_Vec3s_ToVec3f(&sp38, &sp28[0]); Math_Vec3s_ToVec3f(&sp2C, &sp28[1]); - this->unk434 = sp44 - scheduleResult->time0; - this->unk436 = scheduleResult->time1 - scheduleResult->time0; - if (scheduleResult->result != 10 && scheduleResult->result != 11) { + this->unk434 = sp44 - scheduleOutput->time0; + this->unk436 = scheduleOutput->time1 - scheduleOutput->time0; + if (scheduleOutput->result != 10 && scheduleOutput->result != 11) { sp48->unk_1A7 = 0x4B; } Math_Vec3f_Copy(&this->unk438, &sp38); @@ -742,15 +740,15 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu return 1; } -s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) { +s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; - switch (scheduleResult->result) { + switch (scheduleOutput->result) { case 15: case 14: case 13: case 12: - ret = func_80BABC48(this, play, scheduleResult); + ret = func_80BABC48(this, play, scheduleOutput); break; case 11: case 10: @@ -758,7 +756,7 @@ s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu case 8: case 7: case 6: - ret = func_80BABDD8(this, play, scheduleResult); + ret = func_80BABDD8(this, play, scheduleOutput); break; case 5: case 4: @@ -1100,17 +1098,17 @@ void func_80BACE4C(EnSuttari* this, PlayState* play) { } void func_80BACEE0(EnSuttari* this, PlayState* play) { - ScheduleResult scheduleResult; + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || + ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_1; - scheduleResult.result = 0; + scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } - this->unk428 = scheduleResult.result; + this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); func_80BAB434(this); if (this->unk428 == 5) { @@ -1124,17 +1122,17 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) { } void func_80BAD004(EnSuttari* this, PlayState* play) { - ScheduleResult scheduleResult; + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || + ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_1; - scheduleResult.result = 0; + scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } - this->unk428 = scheduleResult.result; + this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A3A, &this->actor); @@ -1148,9 +1146,9 @@ void func_80BAD004(EnSuttari* this, PlayState* play) { void func_80BAD130(EnSuttari* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if ((talkState == 5 || talkState == 6) && Message_ShouldAdvance(play)) { + if (((talkState == TEXT_STATE_5) || (talkState == TEXT_STATE_DONE)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if (this->flags1 & 8) { this->actionFunc = func_80BAD004; } else if (this->flags1 & 4) { @@ -1179,7 +1177,7 @@ void func_80BAD230(EnSuttari* this, PlayState* play) { } void func_80BAD2B4(EnSuttari* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x2A30) { ActorCutscene_Stop(this->cutscenes[0]); ActorCutscene_SetIntentToPlay(this->cutscenes[1]); @@ -1187,7 +1185,7 @@ void func_80BAD2B4(EnSuttari* this, PlayState* play) { } else { ActorCutscene_Stop(this->cutscenes[1]); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; this->actionFunc = func_80BAD380; } @@ -1205,13 +1203,13 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { } else { this->flags1 &= ~0x8000; func_80BABA90(this, 1, 1); - if ((this->flags1 & 0x4000) && (talkState == 5) && Message_ShouldAdvance(play)) { + if ((this->flags1 & 0x4000) && (talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->flags2 &= ~0x10; player->stateFlags1 &= ~0x10000000; this->flags1 &= ~0x4000; ActorCutscene_Stop(this->cutscenes[1]); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; } if (this->flags1 & 0x100) { @@ -1245,7 +1243,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { } void func_80BAD5F8(EnSuttari* this, PlayState* play) { - ScheduleResult scheduleResult; + ScheduleOutput scheduleOutput; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1254,21 +1252,21 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || + ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_1; - scheduleResult.result = 0; + scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } - this->unk428 = scheduleResult.result; + this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { Actor_MarkForDeath(&this->actor); return; } func_80BAB434(this); - if ((this->flags1 & 0x20) && (this->unk430 == 0) && (scheduleResult.result != 7)) { + if ((this->flags1 & 0x20) && (this->unk430 == 0) && (scheduleOutput.result != 7)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; @@ -1280,7 +1278,7 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { } void func_80BAD7F8(EnSuttari* this, PlayState* play) { - ScheduleResult scheduleResult; + ScheduleOutput scheduleOutput; s16 curFrame = this->skelAnime.curFrame; s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); @@ -1292,20 +1290,20 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); - if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) || - ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) { + if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || + ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_1; - scheduleResult.result = 0; + scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_1; } - this->unk428 = scheduleResult.result; + this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { Actor_MarkForDeath(&this->actor); return; } - if ((this->flags1 & 0x20) && (scheduleResult.result != 9)) { + if ((this->flags1 & 0x20) && (scheduleOutput.result != 9)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A02, &this->actor); this->actionFunc = func_80BAD130; @@ -1340,7 +1338,7 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { this->animationIndex = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); } - if (talkstate == 5) { + if (talkstate == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->flags1 & 0x400) { if (this->textId == 0x29EE) { @@ -1352,7 +1350,7 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { this->flags2 &= ~1; } play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->textId = 0; if (this->flags1 & 1) { this->actionFunc = func_80BACA14; @@ -1363,7 +1361,7 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { } func_80BAAB78(this, play); } - } else if ((talkstate == 4) && Message_ShouldAdvance(play)) { + } else if ((talkstate == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); 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 65b11055c..a8d76a7a8 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 @@ -90,7 +90,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { path = &play->setupPathList[path->unk1]; } - for (i = 0; i < EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor); i++) { + for (i = 0; i < EN_SYATEKI_CROW_GET_NUMBER(&this->actor); i++) { path = &play->setupPathList[path->unk1]; } @@ -102,7 +102,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { this->unk_23C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - if ((path == NULL) || (EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor) >= 0x80)) { + if ((path == NULL) || (EN_SYATEKI_CROW_GET_NUMBER(&this->actor) >= 0x80)) { Actor_MarkForDeath(&this->actor); return; } @@ -136,14 +136,14 @@ void func_809CA5D4(EnSyatekiCrow* this) { void func_809CA67C(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->unk_26A == 1) && (this->unk_1C2 == 1) && - (syatekiMan->unk_274 & (1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)))) { + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_1C2 == 1) && + (syatekiMan->guayFlags & (1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)))) { func_809CA71C(this); - } else if (syatekiMan->unk_26A != 1) { + } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { this->unk_1C2 = 1; } - if ((syatekiMan->unk_274 == 0) && (syatekiMan->unk_274 == 0)) { + if ((syatekiMan->guayFlags == 0) && (syatekiMan->guayFlags == 0)) { this->unk_1C2 = 1; } } @@ -185,7 +185,7 @@ void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { f32 sp30; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (syatekiMan->unk_26A != 1) { + if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { func_809CA5D4(this); return; } @@ -207,13 +207,13 @@ void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { this->unk_1CC++; } else { this->unk_1C2 = 0; - syatekiMan->unk_274 &= ~(1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)); + syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&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) { + if ((syatekiMan->perGameVar1.guaySpawnTimer % 90) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_CRY); } } @@ -221,7 +221,7 @@ void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { void func_809CAAF8(EnSyatekiCrow* this) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - syatekiMan->unk_280 += 60; + syatekiMan->score += 60; this->unk_1C2 = 0; this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; @@ -245,8 +245,8 @@ void func_809CABC0(EnSyatekiCrow* this, PlayState* play) { if (this->unk_1C4 > 20) { func_800B3030(play, &this->actor.world.pos, &D_809CB050, &D_809CB050, this->actor.scale.x * 10000.0f, 0, 0); - syatekiMan->unk_27A++; - syatekiMan->unk_274 &= ~(1 << EN_SYATEKI_CROW_GET_PARAM_FF00(&this->actor)); + syatekiMan->guayHitCounter++; + syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)); func_809CA5D4(this); } 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 d0b626218..05eec4ad0 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 @@ -5,7 +5,8 @@ #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) +#define EN_SYATEKI_CROW_GET_NUMBER(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_CROW_PARAMS(number, unkF0, unkF) (((number << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unkF & 0xF)) struct EnSyatekiCrow; diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 43d191c45..d9ae07847 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -131,7 +131,7 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { } this->unk_1E4 = Lib_SegmentedToVirtual(path->points); - this->unk_1E8 = EN_SYATEKI_DEKUNUTS_GET_PARAM_F0(&this->actor); + this->unk_1E8 = EN_SYATEKI_DEKUNUTS_GET_NUMBER(&this->actor); this->unk_1EA = path->count; this->unk_1D8 = 0; this->unk_1DC = 0; @@ -166,13 +166,14 @@ void func_80A2BE54(EnSyatekiDekunuts* this) { void func_80A2BF18(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->unk_26A == 1) && (this->unk_1E2 == 1) && ((syatekiMan->unk_272 & (1 << this->unk_1E8)) != 0)) { + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_1E2 == 1) && + ((syatekiMan->dekuScrubFlags & (1 << this->unk_1E8)) != 0)) { func_80A2BFC4(this); - } else if (syatekiMan->unk_26A != 1) { + } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { this->unk_1E2 = 1; } - if ((syatekiMan->unk_272 == 0) && (syatekiMan->unk_274 == 0) && + if ((syatekiMan->dekuScrubFlags == 0) && (syatekiMan->guayFlags == 0) && (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1)) { this->unk_1E2 = 1; } @@ -189,9 +190,9 @@ void func_80A2BFC4(EnSyatekiDekunuts* this) { this->actor.world.pos = this->actor.prevPos = sp14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk_1EE = 140 - (syatekiMan->unk_27C * 20); + this->unk_1EE = 140 - (syatekiMan->currentWave * 20); - if ((syatekiMan->unk_27C & 1) != 0) { + if ((syatekiMan->currentWave & 1) != 0) { this->unk_1F0 = 1; this->unk_1F2 = 0; } else { @@ -260,7 +261,7 @@ void func_80A2C27C(EnSyatekiDekunuts* this) { void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((this->unk_1EE < this->unk_1D8) || (syatekiMan->unk_26A != 1)) { + if ((this->unk_1EE < this->unk_1D8) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { func_80A2C3AC(this); } @@ -270,7 +271,7 @@ void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) { void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((gSaveContext.eventTimer1Value[TIMER_ID_1] <= 0) || (syatekiMan->unk_26A != 1)) { + if ((gSaveContext.eventTimer1Value[TIMER_ID_1] <= 0) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { func_80A2C3AC(this); } @@ -287,7 +288,7 @@ void func_80A2C3AC(EnSyatekiDekunuts* this) { void func_80A2C3F0(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (syatekiMan->unk_26A == 1) { + if (syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) { if (this->unk_1D8 > 160 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_1D8 = 0; func_80A2C150(this); @@ -319,12 +320,12 @@ void func_80A2C4D0(EnSyatekiDekunuts* this, PlayState* play) { if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 2); - syatekiMan->unk_280 += 100; - syatekiMan->unk_26E++; + syatekiMan->score += 100; + syatekiMan->perGameVar2.bonusDekuScrubHitCounter++; } else { EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 0); - syatekiMan->unk_280 += 30; - syatekiMan->unk_278++; + syatekiMan->score += 30; + syatekiMan->dekuScrubHitCounter++; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); @@ -356,7 +357,7 @@ void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play) { EffectSsHahen_SpawnBurst(play, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { - syatekiMan->unk_272 &= ~(1 << this->unk_1E8); + syatekiMan->dekuScrubFlags &= ~(1 << this->unk_1E8); } func_80A2BE54(this); diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h index 5acf4d493..447dcaee7 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h @@ -5,8 +5,9 @@ #include "objects/object_dekunuts/object_dekunuts.h" #define EN_SYATEKI_DEKUNUTS_GET_PARAM_F(thisx) ((thisx)->params & 0xF) -#define EN_SYATEKI_DEKUNUTS_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_DEKUNUTS_GET_NUMBER(thisx) (((thisx)->params & 0xF0) >> 4) #define EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_DEKUNUTS_PARAMS(unkFF00, number, unkF) (((unkFF00 << 8) & 0xFF00) | ((number << 4) & 0xF0) | (unkF & 0xF)) struct EnSyatekiDekunuts; 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 0229e0807..5e157fe77 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 @@ -2,9 +2,15 @@ * File: z_en_syateki_man.c * Overlay: ovl_En_Syateki_Man * Description: Shooting Gallery Man + * + * In addition to handling the normal NPC behavior with the Town/Swamp Shooting Gallery Man, this actor is also + * responsible for running their respective shooting games as well. */ #include "z_en_syateki_man.h" +#include "overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h" +#include "overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h" +#include "overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_8000000) @@ -15,24 +21,43 @@ void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play); void EnSyatekiMan_Update(Actor* thisx, PlayState* play); void EnSyatekiMan_Draw(Actor* thisx, PlayState* play); -void func_809C6810(EnSyatekiMan* this, PlayState* play); -void func_809C6848(EnSyatekiMan* this, PlayState* play); -void func_809C6E30(EnSyatekiMan* this, PlayState* play); -void func_809C72D8(EnSyatekiMan* this, PlayState* play); -void func_809C7990(EnSyatekiMan* this, PlayState* play); -void func_809C7A90(EnSyatekiMan* this, PlayState* play); -void func_809C7C14(EnSyatekiMan* this, PlayState* play); -void func_809C7D14(EnSyatekiMan* this, PlayState* play); -void func_809C7EB4(EnSyatekiMan* this, PlayState* play); -void func_809C7FFC(EnSyatekiMan* this, PlayState* play); -void func_809C80C0(EnSyatekiMan* this, PlayState* play); -void func_809C81D0(EnSyatekiMan* this, PlayState* play); -void func_809C8488(EnSyatekiMan* this, PlayState* play); -void func_809C8610(EnSyatekiMan* this, PlayState* play); -void func_809C8710(EnSyatekiMan* this, PlayState* play); -void func_809C8808(EnSyatekiMan* this, PlayState* play); -void func_809C898C(EnSyatekiMan* this, PlayState* play); -void func_809C8BF0(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_Idle(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_Talk(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_GiveReward(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_GiveReward(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_MovePlayerAndExplainRules(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_MovePlayerAndSayHighScore(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play); +void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play); + +#define TALK_FLAG_NONE 0 +#define TALK_FLAG_TOWN_HAS_SPOKEN_WITH_HUMAN (1 << 0) +#define TALK_FLAG_TOWN_HAS_SPOKEN_WITH_DEKU (1 << 1) +#define TALK_FLAG_TOWN_HAS_SPOKEN_WITH_GORON (1 << 2) +#define TALK_FLAG_TOWN_HAS_SPOKEN_WITH_ZORA (1 << 3) +#define TALK_FLAG_TOWN_HAS_EXPLAINED_THE_RULES (1 << 4) +#define TALK_FLAG_SWAMP_HAS_SPOKEN_WITH_HUMAN (1 << 0) +#define TALK_FLAG_SWAMP_HAS_EXPLAINED_THE_RULES (1 << 1) + +#define OCTOROK_FLAG(color, row, column) (1 << ((row * 6) + (column * 2) + color)) +#define COLOR_RED 0 +#define COLOR_BLUE 1 +#define ROW_BACK 0 +#define ROW_CENTER 1 +#define ROW_FRONT 2 +#define COLUMN_LEFT 0 +#define COLUMN_CENTER 1 +#define COLUMN_RIGHT 2 const ActorInit En_Syateki_Man_InitVars = { ACTOR_EN_SYATEKI_MAN, @@ -46,87 +71,111 @@ const ActorInit En_Syateki_Man_InitVars = { (ActorFunc)EnSyatekiMan_Draw, }; +typedef enum { + /* 0 */ EN_SYATEKI_MAN_ANIMATION_HANDS_ON_TABLE, + /* 1 */ EN_SYATEKI_MAN_ANIMATION_SWAMP_HEAD_SCRATCH_LOOP, + /* 2 */ EN_SYATEKI_MAN_ANIMATION_SWAMP_HEAD_SCRATCH_END, +} EnSyatekiManAnimationIndex; + static AnimationInfo sAnimations[] = { { &gBurlyGuyHandsOnTableAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &gSwampShootingGalleryManHeadScratchLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &gSwampShootingGalleryManHeadScratchEndAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, }; -static s16 D_809C91C8[] = { - 0x00C1, - 0x0302, - 0x0019, - 0x0026, +/** + * In the Swamp Shooting Gallery, there are four waves of Guays. + * For each wave, these flags are used to control which Guays appear. + */ +static s16 sGuayFlagsPerWave[] = { + (1 << 7) | (1 << 6) | (1 << 0), + (1 << 9) | (1 << 8) | (1 << 1), + (1 << 4) | (1 << 3) | (1 << 0), + (1 << 5) | (1 << 2) | (1 << 1), }; -static EnSyatekiManUnkStruct D_809C91D0[] = { - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, 0x130 }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, 0x20 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x0 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x10 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x20 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x30 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x40 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x1 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x11 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x0 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x100 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x200 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x300 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x420 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x520 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x601 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x702 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x801 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x902 }, +typedef struct { + /* 0x00 */ s16 actorId; + /* 0x04 */ Vec3f pos; + /* 0x10 */ s32 params; +} SwampTargetActorEntry; // size = 0x14 + +static SwampTargetActorEntry sNormalSwampTargetActorList[] = { + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(1, 3, 0) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(0, 2, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 2, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 3, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 4, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 1) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(5, 2, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(6, 0, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(7, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(8, 0, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(9, 0, 2) }, }; -static EnSyatekiManUnkStruct D_809C934C[] = { - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x0 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x100 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x1 }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, 0x11 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x202 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x302 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x3 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x103 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x423 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x204 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x304 }, - { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, 0x424 }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, 0x25 }, - { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, 0x136 }, +/** + * This actor list is never used in-game and doesn't work properly if modded in. + * Without any "normal" Deku Scrubs, the game will not progress beyond the first wave. + */ +static SwampTargetActorEntry sUnusedSwampTargetActorList[] = { + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 1) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 1) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 2) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 3) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 4) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 4) }, + { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(4, 2, 4) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(0, 2, 5) }, + { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(1, 3, 6) }, }; -static EnSyatekiManUnkStruct* D_809C9464[] = { - D_809C91D0, - D_809C934C, +static SwampTargetActorEntry* sSwampTargetActorLists[] = { + sNormalSwampTargetActorList, + sUnusedSwampTargetActorList, }; -static s32 D_809C946C[] = { - ARRAY_COUNT(D_809C91D0), - ARRAY_COUNT(D_809C934C), +static s32 sSwampTargetActorListLengths[] = { + ARRAY_COUNT(sNormalSwampTargetActorList), + ARRAY_COUNT(sUnusedSwampTargetActorList), }; -static Vec3f D_809C9474 = { 0.0f, 10.0f, 140.0f }; -static Vec3f D_809C9480 = { -20.0f, 20.0f, 198.0f }; -static Vec3f D_809C948C = { -20.0f, 40.0f, 175.0f }; +static Vec3f sSwampPlayerPos = { 0.0f, 10.0f, 140.0f }; +static Vec3f sTownFierceDietyPlayerPos = { -20.0f, 20.0f, 198.0f }; +static Vec3f sTownPlayerPos = { -20.0f, 40.0f, 175.0f }; -void func_809C64C0(EnSyatekiMan* this, PlayState* play2, EnSyatekiManUnkStruct arg2[], s32 arg3) { +/** + * Spawns all the actors used as targets in the Swamp Shooting Gallery. + */ +void EnSyatekiMan_Swamp_SpawnTargetActors(EnSyatekiMan* this, PlayState* play2, SwampTargetActorEntry actorList[], + s32 actorListLength) { PlayState* play = play2; s32 i; - for (i = 0; i < arg3; i++) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, arg2[i].index, arg2[i].x, arg2[i].y, arg2[i].z, 0, 0, 0, - arg2[i].variable); + for (i = 0; i < actorListLength; i++) { + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, actorList[i].actorId, actorList[i].pos.x, + actorList[i].pos.y, actorList[i].pos.z, 0, 0, 0, actorList[i].params); } } void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - Path* sp34 = &play->setupPathList[ENSYATEKIMAN_GET_FF00(&this->actor)]; - s32 sp30 = D_809C946C[this->unk_194]; + Path* path = &play->setupPathList[EN_SYATEKI_MAN_GET_PATH(&this->actor)]; + s32 actorListLength = sSwampTargetActorListLengths[this->swampTargetActorListIndex]; this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); @@ -139,26 +188,27 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { } this->actor.colChkInfo.cylRadius = 100; - this->actionFunc = func_809C6810; - this->unk_26A = 0; - this->unk_270 = 15; - this->unk_27E = 0; - this->unk_26E = 0; - this->unk_190 = 0; - this->unk_272 = 0; - this->unk_274 = 0; - this->unk_280 = 0; - this->unk_278 = 0; - this->unk_27A = 0; - this->unk_284 = 0; - this->unk_194 = 0; - this->unk_282 = 0; + this->actionFunc = EnSyatekiMan_SetupIdle; + this->shootingGameState = SG_GAME_STATE_NONE; + this->talkWaitTimer = 15; + this->flagsIndex = 0; + this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; + this->octorokFlags = 0; + this->dekuScrubFlags = 0; + this->guayFlags = 0; + this->score = 0; + this->dekuScrubHitCounter = 0; + this->guayHitCounter = 0; + this->prevTextId = 0; + this->swampTargetActorListIndex = 0; + this->talkFlags = TALK_FLAG_NONE; this->eyeIndex = 0; this->blinkTimer = 0; if (play->sceneNum == SCENE_SYATEKI_MORI) { - this->path = sp34; - func_809C64C0(this, play, D_809C9464[this->unk_194], sp30); + this->path = path; + EnSyatekiMan_Swamp_SpawnTargetActors(this, play, sSwampTargetActorLists[this->swampTargetActorListIndex], + actorListLength); } } @@ -166,79 +216,88 @@ void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) { gSaveContext.save.weekEventReg[63] &= (u8)~1; } -s32 func_809C6720(PlayState* play, Vec3f arg1) { +/** + * Moves the player to the destination through automated control stick movements. + * This is used to move the player to the right place to play the shooting game. + */ +s32 EnSyatekiMan_MovePlayerToPos(PlayState* play, Vec3f pos) { Player* player = GET_PLAYER(play); - f32 sp28; - f32 phi_f0; - s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1); + f32 distXZ; + f32 magnitude; + s16 yaw = Math_Vec3f_Yaw(&player->actor.world.pos, &pos); - sp28 = Math_Vec3f_DistXZ(&player->actor.world.pos, &arg1); + distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &pos); - if (sp28 < 5.0f) { - phi_f0 = 10.0f; - } else if (sp28 < 30.0f) { - phi_f0 = 40.0f; + if (distXZ < 5.0f) { + magnitude = 10.0f; + } else if (distXZ < 30.0f) { + magnitude = 40.0f; } else { - phi_f0 = 80.0f; + magnitude = 80.0f; } play->actorCtx.unk268 = 1; - func_800B6F20(play, &play->actorCtx.unk_26C, phi_f0, sp22); + func_800B6F20(play, &play->actorCtx.unk_26C, magnitude, yaw); - if (sp28 < 5.0f) { + if (distXZ < 5.0f) { return true; } return false; } -void func_809C6810(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play) { if (play->sceneNum == SCENE_SYATEKI_MORI) { - this->actionFunc = func_809C6848; + this->actionFunc = EnSyatekiMan_Swamp_Idle; } else if (play->sceneNum == SCENE_SYATEKI_MIZU) { - this->actionFunc = func_809C72D8; + this->actionFunc = EnSyatekiMan_Town_Idle; } } -void func_809C6848(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - u16 sp22; + u16 faceReactionTextId; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); - sp22 = Text_GetFaceReaction(play, 0x31); - if (sp22 != 0) { - Message_StartTextbox(play, sp22, &this->actor); - this->unk_284 = sp22; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_SYATEKI_MAN_ANIMATION_SWAMP_HEAD_SCRATCH_END); + faceReactionTextId = Text_GetFaceReaction(play, 0x31); + if (faceReactionTextId != 0) { + Message_StartTextbox(play, faceReactionTextId, &this->actor); + this->prevTextId = faceReactionTextId; } else if (player->transformation == PLAYER_FORM_HUMAN) { - if (this->unk_282 == 0) { - this->unk_282 = 1; + if (this->talkFlags == TALK_FLAG_NONE) { + this->talkFlags = TALK_FLAG_SWAMP_HAS_SPOKEN_WITH_HUMAN; + // How are you? Wanna play? Message_StartTextbox(play, 0xA28, &this->actor); - this->unk_284 = 0xA28; + this->prevTextId = 0xA28; } else { + // Won't you play? Message_StartTextbox(play, 0xA29, &this->actor); - this->unk_284 = 0xA29; + this->prevTextId = 0xA29; } } else { switch (CURRENT_DAY) { case 1: + // You can't play if you don't have a bow! (Day 1) Message_StartTextbox(play, 0xA38, &this->actor); - this->unk_284 = 0xA38; + this->prevTextId = 0xA38; break; case 2: + // You can't play if you don't have a bow! (Day 2) Message_StartTextbox(play, 0xA39, &this->actor); - this->unk_284 = 0xA39; + this->prevTextId = 0xA39; break; case 3: + // You can't play if you don't have a bow! (Day 3) Message_StartTextbox(play, 0xA3A, &this->actor); - this->unk_284 = 0xA3A; + this->prevTextId = 0xA3A; break; } } - this->actionFunc = func_809C6E30; + this->actionFunc = EnSyatekiMan_Swamp_Talk; } else { func_800B8614(&this->actor, play, 120.0f); } @@ -248,123 +307,134 @@ void func_809C6848(EnSyatekiMan* this, PlayState* play) { } } -void func_809C6A04(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { - if (!CUR_UPG_VALUE(UPG_QUIVER)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { play_sound(NA_SE_SY_ERROR); + + // You don't have a bow! Message_StartTextbox(play, 0xA30, &this->actor); - this->unk_284 = 0xA30; + this->prevTextId = 0xA30; } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); + + // You don't have enough rupees! Message_StartTextbox(play, 0xA31, &this->actor); - this->unk_284 = 0xA31; - if (this->unk_26A == 4) { + this->prevTextId = 0xA31; + if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { gSaveContext.minigameState = 3; } - this->unk_26A = 3; + + this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } else { func_8019F208(); Rupees_ChangeBy(-20); gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; - this->unk_26A = 7; + play->msgCtx.stateTimer = 4; + this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; player->stateFlags1 |= 0x20; - this->actionFunc = func_809C7FFC; + this->actionFunc = EnSyatekiMan_Swamp_MovePlayerAndExplainRules; } } else { func_8019F230(); switch (CURRENT_DAY) { case 1: + // You're not playing? Please come again. Message_StartTextbox(play, 0xA2D, &this->actor); - this->unk_284 = 0xA2D; + this->prevTextId = 0xA2D; break; case 2: + // You're not playing? Day after tomorrow is the carnival. Message_StartTextbox(play, 0xA2E, &this->actor); - this->unk_284 = 0xA2E; + this->prevTextId = 0xA2E; break; case 3: + // You're not playing? Is something happening outside? Message_StartTextbox(play, 0xA2F, &this->actor); - this->unk_284 = 0xA2F; + this->prevTextId = 0xA2F; break; } - if (this->unk_26A == 4) { + if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { gSaveContext.minigameState = 3; } - this->unk_26A = 3; + this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } } } -void func_809C6C2C(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { - switch (this->unk_284) { - case 0xA28: - case 0xA29: + switch (this->prevTextId) { + case 0xA28: // How are you? Wanna play? + case 0xA29: // Won't you play? + // It costs 20 rupees to play. Message_StartTextbox(play, 0xA2A, &this->actor); - this->unk_284 = 0xA2A; + this->prevTextId = 0xA2A; break; - case 0xA2B: - case 0xA2C: - case 0xA35: + case 0xA2B: // The rules of the game are a piece of cake! + case 0xA2C: // I keep saying - you have to aim with [Control Stick]! + case 0xA35: // You almost had it! Well...just this once...here you go! play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; Interface_InitMinigame(play); play->interfaceCtx.hbaAmmo = 80; func_80123F2C(play, 80); - this->unk_26A = 1; - this->actionFunc = func_809C80C0; + this->shootingGameState = SG_GAME_STATE_RUNNING; + this->actionFunc = EnSyatekiMan_Swamp_StartGame; func_801A2BB8(NA_BGM_MINI_GAME_2); break; - case 0xA32: + case 0xA32: // You have to try harder! if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(play); player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->actionFunc = func_809C6848; + this->actionFunc = EnSyatekiMan_Swamp_Idle; gSaveContext.minigameState = 3; - this->unk_26A = 0; + this->shootingGameState = SG_GAME_STATE_NONE; } else { + // Wanna play again? Message_StartTextbox(play, 0xA33, &this->actor); - this->unk_284 = 0xA33; + this->prevTextId = 0xA33; } break; - case 0xA33: + case 0xA33: // Wanna play again? + // It costs 20 rupees to play. Message_StartTextbox(play, 0xA2A, &this->actor); - this->unk_284 = 0xA2A; - this->unk_26A = 4; + this->prevTextId = 0xA2A; + this->shootingGameState = SG_GAME_STATE_ONE_MORE_GAME; break; - case 0xA34: + case 0xA34: // Perfect! Take this! play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; gSaveContext.minigameState = 3; player->stateFlags1 |= 0x20; - this->actionFunc = func_809C7A90; - func_809C7A90(this, play); + this->actionFunc = EnSyatekiMan_Swamp_SetupGiveReward; + EnSyatekiMan_Swamp_SetupGiveReward(this, play); break; } } } -void func_809C6E30(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x20) { @@ -372,333 +442,372 @@ void func_809C6E30(EnSyatekiMan* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 2: - this->actionFunc = func_809C6848; - this->unk_26A = 0; + case TEXT_STATE_CLOSING: + this->actionFunc = EnSyatekiMan_Swamp_Idle; + this->shootingGameState = SG_GAME_STATE_NONE; break; - case 4: - func_809C6A04(this, play); + case TEXT_STATE_CHOICE: + EnSyatekiMan_Swamp_HandleChoice(this, play); break; - case 5: - func_809C6C2C(this, play); + case TEXT_STATE_5: + EnSyatekiMan_Swamp_HandleNormalMessage(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->actionFunc = func_809C6848; - this->unk_26A = 0; + this->actionFunc = EnSyatekiMan_Swamp_Idle; + this->shootingGameState = SG_GAME_STATE_NONE; } break; - case 0: - case 1: - case 3: - case 7: - case 8: - case 9: - case 10: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_3: + case TEXT_STATE_7: + case TEXT_STATE_8: + case TEXT_STATE_9: + case TEXT_STATE_10: break; } if (this->skelAnime.animation == &gSwampShootingGalleryManHeadScratchEndAnim) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_SYATEKI_MAN_ANIMATION_HANDS_ON_TABLE); } } } -void func_809C6F98(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_StartIntroTextbox(EnSyatekiMan* this, PlayState* play) { switch (gSaveContext.save.playerForm) { case PLAYER_FORM_HUMAN: Flags_SetAllTreasure(play, Flags_GetAllTreasure(play) + 1); if (CURRENT_DAY != 3) { - if (!(this->unk_282 & 1)) { - this->unk_282 |= 1; + if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_HUMAN)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_HUMAN; + // Why don't you give it a try? Message_StartTextbox(play, 0x3E8, &this->actor); - this->unk_284 = 0x3E8; + this->prevTextId = 0x3E8; } else { + // Wanna try? Message_StartTextbox(play, 0x3E9, &this->actor); - this->unk_284 = 0x3E9; + this->prevTextId = 0x3E9; } - } else if (!(this->unk_282 & 1)) { - this->unk_282 |= 1; + } else if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_HUMAN)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_HUMAN; + // If you still have time, why don't you try it? Message_StartTextbox(play, 0x3EA, &this->actor); - this->unk_284 = 0x3EA; + this->prevTextId = 0x3EA; } else { + // How about it? Wanna try? Message_StartTextbox(play, 0x3EB, &this->actor); - this->unk_284 = 0x3EB; + this->prevTextId = 0x3EB; } break; case PLAYER_FORM_DEKU: if (CURRENT_DAY != 3) { - if (!(this->unk_282 & 2)) { - this->unk_282 |= 2; + if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_DEKU)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_DEKU; + // When I saw your fairy, I thought you were that masked troublemaker. Message_StartTextbox(play, 0x3EC, &this->actor); - this->unk_284 = 0x3EC; + this->prevTextId = 0x3EC; } else { + // You can't play because you don't have a bow. Message_StartTextbox(play, 0x3ED, &this->actor); - this->unk_284 = 0x3ED; + this->prevTextId = 0x3ED; } - } else if (!(this->unk_282 & 2)) { - this->unk_282 |= 2; + } else if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_DEKU)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_DEKU; + // I thought you were a customer, but I guess I can't expect any... Message_StartTextbox(play, 0x3EE, &this->actor); - this->unk_284 = 0x3EE; + this->prevTextId = 0x3EE; } else { + // Stop hanging around and go home! Message_StartTextbox(play, 0x3EF, &this->actor); - this->unk_284 = 0x3EF; + this->prevTextId = 0x3EF; } break; case PLAYER_FORM_ZORA: if (CURRENT_DAY != 3) { - if (!(this->unk_282 & 8)) { - this->unk_282 |= 8; + if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_ZORA)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_ZORA; + // I swear I've seen you before... Message_StartTextbox(play, 0x3F0, &this->actor); - this->unk_284 = 0x3F0; + this->prevTextId = 0x3F0; } else { + // If you don't have a bow, you can't play. Message_StartTextbox(play, 0x3F1, &this->actor); - this->unk_284 = 0x3F1; + this->prevTextId = 0x3F1; } - } else if (!(this->unk_282 & 8)) { - this->unk_282 |= 8; + } else if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_ZORA)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_ZORA; + // Huh? You're still here? Message_StartTextbox(play, 0x3F4, &this->actor); - this->unk_284 = 0x3F4; + this->prevTextId = 0x3F4; } else { + // Haven't you heard the news? Message_StartTextbox(play, 0x3F5, &this->actor); - this->unk_284 = 0x3F5; + this->prevTextId = 0x3F5; } break; case PLAYER_FORM_GORON: if (CURRENT_DAY != 3) { - if (!(this->unk_282 & 4)) { - this->unk_282 |= 4; + if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_GORON)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_GORON; + // You have quite the build! Message_StartTextbox(play, 0x3F2, &this->actor); - this->unk_284 = 0x3F2; + this->prevTextId = 0x3F2; } else { + // Sorry...you don't have a bow. Message_StartTextbox(play, 0x3F3, &this->actor); - this->unk_284 = 0x3F3; + this->prevTextId = 0x3F3; } - } else if (!(this->unk_282 & 4)) { - this->unk_282 |= 4; + } else if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_SPOKEN_WITH_GORON)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_SPOKEN_WITH_GORON; + // Huh? You're still here? Message_StartTextbox(play, 0x3F4, &this->actor); - this->unk_284 = 0x3F4; + this->prevTextId = 0x3F4; } else { + // Haven't you heard the news? Message_StartTextbox(play, 0x3F5, &this->actor); - this->unk_284 = 0x3F5; + this->prevTextId = 0x3F5; } break; } } -void func_809C72D8(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_Idle(EnSyatekiMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - u16 sp26 = Text_GetFaceReaction(play, 0x30); + u16 faceReactionTextId = Text_GetFaceReaction(play, 0x30); - if (sp26 != 0) { - Message_StartTextbox(play, sp26, &this->actor); - this->unk_284 = sp26; + if (faceReactionTextId != 0) { + Message_StartTextbox(play, faceReactionTextId, &this->actor); + this->prevTextId = faceReactionTextId; } else { - func_809C6F98(this, play); + EnSyatekiMan_Town_StartIntroTextbox(this, play); } - this->actionFunc = func_809C7990; + + this->actionFunc = EnSyatekiMan_Town_Talk; } else { func_800B8614(&this->actor, play, 120.0f); } } -void func_809C7380(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { - if (!CUR_UPG_VALUE(UPG_QUIVER)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { + // You don't have a bow? Then you can't play. Message_StartTextbox(play, 0x3F9, &this->actor); - this->unk_284 = 0x3F9; + this->prevTextId = 0x3F9; } else { + // You don't have a bow? That's too bad. Message_StartTextbox(play, 0x3FA, &this->actor); - this->unk_284 = 0x3FA; + this->prevTextId = 0x3FA; } } else if (gSaveContext.save.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { + // You don't have a enough rupees! Message_StartTextbox(play, 0x3FB, &this->actor); - this->unk_284 = 0x3FB; + this->prevTextId = 0x3FB; } else { + // You don't have enough rupees? That's too bad. Message_StartTextbox(play, 0x3FC, &this->actor); - this->unk_284 = 0x3FC; + this->prevTextId = 0x3FC; } - if (this->unk_26A == 4) { + if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { player->stateFlags3 &= ~0x400; gSaveContext.minigameState = 3; } - this->unk_26A = 3; + + this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } else { func_8019F208(); Rupees_ChangeBy(-20); - this->unk_26A = 2; - if (!(this->unk_282 & 0x10)) { - this->unk_282 |= 0x10; + this->shootingGameState = SG_GAME_STATE_EXPLAINING_RULES; + if (!(this->talkFlags & TALK_FLAG_TOWN_HAS_EXPLAINED_THE_RULES)) { + this->talkFlags |= TALK_FLAG_TOWN_HAS_EXPLAINED_THE_RULES; + // The rules are simple. Message_StartTextbox(play, 0x3FD, &this->actor); - this->unk_284 = 0x3FD; + this->prevTextId = 0x3FD; } else { + // Aim for the red ones. Message_StartTextbox(play, 0x3FF, &this->actor); - this->unk_284 = 0x3FF; + this->prevTextId = 0x3FF; } + gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; } } else { func_8019F230(); if (CURRENT_DAY != 3) { + // Well, be that way! Message_StartTextbox(play, 0x3F7, &this->actor); - this->unk_284 = 0x3F7; + this->prevTextId = 0x3F7; } else { + // Usually this place is packed... Message_StartTextbox(play, 0x3F8, &this->actor); - this->unk_284 = 0x3F8; + this->prevTextId = 0x3F8; } - if (this->unk_26A == 4) { + if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { player->stateFlags3 &= ~0x400; gSaveContext.minigameState = 3; } - this->unk_26A = 3; + + this->shootingGameState = SG_GAME_STATE_NOT_PLAYING; } } } -void func_809C7620(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_ShouldAdvance(play)) { - switch (this->unk_284) { - case 0x3E8: - case 0x3E9: - case 0x3EA: - case 0x3EB: + switch (this->prevTextId) { + case 0x3E8: // Why don't you give it a try? + case 0x3E9: // Wanna try? + case 0x3EA: // If you still have time, why don't you try it? + case 0x3EB: // How about it? Wanna try? + // One game is 20 rupees. Message_StartTextbox(play, 0x3F6, &this->actor); - this->unk_284 = 0x3F6; + this->prevTextId = 0x3F6; break; - case 0x3EC: + case 0x3EC: // When I saw your fairy, I thought you were that masked troublemaker. + // You can't play because you don't have a bow. Message_StartTextbox(play, 0x3ED, &this->actor); - this->unk_284 = 0x3ED; + this->prevTextId = 0x3ED; break; - case 0x3EE: + case 0x3EE: // I thought you were a customer, but I guess I can't expect any... + // Stop hanging around and go home! Message_StartTextbox(play, 0x3EF, &this->actor); - this->unk_284 = 0x3EF; + this->prevTextId = 0x3EF; break; - case 0x3F0: + case 0x3F0: // I swear I've seen you before... + // If you don't have a bow, you can't play. Message_StartTextbox(play, 0x3F1, &this->actor); - this->unk_284 = 0x3F1; + this->prevTextId = 0x3F1; break; - case 0x3F2: + case 0x3F2: // You have quite the build! + // Sorry...you don't have a bow. Message_StartTextbox(play, 0x3F3, &this->actor); - this->unk_284 = 0x3F3; + this->prevTextId = 0x3F3; break; - case 0x3F4: + case 0x3F4: // Huh? You're still here? + // Haven't you heard the news? Message_StartTextbox(play, 0x3F5, &this->actor); - this->unk_284 = 0x3F5; + this->prevTextId = 0x3F5; break; - case 0x3FD: - case 0x3FF: - if (this->unk_26A == 4) { - if (this->unk_284 == 0x3FD) { + case 0x3FD: // The rules are simple. + case 0x3FF: // Aim for the red ones. + if (this->shootingGameState == SG_GAME_STATE_ONE_MORE_GAME) { + if (this->prevTextId == 0x3FD) { + // Our highest score is [score]. If you break the record, you'll win a prize! Message_StartTextbox(play, 0x3FE, &this->actor); - this->unk_284 = 0x3FE; + this->prevTextId = 0x3FE; } else { + // Our highest score is [score]. Good luck! Message_StartTextbox(play, 0x400, &this->actor); - this->unk_284 = 0x400; + this->prevTextId = 0x400; } } else { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; - this->unk_26A = 7; + this->shootingGameState = SG_GAME_STATE_MOVING_PLAYER; player->stateFlags1 |= 0x20; gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->actionFunc = func_809C8710; + this->actionFunc = EnSyatekiMan_Town_MovePlayerAndSayHighScore; } break; - case 0x3FE: - case 0x400: + case 0x3FE: // Our highest score is [score]. If you break the record, you'll win a prize! + case 0x400: // Our highest score is [score]. Good luck! play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; - this->unk_27E = 0; + this->flagsIndex = 0; Interface_InitMinigame(play); func_80123F2C(play, 0x63); - this->unk_26A = 1; + this->shootingGameState = SG_GAME_STATE_RUNNING; func_801A2BB8(NA_BGM_MINI_GAME_2); - this->actionFunc = func_809C8808; + this->actionFunc = EnSyatekiMan_Town_StartGame; break; - case 0x401: + case 0x401: // You got [score]? Oh, that's too bad... if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(play); gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->unk_26A = 0; - this->actionFunc = func_809C72D8; + this->shootingGameState = SG_GAME_STATE_NONE; + this->actionFunc = EnSyatekiMan_Town_Idle; } else { + // You can't stop, can you? You can play as long as you have rupees. Message_StartTextbox(play, 0x402, &this->actor); - this->unk_284 = 0x402; + this->prevTextId = 0x402; } break; - case 0x403: + case 0x403: // You got [score]? Too bad... if (gSaveContext.save.weekEventReg[63] & 2) { func_801477B4(play); gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->unk_26A = 0; - this->actionFunc = func_809C72D8; + this->shootingGameState = SG_GAME_STATE_NONE; + this->actionFunc = EnSyatekiMan_Town_Idle; } else { + // Frustrating, right? Wanna try again? Message_StartTextbox(play, 0x404, &this->actor); - this->unk_284 = 0x404; + this->prevTextId = 0x404; } break; - case 0x402: - case 0x404: + case 0x402: // You can't stop, can you? You can play as long as you have rupees. + case 0x404: // Frustrating, right? Wanna try again? + // One game is 20 rupees. Message_StartTextbox(play, 0x3F6, &this->actor); - this->unk_284 = 0x3F6; - this->unk_26A = 4; + this->prevTextId = 0x3F6; + this->shootingGameState = SG_GAME_STATE_ONE_MORE_GAME; break; - case 0x405: - case 0x406: - case 0x407: + case 0x405: // No way! That was perfect! + case 0x406: // That was perfect! + case 0x407: // You got a new record! play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->actor.freezeTimer = 0; gSaveContext.minigameState = 3; - this->actionFunc = func_809C7D14; - func_809C7D14(this, play); + this->actionFunc = EnSyatekiMan_Town_SetupGiveReward; + EnSyatekiMan_Town_SetupGiveReward(this, play); break; } } } -void func_809C7990(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_Talk(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags1 & 0x20) { @@ -706,55 +815,56 @@ void func_809C7990(EnSyatekiMan* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 2: - this->actionFunc = func_809C72D8; - this->unk_26A = 0; + case TEXT_STATE_CLOSING: + this->actionFunc = EnSyatekiMan_Town_Idle; + this->shootingGameState = SG_GAME_STATE_NONE; break; - case 4: - func_809C7380(this, play); + case TEXT_STATE_CHOICE: + EnSyatekiMan_Town_HandleChoice(this, play); break; - case 5: - func_809C7620(this, play); + case TEXT_STATE_5: + EnSyatekiMan_Town_HandleNormalMessage(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; player->stateFlags1 &= ~0x20; - this->actionFunc = func_809C72D8; - this->unk_26A = 0; + this->actionFunc = EnSyatekiMan_Town_Idle; + this->shootingGameState = SG_GAME_STATE_NONE; } break; - case 0: - case 1: - case 3: - case 7: - case 8: - case 9: - case 10: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_3: + case TEXT_STATE_7: + case TEXT_STATE_8: + case TEXT_STATE_9: + case TEXT_STATE_10: break; } } -void func_809C7A90(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_HasParent(&this->actor, play)) { if (!(gSaveContext.save.weekEventReg[59] & 0x10)) { gSaveContext.save.weekEventReg[59] |= 0x10; - } else if (!(gSaveContext.save.weekEventReg[32] & 2) && (this->unk_280 >= 0x884)) { + } else if (!(gSaveContext.save.weekEventReg[32] & 2) && (this->score >= 2180)) { gSaveContext.save.weekEventReg[32] |= 2; } + this->actor.parent = NULL; - this->actionFunc = func_809C7C14; + this->actionFunc = EnSyatekiMan_Swamp_GiveReward; } else { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x10)) { Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); - } else if (this->unk_280 < 0x884) { + } else if (this->score < 2180) { Actor_PickUp(&this->actor, play, GI_RUPEE_RED, 500.0f, 100.0f); } else if (!(gSaveContext.save.weekEventReg[32] & 2)) { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 500.0f, 100.0f); @@ -769,46 +879,50 @@ void func_809C7A90(EnSyatekiMan* this, PlayState* play) { } } -void func_809C7C14(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_GiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((CURRENT_DAY == 3) && (gSaveContext.save.time > CLOCK_TIME(12, 0))) { + // We've been having a lot of earthquakes lately. Message_StartTextbox(play, 0xA36, &this->actor); - this->unk_284 = 0xA36; + this->prevTextId = 0xA36; } else { + // Tell your friends about us. Message_StartTextbox(play, 0xA37, &this->actor); - this->unk_284 = 0xA37; + this->prevTextId = 0xA37; } + player->stateFlags1 &= ~0x20; this->actor.flags &= ~ACTOR_FLAG_10000; - this->unk_280 = 0; - this->unk_26A = 0; - this->actionFunc = func_809C6E30; + this->score = 0; + this->shootingGameState = SG_GAME_STATE_NONE; + this->actionFunc = EnSyatekiMan_Swamp_Talk; } else { func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } -void func_809C7D14(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_SetupGiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_HasParent(&this->actor, play)) { - if (this->unk_284 == 0x407) { + if (this->prevTextId == 0x407) { if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { gSaveContext.save.weekEventReg[59] |= 0x20; } } - if ((this->unk_284 == 0x405) || (this->unk_284 == 0x406)) { + if ((this->prevTextId == 0x405) || (this->prevTextId == 0x406)) { if (!(gSaveContext.save.weekEventReg[32] & 4)) { gSaveContext.save.weekEventReg[32] |= 4; } } + this->actor.parent = NULL; - this->actionFunc = func_809C7EB4; + this->actionFunc = EnSyatekiMan_Town_GiveReward; } else { - if (this->unk_284 == 0x407) { + if (this->prevTextId == 0x407) { if ((CUR_UPG_VALUE(UPG_QUIVER) < 3) && !(gSaveContext.save.weekEventReg[59] & 0x20)) { Actor_PickUp(&this->actor, play, GI_QUIVER_30 + CUR_UPG_VALUE(UPG_QUIVER), 500.0f, 100.0f); } else { @@ -827,191 +941,209 @@ void func_809C7D14(EnSyatekiMan* this, PlayState* play) { } } -void func_809C7EB4(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Town_GiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (CURRENT_DAY != 3) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { player->stateFlags1 &= ~0x20; - this->unk_280 = 0; - this->unk_26A = 0; + this->score = 0; + this->shootingGameState = SG_GAME_STATE_NONE; gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->actionFunc = func_809C6810; + this->actionFunc = EnSyatekiMan_SetupIdle; } } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + // This may be our last day in business... Message_StartTextbox(play, 0x408, &this->actor); - this->unk_284 = 0x408; + this->prevTextId = 0x408; player->stateFlags1 &= ~0x20; this->actor.flags &= ~ACTOR_FLAG_10000; - this->unk_280 = 0; - this->unk_26A = 0; - this->actionFunc = func_809C7990; + this->score = 0; + this->shootingGameState = SG_GAME_STATE_NONE; + this->actionFunc = EnSyatekiMan_Town_Talk; } else { func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); } } -void func_809C7FFC(EnSyatekiMan* this, PlayState* play) { +void EnSyatekiMan_Swamp_MovePlayerAndExplainRules(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (func_809C6720(play, D_809C9474)) { + if (EnSyatekiMan_MovePlayerToPos(play, sSwampPlayerPos)) { player->stateFlags1 |= 0x20; - this->unk_26A = 2; - if (this->unk_282 != 2) { - this->unk_282 = 2; + this->shootingGameState = SG_GAME_STATE_EXPLAINING_RULES; + if (this->talkFlags != TALK_FLAG_SWAMP_HAS_EXPLAINED_THE_RULES) { + this->talkFlags = TALK_FLAG_SWAMP_HAS_EXPLAINED_THE_RULES; + // The rules of the game are a piece of cake! Message_StartTextbox(play, 0xA2B, &this->actor); - this->unk_284 = 0xA2B; + this->prevTextId = 0xA2B; } else { + // I keep saying - you have to aim with [Control Stick]! Message_StartTextbox(play, 0xA2C, &this->actor); - this->unk_284 = 0xA2C; + this->prevTextId = 0xA2C; } - this->actionFunc = func_809C6E30; + + this->actionFunc = EnSyatekiMan_Swamp_Talk; } } -void func_809C80C0(EnSyatekiMan* this, PlayState* play) { - static s16 D_809C9498 = 30; +void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play) { + static s16 sGameStartTimer = 30; Player* player = GET_PLAYER(play); - if (D_809C9498 > 0) { - player->actor.world.pos = D_809C9474; + if (sGameStartTimer > 0) { + player->actor.world.pos = sSwampPlayerPos; player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; play->unk_18790(play, -0x8000, &this->actor); - D_809C9498--; + sGameStartTimer--; } else { - D_809C9498 = 30; - this->unk_27E = 0; - this->unk_280 = 0; + sGameStartTimer = 30; + this->flagsIndex = 0; + this->score = 0; player->stateFlags1 &= ~0x20; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); - this->unk_272 = 0x1F; - this->unk_274 = 0; - this->unk_276 = 0; - this->unk_26C = 0; - this->unk_278 = 0; - this->unk_27A = 0; - this->unk_27C = 0; - this->unk_26E = 0; + this->dekuScrubFlags = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0); + this->guayFlags = 0; + this->wolfosFlags = 0; + this->perGameVar1.guaySpawnTimer = 0; + this->dekuScrubHitCounter = 0; + this->guayHitCounter = 0; + this->currentWave = 0; + this->perGameVar2.bonusDekuScrubHitCounter = 0; func_8010E9F0(TIMER_ID_1, 100); this->actor.draw = NULL; - this->actionFunc = func_809C81D0; + this->actionFunc = EnSyatekiMan_Swamp_RunGame; } } -void func_809C81D0(EnSyatekiMan* this, PlayState* play) { - static s16 D_809C949C = 0; +void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { + static s16 sHasSpawnedGuaysForThisWave = false; Player* player = GET_PLAYER(play); - if (((this->unk_272 == 0) || (this->unk_26C > 140)) && (D_809C949C == 0) && (this->unk_27C < 4)) { - D_809C949C = 1; - this->unk_26C = 0; + if (((this->dekuScrubFlags == 0) || (this->perGameVar1.guaySpawnTimer > 140)) && !sHasSpawnedGuaysForThisWave && + (this->currentWave < 4)) { + // Spawn three guays after the player has killed all Deku Scrubs, or after 140 frames. + sHasSpawnedGuaysForThisWave = true; + this->perGameVar1.guaySpawnTimer = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); - this->unk_274 = D_809C91C8[this->unk_27E]; - if (this->unk_27E == 3) { - this->unk_27E = 0; + this->guayFlags = sGuayFlagsPerWave[this->flagsIndex]; + if (this->flagsIndex == 3) { + this->flagsIndex = 0; } else { - this->unk_27E++; + this->flagsIndex++; } - } else if ((this->unk_274 == 0) && (this->unk_272 == 0) && (D_809C949C == 1) && (this->unk_27C < 4)) { - if (this->unk_27A < 3) { - this->unk_27A = 0; + } else if ((this->guayFlags == 0) && (this->dekuScrubFlags == 0) && (sHasSpawnedGuaysForThisWave == true) && + (this->currentWave < 4)) { + // Once all Deku Scrubs and Guays in this wave have either disappeared or died, move on to the next wave. + if (this->guayHitCounter < 3) { + this->guayHitCounter = 0; } - this->unk_26C = 0; - D_809C949C = 0; - this->unk_27C++; - if (this->unk_27C < 4) { - this->unk_272 = 31; + + this->perGameVar1.guaySpawnTimer = 0; + sHasSpawnedGuaysForThisWave = false; + this->currentWave++; + if (this->currentWave < 4) { + this->dekuScrubFlags = (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0); } } - if (this->unk_27A == 3) { - this->unk_27A = 0; - this->unk_276 |= 1; + if (this->guayHitCounter == 3) { + this->guayHitCounter = 0; + this->wolfosFlags |= 1; } - if (this->unk_278 == 10) { - this->unk_278 = 0; - this->unk_276 |= 2; + if (this->dekuScrubHitCounter == 10) { + this->dekuScrubHitCounter = 0; + this->wolfosFlags |= 2; } - this->unk_26C++; + this->perGameVar1.guaySpawnTimer++; + if (gSaveContext.eventTimer1Value[TIMER_ID_1] == 0) { gSaveContext.eventTimer1Value[TIMER_ID_1] = 0; gSaveContext.timerState[TIMER_ID_1] = TIMER_STATE_5; this->actor.draw = EnSyatekiMan_Draw; - this->unk_27E = 0; - this->unk_27C = 0; + this->flagsIndex = 0; + this->currentWave = 0; player->stateFlags1 |= 0x20; - D_809C949C = 0; + sHasSpawnedGuaysForThisWave = false; func_801A2C20(); - this->actionFunc = func_809C8488; - } else if ((this->unk_27C == 4) && (this->unk_276 == 0) && (this->unk_26E == 2)) { + this->actionFunc = EnSyatekiMan_Swamp_EndGame; + } else if ((this->currentWave == 4) && (this->wolfosFlags == 0) && + (this->perGameVar2.bonusDekuScrubHitCounter == 2)) { this->actor.draw = EnSyatekiMan_Draw; - this->unk_27E = 0; - this->unk_27C = 0; + this->flagsIndex = 0; + this->currentWave = 0; player->stateFlags1 |= 0x20; - D_809C949C = 0; + sHasSpawnedGuaysForThisWave = false; func_801A2C20(); - this->unk_26A = 5; - if (this->unk_280 == 0x848) { + this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; + if (this->score == 2120) { Interface_SetPerfectMinigame(play, 2); gSaveContext.timerState[TIMER_ID_1] = TIMER_STATE_6; - this->actionFunc = func_809C8610; + this->actionFunc = EnSyatekiMan_Swamp_AddBonusPoints; } else { gSaveContext.timerState[TIMER_ID_1] = TIMER_STATE_5; - this->actionFunc = func_809C8488; + this->actionFunc = EnSyatekiMan_Swamp_EndGame; } } } -void func_809C8488(EnSyatekiMan* this, PlayState* play) { - if ((this->unk_26A == 1) || (this->unk_26A == 5)) { - this->unk_190 = 0; - this->unk_272 = 0; - this->unk_274 = 0; - this->unk_276 = 0; - if (this->unk_270 <= 0) { - if ((s32)((gSaveContext.save.unk_EF4 & 0xFFFF0000) >> 0x10) < this->unk_280) { - gSaveContext.save.unk_EF4 = ((gSaveContext.save.unk_EF4) & 0xFFFF) | ((u16)this->unk_280 << 0x10); +void EnSyatekiMan_Swamp_EndGame(EnSyatekiMan* this, PlayState* play) { + if ((this->shootingGameState == SG_GAME_STATE_RUNNING) || (this->shootingGameState == SG_GAME_STATE_GIVING_BONUS)) { + this->octorokFlags = 0; + this->dekuScrubFlags = 0; + this->guayFlags = 0; + this->wolfosFlags = 0; + if (this->talkWaitTimer <= 0) { + if (GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { + SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(this->score); } - this->unk_270 = 15; - if (this->unk_280 >= 0x848) { + + this->talkWaitTimer = 15; + if (this->score >= 2120) { + // Perfect! Take this! Message_StartTextbox(play, 0xA34, &this->actor); - this->unk_284 = 0xA34; - this->unk_26A = 6; - } else if (this->unk_280 >= 0x7D0) { + this->prevTextId = 0xA34; + this->shootingGameState = SG_GAME_STATE_ENDED; + } else if (this->score >= 2000) { if (gSaveContext.save.weekEventReg[63] & 2) { gSaveContext.save.weekEventReg[63] &= (u8)~1; gSaveContext.save.weekEventReg[63] &= (u8)~2; - this->unk_26A = 0; + this->shootingGameState = SG_GAME_STATE_NONE; gSaveContext.minigameState = 3; - this->actionFunc = func_809C6848; + this->actionFunc = EnSyatekiMan_Swamp_Idle; return; } + + // You almost had it! Well...just this once...here you go! + // Setting prevTextId to this is what triggers a free replay in EnSyatekiMan_Swamp_HandleNormalMessage. Message_StartTextbox(play, 0xA35, &this->actor); - this->unk_284 = 0xA35; - this->unk_26A = 4; - this->unk_280 = 0; + this->prevTextId = 0xA35; + this->shootingGameState = SG_GAME_STATE_ONE_MORE_GAME; + this->score = 0; } else { + // You have to try harder! Message_StartTextbox(play, 0xA32, &this->actor); - this->unk_284 = 0xA32; - this->unk_26A = 6; + this->prevTextId = 0xA32; + this->shootingGameState = SG_GAME_STATE_ENDED; } - this->actionFunc = func_809C6E30; + + this->actionFunc = EnSyatekiMan_Swamp_Talk; } else { - this->unk_270--; + this->talkWaitTimer--; } } - if (this->unk_270 < 5) { + if (this->talkWaitTimer < 5) { play->unk_1887C = -10; } } -void func_809C8610(EnSyatekiMan* this, PlayState* play) { - static s32 D_809C94A0 = 0; +void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { + static s32 sBonusTimer = 0; Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; @@ -1019,130 +1151,202 @@ void func_809C8610(EnSyatekiMan* this, PlayState* play) { if (gSaveContext.eventTimer1Value[TIMER_ID_1] == 0) { gSaveContext.eventTimer1Value[TIMER_ID_1] = 0; gSaveContext.timerState[TIMER_ID_1] = TIMER_STATE_5; - this->unk_27E = 0; - this->unk_27C = 0; - this->actionFunc = func_809C8488; - D_809C94A0 = 0; - } else if (D_809C94A0 > 10) { + this->flagsIndex = 0; + this->currentWave = 0; + this->actionFunc = EnSyatekiMan_Swamp_EndGame; + sBonusTimer = 0; + } else if (sBonusTimer > 10) { gSaveContext.funcTimer2Value[TIMER_ID_1] += 100; play->interfaceCtx.unk_25C += 10; - this->unk_280 += 10; + this->score += 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - D_809C94A0 = 0; + sBonusTimer = 0; } else { - D_809C94A0++; + sBonusTimer++; } } } -void func_809C8710(EnSyatekiMan* this, PlayState* play) { - Vec3f sp24; +void EnSyatekiMan_Town_MovePlayerAndSayHighScore(EnSyatekiMan* this, PlayState* play) { + Vec3f targetPlayerPos; if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) { - sp24 = D_809C9480; + targetPlayerPos = sTownFierceDietyPlayerPos; } else { - sp24 = D_809C948C; + targetPlayerPos = sTownPlayerPos; } - if (func_809C6720(play, sp24)) { - if (this->unk_284 == 0x3FD) { + if (EnSyatekiMan_MovePlayerToPos(play, targetPlayerPos)) { + if (this->prevTextId == 0x3FD) { + // Our highest score is [score]. If you break the record, you'll win a prize! Message_StartTextbox(play, 0x3FE, &this->actor); - this->unk_284 = 0x3FE; + this->prevTextId = 0x3FE; } else { + // Our highest score is [score]. Good luck! Message_StartTextbox(play, 0x400, &this->actor); - this->unk_284 = 0x400; + this->prevTextId = 0x400; } - this->unk_26A = 2; - this->actionFunc = func_809C7990; + + this->shootingGameState = SG_GAME_STATE_EXPLAINING_RULES; + this->actionFunc = EnSyatekiMan_Town_Talk; } } -void func_809C8808(EnSyatekiMan* this, PlayState* play) { - static s16 D_809C94A4 = 30; +void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play) { + static s16 sGameStartTimer = 30; Player* player = GET_PLAYER(play); - if (D_809C94A4 == 30) { + if (sGameStartTimer == 30) { if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { - player->actor.world.pos = D_809C9480; + player->actor.world.pos = sTownFierceDietyPlayerPos; } else { - player->actor.world.pos = D_809C948C; + player->actor.world.pos = sTownPlayerPos; } + player->actor.prevPos = player->actor.world.pos; player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; play->unk_18790(play, -0x8000, &this->actor); player->stateFlags1 |= 0x20; - D_809C94A4--; - } else if (D_809C94A4 > 0) { + sGameStartTimer--; + } else if (sGameStartTimer > 0) { player->actor.shape.rot.y = -0x8000; player->actor.world.rot.y = player->actor.shape.rot.y; - D_809C94A4--; - } else if (D_809C94A4 == 0) { + sGameStartTimer--; + } else if (sGameStartTimer == 0) { player->stateFlags1 &= ~0x20; - this->unk_280 = 0; - this->unk_27E = 0; - this->unk_26C = 70; - this->unk_26E = 0; - D_809C94A4 = 30; + this->score = 0; + this->flagsIndex = 0; + this->perGameVar1.octorokState = SG_OCTO_STATE_INITIAL; + this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; + sGameStartTimer = 30; func_8010E9F0(TIMER_ID_1, 75); this->actor.draw = NULL; - this->actionFunc = func_809C898C; + this->actionFunc = EnSyatekiMan_Town_RunGame; } } -void func_809C898C(EnSyatekiMan* this, PlayState* play) { - static const s32 D_809C94D0[] = { - 0x00000111, 0x00000650, 0x00010025, 0x00011011, 0x00000984, 0x00004050, 0x00010211, 0x00022015, - 0x00026984, 0x00012852, 0x00011999, 0x00022895, 0x0000056A, 0x0002A451, 0x00004115, - }; - static s32 D_809C94A8 = 0; +/** + * In the Town Shooting Gallery, there are fifteen waves of Octoroks. + * For each wave, these flags are used to control which Octoroks appear. + */ +static const s32 sOctorokFlagsPerWave[] = { + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_CENTER, COLUMN_LEFT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_BLUE, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_BLUE, ROW_FRONT, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_LEFT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), + + OCTOROK_FLAG(COLOR_RED, ROW_FRONT, COLUMN_CENTER) | OCTOROK_FLAG(COLOR_RED, ROW_CENTER, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_RIGHT) | OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_CENTER) | + OCTOROK_FLAG(COLOR_RED, ROW_BACK, COLUMN_LEFT), +}; + +void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { + static s32 sModFromLosingTime = 0; Player* player = GET_PLAYER(play); - s32 sp30 = (((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) * 0.1f) + 1.0f; + s32 timer = (((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) * 0.1f) + 1.0f; // unit is tenths of a second - if (sp30 < 0x2EF) { - s32 temp; + if (timer <= 750) { + s32 waveTimer; // unit is hundredths of a second - if (D_809C94A8 == 0) { - temp = ((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) % 500; + // If you hit a Blue Octorok, you lose 2.5 seconds. If we pretend that the code below was not present, + // then waveTimer would drop by 250, dramatically reducing how much time you have before the Octoroks + // begin hiding. This code will ultimately correct waveTimer such that its value is not affected by + // hitting Blue Octoroks. + if (sModFromLosingTime == 0) { + waveTimer = ((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) % 500; } else { - temp = (((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) + 250) % 500; + waveTimer = (((void)0, gSaveContext.eventTimer1Value[TIMER_ID_1]) + 250) % 500; } - if (temp < 100) { - this->unk_26C = 80; + // Octoroks begin hiding four seconds after a wave begins. + if (waveTimer < 100) { + this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING; } - if (this->unk_26E != 0) { - if (this->unk_26E == 2) { + if (this->perGameVar2.octorokHitType != SG_OCTO_HIT_TYPE_NONE) { + if (this->perGameVar2.octorokHitType == SG_OCTO_HIT_TYPE_BLUE) { gSaveContext.eventTimer2Value[TIMER_ID_1] -= 250; - D_809C94A8 = (D_809C94A8 + 25) % 50; + sModFromLosingTime = (sModFromLosingTime + 25) % 50; } - this->unk_26E = 0; + + this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; } - if (this->unk_26C == 0) { - this->unk_26C++; + if (this->perGameVar1.octorokState == SG_OCTO_STATE_SPAWNING) { + this->perGameVar1.octorokState++; } - if ((D_809C94A8 == (sp30 % 50)) && (this->unk_26C >= 70)) { - if (this->unk_27E < 15) { - this->unk_190 = D_809C94D0[this->unk_27E++]; + // A new wave of Octoroks should appear every five seconds. However, we need to take into account + // that the player might have lost time from hitting Blue Octoroks, so we do something similar to + // what was done with waveTimer above. + if ((sModFromLosingTime == (timer % 50)) && (this->perGameVar1.octorokState >= SG_OCTO_STATE_INITIAL)) { + if (this->flagsIndex < 15) { + this->octorokFlags = sOctorokFlagsPerWave[this->flagsIndex++]; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND); - this->unk_26C = 0; + this->perGameVar1.octorokState = SG_OCTO_STATE_SPAWNING; } } if (gSaveContext.eventTimer1Value[TIMER_ID_1] == 0) { - this->unk_27E = 0; - this->unk_26C = 80; + this->flagsIndex = 0; + this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING; gSaveContext.eventTimer1Value[TIMER_ID_1] = 0; gSaveContext.timerState[TIMER_ID_1] = TIMER_STATE_5; player->stateFlags1 |= 0x20; - D_809C94A8 = 0; + sModFromLosingTime = 0; this->actor.draw = EnSyatekiMan_Draw; func_801A2C20(); - this->actionFunc = func_809C8BF0; - if (this->unk_280 == 50) { + this->actionFunc = EnSyatekiMan_Town_EndGame; + if (this->score == 50) { func_801A3098(NA_BGM_GET_ITEM | 0x900); Interface_SetPerfectMinigame(play, 1); } @@ -1150,47 +1354,56 @@ void func_809C898C(EnSyatekiMan* this, PlayState* play) { } } -void func_809C8BF0(EnSyatekiMan* this, PlayState* play) { - if (this->unk_26A == 1) { - this->unk_190 = 0; - if ((this->unk_270 <= 0) && !play->interfaceCtx.isMinigamePerfect) { - Flags_SetAllTreasure(play, this->unk_280); - this->unk_270 = 15; - if (((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) || (this->unk_280 == 50)) { - if ((s32)(gSaveContext.save.unk_EF4 & 0xFFFF) < this->unk_280) { +void EnSyatekiMan_Town_EndGame(EnSyatekiMan* this, PlayState* play) { + if (this->shootingGameState == SG_GAME_STATE_RUNNING) { + this->octorokFlags = 0; + if ((this->talkWaitTimer <= 0) && !play->interfaceCtx.isMinigamePerfect) { + Flags_SetAllTreasure(play, this->score); + this->talkWaitTimer = 15; + if ((GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) || (this->score == 50)) { + if (GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() < this->score) { if (!(gSaveContext.save.weekEventReg[59] & 0x20)) { + // You got a new record! Message_StartTextbox(play, 0x407, &this->actor); - this->unk_284 = 0x407; - } else if (this->unk_280 == 50) { + this->prevTextId = 0x407; + } else if (this->score == 50) { + // No way! That was perfect! Message_StartTextbox(play, 0x405, &this->actor); - this->unk_284 = 0x405; + this->prevTextId = 0x405; } else { + // You got a new record! Message_StartTextbox(play, 0x407, &this->actor); - this->unk_284 = 0x407; + this->prevTextId = 0x407; } - } else if (this->unk_280 == 50) { + } else if (this->score == 50) { + // That was perfect! Message_StartTextbox(play, 0x406, &this->actor); - this->unk_284 = 0x406; + this->prevTextId = 0x406; } - gSaveContext.save.unk_EF4 = (gSaveContext.save.unk_EF4 & 0xFFFF0000) | (this->unk_280 & 0xFFFF); - this->unk_26A = 6; + + SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(this->score); + this->shootingGameState = SG_GAME_STATE_ENDED; } else { if (CURRENT_DAY != 3) { + // You got [score]? Oh, that's too bad... Message_StartTextbox(play, 0x401, &this->actor); - this->unk_284 = 0x401; + this->prevTextId = 0x401; } else { + // You got [score]? Too bad... Message_StartTextbox(play, 0x403, &this->actor); - this->unk_284 = 0x403; + this->prevTextId = 0x403; } - this->unk_26A = 4; + + this->shootingGameState = SG_GAME_STATE_ONE_MORE_GAME; } - this->actionFunc = func_809C7990; + + this->actionFunc = EnSyatekiMan_Town_Talk; } else { - this->unk_270--; + this->talkWaitTimer--; } } - if (this->unk_270 < 5) { + if (this->talkWaitTimer < 5) { play->unk_1887C = -10; } } @@ -1223,9 +1436,9 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { EnSyatekiMan_Blink(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); - if (this->unk_26A != 1) { + if (this->shootingGameState != SG_GAME_STATE_RUNNING) { SkelAnime_Update(&this->skelAnime); - Actor_TrackPlayer(play, &this->actor, &this->unk_258, &this->unk_25E, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } } @@ -1238,11 +1451,11 @@ s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V if (limbIndex == BURLY_GUY_LIMB_HEAD) { Matrix_Translate(3000.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateZS(this->unk_258.x, MTXMODE_APPLY); - Matrix_RotateXS(this->unk_258.y, MTXMODE_APPLY); + Matrix_RotateZS(this->headRot.x, MTXMODE_APPLY); + Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); Matrix_Translate(-3000.0f, 0.0f, 0.0f, MTXMODE_APPLY); } else if (limbIndex == BURLY_GUY_LIMB_TORSO) { - Matrix_RotateXS(-this->unk_25E.y, MTXMODE_APPLY); + Matrix_RotateXS(-this->torsoRot.y, MTXMODE_APPLY); } return false; @@ -1250,10 +1463,10 @@ s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V void EnSyatekiMan_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSyatekiMan* this = THIS; - Vec3f sp18 = { 1600.0f, 0.0f, 0.0f }; + Vec3f sFocusOffset = { 1600.0f, 0.0f, 0.0f }; if (limbIndex == BURLY_GUY_LIMB_HEAD) { - Matrix_MultVec3f(&sp18, &this->actor.focus.pos); + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index 1719f8161..30bc1b1ad 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -4,49 +4,70 @@ #include "global.h" #include "objects/object_shn/object_shn.h" - struct EnSyatekiMan; typedef void (*EnSyatekiManActionFunc)(struct EnSyatekiMan*, PlayState*); -#define ENSYATEKIMAN_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_MAN_GET_PATH(thisx) (((thisx)->params & 0xFF00) >> 8) -typedef struct { - /* 0x00 */ s16 index; - /* 0x04 */ f32 x; - /* 0x08 */ f32 y; - /* 0x0C */ f32 z; - /* 0x10 */ s32 variable; -} EnSyatekiManUnkStruct; // size = 0x14 +typedef enum { + /* 0 */ SG_GAME_STATE_NONE, // None of the states below apply. + /* 1 */ SG_GAME_STATE_RUNNING, // The shooting game is in-progress. + /* 2 */ SG_GAME_STATE_EXPLAINING_RULES, // For the Town Shooting Gallery, this state is also used for explaining the current high score. + /* 3 */ SG_GAME_STATE_NOT_PLAYING, // Either the player said "No" to playing, or they said "Yes" but don't have enough rupees. + /* 4 */ SG_GAME_STATE_ONE_MORE_GAME, // The player failed to get a new high score (Town) and/or perfect score (Swamp and Town). + /* 5 */ SG_GAME_STATE_GIVING_BONUS, // The player gets bonus points at the end of the Swamp game if they get a perfect score. + /* 6 */ SG_GAME_STATE_ENDED, // The player got a new high score and/or perfect score (Town), or the game is over (Swamp). + /* 7 */ SG_GAME_STATE_MOVING_PLAYER, // The player is automatically moving towards the spot to play the game. +} ShootingGalleryGameState; + +typedef enum { + /* 0 */ SG_OCTO_STATE_SPAWNING, + /* 1 */ SG_OCTO_STATE_SPAWNED, + /* 70 */ SG_OCTO_STATE_INITIAL = 70, + /* 80 */ SG_OCTO_STATE_HIDING = 80, +} ShootingGalleryOctorokState; + +typedef enum { + /* 0 */ SG_OCTO_HIT_TYPE_NONE, + /* 1 */ SG_OCTO_HIT_TYPE_RED, + /* 2 */ SG_OCTO_HIT_TYPE_BLUE, +} ShootingGalleryoctorokHitType; typedef struct EnSyatekiMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnSyatekiManActionFunc actionFunc; /* 0x18C */ Path* path; - /* 0x190 */ s32 unk_190; - /* 0x194 */ s32 unk_194; + /* 0x190 */ s32 octorokFlags; + /* 0x194 */ s32 swampTargetActorListIndex; // used but never initialized, so the value is implicitly always 0 /* 0x198 */ Vec3s jointTable[BURLY_GUY_LIMB_MAX]; /* 0x1F8 */ Vec3s morphTable[BURLY_GUY_LIMB_MAX]; - /* 0x258 */ Vec3s unk_258; - /* 0x25E */ Vec3s unk_25E; + /* 0x258 */ Vec3s headRot; + /* 0x25E */ Vec3s torsoRot; /* 0x264 */ s16 eyeIndex; /* 0x266 */ s16 blinkTimer; /* 0x268 */ UNK_TYPE1 unk268[0x2]; - /* 0x26A */ s16 unk_26A; - /* 0x26C */ s16 unk_26C; - /* 0x26E */ s16 unk_26E; - /* 0x270 */ s16 unk_270; - /* 0x272 */ s16 unk_272; - /* 0x274 */ s16 unk_274; - /* 0x276 */ s16 unk_276; - /* 0x278 */ s16 unk_278; - /* 0x27A */ s16 unk_27A; - /* 0x27C */ s16 unk_27C; - /* 0x27E */ s16 unk_27E; - /* 0x280 */ s16 unk_280; - /* 0x282 */ s16 unk_282; - /* 0x284 */ s16 unk_284; + /* 0x26A */ s16 shootingGameState; + /* 0x26C */ union { + s16 guaySpawnTimer; + s16 octorokState; + } perGameVar1; + /* 0x26E */ union { + s16 bonusDekuScrubHitCounter; + s16 octorokHitType; + } perGameVar2; + /* 0x270 */ s16 talkWaitTimer; + /* 0x272 */ s16 dekuScrubFlags; + /* 0x274 */ s16 guayFlags; + /* 0x276 */ s16 wolfosFlags; + /* 0x278 */ s16 dekuScrubHitCounter; + /* 0x27A */ s16 guayHitCounter; + /* 0x27C */ s16 currentWave; + /* 0x27E */ s16 flagsIndex; // Used for Octoroks in Town and Guays in Swamp + /* 0x280 */ s16 score; + /* 0x282 */ s16 talkFlags; + /* 0x284 */ s16 prevTextId; } EnSyatekiMan; // size = 0x288 extern const ActorInit En_Syateki_Man_InitVars; diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index 26cdf3415..eda6337a0 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -137,7 +137,7 @@ s32 func_80A361F4(EnSyatekiOkuta* this) { temp_v1 = EN_SYATEKI_OKUTA_GET_F(&this->actor); if ((temp_v1 == 1) || (temp_v1 == 4)) { - temp_a0 = syatekiMan->unk_190; + temp_a0 = syatekiMan->octorokFlags; temp_a1 = (temp_v1 * 2) + 6; if ((temp_a0 >> temp_a1) & 3) { @@ -212,7 +212,7 @@ void func_80A36444(EnSyatekiOkuta* this) { void func_80A36488(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (syatekiMan->unk_26C >= 0x46) { + if (syatekiMan->perGameVar1.octorokState >= SG_OCTO_STATE_INITIAL) { func_80A364C0(this); } } @@ -341,9 +341,10 @@ void func_80A36AF8(EnSyatekiOkuta* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; s16 temp_v1_2; - if ((this->actionFunc != func_80A36488) && (this->actionFunc != func_80A363B4) && (syatekiMan->unk_26A == 1) && - (syatekiMan->unk_26C == 0)) { - temp_v1_2 = (syatekiMan->unk_190 >> (EN_SYATEKI_OKUTA_GET_F(&this->actor) * 2)) & 3; + if ((this->actionFunc != func_80A36488) && (this->actionFunc != func_80A363B4) && + (syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && + (syatekiMan->perGameVar1.octorokState == SG_OCTO_STATE_SPAWNING)) { + temp_v1_2 = (syatekiMan->octorokFlags >> (EN_SYATEKI_OKUTA_GET_F(&this->actor) * 2)) & 3; if (temp_v1_2 > 0) { Actor_SetScale(&this->actor, 0.01f); this->unk_2A6 = temp_v1_2; @@ -370,11 +371,11 @@ void EnSyatekiOkuta_Update(Actor* thisx, PlayState* play) { if (this->unk_2A6 == 1) { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); play->interfaceCtx.unk_25C++; - syatekiMan->unk_280++; - syatekiMan->unk_26E = 1; + syatekiMan->score++; + syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_RED; } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_ERROR); - syatekiMan->unk_26E = 2; + syatekiMan->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_BLUE; } func_80A3657C(this); diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index e40cc9570..7c6073bb2 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -151,7 +151,7 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { path = &play->setupPathList[path->unk1]; } - for (i = 0; i < EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor); i++) { + for (i = 0; i < EN_SYATEKI_WF_GET_NUMBER(&this->actor); i++) { path = &play->setupPathList[path->unk1]; } @@ -224,7 +224,7 @@ void func_80A201CC(EnSyatekiWf* this) { this->actor.draw = NULL; this->unk_2A4 = 1; this->unk_298 = 0; - syatekiMan->unk_276 &= ~(1 << EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor)); + syatekiMan->wolfosFlags &= ~(1 << EN_SYATEKI_WF_GET_NUMBER(&this->actor)); this->actionFunc = func_80A20284; } @@ -233,10 +233,10 @@ void func_80A20284(EnSyatekiWf* this, PlayState* play) { if (this->actor.parent != NULL) { syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->unk_26A == 1) && (this->unk_298 == 1)) { + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_298 == 1)) { func_80A200E0(this); func_80A2030C(this); - } else if (syatekiMan->unk_276 & (1 << EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor))) { + } else if (syatekiMan->wolfosFlags & (1 << EN_SYATEKI_WF_GET_NUMBER(&this->actor))) { this->unk_298 = 1; } } @@ -270,7 +270,7 @@ void func_80A203DC(EnSyatekiWf* this, PlayState* play) { s16 temp_v0; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (syatekiMan->unk_26A != 1) { + if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { func_80A201CC(this); } @@ -375,7 +375,7 @@ void func_80A20858(EnSyatekiWf* this, PlayState* play) { EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); - syatekiMan->unk_280 += 100; + syatekiMan->score += 100; this->actionFunc = func_80A208F8; } diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index 1af2d0b96..4de182a10 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -5,7 +5,8 @@ #include "objects/object_wf/object_wf.h" #define EN_SYATEKI_WF_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_WF_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_WF_GET_NUMBER(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_WF_PARAMS(number, unkF0, unused) (((number << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unused & 0xF)) struct EnSyatekiWf; 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 60f5d472b..7d2bbb9bb 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -261,7 +261,7 @@ void func_80BE09A8(EnTab* this, PlayState* play) { void func_80BE0A98(EnTab* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp20 = Message_GetState(&play->msgCtx); + s32 talkState = Message_GetState(&play->msgCtx); this->unk_308 += (this->unk_304 != 0.0f) ? 40.0f : -40.0f; this->unk_308 = CLAMP(this->unk_308, 0.0f, 80.0f); @@ -269,8 +269,8 @@ void func_80BE0A98(EnTab* this, PlayState* play) { Matrix_Translate(this->unk_308, 0.0f, 0.0f, MTXMODE_APPLY); if ((&this->actor == player->targetActor) && - ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (sp20 == 3) && - (this->unk_334 == 3)) { + ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3)) { if ((play->state.frames % 2) == 0) { if (this->unk_304 != 0.0f) { this->unk_304 = 0.0f; @@ -281,7 +281,7 @@ void func_80BE0A98(EnTab* this, PlayState* play) { } else { this->unk_304 = 0.0f; } - this->unk_334 = sp20; + this->prevTalkState = talkState; } s32 func_80BE0C04(EnTab* this, Actor* actor, f32 arg2) { @@ -366,7 +366,7 @@ s32* func_80BE0E04(EnTab* this, PlayState* play) { return NULL; } -s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; EnGm* sp28 = func_80BE04E0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); @@ -385,7 +385,7 @@ s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleResult* arg2) { return ret; } -s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 pad; Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1B04); @@ -399,18 +399,18 @@ s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleResult* arg2) { return true; } -s32 func_80BE1060(EnTab* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80BE1060(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret; this->unk_2FC = 0; - switch (arg2->result) { + switch (scheduleOutput->result) { case 1: - ret = func_80BE0F04(this, play, arg2); + ret = func_80BE0F04(this, play, scheduleOutput); break; case 2: - ret = func_80BE0FC4(this, play, arg2); + ret = func_80BE0FC4(this, play, scheduleOutput); break; default: @@ -472,7 +472,7 @@ void func_80BE1224(EnTab* this, PlayState* play) { } void func_80BE127C(EnTab* this, PlayState* play) { - ScheduleResult sp18; + ScheduleOutput sp18; this->unk_31A = REG(15) + ((void)0, gSaveContext.save.daySpeed); 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 25eec7926..81ce92006 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.h +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.h @@ -41,7 +41,7 @@ typedef struct EnTab { /* 0x328 */ EnTabUnkFunc unk_328; /* 0x32C */ s32 unk_32C; /* 0x330 */ UNK_TYPE1 unk330[4]; - /* 0x334 */ s32 unk_334; + /* 0x334 */ s32 prevTalkState; /* 0x338 */ s32 unk_338; } EnTab; // size = 0x33C diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index b398d3060..fff6d29fa 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -796,25 +796,25 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { EnTalkGibudRequestedItem* requestedItem; switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: + case TEXT_STATE_7: + case TEXT_STATE_8: + case TEXT_STATE_9: + case TEXT_STATE_10: + case TEXT_STATE_11: + case TEXT_STATE_12: + case TEXT_STATE_13: break; - case 5: + case TEXT_STATE_5: EnTalkGibud_GetNextTextBoxId(this, play); break; - case 6: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { if (this->textId == 0x138A) { // Remove the requested item/amount from the player's inventory @@ -834,7 +834,7 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { } break; - case 16: + case TEXT_STATE_16: EnTalkGibud_CheckPresentedItem(this, play); break; } diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index afc151032..4f19b73a8 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -670,7 +670,7 @@ void EnTanron2_Draw(Actor* thisx, PlayState* play2) { Matrix_Scale(D_80BB8454, 0.0f, D_80BB8454, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_0377B0); + gSPDisplayList(POLY_XLU_DISP++, gEffWaterRippleDL); } tanron2 = tanron2->next; } 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 a19c04b80..d782881b0 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -373,7 +373,7 @@ void EnTest4_Destroy(Actor* thisx, PlayState* play) { void func_80A42AB8(EnTest4* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->transitionMode == 0) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && + if ((play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && (play->roomCtx.unk31 == 0) && !Play_IsDebugCamEnabled()) { s16 temp_a2; u16 temp_a0 = sDayNightTransitionTimes[this->unk_144]; @@ -409,7 +409,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if (player->stateFlags1 & 0x800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; - if ((rideActor->type == HORSE_EPONA) || (rideActor->type == HORSE_2)) { + if ((rideActor->type == HORSE_TYPE_EPONA) || (rideActor->type == HORSE_TYPE_2)) { if (CURRENT_DAY < 3) { D_801BDA9C = 1; } else { @@ -461,8 +461,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { play->nextEntranceIndex = 0xD800; } gSaveContext.nextCutsceneIndex = 0xFFF1; - play->transitionTrigger = 0x14; - play->unk_1887F = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_02; player->stateFlags1 |= 0x200; Actor_MarkForDeath(&this->actor); } @@ -525,7 +525,7 @@ void func_80A430C8(EnTest4* this, PlayState* play) { (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { // rain? - D_801BDBB0 = 1; + gWeatherMode = 1; func_800FD78C(play); play->envCtx.unk_E3 = 1; play->envCtx.unk_F2[0] = 0x3C; @@ -540,7 +540,7 @@ void func_80A430C8(EnTest4* this, PlayState* play) { } } - if (D_801BDBB0 == 1) { + if (gWeatherMode == 1) { this->state = TEST4_STATE_1; } } @@ -549,11 +549,11 @@ void func_80A431C8(EnTest4* this, PlayState* play) { if (((gSaveContext.save.time >= CLOCK_TIME(17, 30)) && (gSaveContext.save.time < CLOCK_TIME(23, 0)) && (play->envCtx.unk_F2[0] != 0)) || (play->envCtx.unk_F2[2] != 0)) { - D_801BDBB0 = 0; + gWeatherMode = 0; play->envCtx.unk_E3 = 2; } - if (D_801BDBB0 == 0) { + if (gWeatherMode == 0) { this->state = TEST4_STATE_0; } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index f8bc178fe..7d26a6fb8 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -96,7 +96,7 @@ Color_RGB8 D_80A94050 = { 0, 0, 0 }; s16 D_80A94054 = 500; s16 D_80A94058 = 1500; -Vec3f D_80A9405C = { 0.0f, 1.0f, 0.0f }; +static Vec3f sSubCamUp = { 0.0f, 1.0f, 0.0f }; Color_RGB8 D_80A94068 = { 225, 230, 225 }; Color_RGB8 D_80A9406C = { 120, 120, 100 }; @@ -359,7 +359,7 @@ void func_80A9156C(EnTest6* this, PlayState* play) { ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { ActorCutscene_Start(play->playerActorCsIds[8], NULL); - this->unk_284 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); + this->subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); EnTest6_SetupAction(this, func_80A91760); } break; @@ -369,7 +369,7 @@ void func_80A9156C(EnTest6* this, PlayState* play) { ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); } else { ActorCutscene_Start(play->playerActorCsIds[8], NULL); - this->unk_284 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); + this->subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); EnTest6_SetupAction(this, func_80A92188); } break; @@ -410,15 +410,15 @@ void func_80A91760(EnTest6* this, PlayState* play) { Input* input = CONTROLLER1(&play->state); s16 temp_s0; Player* player = GET_PLAYER(play); - Camera* sp78; - Vec3f sp6C; - Vec3f sp60; + Camera* mainCam; + Vec3f subCamAt; + Vec3f subCamEye; Vec3f sp54; s32 i; f32 sp4C; - Camera* temp_s3 = Play_GetCamera(play, this->unk_284); + Camera* subCam = Play_GetCamera(play, this->subCamId); - sp78 = Play_GetCamera(play, CAM_ID_MAIN); + mainCam = Play_GetCamera(play, CAM_ID_MAIN); switch (this->unk_274) { case 90: @@ -459,12 +459,12 @@ void func_80A91760(EnTest6* this, PlayState* play) { this->unk_254 = ZeldaArena_Malloc(sizeof(Vec3f) * 64); if (this->unk_254 != NULL) { for (i = 0; i < ARRAY_COUNT(this->unk_254[0]); i++) { - (*this->unk_254)[i].x = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + temp_s3->eye.x + - ((temp_s3->at.x - temp_s3->eye.x) * 0.2f); - (*this->unk_254)[i].y = (((2.0f * Rand_ZeroOne()) - 1.0f) * 120.0f) + temp_s3->eye.y + - ((temp_s3->at.y - temp_s3->eye.y) * 0.2f) + sp4C; - (*this->unk_254)[i].z = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + temp_s3->eye.z + - ((temp_s3->at.z - temp_s3->eye.z) * 0.2f); + (*this->unk_254)[i].x = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.x + + ((subCam->at.x - subCam->eye.x) * 0.2f); + (*this->unk_254)[i].y = (((2.0f * Rand_ZeroOne()) - 1.0f) * 120.0f) + subCam->eye.y + + ((subCam->at.y - subCam->eye.y) * 0.2f) + sp4C; + (*this->unk_254)[i].z = (((2.0f * Rand_ZeroOne()) - 1.0f) * 40.0f) + subCam->eye.z + + ((subCam->at.z - subCam->eye.z) * 0.2f); } } func_80A90C08(0x78); @@ -562,29 +562,29 @@ void func_80A91760(EnTest6* this, PlayState* play) { } if (this->unk_27A > 80) { - temp_s3->fov += (90.0f - temp_s3->fov) / (this->unk_27A - 80); + subCam->fov += (90.0f - subCam->fov) / (this->unk_27A - 80); } else if (this->unk_27A > 60) { sp4C = 1.0f / (this->unk_27A - 60); - sp6C.x = temp_s3->at.x + ((player->actor.world.pos.x - temp_s3->at.x) * sp4C); - sp6C.y = temp_s3->at.y + (((player->actor.focus.pos.y - temp_s3->at.y) - 20.0f) * sp4C); - sp6C.z = temp_s3->at.z + ((player->actor.world.pos.z - temp_s3->at.z) * sp4C); + subCamAt.x = subCam->at.x + ((player->actor.world.pos.x - subCam->at.x) * sp4C); + subCamAt.y = subCam->at.y + (((player->actor.focus.pos.y - subCam->at.y) - 20.0f) * sp4C); + subCamAt.z = subCam->at.z + ((player->actor.world.pos.z - subCam->at.z) * sp4C); - sp54.x = (Math_SinS(player->actor.world.rot.y) * 80.0f) + sp6C.x; - sp54.y = sp6C.y + 20.0f; - sp54.z = (Math_CosS(player->actor.world.rot.y) * 80.0f) + sp6C.z; + sp54.x = (Math_SinS(player->actor.world.rot.y) * 80.0f) + subCamAt.x; + sp54.y = subCamAt.y + 20.0f; + sp54.z = (Math_CosS(player->actor.world.rot.y) * 80.0f) + subCamAt.z; sp4C *= 0.75f; - VEC3F_LERPIMPDST(&sp60, &temp_s3->eye, &sp54, sp4C); + VEC3F_LERPIMPDST(&subCamEye, &subCam->eye, &sp54, sp4C); - Play_CameraSetAtEye(play, this->unk_284, &sp6C, &sp60); + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); } else if ((this->unk_27A < 11) && (this->unk_27A > 0)) { - temp_s3->fov += (sp78->fov - temp_s3->fov) / this->unk_27A; + subCam->fov += (mainCam->fov - subCam->fov) / this->unk_27A; } if (this->unk_286 != 0) { func_80A90C54(play, this->unk_286 * 0.05f); - temp_s3->fov += (sp78->fov - temp_s3->fov) * 0.05f; + subCam->fov += (mainCam->fov - subCam->fov) * 0.05f; this->unk_286++; if (this->unk_286 >= 20) { this->unk_27A = 1; @@ -630,10 +630,10 @@ void func_80A92118(EnTest6* this, PlayState* play) { void func_80A92188(EnTest6* this, PlayState* play) { Input* input = CONTROLLER1(&play->state); Player* player = GET_PLAYER(play); - Camera* camera; + Camera* subCam; s32 pad; - s16 sp46; - s16 sp44; + s16 subCamId; + s16 pad2; if (this->unk_27A > 115) { this->unk_160 += 0.2f; @@ -736,23 +736,23 @@ void func_80A92188(EnTest6* this, PlayState* play) { func_80A92950(this, play); if (this->unk_27A == 115) { - sp44 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); - camera = Play_GetCamera(play, sp44); + subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); + subCam = Play_GetCamera(play, subCamId); - this->unk_258 = camera->at; - this->unk_264 = camera->eye; - this->unk_270 = camera->fov; - func_8016119C(camera, &this->unk_18C); + this->subCamAt = subCam->at; + this->subCamEye = subCam->eye; + this->subCamFov = subCam->fov; + func_8016119C(subCam, &this->unk_18C); } if ((this->unk_27A <= 115) && (this->unk_27A >= 16)) { func_80161998(D_80A93E80, &this->unk_18C); } else if (this->unk_27A < 16) { - sp46 = ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8]); + subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); - Play_CameraSetAtEyeUp(play, sp46, &this->unk_258, &this->unk_264, &D_80A9405C); - Play_CameraSetFov(play, sp46, this->unk_270); - Play_CameraSetRoll(play, sp46, 0); + Play_CameraSetAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); + Play_CameraSetFov(play, subCamId, this->subCamFov); + Play_CameraSetRoll(play, subCamId, 0); } switch (this->unk_27A) { @@ -979,9 +979,9 @@ void func_80A92950(EnTest6* this, PlayState* play) { Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - play->unk_1887F = 2; + play->transitionType = TRANS_TYPE_02; if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; gSaveContext.eventInf[2] |= 0x80; @@ -1060,9 +1060,9 @@ void func_80A92950(EnTest6* this, PlayState* play) { Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - play->unk_1887F = 2; + play->transitionType = TRANS_TYPE_02; gSaveContext.respawnFlag = 2; play->msgCtx.ocarinaMode = 4; } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.h b/src/overlays/actors/ovl_En_Test6/z_en_test6.h index 8bc2cff4e..ad596960e 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.h +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.h @@ -34,9 +34,9 @@ typedef struct EnTest6 { /* 0x18C */ DbCameraUnkStruct unk_18C; /* 0x20C */ Vec3f unk_20C[6]; /* 0x254 */ Vec3f (*unk_254)[64]; - /* 0x258 */ Vec3f unk_258; - /* 0x264 */ Vec3f unk_264; - /* 0x270 */ f32 unk_270; + /* 0x258 */ Vec3f subCamAt; + /* 0x264 */ Vec3f subCamEye; + /* 0x270 */ f32 subCamFov; /* 0x274 */ s16 unk_274; /* 0x276 */ s16 unk_276; /* 0x278 */ s16 unk_278; @@ -45,7 +45,7 @@ typedef struct EnTest6 { /* 0x27E */ s16 unk_27E; /* 0x280 */ s16 unk_280; /* 0x282 */ s16 unk_282; - /* 0x284 */ s16 unk_284; + /* 0x284 */ s16 subCamId; /* 0x286 */ s16 unk_286; } EnTest6; // size = 0x288 diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 8cd0b1d4a..b9b62e9f7 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -398,7 +398,7 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { this->unk_1E94 = player->actor.scale.z; func_80183430(&this->unk_18CC, &gameplay_keep_Blob_085640, &gameplay_keep_Blob_083534, this->unk_18FC, - this->unk_1BA8, 0); + this->unk_1BA8, NULL); func_801834A8(&this->unk_18CC, &gameplay_keep_Blob_083534); func_80AF0838(this->unk_15C); func_80AF1730(&this->unk_148); @@ -452,11 +452,11 @@ void func_80AF1A2C(EnTest7* this, PlayState* play) { func_800FD698(play, 2000, 4000, sp2C); if (this->unk_1E54 >= 10) { - Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); - this->unk_1E60 = camera->eye; - this->unk_1E6C = camera->at; - this->unk_1E78 = camera->fov; + this->subCamEye = subCam->eye; + this->subCamAt = subCam->at; + this->subCamFov = subCam->fov; func_80AF082C(this, func_80AF1CA0); this->unk_144 |= 0x20; @@ -514,12 +514,12 @@ void func_80AF1CA0(EnTest7* this, PlayState* play) { } if (Rand_ZeroOne() < 0.3f) { - Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); f32 rand = Rand_ZeroOne(); - sp34.x = ((camera->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; - sp34.y = ((camera->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; - sp34.z = ((camera->eye.z - this->actor.world.pos.z) * rand) + this->actor.world.pos.z; + sp34.x = ((subCam->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; + sp34.y = ((subCam->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; + sp34.z = ((subCam->eye.z - this->actor.world.pos.z) * rand) + this->actor.world.pos.z; func_80AF0C30(this->unk_15C, &sp34, 1); this->unk_144 |= 8; @@ -531,17 +531,17 @@ void func_80AF1CA0(EnTest7* this, PlayState* play) { void func_80AF1E44(EnTest7* this, PlayState* play) { Vec3f sp34; - Camera* camera; + Camera* subCam; f32 rand; func_80AF1B68(this, play); if (Rand_ZeroOne() < 0.3f) { - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); rand = Rand_ZeroOne(); - sp34.x = ((camera->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; - sp34.y = ((camera->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; - sp34.z = ((camera->eye.z - this->actor.world.pos.z) * rand) + this->actor.world.pos.z; + sp34.x = ((subCam->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; + sp34.y = ((subCam->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; + sp34.z = ((subCam->eye.z - this->actor.world.pos.z) * rand) + this->actor.world.pos.z; func_80AF0C30(this->unk_15C, &sp34, 1); } @@ -576,7 +576,7 @@ void func_80AF2030(EnTest7* this, PlayState* play) { s32 temp = this->unk_1E54 - 96; f32 four = 4; f32 sp1C = 1.0f - (temp / four); - Camera* camera; + Camera* subCam; f32 temp_f2; f32 temp_f4; @@ -585,13 +585,13 @@ void func_80AF2030(EnTest7* this, PlayState* play) { this->unk_148.unk_10 -= 0x2EE0; this->actor.world.pos.y += 100.0f; - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); - camera->focalActor = NULL; + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam->focalActor = NULL; - camera->eye.x = ((camera->eye.x - this->unk_1E60.x) * sp1C) + this->unk_1E60.x; - camera->eye.y = ((camera->eye.y - this->unk_1E60.y) * sp1C) + this->unk_1E60.y; - camera->eye.z = ((camera->eye.z - this->unk_1E60.z) * sp1C) + this->unk_1E60.z; - camera->fov = ((camera->fov - this->unk_1E78) * sp1C) + this->unk_1E78; + subCam->eye.x = ((subCam->eye.x - this->subCamEye.x) * sp1C) + this->subCamEye.x; + subCam->eye.y = ((subCam->eye.y - this->subCamEye.y) * sp1C) + this->subCamEye.y; + subCam->eye.z = ((subCam->eye.z - this->subCamEye.z) * sp1C) + this->subCamEye.z; + subCam->fov = ((subCam->fov - this->subCamFov) * sp1C) + this->subCamFov; if (this->unk_1E54 >= 100) { MREG(64) = 1; @@ -669,8 +669,8 @@ void func_80AF2350(EnTest7* this, PlayState* play) { } } - play->transitionTrigger = 0x14; - play->unk_1887F = 2; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_02; gSaveContext.seqIndex = 0xFF; gSaveContext.nightSeqIndex = 0xFF; } @@ -679,31 +679,31 @@ void func_80AF24D8(EnTest7* this, PlayState* play, f32 arg2) { Vec3f sp3C; Vec3f* pos; Player* player = GET_PLAYER(play); - Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); pos = &player->actor.world.pos; - camera->focalActor = NULL; + subCam->focalActor = NULL; sp3C.x = ((180.0f * Math_SinS(this->unk_1E8E)) * Math_CosS(0xFA0)) + pos->x; sp3C.y = (Math_SinS(0xFA0) * 180.0f) + pos->y; sp3C.z = ((180.0f * Math_CosS(this->unk_1E8E)) * Math_CosS(0xFA0)) + pos->z; - camera->eye.x = ((sp3C.x - camera->eye.x) * arg2) + camera->eye.x; - camera->eye.y = ((sp3C.y - camera->eye.y) * arg2) + camera->eye.y; - camera->eye.z = ((sp3C.z - camera->eye.z) * arg2) + camera->eye.z; + subCam->eye.x = ((sp3C.x - subCam->eye.x) * arg2) + subCam->eye.x; + subCam->eye.y = ((sp3C.y - subCam->eye.y) * arg2) + subCam->eye.y; + subCam->eye.z = ((sp3C.z - subCam->eye.z) * arg2) + subCam->eye.z; - camera->fov = ((this->unk_1E78 - camera->fov) * arg2) + camera->fov; - camera->at.y += 1.4444444f; + subCam->fov = ((this->subCamFov - subCam->fov) * arg2) + subCam->fov; + subCam->at.y += 1.4444444f; } void func_80AF2654(EnTest7* this, PlayState* play, f32 arg2) { Vec3f* pos; Player* player = GET_PLAYER(play); - Camera* camera; + Camera* subCam; Vec3f sp30; - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); - camera->focalActor = NULL; + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam->focalActor = NULL; pos = &player->actor.world.pos; @@ -711,15 +711,15 @@ void func_80AF2654(EnTest7* this, PlayState* play, f32 arg2) { sp30.y = (Math_SinS(0xBB8) * 80.0f) + pos->y; sp30.z = ((80.0f * Math_CosS(this->unk_1E8E)) * Math_CosS(0xBB8)) + pos->z; - camera->eye.x = ((sp30.x - camera->eye.x) * arg2) + camera->eye.x; - camera->eye.y = ((sp30.y - camera->eye.y) * arg2) + camera->eye.y; - camera->eye.z = ((sp30.z - camera->eye.z) * arg2) + camera->eye.z; + subCam->eye.x = ((sp30.x - subCam->eye.x) * arg2) + subCam->eye.x; + subCam->eye.y = ((sp30.y - subCam->eye.y) * arg2) + subCam->eye.y; + subCam->eye.z = ((sp30.z - subCam->eye.z) * arg2) + subCam->eye.z; - camera->at.x = ((pos->x - camera->at.x) * arg2) + camera->at.x; - camera->at.y = (((pos->y + 40.0f) - camera->at.y) * arg2) + camera->at.y; - camera->at.z = ((pos->z - camera->at.z) * arg2) + camera->at.z; + subCam->at.x = ((pos->x - subCam->at.x) * arg2) + subCam->at.x; + subCam->at.y = (((pos->y + 40.0f) - subCam->at.y) * arg2) + subCam->at.y; + subCam->at.z = ((pos->z - subCam->at.z) * arg2) + subCam->at.z; - camera->fov = ((this->unk_1E78 - camera->fov) * arg2) + camera->fov; + subCam->fov = ((this->subCamFov - subCam->fov) * arg2) + subCam->fov; } void func_80AF2808(EnTest7* this, PlayState* play, f32 arg2) { @@ -771,19 +771,19 @@ void func_80AF29C0(EnTest7* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - Camera* temp_s0 = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); - temp_s0->at.x = ((D_80AF3454 * Math_SinS(D_80AF3450[0]) * Math_CosS(D_80AF3450[1]))) + pos->x; - temp_s0->at.y = (Math_SinS(D_80AF3450[1]) * D_80AF3454) + pos->y; - temp_s0->at.z = ((D_80AF3454 * Math_CosS(D_80AF3450[0])) * Math_CosS(D_80AF3450[1])) + pos->z; + subCam->at.x = ((D_80AF3454 * Math_SinS(D_80AF3450[0]) * Math_CosS(D_80AF3450[1]))) + pos->x; + subCam->at.y = (Math_SinS(D_80AF3450[1]) * D_80AF3454) + pos->y; + subCam->at.z = ((D_80AF3454 * Math_CosS(D_80AF3450[0])) * Math_CosS(D_80AF3450[1])) + pos->z; - this->actor.world.pos.x = temp_s0->at.x; - this->actor.world.pos.y = temp_s0->at.y - 40.0f; - this->actor.world.pos.z = temp_s0->at.z; + this->actor.world.pos.x = subCam->at.x; + this->actor.world.pos.y = subCam->at.y - 40.0f; + this->actor.world.pos.z = subCam->at.z; } void func_80AF2AE8(EnTest7* this, PlayState* play) { - Camera* camera; + Camera* subCam; if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); @@ -793,9 +793,9 @@ void func_80AF2AE8(EnTest7* this, PlayState* play) { ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF2C48); - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); - this->unk_1E60 = camera->eye; - this->unk_1E6C = camera->at; + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + this->subCamEye = subCam->eye; + this->subCamAt = subCam->at; func_80AF29C0(this, play); } @@ -804,21 +804,21 @@ void func_80AF2BAC(EnTest7* this, PlayState* play, Vec3f* arg2, f32 arg3) { f32 x; f32 y; f32 z; - Camera* camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); - camera->focalActor = NULL; - x = ((camera->at.x - arg2->x) * arg3) + arg2->x; - y = ((camera->at.y - arg2->y) * arg3) + arg2->y; - z = ((camera->at.z - arg2->z) * arg3) + arg2->z; + subCam->focalActor = NULL; + x = ((subCam->at.x - arg2->x) * arg3) + arg2->x; + y = ((subCam->at.y - arg2->y) * arg3) + arg2->y; + z = ((subCam->at.z - arg2->z) * arg3) + arg2->z; - camera->at.x = x; - camera->at.y = y; - camera->at.z = z; + subCam->at.x = x; + subCam->at.y = y; + subCam->at.z = z; } void func_80AF2C48(EnTest7* this, PlayState* play) { f32 sp24 = (40 - this->unk_1E54) / 40.0f; - Camera* camera; + Camera* subCam; this->unk_148.unk_00 = 11.0f; this->unk_144 |= 4; @@ -830,12 +830,12 @@ void func_80AF2C48(EnTest7* this, PlayState* play) { this->actor.world.pos.y = ((this->actor.world.pos.y - this->actor.home.pos.y) * sp24) + this->actor.home.pos.y; this->actor.world.pos.z = ((this->actor.world.pos.z - this->actor.home.pos.z) * sp24) + this->actor.home.pos.z; - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); func_80AF2BAC(this, play, &this->actor.home.pos, sp24); - camera->at.x = this->actor.world.pos.x; - camera->at.y = this->actor.world.pos.y + 40.0f; - camera->at.z = this->actor.world.pos.z; + subCam->at.x = this->actor.world.pos.x; + subCam->at.y = this->actor.world.pos.y + 40.0f; + subCam->at.z = this->actor.world.pos.z; func_800B9010(&this->actor, NA_SE_PL_WARP_WING_ROLL_2 - SFX_FLAG); if (this->unk_1E54 >= 40) { @@ -845,23 +845,23 @@ void func_80AF2C48(EnTest7* this, PlayState* play) { } void func_80AF2DB4(EnTest7* this, PlayState* play) { - Camera* camera; + Camera* subCam; Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); - camera->eye.x = (Math_SinS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->x; - camera->eye.y = pos->y + 108.8042f; - camera->eye.z = (Math_CosS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->z; + subCam->eye.x = (Math_SinS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->x; + subCam->eye.y = pos->y + 108.8042f; + subCam->eye.z = (Math_CosS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->z; - camera->at.x = pos->x; - camera->at.y = pos->y + 40.0f; - camera->at.z = pos->z; + subCam->at.x = pos->x; + subCam->at.y = pos->y + 40.0f; + subCam->at.z = pos->z; } void func_80AF2EC8(EnTest7* this, PlayState* play) { - Camera* camera; + Camera* subCam; if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); @@ -869,9 +869,9 @@ void func_80AF2EC8(EnTest7* this, PlayState* play) { ActorCutscene_Start(play->playerActorCsIds[8], NULL); func_80AF082C(this, func_80AF2F98); - camera = Play_GetCamera(play, ActorCutscene_GetCurrentCamera(play->playerActorCsIds[8])); - this->unk_1E60 = camera->eye; - this->unk_1E6C = camera->at; + subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + this->subCamEye = subCam->eye; + this->subCamAt = subCam->at; this->unk_1E54 = 40; func_80AF2DB4(this, play); diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.h b/src/overlays/actors/ovl_En_Test7/z_en_test7.h index e35c25229..da6dec94b 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.h +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.h @@ -51,9 +51,9 @@ typedef struct EnTest7 { /* 0x1E54 */ s32 unk_1E54; /* 0x1E58 */ EnTest7UnkFunc unk_1E58; /* 0x1E5C */ EnTest7ActionFunc actionFunc; - /* 0x1E60 */ Vec3f unk_1E60; - /* 0x1E6C */ Vec3f unk_1E6C; - /* 0x1E78 */ f32 unk_1E78; + /* 0x1E60 */ Vec3f subCamEye; + /* 0x1E6C */ Vec3f subCamAt; + /* 0x1E78 */ f32 subCamFov; /* 0x1E7C */ LightNode* lightNode; /* 0x1E80 */ LightInfo lightInfo; /* 0x1E8E */ s16 unk_1E8E; diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 514c6bb99..849795b06 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -240,7 +240,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { if (isItemFound) { Inventory_DeleteItem(itemId2, slotId); this->unk_3E8 = object_thiefbird_DL_0033B0; - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Message_StartTextbox(play, 0xF4, NULL); } itemId1 = ITEM_BOTTLE; @@ -264,7 +264,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { this->unk_3E8 = D_80C13680[phi_a3 - 1]; } - if (Message_GetState(&play->msgCtx) == 0) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Message_StartTextbox(play, 0xF5, NULL); } } else { diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index 2ed585d04..dadb5b9cc 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -134,7 +134,7 @@ void func_80ACA184(EnTimeTag* this, PlayState* play) { } void func_80ACA208(EnTimeTag* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->actionFunc = func_80ACA268; } @@ -171,17 +171,17 @@ void func_80ACA348(EnTimeTag* this, PlayState* play) { } void func_80ACA3C0(EnTimeTag* this, PlayState* play) { - if ((play->msgCtx.unk11F00->unk01 == 0) && (play->msgCtx.msgMode == 0x1B)) { + if ((play->msgCtx.unk11F00->state == 0) && (play->msgCtx.msgMode == 0x1B)) { this->actor.home.rot.x = 5; this->actionFunc = func_80ACA348; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; play->msgCtx.msgMode = 0; } } void func_80ACA418(EnTimeTag* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x101C: @@ -216,7 +216,7 @@ void func_80ACA418(EnTimeTag* this, PlayState* play) { } break; - case 2: + case TEXT_STATE_CLOSING: this->actionFunc = func_80ACA5F8; break; } @@ -262,9 +262,9 @@ void func_80ACA714(EnTimeTag* this, PlayState* play) { } void func_80ACA724(EnTimeTag* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { play->nextEntranceIndex = play->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; if (!ENTIMETAG_GET_E000(&this->actor)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_OC_DOOR_OPEN); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 25bbfa0b2..52ffa365f 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -24,8 +24,8 @@ void func_80AECB0C(EnTk* this, PlayState* play); void func_80AECB6C(EnTk* this, PlayState* play); void func_80AECE0C(EnTk* this, PlayState* play); s32 func_80AECE60(EnTk* this, PlayState* play); -s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2); -s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2); +s32 func_80AED354(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput); +s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput); void func_80AED4F8(EnTk* this, PlayState* play); void func_80AED610(EnTk* this, PlayState* play); void func_80AED898(EnTk* this, PlayState* play); @@ -291,7 +291,7 @@ void func_80AECA3C(EnTk* this, PlayState* play) { void func_80AECA90(EnTk* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80AEDE10(this, play); } else if (this->actor.xzDistToPlayer < 100.0f) { func_800B8614(&this->actor, play, 100.0f); @@ -312,13 +312,13 @@ void func_80AECB6C(EnTk* this, PlayState* play) { s32 temp3; f32 sp48; f32 sp44; - ScheduleResult sp34; + ScheduleOutput sp34; u8 temp4; this->actor.textId = 0; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80AED4F8(this, play); return; } @@ -411,7 +411,7 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { this->unk_3CE |= 4; } - if ((play->transitionMode != 0) || (this->timePathTimeSpeed == 0)) { + if ((play->transitionMode != TRANS_MODE_OFF) || (this->timePathTimeSpeed == 0)) { sp78 = this->timePathElapsedTime; sp74 = this->timePathWaypoint; timePathTargetPos = this->actor.world.pos; @@ -429,7 +429,7 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { this->actor.world.rot.y = Math_Vec3f_Yaw(&sp94, &sp88); } - if ((play->transitionMode != 0) || (this->timePathTimeSpeed == 0)) { + if ((play->transitionMode != TRANS_MODE_OFF) || (this->timePathTimeSpeed == 0)) { this->timePathElapsedTime = sp78; this->timePathWaypoint = sp74; this->timePathTargetPos = timePathTargetPos; @@ -492,22 +492,23 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { return false; } -s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AED354(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 phi_v1 = false; - if (arg2->result != 0) { - phi_v1 = func_80AED38C(this, play, arg2); + if (scheduleOutput->result != 0) { + phi_v1 = func_80AED38C(this, play, scheduleOutput); } return phi_v1; } -s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2) { +s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp1E = SCHEDULE_TIME_NOW; u8 params = ENTK_GET_F800(&this->actor); u16 phi_a1; - s32 idx = arg2->result - 1; + s32 index = scheduleOutput->result - 1; + u16 tmp; - this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[idx + 1]); + this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[index + 1]); if (this->timePath == NULL) { return false; } @@ -515,13 +516,13 @@ s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2) { if ((this->unk_3CC <= 0) && (this->unk_3CC != 0) && (this->timePathTimeSpeed >= 0)) { phi_a1 = sp1E; } else { - phi_a1 = arg2->time0; + phi_a1 = scheduleOutput->time0; } - this->timePathTotalTime = arg2->time1 - phi_a1; + this->timePathTotalTime = scheduleOutput->time1 - phi_a1; this->timePathElapsedTime = sp1E - phi_a1; - phi_a1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); - this->timePathWaypointTime = this->timePathTotalTime / phi_a1; + tmp = phi_a1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1); + this->timePathWaypointTime = this->timePathTotalTime / tmp; this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk_3CE &= ~4; this->unk_3CE &= ~8; @@ -554,7 +555,7 @@ void func_80AED610(EnTk* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - 0x1555, 0x71C)) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 4, &this->unk_2D4); @@ -571,14 +572,14 @@ void func_80AED610(EnTk* this, PlayState* play) { break; } - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x13FD: @@ -691,7 +692,7 @@ void func_80AED940(EnTk* this, PlayState* play) { this->unk_2CA &= ~0x80; this->actor.flags &= ~ACTOR_FLAG_10000; play->msgCtx.msgMode = 0; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; func_80AEDE10(this, play); } else if (!(this->unk_2CA & 0x80)) { if (this->actor.xzDistToPlayer < 100.0f) { @@ -794,7 +795,7 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 0: + case TEXT_STATE_NONE: switch (this->unk_2E6) { case 0x1404: case 0x1405: @@ -820,14 +821,14 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { } break; - case 1: - case 2: - case 3: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: break; - case 4: - case 5: - case 6: + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1404: @@ -1189,7 +1190,7 @@ void func_80AEED38(EnTk* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; } - if (Message_GetState(&play->msgCtx) == 0 && !Play_InCsMode(play) && (this->unk_2C6-- <= 0)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && !Play_InCsMode(play) && (this->unk_2C6-- <= 0)) { Message_StartTextbox(play, 0x140C, NULL); this->unk_2CA |= 0x4000; this->unk_2C6 = 200; 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 9f263a1c3..753b5a664 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -408,21 +408,21 @@ s32 func_80BA407C(EnToto* this, PlayState* play) { } s32 func_80BA40D4(EnToto* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { return 1; } return 0; } s32 func_80BA4128(EnToto* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 2) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { return 1; } return 0; } s32 func_80BA415C(EnToto* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 4 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { func_8019F230(); } else { diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index e6a2da91b..01cf781b6 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -205,7 +205,7 @@ void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { } Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; @@ -312,7 +312,7 @@ void EnTrt_Hello(EnTrt* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - if (talkState == 5 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play_sound(NA_SE_SY_MESSAGE_PASS); if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { EnTrt_StartShopping(play, this); @@ -330,7 +330,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { player->stateFlags2 &= ~0x20000000; } - } else if (talkState == 5 && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->textId) { case 0x883: this->textId = 0x884; @@ -348,7 +348,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_PayForMushroom; break; default: @@ -370,7 +370,7 @@ void EnTrt_PayForMushroom(EnTrt* this, PlayState* play) { } void EnTrt_Goodbye(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->textId) { case 0x886: this->textId = 0x887; @@ -385,7 +385,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) { } void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x88F) { if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { @@ -393,7 +393,7 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) { this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->prevTextId = this->textId; @@ -442,7 +442,7 @@ void EnTrt_GiveRedPotionForKoume(EnTrt* this, PlayState* play) { } else if (gSaveContext.save.weekEventReg[12] & 0x10) { Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); } } @@ -450,7 +450,7 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { //! @bug: player is set to NULL not PLAYER Player* player = NULL; - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); @@ -474,11 +474,11 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { void EnTrt_EndConversation(EnTrt* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { EnTrt_EndInteraction(play, this); } - } else if (talkState == 6) { + } else if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play)) { EnTrt_EndInteraction(play, this); } @@ -518,7 +518,7 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { this->cutscene = this->lookForwardCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; - } else if (talkState == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) { if ((!Message_ShouldAdvance(play) || !EnTrt_FacingShopkeeperDialogResult(this, play)) && @@ -620,7 +620,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) { this->drawCursor = 0xFF; this->stickLeftPrompt.isEnabled = true; EnTrt_UpdateCursorPos(play, this); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) { EnTrt_CursorLeftRight(play, this); @@ -638,7 +638,7 @@ void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; Interface_ChangeHudMode(HUD_MODE_ALL); this->drawCursor = 0; @@ -705,7 +705,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (EnTrt_TakeItemOffShelf(this)) { - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (!EnTrt_TestCancelOption(this, play, CONTROLLER1(&play->state)) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { @@ -719,7 +719,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { break; } } - } else if (talkState == 5 && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (!Inventory_HasEmptyBottle()) { play_sound(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x846); @@ -930,7 +930,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); this->blinkFunc = EnTrt_Blink; - if (talkState == 6 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -948,7 +948,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { } void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x83C) { if (Inventory_HasEmptyBottle()) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { @@ -956,7 +956,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->actionFunc = EnTrt_GiveRedPotionForKoume; } else { this->prevTextId = this->textId; @@ -1015,7 +1015,7 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { } void EnTrt_SetupEndInteraction(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { EnTrt_EndInteraction(play, this); } } @@ -1032,20 +1032,20 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { func_800B8614(&this->actor, play, 200.0f); } } - if (talkState == 6 && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (gSaveContext.save.weekEventReg[20] & 2) { play->nextEntranceIndex = 0xC50; } else { play->nextEntranceIndex = 0x8450; } - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 0x40; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_64; + play->transitionTrigger = TRANS_TRIGGER_START; } } void EnTrt_CannotBuy(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->actionFunc = this->prevActionFunc; func_80151938(play, EnTrt_GetItemTextId(this)); } @@ -1054,7 +1054,7 @@ void EnTrt_CannotBuy(EnTrt* this, PlayState* play) { void EnTrt_CanBuy(EnTrt* this, PlayState* play) { EnGirlA* item; - if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->shopItemSelectedTween = 0.0f; EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; @@ -1074,7 +1074,7 @@ void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play) { } void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = EnTrt_ItemGiven; if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { @@ -1092,7 +1092,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { Player* player = GET_PLAYER(play); EnGirlA* item; - if (talkState == 4) { + if (talkState == TEXT_STATE_CHOICE) { Interface_SetDoAction(play, DO_ACTION_DECIDE); if (Message_ShouldAdvance(play)) { EnTrt_ResetItemPosition(this); @@ -1116,7 +1116,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { } } } - } else if (talkState == 5) { + } else if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { EnTrt_ResetItemPosition(this); item = this->items[this->cursorIdx]; @@ -1361,7 +1361,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 itemGiven; - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { if (this->talkOptionTextId == 0x845 || this->talkOptionTextId == 0x882) { func_80151938(play, 0xFF); @@ -1369,7 +1369,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { EnTrt_StartShopping(play, this); } } - } else if (talkState == 16) { + } else if (talkState == TEXT_STATE_16) { itemGiven = func_80123810(play); if (itemGiven > EXCH_ITEM_NONE) { if (itemGiven == EXCH_ITEM_1E) { 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 cadd76abc..0dd9da893 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -326,15 +326,15 @@ void func_80AD3C94(EnTrt2* this, PlayState* play) { } void func_80AD3CEC(EnTrt2* this, PlayState* play) { - u8 sp27 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); func_80AD46F8(this); if (this->unk_3D8) { Message_StartTextbox(play, this->unk_3A8, &this->actor); this->unk_3D8 = false; - } else if ((sp27 == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; func_80AD3380(&this->skelAnime, sAnimations, 6); this->unk_3B2 = 4; } @@ -359,10 +359,10 @@ void func_80AD3DA4(EnTrt2* this, PlayState* play) { } void func_80AD3E34(EnTrt2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle()) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_3B2 = 12; } else { gSaveContext.save.weekEventReg[85] |= 0x10; @@ -374,9 +374,9 @@ void func_80AD3E34(EnTrt2* this, PlayState* play) { } void func_80AD3EF0(EnTrt2* this, PlayState* play) { - u8 temp_v0 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); - if (temp_v0 == 6) { + if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play)) { if ((Inventory_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || !(gSaveContext.save.weekEventReg[12] & 0x10)) { @@ -388,9 +388,9 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { this->unk_3B2 = 10; } } - } else if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { + } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; this->unk_3B2 = 12; } } @@ -406,12 +406,12 @@ void func_80AD3FF4(EnTrt2* this, PlayState* play) { } else if (gSaveContext.save.weekEventReg[12] & 0x10) { Actor_PickUp(&this->actor, play, GI_POTION_RED, 300.0f, 300.0f); } else { - Actor_PickUp(&this->actor, play, GI_BOTTLE_POTION_RED, 300.0f, 300.0f); + Actor_PickUp(&this->actor, play, GI_POTION_RED_BOTTLE, 300.0f, 300.0f); } } void func_80AD40AC(EnTrt2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 6) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { func_800B85E0(&this->actor, play, 400.0f, -1); this->unk_3B2 = 13; } @@ -428,13 +428,13 @@ void func_80AD4110(EnTrt2* this, PlayState* play) { } void func_80AD417C(EnTrt2* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_3A8 == 0x84B) { func_80AD349C(this); func_80AD3DA4(this, play); } else { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; if (this->unk_3A8 == 0x84C) { func_80AD3380(&this->skelAnime, sAnimations, 6); this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); @@ -507,16 +507,16 @@ void func_80AD434C(EnTrt2* this, PlayState* play) { void func_80AD4550(EnTrt2* this, PlayState* play) { Player* player = GET_PLAYER(play); - u8 sp23 = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) { func_80AD3380(&this->skelAnime, sAnimations, 7); this->unk_3B2 = 17; } - if ((sp23 == 5) && Message_ShouldAdvance(play)) { + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; } } 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 83b374e40..943742da3 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -806,31 +806,33 @@ s32 func_80A875AC(Actor* thisx, PlayState* play) { s32 func_80A8777C(Actor* thisx, PlayState* play) { EnTru* this = THIS; s32 ret = 0; - s32 temp_v0 = Message_GetState(&play->msgCtx); + s32 temp_v0; - switch (temp_v0) { - case 4: - case 5: - if (Message_ShouldAdvance(play)) { - case 16: - temp_v0 = func_80123810(play); - if ((temp_v0 == 35) || (temp_v0 == 36)) { - this->unk_34E |= 8; - if (temp_v0 == 35) { - this->unk_390 = 1; - } else { - this->unk_390 = 2; - } - this->unk_378 = func_80A87880; - this->unk_364 = 0; - ret = 1; - } else if (temp_v0 < 0) { - ret = 3; - } else if (temp_v0 != 0) { - ret = 2; - } - break; + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + if (!Message_ShouldAdvance(play)) { + break; } + // Fallthrough + case TEXT_STATE_16: + temp_v0 = func_80123810(play); + if ((temp_v0 == 35) || (temp_v0 == 36)) { + this->unk_34E |= 8; + if (temp_v0 == 35) { + this->unk_390 = 1; + } else { + this->unk_390 = 2; + } + this->unk_378 = func_80A87880; + this->unk_364 = 0; + ret = 1; + } else if (temp_v0 < 0) { + ret = 3; + } else if (temp_v0 != 0) { + ret = 2; + } + break; } return ret; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 7ac2c4a4e..f2159e4d3 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -371,12 +371,12 @@ void func_80B76A64(EnTruMt* this, PlayState* play) { } void func_80B76BB8(EnTruMt* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { play->nextEntranceIndex = 0xA810; - play->unk_1887F = 3; - gSaveContext.nextTransition = 3; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_03; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; } } } diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 47a166551..ddf924872 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -193,7 +193,7 @@ void func_80AE0010(EnTsn* this, PlayState* play) { break; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x107F: case 0x1081: @@ -299,7 +299,7 @@ void func_80AE0460(EnTsn* this, PlayState* play) { ENTSN_SET_Z(&this->unk_1D8->actor, false); this->actionFunc = func_80AE0418; } else { - Actor_PickUp(&this->actor, play, GI_SEAHORSE, 2000.0f, 1000.0f); + Actor_PickUp(&this->actor, play, GI_SEAHORSE_CAUGHT, 2000.0f, 1000.0f); } } @@ -313,7 +313,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { s32 sp24; Player* player = GET_PLAYER(play); - if (Message_GetState(&play->msgCtx) == 0x10) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { sp24 = func_80123810(play); if (sp24 != 0) { gSaveContext.save.weekEventReg[26] |= 2; @@ -381,10 +381,10 @@ void func_80AE0704(EnTsn* this, PlayState* play) { } switch (Message_GetState(&play->msgCtx)) { - case 2: + case TEXT_STATE_CLOSING: break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x106E: @@ -501,6 +501,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { break; } } + break; } if (this->unk_220 & 2) { @@ -539,7 +540,7 @@ void func_80AE0C88(EnTsn* this, PlayState* play) { } void func_80AE0D10(EnTsn* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->actionFunc = func_80AE0D78; ActorCutscene_Stop(this->actor.cutscene); diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index dbe8ef1fa..3430e15f4 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -243,7 +243,7 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { if (this->grottoExitDelay++ == 10) { play->nextEntranceIndex = play->setupExitList[GET_WARPTAG_EXIT_INDEX(&this->dyna.actor)]; Scene_SetExitFade(play); - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); func_801A4058(5); if (1) {} 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 ba534c7f6..3969f9c6e 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 @@ -125,8 +125,8 @@ u8 func_80966608(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; - if (D_801BDBB0 != weatherMode) { - D_801BDBB0 = weatherMode; + if (gWeatherMode != weatherMode) { + gWeatherMode = weatherMode; play->envCtx.unk_21 = 1; play->envCtx.unk_1F = new1F; play->envCtx.unk_20 = new20; @@ -153,7 +153,7 @@ u8 func_80966758(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; - D_801BDBB0 = 0; + gWeatherMode = 0; play->envCtx.unk_21 = 1; play->envCtx.unk_1F = new1F; play->envCtx.unk_20 = new20; @@ -230,7 +230,7 @@ void EnWeatherTag_Die(EnWeatherTag* this, PlayState* play) { // poisoned swamp: placed behind the water fall from ikana // this tag stops spawning after STT cleared? void func_80966B08(EnWeatherTag* this, PlayState* play) { - if (func_80966608(this, play, 0, 0, play->envCtx.unk_1F, 5, 100, 2) || D_801BDBB0 == 2) { + if (func_80966608(this, play, 0, 0, play->envCtx.unk_1F, 5, 100, 2) || (gWeatherMode == 2)) { play->skyboxId = 3; EnWeatherTag_SetupAction(this, func_80966D20); } else if (D_801F4E74 <= 0.01f) { @@ -298,7 +298,7 @@ void func_80966D20(EnWeatherTag* this, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966B08); } - if (D_801BDBB0 != 2) { + if (gWeatherMode != 2) { EnWeatherTag_SetupAction(this, func_80966B08); } } @@ -452,7 +452,7 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { - D_801BDBB0 = 1; + gWeatherMode = 1; func_800FD78C(play); play->envCtx.unk_F2[4] = 0x20; EnWeatherTag_SetupAction(this, func_80967608); @@ -471,7 +471,7 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { // WEATHERTAG_TYPE_LOCALDAY2RAIN 2 void func_80967608(EnWeatherTag* this, PlayState* play) { if ((WEATHER_TAG_RANGE100(this) + 10.0f) < Actor_XZDistanceBetweenActors(&GET_PLAYER(play)->actor, &this->actor)) { - D_801BDBB0 = 0; + gWeatherMode = 0; EnWeatherTag_SetupAction(this, func_809674C8); } } @@ -481,7 +481,7 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && - (!FrameAdvance_IsEnabled(&play->state)) && (play->transitionTrigger == 0) && + (!FrameAdvance_IsEnabled(&play->state)) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15); diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index 3f1b80c0e..fe18c8e1b 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -10,7 +10,7 @@ typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); typedef struct EnWeatherTag { /* 0x000 */ Actor actor; /* 0x144 */ EnWeatherTagActionFunc actionFunc; - /* 0x148 */ u8 pad148[0x4]; // todo attempt remove + /* 0x148 */ UNK_TYPE1 pad148[0x4]; /* 0x14C */ u8 pathCount; /* 0x150 */ Vec3s* pathPoints; // 154: the code avoids what would be a negative value if signed, but signed wont match diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index d78daa080..bf9fc46b5 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -287,7 +287,7 @@ void EnYb_Talk(EnYb* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; EnYb_UpdateAnimation(this, play); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x147D: // I am counting on you func_801477B4(play); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 72b55a036..68051705e 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -205,11 +205,11 @@ void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { } void EnZo_Walk(EnZo* this, PlayState* play) { - if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) { + if (ENZO_GET_PATH(&this->actor) != 0x3F) { EnZo_SetAnimation(&this->skelAnime, 6); } - if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) { + if (ENZO_GET_PATH(&this->actor) != 0x3F) { this->actionFunc = EnZo_FollowPath; } else { this->actionFunc = EnZo_DoNothing; @@ -263,7 +263,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH); + this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH(&this->actor), 0x3F); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = EnZo_Walk; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index b53ee19f8..bfd0c79dd 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -9,7 +9,6 @@ struct EnZo; typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); #define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) -#define ENZO_NO_PATH 0x3F typedef struct EnZo { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index 851dd6a90..1970e53df 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -316,11 +316,11 @@ void func_80B9FE1C(EnZob* this, PlayState* play) { void func_80B9FE5C(EnZob* this, PlayState* play) { func_80B9F86C(this); if (play->msgCtx.ocarinaMode == 3) { - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->actionFunc = func_80B9FDDC; func_80B9FC70(this, 0); - } else if (Message_GetState(&play->msgCtx) == 11) { - play->msgCtx.unk11F10 = 0; + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_11) { + play->msgCtx.msgLength = 0; this->actionFunc = func_80B9FE1C; this->unk_304 = 3; func_80B9F7E4(this, 5, ANIMMODE_ONCE); @@ -330,7 +330,7 @@ void func_80B9FE5C(EnZob* this, PlayState* play) { void func_80B9FF20(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Message_GetState(&play->msgCtx) == 7) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_7) { func_80152434(play, 0x42); this->actionFunc = func_80B9FE5C; func_80B9FC70(this, 2); @@ -345,8 +345,8 @@ void func_80B9FF80(EnZob* this, PlayState* play) { func_80B9F7E4(this, 1, ANIMMODE_LOOP); func_80152434(play, 0x3E); func_80B9FC70(this, 1); - } else if (Message_GetState(&play->msgCtx) == 11) { - play->msgCtx.unk11F10 = 0; + } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_11) { + play->msgCtx.msgLength = 0; this->actionFunc = func_80B9FE1C; this->unk_304 = 3; func_80B9F7E4(this, 5, ANIMMODE_ONCE); @@ -356,7 +356,7 @@ void func_80B9FF80(EnZob* this, PlayState* play) { void func_80BA005C(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Message_GetState(&play->msgCtx) == 7) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_7) { func_80152434(play, 0x41); this->actionFunc = func_80B9FF80; func_80B9FC70(this, 2); @@ -367,7 +367,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { func_80B9F86C(this); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1212)) { switch (play->msgCtx.choiceIndex) { case 1: @@ -385,7 +385,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1208: @@ -395,7 +395,7 @@ void func_80BA00BC(EnZob* this, PlayState* play) { break; case 0x120C: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->actionFunc = func_80B9FD24; func_80B9F7E4(this, 8, ANIMMODE_LOOP); func_80B9FC70(this, 3); @@ -452,7 +452,7 @@ void func_80BA0374(EnZob* this, PlayState* play) { func_80B9F86C(this); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1205)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -469,7 +469,7 @@ void func_80BA0374(EnZob* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x11F8: @@ -623,24 +623,25 @@ void func_80BA09E0(EnZob* this, PlayState* play) { } void func_80BA0A04(EnZob* this, PlayState* play) { - u8 temp_v0; - func_80B9F86C(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - temp_v0 = Message_GetState(&play->msgCtx); - if (temp_v0 != 2) { - if ((temp_v0 == 5) && Message_ShouldAdvance(play)) { - func_801477B4(play); + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + func_801477B4(play); + this->actionFunc = func_80BA0AD8; + this->unk_304 = 0; + func_80B9F7E4(this, 6, ANIMMODE_ONCE); + } + break; + + case TEXT_STATE_CLOSING: this->actionFunc = func_80BA0AD8; this->unk_304 = 0; func_80B9F7E4(this, 6, ANIMMODE_ONCE); - } - } else { - this->actionFunc = func_80BA0AD8; - this->unk_304 = 0; - func_80B9F7E4(this, 6, ANIMMODE_ONCE); + break; } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 2fa9e8906..0c01c96b3 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -612,7 +612,7 @@ void func_80B943EC(EnZog* this, PlayState* play) { } void func_80B94470(EnZog* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 5) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x103C)) { func_801477B4(play); this->actionFunc = func_80B9451C; @@ -663,12 +663,12 @@ void func_80B946B4(EnZog* this, PlayState* play) { void func_80B946FC(EnZog* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->actionFunc = func_80B946B4; func_80B93BA8(this, 1); break; @@ -681,7 +681,7 @@ void func_80B946FC(EnZog* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1008: @@ -827,7 +827,7 @@ void func_80B94D0C(EnZog* this, PlayState* play) { this->unk_31E = 0; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { this->unk_320 = 5; switch (play->msgCtx.currentTextId) { case 0x1004: diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index c0597617d..f20b953ba 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -326,7 +326,7 @@ void func_80B32084(EnZoraegg* this, PlayState* play) { } void func_80B32094(EnZoraegg* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 2) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actionFunc = func_80B320E0; } func_80B31C40(this, play); diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 7ceea163e..cf1913e1c 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -301,11 +301,11 @@ void func_80BBB574(EnZos* this, PlayState* play) { } } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x124B: if (this->unk_2B8 == 9) { - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->unk_2B6 |= 0x20; } else { func_80151938(play, 0x124C); @@ -313,7 +313,7 @@ void func_80BBB574(EnZos* this, PlayState* play) { break; case 0x124C: - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; this->actionFunc = func_80BBB4CC; func_80BBAE84(this, 10, ANIMMODE_LOOP); break; @@ -339,7 +339,7 @@ void func_80BBB718(EnZos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Message_GetState(&play->msgCtx) == 0x10) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { sp24 = func_80123810(play); if (sp24 > 0) { func_801477B4(play); @@ -386,7 +386,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { } } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1237: player->exchangeItemId = 0; @@ -581,7 +581,7 @@ void func_80BBC070(EnZos* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { func_80BBAE84(this, 2, ANIMMODE_LOOP); func_801477B4(play); @@ -590,7 +590,7 @@ void func_80BBC070(EnZos* this, PlayState* play) { } break; - case 2: + case TEXT_STATE_CLOSING: func_80BBAE84(this, 2, ANIMMODE_LOOP); this->actionFunc = func_80BBC14C; this->unk_2B6 |= 1; diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 5fb0ce7c0..0933d2240 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -378,7 +378,7 @@ void func_80B97110(EnZot* this, PlayState* play) { } void func_80B97194(EnZot* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x125C: case 0x125F: @@ -447,7 +447,7 @@ void func_80B973BC(EnZot* this, PlayState* play) { func_80B96D4C(this); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x126E: case 0x1270: @@ -521,7 +521,7 @@ void func_80B975F8(EnZot* this, PlayState* play) { void func_80B9765C(EnZot* this, PlayState* play) { func_80B96D4C(this); - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { s32 requiredScopeTemp; switch (play->msgCtx.currentTextId) { @@ -658,7 +658,7 @@ void func_80B979DC(EnZot* this, PlayState* play) { } void func_80B97A44(EnZot* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1279: case 0x127C: @@ -718,7 +718,7 @@ void func_80B97BF8(EnZot* this, PlayState* play) { void func_80B97C40(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); this->actionFunc = func_80B97CC8; } @@ -766,7 +766,7 @@ void func_80B97E4C(EnZot* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x128C: this->unk_2F2 &= ~4; @@ -951,7 +951,7 @@ void func_80B985EC(EnZot* this, PlayState* play) { Player* player = GET_PLAYER(play); func_80B98348(this, play); - if (Message_GetState(&play->msgCtx) == 0x10) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { func_801477B4(play); @@ -977,7 +977,7 @@ void func_80B98728(EnZot* this, PlayState* play) { func_80B98348(this, play); switch (Message_GetState(&play->msgCtx)) { - case 4: + case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1293)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -993,7 +993,7 @@ void func_80B98728(EnZot* this, PlayState* play) { } break; - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1291: @@ -1090,7 +1090,7 @@ void func_80B98A4C(EnZot* this, PlayState* play) { } void func_80B98AD0(EnZot* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x12B1: case 0x12B4: @@ -1212,7 +1212,7 @@ void func_80B98F94(EnZot* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; } - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x12BB: this->unk_2F2 &= ~4; @@ -1273,7 +1273,7 @@ void func_80B991E4(EnZot* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x800, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { u16 temp = play->msgCtx.currentTextId; u32 temp2; diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 6b237540c..e026843e2 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -260,7 +260,7 @@ void func_80BD187C(EnZov* this, PlayState* play) { func_80BD1764(this); switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1022: @@ -293,7 +293,7 @@ void func_80BD187C(EnZov* this, PlayState* play) { } break; - case 2: + case TEXT_STATE_CLOSING: func_801477B4(play); this->actionFunc = func_80BD1C84; this->unk_320 &= ~1; @@ -411,7 +411,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x1033: case 0x1034: @@ -424,11 +424,11 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { case 0x1039: play->nextEntranceIndex = play->setupExitList[ENZOV_GET_FE00(&this->actor)]; - play->unk_1887F = 5; - play->transitionTrigger = 0x14; + play->transitionType = TRANS_TYPE_05; + play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[78] |= 1; this->actionFunc = func_80BD1D94; - play->msgCtx.unk11F10 = 0; + play->msgCtx.msgLength = 0; Audio_QueueSeqCmd(0x101400FF); break; diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index 65965ad71..4779fdedd 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -459,7 +459,7 @@ void func_80BDD570(EnZow* this, PlayState* play) { func_80BDD490(this, play); switch (Message_GetState(&play->msgCtx)) { - case 5: + case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x12E8: @@ -487,7 +487,7 @@ void func_80BDD570(EnZow* this, PlayState* play) { } break; - case 2: + case TEXT_STATE_CLOSING: this->actionFunc = func_80BDD634; break; } diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index 8842d3e31..ac8592615 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -101,13 +101,13 @@ void ItemBHeart_Draw(Actor* thisx, PlayState* play) { if (flag || thisx->world.rot.y != 0) { func_8012C2DC(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001290); - gSPDisplayList(POLY_XLU_DISP++, object_gi_hearts_DL_001470); + gSPDisplayList(POLY_XLU_DISP++, gGiHeartBorderDL); + gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); } else { func_8012C28C(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_gi_hearts_DL_001290); - gSPDisplayList(POLY_OPA_DISP++, object_gi_hearts_DL_001470); + gSPDisplayList(POLY_OPA_DISP++, gGiHeartBorderDL); + gSPDisplayList(POLY_OPA_DISP++, gGiHeartContainerDL); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 87a385dd5..d2fa8e3a0 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -37,14 +37,14 @@ static s16 sObjectIds[] = { OBJECT_GI_BOTTLE, OBJECT_GI_KEY, OBJECT_GI_M_ARROW, OBJECT_GI_RUPY, OBJECT_GI_RUPY, OBJECT_GI_RUPY, OBJECT_GI_RUPY, OBJECT_GI_HEARTS, OBJECT_GI_KEY, }; -static s16 sDrawItemIndices[] = { - GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_01, - GID_47, GID_4F, GID_50, GID_51, GID_53, GID_13, GID_01, +static s16 sGetItemDrawIds[] = { + GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_BOTTLE, GID_KEY_SMALL, + GID_ARROW_FIRE, GID_RUPEE_GREEN, GID_RUPEE_BLUE, GID_RUPEE_RED, GID_RUPEE_PURPLE, GID_HEART_PIECE, GID_KEY_SMALL, }; static s16 sGetItemIds[] = { - GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_KEY_SMALL, - GI_25, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, + GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_BOTTLE, GI_KEY_SMALL, + GI_ARROW_FIRE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, }; void ItemEtcetera_SetupAction(ItemEtcetera* this, ItemEtceteraActionFunc actionFunc) { @@ -62,8 +62,8 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { } else { this->objIndex = objBankIndex; } - this->giDrawId = sDrawItemIndices[type]; - this->itemID = sGetItemIds[type]; + this->getItemDrawId = sGetItemDrawIds[type]; + this->getItemId = sGetItemIds[type]; this->futureActionFunc = func_8092009C; this->drawFunc = ItemEtcetera_Draw; Actor_SetScale(&this->actor, 0.25f); @@ -104,7 +104,7 @@ void func_8092009C(ItemEtcetera* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { Actor_MarkForDeath(&this->actor); } else { - Actor_PickUp(&this->actor, play, this->itemID, 30.0f, 50.0f); + Actor_PickUp(&this->actor, play, this->getItemId, 30.0f, 50.0f); } } @@ -126,7 +126,7 @@ void ItemEtcetera_DrawThroughLens(Actor* thisx, PlayState* play) { if (play->actorCtx.unk4 == 100) { func_800B8050(&this->actor, play, 0); func_800B8118(&this->actor, play, 0); - GetItem_Draw(play, this->giDrawId); + GetItem_Draw(play, this->getItemDrawId); } } @@ -135,5 +135,5 @@ void ItemEtcetera_Draw(Actor* thisx, PlayState* play) { func_800B8050(&this->actor, play, 0); func_800B8118(&this->actor, play, 0); - GetItem_Draw(play, this->giDrawId); + GetItem_Draw(play, this->getItemDrawId); } diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index aac8d0834..e33f1e1fb 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -30,8 +30,8 @@ typedef enum { typedef struct ItemEtcetera { /* 0x000 */ Actor actor; /* 0x144 */ ItemEtceteraActionFunc futureActionFunc; - /* 0x148 */ s16 giDrawId; - /* 0x14A */ s16 itemID; + /* 0x148 */ s16 getItemDrawId; + /* 0x14A */ s16 getItemId; /* 0x14C */ u8 objIndex; /* 0x150 */ ActorFunc drawFunc; /* 0x154 */ ItemEtceteraActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c index 2f82ac903..769266e97 100644 --- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c +++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c @@ -65,7 +65,7 @@ void ObjChikuwa_Init(Actor* thisx, PlayState* play) { this->dyna.actor.scale.z = 0.05f; DynaPolyActor_Init(&this->dyna, 0); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_d_lift_Colheader_000F00); + DynaPolyActor_LoadMesh(play, &this->dyna, &gDampeGraveBrownElevatorCol); this->dyna.actor.home.rot.y += 0x2000; this->dyna.actor.home.rot.y &= 0xC000; @@ -210,7 +210,7 @@ void ObjChikuwa_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10); + gSPDisplayList(POLY_OPA_DISP++, gDampeGraveBrownElevatorDL); } } } @@ -224,7 +224,7 @@ void ObjChikuwa_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10); + gSPDisplayList(POLY_OPA_DISP++, gDampeGraveBrownElevatorDL); } } } diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index 87433b988..73c5e32c6 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -146,7 +146,7 @@ void func_80A1B3D0(void) { sp74[7] = (spAC - temp_f20) * temp_f22 * temp_f24 * temp_f0 * 0.0013f; for (i = 0; i < ARRAY_COUNT(D_80A1D838); i++) { - ptr = (f32*)&D_80A1D838[i].mf[0]; + ptr = &D_80A1D838[i].xx; tempf1 = sp74[(i + 0) & 7]; tempf2 = sp74[(i + 1) & 7]; diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index ab6d8fd19..10f2679db 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -96,13 +96,13 @@ void func_80B3C39C(ObjGhaka* this, PlayState* play) { void func_80B3C4E0(ObjGhaka* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); - if (talkState == 5) { + if (talkState == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; func_80B3C260(this); } - } else if (talkState == 4) { + } else if (talkState == TEXT_STATE_CHOICE) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: @@ -110,16 +110,19 @@ void func_80B3C4E0(ObjGhaka* this, PlayState* play) { this->dyna.actor.textId = 0xCF5; Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; + case 1: func_8019F208(); this->dyna.actor.textId = 0xCF7; Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); break; + case 2: func_8019F230(); play->msgCtx.msgMode = 0x43; - play->msgCtx.unk12023 = 4; + play->msgCtx.stateTimer = 4; func_80B3C260(this); + break; } } } diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c index 53dad10d9..5fec022ad 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -4,6 +4,7 @@ * Description: "Master" instance of grass for unit spawned by Obj_Grass_Unit */ +#include "prevent_bss_reordering.h" #include "z_obj_grass.h" #include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h" #include "objects/gameplay_keep/gameplay_keep.h" diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index d67da8560..3339d1440 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -5,6 +5,7 @@ */ #include "z_obj_hsblock.h" +#include "objects/object_d_hsblock/object_d_hsblock.h" #define FLAGS 0x00000000 @@ -17,9 +18,11 @@ void ObjHsblock_Draw(Actor* thisx, PlayState* play); void func_8093E0A0(ObjHsblock* this, PlayState* play); -void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc); +void func_8093E03C(ObjHsblock* this); +void func_8093E05C(ObjHsblock* this); +void func_8093E0E8(ObjHsblock* this); +void func_8093E10C(ObjHsblock* this, PlayState* play); -#if 0 const ActorInit Obj_Hsblock_InitVars = { ACTOR_OBJ_HSBLOCK, ACTORCAT_BG, @@ -32,36 +35,120 @@ const ActorInit Obj_Hsblock_InitVars = { (ActorFunc)ObjHsblock_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8093E33C[] = { +static f32 sFocusHeights[] = { 85.0f, 85.0f, 0.0f }; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -#endif +static CollisionHeader* sColHeaders[] = { + &gHookshotPostCol, + &gHookshotPostCol, + &gHookshotTargetCol, +}; -extern InitChainEntry D_8093E33C[]; +static Gfx* sDisplayLists[] = { gHookshotPostDL, gHookshotPostDL, gHookshotTargetDL }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/ObjHsblock_SetupAction.s") +void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093DEAC.s") +void func_8093DEAC(ObjHsblock* this, PlayState* play) { + if (OBJHSBLOCK_GET_5(&this->dyna.actor) != 0) { + Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ICE_POLY, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, + this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 0xFF64); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/ObjHsblock_Init.s") +void ObjHsblock_Init(Actor* thisx, PlayState* play) { + ObjHsblock* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/ObjHsblock_Destroy.s") + DynaPolyActor_Init(&this->dyna, 0); + DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[OBJHSBLOCK_GET_3(thisx)]); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + func_8093DEAC(this, play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093E03C.s") + switch (OBJHSBLOCK_GET_3(&this->dyna.actor)) { + case 0: + case 2: + func_8093E03C(this); + break; + case 1: + if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH(thisx))) { + func_8093E03C(this); + } else { + func_8093E05C(this); + } + break; + default: + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093E05C.s") +void ObjHsblock_Destroy(Actor* thisx, PlayState* play) { + ObjHsblock* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093E0A0.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093E0E8.s") +void func_8093E03C(ObjHsblock* this) { + ObjHsblock_SetupAction(this, NULL); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/func_8093E10C.s") +void func_8093E05C(ObjHsblock* this) { + this->dyna.actor.flags |= ACTOR_FLAG_10; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 105.0f; + ObjHsblock_SetupAction(this, func_8093E0A0); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/ObjHsblock_Update.s") +void func_8093E0A0(ObjHsblock* this, PlayState* play) { + if (Flags_GetSwitch(play, OBJHSBLOCK_GET_SWITCH(&this->dyna.actor))) { + func_8093E0E8(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hsblock/ObjHsblock_Draw.s") +void func_8093E0E8(ObjHsblock* this) { + ObjHsblock_SetupAction(this, func_8093E10C); +} + +void func_8093E10C(ObjHsblock* this, PlayState* play) { + Math_SmoothStepToF(&this->dyna.actor.velocity.y, 16.0f, 0.1f, 0.8f, 0.0f); + if (fabsf(Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.3f, + this->dyna.actor.velocity.y, 0.3f)) < 0.001f) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + func_8093E03C(this); + this->dyna.actor.flags &= ~ACTOR_FLAG_10; + } +} + +void ObjHsblock_Update(Actor* thisx, PlayState* play) { + ObjHsblock* this = THIS; + + if (this->actionFunc != NULL) { + this->actionFunc(this, play); + } + Actor_SetFocus(&this->dyna.actor, sFocusHeights[OBJHSBLOCK_GET_3(thisx)]); +} + +void ObjHsblock_Draw(Actor* thisx, PlayState* play) { + static Color_RGB8 sEnvColors[] = { + { 60, 60, 120 }, + { 120, 100, 70 }, + { 100, 150, 120 }, + { 255, 255, 255 }, + }; + Color_RGB8* envColor = &sEnvColors[OBJHSBLOCK_GET_6(thisx)]; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, 255); + gSPDisplayList(POLY_OPA_DISP++, sDisplayLists[OBJHSBLOCK_GET_3(thisx)]); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h index 375a18625..0411cc9e4 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -3,13 +3,17 @@ #include "global.h" +#define OBJHSBLOCK_GET_SWITCH(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJHSBLOCK_GET_3(thisx) ((thisx)->params & 3) +#define OBJHSBLOCK_GET_5(thisx) (((thisx)->params >> 5) & 1) +#define OBJHSBLOCK_GET_6(thisx) (((thisx)->params >> 6) & 3) + struct ObjHsblock; typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, PlayState*); typedef struct ObjHsblock { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjHsblockActionFunc actionFunc; } ObjHsblock; // size = 0x160 diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index ef3a5b79e..a013560a4 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -4,7 +4,6 @@ * Description: Switch-Activated Geyser */ -#include "prevent_bss_reordering.h" #include "z_obj_hunsui.h" #include "objects/object_hunsui/object_hunsui.h" diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 40fd2682b..fcbdfbad4 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -134,7 +134,7 @@ void ObjKibako2_SpawnSkulltula(ObjKibako2* this, PlayState* play) { } void ObjKibako2_SpawnContents(ObjKibako2* this, PlayState* play) { - if (KIBAKO2_CONTENTS(&this->dyna.actor) == CONTENTS_COLLECTIBLE) { + if (KIBAKO2_CONTENTS(&this->dyna.actor) == OBJKIBAKO2_CONTENTS_COLLECTIBLE) { ObjKibako2_SpawnCollectible(this, play); } else { ObjKibako2_SpawnSkulltula(this, play); @@ -157,14 +157,14 @@ void ObjKibako2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.rot.x = 0; this->dyna.actor.shape.rot.x = 0; - if (contents == CONTENTS_COLLECTIBLE) { + if (contents == OBJKIBAKO2_CONTENTS_COLLECTIBLE) { if (Item_CanDropBigFairy(play, KIBAKO2_COLLECTIBLE_ID(&this->dyna.actor), KIBAKO2_COLLECTIBLE_FLAG(&this->dyna.actor))) { this->unk_1AC = 1; this->dyna.actor.flags |= ACTOR_FLAG_10; } } - if ((contents != CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, play)) { + if ((contents != OBJKIBAKO2_CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, play)) { this->skulltulaNoiseTimer = -1; } this->actionFunc = ObjKibako2_Idle; diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h index 5f319558e..f1816ab4d 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -9,8 +9,8 @@ #define KIBAKO2_CONTENTS(thisx) (((thisx)->params >> 0xF) & 1) typedef enum { - /* 0 */ CONTENTS_COLLECTIBLE, - /* 1 */ CONTENTS_SKULLTULA + /* 0 */ OBJKIBAKO2_CONTENTS_COLLECTIBLE, + /* 1 */ OBJKIBAKO2_CONTENTS_SKULLTULA } ObjKibako2Contents; struct ObjKibako2; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 28a45984e..f7056b147 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -5,6 +5,7 @@ */ #include "z_obj_lift.h" +#include "objects/object_d_lift/object_d_lift.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,16 @@ void ObjLift_Destroy(Actor* thisx, PlayState* play); void ObjLift_Update(Actor* thisx, PlayState* play); void ObjLift_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_8093D760(ObjLift* this); +void func_8093D7A0(ObjLift* this, PlayState* play); +void func_8093D9C0(ObjLift* this); +void func_8093D8B4(ObjLift* this, PlayState* play); +void func_8093D88C(ObjLift* this); +void func_8093DA48(ObjLift* this, PlayState* play); +void func_8093DB70(ObjLift* this); +void func_8093DB90(ObjLift* this, PlayState* play); +void func_8093DC90(Actor* thisx, PlayState* play); + const ActorInit Obj_Lift_InitVars = { ACTOR_OBJ_LIFT, ACTORCAT_BG, @@ -28,46 +38,207 @@ const ActorInit Obj_Lift_InitVars = { (ActorFunc)ObjLift_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8093DD84[] = { - ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(terminalVelocity, -15000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 350, ICHAIN_CONTINUE), +static s16 D_8093DD50[] = { 0, 10, 20, 30, 40, 50, 60 }; + +Vec2s D_8093DD60[] = { + { 120, -120 }, { 120, 0 }, { 120, 120 }, { 0, -120 }, { 0, 0 }, + { 0, 120 }, { -120, -120 }, { -120, 0 }, { -120, 120 }, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(terminalVelocity, -15000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 350, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 350, ICHAIN_STOP), }; -#endif +static f32 D_8093DD98[] = { 0.1f, 0.05f }; -extern InitChainEntry D_8093DD84[]; +static f32 yOffsets[] = { -18.0f, -9.0f }; -extern UNK_TYPE D_06000D10; -extern UNK_TYPE D_06000F00; +void func_8093D3C0(ObjLift* this, PlayState* play) { + Vec3f pos; + Vec3f vel; + Vec3f* actorPos = &this->dyna.actor.world.pos; + s32 i; + s32 rand; + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D3C0.s") + for (i = 0; i < ARRAY_COUNT(D_8093DD60); i++) { + pos.x = (D_8093DD60[i].x * this->dyna.actor.scale.x) + actorPos->x; + pos.y = actorPos->y; + pos.z = (D_8093DD60[i].z * this->dyna.actor.scale.z) + actorPos->z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Init.s") + vel.x = D_8093DD60[i].x * this->dyna.actor.scale.x * 0.8f; + vel.y = (Rand_ZeroOne() * 10.0f) + 6.0f; + vel.z = D_8093DD60[i].z * this->dyna.actor.scale.z * 0.8f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Destroy.s") + if ((s32)Rand_Next() > 0) { + rand = 0x40; + } else { + rand = 0x20; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D760.s") + EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0x100, rand, 15, 15, 0, + ((Rand_ZeroOne() * 50.0f) + 50.0f) * this->dyna.actor.scale.x, 0, 32, 50, -1, + OBJECT_D_LIFT, gDampeGraveBrownElevatorDL); + } + if (OBJLIFT_GET_1(&this->dyna.actor) == 0) { + func_800BBFB0(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1); + } else if (OBJLIFT_GET_1(&this->dyna.actor) == 1) { + func_800BBFB0(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D7A0.s") +void ObjLift_Init(Actor* thisx, PlayState* play) { + f32 temp_fv0; + ObjLift* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D88C.s") + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + this->dyna.actor.scale.x = this->dyna.actor.scale.z = D_8093DD98[OBJLIFT_GET_1(&this->dyna.actor)]; + this->dyna.actor.scale.y = 5.0f / 90.0f; + this->dyna.actor.shape.rot.z = 0; + this->unk_178 = this->dyna.actor.home.rot.z; + this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; + DynaPolyActor_Init(&this->dyna, 1); + if ((this->unk_178 <= 0) && (Flags_GetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)))) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + DynaPolyActor_LoadMesh(play, &this->dyna, &gDampeGraveBrownElevatorCol); + this->unk_160 = Rand_Next() >> 0x10; + this->unk_162 = Rand_Next() >> 0x10; + this->unk_164 = Rand_Next() >> 0x10; + func_8093D760(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D8B4.s") +void ObjLift_Destroy(Actor* thisx, PlayState* play) { + ObjLift* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D9C0.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DA48.s") +void func_8093D760(ObjLift* this) { + this->timer = D_8093DD50[OBJLIFT_GET_7(&this->dyna.actor)]; + this->actionFunc = func_8093D7A0; + this->dyna.actor.draw = ObjLift_Draw; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DB70.s") +void func_8093D7A0(ObjLift* this, PlayState* play) { + s32 pad; + s16 quake; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DB90.s") + if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (this->timer <= 0) { + if (OBJLIFT_GET_7(&this->dyna.actor) == 7) { + func_8093D9C0(this); + } else { + quake = Quake_Add(GET_ACTIVE_CAM(play), 1); + Quake_SetSpeed(quake, 10000); + Quake_SetQuakeValues(quake, 2, 0, 0, 0); + Quake_SetCountdown(quake, 20); + func_8093D88C(this); + } + } + } else { + this->timer = D_8093DD50[OBJLIFT_GET_7(&this->dyna.actor)]; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Update.s") +void func_8093D88C(ObjLift* this) { + this->timer = 20; + this->actionFunc = func_8093D8B4; + this->dyna.actor.draw = func_8093DC90; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Draw.s") +void func_8093D8B4(ObjLift* this, PlayState* play) { + if (this->timer <= 0) { + func_8093D9C0(this); + } else { + this->unk_160 += 0x2710; + this->unk_174 = Math_SinS(this->unk_160) * 300.0f; + this->unk_176 = Math_CosS(this->unk_160) * 300.0f; + this->unk_162 += 0x4650; + this->unk_168.y = Math_SinS(this->unk_162); + this->unk_164 += 0x4650; + this->unk_168.x = Math_SinS(this->unk_164) * 3.0f; + this->unk_168.z = Math_CosS(this->unk_164) * 3.0f; + } + if ((this->timer & 3) == 3) { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DC90.s") +void func_8093D9C0(ObjLift* this) { + this->actionFunc = func_8093DA48; + Math_Vec3f_Copy(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); + this->dyna.actor.shape.rot = this->dyna.actor.world.rot = this->dyna.actor.home.rot; + this->dyna.actor.draw = ObjLift_Draw; +} + +void func_8093DA48(ObjLift* this, PlayState* play) { + s32 pad; + s32 sp38; + Vec3f pos; + + Actor_MoveWithGravity(&this->dyna.actor); + Math_Vec3f_Copy(&pos, &this->dyna.actor.prevPos); + pos.y += yOffsets[OBJLIFT_GET_1(&this->dyna.actor)]; + this->dyna.actor.floorHeight = + BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &sp38, &this->dyna.actor, &pos); + if ((yOffsets[OBJLIFT_GET_1(&this->dyna.actor)] - 0.001f) <= + (this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y)) { + func_8093D3C0(this, play); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); + if (this->unk_178 > 0) { + func_8093DB70(this); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + } else { + Flags_SetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)); + Actor_MarkForDeath(&this->dyna.actor); + } + } +} + +void func_8093DB70(ObjLift* this) { + this->timer = this->unk_178; + this->actionFunc = func_8093DB90; + this->dyna.actor.draw = NULL; +} + +void func_8093DB90(ObjLift* this, PlayState* play) { + if (this->timer <= 0) { + Math_Vec3f_Copy(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); + this->dyna.actor.world.rot = this->dyna.actor.shape.rot = this->dyna.actor.home.rot; + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + func_8093D760(this); + } +} + +void ObjLift_Update(Actor* thisx, PlayState* play) { + ObjLift* this = THIS; + + if (this->timer > 0) { + this->timer--; + } + this->actionFunc(this, play); +} + +void ObjLift_Draw(Actor* thisx, PlayState* play) { + ObjLift* this = THIS; + + Gfx_DrawDListOpa(play, gDampeGraveBrownElevatorDL); +} + +void func_8093DC90(Actor* thisx, PlayState* play) { + ObjLift* this = THIS; + Vec3f pos; + Vec3s rot; + + Math_Vec3f_Sum(&this->dyna.actor.world.pos, &this->unk_168, &pos); + rot.x = this->unk_174 + this->dyna.actor.home.rot.x; + rot.y = this->dyna.actor.home.rot.y; + rot.z = this->unk_176 + this->dyna.actor.home.rot.z; + Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); + Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); + Gfx_DrawDListOpa(play, gDampeGraveBrownElevatorDL); +} diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index 291ad3355..ea29a9cb9 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -3,15 +3,25 @@ #include "global.h" +#define OBJLIFT_GET_1(thisx) ((thisx)->params & 1) +#define OBJLIFT_GET_7(thisx) (((thisx)->params >> 8) & 7) +#define OBJLIFT_GET_7F(thisx) (((thisx)->params >> 1) & 0x7F) + struct ObjLift; typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*); typedef struct ObjLift { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjLiftActionFunc actionFunc; - /* 0x160 */ char unk_160[0x1C]; + /* 0x160 */ s16 unk_160; + /* 0x162 */ s16 unk_162; + /* 0x164 */ s16 unk_164; + /* 0x166 */ s16 timer; + /* 0x168 */ Vec3f unk_168; + /* 0x174 */ s16 unk_174; + /* 0x176 */ s16 unk_176; + /* 0x178 */ s16 unk_178; } ObjLift; // size = 0x17C extern const ActorInit Obj_Lift_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 5fb278c56..31ba1fa63 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -127,7 +127,7 @@ void func_80C0685C(ObjMoonStone* this) { } void func_80C06870(ObjMoonStone* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == 6 && Message_ShouldAdvance(play)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { gSaveContext.save.weekEventReg[74] |= 0x40; Actor_MarkForDeath(&this->actor); } @@ -148,11 +148,11 @@ void ObjMoonStone_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_gi_reserve00_Matanimheader_001C60)); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gGiMoonsTearTexAnim)); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_gi_reserve00_DL_000D78); + gSPDisplayList(POLY_OPA_DISP++, gGiMoonsTearItemDL); Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, object_gi_reserve00_DL_000C80); + gSPDisplayList(POLY_XLU_DISP++, gGiMoonsTearGlowDL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index 977cd1f50..3b1b72f2f 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -99,16 +99,18 @@ void func_80C06CC4(ObjMuPict* this) { void func_80C06CD8(ObjMuPict* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - case 0: - case 1: - case 2: - case 3: - case 4: + case TEXT_STATE_NONE: + case TEXT_STATE_1: + case TEXT_STATE_CLOSING: + case TEXT_STATE_3: + case TEXT_STATE_CHOICE: break; - case 5: + + case TEXT_STATE_5: func_80C06E88(this, play); break; - case 6: + + case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80C06B5C(this); if (this->actor.cutscene >= 0) { diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index d3b9f891c..a5b640133 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -6,7 +6,6 @@ #include "z_obj_nozoki.h" #include "objects/object_secom_obj/object_secom_obj.h" -#include "prevent_bss_reordering.h" #define FLAGS (ACTOR_FLAG_10) @@ -443,7 +442,7 @@ void func_80BA3344(ObjNozoki* this, PlayState* play) { } } else if ((this->dyna.actor.textId == 0) || Actor_TextboxIsClosing(&this->dyna.actor, play)) { play->nextEntranceIndex = 0xE20; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } } @@ -465,7 +464,7 @@ void ObjNozoki_Draw(Actor* thisx, PlayState* play) { ObjNozoki* this = THIS; if (this->unk_15C == 1) { - GetItem_Draw(play, GID_39); + GetItem_Draw(play, GID_MASK_SUN); } else { Gfx_DrawDListOpa(play, D_80BA34FC[this->unk_15C]); } diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 4a2498043..489373acb 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -5,6 +5,7 @@ */ #include "z_obj_ocarinalift.h" +#include "objects/object_raillift/object_raillift.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,21 @@ void ObjOcarinalift_Destroy(Actor* thisx, PlayState* play); void ObjOcarinalift_Update(Actor* thisx, PlayState* play); void ObjOcarinalift_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80AC9680(ObjOcarinalift* this); +void func_80AC96A4(ObjOcarinalift* this, PlayState* play); +void func_80AC96B4(ObjOcarinalift* this); +void func_80AC96D0(ObjOcarinalift* this, PlayState* play); +void func_80AC99D4(ObjOcarinalift* this, PlayState* play); +void func_80AC99C0(ObjOcarinalift* this); +void func_80AC9A68(ObjOcarinalift* this); +void func_80AC9A7C(ObjOcarinalift* this, PlayState* play); +void func_80AC9AB8(ObjOcarinalift* this); +void func_80AC9AE0(ObjOcarinalift* this, PlayState* play); +void func_80AC9B48(ObjOcarinalift* this); +void func_80AC9B5C(ObjOcarinalift* this, PlayState* play); +void func_80AC9C20(ObjOcarinalift* this); +void func_80AC9C48(ObjOcarinalift* this, PlayState* play); + const ActorInit Obj_Ocarinalift_InitVars = { ACTOR_OBJ_OCARINALIFT, ACTORCAT_BG, @@ -28,56 +43,227 @@ const ActorInit Obj_Ocarinalift_InitVars = { (ActorFunc)ObjOcarinalift_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80AC9D70[] = { - ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), +static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void func_80AC94C0(ObjOcarinalift* this, s32 arg1) { + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->unk170[arg1]); +} -extern InitChainEntry D_80AC9D70[]; +void ObjOcarinalift_Init(Actor* thisx, PlayState* play) { + Path* path; + ObjOcarinalift* this = THIS; -extern UNK_TYPE D_06001E40; -extern UNK_TYPE D_060048D0; + Actor_ProcessInitChain(thisx, sInitChain); + this->dyna.actor.shape.rot.x = 0; + this->dyna.actor.world.rot.x = 0; + this->dyna.actor.shape.rot.z = 0; + this->dyna.actor.world.rot.z = 0; + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_raillift_Colheader_0048D0); + this->unk160 = thisx->home.rot.z * 0.1f; + if (this->unk160 < 0.01f) { + func_80AC9680(this); + } else { + path = &play->setupPathList[OBJOCARINALIFT_GET_7F(&this->dyna.actor)]; + this->unk168 = OBJOCARINALIFT_GET_1F(&this->dyna.actor); + this->unk164 = path->count - 1; + this->unk16C = 1; + this->unk170 = Lib_SegmentedToVirtual(path->points); + func_80AC94C0(this, this->unk168); + if ((OBJOCARINALIFT_GET_C(&this->dyna.actor) != OBJOCARINALIFT_PARAMSC_1) && + (Flags_GetSwitch(play, OBJOCARINALIFT_GET_SWITCH_FLAG(&this->dyna.actor)))) { + func_80AC96B4(this); + } else { + func_80AC9AB8(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC94C0.s") +void ObjOcarinalift_Destroy(Actor* thisx, PlayState* play) { + ObjOcarinalift* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/ObjOcarinalift_Init.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/ObjOcarinalift_Destroy.s") +void func_80AC9680(ObjOcarinalift* this) { + this->dyna.actor.flags &= ~ACTOR_FLAG_10; + this->actionFunc = func_80AC96A4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9680.s") +void func_80AC96A4(ObjOcarinalift* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC96A4.s") +void func_80AC96B4(ObjOcarinalift* this) { + this->actionFunc = func_80AC96D0; + this->dyna.actor.speedXZ = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC96B4.s") +void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { + Actor* thisx = &this->dyna.actor; + Vec3f sp48; + f32 magnitude; + f32 phi_fv0; + f32 phi_fa0; + s32 paramsC; + s32 sp34; + Vec3s* temp_v1_2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC96D0.s") + func_800B9010(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + Math_Vec3s_ToVec3f(&sp48, this->unk170 + this->unk168 + this->unk16C); + Math_Vec3f_Diff(&sp48, &thisx->world.pos, &thisx->velocity); + magnitude = Math3D_Vec3fMagnitude(&thisx->velocity); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC99C0.s") + if ((magnitude < (this->unk160 * 8.0f)) && (this->unk160 > 2.0f)) { + phi_fv0 = ((this->unk160 - 2.0f) * 0.1f) + 2.0f; + phi_fa0 = this->unk160 * 0.03f; + } else { + phi_fv0 = this->unk160; + phi_fa0 = this->unk160 * 0.16f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC99D4.s") + Math_StepToF(&thisx->speedXZ, phi_fv0, phi_fa0); + if ((thisx->speedXZ + 0.05f) < magnitude) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / magnitude); + thisx->world.pos.x += thisx->velocity.x; + thisx->world.pos.y += thisx->velocity.y; + thisx->world.pos.z += thisx->velocity.z; + } else { + paramsC = OBJOCARINALIFT_GET_C(thisx); + sp34 = true; + this->unk168 += this->unk16C; + thisx->speedXZ *= 0.4f; + if (((this->unk168 >= this->unk164) && (this->unk16C > 0)) || ((this->unk168 <= 0) && (this->unk16C < 0))) { + if (paramsC == OBJOCARINALIFT_PARAMSC_0) { + this->unk16C = -this->unk16C; + this->timer = 10; + func_80AC9A68(this); + } else { + temp_v1_2 = this->unk170 + this->unk164; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9A68.s") + if (this->unk16C > 0) { + this->unk168 = 0; + } else { + this->unk168 = this->unk164; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9A7C.s") + if (((this->unk170->x != temp_v1_2->x) || (this->unk170->y != temp_v1_2->y)) || + (this->unk170->z != temp_v1_2->z)) { + func_80AC99C0(this); + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + sp34 = false; + } else if ((paramsC == OBJOCARINALIFT_PARAMSC_1) && (this->unk168 == OBJOCARINALIFT_GET_1F(thisx))) { + func_80AC9AB8(this); + } + } + } else if ((paramsC == OBJOCARINALIFT_PARAMSC_1) && (this->unk168 == OBJOCARINALIFT_GET_1F(thisx))) { + func_80AC9AB8(this); + } + if (sp34) { + func_80AC94C0(this, this->unk168); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9AB8.s") +void func_80AC99C0(ObjOcarinalift* this) { + this->actionFunc = func_80AC99D4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9AE0.s") +void func_80AC99D4(ObjOcarinalift* this, PlayState* play) { + if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + func_80AC94C0(this, this->unk168); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + if ((OBJOCARINALIFT_GET_C(&this->dyna.actor) == OBJOCARINALIFT_PARAMSC_1) && + (this->unk168 == OBJOCARINALIFT_GET_1F(&this->dyna.actor))) { + func_80AC9AB8(this); + } else { + func_80AC96B4(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9B48.s") +void func_80AC9A68(ObjOcarinalift* this) { + this->actionFunc = func_80AC9A7C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9B5C.s") +void func_80AC9A7C(ObjOcarinalift* this, PlayState* play) { + this->timer--; + if (this->timer <= 0) { + func_80AC96B4(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9C20.s") +void func_80AC9AB8(ObjOcarinalift* this) { + this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000); + this->actionFunc = func_80AC9AE0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/func_80AC9C48.s") +void func_80AC9AE0(ObjOcarinalift* this, PlayState* play) { + if (func_800B8718(&this->dyna.actor, &play->state)) { + func_80152434(play, 1); + func_80AC9B48(this); + } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + func_800B8804(&this->dyna.actor, play, 40.0f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/ObjOcarinalift_Update.s") +void func_80AC9B48(ObjOcarinalift* this) { + this->actionFunc = func_80AC9B5C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Ocarinalift/ObjOcarinalift_Draw.s") +void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { + if (func_800B886C(&this->dyna.actor, play)) { + if (play->msgCtx.ocarinaMode == 4) { + if (play->msgCtx.unk1202E == 0) { + if (OBJOCARINALIFT_GET_C(&this->dyna.actor) != OBJOCARINALIFT_PARAMSC_1) { + Flags_SetSwitch(play, OBJOCARINALIFT_GET_SWITCH_FLAG(&this->dyna.actor)); + } + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + func_80AC9C20(this); + } + } else { + if (play->msgCtx.ocarinaMode >= 2) { + play->msgCtx.ocarinaMode = 4; + } + func_80AC9AB8(this); + } + } +} + +void func_80AC9C20(ObjOcarinalift* this) { + this->dyna.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_2000000 | ACTOR_FLAG_8000000); + this->actionFunc = func_80AC9C48; +} + +void func_80AC9C48(ObjOcarinalift* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->cutsceneTimer = 50; + func_80AC96B4(this); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjOcarinalift_Update(Actor* thisx, PlayState* play) { + ObjOcarinalift* this = THIS; + + this->actionFunc(this, play); + Actor_SetFocus(&this->dyna.actor, 10.0f); + if (this->cutsceneTimer > 0) { + this->cutsceneTimer--; + if (this->cutsceneTimer == 0) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + } + } +} + +void ObjOcarinalift_Draw(Actor* thisx, PlayState* play) { + ObjOcarinalift* this = THIS; + + Gfx_DrawDListOpa(play, object_raillift_DL_001E40); + Gfx_DrawDListXlu(play, object_raillift_DL_001DB0); +} diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h index 2565722db..a542fb840 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h @@ -3,17 +3,32 @@ #include "global.h" +#define OBJOCARINALIFT_GET_C(thisx) (((thisx)->params >> 0xC) & 3) +#define OBJOCARINALIFT_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJOCARINALIFT_GET_1F(thisx) (((thisx)->params >> 7) & 0x1F) +#define OBJOCARINALIFT_GET_SWITCH_FLAG(thisx) ((thisx)->home.rot.x & 0x7F) + struct ObjOcarinalift; typedef void (*ObjOcarinaliftActionFunc)(struct ObjOcarinalift*, PlayState*); typedef struct ObjOcarinalift { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjOcarinaliftActionFunc actionFunc; - /* 0x160 */ char unk_160[0x18]; + /* 0x160 */ f32 unk160; + /* 0x164 */ s32 unk164; + /* 0x168 */ s32 unk168; + /* 0x16C */ s32 unk16C; + /* 0x170 */ Vec3s* unk170; + /* 0x174 */ s16 timer; + /* 0x176 */ s16 cutsceneTimer; } ObjOcarinalift; // size = 0x178 +typedef enum ObjOcarinaliftParams { + /* 0x0 */ OBJOCARINALIFT_PARAMSC_0, + /* 0x1 */ OBJOCARINALIFT_PARAMSC_1 +} ObjOcarinaliftParams; + extern const ActorInit Obj_Ocarinalift_InitVars; #endif // Z_OBJ_OCARINALIFT_H diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c index b988df889..6255b2cbe 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c @@ -5,6 +5,8 @@ */ #include "z_obj_purify.h" +#include "objects/object_numa_obj/object_numa_obj.h" +#include "objects/object_dekucity_obj/object_dekucity_obj.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -14,7 +16,31 @@ void ObjPurify_Init(Actor* thisx, PlayState* play); void ObjPurify_Destroy(Actor* thisx, PlayState* play); void ObjPurify_Update(Actor* thisx, PlayState* play); -#if 0 +void func_80A84EC0(ObjPurify* this, PlayState* play); +void func_80A851C8(Actor* thisx, PlayState* play); +void func_80A85074(ObjPurify* this, PlayState* play); +void func_80A850B0(ObjPurify* this); +void func_80A850E8(ObjPurify* this, PlayState* play); +void func_80A85304(Actor* thisx, PlayState* play); +void func_80A84FB4(ObjPurify* this, PlayState* play); +void func_80A85010(ObjPurify* this, PlayState* play); +void ObjPurify_DoNothing(ObjPurify* this, PlayState* play); +void func_80A85048(ObjPurify* this); +void func_80A84FA0(ObjPurify* this); +void func_80A8515C(ObjPurify* this); +void func_80A84FEC(ObjPurify* this); +void func_80A84EAC(ObjPurify* this); + +typedef struct ObjPurifyInfo { + /* 0x00 */ s16 objectId; + /* 0x04 */ f32 scale; + /* 0x08 */ Gfx* opaDLists[2]; + /* 0x10 */ Gfx* xluDLists[2]; + /* 0x18 */ AnimatedMaterial* animMat[2]; + /* 0x20 */ CollisionHeader* colHeader; + /* 0x24 */ s32 isDekuCity; +} ObjPurifyInfo; // size = 0x28 + const ActorInit Obj_Purify_InitVars = { ACTOR_OBJ_PURIFY, ACTORCAT_BG, @@ -27,42 +53,248 @@ const ActorInit Obj_Purify_InitVars = { (ActorFunc)NULL, }; -#endif +ObjPurifyInfo sObjPurifyInfo[] = { + { + OBJECT_NUMA_OBJ, + 0.1f, + { NULL, NULL }, + { object_numa_obj_DL_0128E0, object_numa_obj_DL_012D90 }, + { object_numa_obj_Matanimheader_012CF8, object_numa_obj_Matanimheader_0131A8 }, + &object_numa_obj_Colheader_012818, + false, + }, + { + OBJECT_DEKUCITY_OBJ, + 1.0f, + { NULL, NULL }, + { object_dekucity_obj_DL_0004E0, object_dekucity_obj_DL_001030 }, + { object_dekucity_obj_Matanimheader_000E28, object_dekucity_obj_Matanimheader_001978 }, + &object_dekucity_obj_Colheader_0002AC, + true, + }, + { + OBJECT_DEKUCITY_OBJ, + 1.0f, + { object_dekucity_obj_DL_001ED8, object_dekucity_obj_DL_003998 }, + { object_dekucity_obj_DL_001D80, NULL }, + { object_dekucity_obj_Matanimheader_003820, NULL }, + NULL, + true, + }, + { + OBJECT_NUMA_OBJ, + 0.1f, + { NULL, NULL }, + { object_numa_obj_DL_012A60, object_numa_obj_DL_012F10 }, + { object_numa_obj_Matanimheader_012B58, object_numa_obj_Matanimheader_013008 }, + &object_numa_obj_Colheader_012818, + false, + }, + { + OBJECT_NUMA_OBJ, + 0.1f, + { NULL, NULL }, + { object_numa_obj_DL_012BF0, object_numa_obj_DL_0130A0 }, + { object_numa_obj_Matanimheader_012CE8, object_numa_obj_Matanimheader_013198 }, + &object_numa_obj_Colheader_012818, + false, + }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84CD0.s") +void ObjPurify_SetSysMatrix(f32 yPos) { + Matrix_GetCurrent()->yw = yPos; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84CF8.s") +s32 ObjPurify_IsPurified(ObjPurify* this) { + ObjPurifyInfo* info = &sObjPurifyInfo[OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor)]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/ObjPurify_Init.s") + if (!info->isDekuCity) { + // woodfall temple wood flower unraveled + if (gSaveContext.save.weekEventReg[12] & 1) { + return true; + } + } + // woodfall temple purification cutscene watched + else { + if (gSaveContext.save.weekEventReg[20] & 2) { + return true; + } + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/ObjPurify_Destroy.s") +void ObjPurify_Init(Actor* thisx, PlayState* play) { + s32 pad; + ObjPurify* this = THIS; + ObjPurifyInfo* info = &sObjPurifyInfo[OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor)]; + s32 sp20 = OBJPURIFY_GET_UNK_FLAG(thisx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84EAC.s") + Actor_SetScale(&this->dyna.actor, info->scale); + if (sp20 == 1) { + DynaPolyActor_Init(&this->dyna, 0); + } + this->objIndex = Object_GetIndex(&play->objectCtx, info->objectId); + if (this->objIndex < 0) { + Actor_MarkForDeath(&this->dyna.actor); + } else if (sp20 == 0) { + func_80A84EAC(this); + } else if (ObjPurify_IsPurified(this)) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + func_80A84EAC(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84EC0.s") +void ObjPurify_Destroy(Actor* thisx, PlayState* play) { + ObjPurify* this = THIS; + if (OBJPURIFY_GET_UNK_FLAG(&this->dyna.actor) == 1) { + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84FA0.s") +void func_80A84EAC(ObjPurify* this) { + this->actionFunc = func_80A84EC0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84FB4.s") +void func_80A84EC0(ObjPurify* this, PlayState* play) { + s32 pad; + s32 sp28; + s32 index; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A84FEC.s") + if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { + sp28 = OBJPURIFY_GET_UNK_FLAG(&this->dyna.actor); + index = OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor); + this->dyna.actor.objBankIndex = this->objIndex; + Actor_SetObjectDependency(play, &this->dyna.actor); + if (sp28 == 1) { + DynaPolyActor_LoadMesh(play, &this->dyna, sObjPurifyInfo[index].colHeader); + func_80A84FA0(this); + } else if (ObjPurify_IsPurified(this)) { + func_80A8515C(this); + } else { + func_80A84FEC(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A85010.s") +void func_80A84FA0(ObjPurify* this) { + this->actionFunc = func_80A84FB4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A85048.s") +void func_80A84FB4(ObjPurify* this, PlayState* play) { + if (ObjPurify_IsPurified(this)) { + Actor_MarkForDeath(&this->dyna.actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A85074.s") +void func_80A84FEC(ObjPurify* this) { + this->dyna.actor.draw = func_80A851C8; + this->gfxIndex = 0; + this->actionFunc = func_80A85010; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A850B0.s") +void func_80A85010(ObjPurify* this, PlayState* play) { + if (ObjPurify_IsPurified(this)) { + func_80A85048(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A850E8.s") +void func_80A85048(ObjPurify* this) { + this->dyna.actor.draw = func_80A851C8; + this->gfxIndex = 0; + this->actionFunc = func_80A85074; + this->timer = 30; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A8515C.s") +void func_80A85074(ObjPurify* this, PlayState* play) { + this->timer--; + if (this->timer <= 0) { + func_80A850B0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A85194.s") +void func_80A850B0(ObjPurify* this) { + f32 yPos = this->dyna.actor.home.pos.y; + this->dyna.actor.draw = func_80A85304; + this->unk168[1] = yPos - 90.0f; + this->actionFunc = func_80A850E8; + this->unk168[0] = yPos; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/ObjPurify_Update.s") +void func_80A850E8(ObjPurify* this, PlayState* play) { + Math_StepToF(&this->unk168[0], this->dyna.actor.home.pos.y - 90.0f, 0.9f); + if (Math_StepToF(&this->unk168[1], this->dyna.actor.home.pos.y, 0.9f)) { + func_80A8515C(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A851C8.s") +void func_80A8515C(ObjPurify* this) { + this->dyna.actor.flags &= ~ACTOR_FLAG_10; + this->dyna.actor.draw = func_80A851C8; + this->gfxIndex = 1; + this->actionFunc = ObjPurify_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Purify/func_80A85304.s") +void ObjPurify_DoNothing(ObjPurify* this, PlayState* play) { +} + +void ObjPurify_Update(Actor* thisx, PlayState* play) { + ObjPurify* this = THIS; + + this->actionFunc(this, play); +} + +void func_80A851C8(Actor* thisx, PlayState* play) { + s32 pad; + ObjPurify* this = THIS; + ObjPurifyInfo* info = &sObjPurifyInfo[OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor)]; + Gfx* opaDList = info->opaDLists[this->gfxIndex]; + Gfx* xluDList = info->xluDLists[this->gfxIndex]; + AnimatedMaterial* animMat = info->animMat[this->gfxIndex]; + + OPEN_DISPS(play->state.gfxCtx); + + if (animMat != NULL) { + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(animMat)); + } + if (opaDList != NULL) { + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, opaDList); + } + if (xluDList != NULL) { + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, xluDList); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void func_80A85304(Actor* thisx, PlayState* play) { + s32 pad; + ObjPurify* this = THIS; + ObjPurifyInfo* info = &sObjPurifyInfo[OBJPURIFY_GET_INFO_INDEX(&this->dyna.actor)]; + s32 sp6C[2]; + s32 i; + s32 index; + + if (this->unk168[1] < this->unk168[0]) { + sp6C[0] = 1; + sp6C[1] = 0; + } else { + sp6C[0] = 0; + sp6C[1] = 1; + } + + OPEN_DISPS(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + for (i = 0; i < ARRAY_COUNT(sp6C); i++) { + index = sp6C[i]; + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(info->animMat[index])); + ObjPurify_SetSysMatrix(this->unk168[index]); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, info->xluDLists[index]); + }; + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h index 6d16baa7b..542938c80 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.h @@ -8,12 +8,17 @@ struct ObjPurify; typedef void (*ObjPurifyActionFunc)(struct ObjPurify*, PlayState*); typedef struct ObjPurify { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjPurifyActionFunc actionFunc; - /* 0x160 */ char unk_160[0x10]; + /* 0x160 */ s32 gfxIndex; + /* 0x164 */ s16 timer; + /* 0x166 */ s16 objIndex; + /* 0x168 */ f32 unk168[2]; } ObjPurify; // size = 0x170 extern const ActorInit Obj_Purify_InitVars; +#define OBJPURIFY_GET_INFO_INDEX(thisx) ((thisx)->params & 0xF) +#define OBJPURIFY_GET_UNK_FLAG(thisx) (((thisx)->params >> 0xC) & 1) + #endif // Z_OBJ_PURIFY_H 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 616fb341c..23ca0872d 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -110,30 +110,29 @@ void ObjRaillift_DoNothing(ObjRaillift* this, PlayState* play) { } void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { - s32 isTeleporting; + Actor* thisx = &this->dyna.actor; Vec3f nextPoint; f32 speed; f32 target; f32 step; + s32 isTeleporting; s32 isPosUpdated; - Vec3s* initialPoint; Vec3s* endPoint; - s32 pad; - if (OBJRAILLIFT_HAS_FLAG(&this->dyna.actor)) { - if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { + if (OBJRAILLIFT_HAS_FLAG(thisx)) { + if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; return; } - if (OBJRAILLIFT_GET_TYPE(&this->dyna.actor) == DEKU_FLOWER_PLATFORM) { - func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + if (OBJRAILLIFT_GET_TYPE(thisx) == DEKU_FLOWER_PLATFORM) { + func_800B9010(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); } } - Math_Vec3s_ToVec3f(&nextPoint, &(&this->points[this->curPoint])[this->direction]); - Math_Vec3f_Diff(&nextPoint, &this->dyna.actor.world.pos, &this->dyna.actor.velocity); - speed = Math3D_Vec3fMagnitude(&this->dyna.actor.velocity); + Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction); + Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity); + speed = Math3D_Vec3fMagnitude(&thisx->velocity); if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) { target = ((this->speed - 2.0f) * 0.1f) + 2.0f; step = this->speed * 0.03f; @@ -142,17 +141,16 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { step = this->speed * 0.16f; } - Math_StepToF(&this->dyna.actor.speedXZ, target, step); - if ((this->dyna.actor.speedXZ + 0.05f) < speed) { - Math_Vec3f_Scale(&this->dyna.actor.velocity, this->dyna.actor.speedXZ / speed); - this->dyna.actor.world.pos.x += this->dyna.actor.velocity.x; - this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; - this->dyna.actor.world.pos.z += this->dyna.actor.velocity.z; + Math_StepToF(&thisx->speedXZ, target, step); + if ((thisx->speedXZ + 0.05f) < speed) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / speed); + thisx->world.pos.x += thisx->velocity.x; + thisx->world.pos.y += thisx->velocity.y; + thisx->world.pos.z += thisx->velocity.z; } else { this->curPoint += this->direction; - if (1) {} - this->dyna.actor.speedXZ *= 0.4f; - isTeleporting = OBJRAILLIFT_SHOULD_TELEPORT(&this->dyna.actor); + thisx->speedXZ *= 0.4f; + isTeleporting = OBJRAILLIFT_SHOULD_TELEPORT(thisx); isPosUpdated = true; if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || ((this->curPoint <= 0) && (this->direction < 0))) { @@ -163,9 +161,8 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { } else { endPoint = &this->points[this->endPoint]; this->curPoint = this->direction > 0 ? 0 : this->endPoint; - initialPoint = &this->points[0]; - if ((initialPoint->x != endPoint->x) || (initialPoint->y != endPoint->y) || - (initialPoint->z != endPoint->z)) { + if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || + (this->points[0].z != endPoint->z)) { this->actionFunc = ObjRaillift_Teleport; func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; @@ -222,7 +219,7 @@ void ObjRaillift_Update(Actor* thisx, PlayState* play) { f32 step; this->actionFunc(this, play); - Actor_SetFocus(&this->dyna.actor, 10.0f); + Actor_SetFocus(thisx, 10.0f); if (this->cutsceneTimer > 0) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { diff --git a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c index 2a75d5af1..5246b20d4 100644 --- a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c +++ b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c @@ -43,11 +43,11 @@ static u8 sScheduleScript[] = { void ObjShutter_Update(Actor* thisx, PlayState* play2) { ObjShutter* this = THIS; PlayState* play = play2; - ScheduleResult schedule; + ScheduleOutput scheduleOutput; - Schedule_RunScript(play, sScheduleScript, &schedule); - if (schedule.result == 1) { - if (this->scheduleResult != schedule.result) { + Schedule_RunScript(play, sScheduleScript, &scheduleOutput); + if (scheduleOutput.result == 1) { + if (this->scheduleResult != scheduleOutput.result) { this->actor.velocity.y = 0.0f; } if ((this->verticalOffset >= 80.0f) || (this->scheduleResult == 0)) { @@ -57,7 +57,7 @@ void ObjShutter_Update(Actor* thisx, PlayState* play2) { this->verticalOffset += 10.0f; } } else { - if (this->scheduleResult != schedule.result) { + if (this->scheduleResult != scheduleOutput.result) { this->actor.velocity.y = 0.0f; } if (this->verticalOffset != 0.0f) { @@ -72,7 +72,7 @@ void ObjShutter_Update(Actor* thisx, PlayState* play2) { } } } - this->scheduleResult = schedule.result; + this->scheduleResult = scheduleOutput.result; } void ObjShutter_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index a555729fb..9b78bc273 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -456,13 +456,13 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { gSaveContext.save.cutscene = 0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.respawnFlag = 2; - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; - play->unk_1887F = 2; + play->transitionType = TRANS_TYPE_02; if (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == 0xCFF) { - gSaveContext.nextTransition = 0x15; + gSaveContext.nextTransitionType = TRANS_TYPE_21; } else { - gSaveContext.nextTransition = 2; + gSaveContext.nextTransitionType = TRANS_TYPE_02; } } this->actionFunc = ObjTokeidai_DoNothing; diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 779ea2a5e..32a0a0d54 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -508,7 +508,7 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { s32 absYawDiff = ABS_ALT(yawDiff); if (absYawDiff > (0x10000 / 3)) { - Actor_PickUp(&this->actor, play, 0, 36.0f, 30.0f); + Actor_PickUp(&this->actor, play, GI_NONE, 36.0f, 30.0f); } } } diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 5175a8ee1..658cae652 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1,39 +1,66 @@ /* * File: z_obj_um.c * Overlay: ovl_Obj_Um - * Description: Cremia's cart and milk run quest + * Description: Cremia's Cart and milk run minigame */ #include "z_obj_um.h" +#include "overlays/actors/ovl_En_In/z_en_in.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) #define THIS ((ObjUm*)thisx) +/** + * weekEventReg flags checked by this actor: + * - gSaveContext.save.weekEventReg[22] & 1: Aliens defeated + * If false: The actor doesn't spawn + * - gSaveContext.save.weekEventReg[31] & 0x40 + * If true: Cremia doesn't explain again she'll deliever milk to town + * - gSaveContext.save.weekEventReg[31] & 0x80 + * If true: Triggers cutscene on Romani's Ranch + * - gSaveContext.save.weekEventReg[34] & 0x80 + * If true: Doesn't spawn on Romani's Ranch + * - gSaveContext.save.weekEventReg[52] & 1 + * If true: Doesn't spawn on Romani's Ranch or Milk Road + * - gSaveContext.save.weekEventReg[52] & 2 + * If true: Doesn't spawn on Romani's Ranch or Milk Road + * - gSaveContext.save.weekEventReg[59] & 2 + * If true: Doesn't spawn again on Milk Road + * + * weekEventReg flags set by this actor: + * - gSaveContext.save.weekEventReg[31] |= 0x40: Cremia offered a ride + * Cremia offered a ride accross the Milk Road to Player + * - gSaveContext.save.weekEventReg[31] |= 0x80: Player is in Milk Run + * Player accepts the ride and is with Cremia during the Milk Run. + * - gSaveContext.save.weekEventReg[34] |= 0x80: Cremia does Milk Run alone + * Player didn't interact or didn't accept the ride + * - gSaveContext.save.weekEventReg[52] |= 1: Won Milk Run minigame + * At least one pot is safe. Turns off the "Lose Milk Run minigame" + * - gSaveContext.save.weekEventReg[52] |= 2: Lose Milk Run minigame + * Every pot was broken by bandits. Turns off the "Win Milk Run minigame" + * - gSaveContext.save.weekEventReg[59] |= 2: ? + * Passed through Milk Road after winning the Milk Run + * + * weekEventReg flags unset by this actor: + * - gSaveContext.save.weekEventReg[31] &= (u8)~0x80 + * Turned off when the Milk Run finishes + * - gSaveContext.save.weekEventReg[52] &= (u8)~1 + * Turned off if Player lose the Milk Run + * - gSaveContext.save.weekEventReg[52] &= (u8)~2 + * Turned off if Player wins the Milk Run + */ + void ObjUm_Init(Actor* thisx, PlayState* play); void ObjUm_Destroy(Actor* thisx, PlayState* play); void ObjUm_Update(Actor* thisx, PlayState* play); void ObjUm_Draw(Actor* thisx, PlayState* play); -void func_80B79A50(ObjUm* this, PlayState* play); -void func_80B79F10(ObjUm* this, PlayState* play); -void func_80B7A070(ObjUm* this, PlayState* play); -void func_80B7A0E0(ObjUm* this, PlayState* play); -void func_80B7A144(ObjUm* this, PlayState* play); -void func_80B7A2AC(ObjUm* this, PlayState* play); -void func_80B7A394(ObjUm* this, PlayState* play); -void func_80B7A400(ObjUm* this, PlayState* play); -void func_80B7A494(ObjUm* this, PlayState* play); -void func_80B7A614(ObjUm* this, PlayState* play); -void func_80B7A7AC(ObjUm* this, PlayState* play); -void func_80B7ABE4(ObjUm* this, PlayState* play); -void func_80B7AC94(ObjUm* this, PlayState* play); -void func_80B7AD34(ObjUm* this, PlayState* play); -void func_80B7AE58(ObjUm* this, PlayState* play); - +void ObjUm_DefaultAnim(ObjUm* this, PlayState* play); +void ObjUm_UpdateAnim(ObjUm* this, PlayState* play, ObjUmAnimimations index); void ObjUm_SetupAction(ObjUm* this, ObjUmActionFunc actionFunc); -#if 0 const ActorInit Obj_Um_InitVars = { ACTOR_OBJ_UM, ACTORCAT_NPC, @@ -46,131 +73,1949 @@ const ActorInit Obj_Um_InitVars = { (ActorFunc)ObjUm_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B7C138 = { - { COLTYPE_HIT3, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000020, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static TexturePtr sEyeTextures[] = { + gUmCremiaEyeOpenTex, gUmCremiaEyeHalfTex, gUmCremiaEyeClosedTex, + gUmCremiaEyeHappyTex, gUmCremiaEyeAngryTex, gUmCremiaEyeSadTex, +}; + +static TexturePtr sMouthTextures[] = { + gUmMouthNormalTex, + gUmMouthHappyTex, + gUmMouthHangingOpenTex, + gUmMouthFrownTex, +}; + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT3, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0x00000020, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 40, 64, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B7C254[] = { +// actionfuncs +void func_80B7A144(ObjUm* this, PlayState* play); +void ObjUm_RanchWait(ObjUm* this, PlayState* play); +void ObjUm_PreMilkRunStartCs(ObjUm* this, PlayState* play); +void ObjUm_StartCs(ObjUm* this, PlayState* play); +void ObjUm_PostMilkRunStartCs(ObjUm* this, PlayState* play); +void ObjUm_TerminaFieldIdle(ObjUm* this, PlayState* play); +void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play); +void func_80B7A0E0(ObjUm* this, PlayState* play); +void func_80B7A070(ObjUm* this, PlayState* play); +void ObjUm_RanchStartCs(ObjUm* this, PlayState* play); +void func_80B7A2AC(ObjUm* this, PlayState* play); +void func_80B7A240(ObjUm* this, PlayState* play); +void func_80B7A394(ObjUm* this, PlayState* play); +void ObjUm_RunMinigame(ObjUm* this, PlayState* play); +void func_80B7A614(ObjUm* this, PlayState* play); +void func_80B7AB78(ObjUm* this, PlayState* play); +void func_80B7ABE4(ObjUm* this, PlayState* play); +void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play); + +// Maybe it is updating the bandits positions? +void func_80B77770(ObjUm* this, PlayState* play) { + s16 rotY = this->dyna.actor.shape.rot.y; + Vec3f sp108; + Vec3f spFC; + Vec3f spF0; + Vec3f spE4; + Vec3f spD8; + Vec3f spCC; + Vec3f spC0; + Vec3f spB4; + Vec3f spA8; + Vec3f sp9C; + Vec3f sp90; + Vec3f sp84; + Vec3f sp78; + Vec3f sp6C; + Vec3f sp60 = this->dyna.actor.world.pos; + + // Loop unroll? + this->unk_360[15] = sp60; + sp6C = sp60; + this->unk_360[14] = sp6C; + sp78 = sp6C; + this->unk_360[13] = sp78; + sp84 = sp78; + this->unk_360[12] = sp84; + sp90 = sp84; + this->unk_360[11] = sp90; + sp9C = sp90; + this->unk_360[10] = sp9C; + spA8 = sp9C; + this->unk_360[9] = spA8; + spB4 = spA8; + this->unk_360[8] = spB4; + spC0 = spB4; + this->unk_360[7] = spC0; + spCC = spC0; + this->unk_360[6] = spCC; + spD8 = spCC; + this->unk_360[5] = spD8; + spE4 = spD8; + this->unk_360[4] = spE4; + spF0 = spE4; + this->unk_360[3] = spF0; + spFC = spF0; + this->unk_360[2] = spFC; + sp108 = spFC; + this->unk_360[1] = sp108; + this->unk_360[0] = sp108; + + this->unk_360[0].x += 110.0f * Math_SinS(rotY + 0x4000); + this->unk_360[0].z += 110.0f * Math_CosS(rotY + 0x4000); + this->unk_360[1].x += 110.0f * Math_SinS(rotY - 0x4000); + this->unk_360[1].z += 110.0f * Math_CosS(rotY - 0x4000); + Math_Vec3f_Copy(&this->unk_360[2], &this->unk_360[0]); + this->unk_360[2].x -= 200.0f * Math_SinS(rotY); + this->unk_360[2].z -= 200.0f * Math_CosS(rotY); + Math_Vec3f_Copy(&this->unk_360[4], &this->unk_360[1]); + this->unk_360[4].x -= 200.0f * Math_SinS(rotY); + this->unk_360[4].z -= 200.0f * Math_CosS(rotY); + this->unk_360[3].x -= 220.0f * Math_SinS(rotY); + this->unk_360[3].z -= 220.0f * Math_CosS(rotY); + Math_Vec3f_Copy(&this->unk_360[5], &this->unk_360[0]); + this->unk_360[5].x -= 500.0f * Math_SinS(rotY); + this->unk_360[5].z -= 500.0f * Math_CosS(rotY); + Math_Vec3f_Copy(&this->unk_360[7], &this->unk_360[1]); + this->unk_360[7].x -= 500.0f * Math_SinS(rotY); + this->unk_360[7].z -= 500.0f * Math_CosS(rotY); + this->unk_360[6].x -= 500.0f * Math_SinS(rotY); + this->unk_360[6].z -= 500.0f * Math_CosS(rotY); + Math_Vec3f_Copy(&this->unk_360[8], &this->unk_360[0]); + this->unk_360[8].x -= 700.0f * Math_SinS(rotY); + this->unk_360[8].z -= 700.0f * Math_CosS(rotY); + Math_Vec3f_Copy(&this->unk_360[10], &this->unk_360[1]); + this->unk_360[10].x -= 700.0f * Math_SinS(rotY); + this->unk_360[10].z -= 700.0f * Math_CosS(rotY); + this->unk_360[9].x -= 700.0f * Math_SinS(rotY); + this->unk_360[9].z -= 700.0f * Math_CosS(rotY); + this->unk_360[11] = this->unk_360[3]; + this->unk_360[11].x += 40.0f * Math_SinS(rotY + 0x4000); + this->unk_360[11].z += 40.0f * Math_CosS(rotY + 0x4000); + this->unk_360[12] = this->unk_360[3]; + this->unk_360[12].x += 40.0f * Math_SinS(rotY - 0x4000); + this->unk_360[12].z += 40.0f * Math_CosS(rotY - 0x4000); + this->unk_360[13] = this->unk_360[2]; + this->unk_360[14] = this->unk_360[4]; +} + +s32 ObjUm_InitBandits(ObjUm* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s16 pad; + Vec3s* spawnPoints; + EnHorse* bandit1; + EnHorse* bandit2; + + spawnPoints = Lib_SegmentedToVirtual(path->points); + Audio_QueueSeqCmd(0x8000 | NA_BGM_CHASE); + + bandit1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPoints[0].x, spawnPoints[0].y, + spawnPoints[0].z, 0, this->dyna.actor.shape.rot.y, 0, + ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_19)); + this->bandit1 = bandit1; + + bandit1->unk_540 = bandit1->actor.world.pos; + + bandit1->unk_54C = 0xF; + bandit1->unk_550 = 10; + + bandit1->unk_554 = this->pathIndex; + bandit1->unk_568 = 0.0f; + bandit1->unk_56C = 0.0f; + bandit1->unk_558 = 0; + bandit1->unk_55C = 40; + bandit1->unk_560 = 40; + + bandit1->banditPosition = gZeroVec3f; + bandit1->unk_57C = gZeroVec3f; + + bandit1->unk_588 = this->dyna.actor.shape.rot.y; + bandit1->curRaceWaypoint = 1; + + bandit2 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPoints[1].x, spawnPoints[1].y, + spawnPoints[1].z, 0, this->dyna.actor.shape.rot.y, 0, + ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_20)); + this->bandit2 = bandit2; + + bandit2->unk_540 = bandit2->actor.world.pos; + + bandit2->unk_54C = 0xF; + bandit2->unk_550 = 8; + + bandit2->unk_554 = this->pathIndex; + bandit2->unk_568 = 0.0f; + bandit2->unk_56C = 0.0f; + bandit2->unk_55C = 40; + bandit2->unk_560 = 40; + + bandit2->unk_57C = gZeroVec3f; + + bandit2->unk_588 = this->dyna.actor.shape.rot.y; + bandit2->curRaceWaypoint = 2; + + this->potsLife[0] = 4; + this->potsLife[1] = 4; + this->potsLife[2] = 4; + + return 0; +} + +typedef struct { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ s32 unk_10; +} struct_80B7C254; // size = 0x14 + +struct_80B7C254 D_80B7C164[] = { + { 2, 0, 0, 1.0f, 40 }, { 4, 1, 0, 1.0f, 40 }, { 3, 2, 0, 1.0f, 40 }, { 3, 4, 0, 1.0f, 40 }, + { 5, 3, 1, -1.0f, 30 }, { 7, 3, 1, 1.0f, 30 }, { 0, 13, 1, -1.0f, 60 }, { 1, 14, 1, 1.0f, 60 }, + { 13, 10, 0, 1.0f, 40 }, { 14, 8, 0, 1.0f, 40 }, { 8, 5, 0, 1.0f, 30 }, { 10, 7, 0, 1.0f, 30 }, +}; + +// BanditAttack? +s32 func_80B781DC(ObjUm* this, EnHorse* bandit1, EnHorse* bandit2, PlayState* play) { + s32 temp_v0; + s32 phi_s3 = -1; + s32 phi_s4 = 0; + s32 phi_s2 = 0; + f32 phi_f20 = 0.0f; + s32 i; + s32 mask; + + for (i = 0; i < ARRAY_COUNT(D_80B7C164); i++) { + if (bandit1->unk_550 == D_80B7C164[i].unk_00) { + if (bandit2->unk_550 != D_80B7C164[i].unk_04) { + if (D_80B7C164[i].unk_00 != 3) { + if (D_80B7C164[i].unk_04 != 3 || + ((mask = Player_GetMask(play)), PLAYER_MASK_CIRCUS_LEADER != mask)) { + phi_s3 = D_80B7C164[i].unk_04; + phi_s4 = D_80B7C164[i].unk_08; + phi_f20 = D_80B7C164[i].unk_0C; + phi_s2 = D_80B7C164[i].unk_10; + } + } else if (((bandit1->unk_54C != 5) || (D_80B7C164[i].unk_04 != 2)) && + ((bandit1->unk_54C != 7) || (D_80B7C164[i].unk_04 != 4))) { + phi_s3 = D_80B7C164[i].unk_04; + phi_s4 = D_80B7C164[i].unk_08; + phi_f20 = D_80B7C164[i].unk_0C; + if ((2.0f * Rand_ZeroOne()) < 1.0f) { + phi_f20 *= -1.0f; + } + phi_s2 = D_80B7C164[i].unk_10; + } + //! FAKE: + ; + } + } + } + + if (phi_s3 == -1) { + return 0; + } + + bandit1->unk_540 = bandit1->actor.world.pos; + bandit1->unk_54C = bandit1->unk_550; + bandit1->unk_550 = phi_s3; + bandit1->unk_55C = phi_s2; + bandit1->unk_560 = phi_s2; + bandit1->unk_564 = phi_s4; + bandit1->unk_568 = phi_f20; + + if (phi_s3 == 3) { + f32 rand = Rand_ZeroOne(); + + bandit1->unk_558 = (s32)(rand * 3.0f); + } else { + bandit1->unk_558 = 0; + } + + return 0; +} + +// ObjUm_Bandit_UpdatePosition? +s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit) { + Path* sp6C = &play->setupPathList[this->pathIndex]; + s32 sp68; + Vec3s* sp64; + f32 phi_f12; + s32 phi_v1_2; + Vec3f sp50; + f32 sp4C; + f32 sp48; + f32 sp44; + s32 temp_a1; + f32 sp3C; + f32 phi_f14; + + sp68 = sp6C->count; + sp64 = Lib_SegmentedToVirtual(sp6C->points); + + if (sp68 == 0) { + return 0; + } + + if (Math3D_Distance(&bandit->actor.world.pos, &this->dyna.actor.world.pos) < 800.0f) { + if (banditIndex == 0) { + this->flags |= OBJ_UM_FLAG_0200; + } else { + this->flags |= OBJ_UM_FLAG_0400; + } + bandit->unk_540 = bandit->actor.world.pos; + bandit->unk_55C = 50; + bandit->unk_560 = 50; + bandit->unk_564 = 1; + } + + Math_Vec3s_ToVec3f(&sp50, &sp64[bandit->curRaceWaypoint]); + + if (bandit->curRaceWaypoint == 0) { + phi_f12 = sp64[1].x - sp64[0].x; + phi_f14 = sp64[1].z - sp64[0].z; + } else { + if ((bandit->curRaceWaypoint + 1) == sp6C->count) { + phi_f12 = sp64[sp6C->count - 1].x - sp64[sp6C->count - 2].x; + phi_f14 = sp64[sp6C->count - 1].z - sp64[sp6C->count - 2].z; + } else { + phi_f12 = sp64[bandit->curRaceWaypoint + 1].x - sp64[bandit->curRaceWaypoint - 1].x; + phi_f14 = sp64[bandit->curRaceWaypoint + 1].z - sp64[bandit->curRaceWaypoint - 1].z; + } + } + + temp_a1 = Math_Atan2S(phi_f12, phi_f14); + + func_8017B7F8(&sp50, temp_a1, &sp4C, &sp48, &sp44); + if (((bandit->actor.world.pos.x * sp4C) + (sp48 * bandit->actor.world.pos.z) + sp44) > 0.0f) { + bandit->curRaceWaypoint++; + if (bandit->curRaceWaypoint >= sp68) { + bandit->curRaceWaypoint = 0; + } + Math_Vec3s_ToVec3f(&sp50, &sp64[bandit->curRaceWaypoint]); + } + + bandit->actor.world.rot.y = Math_Vec3f_Yaw(&bandit->actor.world.pos, &sp50); + bandit->actor.speedXZ = 45.0f; + + sp3C = Math_CosS(bandit->actor.world.rot.x) * bandit->actor.speedXZ; + bandit->actor.velocity.x = Math_SinS(bandit->actor.world.rot.y) * sp3C; + bandit->actor.velocity.y = Math_SinS(bandit->actor.world.rot.x) * bandit->actor.speedXZ; + bandit->actor.velocity.z = Math_CosS(bandit->actor.world.rot.y) * sp3C; + + bandit->banditPosition.x = + bandit->actor.world.pos.x + (bandit->actor.velocity.x * 0.5f) + bandit->actor.colChkInfo.displacement.x; + bandit->banditPosition.y = + bandit->actor.world.pos.y + (bandit->actor.velocity.y * 0.5f) + bandit->actor.colChkInfo.displacement.y; + bandit->banditPosition.z = + bandit->actor.world.pos.z + (bandit->actor.velocity.z * 0.5f) + bandit->actor.colChkInfo.displacement.z; + + phi_v1_2 = BINANG_SUB(bandit->actor.world.rot.y, bandit->actor.shape.rot.y); + + if (phi_v1_2 > 0x190) { + phi_v1_2 = 0x190; + } else if (phi_v1_2 < -0x190) { + phi_v1_2 = -0x190; + } + + bandit->actor.shape.rot.y = bandit->actor.shape.rot.y + phi_v1_2; + return 0; +} + +// ObjUm_Bandit_GetCloserAndAttack +s32 func_80B78764(ObjUm* this, PlayState* play, EnHorse* bandit1, EnHorse* bandit2) { + s32 pad; + Vec3f sp30; + s16 phi_v1_5; + + bandit1->unk_55C--; + if (bandit1->unk_55C <= 0) { + bandit1->unk_55C = 0; + + if ((bandit1->unk_550 == 3) && !(this->flags & OBJ_UM_FLAG_MINIGAME_FINISHED)) { + s32 potIndex = -1; + + if (this->potsLife[0] != 1) { + potIndex = 0; + } + + if (this->potsLife[1] != 1) { + if ((potIndex == -1) || (potIndex == 0 && Rand_ZeroOne() < 0.3f)) { + potIndex = 1; + } + } + + if (this->potsLife[2] != 1) { + if ((potIndex == -1) || (potIndex != -1 && Rand_ZeroOne() < 0.3f)) { + potIndex = 2; + } + } + + if (this->potsLife[potIndex] != 1) { + this->wasPotHit[potIndex] = true; + if (this->potsLife[potIndex] == 2) { + Audio_PlaySfxAtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_BROKEN); + } else { + Audio_PlaySfxAtPos(&this->potPos[potIndex], NA_SE_EV_MILK_POT_DAMAGE); + } + + this->potsLife[potIndex]--; + if (this->potsLife[potIndex] < 1) { + this->potsLife[potIndex] = 1; + } + } + } + + func_80B781DC(this, bandit1, bandit2, play); + } + + Math3D_Lerp(&bandit1->unk_540, &this->unk_360[bandit1->unk_550], 1.0f - ((f32)bandit1->unk_55C / bandit1->unk_560), + &sp30); + bandit1->banditPosition = sp30; + bandit1->unk_588 = this->dyna.actor.shape.rot.y; + + if ((bandit1->unk_550 == 10) || ((bandit1->unk_550 == 8))) { + phi_v1_5 = bandit1->unk_588; + } else if (Math3D_Distance(&bandit1->actor.prevPos, &bandit1->actor.world.pos) < 10.0f) { + phi_v1_5 = bandit1->unk_588; + } else { + phi_v1_5 = Math_Vec3f_Yaw(&bandit1->actor.prevPos, &bandit1->actor.world.pos); + } + + if (1) {} + + phi_v1_5 -= bandit1->actor.shape.rot.y; + if (phi_v1_5 > 0x190) { + bandit1->actor.shape.rot.y += 0x190; + } else if (phi_v1_5 < -0x190) { + bandit1->actor.shape.rot.y -= 0x190; + } else { + bandit1->actor.shape.rot.y += phi_v1_5; + } + + return 0; +} + +// ObjUm_UpdateBanditsDamage? +s32 func_80B78A54(ObjUm* this, PlayState* play, s32 arg2, EnHorse* arg3, EnHorse* arg4) { + if (this->banditsCollisions[arg2].base.acFlags & AC_HIT) { + if (arg3->unk_550 == 3) { + s16 sp36 = + Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &arg3->actor.world.pos) - this->dyna.actor.shape.rot.y; + + this->banditsCollisions[arg2].base.acFlags &= ~AC_HIT; + Audio_PlaySfxAtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); + arg3->unk_54C = 0xF; + + if (Math_SinS(sp36) > 0.0f) { + arg3->unk_550 = arg4->unk_550 != 10 ? 10 : 8; + arg3->unk_568 = -1.0f; + } else { + arg3->unk_550 = arg4->unk_550 != 8 ? 8 : 10; + arg3->unk_568 = 1.0f; + } + + arg3->unk_540 = arg3->actor.world.pos; + arg3->unk_55C = 40; + arg3->unk_560 = 40; + arg3->unk_564 = 1; + if (arg3->rider != NULL) { + arg3->rider->actor.colorFilterTimer = 20; + Actor_SetColorFilter(&arg3->rider->actor, 0x4000, 0xFF, 0, 40); + } + } else { + if (arg3->rider != NULL) { + arg3->rider->actor.colorFilterTimer = 20; + Actor_SetColorFilter(&arg3->rider->actor, 0x4000, 0xFF, 0, 40); + } + Audio_PlaySfxAtPos(&arg3->actor.projectedPos, NA_SE_EN_CUTBODY); + } + } + + return 0; +} + +// ObjUm_UpdateBanditLogic? +s32 func_80B78C18(ObjUm* this, PlayState* play) { + EnHorse* bandit1 = this->bandit1; + EnHorse* bandit2 = this->bandit2; + + if (!(this->flags & OBJ_UM_FLAG_0200)) { + func_80B783E0(this, play, 0, bandit1); + } else { + func_80B78764(this, play, bandit1, bandit2); + } + + if (!(this->flags & OBJ_UM_FLAG_0400)) { + func_80B783E0(this, play, 1, bandit2); + } else { + func_80B78764(this, play, bandit2, bandit1); + } + + func_80B78A54(this, play, 0, bandit1, bandit2); + func_80B78A54(this, play, 1, bandit2, bandit1); + return 0; +} + +s32 ObjUm_UpdateBanditsCollisions(ObjUm* this, PlayState* play) { + s32 pad[3]; + + this->banditsCollisions[0].dim.pos.x = this->bandit1->actor.world.pos.x; + this->banditsCollisions[0].dim.pos.y = this->bandit1->actor.world.pos.y + 70.0f; + this->banditsCollisions[0].dim.pos.z = this->bandit1->actor.world.pos.z; + + this->banditsCollisions[1].dim.pos.x = this->bandit2->actor.world.pos.x; + this->banditsCollisions[1].dim.pos.y = this->bandit2->actor.world.pos.y + 70.0f; + this->banditsCollisions[1].dim.pos.z = this->bandit2->actor.world.pos.z; + + CollisionCheck_SetAC(play, &play->colChkCtx, &this->banditsCollisions[0].base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->banditsCollisions[1].base); + return 0; +} + +// ObjUm_UpdateBandits? +s32 func_80B78DF0(ObjUm* this, PlayState* play) { + func_80B78C18(this, play); + ObjUm_UpdateBanditsCollisions(this, play); + return 0; +} + +void ObjUm_SetupAction(ObjUm* this, ObjUmActionFunc actionFunc) { + this->actionFunc = actionFunc; +} + +void ObjUm_SetPlayerPosition(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + if (this->flags & OBJ_UM_FLAG_DRAWN_FLOOR) { + player->actor.world.pos = this->unk_308; + player->actor.prevPos = this->unk_308; + } +} + +void ObjUm_RotatePlayer(ObjUm* this, PlayState* play, s16 angle) { + Player* player = GET_PLAYER(play); + + player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = this->dyna.actor.shape.rot.y + angle; +} + +void func_80B78EBC(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + player->actor.focus.rot.x = 0; + player->actor.focus.rot.z = 0; + player->actor.focus.rot.y = player->actor.shape.rot.y; + + player->unk_AAC.x = 0; + player->unk_AAC.y = 0; + player->unk_AAC.z = 0; + + player->unk_AB2.x = 0; + player->unk_AB2.y = 0; + player->unk_AB2.z = 0; + + player->currentYaw = player->actor.focus.rot.y; +} + +void ObjUm_RotatePlayerView(ObjUm* this, PlayState* play, s16 angle) { + Player* player = GET_PLAYER(play); + + player->actor.focus.rot.y += angle; +} + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP), }; -#endif +void ObjUm_Init(Actor* thisx, PlayState* play) { + s32 pad; + ObjUm* this = THIS; + s32 sp54 = true; + s32 i; -extern ColliderCylinderInit D_80B7C138; -extern InitChainEntry D_80B7C254[]; + DynaPolyActor_Init(&this->dyna, 0); + this->unk_350 = 0; -extern UNK_TYPE D_06011DF8; -extern UNK_TYPE D_06012CC0; + this->unk_2C4 = this->dyna.actor.world.pos; + this->unk_2DC = this->dyna.actor.world.pos; + this->unk_308 = this->dyna.actor.world.pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B77770.s") + for (i = 0; i < MILK_POTS_COUNT; i++) { + this->potsLife[i] = 5; + this->wasPotHit[i] = false; + this->potPos[i] = gZeroVec3f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B77FA4.s") + this->donkey = NULL; + this->unk_354 = 0; + this->unk_420 = 0; + this->cartBedPos = this->dyna.actor.world.pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B781DC.s") + this->unk_4CC = 0; + this->mouthTexIndex = 0; + this->flags = OBJ_UM_FLAG_NONE; + this->dyna.actor.gravity = -3.5f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B783E0.s") + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 50.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gUmSkel, NULL, this->jointTable, this->morphTable, UM_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gUmTrotAnim); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78764.s") + this->wheelRot = 0; + ObjUm_DefaultAnim(this, play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78A54.s") + this->type = OBJ_UM_PARSE_TYPE(thisx); + this->initialPathIndex = OBJ_UM_PARSE_PATH_INDEX(thisx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78C18.s") + // if (!AliensDefeated) + if (!(gSaveContext.save.weekEventReg[22] & 1)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78D08.s") + if (this->type == OBJ_UM_TYPE_TERMINA_FIELD) { + ObjUm_SetupAction(this, ObjUm_TerminaFieldIdle); + } else if (this->type == OBJ_UM_TYPE_RANCH) { + this->pathIndex = this->initialPathIndex; + if (gSaveContext.save.weekEventReg[31] & 0x80) { + // In cutscene -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78DF0.s") + sp54 = false; + this->flags |= OBJ_UM_FLAG_0100; + ObjUm_SetupAction(this, func_80B7A144); + func_800FE484(); + } else { + // Waiting for player -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/ObjUm_SetupAction.s") + if ((gSaveContext.save.weekEventReg[34] & 0x80) || gSaveContext.save.time >= CLOCK_TIME(19, 0) || + gSaveContext.save.time <= CLOCK_TIME(6, 0) || (gSaveContext.save.weekEventReg[52] & 1) || + (gSaveContext.save.weekEventReg[52] & 2)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78E38.s") + this->dyna.actor.targetMode = 6; + this->unk_2B4 = 0; + ObjUm_SetupAction(this, ObjUm_RanchWait); + } + } else if (this->type == OBJ_UM_TYPE_PRE_MILK_RUN) { + if (!(gSaveContext.save.weekEventReg[31] & 0x80) || (gSaveContext.save.weekEventReg[52] & 1)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78E88.s") + if (!(gSaveContext.save.weekEventReg[52] & 2)) { + this->pathIndex = this->initialPathIndex; + sp54 = false; + func_800FE484(); + ObjUm_SetupAction(this, ObjUm_PreMilkRunStartCs); + this->unk_354 = 0; + ObjUm_RotatePlayer(this, play, 0); + } + } else if (this->type == OBJ_UM_TYPE_MILK_RUN_MINIGAME) { + if (!(gSaveContext.save.weekEventReg[31] & 0x80)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78EBC.s") + this->pathIndex = this->initialPathIndex; + sp54 = false; + func_800FE484(); + ObjUm_SetupAction(this, ObjUm_StartCs); + this->unk_354 = 0; + ObjUm_RotatePlayer(this, play, 0); + } else if (this->type == OBJ_UM_TYPE_POST_MILK_RUN) { + if (!(gSaveContext.save.weekEventReg[52] & 1) || (gSaveContext.save.weekEventReg[59] & 2)) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B78EFC.s") + this->pathIndex = this->initialPathIndex; + sp54 = false; + func_800FE484(); + ObjUm_SetupAction(this, ObjUm_PostMilkRunStartCs); + this->unk_354 = 0; + ObjUm_RotatePlayer(this, play, 0); + func_801A3098(NA_BGM_CLEAR_EVENT); + } else { + this->type = OBJ_UM_TYPE_TERMINA_FIELD; + ObjUm_SetupAction(this, ObjUm_TerminaFieldIdle); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/ObjUm_Init.s") + this->unk_2F8 = this->unk_2FE = gZeroVec3s; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/ObjUm_Destroy.s") + if (sp54) { + DynaPolyActor_Init(&this->dyna, 0); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_um_Colheader_007E20); + } else { + DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_um_Colheader_007F50); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79524.s") + if (this->dyna.bgId == BGCHECK_SCENE) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79560.s") + func_800C636C(play, &play->colCtx.dyna, this->dyna.bgId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B795A0.s") + this->donkey = + (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, + this->dyna.actor.shape.rot.y, 0, ENHORSE_PARAMS(ENHORSE_PARAM_DONKEY, ENHORSE_18)); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79734.s") + if (this->donkey == NULL) { + Actor_MarkForDeath(&this->dyna.actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B797EC.s") + Collider_InitAndSetCylinder(play, &this->banditsCollisions[0], &this->dyna.actor, &sCylinderInit); + Collider_InitAndSetCylinder(play, &this->banditsCollisions[1], &this->dyna.actor, &sCylinderInit); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7984C.s") +void ObjUm_Destroy(Actor* thisx, PlayState* play) { + ObjUm* this = THIS; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79A24.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79A50.s") + for (i = 0; i < ARRAY_COUNT(this->potPos); i++) { + Audio_StopSfxByPos(&this->potPos[i]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79BA0.s") + Collider_DestroyCylinder(play, &this->banditsCollisions[0]); + Collider_DestroyCylinder(play, &this->banditsCollisions[1]); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79F10.s") +// ObjUm_MarkMyDonkeyAndMyselfForDeath, ObjUm_TerminateMe, ObjUmn't, ObjUm_Asinucide +void func_80B79524(ObjUm* this) { + Actor_MarkForDeath(&this->dyna.actor); + if (this->donkey != NULL) { + Actor_MarkForDeath(&this->donkey->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B79FFC.s") +void func_80B79560(PlayState* play, ObjUm* this, s32 arg2, u16 textId) { + // "Thanks, I rely on you" + if (textId == 0x33BF) { + ObjUm_SetupAction(this, ObjUm_StartCs); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A070.s") +s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { + s32 pad[2]; + s32 phi_v1 = true; + u16 textId = this->dyna.actor.textId; + Player* player; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A0E0.s") + switch (textId) { + // "I'll go to town" + case 0x33B4: + // "Want a ride?" + case 0x33CF: + gSaveContext.save.weekEventReg[31] |= 0x40; + if (play->msgCtx.choiceIndex == 0) { + player = GET_PLAYER(play); + func_8019F208(); + gSaveContext.save.weekEventReg[31] |= 0x80; + play->nextEntranceIndex = 0x64B0; + if (player->stateFlags1 & PLAYER_STATE1_800000) { + D_801BDAA0 = 1; + } + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + phi_v1 = true; + } else { + Actor_ContinueText(play, &this->dyna.actor, 0x33B5); + func_8019F230(); + func_80151BB4(play, 6); + phi_v1 = false; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A144.s") + // "I'll go as fast as I can!" + case 0x33BB: + Actor_ContinueText(play, &this->dyna.actor, 0x33BC); + phi_v1 = false; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A1B4.s") + // "Chase pursuers with your arrows." + case 0x33BC: + Actor_ContinueText(play, &this->dyna.actor, 0x33BD); + phi_v1 = false; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A240.s") + // "Understand?" + case 0x33BD: + if (play->msgCtx.choiceIndex == 0) { + Actor_ContinueText(play, &this->dyna.actor, 0x33BE); + func_8019F230(); + } else { + Actor_ContinueText(play, &this->dyna.actor, 0x33BF); + func_8019F208(); + } + phi_v1 = false; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A2AC.s") + // "I'll tell you again!" + case 0x33BE: + Actor_ContinueText(play, &this->dyna.actor, 0x33BC); + phi_v1 = false; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A394.s") + return phi_v1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A400.s") +s32 func_80B79734(PlayState* play, ObjUm* this, s32 arg2) { + MessageContext* msgCtx = &play->msgCtx; + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A494.s") + switch (Message_GetState(msgCtx)) { + case TEXT_STATE_CLOSING: + func_80B79560(play, this, arg2, this->dyna.actor.textId); + return true; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A614.s") + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + if (Message_ShouldAdvance(play) && func_80B795A0(play, this, arg2)) { + msgCtx->msgMode = 0x43; + ret = true; + } + break; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A7AC.s") +u16 ObjUm_RanchGetDialogue(PlayState* play, ObjUm* this, s32 arg2) { + u16 textId = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7A860.s") + if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if (gSaveContext.save.weekEventReg[31] & 0x40) { + // "Want a ride?" + textId = 0x33CF; + } else { + // "I'll deliver milk" + textId = 0x33B4; + } + } else { + textId = 0x33B7; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AB78.s") + if (textId == 0) { + textId = 1; + } + return textId; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7ABE4.s") +s32 func_80B7984C(PlayState* play, ObjUm* this, s32 arg2, s32* arg3) { + s16 temp_v0_2; + s16 phi_v1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AC94.s") + if (*arg3 == 4) { + return 0; + } + if (*arg3 == 2) { + Message_StartTextbox(play, this->dyna.actor.textId, &this->dyna.actor); + *arg3 = 1; + return 0; + } + if (*arg3 == 3) { + func_80151938(play, this->dyna.actor.textId); + *arg3 = 1; + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AD34.s") + if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { + *arg3 = 1; + return 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AE58.s") + if (*arg3 == 1) { + if (func_80B79734(play, this, arg2)) { + *arg3 = 0; + } + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AEFC.s") + phi_v1 = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; + temp_v0_2 = ABS_ALT(phi_v1); + if (temp_v0_2 >= 0x4E20) { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7AF30.s") + if ((this->dyna.actor.xyzDistToPlayerSq > SQ(100.0f)) && !this->dyna.actor.isTargeted) { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7B154.s") + if (this->dyna.actor.xyzDistToPlayerSq <= SQ(50.0f)) { + if (func_800B8614(&this->dyna.actor, play, 50.0f)) { + this->dyna.actor.textId = ObjUm_RanchGetDialogue(play, this, arg2); + } + } else if (func_800B863C(&this->dyna.actor, play)) { + this->dyna.actor.textId = ObjUm_RanchGetDialogue(play, this, arg2); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7B18C.s") + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/ObjUm_Update.s") +s32 func_80B79A24(s32 arg0) { + switch (arg0) { + case 1: + case 2: + case 3: + return true; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7B598.s") + default: + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7B93C.s") +void ObjUm_RanchWait(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7BABC.s") + this->dyna.actor.flags |= ACTOR_FLAG_1; + SkelAnime_Update(&this->skelAnime); + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + this->flags |= OBJ_UM_FLAG_WAITING; + if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= CLOCK_TIME(19, 0))) { + if (!(player->stateFlags1 & PLAYER_STATE1_800000)) { + func_80B7984C(play, this, 0, &this->unk_2B4); + } + } else if (!func_80B79A24(this->unk_2B4) && (gSaveContext.save.time > CLOCK_TIME(19, 0))) { + gSaveContext.save.weekEventReg[34] |= 0x80; + ObjUm_SetupAction(this, ObjUm_RanchWaitPathFinished); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/func_80B7BEA4.s") + switch (play->msgCtx.currentTextId) { + default: + this->unk_4CC = 0; + this->mouthTexIndex = 0; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Um/ObjUm_Draw.s") + // "I'm worried about my sister" + case 0x33B7: + // "I'll deliver milk" + case 0x33B4: + this->unk_4CC = 0; + this->mouthTexIndex = 1; + break; + + // "I'll leave at 7" + case 0x33B5: + this->unk_4CC = 3; + this->mouthTexIndex = 1; + break; + } +} + +typedef enum ObjUmPathState { + /* 0 */ OBJUM_PATH_STATE_0, + /* 1 */ OBJUM_PATH_STATE_1, + /* 2 */ OBJUM_PATH_STATE_FINISH, + /* 3 */ OBJUM_PATH_STATE_3, + /* 4 */ OBJUM_PATH_STATE_4, +} ObjUmPathState; + +ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { + Path* path = &play->setupPathList[this->pathIndex]; + s32 pathCount; + Vec3s* pathPoints; + f32 xDiff; + f32 zDiff; + Vec3f sp50; + f32 sp4C; + f32 sp48; + f32 sp44; + s32 angle; + ObjUmPathState sp3C; + s16 yawDiff; + + pathCount = path->count; + pathPoints = Lib_SegmentedToVirtual(path->points); + sp3C = OBJUM_PATH_STATE_0; + + if (pathCount == 0) { + return 0; + } + + Math_Vec3s_ToVec3f(&sp50, &pathPoints[this->pointIndex]); + + if (this->pointIndex == 0) { + xDiff = pathPoints[1].x - pathPoints[0].x; + zDiff = pathPoints[1].z - pathPoints[0].z; + } else if ((this->pointIndex + 1) == path->count) { + xDiff = pathPoints[path->count - 1].x - pathPoints[path->count - 2].x; + zDiff = pathPoints[path->count - 1].z - pathPoints[path->count - 2].z; + } else { + xDiff = pathPoints[this->pointIndex + 1].x - pathPoints[this->pointIndex - 1].x; + zDiff = pathPoints[this->pointIndex + 1].z - pathPoints[this->pointIndex - 1].z; + } + + angle = Math_Atan2S(xDiff, zDiff); + + func_8017B7F8(&sp50, angle, &sp4C, &sp48, &sp44); + if (((this->dyna.actor.world.pos.x * sp4C) + (sp48 * this->dyna.actor.world.pos.z) + sp44) > 0.0f) { + this->pointIndex++; + + if (this->pointIndex >= (pathCount - 7)) { + sp3C = OBJUM_PATH_STATE_3; + } + if (this->pointIndex >= (pathCount - 3)) { + sp3C = OBJUM_PATH_STATE_1; + } + if (this->pointIndex >= (pathCount - 2)) { + sp3C = OBJUM_PATH_STATE_4; + } + if (this->pointIndex >= pathCount) { + this->pointIndex = 0; + sp3C = OBJUM_PATH_STATE_FINISH; + } + + Math_Vec3s_ToVec3f(&sp50, &pathPoints[this->pointIndex]); + } + + if (this->donkey != NULL) { + this->dyna.actor.world.rot.y = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &sp50); + func_800F415C(&this->donkey->actor, &sp50, 0x190); + + if (1) {} + + yawDiff = this->donkey->actor.shape.rot.y - this->dyna.actor.shape.rot.y; + if (fabsf(yawDiff) < 2730.0f) { + if (fabsf(yawDiff) < 100.0f) { + this->dyna.actor.shape.rot.y = this->donkey->actor.shape.rot.y; + } else if (yawDiff > 0) { + this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + 0x64; + yawDiff = 0x64; + } else if (yawDiff < 0) { + this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y - 0x64; + yawDiff = -0x64; + } + } else if (yawDiff > 0) { + this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + 0x190; + yawDiff = 0x190; + } else if (yawDiff < 0) { + this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y - 0x190; + yawDiff = -0x190; + } + + if (this->flags & (OBJ_UM_FLAG_0010 | OBJ_UM_FLAG_0004)) { + ObjUm_RotatePlayerView(this, play, yawDiff); + } + } + + if (this->currentAnimIndex == OBJ_UM_ANIM_TROT) { + this->dyna.actor.speedXZ = 4.0f; + } else if (this->currentAnimIndex == OBJ_UM_ANIM_GALLOP) { + this->dyna.actor.speedXZ = 8.0f; + } + + return sp3C; +} + +void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { + this->wheelRot += 0x3E8; + this->flags &= ~OBJ_UM_FLAG_WAITING; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + + switch (ObjUm_UpdatePath(this, play)) { + case OBJUM_PATH_STATE_1: + case OBJUM_PATH_STATE_FINISH: + if (gSaveContext.save.weekEventReg[31] & 0x80) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + play->nextEntranceIndex = 0x3E50; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + } else { + func_80B79524(this); + } + break; + + default: + Actor_MoveWithGravity(&this->dyna.actor); + break; + } +} + +void ObjUm_RanchStartCs(ObjUm* this, PlayState* play) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->lastTime = gSaveContext.save.time; + ObjUm_SetupAction(this, func_80B7A0E0); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void func_80B7A070(ObjUm* this, PlayState* play) { + ObjUm_RanchWaitPathFinished(this, play); + ObjUm_RotatePlayer(this, play, 0); + + switch (play->msgCtx.currentTextId) { + case 0x33B6: + this->unk_4CC = 1; + this->mouthTexIndex = 1; + break; + + default: + this->unk_4CC = 0; + this->mouthTexIndex = 0; + break; + } +} + +void func_80B7A0E0(ObjUm* this, PlayState* play) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + if (gSaveContext.save.time != this->lastTime) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_SetupAction(this, func_80B7A070); + } +} + +void func_80B7A144(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + ObjUm_SetPlayerPosition(this, play); + this->flags |= OBJ_UM_FLAG_0100; + this->flags |= OBJ_UM_FLAG_0004; + player->stateFlags1 |= PLAYER_STATE1_20; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_SetupAction(this, ObjUm_RanchStartCs); +} + +void ObjUm_PreMilkRunDialogueHandler(ObjUm* this, PlayState* play) { + ObjUm_SetPlayerPosition(this, play); + this->flags |= OBJ_UM_FLAG_0004; + + switch (play->msgCtx.currentTextId) { + case 0x33B8: + this->unk_4CC = 0; + this->mouthTexIndex = 3; + break; + + case 0x33B9: + this->unk_4CC = 2; + this->mouthTexIndex = 0; + break; + + default: + this->flags &= ~OBJ_UM_FLAG_LOOK_BACK; + this->unk_4CC = 0; + this->mouthTexIndex = 0; + break; + } +} + +void func_80B7A240(ObjUm* this, PlayState* play) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + if (gSaveContext.save.time != this->lastTime) { + ObjUm_SetupAction(this, func_80B7A2AC); + } + + this->lastTime = gSaveContext.save.time; + ObjUm_PreMilkRunDialogueHandler(this, play); +} + +void func_80B7A2AC(ObjUm* this, PlayState* play) { + this->wheelRot += 0x3E8; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + + switch (ObjUm_UpdatePath(this, play)) { + case OBJUM_PATH_STATE_1: + case OBJUM_PATH_STATE_FINISH: + play->nextEntranceIndex = 0xCE40; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + break; + + default: + if (gSaveContext.save.time == this->lastTime) { + ObjUm_SetupAction(this, func_80B7A240); + } + + this->lastTime = gSaveContext.save.time; + Actor_MoveWithGravity(&this->dyna.actor); + ObjUm_PreMilkRunDialogueHandler(this, play); + break; + } +} + +void func_80B7A394(ObjUm* this, PlayState* play) { + ObjUm_SetPlayerPosition(this, play); + this->flags |= OBJ_UM_FLAG_0004; + if (gSaveContext.save.time != this->lastTime) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_SetupAction(this, func_80B7A2AC); + } +} + +void ObjUm_PreMilkRunStartCs(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + ObjUm_SetPlayerPosition(this, play); + this->flags |= OBJ_UM_FLAG_0004; + player->stateFlags1 |= PLAYER_STATE1_20; + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->lastTime = gSaveContext.save.time; + ObjUm_SetupAction(this, func_80B7A394); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0x7FFF); + this->wheelRot += 0x7D0; + this->flags |= OBJ_UM_FLAG_0010; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + + switch (ObjUm_UpdatePath(this, play)) { + case OBJUM_PATH_STATE_1: + case OBJUM_PATH_STATE_FINISH: + gSaveContext.seqIndex = 0xFF; + gSaveContext.save.weekEventReg[31] &= (u8)~0x80; + gSaveContext.nightSeqIndex = 0xFF; + + if (!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) { + if (!this->areAllPotsBroken) { + play->nextEntranceIndex = 0x3E60; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + gSaveContext.save.weekEventReg[52] |= 1; + gSaveContext.save.weekEventReg[52] &= (u8)~2; + } else { + play->nextEntranceIndex = 0x6480; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + gSaveContext.save.weekEventReg[52] |= 2; + gSaveContext.save.weekEventReg[52] &= (u8)~1; + } + } + break; + + default: + Actor_MoveWithGravity(&this->dyna.actor); + func_80B78DF0(this, play); + break; + } +} + +void func_80B7A614(ObjUm* this, PlayState* play) { + s32 pad; + + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0x7FFF); + this->wheelRot += 0x7D0; + this->flags |= OBJ_UM_FLAG_0010; + this->flags |= OBJ_UM_FLAG_PLAYING_MINIGAME; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + + if (ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_3 && this->unk_4DC == 0) { + this->unk_4DC = 1; + } else if (this->unk_4DC > 0) { + if (this->unk_4DC == 1) { + s32 i; + + this->areAllPotsBroken = true; + + for (i = 0; i < ARRAY_COUNT(this->potsLife); i++) { + if (this->potsLife[i] != 1) { + this->areAllPotsBroken = false; + break; + } + } + + this->flags |= OBJ_UM_FLAG_MINIGAME_FINISHED; + } + + this->unk_4DC++; + } + + if (this->flags & OBJ_UM_FLAG_MINIGAME_FINISHED) { + s32 sp20 = ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene); + + if (this->areAllPotsBroken) { + sp20 = ActorCutscene_GetAdditionalCutscene(sp20); + } + if (ActorCutscene_GetCanPlayNext(sp20)) { + ActorCutscene_StartAndSetUnkLinkFields(sp20, &this->dyna.actor); + ObjUm_SetupAction(this, ObjUm_RunMinigame); + this->flags &= ~OBJ_UM_FLAG_PLAYING_MINIGAME; + } else { + ActorCutscene_SetIntentToPlay(sp20); + } + } + + Actor_MoveWithGravity(&this->dyna.actor); + func_80B78DF0(this, play); +} + +void func_80B7A7AC(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + this->unk_4DC = 0; + this->areAllPotsBroken = false; + player->stateFlags1 &= ~PLAYER_STATE1_20; + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0x7FFF); + func_80B78EBC(this, play); + this->flags |= OBJ_UM_FLAG_0010; + func_80B78DF0(this, play); + this->flags |= 4; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + ObjUm_SetupAction(this, func_80B7A614); +} + +void func_80B7A860(ObjUm* this, PlayState* play) { + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0); + this->flags |= OBJ_UM_FLAG_0004; + + if (play->csCtx.frames == 449) { + ObjUm_InitBandits(this, play); + } else if (play->csCtx.frames >= 450) { + func_80B78DF0(this, play); + } + + if (play->csCtx.state == 0) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + ObjUm_SetupAction(this, func_80B7A7AC); + } + + switch (play->msgCtx.currentTextId) { + case 0x33BA: + this->unk_4CC = 2; + this->mouthTexIndex = 3; + break; + + // "We'll go through here as fast as we can" + case 0x33BB: + if ((fabsf(this->skelAnime.curFrame) < 0.008f) && !(this->flags & OBJ_UM_FLAG_1000)) { + this->flags |= OBJ_UM_FLAG_1000; + this->unk_4CC = 4; + this->mouthTexIndex = 0; + } else if (fabsf(this->skelAnime.morphWeight) < 0.008f) { + this->unk_4CC = 2; + this->mouthTexIndex = 2; + } else { + this->unk_4CC = 5; + this->mouthTexIndex = 0; + } + + this->flags |= OBJ_UM_FLAG_LOOK_BACK; + break; + + // "Chase pursuers with your arrows" + case 0x33BC: + if ((fabsf(this->skelAnime.curFrame) < 0.008f) && !(this->flags & OBJ_UM_FLAG_1000)) { + this->flags |= OBJ_UM_FLAG_1000; + this->unk_4CC = 4; + this->mouthTexIndex = 0; + } else if (fabsf(this->skelAnime.morphWeight) < 0.008f) { + this->unk_4CC = 2; + this->mouthTexIndex = 2; + } else { + this->unk_4CC = 5; + this->mouthTexIndex = 0; + } + this->flags |= OBJ_UM_FLAG_LOOK_BACK; + break; + + // "Understand?" + case 0x33BD: + if ((fabsf(this->skelAnime.curFrame) < 0.008f) && !(this->flags & OBJ_UM_FLAG_1000)) { + this->flags |= OBJ_UM_FLAG_1000; + this->unk_4CC = 4; + this->mouthTexIndex = 0; + } else if (fabsf(this->skelAnime.morphWeight) < 0.008f) { + this->unk_4CC = 2; + } else { + this->unk_4CC = 5; + } + this->mouthTexIndex = 0; + this->unk_4D8 = 0; + this->flags |= OBJ_UM_FLAG_LOOK_BACK; + break; + + case 0x33BE: + this->flags |= OBJ_UM_FLAG_LOOK_BACK; + this->unk_4CC = 2; + this->mouthTexIndex = 3; + break; + + case 0x33BF: + this->unk_4D8++; + if ((fabsf(this->skelAnime.morphWeight) < 0.008f) && this->unk_4D8 >= 6) { + this->unk_4CC = 0; + this->mouthTexIndex = 0; + } else { + this->unk_4CC = 2; + this->mouthTexIndex = 2; + } + this->flags &= ~OBJ_UM_FLAG_LOOK_BACK; + break; + + default: + this->unk_4CC = 0; + this->mouthTexIndex = 0; + break; + } +} + +void func_80B7AB78(ObjUm* this, PlayState* play) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + if (gSaveContext.save.time != this->lastTime) { + ObjUm_SetupAction(this, func_80B7ABE4); + } + + this->lastTime = gSaveContext.save.time; + func_80B7A860(this, play); +} + +void func_80B7ABE4(ObjUm* this, PlayState* play) { + this->wheelRot += 0x3E8; + + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + switch (ObjUm_UpdatePath(this, play)) { + case OBJUM_PATH_STATE_FINISH: + func_80B79524(this); + break; + + default: + if (gSaveContext.save.time == this->lastTime) { + ObjUm_SetupAction(this, func_80B7AB78); + } + + this->lastTime = gSaveContext.save.time; + Actor_MoveWithGravity(&this->dyna.actor); + func_80B7A860(this, play); + break; + } +} + +void ObjUm_StartCs(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + player->stateFlags1 |= PLAYER_STATE1_20; + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0); + this->flags |= OBJ_UM_FLAG_0004; + + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->lastTime = gSaveContext.save.time; + ObjUm_SetupAction(this, func_80B7ABE4); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + player->stateFlags1 |= PLAYER_STATE1_20; + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0); + this->flags |= OBJ_UM_FLAG_0004; + this->wheelRot += 0x3E8; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + + if ((ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_4) && !(gSaveContext.save.weekEventReg[59] & 2)) { + ActorCutscene_Stop(this->dyna.actor.cutscene); + Audio_SetCutsceneFlag(false); + gSaveContext.save.weekEventReg[59] |= 2; + gSaveContext.nextCutsceneIndex = 0xFFF3; + play->nextEntranceIndex = 0x5400; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; + play->transitionTrigger = TRANS_TRIGGER_START; + gSaveContext.save.time += CLOCK_TIME(1, 0) + 2; + } + Actor_MoveWithGravity(&this->dyna.actor); +} + +void ObjUm_PostMilkRunStartCs(ObjUm* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + player->stateFlags1 |= PLAYER_STATE1_20; + ObjUm_SetPlayerPosition(this, play); + ObjUm_RotatePlayer(this, play, 0); + this->flags |= OBJ_UM_FLAG_0004; + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + ObjUm_SetupAction(this, ObjUm_PostMilkRunWaitPathFinished); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjUm_TerminaFieldIdle(ObjUm* this, PlayState* play) { + ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + SkelAnime_Update(&this->skelAnime); +} + +void func_80B7AF30(ObjUm* this, PlayState* play) { + if (!(this->flags & OBJ_UM_FLAG_0001)) { + this->dyna.actor.shape.rot.x = 0; + this->dyna.actor.shape.rot.z = 0; + } else { + CollisionPoly* sp44; + s32 pad[2]; + Vec3f sp30; + + this->flags &= ~OBJ_UM_FLAG_0001; + + if (1) {} + + this->unk_2D0 = this->unk_2C4; + this->unk_2E8 = this->unk_2DC; + + this->unk_2D0.y = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp44, &this->unk_2C4); + if (this->unk_2D0.y == BGCHECK_Y_MIN) { + this->unk_2D0.y = this->dyna.actor.floorHeight; + } + + if (1) {} + + this->unk_2E8.y = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp44, &this->unk_2DC); + if (this->unk_2E8.y == BGCHECK_Y_MIN) { + this->unk_2E8.y = this->dyna.actor.floorHeight; + } + + sp30.x = (this->unk_2D0.x + this->unk_2E8.x) * 0.5f; + sp30.y = (this->unk_2D0.y + this->unk_2E8.y) * 0.5f; + sp30.z = (this->unk_2D0.z + this->unk_2E8.z) * 0.5f; + + this->dyna.actor.shape.rot.x = + (s16)Math_Atan2S(sp30.y - this->dyna.actor.world.pos.y, sqrtf(SQ(sp30.x - this->dyna.actor.world.pos.x) + + SQ(sp30.z - this->dyna.actor.world.pos.z))); + this->dyna.actor.shape.rot.z = (s16)-Math_Atan2S( + sp30.y - this->unk_2D0.y, sqrtf(SQ(sp30.x - this->unk_2D0.x) + SQ(sp30.z - this->unk_2D0.z))); + if (this->flags & OBJ_UM_FLAG_MOVING) { + this->dyna.actor.shape.rot.x += BINANG_SUB((Rand_ZeroOne() * 100.0f), 50.0f); + this->dyna.actor.shape.rot.z += BINANG_SUB((Rand_ZeroOne() * 100.0f), 50.0f); + } + } +} + +void ObjUm_DefaultAnim(ObjUm* this, PlayState* play) { + Animation_PlayOnce(&this->skelAnime, &gUmTrotAnim); + this->currentAnimIndex = OBJ_UM_ANIM_TROT; +} + +typedef struct { + /* 0x00 */ AnimationHeader* anim; + /* 0x04 */ s32 doesMove; // `true` if the animation is intended to be used while the actor is moving +} struct_80B7C25C; // size = 0x08 + +struct_80B7C25C sUmAnims[] = { + { &gUmTrotAnim, true }, // OBJ_UM_ANIM_TROT + { &gUmGallopAnim, true }, // OBJ_UM_ANIM_GALLOP + { &gUmIdleAnim, false }, // OBJ_UM_ANIM_IDLE + { NULL, false }, // OBJ_UM_ANIM_3 + { &gUmLookBackAnim, false }, // OBJ_UM_ANIM_LOOK_BACK +}; + +void ObjUm_UpdateAnim(ObjUm* this, PlayState* play, ObjUmAnimimations index) { + s32 changeAnim; + s32 temp; + s32 indexTemp = index; + f32 animPlaybackSpeed = 0.0f; + + if (sUmAnims[index].doesMove) { + this->flags |= OBJ_UM_FLAG_MOVING; + } else { + this->flags &= ~OBJ_UM_FLAG_MOVING; + } + + if (index == OBJ_UM_ANIM_TROT) { + animPlaybackSpeed = this->dyna.actor.speedXZ * 0.25f; + } else if (index == OBJ_UM_ANIM_GALLOP) { + animPlaybackSpeed = this->dyna.actor.speedXZ * 0.2f; + } else if (index == OBJ_UM_ANIM_IDLE) { + animPlaybackSpeed = 1.0f; + } + this->skelAnime.playSpeed = animPlaybackSpeed; + + if (this->flags & OBJ_UM_FLAG_LOOK_BACK) { + this->skelAnime.playSpeed = 1.0f; + index = OBJ_UM_ANIM_MINUS_1; + } + + changeAnim = (index != this->currentAnimIndex); + if (SkelAnime_Update(&this->skelAnime) || changeAnim) { + this->currentAnimIndex = index; + + if (index != OBJ_UM_ANIM_MINUS_1) { + if (this->donkey != NULL) { + this->donkey->unk_538 = index; + } + + if (changeAnim) { + Animation_MorphToPlayOnce(&this->skelAnime, sUmAnims[index].anim, -3.0f); + } else { + Animation_PlayOnce(&this->skelAnime, sUmAnims[index].anim); + } + } else { + EnHorse* donkey = this->donkey; + + if (donkey != NULL) { + donkey->unk_538 = indexTemp; + } + + if (changeAnim) { + temp = 3 - index; // OBJ_UM_ANIM_LOOK_BACK + Animation_MorphToPlayOnce(&this->skelAnime, sUmAnims[temp].anim, -10.0f); + } else { + temp = 3 - index; // OBJ_UM_ANIM_LOOK_BACK + Animation_PlayOnce(&this->skelAnime, sUmAnims[temp].anim); + } + } + } + + if (this->wheelRot / 0x199A != this->unk_420) { + this->unk_420 = this->wheelRot / 0x199A; + //! FAKE + if (!&sUmAnims[0]) {} + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CART_WHEEL); + } +} + +void ObjUm_Update(Actor* thisx, PlayState* play) { + ObjUm* this = THIS; + + this->actionFunc(this, play); + this->unk_350++; + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); + + if (this->donkey != NULL) { + this->donkey->actor.world.pos.x = this->dyna.actor.world.pos.x; + this->donkey->actor.world.pos.y = this->dyna.actor.floorHeight; + this->donkey->actor.world.pos.z = this->dyna.actor.world.pos.z; + } + + if (this->flags & OBJ_UM_FLAG_0010) { + func_80123F2C(play, 0x63); + this->flags &= ~OBJ_UM_FLAG_0010; + } else if (this->flags & OBJ_UM_FLAG_0004) { + func_80123F2C(play, -3); + this->flags &= ~OBJ_UM_FLAG_0004; + } + + if (this->flags & OBJ_UM_FLAG_0100) { + this->flags &= ~OBJ_UM_FLAG_0100; + ObjUm_RotatePlayer(this, play, 0); + func_80B78EBC(this, play); + } + + func_80B7AF30(this, play); + switch (this->unk_4CC) { + case 0: + switch (this->eyeTexIndex) { + case 0: + if (Rand_ZeroOne() < 0.025f) { + this->eyeTexIndex = 1; + } + break; + + case 1: + if (Rand_ZeroOne() < 0.6f) { + this->eyeTexIndex = 2; + } + break; + + case 2: + if (Rand_ZeroOne() < 0.6f) { + this->eyeTexIndex = 0; + } + break; + + default: + this->eyeTexIndex = 0; + break; + } + break; + + case 1: + this->eyeTexIndex = 3; + break; + case 2: + this->eyeTexIndex = 4; + break; + case 3: + this->eyeTexIndex = 5; + break; + case 4: + this->eyeTexIndex = 2; + break; + case 5: + this->eyeTexIndex = 0; + break; + default: + this->unk_4CC = 0; + this->eyeTexIndex = 0; + break; + } +} + +s32 ObjUm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + ObjUm* this = THIS; + Player* player = GET_PLAYER(play); + s32 pad; + s16 temp_v0_3; + Vec3f sp5C = { 4223.0f, -979.0f, 4098.0f }; + Vec3f sp50 = { 4223.0f, -980.0f, -4083.0f }; + + if ((limbIndex >= UM_LIMB_CREMIA_ROOT) && (this->type == OBJ_UM_TYPE_TERMINA_FIELD)) { + *dList = NULL; + return false; + } + + if (limbIndex == UM_LIMB_CREMIA_HEAD) { + OPEN_DISPS(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sMouthTextures[this->mouthTexIndex])); + + CLOSE_DISPS(play->state.gfxCtx); + } + + if (limbIndex == UM_LIMB_WAGON_RIGHT_WHEEL) { + if (this->flags & OBJ_UM_FLAG_MOVING) { + rot->x = -this->wheelRot; + } + Matrix_MultVec3f(&sp5C, &this->unk_2C4); + } else if (limbIndex == UM_LIMB_WAGON_LEFT_WHEEL) { + if (this->flags & OBJ_UM_FLAG_MOVING) { + rot->x = this->wheelRot; + } + Matrix_MultVec3f(&sp50, &this->unk_2DC); + } else if ((limbIndex == UM_LIMB_CREMIA_HEAD) && (this->flags & OBJ_UM_FLAG_WAITING)) { + if (SubS_AngleDiffLessEqual(this->dyna.actor.shape.rot.y, 0x4E20, this->dyna.actor.yawTowardsPlayer) && + (this->dyna.actor.xzDistToPlayer < 500.0f)) { + s16 sp3E; + Vec3f sp30 = player->actor.world.pos; + + sp30.y = player->bodyPartsPos[7].y + 3.0f; + sp3E = Math_Vec3f_Yaw(&this->dyna.actor.focus.pos, &sp30) - this->dyna.actor.shape.rot.y; + temp_v0_3 = Math_Atan2S( + this->dyna.actor.focus.pos.y - sp30.y, + Math3D_XZLength(sp30.x - this->dyna.actor.focus.pos.x, sp30.z - this->dyna.actor.focus.pos.z)); + this->unk_2FE.x = rot->x + sp3E; + this->unk_2FE.y = rot->y; + this->unk_2FE.z = rot->z + temp_v0_3; + Math_SmoothStepToS(&this->unk_2F8.x, this->unk_2FE.x, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk_2F8.z, this->unk_2FE.z, 4, 0x3E8, 1); + this->unk_2F8.y = rot->y; + rot->x = this->unk_2F8.x; + rot->z = this->unk_2F8.z; + } else { + this->unk_2FE.x = rot->x; + this->unk_2FE.y = rot->y; + this->unk_2FE.z = rot->z; + Math_SmoothStepToS(&this->unk_2F8.x, this->unk_2FE.x, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk_2F8.z, this->unk_2FE.z, 4, 0x3E8, 1); + this->unk_2F8.y = rot->y; + rot->x = this->unk_2F8.x; + rot->z = this->unk_2F8.z; + } + } else if ((limbIndex == UM_LIMB_WAGON_CART_COVER) && (this->flags & OBJ_UM_FLAG_PLAYING_MINIGAME)) { + *dList = NULL; + } + + return false; +} + +void ObjUm_SpawnFragments(PlayState* play, Vec3f* potPos) { + Vec3f sp8C = { 0.0f, -1.0f, 0.0f }; + Gfx* potFragments[] = { object_um_DL_000040, object_um_DL_000910, object_um_DL_0011E0 }; + s32 i; + Vec3f sp70; + + EffectSsHitmark_SpawnFixedScale(play, 0, potPos); + + for (i = 0; i < 20; i++) { + sp70.x = (Rand_ZeroOne() * 20.0f) - 10.0f; + sp70.y = -((Rand_ZeroOne() * 20.0f) - 10.0f); + sp70.z = (Rand_ZeroOne() * 20.0f) - 10.0f; + EffectSsHahen_Spawn(play, potPos, &sp70, &sp8C, 1, 100, OBJECT_UM, 10, + potFragments[(s32)(Rand_ZeroOne() * ARRAY_COUNT(potFragments))]); + } +} + +void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + ObjUm* this = THIS; + GraphicsContext* gfxCtx = play->state.gfxCtx; + Mtx* mtx_s3; + Gfx* spFC[] = { + NULL, gUmBrokenMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, object_um_DL_0067C0 + }; + Gfx* spE4[] = { NULL, NULL, object_um_DL_004B60, object_um_DL_0043E0, NULL, NULL }; + f32 spCC[] = { 0.0f, 1070.0f, 1070.0f, 1070.0f, 1070.0f, 2100.0f }; + Vec3f spC0 = gZeroVec3f; + Vec3f calcPotPos; + f32 spB0; + + spC0.y += 1700.0f; + + if (limbIndex == UM_LIMB_WAGON_CART_BED) { + Vec3f spA4 = { 2000.0f, 1070.0f, 0.0f }; + + Matrix_MultVec3f(&spA4, &this->unk_308); + this->flags |= OBJ_UM_FLAG_DRAWN_FLOOR; + } + + if (limbIndex == UM_LIMB_WAGON_CART_BED) { + Vec3f sp98 = { 2500.0f, 200.0f, 0.0f }; + + Matrix_MultVec3f(&sp98, &this->cartBedPos); + } + + if (limbIndex == UM_LIMB_WAGON_CART_BED) { + Vec3f* potPos; + Vec3f sp88; + Vec3s sp80; + s32 i; + f32 sp70[] = { 2000.0f, 0.0f, -2000.0f }; + + //! FAKE + if (!i) {} + + sp80.x = 0; + sp80.z = 0; + sp88.x = 6800.0f; + OPEN_DISPS(gfxCtx); + + for (i = 0; i < ARRAY_COUNT(this->potsLife); i++) { + sp88.z = sp70[i]; + sp88.y = spCC[this->potsLife[i]]; + + if (this->potsLife[i] == 5) { + sp80.y = 0x4000; + } else { + sp80.y = -0x4000; + } + + Matrix_Push(); + Matrix_TranslateRotateZYX(&sp88, &sp80); + mtx_s3 = Matrix_NewMtx(gfxCtx); + potPos = &this->potPos[i]; + Matrix_MultVec3f(&spC0, &calcPotPos); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, potPos, &spB0); + + if (this->wasPotHit[i]) { + this->wasPotHit[i] = false; + if (this->potsLife[i] == 1) { + ObjUm_SpawnFragments(play, &calcPotPos); + } else { + EffectSsHitmark_SpawnFixedScale(play, 0, &calcPotPos); + } + } + Matrix_Pop(); + + if (mtx_s3 != NULL) { + if (play) {} + gSPMatrix(POLY_OPA_DISP++, mtx_s3, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (spFC[this->potsLife[i]] != NULL) { + s32 pad; + + gSPDisplayList(POLY_OPA_DISP++, spFC[this->potsLife[i]]); + + if (spE4[this->potsLife[i]] != NULL) { + gSPDisplayList(POLY_OPA_DISP++, spE4[this->potsLife[i]]); + } + } + } else { + //! @bug skips CLOSE_DISPS + return; + } + } + + CLOSE_DISPS(gfxCtx); + } + + if (limbIndex == UM_LIMB_CREMIA_HEAD) { + Matrix_MultZero(&this->dyna.actor.focus.pos); + } +} + +void func_80B7BEA4(Vec3f* cartBedPos, s16 arg1, Vec3f* arg2, u8 alpha, PlayState* play) { + f32 temp; + Vec3f sp108; + CollisionPoly* sp104; + Mtx* sp100; + MtxF spC0; + MtxF sp80; + MtxF sp40; + + sp108.x = cartBedPos->x; + sp108.y = cartBedPos->y + 1.0f; + sp108.z = cartBedPos->z; + + temp = BgCheck_EntityRaycastFloor2(play, &play->colCtx, &sp104, &sp108); + if (sp104 != NULL) { + func_800C0094(sp104, cartBedPos->x, temp, cartBedPos->z, &spC0); + } else { + SkinMatrix_SetTranslate(&spC0, cartBedPos->x, cartBedPos->y, cartBedPos->z); + } + + SkinMatrix_MulYRotation(&spC0, arg1); + SkinMatrix_SetScale(&sp80, arg2->x, 1.0f, arg2->z); + SkinMatrix_MtxFMtxFMult(&spC0, &sp80, &sp40); + + sp100 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &sp40); + if (sp100 != NULL) { + OPEN_DISPS(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); + gSPMatrix(POLY_OPA_DISP++, sp100, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gSquareShadowDL); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void ObjUm_Draw(Actor* thisx, PlayState* play) { + s32 pad; + ObjUm* this = THIS; + Vec3f sp34; + + this->flags |= OBJ_UM_FLAG_0001; + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + ObjUm_OverrideLimbDraw, ObjUm_PostLimbDraw, &this->dyna.actor); + sp34.x = 0.45f; + sp34.y = 0.0f; + sp34.z = 0.7f; + func_80B7BEA4(&this->cartBedPos, this->dyna.actor.shape.rot.y, &sp34, 180, play); + func_80B77770(this, play); +} diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.h b/src/overlays/actors/ovl_Obj_Um/z_obj_um.h index d343d3a51..9d228eda8 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.h +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.h @@ -2,18 +2,93 @@ #define Z_OBJ_UM_H #include "global.h" +#include "objects/object_um/object_um.h" +#include "overlays/actors/ovl_En_Horse/z_en_horse.h" struct ObjUm; typedef void (*ObjUmActionFunc)(struct ObjUm*, PlayState*); +#define MILK_POTS_COUNT 3 + +typedef enum ObjUmAnimimations { + /* -1 */ OBJ_UM_ANIM_MINUS_1 = -1, + /* 0 */ OBJ_UM_ANIM_TROT, + /* 1 */ OBJ_UM_ANIM_GALLOP, + /* 2 */ OBJ_UM_ANIM_IDLE, + /* 3 */ OBJ_UM_ANIM_3, // NULL pointer + /* 4 */ OBJ_UM_ANIM_LOOK_BACK +} ObjUmAnimimations; + typedef struct ObjUm { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjUmActionFunc actionFunc; - /* 0x160 */ char unk_160[0x384]; + /* 0x160 */ SkelAnime skelAnime; + /* 0x1A4 */ Vec3s jointTable[UM_LIMB_MAX]; + /* 0x228 */ Vec3s morphTable[UM_LIMB_MAX]; + /* 0x2AC */ s16 wheelRot; + /* 0x2AE */ s16 type; + /* 0x2B0 */ s16 initialPathIndex; + /* 0x2B4 */ s32 unk_2B4; + /* 0x2B8 */ EnHorse* donkey; + /* 0x2BC */ s32 pathIndex; + /* 0x2BE */ s32 pointIndex; + /* 0x2C4 */ Vec3f unk_2C4; + /* 0x2D0 */ Vec3f unk_2D0; + /* 0x2DC */ Vec3f unk_2DC; + /* 0x2E8 */ Vec3f unk_2E8; + /* 0x2F4 */ s32 flags; + /* 0x2BC */ Vec3s unk_2F8; + /* 0x2FE */ Vec3s unk_2FE; + /* 0x304 */ ObjUmAnimimations currentAnimIndex; + /* 0x308 */ Vec3f unk_308; + /* 0x314 */ s32 potsLife[MILK_POTS_COUNT]; + /* 0x320 */ s32 wasPotHit[MILK_POTS_COUNT]; // resets to false in the same frame + /* 0x32C */ Vec3f potPos[MILK_POTS_COUNT]; + /* 0x350 */ s32 unk_350; // unused counter? + /* 0x354 */ s32 unk_354; // unused? + /* 0x358 */ EnHorse* bandit1; + /* 0x35C */ EnHorse* bandit2; + /* 0x360 */ Vec3f unk_360[16]; + /* 0x420 */ s32 unk_420; // ? + /* 0x424 */ ColliderCylinder banditsCollisions[2]; + /* 0x4BC */ Vec3f cartBedPos; + /* 0x4C8 */ u16 lastTime; + /* 0x4CC */ s32 unk_4CC; + /* 0x4D0 */ s32 eyeTexIndex; + /* 0x4D4 */ s32 mouthTexIndex; + /* 0x4D8 */ s32 unk_4D8; + /* 0x4DC */ s32 unk_4DC; + /* 0x4E0 */ s32 areAllPotsBroken; // true when all of the pots have been broken } ObjUm; // size = 0x4E4 extern const ActorInit Obj_Um_InitVars; +typedef enum { + /* 0 */ OBJ_UM_TYPE_TERMINA_FIELD, + /* 1 */ OBJ_UM_TYPE_RANCH, + /* 2 */ OBJ_UM_TYPE_PRE_MILK_RUN, // milk road, pre-minigame + /* 3 */ OBJ_UM_TYPE_MILK_RUN_MINIGAME, + /* 4 */ OBJ_UM_TYPE_POST_MILK_RUN // milk road, post-minigame +} ObjUmType; + +#define OBJ_UM_PARSE_TYPE(thisx) (((thisx)->params & 0xFF00) >> 8) +#define OBJ_UM_PARSE_PATH_INDEX(thisx) ((thisx)->params & 0xFF) + +#define OBJ_UM_FLAG_NONE (0) +#define OBJ_UM_FLAG_0001 (1 << 0) +#define OBJ_UM_FLAG_MOVING (1 << 1) +#define OBJ_UM_FLAG_0004 (1 << 2) +#define OBJ_UM_FLAG_WAITING (1 << 3) // Waiting in the Ranch +#define OBJ_UM_FLAG_0010 (1 << 4) +#define OBJ_UM_FLAG_DRAWN_FLOOR (1 << 5) +#define OBJ_UM_FLAG_0040 (1 << 6) +#define OBJ_UM_FLAG_PLAYING_MINIGAME (1 << 7) +#define OBJ_UM_FLAG_0100 (1 << 8) +#define OBJ_UM_FLAG_0200 (1 << 9) // Something bandit1 +#define OBJ_UM_FLAG_0400 (1 << 10) // Something bandit2 +#define OBJ_UM_FLAG_LOOK_BACK (1 << 11) +#define OBJ_UM_FLAG_1000 (1 << 12) +#define OBJ_UM_FLAG_MINIGAME_FINISHED (1 << 13) + #endif // Z_OBJ_UM_H diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index b58dae7ab..ea9b35f5c 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -138,7 +138,7 @@ void ObjWarpstone_Update(Actor* thisx, PlayState* play) { if (this->isTalking) { if (Actor_TextboxIsClosing(&this->dyna.actor, play)) { this->isTalking = false; - } else if ((Message_GetState(&play->msgCtx) == 4) && Message_ShouldAdvance(play)) { + } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex != 0) { func_8019F208(); play->msgCtx.msgMode = 0x4D; diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index d9c34e4f4..5a733ecba 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -63,20 +63,20 @@ void func_808A7A5C(ObjWturn* this, PlayState* play) { void func_808A7AAC(ObjWturn* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f eye; - Vec3f at; + Vec3f subCamEye; + Vec3f subCamAt; ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); func_8016566C(140); - this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); func_800B7298(play, &this->actor, 21); - at.x = player->actor.focus.pos.x; - at.z = player->actor.focus.pos.z; - at.y = player->actor.focus.pos.y; - eye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + at.x; - eye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + at.z; - eye.y = at.y + 4.0f; - Play_CameraSetAtEye(play, this->camId, &at, &eye); + subCamAt.x = player->actor.focus.pos.x; + subCamAt.z = player->actor.focus.pos.z; + subCamAt.y = player->actor.focus.pos.y; + subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + subCamAt.x; + subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + subCamAt.z; + subCamEye.y = subCamAt.y + 4.0f; + Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->actionFunc = func_808A7BA0; } @@ -85,7 +85,7 @@ void func_808A7BA0(ObjWturn* this, PlayState* play) { func_808A7C04(this, play); } func_800B8FE8(&this->actor, NA_SE_EV_EARTHQUAKE - SFX_FLAG); - Play_CameraSetRoll(play, this->camId, this->actor.shape.rot.z); + Play_CameraSetRoll(play, this->subCamId, this->actor.shape.rot.z); } void func_808A7C04(ObjWturn* this, PlayState* play) { @@ -101,23 +101,23 @@ void func_808A7C04(ObjWturn* this, PlayState* play) { } void func_808A7C78(ObjWturn* this, PlayState* play) { - static Vec3f D_808A7DC0 = { 0.0f, -1.0f, 0.0f }; - Camera* camera = Play_GetCamera(play, this->camId); + static Vec3f sSubCamUp = { 0.0f, -1.0f, 0.0f }; + Camera* subCam = Play_GetCamera(play, this->subCamId); Player* player = GET_PLAYER(play); this->unk_14A++; player->actor.world.pos.y = this->actor.world.pos.y + this->unk_14A * 4.0f; - Play_CameraSetAtEyeUp(play, this->camId, &player->actor.focus.pos, &camera->eye, &D_808A7DC0); + Play_CameraSetAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp); if (this->unk_14A == 1) { - play->unk_1887F = 0x40; - gSaveContext.nextTransition = 3; + play->transitionType = TRANS_TYPE_64; + gSaveContext.nextTransitionType = TRANS_TYPE_03; gSaveContext.nextCutsceneIndex = 0; if (play->sceneNum == 0x58) { play->nextEntranceIndex = 0xAC00; } else { play->nextEntranceIndex = 0xAA10; } - play->transitionTrigger = 0x14; + play->transitionTrigger = TRANS_TRIGGER_START; } } diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h index 5f6e05546..9b8674f59 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.h @@ -10,7 +10,7 @@ typedef void (*ObjWturnActionFunc)(struct ObjWturn*, PlayState*); typedef struct ObjWturn { /* 0x000 */ Actor actor; /* 0x144 */ ObjWturnActionFunc actionFunc; - /* 0x148 */ s16 camId; + /* 0x148 */ s16 subCamId; /* 0x14A */ s16 unk_14A; } ObjWturn; // size = 0x14C diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index 65b8a76ac..7bc2d6966 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -1,27 +1,59 @@ /* * File: z_eff_ss_g_fire.c * Overlay: ovl_Effect_Ss_G_Fire - * Description: + * Description: Flame Footprints */ #include "z_eff_ss_g_fire.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define PARAMS ((EffectSsGFireInitParams*)initParamsx) -s32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_G_Fire_InitVars = { EFFECT_SS_G_FIRE, EffectSsGFire_Init, }; -#endif +u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsGFireInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Fire/EffectSsGFire_Init.s") + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + Math_Vec3f_Copy(&this->pos, &initParams->pos); + this->draw = EffectSsGFire_Draw; + this->update = EffectSsGFire_Update; + this->gfx = gEffFireFootprintDL; + this->life = 8; + this->flags = 0; + this->rgScale = 200; + this->rgTexIndex = 0; + this->rgTexIndexStep = 50; + this->rgPrimColorR = 255; + this->rgPrimColorG = 220; + this->rgPrimColorB = 80; + this->rgPrimColorA = 255; + this->rgEnvColorR = 130; + this->rgEnvColorG = 30; + this->rgEnvColorB = 0; + this->rgEnvColorA = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Fire/EffectSsGFire_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Fire/EffectSsGFire_Update.s") +void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this) { + TexturePtr fireFootprintTextures[] = { + gEffFireFootprint1Tex, gEffFireFootprint2Tex, gEffFireFootprint3Tex, gEffFireFootprint4Tex, + gEffFireFootprint5Tex, gEffFireFootprint6Tex, gEffFireFootprint7Tex, gEffFireFootprint8Tex, + }; + s16 texIndex = (this->rgTexIndex / 100) % 7; + + EffectSs_DrawGEffect(play, this, fireFootprintTextures[texIndex]); +} + +void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this) { + this->rgTexIndex += this->rgTexIndexStep; +} diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index 79cb97234..b820d8168 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -1,29 +1,138 @@ /* * File: z_eff_ss_g_ripple.c * Overlay: ovl_Effect_Ss_G_Ripple - * Description: + * Description: Water Ripple */ #include "z_eff_ss_g_ripple.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rWaterBoxNum regs[0] +#define rRadius regs[1] +#define rRadiusMax regs[2] +#define rPrimColorR regs[3] +#define rPrimColorG regs[4] +#define rPrimColorB regs[5] +#define rPrimColorA regs[6] +#define rEnvColorR regs[7] +#define rEnvColorG regs[8] +#define rEnvColorB regs[9] +#define rEnvColorA regs[10] +#define rLifespan regs[11] +#define rBgId regs[12] #define PARAMS ((EffectSsGRippleInitParams*)initParamsx) -s32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_G_Ripple_InitVars = { EFFECT_SS_G_RIPPLE, EffectSsGRipple_Init, }; -#endif +u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsGRippleInitParams* initParams = PARAMS; + WaterBox* waterBox = NULL; + s32 pad; + s32 bgId; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Init.s") + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + Math_Vec3f_Copy(&this->pos, &initParams->pos); + this->gfx = gEffWaterRippleDL; + this->life = initParams->life + 20; + this->flags = 0; + this->draw = EffectSsGRipple_Draw; + this->update = EffectSsGRipple_Update; + this->rRadius = initParams->radius; + this->rRadiusMax = initParams->radiusMax; + this->rLifespan = initParams->life; + this->rPrimColorR = 255; + this->rPrimColorG = 255; + this->rPrimColorB = 255; + this->rPrimColorA = 255; + this->rEnvColorR = 255; + this->rEnvColorG = 255; + this->rEnvColorB = 255; + this->rEnvColorA = 255; + this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &initParams->pos, 3.0f, &waterBox, &bgId); + this->rBgId = bgId; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/func_80979C38.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Draw.s") +void EffectSsGRipple_DrawRipple(PlayState* play2, EffectSs* this, TexturePtr tex) { + PlayState* play = play2; + f32 radius; + GraphicsContext* gfxCtx = play->state.gfxCtx; + MtxF mfTrans; + MtxF mfScale; + MtxF mfResult; + Mtx* mtx; + f32 yPos; + CollisionHeader* colHeader; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Ripple/EffectSsGRipple_Update.s") + OPEN_DISPS(gfxCtx); + + radius = this->rRadius * 0.0025f; + colHeader = BgCheck_GetCollisionHeader(&play->colCtx, this->rBgId); + + if ((this->rWaterBoxNum != -1) && (colHeader != NULL) && (this->rWaterBoxNum < colHeader->numWaterBoxes)) { + yPos = func_800CA568(&play->colCtx, this->rWaterBoxNum, this->rBgId); + } else { + yPos = this->pos.y; + } + + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, yPos, this->pos.z); + SkinMatrix_SetScale(&mfScale, radius, radius, radius); + SkinMatrix_MtxFMtxFMult(&mfTrans, &mfScale, &mfResult); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C974(gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, + this->rPrimColorA); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this) { + if (this->rLifespan == 0) { + EffectSsGRipple_DrawRipple(play, this, gEffWaterRippleTex); + } +} + +void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this) { + f32 radius; + f32 primAlpha; + f32 envAlpha; + WaterBox* waterBox; + s32 bgId; + + this->rWaterBoxNum = WaterBox_GetSurface2(play, &play->colCtx, &this->pos, 3.0f, &waterBox, &bgId); + this->rBgId = bgId; + + if (DECR(this->rLifespan) == 0) { + radius = this->rRadius; + Math_SmoothStepToF(&radius, this->rRadiusMax, 0.2f, 30.0f, 1.0f); + this->rRadius = radius; + + primAlpha = this->rPrimColorA; + envAlpha = this->rEnvColorA; + + Math_SmoothStepToF(&primAlpha, 0.0f, 0.2f, 15.0f, 7.0f); + Math_SmoothStepToF(&envAlpha, 0.0f, 0.2f, 15.0f, 7.0f); + + this->rPrimColorA = primAlpha; + this->rEnvColorA = envAlpha; + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index d465e082e..260541b51 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -1,30 +1,145 @@ /* * File: z_eff_ss_g_spk.c * Overlay: ovl_Effect_Ss_G_Spk - * Description: + * Description: Sparks */ #include "z_eff_ss_g_spk.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rPrimColorR regs[0] +#define rPrimColorG regs[1] +#define rPrimColorB regs[2] +#define rPrimColorA regs[3] +#define rEnvColorR regs[4] +#define rEnvColorG regs[5] +#define rEnvColorB regs[6] +#define rEnvColorA regs[7] +#define rTexIndex regs[8] +#define rScale regs[9] +#define rScaleStep regs[10] #define PARAMS ((EffectSsGSpkInitParams*)initParamsx) -s32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void func_80978F40(PlayState* play, u32 index, EffectSs* this); -void func_80979068(PlayState* play, u32 index, EffectSs* this); +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this); +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this); void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_G_Spk_InitVars = { EFFECT_SS_G_SPK, EffectSsGSpk_Init, }; -#endif +static TexturePtr sSparkTextures[] = { + gElectricSpark1Tex, + gElectricSpark2Tex, + gElectricSpark3Tex, + gElectricSpark4Tex, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Spk/EffectSsGSpk_Init.s") +u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsGSpkInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Spk/EffectSsGSpk_Draw.s") + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &initParams->velocity); + Math_Vec3f_Copy(&this->accel, &initParams->accel); + this->gfx = gEffSparkDL; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Spk/func_80978F40.s") + if (initParams->updateMode == GSPK_UPDATEMODE_NORMAL) { + this->life = 10; + this->vec.x = initParams->pos.x - initParams->actor->world.pos.x; + this->vec.y = initParams->pos.y - initParams->actor->world.pos.y; + this->vec.z = initParams->pos.z - initParams->actor->world.pos.z; + this->update = EffectSsGSpk_Update; + } else { + this->life = 5; + this->update = EffectSsGSpk_UpdateNoAccel; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_G_Spk/func_80979068.s") + this->draw = EffectSsGSpk_Draw; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rEnvColorA = initParams->envColor.a; + this->rTexIndex = 0; + this->rScale = initParams->scale; + this->rScaleStep = initParams->scaleStep; + this->actor = initParams->actor; + + return 1; +} + +void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this) { + s32 pad; + MtxF mfTrans; + MtxF mfScale; + MtxF mfResult; + MtxF mfTransBillboard; + Mtx* mtx; + f32 scale; + GraphicsContext* gfxCtx = play->state.gfxCtx; + + OPEN_DISPS(gfxCtx); + + scale = this->rScale * 0.0025f; + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); + SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sSparkTextures[this->rTexIndex])); + func_8012C974(gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this) { + this->accel.x = (Rand_ZeroOne() - 0.5f) * 3.0f; + this->accel.z = (Rand_ZeroOne() - 0.5f) * 3.0f; + + if (this->actor != NULL) { + if ((this->actor->category == ACTORCAT_EXPLOSIVES) && (this->actor->update != NULL)) { + this->pos.x = this->actor->world.pos.x + this->vec.x; + this->pos.y = this->actor->world.pos.y + this->vec.y; + this->pos.z = this->actor->world.pos.z + this->vec.z; + if (this->actor->depthInWater >= 20.0f) { + this->life = 0; + } + } + } + + this->vec.x += this->accel.x; + this->vec.z += this->accel.z; + + this->rTexIndex++; + this->rTexIndex &= 3; + this->rScale += this->rScaleStep; +} + +// this update mode is unused in the original game +// with this update mode, the sparks dont move randomly in the xz plane, appearing to be on top of each other +void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this) { + if (this->actor != NULL) { + if ((this->actor->category == ACTORCAT_EXPLOSIVES) && (this->actor->update != NULL)) { + this->pos.x += (Math_SinS(this->actor->world.rot.y) * this->actor->speedXZ); + this->pos.z += (Math_CosS(this->actor->world.rot.y) * this->actor->speedXZ); + } + } + + this->rTexIndex++; + this->rTexIndex &= 3; + this->rScale += this->rScaleStep; +} diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h index 1d970d3d2..c44bb9168 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h @@ -3,6 +3,11 @@ #include "global.h" +typedef enum EffectSsGSpkUpdatemode { + /* 0 */ GSPK_UPDATEMODE_NORMAL, + /* 1 */ GSPK_UPDATEMODE_NO_ACCEL +} EffectSsGSpkUpdatemode; + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h index 78c4a9a62..4184ca576 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h @@ -17,7 +17,6 @@ typedef struct FileChooseContext { /* 0x00248 */ SkyboxContext skyboxCtx; /* 0x00470 */ MessageContext msgCtx; /* 0x12550 */ Font font; - /* 0x242DC */ UNK_TYPE1 unk_242DC[4]; /* 0x242E0 */ EnvironmentContext envCtx; /* 0x243E0 */ Vtx* unk_243E0; /* 0x243E4 */ Vtx* unk_243E4; @@ -113,13 +112,4 @@ typedef struct FileChooseContext { /* 0x24550 */ s16 unk_24550; } FileChooseContext; // size = 0x24558 -// TODO: Confirm those values has the same meaning as their OoT counterparts -typedef enum { - /* 0x00 */ PAUSE_0, // PAUSE_ITEM - /* 0x01 */ PAUSE_1, // PAUSE_MAP - /* 0x02 */ PAUSE_2, // PAUSE_QUEST - /* 0x03 */ PAUSE_3, // PAUSE_EQUIP - /* 0x04 */ PAUSE_4 // PAUSE_WORLD_MAP -} PauseMenuPage; - #endif diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index c0252c57b..2f0ffdd4a 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -1,14 +1,14 @@ /* * File: z_select.c * Overlay: ovl_select - * Description: Debug map select + * Description: Debug Map Select Menu */ #include "z_select.h" #include "libc/alloca.h" #include "overlays/gamestates/ovl_title/z_title.h" -void Select_LoadTitle(SelectContext* this) { +void MapSelect_LoadTitle(MapSelectState* this) { { GameState* gameState = &this->state; gameState->running = false; @@ -17,7 +17,7 @@ void Select_LoadTitle(SelectContext* this) { SET_NEXT_GAMESTATE(&this->state, Title_Init, TitleContext); } -void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { +void MapSelect_LoadGame(MapSelectState* this, u32 entranceIndex, s32 opt) { if (gSaveContext.fileNum == 0xFF) { Sram_InitDebugSave(); } @@ -53,7 +53,7 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { gSaveContext.respawn[RESPAWN_MODE_ZORA].entranceIndex = 0xFF; gSaveContext.respawn[RESPAWN_MODE_DEKU].entranceIndex = 0xFF; gSaveContext.respawn[RESPAWN_MODE_HUMAN].entranceIndex = 0xFF; - D_801BDBB0 = 0; + gWeatherMode = 0; do { GameState* gameState = &this->state; @@ -62,300 +62,440 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } -// "Translation" ("Actual name") +// "Translation" (Actual name) static SceneSelectEntry sScenes[] = { - // " 0: OP Woods for Cutscene Use" (" 0: Forest Opening Scene") - { " 0:OP\x8Cデモ\x8Dヨウ シンリン", Select_LoadGame, 0x1C00 }, - // " 0-0: Lost Woods" (" 0-0: Lost Woods") - { " 0-0:\x8Dマヨイ ノ モリ", Select_LoadGame, 0xC400 }, - // " 1: Town Outskirts" (" 1: Termina Field") - { " 1:\x8Cタウン \x8Dコウガイ", Select_LoadGame, 0x5400 }, - // " 1-0: Astral Observatory" (" 1-0: Astral Observatory") - { " 1-0:\x8Dテンモンカンソクジョ", Select_LoadGame, 0x4C00 }, - // " 1 - 1: Astral Observatory Telescope" (" 1 - 1: Astral Observatory - Telescope") - { " 1-1:\x8Dテンモンカンソクジョ デ ボウエンキョウ", Select_LoadGame, 0x54A0 }, - // " 1 - 2: Ikana Graveyard" (" 1 - 2: Ikana Canyon Graveyard") - { " 1-2:\x8Cイカーナ \x8Dノ ハカバ", Select_LoadGame, 0x8000 }, - // " 2: Romani Ranch" (" 2: Romani Ranch") - { " 2:\x8Cロマニー \x8Dボクジョウ", Select_LoadGame, 0x6400 }, - // " 3: Milk Road" (" 3: Milk Road") - { " 3:\x8Cミルクロード", Select_LoadGame, 0x3E00 }, - // " 4: Main Building" (" 4: Ranch House") - { " 4:\x8Dオモヤ", Select_LoadGame, 0x610 }, - // " 5: Cow Shed" (" 5: Cow Shed") - { " 5:\x8Dウシゴヤ", Select_LoadGame, 0x600 }, - // " 6: Cucco Shed" (" 6: Cucco Shed") - { " 6:\x8Cコッコ \x8Dゴヤ", Select_LoadGame, 0x7E00 }, - // " 7: Dog Racing Area" (" 7: Doggy Racetrack") - { " 7:\x8Cドッグレース\x8Dジョウ", Select_LoadGame, 0x7C00 }, - // " 8: Gorman Track" (" 8: Gorman Track") - { " 8:\x8Cゴーマン トラック", Select_LoadGame, 0xCE00 }, - // " 10: Mountain Village -Winter-" (" 10: Mountain Village - Winter") - { " 10:\x8Dヤマザト -フユ-", Select_LoadGame, 0x9A00 }, - // " 10 - 0: Mountain Village -Spring-" (" 10 - 0: Mountain Village - Spring") - { " 10-0:\x8Dヤマザト -ハル-", Select_LoadGame, 0xAE00 }, - // " 10 - 1: Mountain Village Blacksmith" (" 10 - 1: Mountain Smithy") - { " 10-1:\x8Dヤマザト ノ カジヤ", Select_LoadGame, 0x5200 }, - // " 11: Goron Village -Winter-" (" 11: Goron Village - Winter") - { " 11:\x8Cゴロン\x8D ノ サト -フユ-", Select_LoadGame, 0x9400 }, - // " 11-0: Goron Village -Spring-" (" 11-0: Goron Village - Spring") - { " 11-0:\x8Cゴロン\x8D ノ サト -ハル-", Select_LoadGame, 0x8A00 }, - // " 11-1: Goron Shrine" (" 11-1: Goron Shrine") - { " 11-1:\x8Cゴロン\x8D ノ ホコラ", Select_LoadGame, 0x5E00 }, - // " 11-2: Lone Peak Shrine" (" 11-2: Lone Peak Shrine") - { " 11-2:\x8Dハナレヤマ ノ ホコラ", Select_LoadGame, 0x1500 }, - // " 11-3: Goron Shop" (" 11-3: Goron Shop") - { " 11-3:\x8Cゴロン \x8Dノ ミセ", Select_LoadGame, 0x7400 }, - // " 12: Snowhead" (" 12: Snowhead") - { " 12:\x8Cスノーヘッド", Select_LoadGame, 0xB200 }, - // " 13: Blizzard Path" (" 13: Path to Goron Village - Part 1") - { " 13:\x8Dフブキ ノ ミチ", Select_LoadGame, 0x3200 }, - // " 14: Snowball Path" (" 14: Path to Goron Village - Part 2") - { " 14:\x8Dユキダマ ノ ミチ", Select_LoadGame, 0xB000 }, - // " 15: Goron Racetrack" (" 15: Goron Racetrack") - { " 15:\x8Cゴロンレース \x8Dジョウ", Select_LoadGame, 0xD000 }, - // " 16: Goron Grave" (" 16: Darmani's Grave") - { " 16:\x8Cゴロン \x8Dノ ハカ", Select_LoadGame, 0x9600 }, - // " 17: Snow Field Battle -Winter-" (" 17: Path to Goron Village - Winter") - { " 17:\x8Dセツゲン \x8Cバトル \x8D-フユ-", Select_LoadGame, 0xB400 }, - // " 17-0: Snow Field Battle -Spring-" (" 17-0: Path to Goron Village - Spring") - { " 17-0:\x8Dセツゲン \x8Cバトル \x8D-ハル-", Select_LoadGame, 0xB600 }, - // " 20: Swampland" (" 20: Southern Swamp") - { " 20:\x8Dヌマチ", Select_LoadGame, 0x8400 }, - // " 20-0: Swampland - Afterwards" (" 20-0: Southern Swamp - After Odolwa") - { " 20-0:\x8Dヌマチ ソノゴ", Select_LoadGame, 0xC00 }, - // " 20-1: Swamp Tourist Information" (" 20-1: Tourist Information") - { " 20-1:\x8Dヌマ ノ カンコウアンナイ", Select_LoadGame, 0xA800 }, - // " 20-2: Magic Hags' Potion Shop" (" 20-2: Magic Hags' Potion Shop") - { " 20-2:\x8Dマホウオババ ノ クスリヤ", Select_LoadGame, 0x400 }, - // " 21: Wood Mountain" (" 21: Woodfall") - { " 21:\x8Cウッドマウンテン", Select_LoadGame, 0x8600 }, - // " 21-0: Deku Princess's Prison" (" 21-0: Deku Princess's Prison [Cutscene: Tatl Apologizes]") - { " 21-0:\x8Cデク\x8Dヒメ ノ ロウヤ", Select_LoadGame, 0x3010 }, - // " 22: Deku Castle" (" 22: Deku Palace") - { " 22:\x8Cデクナッツ \x8Dノ シロ", Select_LoadGame, 0x5000 }, - // " 22-0: Boe Hole 0" (" 22-0: Deku Palace Grotto 0 - Deku Baba & Butterflies, Entrance 1") - { " 22-0:\x8Cクロスケ \x8Dノ アナ0", Select_LoadGame, 0x1460 }, - // " 22-1: Boe Hole 1" (" 22-1: Deku Palace Grotto 1 - Deku Baba & Butterflies, Entrance 2") - { " 22-1:\x8Cクロスケ \x8Dノ アナ1", Select_LoadGame, 0x14E0 }, - // " 22-2: Boe Hole 2" (" 22-2: Deku Palace Grotto 2 - Skullwalltula Wall, Lower Entrance") - { " 22-2:\x8Cクロスケ \x8Dノ アナ2", Select_LoadGame, 0x1480 }, - // " 22-3: Boe Hole 3" (" 22-3: Deku Palace Grotto 3 - Skullwalltula Wall, Upper Entrance") - { " 22-3:\x8Cクロスケ \x8Dノ アナ3", Select_LoadGame, 0x14F0 }, - // " 22-4: Boe Hole 4" (" 22-4: Deku Palace Grotto 4 - Bean Seller") - { " 22-4:\x8Cクロスケ \x8Dノ アナ4", Select_LoadGame, 0x14C0 }, - // " 24: Beast Path" (" 24: Road to Swamp") - { " 24:\x8Dケモノミチ", Select_LoadGame, 0x7A00 }, - // " 24-0: Forest Shooting Gallery" (" 24-0: Swamp Shooting Gallery") - { " 24-0:\x8Dモリ ノ シャテキジョウ", Select_LoadGame, 0x4200 }, - // " 25: Deku King's Chamber" (" 25: Deku Palace Throne Room") - { " 25:\x8Cデク\x8Dオウ ノ マ", Select_LoadGame, 0x7600 }, - // " 26: Woods of Mystery" (" 26: Woods of Mystery") - { " 26:\x8Dフシギ ノ モリ", Select_LoadGame, 0xC200 }, - // " 30: Great Bay Coast" (" 30: Great Bay Coast - Entrance Area") - { " 30:\x8Cグレートベイ\x8D ノ カイガン", Select_LoadGame, 0x6800 }, - // " 30-0: Ocean Laboratory" (" 30-0: Marine Research Lab") - { " 30-0:\x8Dカイヨウ ケンキュウジョ", Select_LoadGame, 0x5800 }, - // " 30-1: Fisherman's House" (" 30-1: Fisherman's Hut") - { " 30-1:\x8Dリョウシ ノ イエ", Select_LoadGame, 0x7200 }, - // " 30-2: Pointed Rock" (" 30-2: Twin Pillars") - { " 30-2:\x8Dトンガリ イワ", Select_LoadGame, 0x4400 }, - // " 31: Cape" (" 31: Great Bay Coast - River Area") - { " 31:\x8Dミサキ", Select_LoadGame, 0x6A00 }, - // " 32: Outside of Pirates' Fortress" (" 32: Pirates' Fortress - Exterior") - { " 32:\x8Dカイゾクノトリデマエ", Select_LoadGame, 0x7000 }, - // " 32-0: Pirates' Fortress" (" 32-0: Pirates' Fortress - Courtyard") - { " 32-0:\x8Dカイゾクノトリデ", Select_LoadGame, 0x2200 }, - // " 32-1: Pirates' Fortress - Telescope" (" 32-1: Pirates' Fortress - Secret Entrance (Looking Through - // Telescope)") - { " 32-1:\x8Dカイゾクノトリデ ボウエンキョウ", Select_LoadGame, 0x22A0 }, - // " 32-2: Pirates' Fortress - Interior 0" (" 32-2: Pirates' Fortress - Throne Room") - { " 32-2:\x8Dカイゾクノトリデナイブ0", Select_LoadGame, 0x4000 }, - // " 32-3: Pirates' Fortress - Interior 1" (" 32-3: Pirates' Fortress - View of Throne Room, Wasp Nest") - { " 32-3:\x8Dカイゾクノトリデナイブ1", Select_LoadGame, 0x4010 }, - // " 32-4: Pirates' Fortress - Interior 2" (" 32-4: Pirates' Fortress - Tempting Treasure Chest, Leading to 32-5") - { " 32-4:\x8Dカイゾクノトリデナイブ2", Select_LoadGame, 0x4020 }, - // " 32-5: Pirates' Fortress - Interior 3" (" 32-5: Pirates' Fortress - Zora Egg Room, One Shell Blade") - { " 32-5:\x8Dカイゾクノトリデナイブ3", Select_LoadGame, 0x4030 }, - // " 32-6: Pirates' Fortress - Interior 4" (" 32-6: Pirates' Fortress - Oil Drum Room, Leading to 32-7") - { " 32-6:\x8Dカイゾクノトリデナイブ4", Select_LoadGame, 0x4040 }, - // " 32-7: Pirates' Fortress - Interior 5" (" 32-7: Pirates' Fortress - Zora Egg Room, One Shell Blade") - { " 32-7:\x8Dカイゾクノトリデナイブ5", Select_LoadGame, 0x4050 }, - // " 32-8: Pirates' Fortress - Interior 6" (" 32-8: Pirates' Fortress - Fenced Indoor Walkway, Leading to 32-9") - { " 32-8:\x8Dカイゾクノトリデナイブ6", Select_LoadGame, 0x4060 }, - // " 32-9: Pirates' Fortress - Interior 7" (" 32-9: Pirates' Fortress - Zora Egg Room, One Desbreko & Treasure - // Chest") - { " 32-9:\x8Dカイゾクノトリデナイブ7", Select_LoadGame, 0x4070 }, - // " 32-10: Pirates' Fortress - Interior 8" (" 32-10: Pirates' Fortress - End of Secret Entrance (Telescope - // Room)") - { " 32-10:\x8Dカイゾクノトリデナイブ8", Select_LoadGame, 0x4080 }, - // " 32-11: Pirates' Fortress - Interior 9" (" 32-11: Pirates' Fortress - Start of Secret Entrance") - { " 32-11:\x8Dカイゾクノトリデナイブ9", Select_LoadGame, 0x4090 }, - // " 33: Zora Shrine" (" 33: Zora Hall") - { " 33:\x8Cゾーラ \x8Dノ ホコラ", Select_LoadGame, 0x6000 }, - // " 33-0: Zora Shop" (" 33-0: Zora Shop") - { " 33-0:\x8Cゾーラ \x8Dノ ミセ", Select_LoadGame, 0x9250 }, - // " 33-1: Zora Waiting Room" (" 33-1: Mikau & Tijo's Room") - { " 33-1:\x8Cゾーラ \x8Dノ ヒカエシツ", Select_LoadGame, 0x9200 }, - // " 34: Great Bay" (" 34: Great Bay [Cutscene: Pirates Approach Temple]") - { " 34:\x8Cグレートベイ", Select_LoadGame, 0xBE00 }, - // " 35: Mountain Stream Above Falls" (" 35: Waterfall Rapids") - { " 35:\x8Dタキウエ ノ ケイリュウ", Select_LoadGame, 0x8E00 }, - // " 40: Rock Building Shaft" (" 40: Stone Tower") - { " 40:\x8Cロックビル\x8D ノ タテアナ", Select_LoadGame, 0xAA00 }, - // " 40-0: Heaven & Earth Are Overturned" (" 40-0: Stone Tower [Cutscene: Tower is Flipped]") - { " 40-0:\x8Dテンチ ギャクテン", Select_LoadGame, 0xAC00 }, - // " 41: Road to Ikana" (" 41: Road to Ikana") - { " 41:\x8Cイカーナ \x8Dヘノ ミチ", Select_LoadGame, 0xA000 }, - // " 42: Ancient Castle of Ikana" (" 42: Ancient Castle of Ikana") - { " 42:\x8Cイカーナ\x8D コジョウ", Select_LoadGame, 0x3400 }, - // " 42-0: Ancient Castle of Ikana - Interior" (" 42-0: Ancient Castle of Ikana - Interior") - { " 42-0:\x8Cイカーナ\x8D ノ コジョウ ナイブ", Select_LoadGame, 0x3430 }, - // " 42-B: Ancient Castle of Ikana - Boss Room" (" 42-B: Ikana King's Throne") - { " 42-B:\x8Cイカーナ\x8D ノ コジョウ \x8Cボス\x8Dベヤ", Select_LoadGame, 0xA600 }, - // " 43: Ikana Canyon" (" 43: Ikana Canyon") - { " 43:\x8Cイカーナ \x8Dケイコク", Select_LoadGame, 0x2000 }, - // " 43-0: Ikana Canyon Cave" (" 43-0: Sharp's Cave") - { " 43-0:\x8Cイカーナ \x8Dケイコク ドウクツ", Select_LoadGame, 0x20E0 }, - // " 43-1: Secom's House" (" 43-1: Sakon's Hideout") - { " 43-1:\x8Cセコム \x8Dノ イエ", Select_LoadGame, 0x9800 }, - // " 43-2: Music Box House" (" 43-2: Music Box House") - { " 43-2:\x8Cオルゴール ハウス", Select_LoadGame, 0xA400 }, - // " 50: Clock Town -East-" (" 50: East Clock Town") - { " 50:\x8Cクロックタウン \x8D-ヒガシ-", Select_LoadGame, 0xD200 }, - // " 50-0: Town Target Range" (" 50-0: Shooting Gallery") - { " 50-0:\x8Dマチ ノ シャテキジョウ", Select_LoadGame, 0x3A00 }, - // " 50-1: Honey and Darling's Shop" (" 50-1: Honey & Darling's Shop") - { " 50-1:\x8Cハニー アンド ダーリン \x8Dノ ミセ", Select_LoadGame, 0x800 }, - // " 50-2: Treasure Chest Shop" (" 50-2: Treasure Chest Shop") - { " 50-2:\x8Dタカラバコヤ", Select_LoadGame, 0x2800 }, - // " 50-3: Pots 'n' Pans Inn" (" 50-3: Stockpot Inn") - { " 50-3:\x8Cナベ\x8Dカマ テイ", Select_LoadGame, 0xBC00 }, - // " 50-4: Mayor's House" (" 50-4: The Mayor's Residence") - { " 50-4:\x8Dチョウチョウ ノ イエ", Select_LoadGame, 0 }, - // " 50-5: Milk Bar" (" 50-5: Milk Bar") - { " 50-5:\x8Cミルクバー", Select_LoadGame, 0x2400 }, - // " 51: Clock Town -West-" (" 51: West Clock Town") - { " 51:\x8Cクロックタウン \x8D-ニシ-", Select_LoadGame, 0xD400 }, - // " 51-0: Bomb Shop" (" 51-0: Bomb Shop") - { " 51-0:\x8Dバクダン ヤ", Select_LoadGame, 0xCA00 }, - // " 51-1: Maniac Mart" (" 51-1: Curiosity Shop") - { " 51-1:\x8Cマニ\x8Dヤ", Select_LoadGame, 0xE00 }, - // " 51-2: General Store" (" 51-2: Trading Post") - { " 51-2:\x8Dザッカ ヤ", Select_LoadGame, 0x6200 }, - // " 51-3: Sword Dojo" (" 51-3: Swordsman's School") - { " 51-3:\x8Dケンドウジョウ", Select_LoadGame, 0xA200 }, - // " 51-4: Post House" (" 51-4: Post Office") - { " 51-4:\x8Dポストハウス", Select_LoadGame, 0x5600 }, - // " 51-5: Lottery Shop" (" 51-5: Lottery Shop") - { " 51-5:\x8Dタカラクジヤ", Select_LoadGame, 0x6C00 }, - // " 52: Clock Town -North-" (" 52: North Clock Town") - { " 52:\x8Cクロックタウン \x8D-キタ-", Select_LoadGame, 0xD600 }, - // " 53: Clocktown -South-" (" 53: South Clock Town") - { " 53:\x8Cクロックタウン \x8D-ミナミ-", Select_LoadGame, 0xD800 }, - // " 53-0: Clock Tower Interior" (" 53-0: Clock Tower Interior") - { " 53-0:\x8Dトケイトウナイブ", Select_LoadGame, 0xC000 }, - // " 54: Clock Tower Rooftop" (" 54: Clock Tower Rooftop") - { " 54:\x8Dトケイトウ オクジョウ", Select_LoadGame, 0x2C00 }, - // " 55: Laundry Area" (" 55: Laundry Pool") - { " 55:\x8Dセンタクジョウ", Select_LoadGame, 0xDA00 }, - // " 55-0: Maniac Mart - Rear Entrance" (" 55-0: Curiosity Shop - Back Room") - { " 55-0:\x8Cマニ\x8Dヤ ノ ウラグチ", Select_LoadGame, 0xE10 }, - // " 55-1: Maniac Mart - Peephole" (" 55-1: Curiosity Shop Back Room - Peephole") - { " 55-1:\x8Cマニ\x8Dヤ ノ ノゾキアナ", Select_LoadGame, 0xE20 }, - // "100: Wood Mountain Temple" ("100: Woodfall Temple") - { "100:\x8Cウッドマウンテン \x8Dノ シンデン", Select_LoadGame, 0x3000 }, - // "100-B: Wood Mountain Temple - Boss" ("100-B: Odolwa's Lair") - { "100-B:\x8Cウッドマウンテン \x8Dノ シンデン\x8C-ボス-", Select_LoadGame, 0x3800 }, - // "101: Snowhead Temple" ("101: Snowhead Temple") - { "101:\x8Cスノーヘッド \x8Dノ シンデン", Select_LoadGame, 0x3C00 }, - // "101-B: Snowhead Temple - Boss" ("101-B: Goht's Lair") - { "101-B:\x8Cスノーヘッド \x8Dノ シンデン\x8C-ボス-", Select_LoadGame, 0x8200 }, - // "102: Great Bay Temple" ("102: Great Bay Temple") - { "102:\x8Cグレートベイ \x8Dノ シンデン", Select_LoadGame, 0x8C00 }, - // "102-B: Great Bay Temple - Boss" ("102-B: Gyorg's Lair") - { "102-B:\x8Cグレートベイ \x8Dノ シンデン\x8C-ボス-", Select_LoadGame, 0xB800 }, - // "103: Rock Building Temple -Top Side-" ("103: Stone Tower Temple") - { "103:\x8Cロックビル \x8Dノ シンデン-オモテー", Select_LoadGame, 0x2600 }, - // "103-0: Rock Building Temple -Underside-" ("103-0: Stone Tower Temple - Flipped") - { "103-0:\x8Cロックビル \x8Dノ シンデン-ウラー", Select_LoadGame, 0x2A00 }, - // "103-B: Rock Building Temple - Boss" ("103-B: Twinmold's Lair") - { "103-B:\x8Cロックビル \x8Dノ シンデン\x8C-ボス-", Select_LoadGame, 0x6600 }, - // "104: Steppe" ("104: On the Moon") - { "104:\x8Cソウゲン", Select_LoadGame, 0xC800 }, - // "104-0: Last Deku Dungeon" ("104-0: Deku Trial") - { "104-0:\x8Cラスト デク ダンジョン", Select_LoadGame, 0x4E00 }, - // "104-1: Last Goron Dungeon" ("104-1: Goron Trial") - { "104-1:\x8Cラスト ゴロン ダンジョン", Select_LoadGame, 0x7800 }, - // "104-2: Last Zora Dungeon" ("104-2: Zora Trial") - { "104-2:\x8Cラスト ゾーラ ダンジョン", Select_LoadGame, 0x8800 }, - // "104-3: Last Link Dungeon" ("104-3: Link Trial") - { "104-3:\x8Cラスト リンク ダンジョン", Select_LoadGame, 0xC600 }, - // "104-B: Last Dungeon -Boss-" ("104-B: Majora's Lair") - { "104-B:\x8Cラストダンジョン -ボス-", Select_LoadGame, 0x200 }, - // "119: Deku Shrine" ("119: Deku Shrine") - { "119:\x8Cデクナッツ \x8Dノ ホコラ", Select_LoadGame, 0x9E00 }, - // "121: Secret Shrine" ("121: Secret Shrine") - { "121:\x8Dヒミツ ノ ホコラ", Select_LoadGame, 0xBA00 }, - // "122: Opening Dungeon" ("122: Pond Area [Cutscene: Falling of the Cliff]") - { "122:\x8Cオープニング ダンジョン", Select_LoadGame, 0x2E00 }, - // "123: Giants' Chamber" ("123: Giants' Chamber") - { "123:\x8Dキョジン ノ マ", Select_LoadGame, 0xCC00 }, - // "126: Deku Minigame" ("126: Deku Rupee Minigame") - { "126:\x8Cデクナッツ ミニゲーム", Select_LoadGame, 0x3600 }, - // "127-0: Fairy Fountain 0" ("127-0: Fairy Fountain - Clock Town") - { "127-0:\x8Dヨウセイ ノ イズミ 0", Select_LoadGame, 0x4600 }, - // "127-1: Fairy Fountain 1" ("127-1: Fairy Fountain - Woodfall") - { "127-1:\x8Dヨウセイ ノ イズミ 1", Select_LoadGame, 0x4610 }, - // "127-2: Fairy Fountain 2" ("127-2: Fairy Fountain - Snowhead") - { "127-2:\x8Dヨウセイ ノ イズミ 2", Select_LoadGame, 0x4620 }, - // "127-3: Fairy Fountain 3" ("127-3: Fairy Fountain - Great Bay Coast") - { "127-3:\x8Dヨウセイ ノ イズミ 3", Select_LoadGame, 0x4630 }, - // "127-4: Fairy Fountain 4" ("127-4: Fairy Fountain - Ikana Canyon") - { "127-4:\x8Dヨウセイ ノ イズミ 4", Select_LoadGame, 0x4640 }, - // "128: Swamp Spider Manor" ("128: Swamp Spider House") - { "128:\x8Dヌマ ノ クモヤカタ", Select_LoadGame, 0x4800 }, - // "129: Ocean Spider Manor" ("129: Oceanside Spider House") - { "129:\x8Dウミ ノ クモヤカタ", Select_LoadGame, 0x4A00 }, - // "130: Beneath the Graves - Dampe" ("130: Beneath the Graveyard") - { "130:\x8Dハカ ノ シタ-\x8Cダンペイ-", Select_LoadGame, 0x5A00 }, - // "131: Beneath the Well" ("131: Beneath the Well") - { "131:\x8Dイド ノ シタ", Select_LoadGame, 0x9000 }, - // "132: Ghost Hut" (" 132: Ghost Hut") - { "132:\x8Dユウレイゴヤ", Select_LoadGame, 0x9C00 }, - // "133-0: Beneath the Graves 0" ("133-0: Beneath the Graveyard - Part 1") - { "133-0:\x8Dハカ ノ シタ0", Select_LoadGame, 0xA00 }, - // "133-1: Beneath the Graves 1" ("133-1: Beneath the Graveyard - Part 2") - { "133-1:\x8Dハカ ノ シタ1", Select_LoadGame, 0xA10 }, - // "134-0: Secret Grotto 0" ("134-0: Secret Grotto - Four Gossip Stones") - { "134-0:\x8Dカクシアナ 0", Select_LoadGame, 0x1400 }, - // "134-1: Secret Grotto 1" ("134-1: Secret Grotto - Four Gossip Stones, Skulltula") - { "134-1:\x8Dカクシアナ 1", Select_LoadGame, 0x1410 }, - // "134-2: Secret Grotto 2" ("134-2: Secret Grotto - Four Gossip Stones, Water Puddles") - { "134-2:\x8Dカクシアナ 2", Select_LoadGame, 0x1420 }, - // "134-3: Secret Grotto 3" ("134-3: Secret Grotto - Four Gossip Stones, Water Puddle With Bugs") - { "134-3:\x8Dカクシアナ 3", Select_LoadGame, 0x1430 }, - // "134-4: Secret Grotto 4" ("134-4: Secret Grotto - Chest with Blue Rupee, Deku Babas") - { "134-4:\x8Dカクシアナ 4", Select_LoadGame, 0x1440 }, - // "134-5: Secret Grotto 5" ("134-5: Secret Grotto - Hot Spring, Deku Babas, Large Stones") - { "134-5:\x8Dカクシアナ5", Select_LoadGame, 0x1450 }, - // "134-7: Secret Grotto 7" ("134-7: Secret Grotto - Two Dondogos") - { "134-7:\x8Dカクシアナ 7", Select_LoadGame, 0x1470 }, - // "134-9: Secret Grotto 9" ("134-9: Secret Grotto - Tall Grass With Box, Pot, Bugs") - { "134-9:\x8Dカクシアナ 9", Select_LoadGame, 0x1490 }, - // "134-10: Secret Grotto 10" ("134-10: Secret Grotto - Two Cows Surrounded by Grass") - { "134-10:\x8Dカクシアナ10", Select_LoadGame, 0x14A0 }, - // "134-11: Secret Grotto 11" ("134-11: Secret Grotto - Watery Hole Filled with Underwater Babas, Fish") - { "134-11:\x8Dカクシアナ11", Select_LoadGame, 0x14B0 }, - // "134-13: Secret Grotto 13" ("134-13: Secret Grotto - Peahat in Center") - { "134-13:\x8Dカクシアナ13", Select_LoadGame, 0x14D0 }, - // "X 1: SPOT00" ("X 1: Opening [Cutscene: Opening Cutscene]") - { "X 1:SPOT00", Select_LoadGame, 0x1C00 }, - // "Title" ("Title Screen") - { "title", (void*)Select_LoadTitle, 0x0000 }, + // "0: OP Woods for Cutscene Use" (Forest Opening Scene) + { " 0:OP" GFXP_KATAKANA "デモ" GFXP_HIRAGANA "ヨウ シンリン", MapSelect_LoadGame, 0x1C00 }, + + // "0-0: Lost Woods" (Lost Woods) + { " 0-0:" GFXP_HIRAGANA "マヨイ ノ モリ", MapSelect_LoadGame, 0xC400 }, + + // "1: Town Outskirts" (Termina Field) + { " 1:" GFXP_KATAKANA "タウン " GFXP_HIRAGANA "コウガイ", MapSelect_LoadGame, 0x5400 }, + + // "1-0: Astral Observatory" (Astral Observatory) + { " 1-0:" GFXP_HIRAGANA "テンモンカンソクジョ", MapSelect_LoadGame, 0x4C00 }, + + // "1-1: Astral Observatory Telescope" (Astral Observatory - Telescope) + { " 1-1:" GFXP_HIRAGANA "テンモンカンソクジョ デ ボウエンキョウ", MapSelect_LoadGame, 0x54A0 }, + + // "1-2: Ikana Graveyard" (Ikana Canyon Graveyard) + { " 1-2:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ノ ハカバ", MapSelect_LoadGame, 0x8000 }, + + // "2: Romani Ranch" (Romani Ranch) + { " 2:" GFXP_KATAKANA "ロマニー " GFXP_HIRAGANA "ボクジョウ", MapSelect_LoadGame, 0x6400 }, + + // "3: Milk Road" (Milk Road) + { " 3:" GFXP_KATAKANA "ミルクロード", MapSelect_LoadGame, 0x3E00 }, + + // "4: Main Building" ("Ranch House) + { " 4:" GFXP_HIRAGANA "オモヤ", MapSelect_LoadGame, 0x610 }, + + // "5: Cow Shed" (Cow Shed) + { " 5:" GFXP_HIRAGANA "ウシゴヤ", MapSelect_LoadGame, 0x600 }, + + // "6: Cucco Shed" (Cucco Shed) + { " 6:" GFXP_KATAKANA "コッコ " GFXP_HIRAGANA "ゴヤ", MapSelect_LoadGame, 0x7E00 }, + + // "7: Dog Racing Area" (Doggy Racetrack) + { " 7:" GFXP_KATAKANA "ドッグレース" GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, 0x7C00 }, + + // "8: Gorman Track" (Gorman Track) + { " 8:" GFXP_KATAKANA "ゴーマン トラック", MapSelect_LoadGame, 0xCE00 }, + + // "10: Mountain Village -Winter-" (Mountain Village - Winter) + { " 10:" GFXP_HIRAGANA "ヤマザト -フユ-", MapSelect_LoadGame, 0x9A00 }, + + // "10-0: Mountain Village -Spring-" (Mountain Village - Spring) + { " 10-0:" GFXP_HIRAGANA "ヤマザト -ハル-", MapSelect_LoadGame, 0xAE00 }, + + // "10-1: Mountain Village Blacksmith" (Mountain Smithy) + { " 10-1:" GFXP_HIRAGANA "ヤマザト ノ カジヤ", MapSelect_LoadGame, 0x5200 }, + + // "11: Goron Village -Winter-" (Goron Village - Winter) + { " 11:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -フユ-", MapSelect_LoadGame, 0x9400 }, + + // "11-0: Goron Village -Spring-" (Goron Village - Spring) + { " 11-0:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -ハル-", MapSelect_LoadGame, 0x8A00 }, + + // "11-1: Goron Shrine" (Goron Shrine) + { " 11-1:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ ホコラ", MapSelect_LoadGame, 0x5E00 }, + + // "11-2: Lone Peak Shrine" (Lone Peak Shrine) + { " 11-2:" GFXP_HIRAGANA "ハナレヤマ ノ ホコラ", MapSelect_LoadGame, 0x1500 }, + + // "11-3: Goron Shop" (Goron Shop) + { " 11-3:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x7400 }, + + // "12: Snowhead" (Snowhead) + { " 12:" GFXP_KATAKANA "スノーヘッド", MapSelect_LoadGame, 0xB200 }, + + // "13: Blizzard Path" (Path to Goron Village - Part 1) + { " 13:" GFXP_HIRAGANA "フブキ ノ ミチ", MapSelect_LoadGame, 0x3200 }, + + // "14: Snowball Path" (Path to Goron Village - Part 2) + { " 14:" GFXP_HIRAGANA "ユキダマ ノ ミチ", MapSelect_LoadGame, 0xB000 }, + + // "15: Goron Racetrack" (Goron Racetrack) + { " 15:" GFXP_KATAKANA "ゴロンレース " GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, 0xD000 }, + + // "16: Goron Grave" (Darmani's Grave) + { " 16:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ハカ", MapSelect_LoadGame, 0x9600 }, + + // "17: Snow Field Battle -Winter-" (Path to Goron Village - Winter) + { " 17:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-フユ-", MapSelect_LoadGame, 0xB400 }, + + // "17-0: Snow Field Battle -Spring-" (Path to Goron Village - Spring) + { " 17-0:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-ハル-", MapSelect_LoadGame, 0xB600 }, + + // "20: Swampland" (Southern Swamp) + { " 20:" GFXP_HIRAGANA "ヌマチ", MapSelect_LoadGame, 0x8400 }, + + // "20-0: Swampland - Afterwards" (Southern Swamp - After Odolwa) + { " 20-0:" GFXP_HIRAGANA "ヌマチ ソノゴ", MapSelect_LoadGame, 0xC00 }, + + // "20-1: Swamp Tourist Information" (Tourist Information) + { " 20-1:" GFXP_HIRAGANA "ヌマ ノ カンコウアンナイ", MapSelect_LoadGame, 0xA800 }, + + // "20-2: Magic Hags' Potion Shop" (Magic Hags' Potion Shop) + { " 20-2:" GFXP_HIRAGANA "マホウオババ ノ クスリヤ", MapSelect_LoadGame, 0x400 }, + + // "21: Wood Mountain" (Woodfall) + { " 21:" GFXP_KATAKANA "ウッドマウンテン", MapSelect_LoadGame, 0x8600 }, + + // "21-0: Deku Princess's Prison" (Deku Princess's Prison Cutscene: Tatl Apologizes) + { " 21-0:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "ヒメ ノ ロウヤ", MapSelect_LoadGame, 0x3010 }, + + // "22: Deku Castle" (Deku Palace) + { " 22:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ シロ", MapSelect_LoadGame, 0x5000 }, + + // "22-0: Boe Hole 0" (Deku Palace Grotto 0 - Deku Baba & Butterflies, Entrance 1) + { " 22-0:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ0", MapSelect_LoadGame, 0x1460 }, + + // "22-1: Boe Hole 1" (Deku Palace Grotto 1 - Deku Baba & Butterflies, Entrance 2) + { " 22-1:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ1", MapSelect_LoadGame, 0x14E0 }, + + // "22-2: Boe Hole 2" (Deku Palace Grotto 2 - Skullwalltula Wall, Lower Entrance) + { " 22-2:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ2", MapSelect_LoadGame, 0x1480 }, + + // "22-3: Boe Hole 3" (Deku Palace Grotto 3 - Skullwalltula Wall, Upper Entrance) + { " 22-3:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ3", MapSelect_LoadGame, 0x14F0 }, + + // "22-4: Boe Hole 4" (Deku Palace Grotto 4 - Bean Seller) + { " 22-4:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ4", MapSelect_LoadGame, 0x14C0 }, + + // "24: Beast Path" (Road to Swamp) + { " 24:" GFXP_HIRAGANA "ケモノミチ", MapSelect_LoadGame, 0x7A00 }, + + // "24-0: Forest Shooting Gallery" (Swamp Shooting Gallery) + { " 24-0:" GFXP_HIRAGANA "モリ ノ シャテキジョウ", MapSelect_LoadGame, 0x4200 }, + + // "25: Deku King's Chamber" (Deku Palace Throne Room) + { " 25:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "オウ ノ マ", MapSelect_LoadGame, 0x7600 }, + + // "26: Woods of Mystery" (Woods of Mystery) + { " 26:" GFXP_HIRAGANA "フシギ ノ モリ", MapSelect_LoadGame, 0xC200 }, + + // "30: Great Bay Coast" (Great Bay Coast - Entrance Area) + { " 30:" GFXP_KATAKANA "グレートベイ" GFXP_HIRAGANA " ノ カイガン", MapSelect_LoadGame, 0x6800 }, + + // "30-0: Ocean Laboratory" (Marine Research Lab) + { " 30-0:" GFXP_HIRAGANA "カイヨウ ケンキュウジョ", MapSelect_LoadGame, 0x5800 }, + + // "30-1: Fisherman's House" (Fisherman's Hut) + { " 30-1:" GFXP_HIRAGANA "リョウシ ノ イエ", MapSelect_LoadGame, 0x7200 }, + + // "30-2: Pointed Rock" (Twin Pillars) + { " 30-2:" GFXP_HIRAGANA "トンガリ イワ", MapSelect_LoadGame, 0x4400 }, + + // "31: Cape" (Great Bay Coast - River Area) + { " 31:" GFXP_HIRAGANA "ミサキ", MapSelect_LoadGame, 0x6A00 }, + + // "32: Outside of Pirates' Fortress" (Pirates' Fortress - Exterior) + { " 32:" GFXP_HIRAGANA "カイゾクノトリデマエ", MapSelect_LoadGame, 0x7000 }, + + // "32-0: Pirates' Fortress" (Pirates' Fortress - Courtyard) + { " 32-0:" GFXP_HIRAGANA "カイゾクノトリデ", MapSelect_LoadGame, 0x2200 }, + + // "32-1: Pirates' Fortress - Telescope" (Pirates' Fortress - Secret Entrance, Looking Through Telescope) + { " 32-1:" GFXP_HIRAGANA "カイゾクノトリデ ボウエンキョウ", MapSelect_LoadGame, 0x22A0 }, + + // "32-2: Pirates' Fortress - Interior 0" (Pirates' Fortress - Throne Room) + { " 32-2:" GFXP_HIRAGANA "カイゾクノトリデナイブ0", MapSelect_LoadGame, 0x4000 }, + + // "32-3: Pirates' Fortress - Interior 1" (Pirates' Fortress - View of Throne Room, Wasp Nest) + { " 32-3:" GFXP_HIRAGANA "カイゾクノトリデナイブ1", MapSelect_LoadGame, 0x4010 }, + + // "32-4: Pirates' Fortress - Interior 2" (Pirates' Fortress - Tempting Treasure Chest, Leading to 32-5) + { " 32-4:" GFXP_HIRAGANA "カイゾクノトリデナイブ2", MapSelect_LoadGame, 0x4020 }, + + // "32-5: Pirates' Fortress - Interior 3" (Pirates' Fortress - Zora Egg Room, One Shell Blade) + { " 32-5:" GFXP_HIRAGANA "カイゾクノトリデナイブ3", MapSelect_LoadGame, 0x4030 }, + + // "32-6: Pirates' Fortress - Interior 4" (Pirates' Fortress - Oil Drum Room, Leading to 32-7) + { " 32-6:" GFXP_HIRAGANA "カイゾクノトリデナイブ4", MapSelect_LoadGame, 0x4040 }, + + // "32-7: Pirates' Fortress - Interior 5" (Pirates' Fortress - Zora Egg Room, One Shell Blade) + { " 32-7:" GFXP_HIRAGANA "カイゾクノトリデナイブ5", MapSelect_LoadGame, 0x4050 }, + + // "32-8: Pirates' Fortress - Interior 6" (Pirates' Fortress - Fenced Indoor Walkway, Leading to 32-9) + { " 32-8:" GFXP_HIRAGANA "カイゾクノトリデナイブ6", MapSelect_LoadGame, 0x4060 }, + + // "32-9: Pirates' Fortress - Interior 7" (Pirates' Fortress - Zora Egg Room, One Desbreko & Treasure Chest) + { " 32-9:" GFXP_HIRAGANA "カイゾクノトリデナイブ7", MapSelect_LoadGame, 0x4070 }, + + // "32-10: Pirates' Fortress - Interior 8" (Pirates' Fortress - End of Secret Entrance: Telescope Room) + { " 32-10:" GFXP_HIRAGANA "カイゾクノトリデナイブ8", MapSelect_LoadGame, 0x4080 }, + + // "32-11: Pirates' Fortress - Interior 9" (Pirates' Fortress - Start of Secret Entrance) + { " 32-11:" GFXP_HIRAGANA "カイゾクノトリデナイブ9", MapSelect_LoadGame, 0x4090 }, + + // "33: Zora Shrine" (Zora Hall) + { " 33:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, 0x6000 }, + + // "33-0: Zora Shop" (Zora Shop) + { " 33-0:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x9250 }, + + // "33-1: Zora Waiting Room" (Mikau & Tijo's Room) + { " 33-1:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ヒカエシツ", MapSelect_LoadGame, 0x9200 }, + + // "34: Great Bay" (Great Bay Cutscene: Pirates Approach Temple) + { " 34:" GFXP_KATAKANA "グレートベイ", MapSelect_LoadGame, 0xBE00 }, + + // "35: Mountain Stream Above Falls" (Waterfall Rapids) + { " 35:" GFXP_HIRAGANA "タキウエ ノ ケイリュウ", MapSelect_LoadGame, 0x8E00 }, + + // "40: Rock Building Shaft" (Stone Tower) + { " 40:" GFXP_KATAKANA "ロックビル" GFXP_HIRAGANA " ノ タテアナ", MapSelect_LoadGame, 0xAA00 }, + + // "40-0: Heaven & Earth Are Overturned" (Stone Tower Cutscene: Tower is Flipped) + { " 40-0:" GFXP_HIRAGANA "テンチ ギャクテン", MapSelect_LoadGame, 0xAC00 }, + + // "41: Road to Ikana" (Road to Ikana) + { " 41:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ヘノ ミチ", MapSelect_LoadGame, 0xA000 }, + + // "42: Ancient Castle of Ikana" (Ancient Castle of Ikana) + { " 42:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " コジョウ", MapSelect_LoadGame, 0x3400 }, + + // "42-0: Ancient Castle of Ikana - Interior" (Ancient Castle of Ikana - Interior) + { " 42-0:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " ノ コジョウ ナイブ", MapSelect_LoadGame, 0x3430 }, + + // "42-B: Ancient Castle of Ikana - Boss Room" (Ikana King's Throne) + { " 42-B:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " ノ コジョウ " GFXP_KATAKANA "ボス" GFXP_HIRAGANA "ベヤ", + MapSelect_LoadGame, 0xA600 }, + + // "43: Ikana Canyon" (Ikana Canyon) + { " 43:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク", MapSelect_LoadGame, 0x2000 }, + + // "43-0: Ikana Canyon Cave" (Sharp's Cave) + { " 43-0:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク ドウクツ", MapSelect_LoadGame, 0x20E0 }, + + // "43-1: Secom's House" (Sakon's Hideout) + { " 43-1:" GFXP_KATAKANA "セコム " GFXP_HIRAGANA "ノ イエ", MapSelect_LoadGame, 0x9800 }, + + // "43-2: Music Box House" (Music Box House) + { " 43-2:" GFXP_KATAKANA "オルゴール ハウス", MapSelect_LoadGame, 0xA400 }, + + // "50: Clock Town -East-" (East Clock Town) + { " 50:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ヒガシ-", MapSelect_LoadGame, 0xD200 }, + + // "50-0: Town Target Range" (Shooting Gallery) + { " 50-0:" GFXP_HIRAGANA "マチ ノ シャテキジョウ", MapSelect_LoadGame, 0x3A00 }, + + // "50-1: Honey and Darling's Shop" (Honey & Darling's Shop) + { " 50-1:" GFXP_KATAKANA "ハニー アンド ダーリン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x800 }, + + // "50-2: Treasure Chest Shop" (Treasure Chest Shop) + { " 50-2:" GFXP_HIRAGANA "タカラバコヤ", MapSelect_LoadGame, 0x2800 }, + + // "50-3: Pots 'n' Pans Inn" (Stockpot Inn) + { " 50-3:" GFXP_KATAKANA "ナベ" GFXP_HIRAGANA "カマ テイ", MapSelect_LoadGame, 0xBC00 }, + + // "50-4: Mayor's House" (The Mayor's Residence) + { " 50-4:" GFXP_HIRAGANA "チョウチョウ ノ イエ", MapSelect_LoadGame, 0 }, + + // "50-5: Milk Bar" (Milk Bar) + { " 50-5:" GFXP_KATAKANA "ミルクバー", MapSelect_LoadGame, 0x2400 }, + + // "51: Clock Town -West-" (West Clock Town) + { " 51:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ニシ-", MapSelect_LoadGame, 0xD400 }, + + // "51-0: Bomb Shop" (Bomb Shop) + { " 51-0:" GFXP_HIRAGANA "バクダン ヤ", MapSelect_LoadGame, 0xCA00 }, + + // "51-1: Maniac Mart" (Curiosity Shop) + { " 51-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ", MapSelect_LoadGame, 0xE00 }, + + // "51-2: General Store" (Trading Post) + { " 51-2:" GFXP_HIRAGANA "ザッカ ヤ", MapSelect_LoadGame, 0x6200 }, + + // "51-3: Sword Dojo" (Swordsman's School) + { " 51-3:" GFXP_HIRAGANA "ケンドウジョウ", MapSelect_LoadGame, 0xA200 }, + + // "51-4: Post House" (Post Office) + { " 51-4:" GFXP_HIRAGANA "ポストハウス", MapSelect_LoadGame, 0x5600 }, + + // "51-5: Lottery Shop" (Lottery Shop) + { " 51-5:" GFXP_HIRAGANA "タカラクジヤ", MapSelect_LoadGame, 0x6C00 }, + + // "52: Clock Town -North-" (North Clock Town) + { " 52:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-キタ-", MapSelect_LoadGame, 0xD600 }, + + // "53: Clocktown -South-" (South Clock Town) + { " 53:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ミナミ-", MapSelect_LoadGame, 0xD800 }, + + // "53-0: Clock Tower Interior" (Clock Tower Interior) + { " 53-0:" GFXP_HIRAGANA "トケイトウナイブ", MapSelect_LoadGame, 0xC000 }, + + // "54: Clock Tower Rooftop" (Clock Tower Rooftop) + { " 54:" GFXP_HIRAGANA "トケイトウ オクジョウ", MapSelect_LoadGame, 0x2C00 }, + + // "55: Laundry Area" (Laundry Pool) + { " 55:" GFXP_HIRAGANA "センタクジョウ", MapSelect_LoadGame, 0xDA00 }, + + // "55-0: Maniac Mart - Rear Entrance" (Curiosity Shop - Back Room) + { " 55-0:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ウラグチ", MapSelect_LoadGame, 0xE10 }, + + // "55-1: Maniac Mart - Peephole" (Curiosity Shop Back Room - Peephole) + { " 55-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ノゾキアナ", MapSelect_LoadGame, 0xE20 }, + + // "100: Wood Mountain Temple" (Woodfall Temple) + { "100:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x3000 }, + + // "100-B: Wood Mountain Temple - Boss" (Odolwa's Lair) + { "100-B:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x3800 }, + + // "101: Snowhead Temple" (Snowhead Temple) + { "101:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x3C00 }, + + // "101-B: Snowhead Temple - Boss" (Goht's Lair) + { "101-B:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x8200 }, + + // "102: Great Bay Temple" (Great Bay Temple) + { "102:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x8C00 }, + + // "102-B: Great Bay Temple - Boss" (Gyorg's Lair) + { "102-B:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0xB800 }, + + // "103: Rock Building Temple -Top Side-" (Stone Tower Temple) + { "103:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-オモテー", MapSelect_LoadGame, 0x2600 }, + + // "103-0: Rock Building Temple -Underside-" (Stone Tower Temple - Flipped) + { "103-0:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-ウラー", MapSelect_LoadGame, 0x2A00 }, + + // "103-B: Rock Building Temple - Boss" (Twinmold's Lair) + { "103-B:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x6600 }, + + // "104: Steppe" (On the Moon) + { "104:" GFXP_KATAKANA "ソウゲン", MapSelect_LoadGame, 0xC800 }, + + // "104-0: Last Deku Dungeon" (Deku Trial) + { "104-0:" GFXP_KATAKANA "ラスト デク ダンジョン", MapSelect_LoadGame, 0x4E00 }, + + // "104-1: Last Goron Dungeon" (Goron Trial) + { "104-1:" GFXP_KATAKANA "ラスト ゴロン ダンジョン", MapSelect_LoadGame, 0x7800 }, + + // "104-2: Last Zora Dungeon" (Zora Trial) + { "104-2:" GFXP_KATAKANA "ラスト ゾーラ ダンジョン", MapSelect_LoadGame, 0x8800 }, + + // "104-3: Last Link Dungeon" (Link Trial) + { "104-3:" GFXP_KATAKANA "ラスト リンク ダンジョン", MapSelect_LoadGame, 0xC600 }, + + // "104-B: Last Dungeon -Boss-" (Majora's Lair) + { "104-B:" GFXP_KATAKANA "ラストダンジョン -ボス-", MapSelect_LoadGame, 0x200 }, + + // "119: Deku Shrine" (Deku Shrine) + { "119:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, 0x9E00 }, + + // "121: Secret Shrine" (Secret Shrine) + { "121:" GFXP_HIRAGANA "ヒミツ ノ ホコラ", MapSelect_LoadGame, 0xBA00 }, + + // "122: Opening Dungeon" (Pond Area Cutscene: Falling of the Cliff) + { "122:" GFXP_KATAKANA "オープニング ダンジョン", MapSelect_LoadGame, 0x2E00 }, + + // "123: Giants' Chamber" (Giants' Chamber) + { "123:" GFXP_HIRAGANA "キョジン ノ マ", MapSelect_LoadGame, 0xCC00 }, + + // "126: Deku Minigame" (Deku Rupee Minigame) + { "126:" GFXP_KATAKANA "デクナッツ ミニゲーム", MapSelect_LoadGame, 0x3600 }, + + // "127-0: Fairy Fountain 0" (Fairy Fountain - Clock Town) + { "127-0:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 0", MapSelect_LoadGame, 0x4600 }, + + // "127-1: Fairy Fountain 1" (Fairy Fountain - Woodfall) + { "127-1:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 1", MapSelect_LoadGame, 0x4610 }, + + // "127-2: Fairy Fountain 2" (Fairy Fountain - Snowhead) + { "127-2:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 2", MapSelect_LoadGame, 0x4620 }, + + // "127-3: Fairy Fountain 3" (Fairy Fountain - Great Bay Coast) + { "127-3:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 3", MapSelect_LoadGame, 0x4630 }, + + // "127-4: Fairy Fountain 4" (Fairy Fountain - Ikana Canyon) + { "127-4:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 4", MapSelect_LoadGame, 0x4640 }, + + // "128: Swamp Spider Manor" (Swamp Spider House) + { "128:" GFXP_HIRAGANA "ヌマ ノ クモヤカタ", MapSelect_LoadGame, 0x4800 }, + + // "129: Ocean Spider Manor" (Oceanside Spider House) + { "129:" GFXP_HIRAGANA "ウミ ノ クモヤカタ", MapSelect_LoadGame, 0x4A00 }, + + // "130: Beneath the Graves - Dampe" (Beneath the Graveyard) + { "130:" GFXP_HIRAGANA "ハカ ノ シタ-" GFXP_KATAKANA "ダンペイ-", MapSelect_LoadGame, 0x5A00 }, + + // "131: Beneath the Well" (Beneath the Well) + { "131:" GFXP_HIRAGANA "イド ノ シタ", MapSelect_LoadGame, 0x9000 }, + + // "132: Ghost Hut" (Ghost Hut) + { "132:" GFXP_HIRAGANA "ユウレイゴヤ", MapSelect_LoadGame, 0x9C00 }, + + // "133-0: Beneath the Graves 0" (Beneath the Graveyard - Part 1) + { "133-0:" GFXP_HIRAGANA "ハカ ノ シタ0", MapSelect_LoadGame, 0xA00 }, + + // "133-1: Beneath the Graves 1" (Beneath the Graveyard - Part 2) + { "133-1:" GFXP_HIRAGANA "ハカ ノ シタ1", MapSelect_LoadGame, 0xA10 }, + + // "134-0: Secret Grotto 0" (Secret Grotto - Four Gossip Stones) + { "134-0:" GFXP_HIRAGANA "カクシアナ 0", MapSelect_LoadGame, 0x1400 }, + + // "134-1: Secret Grotto 1" (Secret Grotto - Four Gossip Stones, Skulltula) + { "134-1:" GFXP_HIRAGANA "カクシアナ 1", MapSelect_LoadGame, 0x1410 }, + + // "134-2: Secret Grotto 2" (Secret Grotto - Four Gossip Stones, Water Puddles) + { "134-2:" GFXP_HIRAGANA "カクシアナ 2", MapSelect_LoadGame, 0x1420 }, + + // "134-3: Secret Grotto 3" (Secret Grotto - Four Gossip Stones, Water Puddle With Bugs) + { "134-3:" GFXP_HIRAGANA "カクシアナ 3", MapSelect_LoadGame, 0x1430 }, + + // "134-4: Secret Grotto 4" (Secret Grotto - Chest with Blue Rupee, Deku Babas) + { "134-4:" GFXP_HIRAGANA "カクシアナ 4", MapSelect_LoadGame, 0x1440 }, + + // "134-5: Secret Grotto 5" (Secret Grotto - Hot Spring, Deku Babas, Large Stones) + { "134-5:" GFXP_HIRAGANA "カクシアナ5", MapSelect_LoadGame, 0x1450 }, + + // "134-7: Secret Grotto 7" (Secret Grotto - Two Dondogos) + { "134-7:" GFXP_HIRAGANA "カクシアナ 7", MapSelect_LoadGame, 0x1470 }, + + // "134-9: Secret Grotto 9" (Secret Grotto - Tall Grass With Box, Pot, Bugs) + { "134-9:" GFXP_HIRAGANA "カクシアナ 9", MapSelect_LoadGame, 0x1490 }, + + // "134-10: Secret Grotto 10" (Secret Grotto - Two Cows Surrounded by Grass) + { "134-10:" GFXP_HIRAGANA "カクシアナ10", MapSelect_LoadGame, 0x14A0 }, + + // "134-11: Secret Grotto 11" (Secret Grotto - Watery Hole Filled with Underwater Babas, Fish) + { "134-11:" GFXP_HIRAGANA "カクシアナ11", MapSelect_LoadGame, 0x14B0 }, + + // "134-13: Secret Grotto 13" (Secret Grotto - Peahat in Center) + { "134-13:" GFXP_HIRAGANA "カクシアナ13", MapSelect_LoadGame, 0x14D0 }, + + // "X 1: SPOT00" (Opening Cutscene) + { "X 1:SPOT00", MapSelect_LoadGame, 0x1C00 }, + + // "Title" (Title Screen) + { "title", (void*)MapSelect_LoadTitle, 0x0000 }, }; -void Select_UpdateMenu(SelectContext* this) { +void MapSelect_UpdateMenu(MapSelectState* this) { s32 playerForm; Input* controller1 = CONTROLLER1(&this->state); s32 stickY; @@ -544,7 +684,7 @@ void Select_UpdateMenu(SelectContext* this) { this->currentScene++; this->currentScene = (this->currentScene + this->count) % this->count; - if (this->currentScene == ((this->topDisplayedScene + 19 + this->count) % this->count)) { + if (this->currentScene == ((this->topDisplayedScene + this->count + 19) % this->count)) { this->topDisplayedScene++; this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; } @@ -553,6 +693,7 @@ void Select_UpdateMenu(SelectContext* this) { if (this->verticalInputAccumulator > 7) { this->verticalInput = 0; this->verticalInputAccumulator = 0; + if (this->currentScene == this->topDisplayedScene) { this->topDisplayedScene -= 2; this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; @@ -560,6 +701,7 @@ void Select_UpdateMenu(SelectContext* this) { this->currentScene--; this->currentScene = (this->currentScene + this->count) % this->count; + if (this->currentScene == ((this->topDisplayedScene + this->count) % this->count)) { this->topDisplayedScene--; this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; @@ -576,6 +718,7 @@ void Select_UpdateMenu(SelectContext* this) { if (this->timerUp != 0) { this->timerUp--; } + if (this->timerUp == 0) { this->lockUp = false; } @@ -583,19 +726,20 @@ void Select_UpdateMenu(SelectContext* this) { if (this->timerDown != 0) { this->timerDown--; } + if (this->timerDown == 0) { this->lockDown = false; } } -void Select_PrintMenu(SelectContext* this, GfxPrint* printer) { +void MapSelect_PrintMenu(MapSelectState* this, GfxPrint* printer) { s32 i; GfxPrint_SetColor(printer, 255, 155, 150, 255); GfxPrint_SetPos(printer, 12, 2); GfxPrint_Printf(printer, "ZELDA MAP SELECT"); - GfxPrint_SetColor(printer, 255, 255, 255, 255); + for (i = 0; i < 20; i++) { s32 sceneIndex; char* sceneName; @@ -620,62 +764,58 @@ void Select_PrintMenu(SelectContext* this, GfxPrint* printer) { GfxPrint_Printf(printer, "OPT=%d", this->opt); } -// clang-format off static const char* sLoadingMessages[] = { - // "Please wait a minute", - "\x8Dシバラクオマチクダサイ", - // "Hold on a sec", - "\x8Dチョット マッテネ", - // "Wait a moment", - "\x8Cウェイト ア モーメント", - // "Loading", - "\x8Cロード\x8Dチュウ", - // "Now working", - "\x8Dナウ ワーキング", - // "Now creating", - "\x8Dイマ ツクッテマス", - // "It's not broken", - "\x8Dコショウジャナイヨ", - // "Coffee Break", - "\x8Cコーヒー ブレイク", - // "Please set B side", - "\x8C" "Bメンヲセットシテクダサイ", - // "Be patient, now", - "\x8Dジット\x8Cガマン\x8Dノ\x8Cコ\x8Dデアッタ", - // "Please wait just a minute", - "\x8Dイマシバラクオマチクダサイ", - // "Don't worry, don't worry. Take a break, take a break", - "\x8Dアワテナイアワテナイ。ヒトヤスミヒトヤスミ。", + // "Please wait a minute" + GFXP_HIRAGANA "シバラクオマチクダサイ", + // "Hold on a sec" + GFXP_HIRAGANA "チョット マッテネ", + // "Wait a moment" + GFXP_KATAKANA "ウェイト ア モーメント", + // "Loading" + GFXP_KATAKANA "ロード" GFXP_HIRAGANA "チュウ", + // "Now working" + GFXP_HIRAGANA "ナウ ワーキング", + // "Now creating" + GFXP_HIRAGANA "イマ ツクッテマス", + // "It's not broken" + GFXP_HIRAGANA "コショウジャナイヨ", + // "Coffee Break" + GFXP_KATAKANA "コーヒー ブレイク", + // "Please set B side" + GFXP_KATAKANA "Bメンヲセットシテクダサイ", + // "Be patient, now" + GFXP_HIRAGANA "ジット" GFXP_KATAKANA "ガマン" GFXP_HIRAGANA "ノ" GFXP_KATAKANA "コ" GFXP_HIRAGANA "デアッタ", + // "Please wait just a minute" + GFXP_HIRAGANA "イマシバラクオマチクダサイ", + // "Don't worry, don't worry. Take a break, take a break." + GFXP_HIRAGANA "アワテナイアワテナイ。ヒトヤスミヒトヤスミ。", }; -// clang-format on -void Select_PrintLoadingMessage(SelectContext* this, GfxPrint* printer) { - s32 index; +void MapSelect_PrintLoadingMessage(MapSelectState* this, GfxPrint* printer) { + s32 randomMsg; GfxPrint_SetPos(printer, 10, 15); GfxPrint_SetColor(printer, 255, 255, 255, 255); - index = Rand_ZeroOne() * ARRAY_COUNT(sLoadingMessages); - GfxPrint_Printf(printer, "%s", sLoadingMessages[index]); + randomMsg = Rand_ZeroOne() * ARRAY_COUNT(sLoadingMessages); + GfxPrint_Printf(printer, "%s", sLoadingMessages[randomMsg]); } -// clang-format off // Second column is unused static const char* sFormLabel[][2] = { // "17 (Adult)" // 17 (Daitetsujin) - {"\x8D""17(オトナ)", "\x8D""17(ダイテツジン)"}, + { GFXP_HIRAGANA "17(オトナ)", GFXP_HIRAGANA "17(ダイテツジン)" }, // "30 (Goron)" // 30 (Ice Cream -1) - {"\x8C""30(ゴロン)", "\x8C""30(アイスクリーム-1)"}, + { GFXP_KATAKANA "30(ゴロン)", GFXP_KATAKANA "30(アイスクリーム-1)" }, // "78 (Zora)" // 78 (Carmen +1) - {"\x8C""78(ゾーラ)", "\x8C""78(カルメン+1)"}, + { GFXP_KATAKANA "78(ゾーラ)", GFXP_KATAKANA "78(カルメン+1)" }, // "12 (Deku)" // 12 (Majestic) - {"\x8C""12(デクナッツ)", "\x8C""12(マジェスティック)"}, + { GFXP_KATAKANA "12(デクナッツ)", GFXP_KATAKANA "12(マジェスティック)" }, // "5 (Child)" // 5 (NTT Kodomo) - {"\x8D""5(コドモ)", "\x8C""5(NTTコドモ)"}, + { GFXP_HIRAGANA "5(コドモ)", GFXP_KATAKANA "5(NTTコドモ)" }, }; -// clang-format on -void Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 playerForm) { +void MapSelect_PrintAgeSetting(MapSelectState* this, GfxPrint* printer, s32 playerForm) { s32 pad; const char* age; const char*(*ageTemp)[2]; @@ -706,12 +846,12 @@ void Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 playerFo GfxPrint_Printf(printer, "Age:%s", age); } else { // clang-format off - GfxPrint_Printf(printer, "Age:" "???" "(%d)", playerForm); + GfxPrint_Printf(printer, "Age:???" "(%d)", playerForm); // clang-format on } } -void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csIndex) { +void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 csIndex) { const char* stage; const char* day; @@ -723,21 +863,21 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI case 0: // clang-format off // "Afternoon-jara" - gSaveContext.save.time = CLOCK_TIME(12, 0); stage = "\x8Dオヒル\x8Cジャラ"; + gSaveContext.save.time = CLOCK_TIME(12, 0); stage = GFXP_HIRAGANA "オヒル" GFXP_KATAKANA "ジャラ"; // clang-format on break; case 0x8000: // clang-format off // "Morning-jara" - gSaveContext.save.time = CLOCK_TIME(6, 0) + 1; stage = "\x8Dアサ \x8Cジャラ"; + gSaveContext.save.time = CLOCK_TIME(6, 0) + 1; stage = GFXP_HIRAGANA "アサ " GFXP_KATAKANA "ジャラ"; // clang-format on break; case 0x8800: gSaveContext.save.time = CLOCK_TIME(18, 1); // "Night-jara" - stage = "\x8Dヨル \x8Cジャラ"; + stage = GFXP_HIRAGANA "ヨル " GFXP_KATAKANA "ジャラ"; break; case 0xFFF0: @@ -746,42 +886,52 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI gSaveContext.save.time = CLOCK_TIME(12, 0); stage = "デモ00"; // clang-format on break; + case 0xFFF1: // "Cutscene 01" stage = "デモ01"; break; + case 0xFFF2: // "Cutscene 02" stage = "デモ02"; break; + case 0xFFF3: // "Cutscene 03" stage = "デモ03"; break; + case 0xFFF4: // "Cutscene 04" stage = "デモ04"; break; + case 0xFFF5: // "Cutscene 05" stage = "デモ05"; break; + case 0xFFF6: // "Cutscene 06" stage = "デモ06"; break; + case 0xFFF7: // "Cutscene 07" stage = "デモ07"; break; + case 0xFFF8: // "Cutscene 08" stage = "デモ08"; break; + case 0xFFF9: // "Cutscene 09" stage = "デモ09"; break; + case 0xFFFA: // "Cutscene 0A" stage = "デモ0A"; @@ -791,8 +941,8 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI stage = "???"; break; } - gSaveContext.environmentTime = gSaveContext.save.time; - GfxPrint_Printf(printer, "Stage:\x8C%s", stage); + gSaveContext.skyboxTime = gSaveContext.save.time; + GfxPrint_Printf(printer, "Stage:" GFXP_KATAKANA "%s", stage); GfxPrint_SetPos(printer, 23, 25); GfxPrint_SetColor(printer, 255, 255, 55, 255); @@ -800,31 +950,35 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI switch (gSaveContext.save.day) { case 1: // "The First Day" - day = "\x8Dサイショノヒ"; + day = GFXP_HIRAGANA "サイショノヒ"; break; + case 2: // "The Next Day" - day = "\x8Dツギノヒ"; + day = GFXP_HIRAGANA "ツギノヒ"; break; + case 3: // "The Final Day" - day = "\x8Dサイゴノヒ"; + day = GFXP_HIRAGANA "サイゴノヒ"; break; + case 4: // "Clear Day" - day = "\x8Dクリアーノヒ"; + day = GFXP_HIRAGANA "クリアーノヒ"; break; + default: gSaveContext.save.day = 1; // "The First Day" - day = "\x8Dサイショノヒ"; + day = GFXP_HIRAGANA "サイショノヒ"; break; } - GfxPrint_Printf(printer, "Day:\x8D%s", day); + GfxPrint_Printf(printer, "Day:" GFXP_HIRAGANA "%s", day); } -void Select_DrawMenu(SelectContext* this) { +void MapSelect_DrawMenu(MapSelectState* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; GfxPrint* printer; @@ -836,9 +990,9 @@ void Select_DrawMenu(SelectContext* this) { GfxPrint_Init(printer); GfxPrint_Open(printer, POLY_OPA_DISP); - Select_PrintMenu(this, printer); - Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.save.playerForm)); - Select_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutscene)); + MapSelect_PrintMenu(this, printer); + MapSelect_PrintAgeSetting(this, printer, ((void)0, gSaveContext.save.playerForm)); + MapSelect_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutscene)); POLY_OPA_DISP = GfxPrint_Close(printer); GfxPrint_Destroy(printer); @@ -846,7 +1000,7 @@ void Select_DrawMenu(SelectContext* this) { CLOSE_DISPS(gfxCtx); } -void Select_DrawLoadingScreen(SelectContext* this) { +void MapSelect_DrawLoadingScreen(MapSelectState* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; GfxPrint printer; @@ -857,7 +1011,7 @@ void Select_DrawLoadingScreen(SelectContext* this) { GfxPrint_Init(&printer); GfxPrint_Open(&printer, POLY_OPA_DISP); - Select_PrintLoadingMessage(this, &printer); + MapSelect_PrintLoadingMessage(this, &printer); POLY_OPA_DISP = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); @@ -865,7 +1019,7 @@ void Select_DrawLoadingScreen(SelectContext* this) { CLOSE_DISPS(gfxCtx); } -void Select_Draw(SelectContext* this) { +void MapSelect_Draw(MapSelectState* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; func_8012CF0C(gfxCtx, true, true, 0, 0, 0); @@ -873,28 +1027,28 @@ void Select_Draw(SelectContext* this) { SET_FULLSCREEN_VIEWPORT(&this->view); View_RenderView(&this->view, 0xF); if (!this->state.running) { - Select_DrawLoadingScreen(this); + MapSelect_DrawLoadingScreen(this); } else { - Select_DrawMenu(this); + MapSelect_DrawMenu(this); } } -void Select_Main(GameState* thisx) { - SelectContext* this = (SelectContext*)thisx; +void MapSelect_Main(GameState* thisx) { + MapSelectState* this = (MapSelectState*)thisx; - Select_UpdateMenu(this); - Select_Draw(this); + MapSelect_UpdateMenu(this); + MapSelect_Draw(this); } -void Select_Destroy(GameState* thisx) { +void MapSelect_Destroy(GameState* thisx) { ShrinkWindow_Destroy(); } -void Select_Init(GameState* thisx) { - SelectContext* this = (SelectContext*)thisx; +void MapSelect_Init(GameState* thisx) { + MapSelectState* this = (MapSelectState*)thisx; - this->state.main = Select_Main; - this->state.destroy = Select_Destroy; + this->state.main = MapSelect_Main; + this->state.destroy = MapSelect_Destroy; this->scenes = sScenes; this->topDisplayedScene = 0; diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h index a454a098b..4791a2427 100644 --- a/src/overlays/gamestates/ovl_select/z_select.h +++ b/src/overlays/gamestates/ovl_select/z_select.h @@ -3,12 +3,9 @@ #include "global.h" -struct SelectContext; +struct MapSelectState; -void Select_Init(GameState* thisx); -void Select_Destroy(GameState* thisx); - -typedef void (*Select_LoadFunc)(struct SelectContext*, u32, s32); +typedef void (*Select_LoadFunc)(struct MapSelectState*, u32, s32); typedef struct { /* 0x00 */ char* name; @@ -16,7 +13,7 @@ typedef struct { /* 0x08 */ s32 entranceIndex; } SceneSelectEntry; // size = 0xC -typedef struct SelectContext { +typedef struct MapSelectState { /* 0x000 */ GameState state; /* 0x0A8 */ View view; /* 0x210 */ s32 count; @@ -36,6 +33,9 @@ typedef struct SelectContext { /* 0x270 */ s32 lockDown; /* 0x274 */ s32 unk_274; // unused /* 0x278 */ UNK_TYPE1 unk_278[0x08]; -} SelectContext; // size = 0x280 +} MapSelectState; // size = 0x280 + +void MapSelect_Init(GameState* thisx); +void MapSelect_Destroy(GameState* thisx); #endif diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 1c32f6490..68488b336 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -91,7 +91,7 @@ void Title_Draw(GameState* thisx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE); - gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_CLD_SURF2); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index aaa7c9fc6..316ad3355 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -16,6 +16,86 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +s16 D_8082AED0[] = { 120, 60, 2, 80 }; + +s16 D_8082AED8[] = { 20, 4, 20, 10 }; + +s32 D_8082AEE0 = 0; + +s32 D_8082AEE4[] = { 0, 0, 0 }; + +s32 D_8082AEF0[] = { 0, 0, 0, 0, 0 }; + +s16 D_8082AF04[] = { + 255, 0, 0, 255, 255, 70, 0, 150, 255, 70, 0, 150, 255, 0, 0, 255, +}; + +s16 D_8082AF24[] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x003C, 0x0000, 0x005A, 0x0000, 0x0000, + 0x0000, 0x0028, 0x006E, 0x0050, 0x0028, 0x0000, 0x0046, 0x0000, 0x005A, 0x005A, 0x005A, 0x0000, +}; + +s16 D_8082AF6C[] = { + 255, 255, 255, 255, 255, 255, +}; + +s16 D_8082AF78[] = { + 255, 255, 255, 255, 255, 255, +}; + +s16 D_8082AF84[] = { + 150, 150, 150, 150, 150, 150, +}; + +s16 D_8082AF90 = 20; + +s32 D_8082AF94 = 0; + +s32 D_8082AF98 = 0; + +s32 D_8082AF9C = 0; + +s32 D_8082AFA0 = 0; + +s32 D_8082AFA4 = 0; + +s16 D_8082AFA8 = 20; + +s32 D_8082AFAC = 0; + +void* D_8082AFB0[] = { + 0x020024A0, 0x020025A0, 0x020026A0, 0x020027A0, 0x020028A0, +}; + +s16 D_8082AFC4[] = { + 150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255, +}; + +s16 D_8082AFDC[] = { + 255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255, +}; + +s16 D_8082AFF4[] = { 100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255 }; + +void* D_8082B00C[] = { + 0x08053000, 0x08054000, 0x08055000, 0x08056000, 0x08057000, 0x08058000, +}; + +s16 D_8082B024 = 1; + +s16 D_8082B028 = 0; + +s16 D_8082B02C[] = { + 0xFFFF, 0x0003, 0x0002, 0x0001, 0x0000, 0x0004, 0x0003, 0xFFFE, 0x0000, 0x0005, 0x0016, 0x0003, 0x0000, 0x0004, + 0x0002, 0x0001, 0x0001, 0x0014, 0x0005, 0xFFFE, 0x0002, 0x0013, 0x0010, 0x0004, 0x000C, 0xFFFF, 0xFFFD, 0x0007, + 0x000D, 0xFFFF, 0x0006, 0x0008, 0x000E, 0xFFFF, 0x0007, 0x0009, 0x000F, 0xFFFF, 0x0008, 0x000A, 0x0010, 0xFFFF, + 0x0009, 0x0013, 0x0011, 0xFFFF, 0x000A, 0x0005, 0x0012, 0x0006, 0xFFFD, 0x000D, 0x0012, 0x0007, 0x000C, 0x000E, + 0x0016, 0x0008, 0x000D, 0x000F, 0x0016, 0x0009, 0x000E, 0x0010, 0x0016, 0x000A, 0x000F, 0x0005, 0x0016, 0x000B, + 0x0010, 0x0005, 0xFFFF, 0x000C, 0xFFFD, 0x0016, 0x0005, 0xFFFF, 0x000A, 0x0014, 0x0004, 0xFFFF, 0x0013, 0xFFFE, + 0x0013, 0x000C, 0xFFFD, 0x0016, 0xFFFF, 0x0010, 0x0012, 0x0002, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808160A0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80817B5C.s") diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index 99928bb16..2854b02c6 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -1,25 +1,1098 @@ /* * File: z_kaleido_debug.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Inventory Editor */ #include "z_kaleido_scope.h" +#include "interface/parameter_static/parameter_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; +s16 sCurSection = 0; +s16 sCurRow = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80818920.s") +// These defines must line up with the indices of sSectionPositions +#define INV_EDITOR_SECTION_RUPEE 0 +#define INV_EDITOR_SECTION_HEALTH_CAPACITY 1 +#define INV_EDITOR_SECTION_HEALTH 2 +#define INV_EDITOR_SECTION_ITEMS 3 +#define INV_EDITOR_SECTION_MASKS 27 +#define INV_EDITOR_SECTION_BOSS 51 +#define INV_EDITOR_SECTION_SWORD 55 +#define INV_EDITOR_SECTION_SHIELD 56 +#define INV_EDITOR_SECTION_SONGS 57 +#define INV_EDITOR_SECTION_LULLABY_INTRO 69 +#define INV_EDITOR_SECTION_NOTEBOOK 70 +#define INV_EDITOR_SECTION_QUIVER 71 +#define INV_EDITOR_SECTION_BOMB_BAG 72 +#define INV_EDITOR_SECTION_SWAMP_GOLD_SKULLS 73 +#define INV_EDITOR_SECTION_OCEAN_GOLD_SKULLS 74 +#define INV_EDITOR_SECTION_HEART_PIECE_COUNT 75 +#define INV_EDITOR_SECTION_SMALL_KEYS 76 +#define INV_EDITOR_SECTION_DUNGEON_ITEMS 80 +#define INV_EDITOR_SECTION_STRAY_FAIRIES 84 +#define INV_EDITOR_SECTION_DOUBLE_DEFENSE 88 -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808190C4.s") +// Geometry of the highlights for the selected section +typedef struct { + /* 0 */ s16 screenX; + /* 1 */ s16 screenY; + /* 2 */ s16 width; +} SectionPosition; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80819238.s") +// clang-format off +SectionPosition sSectionPositions[] = { + // Rupees (0) + { 65, 14, 41 }, + // Health Capacity (1) + { 145, 14, 21 }, + // Health (2) + { 193, 14, 35 }, + // Items (3) + { 42, 37, 22 }, { 65, 37, 22 }, { 88, 37, 22 }, { 111, 37, 22 }, { 134, 37, 22 }, { 157, 37, 22 }, // row 1 + { 42, 51, 22 }, { 65, 51, 22 }, { 88, 51, 22 }, { 111, 51, 22 }, { 134, 51, 22 }, { 157, 51, 22 }, // row 2 + { 42, 65, 22 }, { 65, 65, 22 }, { 88, 65, 22 }, { 111, 65, 22 }, { 134, 65, 22 }, { 157, 65, 22 }, // row 3 + { 42, 80, 22 }, { 65, 80, 22 }, { 88, 80, 22 }, { 111, 80, 22 }, { 134, 80, 22 }, { 157, 80, 22 }, // row 4 + // Masks (27) + { 202, 37, 14 }, { 215, 37, 14 }, { 229, 37, 14 }, { 243, 37, 14 }, { 257, 37, 14 }, { 271, 37, 14 }, // row 1 + { 202, 51, 14 }, { 215, 51, 14 }, { 229, 51, 14 }, { 243, 51, 14 }, { 257, 51, 14 }, { 271, 51, 14 }, // row 2 + { 202, 65, 14 }, { 215, 65, 14 }, { 229, 65, 14 }, { 243, 65, 14 }, { 257, 65, 14 }, { 271, 65, 14 }, // row 3 + { 202, 80, 14 }, { 215, 80, 14 }, { 229, 80, 14 }, { 243, 80, 14 }, { 257, 80, 14 }, { 271, 80, 14 }, // row 4 + // Boss (51) + { 42, 111, 14 }, { 54, 111, 14 }, { 66, 111, 14 }, { 78, 111, 14 }, + // Sword (55) + { 114, 99, 14 }, + // Shield (56) + { 142, 99, 14 }, + // Songs (57) + { 188, 99, 14 }, { 202, 99, 14 }, { 216, 99, 14 }, { 230, 99, 14 }, { 244, 99, 14 }, { 258, 99, 14 }, + { 188, 113, 14 }, { 202, 113, 14 }, { 216, 113, 14 }, { 230, 113, 14 }, { 244, 113, 14 }, { 258, 113, 14 }, + // Goron Lullaby Intro (69) + { 272, 113, 14 }, + // Bombers Notebook (70) + { 54, 141, 14 }, + // Quiver Upgrade (71) + { 112, 134, 14 }, + // Bomb Bag Upgrade (72) + { 155, 134, 14 }, + // Gold Skulltula Count (73) + { 194, 130, 32 }, { 194, 144, 32 }, + // Heart Piece Count (75) + { 262, 134, 14 }, + // Small Keys (76) + { 43, 168, 14 }, { 55, 168, 14 }, { 67, 168, 14 }, { 79, 168, 14 }, + // Dungeon Items (80) + { 127, 168, 14 }, { 139, 168, 14 }, { 151, 168, 14 }, { 163, 168, 14 }, + // Stray Fairies (84) + { 202, 168, 22 }, { 223, 168, 22 }, { 244, 168, 22 }, { 265, 168, 22 }, + // Life (88) + { 42, 202, 14 }, + // Magic + { 73, 202, 14 }, + // Lottery + { 136, 202, 38 }, + // Gold Color/Bombers Code (not highlighted properly) + { 214, 202, 74 }, { 214, 202, 74 }, +}; +// clang-format on -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80819F04.s") +s16 sSlotItems[] = { + // Items Row 1 + ITEM_OCARINA, + ITEM_BOW, + ITEM_ARROW_FIRE, + ITEM_ARROW_ICE, + ITEM_ARROW_LIGHT, + ITEM_OCARINA_FAIRY, + // Items Row 2 + ITEM_BOMB, + ITEM_BOMBCHU, + ITEM_STICK, + ITEM_NUT, + ITEM_MAGIC_BEANS, + ITEM_SLINGSHOT, + // Items Row 3 + ITEM_POWDER_KEG, + ITEM_PICTO_BOX, + ITEM_LENS, + ITEM_HOOKSHOT, + ITEM_SWORD_GREAT_FAIRY, + ITEM_LONGSHOT, + // Items Row 4 + ITEM_BOTTLE, + ITEM_POTION_RED, + ITEM_POTION_GREEN, + ITEM_POTION_BLUE, + ITEM_FAIRY, + ITEM_MUSHROOM, + // Masks Row 1 + ITEM_MASK_POSTMAN, + ITEM_MASK_ALL_NIGHT, + ITEM_MASK_BLAST, + ITEM_MASK_STONE, + ITEM_MASK_GREAT_FAIRY, + ITEM_MASK_DEKU, + // Masks Row 2 + ITEM_MASK_KEATON, + ITEM_MASK_BREMEN, + ITEM_MASK_BUNNY, + ITEM_MASK_DON_GERO, + ITEM_MASK_SCENTS, + ITEM_MASK_GORON, + // Masks Row 3 + ITEM_MASK_ROMANI, + ITEM_MASK_CIRCUS_LEADER, + ITEM_MASK_KAFEIS_MASK, + ITEM_MASK_COUPLE, + ITEM_MASK_TRUTH, + ITEM_MASK_ZORA, + // Masks Row 4 + ITEM_MASK_KAMARO, + ITEM_MASK_GIBDO, + ITEM_MASK_GARO, + ITEM_MASK_CAPTAIN, + ITEM_MASK_GIANT, + ITEM_MASK_FIERCE_DEITY, +}; + +s16 sRowFirstSections[] = { + INV_EDITOR_SECTION_RUPEE, + INV_EDITOR_SECTION_HEALTH_CAPACITY, + INV_EDITOR_SECTION_HEALTH, + INV_EDITOR_SECTION_ITEMS, + INV_EDITOR_SECTION_MASKS, + INV_EDITOR_SECTION_BOSS, + INV_EDITOR_SECTION_SWORD, + INV_EDITOR_SECTION_SHIELD, + INV_EDITOR_SECTION_SONGS, + INV_EDITOR_SECTION_NOTEBOOK, + INV_EDITOR_SECTION_QUIVER, + INV_EDITOR_SECTION_BOMB_BAG, + INV_EDITOR_SECTION_SWAMP_GOLD_SKULLS, + INV_EDITOR_SECTION_HEART_PIECE_COUNT, + INV_EDITOR_SECTION_SMALL_KEYS, + INV_EDITOR_SECTION_DUNGEON_ITEMS, + INV_EDITOR_SECTION_STRAY_FAIRIES, + INV_EDITOR_SECTION_DOUBLE_DEFENSE, +}; + +void KaleidoScope_DrawInventoryEditorText(Gfx** gfxp) { + GfxPrint printer; + s32 pad[2]; + + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, *gfxp); + + // Rupees + GfxPrint_SetPos(&printer, 4, 2); + GfxPrint_SetColor(&printer, 255, 60, 0, 255); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ルピー"); + + // Hearts + GfxPrint_SetPos(&printer, 15, 2); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ハート"); + GfxPrint_SetPos(&printer, 15, 3); + GfxPrint_Printf(&printer, "%s", "MAX"); + GfxPrint_SetPos(&printer, 21, 3); + GfxPrint_Printf(&printer, "%s", "NOW"); + GfxPrint_SetPos(&printer, 28, 3); + GfxPrint_Printf(&printer, "%s", "/4"); + + // Items + GfxPrint_SetPos(&printer, 4, 5); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ア"); + GfxPrint_SetPos(&printer, 4, 6); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "イ"); + GfxPrint_SetPos(&printer, 4, 7); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "テ"); + GfxPrint_SetPos(&printer, 4, 8); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ム"); + + // Masks + GfxPrint_SetPos(&printer, 24, 5); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "マ"); + GfxPrint_SetPos(&printer, 24, 6); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ス"); + GfxPrint_SetPos(&printer, 24, 7); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ク"); + + // Boss (Remains) + GfxPrint_SetPos(&printer, 4, 13); + GfxPrint_Printf(&printer, "%s", "BOSS"); + + // Sword + GfxPrint_SetPos(&printer, 13, 13); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ケ"); + GfxPrint_SetPos(&printer, 13, 14); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ン"); + + // Shield + GfxPrint_SetPos(&printer, 17, 13); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "タ"); + GfxPrint_SetPos(&printer, 17, 14); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "テ"); + + // Ocarina (Songs) + GfxPrint_SetPos(&printer, 21, 13); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "オカ"); + GfxPrint_SetPos(&printer, 21, 14); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "リナ"); + + // Schedule (Bombers Notebook) + GfxPrint_SetPos(&printer, 4, 17); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "スケジュール"); + + // Quiver + GfxPrint_SetPos(&printer, 12, 17); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ヤ"); + GfxPrint_SetPos(&printer, 12, 18); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "タテ"); + + // Bomb Bag + GfxPrint_SetPos(&printer, 16, 17); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ボム"); + GfxPrint_SetPos(&printer, 16, 18); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "フクロ"); + + // Gold Skulls + GfxPrint_SetPos(&printer, 22, 17); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "キン"); + GfxPrint_SetPos(&printer, 22, 18); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "スタ"); + + // Heart Pieces + GfxPrint_SetPos(&printer, 29, 17); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ハート"); + GfxPrint_SetPos(&printer, 29, 18); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "カケラ"); + GfxPrint_SetPos(&printer, 34, 18); + GfxPrint_Printf(&printer, "%s", "/4"); + + // Keys + GfxPrint_SetPos(&printer, 4, 21); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "カ"); + GfxPrint_SetPos(&printer, 4, 22); + GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ギ"); + + // Map/Compass + GfxPrint_SetPos(&printer, 12, 21); + GfxPrint_Printf(&printer, "%s", "MAP"); + GfxPrint_SetPos(&printer, 12, 22); + GfxPrint_Printf(&printer, "%s", "コンパ"); + + // Fairies + GfxPrint_SetPos(&printer, 23, 21); + GfxPrint_Printf(&printer, "%s", "ヨウ"); + GfxPrint_SetPos(&printer, 23, 22); + GfxPrint_Printf(&printer, "%s", "セイ"); + + // Life (double defence) + GfxPrint_SetPos(&printer, 4, 25); + GfxPrint_Printf(&printer, "%s", "イ"); + GfxPrint_SetPos(&printer, 4, 26); + GfxPrint_Printf(&printer, "%s", "ノ"); + GfxPrint_SetPos(&printer, 4, 27); + GfxPrint_Printf(&printer, "%s", "チ"); + + // Magic + GfxPrint_SetPos(&printer, 8, 25); + GfxPrint_Printf(&printer, "%s", "マ"); + GfxPrint_SetPos(&printer, 8, 26); + GfxPrint_Printf(&printer, "%s", "ホ"); + GfxPrint_SetPos(&printer, 8, 27); + GfxPrint_Printf(&printer, "%s", "ウ"); + + // Lottery + GfxPrint_SetPos(&printer, 13, 25); + GfxPrint_Printf(&printer, "%s", "タカラ"); + GfxPrint_SetPos(&printer, 13, 26); + GfxPrint_Printf(&printer, "%s", "クジ"); + + // Gold Color (Oceanside Spider House Mask Order) + GfxPrint_SetPos(&printer, 23, 24); + GfxPrint_Printf(&printer, "%s", "キンイロ"); + + // Bombers (code) + GfxPrint_SetPos(&printer, 23, 26); + GfxPrint_Printf(&printer, "%s", "ボン"); + GfxPrint_SetPos(&printer, 23, 27); + GfxPrint_Printf(&printer, "%s", "バーズ"); + + *gfxp = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); +} + +void KaleidoScope_DrawDigit(PlayState* play, s32 digit, s32 rectLeft, s32 rectTop) { + OPEN_DISPS(play->state.gfxCtx); + + gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * digit)), G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + 8) << 2, (rectTop + 16) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_DrawInventoryEditor(PlayState* play) { + Gfx* gfx; + Gfx* gfxRef; + s32 counterDigits[4]; + s16 slot; + s16 i; + s16 j; + s32 rectLeft; + s32 rectTop; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C628(play->state.gfxCtx); + + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 220); + gDPFillRectangle(POLY_OPA_DISP++, 24, 12, 298, 228); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, + PRIMITIVE, 0); + + gfxRef = POLY_OPA_DISP; + gfx = Graph_GfxPlusOne(gfxRef); + gSPDisplayList(OVERLAY_DISP++, gfx); + + KaleidoScope_DrawInventoryEditorText(&gfx); + + gSPEndDisplayList(gfx++); + Graph_BranchDlist(gfxRef, gfx); + POLY_OPA_DISP = gfx; + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 0, 0, 255); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); + + // Current Health Quarter (X / 4) + KaleidoScope_DrawDigit(play, (((void)0, gSaveContext.save.playerData.health) % 0x10) / 4, 217, 15); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + // Rupees + counterDigits[0] = counterDigits[1] = counterDigits[2] = 0; + counterDigits[3] = gSaveContext.save.playerData.rupees; + while (counterDigits[3] >= 1000) { + counterDigits[0]++; + counterDigits[3] -= 1000; + } + + while (counterDigits[3] >= 100) { + counterDigits[1]++; + counterDigits[3] -= 100; + } + + while (counterDigits[3] >= 10) { + counterDigits[2]++; + counterDigits[3] -= 10; + } + + // Loop over columns (i) + for (i = 0, rectLeft = 68; i < 4; i++, rectLeft += 9) { + KaleidoScope_DrawDigit(play, counterDigits[i], rectLeft, 15); + } + + // Health capacity + counterDigits[2] = 0; + counterDigits[3] = gSaveContext.save.playerData.healthCapacity / 0x10; + while (counterDigits[3] >= 10) { + counterDigits[2]++; + counterDigits[3] -= 10; + } + + KaleidoScope_DrawDigit(play, counterDigits[2], 145, 15); + KaleidoScope_DrawDigit(play, counterDigits[3], 154, 15); + + // Health + counterDigits[2] = 0; + counterDigits[3] = gSaveContext.save.playerData.health / 0x10; + while (counterDigits[3] >= 10) { + counterDigits[2]++; + counterDigits[3] -= 10; + } + + KaleidoScope_DrawDigit(play, counterDigits[2], 195, 15); + KaleidoScope_DrawDigit(play, counterDigits[3], 204, 15); + + // Items + // Loop over rows (i) + for (slot = 0, i = 0, rectTop = 38; i < 4; i++, rectTop += 14) { + // Loop over columns (j) + for (j = 0, rectLeft = 44; j < 6; j++, slot++, rectLeft += 23) { + counterDigits[3] = 0; + counterDigits[2] = 0; + if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_NUT)) || (slot == SLOT_POWDER_KEG) || + (slot == SLOT_MAGIC_BEANS)) { + counterDigits[3] = AMMO(gAmmoItems[slot]); + } else if ((slot == SLOT_TRADE_DEED) || (slot == SLOT_TRADE_KEY_MAMA) || (slot == SLOT_TRADE_COUPLE)) { + counterDigits[3] = gSaveContext.save.inventory.items[slot]; + } else if (slot >= SLOT_BOTTLE_1) { + counterDigits[3] = gSaveContext.save.inventory.items[slot]; + } else if (gSaveContext.save.inventory.items[slot] != ITEM_NONE) { + counterDigits[3] = 1; + } + + if (counterDigits[3] != ITEM_NONE) { + while (counterDigits[3] >= 10) { + counterDigits[2]++; + counterDigits[3] -= 10; + } + } else { + counterDigits[2] = counterDigits[3] = 0; + } + + if (counterDigits[2] != 0) { + KaleidoScope_DrawDigit(play, counterDigits[2], rectLeft, rectTop); + } + KaleidoScope_DrawDigit(play, counterDigits[3], rectLeft + 9, rectTop); + } + } + + // Masks + // Loop over rows (i) + for (slot = 0, i = 0, rectTop = 38; i < 4; i++, rectTop += 14) { + // Loop over columns (j) + for (j = 0, rectLeft = 204; j < 6; j++, slot++, rectLeft += 14) { + counterDigits[2] = 0; + + if (gSaveContext.save.inventory.items[SLOT_MASK_POSTMAN + slot] != ITEM_NONE) { + counterDigits[2] = 1; + } + KaleidoScope_DrawDigit(play, counterDigits[2], rectLeft, rectTop); + } + } + + // Boss Remains + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 44, i = 0; i < 4; i++) { + counterDigits[2] = 0; + if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA + i)) { + counterDigits[2] = 1; + } + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 112); + counterDigits[1] += 14; + } + + // Sword + KaleidoScope_DrawDigit(play, GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD), 116, 100); + + // Shield + KaleidoScope_DrawDigit(play, GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD), 145, 100); + + // Songs + // Loop over rows (j), (counterDigits[3] stores rectTop) + for (counterDigits[3] = 100, j = 0, slot = 0; j < 2; j++) { + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 190, i = 0; i < 6; i++, slot++) { + counterDigits[2] = 0; + if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA + slot)) { + counterDigits[2] = 1; + } + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], counterDigits[3]); + counterDigits[1] += 14; + } + counterDigits[3] += 14; + } + + // Goron Lullaby Intro + counterDigits[2] = 0; + counterDigits[3] -= 14; + if (CHECK_QUEST_ITEM(QUEST_SONG_LULLABY_INTRO)) { + counterDigits[2] = 1; + } + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], counterDigits[3]); + + // Bombers Notebook + counterDigits[2] = 0; + if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { + counterDigits[2] = 1; + } + KaleidoScope_DrawDigit(play, counterDigits[2], 56, 142); + + // Quiver + KaleidoScope_DrawDigit(play, CUR_UPG_VALUE(UPG_QUIVER), 114, 134); + + // Bomb Bag + KaleidoScope_DrawDigit(play, CUR_UPG_VALUE(UPG_BOMB_BAG), 156, 134); + + // Gold Skulls (Swamp Spider House) + counterDigits[2] = 0; + counterDigits[1] = 0; + counterDigits[3] = Inventory_GetSkullTokenCount(SCENE_KINSTA1); + + while (counterDigits[3] >= 100) { + counterDigits[3] -= 100; + counterDigits[1]++; + } + + while (counterDigits[3] >= 10) { + counterDigits[3] -= 10; + counterDigits[2]++; + } + + KaleidoScope_DrawDigit(play, counterDigits[1], 196, 130); + KaleidoScope_DrawDigit(play, counterDigits[2], 205, 130); + KaleidoScope_DrawDigit(play, counterDigits[3], 214, 130); + + // Gold Skulls (Oceans Spider House) + counterDigits[2] = 0; + counterDigits[1] = 0; + counterDigits[3] = Inventory_GetSkullTokenCount(SCENE_KINDAN2); + + while (counterDigits[3] >= 100) { + counterDigits[3] -= 100; + counterDigits[1]++; + } + + while (counterDigits[3] >= 10) { + counterDigits[3] -= 10; + counterDigits[2]++; + } + + KaleidoScope_DrawDigit(play, counterDigits[1], 196, 144); + KaleidoScope_DrawDigit(play, counterDigits[2], 205, 144); + KaleidoScope_DrawDigit(play, counterDigits[3], 214, 144); + + // Heart Pieces + KaleidoScope_DrawDigit(play, GET_QUEST_HEART_PIECE_COUNT, 264, 134); + + // Keys + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 45, i = 0; i < 4; i++) { + counterDigits[2] = 0; + + if ((counterDigits[3] = DUNGEON_KEY_COUNT(i)) >= 0) { + while (counterDigits[3] >= 10) { + counterDigits[2]++; + counterDigits[3] -= 10; + } + } else { + counterDigits[2] = counterDigits[3] = 0; + } + + KaleidoScope_DrawDigit(play, counterDigits[3], counterDigits[1], 168); + counterDigits[1] += 12; + } + + // Dungeon Items + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 129, i = 0; i < 4; i++) { + counterDigits[2] = gSaveContext.save.inventory.dungeonItems[i] & gEquipMasks[0]; + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 168); + counterDigits[1] += 12; + } + + // Stray Fairies + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 202, i = 0; i < 4; i++) { + counterDigits[3] = gSaveContext.save.inventory.strayFairies[i]; + counterDigits[2] = counterDigits[3] / 10; + counterDigits[3] -= counterDigits[2] * 10; + if (counterDigits[2] != 0) { + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 168); + } + KaleidoScope_DrawDigit(play, counterDigits[3], counterDigits[1] + 9, 168); + counterDigits[1] += 21; + } + + // Double Defence + KaleidoScope_DrawDigit(play, gSaveContext.save.playerData.doubleDefense, 44, 202); + + // Magic + //! @bug should be gSaveContext.save.playerData.doubleMagic + KaleidoScope_DrawDigit(play, gSaveContext.save.playerData.doubleDefense, 75, 202); + + // Lottery + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 139, i = 0; i < 3; i++) { + counterDigits[2] = gSaveContext.save.lotteryCodes[0][i]; + + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 184); + counterDigits[2] = gSaveContext.save.lotteryCodes[1][i]; + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 198); + + counterDigits[2] = gSaveContext.save.lotteryCodes[2][i]; + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 212); + + counterDigits[1] += 12; + } + + // Oceanside Spider House Mask Order + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 217, i = 0; i < 6; i++) { + counterDigits[2] = gSaveContext.save.spiderHouseMaskOrder[i]; + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 186); + + counterDigits[1] += 12; + } + + // Bombers code + // Loop over columns (i), (counterDigits[1] stores rectLeft) + for (counterDigits[1] = 220, i = 0; i < 5; i++) { + counterDigits[2] = gSaveContext.save.bomberCode[i]; + KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 210); + + counterDigits[1] += 12; + } + + // Draws a highlight on the selected section + gDPPipeSync(POLY_OPA_DISP++); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 200, 120); + + gDPFillRectangle(POLY_OPA_DISP++, sSectionPositions[sCurSection].screenX, sSectionPositions[sCurSection].screenY, + sSectionPositions[sCurSection].screenX + sSectionPositions[sCurSection].width, + sSectionPositions[sCurSection].screenY + 15); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_UpdateInventoryEditor(PlayState* play) { + static s32 sPrevDBtnInput = 0; + static s32 sHeldDBtnTimer = 0; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = CONTROLLER1(&play->state); + s16 slot; + s16 value; + s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); + + pauseCtx->stickRelX = input->rel.stick_x; + pauseCtx->stickRelY = input->rel.stick_y; + + // Handles navigating the menu to different sections with the D-Pad + // When the same direction is held, registers the input periodically based on a timer + if (dBtnInput == sPrevDBtnInput) { + sHeldDBtnTimer--; + if (sHeldDBtnTimer < 0) { + sHeldDBtnTimer = 1; + } else { + dBtnInput ^= sPrevDBtnInput; + } + } else { + sPrevDBtnInput = dBtnInput; + sHeldDBtnTimer = 16; + } + + if (CHECK_BTN_ANY(dBtnInput, BTN_DDOWN)) { + sCurRow++; + if (sCurRow > 17) { + sCurRow = 0; + } + sCurSection = sRowFirstSections[sCurRow]; + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DUP)) { + sCurRow--; + if (sCurRow < 0) { + sCurRow = 17; + } + sCurSection = sRowFirstSections[sCurRow]; + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DLEFT)) { + sCurSection--; + if (sCurSection < 0) { + sCurSection = ARRAY_COUNT(sSectionPositions) - 1; + } + } else if (CHECK_BTN_ANY(dBtnInput, BTN_DRIGHT)) { + sCurSection++; + if (sCurSection > (ARRAY_COUNT(sSectionPositions) - 1)) { + sCurSection = 0; + } + } + + // Handles the logic to change values based on the selected section + switch (sCurSection) { + case INV_EDITOR_SECTION_RUPEE: + // Rupees + if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + gSaveContext.save.playerData.rupees -= 100; + if (gSaveContext.save.playerData.rupees < 0) { + gSaveContext.save.playerData.rupees = 0; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + gSaveContext.save.playerData.rupees += 100; + if (gSaveContext.save.playerData.rupees >= 9999) { + gSaveContext.save.playerData.rupees = 9999; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.playerData.rupees--; + if (gSaveContext.save.playerData.rupees < 0) { + gSaveContext.save.playerData.rupees = 0; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.playerData.rupees++; + if (gSaveContext.save.playerData.rupees >= 9999) { + gSaveContext.save.playerData.rupees = 9999; + } + } + break; + + case INV_EDITOR_SECTION_HEALTH_CAPACITY: + // Health Capacity + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.playerData.healthCapacity -= 0x10; + if (gSaveContext.save.playerData.healthCapacity < 0x30) { + gSaveContext.save.playerData.healthCapacity = 0x30; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.playerData.healthCapacity += 0x10; + if (gSaveContext.save.playerData.healthCapacity >= 0x140) { + gSaveContext.save.playerData.healthCapacity = 0x140; + } + } + break; + + case INV_EDITOR_SECTION_HEALTH: + // Health + if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + Health_ChangeBy(play, -4); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + Health_ChangeBy(play, 4); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + Health_ChangeBy(play, -0x10); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + Health_ChangeBy(play, 0x10); + } + break; + + case INV_EDITOR_SECTION_HEART_PIECE_COUNT: + // Heart Piece Count + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (GET_QUEST_HEART_PIECE_COUNT != 0) { + DECREMENT_QUEST_HEART_PIECE_COUNT; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (LEQ_MAX_QUEST_HEART_PIECE_COUNT) { + INCREMENT_QUEST_HEART_PIECE_COUNT; + } + } + break; + + default: + if (sCurSection < INV_EDITOR_SECTION_BOSS) { + // Items + slot = sCurSection - INV_EDITOR_SECTION_ITEMS; + if ((slot == SLOT_BOW) || ((slot >= SLOT_BOMB) && (slot <= SLOT_NUT)) || (slot == SLOT_POWDER_KEG) || + (slot == SLOT_MAGIC_BEANS)) { + if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + Inventory_DeleteItem(gAmmoItems[slot], SLOT(gAmmoItems[slot])); + AMMO(gAmmoItems[slot]) = 0; + } + + if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (slot != INV_CONTENT(gAmmoItems[slot])) { + INV_CONTENT(gAmmoItems[slot]) = gAmmoItems[slot]; + } + AMMO(gAmmoItems[slot])++; + if (AMMO(gAmmoItems[slot]) > 99) { + AMMO(gAmmoItems[slot]) = 99; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + AMMO(gAmmoItems[slot])--; + if (AMMO(gAmmoItems[slot]) < 0) { + AMMO(gAmmoItems[slot]) = 0; + } + } + } else if ((slot == SLOT_TRADE_DEED) || (slot == SLOT_TRADE_KEY_MAMA) || (slot == SLOT_TRADE_COUPLE)) { + if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + value = sSlotItems[slot]; + Inventory_DeleteItem(value, slot); + } else if (slot == SLOT_TRADE_DEED) { + if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_MOON_TEAR; + } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_MOON_TEAR) && + (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_MOUNTAIN)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) + 1; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_DEED_OCEAN; + } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_DEED_LAND) && + (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_OCEAN)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) - 1; + } + } + } else if (slot == SLOT_TRADE_KEY_MAMA) { + if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_ROOM_KEY; + } else if ((INV_CONTENT(ITEM_ROOM_KEY) >= ITEM_ROOM_KEY) && + (INV_CONTENT(ITEM_ROOM_KEY) <= ITEM_ROOM_KEY)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) + 1; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_LETTER_MAMA; + } else if ((INV_CONTENT(ITEM_ROOM_KEY) >= ITEM_LETTER_MAMA) && + (INV_CONTENT(ITEM_ROOM_KEY) <= ITEM_LETTER_MAMA)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) - 1; + } + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_LETTER_TO_KAFEI; + } else if ((INV_CONTENT(ITEM_LETTER_TO_KAFEI) >= ITEM_LETTER_TO_KAFEI) && + (INV_CONTENT(ITEM_LETTER_TO_KAFEI) <= ITEM_LETTER_TO_KAFEI)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) + 1; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_PENDANT_OF_MEMORIES; + } else if ((INV_CONTENT(ITEM_LETTER_TO_KAFEI) >= ITEM_PENDANT_OF_MEMORIES) && + (INV_CONTENT(ITEM_LETTER_TO_KAFEI) <= ITEM_PENDANT_OF_MEMORIES)) { + gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) - 1; + } + } + } else if ((slot >= SLOT_BOTTLE_1) && (slot <= SLOT_BOTTLE_6)) { + if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + value = ITEM_BOTTLE + slot - SLOT_BOTTLE_1; + Inventory_DeleteItem(value, SLOT(ITEM_BOTTLE) + slot - SLOT_BOTTLE_1); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_BOTTLE; + } else if ((gSaveContext.save.inventory.items[slot] >= ITEM_BOTTLE) && + (gSaveContext.save.inventory.items[slot] <= ITEM_HYLIAN_LOACH)) { + gSaveContext.save.inventory.items[slot] = gSaveContext.save.inventory.items[slot] + 1; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot] = ITEM_OBABA_DRINK; + } else if ((gSaveContext.save.inventory.items[slot] >= ITEM_POTION_RED) && + (gSaveContext.save.inventory.items[slot] <= ITEM_OBABA_DRINK)) { + gSaveContext.save.inventory.items[slot] = gSaveContext.save.inventory.items[slot] - 1; + } + } + } else { + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT) || + CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + value = sSlotItems[slot]; + if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { + INV_CONTENT(value) = value; + } else { + Inventory_DeleteItem(value, slot); + } + } + } + + } else if (sCurSection == INV_EDITOR_SECTION_SWORD) { + // Sword + value = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD); + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + value--; + if (value < EQUIP_VALUE_SWORD_NONE) { + value = EQUIP_VALUE_SWORD_NONE; + } + + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, value); + + if (value != 0) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); + gSaveContext.save.playerData.swordHealth = 100; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } + + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + value++; + if (value > EQUIP_VALUE_SWORD_DIETY) { + value = EQUIP_VALUE_SWORD_DIETY; + } + + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, value); + + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); + gSaveContext.save.playerData.swordHealth = 100; + } + + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + + } else if (sCurSection == INV_EDITOR_SECTION_SHIELD) { + // Shield + value = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD); + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + value--; + if (value < EQUIP_VALUE_SHIELD_NONE) { + value = EQUIP_VALUE_SHIELD_NONE; + } + + SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, value); + + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + value++; + if (value > EQUIP_VALUE_SHIELD_MAX) { + value = EQUIP_VALUE_SHIELD_MAX; + } + SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, value); + } + + } else if (sCurSection == INV_EDITOR_SECTION_QUIVER) { + // Quiver + value = GET_CUR_UPG_VALUE(UPG_QUIVER); + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + value--; + if (value < 0) { + value = 0; + } + Inventory_ChangeUpgrade(UPG_QUIVER, value); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + value++; + if (value > 3) { + value = 3; + } + Inventory_ChangeUpgrade(UPG_QUIVER, value); + } + + } else if (sCurSection == INV_EDITOR_SECTION_BOMB_BAG) { + // Bomb Bag + value = GET_CUR_UPG_VALUE(UPG_BOMB_BAG); + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + value--; + if (value < 0) { + value = 0; + } + Inventory_ChangeUpgrade(UPG_BOMB_BAG, value); + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + value++; + if (value > 3) { + value = 3; + } + Inventory_ChangeUpgrade(UPG_BOMB_BAG, value); + } + + } else if (sCurSection == INV_EDITOR_SECTION_SWAMP_GOLD_SKULLS) { + // Gold Skulls (Swamp Spider House) + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) != 0) { + gSaveContext.save.skullTokenCount = + ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) - 1) << 0x10) | + (gSaveContext.save.skullTokenCount & 0xFFFF); + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.skullTokenCount = + ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | + (gSaveContext.save.skullTokenCount & 0xFFFF); + } + + } else if (sCurSection == INV_EDITOR_SECTION_OCEAN_GOLD_SKULLS) { + // Gold Skulls (Oceans Spider House) + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (((u16)gSaveContext.save.skullTokenCount) != 0) { + gSaveContext.save.skullTokenCount = (((u16)gSaveContext.save.skullTokenCount - 1) & 0xFFFF) | + (gSaveContext.save.skullTokenCount & 0xFFFF0000); + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.skullTokenCount = (((u16)gSaveContext.save.skullTokenCount + 1) & 0xFFFF) | + (gSaveContext.save.skullTokenCount & 0xFFFF0000); + } + + } else if (sCurSection == INV_EDITOR_SECTION_NOTEBOOK) { + // Bombers Notebook + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.inventory.questItems ^= gBitFlags[QUEST_BOMBERS_NOTEBOOK]; + } + + } else if (sCurSection == INV_EDITOR_SECTION_LULLABY_INTRO) { + // Goron Lullaby Intro + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.inventory.questItems ^= gBitFlags[QUEST_SONG_LULLABY_INTRO]; + } + + } else if (sCurSection < INV_EDITOR_SECTION_LULLABY_INTRO) { + // Boss Remains and Songs + //! Note: quest items must align with section, and all cases below INV_EDITOR_SECTION_LULLABY_INTRO must + //! have also been taken + slot = sCurSection - INV_EDITOR_SECTION_BOSS; + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.inventory.questItems ^= gBitFlags[slot]; + } + + } else if (sCurSection < INV_EDITOR_SECTION_DUNGEON_ITEMS) { + // Dungeon Small Keys + slot = sCurSection - INV_EDITOR_SECTION_SMALL_KEYS; + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + DUNGEON_KEY_COUNT(slot)--; + if (DUNGEON_KEY_COUNT(slot) < 0) { + DUNGEON_KEY_COUNT(slot) = -1; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (DUNGEON_KEY_COUNT(slot) < 0) { + DUNGEON_KEY_COUNT(slot) = 1; + } else { + DUNGEON_KEY_COUNT(slot)++; + if (DUNGEON_KEY_COUNT(slot) >= 9) { + DUNGEON_KEY_COUNT(slot) = 9; + } + } + } + + } else if (sCurSection < INV_EDITOR_SECTION_STRAY_FAIRIES) { + // Dungeon Items + slot = sCurSection - INV_EDITOR_SECTION_DUNGEON_ITEMS; + if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + // Map + gSaveContext.save.inventory.dungeonItems[slot] ^= 4; + } + if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + // Compass + gSaveContext.save.inventory.dungeonItems[slot] ^= 2; + } + if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + // Boss Key + gSaveContext.save.inventory.dungeonItems[slot] ^= 1; + } + + } else if (sCurSection < INV_EDITOR_SECTION_DOUBLE_DEFENSE) { + // Stray Fairies + slot = sCurSection - INV_EDITOR_SECTION_STRAY_FAIRIES; + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + gSaveContext.save.inventory.strayFairies[slot]--; + if (gSaveContext.save.inventory.strayFairies[slot] < 0) { + gSaveContext.save.inventory.strayFairies[slot] = 0; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || + CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.inventory.strayFairies[slot]++; + if (gSaveContext.save.inventory.strayFairies[slot] >= 99) { + gSaveContext.save.inventory.strayFairies[slot] = 99; + } + } + + } else { + // Double Defence + if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT) || + CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + gSaveContext.save.playerData.doubleDefense ^= 1; + if (!gSaveContext.save.playerData.doubleDefense) { + gSaveContext.save.inventory.defenseHearts = 0; + } else { + gSaveContext.save.inventory.defenseHearts = 20; + } + } + } + break; + } + + // Handles exiting the inventory editor with the L button + // The editor is opened with `debugEditor` set to DEBUG_EDITOR_INVENTORY_INIT, + // and becomes closable after a frame once `debugEditor` is set to DEBUG_EDITOR_INVENTORY + if (pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY_INIT) { + pauseCtx->debugEditor = DEBUG_EDITOR_INVENTORY; + } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY) && CHECK_BTN_ALL(input->press.button, BTN_L)) { + pauseCtx->debugEditor = DEBUG_EDITOR_NONE; + } +} diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 11d0b1207..ae2140f2c 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -16,6 +16,64 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +s32 D_8082B3C0 = 0; + +s32 D_8082B3C4 = 0; + +s16 D_8082B3C8 = 10; + +u8 D_8082B3CC[5][24] = { + { + false, false, false, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, true, true, true, true, true, true, + }, + { + true, false, false, false, false, true, false, false, false, false, false, true, + true, true, true, false, false, true, true, true, true, true, true, true, + }, + { + true, false, false, false, false, true, false, false, false, false, false, true, + false, true, true, false, false, true, true, true, true, true, true, true, + }, + { + true, false, false, false, false, true, false, false, false, true, false, true, + false, true, true, false, false, true, true, true, true, true, true, true, + }, + { + true, true, true, true, true, true, true, true, true, true, true, true, + false, true, true, true, true, true, true, true, true, true, true, true, + }, +}; + +s16 D_8082B444[] = { + 0x005F, 0x003E, 0x005F, 0x0080, 0x00A1, 0x00C2, 0x003E, 0x005F, +}; + +s16 D_8082B454[] = { + 0x0055, 0x0075, 0x0075, 0x0075, 0x0075, 0x0075, 0x0096, 0x0096, 0x00FF, 0x0064, + 0x00FF, 0x0000, 0x0000, 0x0064, 0x00FF, 0x0000, 0x0000, 0x00FF, 0x0064, 0x0000, +}; + +u8 D_8082B47C[] = { + 0x35, 0x33, 0x34, 0x32, 0xFF, +}; + +s16 D_8082B484[] = { + 0x0294, + 0x0384, + 0x0474, + 0x0000, +}; + +s16 D_8082B48C[] = { + 0x044C, + 0x0398, + 0x044C, + 0x0000, +}; + +s32 D_8082B494[] = { 0, 0, 0 }; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081B240.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081B6BC.s") diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 83869bd10..6e23e8f6f 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -16,6 +16,87 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +s32 D_8082B4A0[] = { 0x09003600, 0x09003F00, 0x09004800 }; + +s32 D_8082B4AC[] = { + 0x0D000000, + 0x0D000800, + 0x0D001000, + 0x0D001800, +}; + +s16 D_8082B4BC[] = { + 0x0043, + 0x0051, + 0x005F, + 0x006D, +}; + +s16 D_8082B4C4 = 0x7B; +s16 D_8082B4C8 = 30; +s16 D_8082B4CC = 0; +s16 D_8082B4D0 = 0xF; +s16 D_8082B4D4 = 0; +s16 D_8082B4D8 = 0xFF; +f32 D_8082B4DC = 100.0f; + +s32 D_8082B4E0[] = { + 0x02008998, 0x0C001B80, 0x02008998, 0x0C001B80, 0x02009598, 0x0C002780, 0x02009598, 0x0C002780, + 0x0200A198, 0x0C003380, 0x0200A198, 0x0C003380, 0x0200AD98, 0x0C003F80, 0x0200AD98, 0x0C003F80, +}; + +s32 D_8082B520[] = { + 0xFF6EA05A, + 0xFF6478FF, + 0xFFF5F55A, +}; + +s32 D_8082B52C[] = { + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFE1AA00, +}; + +s32 D_8082B538[] = { + 0x00000400, + 0x00000000, + 0x00000000, + 0x00000000, +}; + +s16 D_8082B548[] = { + 0x0C00, 0x8418, 0x0C00, 0x9098, 0x0C01, 0x2898, 0x0C01, 0x35D8, 0x0C01, 0x4318, + 0x0C00, 0xDE58, 0x0C00, 0xEB58, 0x0C00, 0xFAA8, 0x0C00, 0x9858, 0x0C00, 0x9E58, + 0x0C00, 0xAE58, 0x0C00, 0xBE58, 0x0C00, 0xCE58, 0x0C01, 0x09F8, 0x0C01, 0x1958, +}; + +s16 D_8082B584[] = { + 0x0000, 0x0000, 0x00FF, 0x00FF, 0x00FF, 0x0000, +}; + +s16 D_8082B590[] = { + 0x00FF, 0x00FF, 0x0000, 0x0000, 0x0000, 0x00FF, +}; + +s16 D_8082B59C[] = { + 0x0056, 0x0068, 0x0091, 0x0099, 0x00A3, 0x009F, 0x009D, 0x00C7, 0x00D0, 0x00D2, 0x00DA, 0x0000, +}; + +s16 D_8082B5B4[] = { + 0x007F, 0x0099, 0x008A, 0x00AB, 0x0092, 0x0077, 0x004D, 0x006A, 0x0078, 0x0049, 0x0063, 0x0000, +}; + +s16 D_8082B5CC[] = { + 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, 0x0005, 0x0004, 0x0006, 0x0000, 0x0008, +}; + +u16 D_8082B5E0[] = { + 0xAF, 0xB3, 0xAA, 0xB1, 0xA9, 0xB2, 0xA8, 0xB0, 0xAC, 0xAE, +}; +u16 D_8082B5F4 = 0; + +s32 D_8082B5F8[] = { 0, 0 }; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D240.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081D6DC.s") diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 04fa566e3..aa24bf2e2 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -16,6 +16,48 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +s32 D_8082B600 = 0; + +s32 D_8082B604 = 0; + +s16 D_8082B608 = 10; + +s32 D_8082B60C[] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00010000, + 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, + 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, + 0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101, +}; + +s32 D_8082B684[] = { + 0x01010004, 0x02020180, 0x01040210, 0x00100201, 0x00080110, 0x02040220, 0x00400080, 0x00020102, 0x00010240, + 0x01200108, 0x00200140, 0x02080280, 0x00FF0064, 0x00FF0000, 0x00000064, 0x00FF0000, 0x000000FF, 0x00640000, +}; + +u8 D_8082B6CC[] = { 0x35, 0x33, 0x34, 0x32, 0xFF }; + +s16 D_8082B6D4[] = { + 0x0294, + 0x0384, + 0x0474, + 0x0000, +}; + +s16 D_8082B6DC[] = { + 0x044C, + 0x0398, + 0x044C, + 0x0000, +}; + +s32 D_8082B6E4[] = { 0, 0, 0 }; + +s16 D_8082B6F0[] = { 100, 255 }; + +s32 D_8082B6F4 = 0; + +s16 D_8082B6F8[] = { 10, 0, 0, 0 }; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FF80.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808204AC.s") diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index 91c6b044d..f4c91e9e8 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -1,8 +1,25 @@ -#ifndef _Z64_KALEIDO_SCOPE_H_ -#define _Z64_KALEIDO_SCOPE_H_ +#ifndef Z_KALEIDO_SCOPE_H +#define Z_KALEIDO_SCOPE_H #include "global.h" +typedef enum { + /* 0x00 */ PAUSE_ITEM, + /* 0x01 */ PAUSE_MAP, + /* 0x02 */ PAUSE_QUEST, + /* 0x03 */ PAUSE_MASK, + /* 0x04 */ PAUSE_WORLD_MAP +} PauseMenuPage; +typedef enum { + /* 0 */ DEBUG_EDITOR_NONE, + /* 1 */ DEBUG_EDITOR_INVENTORY_INIT, + /* 2 */ DEBUG_EDITOR_INVENTORY, + /* 3 */ DEBUG_EDITOR_EVENTS +} DebugEditor; + +// Debug +void KaleidoScope_DrawInventoryEditor(PlayState* play); +void KaleidoScope_UpdateInventoryEditor(PlayState* play); #endif diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 5573ecb11..44575f156 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -16,6 +16,302 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +void* D_8082B700[] = { + 0x08064440, 0x0806E440, 0x08077A40, 0x08081040, 0x0808A640, 0x0D003A00, 0x0806EE40, 0x08078440, + 0x08081A40, 0x0808B040, 0x08065840, 0x0806F840, 0x08078E40, 0x08082440, 0x0808BA40, +}; +void* D_8082B73C[] = { + 0x0D004400, 0x08070240, 0x08079840, 0x08082E40, 0x0808C440, 0x0D004E00, 0x08070C40, 0x0807A240, + 0x08083840, 0x0808CE40, 0x0D005800, 0x08071640, 0x0807AC40, 0x08084240, 0x0808D840, +}; +void* D_8082B778[] = { + 0x08068040, 0x08072040, 0x0807B640, 0x08084C40, 0x0808E240, 0x0D006200, 0x08072A40, 0x0807C040, + 0x08085640, 0x0808EC40, 0x08069440, 0x08073440, 0x0807CA40, 0x08086040, 0x0808F640, +}; +void* D_8082B7B4[] = { + 0x0D006C00, 0x08073E40, 0x0807D440, 0x08086A40, 0x08090040, 0x0D007600, 0x08074840, 0x0807DE40, + 0x08087440, 0x08090A40, 0x0D008000, 0x08075240, 0x0807E840, 0x08087E40, 0x08091440, +}; + +s16 D_8082B7F0[] = { + 0x0050, 0x0040, 0x0040, 0x0040, 0x0010, 0x0040, 0x0070, 0x0070, 0x0030, 0x0040, 0x0040, 0x0040, + 0x0040, 0x0030, 0x0040, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, +}; +s16 D_8082B838[] = { + 0x0028, 0x001F, 0x0035, 0x0035, 0x0035, 0x0034, 0x0023, 0x0023, 0x0020, 0x0040, 0x0040, 0x0040, + 0x0040, 0x0052, 0x003D, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, + 0x0008, 0x0008, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, +}; + +s16 D_8082B880 = 0; +s16 D_8082B884 = 0; +s16 D_8082B888 = 0; +s16 D_8082B88C = 255; +s16 D_8082B890 = 0; +s16 D_8082B894 = 0; +s16 D_8082B898 = 0; +s16 D_8082B89C = 0; +s16 D_8082B8A0 = 0; +s16 D_8082B8A4 = 0; +s16 D_8082B8A8 = 255; +s16 D_8082B8AC = 0; +s16 D_8082B8B0 = 0; + +s16 D_8082B8B4 = false; + +f32 D_8082B8B8[] = { + -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, -4.0f, -4.0f, +}; + +f32 D_8082B8D8[] = { + -4.0f, -4.0f, -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, +}; + +s16 D_8082B8F8[] = { + PAUSE_MAP, PAUSE_MASK, PAUSE_QUEST, PAUSE_ITEM, PAUSE_MASK, PAUSE_MAP, PAUSE_ITEM, PAUSE_QUEST, +}; + +f32 D_8082B908 = 0.0f; +f32 D_8082B90C = 0.0f; +f32 D_8082B910 = 40.0f; +f32 D_8082B914 = -40.0f; + +s32 D_8082B918 = 0; + +s32 D_8082B91C = 0; + +s16 D_8082B920 = 10; + +u8 D_8082B924[] = { + 0x00, 0x14, 0x00, 0x04, 0x00, 0x14, 0x00, 0x0A, 0x0F, 0x1F, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x07, 0x07, 0x03, 0x0F, 0x07, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0x1F, 0x0F, 0x03, 0x0F, 0x00, 0x00, +}; + +s16 D_8082B944 = 0x42; + +s16 D_8082B948[][3] = { + { 0x00FF, 0x00FF, 0x00FF }, { 0x00FF, 0x00FF, 0x00FF }, { 0x00FF, 0x00FF, 0x0000 }, + { 0x00FF, 0x00FF, 0x0000 }, { 0x0064, 0x0096, 0x00FF }, { 0x0064, 0x00FF, 0x00FF }, +}; + +s16 D_8082B96C[][3] = { + { 0x0000, 0x0000, 0x0000 }, { 0x00AA, 0x00AA, 0x00AA }, { 0x0000, 0x0000, 0x0000 }, + { 0x00FF, 0x00A0, 0x0000 }, { 0x0000, 0x0000, 0x0064 }, { 0x0000, 0x0096, 0x00FF }, +}; + +s16 D_8082B990 = 10; +s16 D_8082B994 = 0; + +s32 D_8082B998[] = { + 0x0D003300, + 0x0D002700, + 0x0D002B00, + 0x0D002F00, +}; + +s32 D_8082B9A8[] = { + 0x0D002B00, + 0x0D002F00, + 0x0D003300, + 0x0D002700, +}; + +s16 D_8082B9B8[] = { + 0x00B4, 0x00D2, 0x00FF, 0x00DC, 0x0064, 0x0064, 0x0096, 0x00DC, +}; + +s16 D_8082B9C8 = 20; + +s32 D_8082B9CC = 0; + +s16 D_8082B9D0[] = { + 0x00B4, 0x00D2, 0x00FF, 0x00DC, 0x0064, 0x0064, 0x0096, 0x00DC, +}; + +s16 D_8082B9E0 = 20; + +s32 D_8082B9E4 = 0; + +s32 D_8082B9E8 = 0; + +s32 D_8082B9EC = 0; + +s16 D_8082B9F0[] = { + 0xFFEB, 0xFF98, 0xFFB4, 0xFFD0, 0xFF98, 0xFFD8, +}; + +s32 D_8082B9FC = 0; + +s16 D_8082BA00[] = { + 0xFFD7, 0x0009, 0x002B, 0xFFEB, 0xFFDB, 0x002B, 0xFFBB, 0xFFBB, 0xFFE0, 0xFF93, 0xFFD3, 0xFF93, + 0xFFD3, 0x003B, 0xFFFB, 0xFFBA, 0xFFCC, 0xFFF5, 0xFFFE, 0x0008, 0x0002, 0x0001, 0x002B, 0x0034, + 0x0036, 0x003E, 0xFFB0, 0xFFC0, 0xFFF7, 0xFFFD, 0xFFF9, 0xFFF0, 0xFFFF, 0x0017, 0x002C, 0x0036, +}; + +s16 D_8082BA48[] = { + 0xFFB4, 0xFFC6, 0x000A, 0xFFC6, 0x000A, 0x0000, +}; + +s32 D_8082BA54 = 0; + +s32 D_8082BA58 = 0; + +s16 D_8082BA5C[] = { + 0x0080, 0x0018, 0x0018, 0x0018, 0x0020, 0x0018, +}; + +s32 D_8082BA68 = 0; + +s16 D_8082BA6C[] = { + 0x0098, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, +}; + +s32 D_8082BA78 = 0; + +s32 D_8082BA7C = 0; + +s16 D_8082BA80[] = { + 0x0036, 0xFFD6, 0xFFD6, 0xFFD6, 0xFFE8, 0x0032, +}; + +s32 D_8082BA8C = 0; + +s16 D_8082BA90[] = { + 0x000B, 0x0016, 0xFFF0, 0xFFF0, 0xFFF0, 0x003B, 0x0018, 0x003B, 0xFFF5, 0xFFFB, 0xFFFB, 0x003B, + 0x003B, 0x0027, 0x001F, 0xFFF6, 0xFFDC, 0xFFED, 0xFFCB, 0xFFE5, 0xFFFE, 0x0029, 0x000B, 0xFFFD, + 0x002D, 0x0012, 0xFFF8, 0xFFDA, 0x0027, 0x001A, 0x0001, 0xFFF9, 0xFFE4, 0xFFE5, 0xFFFF, 0x0018, +}; + +s16 D_8082BAD8[] = { + 0x0024, 0x000A, 0x000A, 0xFFFA, 0xFFFA, 0x0000, +}; + +s32 D_8082BAE4 = 0; + +s32 D_8082BAE8 = 0; + +s16 D_8082BAEC[] = { + 0x0010, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, +}; + +s32 D_8082BAF8 = 0; + +s16 D_8082BAFC[] = { + 0x0010, 0x0030, 0x0030, 0x0010, 0x0010, 0x0000, +}; + +void* D_8082BB08[] = { + &D_8082B9E8, &D_8082B9EC, &D_8082B9F0, &D_8082B9FC, &D_8082BA00, &D_8082BA48, +}; + +void* D_8082BB20[] = { + &D_8082BA54, &D_8082BA58, &D_8082BA5C, &D_8082BA68, &D_8082B7F0, &D_8082BA6C, +}; + +void* D_8082BB38[] = { + &D_8082BA78, &D_8082BA7C, &D_8082BA80, &D_8082BA8C, &D_8082BA90, &D_8082BAD8, +}; + +void* D_8082BB50[] = { + &D_8082BAE4, &D_8082BAE8, &D_8082BAEC, &D_8082BAF8, &D_8082B838, &D_8082BAFC, +}; + +s16 D_8082BB68[] = { + 0x000E, 0xFFFE, 0xFFFE, 0xFFEE, 0xFFEE, 0x0000, +}; + +s16 D_8082BB74[] = { + 0x002D, 0x004E, 0x000A, 0x002D, 0x0050, 0x000B, 0xFF93, 0xFFA9, 0xFFBF, 0xFFD7, 0xFFED, 0xFFEE, 0xFF93, 0xFFA9, + 0xFFBF, 0xFFD7, 0xFFED, 0xFFEE, 0xFF99, 0x0007, 0x0052, 0xFF92, 0xFFCA, 0xFF9E, 0xFFAA, 0xFFB6, 0xFFC2, 0xFFCE, + 0xFFDA, 0xFFE6, 0xFFF2, 0xFF9E, 0xFFAA, 0xFFB6, 0xFFC2, 0xFFCE, 0xFFDA, 0xFFE6, 0xFFF2, 0x0000, +}; + +s16 D_8082BBC4[] = { + 0x003E, 0x002A, 0x002A, 0x0014, 0xFFF7, 0xFFF7, 0xFFEC, 0xFFEC, 0xFFEC, 0xFFEC, 0xFFEC, 0xFFEC, 0x0002, 0x0002, + 0x0002, 0x0002, 0x0002, 0x0002, 0x0036, 0xFFD4, 0xFFD4, 0x0022, 0x003A, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, + 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0xFFCC, 0x0000, +}; + +s16 D_8082BC14[] = { + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, + 0x0010, 0x0010, 0x0010, 0x0010, 0x0020, 0x0020, 0x0020, 0x0018, 0x0030, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, + 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, +}; + +s16 D_8082BC64[] = { + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, + 0x0018, 0x0018, 0x0018, 0x0018, 0x0020, 0x0020, 0x0020, 0x0018, 0x0030, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, + 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, +}; + +f32 D_8082BCB4[] = { + -62.0f, -36.0f, -10.0f, 16.0f, 42.0f, 68.0f, +}; + +f32 D_8082BCCC[] = { + 31.0f, + 5.0f, + -21.0f, + -47.0f, +}; + +f32 D_8082BCDC[] = { + -49.0f, -35.0f, -3.0f, 4.0f, 12.0f, 8.0f, 7.0f, 40.0f, 47.0f, 49.0f, 55.0f, +}; + +f32 D_8082BD08[] = { + -15.0f, -36.0f, -23.0f, -49.0f, -29.0f, -8.0f, 25.0f, 2.0f, -9.0f, 28.0f, 7.0f, +}; + +f32 D_8082BD34[] = { + -50.0f, -38.0f, 6.0f, 11.0f, 8.0f, 0.0f, 12.0f, 31.0f, 48.0f, 56.0f, +}; + +f32 D_8082BD5C[] = { + -14.0f, -39.0f, 23.0f, 11.0f, -8.0f, -15.0f, -31.0f, -30.0f, -10.0f, 11.0f, +}; + +f32 D_8082BD84[] = { + -72.0f, -47.0f, -26.0f, -50.0f, -48.0f, -48.0f, -48.0f, -48.0f, -48.0f, +}; + +f32 D_8082BDA8[] = { + -47.0f, -47.0f, -47.0f, -30.0f, 33.0f, 22.0f, 11.0f, -2.0f, -13.0f, +}; + +f32 D_8082BDCC[] = { + 52.0f, 80.0f, 24.0f, 52.0f, 81.0f, 24.0f, -78.0f, -61.0f, -44.0f, -24.0f, -6.0f, -3.0f, + -78.0f, -61.0f, -44.0f, -24.0f, -6.0f, -3.0f, -68.0f, 22.0f, 83.0f, -67.0f, -21.0f, +}; + +f32 D_8082BE28[] = { + 33.0f, 18.0f, 18.0f, 0.0f, -23.0f, -23.0f, -29.0f, -29.0f, -29.0f, -29.0f, -29.0f, -29.0f, + -11.0f, -11.0f, -11.0f, -11.0f, -11.0f, -11.0f, 27.0f, -53.0f, -53.0f, 14.0f, 26.0f, +}; + +s16 D_8082BE84 = 0; + +s16 D_8082BE88[] = { + 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, +}; + +s32 D_8082BE9C = 0; + +s32 D_8082BEA0 = 0; + +s16 D_8082BEA4 = 10; + +s32 D_8082BEA8 = 0; + +s32 D_8082BEAC = 0; + +s32 D_8082BEB0 = 0; + +s32 D_8082BEB4 = 0; + +s32 D_8082BEB8[] = { 0, 0 }; + #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821900.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8082192C.s") diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index f3fca8ff4..22762b51a 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -526,7 +526,7 @@ 0x801BB090 : "z_debug_mode", 0x801BB120 : "z_demo", 0x801BB170 : "z_draw", - 0x801BC240 : "z_eff_footmark", + 0x801BC210 : "z_eff_footmark", 0x801BC2A0 : "", 0x801BC420 : "z_face_reaction", 0x801BD830 : "", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 8ea00efde..708dfceef 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1047,13 +1047,13 @@ 0x800C9598:("BgCheck_InitCollisionHeaders",), 0x800C9640:("BgCheck_ResetPolyCheckTbl",), 0x800C9694:("SurfaceType_GetData",), - 0x800C9704:("SurfaceType_GetCamDataIndex",), - 0x800C9728:("func_800C9728",), - 0x800C9770:("SurfaceType_GetCameraSetting",), - 0x800C97F8:("func_800C97F8",), - 0x800C9844:("func_800C9844",), - 0x800C98CC:("func_800C98CC",), - 0x800C9924:("SurfaceType_GetCamPosData",), + 0x800C9704:("SurfaceType_GetBgCamIndex",), + 0x800C9728:("BgCheck_GetBgCamSettingImpl",), + 0x800C9770:("BgCheck_GetBgCamSetting",), + 0x800C97F8:("BgCheck_GetBgCamCountImpl",), + 0x800C9844:("BgCheck_GetBgCamCount",), + 0x800C98CC:("BgCheck_GetBgCamFuncDataImpl",), + 0x800C9924:("BgCheck_GetBgCamFuncData",), 0x800C99AC:("SurfaceType_GetSceneExitIndex",), 0x800C99D4:("func_800C99D4",), 0x800C99FC:("func_800C99FC",), @@ -1085,9 +1085,9 @@ 0x800CA1E8:("WaterBox_GetSurface1_2",), 0x800CA22C:("WaterBox_GetSurface2",), 0x800CA568:("func_800CA568",), - 0x800CA634:("WaterBox_GetCamDataIndex",), - 0x800CA648:("WaterBox_GetCameraSetting",), - 0x800CA6B8:("func_800CA6B8",), + 0x800CA634:("WaterBox_GetBgCamIndex",), + 0x800CA648:("WaterBox_GetBgCamSetting",), + 0x800CA6B8:("WaterBox_GetSceneBgCamSetting",), 0x800CA6D8:("WaterBox_GetLightSettingIndex",), 0x800CA6F0:("func_800CA6F0",), 0x800CA9D0:("func_800CA9D0",), @@ -1131,7 +1131,7 @@ 0x800CB7F8:("func_800CB7F8",), 0x800CB828:("func_800CB828",), 0x800CB854:("func_800CB854",), - 0x800CB880:("func_800CB880",), + 0x800CB880:("Camera_IsSwimming",), 0x800CB8C8:("func_800CB8C8",), 0x800CB8F4:("func_800CB8F4",), 0x800CB924:("func_800CB924",), @@ -1154,10 +1154,10 @@ 0x800CC488:("func_800CC488",), 0x800CC56C:("func_800CC56C",), 0x800CC5C8:("func_800CC5C8",), - 0x800CC740:("func_800CC740",), - 0x800CC7A8:("func_800CC7A8",), - 0x800CC804:("func_800CC804",), - 0x800CC874:("func_800CC874",), + 0x800CC740:("Camera_GetBgCamOrActorCsCamSetting",), + 0x800CC7A8:("Camera_GetBgCamOrActorCsCamFuncData",), + 0x800CC804:("Camera_GetBgCamIndex",), + 0x800CC874:("Camera_GetWaterBoxBgCamSetting",), 0x800CC938:("func_800CC938",), 0x800CC958:("func_800CC958",), 0x800CC9C0:("func_800CC9C0",), @@ -1583,29 +1583,29 @@ 0x800EE29C:("Cutscene_CheckActorAction",), 0x800EE2F4:("Cutscene_IsPlaying",), 0x800EE320:("GetItem_Draw",), - 0x800EE364:("func_800EE364",), - 0x800EE400:("func_800EE400",), - 0x800EE5FC:("func_800EE5FC",), - 0x800EE7D8:("func_800EE7D8",), - 0x800EE940:("func_800EE940",), - 0x800EEA48:("func_800EEA48",), - 0x800EEC18:("func_800EEC18",), - 0x800EED20:("func_800EED20",), - 0x800EEE34:("func_800EEE34",), - 0x800EEF4C:("func_800EEF4C",), - 0x800EF054:("func_800EF054",), - 0x800EF0F0:("func_800EF0F0",), - 0x800EF1F4:("func_800EF1F4",), - 0x800EF2AC:("func_800EF2AC",), - 0x800EF364:("func_800EF364",), - 0x800EF4D4:("func_800EF4D4",), - 0x800EF65C:("func_800EF65C",), - 0x800EF780:("func_800EF780",), - 0x800EF89C:("func_800EF89C",), - 0x800EF984:("func_800EF984",), - 0x800EFAB8:("func_800EFAB8",), - 0x800EFBFC:("func_800EFBFC",), - 0x800EFD44:("func_800EFD44",), + 0x800EE364:("GetItem_DrawBombchu",), + 0x800EE400:("GetItem_DrawPoes",), + 0x800EE5FC:("GetItem_DrawFairyBottle",), + 0x800EE7D8:("GetItem_DrawSkullToken",), + 0x800EE940:("GetItem_DrawCompass",), + 0x800EEA48:("GetItem_DrawPotion",), + 0x800EEC18:("GetItem_DrawGoronSword",), + 0x800EED20:("GetItem_DrawDekuNuts",), + 0x800EEE34:("GetItem_DrawRecoveryHeart",), + 0x800EEF4C:("GetItem_DrawFish",), + 0x800EF054:("GetItem_DrawOpa0",), + 0x800EF0F0:("GetItem_DrawOpa0Xlu1",), + 0x800EF1F4:("GetItem_DrawOpa01",), + 0x800EF2AC:("GetItem_DrawXlu01",), + 0x800EF364:("GetItem_DrawSeahorse",), + 0x800EF4D4:("GetItem_DrawFairyContainer",), + 0x800EF65C:("GetItem_DrawMoonsTear",), + 0x800EF780:("GetItem_DrawMagicArrow",), + 0x800EF89C:("GetItem_DrawUpgrades",), + 0x800EF984:("GetItem_DrawRupee",), + 0x800EFAB8:("GetItem_DrawSmallRupee",), + 0x800EFBFC:("GetItem_DrawWallet",), + 0x800EFD44:("GetItem_DrawRemains",), 0x800EFE60:("EffFootmark_Init",), 0x800EFF04:("EffFootmark_Add",), 0x800F00BC:("EffFootmark_Update",), @@ -1657,7 +1657,7 @@ 0x800F20F8:("ActorCutscene_GetLength",), 0x800F2138:("func_800F2138",), 0x800F2178:("func_800F2178",), - 0x800F21B8:("ActorCutscene_GetCurrentCamera",), + 0x800F21B8:("ActorCutscene_GetCurrentSubCamId",), 0x800F21CC:("func_800F21CC",), 0x800F22C4:("func_800F22C4",), 0x800F23C4:("ActorCutscene_SetReturnCamera",), @@ -3022,8 +3022,8 @@ 0x80169AFC:("func_80169AFC",), 0x80169BC4:("Play_CameraGetUID",), 0x80169BF8:("func_80169BF8",), - 0x80169C64:("Play_GetCsCamDataSetting",), - 0x80169C84:("Play_GetCsCamDataVec3s",), + 0x80169C64:("Play_GetActorCsCamSetting",), + 0x80169C84:("Play_GetActorCsCamFuncData",), 0x80169CBC:("Play_GetOriginalSceneNumber",), 0x80169D40:("Play_SaveCycleSceneFlags",), 0x80169DCC:("Play_SetRespawnData",), @@ -3767,41 +3767,41 @@ 0x80197138:("AudioEffects_NotePortamentoInit",), 0x80197164:("AudioEffects_AdsrInit",), 0x80197188:("AudioEffects_AdsrUpdate",), - 0x801974D0:("func_801974D0",), - 0x80197538:("func_80197538",), - 0x80197714:("func_80197714",), - 0x80197880:("func_80197880",), - 0x801979D8:("func_801979D8",), - 0x80197A54:("func_80197A54",), + 0x801974D0:("AudioSeq_GetScriptControlFlowArgument",), + 0x80197538:("AudioSeq_HandleScriptFlowControl",), + 0x80197714:("AudioSeq_InitSequenceChannel",), + 0x80197880:("AudioSeq_SeqChannelSetLayer",), + 0x801979D8:("AudioSeq_SeqLayerDisable",), + 0x80197A54:("AudioSeq_SeqLayerFree",), 0x80197AA4:("AudioSeq_SequenceChannelDisable",), - 0x80197B14:("func_80197B14",), - 0x80197C0C:("func_80197C0C",), - 0x80197C8C:("func_80197C8C",), + 0x80197B14:("AudioSeq_SequencePlayerSetupChannels",), + 0x80197C0C:("AudioSeq_SequencePlayerDisableChannels",), + 0x80197C8C:("AudioSeq_SequenceChannelEnable",), 0x80197D24:("AudioSeq_SequencePlayerDisableAsFinished",), 0x80197D4C:("AudioSeq_SequencePlayerDisable",), 0x80197E08:("AudioSeq_AudioListPushBack",), 0x80197E48:("AudioSeq_AudioListPopBack",), - 0x80197E88:("func_80197E88",), - 0x80197F28:("func_80197F28",), - 0x80197F3C:("func_80197F3C",), - 0x80197F74:("func_80197F74",), - 0x80197FB4:("func_80197FB4",), - 0x801980D0:("func_801980D0",), - 0x8019815C:("func_8019815C",), - 0x8019825C:("func_8019825C",), - 0x80198640:("func_80198640",), - 0x80198CE0:("func_80198CE0",), - 0x801990F4:("func_801990F4",), - 0x80199124:("func_80199124",), - 0x80199198:("func_80199198",), - 0x80199244:("func_80199244",), - 0x80199268:("func_80199268",), - 0x8019A0BC:("func_8019A0BC",), - 0x8019AA3C:("func_8019AA3C",), - 0x8019AAF0:("func_8019AAF0",), + 0x80197E88:("AudioSeq_InitLayerFreelist",), + 0x80197F28:("AudioSeq_ScriptReadU8",), + 0x80197F3C:("AudioSeq_ScriptReadS16",), + 0x80197F74:("AudioSeq_ScriptReadCompressedU16",), + 0x80197FB4:("AudioSeq_SeqLayerProcessScript",), + 0x801980D0:("AudioSeq_SeqLayerProcessScriptStep1",), + 0x8019815C:("AudioSeq_SeqLayerProcessScriptStep5",), + 0x8019825C:("AudioSeq_SeqLayerProcessScriptStep2",), + 0x80198640:("AudioSeq_SeqLayerProcessScriptStep4",), + 0x80198CE0:("AudioSeq_SeqLayerProcessScriptStep3",), + 0x801990F4:("AudioSeq_SetChannelPriorities",), + 0x80199124:("AudioSeq_GetInstrument",), + 0x80199198:("AudioSeq_SetInstrument",), + 0x80199244:("AudioSeq_SequenceChannelSetVolume",), + 0x80199268:("AudioSeq_SequenceChannelProcessScript",), + 0x8019A0BC:("AudioSeq_SequencePlayerProcessSequence",), + 0x8019AA3C:("AudioSeq_ProcessSequences",), + 0x8019AAF0:("AudioSeq_SkipForwardSequence",), 0x8019AB40:("AudioSeq_ResetSequencePlayer",), 0x8019AC10:("AudioSeq_InitSequencePlayerChannels",), - 0x8019ACEC:("func_8019ACEC",), + 0x8019ACEC:("AudioSeq_InitSequencePlayer",), 0x8019ADBC:("AudioSeq_InitSequencePlayers",), 0x8019AE40:("func_8019AE40",), 0x8019AEC0:("func_8019AEC0",), @@ -4089,19 +4089,19 @@ 0x8080066C:("Title_Main",), 0x8080071C:("Title_Destroy",), 0x8080074C:("Title_Init",), - 0x80800910:("Select_LoadTitle",), - 0x80800930:("Select_LoadGame",), - 0x80800A44:("Select_UpdateMenu",), - 0x808013B8:("Select_PrintMenu",), - 0x80801594:("Select_PrintLoadingMessage",), - 0x80801620:("Select_PrintAgeSetting",), - 0x808016E8:("Select_PrintCutsceneSetting",), - 0x8080194C:("Select_DrawMenu",), - 0x808019FC:("Select_DrawLoadingScreen",), - 0x80801A64:("Select_Draw",), - 0x80801AFC:("Select_Main",), - 0x80801B28:("Select_Destroy",), - 0x80801B4C:("Select_Init",), + 0x80800910:("MapSelect_LoadTitle",), + 0x80800930:("MapSelect_LoadGame",), + 0x80800A44:("MapSelect_UpdateMenu",), + 0x808013B8:("MapSelect_PrintMenu",), + 0x80801594:("MapSelect_PrintLoadingMessage",), + 0x80801620:("MapSelect_PrintAgeSetting",), + 0x808016E8:("MapSelect_PrintCutsceneSetting",), + 0x8080194C:("MapSelect_DrawMenu",), + 0x808019FC:("MapSelect_DrawLoadingScreen",), + 0x80801A64:("MapSelect_Draw",), + 0x80801AFC:("MapSelect_Main",), + 0x80801B28:("MapSelect_Destroy",), + 0x80801B4C:("MapSelect_Init",), 0x80803DF0:("Opening_SetupForTitleCutscene",), 0x80803EA0:("func_80803EA0",), 0x80803EC0:("Opening_Main",), @@ -4200,10 +4200,10 @@ 0x808160A0:("func_808160A0",), 0x80817B5C:("func_80817B5C",), 0x80818904:("func_80818904",), - 0x80818920:("func_80818920",), - 0x808190C4:("func_808190C4",), - 0x80819238:("func_80819238",), - 0x80819F04:("func_80819F04",), + 0x80818920:("KaleidoScope_DrawInventoryEditorText",), + 0x808190C4:("KaleidoScope_DrawDigit",), + 0x80819238:("KaleidoScope_DrawInventoryEditor",), + 0x80819F04:("KaleidoScope_UpdateInventoryEditor",), 0x8081B240:("func_8081B240",), 0x8081B6BC:("func_8081B6BC",), 0x8081B6EC:("func_8081B6EC",), @@ -7074,44 +7074,44 @@ 0x809294B0:("ObjTsubo_Draw",), 0x80929910:("EnIk_Init",), 0x80929A98:("EnIk_Destroy",), - 0x80929AF8:("func_80929AF8",), - 0x80929B6C:("func_80929B6C",), - 0x80929BEC:("func_80929BEC",), - 0x80929C80:("func_80929C80",), - 0x80929D04:("func_80929D04",), - 0x80929E2C:("func_80929E2C",), - 0x80929E88:("func_80929E88",), - 0x80929F20:("func_80929F20",), - 0x80929FC8:("func_80929FC8",), - 0x8092A020:("func_8092A020",), - 0x8092A124:("func_8092A124",), - 0x8092A188:("func_8092A188",), - 0x8092A28C:("func_8092A28C",), - 0x8092A33C:("func_8092A33C",), - 0x8092A570:("func_8092A570",), - 0x8092A5BC:("func_8092A5BC",), - 0x8092A680:("func_8092A680",), - 0x8092A754:("func_8092A754",), - 0x8092A8D8:("func_8092A8D8",), - 0x8092A994:("func_8092A994",), - 0x8092AA6C:("func_8092AA6C",), - 0x8092AB14:("func_8092AB14",), - 0x8092AB50:("func_8092AB50",), - 0x8092ABD8:("func_8092ABD8",), - 0x8092AC4C:("func_8092AC4C",), - 0x8092ACFC:("func_8092ACFC",), - 0x8092ADB4:("func_8092ADB4",), - 0x8092AE14:("func_8092AE14",), - 0x8092AFB4:("func_8092AFB4",), - 0x8092AFD4:("func_8092AFD4",), - 0x8092B03C:("func_8092B03C",), - 0x8092B098:("func_8092B098",), - 0x8092B1B4:("func_8092B1B4",), - 0x8092B46C:("func_8092B46C",), + 0x80929AF8:("EnIk_Freeze",), + 0x80929B6C:("EnIk_Thaw",), + 0x80929BEC:("EnIk_HitArmor",), + 0x80929C80:("EnIk_IsChangingAction",), + 0x80929D04:("EnIk_ChooseAttack",), + 0x80929E2C:("EnIk_CheckActions",), + 0x80929E88:("EnIk_SetupIdle",), + 0x80929F20:("EnIk_Idle",), + 0x80929FC8:("EnIk_SetupWalk",), + 0x8092A020:("EnIk_WalkTowardsPlayer",), + 0x8092A124:("EnIk_SetupRun",), + 0x8092A188:("EnIk_RunTowardsPlayer",), + 0x8092A28C:("EnIk_SetupVerticalAttack",), + 0x8092A33C:("EnIk_VerticalAttack",), + 0x8092A570:("EnIk_SetupTakeOutAxe",), + 0x8092A5BC:("EnIk_TakeOutAxe",), + 0x8092A680:("EnIk_SetupHorizontalDoubleAttack",), + 0x8092A754:("EnIk_HorizontalDoubleAttack",), + 0x8092A8D8:("EnIk_SetupSingleHorizontalAttack",), + 0x8092A994:("EnIk_SingleHorizontalAttack",), + 0x8092AA6C:("EnIk_SetupEndHorizontalAttack",), + 0x8092AB14:("EnIk_EndHorizontalAttack",), + 0x8092AB50:("EnIk_SetupBlock",), + 0x8092ABD8:("EnIk_Block",), + 0x8092AC4C:("EnIk_SetupReactToAttack",), + 0x8092ACFC:("EnIk_ReactToAttack",), + 0x8092ADB4:("EnIk_SetupDie",), + 0x8092AE14:("EnIk_Die",), + 0x8092AFB4:("EnIk_SetupFrozen",), + 0x8092AFD4:("EnIk_Frozen",), + 0x8092B03C:("EnIk_SetupCutscene",), + 0x8092B098:("EnIk_PlayCutscene",), + 0x8092B1B4:("EnIk_UpdateDamage",), + 0x8092B46C:("EnIk_UpdateArmor",), 0x8092B5FC:("EnIk_Update",), - 0x8092B900:("func_8092B900",), - 0x8092B93C:("func_8092B93C",), - 0x8092BC6C:("func_8092BC6C",), + 0x8092B900:("EnIk_OverrideLimbDraw",), + 0x8092B93C:("EnIk_PostLimbDraw",), + 0x8092BC6C:("EnIk_UpdateArmorDraw",), 0x8092BE14:("EnIk_Draw",), 0x8092C530:("DemoShd_Init",), 0x8092C540:("DemoShd_Destroy",), @@ -8145,8 +8145,8 @@ 0x80978B68:("EffectSsBlast_Update",), 0x80978C30:("EffectSsGSpk_Init",), 0x80978D70:("EffectSsGSpk_Draw",), - 0x80978F40:("func_80978F40",), - 0x80979068:("func_80979068",), + 0x80978F40:("EffectSsGSpk_Update",), + 0x80979068:("EffectSsGSpk_UpdateNoAccel",), 0x809791B0:("func_809791B0",), 0x80979228:("EffectSsDFire_Init",), 0x8097930C:("EffectSsDFire_Draw",), @@ -8155,7 +8155,7 @@ 0x80979738:("EffectSsBubble_Draw",), 0x8097985C:("EffectSsBubble_Update",), 0x80979B30:("EffectSsGRipple_Init",), - 0x80979C38:("func_80979C38",), + 0x80979C38:("EffectSsGRipple_DrawRipple",), 0x80979E48:("EffectSsGRipple_Draw",), 0x80979E80:("EffectSsGRipple_Update",), 0x8097A050:("EffectSsGSplash_Init",), @@ -8305,49 +8305,49 @@ 0x80987A3C:("OceffWipe3_Destroy",), 0x80987A70:("OceffWipe3_Update",), 0x80987AD0:("OceffWipe3_Draw",), - 0x80989140:("func_80989140",), - 0x80989204:("func_80989204",), - 0x8098933C:("func_8098933C",), - 0x80989418:("func_80989418",), - 0x809895B4:("func_809895B4",), - 0x80989674:("func_80989674",), - 0x80989864:("func_80989864",), - 0x80989974:("func_80989974",), - 0x809899C8:("func_809899C8",), - 0x80989A08:("func_80989A08",), - 0x80989A48:("func_80989A48",), - 0x80989A9C:("func_80989A9C",), - 0x80989ADC:("func_80989ADC",), - 0x80989BF8:("func_80989BF8",), - 0x80989D38:("func_80989D38",), - 0x80989E18:("func_80989E18",), - 0x80989FC8:("func_80989FC8",), - 0x8098A064:("func_8098A064",), - 0x8098A1B4:("func_8098A1B4",), - 0x8098A234:("func_8098A234",), - 0x8098A468:("func_8098A468",), - 0x8098A55C:("func_8098A55C",), - 0x8098A618:("func_8098A618",), - 0x8098A70C:("func_8098A70C",), - 0x8098A89C:("func_8098A89C",), - 0x8098A938:("func_8098A938",), - 0x8098AAAC:("func_8098AAAC",), - 0x8098AB48:("func_8098AB48",), - 0x8098AC34:("func_8098AC34",), - 0x8098AE58:("func_8098AE58",), - 0x8098AF44:("func_8098AF44",), - 0x8098AF98:("func_8098AF98",), - 0x8098B004:("func_8098B004",), - 0x8098B198:("func_8098B198",), - 0x8098B28C:("func_8098B28C",), - 0x8098B390:("func_8098B390",), - 0x8098B464:("func_8098B464",), - 0x8098B560:("func_8098B560",), - 0x8098B88C:("func_8098B88C",), - 0x8098BA64:("func_8098BA64",), - 0x8098BB10:("func_8098BB10",), - 0x8098BBEC:("func_8098BBEC",), - 0x8098BC54:("func_8098BC54",), + 0x80989140:("EnDg_ChangeAnimation",), + 0x80989204:("EnDg_UpdateCollision",), + 0x8098933C:("EnDg_GetFloorRot",), + 0x80989418:("EnDg_HasReachedPoint",), + 0x809895B4:("EnDg_GetYRotation",), + 0x80989674:("EnDg_MoveAlongPath",), + 0x80989864:("EnDg_SpawnFloorDustRing",), + 0x80989974:("EnDg_PlaySfxWalk",), + 0x809899C8:("EnDg_PlaySfxBark",), + 0x80989A08:("EnDg_PlaySfxAngryBark",), + 0x80989A48:("EnDg_PlaySfxWhine",), + 0x80989A9C:("EnDg_PlaySfxGrowl",), + 0x80989ADC:("EnDg_SetupIdleMove",), + 0x80989BF8:("EnDg_UpdateTextId",), + 0x80989D38:("EnDg_StartTextBox",), + 0x80989E18:("EnDg_TryPickUp",), + 0x80989FC8:("EnDg_FindFollowerForBremenMask",), + 0x8098A064:("EnDg_CheckForBremenMaskMarch",), + 0x8098A1B4:("EnDg_ShouldReactToNonHumanPlayer",), + 0x8098A234:("EnDg_ChooseActionForForm",), + 0x8098A468:("EnDg_IdleMove",), + 0x8098A55C:("EnDg_IdleBark",), + 0x8098A618:("EnDg_BackAwayFromGoron",), + 0x8098A70C:("EnDg_RunAwayFromGoron",), + 0x8098A89C:("EnDg_BarkAtGoron",), + 0x8098A938:("EnDg_ApproachPlayerToAttack",), + 0x8098AAAC:("EnDg_RunAfterAttacking",), + 0x8098AB48:("EnDg_SitNextToPlayer",), + 0x8098AC34:("EnDg_JumpAttack",), + 0x8098AE58:("EnDg_WalkToPlayer",), + 0x8098AF44:("EnDg_SetupBremenMaskApproachPlayer",), + 0x8098AF98:("EnDg_Fall",), + 0x8098B004:("EnDg_ApproachPlayer",), + 0x8098B198:("EnDg_SlowlyBackUpBeforeAttacking",), + 0x8098B28C:("EnDg_BackAwayFromPlayer",), + 0x8098B390:("EnDg_BarkAtPlayer",), + 0x8098B464:("EnDg_SetupSwim",), + 0x8098B560:("EnDg_Swim",), + 0x8098B88C:("EnDg_JumpOutOfWater",), + 0x8098BA64:("EnDg_Held",), + 0x8098BB10:("EnDg_Thrown",), + 0x8098BBEC:("EnDg_SetupTalk",), + 0x8098BC54:("EnDg_Talk",), 0x8098BCA8:("EnDg_Init",), 0x8098BE18:("EnDg_Destroy",), 0x8098BE44:("EnDg_Update",), @@ -8830,7 +8830,7 @@ 0x809AC7F8:("func_809AC7F8",), 0x809AC970:("func_809AC970",), 0x809AC9B8:("BgFireWall_Update",), - 0x809ACB28:("func_809ACB28",), + 0x809ACB28:("BgFireWall_Draw",), 0x809ACD90:("EnBu_Init",), 0x809ACDA8:("EnBu_Destroy",), 0x809ACDB8:("EnBu_DoNothing",), @@ -9080,33 +9080,33 @@ 0x809C5E14:("EnBomBowlMan_Update",), 0x809C5F44:("EnBomBowlMan_OverrideLimbDraw",), 0x809C5FC4:("EnBomBowlMan_Draw",), - 0x809C64C0:("func_809C64C0",), + 0x809C64C0:("EnSyatekiMan_Swamp_SpawnTargetActors",), 0x809C6578:("EnSyatekiMan_Init",), 0x809C66FC:("EnSyatekiMan_Destroy",), - 0x809C6720:("func_809C6720",), - 0x809C6810:("func_809C6810",), - 0x809C6848:("func_809C6848",), - 0x809C6A04:("func_809C6A04",), - 0x809C6C2C:("func_809C6C2C",), - 0x809C6E30:("func_809C6E30",), - 0x809C6F98:("func_809C6F98",), - 0x809C72D8:("func_809C72D8",), - 0x809C7380:("func_809C7380",), - 0x809C7620:("func_809C7620",), - 0x809C7990:("func_809C7990",), - 0x809C7A90:("func_809C7A90",), - 0x809C7C14:("func_809C7C14",), - 0x809C7D14:("func_809C7D14",), - 0x809C7EB4:("func_809C7EB4",), - 0x809C7FFC:("func_809C7FFC",), - 0x809C80C0:("func_809C80C0",), - 0x809C81D0:("func_809C81D0",), - 0x809C8488:("func_809C8488",), - 0x809C8610:("func_809C8610",), - 0x809C8710:("func_809C8710",), - 0x809C8808:("func_809C8808",), - 0x809C898C:("func_809C898C",), - 0x809C8BF0:("func_809C8BF0",), + 0x809C6720:("EnSyatekiMan_MovePlayerToPos",), + 0x809C6810:("EnSyatekiMan_SetupIdle",), + 0x809C6848:("EnSyatekiMan_Swamp_Idle",), + 0x809C6A04:("EnSyatekiMan_Swamp_HandleChoice",), + 0x809C6C2C:("EnSyatekiMan_Swamp_HandleNormalMessage",), + 0x809C6E30:("EnSyatekiMan_Swamp_Talk",), + 0x809C6F98:("EnSyatekiMan_Town_StartIntroTextbox",), + 0x809C72D8:("EnSyatekiMan_Town_Idle",), + 0x809C7380:("EnSyatekiMan_Town_HandleChoice",), + 0x809C7620:("EnSyatekiMan_Town_HandleNormalMessage",), + 0x809C7990:("EnSyatekiMan_Town_Talk",), + 0x809C7A90:("EnSyatekiMan_Swamp_SetupGiveReward",), + 0x809C7C14:("EnSyatekiMan_Swamp_GiveReward",), + 0x809C7D14:("EnSyatekiMan_Town_SetupGiveReward",), + 0x809C7EB4:("EnSyatekiMan_Town_GiveReward",), + 0x809C7FFC:("EnSyatekiMan_Swamp_MovePlayerAndExplainRules",), + 0x809C80C0:("EnSyatekiMan_Swamp_StartGame",), + 0x809C81D0:("EnSyatekiMan_Swamp_RunGame",), + 0x809C8488:("EnSyatekiMan_Swamp_EndGame",), + 0x809C8610:("EnSyatekiMan_Swamp_AddBonusPoints",), + 0x809C8710:("EnSyatekiMan_Town_MovePlayerAndSayHighScore",), + 0x809C8808:("EnSyatekiMan_Town_StartGame",), + 0x809C898C:("EnSyatekiMan_Town_RunGame",), + 0x809C8BF0:("EnSyatekiMan_Town_EndGame",), 0x809C8DE8:("EnSyatekiMan_Blink",), 0x809C8E44:("EnSyatekiMan_Update",), 0x809C8EE4:("EnSyatekiMan_OverrideLimbDraw",), @@ -9306,11 +9306,11 @@ 0x809DAAA8:("func_809DAAA8",), 0x809DAB78:("func_809DAB78",), 0x809DBFB4:("func_809DBFB4",), - 0x809DC218:("func_809DC218",), - 0x809DC320:("Boss02_Update",), - 0x809DC78C:("func_809DC78C",), - 0x809DCA00:("Boss02_Draw",), - 0x809DD0A8:("func_809DD0A8",), + 0x809DC218:("Boss02_Tail_Update",), + 0x809DC320:("Boss02_Twinmold_Update",), + 0x809DC78C:("Boss02_Static_Update",), + 0x809DCA00:("Boss02_Twinmold_Draw",), + 0x809DD0A8:("Boss02_Static_Draw",), 0x809DD0CC:("Boss02_UpdateEffects",), 0x809DD2F8:("Boss02_DrawEffects",), 0x809DD934:("func_809DD934",), @@ -10416,19 +10416,19 @@ 0x80A43274:("EnTest4_Update",), 0x80A434E0:("EnBat_Init",), 0x80A437A0:("EnBat_Destroy",), - 0x80A437CC:("func_80A437CC",), - 0x80A43810:("func_80A43810",), - 0x80A43870:("func_80A43870",), - 0x80A438D4:("func_80A438D4",), - 0x80A438F8:("func_80A438F8",), - 0x80A4392C:("func_80A4392C",), - 0x80A43CA0:("func_80A43CA0",), - 0x80A43CE8:("func_80A43CE8",), - 0x80A43F60:("func_80A43F60",), - 0x80A44114:("func_80A44114",), - 0x80A44294:("func_80A44294",), - 0x80A4431C:("func_80A4431C",), - 0x80A443D8:("func_80A443D8",), + 0x80A437CC:("EnBat_IsGraveyardOnSecondDay",), + 0x80A43810:("EnBat_StepAnimation",), + 0x80A43870:("EnBat_SetupPerch",), + 0x80A438D4:("EnBat_Perch",), + 0x80A438F8:("EnBat_SetupFlyIdle",), + 0x80A4392C:("EnBat_FlyIdle",), + 0x80A43CA0:("EnBat_SetupDiveAttack",), + 0x80A43CE8:("EnBat_DiveAttack",), + 0x80A43F60:("EnBat_SetupDie",), + 0x80A44114:("EnBat_Die",), + 0x80A44294:("EnBat_SetupStunned",), + 0x80A4431C:("EnBat_Stunned",), + 0x80A443D8:("EnBat_UpdateDamage",), 0x80A444B8:("EnBat_Update",), 0x80A44818:("EnBat_Draw",), 0x80A44C80:("EnSekihi_Init",), @@ -10436,9 +10436,9 @@ 0x80A44DE8:("func_80A44DE8",), 0x80A44F40:("func_80A44F40",), 0x80A450B0:("func_80A450B0",), - 0x80A45130:("func_80A45130",), + 0x80A45130:("EnSekihi_DoNothing",), 0x80A45140:("EnSekihi_Update",), - 0x80A45164:("func_80A45164",), + 0x80A45164:("EnSekihi_Draw",), 0x80A45360:("EnWiz_Init",), 0x80A45568:("EnWiz_Destroy",), 0x80A455C4:("func_80A455C4",), @@ -10491,10 +10491,10 @@ 0x80A4BF78:("func_80A4BF78",), 0x80A4C490:("EffChange_Init",), 0x80A4C54C:("EffChange_Destroy",), - 0x80A4C578:("func_80A4C578",), + 0x80A4C578:("EffChange_SetColors",), 0x80A4C5CC:("func_80A4C5CC",), 0x80A4C78C:("EffChange_Update",), - 0x80A4C7B0:("func_80A4C7B0",), + 0x80A4C7B0:("EffChange_Draw",), 0x80A4C9B0:("DmStatue_Init",), 0x80A4C9D4:("DmStatue_Destroy",), 0x80A4C9E4:("DmStatue_Update",), @@ -11197,8 +11197,8 @@ 0x80A83FBC:("func_80A83FBC",), 0x80A84088:("func_80A84088",), 0x80A84338:("func_80A84338",), - 0x80A84CD0:("func_80A84CD0",), - 0x80A84CF8:("func_80A84CF8",), + 0x80A84CD0:("ObjPurify_SetSysMatrix",), + 0x80A84CF8:("ObjPurify_IsPurified",), 0x80A84D68:("ObjPurify_Init",), 0x80A84E68:("ObjPurify_Destroy",), 0x80A84EAC:("func_80A84EAC",), @@ -11212,7 +11212,7 @@ 0x80A850B0:("func_80A850B0",), 0x80A850E8:("func_80A850E8",), 0x80A8515C:("func_80A8515C",), - 0x80A85194:("func_80A85194",), + 0x80A85194:("ObjPurify_DoNothing",), 0x80A851A4:("ObjPurify_Update",), 0x80A851C8:("func_80A851C8",), 0x80A85304:("func_80A85304",), @@ -11547,37 +11547,37 @@ 0x80AA90F4:("func_80AA90F4",), 0x80AA9140:("DmChar01_Update",), 0x80AA922C:("DmChar01_Draw",), - 0x80AAAE30:("DmChar02_ChangeAnimationByInfo",), - 0x80AAAECC:("func_80AAAECC",), - 0x80AAAF2C:("func_80AAAF2C",), + 0x80AAAE30:("DmChar02_ChangeAnimation",), + 0x80AAAECC:("DmChar02_PlaySfxForDroppingOcarinaCutscene",), + 0x80AAAF2C:("DmChar02_PlaySfxForCutscenes",), 0x80AAAF78:("DmChar02_Init",), 0x80AAB03C:("DmChar02_Destroy",), - 0x80AAB04C:("func_80AAB04C",), + 0x80AAB04C:("DmChar02_PerformCutsceneActions",), 0x80AAB19C:("DmChar02_Update",), - 0x80AAB23C:("func_80AAB23C",), - 0x80AAB258:("func_80AAB258",), - 0x80AAB270:("func_80AAB270",), + 0x80AAB23C:("DmChar02_OverrideLimbDraw",), + 0x80AAB258:("DmChar02_PostLimbDraw",), + 0x80AAB270:("DmChar02_TransformLimbDraw",), 0x80AAB284:("DmChar02_Draw",), - 0x80AAB4A0:("func_80AAB4A0",), + 0x80AAB4A0:("DmChar03_ChangeAnimation",), 0x80AAB53C:("DmChar03_Init",), 0x80AAB5E8:("DmChar03_Destroy",), 0x80AAB5F8:("func_80AAB5F8",), 0x80AAB644:("func_80AAB644",), - 0x80AAB700:("func_80AAB700",), + 0x80AAB700:("DmChar03_DoNothing",), 0x80AAB710:("func_80AAB710",), 0x80AAB838:("func_80AAB838",), 0x80AAB8DC:("DmChar03_Update",), - 0x80AAB974:("func_80AAB974",), - 0x80AAB990:("func_80AAB990",), - 0x80AAB9A8:("func_80AAB9A8",), + 0x80AAB974:("DmChar03_OverrideLimbDraw",), + 0x80AAB990:("DmChar03_PostLimbDraw",), + 0x80AAB9A8:("DmChar03_TransformLimbDraw",), 0x80AAB9BC:("DmChar03_Draw",), 0x80AABA84:("func_80AABA84",), - 0x80AABC40:("func_80AABC40",), + 0x80AABC40:("DmChar04_ChangeAnim",), 0x80AABCDC:("DmChar04_Init",), 0x80AABE24:("DmChar04_Destroy",), 0x80AABE34:("func_80AABE34",), 0x80AABF28:("DmChar04_Update",), - 0x80AABF74:("func_80AABF74",), + 0x80AABF74:("DmChar04_OverrideLimbDraw",), 0x80AAC03C:("DmChar04_Draw",), 0x80AAC5A0:("func_80AAC5A0",), 0x80AAC63C:("func_80AAC63C",), @@ -13157,46 +13157,46 @@ 0x80B1A1B0:("TGSw_Draw",), 0x80B1A3B0:("EnPoSisters_Init",), 0x80B1A600:("EnPoSisters_Destroy",), - 0x80B1A648:("func_80B1A648",), - 0x80B1A768:("func_80B1A768",), - 0x80B1A894:("func_80B1A894",), - 0x80B1A9B0:("func_80B1A9B0",), - 0x80B1AA88:("func_80B1AA88",), - 0x80B1AAE8:("func_80B1AAE8",), - 0x80B1AB5C:("func_80B1AB5C",), - 0x80B1ABB8:("func_80B1ABB8",), - 0x80B1AC40:("func_80B1AC40",), - 0x80B1ACB8:("func_80B1ACB8",), - 0x80B1AE28:("func_80B1AE28",), - 0x80B1AE3C:("func_80B1AE3C",), - 0x80B1AF8C:("func_80B1AF8C",), - 0x80B1B020:("func_80B1B020",), - 0x80B1B0E0:("func_80B1B0E0",), - 0x80B1B168:("func_80B1B168",), - 0x80B1B280:("func_80B1B280",), - 0x80B1B2F0:("func_80B1B2F0",), - 0x80B1B3A8:("func_80B1B3A8",), - 0x80B1B444:("func_80B1B444",), - 0x80B1B5B4:("func_80B1B5B4",), - 0x80B1B628:("func_80B1B628",), - 0x80B1B70C:("func_80B1B70C",), - 0x80B1B7BC:("func_80B1B7BC",), - 0x80B1B860:("func_80B1B860",), - 0x80B1B940:("func_80B1B940",), - 0x80B1BA3C:("func_80B1BA3C",), - 0x80B1BA90:("func_80B1BA90",), - 0x80B1BC4C:("func_80B1BC4C",), - 0x80B1BCA0:("func_80B1BCA0",), - 0x80B1BCF0:("func_80B1BCF0",), - 0x80B1BE4C:("func_80B1BE4C",), - 0x80B1BF2C:("func_80B1BF2C",), - 0x80B1C030:("func_80B1C030",), - 0x80B1C0A4:("func_80B1C0A4",), - 0x80B1C2E8:("func_80B1C2E8",), - 0x80B1C340:("func_80B1C340",), - 0x80B1C408:("func_80B1C408",), + 0x80B1A648:("EnPoSisters_UpdateDeathFlameSwirl",), + 0x80B1A768:("EnPoSisters_MatchPlayerXZ",), + 0x80B1A894:("EnPoSisters_MatchPlayerY",), + 0x80B1A9B0:("EnPoSisters_CheckZTarget",), + 0x80B1AA88:("EnPoSisters_SetupObserverIdle",), + 0x80B1AAE8:("EnPoSisters_ObserverIdle",), + 0x80B1AB5C:("EnPoSisters_SetupAimlessIdleFlying2",), + 0x80B1ABB8:("EnPoSisters_AimlessIdleFlying2",), + 0x80B1AC40:("EnPoSisters_SetupAimlessIdleFlying",), + 0x80B1ACB8:("EnPoSisters_AimlessIdleFlying",), + 0x80B1AE28:("EnPoSisters_SetupInvestigating",), + 0x80B1AE3C:("EnPoSisters_Investigating",), + 0x80B1AF8C:("EnPoSisters_SetupSpinUp",), + 0x80B1B020:("EnPoSisters_SpinUp",), + 0x80B1B0E0:("EnPoSisters_SetupSpinAttack",), + 0x80B1B168:("EnPoSisters_SpinAttack",), + 0x80B1B280:("EnPoSisters_SetupAttackConnect",), + 0x80B1B2F0:("EnPoSisters_AttackConnectDrift",), + 0x80B1B3A8:("EnPoSisters_SetupDamageFlinch",), + 0x80B1B444:("EnPoSisters_DamageFlinch",), + 0x80B1B5B4:("EnPoSisters_SetupFlee",), + 0x80B1B628:("EnPoSisters_Flee",), + 0x80B1B70C:("EnPoSisters_SetupSpinToInvis",), + 0x80B1B7BC:("EnPoSisters_SpinToInvis",), + 0x80B1B860:("EnPoSisters_SetupSpinBackToVisible",), + 0x80B1B940:("EnPoSisters_SpinBackToVisible",), + 0x80B1BA3C:("EnPoSisters_SetupDeathStage1",), + 0x80B1BA90:("EnPoSisters_DeathStage1",), + 0x80B1BC4C:("EnPoSisters_SetupDeathStage2",), + 0x80B1BCA0:("EnPoSisters_DeathStage2",), + 0x80B1BCF0:("EnPoSisters_SpawnMegClones",), + 0x80B1BE4C:("EnPoSisters_MegCloneVanish",), + 0x80B1BF2C:("EnPoSisters_MegCloneWaitForSpinBack",), + 0x80B1C030:("EnPoSisters_SetupMegSurroundPlayer",), + 0x80B1C0A4:("EnPoSisters_MegSurroundPlayer",), + 0x80B1C2E8:("EnPoSisters_SetupSpawnPo",), + 0x80B1C340:("EnPoSisters_PoeSpawn",), + 0x80B1C408:("EnPoSisters_CheckCollision",), 0x80B1C61C:("EnPoSisters_Update",), - 0x80B1C974:("func_80B1C974",), + 0x80B1C974:("EnPoSisters_UpdateColors",), 0x80B1CB44:("EnPoSisters_OverrideLimbDraw",), 0x80B1CD34:("EnPoSisters_PostLimbDraw",), 0x80B1D484:("EnPoSisters_Draw",), @@ -13293,7 +13293,7 @@ 0x80B25448:("EnRacedog_UpdateRunAnimationPlaySpeed",), 0x80B25490:("EnRacedog_IsOverFinishLine",), 0x80B255AC:("EnRacedog_SpawnFloorDustRing",), - 0x80B256BC:("EnRacedog_PlayWalkSfx",), + 0x80B256BC:("EnRacedog_PlaySfxWalk",), 0x80B25708:("EnRacedog_Update",), 0x80B2583C:("EnRacedog_UpdateSelectionArrow",), 0x80B258D8:("EnRacedog_DrawSelectionArrow",), @@ -14137,7 +14137,7 @@ 0x80B5EE3C:("EnDragon_RetreatOrIdle",), 0x80B5EF88:("EnDragon_SetupExtend",), 0x80B5EFD0:("EnDragon_Extend",), - 0x80B5F3A4:("EnDragon_CameraSetAtEye",), + 0x80B5F3A4:("EnDragon_SetSubCamEyeAt",), 0x80B5F418:("EnDragon_SetupGrab",), 0x80B5F508:("EnDragon_Grab",), 0x80B5F888:("EnDragon_SetupAttack",), @@ -14462,57 +14462,57 @@ 0x80B77354:("EnTruMt_TransformLimbDraw",), 0x80B773D0:("EnTruMt_Draw",), 0x80B77770:("func_80B77770",), - 0x80B77FA4:("func_80B77FA4",), + 0x80B77FA4:("ObjUm_InitBandits",), 0x80B781DC:("func_80B781DC",), 0x80B783E0:("func_80B783E0",), 0x80B78764:("func_80B78764",), 0x80B78A54:("func_80B78A54",), 0x80B78C18:("func_80B78C18",), - 0x80B78D08:("func_80B78D08",), + 0x80B78D08:("ObjUm_UpdateBanditsCollisions",), 0x80B78DF0:("func_80B78DF0",), 0x80B78E2C:("ObjUm_SetupAction",), - 0x80B78E38:("func_80B78E38",), - 0x80B78E88:("func_80B78E88",), + 0x80B78E38:("ObjUm_SetPlayerPosition",), + 0x80B78E88:("ObjUm_RotatePlayer",), 0x80B78EBC:("func_80B78EBC",), - 0x80B78EFC:("func_80B78EFC",), + 0x80B78EFC:("ObjUm_RotatePlayerView",), 0x80B78F24:("ObjUm_Init",), 0x80B7949C:("ObjUm_Destroy",), 0x80B79524:("func_80B79524",), 0x80B79560:("func_80B79560",), 0x80B795A0:("func_80B795A0",), 0x80B79734:("func_80B79734",), - 0x80B797EC:("func_80B797EC",), + 0x80B797EC:("ObjUm_RanchGetDialogue",), 0x80B7984C:("func_80B7984C",), 0x80B79A24:("func_80B79A24",), - 0x80B79A50:("func_80B79A50",), - 0x80B79BA0:("func_80B79BA0",), - 0x80B79F10:("func_80B79F10",), - 0x80B79FFC:("func_80B79FFC",), + 0x80B79A50:("ObjUm_RanchWait",), + 0x80B79BA0:("ObjUm_UpdatePath",), + 0x80B79F10:("ObjUm_RanchWaitPathFinished",), + 0x80B79FFC:("ObjUm_RanchStartCs",), 0x80B7A070:("func_80B7A070",), 0x80B7A0E0:("func_80B7A0E0",), 0x80B7A144:("func_80B7A144",), - 0x80B7A1B4:("func_80B7A1B4",), + 0x80B7A1B4:("ObjUm_PreMilkRunDialogueHandler",), 0x80B7A240:("func_80B7A240",), 0x80B7A2AC:("func_80B7A2AC",), 0x80B7A394:("func_80B7A394",), - 0x80B7A400:("func_80B7A400",), - 0x80B7A494:("func_80B7A494",), + 0x80B7A400:("ObjUm_PreMilkRunStartCs",), + 0x80B7A494:("ObjUm_RunMinigame",), 0x80B7A614:("func_80B7A614",), 0x80B7A7AC:("func_80B7A7AC",), 0x80B7A860:("func_80B7A860",), 0x80B7AB78:("func_80B7AB78",), 0x80B7ABE4:("func_80B7ABE4",), - 0x80B7AC94:("func_80B7AC94",), - 0x80B7AD34:("func_80B7AD34",), - 0x80B7AE58:("func_80B7AE58",), - 0x80B7AEFC:("func_80B7AEFC",), + 0x80B7AC94:("ObjUm_StartCs",), + 0x80B7AD34:("ObjUm_PostMilkRunWaitPathFinished",), + 0x80B7AE58:("ObjUm_PostMilkRunStartCs",), + 0x80B7AEFC:("ObjUm_TerminaFieldIdle",), 0x80B7AF30:("func_80B7AF30",), - 0x80B7B154:("func_80B7B154",), - 0x80B7B18C:("func_80B7B18C",), + 0x80B7B154:("ObjUm_DefaultAnim",), + 0x80B7B18C:("ObjUm_UpdateAnim",), 0x80B7B368:("ObjUm_Update",), - 0x80B7B598:("func_80B7B598",), - 0x80B7B93C:("func_80B7B93C",), - 0x80B7BABC:("func_80B7BABC",), + 0x80B7B598:("ObjUm_OverrideLimbDraw",), + 0x80B7B93C:("ObjUm_SpawnFragments",), + 0x80B7BABC:("ObjUm_PostLimbDraw",), 0x80B7BEA4:("func_80B7BEA4",), 0x80B7C03C:("ObjUm_Draw",), 0x80B7C890:("EnNeoReeba_Init",), @@ -15168,27 +15168,27 @@ 0x80BA7D30:("EnRailgibud_SinkIntoGround",), 0x80BA7DC8:("EnRailgibud_PerformCutsceneActions",), 0x80BA8050:("EnRailgibud_Cutscene_Update",), - 0x80BA8820:("func_80BA8820",), - 0x80BA886C:("func_80BA886C",), - 0x80BA8C4C:("func_80BA8C4C",), - 0x80BA8C90:("func_80BA8C90",), - 0x80BA8D2C:("func_80BA8D2C",), - 0x80BA8DF4:("func_80BA8DF4",), - 0x80BA8F88:("func_80BA8F88",), - 0x80BA9110:("func_80BA9110",), - 0x80BA9160:("func_80BA9160",), - 0x80BA93AC:("func_80BA93AC",), - 0x80BA9480:("func_80BA9480",), - 0x80BA9758:("func_80BA9758",), - 0x80BA9848:("func_80BA9848",), - 0x80BA98EC:("func_80BA98EC",), - 0x80BA9AB8:("func_80BA9AB8",), - 0x80BA9B24:("func_80BA9B24",), - 0x80BA9B80:("func_80BA9B80",), - 0x80BA9CD4:("func_80BA9CD4",), - 0x80BA9E00:("func_80BA9E00",), - 0x80BA9E10:("func_80BA9E10",), - 0x80BA9E48:("func_80BA9E48",), + 0x80BA8820:("EnBaba_FindBombShopkeeper",), + 0x80BA886C:("EnBaba_HandleConversation",), + 0x80BA8C4C:("EnBaba_TriggerTransition",), + 0x80BA8C90:("EnBaba_UpdateCollider",), + 0x80BA8D2C:("EnBaba_MoveForward",), + 0x80BA8DF4:("EnBaba_UpdateModel",), + 0x80BA8F88:("EnBaba_InitTimePath",), + 0x80BA9110:("EnBaba_ProcessScheduleOutput",), + 0x80BA9160:("EnBaba_FollowTimePath",), + 0x80BA93AC:("EnBaba_HandleSchedule",), + 0x80BA9480:("EnBaba_FinishInit",), + 0x80BA9758:("EnBaba_Idle",), + 0x80BA9848:("EnBaba_FollowSchedule_Talk",), + 0x80BA98EC:("EnBaba_Talk",), + 0x80BA9AB8:("EnBaba_GiveBlastMask",), + 0x80BA9B24:("EnBaba_GaveBlastMask",), + 0x80BA9B80:("EnBaba_FollowSchedule",), + 0x80BA9CD4:("EnBaba_KnockedOver",), + 0x80BA9E00:("EnBaba_DoNothing",), + 0x80BA9E10:("EnBaba_Walk",), + 0x80BA9E48:("EnBaba_FaceForward",), 0x80BA9E6C:("EnBaba_Init",), 0x80BA9F24:("EnBaba_Destroy",), 0x80BA9F50:("EnBaba_Update",), @@ -15668,8 +15668,8 @@ 0x80BCED34:("func_80BCED34",), 0x80BCEDE0:("func_80BCEDE0",), 0x80BCEE98:("EffKamejimaWave_Update",), - 0x80BCEEBC:("func_80BCEEBC",), - 0x80BCEF0C:("func_80BCEF0C",), + 0x80BCEEBC:("EffKamejimaWave_SetVtxAlpha",), + 0x80BCEF0C:("EffKamejimaWave_Draw",), 0x80BCF1D0:("EnHg_Init",), 0x80BCF328:("EnHg_Destroy",), 0x80BCF354:("func_80BCF354",), @@ -15830,10 +15830,10 @@ 0x80BD6218:("BgHakaBombwall_Destroy",), 0x80BD6260:("func_80BD6260",), 0x80BD6274:("func_80BD6274",), - 0x80BD62D0:("func_80BD62D0",), - 0x80BD6314:("func_80BD6314",), - 0x80BD63B4:("func_80BD63B4",), - 0x80BD63D0:("func_80BD63D0",), + 0x80BD62D0:("BgHakaBombwall_SetupPlayCutscene",), + 0x80BD6314:("BgHakaBombwall_PlayCutscene",), + 0x80BD63B4:("BgHakaBombwall_SetupEndCutscene",), + 0x80BD63D0:("BgHakaBombwall_EndCutscene",), 0x80BD6420:("BgHakaBombwall_Update",), 0x80BD6444:("BgHakaBombwall_Draw",), 0x80BD6580:("BgHakaTomb_Init",), @@ -16218,7 +16218,7 @@ 0x80BEBEB8:("func_80BEBEB8",), 0x80BEBF78:("func_80BEBF78",), 0x80BEC080:("EffLastday_Update",), - 0x80BEC0A4:("func_80BEC0A4",), + 0x80BEC0A4:("EffLastday_SetVtxAlpha",), 0x80BEC0DC:("EffLastday_Draw",), 0x80BEC240:("BgIkanaDharma_SpawnEffects",), 0x80BEC3F4:("BgIkanaDharma_Init",), @@ -16370,12 +16370,12 @@ 0x80BF6C94:("EnOsk_Draw",), 0x80BF74E0:("EnSth2_Init",), 0x80BF7590:("EnSth2_Destroy",), - 0x80BF75A0:("func_80BF75A0",), + 0x80BF75A0:("EnSth2_UpdateSkelAnime",), 0x80BF75CC:("EnSth2_Update",), - 0x80BF7688:("func_80BF7688",), - 0x80BF76AC:("func_80BF76AC",), - 0x80BF77AC:("func_80BF77AC",), - 0x80BF7814:("func_80BF7814",), + 0x80BF7688:("EnSth2_UpdateActionFunc",), + 0x80BF76AC:("EnSth2_OverrideLimbDraw",), + 0x80BF77AC:("EnSth2_PostLimbDraw",), + 0x80BF7814:("EnSth2_Draw",), 0x80BFA100:("EnYb_Init",), 0x80BFA2D0:("EnYb_Destroy",), 0x80BFA2FC:("func_80BFA2FC",), @@ -16436,17 +16436,17 @@ 0x80BFD148:("EnScopecoin_Destroy",), 0x80BFD158:("EnScopecoin_Update",), 0x80BFD17C:("EnScopecoin_Draw",), - 0x80BFD2E0:("func_80BFD2E0",), - 0x80BFD30C:("func_80BFD30C",), - 0x80BFD3A4:("func_80BFD3A4",), - 0x80BFD434:("func_80BFD434",), - 0x80BFD4FC:("func_80BFD4FC",), - 0x80BFD5E4:("func_80BFD5E4",), - 0x80BFD6BC:("func_80BFD6BC",), - 0x80BFD8F0:("func_80BFD8F0",), - 0x80BFD984:("func_80BFD984",), - 0x80BFDA48:("func_80BFDA48",), - 0x80BFDAE8:("func_80BFDAE8",), + 0x80BFD2E0:("EnBjt_UpdateSkelAnime",), + 0x80BFD30C:("EnBjt_ChangeAnimation",), + 0x80BFD3A4:("EnBjt_UpdateCollision",), + 0x80BFD434:("EnBjt_TakeItem",), + 0x80BFD4FC:("EnBjt_Appear",), + 0x80BFD5E4:("EnBjt_Vanish",), + 0x80BFD6BC:("EnBjt_ChooseBehaviour",), + 0x80BFD8F0:("EnBjt_CheckTalk",), + 0x80BFD984:("EnBjt_ChooseAnimation",), + 0x80BFDA48:("EnBjt_Talk",), + 0x80BFDAE8:("EnBjt_FollowSchedule",), 0x80BFDC98:("EnBjt_Init",), 0x80BFDD80:("EnBjt_Destroy",), 0x80BFDD90:("EnBjt_Update",), @@ -16610,10 +16610,10 @@ 0x80C08480:("ObjUsiyane_Draw",), 0x80C08760:("EnNnh_Init",), 0x80C087FC:("EnNnh_Destroy",), - 0x80C08828:("func_80C08828",), - 0x80C0883C:("func_80C0883C",), - 0x80C088A4:("func_80C088A4",), - 0x80C088B8:("func_80C088B8",), + 0x80C08828:("EnNnh_SetupWaitForDialogue",), + 0x80C0883C:("EnNnh_WaitForDialogue",), + 0x80C088A4:("EnNnh_SetupDialogue",), + 0x80C088B8:("EnNnh_Dialogue",), 0x80C088EC:("EnNnh_Update",), 0x80C08950:("EnNnh_Draw",), 0x80C08A80:("ObjKzsaku_Init",), @@ -16930,14 +16930,14 @@ 0x80C1B9D4:("func_80C1B9D4",), 0x80C1BAC8:("EnFall2_Update",), 0x80C1BAEC:("EnFall2_Draw",), - 0x80C1BD90:("func_80C1BD90",), + 0x80C1BD90:("DmAl_ChangeAnimation",), 0x80C1BDD8:("func_80C1BDD8",), 0x80C1BF08:("DmAl_Init",), 0x80C1BFB8:("DmAl_Destroy",), 0x80C1BFC8:("DmAl_Update",), - 0x80C1C028:("func_80C1C028",), - 0x80C1C064:("func_80C1C064",), - 0x80C1C11C:("func_80C1C11C",), + 0x80C1C028:("DmAl_OverrideLimbDraw",), + 0x80C1C064:("DmAl_PostLimbDraw",), + 0x80C1C11C:("DmAl_TransformLimbDraw",), 0x80C1C130:("DmAl_Draw",), 0x80C1C410:("func_80C1C410",), 0x80C1C4D8:("func_80C1C4D8",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index b7a103687..5a6c609ef 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -914,7 +914,7 @@ 0x801BB148:("sCsStateHandlers2","cutscene_update_func","[5]",0x14), 0x801BB15C:("D_801BB15C","UNK_TYPE2","",0x2), 0x801BB160:("D_801BB160","UNK_TYPE4","",0x4), - 0x801BB170:("D_801BB170","s801BB170","[118]",0x1098), + 0x801BB170:("sDrawItemTable","DrawItemTableEntry","[118]",0x1098), 0x801BC210:("D_801BC210","UNK_TYPE1","",0x1), 0x801BC240:("D_801BC240","Gfx","[9]",0x48), 0x801BC288:("D_801BC288","Gfx","[3]",0x18), @@ -970,7 +970,7 @@ 0x801BDBA0:("D_801BDBA0","UNK_TYPE1","",0x1), 0x801BDBA4:("D_801BDBA4","UNK_TYPE1","",0x1), 0x801BDBA8:("D_801BDBA8","UNK_TYPE1","",0x1), - 0x801BDBB0:("D_801BDBB0","u8","",0x1), + 0x801BDBB0:("gWeatherMode","u8","",0x1), 0x801BDBB4:("D_801BDBB4","UNK_TYPE1","",0x1), 0x801BDBB8:("D_801BDBB8","UNK_TYPE1","",0x1), 0x801BDBBC:("D_801BDBBC","UNK_TYPE1","",0x1), @@ -1942,7 +1942,7 @@ 0x801C5FC0:("D_801C5FC0","u32","[452]",0x710), 0x801C66D0:("D_801C66D0","UNK_TYPE2","",0x2), 0x801C6798:("D_801C6798","UNK_TYPE4","",0x4), - 0x801C67B0:("D_801C67B0","UNK_TYPE1","",0x1), + 0x801C67B0:("gAmmoItems","UNK_TYPE1","",0x1), 0x801C67C8:("D_801C67C8","s32","[8]",0x20), 0x801C67E8:("D_801C67E8","UNK_TYPE4","",0x4), 0x801C67F0:("D_801C67F0","s32","[8]",0x20), @@ -2252,7 +2252,7 @@ 0x801D618C:("D_801D618C","UNK_PTR","",0x4), 0x801D6190:("D_801D6190","f32","",0x4), 0x801D6194:("D_801D6194","UNK_TYPE4","",0x4), - 0x801D61A0:("D_801D61A0","u8","[96]",0x60), + 0x801D61A0:("sSeqInstructionArgsTable","u8","[96]",0x60), 0x801D6200:("D_801D6200","UNK_TYPE1","",0x1), 0x801D6600:("D_801D6600","UNK_TYPE1","",0x1), 0x801D6608:("D_801D6608","UNK_TYPE1","",0x1), @@ -4681,24 +4681,18 @@ 0x8082AFB0:("D_8082AFB0","UNK_TYPE1","",0x1), 0x8082AFC4:("D_8082AFC4","UNK_TYPE2","",0x2), 0x8082AFDC:("D_8082AFDC","UNK_TYPE2","",0x2), - 0x8082AFF4:("D_8082AFF4","UNK_TYPE2","",0x2), - 0x8082B008:("D_8082B008","UNK_TYPE1","",0x1), + 0x8082AFF4:("D_8082AFF4","s16","[12]",0x18), + 0x8082B00C:("D_8082B00C","void*","[6]",0x18), 0x8082B024:("D_8082B024","UNK_TYPE1","",0x1), 0x8082B028:("D_8082B028","UNK_TYPE2","",0x2), - 0x8082B02C:("D_8082B02C","UNK_TYPE1","",0x1), - 0x8082B02E:("D_8082B02E","UNK_TYPE1","",0x1), - 0x8082B030:("D_8082B030","UNK_TYPE1","",0x1), - 0x8082B032:("D_8082B032","UNK_TYPE1","",0x1), - 0x8082B0F0:("D_8082B0F0","UNK_TYPE2","",0x2), - 0x8082B0F4:("D_8082B0F4","UNK_TYPE2","",0x2), - 0x8082B0F8:("D_8082B0F8","UNK_TYPE1","",0x1), - 0x8082B2FA:("D_8082B2FA","UNK_TYPE1","",0x1), - 0x8082B302:("D_8082B302","UNK_TYPE1","",0x1), - 0x8082B30A:("D_8082B30A","UNK_TYPE1","",0x1), - 0x8082B328:("D_8082B328","UNK_TYPE1","",0x1), - 0x8082B388:("D_8082B388","UNK_TYPE2","",0x2), - 0x8082B3AC:("D_8082B3AC","UNK_TYPE4","",0x4), - 0x8082B3B0:("D_8082B3B0","UNK_TYPE4","",0x4), + 0x8082B02C:("D_8082B02C","s16","[98]",0xC4), + 0x8082B0F0:("sCurSection","UNK_TYPE2","",0x2), + 0x8082B0F4:("sCurRow","UNK_TYPE2","",0x2), + 0x8082B0F8:("sSectionPositions","s16","[280]",0x230), + 0x8082B328:("sSlotItems","UNK_TYPE1","",0x1), + 0x8082B388:("sRowFirstSections","UNK_TYPE2","",0x2), + 0x8082B3AC:("sPrevDBtnInput","UNK_TYPE4","",0x4), + 0x8082B3B0:("sHeldDBtnTimer","UNK_TYPE4","",0x4), 0x8082B3C0:("D_8082B3C0","UNK_TYPE2","",0x2), 0x8082B3C4:("D_8082B3C4","UNK_TYPE2","",0x2), 0x8082B3C8:("D_8082B3C8","UNK_TYPE2","",0x2), @@ -4723,10 +4717,7 @@ 0x8082B520:("D_8082B520","UNK_TYPE1","",0x1), 0x8082B52C:("D_8082B52C","UNK_TYPE1","",0x1), 0x8082B538:("D_8082B538","UNK_TYPE1","",0x1), - 0x8082B548:("D_8082B548","UNK_TYPE4","",0x4), - 0x8082B54A:("D_8082B54A","UNK_TYPE1","",0x1), - 0x8082B552:("D_8082B552","UNK_TYPE1","",0x1), - 0x8082B55A:("D_8082B55A","UNK_TYPE1","",0x1), + 0x8082B548:("D_8082B548","s16","[30]",0x3C), 0x8082B584:("D_8082B584","UNK_TYPE2","",0x2), 0x8082B590:("D_8082B590","UNK_TYPE2","",0x2), 0x8082B59C:("D_8082B59C","UNK_TYPE1","",0x1), @@ -9176,8 +9167,8 @@ 0x80989064:("D_80989064","f32","",0x4), 0x80989068:("D_80989068","f32","",0x4), 0x8098C280:("En_Dg_InitVars","UNK_TYPE1","",0x1), - 0x8098C2A0:("D_8098C2A0","UNK_TYPE1","",0x1), - 0x8098C2A4:("D_8098C2A4","UNK_TYPE2","",0x2), + 0x8098C2A0:("sIsAnyDogHeld","UNK_TYPE1","",0x1), + 0x8098C2A4:("sBremenMaskFollower","UNK_TYPE2","",0x2), 0x8098C2A8:("D_8098C2A8","UNK_TYPE2","",0x2), 0x8098C2AC:("D_8098C2AC","UNK_TYPE2","",0x2), 0x8098C2FC:("D_8098C2FC","UNK_TYPE1","",0x1), @@ -9922,23 +9913,23 @@ 0x809C6264:("D_809C6264","f32","",0x4), 0x809C6268:("D_809C6268","f32","",0x4), 0x809C9160:("En_Syateki_Man_InitVars","UNK_TYPE1","",0x1), - 0x809C9180:("D_809C9180","UNK_TYPE1","",0x1), - 0x809C91C8:("D_809C91C8","UNK_TYPE1","",0x1), - 0x809C91D0:("D_809C91D0","UNK_TYPE1","",0x1), - 0x809C934C:("D_809C934C","UNK_TYPE1","",0x1), - 0x809C9464:("D_809C9464","UNK_PTR","",0x4), - 0x809C946C:("D_809C946C","UNK_TYPE1","",0x1), - 0x809C9474:("D_809C9474","UNK_TYPE4","",0x4), - 0x809C9480:("D_809C9480","UNK_TYPE4","",0x4), - 0x809C948C:("D_809C948C","UNK_TYPE4","",0x4), - 0x809C9498:("D_809C9498","UNK_TYPE2","",0x2), - 0x809C949C:("D_809C949C","UNK_TYPE2","",0x2), - 0x809C94A0:("D_809C94A0","UNK_TYPE4","",0x4), - 0x809C94A4:("D_809C94A4","UNK_TYPE2","",0x2), - 0x809C94A8:("D_809C94A8","UNK_TYPE4","",0x4), - 0x809C94AC:("D_809C94AC","UNK_TYPE4","",0x4), - 0x809C94B8:("D_809C94B8","UNK_PTR","",0x4), - 0x809C94D0:("D_809C94D0","UNK_TYPE1","",0x1), + 0x809C9180:("sAnimations","UNK_TYPE1","",0x1), + 0x809C91C8:("sGuayFlagsPerWave","UNK_TYPE1","",0x1), + 0x809C91D0:("sNormalSwampTargetActorList","UNK_TYPE1","",0x1), + 0x809C934C:("sUnusedSwampTargetActorList","UNK_TYPE1","",0x1), + 0x809C9464:("sSwampTargetActorLists","UNK_PTR","",0x4), + 0x809C946C:("sSwampTargetActorListLengths","UNK_TYPE1","",0x1), + 0x809C9474:("sSwampPlayerPos","UNK_TYPE4","",0x4), + 0x809C9480:("sTownFierceDietyPlayerPos","UNK_TYPE4","",0x4), + 0x809C948C:("sTownPlayerPos","UNK_TYPE4","",0x4), + 0x809C9498:("sGameStartTimer","s16","",0x2), + 0x809C949C:("sHasSpawnedGuaysForThisWave","UNK_TYPE2","",0x2), + 0x809C94A0:("sBonusTimer","s32","",0x4), + 0x809C94A4:("sGameStartTimer","s16","",0x2), + 0x809C94A8:("sModFromLosingTime","s32","",0x4), + 0x809C94AC:("sFocusOffset","UNK_TYPE4","",0x4), + 0x809C94B8:("sEyeTextures","UNK_PTR","",0x4), + 0x809C94D0:("sOctorokFlagsPerWave","UNK_TYPE1","",0x1), 0x809C950C:("jtbl_809C950C","UNK_PTR","",0x4), 0x809C9544:("jtbl_809C9544","UNK_PTR","",0x4), 0x809C9570:("jtbl_809C9570","UNK_PTR","",0x4), @@ -10232,12 +10223,12 @@ 0x809E0420:("D_809E0420","UNK_TYPE1","",0x1), 0x809E0421:("D_809E0421","UNK_TYPE1","",0x1), 0x809E0422:("D_809E0422","UNK_TYPE1","",0x1), - 0x809E0424:("D_809E0424","UNK_TYPE4","",0x4), - 0x809E0428:("D_809E0428","UNK_TYPE4","",0x4), - 0x809E042C:("D_809E042C","UNK_TYPE4","",0x4), - 0x809E0430:("D_809E0430","UNK_TYPE1","",0x1), - 0x809E0434:("D_809E0434","UNK_TYPE4","",0x4), - 0x809E0438:("D_809E0438","UNK_TYPE1","",0x1), + 0x809E0424:("sRedTwinmold","UNK_TYPE4","",0x4), + 0x809E0428:("sBlueTwinmold","UNK_TYPE4","",0x4), + 0x809E042C:("sTwinmoldStatic","UNK_TYPE4","",0x4), + 0x809E0430:("sMusicStartTimer","UNK_TYPE1","",0x1), + 0x809E0434:("sBlueWarp","UNK_TYPE4","",0x4), + 0x809E0438:("sEffects","UNK_TYPE1","",0x1), 0x809E8EA0:("D_809E8EA0","UNK_TYPE4","",0x4), 0x809E8EAC:("Boss_03_InitVars","UNK_TYPE1","",0x1), 0x809E8ECC:("D_809E8ECC","UNK_TYPE1","",0x1), @@ -11495,12 +11486,12 @@ 0x80A43364:("sDayNightTransitionTimes","u16","[2]",0x4), 0x80A434D0:("sCutscenes","s16","[2]",0x4), 0x80A434D4:("sCurrentCs","s16","",0x2), - 0x80A449E0:("En_Bat_InitVars","UNK_TYPE1","",0x1), - 0x80A44A00:("D_80A44A00","UNK_TYPE1","",0x1), - 0x80A44A2C:("D_80A44A2C","UNK_TYPE1","",0x1), - 0x80A44A4C:("D_80A44A4C","UNK_TYPE1","",0x1), - 0x80A44A54:("D_80A44A54","UNK_TYPE1","",0x1), - 0x80A44A64:("D_80A44A64","UNK_TYPE1","",0x1), + 0x80A449E0:("En_Bat_InitVars","ActorInit","",0x1), + 0x80A44A00:("sSphereInit","ColliderSphereInit","",0x1), + 0x80A44A2C:("sDamageTable","DamageTable","4",0x1), + 0x80A44A4C:("sColChkInfoInit","CollisionCheckInfoInit","",0x1), + 0x80A44A54:("sInitChain","InitChainEntry","",0x1), + 0x80A44A64:("sWingsDLs","Gfx*[]","9",0x1), 0x80A44A90:("D_80A44A90","f32","",0x4), 0x80A44A94:("D_80A44A94","f32","",0x4), 0x80A44A98:("D_80A44A98","f32","",0x4), @@ -11517,8 +11508,8 @@ 0x80A44AC4:("D_80A44AC4","f32","",0x4), 0x80A44AC8:("D_80A44AC8","f32","",0x4), 0x80A44ACC:("D_80A44ACC","f32","",0x4), - 0x80A44C70:("D_80A44C70","UNK_TYPE1","",0x1), - 0x80A44C74:("D_80A44C74","UNK_TYPE1","",0x1), + 0x80A44C70:("sNumberAttacking","UNK_TYPE1","",0x1), + 0x80A44C74:("sAlreadySpawned","UNK_TYPE1","",0x1), 0x80A45250:("En_Sekihi_InitVars","UNK_TYPE1","",0x1), 0x80A45270:("D_80A45270","UNK_TYPE1","",0x1), 0x80A4527C:("D_80A4527C","UNK_TYPE1","",0x1), @@ -12328,7 +12319,7 @@ 0x80A846A0:("D_80A846A0","f32","",0x4), 0x80A849D0:("D_80A849D0","UNK_TYPE4","",0x4), 0x80A85460:("Obj_Purify_InitVars","UNK_TYPE1","",0x1), - 0x80A85480:("D_80A85480","UNK_TYPE1","",0x1), + 0x80A85480:("ObjPurifyInfoList","UNK_TYPE1","",0x1), 0x80A854A0:("D_80A854A0","UNK_TYPE1","",0x1), 0x80A88910:("D_80A88910","UNK_TYPE1","",0x1), 0x80A88918:("D_80A88918","UNK_TYPE1","",0x1), @@ -13882,7 +13873,7 @@ 0x80B1A348:("D_80B1A348","f32","",0x4), 0x80B1A34C:("D_80B1A34C","f32","",0x4), 0x80B1DA30:("D_80B1DA30","UNK_TYPE1","",0x1), - 0x80B1DA40:("D_80B1DA40","UNK_TYPE1","",0x1), + 0x80B1DA40:("sPoSisterEnvColors","UNK_TYPE1","",0x1), 0x80B1DA50:("En_Po_Sisters_InitVars","UNK_TYPE1","",0x1), 0x80B1DA70:("D_80B1DA70","UNK_TYPE1","",0x1), 0x80B1DA9C:("D_80B1DA9C","UNK_TYPE1","",0x1), @@ -14348,11 +14339,11 @@ 0x80B4E934:("D_80B4E934","UNK_TYPE4","",0x4), 0x80B4E938:("D_80B4E938","f32","",0x4), 0x80B4E940:("D_80B4E940","UNK_TYPE4","",0x4), - 0x80B4E944:("D_80B4E944","UNK_TYPE4","",0x4), - 0x80B4E958:("D_80B4E958","UNK_TYPE4","",0x4), + 0x80B4E944:("sRomaniEyeTextures","UNK_TYPE4","",0x4), + 0x80B4E958:("sRomaniMouthTextures","UNK_TYPE4","",0x4), 0x80B4E968:("D_80B4E968","UNK_TYPE1","",0x1), - 0x80B4E96C:("D_80B4E96C","UNK_TYPE4","",0x4), - 0x80B4E984:("D_80B4E984","UNK_TYPE4","",0x4), + 0x80B4E96C:("sCremiaEyeTextures","UNK_TYPE4","",0x4), + 0x80B4E984:("sCremiaMouthTextures","UNK_TYPE4","",0x4), 0x80B4E994:("D_80B4E994","UNK_TYPE1","",0x1), 0x80B4E998:("D_80B4E998","UNK_TYPE1","",0x1), 0x80B4E99C:("D_80B4E99C","UNK_TYPE1","",0x1), @@ -15003,14 +14994,12 @@ 0x80B77684:("D_80B77684","f32","",0x4), 0x80B77688:("D_80B77688","f32","",0x4), 0x80B7C0F0:("Obj_Um_InitVars","UNK_TYPE1","",0x1), - 0x80B7C110:("D_80B7C110","UNK_TYPE1","",0x1), - 0x80B7C128:("D_80B7C128","UNK_TYPE1","",0x1), - 0x80B7C138:("D_80B7C138","UNK_TYPE1","",0x1), + 0x80B7C110:("sEyeTextures","UNK_TYPE1","",0x1), + 0x80B7C128:("sMouthTextures","UNK_TYPE1","",0x1), + 0x80B7C138:("sCylinderInit","UNK_TYPE1","",0x1), 0x80B7C164:("D_80B7C164","UNK_TYPE4","",0x4), - 0x80B7C254:("D_80B7C254","UNK_TYPE4","",0x4), - 0x80B7C25C:("D_80B7C25C","UNK_TYPE1","",0x1), - 0x80B7C260:("D_80B7C260","UNK_TYPE1","",0x1), - 0x80B7C274:("D_80B7C274","UNK_TYPE1","",0x1), + 0x80B7C254:("sInitChain","UNK_TYPE4","",0x4), + 0x80B7C25C:("sUmAnims","UNK_TYPE1","[5]",0x28), 0x80B7C284:("D_80B7C284","UNK_TYPE4","",0x4), 0x80B7C290:("D_80B7C290","UNK_TYPE4","",0x4), 0x80B7C29C:("D_80B7C29C","UNK_TYPE4","",0x4), @@ -15824,7 +15813,7 @@ 0x80BCF0C0:("D_80BCF0C0","f32","",0x4), 0x80BCF0C4:("D_80BCF0C4","f32","",0x4), 0x80BCF0C8:("D_80BCF0C8","f32","",0x4), - 0x80BCF1C0:("D_80BCF1C0","UNK_TYPE1","",0x1), + 0x80BCF1C0:("sVtxAlpha","UNK_TYPE1","",0x1), 0x80BCF1C1:("D_80BCF1C1","UNK_TYPE1","",0x1), 0x80BCF1C4:("D_80BCF1C4","UNK_TYPE1","",0x1), 0x80BCFF90:("En_Hg_InitVars","UNK_TYPE1","",0x1), @@ -16582,7 +16571,7 @@ 0x80C1C250:("Dm_Al_InitVars","UNK_TYPE1","",0x1), 0x80C1C270:("D_80C1C270","UNK_TYPE1","",0x1), 0x80C1C280:("D_80C1C280","UNK_TYPE4","",0x4), - 0x80C1C294:("D_80C1C294","UNK_TYPE4","",0x4), + 0x80C1C294:("sDlists","UNK_TYPE4","",0x4), 0x80C1C2AC:("D_80C1C2AC","UNK_TYPE1","",0x1), 0x80C1C2B0:("jtbl_80C1C2B0","UNK_PTR","",0x4), 0x80C1C2E4:("jtbl_80C1C2E4","UNK_PTR","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index c4a35bb5f..8193b3168 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -23,7 +23,7 @@ wordReplace = { "Actor_GetSwitchFlag": "Flags_GetSwitch", "atan_flip": "Math_Acot2F", "atans": "Math_Atan2S", - + # "SysMatrix_StateAlloc": "Matrix_StateAlloc", # "SysMatrix_StatePush": "Matrix_StatePush", # "SysMatrix_StatePop": "Matrix_StatePop", @@ -393,8 +393,8 @@ wordReplace = { "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", "BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders", "BgCheck_GetPolygonAttributes": "SurfaceType_GetData", - "func_800C9704": "SurfaceType_GetCamDataIndex", - "func_800C9924": "SurfaceType_GetCamPosData", + "func_800C9704": "SurfaceType_GetBgCamIndex", + "func_800C9924": "BgCheck_GetBgCamFuncData", "func_800C99AC": "SurfaceType_GetSceneExitIndex", "func_800C9B90": "SurfaceType_IsHorseBlocked", "func_800C9BDC": "SurfaceType_GetSfx", @@ -460,8 +460,8 @@ wordReplace = { "func_801699D4": "Play_CopyCamera", "func_80169AC0": "Play_CameraChangeSetting", "func_80169BC4": "Play_CameraGetUID", - "func_80169C64": "Play_GetCsCamDataSetting", - "func_80169C84": "Play_GetCsCamDataVec3s", + "func_80169C64": "Play_GetActorCsCamSetting", + "func_80169C84": "Play_GetActorCsCamFuncData", "convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber", "func_80169D40": "Play_SaveCycleSceneFlags", "func_80169DCC": "Play_SetRespawnData", @@ -581,6 +581,7 @@ wordReplace = { "func_800E8F08": "Actor_TrackNone", "func_800E8FA4": "Actor_TrackPoint", "func_800E9250": "Actor_TrackPlayer", + "func_800E8EA0": "Actor_ContinueText", "func_8010A000": "Map_GetDungeonOrBossAreaIndex", "func_8010A074": "Map_IsInDungeonOrBossArea", @@ -595,6 +596,8 @@ wordReplace = { "func_8010A54C": "Minimap_Draw", "func_8010A580": "Map_Update", + "ActorCutscene_GetCurrentCamera": "ActorCutscene_GetCurrentSubCamId", + # Structs "ActorAnimationEntry": "AnimationInfo", "ActorAnimationEntryS": "AnimationInfoS", @@ -602,6 +605,7 @@ wordReplace = { "GlobalContext": "PlayState", "globalCtx": "play", "globalCtx2": "play2", + "ScheduleResult": "ScheduleOutput", # Struct members "skelAnime.unk03": "skelAnime.taper", @@ -628,6 +632,7 @@ wordReplace = { "gSaveContext.playerForm": "gSaveContext.save.playerForm", "gSaveContext.day": "gSaveContext.save.day", "gSaveContext.isNight": "gSaveContext.save.isNight", + "gSaveContext.environmentTime": "gSaveContext.skyboxTime", "gSaveContext.naviTimer": "gSaveContext.save.playerData.tatlTimer", "gSaveContext.tatlTimer": "gSaveContext.save.playerData.tatlTimer", "gSaveContext.rupees": "gSaveContext.save.playerData.rupees", @@ -680,10 +685,20 @@ wordReplace = { "globalCtx->envCtx.unk_DC": "play->envCtx.lightBlend", "globalCtx->interfaceCtx.unk_21E": "play->interfaceCtx.bButtonDoAction", + "play->msgCtx.unk11F04": "play->msgCtx.currentTextId", + "play->msgCtx.unk11F10": "play->msgCtx.msgLength", + "play->msgCtx.unk11F22": "play->msgCtx.msgMode", + "play->msgCtx.unk12023": "play->msgCtx.stateTimer", "play->msgCtx.unk1202A": "play->msgCtx.ocarinaMode", "play->msgCtx.unk1202C": "play->msgCtx.ocarinaAction", - "play->msgCtx.unk11F22": "play->msgCtx.msgMode", - "play->msgCtx.unk11F04": "play->msgCtx.currentTextId", + + "play->sceneLoadFlag": "play->transitionTrigger", + "play->unk_18B4A": "play->transitionMode", + "play->unk_1887F": "play->transitionType", + "gSaveContext.nextTransition": "gSaveContext.nextTransitionType", + "gSaveContext.unk_3F48": "gSaveContext.cutsceneTransitionControl", + "gSaveContext.fadeDuration": "gSaveContext.transFadeDuration", + "gSaveContext.fadeSpeed": "gSaveContext.transWipeSpeed", "D_801D15B0" : "gZeroVec3f", "D_801D15BC" : "gZeroVec3s", diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 9b1959be9..bf61be341 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -11,6 +11,8 @@ CLOSE_DISPS = "void" ABS = "int" ABS_ALT = "int" SQ = "int" +ARRAY_COUNT = "int" +ARRAY_COUNTU = "int" CLAMP = "int" CLOCK_TIME = "int" CURRENT_DAY = "int" diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 582a2355d..912f3932d 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -561,13 +561,13 @@ asm/non_matchings/code/z_bgcheck/CollisionHeader_GetVirtual.s,CollisionHeader_Ge asm/non_matchings/code/z_bgcheck/BgCheck_InitCollisionHeaders.s,BgCheck_InitCollisionHeaders,0x800C9598,0x2A asm/non_matchings/code/z_bgcheck/func_800C9640.s,func_800C9640,0x800C9640,0x15 asm/non_matchings/code/z_bgcheck/SurfaceType_GetData.s,SurfaceType_GetData,0x800C9694,0x1C -asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamDataIndex.s,SurfaceType_GetCamDataIndex,0x800C9704,0x9 -asm/non_matchings/code/z_bgcheck/func_800C9728.s,func_800C9728,0x800C9728,0x12 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetBgCamIndex.s,SurfaceType_GetBgCamIndex,0x800C9704,0x9 +asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamSettingImpl.s,BgCheck_GetBgCamSettingImpl,0x800C9728,0x12 asm/non_matchings/code/z_bgcheck/func_800C9770.s,func_800C9770,0x800C9770,0x22 -asm/non_matchings/code/z_bgcheck/func_800C97F8.s,func_800C97F8,0x800C97F8,0x13 -asm/non_matchings/code/z_bgcheck/func_800C9844.s,func_800C9844,0x800C9844,0x22 -asm/non_matchings/code/z_bgcheck/func_800C98CC.s,func_800C98CC,0x800C98CC,0x16 -asm/non_matchings/code/z_bgcheck/SurfaceType_GetCamPosData.s,SurfaceType_GetCamPosData,0x800C9924,0x22 +asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamCountImpl.s,BgCheck_GetBgCamCountImpl,0x800C97F8,0x13 +asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamCount.s,BgCheck_GetBgCamCount,0x800C9844,0x22 +asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncDataImpl.s,BgCheck_GetBgCamFuncDataImpl,0x800C98CC,0x16 +asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncData.s,BgCheck_GetBgCamFuncData,0x800C9924,0x22 asm/non_matchings/code/z_bgcheck/SurfaceType_GetSceneExitIndex.s,SurfaceType_GetSceneExitIndex,0x800C99AC,0xA asm/non_matchings/code/z_bgcheck/func_800C99D4.s,func_800C99D4,0x800C99D4,0xA asm/non_matchings/code/z_bgcheck/func_800C99FC.s,func_800C99FC,0x800C99FC,0xA @@ -601,7 +601,7 @@ asm/non_matchings/code/z_bgcheck/WaterBox_GetSurface2.s,WaterBox_GetSurface2,0x8 asm/non_matchings/code/z_bgcheck/func_800CA568.s,func_800CA568,0x800CA568,0x33 asm/non_matchings/code/z_bgcheck/func_800CA634.s,func_800CA634,0x800CA634,0x5 asm/non_matchings/code/z_bgcheck/func_800CA648.s,func_800CA648,0x800CA648,0x1C -asm/non_matchings/code/z_bgcheck/func_800CA6B8.s,func_800CA6B8,0x800CA6B8,0x8 +asm/non_matchings/code/z_bgcheck/WaterBox_GetSceneBgCamSetting.s,WaterBox_GetSceneBgCamSetting,0x800CA6B8,0x8 asm/non_matchings/code/z_bgcheck/WaterBox_GetLightSettingIndex.s,WaterBox_GetLightSettingIndex,0x800CA6D8,0x6 asm/non_matchings/code/z_bgcheck/func_800CA6F0.s,func_800CA6F0,0x800CA6F0,0xB8 asm/non_matchings/code/z_bgcheck/func_800CA9D0.s,func_800CA9D0,0x800CA9D0,0x11 @@ -645,7 +645,7 @@ asm/non_matchings/code/z_camera/func_800CB7CC.s,func_800CB7CC,0x800CB7CC,0xB asm/non_matchings/code/z_camera/func_800CB7F8.s,func_800CB7F8,0x800CB7F8,0xC asm/non_matchings/code/z_camera/func_800CB828.s,func_800CB828,0x800CB828,0xB asm/non_matchings/code/z_camera/func_800CB854.s,func_800CB854,0x800CB854,0xB -asm/non_matchings/code/z_camera/func_800CB880.s,func_800CB880,0x800CB880,0x12 +asm/non_matchings/code/z_camera/Camera_IsSwimming.s,Camera_IsSwimming,0x800CB880,0x12 asm/non_matchings/code/z_camera/func_800CB8C8.s,func_800CB8C8,0x800CB8C8,0xB asm/non_matchings/code/z_camera/func_800CB8F4.s,func_800CB8F4,0x800CB8F4,0xC asm/non_matchings/code/z_camera/func_800CB924.s,func_800CB924,0x800CB924,0xB @@ -668,10 +668,10 @@ asm/non_matchings/code/z_camera/func_800CC260.s,func_800CC260,0x800CC260,0x8A asm/non_matchings/code/z_camera/func_800CC488.s,func_800CC488,0x800CC488,0x39 asm/non_matchings/code/z_camera/func_800CC56C.s,func_800CC56C,0x800CC56C,0x17 asm/non_matchings/code/z_camera/func_800CC5C8.s,func_800CC5C8,0x800CC5C8,0x5E -asm/non_matchings/code/z_camera/func_800CC740.s,func_800CC740,0x800CC740,0x1A -asm/non_matchings/code/z_camera/func_800CC7A8.s,func_800CC7A8,0x800CC7A8,0x17 -asm/non_matchings/code/z_camera/func_800CC804.s,func_800CC804,0x800CC804,0x1C -asm/non_matchings/code/z_camera/func_800CC874.s,func_800CC874,0x800CC874,0x31 +asm/non_matchings/code/z_camera/Camera_GetBgCamOrActorCsCamSetting.s,Camera_GetBgCamOrActorCsCamSetting,0x800CC740,0x1A +asm/non_matchings/code/z_camera/Camera_GetBgCamOrActorCsCamFuncData.s,Camera_GetBgCamOrActorCsCamFuncData,0x800CC7A8,0x17 +asm/non_matchings/code/z_camera/Camera_GetBgCamIndex.s,Camera_GetBgCamIndex,0x800CC804,0x1C +asm/non_matchings/code/z_camera/Camera_GetWaterBoxBgCamSetting.s,Camera_GetWaterBoxBgCamSetting,0x800CC874,0x31 asm/non_matchings/code/z_camera/func_800CC938.s,func_800CC938,0x800CC938,0x8 asm/non_matchings/code/z_camera/func_800CC958.s,func_800CC958,0x800CC958,0x1A asm/non_matchings/code/z_camera/func_800CC9C0.s,func_800CC9C0,0x800CC9C0,0xCB @@ -1097,29 +1097,29 @@ asm/non_matchings/code/z_demo/Cutscene_GetActorActionIndex.s,Cutscene_GetActorAc asm/non_matchings/code/z_demo/Cutscene_CheckActorAction.s,Cutscene_CheckActorAction,0x800EE29C,0x16 asm/non_matchings/code/z_demo/Cutscene_IsPlaying.s,Cutscene_IsPlaying,0x800EE2F4,0xB asm/non_matchings/code/z_draw/GetItem_Draw.s,GetItem_Draw,0x800EE320,0x11 -asm/non_matchings/code/z_draw/func_800EE364.s,func_800EE364,0x800EE364,0x27 -asm/non_matchings/code/z_draw/func_800EE400.s,func_800EE400,0x800EE400,0x7F -asm/non_matchings/code/z_draw/func_800EE5FC.s,func_800EE5FC,0x800EE5FC,0x77 -asm/non_matchings/code/z_draw/func_800EE7D8.s,func_800EE7D8,0x800EE7D8,0x5A -asm/non_matchings/code/z_draw/func_800EE940.s,func_800EE940,0x800EE940,0x42 -asm/non_matchings/code/z_draw/func_800EEA48.s,func_800EEA48,0x800EEA48,0x74 -asm/non_matchings/code/z_draw/func_800EEC18.s,func_800EEC18,0x800EEC18,0x42 -asm/non_matchings/code/z_draw/func_800EED20.s,func_800EED20,0x800EED20,0x45 -asm/non_matchings/code/z_draw/func_800EEE34.s,func_800EEE34,0x800EEE34,0x46 -asm/non_matchings/code/z_draw/func_800EEF4C.s,func_800EEF4C,0x800EEF4C,0x42 -asm/non_matchings/code/z_draw/func_800EF054.s,func_800EF054,0x800EF054,0x27 -asm/non_matchings/code/z_draw/func_800EF0F0.s,func_800EF0F0,0x800EF0F0,0x41 -asm/non_matchings/code/z_draw/func_800EF1F4.s,func_800EF1F4,0x800EF1F4,0x2E -asm/non_matchings/code/z_draw/func_800EF2AC.s,func_800EF2AC,0x800EF2AC,0x2E -asm/non_matchings/code/z_draw/func_800EF364.s,func_800EF364,0x800EF364,0x5C -asm/non_matchings/code/z_draw/func_800EF4D4.s,func_800EF4D4,0x800EF4D4,0x62 -asm/non_matchings/code/z_draw/func_800EF65C.s,func_800EF65C,0x800EF65C,0x49 -asm/non_matchings/code/z_draw/func_800EF780.s,func_800EF780,0x800EF780,0x47 -asm/non_matchings/code/z_draw/func_800EF89C.s,func_800EF89C,0x800EF89C,0x3A -asm/non_matchings/code/z_draw/func_800EF984.s,func_800EF984,0x800EF984,0x4D -asm/non_matchings/code/z_draw/func_800EFAB8.s,func_800EFAB8,0x800EFAB8,0x51 -asm/non_matchings/code/z_draw/func_800EFBFC.s,func_800EFBFC,0x800EFBFC,0x52 -asm/non_matchings/code/z_draw/func_800EFD44.s,func_800EFD44,0x800EFD44,0x47 +asm/non_matchings/code/z_draw/GetItem_DrawBombchu.s,GetItem_DrawBombchu,0x800EE364,0x27 +asm/non_matchings/code/z_draw/GetItem_DrawPoes.s,GetItem_DrawPoes,0x800EE400,0x7F +asm/non_matchings/code/z_draw/GetItem_DrawFairyBottle.s,GetItem_DrawFairyBottle,0x800EE5FC,0x77 +asm/non_matchings/code/z_draw/GetItem_DrawSkullToken.s,GetItem_DrawSkullToken,0x800EE7D8,0x5A +asm/non_matchings/code/z_draw/GetItem_DrawCompass.s,GetItem_DrawCompass,0x800EE940,0x42 +asm/non_matchings/code/z_draw/GetItem_DrawPotion.s,GetItem_DrawPotion,0x800EEA48,0x74 +asm/non_matchings/code/z_draw/GetItem_DrawGoronSword.s,GetItem_DrawGoronSword,0x800EEC18,0x42 +asm/non_matchings/code/z_draw/GetItem_DrawDekuNuts.s,GetItem_DrawDekuNuts,0x800EED20,0x45 +asm/non_matchings/code/z_draw/GetItem_DrawRecoveryHeart.s,GetItem_DrawRecoveryHeart,0x800EEE34,0x46 +asm/non_matchings/code/z_draw/GetItem_DrawFish.s,GetItem_DrawFish,0x800EEF4C,0x42 +asm/non_matchings/code/z_draw/GetItem_DrawOpa0.s,GetItem_DrawOpa0,0x800EF054,0x27 +asm/non_matchings/code/z_draw/GetItem_DrawOpa0Xlu1.s,GetItem_DrawOpa0Xlu1,0x800EF0F0,0x41 +asm/non_matchings/code/z_draw/GetItem_DrawOpa01.s,GetItem_DrawOpa01,0x800EF1F4,0x2E +asm/non_matchings/code/z_draw/GetItem_DrawXlu01.s,GetItem_DrawXlu01,0x800EF2AC,0x2E +asm/non_matchings/code/z_draw/GetItem_DrawSeahorse.s,GetItem_DrawSeahorse,0x800EF364,0x5C +asm/non_matchings/code/z_draw/GetItem_DrawFairyContainer.s,GetItem_DrawFairyContainer,0x800EF4D4,0x62 +asm/non_matchings/code/z_draw/GetItem_DrawMoonsTear.s,GetItem_DrawMoonsTear,0x800EF65C,0x49 +asm/non_matchings/code/z_draw/GetItem_DrawMagicArrow.s,GetItem_DrawMagicArrow,0x800EF780,0x47 +asm/non_matchings/code/z_draw/GetItem_DrawUpgrades.s,GetItem_DrawUpgrades,0x800EF89C,0x3A +asm/non_matchings/code/z_draw/GetItem_DrawRupee.s,GetItem_DrawRupee,0x800EF984,0x4D +asm/non_matchings/code/z_draw/GetItem_DrawSmallRupee.s,GetItem_DrawSmallRupee,0x800EFAB8,0x51 +asm/non_matchings/code/z_draw/GetItem_DrawWallet.s,GetItem_DrawWallet,0x800EFBFC,0x52 +asm/non_matchings/code/z_draw/GetItem_DrawRemains.s,GetItem_DrawRemains,0x800EFD44,0x47 asm/non_matchings/code/z_eff_footmark/EffFootmark_Init.s,EffFootmark_Init,0x800EFE60,0x29 asm/non_matchings/code/z_eff_footmark/EffFootmark_Add.s,EffFootmark_Add,0x800EFF04,0x6E asm/non_matchings/code/z_eff_footmark/EffFootmark_Update.s,EffFootmark_Update,0x800F00BC,0x43 @@ -1171,7 +1171,7 @@ asm/non_matchings/code/z_eventmgr/ActorCutscene_GetAdditionalCutscene.s,ActorCut asm/non_matchings/code/z_eventmgr/ActorCutscene_GetLength.s,ActorCutscene_GetLength,0x800F20F8,0x10 asm/non_matchings/code/z_eventmgr/func_800F2138.s,func_800F2138,0x800F2138,0x10 asm/non_matchings/code/z_eventmgr/func_800F2178.s,func_800F2178,0x800F2178,0x10 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentCamera.s,ActorCutscene_GetCurrentCamera,0x800F21B8,0x5 +asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentSubCamId.s,ActorCutscene_GetCurrentSubCamId,0x800F21B8,0x5 asm/non_matchings/code/z_eventmgr/func_800F21CC.s,func_800F21CC,0x800F21CC,0x3E asm/non_matchings/code/z_eventmgr/func_800F22C4.s,func_800F22C4,0x800F22C4,0x40 asm/non_matchings/code/z_eventmgr/ActorCutscene_SetReturnCamera.s,ActorCutscene_SetReturnCamera,0x800F23C4,0x7 @@ -2536,8 +2536,8 @@ asm/non_matchings/code/z_play/Play_CameraChangeSetting.s,Play_CameraChangeSettin asm/non_matchings/code/z_play/func_80169AFC.s,func_80169AFC,0x80169AFC,0x32 asm/non_matchings/code/z_play/Play_CameraGetUID.s,Play_CameraGetUID,0x80169BC4,0xD 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/Play_GetActorCsCamSetting.s,Play_GetActorCsCamSetting,0x80169C64,0x8 +asm/non_matchings/code/z_play/Play_GetActorCsCamFuncData.s,Play_GetActorCsCamFuncData,0x80169C84,0xE 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 @@ -3283,41 +3283,41 @@ asm/non_matchings/code/audio_effects/AudioEffects_NoteVibratoInit.s,AudioEffects asm/non_matchings/code/audio_effects/AudioEffects_NotePortamentoInit.s,AudioEffects_NotePortamentoInit,0x80197138,0xB asm/non_matchings/code/audio_effects/AudioEffects_AdsrInit.s,AudioEffects_AdsrInit,0x80197164,0x9 asm/non_matchings/code/audio_effects/AudioEffects_AdsrUpdate.s,AudioEffects_AdsrUpdate,0x80197188,0xD2 -asm/non_matchings/code/audio_seqplayer/func_801974D0.s,func_801974D0,0x801974D0,0x1A -asm/non_matchings/code/audio_seqplayer/func_80197538.s,func_80197538,0x80197538,0x77 -asm/non_matchings/code/audio_seqplayer/func_80197714.s,func_80197714,0x80197714,0x5B -asm/non_matchings/code/audio_seqplayer/func_80197880.s,func_80197880,0x80197880,0x56 -asm/non_matchings/code/audio_seqplayer/func_801979D8.s,func_801979D8,0x801979D8,0x1F -asm/non_matchings/code/audio_seqplayer/func_80197A54.s,func_80197A54,0x80197A54,0x14 +asm/non_matchings/code/audio_seqplayer/AudioSeq_GetScriptControlFlowArgument.s,AudioSeq_GetScriptControlFlowArgument,0x801974D0,0x1A +asm/non_matchings/code/audio_seqplayer/AudioSeq_HandleScriptFlowControl.s,AudioSeq_HandleScriptFlowControl,0x80197538,0x77 +asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequenceChannel.s,AudioSeq_InitSequenceChannel,0x80197714,0x5B +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqChannelSetLayer.s,AudioSeq_SeqChannelSetLayer,0x80197880,0x56 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerDisable.s,AudioSeq_SeqLayerDisable,0x801979D8,0x1F +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerFree.s,AudioSeq_SeqLayerFree,0x80197A54,0x14 asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelDisable.s,AudioSeq_SequenceChannelDisable,0x80197AA4,0x1C -asm/non_matchings/code/audio_seqplayer/func_80197B14.s,func_80197B14,0x80197B14,0x3E -asm/non_matchings/code/audio_seqplayer/func_80197C0C.s,func_80197C0C,0x80197C0C,0x20 -asm/non_matchings/code/audio_seqplayer/func_80197C8C.s,func_80197C8C,0x80197C8C,0x26 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerSetupChannels.s,AudioSeq_SequencePlayerSetupChannels,0x80197B14,0x3E +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisableChannels.s,AudioSeq_SequencePlayerDisableChannels,0x80197C0C,0x20 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelEnable.s,AudioSeq_SequenceChannelEnable,0x80197C8C,0x26 asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisableAsFinished.s,AudioSeq_SequencePlayerDisableAsFinished,0x80197D24,0xA asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerDisable.s,AudioSeq_SequencePlayerDisable,0x80197D4C,0x2F asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPushBack.s,AudioSeq_AudioListPushBack,0x80197E08,0x10 asm/non_matchings/code/audio_seqplayer/AudioSeq_AudioListPopBack.s,AudioSeq_AudioListPopBack,0x80197E48,0x10 -asm/non_matchings/code/audio_seqplayer/func_80197E88.s,func_80197E88,0x80197E88,0x28 -asm/non_matchings/code/audio_seqplayer/func_80197F28.s,func_80197F28,0x80197F28,0x5 -asm/non_matchings/code/audio_seqplayer/func_80197F3C.s,func_80197F3C,0x80197F3C,0xE -asm/non_matchings/code/audio_seqplayer/func_80197F74.s,func_80197F74,0x80197F74,0x10 -asm/non_matchings/code/audio_seqplayer/func_80197FB4.s,func_80197FB4,0x80197FB4,0x47 -asm/non_matchings/code/audio_seqplayer/func_801980D0.s,func_801980D0,0x801980D0,0x23 -asm/non_matchings/code/audio_seqplayer/func_8019815C.s,func_8019815C,0x8019815C,0x40 -asm/non_matchings/code/audio_seqplayer/func_8019825C.s,func_8019825C,0x8019825C,0xF9 -asm/non_matchings/code/audio_seqplayer/func_80198640.s,func_80198640,0x80198640,0x1A8 -asm/non_matchings/code/audio_seqplayer/func_80198CE0.s,func_80198CE0,0x80198CE0,0x105 -asm/non_matchings/code/audio_seqplayer/func_801990F4.s,func_801990F4,0x801990F4,0xC -asm/non_matchings/code/audio_seqplayer/func_80199124.s,func_80199124,0x80199124,0x1D -asm/non_matchings/code/audio_seqplayer/func_80199198.s,func_80199198,0x80199198,0x2B -asm/non_matchings/code/audio_seqplayer/func_80199244.s,func_80199244,0x80199244,0x9 -asm/non_matchings/code/audio_seqplayer/func_80199268.s,func_80199268,0x80199268,0x395 -asm/non_matchings/code/audio_seqplayer/func_8019A0BC.s,func_8019A0BC,0x8019A0BC,0x260 -asm/non_matchings/code/audio_seqplayer/func_8019AA3C.s,func_8019AA3C,0x8019AA3C,0x2D -asm/non_matchings/code/audio_seqplayer/func_8019AAF0.s,func_8019AAF0,0x8019AAF0,0x14 +asm/non_matchings/code/audio_seqplayer/AudioSeq_InitLayerFreelist.s,AudioSeq_InitLayerFreelist,0x80197E88,0x28 +asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadU8.s,AudioSeq_ScriptReadU8,0x80197F28,0x5 +asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadS16.s,AudioSeq_ScriptReadS16,0x80197F3C,0xE +asm/non_matchings/code/audio_seqplayer/AudioSeq_ScriptReadCompressedU16.s,AudioSeq_ScriptReadCompressedU16,0x80197F74,0x10 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScript.s,AudioSeq_SeqLayerProcessScript,0x80197FB4,0x47 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep1.s,AudioSeq_SeqLayerProcessScriptStep1,0x801980D0,0x23 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep5.s,AudioSeq_SeqLayerProcessScriptStep5,0x8019815C,0x40 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep2.s,AudioSeq_SeqLayerProcessScriptStep2,0x8019825C,0xF9 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep4.s,AudioSeq_SeqLayerProcessScriptStep4,0x80198640,0x1A8 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SeqLayerProcessScriptStep3.s,AudioSeq_SeqLayerProcessScriptStep3,0x80198CE0,0x105 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SetChannelPriorities.s,AudioSeq_SetChannelPriorities,0x801990F4,0xC +asm/non_matchings/code/audio_seqplayer/AudioSeq_GetInstrument.s,AudioSeq_GetInstrument,0x80199124,0x1D +asm/non_matchings/code/audio_seqplayer/AudioSeq_SetInstrument.s,AudioSeq_SetInstrument,0x80199198,0x2B +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelSetVolume.s,AudioSeq_SequenceChannelSetVolume,0x80199244,0x9 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequenceChannelProcessScript.s,AudioSeq_SequenceChannelProcessScript,0x80199268,0x395 +asm/non_matchings/code/audio_seqplayer/AudioSeq_SequencePlayerProcessSequence.s,AudioSeq_SequencePlayerProcessSequence,0x8019A0BC,0x260 +asm/non_matchings/code/audio_seqplayer/AudioSeq_ProcessSequences.s,AudioSeq_ProcessSequences,0x8019AA3C,0x2D +asm/non_matchings/code/audio_seqplayer/AudioSeq_SkipForwardSequence.s,AudioSeq_SkipForwardSequence,0x8019AAF0,0x14 asm/non_matchings/code/audio_seqplayer/AudioSeq_ResetSequencePlayer.s,AudioSeq_ResetSequencePlayer,0x8019AB40,0x34 asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayerChannels.s,AudioSeq_InitSequencePlayerChannels,0x8019AC10,0x37 -asm/non_matchings/code/audio_seqplayer/func_8019ACEC.s,func_8019ACEC,0x8019ACEC,0x34 +asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayer.s,AudioSeq_InitSequencePlayer,0x8019ACEC,0x34 asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayers.s,AudioSeq_InitSequencePlayers,0x8019ADBC,0x21 asm/non_matchings/code/code_8019AE40/func_8019AE40.s,func_8019AE40,0x8019AE40,0x1C asm/non_matchings/code/code_8019AEC0/func_8019AEC0.s,func_8019AEC0,0x8019AEC0,0x10 diff --git a/undefined_syms.txt b/undefined_syms.txt index c44ed6928..c9a2964db 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -423,7 +423,6 @@ D_0402F028 = 0x0402F028; D_0402F0EC = 0x0402F0EC; D_04030100 = 0x04030100; D_040301B0 = 0x040301B0; -D_04032270 = 0x04032270; D_040367B0 = 0x040367B0; D_040377B0 = 0x040377B0; D_04037850 = 0x04037850; @@ -583,8 +582,6 @@ D_060037F8 = 0x060037F8; // ovl_Bg_Haka_Bombwall -D_06000040 = 0x06000040; -D_06000148 = 0x06000148; D_06001680 = 0x06001680; // ovl_Bg_Hakugin_Bombwall @@ -864,18 +861,6 @@ D_06000000 = 0x06000000; D_06000140 = 0x06000140; D_06001AF0 = 0x06001AF0; -// ovl_Eff_Lastday - -D_06000000 = 0x06000000; -D_06000060 = 0x06000060; -D_06000148 = 0x06000148; -D_06000210 = 0x06000210; -D_06000308 = 0x06000308; -D_06000370 = 0x06000370; -D_06000448 = 0x06000448; -D_06000510 = 0x06000510; -D_06000608 = 0x06000608; - // ovl_Eff_Stk D_06008920 = 0x06008920; @@ -956,10 +941,6 @@ D_06004210 = 0x06004210; D_06007C70 = 0x06007C70; D_0600823C = 0x0600823C; -// ovl_En_Bjt - -D_06002390 = 0x06002390; - // ovl_En_Bombal D_06000A00 = 0x06000A00; @@ -1130,21 +1111,6 @@ D_0600B644 = 0x0600B644; D_0600F248 = 0x0600F248; D_06012A58 = 0x06012A58; -// ovl_En_Ik - -D_06000CE8 = 0x06000CE8; -D_060015F8 = 0x060015F8; -D_06001ABC = 0x06001ABC; -D_06002484 = 0x06002484; -D_06002E7C = 0x06002E7C; -D_0600367C = 0x0600367C; -D_0600391C = 0x0600391C; -D_06004A04 = 0x06004A04; -D_06005254 = 0x06005254; -D_060057F4 = 0x060057F4; -D_06006294 = 0x06006294; -D_060136A0 = 0x060136A0; - // ovl_En_Invadepoh_Demo D_06000080 = 0x06000080; @@ -1500,12 +1466,6 @@ D_06000030 = 0x06000030; D_06002068 = 0x06002068; D_06002188 = 0x06002188; -// ovl_Obj_Ocarinalift - -D_06001DB0 = 0x06001DB0; -D_06001E40 = 0x06001E40; -D_060048D0 = 0x060048D0; - // ovl_Obj_Takaraya_Wall D_06000B70 = 0x06000B70; @@ -1520,13 +1480,6 @@ D_06001100 = 0x06001100; D_06001140 = 0x06001140; D_06001CB0 = 0x06001CB0; -// ovl_Obj_Um - -D_06007E20 = 0x06007E20; -D_06007F50 = 0x06007F50; -D_06011DF8 = 0x06011DF8; -D_06012CC0 = 0x06012CC0; - // ovl_Obj_Usiyane D_06000098 = 0x06000098;