diff --git a/Makefile b/Makefile index f33f60848..e4729002c 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ ELF2ROM := tools/buildtools/elf2rom MKLDSCRIPT := tools/buildtools/mkldscript YAZ0 := tools/buildtools/yaz0 ZAPD := tools/ZAPD/ZAPD.out +FADO := tools/fado/fado.elf OPTFLAGS := -O2 -g3 ASFLAGS := -march=vr4300 -32 -Iinclude @@ -184,9 +185,11 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \ $(foreach f,$(C_FILES:.c=.o),build/$f) \ $(foreach f,$(BASEROM_FILES),build/$f.o) +OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' ) + # Automatic dependency files -# (Only asm_processor dependencies are handled for now) -DEP_FILES := $(O_FILES:.o=.asmproc.d) +# (Only asm_processor dependencies and reloc dependencies are handled for now) +DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) # create build directories $(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(ASSET_BIN_DIRS),build/$(dir))) @@ -262,9 +265,20 @@ $(ROM): $(ELF) $(ROMC): $(ROM) python3 tools/z64compress_wrapper.py $(COMPFLAGS) $(ROM) $@ $(ELF) build/$(SPEC) -$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) build/ldscript.txt build/undefined_syms.txt +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) build/ldscript.txt build/undefined_syms.txt $(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/mm.map -o $@ +## Order-only prerequisites +# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES. +# The intermediate phony targets avoid quadratically-many dependencies between the targets and prerequisites. + +o_files: $(O_FILES) +$(OVL_RELOC_FILES): | o_files + +asset_files: $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) +$(O_FILES): | asset_files + +.PHONY: o_files asset_files #### Main commands #### @@ -313,9 +327,11 @@ init: build/undefined_syms.txt: undefined_syms.txt $(CPP) $(CPPFLAGS) $< > build/undefined_syms.txt -build/ldscript.txt: $(SPEC) - $(CPP) $(CPPFLAGS) $< > build/spec - $(MKLDSCRIPT) build/spec $@ +build/$(SPEC): $(SPEC) + $(CPP) $(CPPFLAGS) $< > $@ + +build/ldscript.txt: build/$(SPEC) + $(MKLDSCRIPT) $< $@ build/asm/%.o: asm/%.s $(AS) $(ASFLAGS) $< -o $@ @@ -334,13 +350,13 @@ build/data/%.o: data/%.s build/src/overlays/%.o: src/overlays/%.c $(CC_CHECK) $< $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< - $(OBJDUMP_CMD) -# TODO: `() || true` is currently necessary to suppress `Error 1 (ignored)` make warnings caused by `test`, but this will go away if -# the following is moved to a separate rule that is only run once when all the required objects have been compiled. - $(ZAPD) bovl -eh -i $@ -cfg $< --outputpath $(@D)/$(notdir $(@D))_reloc.s - (test -f $(@D)/$(notdir $(@D))_reloc.s && $(AS) $(ASFLAGS) $(@D)/$(notdir $(@D))_reloc.s -o $(@D)/$(notdir $(@D))_reloc.o) || true + @$(OBJDUMP) -d $@ > $(@:.o=.s) $(RM_MDEBUG) +build/src/overlays/%_reloc.o: build/$(SPEC) + $(FADO) $$(tools/buildtools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d) + $(AS) $(ASFLAGS) $(@:.o=.s) -o $@ + build/src/%.o: src/%.c $(CC_CHECK) $< $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< diff --git a/README.md b/README.md index 0dfb48d9f..9d746db2a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Please refer to the following for more information: - [Website](https://zelda64.dev/) - [Discord](https://discord.zelda64.dev/) -- [How to Contribute](CONTRIBUTING.md) +- [How to Contribute](docs/CONTRIBUTING.md) ## Installation diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml index 45fa3eccd..596101814 100644 --- a/assets/xml/objects/gameplay_field_keep.xml +++ b/assets/xml/objects/gameplay_field_keep.xml @@ -12,14 +12,14 @@ - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 11b6a0861..4f1ad1841 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -796,7 +796,7 @@ - + @@ -820,7 +820,7 @@ - + @@ -828,16 +828,18 @@ - - - - - + + + + + - - - - + + + + + + @@ -891,11 +893,11 @@ - - - - - + + + + + @@ -942,13 +944,13 @@ - - - - - - - + + + + + + + @@ -981,7 +983,7 @@ - + @@ -995,13 +997,13 @@ - - - - - - - + + + + + + + @@ -1087,7 +1089,7 @@ - + @@ -1112,10 +1114,10 @@ - - - - + + + + @@ -1150,30 +1152,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -1285,12 +1287,18 @@ - - - - + + + + + + + + + + - + @@ -1303,14 +1311,17 @@ + + - + - + + @@ -1343,11 +1354,11 @@ - - - - - + + + + + diff --git a/assets/xml/objects/object_ah.xml b/assets/xml/objects/object_ah.xml index 3644f2a90..1bf479e86 100644 --- a/assets/xml/objects/object_ah.xml +++ b/assets/xml/objects/object_ah.xml @@ -53,6 +53,6 @@ - + diff --git a/assets/xml/objects/object_ahg.xml b/assets/xml/objects/object_ahg.xml index 7d4c2c741..7eb4c7126 100644 --- a/assets/xml/objects/object_ahg.xml +++ b/assets/xml/objects/object_ahg.xml @@ -48,6 +48,6 @@ - + diff --git a/assets/xml/objects/object_al.xml b/assets/xml/objects/object_al.xml index dc28bcf6b..db348868a 100644 --- a/assets/xml/objects/object_al.xml +++ b/assets/xml/objects/object_al.xml @@ -65,7 +65,7 @@ - + diff --git a/assets/xml/objects/object_am.xml b/assets/xml/objects/object_am.xml index b0737cb50..1f738d39b 100644 --- a/assets/xml/objects/object_am.xml +++ b/assets/xml/objects/object_am.xml @@ -34,7 +34,7 @@ - + diff --git a/assets/xml/objects/object_an1.xml b/assets/xml/objects/object_an1.xml index 2c212923d..2db214bd3 100644 --- a/assets/xml/objects/object_an1.xml +++ b/assets/xml/objects/object_an1.xml @@ -81,7 +81,7 @@ - + diff --git a/assets/xml/objects/object_and.xml b/assets/xml/objects/object_and.xml index 17cff4597..00c8d7585 100644 --- a/assets/xml/objects/object_and.xml +++ b/assets/xml/objects/object_and.xml @@ -67,7 +67,7 @@ - + diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml index 3d8f7c385..34fb49f0d 100644 --- a/assets/xml/objects/object_ani.xml +++ b/assets/xml/objects/object_ani.xml @@ -21,7 +21,7 @@ - + diff --git a/assets/xml/objects/object_aob.xml b/assets/xml/objects/object_aob.xml index 3325e9b53..50de06ea0 100644 --- a/assets/xml/objects/object_aob.xml +++ b/assets/xml/objects/object_aob.xml @@ -22,7 +22,7 @@ - + diff --git a/assets/xml/objects/object_az.xml b/assets/xml/objects/object_az.xml index d4382673f..81207b06b 100644 --- a/assets/xml/objects/object_az.xml +++ b/assets/xml/objects/object_az.xml @@ -50,7 +50,7 @@ - + @@ -121,7 +121,7 @@ - + diff --git a/assets/xml/objects/object_bai.xml b/assets/xml/objects/object_bai.xml index 4225bec84..813065876 100644 --- a/assets/xml/objects/object_bai.xml +++ b/assets/xml/objects/object_bai.xml @@ -47,7 +47,7 @@ - + diff --git a/assets/xml/objects/object_bal.xml b/assets/xml/objects/object_bal.xml index a16e2fb1f..2cdfc5c3a 100644 --- a/assets/xml/objects/object_bal.xml +++ b/assets/xml/objects/object_bal.xml @@ -68,7 +68,7 @@ - + diff --git a/assets/xml/objects/object_bb.xml b/assets/xml/objects/object_bb.xml index c9c6a0a90..e03cdb0e2 100644 --- a/assets/xml/objects/object_bb.xml +++ b/assets/xml/objects/object_bb.xml @@ -42,6 +42,6 @@ - + diff --git a/assets/xml/objects/object_bba.xml b/assets/xml/objects/object_bba.xml index c3c5a5c1b..0b22866e7 100644 --- a/assets/xml/objects/object_bba.xml +++ b/assets/xml/objects/object_bba.xml @@ -41,7 +41,7 @@ - + diff --git a/assets/xml/objects/object_bee.xml b/assets/xml/objects/object_bee.xml index 8f1d704cf..735d191f3 100644 --- a/assets/xml/objects/object_bee.xml +++ b/assets/xml/objects/object_bee.xml @@ -23,6 +23,6 @@ - + diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index 0602f987d..fe294cb33 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -51,7 +51,7 @@ - + @@ -107,6 +107,6 @@ - + diff --git a/assets/xml/objects/object_bh.xml b/assets/xml/objects/object_bh.xml index 56b7de5f9..3e33fb739 100644 --- a/assets/xml/objects/object_bh.xml +++ b/assets/xml/objects/object_bh.xml @@ -13,6 +13,6 @@ - + diff --git a/assets/xml/objects/object_bigokuta.xml b/assets/xml/objects/object_bigokuta.xml index 2c54c6a61..d8df44ddc 100644 --- a/assets/xml/objects/object_bigokuta.xml +++ b/assets/xml/objects/object_bigokuta.xml @@ -53,6 +53,6 @@ - + diff --git a/assets/xml/objects/object_bigslime.xml b/assets/xml/objects/object_bigslime.xml index 7195c20c7..84a6eec61 100644 --- a/assets/xml/objects/object_bigslime.xml +++ b/assets/xml/objects/object_bigslime.xml @@ -88,7 +88,7 @@ - + diff --git a/assets/xml/objects/object_bji.xml b/assets/xml/objects/object_bji.xml index 0fec0c8c3..bef54b0e5 100644 --- a/assets/xml/objects/object_bji.xml +++ b/assets/xml/objects/object_bji.xml @@ -57,7 +57,7 @@ - + diff --git a/assets/xml/objects/object_bjt.xml b/assets/xml/objects/object_bjt.xml index 59a71dcee..27529206f 100644 --- a/assets/xml/objects/object_bjt.xml +++ b/assets/xml/objects/object_bjt.xml @@ -23,6 +23,6 @@ - + diff --git a/assets/xml/objects/object_bob.xml b/assets/xml/objects/object_bob.xml index f942c84db..13edbe6fe 100644 --- a/assets/xml/objects/object_bob.xml +++ b/assets/xml/objects/object_bob.xml @@ -15,7 +15,7 @@ - + diff --git a/assets/xml/objects/object_boj.xml b/assets/xml/objects/object_boj.xml index ed42d9031..cfb10e97a 100644 --- a/assets/xml/objects/object_boj.xml +++ b/assets/xml/objects/object_boj.xml @@ -75,7 +75,7 @@ - + diff --git a/assets/xml/objects/object_boss01.xml b/assets/xml/objects/object_boss01.xml index 6a10080a3..89cc97a7e 100644 --- a/assets/xml/objects/object_boss01.xml +++ b/assets/xml/objects/object_boss01.xml @@ -113,7 +113,7 @@ - + @@ -183,7 +183,7 @@ - + diff --git a/assets/xml/objects/object_boss02.xml b/assets/xml/objects/object_boss02.xml index 9a400554b..8a80a57f2 100644 --- a/assets/xml/objects/object_boss02.xml +++ b/assets/xml/objects/object_boss02.xml @@ -62,7 +62,7 @@ - + @@ -120,6 +120,6 @@ - + diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml index 75ce1d3c9..da17bf406 100644 --- a/assets/xml/objects/object_boss03.xml +++ b/assets/xml/objects/object_boss03.xml @@ -65,7 +65,7 @@ - + @@ -130,7 +130,7 @@ - + diff --git a/assets/xml/objects/object_boss04.xml b/assets/xml/objects/object_boss04.xml index ce54c25b4..d98083a64 100644 --- a/assets/xml/objects/object_boss04.xml +++ b/assets/xml/objects/object_boss04.xml @@ -41,6 +41,6 @@ - + diff --git a/assets/xml/objects/object_boss05.xml b/assets/xml/objects/object_boss05.xml index b401ae2be..95bb16edd 100644 --- a/assets/xml/objects/object_boss05.xml +++ b/assets/xml/objects/object_boss05.xml @@ -24,7 +24,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/assets/xml/objects/object_boss07.xml b/assets/xml/objects/object_boss07.xml index 15a2e162d..91234f758 100644 --- a/assets/xml/objects/object_boss07.xml +++ b/assets/xml/objects/object_boss07.xml @@ -47,7 +47,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -184,7 +184,7 @@ - + diff --git a/assets/xml/objects/object_boss_hakugin.xml b/assets/xml/objects/object_boss_hakugin.xml index 62d6fb91f..3444dc041 100644 --- a/assets/xml/objects/object_boss_hakugin.xml +++ b/assets/xml/objects/object_boss_hakugin.xml @@ -73,7 +73,7 @@ - + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index 85e788633..4413ecd7a 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -21,7 +21,7 @@ - + @@ -44,7 +44,7 @@ - + diff --git a/assets/xml/objects/object_bsb.xml b/assets/xml/objects/object_bsb.xml index 7ccf12bce..81cdb9991 100644 --- a/assets/xml/objects/object_bsb.xml +++ b/assets/xml/objects/object_bsb.xml @@ -72,7 +72,7 @@ - + diff --git a/assets/xml/objects/object_cne.xml b/assets/xml/objects/object_cne.xml index fccbf539f..a4c8b28e2 100644 --- a/assets/xml/objects/object_cne.xml +++ b/assets/xml/objects/object_cne.xml @@ -18,7 +18,7 @@ - + diff --git a/assets/xml/objects/object_cow.xml b/assets/xml/objects/object_cow.xml index 535d5dd85..6895d6217 100644 --- a/assets/xml/objects/object_cow.xml +++ b/assets/xml/objects/object_cow.xml @@ -30,7 +30,7 @@ - + @@ -50,7 +50,7 @@ - + diff --git a/assets/xml/objects/object_crow.xml b/assets/xml/objects/object_crow.xml index de51da580..10fc23543 100644 --- a/assets/xml/objects/object_crow.xml +++ b/assets/xml/objects/object_crow.xml @@ -19,6 +19,6 @@ - + diff --git a/assets/xml/objects/object_cs.xml b/assets/xml/objects/object_cs.xml index 803d2b02c..fe614582b 100644 --- a/assets/xml/objects/object_cs.xml +++ b/assets/xml/objects/object_cs.xml @@ -89,7 +89,7 @@ - + diff --git a/assets/xml/objects/object_dai.xml b/assets/xml/objects/object_dai.xml index f613a9ab8..b547897f8 100644 --- a/assets/xml/objects/object_dai.xml +++ b/assets/xml/objects/object_dai.xml @@ -81,6 +81,6 @@ - + diff --git a/assets/xml/objects/object_daiku.xml b/assets/xml/objects/object_daiku.xml index 57124bd28..17d8ddbf0 100644 --- a/assets/xml/objects/object_daiku.xml +++ b/assets/xml/objects/object_daiku.xml @@ -65,7 +65,7 @@ - + diff --git a/assets/xml/objects/object_death.xml b/assets/xml/objects/object_death.xml index 7d3e1e596..77d4ccd4a 100644 --- a/assets/xml/objects/object_death.xml +++ b/assets/xml/objects/object_death.xml @@ -75,7 +75,7 @@ - + diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index b82cfb94b..eb80e770b 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -20,7 +20,7 @@ - + diff --git a/assets/xml/objects/object_dekunuts.xml b/assets/xml/objects/object_dekunuts.xml index 8a45dd04a..909231a77 100644 --- a/assets/xml/objects/object_dekunuts.xml +++ b/assets/xml/objects/object_dekunuts.xml @@ -38,7 +38,7 @@ - + diff --git a/assets/xml/objects/object_dinofos.xml b/assets/xml/objects/object_dinofos.xml index 7b1ff8c20..8db9c7c4a 100644 --- a/assets/xml/objects/object_dinofos.xml +++ b/assets/xml/objects/object_dinofos.xml @@ -61,7 +61,7 @@ - + diff --git a/assets/xml/objects/object_dnk.xml b/assets/xml/objects/object_dnk.xml index ad69c7722..bec6ce45d 100644 --- a/assets/xml/objects/object_dnk.xml +++ b/assets/xml/objects/object_dnk.xml @@ -44,7 +44,7 @@ - + diff --git a/assets/xml/objects/object_dno.xml b/assets/xml/objects/object_dno.xml index a320be10f..664663628 100644 --- a/assets/xml/objects/object_dno.xml +++ b/assets/xml/objects/object_dno.xml @@ -81,6 +81,6 @@ - + diff --git a/assets/xml/objects/object_dnp.xml b/assets/xml/objects/object_dnp.xml index 376368578..d9494909c 100644 --- a/assets/xml/objects/object_dnp.xml +++ b/assets/xml/objects/object_dnp.xml @@ -81,7 +81,7 @@ - + diff --git a/assets/xml/objects/object_dnq.xml b/assets/xml/objects/object_dnq.xml index 830e6d8e4..92d818a4b 100644 --- a/assets/xml/objects/object_dnq.xml +++ b/assets/xml/objects/object_dnq.xml @@ -88,7 +88,7 @@ - + diff --git a/assets/xml/objects/object_dns.xml b/assets/xml/objects/object_dns.xml index d42f68f54..e5d91326f 100644 --- a/assets/xml/objects/object_dns.xml +++ b/assets/xml/objects/object_dns.xml @@ -38,7 +38,7 @@ - + diff --git a/assets/xml/objects/object_dnt.xml b/assets/xml/objects/object_dnt.xml index 6a2b0058d..96b793849 100644 --- a/assets/xml/objects/object_dnt.xml +++ b/assets/xml/objects/object_dnt.xml @@ -84,7 +84,7 @@ - + diff --git a/assets/xml/objects/object_dodongo.xml b/assets/xml/objects/object_dodongo.xml index f63a27467..df70802d0 100644 --- a/assets/xml/objects/object_dodongo.xml +++ b/assets/xml/objects/object_dodongo.xml @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_dog.xml b/assets/xml/objects/object_dog.xml index 6941cb36c..0e3d318b4 100644 --- a/assets/xml/objects/object_dog.xml +++ b/assets/xml/objects/object_dog.xml @@ -60,6 +60,6 @@ - + diff --git a/assets/xml/objects/object_drs.xml b/assets/xml/objects/object_drs.xml index c5f4ee726..1b6c29597 100644 --- a/assets/xml/objects/object_drs.xml +++ b/assets/xml/objects/object_drs.xml @@ -16,6 +16,6 @@ - + diff --git a/assets/xml/objects/object_ds2.xml b/assets/xml/objects/object_ds2.xml index 1f1fd9d20..1794c4bf8 100644 --- a/assets/xml/objects/object_ds2.xml +++ b/assets/xml/objects/object_ds2.xml @@ -27,6 +27,6 @@ - + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml index 721eec677..7e7d45f0c 100644 --- a/assets/xml/objects/object_ds2n.xml +++ b/assets/xml/objects/object_ds2n.xml @@ -86,7 +86,7 @@ - + diff --git a/assets/xml/objects/object_dt.xml b/assets/xml/objects/object_dt.xml index 78ad8046e..8b2a90217 100644 --- a/assets/xml/objects/object_dt.xml +++ b/assets/xml/objects/object_dt.xml @@ -61,7 +61,7 @@ - + diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml index 8dd90375a..a64bc975b 100644 --- a/assets/xml/objects/object_dy_obj.xml +++ b/assets/xml/objects/object_dy_obj.xml @@ -91,6 +91,6 @@ - + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index 3cb6468b9..709224f9d 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -8,6 +8,6 @@ - + diff --git a/assets/xml/objects/object_eg.xml b/assets/xml/objects/object_eg.xml index 46d3e0089..9cda7f0a3 100644 --- a/assets/xml/objects/object_eg.xml +++ b/assets/xml/objects/object_eg.xml @@ -70,7 +70,7 @@ - + diff --git a/assets/xml/objects/object_famos.xml b/assets/xml/objects/object_famos.xml index cbbf0057c..d12a94d66 100644 --- a/assets/xml/objects/object_famos.xml +++ b/assets/xml/objects/object_famos.xml @@ -22,7 +22,7 @@ - + diff --git a/assets/xml/objects/object_fb.xml b/assets/xml/objects/object_fb.xml index f0d3b8111..bb630781c 100644 --- a/assets/xml/objects/object_fb.xml +++ b/assets/xml/objects/object_fb.xml @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_firefly.xml b/assets/xml/objects/object_firefly.xml index 84018ddd8..4c6aacd16 100644 --- a/assets/xml/objects/object_firefly.xml +++ b/assets/xml/objects/object_firefly.xml @@ -49,6 +49,6 @@ - + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index 9da78b6ab..f01639fbf 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -35,7 +35,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -131,7 +131,7 @@ - + diff --git a/assets/xml/objects/object_fr.xml b/assets/xml/objects/object_fr.xml index cb02087ba..0cd28760e 100644 --- a/assets/xml/objects/object_fr.xml +++ b/assets/xml/objects/object_fr.xml @@ -62,6 +62,6 @@ - + diff --git a/assets/xml/objects/object_fsn.xml b/assets/xml/objects/object_fsn.xml index e3ae8db1b..dd67874f0 100644 --- a/assets/xml/objects/object_fsn.xml +++ b/assets/xml/objects/object_fsn.xml @@ -103,7 +103,7 @@ - + diff --git a/assets/xml/objects/object_fu.xml b/assets/xml/objects/object_fu.xml index 4094355ae..19404f90e 100644 --- a/assets/xml/objects/object_fu.xml +++ b/assets/xml/objects/object_fu.xml @@ -47,6 +47,6 @@ - + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index 2f6aac2dd..ead4263dc 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -1,63 +1,83 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml index 6338b48d6..5590677ea 100644 --- a/assets/xml/objects/object_geldb.xml +++ b/assets/xml/objects/object_geldb.xml @@ -71,7 +71,7 @@ - + diff --git a/assets/xml/objects/object_gg.xml b/assets/xml/objects/object_gg.xml index 17c21c93a..f7483e338 100644 --- a/assets/xml/objects/object_gg.xml +++ b/assets/xml/objects/object_gg.xml @@ -71,7 +71,7 @@ - + diff --git a/assets/xml/objects/object_giant.xml b/assets/xml/objects/object_giant.xml index 8698d176b..491cd0cb0 100644 --- a/assets/xml/objects/object_giant.xml +++ b/assets/xml/objects/object_giant.xml @@ -68,7 +68,7 @@ - + diff --git a/assets/xml/objects/object_gk.xml b/assets/xml/objects/object_gk.xml index 3fde40f94..b36aef153 100644 --- a/assets/xml/objects/object_gk.xml +++ b/assets/xml/objects/object_gk.xml @@ -42,7 +42,7 @@ - + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index ae80c7dfc..7463cd2e0 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -65,7 +65,7 @@ - + diff --git a/assets/xml/objects/object_gmo.xml b/assets/xml/objects/object_gmo.xml index 7490a661e..eaee120b3 100644 --- a/assets/xml/objects/object_gmo.xml +++ b/assets/xml/objects/object_gmo.xml @@ -11,6 +11,6 @@ - + diff --git a/assets/xml/objects/object_grasshopper.xml b/assets/xml/objects/object_grasshopper.xml index 35120e0c9..3ef7b8e64 100644 --- a/assets/xml/objects/object_grasshopper.xml +++ b/assets/xml/objects/object_grasshopper.xml @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_ha.xml b/assets/xml/objects/object_ha.xml index 4f595b6be..94973c809 100644 --- a/assets/xml/objects/object_ha.xml +++ b/assets/xml/objects/object_ha.xml @@ -63,7 +63,7 @@ - + @@ -130,6 +130,6 @@ - + diff --git a/assets/xml/objects/object_hakugin_obj.xml b/assets/xml/objects/object_hakugin_obj.xml index 412d0bdd3..b4badbd1d 100644 --- a/assets/xml/objects/object_hakugin_obj.xml +++ b/assets/xml/objects/object_hakugin_obj.xml @@ -6,37 +6,37 @@ - + - + - + - + - + - + - + diff --git a/assets/xml/objects/object_harfgibud.xml b/assets/xml/objects/object_harfgibud.xml index 361bbe74c..61e1fc457 100644 --- a/assets/xml/objects/object_harfgibud.xml +++ b/assets/xml/objects/object_harfgibud.xml @@ -56,7 +56,7 @@ - + @@ -116,7 +116,7 @@ - + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml index 3f5e12a38..9271520b7 100644 --- a/assets/xml/objects/object_hata.xml +++ b/assets/xml/objects/object_hata.xml @@ -34,6 +34,6 @@ - + diff --git a/assets/xml/objects/object_hintnuts.xml b/assets/xml/objects/object_hintnuts.xml index a500981a7..483623988 100644 --- a/assets/xml/objects/object_hintnuts.xml +++ b/assets/xml/objects/object_hintnuts.xml @@ -27,7 +27,7 @@ - + diff --git a/assets/xml/objects/object_horse_link_child.xml b/assets/xml/objects/object_horse_link_child.xml index 506135e0c..60178badb 100644 --- a/assets/xml/objects/object_horse_link_child.xml +++ b/assets/xml/objects/object_horse_link_child.xml @@ -76,7 +76,7 @@ - + diff --git a/assets/xml/objects/object_hs.xml b/assets/xml/objects/object_hs.xml index ae025f327..19ea49b6b 100644 --- a/assets/xml/objects/object_hs.xml +++ b/assets/xml/objects/object_hs.xml @@ -46,6 +46,6 @@ - + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 7042bf10b..352b82487 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -100,6 +100,6 @@ - + diff --git a/assets/xml/objects/object_ikn_demo.xml b/assets/xml/objects/object_ikn_demo.xml index 56f8fd0e9..53d5c65a1 100644 --- a/assets/xml/objects/object_ikn_demo.xml +++ b/assets/xml/objects/object_ikn_demo.xml @@ -43,7 +43,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -89,7 +89,7 @@ - + diff --git a/assets/xml/objects/object_in.xml b/assets/xml/objects/object_in.xml index 3874e4834..15b2382aa 100644 --- a/assets/xml/objects/object_in.xml +++ b/assets/xml/objects/object_in.xml @@ -112,7 +112,7 @@ - + diff --git a/assets/xml/objects/object_in2.xml b/assets/xml/objects/object_in2.xml index 4457defae..bcd04091b 100644 --- a/assets/xml/objects/object_in2.xml +++ b/assets/xml/objects/object_in2.xml @@ -66,7 +66,7 @@ - + diff --git a/assets/xml/objects/object_jg.xml b/assets/xml/objects/object_jg.xml index 17889995f..c3e1ac18a 100644 --- a/assets/xml/objects/object_jg.xml +++ b/assets/xml/objects/object_jg.xml @@ -108,11 +108,11 @@ - + - + diff --git a/assets/xml/objects/object_js.xml b/assets/xml/objects/object_js.xml index 92f14da0b..1335b8287 100644 --- a/assets/xml/objects/object_js.xml +++ b/assets/xml/objects/object_js.xml @@ -39,7 +39,7 @@ - + diff --git a/assets/xml/objects/object_jso.xml b/assets/xml/objects/object_jso.xml index 33816a797..a397311c4 100644 --- a/assets/xml/objects/object_jso.xml +++ b/assets/xml/objects/object_jso.xml @@ -49,7 +49,7 @@ - + @@ -114,7 +114,7 @@ - + diff --git a/assets/xml/objects/object_ka.xml b/assets/xml/objects/object_ka.xml index 36dceb0ca..69ea2d929 100644 --- a/assets/xml/objects/object_ka.xml +++ b/assets/xml/objects/object_ka.xml @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_kamejima.xml b/assets/xml/objects/object_kamejima.xml index 425e4643d..e8368051d 100644 --- a/assets/xml/objects/object_kamejima.xml +++ b/assets/xml/objects/object_kamejima.xml @@ -69,7 +69,7 @@ - + diff --git a/assets/xml/objects/object_kbt.xml b/assets/xml/objects/object_kbt.xml index aad49e946..102aed91d 100644 --- a/assets/xml/objects/object_kbt.xml +++ b/assets/xml/objects/object_kbt.xml @@ -68,7 +68,7 @@ - + diff --git a/assets/xml/objects/object_kgy.xml b/assets/xml/objects/object_kgy.xml index 0e2d3be2c..5bbf17793 100644 --- a/assets/xml/objects/object_kgy.xml +++ b/assets/xml/objects/object_kgy.xml @@ -67,7 +67,7 @@ - + diff --git a/assets/xml/objects/object_kitan.xml b/assets/xml/objects/object_kitan.xml index 05d090d93..edc2e5cc6 100644 --- a/assets/xml/objects/object_kitan.xml +++ b/assets/xml/objects/object_kitan.xml @@ -49,6 +49,6 @@ - + diff --git a/assets/xml/objects/object_knight.xml b/assets/xml/objects/object_knight.xml index 0459cb062..fa0e900e4 100644 --- a/assets/xml/objects/object_knight.xml +++ b/assets/xml/objects/object_knight.xml @@ -171,7 +171,7 @@ - + @@ -200,7 +200,7 @@ - + diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 2b714be38..55f980ad2 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -75,7 +75,7 @@ - + diff --git a/assets/xml/objects/object_link_boy.xml b/assets/xml/objects/object_link_boy.xml index b0a85ece5..68ec00737 100644 --- a/assets/xml/objects/object_link_boy.xml +++ b/assets/xml/objects/object_link_boy.xml @@ -76,6 +76,6 @@ - + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml index 51145033c..5ad903048 100644 --- a/assets/xml/objects/object_link_child.xml +++ b/assets/xml/objects/object_link_child.xml @@ -151,6 +151,6 @@ - + diff --git a/assets/xml/objects/object_link_goron.xml b/assets/xml/objects/object_link_goron.xml index 1aa57c010..39686b4f7 100644 --- a/assets/xml/objects/object_link_goron.xml +++ b/assets/xml/objects/object_link_goron.xml @@ -80,7 +80,7 @@ - + @@ -103,6 +103,6 @@ - + diff --git a/assets/xml/objects/object_link_nuts.xml b/assets/xml/objects/object_link_nuts.xml index e3dab39da..eb072c940 100644 --- a/assets/xml/objects/object_link_nuts.xml +++ b/assets/xml/objects/object_link_nuts.xml @@ -74,6 +74,6 @@ - + diff --git a/assets/xml/objects/object_link_zora.xml b/assets/xml/objects/object_link_zora.xml index fe5c50ea6..9a973c56a 100644 --- a/assets/xml/objects/object_link_zora.xml +++ b/assets/xml/objects/object_link_zora.xml @@ -91,6 +91,6 @@ - + diff --git a/assets/xml/objects/object_ma1.xml b/assets/xml/objects/object_ma1.xml index 4d60bb95f..b0b1435bc 100644 --- a/assets/xml/objects/object_ma1.xml +++ b/assets/xml/objects/object_ma1.xml @@ -103,7 +103,7 @@ - + diff --git a/assets/xml/objects/object_ma2.xml b/assets/xml/objects/object_ma2.xml index 5e642f340..0d528b37b 100644 --- a/assets/xml/objects/object_ma2.xml +++ b/assets/xml/objects/object_ma2.xml @@ -93,7 +93,7 @@ - + diff --git a/assets/xml/objects/object_mk.xml b/assets/xml/objects/object_mk.xml index 1ee3741bb..087fcc9e0 100644 --- a/assets/xml/objects/object_mk.xml +++ b/assets/xml/objects/object_mk.xml @@ -40,6 +40,6 @@ - + diff --git a/assets/xml/objects/object_mm.xml b/assets/xml/objects/object_mm.xml index baac5425d..43e8e930b 100644 --- a/assets/xml/objects/object_mm.xml +++ b/assets/xml/objects/object_mm.xml @@ -54,7 +54,7 @@ - + diff --git a/assets/xml/objects/object_mnk.xml b/assets/xml/objects/object_mnk.xml index c6e23399d..d585972c0 100644 --- a/assets/xml/objects/object_mnk.xml +++ b/assets/xml/objects/object_mnk.xml @@ -23,7 +23,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -121,6 +121,6 @@ - + diff --git a/assets/xml/objects/object_ms.xml b/assets/xml/objects/object_ms.xml index a4a36e149..93828c76f 100644 --- a/assets/xml/objects/object_ms.xml +++ b/assets/xml/objects/object_ms.xml @@ -27,6 +27,6 @@ - + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml index 925cb74e9..1f246b07b 100644 --- a/assets/xml/objects/object_mu.xml +++ b/assets/xml/objects/object_mu.xml @@ -56,7 +56,7 @@ - + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml index e8a695b52..511fddd6c 100644 --- a/assets/xml/objects/object_nb.xml +++ b/assets/xml/objects/object_nb.xml @@ -41,6 +41,6 @@ - + diff --git a/assets/xml/objects/object_niw.xml b/assets/xml/objects/object_niw.xml index 0e533fb6e..157d2b302 100644 --- a/assets/xml/objects/object_niw.xml +++ b/assets/xml/objects/object_niw.xml @@ -35,6 +35,6 @@ - + diff --git a/assets/xml/objects/object_oF1d_map.xml b/assets/xml/objects/object_oF1d_map.xml index a55e9c9ea..0f331cbce 100644 --- a/assets/xml/objects/object_oF1d_map.xml +++ b/assets/xml/objects/object_oF1d_map.xml @@ -125,7 +125,7 @@ - + diff --git a/assets/xml/objects/object_ob.xml b/assets/xml/objects/object_ob.xml index 0f79703b5..75217e04e 100644 --- a/assets/xml/objects/object_ob.xml +++ b/assets/xml/objects/object_ob.xml @@ -76,7 +76,7 @@ - + diff --git a/assets/xml/objects/object_okuta.xml b/assets/xml/objects/object_okuta.xml index e10afa135..cad1c57bd 100644 --- a/assets/xml/objects/object_okuta.xml +++ b/assets/xml/objects/object_okuta.xml @@ -60,7 +60,7 @@ - + diff --git a/assets/xml/objects/object_osn.xml b/assets/xml/objects/object_osn.xml index 2cb8315ea..dbcdb8473 100644 --- a/assets/xml/objects/object_osn.xml +++ b/assets/xml/objects/object_osn.xml @@ -110,7 +110,7 @@ - + diff --git a/assets/xml/objects/object_ot.xml b/assets/xml/objects/object_ot.xml index 49a8d89ce..ae3b42d22 100644 --- a/assets/xml/objects/object_ot.xml +++ b/assets/xml/objects/object_ot.xml @@ -48,7 +48,7 @@ - + diff --git a/assets/xml/objects/object_owl.xml b/assets/xml/objects/object_owl.xml index 6c9d79883..5560e3347 100644 --- a/assets/xml/objects/object_owl.xml +++ b/assets/xml/objects/object_owl.xml @@ -57,7 +57,7 @@ - + @@ -90,6 +90,6 @@ - + diff --git a/assets/xml/objects/object_pamera.xml b/assets/xml/objects/object_pamera.xml index 28f73983e..61dc17694 100644 --- a/assets/xml/objects/object_pamera.xml +++ b/assets/xml/objects/object_pamera.xml @@ -63,7 +63,7 @@ - + diff --git a/assets/xml/objects/object_ph.xml b/assets/xml/objects/object_ph.xml index 2e8a8eb29..fcf03b765 100644 --- a/assets/xml/objects/object_ph.xml +++ b/assets/xml/objects/object_ph.xml @@ -39,6 +39,6 @@ - + diff --git a/assets/xml/objects/object_po.xml b/assets/xml/objects/object_po.xml index 2cc6e5cbd..98dbc61b1 100644 --- a/assets/xml/objects/object_po.xml +++ b/assets/xml/objects/object_po.xml @@ -48,6 +48,6 @@ - + diff --git a/assets/xml/objects/object_po_composer.xml b/assets/xml/objects/object_po_composer.xml index ae8ef56e3..c45cf9039 100644 --- a/assets/xml/objects/object_po_composer.xml +++ b/assets/xml/objects/object_po_composer.xml @@ -53,6 +53,6 @@ - + diff --git a/assets/xml/objects/object_po_fusen.xml b/assets/xml/objects/object_po_fusen.xml index 5885b89a3..a25c9d960 100644 --- a/assets/xml/objects/object_po_fusen.xml +++ b/assets/xml/objects/object_po_fusen.xml @@ -27,6 +27,6 @@ - + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index 61bc0b404..e2e57a31a 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -65,6 +65,6 @@ - + diff --git a/assets/xml/objects/object_pp.xml b/assets/xml/objects/object_pp.xml index 1ac690935..dc51c202c 100644 --- a/assets/xml/objects/object_pp.xml +++ b/assets/xml/objects/object_pp.xml @@ -1,131 +1,153 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_pr.xml b/assets/xml/objects/object_pr.xml index 95fc4743c..52429cb18 100644 --- a/assets/xml/objects/object_pr.xml +++ b/assets/xml/objects/object_pr.xml @@ -40,7 +40,7 @@ - + @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_ps.xml b/assets/xml/objects/object_ps.xml index f341e95a4..689d78fb5 100644 --- a/assets/xml/objects/object_ps.xml +++ b/assets/xml/objects/object_ps.xml @@ -33,7 +33,7 @@ - + diff --git a/assets/xml/objects/object_pst.xml b/assets/xml/objects/object_pst.xml index 3649877ea..d2b5323d6 100644 --- a/assets/xml/objects/object_pst.xml +++ b/assets/xml/objects/object_pst.xml @@ -1,14 +1,15 @@  + - - - - - - - - - - + + + + + + + + + + diff --git a/assets/xml/objects/object_raf.xml b/assets/xml/objects/object_raf.xml index e3b4d2d93..2322740d5 100644 --- a/assets/xml/objects/object_raf.xml +++ b/assets/xml/objects/object_raf.xml @@ -53,6 +53,6 @@ - + diff --git a/assets/xml/objects/object_rat.xml b/assets/xml/objects/object_rat.xml index ce32e20cc..af47a3437 100644 --- a/assets/xml/objects/object_rat.xml +++ b/assets/xml/objects/object_rat.xml @@ -1,28 +1,38 @@  + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_rb.xml b/assets/xml/objects/object_rb.xml index 72b3e6cb6..cd0e9c274 100644 --- a/assets/xml/objects/object_rb.xml +++ b/assets/xml/objects/object_rb.xml @@ -48,6 +48,6 @@ - + diff --git a/assets/xml/objects/object_rd.xml b/assets/xml/objects/object_rd.xml index 854ded388..cb16e492f 100644 --- a/assets/xml/objects/object_rd.xml +++ b/assets/xml/objects/object_rd.xml @@ -45,7 +45,7 @@ - + @@ -105,7 +105,7 @@ - + diff --git a/assets/xml/objects/object_rs.xml b/assets/xml/objects/object_rs.xml index fe58a7555..5334f4fb8 100644 --- a/assets/xml/objects/object_rs.xml +++ b/assets/xml/objects/object_rs.xml @@ -58,6 +58,6 @@ - + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index f2d3fd2b0..08f182bb9 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -68,7 +68,7 @@ - + diff --git a/assets/xml/objects/object_rz.xml b/assets/xml/objects/object_rz.xml index a75e033f0..d8740403a 100644 --- a/assets/xml/objects/object_rz.xml +++ b/assets/xml/objects/object_rz.xml @@ -66,6 +66,6 @@ - + diff --git a/assets/xml/objects/object_sb.xml b/assets/xml/objects/object_sb.xml index 359cff20d..026b3389b 100644 --- a/assets/xml/objects/object_sb.xml +++ b/assets/xml/objects/object_sb.xml @@ -24,7 +24,7 @@ - + diff --git a/assets/xml/objects/object_sdn.xml b/assets/xml/objects/object_sdn.xml index 88c62434e..8271480be 100644 --- a/assets/xml/objects/object_sdn.xml +++ b/assets/xml/objects/object_sdn.xml @@ -60,7 +60,7 @@ - + diff --git a/assets/xml/objects/object_shn.xml b/assets/xml/objects/object_shn.xml index 4a8e01867..c4b256f68 100644 --- a/assets/xml/objects/object_shn.xml +++ b/assets/xml/objects/object_shn.xml @@ -103,7 +103,7 @@ - + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index c9935b64f..78413a9de 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_snowman.xml b/assets/xml/objects/object_snowman.xml index fde2d911f..dd5f42c17 100644 --- a/assets/xml/objects/object_snowman.xml +++ b/assets/xml/objects/object_snowman.xml @@ -43,7 +43,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_ssh.xml b/assets/xml/objects/object_ssh.xml index 57599fdce..29cd1fab1 100644 --- a/assets/xml/objects/object_ssh.xml +++ b/assets/xml/objects/object_ssh.xml @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_st.xml b/assets/xml/objects/object_st.xml index b8b39f94f..cbb01d3c5 100644 --- a/assets/xml/objects/object_st.xml +++ b/assets/xml/objects/object_st.xml @@ -64,7 +64,7 @@ - + diff --git a/assets/xml/objects/object_sth.xml b/assets/xml/objects/object_sth.xml index c7a0ffd25..b176cd8cc 100644 --- a/assets/xml/objects/object_sth.xml +++ b/assets/xml/objects/object_sth.xml @@ -37,6 +37,6 @@ - + diff --git a/assets/xml/objects/object_stk.xml b/assets/xml/objects/object_stk.xml index 9698e335e..a6f00c89b 100644 --- a/assets/xml/objects/object_stk.xml +++ b/assets/xml/objects/object_stk.xml @@ -100,7 +100,7 @@ - + diff --git a/assets/xml/objects/object_stk2.xml b/assets/xml/objects/object_stk2.xml index d9bde796d..d526bbc5c 100644 --- a/assets/xml/objects/object_stk2.xml +++ b/assets/xml/objects/object_stk2.xml @@ -42,7 +42,7 @@ - + diff --git a/assets/xml/objects/object_tab.xml b/assets/xml/objects/object_tab.xml index 9a63c2ed3..0a984b284 100644 --- a/assets/xml/objects/object_tab.xml +++ b/assets/xml/objects/object_tab.xml @@ -57,7 +57,7 @@ - + diff --git a/assets/xml/objects/object_tanron4.xml b/assets/xml/objects/object_tanron4.xml index 2c988e74b..491e9a587 100644 --- a/assets/xml/objects/object_tanron4.xml +++ b/assets/xml/objects/object_tanron4.xml @@ -25,6 +25,6 @@ - + diff --git a/assets/xml/objects/object_taru.xml b/assets/xml/objects/object_taru.xml index 763fe1b2e..4a23d2923 100644 --- a/assets/xml/objects/object_taru.xml +++ b/assets/xml/objects/object_taru.xml @@ -1,12 +1,12 @@  - - - + + + - - - + + + diff --git a/assets/xml/objects/object_test3.xml b/assets/xml/objects/object_test3.xml index 6b0a5349c..efd018995 100644 --- a/assets/xml/objects/object_test3.xml +++ b/assets/xml/objects/object_test3.xml @@ -63,6 +63,6 @@ - + diff --git a/assets/xml/objects/object_thiefbird.xml b/assets/xml/objects/object_thiefbird.xml index e7cb3ac91..5a4cec335 100644 --- a/assets/xml/objects/object_thiefbird.xml +++ b/assets/xml/objects/object_thiefbird.xml @@ -1,66 +1,84 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tite.xml b/assets/xml/objects/object_tite.xml index 681b732e8..351b4f56a 100644 --- a/assets/xml/objects/object_tite.xml +++ b/assets/xml/objects/object_tite.xml @@ -49,6 +49,6 @@ - + diff --git a/assets/xml/objects/object_tk.xml b/assets/xml/objects/object_tk.xml index 0c0ea3831..b11b47488 100644 --- a/assets/xml/objects/object_tk.xml +++ b/assets/xml/objects/object_tk.xml @@ -60,6 +60,6 @@ - + diff --git a/assets/xml/objects/object_tl.xml b/assets/xml/objects/object_tl.xml index 6397283af..7f0cfd756 100644 --- a/assets/xml/objects/object_tl.xml +++ b/assets/xml/objects/object_tl.xml @@ -10,7 +10,7 @@ - + @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_toryo.xml b/assets/xml/objects/object_toryo.xml index 45d3da100..e19f2c540 100644 --- a/assets/xml/objects/object_toryo.xml +++ b/assets/xml/objects/object_toryo.xml @@ -48,6 +48,6 @@ - + diff --git a/assets/xml/objects/object_trt.xml b/assets/xml/objects/object_trt.xml index a0d83076e..c7fb81321 100644 --- a/assets/xml/objects/object_trt.xml +++ b/assets/xml/objects/object_trt.xml @@ -89,6 +89,6 @@ - + diff --git a/assets/xml/objects/object_tru.xml b/assets/xml/objects/object_tru.xml index dd0e6d20c..138723ceb 100644 --- a/assets/xml/objects/object_tru.xml +++ b/assets/xml/objects/object_tru.xml @@ -102,7 +102,7 @@ - + diff --git a/assets/xml/objects/object_tsn.xml b/assets/xml/objects/object_tsn.xml index 761a6e0d7..d610b185e 100644 --- a/assets/xml/objects/object_tsn.xml +++ b/assets/xml/objects/object_tsn.xml @@ -47,7 +47,7 @@ - + diff --git a/assets/xml/objects/object_uch.xml b/assets/xml/objects/object_uch.xml index e61be5042..d82bf5b10 100644 --- a/assets/xml/objects/object_uch.xml +++ b/assets/xml/objects/object_uch.xml @@ -59,6 +59,6 @@ - + diff --git a/assets/xml/objects/object_um.xml b/assets/xml/objects/object_um.xml index aa979bf75..aac86a9a7 100644 --- a/assets/xml/objects/object_um.xml +++ b/assets/xml/objects/object_um.xml @@ -77,7 +77,7 @@ - + diff --git a/assets/xml/objects/object_utubo.xml b/assets/xml/objects/object_utubo.xml index a1f499eb6..4ce3d64f0 100644 --- a/assets/xml/objects/object_utubo.xml +++ b/assets/xml/objects/object_utubo.xml @@ -42,7 +42,7 @@ - + diff --git a/assets/xml/objects/object_vm.xml b/assets/xml/objects/object_vm.xml index b6c1cdfa2..bf13f3b40 100644 --- a/assets/xml/objects/object_vm.xml +++ b/assets/xml/objects/object_vm.xml @@ -25,6 +25,6 @@ - + diff --git a/assets/xml/objects/object_wallmaster.xml b/assets/xml/objects/object_wallmaster.xml index fba2bc246..afe3843e3 100644 --- a/assets/xml/objects/object_wallmaster.xml +++ b/assets/xml/objects/object_wallmaster.xml @@ -65,7 +65,7 @@ - + diff --git a/assets/xml/objects/object_warp1.xml b/assets/xml/objects/object_warp1.xml index 814334792..6ac25e827 100644 --- a/assets/xml/objects/object_warp1.xml +++ b/assets/xml/objects/object_warp1.xml @@ -32,7 +32,7 @@ - + diff --git a/assets/xml/objects/object_wdhand.xml b/assets/xml/objects/object_wdhand.xml index bcd5b0ce3..311d9299f 100644 --- a/assets/xml/objects/object_wdhand.xml +++ b/assets/xml/objects/object_wdhand.xml @@ -23,6 +23,6 @@ - + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index 3d9ce392d..b6c5b640d 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -62,7 +62,7 @@ - + @@ -132,7 +132,7 @@ - + diff --git a/assets/xml/objects/object_wiz.xml b/assets/xml/objects/object_wiz.xml index 947cab3c7..2928083aa 100644 --- a/assets/xml/objects/object_wiz.xml +++ b/assets/xml/objects/object_wiz.xml @@ -97,6 +97,6 @@ - + diff --git a/assets/xml/objects/object_yb.xml b/assets/xml/objects/object_yb.xml index 1a8503a6e..3bbfc7cce 100644 --- a/assets/xml/objects/object_yb.xml +++ b/assets/xml/objects/object_yb.xml @@ -56,6 +56,6 @@ - + diff --git a/assets/xml/objects/object_zl1.xml b/assets/xml/objects/object_zl1.xml index 04d4ae406..2b8a101bc 100644 --- a/assets/xml/objects/object_zl1.xml +++ b/assets/xml/objects/object_zl1.xml @@ -74,7 +74,7 @@ - + diff --git a/assets/xml/objects/object_zl4.xml b/assets/xml/objects/object_zl4.xml index 65596c370..73ebb8606 100644 --- a/assets/xml/objects/object_zl4.xml +++ b/assets/xml/objects/object_zl4.xml @@ -93,7 +93,7 @@ - + diff --git a/assets/xml/objects/object_zm.xml b/assets/xml/objects/object_zm.xml index f6f1b95e5..c35d5aecb 100644 --- a/assets/xml/objects/object_zm.xml +++ b/assets/xml/objects/object_zm.xml @@ -55,7 +55,7 @@ - + diff --git a/assets/xml/objects/object_zo.xml b/assets/xml/objects/object_zo.xml index d2a16cfac..0cd5c8546 100644 --- a/assets/xml/objects/object_zo.xml +++ b/assets/xml/objects/object_zo.xml @@ -74,7 +74,7 @@ - + diff --git a/assets/xml/objects/object_zob.xml b/assets/xml/objects/object_zob.xml index bc4d61c6a..8d27f260f 100644 --- a/assets/xml/objects/object_zob.xml +++ b/assets/xml/objects/object_zob.xml @@ -67,7 +67,7 @@ - + diff --git a/assets/xml/objects/object_zod.xml b/assets/xml/objects/object_zod.xml index 3e0b6567a..2616dbcdf 100644 --- a/assets/xml/objects/object_zod.xml +++ b/assets/xml/objects/object_zod.xml @@ -44,7 +44,7 @@ - + diff --git a/assets/xml/objects/object_zog.xml b/assets/xml/objects/object_zog.xml index 15265596d..1ede14ad2 100644 --- a/assets/xml/objects/object_zog.xml +++ b/assets/xml/objects/object_zog.xml @@ -107,6 +107,6 @@ - + diff --git a/assets/xml/objects/object_zoraegg.xml b/assets/xml/objects/object_zoraegg.xml index 367d2df76..175c6aeb2 100644 --- a/assets/xml/objects/object_zoraegg.xml +++ b/assets/xml/objects/object_zoraegg.xml @@ -22,7 +22,7 @@ - + diff --git a/assets/xml/objects/object_zos.xml b/assets/xml/objects/object_zos.xml index 1f5a2a542..016831ac5 100644 --- a/assets/xml/objects/object_zos.xml +++ b/assets/xml/objects/object_zos.xml @@ -62,7 +62,7 @@ - + diff --git a/assets/xml/objects/object_zov.xml b/assets/xml/objects/object_zov.xml index abbc52268..440782f10 100644 --- a/assets/xml/objects/object_zov.xml +++ b/assets/xml/objects/object_zov.xml @@ -76,6 +76,6 @@ - + diff --git a/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml b/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml new file mode 100644 index 000000000..0c23d17cd --- /dev/null +++ b/assets/xml/overlays/ovl_Effect_Ss_Fhg_Flash.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/xml/overlays/ovl_En_Bom.xml b/assets/xml/overlays/ovl_En_Bom.xml index 08902add6..15bfa097c 100644 --- a/assets/xml/overlays/ovl_En_Bom.xml +++ b/assets/xml/overlays/ovl_En_Bom.xml @@ -1,9 +1,20 @@ + - - - - - + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe7.xml b/assets/xml/overlays/ovl_Oceff_Wipe7.xml new file mode 100644 index 000000000..682bd0c98 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe7.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/docs/tutorial/object_decomp_example.md b/docs/tutorial/object_decomp_example.md index 0917ebdd4..d1cc4738a 100644 --- a/docs/tutorial/object_decomp_example.md +++ b/docs/tutorial/object_decomp_example.md @@ -110,7 +110,7 @@ After naming the animations, the end result will look something like this: Once again, we can run `./extract_assets.py -s objects/object_dns` to extract the object, and we can update the animation names in `z_en_dns.c` to use our new names like so: ```c -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &gKingsChamberDekuGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, diff --git a/include/functions.h b/include/functions.h index e4f95941f..f610449df 100644 --- a/include/functions.h +++ b/include/functions.h @@ -556,20 +556,19 @@ void EffectSsSibuki_SpawnBurst(PlayState* play, Vec3f* pos); void EffectSsStone1_Spawn(PlayState* play, Vec3f* pos, s32 reg0); void EffectSsHitmark_SpawnFixedScale(PlayState* play, s32 type, Vec3f* pos); void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3f* pos); -// void EffectSsFhgFlash_SpawnShock(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5); +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params); // void EffectSsKFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6); void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, s16* linkDetected, s16 drawFlag); void EffectSsKakera_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); // void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void EffectSsIcePiece_SpawnBurst(void); -// void EffectSsEnIce_SpawnFlyingVec3f(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, Color_RGBA8* pzParm4, Color_RGBA8* param_5, UNK_TYPE4 param_6); void func_800B2B44(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3); // void func_800B2B7C(void); void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life); // void EffectSsFireTail_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE4 uParm4, Vec3f* param_5, UNK_TYPE2 param_6, Color_RGBA8* param_7, Color_RGBA8* param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE4 param_11); // void EffectSsFireTail_SpawnFlame(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); // void EffectSsFireTail_SpawnFlameOnPlayer(void); -void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags, s16 bodyPart); // void EffectSsEnFire_SpawnVec3s(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); @@ -594,7 +593,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play); void Actor_SetFeetPos(Actor* actor, s32 limbIndex, s32 leftFootIndex, Vec3f* leftFootPos, s32 rightFootIndex, Vec3f* rightFootPos); void func_800B4AEC(PlayState* play, Actor* actor, f32 y); void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play); -void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3); +void Actor_GetProjectedPos(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW); void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play); @@ -679,8 +678,8 @@ PosRot* Actor_GetWorldPosShapeRot(PosRot* dest, Actor* actor); s32 func_800B83F8(Actor* actor, Player* player, s32 flag); s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState); -s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId); -s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, s32 exchangeItemId); +s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, PlayerActionParam exchangeItemId); +s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, PlayerActionParam exchangeItemId); s32 func_800B8614(Actor* actor, PlayState* play, f32 radius); s32 func_800B863C(Actor* actor, PlayState* play); s32 Actor_TextboxIsClosing(Actor* actor, PlayState* play); @@ -691,7 +690,7 @@ s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange); s32 func_800B8804(Actor* actor, PlayState* play, f32 xzRange); s32 func_800B886C(Actor* actor, PlayState* play); void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); -s32 func_800B8934(PlayState* play, Actor* actor); +s32 Actor_OnScreen(PlayState* play, Actor* actor); s32 Actor_HasParent(Actor* actor, PlayState* play); s32 Actor_PickUp(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange); s32 Actor_PickUpNearby(Actor* actor, PlayState* play, s32 getItemId); @@ -758,7 +757,7 @@ s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*text void func_800BD888(Actor* actor, struct_800BD888_arg1* arg1, s16 arg2, s16 arg3); void func_800BD9E0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); void func_800BDAA0(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animation, s32 index); +void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 animIndex); void Actor_Noop(Actor* actor, PlayState* play); void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist); @@ -960,39 +959,7 @@ s32 DynaPolyActor_IsInRidingRotatingState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInSwitchPressedState(DynaPolyActor* dynaActor); s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor); s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight); -f32 Camera_fabsf(f32 f); -f32 Camera_LengthVec3f(Vec3f* v); -// void func_800CB270(void); -f32 Camera_Lerpf(f32 b, f32 a, f32 t, f32 minDist); -s16 Camera_Lerps(s16 b, s16 a, f32 t, s16 minDist); -// void func_800CB42C(void); -void Camera_LerpVec3f(Vec3f* b, Vec3f* a, f32 tXZ, f32 tY, f32 minDist); -void func_800CB544(Camera* camera); -// void func_800CB584(void); -// void func_800CB5DC(void); -// void func_800CB60C(void); -// void func_800CB674(void); -// void func_800CB6C8(void); -f32 func_800CB700(Camera* camera); -// void func_800CB780(void); -// void func_800CB7CC(void); -// void func_800CB7F8(void); -// void func_800CB828(void); -// void func_800CB854(void); -// void Camera_IsSwimming(void); -// void func_800CB8C8(void); -// void func_800CB8F4(void); -// void func_800CB924(void); -// void func_800CB950(void); -// void func_800CBA08(void); -// void func_800CBA34(void); -// void func_800CBA7C(void); -// void func_800CBAAC(void); -// void func_800CBAD4(void); -// void func_800CBB58(void); -// void func_800CBB88(void); -// void func_800CBC00(void); -// void func_800CBC30(void); + // void func_800CBC84(void); // void func_800CBFA4(void); // void func_800CC000(void); @@ -1106,8 +1073,8 @@ Camera* Camera_Alloc(View* view, CollisionContext* bg, PlayState* play); void Camera_Free(Camera* camera); void Camera_Init(Camera* camera, View* view, CollisionContext* bg, PlayState* play); // void func_800DDFE0(void); -void func_800DE0EC(Camera* camera, Actor* actor); -// s32 func_800DE308(Camera* camera, UNK_TYPE2 uParm2); +void Camera_InitPlayerSettings(Camera* camera, Player* player); +s32 Camera_ChangeStatus(Camera* camera, s16 status); // void func_800DE324(void); // void func_800DE62C(void); // void func_800DE840(void); @@ -1128,7 +1095,7 @@ void Camera_GetCamDir(Vec3s* dst, Camera* camera); s16 Camera_GetCamDirPitch(Camera* camera); s16 Camera_GetCamDirYaw(Camera* camera); void Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown); -void func_800DFD78(Camera* camera, s32 paramFlag, void* value); +s32 Camera_SetViewParam(Camera* camera, s32 viewFlag, void* param); // UNK_TYPE4 func_800DFEF0(s32 param_1, u16 param_2); // UNK_TYPE4 func_800DFF18(Camera* iParm1, UNK_TYPE2 uParm2); // UNK_TYPE4 func_800DFF34(s32 param_1); @@ -1136,7 +1103,7 @@ void func_800DFD78(Camera* camera, s32 paramFlag, void* value); s16 Camera_SetFlags(Camera* iParm1, s16 flags); s16 Camera_ClearFlags(Camera* camera, s16 flags); s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamDataId, f32 arg3, s16 timer1, s16 timer2, s16 timer3); -// UNK_TYPE4 func_800E007C(Camera* param_1, Camera* param_2); +s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera); // UNK_TYPE4 func_800E01AC(void); Vec3f* Camera_GetQuakeOffset(Vec3f* dst, Camera* camera); // void func_800E01DC(s32 param_1, u32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); @@ -2183,8 +2150,8 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd); void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd); void Scene_SetExitFade(PlayState* play); s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); -u16 Entrance_CreateIndex(s32 sceneIndex, s32 spawnIndex, s32 sceneSetup); -u16 Entrance_CreateIndexFromSpawn(s32 spawnIndex); +u16 Entrance_Create(s32 scene, s32 spawn, s32 layer); +u16 Entrance_CreateFromSpawn(s32 spawn); void Scene_ExecuteDrawConfig(PlayState* play); void Scene_DrawConfigDefault(PlayState* play); Gfx* AnimatedMat_TexScroll(PlayState* play, AnimatedMatTexScrollParams* params); @@ -2222,10 +2189,10 @@ void Scene_DrawConfig5(PlayState* play); void Scene_DrawConfigMatAnimManualStep(PlayState* play); void Scene_DrawConfigGreatBayTemple(PlayState* play); EntranceTableEntry* Entrance_GetTableEntry(u16 entrance); -s32 Entrance_GetSceneNum(u16 entranceIndex); -s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex); -s32 Entrance_GetSpawnNum(u16 entranceIndex); -s32 Entrance_GetTransitionFlags(u16 entranceIndex); +s32 Entrance_GetSceneNum(u16 entrance); +s32 Entrance_GetSceneNumAbsolute(u16 entrance); +s32 Entrance_GetSpawnNum(u16 entrance); +s32 Entrance_GetTransitionFlags(u16 entrance); 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); @@ -2248,7 +2215,7 @@ s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Ve s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation); s16 Animation_GetLength2(LegacyAnimationHeader* animation); s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation); -void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* vec2, Vec3s* vec3, f32 unkf); +void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* target, f32 weight); void AnimationContext_Reset(AnimationContext* animationCtx); void AnimationContext_SetNextQueue(PlayState* play); void AnimationContext_DisableQueue(PlayState* play); @@ -2341,13 +2308,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -s32 func_8013A240(PlayState* play); -void func_8013A41C(s32 flag); -void func_8013A46C(s32 flag); -u32 func_8013A4C4(s32 flag); -s16 func_8013A504(s16 val); -s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError); - void View_ViewportToVp(Vp* dest, Viewport* src); void View_Init(View* view, GraphicsContext* gfxCtx); void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); @@ -2578,18 +2538,18 @@ void func_80165690(void); // void func_80165EC0(void); // void func_80166060(void); Gfx* func_801660B8(PlayState* play, Gfx* gfx); -void Play_Fini(GameState* thisx); +void Play_Destroy(GameState* thisx); // void func_801663C4(void); // void func_80166644(void); // void func_801668B4(void); void func_80166968(PlayState* play, Camera* camera); void func_80166B30(PlayState* play); -void func_80167814(PlayState* play); +void Play_Update(PlayState* play); void func_80167DE4(PlayState* play); // void func_80167F0C(void); void Play_Draw(PlayState* play); void func_80168DAC(PlayState* play); -void Play_Update(PlayState* play); +void Play_Main(PlayState* play); s32 Play_InCsMode(PlayState* play); f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); // void func_801691F0(void); @@ -2597,19 +2557,19 @@ void* Play_LoadScene(PlayState* play, RomFile* entry); void func_8016927C(PlayState* play, s16 sParm2); // void func_801692C4(PlayState* play, UNK_TYPE1 uParm2); // void Play_SceneInit(PlayState* play, s32 sceneIndex, UNK_TYPE1 param_3); -UNK_RET func_80169474(PlayState* play, Vec3f* v1, Vec3f* v2); -s32 Play_CreateSubCamera(PlayState* play); -s32 Play_GetActiveCamId(PlayState* play); -void Play_CameraChangeStatus(PlayState* play, s16 camId, s16 status); +void Play_GetScreenPos(PlayState* play, Vec3f* worldPos, Vec3f* screenPos); +s16 Play_CreateSubCamera(PlayState* play); +s16 Play_GetActiveCamId(PlayState* play); +s32 Play_ChangeCameraStatus(PlayState* play, s16 camId, s16 status); void Play_ClearCamera(PlayState* play, s16 camId); 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); -void Play_CameraSetRoll(PlayState* play, s16 camId, s16 roll); +s32 Play_SetCameraAtEye(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye); +s32 Play_SetCameraAtEyeUp(PlayState* play, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +s32 Play_SetCameraFov(PlayState* play, s16 camId, f32 fov); +s32 Play_SetCameraRoll(PlayState* play, s16 camId, s16 roll); void Play_CopyCamera(PlayState* play, s16 dstCamId, s16 srcCamId); -// void func_80169A50(void); -void Play_CameraChangeSetting(PlayState* play, s16 camId, s16 setting); +s32 func_80169A50(PlayState* play, s16 camId, Player* player, s16 setting); +s32 Play_ChangeCameraSetting(PlayState* play, s16 camId, s16 setting); void func_80169AFC(PlayState* play, s16 camId, s16 arg2); u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); @@ -2811,7 +2771,7 @@ void SpeedMeter_DrawTimeEntries(void* displayList, GraphicsContext* gfxCtx); void SpeedMeter_DrawAllocEntries(void* displayList, GraphicsContext* gfxCtx, GameState* gameState); void func_801780F0(Mtx* param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5, f32 param_6, f32 param_7); // void func_801781EC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_8017842C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); +void func_8017842C(MtxF* arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, f32 arg5, f32 arg6, f32 arg7, f32 arg8, f32 arg9, f32 arg10); // void func_80178750(void); // void func_80178818(void); void func_80178978(void); @@ -3027,6 +2987,7 @@ void osFlashSectorEraseThrough(u32 pageNum); s32 osFlashWriteBuffer(OSIoMesg* mb, s32 priority, void* dramAddr, OSMesgQueue* mq); s32 osFlashWriteArray(u32 pageNum); s32 osFlashReadArray(OSIoMesg* mb, s32 priority, u32 pageNum, void* dramAddr, u32 pageCount, OSMesgQueue* mq); + // void func_801877D0(void); // void func_80187B64(void); // void func_80187BEC(void); @@ -3069,6 +3030,7 @@ s32 osFlashReadArray(OSIoMesg* mb, s32 priority, u32 pageNum, void* dramAddr, u3 // void func_8018A808(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); // void func_8018ACC4(void); // void func_8018AE34(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); + void AudioHeap_DiscardFont(s32 fontId); void* AudioHeap_WritebackDCache(void* addr, size_t size); void* AudioHeap_AllocAttemptExternal(AudioAllocPool* pool, size_t size); @@ -3088,6 +3050,7 @@ void* AudioHeap_AllocPermanent(s32 tableType, s32 id, size_t size); void* AudioHeap_AllocSampleCache(size_t size, s32 sampleBankId, void* sampleAddr, s8 medium, s32 cache); void AudioHeap_ApplySampleBankCache(s32 sampleBankId); void AudioHeap_SetReverbData(s32 reverbIndex, u32 dataType, s32 data, s32 flags); + void AudioLoad_DecreaseSampleDmaTtls(void); void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium); void AudioLoad_InitSampleDmaBuffers(s32 numNotes); @@ -3116,6 +3079,7 @@ void AudioLoad_LoadPermanentSamples(void); void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* isDone); void AudioLoad_ProcessScriptLoads(void); void AudioLoad_InitScriptLoads(void); + AudioTask* func_80192BE0(void); // void func_80192C00(void); // void func_8019319C(void); @@ -3124,10 +3088,10 @@ AudioTask* func_80192BE0(void); // void func_80193774(void); // void func_8019380C(void); // void func_80193858(void); -// void func_8019387C(void); -void Audio_QueueCmdS8(u32 opArgs, s8 data); +void AudioThread_QueueCmdS32(u32 opArgs, s32 data); +void AudioThread_QueueCmdS8(u32 opArgs, s8 data); // void func_801938D0(void); -// void func_80193900(void); +s32 AudioThread_ScheduleProcessCmds(void); // void func_80193990(void); // void func_801939A8(void); // void func_80193AEC(void); @@ -3149,13 +3113,14 @@ void Audio_QueueCmdS8(u32 opArgs, s8 data); // void func_80194528(void); // void func_80194548(void); // void func_80194568(void); -u32 Audio_NextRandom(void); -void Audio_InitMesgQueues(void); +u32 AudioThread_NextRandom(void); +void AudioThread_InitMesgQueues(void); + void Audio_InvalDCache(void* buf, size_t size); void Audio_WritebackDCache(void* buf, size_t size); -// void func_80194790(void); -// void func_80194840(void); -// void func_801948B0(void); + +s32 osAiSetNextBuffer(void* buf, u32 size); + void AudioPlayback_NoteDisable(Note* note); void AudioPlayback_ProcessNotes(void); SoundFontSound* AudioPlayback_InstrumentGetSound(Instrument* instrument, s32 semitone); @@ -3173,12 +3138,14 @@ void AudioPlayback_NotePoolFill(NotePool* pool, s32 count); void AudioPlayback_AudioListRemove(AudioListItem* item); Note* AudioPlayback_AllocNote(SequenceLayer* layer); void AudioPlayback_NoteInitAll(void); + 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, EnvelopePoint* envelope, s16* volOut); f32 AudioEffects_AdsrUpdate(AdsrState* adsr); + void AudioSeq_SequenceChannelDisable(SequenceChannel* channel); void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer); void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer); @@ -3189,76 +3156,40 @@ void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer); void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer); 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); -// void func_8019AF00(void); -// void func_8019AF58(void); -// void func_8019AFE8(void); -// void func_8019B02C(void); -// void AudioOcarina_MapSongFromNotesToButtons(void); -// void func_8019B144(void); -// void func_8019B378(void); -// void func_8019B38C(void); -// void func_8019B3D0(void); -// void func_8019B4B8(void); -void AudioOcarina_StartDefault(u32 arg0); -// void func_8019B568(void); -// void func_8019B5AC(void); -// void func_8019B5EC(void); -// void func_8019B618(void); -// void func_8019B654(void); -// void func_8019B6B4(void); -// void func_8019BC44(void); -// void func_8019BE98(void); -// void func_8019C1D0(void); -// void func_8019C268(void); -// void func_8019C2E4(void); -u32 AudioOcarina_SetInstrumentId(u8 arg0); -// void func_8019C398(void); -// void func_8019C5A0(void); -// void func_8019C8D8(void); -// void func_8019CD08(void); -// void func_8019CE34(void); -// void func_8019CE6C(void); -// void func_8019CEBC(void); -// void func_8019CF6C(void); -// void func_8019CF78(void); + +void AudioOcarina_SetSongStartingPos(void); +void AudioOcarina_StartAtSongStartingPos(u32 ocarinaFlags); +void AudioOcarina_StartForSongCheck(u32 ocarinaFlags, u8 ocarinaStaffPlayingPosStart); +void AudioOcarina_StartWithSongNoteLengths(u32 ocarinaFlags); +void AudioOcarina_StartDefault(u32 ocarinaFlags); +u8 func_8019B5AC(void); +void AudioOcarina_ResetAndReadInput(void); +void AudioOcarina_SetOcarinaDisableTimer(u8 resetUnused, u8 resetDelay); +u32 AudioOcarina_SetInstrument(u8 ocarinaInstrumentId); +void AudioOcarina_SetPlaybackSong(s8 songIndexPlusOne, u8 playbackState); +void AudioOcarina_SetRecordingState(u8 recordingState); +OcarinaStaff* AudioOcarina_GetRecordingStaff(void); +OcarinaStaff* AudioOcarina_GetPlayingStaff(void); OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); -// void func_8019CFA8(void); -// void AudioOcarina_TerminaWallValidateNotes(void); void AudioOcarina_TerminaWallGenerateNotes(void); -// void AudioOcarina_MemoryGameSetNumNotes(void); -// void AudioOcarina_MemoryGameGenerateNotes(void); -// void func_8019D600(void); -void func_8019D758(void); -// void func_8019D864(void); -// void func_8019D8B4(void); -// void func_8019D8E4(void); -// void func_8019DF28(void); -// void func_8019DF64(void); +void AudioOcarina_PlayLongScarecrowAfterCredits(void); + void func_8019E014(void); // void func_8019E110(void); -// void func_8019E14C(void); -// void func_8019E324(void); -// void func_8019E4B0(void); -// void func_8019E634(void); -// void func_8019E864(void); -// void func_8019EA40(void); -// void func_8019EB2C(void); -// void func_8019F024(void); -// void func_8019F05C(void); +void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void play_sound(u16 sfxId); void func_8019F128(u16 sfxId); void func_8019F170(Vec3f* pos, u16 sfxId); void Audio_PlaySfxAtPos(Vec3f* pos, u16 sfxId); void func_8019F208(void); // decide sfx void func_8019F230(void); // cancel sfx -// void func_8019F258(void); -// void func_8019F300(void); void func_8019F420(Vec3f* pos, u16 sfxId); void func_8019F4AC(Vec3f* pos, u16 sfxId); void func_8019F540(s8 arg0); -void func_8019F570(Vec3f* pos, s8 arg1); +void AudioSfx_LowerSfxSettingsReverb(Vec3f* pos, s8 isReverbLowered); // void func_8019F5AC(void); // void func_8019F638(void); // void func_8019F780(void); @@ -3290,7 +3221,7 @@ void func_801A0238(s32 arg0, s32 arg1); // void Audio_UpdateRiverSoundVolumes(void); // void func_801A0554(void); // void func_801A05F0(void); -void func_801A0654(Vec3f* arg0, u16 sfxId, s32 arg2); +void AudioSfx_SetChannelIO(Vec3f* pos, u16 sfxId, u8 ioData); void func_801A0810(Vec3f* arg0, u16 sfxId, u8 arg2); void func_801A0868(Vec3f* pos, u16 sfxId, u8 val); // void func_801A09D4(void); @@ -3361,7 +3292,7 @@ void func_801A4058(UNK_TYPE arg0); // void func_801A42C8(void); // void func_801A4324(void); // void func_801A4348(void); -// void func_801A4380(void); +void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 arg0); void func_801A4428(u8 reverbIndex); void Audio_PreNMI(void); // void func_801A44C4(void); @@ -3372,14 +3303,14 @@ void func_801A479C(Vec3f* arg0, u16 sfxId, s32 arg2); void func_801A47DC(u8 channelIndexRange, u8 port, u8 val); // void func_801A48E0(void); void func_801A4A28(u8 natureSeqId); -// void func_801A4B80(void); -void func_801A4C30(void); -// void func_801A4C54(void); +// void Audio_SetNatureAmbienceRandomBend(void); +void Audio_Init(void); void func_801A4D00(void); // void func_801A4D50(void); // void func_801A4DA4(void); // void func_801A4DF4(void); // void func_801A4E64(void); + // void func_801A4EB0(void); // void func_801A4EB8(void); // void func_801A4FD8(void); @@ -3398,29 +3329,24 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0); // void func_801A5808(void); // void func_801A5A10(void); // void func_801A5A1C(void); -void func_801A5BD0(s32 param_1); -// void func_801A5C28(void); -// void func_801A5C8C(void); -void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* param_2, u8 param_3, f32* param_4, f32* param_5, s8* param_6); -// void func_801A5DDC(void); -// void func_801A5F7C(void); -// void func_801A6430(void); -// void func_801A65C8(void); -// void func_801A6D0C(void); -void func_801A7084(u8 bankId); -// void func_801A7168(void); -// void func_801A7284(void); -void Audio_StopSfxByPos(Vec3f* pos); -void func_801A7328(Vec3f* pos, u16 sfxId); -// void func_801A7484(void); -void func_801A75E8(u16 sfxId); -// void func_801A7720(void); -void func_801A7794(u32 param_1, u32 param_2, u32 param_3); -// void func_801A7828(void); -// void func_801A787C(void); -u8 Audio_IsSfxPlaying(u32 sfxId); -// void func_801A794C(void); -// void func_801A7B10(void); + +void AudioSfx_MuteBanks(u16 muteMask); +void AudioSfx_LowerBgmVolume(u8 channelIndex); +void AudioSfx_RestoreBgmVolume(u8 channelIndex); +void AudioSfx_PlaySfx(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* volume, s8* reverbAdd); +void AudioSfx_ProcessRequest(void); +void AudioSfx_StopByBank(u8 bankId); +void AudioSfx_StopByPosAndBank(u8 bankId, Vec3f* pos); +void AudioSfx_StopByPos(Vec3f* pos); +void AudioSfx_StopByPosAndId(Vec3f* pos, u16 sfxId); +void AudioSfx_StopByTokenAndId(u8 token, u16 sfxId); +void AudioSfx_StopById(u32 sfxId); +void AudioSfx_ProcessRequests(void); +void AudioSfx_ProcessActiveSfx(void); +u8 AudioSfx_IsPlaying(u32 sfxId); +void AudioSfx_Reset(void); + +void Audio_StartSequence(u8 playerIndex, u8 seqId, u8 seqArgs, u16 fadeTimer); // void func_801A7D04(void); // void func_801A7D84(void); void Audio_QueueSeqCmd(u32 cmd); diff --git a/include/macros.h b/include/macros.h index 5d1829c4c..f713bf736 100644 --- a/include/macros.h +++ b/include/macros.h @@ -11,6 +11,9 @@ #define SCREEN_WIDTH_HIGH_RES 576 #define SCREEN_HEIGHT_HIGH_RES 454 +#define PROJECTED_TO_SCREEN_X(projectedPos, invW) ((projectedPos).x * (invW) * (SCREEN_WIDTH / 2) + (SCREEN_WIDTH / 2)) +#define PROJECTED_TO_SCREEN_Y(projectedPos, invW) ((projectedPos).y * (invW) * (-SCREEN_HEIGHT / 2) + (SCREEN_HEIGHT / 2)) + #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) diff --git a/include/sfx.h b/include/sfx.h index 7430f8581..33c79abf4 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -1,6 +1,19 @@ #ifndef SFX_H #define SFX_H +/** + * With `SFX_FLAG` on, play the entire sfx audio clip. + * Requesting the sfx while playing will restart the sfx from the beginning. + * i.e. sfx only needs to be requested once. + * + * With `SFX_FLAG` off, play the sfx for only one frame. + * Requesting the sfx while playing will allow the sfx to continue to the next frame. + * i.e. sfx needs to be requested every frame. + * + * By default, `SFX_FLAG` is on. + * Use `- SFX_FLAG` to turn `SFX_FLAG` off. + */ +#define SFX_FLAG_MASK 0xC00 #define SFX_FLAG 0x800 // ------------ PLAYER ------------ @@ -469,28 +482,6 @@ #define NA_SE_PL_BOUND_METAL 0x9CD #define NA_SE_PL_WALK_WALL 0x9CE #define NA_SE_PL_WALK_WALL_DEKU 0x9CF -#define NA_SE_PL_WALK_WALL_ZORA 0x9D0 -#define NA_SE_PL_WALK_WALL_GORON 0x9D1 -#define NA_SE_PL_DEKU_IDOLING1 0x9D2 -#define NA_SE_PL_GOLON_IDOLING1 0x9D3 -#define NA_SE_PL_ZORA_IDOLING1 0x9D4 -#define NA_SE_PL_WALK_WALL2_METAL 0x9D5 -#define NA_SE_PL_WALK_WALL2_DEKU 0x9D6 -#define NA_SE_PL_WALK_WALL2_ZORA 0x9D7 -#define NA_SE_PL_WALK_WALL2_GORON 0x9D8 -#define NA_SE_PL_WALK_WEED 0x9D9 -#define NA_SE_PL_WALK_WOOD 0x9DA -#define NA_SE_PL_JUMP_WOOD 0x9DB -#define NA_SE_PL_LAND_WOOD 0x9DC -#define NA_SE_PL_GIANT_SWING 0x9DD -#define NA_SE_PL_GIANT_SWING2 0x9DE -#define NA_SE_PL_GIANT_SWING_FINISH 0x9DF -#define NA_SE_PL_GIANT_GUARD 0x9E0 -#define NA_SE_PL_GIANT_GUARD_OFF 0x9E1 -#define NA_SE_PL_GORON_GAKKI_START 0x9E2 -#define NA_SE_PL_KEIREI 0x9E3 -#define NA_SE_PL_GIANT_LINK_FOOT 0x9E4 -#define NA_SE_PL_DUMMY485 0x9E5 // ------------ ITEM ------------ @@ -605,6 +596,7 @@ #define NA_SE_IT_FISHING_WORM_BOUND 0x186C #define NA_SE_IT_DUMMY_109 0x186D #define NA_SE_IT_DUMMY_110 0x186E +#define NA_SE_IT_DUMMY_111 0x186F // ------------ ENVIRONMENT ------------ @@ -1072,72 +1064,6 @@ #define NA_SE_EV_DEMO_KID_SAGURU 0x29CD #define NA_SE_EV_WATER_WALL3 0x29CE #define NA_SE_EV_BOMBERS_TAORE 0x29CF -#define NA_SE_EV_RIVER_STREAM_TOWER 0x29D0 -#define NA_SE_EV_MONKEY_ROPE 0x29D1 -#define NA_SE_EV_MONKEY_FOOT_PAN 0x29D2 -#define NA_SE_EV_BODYFALL_SAND1 0x29D3 -#define NA_SE_EV_SCOOP_SAND1 0x29D4 -#define NA_SE_EV_CHICKEN_CRY_M_0600 0x29D5 -#define NA_SE_EV_WATER_WALL_BIG2 0x29D6 -#define NA_SE_EV_WATER_VOLTEX 0x29D7 -#define NA_SE_EV_WATER_WALL_IKANA 0x29D8 -#define NA_SE_EV_DOOR_OPEN_GATYA 0x29D9 -#define NA_SE_EV_CLAP_1SHOT 0x29DA -#define NA_SE_EV_TRR_APPEAR 0x29DB -#define NA_SE_EV_ICE_MELT_SHORT 0x29DC -#define NA_SE_EV_DEMO37_CLOTH1 0x29DD -#define NA_SE_EV_DEMO37_CLOTH2 0x29DE -#define NA_SE_EV_DEMO37_CLOTH3 0x29DF -#define NA_SE_EV_DEMO37_CLOTH4 0x29E0 -#define NA_SE_EV_WHITE_FAIRY_DASH_SHORT 0x29E1 -#define NA_SE_EV_WHITE_FAIRY_DASH_SHORT2 0x29E2 -#define NA_SE_EV_DEMO27_BODYFALL 0x29E3 -#define NA_SE_EV_DEMO30_LINK_RIDE 0x29E4 -#define NA_SE_EV_DEMO16_WHITEOUT 0x29E5 -#define NA_SE_EV_DEMO16_MIKAU_FADE 0x29E6 -#define NA_SE_EV_DEMO27_WHITEOUT 0x29E7 -#define NA_SE_SC_ZHOP_WAVE 0x29E8 -#define NA_SE_EV_DEMO02_ME1 0x29E9 -#define NA_SE_EV_DEMO02_WHOOSH 0x29EA -#define NA_SE_EV_DEMO02_ME2 0x29EB -#define NA_SE_EV_DEMO25_ME1 0x29EC -#define NA_SE_EV_DEMO25_HEAD_HIT 0x29ED -#define NA_SE_EV_TENTI_GYAKUTEN 0x29EE -#define NA_SE_EV_IKANA_JYOUKA 0x29EF -#define NA_SE_EV_IKANA_SHARP 0x29F0 -#define NA_SE_EV_IKANA_JYOUKA_FLASH 0x29F1 -#define NA_SE_EV_IKACASTLE_SLIDE1 0x29F2 -#define NA_SE_EV_OKUJYOU_WIND 0x29F3 -#define NA_SE_EV_CAM_WHOOSH 0x29F4 -#define NA_SE_EV_DESK_HIT 0x29F5 -#define NA_SE_EV_DEMO08_FIRE 0x29F6 -#define NA_SE_EV_DEMO08_ME1 0x29F7 -#define NA_SE_EV_OCARINA_FALL 0x29F8 -#define NA_SE_EV_LINK_WARP_LV 0x29F9 -#define NA_SE_EV_DEMO_ATATAME 0x29FA -#define NA_SE_EV_DEMO12_KIRAKIRA 0x29FB -#define NA_SE_EV_DEMO32_FIRE_SIPPAI 0x29FC -#define NA_SE_EV_KYOJIN_DOWN 0x29FD -#define NA_SE_EV_FACE_BREAKDOWN_OFF 0x29FE -#define NA_SE_EV_DEMO_MOON_IN 0x29FF -#define NA_SE_EV_1ST_MODORU_ME 0x2A00 -#define NA_SE_EV_WATER_WALL_BIG_SILENT2 0x2A01 -#define NA_SE_EV_MOONFALL_WIND1 0x2A02 -#define NA_SE_EV_MOONFALL_WIND2 0x2A03 -#define NA_SE_EV_MOONFALL_WIND3 0x2A04 -#define NA_SE_EV_MOONFALL_WIND4 0x2A05 -#define NA_SE_EV_TOKEITOU_EXPLO1 0x2A06 -#define NA_SE_EV_TOKEITOU_EXPLO2 0x2A07 -#define NA_SE_EV_MOONFALL_WIND5 0x2A08 -#define NA_SE_EV_MOONFALL_WIND6 0x2A09 -#define NA_SE_EV_MOONFALL_WIND7 0x2A0A -#define NA_SE_EV_GIANT_DOWN 0x2A0B -#define NA_SE_SC_DEMO_SPLASH1 0x2A0C -#define NA_SE_EV_TURI_SPLASH 0x2A0D -#define NA_SE_EV_DUMMY_525 0x2A0E -#define NA_SE_EV_WAVE_S_TURIBORI 0x2A0F -#define NA_SE_EN_LAST_DAMAGE_3DOFF 0x2A10 -#define NA_SE_EV_DUMMY_529 0x2A11 // ------------ ENEMY ------------ @@ -1877,41 +1803,6 @@ #define NA_SE_EN_KITA_SNORE 0x3ADD #define NA_SE_EN_IRONNACK_DASH 0x3ADE #define NA_SE_EN_TUBOOCK_FLY 0x3ADF -#define NA_SE_EN_MIMICK_BREATH 0x3AE0 -#define NA_SE_EN_FANTOM_DEAD 0x3AE1 -#define NA_SE_EN_KAICHO_PIYORI 0x3AE2 -#define NA_SE_EN_READED_WALK 0x3AE3 -#define NA_SE_EN_LEADED_WHITE 0x3AE4 -#define NA_SE_EN_MIBOSS_APPEAR_B_OLD 0x3AE5 -#define NA_SE_EN_MIBOSS_KICK_OLD 0x3AE6 -#define NA_SE_EN_MIBOSS_HEADDOWN_OLD 0x3AE7 -#define NA_SE_EN_MIBOSS_LEGDOWN_OLD 0x3AE8 -#define NA_SE_EN_MIBOSS_WEAKWAIT_OLD 0x3AE9 -#define NA_SE_EN_MIBOSS_THRUST1_OLD 0x3AEA -#define NA_SE_EN_MIBOSS_JUMP3_OLD 0x3AEB -#define NA_SE_EN_MIBOSS_SWORD_ROLL_OLD 0x3AEC -#define NA_SE_EN_MIBOSS_DANCE_THRUST_OLD 0x3AED -#define NA_SE_EN_MIBOSS_DANCE_FIRE_OLD 0x3AEE -#define NA_SE_EN_B_PAMET_ROCK 0x3AEF -#define NA_SE_EN_DUMMY753 0x3AF0 -#define NA_SE_EN_DUMMY_754 0x3AF1 -#define NA_SE_EN_FANTOM_FLOAT 0x3AF2 -#define NA_SE_EN_KONB_SUIKOMI 0x3AF3 -#define NA_SE_EN_KONB_LANDING_OLD 0x3AF4 -#define NA_SE_EN_KONB_SIBUKI_OLD 0x3AF5 -#define NA_SE_EN_KONB_PIYORI_OLD 0x3AF6 -#define NA_SE_EN_KOUME_UBAITORU 0x3AF7 -#define NA_SE_EN_STALKIDS_PSYCHO2 0x3AF8 -#define NA_SE_EN_RIZA_ATTACK3 0x3AF9 -#define NA_SE_EN_YASE_LAUGH_K_HOLD 0x3AFA -#define NA_SE_EN_WIZ_DEAD_NEW 0x3AFB -#define NA_SE_EN_HIPLOOP_BURN 0x3AFC -#define NA_SE_EN_EYEGOLE_HATAKI 0x3AFD -#define NA_SE_EN_DEKNUTS_DANCE_FADE 0x3AFE -#define NA_SE_EN_NUTS_FURUERU 0x3AFF -#define NA_SE_EN_PO_APPEAR_IDO 0x3B00 -#define NA_SE_EN_FOLLOWERS_TO_KABE 0x3B01 -#define NA_SE_EN_MUJURA_LAST_UP 0x3B02 // ------------ SYSTEM ------------ @@ -2011,31 +1902,6 @@ #define NA_SE_SY_TIME_CONTROL_SLOW 0x485D #define NA_SE_SY_TIME_CONTROL_NORMAL 0x485E #define NA_SE_SY_SECOM_WARNING 0x485F -#define NA_SE_SY_WIN_CHANGE 0x4860 -#define NA_SE_SY_TOUCH1 0x4861 -#define NA_SE_SY_MENU_CHAT_MOVE 0x4862 -#define NA_SE_SY_YUBI_MOVE 0x4863 -#define NA_SE_SY_CHAT_ALLERT_IN 0x4864 -#define NA_SE_SY_CHAT_ALLERT 0x4865 -#define NA_SE_SY_CHAT_ALLERT_OUT 0x4866 -#define NA_SE_SY_TOUCH2 0x4867 -#define NA_SE_SY_TOUCH2_OUT 0x4868 -#define NA_SE_SY_TOUCH3 0x4869 -#define NA_SE_SY_TOUCH4 0x486A -#define NA_SE_SY_YUBI_CURSOL_KEY 0x486B -#define NA_SE_SY_EVENT_INFO 0x486C -#define NA_SE_SY_CLEAR1 0x486D -#define NA_SE_SY_ALARM_MOVE 0x486E -#define NA_SE_SY_QUEST_NEW 0x486F -#define NA_SE_SY_EVENT_FAIL 0x4870 -#define NA_SE_SY_QUEST_CLEAR 0x4871 -#define NA_SE_SY_CHAT_ALARM_OFF 0x4872 -#define NA_SE_SY_CHAT_ALARM_INFO 0x4873 -#define NA_SE_SY_ICON_MOVE 0x4874 -#define NA_SE_SY_ICON_MOVE_SET 0x4875 -#define NA_SE_SY_DIAMOND_SWITCH 0x4876 -#define NA_SE_SY_PREDEMO_EVIL 0x4877 -#define NA_SE_SY_PREDEMO_OMEN 0x4878 // ------------ OCARINA ------------ @@ -2055,10 +1921,6 @@ #define NA_SE_OC_13 0x580D #define NA_SE_OC_14 0x580E #define NA_SE_OC_15 0x580F -#define NA_SE_OC_HINT_MOVIE 0x5810 -#define NA_SE_OC_HINT_MOVIE2_WHITE 0x5811 -#define NA_SE_OC_HINT_MOVIE_ZOOMIN 0x5812 -#define NA_SE_OC_HIBIKI_ISHI 0x5813 // ------------ VOICE ------------ @@ -2458,205 +2320,36 @@ #define NA_SE_VO_DEMO_388 0x6989 #define NA_SE_VO_DEMO_389 0x698A #define NA_SE_VO_DEMO_390 0x698B +#define NA_SE_VO_DEMO_391 0x698C +#define NA_SE_VO_DEMO_392 0x698D +#define NA_SE_VO_DEMO_393 0x698E +#define NA_SE_VO_DEMO_394 0x698F -// ------------ UNKNOWN ------------ +// ------------ Sfx Table ------------ +// TODO: Extract via table after 100% decompilation /* -#define NA_BGM_DEMO_SE_SEQ 0x7800 -#define NA_BGM_DEMO_SE_SEQ_1 0x7801 -#define NA_BGM_DEMO_SE_SEQ_2 0x7802 -#define NA_BGM_DEMO_SE_SEQ_3 0x7803 -#define NA_BGM_DEMO_SE_SEQ_4 0x7804 -#define NA_BGM_DEMO_SE_SEQ_5 0x7805 -#define NA_BGM_DEMO_SE_SEQ_6 0x7806 -#define NA_BGM_DEMO_SE_SEQ_7 0x7807 -#define NA_BGM_DEMO_SE_SEQ_8 0x7808 -#define NA_BGM_DEMO_SE_SEQ_9 0x7809 -#define NA_BGM_DEMO_SE_SEQ_A 0x780A -#define NA_BGM_DEMO_SE_SEQ_B 0x780B -#define NA_BGM_DEMO_SE_SEQ_C 0x780C -#define NA_BGM_DEMO_SE_SEQ_D 0x780D -#define NA_BGM_DEMO_SE_SEQ_E 0x780E -#define NA_BGM_DEMO_SE_SEQ_F 0x780F -#define NA_SE_EN_MIBOSS_FALL 0x7810 -#define NA_SE_EN_MIBOSS_DAMAGE 0x7811 -#define NA_SE_EN_MIBOSS_DASH 0x7812 -#define NA_SE_EN_MIBOSS_DEAD 0x7813 -#define NA_SE_EN_MIBOSS_GND1 0x7814 -#define NA_SE_EN_MIBOSS_GND2 0x7815 -#define NA_SE_EN_MIBOSS_UNARI 0x7816 -#define NA_SE_EN_MIBOSS_RHYTHM 0x7817 -#define NA_SE_EN_MIBOSS_SWORD 0x7818 -#define NA_SE_EN_MIBOSS_JUMP1_NOTUSE 0x7819 -#define NA_SE_EN_MIBOSS_JUMP2_NOTUSE 0x781A -#define NA_SE_EN_MIBOSS_VOICE1 0x781B -#define NA_SE_EN_MIBOSS_VOICE2 0x781C -#define NA_SE_EN_MIBOSS_VOICE3 0x781D -#define NA_SE_EN_MIBOSS_FAINT 0x781E -#define NA_SE_EN_MIBOSS_ROLLING 0x781F -#define NA_SE_EN_MIBOSS_FREEZE 0x7820 -#define NA_SE_EN_MIBOSS_APPEAR_B 0x7821 -#define NA_SE_EN_MIBOSS_KICK 0x7822 -#define NA_SE_EN_MIBOSS_HEADDOWN 0x7823 -#define NA_SE_EN_MIBOSS_LEGDOWN 0x7824 -#define NA_SE_EN_MIBOSS_WEAKWAIT 0x7825 -#define NA_SE_EN_MIBOSS_THRUST1 0x7826 -#define NA_SE_EN_MIBOSS_JUMP3 0x7827 -#define NA_SE_EN_MIBOSS_SWORD_ROLL 0x7828 -#define NA_SE_EN_MIBOSS_DANCE_THRUST 0x7829 -#define NA_SE_EN_MIBOSS_DANCE_FIRE 0x782A -#define NA_SE_EN_ICEB_FOOTSTEP 0x782B -#define NA_SE_EN_ICEB_CRY 0x782C -#define NA_SE_EN_ICEB_STEAM_LONG 0x782D -#define NA_SE_EN_ICEB_STEAMS_DEMO 0x782E -#define NA_SE_EN_ICEB_STEAM_DEMO_UP 0x782F -#define NA_SE_EN_ICEB_DEAD 0x7830 -#define NA_SE_EN_ICEB_DAMAGE 0x7831 -#define NA_SE_EN_ICEB_SLIDING 0x7832 -#define NA_SE_EN_ICEB_BACK_ATTACK2 0x7833 -#define NA_SE_EN_KONB_BITE 0x7834 -#define NA_SE_EN_KONB_BOUND 0x7835 -#define NA_SE_EN_KONB_BOUND2 0x7836 -#define NA_SE_EN_KONB_DAMAGE 0x7837 -#define NA_SE_EN_KONB_DEAD 0x7838 -#define NA_SE_EN_KONB_DEAD2 0x7839 -#define NA_SE_EN_KONB_DEAD_JUMP 0x783A -#define NA_SE_EN_KONB_DEAD_JUMP2 0x783B -#define NA_SE_EN_KONB_DEMO_MOVE 0x783C -#define NA_SE_EN_KONB_INIT 0x783D -#define NA_SE_EN_KONB_JUMP 0x783E -#define NA_SE_EN_KONB_JUMP_LEV 0x783F -#define NA_SE_EN_KONB_LANDING 0x7840 -#define NA_SE_EN_KONB_MINI_APPEAR_NOTUSE 0x7841 -#define NA_SE_EN_KONB_PIYORI 0x7842 -#define NA_SE_EN_KONB_PREATTACK 0x7843 -#define NA_SE_EN_KONB_SIBUKI 0x7844 -#define NA_SE_EN_KONB_SINK 0x7845 -#define NA_SE_EN_KONB_WAIT 0x7846 -#define NA_SE_EN_KONB_DODAI_FALL 0x7847 -#define NA_SE_EN_KONB_SUIKOMU 0x7848 -#define NA_SE_EN_KONB_TABERU 0x7849 -#define NA_SE_EN_KONB_TOBIDASU 0x784A -#define NA_SE_EN_KONB_TOSSIN1_KAMAE 0x784B -#define NA_SE_EN_KONB_TOSSIN1_DASH 0x784C -#define NA_SE_EN_KONB_TOSSIN1_TYAKUSUI 0x784D -#define NA_SE_EN_KONB_BOMB1_INSIDE 0x784E -#define NA_SE_EN_KONB_BOMB1_OUTSIDE 0x784F -#define NA_SE_EN_KONB_MEDAMA_APPEAR 0x7850 -#define NA_SE_EN_KONB_BOMB_CHAIN 0x7851 -#define NA_SE_EN_KONB_CHIAN_SLASH 0x7852 -#define NA_SE_EN_KONB_INFO_SAKEBI 0x7853 -#define NA_SE_EN_KONB_INFO_SAKEBI_LONG 0x7854 -#define NA_SE_EN_KONB_DODAI_ATTACK1 0x7855 -#define NA_SE_EN_KONB_DODAI_ATTACK2 0x7856 -#define NA_SE_EN_KONB_TAORE 0x7857 -#define NA_SE_EN_INBOSS_SAND 0x7858 -#define NA_SE_EN_INBOSS_ROAR 0x7859 -#define NA_SE_EN_INBOSS_DAMAGE 0x785A -#define NA_SE_EN_INBOSS_DEAD_PRE2 0x785B -#define NA_SE_EN_INBOSS_DEAD 0x785C -#define NA_SE_EN_INBOSS_DOWN_PRE 0x785D -#define NA_SE_EN_INBOSS_BRESS_PRE 0x785E -#define NA_SE_EN_INBOSS_SANRAN 0x785F -#define NA_SE_EN_INBOSS_CHIBI_WALK 0x7860 -#define NA_SE_EN_INBOSS_CHIBI_DAMAGE 0x7861 -#define NA_SE_EN_INBOSS_CHIBI_DEAD 0x7862 -#define NA_SE_EN_INBOSS_CHIBI_RUN 0x7863 -#define NA_SE_EN_INBOSS_JIMEN_MORI 0x7864 -#define NA_SE_EN_INBOSS_JIMEN_DERU 0x7865 -#define NA_SE_EN_INBOSS_UNDER_MOVE 0x7866 -#define NA_SE_EN_INBOSS_BREATH 0x7867 -#define NA_SE_EN_INBOSS_DAMAGE_MOVE 0x7868 -#define NA_SE_EN_INBOSS_MEDAMA_DERU 0x7869 -#define NA_SE_EN_INBOSS_FIREBALL_FLY 0x786A -#define NA_SE_EN_INBOSS_SANRAN_SHORT 0x786B -#define NA_SE_EN_INBOSS_DOWN 0x786C -#define NA_SE_EN_INBOSS_DEAD_RED 0x786D -#define NA_SE_EN_INBOSS_TAME 0x786E -#define NA_SE_EN_LAST1_ATTACK 0x786F -#define NA_SE_EN_LAST1_ATTACK_2ND 0x7870 -#define NA_SE_EN_LAST1_BEAM 0x7871 -#define NA_SE_EN_LAST1_BEAM2 0x7872 -#define NA_SE_EN_LAST1_BLOW 0x7873 -#define NA_SE_EN_LAST1_DAMAGE1 0x7874 -#define NA_SE_EN_LAST1_DAMAGE2 0x7875 -#define NA_SE_EN_LAST1_DEAD 0x7876 -#define NA_SE_EN_LAST1_DEMO_BREAK_NOUSE 0x7877 -#define NA_SE_EN_LAST1_DEMO_WALL_NOUSE 0x7878 -#define NA_SE_EN_LAST1_FALL 0x7879 -#define NA_SE_EN_LAST1_FLOAT 0x787A -#define NA_SE_EN_LAST1_GROW_HEAD_NOTUSE 0x787B -#define NA_SE_EN_LAST1_ROLLING 0x787C -#define NA_SE_EN_LAST1_TRANSFORM_NOTUSE 0x787D -#define NA_SE_EN_LAST2_BALLET 0x787E -#define NA_SE_EN_LAST2_BIRD 0x787F -#define NA_SE_EN_LAST2_BIRD2 0x7880 -#define NA_SE_EN_LAST2_DAMAGE 0x7881 -#define NA_SE_EN_LAST2_DAMAGE2 0x7882 -#define NA_SE_EN_LAST2_DEAD 0x7883 -#define NA_SE_EN_LAST2_FIRE 0x7884 -#define NA_SE_EN_LAST2_GROW_HEAD 0x7885 -#define NA_SE_EN_LAST2_VOICE_UAUOO2 0x7886 -#define NA_SE_EN_LAST2_GYM_B 0x7887 -#define NA_SE_EN_LAST2_HEARTBEAT 0x7888 -#define NA_SE_EN_LAST2_JUMP 0x7889 -#define NA_SE_EN_LAST2_VOICE_UAUOO1 0x788A -#define NA_SE_EN_LAST2_MOONWALK 0x788B -#define NA_SE_EN_LAST2_PUMP_UP 0x788C -#define NA_SE_EN_LAST2_SHOUT_NOTUSE 0x788D -#define NA_SE_EN_LAST2_VOICE_SURPRISED 0x788E -#define NA_SE_EN_LAST2_UAUOO 0x788F -#define NA_SE_EN_LAST2_WAIT 0x7890 -#define NA_SE_EN_LAST2_WALK 0x7891 -#define NA_SE_EN_LAST2_WALK2 0x7892 -#define NA_SE_EN_LAST3_COIL_ATTACK 0x7893 -#define NA_SE_EN_LAST3_VOICE_DAMAGE 0x7894 -#define NA_SE_EN_LAST3_VOICE_DAMAGE2 0x7895 -#define NA_SE_EN_LAST3_VOICE_DEAD 0x7896 -#define NA_SE_EN_LAST3_DEAD_DEAD1 0x7897 -#define NA_SE_EN_LAST3_DEAD_DEAD2 0x7898 -#define NA_SE_EN_LAST3_DEAD_FLOAT_NOTUSE 0x7899 -#define NA_SE_EN_LAST3_DEAD_LIGHTS 0x789A -#define NA_SE_EN_LAST3_DEAD_ROD_NOTUSE 0x789B -#define NA_SE_EN_LAST3_DEAD_WIND1 0x789C -#define NA_SE_EN_LAST3_DEAD_WIND2 0x789D -#define NA_SE_EN_LAST3_DEAD_WIND3 0x789E -#define NA_SE_EN_LAST3_GET_LINK 0x789F -#define NA_SE_EN_LAST3_VOICE_KICK 0x78A0 -#define NA_SE_EN_LAST3_KOMA 0x78A1 -#define NA_SE_EN_LAST3_ROD_DANCE 0x78A2 -#define NA_SE_EN_LAST3_ROD_MID 0x78A3 -#define NA_SE_EN_LAST3_ROD_FLOOR 0x78A4 -#define NA_SE_EN_LAST3_ROD_HOP 0x78A5 -#define NA_SE_EN_LAST3_ROD_HOP2 0x78A6 -#define NA_SE_EN_LAST3_ROD_WIND 0x78A7 -#define NA_SE_EN_LAST3_VOICE_KOMA 0x78A8 -#define NA_SE_EN_LAST3_VOICE_ROD 0x78A9 -#define NA_SE_EN_LAST3_VOICE_THROW 0x78AA -#define NA_SE_EN_LAST3_VOICE_LAUGH 0x78AB -#define NA_SE_EN_LAST1_SIZZLE 0x78AC -#define NA_SE_EN_LAST1_LAND2 0x78AD -#define NA_SE_EN_LAST3_WHIP1 0x78AE -#define NA_SE_EV_LAVA_HIT 0x78AF -#define NA_SE_EV_LAVA_WHOOSH 0x78B0 -#define Wind_seq1 0x78B1 -#define Bird_seqs 0x78B2 -#define Rain_seq0 0x78B3 -#define Thun_seq0 0x78B4 -#define NA_BGM_OCA_EPONA_SEQ 0x78B5 -#define NA_BGM_OCA_TIME_SEQ 0x78B6 -#define NA_BGM_OCA_STORM_SEQ 0x78B7 -#define NA_BGM_OCA_BIGWING_SEQ 0x78B8 -#define NA_BGM_OCA_TIME_SPEED_SEQ 0x78B9 -#define NA_BGM_OCA_TIME_JUMP_SEQ 0x78BA -#define NA_BGM_OCA_AWAKING_SEQ 0x78BB -#define NA_BGM_OCA_CURE_SEQ 0x78BC -#define NA_BGM_OCA_LULLABY_HALF_SEQ 0x78BD -#define NA_BGM_OCA_LULLABY_SEQ 0x78BE -#define NA_BGM_OCA_PLEDGE_SEQ 0x78BF -#define NA_BGM_OCA_TIDE_SEQ 0x78C0 -#define NA_BGM_OCA_SHELL_SEQ 0x78C1 -#define NA_BGM_GERO_SEQ 0x78C2 +#define DEFINE_SFX(enum, _1, _2, _3, _4, _5) enum, + +typedef enum { + NA_SE_PL_BASE = 0x7FF, + #include "tables/sfx/playerbank_table.h" + NA_SE_IT_BASE = 0x17FF, + #include "tables/sfx/itembank_table.h" + NA_SE_EV_BASE = 0x27FF, + #include "tables/sfx/environmentbank_table.h" + NA_SE_EN_BASE = 0x37FF, + #include "tables/sfx/enemybank_table.h" + NA_SE_SY_BASE = 0x47FF, + #include "tables/sfx/systembank_table.h" + NA_SE_OC_BASE = 0x57FF, + #include "tables/sfx/ocarinabank_table.h" + NA_SE_VO_BASE = 0x67FF, + #include "tables/sfx/voicebank_table.h" + NA_SE_MAX +} SfxId; + +#undef DEFINE_SFX */ #endif diff --git a/include/tables/sfx/enemybank_table.h b/include/tables/sfx/enemybank_table.h new file mode 100644 index 000000000..e969fef59 --- /dev/null +++ b/include/tables/sfx/enemybank_table.h @@ -0,0 +1,749 @@ +/** + * Sfx Enemy Bank + * + * DEFINE_SFX should be used for all sfx define in the enemy bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the enemy bank in sequence 0 + */ +/* 0x3800 */ DEFINE_SFX(NA_SE_EN_DODO_J_WALK, 0x18, 1, 0, 0, 0) +/* 0x3801 */ DEFINE_SFX(NA_SE_EN_DODO_J_CRY, 0x30, 1, 0, 0, 0) +/* 0x3802 */ DEFINE_SFX(NA_SE_EN_DODO_J_FIRE, 0x30, 1, 0, 0, 0) +/* 0x3803 */ DEFINE_SFX(NA_SE_EN_DODO_J_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3804 */ DEFINE_SFX(NA_SE_EN_DODO_J_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3805 */ DEFINE_SFX(NA_SE_EN_BAKUO_ROLL, 0x30, 3, 0, 0, 0) +/* 0x3806 */ DEFINE_SFX(NA_SE_EN_MIZUBABA2_VOICE, 0x36, 0, 0, 0, 0) +/* 0x3807 */ DEFINE_SFX(NA_SE_EN_MIZUBABA2_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x3808 */ DEFINE_SFX(NA_SE_EN_MIBOSS_FALL_OLD_OLD, 0x40, 3, 0, 0, 0) +/* 0x3809 */ DEFINE_SFX(NA_SE_EN_MIBOSS_DAMAGE_OLD, 0x58, 3, 0, 0, 0) +/* 0x380A */ DEFINE_SFX(NA_SE_EN_MIBOSS_DASH_OLD, 0x40, 3, 0, 0, 0) +/* 0x380B */ DEFINE_SFX(NA_SE_EN_MIBOSS_DEAD_OLD, 0x68, 3, 0, 0, SFX_FLAG_REVERB_NO_DIST) +/* 0x380C */ DEFINE_SFX(NA_SE_EN_MIBOSS_GND1_OLD, 0x40, 3, 0, 0, 0) +/* 0x380D */ DEFINE_SFX(NA_SE_EN_GOMA_DOWN, 0x30, 3, 0, 0, 0) +/* 0x380E */ DEFINE_SFX(NA_SE_EN_MIBOSS_GND2_OLD, 0x40, 3, 0, 0, 0) +/* 0x380F */ DEFINE_SFX(NA_SE_EN_MIBOSS_UNARI_OLD, 0x40, 3, 0, 0, 0) +/* 0x3810 */ DEFINE_SFX(NA_SE_EN_MIBOSS_RHYTHM_OLD, 0x54, 3, 0, 0, SFX_FLAG_LOWER_VOLUME_BGM) +/* 0x3811 */ DEFINE_SFX(NA_SE_EN_MIBOSS_SWORD_OLD, 0x54, 3, 0, 0, 0) +/* 0x3812 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_ENTRY, 0x30, 3, 0, 0, 0) +/* 0x3813 */ DEFINE_SFX(NA_SE_EN_MIBOSS_JUMP1, 0x40, 3, 0, 0, 0) +/* 0x3814 */ DEFINE_SFX(NA_SE_EN_MIBOSS_JUMP2, 0x40, 3, 0, 0, 0) +/* 0x3815 */ DEFINE_SFX(NA_SE_EN_MIBOSS_VOICE1_OLD, 0x54, 3, 0, 0, 0) +/* 0x3816 */ DEFINE_SFX(NA_SE_EN_MIBOSS_VOICE2_OLD, 0x54, 3, 0, 0, 0) +/* 0x3817 */ DEFINE_SFX(NA_SE_EN_MIBOSS_VOICE3_OLD, 0x54, 3, 0, 0, 0) +/* 0x3818 */ DEFINE_SFX(NA_SE_EN_INBOSS_SAND_OLD, 0x30, 3, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3819 */ DEFINE_SFX(NA_SE_EN_INBOSS_ROAR_OLD, 0x50, 3, 0, 0, 0) +/* 0x381A */ DEFINE_SFX(NA_SE_EN_INBOSS_DAMAGE_OLD, 0x58, 3, 0, 0, 0) +/* 0x381B */ DEFINE_SFX(NA_SE_EN_COMMON_WEAKENED, 0x38, 3, 0, 0, 0) +/* 0x381C */ DEFINE_SFX(NA_SE_EN_MIBOSS_FAINT_OLD, 0x50, 3, 0, 0, 0) +/* 0x381D */ DEFINE_SFX(NA_SE_EN_MIBOSS_ROLLING_OLD, 0x30, 3, 0, 0, 0) +/* 0x381E */ DEFINE_SFX(NA_SE_EN_MIZUBABA1_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x381F */ DEFINE_SFX(NA_SE_EN_MIZUBABA_DEAD, 0x48, 0, 0, 0, 0) +/* 0x3820 */ DEFINE_SFX(NA_SE_EN_DODO_M_CRY, 0x30, 0, 0, 0, 0) +/* 0x3821 */ DEFINE_SFX(NA_SE_EN_DODO_M_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3822 */ DEFINE_SFX(NA_SE_EN_DODO_M_MOVE, 0x18, 0, 0, 0, 0) +/* 0x3823 */ DEFINE_SFX(NA_SE_EN_DODO_M_DOWN, 0x14, 0, 0, 0, 0) +/* 0x3824 */ DEFINE_SFX(NA_SE_EN_DODO_M_UP, 0x14, 0, 0, 0, 0) +/* 0x3825 */ DEFINE_SFX(NA_SE_EN_MIZUBABA_TRANSFORM, 0x30, 0, 0, 0, 0) +/* 0x3826 */ DEFINE_SFX(NA_SE_EN_DODO_M_EAT, 0x30, 0, 0, 0, 0) +/* 0x3827 */ DEFINE_SFX(NA_SE_EN_MIZUBABA2_WALK, 0x28, 0, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3828 */ DEFINE_SFX(NA_SE_EN_BOMCHU_WALK, 0x28, 0, 0, 0, 0) +/* 0x3829 */ DEFINE_SFX(NA_SE_EN_RIZA_CRY, 0x30, 2, 0, 0, 0) +/* 0x382A */ DEFINE_SFX(NA_SE_EN_RIZA_ATTACK, 0x32, 2, 0, 0, 0) +/* 0x382B */ DEFINE_SFX(NA_SE_EN_RIZA_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x382C */ DEFINE_SFX(NA_SE_EN_RIZA_WARAU, 0x20, 0, 0, 0, 0) +/* 0x382D */ DEFINE_SFX(NA_SE_EN_RIZA_DEAD, 0x40, 1, 0, 0, 0) +/* 0x382E */ DEFINE_SFX(NA_SE_EN_RIZA_WALK, 0x18, 0, 0, 0, 0) +/* 0x382F */ DEFINE_SFX(NA_SE_EN_RIZA_JUMP, 0x28, 0, 0, 0, 0) +/* 0x3830 */ DEFINE_SFX(NA_SE_EN_STALKID_WALK, 0x18, 0, 1, 0, 0) +/* 0x3831 */ DEFINE_SFX(NA_SE_EN_STALKID_ATTACK, 0x30, 0, 0, 0, 0) +/* 0x3832 */ DEFINE_SFX(NA_SE_EN_STALKID_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3833 */ DEFINE_SFX(NA_SE_EN_STALKID_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3834 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_SLIDING, 0x14, 0, 0, 0, 0) +/* 0x3835 */ DEFINE_SFX(NA_SE_EN_TEKU_WALK_WATER, 0x18, 0, 2, 0, 0) +/* 0x3836 */ DEFINE_SFX(NA_SE_EN_LIGHT_ARROW_HIT, 0x38, 2, 0, 0, 0) +/* 0x3837 */ DEFINE_SFX(NA_SE_EN_MIZUBABA2_ATTACK, 0x34, 0, 0, 0, 0) +/* 0x3838 */ DEFINE_SFX(NA_SE_EN_STAL_WARAU, 0x28, 1, 0, 0, 0) +/* 0x3839 */ DEFINE_SFX(NA_SE_EN_STAL_SAKEBI, 0x30, 0, 0, 0, 0) +/* 0x383A */ DEFINE_SFX(NA_SE_EN_STAL_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x383B */ DEFINE_SFX(NA_SE_EN_STAL_DEAD, 0x40, 1, 0, 0, 0) +/* 0x383C */ DEFINE_SFX(NA_SE_EN_WOLFOS_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x383D */ DEFINE_SFX(NA_SE_EN_STAL_WALK, 0x18, 0, 0, 0, 0) +/* 0x383E */ DEFINE_SFX(NA_SE_EN_WOLFOS_CRY, 0x20, 0, 0, 0, 0) +/* 0x383F */ DEFINE_SFX(NA_SE_EN_WOLFOS_ATTACK, 0x30, 0, 0, 0, 0) +/* 0x3840 */ DEFINE_SFX(NA_SE_EN_FFLY_ATTACK, 0x32, 0, 0, 0, 0) +/* 0x3841 */ DEFINE_SFX(NA_SE_EN_FFLY_FLY, 0x20, 1, 0, 0, 0) +/* 0x3842 */ DEFINE_SFX(NA_SE_EN_FFLY_DEAD, 0x37, 1, 0, 0, 0) +/* 0x3843 */ DEFINE_SFX(NA_SE_EN_WOLFOS_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3844 */ DEFINE_SFX(NA_SE_EN_AMOS_WALK, 0x30, 0, 0, 0, 0) +/* 0x3845 */ DEFINE_SFX(NA_SE_EN_AMOS_WAVE, 0x30, 0, 0, 0, 0) +/* 0x3846 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_DEAD, 0x40, 2, 0, 0, 0) +/* 0x3847 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_DAMAGE, 0x38, 2, 0, 0, 0) +/* 0x3848 */ DEFINE_SFX(NA_SE_EN_AMOS_VOICE, 0x20, 0, 0, 0, 0) +/* 0x3849 */ DEFINE_SFX(NA_SE_EN_KUSAMUSHI_VIBE, 0x18, 0, 0, 0, 0) +/* 0x384A */ DEFINE_SFX(NA_SE_EN_BEE_FLY, 0x40, 7, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x384B */ DEFINE_SFX(NA_SE_EN_WOLFOS_DEAD, 0x40, 1, 0, 0, 0) +/* 0x384C */ DEFINE_SFX(NA_SE_EN_COMMON_E_BALL, 0x30, 3, 0, 0, 0) +/* 0x384D */ DEFINE_SFX(NA_SE_EN_COMMON_THUNDER_THR, 0x30, 3, 0, 0, 0) +/* 0x384E */ DEFINE_SFX(NA_SE_EN_COMMON_E_BALL_HIT, 0x30, 3, 0, 0, 0) +/* 0x384F */ DEFINE_SFX(NA_SE_EN_COMMON_ELEC_ARK, 0x30, 3, 0, 0, 0) +/* 0x3850 */ DEFINE_SFX(NA_SE_EN_SUISEN_EAT, 0x30, 0, 0, 0, 0) +/* 0x3851 */ DEFINE_SFX(NA_SE_EN_SUISEN_DEAD, 0x40, 0, 0, 0, 0) +/* 0x3852 */ DEFINE_SFX(NA_SE_EN_COMMON_E_BALL_THR, 0x30, 3, 0, 0, 0) +/* 0x3853 */ DEFINE_SFX(NA_SE_EN_UTSUBO_APPEAR, 0x30, 3, 0, 0, 0) +/* 0x3854 */ DEFINE_SFX(NA_SE_EN_BOMCHU_VOICE, 0x34, 0, 0, 0, 0) +/* 0x3855 */ DEFINE_SFX(NA_SE_EN_BOMCHU_AIM, 0x34, 0, 0, 0, 0) +/* 0x3856 */ DEFINE_SFX(NA_SE_EN_BOMCHU_RUN, 0x36, 0, 0, 0, 0) +/* 0x3857 */ DEFINE_SFX(NA_SE_EN_UTSUBO_BACK, 0x30, 3, 0, 0, 0) +/* 0x3858 */ DEFINE_SFX(NA_SE_EN_DODO_J_BREATH, 0x28, 0, 0, 0, 0) +/* 0x3859 */ DEFINE_SFX(NA_SE_EN_DODO_J_TAIL, 0x30, 0, 0, 0, 0) +/* 0x385A */ DEFINE_SFX(NA_SE_EN_WOLFOS_WALK, 0x18, 0, 0, 0, 0) +/* 0x385B */ DEFINE_SFX(NA_SE_EN_DODO_J_EAT, 0x30, 0, 0, 0, 0) +/* 0x385C */ DEFINE_SFX(NA_SE_EN_DEKU_MOUTH, 0x28, 0, 3, 0, 0) +/* 0x385D */ DEFINE_SFX(NA_SE_EN_DEKU_ATTACK, 0x30, 0, 1, 0, 0) +/* 0x385E */ DEFINE_SFX(NA_SE_EN_DEKU_DAMAGE, 0x38, 1, 1, 0, 0) +/* 0x385F */ DEFINE_SFX(NA_SE_EN_DEKU_DEAD, 0x40, 1, 1, 0, 0) +/* 0x3860 */ DEFINE_SFX(NA_SE_EN_MIZUBABA1_MOUTH, 0x30, 0, 0, 0, 0) +/* 0x3861 */ DEFINE_SFX(NA_SE_EN_MIZUBABA1_ATTACK, 0x36, 0, 0, 0, 0) +/* 0x3862 */ DEFINE_SFX(NA_SE_EN_DEKU_JR_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3863 */ DEFINE_SFX(NA_SE_EN_DEKU_SCRAPE, 0x14, 0, 0, 0, 0) +/* 0x3864 */ DEFINE_SFX(NA_SE_EN_TAIL_FLY, 0x30, 0, 0, 0, 0) +/* 0x3865 */ DEFINE_SFX(NA_SE_EN_TAIL_CRY, 0x20, 0, 0, 0, 0) +/* 0x3866 */ DEFINE_SFX(NA_SE_EN_TAIL_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3867 */ DEFINE_SFX(NA_SE_EN_GOLON_STAND_IMT, 0x30, 3, 0, 0, 0) +/* 0x3868 */ DEFINE_SFX(NA_SE_EN_STALTU_DOWN, 0x30, 4, 0, 0, 0) +/* 0x3869 */ DEFINE_SFX(NA_SE_EN_STALTU_UP, 0x30, 4, 0, 0, 0) +/* 0x386A */ DEFINE_SFX(NA_SE_EN_STALTU_LAUGH, 0x20, 4, 0, 0, 0) +/* 0x386B */ DEFINE_SFX(NA_SE_EN_STALTU_DAMAGE, 0x38, 4, 0, 0, 0) +/* 0x386C */ DEFINE_SFX(NA_SE_EN_TEKU_JUMP, 0x20, 3, 0, 0, 0) +/* 0x386D */ DEFINE_SFX(NA_SE_EN_TEKU_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x386E */ DEFINE_SFX(NA_SE_EN_TEKU_DEAD, 0x40, 1, 0, 0, 0) +/* 0x386F */ DEFINE_SFX(NA_SE_EN_TEKU_WALK, 0x14, 0, 0, 0, 0) +/* 0x3870 */ DEFINE_SFX(NA_SE_EN_PO_KANTERA, 0x30, 3, 0, 0, 0) +/* 0x3871 */ DEFINE_SFX(NA_SE_EN_PO_FLY, 0x20, 1, 0, 0, 0) +/* 0x3872 */ DEFINE_SFX(NA_SE_EN_PO_AWAY, 0x20, 1, 0, 0, 0) +/* 0x3873 */ DEFINE_SFX(NA_SE_EN_STALKIDS_APPEAR, 0x30, 2, 0, 0, 0) +/* 0x3874 */ DEFINE_SFX(NA_SE_EN_PO_DISAPPEAR, 0x35, 2, 0, 0, 0) +/* 0x3875 */ DEFINE_SFX(NA_SE_EN_PO_DAMAGE, 0x38, 2, 0, 0, 0) +/* 0x3876 */ DEFINE_SFX(NA_SE_EN_PO_DEAD, 0x48, 2, 0, 0, 0) +/* 0x3877 */ DEFINE_SFX(NA_SE_EN_WIZ_DISAPPEAR, 0x40, 2, 0, 0, 0) +/* 0x3878 */ DEFINE_SFX(NA_SE_EN_EXTINCT, 0x45, 1, 2, 0, 0) +/* 0x3879 */ DEFINE_SFX(NA_SE_EN_GOLON_LAND_BIG, 0x34, 0, 0, 0, 0) +/* 0x387A */ DEFINE_SFX(NA_SE_EN_GERUDOFT_DOWN, 0x40, 0, 0, 0, 0) +/* 0x387B */ DEFINE_SFX(NA_SE_EN_EYEGOLE_ATTACK, 0x20, 2, 0, 0, 0) +/* 0x387C */ DEFINE_SFX(NA_SE_EN_NUTS_UP, 0x28, 0, 0, 0, 0) +/* 0x387D */ DEFINE_SFX(NA_SE_EN_NUTS_DOWN, 0x28, 0, 0, 0, 0) +/* 0x387E */ DEFINE_SFX(NA_SE_EN_NUTS_THROW, 0x30, 0, 0, 0, 0) +/* 0x387F */ DEFINE_SFX(NA_SE_EN_NUTS_WALK, 0x20, 4, 2, 0, 0) +/* 0x3880 */ DEFINE_SFX(NA_SE_EN_NUTS_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3881 */ DEFINE_SFX(NA_SE_EN_NUTS_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3882 */ DEFINE_SFX(NA_SE_EN_NUT_FAINT, 0x20, 0, 0, 0, 0) +/* 0x3883 */ DEFINE_SFX(NA_SE_EN_PO_BIG_GET, 0x30, 3, 0, 0, 0) +/* 0x3884 */ DEFINE_SFX(NA_SE_EN_STALTU_ROLL, 0x30, 4, 0, 0, 0) +/* 0x3885 */ DEFINE_SFX(NA_SE_EN_STALTU_DEAD, 0x40, 4, 0, 0, 0) +/* 0x3886 */ DEFINE_SFX(NA_SE_EN_PO_SISTER_DEAD, 0x40, 3, 0, 0, 0) +/* 0x3887 */ DEFINE_SFX(NA_SE_EN_BARI_SPLIT, 0x40, 1, 0, 0, 0) +/* 0x3888 */ DEFINE_SFX(NA_SE_EN_LAST1_GROW_HEAD, 0x28, 1, 0, 0, 0) +/* 0x3889 */ DEFINE_SFX(NA_SE_EN_NUTS_VOICE, 0x30, 3, 0, 0, 0) +/* 0x388A */ DEFINE_SFX(NA_SE_EN_TEKU_LAND_WATER, 0x20, 0, 0, 0, 0) +/* 0x388B */ DEFINE_SFX(NA_SE_EN_LAST_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x388C */ DEFINE_SFX(NA_SE_EN_STALWALL_ROLL, 0x30, 4, 0, 0, 0) +/* 0x388D */ DEFINE_SFX(NA_SE_EN_STALWALL_DASH, 0x30, 0, 0, 0, 0) +/* 0x388E */ DEFINE_SFX(NA_SE_EN_TEKU_JUMP_WATER, 0x20, 0, 0, 0, 0) +/* 0x388F */ DEFINE_SFX(NA_SE_EN_TEKU_LAND_WATER2, 0x20, 0, 0, 0, 0) +/* 0x3890 */ DEFINE_SFX(NA_SE_EN_FALL_AIM, 0x38, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3891 */ DEFINE_SFX(NA_SE_EN_FALL_UP, 0x30, 3, 0, 0, 0) +/* 0x3892 */ DEFINE_SFX(NA_SE_EN_FALL_CATCH, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3893 */ DEFINE_SFX(NA_SE_EN_FALL_LAND, 0x30, 0, 0, 0, 0) +/* 0x3894 */ DEFINE_SFX(NA_SE_EN_FALL_WALK, 0x14, 0, 0, 0, 0) +/* 0x3895 */ DEFINE_SFX(NA_SE_EN_FALL_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3896 */ DEFINE_SFX(NA_SE_EN_DAIOCTA_REVERSE, 0x40, 1, 0, 0, 0) +/* 0x3897 */ DEFINE_SFX(NA_SE_EN_KAICHO_FLUTTER, 0x14, 0, 0, 0, 0) +/* 0x3898 */ DEFINE_SFX(NA_SE_EN_BIRI_FLY, 0x20, 0, 0, 0, 0) +/* 0x3899 */ DEFINE_SFX(NA_SE_EN_BIRI_JUMP, 0x20, 0, 0, 0, 0) +/* 0x389A */ DEFINE_SFX(NA_SE_EN_BIRI_SPARK, 0x30, 0, 0, 0, 0) +/* 0x389B */ DEFINE_SFX(NA_SE_EN_BIRI_DEAD, 0x40, 1, 0, 0, 0) +/* 0x389C */ DEFINE_SFX(NA_SE_EN_COMMON_WATER_DEEP, 0x30, 0, 2, 0, 0) +/* 0x389D */ DEFINE_SFX(NA_SE_EN_BARI_ROLL, 0x30, 0, 0, 0, 0) +/* 0x389E */ DEFINE_SFX(NA_SE_EN_COMMON_FREEZE, 0x37, 1, 0, 0, 0) +/* 0x389F */ DEFINE_SFX(NA_SE_EN_BARI_DEAD, 0x40, 1, 0, 0, 0) +/* 0x38A0 */ DEFINE_SFX(NA_SE_EN_BATTA_FLY, 0x28, 5, 0, 0, 0) +/* 0x38A1 */ DEFINE_SFX(NA_SE_EN_BATTA_ATTACK, 0x36, 5, 0, 0, 0) +/* 0x38A2 */ DEFINE_SFX(NA_SE_EN_BATTA_DAMAGE, 0x38, 5, 0, 0, 0) +/* 0x38A3 */ DEFINE_SFX(NA_SE_EN_BATTA_DEAD, 0x48, 5, 0, 0, 0) +/* 0x38A4 */ DEFINE_SFX(NA_SE_EN_WIZ_UNARI, 0x30, 3, 0, 0, 0) +/* 0x38A5 */ DEFINE_SFX(NA_SE_EN_WIZ_RUN, 0x28, 2, 0, 0, 0) +/* 0x38A6 */ DEFINE_SFX(NA_SE_EN_WIZ_VOICE, 0x30, 3, 0, 0, 0) +/* 0x38A7 */ DEFINE_SFX(NA_SE_EN_WIZ_LAUGH, 0x30, 3, 0, 0, 0) +/* 0x38A8 */ DEFINE_SFX(NA_SE_EN_WIZ_ATTACK, 0x34, 3, 0, 0, 0) +/* 0x38A9 */ DEFINE_SFX(NA_SE_EN_WIZ_DAMAGE, 0x38, 3, 0, 0, 0) +/* 0x38AA */ DEFINE_SFX(NA_SE_EN_WIZ_DEAD, 0x40, 3, 0, 0, 0) +/* 0x38AB */ DEFINE_SFX(NA_SE_EN_WIZ_EXP, 0x30, 3, 0, 0, 0) +/* 0x38AC */ DEFINE_SFX(NA_SE_EN_DAIOCTA_DEAD, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x38AD */ DEFINE_SFX(NA_SE_EN_DAIOCTA_DEAD2, 0x30, 3, 0, 0, 0) +/* 0x38AE */ DEFINE_SFX(NA_SE_EN_FANTOM_DAMAGE, 0x38, 3, 0, 0, 0) +/* 0x38AF */ DEFINE_SFX(NA_SE_EN_DAIOCTA_DAMAGE, 0x40, 3, 0, 0, 0) +/* 0x38B0 */ DEFINE_SFX(NA_SE_EN_WIZ_LAUGH2, 0x30, 3, 0, 0, 0) +/* 0x38B1 */ DEFINE_SFX(NA_SE_EN_GOLON_SIT_IMT, 0x30, 3, 0, 0, 0) +/* 0x38B2 */ DEFINE_SFX(NA_SE_EN_FANTOM_VOICE, 0x30, 3, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x38B3 */ DEFINE_SFX(NA_SE_EN_KAICHO_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x38B4 */ DEFINE_SFX(NA_SE_EN_GOLON_COLD, 0x30, 3, 1, 0, 0) +/* 0x38B5 */ DEFINE_SFX(NA_SE_EN_GOLON_JUMP, 0x30, 3, 0, 0, 0) +/* 0x38B6 */ DEFINE_SFX(NA_SE_EN_KAICHO_CRY, 0x20, 0, 0, 0, 0) +/* 0x38B7 */ DEFINE_SFX(NA_SE_EN_KAICHO_ATTACK, 0x34, 0, 0, 0, 0) +/* 0x38B8 */ DEFINE_SFX(NA_SE_EN_GOLON_WALK, 0x18, 0, 2, 0, 0) +/* 0x38B9 */ DEFINE_SFX(NA_SE_EN_SLIME_JUMP, 0x30, 0, 0, 0, 0) +/* 0x38BA */ DEFINE_SFX(NA_SE_EN_SLIME_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x38BB */ DEFINE_SFX(NA_SE_EN_SLIME_BREAK, 0x30, 0, 0, 0, 0) +/* 0x38BC */ DEFINE_SFX(NA_SE_EN_KUROSUKE_MOVE, 0x14, 0, 0, 0, 0) +/* 0x38BD */ DEFINE_SFX(NA_SE_EN_KUROSUKE_ATTACK, 0x34, 0, 0, 0, 0) +/* 0x38BE */ DEFINE_SFX(NA_SE_EN_SLIME_DEAD, 0x40, 0, 0, 0, 0) +/* 0x38BF */ DEFINE_SFX(NA_SE_EN_SLIME_DEFENCE, 0x30, 3, 0, 0, 0) +/* 0x38C0 */ DEFINE_SFX(NA_SE_EN_OCTAROCK_ROCK, 0x20, 0, 0, 0, 0) +/* 0x38C1 */ DEFINE_SFX(NA_SE_EN_COMMON_WATER_SLW, 0x30, 0, 2, 0, 0) +/* 0x38C2 */ DEFINE_SFX(NA_SE_EN_OCTAROCK_JUMP, 0x30, 0, 0, 0, 0) +/* 0x38C3 */ DEFINE_SFX(NA_SE_EN_DAIOCTA_LAND, 0x30, 0, 0, 0, 0) +/* 0x38C4 */ DEFINE_SFX(NA_SE_EN_DAIOCTA_SINK, 0x28, 0, 0, 0, 0) +/* 0x38C5 */ DEFINE_SFX(NA_SE_EN_COMMON_WATER_MID, 0x30, 0, 2, 0, 0) +/* 0x38C6 */ DEFINE_SFX(NA_SE_EN_OCTAROCK_DEAD1, 0x40, 1, 0, 0, 0) +/* 0x38C7 */ DEFINE_SFX(NA_SE_EN_OCTAROCK_DEAD2, 0x40, 1, 0, 0, 0) +/* 0x38C8 */ DEFINE_SFX(NA_SE_EN_BUBLE_WING, 0x20, 0, 0, 0, 0) +/* 0x38C9 */ DEFINE_SFX(NA_SE_EN_BUBLE_MOUTH, 0x20, 0, 0, 0, 0) +/* 0x38CA */ DEFINE_SFX(NA_SE_EN_BUBLE_LAUGH, 0x14, 0, 0, 0, 0) +/* 0x38CB */ DEFINE_SFX(NA_SE_EN_BUBLE_BITE, 0x30, 0, 0, 0, 0) +/* 0x38CC */ DEFINE_SFX(NA_SE_EN_BUBLE_UP, 0x30, 0, 0, 0, 0) +/* 0x38CD */ DEFINE_SFX(NA_SE_EN_BUBLE_DOWN, 0x30, 0, 0, 0, 0) +/* 0x38CE */ DEFINE_SFX(NA_SE_EN_BUBLE_DEAD, 0x40, 1, 0, 0, 0) +/* 0x38CF */ DEFINE_SFX(NA_SE_EN_BUBLEFALL_FIRE, 0x30, 0, 0, 0, 0) +/* 0x38D0 */ DEFINE_SFX(NA_SE_EN_UTSUBO_DEAD, 0x30, 3, 0, 0, 0) +/* 0x38D1 */ DEFINE_SFX(NA_SE_EN_UTSUBO_DAMAGE, 0x38, 3, 0, 0, 0) +/* 0x38D2 */ DEFINE_SFX(NA_SE_EN_FROG_REAL, 0x40, 3, 0, 0, 0) +/* 0x38D3 */ DEFINE_SFX(NA_SE_EN_FROG_DAMAGE, 0x48, 3, 0, 0, 0) +/* 0x38D4 */ DEFINE_SFX(NA_SE_EN_B_SLIME_EAT, 0x30, 3, 0, 0, 0) +/* 0x38D5 */ DEFINE_SFX(NA_SE_EN_B_SLIME_LAUGH, 0x34, 3, 0, 0, 0) +/* 0x38D6 */ DEFINE_SFX(NA_SE_EN_FROG_DEAD, 0x48, 3, 0, 0, 0) +/* 0x38D7 */ DEFINE_SFX(NA_SE_EN_UTSUBO_BITE, 0x30, 3, 0, 0, 0) +/* 0x38D8 */ DEFINE_SFX(NA_SE_EN_B_SLIME_REVERSE, 0x34, 3, 0, 0, 0) +/* 0x38D9 */ DEFINE_SFX(NA_SE_EN_SLIME_JUMP1, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x38DA */ DEFINE_SFX(NA_SE_EN_SLIME_JUMP2, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x38DB */ DEFINE_SFX(NA_SE_EN_B_SLIME_BREAK, 0x40, 3, 0, 0, 0) +/* 0x38DC */ DEFINE_SFX(NA_SE_EN_BARI_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x38DD */ DEFINE_SFX(NA_SE_EN_HIPLOOP_LAND, 0x30, 1, 0, 0, 0) +/* 0x38DE */ DEFINE_SFX(NA_SE_EN_MOFER_CORE_MOVE_WT, 0x28, 3, 0, 0, 0) +/* 0x38DF */ DEFINE_SFX(NA_SE_EN_MOFER_CORE_SMJUMP, 0x28, 3, 0, 0, 0) +/* 0x38E0 */ DEFINE_SFX(NA_SE_EN_MONBLIN_GNDWAVE, 0x30, 3, 0, 0, 0) +/* 0x38E1 */ DEFINE_SFX(NA_SE_EN_MONBLIN_HAM_DOWN, 0x30, 3, 0, 0, 0) +/* 0x38E2 */ DEFINE_SFX(NA_SE_EN_MONBLIN_HAM_UP, 0x30, 3, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x38E3 */ DEFINE_SFX(NA_SE_EN_BUBLE_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x38E4 */ DEFINE_SFX(NA_SE_EN_REDEAD_CRY, 0x20, 0, 0, 0, 0) +/* 0x38E5 */ DEFINE_SFX(NA_SE_EN_REDEAD_AIM, 0x34, 0, 0, 0, 0) +/* 0x38E6 */ DEFINE_SFX(NA_SE_EN_REDEAD_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x38E7 */ DEFINE_SFX(NA_SE_EN_REDEAD_DEAD, 0x40, 1, 0, 0, 0) +/* 0x38E8 */ DEFINE_SFX(NA_SE_EN_REDEAD_ATTACK, 0x34, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x38E9 */ DEFINE_SFX(NA_SE_EN_GOLON_KID_SOB, 0x20, 0, 0, 0, 0) +/* 0x38EA */ DEFINE_SFX(NA_SE_EN_GOLON_KID_CRY, 0x38, 2, 1, 0, 0) +/* 0x38EB */ DEFINE_SFX(NA_SE_EN_KAICHO_DEAD, 0x40, 1, 0, 0, 0) +/* 0x38EC */ DEFINE_SFX(NA_SE_EN_PO_LAUGH, 0x30, 3, 0, 0, 0) +/* 0x38ED */ DEFINE_SFX(NA_SE_EN_PO_CRY, 0x30, 2, 0, 0, 0) +/* 0x38EE */ DEFINE_SFX(NA_SE_EN_PO_ROLL, 0x30, 2, 0, 0, 0) +/* 0x38EF */ DEFINE_SFX(NA_SE_EN_PO_LAUGH2, 0x38, 3, 0, 0, 0) +/* 0x38F0 */ DEFINE_SFX(NA_SE_EN_GOLON_ROLLING, 0x30, 0, 0, 0, 0) +/* 0x38F1 */ DEFINE_SFX(NA_SE_EN_GOLON_READY, 0x30, 0, 0, 0, 0) +/* 0x38F2 */ DEFINE_SFX(NA_SE_EN_GOLON_DASH, 0x34, 0, 0, 0, 0) +/* 0x38F3 */ DEFINE_SFX(NA_SE_EN_PAMET_VOICE, 0x34, 3, 0, 0, 0) +/* 0x38F4 */ DEFINE_SFX(NA_SE_EN_PAMET_ROLL, 0x30, 3, 0, 0, 0) +/* 0x38F5 */ DEFINE_SFX(NA_SE_EN_PAMET_WALK, 0x24, 0, 1, 0, 0) +/* 0x38F6 */ DEFINE_SFX(NA_SE_EN_PAMET_ROAR, 0x30, 3, 0, 0, 0) +/* 0x38F7 */ DEFINE_SFX(NA_SE_EN_PAMET_WAKEUP, 0x28, 2, 2, 0, 0) +/* 0x38F8 */ DEFINE_SFX(NA_SE_EN_PAMET_REVERSE, 0x40, 3, 0, 0, 0) +/* 0x38F9 */ DEFINE_SFX(NA_SE_EN_PAMET_DAMAGE, 0x40, 3, 0, 0, 0) +/* 0x38FA */ DEFINE_SFX(NA_SE_EN_PAMET_DEAD, 0x30, 3, 0, 0, 0) +/* 0x38FB */ DEFINE_SFX(NA_SE_EN_BAKUO_VOICE, 0x34, 3, 0, 0, 0) +/* 0x38FC */ DEFINE_SFX(NA_SE_EN_GOLON_WAKE_UP, 0x20, 3, 2, 0, 0) +/* 0x38FD */ DEFINE_SFX(NA_SE_EN_GOLON_SIT_DOWN, 0x20, 0, 0, 0, 0) +/* 0x38FE */ DEFINE_SFX(NA_SE_EN_DAIGOLON_SLEEP3, 0x30, 3, 0, 0, 0) +/* 0x38FF */ DEFINE_SFX(NA_SE_EN_CHICKEN_FLUTTER, 0x20, 0, 2, 0, 0) +/* 0x3900 */ DEFINE_SFX(NA_SE_EN_KOUME_ILL, 0x30, 3, 2, 0, 0) +/* 0x3901 */ DEFINE_SFX(NA_SE_EN_KOUME_REGAIN, 0x18, 3, 2, 0, 0) +/* 0x3902 */ DEFINE_SFX(NA_SE_EN_KOUME_DRINK, 0x34, 3, 2, 0, 0) +/* 0x3903 */ DEFINE_SFX(NA_SE_EN_KOUME_LAUGH, 0x30, 3, 2, 0, 0) +/* 0x3904 */ DEFINE_SFX(NA_SE_EN_KOUME_FLY, 0x38, 3, 0, 0, 0) +/* 0x3905 */ DEFINE_SFX(NA_SE_EN_KOUME_AWAY, 0x18, 3, 0, 0, 0) +/* 0x3906 */ DEFINE_SFX(NA_SE_EN_KOUME_MAGIC, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3907 */ DEFINE_SFX(NA_SE_EN_DAIGOLON_SLEEP2, 0x38, 3, 0, 0, 0) +/* 0x3908 */ DEFINE_SFX(NA_SE_EN_STALKIDS_JUMP, 0x30, 3, 0, 0, 0) +/* 0x3909 */ DEFINE_SFX(NA_SE_EN_STALKIDS_FADEOUT, 0x40, 3, 0, 0, 0) +/* 0x390A */ DEFINE_SFX(NA_SE_EN_STALKIDS_LAUGH, 0x40, 4, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x390B */ DEFINE_SFX(NA_SE_EN_STALKIDS_SHAKEHEAD, 0x38, 5, 0, 0, 0) +/* 0x390C */ DEFINE_SFX(NA_SE_EN_STALKIDS_ONGND, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x390D */ DEFINE_SFX(NA_SE_EN_STALKIDS_SURPRISED, 0x30, 3, 0, 0, 0) +/* 0x390E */ DEFINE_SFX(NA_SE_EN_STALKIDS_WALK, 0x30, 0, 2, 0, 0) +/* 0x390F */ DEFINE_SFX(NA_SE_EN_STALKIDS_REVERSE, 0x30, 5, 0, 0, 0) +/* 0x3910 */ DEFINE_SFX(NA_SE_EN_STALKIDS_FLOAT, 0x30, 3, 0, 0, 0) +/* 0x3911 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_EYE, 0x30, 2, 2, 0, 0) +/* 0x3912 */ DEFINE_SFX(NA_SE_EN_STALKIDS_CAUGHT, 0x30, 3, 0, 0, 0) +/* 0x3913 */ DEFINE_SFX(NA_SE_EN_STALKIDS_MASK_ON, 0x30, 5, 0, 0, 0) +/* 0x3914 */ DEFINE_SFX(NA_SE_EN_TWINROBA_CUTBODY, 0x30, 3, 0, 0, 0) +/* 0x3915 */ DEFINE_SFX(NA_SE_EN_STALKIDS_MASK_OFF, 0x30, 4, 2, 0, 0) +/* 0x3916 */ DEFINE_SFX(NA_SE_EN_STALKIDS_RIDE, 0x38, 0, 2, 0, 0) +/* 0x3917 */ DEFINE_SFX(NA_SE_EN_DEKNUTS_DANCE, 0x38, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER | SFX_FLAG_VOLUME_NO_DIST) +/* 0x3918 */ DEFINE_SFX(NA_SE_EN_DEKNUTS_DANCE1, 0x38, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER | SFX_FLAG_VOLUME_NO_DIST) +/* 0x3919 */ DEFINE_SFX(NA_SE_EN_DEKNUTS_DANCE2, 0x38, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER | SFX_FLAG_VOLUME_NO_DIST) +/* 0x391A */ DEFINE_SFX(NA_SE_EN_DEKNUTS_DANCE_BIG, 0x38, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER | SFX_FLAG_VOLUME_NO_DIST) +/* 0x391B */ DEFINE_SFX(NA_SE_EN_EYEGOLE_BEAM, 0x40, 2, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x391C */ DEFINE_SFX(NA_SE_EN_GOLON_EYE_BIG, 0x18, 3, 2, 0, 0) +/* 0x391D */ DEFINE_SFX(NA_SE_EN_GOLON_GOOD_BIG, 0x30, 3, 0, 0, 0) +/* 0x391E */ DEFINE_SFX(NA_SE_EN_STALKIDS_LAUGH_MID, 0x30, 3, 0, 0, 0) +/* 0x391F */ DEFINE_SFX(NA_SE_EN_STALKIDS_FLOAT_COPY, 0x20, 3, 0, 0, 0) +/* 0x3920 */ DEFINE_SFX(NA_SE_EN_STALKIDS_TURN, 0x24, 5, 0, 0, 0) +/* 0x3921 */ DEFINE_SFX(NA_SE_EN_STALKIDS_DAMAGE, 0x28, 3, 0, 0, 0) +/* 0x3922 */ DEFINE_SFX(NA_SE_EN_STALKIDS_SCREAM, 0x30, 3, 0, 0, 0) +/* 0x3923 */ DEFINE_SFX(NA_SE_EN_STALKIDS_OTEDAMA2, 0x30, 5, 0, 0, 0) +/* 0x3924 */ DEFINE_SFX(NA_SE_EN_STALKIDS_STRETCH, 0x30, 5, 0, 0, 0) +/* 0x3925 */ DEFINE_SFX(NA_SE_EN_STALKIDS_LAUGH_MD2, 0x30, 0, 0, 0, 0) +/* 0x3926 */ DEFINE_SFX(NA_SE_EN_OWL_FLUTTER, 0x30, 0, 0, 0, 0) +/* 0x3927 */ DEFINE_SFX(NA_SE_EN_VALVAISA_LAND, 0x30, 3, 0, 0, 0) +/* 0x3928 */ DEFINE_SFX(NA_SE_EN_IRONNACK_WALK, 0x18, 1, 0, 0, 0) +/* 0x3929 */ DEFINE_SFX(NA_SE_EN_IRONNACK_SWING_AXE, 0x34, 3, 0, 0, 0) +/* 0x392A */ DEFINE_SFX(NA_SE_EN_STALKIDS_OTEDAMA1, 0x30, 5, 0, 0, 0) +/* 0x392B */ DEFINE_SFX(NA_SE_EN_PAMET_CUTTER_ON, 0x34, 3, 0, 0, 0) +/* 0x392C */ DEFINE_SFX(NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO, 0x34, 3, 0, 0, 0) +/* 0x392D */ DEFINE_SFX(NA_SE_EN_PAMET_CUTTER_OFF, 0x34, 3, 0, 0, 0) +/* 0x392E */ DEFINE_SFX(NA_SE_EN_B_SLIME_JUMP1, 0x30, 3, 0, 0, 0) +/* 0x392F */ DEFINE_SFX(NA_SE_EN_B_SLIME_JUMP2, 0x30, 3, 0, 0, 0) +/* 0x3930 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_ATTACK, 0x30, 1, 0, 0, 0) +/* 0x3931 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_SM_WALK, 0x14, 0, 0, 0, 0) +/* 0x3932 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_SM_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3933 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_RESTORE, 0x30, 1, 0, 0, 0) +/* 0x3934 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_EXPAND, 0x30, 1, 0, 0, 0) +/* 0x3935 */ DEFINE_SFX(NA_SE_EN_KUSAMUSHI_HIDE, 0x20, 1, 0, 0, 0) +/* 0x3936 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_SM_STICK, 0x38, 3, 0, 0, 0) +/* 0x3937 */ DEFINE_SFX(NA_SE_EN_FLOORMASTER_SM_LAND, 0x30, 0, 0, 0, 0) +/* 0x3938 */ DEFINE_SFX(NA_SE_EN_B_SLIME_COMBINE, 0x40, 3, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3939 */ DEFINE_SFX(NA_SE_EN_B_SLIME_PUNCH_MOVE, 0x30, 3, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x393A */ DEFINE_SFX(NA_SE_EN_IRONNACK_ARMOR_HIT, 0x38, 3, 0, 0, 0) +/* 0x393B */ DEFINE_SFX(NA_SE_EN_CUTBODY, 0x38, 3, 0, 0, 0) +/* 0x393C */ DEFINE_SFX(NA_SE_EN_LAST1_TRANSFORM, 0x40, 3, 0, 0, 0) +/* 0x393D */ DEFINE_SFX(NA_SE_EN_LAST1_DEMO_BREAK, 0x40, 3, 2, 0, 0) +/* 0x393E */ DEFINE_SFX(NA_SE_EN_LAST1_DEMO_WALL, 0x40, 3, 2, 0, 0) +/* 0x393F */ DEFINE_SFX(NA_SE_EN_B_PAMET_BREAK, 0x40, 3, 0, 0, 0) +/* 0x3940 */ DEFINE_SFX(NA_SE_EN_KONB_DEMO_MOVE_OLD, 0x21, 3, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3941 */ DEFINE_SFX(NA_SE_EN_KONB_JUMP_OLD, 0x54, 3, 0, 0, 0) +/* 0x3942 */ DEFINE_SFX(NA_SE_EN_KONB_SINK_OLD, 0x54, 3, 0, 0, 0) +/* 0x3943 */ DEFINE_SFX(NA_SE_EN_UTSUBO_EAT, 0x54, 3, 0, 0, 0) +/* 0x3944 */ DEFINE_SFX(NA_SE_EN_YMAJIN_HOLD_SNOW, 0x34, 2, 0, 0, 0) +/* 0x3945 */ DEFINE_SFX(NA_SE_EN_KONB_DAMAGE_OLD, 0x58, 3, 0, 0, 0) +/* 0x3946 */ DEFINE_SFX(NA_SE_EN_KONB_DEAD_OLD, 0x68, 3, 0, 0, 0) +/* 0x3947 */ DEFINE_SFX(NA_SE_EN_KONB_BOUND_OLD, 0x50, 3, 3, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3948 */ DEFINE_SFX(NA_SE_EN_AWA_BOUND, 0x14, 0, 0, 0, 0) +/* 0x3949 */ DEFINE_SFX(NA_SE_EN_AWA_BREAK, 0x20, 1, 0, 0, 0) +/* 0x394A */ DEFINE_SFX(NA_SE_EN_ICEB_FOOTSTEP_OLD, 0x48, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x394B */ DEFINE_SFX(NA_SE_EN_COMMON_THUNDER, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x394C */ DEFINE_SFX(NA_SE_EN_ICEB_CRY_OLD, 0x50, 1, 0, 0, 0) +/* 0x394D */ DEFINE_SFX(NA_SE_EN_ICEB_STEAM_LONG_OLD, 0x50, 1, 0, 0, 0) +/* 0x394E */ DEFINE_SFX(NA_SE_EN_ICEB_STEAMS_DEMO_OLD, 0x50, 0, 0, 0, 0) +/* 0x394F */ DEFINE_SFX(NA_SE_EN_ICEB_STEAM_DEMO_UP_OLD, 0x50, 0, 0, 0, 0) +/* 0x3950 */ DEFINE_SFX(NA_SE_EN_ICEB_DEAD_OLD, 0x68, 3, 0, 0, 0) +/* 0x3951 */ DEFINE_SFX(NA_SE_EN_ICEB_DAMAGE_OLD, 0x58, 3, 0, 0, 0) +/* 0x3952 */ DEFINE_SFX(NA_SE_EN_KONB_INIT_OLD, 0x90, 3, 0, 0, 0) +/* 0x3953 */ DEFINE_SFX(NA_SE_EN_KONB_DEAD2_OLD, 0x48, 3, 0, 0, 0) +/* 0x3954 */ DEFINE_SFX(NA_SE_EN_PIHAT_UP, 0x28, 2, 0, 0, 0) +/* 0x3955 */ DEFINE_SFX(NA_SE_EN_PIHAT_FLY, 0x30, 0, 0, 0, 0) +/* 0x3956 */ DEFINE_SFX(NA_SE_EN_PIHAT_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3957 */ DEFINE_SFX(NA_SE_EN_PIHAT_LAND, 0x28, 2, 0, 0, 0) +/* 0x3958 */ DEFINE_SFX(NA_SE_EN_KONB_BOUND2_OLD, 0x50, 3, 0, 0, 0) +/* 0x3959 */ DEFINE_SFX(NA_SE_EN_KONB_DEAD_JUMP_OLD, 0x50, 3, 0, 0, 0) +/* 0x395A */ DEFINE_SFX(NA_SE_EN_KONB_DEAD_JUMP2_OLD, 0x50, 3, 0, 0, 0) +/* 0x395B */ DEFINE_SFX(NA_SE_EN_FROG_JUMP, 0x40, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x395C */ DEFINE_SFX(NA_SE_EN_FROG_GREET, 0x40, 3, 0, 0, 0) +/* 0x395D */ DEFINE_SFX(NA_SE_EN_FROG_HOLD_SLIME, 0x40, 3, 0, 0, 0) +/* 0x395E */ DEFINE_SFX(NA_SE_EN_FROG_THROW_SLIME, 0x40, 3, 0, 0, 0) +/* 0x395F */ DEFINE_SFX(NA_SE_EN_FROG_JUMP_MID, 0x40, 3, 0, 0, 0) +/* 0x3960 */ DEFINE_SFX(NA_SE_EN_KONB_BITE_OLD, 0x54, 3, 0, 0, 0) +/* 0x3961 */ DEFINE_SFX(NA_SE_EN_FROG_PUNCH1, 0x40, 3, 0, 0, 0) +/* 0x3962 */ DEFINE_SFX(NA_SE_EN_FROG_PUNCH2, 0x40, 3, 0, 0, 0) +/* 0x3963 */ DEFINE_SFX(NA_SE_EN_UTSUBO_APPEAR_TRG, 0x48, 3, 0, 0, 0) +/* 0x3964 */ DEFINE_SFX(NA_SE_EN_FROG_DOWN, 0x48, 3, 0, 0, 0) +/* 0x3965 */ DEFINE_SFX(NA_SE_EN_FROG_JUMP_ABOVE, 0x48, 3, 0, 0, 0) +/* 0x3966 */ DEFINE_SFX(NA_SE_EN_FROG_KICK, 0x40, 3, 0, 0, 0) +/* 0x3967 */ DEFINE_SFX(NA_SE_EN_YMAJIN_MINI_HOLD, 0x34, 2, 0, 0, 0) +/* 0x3968 */ DEFINE_SFX(NA_SE_EN_YMAJIN_MINI_THROW, 0x34, 2, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3969 */ DEFINE_SFX(NA_SE_EN_YMAJIN_MOVE, 0x28, 2, 0, 0, 0) +/* 0x396A */ DEFINE_SFX(NA_SE_EN_YMAJIN_MINI_MOVE, 0x28, 2, 0, 0, 0) +/* 0x396B */ DEFINE_SFX(NA_SE_EN_YMAJIN_SURFACE, 0x30, 2, 0, 0, 0) +/* 0x396C */ DEFINE_SFX(NA_SE_EN_YMAJIN_HIDE, 0x30, 2, 0, 0, 0) +/* 0x396D */ DEFINE_SFX(NA_SE_EN_YMAJIN_SPLIT, 0x38, 2, 0, 0, 0) +/* 0x396E */ DEFINE_SFX(NA_SE_EN_YMAJIN_UNITE, 0x38, 2, 0, 0, 0) +/* 0x396F */ DEFINE_SFX(NA_SE_EN_YMAJIN_DEAD_BREAK, 0x48, 2, 0, 0, 0) +/* 0x3970 */ DEFINE_SFX(NA_SE_EN_BIMOS_ROLL_HEAD, 0x10, 0, 0, 0, 0) +/* 0x3971 */ DEFINE_SFX(NA_SE_EN_BIMOS_LAZER, 0x34, 0, 0, 0, 0) +/* 0x3972 */ DEFINE_SFX(NA_SE_EN_BIMOS_LAZER_GND, 0x18, 0, 0, 0, 0) +/* 0x3973 */ DEFINE_SFX(NA_SE_EN_BIMOS_AIM, 0x30, 0, 0, 0, 0) +/* 0x3974 */ DEFINE_SFX(NA_SE_EN_BUBLEWALK_WALK, 0x14, 0, 0, 0, 0) +/* 0x3975 */ DEFINE_SFX(NA_SE_EN_BUBLEWALK_AIM, 0x34, 0, 0, 0, 0) +/* 0x3976 */ DEFINE_SFX(NA_SE_EN_BUBLEWALK_REVERSE, 0x28, 1, 0, 0, 0) +/* 0x3977 */ DEFINE_SFX(NA_SE_EN_BUBLEWALK_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3978 */ DEFINE_SFX(NA_SE_EN_BUBLEWALK_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3979 */ DEFINE_SFX(NA_SE_EN_HIPLOOP_RUN, 0x30, 1, 0, 0, 0) +/* 0x397A */ DEFINE_SFX(NA_SE_EN_HIPLOOP_PAUSE, 0x38, 1, 0, 0, 0) +/* 0x397B */ DEFINE_SFX(NA_SE_EN_HIPLOOP_MASC_OFF, 0x36, 1, 0, 0, 0) +/* 0x397C */ DEFINE_SFX(NA_SE_EN_HIPLOOP_FOOT, 0x34, 1, 0, 0, 0) +/* 0x397D */ DEFINE_SFX(NA_SE_EN_HIPLOOP_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x397E */ DEFINE_SFX(NA_SE_EN_HIPLOOP_DEAD, 0x48, 1, 0, 0, 0) +/* 0x397F */ DEFINE_SFX(NA_SE_EN_HIPLOOP_FOOTSTEP, 0x30, 1, 0, 0, 0) +/* 0x3980 */ DEFINE_SFX(NA_SE_EN_DEKUHIME_WALK, 0x38, 3, 2, 0, 0) +/* 0x3981 */ DEFINE_SFX(NA_SE_EN_DEKUHIME_TURN, 0x30, 3, 0, 0, 0) +/* 0x3982 */ DEFINE_SFX(NA_SE_EN_DEKUHIME_GREET, 0x20, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3983 */ DEFINE_SFX(NA_SE_EN_DEKUHIME_GREET2, 0x30, 3, 0, 0, 0) +/* 0x3984 */ DEFINE_SFX(NA_SE_EN_PIHAT_SM_FLY, 0x30, 0, 0, 0, 0) +/* 0x3985 */ DEFINE_SFX(NA_SE_EN_PIHAT_SM_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3986 */ DEFINE_SFX(NA_SE_EN_STALKID_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x3987 */ DEFINE_SFX(NA_SE_EN_AKINDONUTS_HIDE, 0x20, 0, 0, 0, 0) +/* 0x3988 */ DEFINE_SFX(NA_SE_EN_RIVA_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3989 */ DEFINE_SFX(NA_SE_EN_RIVA_DEAD, 0x40, 1, 0, 0, 0) +/* 0x398A */ DEFINE_SFX(NA_SE_EN_RIVA_MOVE, 0x30, 0, 0, 0, 0) +/* 0x398B */ DEFINE_SFX(NA_SE_EN_DEKUHIME_VOICE_SAD, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x398C */ DEFINE_SFX(NA_SE_EN_DEKUHIME_VOICE_JOY, 0x30, 3, 0, 0, 0) +/* 0x398D */ DEFINE_SFX(NA_SE_EN_NUTS_JUMP, 0x30, 2, 0, 0, 0) +/* 0x398E */ DEFINE_SFX(NA_SE_EN_NUTS_CLOTHES, 0x30, 3, 0, 0, 0) +/* 0x398F */ DEFINE_SFX(NA_SE_EN_SITSUJI_VOICE, 0x30, 3, 0, 0, 0) +/* 0x3990 */ DEFINE_SFX(NA_SE_EN_LIKE_WALK, 0x18, 0, 0, 0, 0) +/* 0x3991 */ DEFINE_SFX(NA_SE_EN_LIKE_UNARI, 0x28, 0, 0, 0, 0) +/* 0x3992 */ DEFINE_SFX(NA_SE_EN_SUISEN_DRINK, 0x34, 2, 0, 0, 0) +/* 0x3993 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_DEMO_EYE, 0x34, 2, 0, 0, 0) +/* 0x3994 */ DEFINE_SFX(NA_SE_EN_SUISEN_THROW, 0x34, 0, 0, 0, 0) +/* 0x3995 */ DEFINE_SFX(NA_SE_EN_LIKE_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x3996 */ DEFINE_SFX(NA_SE_EN_LIKE_DEAD, 0x40, 1, 0, 0, 0) +/* 0x3997 */ DEFINE_SFX(NA_SE_EN_MGANON_SWORD, 0x30, 3, 0, 0, 0) +/* 0x3998 */ DEFINE_SFX(NA_SE_EN_PIRATE_ATTACK, 0x30, 2, 0, 0, 0) +/* 0x3999 */ DEFINE_SFX(NA_SE_EN_PIRATE_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x399A */ DEFINE_SFX(NA_SE_EN_PIRATE_DEAD, 0x48, 0, 0, 0, 0) +/* 0x399B */ DEFINE_SFX(NA_SE_EN_MB_MOTH_FLY, 0x28, 4, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x399C */ DEFINE_SFX(NA_SE_EN_MB_MOTH_DEAD, 0x48, 4, 0, 0, 0) +/* 0x399D */ DEFINE_SFX(NA_SE_EN_MB_INSECT_WALK, 0x20, 4, 0, 0, 0) +/* 0x399E */ DEFINE_SFX(NA_SE_EN_B_PAMET_ROLL, 0x25, 3, 0, 0, 0) +/* 0x399F */ DEFINE_SFX(NA_SE_EN_FROG_VOICE1, 0x40, 2, 0, 0, 0) +/* 0x39A0 */ DEFINE_SFX(NA_SE_EN_GERUDOFT_WALK, 0x18, 0, 2, 0, 0) +/* 0x39A1 */ DEFINE_SFX(NA_SE_EN_FROG_VOICE2, 0x44, 3, 0, 0, 0) +/* 0x39A2 */ DEFINE_SFX(NA_SE_EN_B_PAMET_VOICE, 0x44, 0, 0, 0, 0) +/* 0x39A3 */ DEFINE_SFX(NA_SE_EN_B_PAMET_REVERSE, 0x18, 0, 0, 0, 0) +/* 0x39A4 */ DEFINE_SFX(NA_SE_EN_FREEZAD_BREATH, 0x30, 0, 0, 0, 0) +/* 0x39A5 */ DEFINE_SFX(NA_SE_EN_FREEZAD_DAMAGE, 0x38, 1, 0, 0, 0) +/* 0x39A6 */ DEFINE_SFX(NA_SE_EN_FREEZAD_DEAD, 0x40, 1, 0, 0, 0) +/* 0x39A7 */ DEFINE_SFX(NA_SE_EN_DEKUHIMA_VOICE_HURY, 0x18, 3, 0, 0, 0) +/* 0x39A8 */ DEFINE_SFX(NA_SE_EN_KINGNUTS_VOICE, 0x30, 3, 0, 0, 0) +/* 0x39A9 */ DEFINE_SFX(NA_SE_EN_FROG_RUNAWAY, 0x38, 3, 1, 0, 0) +/* 0x39AA */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_DEAD1_OLD, 0x30, 3, 0, 0, 0) +/* 0x39AB */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_DEAD2_OLD, 0x30, 3, 0, 0, 0) +/* 0x39AC */ DEFINE_SFX(NA_SE_EN_FROG_RUNAWAY2, 0x30, 3, 0, 0, 0) +/* 0x39AD */ DEFINE_SFX(NA_SE_EN_DAIGOLON_SLEEP1, 0x36, 3, 0, 0, 0) +/* 0x39AE */ DEFINE_SFX(NA_SE_EN_IRONNACK_HIT_GND, 0x34, 3, 0, 0, 0) +/* 0x39AF */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_WIND1_OLD, 0x34, 2, 2, 0, 0) +/* 0x39B0 */ DEFINE_SFX(NA_SE_EN_TWINROBA_LAUGH, 0x58, 3, 0, 0, 0) +/* 0x39B1 */ DEFINE_SFX(NA_SE_EN_TWINROBA_LAUGH2, 0x68, 3, 0, 0, 0) +/* 0x39B2 */ DEFINE_SFX(NA_SE_EN_IRONNACK_PULLOUT, 0x30, 3, 0, 0, 0) +/* 0x39B3 */ DEFINE_SFX(NA_SE_EN_TWINROBA_SHOOT_VOICE, 0x30, 3, 0, 0, 0) +/* 0x39B4 */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_WIND2_OLD, 0x34, 2, 0, 0, 0) +/* 0x39B5 */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_WIND3_OLD, 0x34, 3, 0, 0, 0) +/* 0x39B6 */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_LIGHTS_OLD, 0x40, 0, 0, 0, 0) +/* 0x39B7 */ DEFINE_SFX(NA_SE_EN_PIRATE_BREATH, 0x30, 3, 0, 0, 0) +/* 0x39B8 */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_ROD, 0x40, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x39B9 */ DEFINE_SFX(NA_SE_EN_LAST2_SHOUT, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x39BA */ DEFINE_SFX(NA_SE_EN_LAST2_PUMP_UP_OLD, 0x30, 0, 3, 0, 0) +/* 0x39BB */ DEFINE_SFX(NA_SE_EN_LAST2_GROW_HEAD_OLD, 0x30, 0, 3, 0, 0) +/* 0x39BC */ DEFINE_SFX(NA_SE_EN_LAST2_HEARTBEAT_OLD, 0x40, 0, 0, 0, 0) +/* 0x39BD */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_MOVING, 0x30, 3, 0, 0, 0) +/* 0x39BE */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_DASH_2, 0x28, 3, 0, 0, 0) +/* 0x39BF */ DEFINE_SFX(NA_SE_EN_LAST3_DEAD_FLOAT, 0x40, 3, 0, 0, 0) +/* 0x39C0 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_CRYING, 0x40, 3, 0, 0, 0) +/* 0x39C1 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_SKIP, 0x30, 3, 0, 0, 0) +/* 0x39C2 */ DEFINE_SFX(NA_SE_EN_STALTURA_APPEAR, 0x30, 3, 0, 0, 0) +/* 0x39C3 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_JUMP, 0x30, 3, 0, 0, 0) +/* 0x39C4 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_FALL, 0x30, 3, 0, 0, 0) +/* 0x39C5 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_DAMAGE, 0x38, 3, 0, 0, 0) +/* 0x39C6 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_DEAD, 0x48, 3, 0, 0, 0) +/* 0x39C7 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_SWORD, 0x20, 3, 0, 0, 0) +/* 0x39C8 */ DEFINE_SFX(NA_SE_EN_BAKUO_DEAD, 0x48, 3, 0, 0, 0) +/* 0x39C9 */ DEFINE_SFX(NA_SE_EN_BAKUO_APPEAR, 0x36, 3, 0, 0, 0) +/* 0x39CA */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_WIND_OLD, 0x30, 3, 0, 0, 0) +/* 0x39CB */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_FLOOR_OLD, 0x30, 3, 0, 0, 0) +/* 0x39CC */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_DANCE_OLD, 0x38, 3, 0, 0, 0) +/* 0x39CD */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_HOP_OLD, 0x38, 3, 0, 0, 0) +/* 0x39CE */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_HOP2_OLD, 0x20, 3, 0, 0, 0) +/* 0x39CF */ DEFINE_SFX(NA_SE_EN_GANON_RESTORE, 0x30, 3, 0, 0, 0) +/* 0x39D0 */ DEFINE_SFX(NA_SE_EN_GOLON_CIRCLE, 0x44, 3, 0, 0, 0) +/* 0x39D1 */ DEFINE_SFX(NA_SE_EN_GOLON_CIRCLE_OFF, 0x30, 3, 2, 0, 0) +/* 0x39D2 */ DEFINE_SFX(NA_SE_EN_LAST1_BLOW_OLD, 0x30, 3, 0, 0, 0) +/* 0x39D3 */ DEFINE_SFX(NA_SE_EN_LAST1_BEAM_OLD, 0x30, 3, 0, 0, 0) +/* 0x39D4 */ DEFINE_SFX(NA_SE_EN_LAST1_ATTACK_OLD, 0x34, 3, 0, 0, 0) +/* 0x39D5 */ DEFINE_SFX(NA_SE_EN_LAST1_DAMAGE1_OLD, 0x30, 3, 0, 0, 0) +/* 0x39D6 */ DEFINE_SFX(NA_SE_EN_LAST1_DAMAGE2_OLD, 0x30, 3, 0, 0, 0) +/* 0x39D7 */ DEFINE_SFX(NA_SE_EN_LAST1_FALL_OLD, 0x20, 2, 0, 0, 0) +/* 0x39D8 */ DEFINE_SFX(NA_SE_EN_MGANON_STAND, 0x34, 3, 0, 0, 0) +/* 0x39D9 */ DEFINE_SFX(NA_SE_EN_LAST2_FIRE_OLD, 0x20, 3, 2, 0, 0) +/* 0x39DA */ DEFINE_SFX(NA_SE_EN_STALGOLD_ROLL, 0x30, 4, 0, 0, 0) +/* 0x39DB */ DEFINE_SFX(NA_SE_EN_LAST2_WALK_OLD, 0x30, 2, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x39DC */ DEFINE_SFX(NA_SE_EN_LAST2_WAIT_OLD, 0x40, 2, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x39DD */ DEFINE_SFX(NA_SE_EN_LAST2_JUMP_OLD, 0x40, 3, 2, 0, 0) +/* 0x39DE */ DEFINE_SFX(NA_SE_EN_LAST2_BIRD_OLD, 0x30, 2, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x39DF */ DEFINE_SFX(NA_SE_EN_LAST2_BIRD2_OLD, 0x30, 2, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x39E0 */ DEFINE_SFX(NA_SE_EN_STALTU_WAVE, 0x30, 0, 0, 0, 0) +/* 0x39E1 */ DEFINE_SFX(NA_SE_EN_STALTU_DOWN_SET, 0x30, 0, 0, 0, 0) +/* 0x39E2 */ DEFINE_SFX(NA_SE_EN_DEKU_WAKEUP, 0x30, 1, 0, 0, 0) +/* 0x39E3 */ DEFINE_SFX(NA_SE_EN_LAST2_WALK2_OLD, 0x32, 2, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x39E4 */ DEFINE_SFX(NA_SE_EN_LAST1_FLOAT_OLD, 0x32, 3, 0, 0, 0) +/* 0x39E5 */ DEFINE_SFX(NA_SE_EN_LAST1_ATTACK_2ND_OLD, 0x54, 1, 0, 0, 0) +/* 0x39E6 */ DEFINE_SFX(NA_SE_EN_LAST1_ROLLING_OLD, 0x52, 0, 0, 0, 0) +/* 0x39E7 */ DEFINE_SFX(NA_SE_EN_LAST3_GET_LINK_OLD, 0x54, 3, 0, 0, 0) +/* 0x39E8 */ DEFINE_SFX(NA_SE_EN_PO_BIG_CRY, 0x30, 0, 0, 0, 0) +/* 0x39E9 */ DEFINE_SFX(NA_SE_EN_STALTURA_BOUND, 0x08, 1, 0, 0, 0) +/* 0x39EA */ DEFINE_SFX(NA_SE_EN_STALGOLD_UP_CRY, 0x30, 1, 0, 0, 0) +/* 0x39EB */ DEFINE_SFX(NA_SE_EN_GOLON_CRY, 0x30, 3, 0, 0, 0) +/* 0x39EC */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_SOFT, 0x54, 3, 0, 0, 0) +/* 0x39ED */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_MID_OLD, 0x54, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x39EE */ DEFINE_SFX(NA_SE_EN_RIVA_BIG_APPEAR, 0x34, 3, 0, 0, 0) +/* 0x39EF */ DEFINE_SFX(NA_SE_EN_LAST3_ROD_HARD, 0x54, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x39F0 */ DEFINE_SFX(NA_SE_EN_MUSI_WALK, 0x08, 0, 0, 0, 0) +/* 0x39F1 */ DEFINE_SFX(NA_SE_EN_LAST3_COIL_ATTACK_OLD, 0x54, 0, 0, 0, 0) +/* 0x39F2 */ DEFINE_SFX(NA_SE_EN_STALWALL_LAUGH, 0x34, 0, 0, 0, 0) +/* 0x39F3 */ DEFINE_SFX(NA_SE_EN_PIRANHA_EXIST, 0x15, 0, 0, 0, 0) +/* 0x39F4 */ DEFINE_SFX(NA_SE_EN_PIRANHA_ATTACK, 0x35, 0, 0, 0, 0) +/* 0x39F5 */ DEFINE_SFX(NA_SE_EN_PIRANHA_DEAD, 0x48, 0, 0, 0, 0) +/* 0x39F6 */ DEFINE_SFX(NA_SE_EN_KINGNUTS_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x39F7 */ DEFINE_SFX(NA_SE_EN_COMMON_DEADLIGHT, 0x30, 0, 0, 0, 0) +/* 0x39F8 */ DEFINE_SFX(NA_SE_EN_GOLONKID_WALK, 0x30, 2, 3, 0, 0) +/* 0x39F9 */ DEFINE_SFX(NA_SE_EN_YMAJIN_MINI_DAMAGE, 0x38, 2, 0, 0, 0) +/* 0x39FA */ DEFINE_SFX(NA_SE_EN_YMAJIN_DAMAGE, 0x38, 2, 0, 0, 0) +/* 0x39FB */ DEFINE_SFX(NA_SE_EN_KOTAKE_SURPRISED, 0x30, 0, 2, 0, 0) +/* 0x39FC */ DEFINE_SFX(NA_SE_EN_HANDW_GET, 0x30, 0, 0, 0, 0) +/* 0x39FD */ DEFINE_SFX(NA_SE_EN_HANDW_RELEASE, 0x30, 0, 0, 0, 0) +/* 0x39FE */ DEFINE_SFX(NA_SE_EN_SLIME_SURFACE, 0x30, 0, 0, 0, 0) +/* 0x39FF */ DEFINE_SFX(NA_SE_EN_KOTAKE_SLEEP, 0x30, 0, 0, 0, 0) +/* 0x3A00 */ DEFINE_SFX(NA_SE_EN_KOTAKE_SURPRISED2, 0x30, 0, 2, SFX_FLAG2_FORCE_RESET, 0) +/* 0x3A01 */ DEFINE_SFX(NA_SE_EN_NEMURI_SLEEP, 0x30, 6, 0, SFX_FLAG2_APPLY_LOWPASS_FILTER | SFX_FLAG2_SURROUND_NO_HIGHPASS_FILTER | SFX_FLAG2_UNUSED4 | SFX_FLAG2_UNUSED2, 0) +/* 0x3A02 */ DEFINE_SFX(NA_SE_EN_LAST1_DEAD_OLD, 0x30, 0, 0, 0, 0) +/* 0x3A03 */ DEFINE_SFX(NA_SE_EN_GOLON_SIRLOIN_ROLL, 0x30, 6, 0, 0, 0) +/* 0x3A04 */ DEFINE_SFX(NA_SE_EN_GOLON_VOICE_EATFULL, 0x30, 3, 2, 0, 0) +/* 0x3A05 */ DEFINE_SFX(NA_SE_EN_GOLON_SIRLOIN_EAT, 0x30, 0, 0, 0, 0) +/* 0x3A06 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_WALK, 0x30, 2, 0, 0, 0) +/* 0x3A07 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_STAND, 0x30, 2, 0, 0, 0) +/* 0x3A08 */ DEFINE_SFX(NA_SE_EN_EYEGOLE_SIT, 0x30, 2, 0, 0, 0) +/* 0x3A09 */ DEFINE_SFX(NA_SE_EN_INVADER_DEAD, 0x48, 2, 0, 0, 0) +/* 0x3A0A */ DEFINE_SFX(NA_SE_EN_FOLLOWERS_BEAM_PRE, 0x28, 1, 0, 0, 0) +/* 0x3A0B */ DEFINE_SFX(NA_SE_EN_FOLLOWERS_BEAM, 0x36, 0, 0, 0, 0) +/* 0x3A0C */ DEFINE_SFX(NA_SE_EN_FOLLOWERS_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x3A0D */ DEFINE_SFX(NA_SE_EN_FOLLOWERS_DEAD, 0x48, 0, 0, 0, 0) +/* 0x3A0E */ DEFINE_SFX(NA_SE_EN_INBOSS_DEAD_PRE2_OLD, 0x68, 3, 0, 0, 0) +/* 0x3A0F */ DEFINE_SFX(NA_SE_EN_IKURA_JUMP1, 0x30, 3, 0, 0, 0) +/* 0x3A10 */ DEFINE_SFX(NA_SE_EN_IKURA_JUMP2, 0x30, 3, 0, 0, 0) +/* 0x3A11 */ DEFINE_SFX(NA_SE_EN_IKURA_DAMAGE, 0x38, 3, 0, 0, 0) +/* 0x3A12 */ DEFINE_SFX(NA_SE_EN_IKURA_DEAD, 0x48, 3, 0, 0, 0) +/* 0x3A13 */ DEFINE_SFX(NA_SE_EN_ME_DAMAGE, 0x58, 3, 0, 0, 0) +/* 0x3A14 */ DEFINE_SFX(NA_SE_EN_ME_DEAD, 0x68, 3, 0, 0, 0) +/* 0x3A15 */ DEFINE_SFX(NA_SE_EN_ME_EXIST, 0x29, 3, 0, 0, 0) +/* 0x3A16 */ DEFINE_SFX(NA_SE_EN_ME_ATTACK, 0x54, 3, 0, 0, 0) +/* 0x3A17 */ DEFINE_SFX(NA_SE_EN_GOLONKID_SOB_TALK, 0x30, 0, 0, 0, 0) +/* 0x3A18 */ DEFINE_SFX(NA_SE_EN_GOLONKID_YAWN, 0x30, 0, 0, 0, 0) +/* 0x3A19 */ DEFINE_SFX(NA_SE_EN_GOLONKID_SNORE, 0x30, 0, 1, 0, 0) +/* 0x3A1A */ DEFINE_SFX(NA_SE_EN_GOLON_SNORE1, 0x30, 0, 1, 0, 0) +/* 0x3A1B */ DEFINE_SFX(NA_SE_EN_GOLON_SNORE2, 0x30, 0, 1, 0, 0) +/* 0x3A1C */ DEFINE_SFX(NA_SE_EN_BUBLEFALL_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x3A1D */ DEFINE_SFX(NA_SE_EN_INBOSS_DEAD_OLD, 0x68, 3, 0, 0, 0) +/* 0x3A1E */ DEFINE_SFX(NA_SE_EN_LAST1_BEAM2_OLD, 0x30, 0, 0, 0, 0) +/* 0x3A1F */ DEFINE_SFX(NA_SE_EN_COMMON_EXTINCT_LEV, 0x45, 2, 0, 0, 0) +/* 0x3A20 */ DEFINE_SFX(NA_SE_EN_BOSU_HEAD_MID, 0x40, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A21 */ DEFINE_SFX(NA_SE_EN_BOSU_HEAD_SHORT, 0x40, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A22 */ DEFINE_SFX(NA_SE_EN_DEBU_HEAD_MID, 0x30, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A23 */ DEFINE_SFX(NA_SE_EN_DEBU_HEAD_SHORT, 0x30, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A24 */ DEFINE_SFX(NA_SE_EN_YASE_HEAD_MID, 0x30, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A25 */ DEFINE_SFX(NA_SE_EN_YASE_HEAD_SHORT, 0x30, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A26 */ DEFINE_SFX(NA_SE_EN_BOSU_WALK, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A27 */ DEFINE_SFX(NA_SE_EN_DEBU_WALK, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A28 */ DEFINE_SFX(NA_SE_EN_YASE_WALK, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A29 */ DEFINE_SFX(NA_SE_EN_BOSU_SIT, 0x50, 3, 0, 0, 0) +/* 0x3A2A */ DEFINE_SFX(NA_SE_EN_BOSU_STAND, 0x30, 3, 0, 0, 0) +/* 0x3A2B */ DEFINE_SFX(NA_SE_EN_BOSU_HAND, 0x30, 3, 0, 0, 0) +/* 0x3A2C */ DEFINE_SFX(NA_SE_EN_LAST3_KOMA_OLD, 0x10, 0, 0, 0, 0) +/* 0x3A2D */ DEFINE_SFX(NA_SE_EN_KONB_PREATTACK_OLD, 0x54, 3, 0, 0, 0) +/* 0x3A2E */ DEFINE_SFX(NA_SE_EN_BOSU_SHOCK, 0x50, 3, 0, 0, 0) +/* 0x3A2F */ DEFINE_SFX(NA_SE_EN_BOSU_SHIT, 0x50, 3, 0, 0, 0) +/* 0x3A30 */ DEFINE_SFX(NA_SE_EN_BOSU_ATTACK, 0x54, 3, 1, 0, 0) +/* 0x3A31 */ DEFINE_SFX(NA_SE_EN_BOSU_CYNICAL, 0x50, 3, 1, 0, 0) +/* 0x3A32 */ DEFINE_SFX(NA_SE_EN_BOSU_LAUGH, 0x50, 3, 1, 0, 0) +/* 0x3A33 */ DEFINE_SFX(NA_SE_EN_BOSU_LAUGH_DEMO, 0x50, 3, 1, 0, 0) +/* 0x3A34 */ DEFINE_SFX(NA_SE_EN_DEBU_ATTACK, 0x36, 3, 1, 0, 0) +/* 0x3A35 */ DEFINE_SFX(NA_SE_EN_DEBU_LAUGH, 0x34, 3, 1, 0, 0) +/* 0x3A36 */ DEFINE_SFX(NA_SE_EN_DEBU_PAUSE, 0x34, 3, 2, 0, 0) +/* 0x3A37 */ DEFINE_SFX(NA_SE_EN_YASE_ATTACK, 0x36, 3, 1, 0, 0) +/* 0x3A38 */ DEFINE_SFX(NA_SE_EN_YASE_LAUGH, 0x35, 3, 1, 0, 0) +/* 0x3A39 */ DEFINE_SFX(NA_SE_EN_YASE_PAUSE, 0x34, 3, 2, 0, 0) +/* 0x3A3A */ DEFINE_SFX(NA_SE_EN_BOSU_DAMAGE, 0x58, 3, 1, 0, 0) +/* 0x3A3B */ DEFINE_SFX(NA_SE_EN_DEBU_DAMAGE, 0x68, 3, 1, 0, 0) +/* 0x3A3C */ DEFINE_SFX(NA_SE_EN_YASE_DAMAGE, 0x38, 3, 1, 0, 0) +/* 0x3A3D */ DEFINE_SFX(NA_SE_EN_BOSU_DEAD, 0x48, 3, 1, 0, 0) +/* 0x3A3E */ DEFINE_SFX(NA_SE_EN_DEBU_DEAD, 0x38, 3, 1, 0, 0) +/* 0x3A3F */ DEFINE_SFX(NA_SE_EN_YASE_DEAD, 0x48, 3, 1, 0, 0) +/* 0x3A40 */ DEFINE_SFX(NA_SE_EN_DEBU_PAUSE_K, 0x34, 3, 2, 0, 0) +/* 0x3A41 */ DEFINE_SFX(NA_SE_EN_DEBU_LAUGH_SHORT_K, 0x34, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A42 */ DEFINE_SFX(NA_SE_EN_DEBU_LAUGH_K, 0x34, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A43 */ DEFINE_SFX(NA_SE_EN_YASE_PAUSE_K, 0x34, 3, 2, 0, 0) +/* 0x3A44 */ DEFINE_SFX(NA_SE_EN_YASE_LAUGH_K, 0x34, 3, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A45 */ DEFINE_SFX(NA_SE_EN_BOSU_LAUGH_DEMO_K, 0x50, 3, 1, 0, 0) +/* 0x3A46 */ DEFINE_SFX(NA_SE_EN_DEBU_LAUGH_SHORT, 0x34, 3, 1, 0, 0) +/* 0x3A47 */ DEFINE_SFX(NA_SE_EN_BOSU_LAUGH_K, 0x50, 3, 1, 0, 0) +/* 0x3A48 */ DEFINE_SFX(NA_SE_EN_DEBU_ATTACK_W, 0x36, 3, 1, 0, 0) +/* 0x3A49 */ DEFINE_SFX(NA_SE_EN_YASE_ATTACK_W, 0x36, 3, 1, 0, 0) +/* 0x3A4A */ DEFINE_SFX(NA_SE_EN_BOSU_ATTACK_W, 0x34, 3, 1, 0, 0) +/* 0x3A4B */ DEFINE_SFX(NA_SE_EN_STAL_FREEZE_LIGHTS, 0x37, 3, 0, 0, 0) +/* 0x3A4C */ DEFINE_SFX(NA_SE_EN_BOSU_ATTACK_K, 0x54, 3, 1, 0, 0) +/* 0x3A4D */ DEFINE_SFX(NA_SE_EN_BOSU_SWORD, 0x40, 3, 0, 0, 0) +/* 0x3A4E */ DEFINE_SFX(NA_SE_EN_KONB_JUMP_LEV_OLD, 0x40, 3, 0, 0, 0) +/* 0x3A4F */ DEFINE_SFX(NA_SE_EN_MIBOSS_FREEZE_OLD, 0x57, 3, 0, 0, 0) +/* 0x3A50 */ DEFINE_SFX(NA_SE_EN_YMAJIN_THROW, 0x34, 2, 0, 0, 0) +/* 0x3A51 */ DEFINE_SFX(NA_SE_EN_BOSU_HEAD_BITE, 0x40, 0, 0, 0, 0) +/* 0x3A52 */ DEFINE_SFX(NA_SE_EN_BOSU_HEAD_FLOAT, 0x32, 0, 0, 0, 0) +/* 0x3A53 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_KICK_OLD, 0x50, 3, 2, 0, 0) +/* 0x3A54 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_KOMA_OLD, 0x50, 3, 2, 0, 0) +/* 0x3A55 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_ROD_OLD, 0x50, 3, 2, 0, 0) +/* 0x3A56 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_THROW_OLD, 0x50, 3, 2, 0, 0) +/* 0x3A57 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_LAUGH_OLD, 0x50, 3, 2, 0, 0) +/* 0x3A58 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_DAMAGE_OLD, 0x58, 3, 2, 0, 0) +/* 0x3A59 */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_DAMAGE2_OLD, 0x58, 3, 2, 0, 0) +/* 0x3A5A */ DEFINE_SFX(NA_SE_EN_LAST3_VOICE_DEAD_OLD, 0x68, 3, 0, 0, 0) +/* 0x3A5B */ DEFINE_SFX(NA_SE_EN_BOSU_DEAD_VOICE, 0x68, 3, 0, 0, 0) +/* 0x3A5C */ DEFINE_SFX(NA_SE_EN_DEBU_DEAD_VOICE, 0x48, 3, 0, 0, 0) +/* 0x3A5D */ DEFINE_SFX(NA_SE_EN_YASE_DEAD_VOICE, 0x48, 3, 0, 0, 0) +/* 0x3A5E */ DEFINE_SFX(NA_SE_EN_LAST2_BALLET_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A5F */ DEFINE_SFX(NA_SE_EN_LAST2_MOONWALK_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A60 */ DEFINE_SFX(NA_SE_EN_SHARP_FLOAT, 0x28, 4, 0, 0, 0) +/* 0x3A61 */ DEFINE_SFX(NA_SE_EN_SHARP_REACTION, 0x34, 2, 0, 0, 0) +/* 0x3A62 */ DEFINE_SFX(NA_SE_EN_REDEAD_WEAKENED1, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A63 */ DEFINE_SFX(NA_SE_EN_REDEAD_WEAKENED_L1, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A64 */ DEFINE_SFX(NA_SE_EN_REDEAD_WEAKENED2, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A65 */ DEFINE_SFX(NA_SE_EN_REDEAD_WEAKENED_L2, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A66 */ DEFINE_SFX(NA_SE_EN_PIRATE_ONGND, 0x30, 1, 0, 0, 0) +/* 0x3A67 */ DEFINE_SFX(NA_SE_EN_FOLLOWERS_STAY, 0x30, 4, 2, 0, 0) +/* 0x3A68 */ DEFINE_SFX(NA_SE_EN_LAST2_VOICE_BALLET, 0x50, 3, 0, 0, 0) +/* 0x3A69 */ DEFINE_SFX(NA_SE_EN_LAST2_VOICE_UAUOO1_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A6A */ DEFINE_SFX(NA_SE_EN_LAST2_VOICE_UAUOO2_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A6B */ DEFINE_SFX(NA_SE_EN_LAST2_VOICE_SURPRISED_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A6C */ DEFINE_SFX(NA_SE_EN_LAST2_DAMAGE_OLD, 0x58, 3, 0, 0, 0) +/* 0x3A6D */ DEFINE_SFX(NA_SE_EN_LAST2_DAMAGE2_OLD, 0x58, 3, 0, 0, 0) +/* 0x3A6E */ DEFINE_SFX(NA_SE_EN_LAST2_DEAD_OLD, 0x68, 3, 0, 0, 0) +/* 0x3A6F */ DEFINE_SFX(NA_SE_EN_LAST2_UAUOO_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A70 */ DEFINE_SFX(NA_SE_EN_LAST2_GYM_B_OLD, 0x50, 3, 0, 0, 0) +/* 0x3A71 */ DEFINE_SFX(NA_SE_EN_PIRATE_COOL_LAUGH, 0x30, 1, 0, 0, 0) +/* 0x3A72 */ DEFINE_SFX(NA_SE_EN_PIRATE_CYNICAL, 0x30, 1, 0, 0, 0) +/* 0x3A73 */ DEFINE_SFX(NA_SE_EN_PIRATE_DAMM_BREATH, 0x30, 1, 0, 0, 0) +/* 0x3A74 */ DEFINE_SFX(NA_SE_EN_PIRATE_SHOUT, 0x30, 1, 0, 0, 0) +/* 0x3A75 */ DEFINE_SFX(NA_SE_EN_STAL01_LAUGH, 0x34, 0, 2, 0, 0) +/* 0x3A76 */ DEFINE_SFX(NA_SE_EN_STAL02_LAUGH_SHORT, 0x34, 0, 0, 0, 0) +/* 0x3A77 */ DEFINE_SFX(NA_SE_EN_STAL03_LAUGH_BIG, 0x34, 0, 0, 0, 0) +/* 0x3A78 */ DEFINE_SFX(NA_SE_EN_STAL04_ANGER, 0x34, 0, 0, 0, 0) +/* 0x3A79 */ DEFINE_SFX(NA_SE_EN_STAL05_CYNICAL, 0x34, 0, 0, 0, 0) +/* 0x3A7A */ DEFINE_SFX(NA_SE_EN_STAL06_SURPRISED, 0x34, 0, 0, 0, 0) +/* 0x3A7B */ DEFINE_SFX(NA_SE_EN_STAL07_ANTONISHED, 0x34, 0, 0, 0, 0) +/* 0x3A7C */ DEFINE_SFX(NA_SE_EN_STAL08_CRY_BIG, 0x34, 0, 0, 0, 0) +/* 0x3A7D */ DEFINE_SFX(NA_SE_EN_STAL09_SCREAM, 0x34, 0, 0, 0, 0) +/* 0x3A7E */ DEFINE_SFX(NA_SE_EN_STAL10_LAUGH_SHY, 0x34, 0, 0, 0, 0) +/* 0x3A7F */ DEFINE_SFX(NA_SE_EN_STAL11_LAUGH_SHY2, 0x54, 0, 0, 0, 0) +/* 0x3A80 */ DEFINE_SFX(NA_SE_EN_STAL12_LAUGH_KIDLY, 0x34, 0, 0, 0, 0) +/* 0x3A81 */ DEFINE_SFX(NA_SE_EN_STAL20_CALL_MOON, 0x34, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3A82 */ DEFINE_SFX(NA_SE_EN_STAL20_CALL_MOON2, 0x34, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3A83 */ DEFINE_SFX(NA_SE_EN_STAL21_PSYCHO_VOICE, 0x34, 0, 0, 0, 0) +/* 0x3A84 */ DEFINE_SFX(NA_SE_EN_STALKIDS_DOWN_K, 0x30, 5, 0, 0, 0) +/* 0x3A85 */ DEFINE_SFX(NA_SE_EN_AKINDO_FLY, 0x30, 1, 0, 0, 0) +/* 0x3A86 */ DEFINE_SFX(NA_SE_EN_NPC_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x3A87 */ DEFINE_SFX(NA_SE_EN_NPC_FADEAWAY, 0x30, 0, 0, 0, 0) +/* 0x3A88 */ DEFINE_SFX(NA_SE_EN_DEBU_PAUSEx2, 0x34, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A89 */ DEFINE_SFX(NA_SE_EN_YASE_PAUSEx2, 0x34, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A8A */ DEFINE_SFX(NA_SE_EN_DEBU_HEAD_UP, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A8B */ DEFINE_SFX(NA_SE_EN_YASE_HEAD_UP, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A8C */ DEFINE_SFX(NA_SE_EN_STAL22_LAUGH_KID_L, 0x34, 0, 0, 0, 0) +/* 0x3A8D */ DEFINE_SFX(NA_SE_EN_EVIL_POWER, 0x30, 0, 0, 0, 0) +/* 0x3A8E */ DEFINE_SFX(NA_SE_NE_STAL23_COLD, 0x34, 3, 2, 0, SFX_FLAG_REVERB_NO_DIST) +/* 0x3A8F */ DEFINE_SFX(NA_SE_EN_STALKIDS_GASAGOSO, 0x30, 5, 0, 0, SFX_FLAG_REVERB_NO_DIST) +/* 0x3A90 */ DEFINE_SFX(NA_SE_EN_BOSU_TALK, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x3A91 */ DEFINE_SFX(NA_SE_EN_FAMOS_REVERSE1, 0x34, 0, 0, 0, 0) +/* 0x3A92 */ DEFINE_SFX(NA_SE_EN_FAMOS_REVERSE2, 0x34, 0, 0, 0, 0) +/* 0x3A93 */ DEFINE_SFX(NA_SE_EN_FAMOS_FLOAT, 0x30, 6, 0, 0, 0) +/* 0x3A94 */ DEFINE_SFX(NA_SE_EN_FAMOS_FLOAT_REVERSE, 0x30, 6, 0, 0, 0) +/* 0x3A95 */ DEFINE_SFX(NA_SE_EN_KOTAKE_ROLL, 0x30, 5, 0, 0, 0) +/* 0x3A96 */ DEFINE_SFX(NA_SE_EN_KOTAKE_FLY, 0x30, 6, 0, 0, 0) +/* 0x3A97 */ DEFINE_SFX(NA_SE_EN_THIEFBIRD_VOICE, 0x34, 0, 0, 0, 0) +/* 0x3A98 */ DEFINE_SFX(NA_SE_EN_THIEFBIRD_DAMAGE, 0x38, 0, 0, 0, 0) +/* 0x3A99 */ DEFINE_SFX(NA_SE_EN_THIEFBIRD_DEAD, 0x48, 0, 0, 0, 0) +/* 0x3A9A */ DEFINE_SFX(NA_SE_EN_STALKIDS_BODY, 0x30, 0, 2, 0, 0) +/* 0x3A9B */ DEFINE_SFX(NA_SE_EN_STALKIDS_BODY_LEV, 0x30, 5, 2, 0, 0) +/* 0x3A9C */ DEFINE_SFX(NA_SE_EN_BOSU_STAND_RAPID, 0x30, 0, 0, 0, 0) +/* 0x3A9D */ DEFINE_SFX(NA_SE_EN_STAL24_SCREAM2, 0x30, 0, 0, 0, 0) +/* 0x3A9E */ DEFINE_SFX(NA_SE_EN_STALKIDS_EARTHQUAKE, 0x30, 0, 2, 0, 0) +/* 0x3A9F */ DEFINE_SFX(NA_SE_EN_MASK_FLOAT, 0x30, 0, 0, 0, 0) +/* 0x3AA0 */ DEFINE_SFX(NA_SE_EN_STALKIDS_PULLED, 0x30, 0, 0, 0, 0) +/* 0x3AA1 */ DEFINE_SFX(NA_SE_EN_KITA_SALUTE, 0x40, 2, 0, 0, 0) +/* 0x3AA2 */ DEFINE_SFX(NA_SE_EN_KTIA_WALK, 0x32, 0, 2, 0, 0) +/* 0x3AA3 */ DEFINE_SFX(NA_SE_EN_KTIA_PAUSE_K, 0x50, 2, 0, 0, 0) +/* 0x3AA4 */ DEFINE_SFX(NA_SE_EN_KITA_LAUGH_K, 0x50, 2, 0, 0, 0) +/* 0x3AA5 */ DEFINE_SFX(NA_SE_EN_KITA_DAMAGE, 0x58, 2, 0, 0, 0) +/* 0x3AA6 */ DEFINE_SFX(NA_SE_EN_KITA_DEAD, 0x68, 2, 0, 0, 0) +/* 0x3AA7 */ DEFINE_SFX(NA_SE_EN_STALBABY_LAUGH, 0x30, 0, 0, 0, 0) +/* 0x3AA8 */ DEFINE_SFX(NA_SE_EN_STALBABY_SURPRISED, 0x30, 0, 0, 0, 0) +/* 0x3AA9 */ DEFINE_SFX(NA_SE_EN_KITA_BREAK, 0x50, 2, 0, 0, 0) +/* 0x3AAA */ DEFINE_SFX(NA_SE_EN_KITA_ATTACK_W, 0x50, 2, 0, 0, 0) +/* 0x3AAB */ DEFINE_SFX(NA_SE_EN_KONB_WAIT_OLD, 0x30, 3, 0, 0, 0) +/* 0x3AAC */ DEFINE_SFX(NA_SE_EN_DEATH_SCYTHE, 0x54, 5, 0, 0, 0) +/* 0x3AAD */ DEFINE_SFX(NA_SE_EN_DEATH_ROLL, 0x28, 5, 0, 0, 0) +/* 0x3AAE */ DEFINE_SFX(NA_SE_EN_DEATH_SCYTHE_LEV, 0x78, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AAF */ DEFINE_SFX(NA_SE_EN_DEATH_SCYTHE_ONGND, 0x78, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AB0 */ DEFINE_SFX(NA_SE_EN_DEATH_VOICE, 0x50, 3, 0, 0, 0) +/* 0x3AB1 */ DEFINE_SFX(NA_SE_EN_DEATH_DAMAGE, 0x58, 3, 0, 0, 0) +/* 0x3AB2 */ DEFINE_SFX(NA_SE_EN_DEATH_DEAD, 0x68, 3, 0, 0, 0) +/* 0x3AB3 */ DEFINE_SFX(NA_SE_EN_DEATH_ATTACK, 0x54, 3, 0, 0, 0) +/* 0x3AB4 */ DEFINE_SFX(NA_SE_EN_DEATH_APPEAR, 0x40, 3, 0, 0, 0) +/* 0x3AB5 */ DEFINE_SFX(NA_SE_EN_DEATH_HEARTBREAK, 0x78, 3, 0, 0, 0) +/* 0x3AB6 */ DEFINE_SFX(NA_SE_EN_KONB_MINI_DEAD, 0x48, 0, 0, 0, 0) +/* 0x3AB7 */ DEFINE_SFX(NA_SE_EN_HALF_REDEAD_LOOP, 0x30, 3, 2, 0, 0) +/* 0x3AB8 */ DEFINE_SFX(NA_SE_EN_HALF_REDEAD_SURPRISE, 0x30, 3, 2, 0, 0) +/* 0x3AB9 */ DEFINE_SFX(NA_SE_EN_HALF_REDEAD_SCREAME, 0x30, 3, 2, 0, 0) +/* 0x3ABA */ DEFINE_SFX(NA_SE_EN_HALF_REDEAD_TRANS, 0x30, 3, 0, 0, 0) +/* 0x3ABB */ DEFINE_SFX(NA_SE_EN_GOLON_VOICE_GENERAL, 0x30, 0, 0, 0, 0) +/* 0x3ABC */ DEFINE_SFX(NA_SE_EN_IWAIGORON_EVERYBODY, 0x30, 0, 0, 0, 0) +/* 0x3ABD */ DEFINE_SFX(NA_SE_EN_IWAIGORON_SOLO, 0x30, 3, 3, 0, 0) +/* 0x3ABE */ DEFINE_SFX(NA_SE_EN_ROMANI_WALK, 0x30, 0, 2, 0, 0) +/* 0x3ABF */ DEFINE_SFX(NA_SE_EN_MOON_SCREAM1, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC0 */ DEFINE_SFX(NA_SE_EN_MOON_SCREAM2, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC1 */ DEFINE_SFX(NA_SE_EN_MOON_SCREAM3, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC2 */ DEFINE_SFX(NA_SE_EN_MOON_SCREAM4, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC3 */ DEFINE_SFX(NA_SE_EN_STALKIDS_HEADACHE, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC4 */ DEFINE_SFX(NA_SE_EN_BIGNUTS_WALK, 0x30, 5, 1, 0, 0) +/* 0x3AC5 */ DEFINE_SFX(NA_SE_EN_KITA_PAUSE, 0x60, 2, 0, 0, 0) +/* 0x3AC6 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_LAUGH, 0x70, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x3AC7 */ DEFINE_SFX(NA_SE_EN__copy514, 0x30, 0, 2, 0, 0) +/* 0x3AC8 */ DEFINE_SFX(NA_SE_EN__copy515, 0x30, 0, 2, 0, 0) +/* 0x3AC9 */ DEFINE_SFX(NA_SE_EN__copy516, 0x30, 0, 2, 0, 0) +/* 0x3ACA */ DEFINE_SFX(NA_SE_EN__copy517, 0x30, 0, 2, 0, 0) +/* 0x3ACB */ DEFINE_SFX(NA_SE_EN__copy518, 0x30, 0, 2, 0, 0) +/* 0x3ACC */ DEFINE_SFX(NA_SE_EN__copy519, 0x30, 0, 2, 0, 0) +/* 0x3ACD */ DEFINE_SFX(NA_SE_EN_DALMANI_A, 0x30, 0, 2, 0, 0) +/* 0x3ACE */ DEFINE_SFX(NA_SE_EN_DALMANI_B, 0x30, 0, 2, 0, 0) +/* 0x3ACF */ DEFINE_SFX(NA_SE_EN_DALMANI_C, 0x30, 0, 2, 0, 0) +/* 0x3AD0 */ DEFINE_SFX(NA_SE_EN_DALMANI_D, 0x30, 0, 2, 0, 0) +/* 0x3AD1 */ DEFINE_SFX(NA_SE_EN__2d1, 0x30, 0, 0, 0, 0) +/* 0x3AD2 */ DEFINE_SFX(NA_SE_EN__2d2, 0x30, 0, 0, 0, 0) +/* 0x3AD3 */ DEFINE_SFX(NA_SE_EN_EVIL_POWER_PREDEMO, 0x30, 7, 0, 0, 0) +/* 0x3AD4 */ DEFINE_SFX(NA_SE_EN_KOUME_DAMAGE, 0x30, 4, 1, 0, 0) +/* 0x3AD5 */ DEFINE_SFX(NA_SE_EN_KOUME_DAMAGE2, 0x30, 4, 1, 0, 0) +/* 0x3AD6 */ DEFINE_SFX(NA_SE_EN_KONB_MINI_APPEAR, 0x30, 3, 2, 0, 0) +/* 0x3AD7 */ DEFINE_SFX(NA_SE_EN_IRONNACK_DAMAGE, 0x48, 3, 0, 0, 0) +/* 0x3AD8 */ DEFINE_SFX(NA_SE_EN_IRONNACK_DEAD, 0x58, 3, 0, 0, 0) +/* 0x3AD9 */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_ONGND, 0x30, 0, 0, 0, 0) +/* 0x3ADA */ DEFINE_SFX(NA_SE_EN_ANSATSUSYA_ROCK, 0x30, 3, 0, 0, 0) +/* 0x3ADB */ DEFINE_SFX(NA_SE_EN_REDEAD_REVERSE, 0x36, 0, 0, 0, 0) +/* 0x3ADC */ DEFINE_SFX(NA_SE_EN_STALKIDS_NOSE, 0x40, 2, 0, 0, 0) +/* 0x3ADD */ DEFINE_SFX(NA_SE_EN_KITA_SNORE, 0x30, 0, 0, 0, 0) +/* 0x3ADE */ DEFINE_SFX(NA_SE_EN_IRONNACK_DASH, 0x30, 0, 0, 0, 0) +/* 0x3ADF */ DEFINE_SFX(NA_SE_EN_TUBOOCK_FLY, 0x30, 0, 0, 0, 0) diff --git a/include/tables/sfx/environmentbank_table.h b/include/tables/sfx/environmentbank_table.h new file mode 100644 index 000000000..ab7945c34 --- /dev/null +++ b/include/tables/sfx/environmentbank_table.h @@ -0,0 +1,477 @@ +/** + * Sfx Environment Bank + * + * DEFINE_SFX should be used for all sfx define in the environment bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the environment bank in sequence 0 + */ +/* 0x2800 */ DEFINE_SFX(NA_SE_EV_DOOR_OPEN, 0x70, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX | SFX_FLAG_SURROUND_LOWPASS_FILTER) +/* 0x2801 */ DEFINE_SFX(NA_SE_EV_DOOR_CLOSE, 0x80, 0, 1, 0, 0) +/* 0x2802 */ DEFINE_SFX(NA_SE_EV_EXPLOSION, 0x30, 0, 0, 0, 0) +/* 0x2803 */ DEFINE_SFX(NA_SE_EV_HORSE_WALK, 0x60, 0, 1, 0, 0) +/* 0x2804 */ DEFINE_SFX(NA_SE_EV_HORSE_RUN, 0x60, 0, 1, 0, 0) +/* 0x2805 */ DEFINE_SFX(NA_SE_EV_HORSE_NEIGH, 0x70, 0, 1, 0, 0) +/* 0x2806 */ DEFINE_SFX(NA_SE_EV_RIVER_STREAM, 0x30, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x2807 */ DEFINE_SFX(NA_SE_EV_WATER_WALL_BIG, 0x70, 2, 0, 0, 0) +/* 0x2808 */ DEFINE_SFX(NA_SE_EV_OUT_OF_WATER, 0x30, 0, 1, 0, 0) +/* 0x2809 */ DEFINE_SFX(NA_SE_EV_DIVE_WATER, 0x30, 0, 1, 0, 0) +/* 0x280A */ DEFINE_SFX(NA_SE_EV_ROCK_SLIDE, 0x80, 2, 0, 0, 0) +/* 0x280B */ DEFINE_SFX(NA_SE_EV_MAGMA_LEVEL, 0xA0, 3, 0, 0, 0) +/* 0x280C */ DEFINE_SFX(NA_SE_EV_BRIDGE_OPEN, 0x30, 3, 0, 0, SFX_FLAG_8) +/* 0x280D */ DEFINE_SFX(NA_SE_EV_BRIDGE_CLOSE, 0x30, 3, 0, 0, 0) +/* 0x280E */ DEFINE_SFX(NA_SE_EV_BRIDGE_OPEN_STOP, 0x30, 3, 0, 0, 0) +/* 0x280F */ DEFINE_SFX(NA_SE_EV_BRIDGE_CLOSE_STOP, 0x30, 3, 0, 0, 0) +/* 0x2810 */ DEFINE_SFX(NA_SE_EV_WALL_BROKEN, 0x30, 2, 0, 0, 0) +/* 0x2811 */ DEFINE_SFX(NA_SE_EV_CHICKEN_CRY_N, 0x30, 0, 1, 0, 0) +/* 0x2812 */ DEFINE_SFX(NA_SE_EV_CHICKEN_CRY_A, 0x30, 0, 1, 0, 0) +/* 0x2813 */ DEFINE_SFX(NA_SE_EV_CHICKEN_CRY_M, 0x50, 0, 0, 0, 0) +/* 0x2814 */ DEFINE_SFX(NA_SE_EV_SLIDE_DOOR_OPEN, 0x60, 2, 0, 0, 0) +/* 0x2815 */ DEFINE_SFX(NA_SE_EV_FOOT_SWITCH, 0x30, 3, 0, 0, 0) +/* 0x2816 */ DEFINE_SFX(NA_SE_EV_HORSE_GROAN, 0x60, 0, 0, 0, 0) +/* 0x2817 */ DEFINE_SFX(NA_SE_EV_BOMB_DROP_WATER, 0x30, 2, 2, 0, 0) +/* 0x2818 */ DEFINE_SFX(NA_SE_EV_HORSE_JUMP, 0x30, 0, 0, 0, 0) +/* 0x2819 */ DEFINE_SFX(NA_SE_EV_HORSE_LAND, 0x40, 0, 0, 0, 0) +/* 0x281A */ DEFINE_SFX(NA_SE_EV_HORSE_SLIP, 0x68, 0, 0, 0, 0) +/* 0x281B */ DEFINE_SFX(NA_SE_EV_WHITE_FAIRY_DASH, 0x58, 0, 1, 0, 0) +/* 0x281C */ DEFINE_SFX(NA_SE_EV_SLIDE_DOOR_CLOSE, 0x60, 0, 0, 0, 0) +/* 0x281D */ DEFINE_SFX(NA_SE_EV_BIGWALL_BOUND, 0x70, 3, 0, 0, 0) +/* 0x281E */ DEFINE_SFX(NA_SE_EV_STONE_STATUE_OPEN, 0x30, 3, 1, 0, 0) +/* 0x281F */ DEFINE_SFX(NA_SE_EV_TBOX_UNLOCK, 0x30, 0, 0, 0, 0) +/* 0x2820 */ DEFINE_SFX(NA_SE_EV_TBOX_OPEN, 0x30, 0, 0, 0, 0) +/* 0x2821 */ DEFINE_SFX(NA_SE_SY_TIMER, 0xA0, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_LOWER_VOLUME_BGM) +/* 0x2822 */ DEFINE_SFX(NA_SE_EV_FLAME_IGNITION, 0x20, 2, 0, 0, 0) +/* 0x2823 */ DEFINE_SFX(NA_SE_EV_SPEAR_HIT, 0x30, 0, 0, 0, 0) +/* 0x2824 */ DEFINE_SFX(NA_SE_EV_ELEVATOR_MOVE, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x2825 */ DEFINE_SFX(NA_SE_EV_WARP_HOLE, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST | SFX_PARAM_RAND_FREQ_SCALE) +/* 0x2826 */ DEFINE_SFX(NA_SE_EV_LINK_WARP, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x2827 */ DEFINE_SFX(NA_SE_EV_PILLAR_SINK, 0x30, 2, 0, 0, 0) +/* 0x2828 */ DEFINE_SFX(NA_SE_EV_WATER_WALL, 0x30, 0, 0, 0, 0) +/* 0x2829 */ DEFINE_SFX(NA_SE_EV_RIVER_STREAM_S, 0x30, 0, 0, 0, 0) +/* 0x282A */ DEFINE_SFX(NA_SE_EV_RIVER_STREAM_F, 0x30, 0, 0, 0, 0) +/* 0x282B */ DEFINE_SFX(NA_SE_EV_KID_HORSE_LAND2, 0x60, 0, 0, 0, 0) +/* 0x282C */ DEFINE_SFX(NA_SE_EV_KID_HORSE_SANDDUST, 0x60, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x282D */ DEFINE_SFX(NA_SE_EV_DUMMY_45, 0x30, 0, 0, 0, 0) +/* 0x282E */ DEFINE_SFX(NA_SE_EV_LIGHTNING, 0x80, 0, 0, 0, 0) +/* 0x282F */ DEFINE_SFX(NA_SE_EV_BOMB_BOUND, 0x30, 0, 2, 0, 0) +/* 0x2830 */ DEFINE_SFX(NA_SE_EV_WATERDROP, 0x30, 0, 1, 0, 0) +/* 0x2831 */ DEFINE_SFX(NA_SE_EV_TORCH, 0x10, 0, 0, 0, 0) +/* 0x2832 */ DEFINE_SFX(NA_SE_EV_MAGMA_LEVEL_M, 0xA0, 3, 0, 0, 0) +/* 0x2833 */ DEFINE_SFX(NA_SE_EV_FIRE_PILLAR, 0x30, 0, 0, 0, SFX_FLAG_8) +/* 0x2834 */ DEFINE_SFX(NA_SE_EV_FIRE_PLATE, 0x30, 0, 0, 0, SFX_FLAG_PRIORITY_NO_DIST) +/* 0x2835 */ DEFINE_SFX(NA_SE_EV_BLOCK_BOUND, 0x30, 3, 0, 0, 0) +/* 0x2836 */ DEFINE_SFX(NA_SE_EV_METALDOOR_SLIDE, 0x60, 3, 0, SFX_FLAG2_UNUSED6, 0) +/* 0x2837 */ DEFINE_SFX(NA_SE_EV_METALDOOR_STOP, 0x30, 0, 0, 0, 0) +/* 0x2838 */ DEFINE_SFX(NA_SE_EV_BLOCK_SHAKE, 0x30, 0, 0, 0, 0) +/* 0x2839 */ DEFINE_SFX(NA_SE_EV_BOX_BREAK, 0x30, 2, 0, 0, 0) +/* 0x283A */ DEFINE_SFX(NA_SE_EV_HAMMER_SWITCH, 0x30, 0, 0, 0, 0) +/* 0x283B */ DEFINE_SFX(NA_SE_EV_MAGMA_LEVEL_L, 0xA0, 3, 0, 0, 0) +/* 0x283C */ DEFINE_SFX(NA_SE_EV_SPEAR_FENCE, 0x30, 0, 0, 0, 0) +/* 0x283D */ DEFINE_SFX(NA_SE_EV_WATERDROP_GRD, 0x30, 0, 0, 0, 0) +/* 0x283E */ DEFINE_SFX(NA_SE_EV_EXPLSION_LONG, 0x30, 3, 0, 0, 0) +/* 0x283F */ DEFINE_SFX(NA_SE_EV_WATER_WALL_BIG_SILENT, 0x70, 0, 0, 0, 0) +/* 0x2840 */ DEFINE_SFX(NA_SE_EV_DESERT_WARPHOLE, 0x60, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x2841 */ DEFINE_SFX(NA_SE_EV_FOUNTAIN, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x2842 */ DEFINE_SFX(NA_SE_EV_KID_HORSE_WALK, 0x60, 0, 0, 0, 0) +/* 0x2843 */ DEFINE_SFX(NA_SE_EV_KID_HORSE_RUN, 0x60, 0, 0, 0, 0) +/* 0x2844 */ DEFINE_SFX(NA_SE_EV_KID_HORSE_NEIGH, 0x60, 0, 0, 0, 0) +/* 0x2845 */ DEFINE_SFX(NA_SE_EV_KID_HORSE_GROAN, 0x60, 0, 0, 0, 0) +/* 0x2846 */ DEFINE_SFX(NA_SE_EV_S_STONE_FLASH, 0x30, 3, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2847 */ DEFINE_SFX(NA_SE_EV_LIGHT_GATHER, 0x30, 0, 0, 0, 0) +/* 0x2848 */ DEFINE_SFX(NA_SE_EV_TREE_CUT, 0x30, 0, 0, 0, 0) +/* 0x2849 */ DEFINE_SFX(NA_SE_EV_VOLCANO, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_PRIORITY_NO_DIST) +/* 0x284A */ DEFINE_SFX(NA_SE_EV_POSTMAN_WALK, 0x30, 0, 1, 0, 0) +/* 0x284B */ DEFINE_SFX(NA_SE_EV_POSTMACHINE_HIT_OPEN, 0x60, 0, 0, 0, 0) +/* 0x284C */ DEFINE_SFX(NA_SE_EV_POSTMACHINE_OPEN, 0x60, 3, 0, 0, 0) +/* 0x284D */ DEFINE_SFX(NA_SE_EV_CHINETRAP_DOWN, 0x30, 0, 0, 0, 0) +/* 0x284E */ DEFINE_SFX(NA_SE_EV_PLANT_BROKEN, 0x58, 1, 0, 0, 0) +/* 0x284F */ DEFINE_SFX(NA_SE_EV_STONE_SWITCH_ON, 0x30, 0, 0, 0, 0) +/* 0x2850 */ DEFINE_SFX(NA_SE_EV_FLUTTER_FLAG, 0x30, 0, 0, 0, 0) +/* 0x2851 */ DEFINE_SFX(NA_SE_EV_TRAP_BOUND, 0x40, 0, 0, 0, 0) +/* 0x2852 */ DEFINE_SFX(NA_SE_EV_ROCK_BROKEN, 0x30, 3, 3, 0, 0) +/* 0x2853 */ DEFINE_SFX(NA_SE_EV_FANTOM_WARP_S2, 0x70, 2, 0, 0, 0) +/* 0x2854 */ DEFINE_SFX(NA_SE_EV_FANTOM_WARP_L2, 0x60, 2, 0, 0, 0) +/* 0x2855 */ DEFINE_SFX(NA_SE_EV_COFFIN_CAP_OPEN, 0x30, 0, 0, 0, 0) +/* 0x2856 */ DEFINE_SFX(NA_SE_EV_TRE_BOX_BOUND, 0x60, 1, 1, 0, 0) +/* 0x2857 */ DEFINE_SFX(NA_SE_EV_WIND_TRAP, 0x30, 2, 0, 0, 0) +/* 0x2858 */ DEFINE_SFX(NA_SE_EV_TRAP_OBJ_SLIDE, 0x30, 0, 0, 0, 0) +/* 0x2859 */ DEFINE_SFX(NA_SE_EV_METALDOOR_OPEN, 0x90, 3, 0, 0, 0) +/* 0x285A */ DEFINE_SFX(NA_SE_EV_METALDOOR_CLOSE, 0x90, 3, 0, 0, 0) +/* 0x285B */ DEFINE_SFX(NA_SE_EV_BURN_OUT, 0x30, 0, 0, 0, 0) +/* 0x285C */ DEFINE_SFX(NA_SE_EV_BLOCKSINK, 0x30, 2, 0, 0, 0) +/* 0x285D */ DEFINE_SFX(NA_SE_EV_CROWD, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_REVERB_NO_DIST | SFX_PARAM_RAND_FREQ_SCALE) +/* 0x285E */ DEFINE_SFX(NA_SE_EV_WATER_LEVEL_DOWN, 0x30, 0, 0, 0, 0) +/* 0x285F */ DEFINE_SFX(NA_SE_EV_NAVY_VANISH, 0x30, 0, 0, 0, 0) +/* 0x2860 */ DEFINE_SFX(NA_SE_EV_STONE_SWITCH_OFF, 0x30, 3, 0, 0, 0) +/* 0x2861 */ DEFINE_SFX(NA_SE_EV_WEB_VIBRATION, 0x30, 0, 0, 0, 0) +/* 0x2862 */ DEFINE_SFX(NA_SE_EV_ICE_STAND_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x2863 */ DEFINE_SFX(NA_SE_EV_ROLL_STAND, 0x30, 3, 0, 0, 0) +/* 0x2864 */ DEFINE_SFX(NA_SE_EV_SEESAW_WATER_BOUND, 0x30, 0, 1, 0, 0) +/* 0x2865 */ DEFINE_SFX(NA_SE_EV_SECOM_CONVEYOR, 0x30, 0, 0, 0, 0) +/* 0x2866 */ DEFINE_SFX(NA_SE_EV_WOODDOOR_OPEN, 0x30, 0, 0, 0, 0) +/* 0x2867 */ DEFINE_SFX(NA_SE_EV_METALGATE_OPEN, 0x30, 0, 0, 0, 0) +/* 0x2868 */ DEFINE_SFX(NA_SE_IT_SCOOP_UP_WATER, 0x30, 0, 0, 0, 0) +/* 0x2869 */ DEFINE_SFX(NA_SE_EV_FISH_LEAP, 0x30, 0, 0, 0, 0) +/* 0x286A */ DEFINE_SFX(NA_SE_EV_KAKASHI_SWING, 0x30, 0, 0, 0, 0) +/* 0x286B */ DEFINE_SFX(NA_SE_EV_KAKASHI_ROLL, 0x30, 0, 0, 0, 0) +/* 0x286C */ DEFINE_SFX(NA_SE_EV_BOTTLE_CAP_OPEN, 0x30, 3, 0, 0, 0) +/* 0x286D */ DEFINE_SFX(NA_SE_EV_G_STONE_CRUSH, 0x30, 3, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x286E */ DEFINE_SFX(NA_SE_EV_KAKASH_LONGI_ROLL, 0x30, 0, 0, 0, 0) +/* 0x286F */ DEFINE_SFX(NA_SE_EV_SUN_MARK_FLASH, 0x30, 3, 0, 0, 0) +/* 0x2870 */ DEFINE_SFX(NA_SE_EV_FALL_DOWN_DIRT, 0x30, 0, 0, 0, 0) +/* 0x2871 */ DEFINE_SFX(NA_SE_EV_SEESAW_BOUND, 0x30, 0, 0, 0, 0) +/* 0x2872 */ DEFINE_SFX(NA_SE_EV_FAIRY_ATTACK, 0x30, 0, 2, 0, 0) +/* 0x2873 */ DEFINE_SFX(NA_SE_EV_WOOD_HIT, 0x30, 0, 0, 0, 0) +/* 0x2874 */ DEFINE_SFX(NA_SE_EV_SCOOPUP_WATER, 0x30, 0, 0, 0, 0) +/* 0x2875 */ DEFINE_SFX(NA_SE_EV_DROP_FALL, 0x30, 0, 0, 0, 0) +/* 0x2876 */ DEFINE_SFX(NA_SE_EV_WOOD_GEAR, 0x30, 2, 0, 0, 0) +/* 0x2877 */ DEFINE_SFX(NA_SE_EV_TREE_SWING, 0x60, 0, 0, 0, 0) +/* 0x2878 */ DEFINE_SFX(NA_SE_EV_AUTO_DOOR_CLOSE, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX | SFX_FLAG_SURROUND_LOWPASS_FILTER) +/* 0x2879 */ DEFINE_SFX(NA_SE_EV_NAVY_FLY_REBIRTH, 0x30, 2, 0, 0, 0) +/* 0x287A */ DEFINE_SFX(NA_SE_EV_CHAINLIFT_STOP, 0x30, 2, 0, 0, 0) +/* 0x287B */ DEFINE_SFX(NA_SE_EV_TRE_BOX_APPEAR, 0x80, 2, 0, 0, 0) +/* 0x287C */ DEFINE_SFX(NA_SE_EV_CHAIN_KEY_UNLOCK, 0x40, 0, 0, 0, 0) +/* 0x287D */ DEFINE_SFX(NA_SE_EV_SPINE_TRAP_MOVE, 0x1C, 0, 0, 0, 0) +/* 0x287E */ DEFINE_SFX(NA_SE_EV_HEALING, 0x30, 0, 0, 0, 0) +/* 0x287F */ DEFINE_SFX(NA_SE_EV_GREAT_FAIRY_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x2880 */ DEFINE_SFX(NA_SE_EV_GREAT_FAIRY_VANISH, 0x30, 0, 0, 0, 0) +/* 0x2881 */ DEFINE_SFX(NA_SE_EV_RED_EYE, 0x30, 0, 0, 0, 0) +/* 0x2882 */ DEFINE_SFX(NA_SE_EV_ROLL_STAND_2, 0x30, 0, 0, 0, 0) +/* 0x2883 */ DEFINE_SFX(NA_SE_EV_WALL_SLIDE, 0x30, 0, 0, 0, 0) +/* 0x2884 */ DEFINE_SFX(NA_SE_EV_TRE_BOX_FLASH, 0x30, 0, 0, 0, 0) +/* 0x2885 */ DEFINE_SFX(NA_SE_EV_WINDMILL_LEVEL, 0x60, 4, 0, 0, 0) +/* 0x2886 */ DEFINE_SFX(NA_SE_EV_GOTO_HEAVEN, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x2887 */ DEFINE_SFX(NA_SE_EV_POT_BROKEN, 0x30, 0, 1, 0, 0) +/* 0x2888 */ DEFINE_SFX(NA_SE_PL_PUT_DOWN_POT, 0x30, 0, 0, 0, 0) +/* 0x2889 */ DEFINE_SFX(NA_SE_EV_DIVE_INTO_WATER, 0x60, 0, 0, 0, 0) +/* 0x288A */ DEFINE_SFX(NA_SE_EV_JUMP_OUT_WATER, 0x60, 0, 0, 0, 0) +/* 0x288B */ DEFINE_SFX(NA_SE_EV_ICE_PIECE, 0x30, 0, 0, 0, 0) +/* 0x288C */ DEFINE_SFX(NA_SE_EV_TRIFORCE, 0x30, 0, 0, 0, 0) +/* 0x288D */ DEFINE_SFX(NA_SE_EV_AURORA, 0x30, 0, 0, 0, 0) +/* 0x288E */ DEFINE_SFX(NA_SE_EV_CHIBI_FAIRY_SAVED, 0x60, 3, 0, 0, 0) +/* 0x288F */ DEFINE_SFX(NA_SE_EV_BUYOSTAND_RISING, 0x30, 3, 0, 0, 0) +/* 0x2890 */ DEFINE_SFX(NA_SE_EV_BUYOSTAND_FALL, 0x30, 3, 0, 0, 0) +/* 0x2891 */ DEFINE_SFX(NA_SE_EV_MILK_POT_BROKEN, 0x80, 0, 0, 0, 0) +/* 0x2892 */ DEFINE_SFX(NA_SE_EV_CHAIR_ROLL, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2893 */ DEFINE_SFX(NA_SE_EV_STONEDOOR_STOP, 0x30, 3, 0, 0, 0) +/* 0x2894 */ DEFINE_SFX(NA_SE_EV_S_STONE_REVIVAL, 0x30, 0, 0, 0, 0) +/* 0x2895 */ DEFINE_SFX(NA_SE_EV_WATER_TANK, 0x30, 0, 0, 0, 0) +/* 0x2896 */ DEFINE_SFX(NA_SE_EV_HUMAN_BOUND, 0x30, 0, 2, 0, 0) +/* 0x2897 */ DEFINE_SFX(NA_SE_EV_TOILET_WATER, 0x30, 0, 0, 0, 0) +/* 0x2898 */ DEFINE_SFX(NA_SE_EV_EARTHQUAKE, 0x30, 0, 0, 0, 0) +/* 0x2899 */ DEFINE_SFX(NA_SE_EV_SWEEP, 0x30, 0, 0, 0, 0) +/* 0x289A */ DEFINE_SFX(NA_SE_EV_GOD_LIGHTBALL_2, 0x30, 0, 0, 0, 0) +/* 0x289B */ DEFINE_SFX(NA_SE_EV_RUN_AROUND, 0x30, 0, 0, 0, 0) +/* 0x289C */ DEFINE_SFX(NA_SE_EV_CONSENTRATION, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x289D */ DEFINE_SFX(NA_SE_EV_TIMETRIP_LIGHT, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x289E */ DEFINE_SFX(NA_SE_EV_DOOR_BELL, 0x30, 2, 0, 0, 0) +/* 0x289F */ DEFINE_SFX(NA_SE_EV_BOUND_ON_MAGMA, 0x30, 3, 0, 0, 0) +/* 0x28A0 */ DEFINE_SFX(NA_SE_EV_HONEYCOMB_FALL, 0x30, 0, 0, 0, 0) +/* 0x28A1 */ DEFINE_SFX(NA_SE_EV_JUMP_CONC, 0x30, 0, 0, 0, 0) +/* 0x28A2 */ DEFINE_SFX(NA_SE_EV_ICE_MELT, 0x30, 0, 0, 0, 0) +/* 0x28A3 */ DEFINE_SFX(NA_SE_EV_FIRE_PILLAR_S, 0x30, 0, 0, 0, 0) +/* 0x28A4 */ DEFINE_SFX(NA_SE_EV_BLOCK_RISING, 0x20, 3, 0, 0, 0) +/* 0x28A5 */ DEFINE_SFX(NA_SE_EV_CHINCLE_SPELL_EFFECT, 0x30, 0, 0, 0, 0) +/* 0x28A6 */ DEFINE_SFX(NA_SE_EV_LINK_WARP_IN, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x28A7 */ DEFINE_SFX(NA_SE_EV_LINK_WARP_OUT, 0x30, 0, 0, 0, 0) +/* 0x28A8 */ DEFINE_SFX(NA_SE_EV_FIATY_HEAL, 0x30, 0, 0, 0, 0) +/* 0x28A9 */ DEFINE_SFX(NA_SE_EV_CHAIN_KEY_UNLOCK_B, 0x30, 0, 0, 0, 0) +/* 0x28AA */ DEFINE_SFX(NA_SE_EV_WOODBOX_BREAK, 0x70, 2, 0, 0, 0) +/* 0x28AB */ DEFINE_SFX(NA_SE_EV_PUT_DOWN_WOODBOX, 0x30, 0, 0, 0, 0) +/* 0x28AC */ DEFINE_SFX(NA_SE_EV_LAND_DIRT, 0x30, 0, 0, 0, 0) +/* 0x28AD */ DEFINE_SFX(NA_SE_EV_FLOOR_ROLLING, 0x30, 0, 0, 0, 0) +/* 0x28AE */ DEFINE_SFX(NA_SE_EV_DOG_CRY_EVENING, 0x50, 0, 0, 0, 0) +/* 0x28AF */ DEFINE_SFX(NA_SE_EV_JABJAB_HICCUP, 0x30, 0, 0, 0, 0) +/* 0x28B0 */ DEFINE_SFX(NA_SE_EV_STICK_SWING, 0x30, 0, 0, 0, 0) +/* 0x28B1 */ DEFINE_SFX(NA_SE_EV_FROG_JUMP, 0x30, 0, 0, 0, 0) +/* 0x28B2 */ DEFINE_SFX(NA_SE_EV_ICE_FREEZE, 0x30, 3, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x28B3 */ DEFINE_SFX(NA_SE_EV_BURNING, 0x20, 0, 0, 0, 0) +/* 0x28B4 */ DEFINE_SFX(NA_SE_EV_WOODPLATE_BOUND, 0x30, 0, 3, 0, 0) +/* 0x28B5 */ DEFINE_SFX(NA_SE_EV_MOON_CRY, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x28B6 */ DEFINE_SFX(NA_SE_EV_JABJAB_GROAN, 0x30, 0, 0, 0, 0) +/* 0x28B7 */ DEFINE_SFX(NA_SE_EV_WAVE_S, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x28B8 */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL, 0x30, 0, 0, 0, 0) +/* 0x28B9 */ DEFINE_SFX(NA_SE_EV_ELEVATOR_MOVE3, 0x30, 0, 0, 0, 0) +/* 0x28BA */ DEFINE_SFX(NA_SE_EV_DIAMOND_SWITCH, 0x30, 2, 0, 0, 0) +/* 0x28BB */ DEFINE_SFX(NA_SE_EV_FLAME_OF_FIRE, 0x30, 3, 0, 0, 0) +/* 0x28BC */ DEFINE_SFX(NA_SE_EV_FISH_GROW_UP, 0x30, 2, 0, 0, 0) +/* 0x28BD */ DEFINE_SFX(NA_SE_EV_FLYING_AIR, 0x30, 0, 0, 0, 0) +/* 0x28BE */ DEFINE_SFX(NA_SE_EV_PASS_AIR, 0x30, 0, 0, 0, 0) +/* 0x28BF */ DEFINE_SFX(NA_SE_EV_COME_UP_DEKU_JR, 0x30, 0, 0, 0, 0) +/* 0x28C0 */ DEFINE_SFX(NA_SE_EV_SAND_STORM, 0x30, 0, 0, 0, 0) +/* 0x28C1 */ DEFINE_SFX(NA_SE_EV_BOILED_WATER_S, 0x30, 6, 0, 0, 0) +/* 0x28C2 */ DEFINE_SFX(NA_SE_EV_GRAVE_EXPLOSION, 0xA0, 3, 0, 0, 0) +/* 0x28C3 */ DEFINE_SFX(NA_SE_EV_LURE_MOVE_W, 0x30, 0, 0, 0, 0) +/* 0x28C4 */ DEFINE_SFX(NA_SE_EV_POT_MOVE_START, 0x30, 0, 0, 0, 0) +/* 0x28C5 */ DEFINE_SFX(NA_SE_EV_DIVE_INTO_WATER_L, 0x30, 0, 0, 0, 0) +/* 0x28C6 */ DEFINE_SFX(NA_SE_EV_OUT_OF_WATER_L, 0x30, 0, 0, 0, 0) +/* 0x28C7 */ DEFINE_SFX(NA_SE_EV_BOILED_WATER_L, 0x30, 0, 0, 0, 0) +/* 0x28C8 */ DEFINE_SFX(NA_SE_EV_DIG_UP, 0x30, 0, 0, 0, 0) +/* 0x28C9 */ DEFINE_SFX(NA_SE_EV_WOOD_BOUND, 0x30, 0, 0, 0, 0) +/* 0x28CA */ DEFINE_SFX(NA_SE_EV_WATER_BUBBLE, 0x30, 0, 3, 0, 0) +/* 0x28CB */ DEFINE_SFX(NA_SE_EV_ICE_BROKEN, 0x30, 2, 0, 0, 0) +/* 0x28CC */ DEFINE_SFX(NA_SE_EV_FROG_GROW_UP, 0x30, 2, 0, 0, 0) +/* 0x28CD */ DEFINE_SFX(NA_SE_EV_WATER_CONVECTION, 0x30, 0, 0, 0, 0) +/* 0x28CE */ DEFINE_SFX(NA_SE_EV_GROUND_GATE_OPEN, 0x30, 3, 0, 0, 0) +/* 0x28CF */ DEFINE_SFX(NA_SE_EV_FACE_BREAKDOWN, 0x30, 3, 0, 0, 0) +/* 0x28D0 */ DEFINE_SFX(NA_SE_EV_TOILET_HAND_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x28D1 */ DEFINE_SFX(NA_SE_EV_TOILET_HAND_VANISH, 0x30, 3, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x28D2 */ DEFINE_SFX(NA_SE_EV_ROUND_TRAP_MOVE, 0x30, 0, 0, 0, 0) +/* 0x28D3 */ DEFINE_SFX(NA_SE_EV_HIT_SOUND, 0x30, 0, 0, 0, 0) +/* 0x28D4 */ DEFINE_SFX(NA_SE_EV_ICE_SWING, 0x30, 0, 0, 0, 0) +/* 0x28D5 */ DEFINE_SFX(NA_SE_EV_DOWN_TO_GROUND, 0x30, 0, 0, 0, 0) +/* 0x28D6 */ DEFINE_SFX(NA_SE_EV_BIG_TORTOISE_SWIM, 0x60, 3, 2, 0, 0) +/* 0x28D7 */ DEFINE_SFX(NA_SE_EV_TORTOISE_WAKE_UP, 0x80, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x28D8 */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_BARK, 0x50, 0, 0, 0, 0) +/* 0x28D9 */ DEFINE_SFX(NA_SE_EV_RUPY_FALL, 0x60, 0, 0, 0, 0) +/* 0x28DA */ DEFINE_SFX(NA_SE_EV_RAIN, 0x90, 0, 0, 0, 0) +/* 0x28DB */ DEFINE_SFX(NA_SE_EV_IRON_DOOR_OPEN, 0x30, 0, 0, 0, 0) +/* 0x28DC */ DEFINE_SFX(NA_SE_EV_IRON_DOOR_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x28DD */ DEFINE_SFX(NA_SE_EV_WHIRLPOOL, 0x30, 0, 0, 0, 0) +/* 0x28DE */ DEFINE_SFX(NA_SE_EV_BIG_TORTOISE_ROLL, 0x60, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x28DF */ DEFINE_SFX(NA_SE_EV_COW_CRY, 0x30, 0, 0, 0, 0) +/* 0x28E0 */ DEFINE_SFX(NA_SE_EV_METAL_BOX_BOUND, 0x30, 0, 0, 0, 0) +/* 0x28E1 */ DEFINE_SFX(NA_SE_EV_ELECTRIC_EXPLOSION, 0x30, 3, 0, 0, 0) +/* 0x28E2 */ DEFINE_SFX(NA_SE_EV_HEAVY_THROW, 0x30, 3, 0, 0, 0) +/* 0x28E3 */ DEFINE_SFX(NA_SE_EV_FROG_CRY_0, 0x30, 0, 0, 0, 0) +/* 0x28E4 */ DEFINE_SFX(NA_SE_EV_FROG_CRY_1, 0x30, 0, 0, 0, 0) +/* 0x28E5 */ DEFINE_SFX(NA_SE_EV_COW_CRY_LV, 0x30, 0, 0, 0, 0) +/* 0x28E6 */ DEFINE_SFX(NA_SE_EV_RONRON_DOOR_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x28E7 */ DEFINE_SFX(NA_SE_EV_BUTTERFRY_TO_FAIRY, 0x30, 0, 0, 0, 0) +/* 0x28E8 */ DEFINE_SFX(NA_SE_EV_FIVE_COUNT_LUPY, 0xA0, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x28E9 */ DEFINE_SFX(NA_SE_EV_STONE_GROW_UP, 0x30, 0, 0, 0, 0) +/* 0x28EA */ DEFINE_SFX(NA_SE_EV_STONE_LAUNCH, 0x30, 0, 0, 0, 0) +/* 0x28EB */ DEFINE_SFX(NA_SE_EV_STONE_ROLLING, 0x30, 0, 0, 0, 0) +/* 0x28EC */ DEFINE_SFX(NA_SE_EV_TOGE_STICK_ROLLING, 0x30, 2, 0, 0, 0) +/* 0x28ED */ DEFINE_SFX(NA_SE_EV_TOWER_ENERGY, 0x30, 0, 0, 0, 0) +/* 0x28EE */ DEFINE_SFX(NA_SE_EV_MOON_LIGHT_PILLAR, 0x30, 3, 0, 0, 0) +/* 0x28EF */ DEFINE_SFX(NA_SE_EV_MONKEY_WALK, 0x20, 0, 0, 0, 0) +/* 0x28F0 */ DEFINE_SFX(NA_SE_EV_KNIGHT_WALK, 0x30, 0, 0, 0, 0) +/* 0x28F1 */ DEFINE_SFX(NA_SE_EV_PILLAR_MOVE_STOP, 0x30, 0, 1, 0, 0) +/* 0x28F2 */ DEFINE_SFX(NA_SE_EV_WAVE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x28F3 */ DEFINE_SFX(NA_SE_EV_BIGBELL, 0x30, 2, 0, 0, 0) +/* 0x28F4 */ DEFINE_SFX(NA_SE_EV_NUTS_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x28F5 */ DEFINE_SFX(NA_SE_EV_SNOWBALL_BROKEN, 0x30, 2, 0, 0, 0) +/* 0x28F6 */ DEFINE_SFX(NA_SE_EV_SMALLBALL_ROLL, 0x30, 5, 0, 0, 0) +/* 0x28F7 */ DEFINE_SFX(NA_SE_EV_FLOWERPETAL_MOVE, 0x30, 0, 0, 0, 0) +/* 0x28F8 */ DEFINE_SFX(NA_SE_EV_FLOWERPETAL_STOP, 0x30, 0, 0, 0, 0) +/* 0x28F9 */ DEFINE_SFX(NA_SE_EV_FLOWER_ROLLING, 0x40, 0, 0, 0, 0) +/* 0x28FA */ DEFINE_SFX(NA_SE_EV_GLASSBROKEN_IMPACT, 0x30, 0, 0, 0, 0) +/* 0x28FB */ DEFINE_SFX(NA_SE_EV_GLASSBROKEN_BOUND, 0x30, 0, 0, 0, 0) +/* 0x28FC */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL_SR, 0x30, 5, 0, 0, 0) +/* 0x28FD */ DEFINE_SFX(NA_SE_EV_SMALL_SNOWBALL_BROKEN, 0x30, 2, 3, 0, 0) +/* 0x28FE */ DEFINE_SFX(NA_SE_EV_STATUE_VANISH, 0x30, 0, 0, 0, 0) +/* 0x28FF */ DEFINE_SFX(NA_SE_EV_BIGBALL_BOUND, 0x30, 0, 0, 0, 0) +/* 0x2900 */ DEFINE_SFX(NA_SE_EV_MONKEY_VO_WALK, 0x30, 0, 2, 0, 0) +/* 0x2901 */ DEFINE_SFX(NA_SE_EV_MONKEY_VO_JOY, 0x30, 0, 2, 0, 0) +/* 0x2902 */ DEFINE_SFX(NA_SE_EV_WALK_WATER, 0x30, 0, 0, 0, 0) +/* 0x2903 */ DEFINE_SFX(NA_SE_EV_PLATE_LIFT_LEVEL, 0x30, 2, 0, 0, 0) +/* 0x2904 */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL_2, 0x30, 0, 0, 0, 0) +/* 0x2905 */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL_SR_2, 0x30, 0, 0, 0, 0) +/* 0x2906 */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL_3, 0x30, 0, 0, 0, 0) +/* 0x2907 */ DEFINE_SFX(NA_SE_EV_BIGBALL_ROLL_SR_3, 0x30, 0, 0, 0, 0) +/* 0x2908 */ DEFINE_SFX(NA_SE_EV_BEAVER_SWIM_MOTOR, 0x68, 2, 0, 0, 0) +/* 0x2909 */ DEFINE_SFX(NA_SE_EV_BEAVER_SWIM_HAND, 0x30, 2, 0, 0, 0) +/* 0x290A */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_CRY, 0x30, 0, 1, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x290B */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_GROAN, 0x30, 0, 0, 0, 0) +/* 0x290C */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_ATK_BARK, 0x30, 0, 0, 0, 0) +/* 0x290D */ DEFINE_SFX(NA_SE_EV_ICE_PILLAR_RISING, 0x30, 2, 0, 0, 0) +/* 0x290E */ DEFINE_SFX(NA_SE_EV_ICE_PILLAR_FALL, 0x30, 2, 0, 0, 0) +/* 0x290F */ DEFINE_SFX(NA_SE_EV_GORON_CHEER, 0x30, 3, 0, 0, 0) +/* 0x2910 */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_ANG_BARK, 0x30, 0, 0, 0, 0) +/* 0x2911 */ DEFINE_SFX(NA_SE_EV_COMICAL_JUMP, 0x30, 0, 0, 0, 0) +/* 0x2912 */ DEFINE_SFX(NA_SE_EV_LIGHTNING_HARD, 0x30, 0, 0, 0, 0) +/* 0x2913 */ DEFINE_SFX(NA_SE_EV_SMALL_DOG_WHINE, 0x30, 0, 3, 0, 0) +/* 0x2914 */ DEFINE_SFX(NA_SE_EV_PANIC_IN_HOUSE, 0x80, 0, 0, 0, 0) +/* 0x2915 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_BELL, 0x30, 0, 0, 0, 0) +/* 0x2916 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_SECOND_HAND, 0x30, 2, 0, 0, 0) +/* 0x2917 */ DEFINE_SFX(NA_SE_EV_SIGNAL_BIGBELL, 0xA0, 3, 0, 0, SFX_FLAG_FREQ_NO_DIST | SFX_FLAG_VOLUME_NO_DIST) +/* 0x2918 */ DEFINE_SFX(NA_SE_EV_DUMMY_280, 0x30, 0, 0, 0, 0) +/* 0x2919 */ DEFINE_SFX(NA_SE_EV_BEAVER_VOICE_0, 0x30, 0, 0, 0, 0) +/* 0x291A */ DEFINE_SFX(NA_SE_EV_BEAVER_VOICE_1, 0x30, 0, 0, 0, 0) +/* 0x291B */ DEFINE_SFX(NA_SE_EV_WATERWHEEL_LEVEL, 0x30, 0, 2, 0, 0) +/* 0x291C */ DEFINE_SFX(NA_SE_EV_WOOD_GATE_OPEN_N, 0x30, 0, 0, 0, 0) +/* 0x291D */ DEFINE_SFX(NA_SE_EV_INVISIBLE_MONKEY, 0x30, 5, 2, 0, 0) +/* 0x291E */ DEFINE_SFX(NA_SE_EV_CRUISER, 0x30, 0, 1, 0, 0) +/* 0x291F */ DEFINE_SFX(NA_SE_EV_SECRET_CHEER, 0x30, 0, 0, 0, 0) +/* 0x2920 */ DEFINE_SFX(NA_SE_EV_BOTTLE_WATERING, 0x30, 0, 0, 0, 0) +/* 0x2921 */ DEFINE_SFX(NA_SE_EV_MONKEY_VO_SADNESS, 0x30, 0, 0, 0, 0) +/* 0x2922 */ DEFINE_SFX(NA_SE_EV_SNOWSTORM_HARD, 0x60, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2923 */ DEFINE_SFX(NA_SE_EV_UNSKILLFUL_OCARINA, 0x30, 0, 0, 0, 0) +/* 0x2924 */ DEFINE_SFX(NA_SE_EV_BLACK_FAIRY_DASH, 0x30, 0, 1, 0, 0) +/* 0x2925 */ DEFINE_SFX(NA_SE_EV_FAIRY_SURPRISE, 0x30, 0, 0, 0, 0) +/* 0x2926 */ DEFINE_SFX(NA_SE_EV_MONDO_SURPRISE, 0x30, 0, 0, 0, 0) +/* 0x2927 */ DEFINE_SFX(NA_SE_EV_SPOT_LIGHT_OPEN, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2928 */ DEFINE_SFX(NA_SE_EV_HOUSE_BROKEN, 0x30, 2, 0, 0, 0) +/* 0x2929 */ DEFINE_SFX(NA_SE_EV_MOON_FALL, 0x30, 3, 0, 0, 0) +/* 0x292A */ DEFINE_SFX(NA_SE_EV_OCARINA_BOUND_0, 0x30, 0, 0, 0, 0) +/* 0x292B */ DEFINE_SFX(NA_SE_EV_OCARINA_BOUND_1, 0x30, 0, 1, 0, 0) +/* 0x292C */ DEFINE_SFX(NA_SE_EV_BOMBERS_WALK, 0x30, 0, 1, 0, 0) +/* 0x292D */ DEFINE_SFX(NA_SE_EV_BOMBERS_LAND, 0x30, 0, 2, 0, 0) +/* 0x292E */ DEFINE_SFX(NA_SE_EV_BOMBERS_SHOT_BREATH, 0x30, 0, 0, 0, 0) +/* 0x292F */ DEFINE_SFX(NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN, 0x30, 0, 0, 0, 0) +/* 0x2930 */ DEFINE_SFX(NA_SE_EV_BOMBERS_JUMP, 0x30, 0, 0, 0, 0) +/* 0x2931 */ DEFINE_SFX(NA_SE_EV_SOLDIER_WALK, 0x30, 0, 3, 0, 0) +/* 0x2932 */ DEFINE_SFX(NA_SE_EV_ROCK_CUBE_RISING, 0x30, 0, 0, 0, 0) +/* 0x2933 */ DEFINE_SFX(NA_SE_EV_ROCK_CUBE_FALL, 0x30, 0, 0, 0, 0) +/* 0x2934 */ DEFINE_SFX(NA_SE_EV_BELL_SPIT, 0x30, 0, 0, 0, 0) +/* 0x2935 */ DEFINE_SFX(NA_SE_EV_BELL_SIGH, 0x30, 0, 0, 0, 0) +/* 0x2936 */ DEFINE_SFX(NA_SE_EV_BELL_BRAKE, 0x30, 0, 0, 0, 0) +/* 0x2937 */ DEFINE_SFX(NA_SE_EV_DOG_SWIM, 0x30, 0, 0, 0, 0) +/* 0x2938 */ DEFINE_SFX(NA_SE_EV_CHIBI_FAIRY_HEAL_ORG, 0x80, 0, 0, 0, 0) +/* 0x2939 */ DEFINE_SFX(NA_SE_EV_BOMBERS_CLIMB, 0x30, 0, 0, 0, 0) +/* 0x293A */ DEFINE_SFX(NA_SE_EV_WOODPLATE_BROKEN, 0x30, 3, 1, 0, 0) +/* 0x293B */ DEFINE_SFX(NA_SE_EV_WATER_LEVEL_DOWN_FIX, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x293C */ DEFINE_SFX(NA_SE_EV_HONEYCOMB_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x293D */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_UP, 0x30, 3, 0, 0, 0) +/* 0x293E */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_STOP, 0x30, 3, 0, 0, 0) +/* 0x293F */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_FALL, 0x30, 3, 0, 0, 0) +/* 0x2940 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_BOUND_0, 0x30, 3, 0, 0, 0) +/* 0x2941 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_BOUND_1, 0x30, 3, 0, 0, 0) +/* 0x2942 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_BOUND_2, 0x30, 3, 0, 0, 0) +/* 0x2943 */ DEFINE_SFX(NA_SE_EV_STONEDOOR_OPEN_S, 0x30, 0, 0, 0, 0) +/* 0x2944 */ DEFINE_SFX(NA_SE_EV_ICE_MELT_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x2945 */ DEFINE_SFX(NA_SE_EV_CLOCK_TOWER_STAIR_MOVE, 0x30, 3, 0, 0, 0) +/* 0x2946 */ DEFINE_SFX(NA_SE_EV_DUMMY_326, 0xA0, 0, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x2947 */ DEFINE_SFX(NA_SE_EV_OBJECT_STICK, 0x30, 3, 1, 0, 0) +/* 0x2948 */ DEFINE_SFX(NA_SE_EV_CHICK_TO_CHICKEN, 0x30, 0, 1, 0, 0) +/* 0x2949 */ DEFINE_SFX(NA_SE_EV_MUJURA_BALLOON_BROKEN, 0x60, 2, 0, 0, 0) +/* 0x294A */ DEFINE_SFX(NA_SE_EV_BALLOON_SWELL, 0x30, 0, 0, 0, 0) +/* 0x294B */ DEFINE_SFX(NA_SE_EV_SEAHORSE_OUT_BOTTLE, 0x30, 0, 0, 0, 0) +/* 0x294C */ DEFINE_SFX(NA_SE_EV_KYOJIN_VOICE_SUCCESS, 0x30, 0, 2, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x294D */ DEFINE_SFX(NA_SE_EV_KYOJIN_VOICE_FAIL, 0x30, 0, 2, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x294E */ DEFINE_SFX(NA_SE_EV_KYOJIN_WALK, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x294F */ DEFINE_SFX(NA_SE_EV_MOON_FALL_LAST, 0x30, 0, 0, 0, 0) +/* 0x2950 */ DEFINE_SFX(NA_SE_EV_EARTHQUAKE_LAST, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2951 */ DEFINE_SFX(NA_SE_EV_SEAHORSE_SWIM, 0x30, 0, 0, 0, 0) +/* 0x2952 */ DEFINE_SFX(NA_SE_EV_OPEN_AMBRELLA, 0x30, 0, 0, 0, 0) +/* 0x2953 */ DEFINE_SFX(NA_SE_EV_BUTLER_FRY, 0x60, 0, 0, 0, 0) +/* 0x2954 */ DEFINE_SFX(NA_SE_EV_PIRATE_SHIP, 0x30, 2, 0, 0, 0) +/* 0x2955 */ DEFINE_SFX(NA_SE_EV_DRAIN, 0x30, 0, 0, 0, 0) +/* 0x2956 */ DEFINE_SFX(NA_SE_EV_DORA_L, 0x30, 2, 0, 0, 0) +/* 0x2957 */ DEFINE_SFX(NA_SE_EV_LOG_BOUND, 0x30, 0, 2, 0, 0) +/* 0x2958 */ DEFINE_SFX(NA_SE_EV_CART_WHEEL, 0x60, 2, 1, 0, 0) +/* 0x2959 */ DEFINE_SFX(NA_SE_EV_EARTHQUAKE_LAST2, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x295A */ DEFINE_SFX(NA_SE_EV_DORA_S, 0x30, 0, 0, 0, 0) +/* 0x295B */ DEFINE_SFX(NA_SE_EV_ROCK_FALL, 0x30, 0, 0, 0, 0) +/* 0x295C */ DEFINE_SFX(NA_SE_EV_FREEZE_S, 0x30, 0, 0, 0, 0) +/* 0x295D */ DEFINE_SFX(NA_SE_EV_WOOD_BOUND_S, 0x30, 0, 0, 0, 0) +/* 0x295E */ DEFINE_SFX(NA_SE_EV_CLOSE_AMBRELLA, 0x30, 0, 0, 0, 0) +/* 0x295F */ DEFINE_SFX(NA_SE_EV_OBJECT_SLIDE, 0x30, 0, 0, 0, 0) +/* 0x2960 */ DEFINE_SFX(NA_SE_EV_ROLL_AND_FALL, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2961 */ DEFINE_SFX(NA_SE_EV_GORON_BOUND_0, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2962 */ DEFINE_SFX(NA_SE_EV_GORON_BOUND_1, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2963 */ DEFINE_SFX(NA_SE_EV_MONKEY_VO_DAMAGE, 0x30, 0, 0, 0, 0) +/* 0x2964 */ DEFINE_SFX(NA_SE_EV_FORT_RISING, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2965 */ DEFINE_SFX(NA_SE_EV_MONKEY_VO_REWARD, 0x30, 0, 0, 0, 0) +/* 0x2966 */ DEFINE_SFX(NA_SE_EV_WATER_PURIFICATION, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2967 */ DEFINE_SFX(NA_SE_EV_OWL_WARP_SWITCH_ON, 0x80, 0, 0, 0, 0) +/* 0x2968 */ DEFINE_SFX(NA_SE_EV_BIG_WATER_WHEEL_RR, 0x80, 3, 0, 0, 0) +/* 0x2969 */ DEFINE_SFX(NA_SE_EV_BIG_WATER_WHEEL_LR, 0x80, 3, 0, 0, 0) +/* 0x296A */ DEFINE_SFX(NA_SE_EV_SMALL_WATER_WHEEL, 0x30, 3, 0, 0, 0) +/* 0x296B */ DEFINE_SFX(NA_SE_EV_COCK_SWITCH_ROLL, 0x80, 2, 0, 0, 0) +/* 0x296C */ DEFINE_SFX(NA_SE_EV_COCK_SWITCH_STOP, 0x80, 2, 0, 0, 0) +/* 0x296D */ DEFINE_SFX(NA_SE_EV_PIPE_STREAM_START, 0x30, 0, 0, 0, 0) +/* 0x296E */ DEFINE_SFX(NA_SE_EV_WATER_PILLAR, 0x60, 0, 0, 0, 0) +/* 0x296F */ DEFINE_SFX(NA_SE_EV_SEESAW_INCLINE, 0x30, 0, 0, 0, 0) +/* 0x2970 */ DEFINE_SFX(NA_SE_EV_ZORA_WALK, 0x30, 2, 1, 0, 0) +/* 0x2971 */ DEFINE_SFX(NA_SE_EV_PIRATE_WALK, 0x30, 2, 1, 0, 0) +/* 0x2972 */ DEFINE_SFX(NA_SE_EV_PILLAR_UP_FAST, 0x30, 3, 1, 0, 0) +/* 0x2973 */ DEFINE_SFX(NA_SE_EV_DUMMY_WATER_WHEEL_RR, 0x60, 0, 0, SFX_FLAG2_APPLY_LOWPASS_FILTER, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2974 */ DEFINE_SFX(NA_SE_EV_DUMMY_WATER_WHEEL_LR, 0x60, 0, 0, SFX_FLAG2_APPLY_LOWPASS_FILTER, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2975 */ DEFINE_SFX(NA_SE_EV_MUJURA_FOLLOWERS_FLY, 0x30, 0, 0, 0, 0) +/* 0x2976 */ DEFINE_SFX(NA_SE_EV_MAKE_TURRET, 0x30, 0, 0, 0, 0) +/* 0x2977 */ DEFINE_SFX(NA_SE_EV_CHANDELIER_ROLL, 0x30, 3, 0, 0, 0) +/* 0x2978 */ DEFINE_SFX(NA_SE_EV_CHANDELIER_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x2979 */ DEFINE_SFX(NA_SE_EV_SINK_WOOD_FLOOR, 0x30, 0, 0, 0, 0) +/* 0x297A */ DEFINE_SFX(NA_SE_EV_REBOUND_WOOD_FLOOR, 0x30, 0, 0, 0, 0) +/* 0x297B */ DEFINE_SFX(NA_SE_EV_UFO_APPEAR, 0x30, 3, 0, 0, 0) +/* 0x297C */ DEFINE_SFX(NA_SE_EV_UFO_DASH, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x297D */ DEFINE_SFX(NA_SE_EV_TORNADE, 0x80, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x297E */ DEFINE_SFX(NA_SE_EV_MILK_POT_DAMAGE, 0x80, 3, 0, 0, 0) +/* 0x297F */ DEFINE_SFX(NA_SE_EV_DUMMY_383, 0x30, 0, 0, 0, 0) +/* 0x2980 */ DEFINE_SFX(NA_SE_EV_KYOJIN_SIGN, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2981 */ DEFINE_SFX(NA_SE_EV_KYOJIN_GRATITUDE0, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2982 */ DEFINE_SFX(NA_SE_EV_KYOJIN_GRATITUDE1, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2983 */ DEFINE_SFX(NA_SE_EV_KYOJIN_GRATITUDE2, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2984 */ DEFINE_SFX(NA_SE_EV_IKANA_DOOR_OPEN, 0x30, 0, 0, 0, 0) +/* 0x2985 */ DEFINE_SFX(NA_SE_EV_IKANA_DOOR_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x2986 */ DEFINE_SFX(NA_SE_EV_MOONSTONE_FALL, 0x80, 3, 0, 0, 0) +/* 0x2987 */ DEFINE_SFX(NA_SE_EV_COMING_FIRE, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2988 */ DEFINE_SFX(NA_SE_EV_FAIRY_GROUP_FRY, 0x30, 0, 0, 0, 0) +/* 0x2989 */ DEFINE_SFX(NA_SE_EV_FAIRY_GROUP_HEAL, 0x30, 0, 0, 0, 0) +/* 0x298A */ DEFINE_SFX(NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY, 0x30, 0, 0, 0, 0) +/* 0x298B */ DEFINE_SFX(NA_SE_EV_PAMERA_WALK, 0x30, 0, 0, 0, 0) +/* 0x298C */ DEFINE_SFX(NA_SE_EV_G_STONE_CHANGE_COLOR, 0x30, 0, 0, 0, 0) +/* 0x298D */ DEFINE_SFX(NA_SE_EV_CURTAIN_DOWN, 0x30, 0, 0, 0, 0) +/* 0x298E */ DEFINE_SFX(NA_SE_EV_GORON_HAND_HIT, 0x30, 3, 0, 0, 0) +/* 0x298F */ DEFINE_SFX(NA_SE_EV_SMALL_WOODPLATE_BOUND_0, 0x30, 3, 1, 0, 0) +/* 0x2990 */ DEFINE_SFX(NA_SE_EV_GET_UP_ON_BED, 0x30, 3, 0, 0, 0) +/* 0x2991 */ DEFINE_SFX(NA_SE_EV_LIE_DOWN_ON_BED, 0x30, 3, 0, 0, 0) +/* 0x2992 */ DEFINE_SFX(NA_SE_EV_BANK_MAN_HAND_HIT, 0x30, 0, 0, 0, 0) +/* 0x2993 */ DEFINE_SFX(NA_SE_EV_HANKO, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x2994 */ DEFINE_SFX(NA_SE_EV_CHICK_SONG, 0x10, 7, 0, 0, 0) +/* 0x2995 */ DEFINE_SFX(NA_SE_EV_LAND_SAND, 0x30, 0, 0, 0, 0) +/* 0x2996 */ DEFINE_SFX(NA_SE_EV_JUMP_SAND, 0x30, 0, 0, 0, 0) +/* 0x2997 */ DEFINE_SFX(NA_SE_EV_SECRET_LADDER_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x2998 */ DEFINE_SFX(NA_SE_EV_CLAPPING_2P, 0x30, 0, 0, 0, 0) +/* 0x2999 */ DEFINE_SFX(NA_SE_EV_DIVE_INTO_WEED, 0x30, 0, 0, 0, 0) +/* 0x299A */ DEFINE_SFX(NA_SE_EV_FAIRY_SHIVER, 0x30, 0, 0, 0, 0) +/* 0x299B */ DEFINE_SFX(NA_SE_EV_MASK_RISING, 0x30, 0, 0, 0, 0) +/* 0x299C */ DEFINE_SFX(NA_SE_EV_MOON_EYE_FLASH, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x299D */ DEFINE_SFX(NA_SE_EV_SLIP_MOON, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x299E */ DEFINE_SFX(NA_SE_EV_FALL_POWER, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x299F */ DEFINE_SFX(NA_SE_EV_BELL_DASH_NORMAL, 0x58, 0, 1, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x29A0 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_MOVE_X, 0x60, 3, 0, 0, 0) +/* 0x29A1 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_MOVE_Z, 0x60, 3, 0, 0, 0) +/* 0x29A2 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_MOVE_Y, 0x60, 3, 0, 0, 0) +/* 0x29A3 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_STOP_C, 0x70, 3, 0, 0, 0) +/* 0x29A4 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_STOP_F, 0x70, 3, 0, 0, 0) +/* 0x29A5 */ DEFINE_SFX(NA_SE_EV_BELL_ANGER, 0x30, 0, 0, 0, 0) +/* 0x29A6 */ DEFINE_SFX(NA_SE_EV_IKANA_BLOCK_SWITCH, 0x70, 3, 0, 0, 0) +/* 0x29A7 */ DEFINE_SFX(NA_SE_EV_BAT_FLY, 0x30, 4, 0, 0, 0) +/* 0x29A8 */ DEFINE_SFX(NA_SE_EV_UFO_LIGHT_BEAM, 0x30, 3, 0, 0, 0) +/* 0x29A9 */ DEFINE_SFX(NA_SE_EV_DOOR_UNLOCK, 0x30, 0, 0, 0, 0) +/* 0x29AA */ DEFINE_SFX(NA_SE_EV_WOOD_WATER_WHEEL, 0x30, 0, 0, 0, 0) +/* 0x29AB */ DEFINE_SFX(NA_SE_EV_CONVEYOR_SHUTTER_OPEN, 0x60, 0, 0, 0, 0) +/* 0x29AC */ DEFINE_SFX(NA_SE_EV_CONVEYOR_SHUTTER_CLOSE, 0x60, 0, 0, 0, 0) +/* 0x29AD */ DEFINE_SFX(NA_SE_EV_ROOM_CARTAIN, 0x30, 0, 0, 0, 0) +/* 0x29AE */ DEFINE_SFX(NA_SE_EV_ZORA_KIDS_BORN, 0x30, 0, 0, SFX_FLAG2_APPLY_LOWPASS_FILTER, 0) +/* 0x29AF */ DEFINE_SFX(NA_SE_EV_ZORA_KIDS_SWIM_0, 0x30, 0, 1, SFX_FLAG2_APPLY_LOWPASS_FILTER, 0) +/* 0x29B0 */ DEFINE_SFX(NA_SE_EV_ZORA_KIDS_SWIM_1, 0x30, 0, 1, SFX_FLAG2_APPLY_LOWPASS_FILTER, 0) +/* 0x29B1 */ DEFINE_SFX(NA_SE_EV_MOON_EXPLOSION, 0x60, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x29B2 */ DEFINE_SFX(NA_SE_EV_RAINBOW, 0x70, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x29B3 */ DEFINE_SFX(NA_SE_EV_OMENYA_WALK, 0x30, 0, 2, 0, 0) +/* 0x29B4 */ DEFINE_SFX(NA_SE_EV_KYOJIN_GROAN, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x29B5 */ DEFINE_SFX(NA_SE_EV_UFO_FLY, 0x30, 3, 0, 0, 0) +/* 0x29B6 */ DEFINE_SFX(NA_SE_EV_GRASS_WALL_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x29B7 */ DEFINE_SFX(NA_SE_EV_WARP_HOLE_ENERGY, 0x60, 3, 0, 0, 0) +/* 0x29B8 */ DEFINE_SFX(NA_SE_EV_BOSS_WARP_HOLE, 0x70, 0, 0, 0, 0) +/* 0x29B9 */ DEFINE_SFX(NA_SE_EV_FIREWORKS_LAUNCH, 0x30, 0, 0, 0, 0) +/* 0x29BA */ DEFINE_SFX(NA_SE_EV_IKANA_SOUL_LV, 0x30, 0, 0, 0, 0) +/* 0x29BB */ DEFINE_SFX(NA_SE_EV_IKANA_PURIFICATION, 0x30, 0, 0, 0, 0) +/* 0x29BC */ DEFINE_SFX(NA_SE_EV_ZORA_KIDS_SWIM_2, 0x30, 0, 0, 0, 0) +/* 0x29BD */ DEFINE_SFX(NA_SE_EV_DARUMA_VANISH, 0x30, 0, 0, 0, 0) +/* 0x29BE */ DEFINE_SFX(NA_SE_EV_IKANA_SOUL_TRANSFORM, 0x30, 0, 0, 0, 0) +/* 0x29BF */ DEFINE_SFX(NA_SE_EV_ROMANI_BOW_FLICK, 0x40, 0, 0, 0, 0) +/* 0x29C0 */ DEFINE_SFX(NA_SE_EV_WHITE_FAIRY_SHOT_DASH, 0x58, 0, 1, 0, 0) +/* 0x29C1 */ DEFINE_SFX(NA_SE_EV_BLACK_FAIRY_SHOT_DASH, 0x58, 0, 1, 0, 0) +/* 0x29C2 */ DEFINE_SFX(NA_SE_EV_SWORD_FORGE, 0x30, 0, 1, 0, 0) +/* 0x29C3 */ DEFINE_SFX(NA_SE_EV_STONEDOOR_CLOSE_S, 0x30, 1, 1, 0, 0) +/* 0x29C4 */ DEFINE_SFX(NA_SE_EV_BOTTLE_CAP_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x29C5 */ DEFINE_SFX(NA_SE_EV_PAMET_ROCK_CRASH, 0x30, 0, 0, 0, 0) +/* 0x29C6 */ DEFINE_SFX(NA_SE_EV_GUILLOTINE_UP, 0x30, 0, 0, 0, 0) +/* 0x29C7 */ DEFINE_SFX(NA_SE_EV_ROCK_BROKEN2, 0x30, 0, 0, 0, 0) +/* 0x29C8 */ DEFINE_SFX(NA_SE_EV_OBJECT_STICK2, 0x30, 0, 0, 0, 0) +/* 0x29C9 */ DEFINE_SFX(NA_SE_EV_WOODBOX_BOUND2, 0x30, 0, 0, 0, 0) +/* 0x29CA */ DEFINE_SFX(NA_SE_EV_DEMO_KID_ATOZUSARI, 0x30, 0, 0, 0, 0) +/* 0x29CB */ DEFINE_SFX(NA_SE_EV_UNDER_WATER, 0x30, 0, 0, 0, 0) +/* 0x29CC */ DEFINE_SFX(NA_SE_EV_FREEZE2, 0x30, 0, 0, 0, 0) +/* 0x29CD */ DEFINE_SFX(NA_SE_EV_DEMO_KID_SAGURU, 0x30, 0, 0, 0, 0) +/* 0x29CE */ DEFINE_SFX(NA_SE_EV_WATER_WALL3, 0x30, 0, 0, 0, 0) +/* 0x29CF */ DEFINE_SFX(NA_SE_EV_BOMBERS_TAORE, 0x30, 0, 0, 0, 0) diff --git a/include/tables/sfx/itembank_table.h b/include/tables/sfx/itembank_table.h new file mode 100644 index 000000000..f8b25aaa0 --- /dev/null +++ b/include/tables/sfx/itembank_table.h @@ -0,0 +1,125 @@ +/** + * Sfx Item Bank + * + * DEFINE_SFX should be used for all sfx define in the item bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the item bank in sequence 0 + */ +/* 0x1800 */ DEFINE_SFX(NA_SE_IT_SWORD_IMPACT, 0x30, 0, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x1801 */ DEFINE_SFX(NA_SE_IT_SWORD_SWING, 0x30, 0, 1, 0, 0) +/* 0x1802 */ DEFINE_SFX(NA_SE_IT_SWORD_PUTAWAY, 0x30, 0, 0, 0, 0) +/* 0x1803 */ DEFINE_SFX(NA_SE_IT_SWORD_PICKOUT, 0x30, 0, 0, 0, 0) +/* 0x1804 */ DEFINE_SFX(NA_SE_IT_ARROW_SHOT, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1805 */ DEFINE_SFX(NA_SE_IT_BOOMERANG_THROW, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1806 */ DEFINE_SFX(NA_SE_IT_SHIELD_BOUND, 0x60, 3, 2, 0, 0) +/* 0x1807 */ DEFINE_SFX(NA_SE_IT_BOW_DRAW, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1808 */ DEFINE_SFX(NA_SE_IT_SHIELD_REFLECT_SW, 0x80, 3, 1, 0, 0) +/* 0x1809 */ DEFINE_SFX(NA_SE_IT_ARROW_STICK_HRAD, 0x30, 0, 0, 0, 0) +/* 0x180A */ DEFINE_SFX(NA_SE_IT_HAMMER_HIT, 0x30, 0, 1, 0, 0) +/* 0x180B */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_CHAIN, 0x38, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x180C */ DEFINE_SFX(NA_SE_IT_SHIELD_REFLECT_MG, 0x30, 1, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x180D */ DEFINE_SFX(NA_SE_IT_BOMB_IGNIT, 0x50, 0, 0, 0, SFX_FLAG_8) +/* 0x180E */ DEFINE_SFX(NA_SE_IT_BOMB_EXPLOSION, 0x90, 2, 0, 0, 0) +/* 0x180F */ DEFINE_SFX(NA_SE_IT_BOMB_UNEXPLOSION, 0x50, 2, 0, 0, 0) +/* 0x1810 */ DEFINE_SFX(NA_SE_IT_BOOMERANG_FLY, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1811 */ DEFINE_SFX(NA_SE_IT_SWORD_STRIKE, 0x40, 2, 0, 0, 0) +/* 0x1812 */ DEFINE_SFX(NA_SE_IT_HAMMER_SWING, 0x30, 0, 1, 0, 0) +/* 0x1813 */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_REFLECT, 0x30, 0, 0, 0, 0) +/* 0x1814 */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_STICK_CRE, 0x30, 0, 0, 0, 0) +/* 0x1815 */ DEFINE_SFX(NA_SE_IT_ARROW_STICK_OBJ, 0x34, 0, 0, 0, 0) +/* 0x1816 */ DEFINE_SFX(NA_SE_IT_SWORD_SLASH, 0x30, 0, 0, 0, 0) +/* 0x1817 */ DEFINE_SFX(NA_SE_IT_SWORD_SLASH_HARD, 0x30, 0, 0, 0, 0) +/* 0x1818 */ DEFINE_SFX(NA_SE_IT_SWORD_SWING_HARD, 0x30, 0, 0, 0, 0) +/* 0x1819 */ DEFINE_SFX(NA_SE_IT_BOMB_BOUND, 0x30, 0, 0, 0, 0) +/* 0x181A */ DEFINE_SFX(NA_SE_IT_WALL_HIT_HARD, 0x60, 0, 0, 0, 0) +/* 0x181B */ DEFINE_SFX(NA_SE_IT_WALL_HIT_SOFT, 0x30, 0, 0, 0, 0) +/* 0x181C */ DEFINE_SFX(NA_SE_IT_STONE_HIT, 0x30, 0, 0, 0, 0) +/* 0x181D */ DEFINE_SFX(NA_SE_IT_WOODSTICK_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x181E */ DEFINE_SFX(NA_SE_IT_LASH, 0x30, 0, 2, 0, 0) +/* 0x181F */ DEFINE_SFX(NA_SE_IT_SHIELD_SWING, 0x30, 0, 1, 0, 0) +/* 0x1820 */ DEFINE_SFX(NA_SE_IT_SLING_SHOT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1821 */ DEFINE_SFX(NA_SE_IT_SLING_DRAW, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1822 */ DEFINE_SFX(NA_SE_IT_SWORD_CHARGE, 0x30, 0, 0, 0, 0) +/* 0x1823 */ DEFINE_SFX(NA_SE_IT_ROLLING_CUT, 0x30, 0, 0, 0, 0) +/* 0x1824 */ DEFINE_SFX(NA_SE_IT_SWORD_STRIKE_HARD, 0x30, 0, 0, 0, 0) +/* 0x1825 */ DEFINE_SFX(NA_SE_IT_SLING_REFLECT, 0x30, 0, 0, 0, 0) +/* 0x1826 */ DEFINE_SFX(NA_SE_IT_SHIELD_REMOVE, 0x30, 0, 0, 0, 0) +/* 0x1827 */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_READY, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1828 */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_RECEIVE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1829 */ DEFINE_SFX(NA_SE_IT_HOOKSHOT_STICK_OBJ, 0x60, 3, 1, 0, 0) +/* 0x182A */ DEFINE_SFX(NA_SE_IT_SWORD_REFLECT_MG, 0x30, 1, 0, 0, 0) +/* 0x182B */ DEFINE_SFX(NA_SE_IT_DEKU, 0x30, 1, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x182C */ DEFINE_SFX(NA_SE_IT_WALL_HIT_BUYO, 0x30, 0, 0, 0, 0) +/* 0x182D */ DEFINE_SFX(NA_SE_IT_SWORD_PUTAWAY_STN, 0x30, 0, 0, 0, 0) +/* 0x182E */ DEFINE_SFX(NA_SE_IT_ROLLING_CUT_LV1, 0xA0, 2, 0, 0, 0) +/* 0x182F */ DEFINE_SFX(NA_SE_IT_ROLLING_CUT_LV2, 0xA0, 2, 0, 0, 0) +/* 0x1830 */ DEFINE_SFX(NA_SE_IT_BOW_FLICK, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1831 */ DEFINE_SFX(NA_SE_IT_BOMBCHU_MOVE, 0x30, 0, 0, 0, SFX_FLAG_8) +/* 0x1832 */ DEFINE_SFX(NA_SE_IT_SHIELD_CHARGE_LV1, 0x60, 0, 0, 0, 0) +/* 0x1833 */ DEFINE_SFX(NA_SE_IT_SHIELD_CHARGE_LV2, 0x60, 0, 0, 0, 0) +/* 0x1834 */ DEFINE_SFX(NA_SE_IT_SHIELD_CHARGE_LV3, 0x60, 0, 0, 0, 0) +/* 0x1835 */ DEFINE_SFX(NA_SE_IT_SLING_FLICK, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x1836 */ DEFINE_SFX(NA_SE_IT_SWORD_STICK_STN, 0x30, 0, 0, 0, 0) +/* 0x1837 */ DEFINE_SFX(NA_SE_IT_REFLECTION_WOOD, 0x60, 1, 2, 0, 0) +/* 0x1838 */ DEFINE_SFX(NA_SE_IT_SHIELD_REFLECT_MG2, 0x30, 0, 0, 0, 0) +/* 0x1839 */ DEFINE_SFX(NA_SE_IT_MAGIC_ARROW_SHOT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x183A */ DEFINE_SFX(NA_SE_IT_EXPLOSION_FRAME, 0x60, 3, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x183B */ DEFINE_SFX(NA_SE_IT_EXPLOSION_ICE, 0x60, 3, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x183C */ DEFINE_SFX(NA_SE_IT_EXPLOSION_LIGHT, 0x60, 3, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x183D */ DEFINE_SFX(NA_SE_IT_FISHING_REEL_SLOW, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x183E */ DEFINE_SFX(NA_SE_IT_FISHING_REEL_HIGH, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x183F */ DEFINE_SFX(NA_SE_IT_PULL_FISHING_ROD, 0x30, 0, 1, 0, 0) +/* 0x1840 */ DEFINE_SFX(NA_SE_IT_DM_FLYING_GOD_PASS, 0x80, 3, 0, 0, 0) +/* 0x1841 */ DEFINE_SFX(NA_SE_IT_DM_FLYING_GOD_DASH, 0x80, 3, 0, 0, 0) +/* 0x1842 */ DEFINE_SFX(NA_SE_IT_DM_RING_EXPLOSION, 0x30, 3, 0, 0, 0) +/* 0x1843 */ DEFINE_SFX(NA_SE_IT_DM_RING_GATHER, 0x30, 0, 0, 0, 0) +/* 0x1844 */ DEFINE_SFX(NA_SE_IT_INGO_HORSE_NEIGH, 0x30, 0, 1, 0, 0) +/* 0x1845 */ DEFINE_SFX(NA_SE_IT_EARTHQUAKE, 0x30, 0, 0, 0, 0) +/* 0x1846 */ DEFINE_SFX(NA_SE_IT_ERUPTION_PILLAR, 0x30, 0, 0, 0, 0) +/* 0x1847 */ DEFINE_SFX(NA_SE_IT_KAKASHI_JUMP, 0x30, 0, 0, 0, 0) +/* 0x1848 */ DEFINE_SFX(NA_SE_IT_FLAME, 0x30, 0, 0, 0, 0) +/* 0x1849 */ DEFINE_SFX(NA_SE_IT_SHIELD_BEAM, 0x30, 0, 0, 0, 0) +/* 0x184A */ DEFINE_SFX(NA_SE_IT_FISHING_HIT, 0x30, 0, 0, 0, 0) +/* 0x184B */ DEFINE_SFX(NA_SE_IT_GOODS_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x184C */ DEFINE_SFX(NA_SE_IT_MAJIN_SWORD_BROKEN, 0x80, 0, 0, 0, 0) +/* 0x184D */ DEFINE_SFX(NA_SE_IT_HAND_CLAP, 0x30, 0, 0, 0, 0) +/* 0x184E */ DEFINE_SFX(NA_SE_IT_MASTER_SWORD_SWING, 0x30, 0, 0, 0, 0) +/* 0x184F */ DEFINE_SFX(NA_SE_IT_GORON_BALLFANG, 0x30, 0, 0, 0, 0) +/* 0x1850 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_FLOWER_OPEN, 0x80, 0, 0, 0, 0) +/* 0x1851 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_FLOWER_ROLL, 0x80, 0, 0, 0, 0) +/* 0x1852 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_FLOWER_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x1853 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_BUBLE_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x1854 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_BUBLE_VANISH, 0x30, 0, 0, 0, 0) +/* 0x1855 */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_DROP_BOMB, 0x30, 0, 0, 0, 0) +/* 0x1856 */ DEFINE_SFX(NA_SE_IT_SET_TRANSFORM_MASK, 0x30, 0, 0, 0, 0) +/* 0x1857 */ DEFINE_SFX(NA_SE_IT_GORON_PUNCH_SWING, 0x30, 0, 0, 0, 0) +/* 0x1858 */ DEFINE_SFX(NA_SE_IT_TRANSFORM_MASK_BROKEN, 0x30, 0, 0, 0, 0) +/* 0x1859 */ DEFINE_SFX(NA_SE_IT_ZORA_KICK_SWING, 0x40, 0, 0, 0, 0) +/* 0x185A */ DEFINE_SFX(NA_SE_IT_DEKUNUTS_BUBLE_SHOT_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x185B */ DEFINE_SFX(NA_SE_IT_BIG_BOMB_IGNIT, 0x60, 0, 0, 0, SFX_FLAG_8) +/* 0x185C */ DEFINE_SFX(NA_SE_IT_BIG_BOMB_EXPLOSION, 0x70, 0, 0, 0, 0) +/* 0x185D */ DEFINE_SFX(NA_SE_IT_REFLECTION_SNOW, 0x60, 0, 0, 0, 0) +/* 0x185E */ DEFINE_SFX(NA_SE_IT_GORON_ROLLING_REFLECTION, 0x30, 3, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x185F */ DEFINE_SFX(NA_SE_IT_MASK_BOUND_0, 0x30, 0, 1, 0, 0) +/* 0x1860 */ DEFINE_SFX(NA_SE_IT_MASK_BOUND_1, 0x30, 0, 1, 0, 0) +/* 0x1861 */ DEFINE_SFX(NA_SE_IT_MASK_BOUND_SAND, 0x30, 0, 0, 0, 0) +/* 0x1862 */ DEFINE_SFX(NA_SE_IT_REFLECTION_WATER, 0x30, 0, 0, 0, 0) +/* 0x1863 */ DEFINE_SFX(NA_SE_IT_KYOJIN_BEARING, 0x60, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x1864 */ DEFINE_SFX(NA_SE_FISHING_REEL_SLOW2, 0x30, 0, 0, 0, 0) +/* 0x1865 */ DEFINE_SFX(NA_SE_IT_LURE_LAND1, 0x30, 0, 0, 0, 0) +/* 0x1866 */ DEFINE_SFX(NA_SE_IT_ROD_THROW, 0x30, 0, 0, 0, 0) +/* 0x1867 */ DEFINE_SFX(NA_SE_IT_REFLECT_BOSS, 0x30, 0, 0, 0, 0) +/* 0x1868 */ DEFINE_SFX(NA_SE_IT_SHIELD_SWING_ZORA, 0x30, 0, 0, 0, 0) +/* 0x1869 */ DEFINE_SFX(NA_SE_IT_SHIELD_REMOVE_ZORA, 0x30, 0, 0, 0, 0) +/* 0x186A */ DEFINE_SFX(NA_SE_IT_BOMB_EXPLOSION2, 0x30, 0, 0, 0, 0) +/* 0x186B */ DEFINE_SFX(NA_SE_IT_FISHING_REEL_REVERSE, 0x30, 0, 0, 0, 0) +/* 0x186C */ DEFINE_SFX(NA_SE_IT_FISHING_WORM_BOUND, 0x30, 0, 0, 0, 0) +/* 0x186D */ DEFINE_SFX(NA_SE_IT_DUMMY_109, 0x30, 0, 0, 0, 0) +/* 0x186E */ DEFINE_SFX(NA_SE_IT_DUMMY_110, 0x30, 0, 0, 0, 0) +/* 0x186F */ DEFINE_SFX(NA_SE_IT_DUMMY_111, 0x30, 0, 0, 0, 0) diff --git a/include/tables/sfx/ocarinabank_table.h b/include/tables/sfx/ocarinabank_table.h new file mode 100644 index 000000000..fa83394ab --- /dev/null +++ b/include/tables/sfx/ocarinabank_table.h @@ -0,0 +1,29 @@ +/** + * Sfx Ocarina Bank + * + * DEFINE_SFX should be used for all sfx define in the ocarina bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the ocarina bank in sequence 0 + */ +/* 0x5800 */ DEFINE_SFX(NA_SE_OC_OCARINA, 0x30, 0, 0, 0, 0) +/* 0x5801 */ DEFINE_SFX(NA_SE_OC_ABYSS, 0x30, 0, 0, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x5802 */ DEFINE_SFX(NA_SE_OC_DOOR_OPEN, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX | SFX_FLAG_SURROUND_LOWPASS_FILTER) +/* 0x5803 */ DEFINE_SFX(NA_SE_OC_SECRET_WARP_IN, 0x30, 0, 0, 0, 0) +/* 0x5804 */ DEFINE_SFX(NA_SE_OC_SECRET_WARP_OUT, 0x30, 0, 0, 0, 0) +/* 0x5805 */ DEFINE_SFX(NA_SE_OC_SECRET_HOLE_OUT, 0x30, 0, 0, 0, 0) +/* 0x5806 */ DEFINE_SFX(NA_SE_OC_REVENGE, 0x30, 0, 0, 0, 0) +/* 0x5807 */ DEFINE_SFX(NA_SE_OC_TUNAMI, 0x30, 0, 0, 0, 0) +/* 0x5808 */ DEFINE_SFX(NA_SE_OC_TELOP_IMPACT, 0x30, 0, 0, 0, 0) +/* 0x5809 */ DEFINE_SFX(NA_SE_OC_WOOD_GATE_OPEN, 0x30, 0, 0, 0, 0) +/* 0x580A */ DEFINE_SFX(NA_SE_OC_FIREWORKS, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x580B */ DEFINE_SFX(NA_SE_OC_WHITE_OUT_INTO_KYOJIN, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x580C */ DEFINE_SFX(NA_SE_OC_12, 0x30, 0, 0, 0, 0) +/* 0x580D */ DEFINE_SFX(NA_SE_OC_13, 0x30, 0, 0, 0, 0) +/* 0x580E */ DEFINE_SFX(NA_SE_OC_14, 0x30, 0, 0, 0, 0) +/* 0x580F */ DEFINE_SFX(NA_SE_OC_15, 0x30, 0, 0, 0, 0) diff --git a/include/tables/sfx/playerbank_table.h b/include/tables/sfx/playerbank_table.h new file mode 100644 index 000000000..bcec96a67 --- /dev/null +++ b/include/tables/sfx/playerbank_table.h @@ -0,0 +1,477 @@ +/** + * Sfx Player Bank + * + * DEFINE_SFX should be used for all sfx define in the player bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the player bank in sequence 0 + */ +/* 0x800 */ DEFINE_SFX(NA_SE_PL_WALK_GROUND, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x801 */ DEFINE_SFX(NA_SE_PL_WALK_SAND, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x802 */ DEFINE_SFX(NA_SE_PL_WALK_CONCRETE, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x803 */ DEFINE_SFX(NA_SE_PL_WALK_DIRT, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x804 */ DEFINE_SFX(NA_SE_PL_WALK_WATER0, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x805 */ DEFINE_SFX(NA_SE_PL_WALK_WATER1, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x806 */ DEFINE_SFX(NA_SE_PL_WALK_WATER2, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x807 */ DEFINE_SFX(NA_SE_PL_WALK_MAGMA, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x808 */ DEFINE_SFX(NA_SE_PL_WALK_GRASS, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x809 */ DEFINE_SFX(NA_SE_PL_WALK_IRON, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80A */ DEFINE_SFX(NA_SE_PL_WALK_LADDER, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80B */ DEFINE_SFX(NA_SE_PL_WALK_GLASS, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80C */ DEFINE_SFX(NA_SE_PL_WALK_METAL1, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80D */ DEFINE_SFX(NA_CODE_DIRT_DEEP, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80E */ DEFINE_SFX(NA_SE_PL_WALK_SNOW, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x80F */ DEFINE_SFX(NA_SE_PL_WALK_ICE, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x810 */ DEFINE_SFX(NA_SE_PL_JUMP_GROUND, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x811 */ DEFINE_SFX(NA_SE_PL_JUMP_SAND, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x812 */ DEFINE_SFX(NA_SE_PL_JUMP_CONCRETE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x813 */ DEFINE_SFX(NA_SE_PL_JUMP_DIRT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x814 */ DEFINE_SFX(NA_SE_PL_JUMP_WATER0, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x815 */ DEFINE_SFX(NA_SE_PL_JUMP_WATER1, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x816 */ DEFINE_SFX(NA_SE_PL_JUMP_WATER2, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x817 */ DEFINE_SFX(NA_SE_PL_JUMP_MAGMA, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x818 */ DEFINE_SFX(NA_SE_PL_JUMP_GRASS, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x819 */ DEFINE_SFX(NA_SE_PL_JUMP_IRON, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81A */ DEFINE_SFX(NA_SE_PL_JUMP_LADDER, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81B */ DEFINE_SFX(NA_SE_PL_JUMP_GLASS, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81C */ DEFINE_SFX(NA_SE_PL_DUMMY_28, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81D */ DEFINE_SFX(NA_SE_PL_JUMP_HEAVYBOOTS, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81E */ DEFINE_SFX(NA_SE_PL_JUMP_SNOW, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x81F */ DEFINE_SFX(NA_SE_PL_JUMP_ICE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x820 */ DEFINE_SFX(NA_SE_PL_LAND_GROUND, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x821 */ DEFINE_SFX(NA_SE_PL_LAND_SAND, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x822 */ DEFINE_SFX(NA_SE_PL_LAND_CONCRETE, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x823 */ DEFINE_SFX(NA_SE_PL_LAND_DIRT, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x824 */ DEFINE_SFX(NA_SE_PL_LAND_WATER0, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x825 */ DEFINE_SFX(NA_SE_PL_LAND_WATER1, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x826 */ DEFINE_SFX(NA_SE_PL_LAND_WATER2, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x827 */ DEFINE_SFX(NA_SE_PL_LAND_MAGMA, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x828 */ DEFINE_SFX(NA_SE_PL_LAND_GRASS, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x829 */ DEFINE_SFX(NA_SE_PL_LAND_IRON, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82A */ DEFINE_SFX(NA_SE_PL_LAND_LADDER, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82B */ DEFINE_SFX(NA_SE_PL_LAND_GLASS, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82C */ DEFINE_SFX(NA_SE_PL_DUMMY_44, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82D */ DEFINE_SFX(NA_SE_PL_LAND_HEAVYBOOTS, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82E */ DEFINE_SFX(NA_SE_PL_LAND_SNOW, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x82F */ DEFINE_SFX(NA_SE_PL_LAND_ICE, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x830 */ DEFINE_SFX(NA_SE_PL_SLIPDOWN, 0x30, 0, 2, 0, 0) +/* 0x831 */ DEFINE_SFX(NA_SE_PL_CLIMB_CLIFF, 0x30, 0, 0, 0, 0) +/* 0x832 */ DEFINE_SFX(NA_SE_PL_SIT_ON_HORSE, 0x30, 0, 0, 0, 0) +/* 0x833 */ DEFINE_SFX(NA_SE_PL_GET_OFF_HORSE, 0x30, 0, 0, 0, 0) +/* 0x834 */ DEFINE_SFX(NA_SE_PL_TAKE_OUT_SHIELD, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x835 */ DEFINE_SFX(NA_SE_PL_CHANGE_ARMS, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x836 */ DEFINE_SFX(NA_SE_PL_CATCH_BOOMERANG, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x837 */ DEFINE_SFX(NA_SE_PL_DIVE_INTO_WATER, 0x30, 0, 1, 0, 0) +/* 0x838 */ DEFINE_SFX(NA_SE_PL_JUMP_OUT_WATER, 0x30, 0, 1, 0, 0) +/* 0x839 */ DEFINE_SFX(NA_SE_PL_SWIM, 0x30, 0, 2, 0, 0) +/* 0x83A */ DEFINE_SFX(NA_SE_PL_THROW, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x83B */ DEFINE_SFX(NA_SE_PL_BODY_BOUND, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x83C */ DEFINE_SFX(NA_SE_PL_ROLL, 0x40, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x83D */ DEFINE_SFX(NA_SE_PL_SKIP, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x83E */ DEFINE_SFX(NA_SE_PL_BODY_HIT, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x83F */ DEFINE_SFX(NA_SE_PL_DAMAGE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x840 */ DEFINE_SFX(NA_SE_PL_SLIP, 0x30, 0, 1, 0, 0) +/* 0x841 */ DEFINE_SFX(NA_SE_PL_SLIP_SAND, 0x30, 0, 1, 0, 0) +/* 0x842 */ DEFINE_SFX(NA_SE_PL_SLIP_CONCRETE, 0x30, 0, 1, 0, 0) +/* 0x843 */ DEFINE_SFX(NA_SE_PL_SLIP_DIRT, 0x30, 0, 1, 0, 0) +/* 0x844 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER0, 0x30, 0, 1, 0, 0) +/* 0x845 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER1, 0x30, 0, 1, 0, 0) +/* 0x846 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER2, 0x30, 0, 1, 0, 0) +/* 0x847 */ DEFINE_SFX(NA_SE_PL_SLIP_MAGMA, 0x30, 0, 1, 0, 0) +/* 0x848 */ DEFINE_SFX(NA_SE_PL_SLIP_GRASS, 0x30, 0, 1, 0, 0) +/* 0x849 */ DEFINE_SFX(NA_SE_PL_SLIP_IRON, 0x30, 0, 1, 0, 0) +/* 0x84A */ DEFINE_SFX(NA_SE_PL_SLIP_LADDER, 0x30, 0, 1, 0, 0) +/* 0x84B */ DEFINE_SFX(NA_SE_PL_SLIP_GLASS, 0x30, 0, 1, 0, 0) +/* 0x84C */ DEFINE_SFX(NA_SE_PL_DUMMY76, 0x30, 0, 0, 0, 0) +/* 0x84D */ DEFINE_SFX(NA_SE_PL_SLIP_HEAVYBOOTS, 0x30, 0, 0, 0, 0) +/* 0x84E */ DEFINE_SFX(NA_SE_PL_SLIP_SNOW, 0x30, 0, 0, 0, 0) +/* 0x84F */ DEFINE_SFX(NA_SE_PL_SLIP_ICE, 0x30, 0, 0, 0, 0) +/* 0x850 */ DEFINE_SFX(NA_SE_PL_BOUND, 0x80, 0, 0, 0, 0) +/* 0x851 */ DEFINE_SFX(NA_SE_PL_BOUND_SAND, 0x80, 0, 0, 0, 0) +/* 0x852 */ DEFINE_SFX(NA_SE_PL_BOUND_CONCRETE, 0x80, 0, 0, 0, 0) +/* 0x853 */ DEFINE_SFX(NA_SE_PL_BOUND_DIRT, 0x80, 0, 0, 0, 0) +/* 0x854 */ DEFINE_SFX(NA_SE_PL_BOUND_WATER0, 0x80, 0, 0, 0, 0) +/* 0x855 */ DEFINE_SFX(NA_SE_PL_BOUND_WATER1, 0x80, 0, 0, 0, 0) +/* 0x856 */ DEFINE_SFX(NA_SE_PL_BOUND_WATER2, 0x80, 0, 0, 0, 0) +/* 0x857 */ DEFINE_SFX(NA_SE_PL_BOUND_MAGMA, 0x80, 0, 0, 0, 0) +/* 0x858 */ DEFINE_SFX(NA_SE_PL_BOUND_GRASS, 0x80, 0, 0, 0, 0) +/* 0x859 */ DEFINE_SFX(NA_SE_PL_BOUND_IRON, 0x80, 0, 0, 0, 0) +/* 0x85A */ DEFINE_SFX(NA_SE_PL_BOUND_LADDER, 0x80, 0, 0, 0, 0) +/* 0x85B */ DEFINE_SFX(NA_SE_PL_BOUND_WOOD, 0x80, 0, 0, 0, 0) +/* 0x85C */ DEFINE_SFX(NA_SE_PL_DUMMY_92, 0x80, 0, 0, 0, 0) +/* 0x85D */ DEFINE_SFX(NA_SE_PL_BOUND_HEAVYBOOTS, 0x80, 0, 0, 0, 0) +/* 0x85E */ DEFINE_SFX(NA_SE_PL_BOUND_SNOW, 0x80, 0, 0, 0, 0) +/* 0x85F */ DEFINE_SFX(NA_SE_PL_BOUND_ICE, 0x80, 0, 0, 0, 0) +/* 0x860 */ DEFINE_SFX(NA_SE_PL_BOW_DRAW, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x861 */ DEFINE_SFX(NA_SE_PL_MEATL_BOOTS_JUMP, 0x30, 0, 0, 0, 0) +/* 0x862 */ DEFINE_SFX(NA_SE_PL_DUMMY_98, 0x30, 0, 0, 0, 0) +/* 0x863 */ DEFINE_SFX(NA_SE_PL_FACE_UP, 0x30, 0, 0, 0, 0) +/* 0x864 */ DEFINE_SFX(NA_SE_PL_DIVE_BUBBLE, 0x30, 0, 0, 0, 0) +/* 0x865 */ DEFINE_SFX(NA_SE_PL_MOVE_BUBBLE, 0x30, 0, 0, 0, 0) +/* 0x866 */ DEFINE_SFX(NA_SE_PL_METALEFFECT_KID, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x867 */ DEFINE_SFX(NA_SE_PL_METALEFFECT_ADULT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x868 */ DEFINE_SFX(NA_SE_PL_SPARK, 0x30, 0, 0, 0, 0) +/* 0x869 */ DEFINE_SFX(NA_SE_PL_PULL_UP_PLANT, 0x30, 0, 0, 0, 0) +/* 0x86A */ DEFINE_SFX(NA_SE_PL_PULL_UP_ROCK, 0x30, 0, 0, 0, 0) +/* 0x86B */ DEFINE_SFX(NA_SE_PL_IN_BUBBLE, 0x30, 0, 0, 0, 0) +/* 0x86C */ DEFINE_SFX(NA_SE_PL_PULL_UP_BIGROCK, 0x30, 3, 0, 0, 0) +/* 0x86D */ DEFINE_SFX(NA_SE_PL_SWORD_CHARGE, 0x30, 0, 0, 0, 0) +/* 0x86E */ DEFINE_SFX(NA_SE_PL_FREEZE, 0x30, 0, 0, 0, 0) +/* 0x86F */ DEFINE_SFX(NA_SE_PL_PULL_UP_POT, 0x30, 0, 0, 0, 0) +/* 0x870 */ DEFINE_SFX(NA_SE_PL_KNOCK, 0x30, 0, 0, 0, 0) +/* 0x871 */ DEFINE_SFX(NA_SE_PL_CALM_HIT, 0x30, 0, 2, 0, 0) +/* 0x872 */ DEFINE_SFX(NA_SE_PL_CALM_PAT, 0x30, 0, 0, 0, 0) +/* 0x873 */ DEFINE_SFX(NA_SE_PL_SUBMERGE, 0x30, 0, 0, 0, 0) +/* 0x874 */ DEFINE_SFX(NA_SE_PL_FREEZE_S, 0x30, 3, 0, 0, 0) +/* 0x875 */ DEFINE_SFX(NA_SE_PL_ICE_BROKEN, 0x30, 1, 0, 0, 0) +/* 0x876 */ DEFINE_SFX(NA_SE_PL_SLIP_ICE_LELEL, 0x30, 0, 0, 0, 0) +/* 0x877 */ DEFINE_SFX(NA_SE_PL_PUT_OUT_ITEM, 0x30, 0, 0, 0, 0) +/* 0x878 */ DEFINE_SFX(NA_SE_PL_PULL_UP_WOODBOX, 0x30, 0, 0, 0, 0) +/* 0x879 */ DEFINE_SFX(NA_SE_PL_MAGIC_FIRE, 0x30, 0, 0, 0, 0) +/* 0x87A */ DEFINE_SFX(NA_SE_PL_MAGIC_WIND_NORMAL, 0x30, 0, 0, 0, 0) +/* 0x87B */ DEFINE_SFX(NA_SE_PL_MAGIC_WIND_WARP, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST) +/* 0x87C */ DEFINE_SFX(NA_SE_PL_MAGIC_SOUL_NORMAL, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x87D */ DEFINE_SFX(NA_SE_PL_ARROW_CHARGE_FIRE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x87E */ DEFINE_SFX(NA_SE_PL_ARROW_CHARGE_ICE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x87F */ DEFINE_SFX(NA_SE_PL_ARROW_CHARGE_LIGHT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x880 */ DEFINE_SFX(NA_SE_DUMMY_128, 0x20, 0, 2, 0, 0) +/* 0x881 */ DEFINE_SFX(NA_SE_DUMMY_129, 0x20, 0, 2, 0, 0) +/* 0x882 */ DEFINE_SFX(NA_SE_DUMMY_130, 0x20, 0, 2, 0, 0) +/* 0x883 */ DEFINE_SFX(NA_SE_PL_PULL_UP_RUTO, 0x20, 0, 2, 0, 0) +/* 0x884 */ DEFINE_SFX(NA_SE_DUMMY_132, 0x20, 0, 1, 0, 0) +/* 0x885 */ DEFINE_SFX(NA_SE_DUMMY_133, 0x20, 0, 1, 0, 0) +/* 0x886 */ DEFINE_SFX(NA_SE_DUMMY_134, 0x20, 0, 1, 0, 0) +/* 0x887 */ DEFINE_SFX(NA_SE_DUMMY_135, 0x20, 0, 1, 0, 0) +/* 0x888 */ DEFINE_SFX(NA_SE_DUMMY_136, 0x20, 0, 2, 0, 0) +/* 0x889 */ DEFINE_SFX(NA_SE_DUMMY_137, 0x20, 0, 2, 0, 0) +/* 0x88A */ DEFINE_SFX(NA_SE_DUMMY_138, 0x20, 0, 2, 0, 0) +/* 0x88B */ DEFINE_SFX(NA_SE_DUMMY_139, 0x20, 0, 0, 0, 0) +/* 0x88C */ DEFINE_SFX(NA_SE_DUMMY_140, 0x20, 0, 0, 0, 0) +/* 0x88D */ DEFINE_SFX(NA_SE_DUMMY_141, 0x20, 0, 0, 0, 0) +/* 0x88E */ DEFINE_SFX(NA_SE_DUMMY_142, 0x20, 0, 0, 0, 0) +/* 0x88F */ DEFINE_SFX(NA_SE_DUMMY_143, 0x20, 0, 0, 0, 0) +/* 0x890 */ DEFINE_SFX(NA_SE_DUMMY_144, 0x30, 0, 0, 0, 0) +/* 0x891 */ DEFINE_SFX(NA_SE_DUMMY_145, 0x30, 0, 0, 0, 0) +/* 0x892 */ DEFINE_SFX(NA_SE_DUMMY_146, 0x30, 0, 0, 0, 0) +/* 0x893 */ DEFINE_SFX(NA_SE_DUMMY_147, 0x30, 0, 0, 0, 0) +/* 0x894 */ DEFINE_SFX(NA_SE_DUMMY_148, 0x30, 0, 0, 0, 0) +/* 0x895 */ DEFINE_SFX(NA_SE_DUMMY_149, 0x30, 0, 0, 0, 0) +/* 0x896 */ DEFINE_SFX(NA_SE_DUMMY_150, 0x30, 0, 0, 0, 0) +/* 0x897 */ DEFINE_SFX(NA_SE_DUMMY_151, 0x30, 0, 0, 0, 0) +/* 0x898 */ DEFINE_SFX(NA_SE_DUMMY_152, 0x30, 0, 0, 0, 0) +/* 0x899 */ DEFINE_SFX(NA_SE_DUMMY_153, 0x30, 0, 0, 0, 0) +/* 0x89A */ DEFINE_SFX(NA_SE_DUMMY_154, 0x30, 0, 0, 0, 0) +/* 0x89B */ DEFINE_SFX(NA_SE_DUMMY_155, 0x30, 0, 0, 0, 0) +/* 0x89C */ DEFINE_SFX(NA_SE_DUMMY_156, 0x30, 0, 0, 0, 0) +/* 0x89D */ DEFINE_SFX(NA_SE_DUMMY_157, 0x30, 0, 0, 0, 0) +/* 0x89E */ DEFINE_SFX(NA_SE_DUMMY_158, 0x30, 0, 0, 0, 0) +/* 0x89F */ DEFINE_SFX(NA_SE_DUMMY_159, 0x30, 0, 0, 0, 0) +/* 0x8A0 */ DEFINE_SFX(NA_SE_DUMMY_160, 0x40, 0, 0, 0, 0) +/* 0x8A1 */ DEFINE_SFX(NA_SE_DUMMY_161, 0x40, 0, 0, 0, 0) +/* 0x8A2 */ DEFINE_SFX(NA_SE_DUMMY_162, 0x40, 0, 0, 0, 0) +/* 0x8A3 */ DEFINE_SFX(NA_SE_DUMMY_163, 0x40, 0, 0, 0, 0) +/* 0x8A4 */ DEFINE_SFX(NA_SE_DUMMY_164, 0x40, 0, 0, 0, 0) +/* 0x8A5 */ DEFINE_SFX(NA_SE_DUMMY_165, 0x40, 0, 0, 0, 0) +/* 0x8A6 */ DEFINE_SFX(NA_SE_DUMMY_166, 0x40, 0, 0, 0, 0) +/* 0x8A7 */ DEFINE_SFX(NA_SE_DUMMY_167, 0x40, 0, 0, 0, 0) +/* 0x8A8 */ DEFINE_SFX(NA_SE_DUMMY_168, 0x40, 0, 0, 0, 0) +/* 0x8A9 */ DEFINE_SFX(NA_SE_DUMMY_169, 0x40, 0, 0, 0, 0) +/* 0x8AA */ DEFINE_SFX(NA_SE_DUMMY_170, 0x40, 0, 0, 0, 0) +/* 0x8AB */ DEFINE_SFX(NA_SE_DUMMY_171, 0x40, 0, 0, 0, 0) +/* 0x8AC */ DEFINE_SFX(NA_SE_DUMMY_172, 0x40, 0, 0, 0, 0) +/* 0x8AD */ DEFINE_SFX(NA_SE_DUMMY_173, 0x40, 0, 0, 0, 0) +/* 0x8AE */ DEFINE_SFX(NA_SE_DUMMY_174, 0x40, 0, 0, 0, 0) +/* 0x8AF */ DEFINE_SFX(NA_SE_DUMMY_175, 0x40, 0, 0, 0, 0) +/* 0x8B0 */ DEFINE_SFX(NA_SE_PL_CRAWL, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B1 */ DEFINE_SFX(NA_SE_PL_CRAWL_SAND, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B2 */ DEFINE_SFX(NA_SE_PL_CRAWL_CONCRETE, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B3 */ DEFINE_SFX(NA_SE_PL_CRAWL_DIRT, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B4 */ DEFINE_SFX(NA_SE_PL_CRAWL_WATER0, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B5 */ DEFINE_SFX(NA_SE_DUMMY_181, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B6 */ DEFINE_SFX(NA_SE_DUMMY_182, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B7 */ DEFINE_SFX(NA_SE_DUMMY_183, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B8 */ DEFINE_SFX(NA_SE_DUMMY_184, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8B9 */ DEFINE_SFX(NA_SE_DUMMY_185, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BA */ DEFINE_SFX(NA_SE_DUMMY_186, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BB */ DEFINE_SFX(NA_SE_PL_CRAWL_WOOD, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BC */ DEFINE_SFX(NA_SE_DUMMY_188, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BD */ DEFINE_SFX(NA_SE_DUMMY_189, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BE */ DEFINE_SFX(NA_SE_DUMMY_190, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8BF */ DEFINE_SFX(NA_SE_PL_CRAWL_ICE, 0x30, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8C0 */ DEFINE_SFX(NA_SE_PL_MAGIC_SOUL_FLASH, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8C1 */ DEFINE_SFX(NA_SE_PL_ROLL_DUST, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x8C2 */ DEFINE_SFX(NA_SE_DUMMY_194, 0x30, 0, 0, 0, 0) +/* 0x8C3 */ DEFINE_SFX(NA_SE_PL_MAGIC_SOUL_BALL, 0x30, 0, 0, 0, 0) +/* 0x8C4 */ DEFINE_SFX(NA_SE_PL_SPIRAL_HEAL_BEAM, 0x30, 0, 0, 0, 0) +/* 0x8C5 */ DEFINE_SFX(NA_SE_PL_BOUND_NOWEAPON, 0x30, 0, 0, 0, 0) +/* 0x8C6 */ DEFINE_SFX(NA_SE_PL_PLANT_GROW_UP, 0x30, 0, 0, 0, 0) +/* 0x8C7 */ DEFINE_SFX(NA_SE_PL_PLANT_TALLER, 0x30, 0, 0, 0, 0) +/* 0x8C8 */ DEFINE_SFX(NA_SE_PL_MAGIC_WIND_VANISH, 0x60, 2, 0, 0, 0) +/* 0x8C9 */ DEFINE_SFX(NA_SE_PL_HOBBERBOOTS_LV, 0x30, 0, 0, 0, 0) +/* 0x8CA */ DEFINE_SFX(NA_SE_PL_PLANT_MOVE, 0x30, 0, 0, 0, 0) +/* 0x8CB */ DEFINE_SFX(NA_SE_EV_WALL_MOVE_SP, 0x30, 0, 0, 0, SFX_PARAM_RAND_FREQ_SCALE) +/* 0x8CC */ DEFINE_SFX(NA_SE_PL_PLANT_GROW_BIG, 0x30, 0, 0, 0, 0) +/* 0x8CD */ DEFINE_SFX(NA_SE_PL_TELESCOPE_MOVEMENT, 0x30, 0, 0, 0, 0) +/* 0x8CE */ DEFINE_SFX(NA_SE_PL_GIANT_WALK, 0x30, 3, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8CF */ DEFINE_SFX(NA_SE_PL_CHIBI_FAIRY_HEAL, 0x30, 0, 0, 0, 0) +/* 0x8D0 */ DEFINE_SFX(NA_SE_PL_SLIP_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D1 */ DEFINE_SFX(NA_SE_PL_SLIP_SAND_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D2 */ DEFINE_SFX(NA_SE_PL_SLIP_CONCRETE_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D3 */ DEFINE_SFX(NA_SE_PL_SLIP_DIRT_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D4 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER0_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D5 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER1_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D6 */ DEFINE_SFX(NA_SE_PL_SLIP_WATER2_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D7 */ DEFINE_SFX(NA_SE_PL_SLIP_MAGMA_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D8 */ DEFINE_SFX(NA_SE_PL_SLIP_GRASS_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8D9 */ DEFINE_SFX(NA_SE_PL_SLIP_IRON_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8DA */ DEFINE_SFX(NA_SE_PL_SLIP_LADDER_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8DB */ DEFINE_SFX(NA_SE_PL_SLIP_GLASS_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8DC */ DEFINE_SFX(NA_SE_PL_DUMMY_220, 0x30, 0, 0, 0, 0) +/* 0x8DD */ DEFINE_SFX(NA_SE_PL_SLIP_HEAVYBOOTS_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8DE */ DEFINE_SFX(NA_SE_PL_DUMMY_222, 0x30, 0, 0, 0, 0) +/* 0x8DF */ DEFINE_SFX(NA_SE_PL_SLIP_ICE_LEVEL, 0x30, 0, 0, 0, 0) +/* 0x8E0 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_FIRE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8E1 */ DEFINE_SFX(NA_SE_PL_GORON_BALLJUMP, 0x60, 0, 1, 0, 0) +/* 0x8E2 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_IN_GRD, 0x40, 0, 0, 0, 0) +/* 0x8E3 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_OUT_GRD, 0x30, 0, 0, 0, 0) +/* 0x8E4 */ DEFINE_SFX(NA_SE_PL_TRANSFORM, 0x30, 0, 0, 0, 0) +/* 0x8E5 */ DEFINE_SFX(NA_SE_PL_TRANSFORM_DEMO, 0x30, 0, 0, 0, 0) +/* 0x8E6 */ DEFINE_SFX(NA_SE_PL_GORON_TO_BALL, 0x30, 0, 0, 0, 0) +/* 0x8E7 */ DEFINE_SFX(NA_SE_PL_BALL_TO_GORON, 0x30, 0, 0, 0, 0) +/* 0x8E8 */ DEFINE_SFX(NA_SE_PL_GORON_PUNCH, 0x50, 3, 1, 0, 0) +/* 0x8E9 */ DEFINE_SFX(NA_SE_PL_SINK_ON_SAND, 0x30, 0, 0, 0, 0) +/* 0x8EA */ DEFINE_SFX(NA_SE_PL_SINK_ON_SNOW, 0x30, 0, 0, 0, 0) +/* 0x8EB */ DEFINE_SFX(NA_SE_PL_GORON_BALL_CHARGE, 0x30, 0, 0, 0, 0) +/* 0x8EC */ DEFINE_SFX(NA_SE_PL_ZORA_SWIM_DASH, 0x30, 0, 0, 0, 0) +/* 0x8ED */ DEFINE_SFX(NA_SE_PL_ZORA_SWIM_LV, 0x30, 0, 0, 0, 0) +/* 0x8EE */ DEFINE_SFX(NA_SE_PL_ZORA_SWIM_ROLL, 0x30, 0, 0, 0, 0) +/* 0x8EF */ DEFINE_SFX(NA_SE_PL_GORON_SQUAT, 0x30, 0, 0, 0, 0) +/* 0x8F0 */ DEFINE_SFX(NA_SE_PL_DUMMY_240, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F1 */ DEFINE_SFX(NA_SE_PL_DUMMY_241, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F2 */ DEFINE_SFX(NA_SE_PL_DUMMY_242, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F3 */ DEFINE_SFX(NA_SE_PL_DUMMY_243, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F4 */ DEFINE_SFX(NA_SE_PL_DUMMY_244, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F5 */ DEFINE_SFX(NA_SE_PL_DUMMY_245, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F6 */ DEFINE_SFX(NA_SE_PL_DUMMY_246, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F7 */ DEFINE_SFX(NA_SE_PL_DUMMY_247, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F8 */ DEFINE_SFX(NA_SE_PL_DUMMY_248, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8F9 */ DEFINE_SFX(NA_SE_PL_DUMMY_249, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FA */ DEFINE_SFX(NA_SE_PL_DUMMY_250, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FB */ DEFINE_SFX(NA_SE_PL_DUMMY_251, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FC */ DEFINE_SFX(NA_SE_PL_DUMMY_252, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FD */ DEFINE_SFX(NA_SE_PL_DUMMY_253, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FE */ DEFINE_SFX(NA_SE_PL_DUMMY_254, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x8FF */ DEFINE_SFX(NA_SE_PL_DUMMY_255, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x900 */ DEFINE_SFX(NA_SE_PL_DUMMY_256, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x901 */ DEFINE_SFX(NA_SE_PL_DUMMY_257, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x902 */ DEFINE_SFX(NA_SE_PL_DUMMY_258, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x903 */ DEFINE_SFX(NA_SE_PL_DUMMY_259, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x904 */ DEFINE_SFX(NA_SE_PL_DUMMY_260, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x905 */ DEFINE_SFX(NA_SE_PL_DUMMY_261, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x906 */ DEFINE_SFX(NA_SE_PL_DUMMY_262, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x907 */ DEFINE_SFX(NA_SE_PL_DUMMY_263, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x908 */ DEFINE_SFX(NA_SE_PL_DUMMY_264, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x909 */ DEFINE_SFX(NA_SE_PL_DUMMY_265, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90A */ DEFINE_SFX(NA_SE_PL_DUMMY_266, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90B */ DEFINE_SFX(NA_SE_PL_DUMMY_267, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90C */ DEFINE_SFX(NA_SE_PL_DUMMY_268, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90D */ DEFINE_SFX(NA_SE_PL_DUMMY_269, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90E */ DEFINE_SFX(NA_SE_PL_DUMMY_270, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x90F */ DEFINE_SFX(NA_SE_PL_DUMMY_271, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x910 */ DEFINE_SFX(NA_SE_PL_DUMMY_272, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x911 */ DEFINE_SFX(NA_SE_PL_DUMMY_273, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x912 */ DEFINE_SFX(NA_SE_PL_DUMMY_274, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x913 */ DEFINE_SFX(NA_SE_PL_DUMMY_275, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x914 */ DEFINE_SFX(NA_SE_PL_DUMMY_276, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x915 */ DEFINE_SFX(NA_SE_PL_DUMMY_277, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x916 */ DEFINE_SFX(NA_SE_PL_DUMMY_278, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x917 */ DEFINE_SFX(NA_SE_PL_DUMMY_279, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x918 */ DEFINE_SFX(NA_SE_PL_DUMMY_280, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x919 */ DEFINE_SFX(NA_SE_PL_DUMMY_281, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91A */ DEFINE_SFX(NA_SE_PL_DUMMY_282, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91B */ DEFINE_SFX(NA_SE_PL_DUMMY_283, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91C */ DEFINE_SFX(NA_SE_PL_DUMMY_284, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91D */ DEFINE_SFX(NA_SE_PL_DUMMY_285, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91E */ DEFINE_SFX(NA_SE_PL_DUMMY_286, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x91F */ DEFINE_SFX(NA_SE_PL_DUMMY_287, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x920 */ DEFINE_SFX(NA_SE_PL_DUMMY_288, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x921 */ DEFINE_SFX(NA_SE_PL_DUMMY_289, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x922 */ DEFINE_SFX(NA_SE_PL_DUMMY_290, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x923 */ DEFINE_SFX(NA_SE_PL_DUMMY_291, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x924 */ DEFINE_SFX(NA_SE_PL_DUMMY_292, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x925 */ DEFINE_SFX(NA_SE_PL_DUMMY_293, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x926 */ DEFINE_SFX(NA_SE_PL_DUMMY_294, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x927 */ DEFINE_SFX(NA_SE_PL_DUMMY_295, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x928 */ DEFINE_SFX(NA_SE_PL_DUMMY_296, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x929 */ DEFINE_SFX(NA_SE_PL_DUMMY_297, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92A */ DEFINE_SFX(NA_SE_PL_DUMMY_298, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92B */ DEFINE_SFX(NA_SE_PL_DUMMY_299, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92C */ DEFINE_SFX(NA_SE_PL_DUMMY_300, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92D */ DEFINE_SFX(NA_SE_PL_DUMMY_301, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92E */ DEFINE_SFX(NA_SE_PL_DUMMY_302, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x92F */ DEFINE_SFX(NA_SE_PL_DUMMY_303, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x930 */ DEFINE_SFX(NA_SE_PL_DUMMY_304, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x931 */ DEFINE_SFX(NA_SE_PL_DUMMY_305, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x932 */ DEFINE_SFX(NA_SE_PL_DUMMY_306, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x933 */ DEFINE_SFX(NA_SE_PL_DUMMY_307, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x934 */ DEFINE_SFX(NA_SE_PL_DUMMY_308, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x935 */ DEFINE_SFX(NA_SE_PL_DUMMY_309, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x936 */ DEFINE_SFX(NA_SE_PL_DUMMY_310, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x937 */ DEFINE_SFX(NA_SE_PL_DUMMY_311, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x938 */ DEFINE_SFX(NA_SE_PL_DUMMY_312, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x939 */ DEFINE_SFX(NA_SE_PL_DUMMY_313, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93A */ DEFINE_SFX(NA_SE_PL_DUMMY_314, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93B */ DEFINE_SFX(NA_SE_PL_DUMMY_315, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93C */ DEFINE_SFX(NA_SE_PL_DUMMY_316, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93D */ DEFINE_SFX(NA_SE_PL_DUMMY_317, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93E */ DEFINE_SFX(NA_SE_PL_DUMMY_318, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x93F */ DEFINE_SFX(NA_SE_PL_DUMMY_319, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x940 */ DEFINE_SFX(NA_SE_PL_DUMMY_320, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x941 */ DEFINE_SFX(NA_SE_PL_DUMMY_321, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x942 */ DEFINE_SFX(NA_SE_PL_DUMMY_322, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x943 */ DEFINE_SFX(NA_SE_PL_DUMMY_323, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x944 */ DEFINE_SFX(NA_SE_PL_DUMMY_324, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x945 */ DEFINE_SFX(NA_SE_PL_DUMMY_325, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x946 */ DEFINE_SFX(NA_SE_PL_DUMMY_326, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x947 */ DEFINE_SFX(NA_SE_PL_DUMMY_327, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x948 */ DEFINE_SFX(NA_SE_PL_DUMMY_328, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x949 */ DEFINE_SFX(NA_SE_PL_DUMMY_329, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94A */ DEFINE_SFX(NA_SE_PL_DUMMY_330, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94B */ DEFINE_SFX(NA_SE_PL_DUMMY_331, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94C */ DEFINE_SFX(NA_SE_PL_DUMMY_332, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94D */ DEFINE_SFX(NA_SE_PL_DUMMY_333, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94E */ DEFINE_SFX(NA_SE_PL_DUMMY_334, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x94F */ DEFINE_SFX(NA_SE_PL_DUMMY_335, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x950 */ DEFINE_SFX(NA_SE_PL_DUMMY_336, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x951 */ DEFINE_SFX(NA_SE_PL_DUMMY_337, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x952 */ DEFINE_SFX(NA_SE_PL_DUMMY_338, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x953 */ DEFINE_SFX(NA_SE_PL_DUMMY_339, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x954 */ DEFINE_SFX(NA_SE_PL_DUMMY_340, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x955 */ DEFINE_SFX(NA_SE_PL_DUMMY_341, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x956 */ DEFINE_SFX(NA_SE_PL_DUMMY_342, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x957 */ DEFINE_SFX(NA_SE_PL_DUMMY_343, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x958 */ DEFINE_SFX(NA_SE_PL_DUMMY_344, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x959 */ DEFINE_SFX(NA_SE_PL_DUMMY_345, 0x20, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95A */ DEFINE_SFX(NA_SE_PL_DUMMY_346, 0x20, 0, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95B */ DEFINE_SFX(NA_SE_PL_DUMMY_347, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95C */ DEFINE_SFX(NA_SE_PL_DUMMY_348, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95D */ DEFINE_SFX(NA_SE_PL_DUMMY_349, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95E */ DEFINE_SFX(NA_SE_PL_DUMMY_350, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x95F */ DEFINE_SFX(NA_SE_PL_DUMMY_351, 0x20, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x960 */ DEFINE_SFX(NA_SE_EV_MARATHONMAN_RISE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x961 */ DEFINE_SFX(NA_SE_PL_DUMMY_353, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x962 */ DEFINE_SFX(NA_SE_PL_DUMMY_354, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x963 */ DEFINE_SFX(NA_SE_PL_DUMMY_355, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x964 */ DEFINE_SFX(NA_SE_PL_DUMMY_356, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x965 */ DEFINE_SFX(NA_SE_PL_DUMMY_357, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x966 */ DEFINE_SFX(NA_SE_PL_DUMMY_358, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x967 */ DEFINE_SFX(NA_SE_PL_DUMMY_359, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x968 */ DEFINE_SFX(NA_SE_PL_DUMMY_360, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x969 */ DEFINE_SFX(NA_SE_PL_DUMMY_361, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96A */ DEFINE_SFX(NA_SE_PL_DUMMY_362, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96B */ DEFINE_SFX(NA_SE_PL_DUMMY_363, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96C */ DEFINE_SFX(NA_SE_PL_DUMMY_364, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96D */ DEFINE_SFX(NA_SE_PL_DUMMY_365, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96E */ DEFINE_SFX(NA_SE_PL_DUMMY_366, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x96F */ DEFINE_SFX(NA_SE_PL_DUMMY_367, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x970 */ DEFINE_SFX(NA_SE_EV_MARATHONMAN_LAND, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x971 */ DEFINE_SFX(NA_SE_PL_DUMMY_369, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x972 */ DEFINE_SFX(NA_SE_PL_DUMMY_370, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x973 */ DEFINE_SFX(NA_SE_PL_DUMMY_371, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x974 */ DEFINE_SFX(NA_SE_PL_DUMMY_372, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x975 */ DEFINE_SFX(NA_SE_PL_DUMMY_373, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x976 */ DEFINE_SFX(NA_SE_PL_DUMMY_374, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x977 */ DEFINE_SFX(NA_SE_PL_DUMMY_375, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x978 */ DEFINE_SFX(NA_SE_PL_DUMMY_376, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x979 */ DEFINE_SFX(NA_SE_PL_DUMMY_377, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97A */ DEFINE_SFX(NA_SE_PL_DUMMY378, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97B */ DEFINE_SFX(NA_SE_PL_DUMMY_379, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97C */ DEFINE_SFX(NA_SE_PL_DUMMY_380, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97D */ DEFINE_SFX(NA_SE_PL_DUMMY_381, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97E */ DEFINE_SFX(NA_SE_PL_DUMMY_382, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x97F */ DEFINE_SFX(NA_SE_PL_DUMMY_383, 0x40, 0, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x980 */ DEFINE_SFX(NA_SE_PL_GORON_CHG_ROLL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x981 */ DEFINE_SFX(NA_SE_PL_DUMMY_385, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x982 */ DEFINE_SFX(NA_SE_PL_DUMMY_386, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x983 */ DEFINE_SFX(NA_SE_PL_DUMMY_387, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x984 */ DEFINE_SFX(NA_SE_PL_DUMMY_388, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x985 */ DEFINE_SFX(NA_SE_PL_DUMMY_389, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x986 */ DEFINE_SFX(NA_SE_PL_DUMMY_390, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x987 */ DEFINE_SFX(NA_SE_PL_DUMMY_391, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x988 */ DEFINE_SFX(NA_SE_PL_DUMMY_392, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x989 */ DEFINE_SFX(NA_SE_PL_DUMMY_393, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98A */ DEFINE_SFX(NA_SE_PL_DUMMY_394, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98B */ DEFINE_SFX(NA_SE_PL_DUMMY_395, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98C */ DEFINE_SFX(NA_SE_PL_DUMMY_396, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98D */ DEFINE_SFX(NA_SE_PL_DUMMY_397, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98E */ DEFINE_SFX(NA_SE_PL_DUMMY_398, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x98F */ DEFINE_SFX(NA_SE_PL_GORON_CHG_ROLL_ICE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x990 */ DEFINE_SFX(NA_SE_PL_GORON_ROLL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x991 */ DEFINE_SFX(NA_SE_PL_DUMMY_401, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x992 */ DEFINE_SFX(NA_SE_PL_DUMMY_402, 0x50, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x993 */ DEFINE_SFX(NA_SE_PL_DUMMY_403, 0x50, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x994 */ DEFINE_SFX(NA_SE_PL_DUMMY_404, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x995 */ DEFINE_SFX(NA_SE_PL_DUMMY_405, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x996 */ DEFINE_SFX(NA_SE_PL_DUMMY_406, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x997 */ DEFINE_SFX(NA_SE_PL_DUMMY_407, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x998 */ DEFINE_SFX(NA_SE_PL_DUMMY_408, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x999 */ DEFINE_SFX(NA_SE_PL_DUMMY_409, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99A */ DEFINE_SFX(NA_SE_PL_DUMMY_410, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99B */ DEFINE_SFX(NA_SE_PL_DUMMY_411, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99C */ DEFINE_SFX(NA_SE_PL_DUMMY_412, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99D */ DEFINE_SFX(NA_SE_PL_DUMMY_413, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99E */ DEFINE_SFX(NA_SE_PL_DUMMY_414, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x99F */ DEFINE_SFX(NA_SE_PL_GORON_ROLL_ICE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A0 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_BUD, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A1 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_BUBLE_BREATH, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A2 */ DEFINE_SFX(NA_SE_PL_GORON_BALL_CHARGE_FAILED, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A3 */ DEFINE_SFX(NA_SE_PL_GORON_BALL_CHARGE_DASH, 0x60, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A4 */ DEFINE_SFX(NA_SE_PL_FACE_CHANGE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A5 */ DEFINE_SFX(NA_SE_PL_FACE_UP_S, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A6 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_STRUGGLE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A7 */ DEFINE_SFX(NA_SE_PL_WARP_PLATE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A8 */ DEFINE_SFX(NA_SE_PL_WARP_PLATE_OUT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9A9 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_ATTACK, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9AA */ DEFINE_SFX(NA_SE_PL_TRANSFORM_VOICE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9AB */ DEFINE_SFX(NA_SE_PL_FACE_RETURN, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9AC */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_DROP_BOMB, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9AD */ DEFINE_SFX(NA_SE_PL_GORON_SLIP, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9AE */ DEFINE_SFX(NA_SE_PL_ROLL_SNOW_DUST, 0x30, 0, 2, 0, SFX_PARAM_RAND_FREQ_LOWER) +/* 0x9AF */ DEFINE_SFX(NA_SE_PL_ZORA_SPARK_BARRIER, 0x40, 3, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B0 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B1 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP2, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B2 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP3, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B3 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP4, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B4 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP5, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B5 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP6, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B6 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP7, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B7 */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_JUMP8, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B8 */ DEFINE_SFX(NA_SE_PL_GORON_STOMACH_EXPLOSION, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9B9 */ DEFINE_SFX(NA_SE_PL_GORON_DRINK_BOMB, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BA */ DEFINE_SFX(NA_SE_PL_GET_UP, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BB */ DEFINE_SFX(NA_SE_PL_WARP_WING_OPEN, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BC */ DEFINE_SFX(NA_SE_PL_WARP_WING_CLOSE, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BD */ DEFINE_SFX(NA_SE_PL_WARP_WING_ROLL, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BE */ DEFINE_SFX(NA_SE_PL_WARP_WING_VANISH, 0x30, 0, 0, 0, SFX_FLAG_VOLUME_NO_DIST | SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9BF */ DEFINE_SFX(NA_SE_PL_DEKUNUTS_MISS_FIRE, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C0 */ DEFINE_SFX(NA_SE_PL_FLYING_AIR, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C1 */ DEFINE_SFX(NA_SE_PL_FIREWORKS, 0x30, 3, 1, 0, 0) +/* 0x9C2 */ DEFINE_SFX(NA_SE_PL_FIREWORKS_DUMMY, 0x30, 3, 1, 0, 0) +/* 0x9C3 */ DEFINE_SFX(NA_SE_PL_PULL_UP_SNOWBALL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C4 */ DEFINE_SFX(NA_SE_PL_WARP_WING_ROLL_2, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C5 */ DEFINE_SFX(NA_SE_PL_TRANSFORM_GIANT, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C6 */ DEFINE_SFX(NA_SE_PL_TRANSFORM_NORAML, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C7 */ DEFINE_SFX(NA_SE_PL_LI_OKARINATORI, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C8 */ DEFINE_SFX(NA_SE_PL_LI_FUTTOBI, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9C9 */ DEFINE_SFX(NA_SE_PL_LI_OP_OKIAGARI, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CA */ DEFINE_SFX(NA_SE_PL_LI_OP_TATIAGARI, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CB */ DEFINE_SFX(NA_SE_PL_JUMP_METAL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CC */ DEFINE_SFX(NA_SE_PL_LAND_METAL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CD */ DEFINE_SFX(NA_SE_PL_BOUND_METAL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CE */ DEFINE_SFX(NA_SE_PL_WALK_WALL, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x9CF */ DEFINE_SFX(NA_SE_PL_WALK_WALL_DEKU, 0x30, 0, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) diff --git a/include/tables/sfx/systembank_table.h b/include/tables/sfx/systembank_table.h new file mode 100644 index 000000000..9d27d5d49 --- /dev/null +++ b/include/tables/sfx/systembank_table.h @@ -0,0 +1,109 @@ +/** + * Sfx System Bank + * + * DEFINE_SFX should be used for all sfx define in the system bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the system bank in sequence 0 + */ +/* 0x4800 */ DEFINE_SFX(NA_SE_SY_WIN_OPEN, 0xC0, 0, 0, 0, 0) +/* 0x4801 */ DEFINE_SFX(NA_SE_SY_WIN_CLOSE, 0xC0, 0, 0, 0, 0) +/* 0x4802 */ DEFINE_SFX(NA_SE_SY_CORRECT_CHIME, 0xB0, 0, 0, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x4803 */ DEFINE_SFX(NA_SE_SY_GET_RUPY, 0x30, 0, 0, 0, 0) +/* 0x4804 */ DEFINE_SFX(NA_SE_SY_MESSAGE_WOMAN, 0x30, 0, 0, 0, 0) +/* 0x4805 */ DEFINE_SFX(NA_SE_SY_MESSAGE_MAN, 0x30, 0, 0, 0, 0) +/* 0x4806 */ DEFINE_SFX(NA_SE_SY_ERROR, 0x50, 0, 0, 0, 0) +/* 0x4807 */ DEFINE_SFX(NA_SE_SY_TRE_BOX_APPEAR, 0x30, 0, 0, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x4808 */ DEFINE_SFX(NA_SE_SY_DECIDE, 0x30, 0, 0, 0, 0) +/* 0x4809 */ DEFINE_SFX(NA_SE_SY_CURSOR, 0x30, 0, 0, 0, 0) +/* 0x480A */ DEFINE_SFX(NA_SE_SY_CANCEL, 0x30, 0, 0, 0, 0) +/* 0x480B */ DEFINE_SFX(NA_SE_SY_HP_RECOVER, 0x30, 0, 0, 0, 0) +/* 0x480C */ DEFINE_SFX(NA_SE_SY_ATTENTION_ON, 0x20, 0, 0, 0, 0) +/* 0x480D */ DEFINE_SFX(NA_SE_SY_DUMMY_13, 0x30, 0, 0, 0, 0) +/* 0x480E */ DEFINE_SFX(NA_SE_SY_DUMMY_14, 0x30, 0, 0, 0, 0) +/* 0x480F */ DEFINE_SFX(NA_SE_SY_LOCK_OFF, 0x30, 0, 0, 0, 0) +/* 0x4810 */ DEFINE_SFX(NA_SE_SY_LOCK_ON_HUMAN, 0x28, 0, 0, 0, 0) +/* 0x4811 */ DEFINE_SFX(NA_SE_SY_DUMMY_17, 0x30, 0, 0, 0, 0) +/* 0x4812 */ DEFINE_SFX(NA_SE_SY_DUMMY_18, 0x30, 0, 0, 0, 0) +/* 0x4813 */ DEFINE_SFX(NA_SE_SY_CAMERA_ZOOM_UP, 0x30, 0, 0, 0, 0) +/* 0x4814 */ DEFINE_SFX(NA_SE_SY_CAMERA_ZOOM_DOWN, 0x30, 0, 0, 0, 0) +/* 0x4815 */ DEFINE_SFX(NA_SE_SY_DUMMY_21, 0x30, 0, 0, 0, 0) +/* 0x4816 */ DEFINE_SFX(NA_SE_SY_DUMMY_22, 0x30, 0, 0, 0, 0) +/* 0x4817 */ DEFINE_SFX(NA_SE_SY_ATTENTION_ON_OLD, 0x30, 0, 0, 0, 0) +/* 0x4818 */ DEFINE_SFX(NA_SE_SY_MESSAGE_PASS, 0x18, 0, 0, 0, 0) +/* 0x4819 */ DEFINE_SFX(NA_SE_SY_WARNING_COUNT_N, 0x2C, 0, 0, 0, 0) +/* 0x481A */ DEFINE_SFX(NA_SE_SY_WARNING_COUNT_E, 0x2C, 0, 0, 0, 0) +/* 0x481B */ DEFINE_SFX(NA_SE_SY_HITPOINT_ALARM, 0x20, 0, 0, 0, 0) +/* 0x481C */ DEFINE_SFX(NA_SE_SY_DUMMY_28, 0x30, 0, 0, 0, 0) +/* 0x481D */ DEFINE_SFX(NA_SE_SY_DEMO_CUT, 0x30, 0, 0, 0, 0) +/* 0x481E */ DEFINE_SFX(NA_SE_SY_NAVY_CALL, 0x30, 0, 0, 0, 0) +/* 0x481F */ DEFINE_SFX(NA_SE_SY_GAUGE_UP, 0x30, 0, 0, 0, 0) +/* 0x4820 */ DEFINE_SFX(NA_SE_SY_DUMMY_32, 0x30, 0, 0, 0, 0) +/* 0x4821 */ DEFINE_SFX(NA_SE_SY_DUMMY_33, 0x30, 0, 0, 0, 0) +/* 0x4822 */ DEFINE_SFX(NA_SE_SY_DUMMY_34, 0x30, 0, 0, 0, 0) +/* 0x4823 */ DEFINE_SFX(NA_SE_SY_PIECE_OF_HEART, 0x30, 0, 0, 0, 0) +/* 0x4824 */ DEFINE_SFX(NA_SE_SY_GET_ITEM, 0x30, 0, 0, 0, 0) +/* 0x4825 */ DEFINE_SFX(NA_SE_SY_WIN_SCROLL_LEFT, 0x30, 0, 0, 0, 0) +/* 0x4826 */ DEFINE_SFX(NA_SE_SY_WIN_SCROLL_RIGHT, 0x30, 0, 0, 0, 0) +/* 0x4827 */ DEFINE_SFX(NA_SE_SY_OCARINA_ERROR, 0x20, 0, 0, 0, 0) +/* 0x4828 */ DEFINE_SFX(NA_SE_SY_CAMERA_ZOOM_UP_2, 0x30, 0, 0, 0, 0) +/* 0x4829 */ DEFINE_SFX(NA_SE_SY_CAMERA_ZOOM_DOWN_2, 0x30, 0, 0, 0, 0) +/* 0x482A */ DEFINE_SFX(NA_SE_SY_GLASSMODE_ON, 0x30, 0, 0, 0, 0) +/* 0x482B */ DEFINE_SFX(NA_SE_SY_GLASSMODE_OFF, 0x30, 0, 0, 0, 0) +/* 0x482C */ DEFINE_SFX(NA_SE_SY_FOUND, 0x60, 0, 0, 0, 0) +/* 0x482D */ DEFINE_SFX(NA_SE_SY_HIT_SOUND, 0x30, 0, 0, 0, 0) +/* 0x482E */ DEFINE_SFX(NA_SE_SY_MESSAGE_END, 0x30, 0, 0, 0, 0) +/* 0x482F */ DEFINE_SFX(NA_SE_SY_RUPY_COUNT, 0x30, 0, 0, 0, 0) +/* 0x4830 */ DEFINE_SFX(NA_SE_SY_LOCK_ON, 0x30, 0, 0, 0, 0) +/* 0x4831 */ DEFINE_SFX(NA_SE_SY_GET_BOXITEM, 0x30, 0, 0, 0, 0) +/* 0x4832 */ DEFINE_SFX(NA_SE_SY_WHITE_OUT_INTO_MOON, 0x30, 0, 0, 0, 0) +/* 0x4833 */ DEFINE_SFX(NA_SE_SY_WHITE_OUT_S, 0x30, 0, 0, 0, 0) +/* 0x4834 */ DEFINE_SFX(NA_SE_SY_WHITE_OUT_T, 0x30, 0, 0, 0, 0) +/* 0x4835 */ DEFINE_SFX(NA_SE_SY_START_SHOT, 0x30, 0, 0, 0, 0) +/* 0x4836 */ DEFINE_SFX(NA_SE_SY_METRONOME, 0x30, 0, 0, 0, 0) +/* 0x4837 */ DEFINE_SFX(NA_SE_SY_ATTENTION_URGENCY, 0x30, 0, 0, 0, 0) +/* 0x4838 */ DEFINE_SFX(NA_SE_SY_METRONOME_LV, 0x30, 0, 0, 0, 0) +/* 0x4839 */ DEFINE_SFX(NA_SE_SY_FSEL_CURSOR, 0x30, 0, 0, 0, 0) +/* 0x483A */ DEFINE_SFX(NA_SE_SY_FSEL_DECIDE_S, 0x30, 0, 0, 0, 0) +/* 0x483B */ DEFINE_SFX(NA_SE_SY_FSEL_DECIDE_L, 0x30, 0, 0, 0, 0) +/* 0x483C */ DEFINE_SFX(NA_SE_SY_FSEL_CLOSE, 0x30, 0, 0, 0, 0) +/* 0x483D */ DEFINE_SFX(NA_SE_SY_FSEL_ERROR, 0x30, 0, 0, 0, 0) +/* 0x483E */ DEFINE_SFX(NA_SE_SY_SET_FIRE_ARROW, 0x30, 0, 0, 0, 0) +/* 0x483F */ DEFINE_SFX(NA_SE_SY_SET_ICE_ARROW, 0x30, 0, 0, 0, 0) +/* 0x4840 */ DEFINE_SFX(NA_SE_SY_SET_LIGHT_ARROW, 0x30, 0, 0, 0, 0) +/* 0x4841 */ DEFINE_SFX(NA_SE_SY_SYNTH_MAGIC_ARROW, 0x30, 0, 0, 0, 0) +/* 0x4842 */ DEFINE_SFX(NA_SE_SY_METRONOME_2, 0x30, 0, 0, 0, 0) +/* 0x4843 */ DEFINE_SFX(NA_SE_SY_KINSTA_MARK_APPEAR, 0x30, 0, 0, 0, 0) +/* 0x4844 */ DEFINE_SFX(NA_SE_SY_FIVE_COUNT_LUPY, 0x30, 0, 0, 0, 0) +/* 0x4845 */ DEFINE_SFX(NA_SE_SY_CARROT_RECOVER, 0x30, 0, 0, 0, 0) +/* 0x4846 */ DEFINE_SFX(NA_SE_EV_FAIVE_LUPY_COUNT, 0x30, 0, 0, 0, 0) +/* 0x4847 */ DEFINE_SFX(NA_SE_SY_METRONOME_TEMPO, 0x30, 0, 0, 0, 0) +/* 0x4848 */ DEFINE_SFX(NA_SE_SY_COMICAL_SOUND0_0, 0x30, 0, 0, 0, 0) +/* 0x4849 */ DEFINE_SFX(NA_SE_SY_COMICAL_SOUND0_1, 0x30, 0, 0, 0, 0) +/* 0x484A */ DEFINE_SFX(NA_SE_SY_COMICAL_SOUND0_LAST, 0x30, 0, 0, 0, 0) +/* 0x484B */ DEFINE_SFX(NA_SE_SY_SOUT_DEMO, 0x30, 0, 0, 0, 0) +/* 0x484C */ DEFINE_SFX(NA_SE_SY_TIMESIGNAL_BELL, 0x30, 0, 0, 0, 0) +/* 0x484D */ DEFINE_SFX(NA_SE_SY_DEKUNUTS_JUMP_FAILED, 0x30, 0, 0, 0, 0) +/* 0x484E */ DEFINE_SFX(NA_SE_SY_ATTENTION_SOUND, 0x30, 0, 0, 0, 0) +/* 0x484F */ DEFINE_SFX(NA_SE_SY_TRANSFORM_MASK_FLASH, 0x30, 0, 0, 0, 0) +/* 0x4850 */ DEFINE_SFX(NA_SE_SY_CAMERA_SHUTTER, 0x30, 0, 0, 0, 0) +/* 0x4851 */ DEFINE_SFX(NA_SE_SY_STALKIDS_PSYCHO, 0x60, 0, 0, 0, 0) +/* 0x4852 */ DEFINE_SFX(NA_SE_SY_CHICK_JOIN_CHIME, 0x30, 0, 0, 0, 0) +/* 0x4853 */ DEFINE_SFX(NA_SE_SY_HIT_SOUND_L, 0x30, 0, 0, 0, 0) +/* 0x4854 */ DEFINE_SFX(NA_SE_SY_FAIRY_MASK_SUCCESS, 0x30, 0, 0, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x4855 */ DEFINE_SFX(NA_SE_SY_SCHEDULE_WRITE, 0x60, 0, 0, 0, 0) +/* 0x4856 */ DEFINE_SFX(NA_SE_SY_STOPWATCH_TIMER_3, 0x30, 0, 0, 0, 0) +/* 0x4857 */ DEFINE_SFX(NA_SE_SY_STOPWATCH_TIMER_INF, 0x30, 0, 0, 0, 0) +/* 0x4858 */ DEFINE_SFX(NA_SE_SY_EARTHQUAKE_OUTDOOR, 0x30, 0, 0, 0, 0) +/* 0x4859 */ DEFINE_SFX(NA_SE_SY_SPIRAL_DASH, 0x30, 0, 0, 0, 0) +/* 0x485A */ DEFINE_SFX(NA_SE_SY_QUIZ_CORRECT, 0x30, 0, 0, 0, 0) +/* 0x485B */ DEFINE_SFX(NA_SE_SY_QUIZ_INCORRECT, 0x30, 0, 0, 0, 0) +/* 0x485C */ DEFINE_SFX(NA_SE_SY_DIZZY_EFFECT, 0x30, 0, 0, 0, 0) +/* 0x485D */ DEFINE_SFX(NA_SE_SY_TIME_CONTROL_SLOW, 0xA0, 0, 0, 0, SFX_FLAG_LOWER_VOLUME_BGM) +/* 0x485E */ DEFINE_SFX(NA_SE_SY_TIME_CONTROL_NORMAL, 0xA0, 0, 0, 0, SFX_FLAG_LOWER_VOLUME_BGM) +/* 0x485F */ DEFINE_SFX(NA_SE_SY_SECOM_WARNING, 0x30, 0, 0, 0, 0) diff --git a/include/tables/sfx/voicebank_table.h b/include/tables/sfx/voicebank_table.h new file mode 100644 index 000000000..d2ce5aae3 --- /dev/null +++ b/include/tables/sfx/voicebank_table.h @@ -0,0 +1,413 @@ +/** + * Sfx Voice Bank + * + * DEFINE_SFX should be used for all sfx define in the voice bank from sequence 0 + * - Argument 0: Enum value for this sfx + * - Argument 1: Importance for deciding which sfx to prioritize. Higher values have greater importance + * - Argument 2: Slows the decay of volume with distance (a 3-bit number ranging from 0-7) + * - Argument 3: Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) + * - Argument 4: Various flags to add properties to the sfx + * - Argument 5: Various flags to add properties to the sfx + * + * WARNING: entries must align with the table defined for the voice bank in sequence 0 + */ +/* 0x6800 */ DEFINE_SFX(NA_SE_VO_LI_SWORD_N, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6801 */ DEFINE_SFX(NA_SE_VO_LI_SWORD_L, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6802 */ DEFINE_SFX(NA_SE_VO_LI_LASH, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6803 */ DEFINE_SFX(NA_SE_VO_LI_HANG, 0x20, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6804 */ DEFINE_SFX(NA_SE_VO_LI_CLIMB_END, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6805 */ DEFINE_SFX(NA_SE_VO_LI_DAMAGE_S, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6806 */ DEFINE_SFX(NA_SE_VO_LI_FREEZE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6807 */ DEFINE_SFX(NA_SE_VO_LI_FALL_S, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6808 */ DEFINE_SFX(NA_SE_VO_LI_FALL_L, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6809 */ DEFINE_SFX(NA_SE_VO_LI_BREATH_REST, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680A */ DEFINE_SFX(NA_SE_VO_LI_BREATH_DRINK, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680B */ DEFINE_SFX(NA_SE_VO_LI_DOWN, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680C */ DEFINE_SFX(NA_SE_VO_LI_TAKEN_AWAY, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680D */ DEFINE_SFX(NA_SE_VO_LI_HELD, 0x50, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680E */ DEFINE_SFX(NA_SE_VO_LI_SNEEZE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x680F */ DEFINE_SFX(NA_SE_VO_LI_SWEAT, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6810 */ DEFINE_SFX(NA_SE_VO_LI_DRINK, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6811 */ DEFINE_SFX(NA_SE_VO_LI_RELAX, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6812 */ DEFINE_SFX(NA_SE_VO_LI_SWORD_PUTAWAY, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6813 */ DEFINE_SFX(NA_SE_VO_LI_GROAN, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6814 */ DEFINE_SFX(NA_SE_VO_LI_AUTO_JUMP, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6815 */ DEFINE_SFX(NA_SE_VO_LI_MAGIC_NALE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6816 */ DEFINE_SFX(NA_SE_VO_LI_SURPRISE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6817 */ DEFINE_SFX(NA_SE_VO_LI_MAGIC_FROL, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6818 */ DEFINE_SFX(NA_SE_VO_LI_PUSH, 0x30, 2, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6819 */ DEFINE_SFX(NA_SE_VO_LI_HOOKSHOT_HANG, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681A */ DEFINE_SFX(NA_SE_VO_LI_LAND_DAMAGE_S, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681B */ DEFINE_SFX(NA_SE_VO_LI_MAGIC_START, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681C */ DEFINE_SFX(NA_SE_VO_LI_MAGIC_ATTACK, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681D */ DEFINE_SFX(NA_SE_VO_BL_DOWN, 0x80, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681E */ DEFINE_SFX(NA_SE_VO_LI_DEMO_DAMAGE, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x681F */ DEFINE_SFX(NA_SE_VO_LI_SWORD_N_copy30, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6820 */ DEFINE_SFX(NA_SE_VO_DUMMY_32, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6821 */ DEFINE_SFX(NA_SE_VO_DUMMY_33, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6822 */ DEFINE_SFX(NA_SE_VO_DUMMY_34, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6823 */ DEFINE_SFX(NA_SE_VO_DUMMY_35, 0x20, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6824 */ DEFINE_SFX(NA_SE_VO_DUMMY_36, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6825 */ DEFINE_SFX(NA_SE_VO_DUMMY_37, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6826 */ DEFINE_SFX(NA_SE_VO_DUMMY_38, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6827 */ DEFINE_SFX(NA_SE_VO_DUMMY_39, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6828 */ DEFINE_SFX(NA_SE_VO_NAVY_ENEMY, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6829 */ DEFINE_SFX(NA_SE_VO_NAVY_HELLO, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682A */ DEFINE_SFX(NA_SE_VO_NAVY_HEAR, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682B */ DEFINE_SFX(NA_SE_VO_DUMMY_43, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682C */ DEFINE_SFX(NA_SE_VO_DUMMY_44, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682D */ DEFINE_SFX(NA_SE_VO_DUMMY_45, 0x50, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682E */ DEFINE_SFX(NA_SE_VO_DUMMY_46, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x682F */ DEFINE_SFX(NA_SE_VO_DUMMY_47, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6830 */ DEFINE_SFX(NA_SE_VO_DUMMY_48, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6831 */ DEFINE_SFX(NA_SE_VO_DUMMY_49, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6832 */ DEFINE_SFX(NA_SE_VO_DUMMY_50, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6833 */ DEFINE_SFX(NA_SE_VO_DUMMY_51, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6834 */ DEFINE_SFX(NA_SE_VO_DUMMY_52, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6835 */ DEFINE_SFX(NA_SE_VO_DUMMY_53, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6836 */ DEFINE_SFX(NA_SE_VO_DUMMY_54, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6837 */ DEFINE_SFX(NA_SE_VO_DUMMY_55, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6838 */ DEFINE_SFX(NA_SE_VO_DUMMY_56, 0x30, 1, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6839 */ DEFINE_SFX(NA_SE_VO_DUMMY_57, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683A */ DEFINE_SFX(NA_SE_VO_DUMMY_58, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683B */ DEFINE_SFX(NA_SE_VO_DUMMY_59, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683C */ DEFINE_SFX(NA_SE_VO_DUMMY_60, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683D */ DEFINE_SFX(NA_SE_VO_DUMMY_61, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683E */ DEFINE_SFX(NA_SE_VO_DUMMY_62, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x683F */ DEFINE_SFX(NA_SE_VO_DUMMY_63, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6840 */ DEFINE_SFX(NA_SE_VO_LK_WAKE_UP, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6841 */ DEFINE_SFX(NA_SE_VO_LK_CATCH_DEMO, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6842 */ DEFINE_SFX(NA_SE_VO_LK_DRAGGED_DAMAGE, 0x30, 0, 0, 0, 0) +/* 0x6843 */ DEFINE_SFX(NA_SE_VO_NAVY_CALL, 0x60, 0, 0, 0, SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) +/* 0x6844 */ DEFINE_SFX(NA_SE_VO_NA_HELLO_3, 0x30, 0, 0, 0, 0) +/* 0x6845 */ DEFINE_SFX(NA_SE_VO_CHAT_MESSAGE_CALL, 0x30, 0, 0, 0, 0) +/* 0x6846 */ DEFINE_SFX(NA_SE_VO_BELL_MESSAGE, 0x30, 0, 0, 0, 0) +/* 0x6847 */ DEFINE_SFX(NA_SE_VO_MONDO_MESSAGE, 0x30, 0, 0, 0, 0) +/* 0x6848 */ DEFINE_SFX(NA_SE_VO_LK_USING_UP_ENERGY, 0x30, 0, 0, 0, 0) +/* 0x6849 */ DEFINE_SFX(NA_SE_VO_DUMMY_73, 0x30, 0, 0, 0, 0) +/* 0x684A */ DEFINE_SFX(NA_SE_VO_GO_SLEEP, 0x30, 0, 0, 0, 0) +/* 0x684B */ DEFINE_SFX(NA_SE_VO_NP_SLEEP_OUT, 0x30, 0, 0, 0, 0) +/* 0x684C */ DEFINE_SFX(NA_SE_VO_DUMMY_76, 0x30, 0, 0, 0, 0) +/* 0x684D */ DEFINE_SFX(NA_SE_VO_DUMMY_77, 0x30, 0, 0, 0, 0) +/* 0x684E */ DEFINE_SFX(NA_SE_VO_NP_DRINK, 0x30, 0, 0, 0, 0) +/* 0x684F */ DEFINE_SFX(NA_SE_VO_DUMMY_79, 0x30, 0, 0, 0, 0) +/* 0x6850 */ DEFINE_SFX(NA_SE_VO_NARRATION_0, 0x30, 0, 0, 0, 0) +/* 0x6851 */ DEFINE_SFX(NA_SE_VO_TA_SURPRISE, 0x30, 0, 0, 0, 0) +/* 0x6852 */ DEFINE_SFX(NA_SE_VO_TA_CRY_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6853 */ DEFINE_SFX(NA_SE_VO_TA_CRY_1, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6854 */ DEFINE_SFX(NA_SE_VO_IN_CRY_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6855 */ DEFINE_SFX(NA_SE_VO_IN_LOST, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6856 */ DEFINE_SFX(NA_SE_VO_IN_LASH_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6857 */ DEFINE_SFX(NA_SE_VO_IN_LASH_1, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6858 */ DEFINE_SFX(NA_SE_VO_FR_LAUGH_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6859 */ DEFINE_SFX(NA_SE_VO_FR_SMILE_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685A */ DEFINE_SFX(NA_SE_VO_NB_AGONY, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685B */ DEFINE_SFX(NA_SE_VO_NB_CRY_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685C */ DEFINE_SFX(NA_SE_VO_NB_NOTICE, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685D */ DEFINE_SFX(NA_SE_VO_NA_HELLO_0, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685E */ DEFINE_SFX(NA_SE_VO_NA_HELLO_1, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x685F */ DEFINE_SFX(NA_SE_VO_NA_HELLO_2, 0x30, 0, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6860 */ DEFINE_SFX(NA_SE_VO_RT_CRASH, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6861 */ DEFINE_SFX(NA_SE_VO_RT_DISCOVER, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6862 */ DEFINE_SFX(NA_SE_VO_RT_FALL, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6863 */ DEFINE_SFX(NA_SE_VO_RT_LAUGH_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6864 */ DEFINE_SFX(NA_SE_VO_RT_LIFT, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6865 */ DEFINE_SFX(NA_SE_VO_RT_THROW, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6866 */ DEFINE_SFX(NA_SE_VO_RT_UNBALLANCE, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6867 */ DEFINE_SFX(NA_SE_VO_ST_DAMAGE, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6868 */ DEFINE_SFX(NA_SE_VO_ST_ATTACK, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6869 */ DEFINE_SFX(NA_SE_VO_Z0_HURRY, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686A */ DEFINE_SFX(NA_SE_VO_Z0_MEET, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686B */ DEFINE_SFX(NA_SE_VO_Z0_QUESTION, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686C */ DEFINE_SFX(NA_SE_VO_Z0_SIGH_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686D */ DEFINE_SFX(NA_SE_VO_Z0_SMILE_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686E */ DEFINE_SFX(NA_SE_VO_Z0_SURPRISE, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x686F */ DEFINE_SFX(NA_SE_VO_Z0_THROW, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6870 */ DEFINE_SFX(NA_SE_VO_SK_CRY_0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6871 */ DEFINE_SFX(NA_SE_VO_SK_CRY_1, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6872 */ DEFINE_SFX(NA_SE_VO_SK_CRASH, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6873 */ DEFINE_SFX(NA_SE_VO_NA_LISTEN, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6874 */ DEFINE_SFX(NA_SE_VO_SK_SHOUT, 0x30, 1, 0, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6875 */ DEFINE_SFX(NA_SE_VO_Z1_CRY_0, 0x30, 3, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6876 */ DEFINE_SFX(NA_SE_VO_Z1_CRY_1, 0x30, 3, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6877 */ DEFINE_SFX(NA_SE_VO_Z1_OPENDOOR, 0x30, 3, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6878 */ DEFINE_SFX(NA_SE_VO_FR_SMILE_1, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6879 */ DEFINE_SFX(NA_SE_VO_FR_SMILE_2, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687A */ DEFINE_SFX(NA_SE_VO_KZ_MOVE, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687B */ DEFINE_SFX(NA_SE_VO_NB_LAUGH, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687C */ DEFINE_SFX(NA_SE_VO_IN_JOY0, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687D */ DEFINE_SFX(NA_SE_VO_IN_JOY1, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687E */ DEFINE_SFX(NA_SE_VO_IN_JOY2, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x687F */ DEFINE_SFX(NA_SE_VO_DUMMY_127, 0x30, 1, 1, 0, SFX_FLAG_FREQ_NO_DIST) +/* 0x6880 */ DEFINE_SFX(NA_SE_VO_DUMMY_128, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6881 */ DEFINE_SFX(NA_SE_VO_DUMMY_129, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6882 */ DEFINE_SFX(NA_SE_VO_DUMMY_130, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6883 */ DEFINE_SFX(NA_SE_VO_DUMMY_131, 0x20, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6884 */ DEFINE_SFX(NA_SE_VO_DUMMY_132, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6885 */ DEFINE_SFX(NA_SE_VO_DUMMY_133, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6886 */ DEFINE_SFX(NA_SE_VO_DUMMY_134, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6887 */ DEFINE_SFX(NA_SE_VO_DUMMY_135, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6888 */ DEFINE_SFX(NA_SE_VO_DUMMY_136, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6889 */ DEFINE_SFX(NA_SE_VO_DUMMY_137, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688A */ DEFINE_SFX(NA_SE_VO_DUMMY_138, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688B */ DEFINE_SFX(NA_SE_VO_DUMMY_139, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688C */ DEFINE_SFX(NA_SE_VO_DUMMY_140, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688D */ DEFINE_SFX(NA_SE_VO_DUMMY_141, 0x50, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688E */ DEFINE_SFX(NA_SE_VO_DUMMY_142, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x688F */ DEFINE_SFX(NA_SE_VO_DUMMY_143, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6890 */ DEFINE_SFX(NA_SE_VO_DUMMY_144, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6891 */ DEFINE_SFX(NA_SE_VO_DUMMY_145, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6892 */ DEFINE_SFX(NA_SE_VO_DUMMY_146, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6893 */ DEFINE_SFX(NA_SE_VO_DUMMY_147, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6894 */ DEFINE_SFX(NA_SE_VO_DUMMY_148, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6895 */ DEFINE_SFX(NA_SE_VO_DUMMY_149, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6896 */ DEFINE_SFX(NA_SE_VO_DUMMY_150, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6897 */ DEFINE_SFX(NA_SE_VO_DUMMY_151, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6898 */ DEFINE_SFX(NA_SE_VO_DUMMY_152, 0x30, 1, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6899 */ DEFINE_SFX(NA_SE_VO_DUMMY_153, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689A */ DEFINE_SFX(NA_SE_VO_DUMMY_154, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689B */ DEFINE_SFX(NA_SE_VO_DUMMY_155, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689C */ DEFINE_SFX(NA_SE_VO_DUMMY_156, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689D */ DEFINE_SFX(NA_SE_VO_DUMMY_157, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689E */ DEFINE_SFX(NA_SE_VO_DUMMY_158, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x689F */ DEFINE_SFX(NA_SE_VO_DUMMY_159, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A0 */ DEFINE_SFX(NA_SE_VO_DUMMY_160, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A1 */ DEFINE_SFX(NA_SE_VO_DUMMY_161, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A2 */ DEFINE_SFX(NA_SE_VO_DUMMY_162, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A3 */ DEFINE_SFX(NA_SE_VO_DUMMY_163, 0x20, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A4 */ DEFINE_SFX(NA_SE_VO_DUMMY_164, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A5 */ DEFINE_SFX(NA_SE_VO_DUMMY_165, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A6 */ DEFINE_SFX(NA_SE_VO_DUMMY_166, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A7 */ DEFINE_SFX(NA_SE_VO_DUMMY_167, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A8 */ DEFINE_SFX(NA_SE_VO_DUMMY_168, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68A9 */ DEFINE_SFX(NA_SE_VO_DUMMY_169, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AA */ DEFINE_SFX(NA_SE_VO_DUMMY_170, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AB */ DEFINE_SFX(NA_SE_VO_DUMMY_171, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AC */ DEFINE_SFX(NA_SE_VO_DUMMY_172, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AD */ DEFINE_SFX(NA_SE_VO_DUMMY_173, 0x50, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AE */ DEFINE_SFX(NA_SE_VO_DUMMY_174, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68AF */ DEFINE_SFX(NA_SE_VO_DUMMY_175, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B0 */ DEFINE_SFX(NA_SE_VO_DUMMY_176, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B1 */ DEFINE_SFX(NA_SE_VO_DUMMY_177, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B2 */ DEFINE_SFX(NA_SE_VO_DUMMY_178, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B3 */ DEFINE_SFX(NA_SE_VO_DUMMY_179, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B4 */ DEFINE_SFX(NA_SE_VO_DUMMY_180, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B5 */ DEFINE_SFX(NA_SE_VO_DUMMY_181, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B6 */ DEFINE_SFX(NA_SE_VO_DUMMY_182, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B7 */ DEFINE_SFX(NA_SE_VO_DUMMY_183, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B8 */ DEFINE_SFX(NA_SE_VO_DUMMY_184, 0x30, 2, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68B9 */ DEFINE_SFX(NA_SE_VO_DUMMY_185, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BA */ DEFINE_SFX(NA_SE_VO_DUMMY_186, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BB */ DEFINE_SFX(NA_SE_VO_DUMMY_187, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BC */ DEFINE_SFX(NA_SE_VO_DUMMY_188, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BD */ DEFINE_SFX(NA_SE_VO_DUMMY_189, 0x80, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BE */ DEFINE_SFX(NA_SE_VO_DUMMY_190, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68BF */ DEFINE_SFX(NA_SE_VO_DUMMY_191, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C0 */ DEFINE_SFX(NA_SE_VO_DUMMY_192, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C1 */ DEFINE_SFX(NA_SE_VO_DUMMY_193, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C2 */ DEFINE_SFX(NA_SE_VO_DUMMY_194, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C3 */ DEFINE_SFX(NA_SE_VO_DUMMY_195, 0x20, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C4 */ DEFINE_SFX(NA_SE_VO_DUMMY_196, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C5 */ DEFINE_SFX(NA_SE_VO_DUMMY_197, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C6 */ DEFINE_SFX(NA_SE_VO_DUMMY_198, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C7 */ DEFINE_SFX(NA_SE_VO_DUMMY_199, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C8 */ DEFINE_SFX(NA_SE_VO_DUMMY_200, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68C9 */ DEFINE_SFX(NA_SE_VO_DUMMY_201, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CA */ DEFINE_SFX(NA_SE_VO_DUMMY_202, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CB */ DEFINE_SFX(NA_SE_VO_DUMMY_203, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CC */ DEFINE_SFX(NA_SE_VO_DUMMY_204, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CD */ DEFINE_SFX(NA_SE_VO_DUMMY_205, 0x50, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CE */ DEFINE_SFX(NA_SE_VO_DUMMY_206, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68CF */ DEFINE_SFX(NA_SE_VO_DUMMY_207, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D0 */ DEFINE_SFX(NA_SE_VO_DUMMY_208, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D1 */ DEFINE_SFX(NA_SE_VO_DUMMY_209, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D2 */ DEFINE_SFX(NA_SE_VO_DUMMY_210, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D3 */ DEFINE_SFX(NA_SE_VO_DUMMY_211, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D4 */ DEFINE_SFX(NA_SE_VO_DUMMY_212, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D5 */ DEFINE_SFX(NA_SE_VO_DUMMY_213, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D6 */ DEFINE_SFX(NA_SE_VO_DUMMY_214, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D7 */ DEFINE_SFX(NA_SE_VO_DUMMY_215, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D8 */ DEFINE_SFX(NA_SE_VO_DUMMY_216, 0x30, 2, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68D9 */ DEFINE_SFX(NA_SE_VO_DUMMY_217, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DA */ DEFINE_SFX(NA_SE_VO_DUMMY_218, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DB */ DEFINE_SFX(NA_SE_VO_DUMMY_219, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DC */ DEFINE_SFX(NA_SE_VO_DUMMY_220, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DD */ DEFINE_SFX(NA_SE_VO_DUMMY_221, 0x80, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DE */ DEFINE_SFX(NA_SE_VO_DUMMY_222, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68DF */ DEFINE_SFX(NA_SE_VO_DUMMY_223, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E0 */ DEFINE_SFX(NA_SE_VO_LI_POO_WAIT, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E1 */ DEFINE_SFX(NA_SE_VO_DUMMY_225, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E2 */ DEFINE_SFX(NA_SE_VO_DUMMY_226, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E3 */ DEFINE_SFX(NA_SE_VO_DUMMY_227, 0x20, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E4 */ DEFINE_SFX(NA_SE_VO_DUMMY_228, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E5 */ DEFINE_SFX(NA_SE_VO_DUMMY_229, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E6 */ DEFINE_SFX(NA_SE_VO_DUMMY_230, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E7 */ DEFINE_SFX(NA_SE_VO_DUMMY_231, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E8 */ DEFINE_SFX(NA_SE_VO_DUMMY_232, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68E9 */ DEFINE_SFX(NA_SE_VO_DUMMY_233, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68EA */ DEFINE_SFX(NA_SE_VO_DUMMY_234, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68EB */ DEFINE_SFX(NA_SE_VO_DUMMY_235, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68EC */ DEFINE_SFX(NA_SE_VO_DUMMY_236, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68ED */ DEFINE_SFX(NA_SE_VO_DUMMY_237, 0x50, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68EE */ DEFINE_SFX(NA_SE_VO_DUMMY_238, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68EF */ DEFINE_SFX(NA_SE_VO_DUMMY_239, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F0 */ DEFINE_SFX(NA_SE_VO_DUMMY_240, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F1 */ DEFINE_SFX(NA_SE_VO_DUMMY_241, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F2 */ DEFINE_SFX(NA_SE_VO_DUMMY_242, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F3 */ DEFINE_SFX(NA_SE_VO_DUMMY_243, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F4 */ DEFINE_SFX(NA_SE_VO_DUMMY_244, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F5 */ DEFINE_SFX(NA_SE_VO_DUMMY_245, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F6 */ DEFINE_SFX(NA_SE_VO_DUMMY_246, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F7 */ DEFINE_SFX(NA_SE_VO_DUMMY_247, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F8 */ DEFINE_SFX(NA_SE_VO_DUMMY_248, 0x30, 2, 2, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68F9 */ DEFINE_SFX(NA_SE_VO_DUMMY_249, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FA */ DEFINE_SFX(NA_SE_VO_DUMMY_250, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FB */ DEFINE_SFX(NA_SE_VO_DUMMY_251, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FC */ DEFINE_SFX(NA_SE_VO_DUMMY_252, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FD */ DEFINE_SFX(NA_SE_VO_DUMMY_253, 0x80, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FE */ DEFINE_SFX(NA_SE_VO_DUMMY_254, 0x30, 2, 1, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x68FF */ DEFINE_SFX(NA_SE_VO_DUMMY_255, 0x30, 2, 1, SFX_FLAG2_APPLY_LOWPASS_FILTER, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6900 */ DEFINE_SFX(NA_SE_VO_JMVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6901 */ DEFINE_SFX(NA_SE_VO_JMVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6902 */ DEFINE_SFX(NA_SE_VO_CDVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6903 */ DEFINE_SFX(NA_SE_VO_CDVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6904 */ DEFINE_SFX(NA_SE_VO_CDVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6905 */ DEFINE_SFX(NA_SE_VO_CDVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6906 */ DEFINE_SFX(NA_SE_VO_BBVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6907 */ DEFINE_SFX(NA_SE_VO_BBVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6908 */ DEFINE_SFX(NA_SE_VO_BBVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6909 */ DEFINE_SFX(NA_SE_VO_BBVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690A */ DEFINE_SFX(NA_SE_VO_BBVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690B */ DEFINE_SFX(NA_SE_VO_BBVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690C */ DEFINE_SFX(NA_SE_VO_OBVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690D */ DEFINE_SFX(NA_SE_VO_ARVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690E */ DEFINE_SFX(NA_SE_VO_ARVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x690F */ DEFINE_SFX(NA_SE_VO_MMVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6910 */ DEFINE_SFX(NA_SE_VO_MMVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6911 */ DEFINE_SFX(NA_SE_VO_MMVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6912 */ DEFINE_SFX(NA_SE_VO_MMVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6913 */ DEFINE_SFX(NA_SE_VO_MMVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6914 */ DEFINE_SFX(NA_SE_VO_MMVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6915 */ DEFINE_SFX(NA_SE_VO_ABVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6916 */ DEFINE_SFX(NA_SE_VO_ABVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6917 */ DEFINE_SFX(NA_SE_VO_NPVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6918 */ DEFINE_SFX(NA_SE_VO_FPVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6919 */ DEFINE_SFX(NA_SE_VO_FPVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691A */ DEFINE_SFX(NA_SE_VO_FPVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691B */ DEFINE_SFX(NA_SE_VO_FPVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691C */ DEFINE_SFX(NA_SE_VO_ROVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691D */ DEFINE_SFX(NA_SE_VO_ROVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691E */ DEFINE_SFX(NA_SE_VO_RYVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x691F */ DEFINE_SFX(NA_SE_VO_RYVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6920 */ DEFINE_SFX(NA_SE_VO_RYVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6921 */ DEFINE_SFX(NA_SE_VO_RYVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6922 */ DEFINE_SFX(NA_SE_VO_ANVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6923 */ DEFINE_SFX(NA_SE_VO_ANVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6924 */ DEFINE_SFX(NA_SE_VO_ANVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6925 */ DEFINE_SFX(NA_SE_VO_ANVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6926 */ DEFINE_SFX(NA_SE_VO_CRVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6927 */ DEFINE_SFX(NA_SE_VO_CRVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6928 */ DEFINE_SFX(NA_SE_VO_CRVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6929 */ DEFINE_SFX(NA_SE_VO_CRVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692A */ DEFINE_SFX(NA_SE_VO_HNVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692B */ DEFINE_SFX(NA_SE_VO_HNVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692C */ DEFINE_SFX(NA_SE_VO_HNVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692D */ DEFINE_SFX(NA_SE_VO_RMVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692E */ DEFINE_SFX(NA_SE_VO_RMVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x692F */ DEFINE_SFX(NA_SE_VO_RMVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6930 */ DEFINE_SFX(NA_SE_VO_PMVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6931 */ DEFINE_SFX(NA_SE_VO_PMVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6932 */ DEFINE_SFX(NA_SE_VO_PMVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6933 */ DEFINE_SFX(NA_SE_VO_DHVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6934 */ DEFINE_SFX(NA_SE_VO_DHVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6935 */ DEFINE_SFX(NA_SE_VO_DHVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6936 */ DEFINE_SFX(NA_SE_VO_DHVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6937 */ DEFINE_SFX(NA_SE_VO_DHVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6938 */ DEFINE_SFX(NA_SE_VO_TFVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6939 */ DEFINE_SFX(NA_SE_VO_ANVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693A */ DEFINE_SFX(NA_SE_VO_ANVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693B */ DEFINE_SFX(NA_SE_VO_PMVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693C */ DEFINE_SFX(NA_SE_VO_CHVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693D */ DEFINE_SFX(NA_SE_VO_CHVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693E */ DEFINE_SFX(NA_SE_VO_CHVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x693F */ DEFINE_SFX(NA_SE_VO_CHVO06, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6940 */ DEFINE_SFX(NA_SE_VO_CHVO07, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6941 */ DEFINE_SFX(NA_SE_VO_CHVO08, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6942 */ DEFINE_SFX(NA_SE_VO_CHVO09, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6943 */ DEFINE_SFX(NA_SE_VO_DPVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6944 */ DEFINE_SFX(NA_SE_VO_DPVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6945 */ DEFINE_SFX(NA_SE_VO_DPVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6946 */ DEFINE_SFX(NA_SE_VO_SKVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6947 */ DEFINE_SFX(NA_SE_VO_SKVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6948 */ DEFINE_SFX(NA_SE_VO_KHVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6949 */ DEFINE_SFX(NA_SE_VO_KHVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694A */ DEFINE_SFX(NA_SE_VO_KHVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694B */ DEFINE_SFX(NA_SE_VO_SHVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694C */ DEFINE_SFX(NA_SE_VO_SHVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694D */ DEFINE_SFX(NA_SE_VO_KAVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694E */ DEFINE_SFX(NA_SE_VO_KAVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x694F */ DEFINE_SFX(NA_SE_VO_MTVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6950 */ DEFINE_SFX(NA_SE_VO_TTVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6951 */ DEFINE_SFX(NA_SE_VO_ITVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6952 */ DEFINE_SFX(NA_SE_VO_ITVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6953 */ DEFINE_SFX(NA_SE_VO_ITVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6954 */ DEFINE_SFX(NA_SE_VO_KMVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6955 */ DEFINE_SFX(NA_SE_VO_KMVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6956 */ DEFINE_SFX(NA_SE_VO_JOVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6957 */ DEFINE_SFX(NA_SE_VO_JYVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6958 */ DEFINE_SFX(NA_SE_VO_DTVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6959 */ DEFINE_SFX(NA_SE_VO_GUVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695A */ DEFINE_SFX(NA_SE_VO_KTVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695B */ DEFINE_SFX(NA_SE_VO_KTVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695C */ DEFINE_SFX(NA_SE_VO_KTVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695D */ DEFINE_SFX(NA_SE_VO_ZBVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695E */ DEFINE_SFX(NA_SE_VO_ZBVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x695F */ DEFINE_SFX(NA_SE_VO_DAVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6960 */ DEFINE_SFX(NA_SE_VO_SHVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6961 */ DEFINE_SFX(NA_SE_VO_GBVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6962 */ DEFINE_SFX(NA_SE_VO_GBVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6963 */ DEFINE_SFX(NA_SE_VO_PFVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6964 */ DEFINE_SFX(NA_SE_VO_PFVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6965 */ DEFINE_SFX(NA_SE_VO_GAVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6966 */ DEFINE_SFX(NA_SE_VO_GAVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6967 */ DEFINE_SFX(NA_SE_VO_DJVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6968 */ DEFINE_SFX(NA_SE_VO_DJVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6969 */ DEFINE_SFX(NA_SE_VO_MSVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696A */ DEFINE_SFX(NA_SE_VO_MSVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696B */ DEFINE_SFX(NA_SE_VO_JPVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696C */ DEFINE_SFX(NA_SE_VO_HYVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696D */ DEFINE_SFX(NA_SE_VO_HYVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696E */ DEFINE_SFX(NA_SE_VO_BAVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x696F */ DEFINE_SFX(NA_SE_VO_POVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6970 */ DEFINE_SFX(NA_SE_VO_DAVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6971 */ DEFINE_SFX(NA_SE_VO_DAVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6972 */ DEFINE_SFX(NA_SE_VO_MKVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6973 */ DEFINE_SFX(NA_SE_VO_MKVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6974 */ DEFINE_SFX(NA_SE_VO_MKVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6975 */ DEFINE_SFX(NA_SE_VO_MKVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6976 */ DEFINE_SFX(NA_SE_VO_MKVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6977 */ DEFINE_SFX(NA_SE_VO_TIVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6978 */ DEFINE_SFX(NA_SE_VO_TIVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6979 */ DEFINE_SFX(NA_SE_VO_TIVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697A */ DEFINE_SFX(NA_SE_VO_TIVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697B */ DEFINE_SFX(NA_SE_VO_TIVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697C */ DEFINE_SFX(NA_SE_VO_TIVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697D */ DEFINE_SFX(NA_SE_VO_OMVO00, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697E */ DEFINE_SFX(NA_SE_VO_OMVO01, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x697F */ DEFINE_SFX(NA_SE_VO_OMVO02, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6980 */ DEFINE_SFX(NA_SE_VO_OMVO03, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6981 */ DEFINE_SFX(NA_SE_VO_OMVO04, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6982 */ DEFINE_SFX(NA_SE_VO_OMVO05, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6983 */ DEFINE_SFX(NA_SE_VO_OMVO06, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6984 */ DEFINE_SFX(NA_SE_VO_DEMO_FALL2, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6985 */ DEFINE_SFX(NA_SE_VO_DEMO_384, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6986 */ DEFINE_SFX(NA_SE_VO_DEMO_385, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6987 */ DEFINE_SFX(NA_SE_VO_DEMO_386, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6988 */ DEFINE_SFX(NA_SE_VO_DEMO_387, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x6989 */ DEFINE_SFX(NA_SE_VO_DEMO_388, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698A */ DEFINE_SFX(NA_SE_VO_DEMO_389, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698B */ DEFINE_SFX(NA_SE_VO_DEMO_390, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698C */ DEFINE_SFX(NA_SE_VO_DEMO_391, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698D */ DEFINE_SFX(NA_SE_VO_DEMO_392, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698E */ DEFINE_SFX(NA_SE_VO_DEMO_393, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) +/* 0x698E */ DEFINE_SFX(NA_SE_VO_DEMO_394, 0x30, 2, 0, 0, SFX_FLAG_BEHIND_SCREEN_Z_INDEX) diff --git a/include/variables.h b/include/variables.h index 7ccb36154..4135fb693 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1553,7 +1553,7 @@ extern s16 gHighPassFilterData[]; extern s16 gBandStopFilterData[]; extern s16 gBandPassFilterData[]; extern s16* gWaveSamples[9]; -extern f32 gBendPitchOneOctaveFrequencies[256]; +extern f32 gBendPitchOneOctaveFrequencies[]; extern f32 gBendPitchTwoSemitonesFrequencies[]; extern f32 gPitchFrequencies[]; extern u8 gDefaultShortNoteVelocityTable[]; @@ -1582,20 +1582,13 @@ extern s32 gAudioContextInitalized; // extern UNK_TYPE1 D_801D5FF8; // extern UNK_TYPE4 D_801D5FFC; extern UNK_PTR D_801D6000; -// extern UNK_TYPE1 D_801D6010; -// extern UNK_TYPE1 D_801D6014; -// extern UNK_TYPE1 D_801D6028; -// extern UNK_TYPE1 D_801D6098; -// extern UNK_TYPE1 D_801D6100; -extern UNK_PTR D_801D6188; -extern UNK_PTR D_801D618C; // extern UNK_TYPE4 D_801D6190; // extern UNK_TYPE4 D_801D6194; // extern UNK_TYPE1 D_801D6200; -// extern UNK_TYPE1 D_801D6600; -// extern UNK_TYPE1 D_801D6608; -// extern UNK_TYPE1 D_801D6610; -// extern UNK_TYPE1 D_801D662C; +extern u8 gIsLargeSfxBank[7]; +extern u8 D_801D6608[7]; +extern u8 gChannelsPerBank[4][7]; +extern u8 gUsedChannelsPerBank[4][7]; // extern UNK_TYPE1 D_801D6648; // extern UNK_TYPE1 D_801D664C; // extern UNK_TYPE1 D_801D6650; @@ -1649,8 +1642,8 @@ extern f32 gSfxVolume; // extern UNK_TYPE1 D_801D6FD8; // extern UNK_TYPE1 D_801D6FDC; // extern UNK_TYPE1 D_801D6FE0; -// extern UNK_TYPE1 D_801D6FE4; -// extern UNK_TYPE1 D_801D6FE8; +// extern UNK_TYPE1 sPlaybackStaffStopPos; +// extern UNK_TYPE1 sPlaybackStaffStartPos; // extern UNK_TYPE4 D_801D6FEC; // extern UNK_TYPE4 D_801D6FF0; // extern UNK_TYPE2 D_801D6FF4; @@ -1717,28 +1710,17 @@ extern UNK_PTR D_801D8B24; // extern UNK_TYPE1 D_801D8E48; // extern UNK_TYPE1 D_801D8E50; // extern UNK_TYPE1 D_801D8F70; -// extern SfxParams sEnemyBankParams[]; -// extern SfxParams sPlayerBankParams[]; -// extern SfxParams sItemBankParams[]; -// extern SfxParams sEnvBankParams[]; -// extern SfxParams sSystemBankParams[]; -// extern SfxParams sOcarinaBankParams[]; -// extern SfxParams sVoiceBankParams[]; extern SfxParams* gSfxParams[7]; -// extern UNK_TYPE1 D_801DB470; -// extern UNK_TYPE1 D_801DB474; -extern UNK_PTR D_801DB478[7]; -// extern UNK_TYPE1 D_801DB494; -// extern UNK_TYPE1 D_801DB49C; -// extern UNK_TYPE2 D_801DB4A0; -extern Vec3f D_801DB4A4; -extern f32 D_801DB4B0; -extern s8 D_801DB4B8; +extern SfxBankEntry* gSfxBanks[7]; +extern u8 gSfxChannelLayout; +extern Vec3f gSfxDefaultPos; +extern f32 gSfxDefaultFreqAndVolScale; +extern s8 gSfxDefaultReverb; // extern UNK_TYPE1 D_801DB4C0; // extern UNK_TYPE1 D_801DB4C4; // extern UNK_TYPE1 D_801DB4C8; // extern UNK_TYPE1 D_801DB4CC; -// extern UNK_TYPE1 D_801DB4D4; +extern u8 gAudioSpecId; // extern UNK_TYPE1 D_801DB4D8; // extern UNK_TYPE4 D_801DB4DC; // extern UNK_TYPE1 D_801DB4E0; @@ -3471,21 +3453,21 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD5E8; // extern UNK_TYPE1 D_801FD608; // extern UNK_TYPE1 D_801FD610; -// extern UNK_TYPE1 D_801FD710; -// extern UNK_TYPE1 D_801FD8C0; -// extern UNK_TYPE1 D_801FDB00; -// extern UNK_TYPE1 D_801FE100; -// extern UNK_TYPE1 D_801FE4C0; -// extern UNK_TYPE1 D_801FE640; -// extern UNK_TYPE1 D_801FE6D0; -extern SoundRequest D_801FE7C0[1]; -// extern UNK_TYPE1 D_801FFBC0; -// extern UNK_TYPE1 D_801FFBC8; -// extern UNK_TYPE1 D_801FFBD0; -// extern UNK_TYPE1 D_801FFBD8; -// extern UNK_TYPE1 D_801FFC80; -// extern UNK_TYPE1 D_801FFC84; -// extern UNK_TYPE1 D_801FFC90; +// extern UNK_TYPE1 sSfxPlayerBank; +// extern UNK_TYPE1 sSfxItemBank; +// extern UNK_TYPE1 sSfxEnvironmentBank; +// extern UNK_TYPE1 sSfxEnemyBank; +// extern UNK_TYPE1 sSfxSystemBank; +// extern UNK_TYPE1 sSfxOcarinaBank; +// extern UNK_TYPE1 sSfxVoiceBank; +// extern SfxRequest sSfxRequests[0x100]; +// extern UNK_TYPE1 sSfxBankListEnd; +// extern UNK_TYPE1 sSfxBankFreeListStart; +// extern UNK_TYPE1 sSfxBankUnused; +extern ActiveSfx gActiveSfx[7][3]; +// extern UNK_TYPE1 sCurSfxPlayerChannelIndex; +// extern UNK_TYPE1 gSfxBankMuted; +// extern UNK_TYPE1 sUnusedBankLerp; // extern UNK_TYPE1 D_801FFD00; // extern UNK_TYPE1 D_801FFD34; // extern UNK_TYPE1 D_801FFD40; diff --git a/include/z64.h b/include/z64.h index b8638e81c..e97415a4d 100644 --- a/include/z64.h +++ b/include/z64.h @@ -98,17 +98,17 @@ typedef struct { } AnimatedMaterial; // size = 0x8 typedef struct { - /* 0x00 */ Vec3s pos; - /* 0x06 */ s16 unk_06; - /* 0x08 */ Gfx* opa; - /* 0x0C */ Gfx* xlu; -} PolygonDlist2; // size = 0x8 + /* 0x0 */ Vec3s pos; + /* 0x6 */ s16 unk_06; + /* 0x8 */ Gfx* opa; + /* 0xC */ Gfx* xlu; +} PolygonDlist2; // size = 0x10 typedef struct { - /* 0x00 */ u8 type; - /* 0x01 */ u8 num; // number of dlist entries - /* 0x04 */ void* start; - /* 0x08 */ void* end; + /* 0x0 */ u8 type; + /* 0x1 */ u8 num; // number of dlist entries + /* 0x4 */ void* start; + /* 0x8 */ void* end; } PolygonType2; // size = 0xC typedef struct { @@ -156,7 +156,7 @@ typedef struct { /* 0xA */ u8 colorsIndex; /* 0xB */ u8 flags; /* 0xC */ u8 lightParamsIndex; -} FireObjInitParams; // size = 0xD +} FireObjInitParams; // size = 0x10 typedef struct FireObjColors { /* 0x0 */ Color_RGBA8 primColor; @@ -183,17 +183,17 @@ typedef struct { } GameInfo; // size = 0x15D4 typedef struct { - /* 0x0000 */ u32 size; - /* 0x0004 */ void* bufp; - /* 0x0008 */ void* head; - /* 0x000C */ void* tail; + /* 0x0 */ u32 size; + /* 0x4 */ void* bufp; + /* 0x8 */ void* head; + /* 0xC */ void* tail; } TwoHeadArena; // size = 0x10 typedef struct { - /* 0x0000 */ u32 size; - /* 0x0004 */ Gfx* bufp; - /* 0x0008 */ Gfx* p; - /* 0x000C */ Gfx* d; + /* 0x0 */ u32 size; + /* 0x4 */ Gfx* bufp; + /* 0x8 */ Gfx* p; + /* 0xC */ Gfx* d; } TwoHeadGfxArena; // size = 0x10 typedef struct { @@ -663,29 +663,29 @@ typedef struct { } EnvironmentContext; // size = 0x100 typedef struct { - /* 0x00000 */ View view; - /* 0x00168 */ void* skyboxStaticSegment[4]; - /* 0x00178 */ void* skyboxPaletteStaticSegment; - /* 0x0017C */ Gfx* dListBuf; - /* 0x00180 */ Gfx* roomDL; - /* 0x00184 */ Vtx* roomVtx; - /* 0x00188 */ DmaRequest unk188; - /* 0x001A8 */ DmaRequest unk1A8; - /* 0x001C8 */ DmaRequest unk1C8; - /* 0x001E8 */ OSMesgQueue loadQueue; - /* 0x00200 */ OSMesg loadMsg; - /* 0x00204 */ s16 skyboxShouldDraw; - /* 0x00208 */ f32 rotX; - /* 0x0020C */ f32 rotY; - /* 0x00210 */ f32 rotZ; - /* 0x00214 */ Vec3f eye; - /* 0x00220 */ s16 angle; - /* 0x00222 */ u8 primR; - /* 0x00223 */ u8 primG; - /* 0x00224 */ u8 primB; - /* 0x00225 */ u8 envR; - /* 0x00226 */ u8 envG; - /* 0x00227 */ u8 envB; + /* 0x000 */ View view; + /* 0x168 */ void* skyboxStaticSegment[4]; + /* 0x178 */ void* skyboxPaletteStaticSegment; + /* 0x17C */ Gfx* dListBuf; + /* 0x180 */ Gfx* roomDL; + /* 0x184 */ Vtx* roomVtx; + /* 0x188 */ DmaRequest unk188; + /* 0x1A8 */ DmaRequest unk1A8; + /* 0x1C8 */ DmaRequest unk1C8; + /* 0x1E8 */ OSMesgQueue loadQueue; + /* 0x200 */ OSMesg loadMsg; + /* 0x204 */ s16 skyboxShouldDraw; + /* 0x208 */ f32 rotX; + /* 0x20C */ f32 rotY; + /* 0x210 */ f32 rotZ; + /* 0x214 */ Vec3f eye; + /* 0x220 */ s16 angle; + /* 0x222 */ u8 primR; + /* 0x223 */ u8 primG; + /* 0x224 */ u8 primB; + /* 0x225 */ u8 envR; + /* 0x226 */ u8 envG; + /* 0x227 */ u8 envB; } SkyboxContext; // size = 0x228 typedef enum { @@ -693,8 +693,8 @@ typedef enum { } SkyboxId; typedef struct ListAlloc { - /* 0x00 */ struct ListAlloc* prev; - /* 0x04 */ struct ListAlloc* next; + /* 0x0 */ struct ListAlloc* prev; + /* 0x4 */ struct ListAlloc* next; } ListAlloc; // size = 0x8 typedef struct { @@ -1003,7 +1003,7 @@ struct FireObjLight { /* 0x00 */ LightNode* light; /* 0x04 */ LightInfo lightInfo; /* 0x12 */ u8 lightParamsIndex; -}; // size = 0x13 +}; // size = 0x14 #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 @@ -1062,22 +1062,21 @@ struct FireObj { }; // size = 0x8B typedef struct { - /* 0x00 */ u8 seqIndex; - /* 0x01 */ u8 nightSeqIndex; - /* 0x02 */ u8 unk_02; + /* 0x0 */ u8 seqIndex; + /* 0x1 */ u8 nightSeqIndex; + /* 0x2 */ u8 unk_02; } SoundContext; // size = 0x3 typedef struct { - /* 0x00 */ s32 enabled; - /* 0x04 */ s32 timer; + /* 0x0 */ s32 enabled; + /* 0x4 */ s32 timer; } FrameAdvanceContext; // size = 0x8 typedef enum { - /* 00 */ GAMEOVER_INACTIVE, - /* 01 */ GAMEOVER_DEATH_START, - /* 02 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground - /* 03 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out - + /* 0 */ GAMEOVER_INACTIVE, + /* 1 */ GAMEOVER_DEATH_START, + /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground + /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out /* 20 */ GAMEOVER_REVIVE_START = 20, /* 21 */ GAMEOVER_REVIVE_RUMBLE, /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground @@ -1086,8 +1085,8 @@ typedef enum { } GameOverState; typedef struct { - /* 0x00 */ u16 state; -} GameOverContext; // size = 0x02 + /* 0x0 */ u16 state; +} GameOverContext; // size = 0x2 struct PlayState { /* 0x00000 */ GameState state; @@ -1158,7 +1157,7 @@ struct PlayState { /* 0x18875 */ s8 transitionTrigger; // "fade_direction" /* 0x18876 */ s16 unk_18876; /* 0x18878 */ s16 bgCoverAlpha; - /* 0x1887A */ u16 nextEntranceIndex; + /* 0x1887A */ u16 nextEntrance; /* 0x1887C */ s8 unk_1887C; // shootingGalleryStatus? /* 0x1887D */ s8 unk_1887D; /* 0x1887E */ s8 unk_1887E; @@ -1199,17 +1198,17 @@ typedef struct { } struct_800BD888_arg1; // size = 0x28 typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8 color; - /* 0x0C */ Color_RGBA8 envColor; + /* 0x0 */ u32 type; + /* 0x4 */ u32 setScissor; + /* 0x8 */ Color_RGBA8 color; + /* 0xC */ Color_RGBA8 envColor; } struct_801F8010; // size = 0x10 typedef struct { - /* 0x00 */ u32 useRgba; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8 primColor; - /* 0x08 */ Color_RGBA8 envColor; + /* 0x0 */ u32 useRgba; + /* 0x4 */ u32 setScissor; + /* 0x8 */ Color_RGBA8 primColor; + /* 0xC */ Color_RGBA8 envColor; } struct_801F8020; // size = 0x10 typedef struct { @@ -1237,9 +1236,9 @@ typedef struct { } TargetRangeParams; // size = 0x8 typedef struct { - /* 0x00 */ u8* value; - /* 0x04 */ const char* name; -} FlagSetEntry; // size = 0x08 + /* 0x0 */ u8* value; + /* 0x4 */ const char* name; +} FlagSetEntry; // size = 0x8 // TODO: Dedicated Header? #define FRAM_BASE_ADDRESS 0x08000000 // FRAM Base Address in Cart Memory diff --git a/include/z64actor.h b/include/z64actor.h index baec8e81a..175d9ef22 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -9,6 +9,7 @@ // This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD. #define AM_FIELD_SIZE SEGMENT_SIZE(ovl_Arrow_Fire) + #define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC collisions #define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects. @@ -31,18 +32,18 @@ typedef struct { } DamageTable; // size = 0x20 typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 cylRadius; - /* 0x04 */ s16 cylHeight; - /* 0x06 */ u8 mass; -} CollisionCheckInfoInit; + /* 0x0 */ u8 health; + /* 0x2 */ s16 cylRadius; + /* 0x4 */ s16 cylHeight; + /* 0x6 */ u8 mass; +} CollisionCheckInfoInit; // size = 0x8 typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 cylRadius; - /* 0x04 */ s16 cylHeight; - /* 0x06 */ s16 cylYShift; - /* 0x08 */ u8 mass; + /* 0x0 */ u8 health; + /* 0x2 */ s16 cylRadius; + /* 0x4 */ s16 cylHeight; + /* 0x6 */ s16 cylYShift; + /* 0x8 */ u8 mass; } CollisionCheckInfoInit2; // size = 0xC typedef struct { @@ -222,6 +223,7 @@ typedef struct { /* 0x15A */ s16 pad15A; } DynaPolyActor; // size = 0x15C + typedef enum { /* 0x00 */ ITEM00_RUPEE_GREEN, /* 0x01 */ ITEM00_RUPEE_BLUE, @@ -396,8 +398,8 @@ typedef struct ActorContext { } ActorContext; // size = 0x284 typedef enum { - /* 00 */ ACTOR_DRAW_DMGEFF_FIRE, - /* 01 */ ACTOR_DRAW_DMGEFF_BLUE_FIRE, + /* 0 */ ACTOR_DRAW_DMGEFF_FIRE, + /* 1 */ ACTOR_DRAW_DMGEFF_BLUE_FIRE, /* 10 */ ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX = 10, /* 11 */ ACTOR_DRAW_DMGEFF_FROZEN_SFX, /* 20 */ ACTOR_DRAW_DMGEFF_LIGHT_ORBS = 20, diff --git a/include/z64animation.h b/include/z64animation.h index cceb2547f..b697dbfdf 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -34,49 +34,49 @@ typedef enum { } AnimationTapers; typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; // The first child's index into the limb table. - /* 0x07 */ u8 sibling; // The parent limb's next limb index into the limb table. - /* 0x08 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; // The first child's index into the limb table. + /* 0x7 */ u8 sibling; // The parent limb's next limb index into the limb table. + /* 0x8 */ Gfx* dList; // Display lists for the limb. Index 0 is the normal display list, index 1 is the // far model display list. } StandardLimb; // size = 0xC // Model has limbs with only rigid meshes typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; - /* 0x07 */ u8 sibling; - /* 0x08 */ Gfx* dLists[2]; // Near and far + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; + /* 0x7 */ u8 sibling; + /* 0x8 */ Gfx* dLists[2]; // Near and far } LodLimb; // size = 0x10 // Model has limbs with only rigid meshes typedef struct { - /* 0x00 */ void** segment; - /* 0x04 */ u8 limbCount; + /* 0x0 */ void** segment; + /* 0x4 */ u8 limbCount; } SkeletonHeader; // size = 0x8 // Model has limbs with flexible meshes typedef struct { - /* 0x00 */ SkeletonHeader sh; - /* 0x08 */ u8 dListCount; + /* 0x0 */ SkeletonHeader sh; + /* 0x8 */ u8 dListCount; } FlexSkeletonHeader; // size = 0xC // Index into the frame data table. typedef struct { - /* 0x00 */ u16 x; - /* 0x02 */ u16 y; - /* 0x04 */ u16 z; -} JointIndex; // size = 0x06 + /* 0x0 */ u16 x; + /* 0x2 */ u16 y; + /* 0x4 */ u16 z; +} JointIndex; // size = 0x6 typedef struct { - /* 0x00 */ s16 frameCount; -} AnimationHeaderCommon; + /* 0x0 */ s16 frameCount; +} AnimationHeaderCommon; // size = 0x2 typedef struct { - /* 0x000 */ AnimationHeaderCommon common; - /* 0x004 */ s16* frameData; // referenced as tbl - /* 0x008 */ JointIndex* jointIndices; // referenced as ref_tbl - /* 0x00C */ u16 staticIndexMax; + /* 0x0 */ AnimationHeaderCommon common; + /* 0x4 */ s16* frameData; // referenced as tbl + /* 0x8 */ JointIndex* jointIndices; // referenced as ref_tbl + /* 0xC */ u16 staticIndexMax; } AnimationHeader; // size = 0x10 typedef struct { @@ -89,10 +89,10 @@ typedef struct { } JointKey; // size = 0x12 typedef struct { - /* 0x00 */ s16 frameCount; - /* 0x02 */ s16 limbCount; - /* 0x04 */ s16* frameData; - /* 0x08 */ JointKey* jointKey; + /* 0x0 */ s16 frameCount; + /* 0x2 */ s16 limbCount; + /* 0x4 */ s16* frameData; + /* 0x8 */ JointKey* jointKey; } LegacyAnimationHeader; // size = 0xC typedef enum { @@ -105,46 +105,46 @@ typedef enum { } AnimationType; typedef struct { - /* 0x000 */ DmaRequest req; - /* 0x020 */ OSMesgQueue msgQueue; - /* 0x038 */ OSMesg msg; + /* 0x00 */ DmaRequest req; + /* 0x20 */ OSMesgQueue msgQueue; + /* 0x38 */ OSMesg msg; } AnimEntryLoadFrame; // size = 0x3C typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; } AnimEntryCopyAll; // size = 0xC typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* base; - /* 0x008 */ Vec3s* mod; - /* 0x00C */ f32 weight; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* base; + /* 0x8 */ Vec3s* mod; + /* 0xC */ f32 weight; } AnimEntryInterp; // size = 0x10 typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; - /* 0x00C */ u8* copyFlag; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; + /* 0xC */ u8* copyFlag; } AnimEntryCopyTrue; // size = 0x10 typedef struct { - /* 0x000 */ u8 queueFlag; - /* 0x001 */ u8 vecCount; - /* 0x004 */ Vec3s* dst; - /* 0x008 */ Vec3s* src; - /* 0x00C */ u8* copyFlag; + /* 0x0 */ u8 queueFlag; + /* 0x1 */ u8 vecCount; + /* 0x4 */ Vec3s* dst; + /* 0x8 */ Vec3s* src; + /* 0xC */ u8* copyFlag; } AnimEntryCopyFalse; // size = 0x10 typedef struct { - /* 0x000 */ struct Actor* actor; - /* 0x004 */ struct SkelAnime* skelAnime; - /* 0x008 */ f32 unk08; + /* 0x0 */ struct Actor* actor; + /* 0x4 */ struct SkelAnime* skelAnime; + /* 0x8 */ f32 unk08; } AnimEntryMoveActor; // size = 0xC typedef union { @@ -157,8 +157,8 @@ typedef union { } AnimationEntryData; // size = 0x3C typedef struct { - /* 0x000 */ u8 type; - /* 0x004 */ AnimationEntryData data; + /* 0x00 */ u8 type; + /* 0x04 */ AnimationEntryData data; } AnimationEntry; // size = 0x40 typedef struct AnimationContext { @@ -167,8 +167,8 @@ typedef struct AnimationContext { } AnimationContext; // size = 0xC84 typedef struct { - /* 0x000 */ AnimationHeaderCommon common; - /* 0x004 */ u32 segment; + /* 0x0 */ AnimationHeaderCommon common; + /* 0x4 */ u32 segment; } LinkAnimationHeader; // size = 0x8 typedef struct SkelAnime { @@ -234,19 +234,19 @@ typedef struct { } AnimationInfo; // size = 0x18 typedef struct { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ s16 startFrame; - /* 0x0A */ s16 frameCount; - /* 0x0C */ u8 mode; - /* 0x0E */ s16 morphFrames; + /* 0x0 */ AnimationHeader* animation; + /* 0x4 */ f32 playSpeed; + /* 0x8 */ s16 startFrame; + /* 0xA */ s16 frameCount; + /* 0xC */ u8 mode; + /* 0xE */ s16 morphFrames; } AnimationInfoS; // size = 0x10 typedef struct AnimationSpeedInfo { - /* 0x00 */ AnimationHeader* animation; - /* 0x04 */ f32 playSpeed; - /* 0x08 */ u8 mode; - /* 0x0C */ f32 morphFrames; + /* 0x0 */ AnimationHeader* animation; + /* 0x4 */ f32 playSpeed; + /* 0x8 */ u8 mode; + /* 0xC */ f32 morphFrames; } AnimationSpeedInfo; // size = 0x10 struct SkeletonInfo; @@ -256,18 +256,18 @@ typedef s32 (*UnkKeyframeCallback)(struct PlayState* play, struct SkeletonInfo* // Keyframe limb? typedef struct { - /* 0x00 */ Gfx* dList; - /* 0x04 */ u8 unk_4; - /* 0x05 */ u8 flags; - /* 0x06 */ Vec3s root; + /* 0x0 */ Gfx* dList; + /* 0x4 */ u8 unk_4; + /* 0x5 */ u8 flags; + /* 0x6 */ Vec3s root; } Struct_801BFA14_Arg1_Field4; // size = 0xC // Other limb type? typedef struct { - /* 0x00 */ Gfx* dList; - /* 0x04 */ u8 unk_4; - /* 0x05 */ u8 flags; - /* 0x06 */ u8 unk_6; // transform limb draw index + /* 0x0 */ Gfx* dList; + /* 0x4 */ u8 unk_4; + /* 0x5 */ u8 flags; + /* 0x6 */ u8 unk_6; // transform limb draw index } Struct_801BFA14_Arg1_Field4_2; // size = 0x8 typedef struct { @@ -279,18 +279,18 @@ typedef struct { }; /* 0x08 */ s16* unk_8; /* 0x0C */ s16* unk_C; - /* 0x0C */ char unk_10[0x2]; + /* 0x10 */ char unk_10[0x2]; /* 0x12 */ s16 unk_12; -} Struct_801BFA14_Arg1; +} Struct_801BFA14_Arg1; // size = 0x14 typedef struct { /* 0x00 */ u16* unk_0; /* 0x04 */ s16* unk_4; /* 0x08 */ s16* unk_8; /* 0x0C */ s16* unk_C; - /* 0x0C */ char unk_10[0x2]; + /* 0x10 */ char unk_10[0x2]; /* 0x12 */ s16 unk_12; -} SkeletonInfo_1C; +} SkeletonInfo_1C; // size = 0x14 typedef struct { /* 0x00 */ f32 unk_0; @@ -299,7 +299,7 @@ typedef struct { /* 0x0C */ f32 unk_C; /* 0x10 */ f32 unk_10; /* 0x14 */ s32 unk_14; -} FrameControl; +} FrameControl; // size = 0x18 // FlexKeyframeSkeleton ? typedef struct SkeletonInfo { @@ -310,7 +310,7 @@ typedef struct SkeletonInfo { /* 0x24 */ f32 unk_24; // duration? current time? /* 0x28 */ Vec3s* frameData; // array of 3 Vec3s /* 0x2C */ s16* unk_2C; -} SkeletonInfo; +} SkeletonInfo; // size = 0x30 typedef s32 (*OverrideKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeletonInfo, s32 limbIndex, Gfx** dList, u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos); diff --git a/include/z64audio.h b/include/z64audio.h index af104b6c2..4095251ca 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -28,19 +28,12 @@ #define AIBUF_LEN 0x580 typedef enum { - /* 0 */ AUDIO_FS_STEREO, - /* 1 */ AUDIO_FS_HEADSET, - /* 2 */ AUDIO_FS_SURROUND, - /* 3 */ AUDIO_FS_MONO -} AudioFileSelectOption; - -typedef enum { - /* 0 */ AUDIO_MODE_STEREO, - /* 1 */ AUDIO_MODE_HEADSET, - /* 2 */ AUDIO_MODE_UNK, - /* 3 */ AUDIO_MODE_MONO, - /* 4 */ AUDIO_MODE_SURROUND -} AudioSoundMode; + /* 0 */ SOUNDMODE_STEREO, + /* 1 */ SOUNDMODE_HEADSET, + /* 2 */ SOUNDMODE_SURROUND, + /* 3 */ SOUNDMODE_MONO, + /* 4 */ SOUNDMODE_SURROUND_EXTERNAL, +} SoundMode; typedef enum { /* 0 */ ADSR_STATE_DISABLED, @@ -441,7 +434,7 @@ typedef struct SequenceChannel { /* 0x80 */ AdsrSettings adsr; /* 0x88 */ NotePool notePool; /* 0xC8 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib, "io ports" - /* 0xD0 */ u8* sfxState; + /* 0xD0 */ u8* sfxState; // SfxChannelState /* 0xD4 */ s16* filter; /* 0xD8 */ Stereo stereo; /* 0xDC */ s32 unk_DC; @@ -1080,51 +1073,47 @@ typedef enum { /* 1 */ SFX_STATE_QUEUED, /* 2 */ SFX_STATE_READY, /* 3 */ SFX_STATE_PLAYING_REFRESH, - /* 4 */ SFX_STATE_PLAYING_1, - /* 5 */ SFX_STATE_PLAYING_2 + /* 4 */ SFX_STATE_PLAYING, + /* 5 */ SFX_STATE_PLAYING_ONE_FRAME } SfxState; typedef struct { - /* 0x00 */ f32* posX; - /* 0x04 */ f32* posY; - /* 0x08 */ f32* posZ; - /* 0x0C */ f32* freqScale; - /* 0x10 */ f32* vol; - /* 0x14 */ s8* reverbAdd; - /* 0x18 */ f32 dist; - /* 0x1C */ u32 priority; // lower is more prioritized - /* 0x20 */ u16 sfxParams; - /* 0x22 */ u16 sfxId; - /* 0x25 */ u8 sfxFlags; - /* 0x24 */ u8 sfxImportance; - /* 0x26 */ u8 state; // uses SfxState enum - /* 0x27 */ u8 freshness; - /* 0x28 */ u8 prev; - /* 0x29 */ u8 next; - /* 0x2A */ u8 channelIdx; - /* 0x2B */ u8 unk_2F; - /* 0x2C */ u8 token; + /* 0x00 */ f32* posX; + /* 0x04 */ f32* posY; + /* 0x08 */ f32* posZ; + /* 0x0C */ f32* freqScale; + /* 0x10 */ f32* volume; + /* 0x14 */ s8* reverbAdd; + /* 0x18 */ f32 dist; + /* 0x1C */ u32 priority; // lower is more prioritized + /* 0x20 */ u16 sfxParams; + /* 0x22 */ u16 sfxId; + /* 0x25 */ u8 sfxFlags; + /* 0x24 */ u8 sfxImportance; + /* 0x26 */ u8 state; // uses SfxState enum + /* 0x27 */ u8 freshness; + /* 0x28 */ u8 prev; + /* 0x29 */ u8 next; + /* 0x2A */ u8 channelIndex; + /* 0x2B */ u8 randFreq; + /* 0x2C */ u8 token; } SfxBankEntry; // size = 0x30 /* - * SFX IDs + * SfxId: * - * index 0000000111111111 observed in audio code - * & 200 0000001000000000 single bit - * & 400 0000010000000000 single bit - * & 800 0000100000000000 single bit, what we currently call SFX_FLAG - * & 600 0000011000000000 2 bits - * & A00 0000101000000000 2 bits - * & C00 0000110000000000 2 bits, observed in audio code - * & E00 0000111000000000 all 3 bits - * bank 1111000000000000 observed in audio code + * & 03FF 0000000111111111 index + * & 0400 0000010000000000 unused flag + * & 0800 0000100000000000 SFX_FLAG + * & 0C00 0000110000000000 Flag Mask + * & F000 1111000000000000 observed in audio code */ #define SFX_BANK_SHIFT(sfxId) (((sfxId) >> 12) & 0xFF) #define SFX_BANK_MASK(sfxId) ((sfxId) & 0xF000) -#define SFX_INDEX(sfxId) ((sfxId) & 0x03FF) +#define SFX_INDEX(sfxId) ((sfxId) & 0x3FF) #define SFX_BANK(sfxId) SFX_BANK_SHIFT(SFX_BANK_MASK(sfxId)) typedef struct { @@ -1132,19 +1121,74 @@ typedef struct { /* 0x4 */ u8 entryIndex; } ActiveSfx; // size = 0x08 +// SfxParams bit-packing + +// Slows the decay of volume with distance (a 3-bit number ranging from 0-7) +#define SFX_PARAM_DIST_RANGE_SHIFT 0 +#define SFX_PARAM_DIST_RANGE_MASK_UPPER (4 << SFX_PARAM_DIST_RANGE_SHIFT) +#define SFX_PARAM_DIST_RANGE_MASK (7 << SFX_PARAM_DIST_RANGE_SHIFT) + +// Lower SEQ_PLAYER_BGM_MAIN and SEQ_PLAYER_BGM_SUB while the sfx is playing +#define SFX_FLAG_LOWER_VOLUME_BGM (1 << 3) + +// Sfx priority is not raised with distance (making it more likely to be ejected) +#define SFX_FLAG_PRIORITY_NO_DIST (1 << 4) + +// If a new sfx is requested at both the same position with the same importance, +// Block that new sfx from replacing the current sfx +// Note: Only 1 sfx can be played at a specific position at once +#define SFX_FLAG_BLOCK_EQUAL_IMPORTANCE (1 << 5) + +// Applies increasingly random offsets to frequency (a 2-bit number ranging from 0-3) +#define SFX_PARAM_RAND_FREQ_RAISE_SHIFT 6 +#define SFX_PARAM_RAND_FREQ_RAISE_MASK (3 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT) + +// Sets a flag to ioPort 5 +#define SFX_FLAG_8 (1 << 8) + +// Use lowpass filter on surround sound +#define SFX_FLAG_SURROUND_LOWPASS_FILTER (1 << 9) + +// Unused remnant of OoT +#define SFX_FLAG_BEHIND_SCREEN_Z_INDEX_SHIFT 10 +#define SFX_FLAG_BEHIND_SCREEN_Z_INDEX (1 << SFX_FLAG_BEHIND_SCREEN_Z_INDEX_SHIFT) + +// Randomly scale base frequency each frame through mutiplicative offset +#define SFX_PARAM_RAND_FREQ_SCALE (1 << 11) + +// Sfx reverb is not raised with distance +#define SFX_FLAG_REVERB_NO_DIST (1 << 12) + +// Sfx volume is not lowered with distance +#define SFX_FLAG_VOLUME_NO_DIST (1 << 13) + +// SFX_FLAG_VIBRATO +// Randomly lower base frequency each frame through additive offset +#define SFX_PARAM_RAND_FREQ_LOWER (1 << 14) + +// Sfx frequency is not raised with distance +#define SFX_FLAG_FREQ_NO_DIST (1 << 15) + +// Force the sfx to reset from the beginning when requested again +#define SFX_FLAG2_FORCE_RESET (1 << 0) + +// Unused +#define SFX_FLAG2_UNUSED2 (1 << 2) +#define SFX_FLAG2_UNUSED4 (1 << 4) + +// Do not use highpass filter on surround sound +#define SFX_FLAG2_SURROUND_NO_HIGHPASS_FILTER (1 << 5) + +// Unused +#define SFX_FLAG2_UNUSED6 (1 << 6) + +// Apply a low-pass filter with a lowPassCutoff of 4 +#define SFX_FLAG2_APPLY_LOWPASS_FILTER (1 << 7) + typedef struct { /* 0x0 */ u8 importance; /* 0x1 */ u8 flags; /* 0x2 */ u16 params; } SfxParams; // size = 0x4 -typedef struct { - /* 0x00 */ u16 sfxId; - /* 0x02 */ u8 token; - /* 0x04 */ s8* reverbAdd; - /* 0x08 */ Vec3f* pos; - /* 0x0C */ f32* freqScale; - /* 0x10 */ f32* vol; -} SoundRequest; // size = 0x14 - #endif diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index f0d24fd6f..b42938354 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -72,20 +72,20 @@ typedef struct { } ScaleRotPos; // size = 0x20 typedef struct CollisionPoly { - /* 0x00 */ u16 type; + /* 0x0 */ u16 type; union { - u16 vtxData[3]; + /* 0x2 */ u16 vtxData[3]; struct { - /* 0x02 */ u16 flags_vIA; // 0xE000 is poly exclusion flags (xpFlags), 0x1FFF is vtxId - /* 0x04 */ u16 flags_vIB; // 0xE000 is flags, 0x1FFF is vtxId + /* 0x2 */ u16 flags_vIA; // 0xE000 is poly exclusion flags (xpFlags), 0x1FFF is vtxId + /* 0x4 */ u16 flags_vIB; // 0xE000 is flags, 0x1FFF is vtxId // 0x2000 = poly IsConveyor surface - /* 0x06 */ u16 vIC; + /* 0x6 */ u16 vIC; }; }; - /* 0x08 */ Vec3s normal; // Unit normal vector + /* 0x8 */ Vec3s normal; // Unit normal vector // Value ranges from -0x7FFF to 0x7FFF, representing -1.0 to 1.0; 0x8000 is invalid - /* 0x0E */ s16 dist; // Plane distance from origin along the normal + /* 0xE */ s16 dist; // Plane distance from origin along the normal } CollisionPoly; // size = 0x10 typedef struct { @@ -158,9 +158,10 @@ typedef struct { /* 0x2 */ u16 next; // index of the next SSNode in the list, or SS_NULL if last element } SSNode; // size = 0x4 +// represents a linked list of type SSNode typedef struct { - u16 head; // index of the first SSNode in the list, or SS_NULL if the list is empty -} SSList; // represents a linked list of type SSNode + /* 0x0 */ u16 head; // index of the first SSNode in the list, or SS_NULL if the list is empty +} SSList; // size = 0x2 typedef struct { /* 0x0 */ u16 max; @@ -313,8 +314,9 @@ typedef struct { } BgSpecialSceneMeshSubdivision; // size = 0xC typedef struct { - s16 sceneId; - Vec3s subdivAmount; - s32 nodeListMax; // if -1, dynamically compute max nodes -} BgCheckSceneSubdivisionEntry; + /* 0x0 */ s16 sceneId; + /* 0x2 */ Vec3s subdivAmount; + /* 0x8 */ s32 nodeListMax; // if -1, dynamically compute max nodes +} BgCheckSceneSubdivisionEntry; // size = 0xC + #endif diff --git a/include/z64collision_check.h b/include/z64collision_check.h index fbfcff7ae..434b74a3a 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -21,54 +21,54 @@ typedef struct { } Collider; // size = 0x18 typedef struct { - /* 0x00 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x01 */ u8 atFlags; // Information flags for AT collisions. - /* 0x02 */ u8 acFlags; // Information flags for OC collisions. - /* 0x03 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x04 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. - /* 0x05 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInit; // size = 0x06 + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for OC collisions. + /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x4 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. + /* 0x5 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInit; // size = 0x6 typedef struct { - /* 0x00 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x01 */ u8 atFlags; // Information flags for AT collisions. - /* 0x02 */ u8 acFlags; // Information flags for AC collisions. - /* 0x03 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x04 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInitType1; // size = 0x05 + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for AC collisions. + /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x4 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInitType1; // size = 0x5 typedef struct { - /* 0x00 */ struct Actor* actor; // Attached actor - /* 0x04 */ u8 atFlags; // Information flags for AT collisions. - /* 0x05 */ u8 acFlags; // Information flags for AC collisions. - /* 0x06 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x07 */ u8 shape; // JntSph, Cylinder, Tris, or Quad -} ColliderInitToActor; // size = 0x08 + /* 0x0 */ struct Actor* actor; // Attached actor + /* 0x4 */ u8 atFlags; // Information flags for AT collisions. + /* 0x5 */ u8 acFlags; // Information flags for AC collisions. + /* 0x6 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x7 */ u8 shape; // JntSph, Cylinder, Tris, or Quad +} ColliderInitToActor; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 damage; // Damage or Stun Timer -} ColliderTouch; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer +} ColliderTouch; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 damage; // Damage or Stun Timer -} ColliderTouchInit; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer +} ColliderTouchInit; // size = 0x8 typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper damage type flags. - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 defense; // Damage Resistance - /* 0x06 */ Vec3s hitPos; // Point of contact -} ColliderBump; // size = 0x0C + /* 0x0 */ u32 dmgFlags; // Bumper damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance + /* 0x6 */ Vec3s hitPos; // Point of contact +} ColliderBump; // size = 0xC typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper exclusion mask - /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 defense; // Damage Resistance -} ColliderBumpInit; // size = 0x08 + /* 0x0 */ u32 dmgFlags; // Bumper exclusion mask + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance +} ColliderBumpInit; // size = 0x8 typedef struct ColliderInfo { /* 0x00 */ ColliderTouch toucher; // Damage properties when acting as an AT collider @@ -100,10 +100,10 @@ typedef struct { } ColliderJntSphElementDim; // size = 0x18 typedef struct { - /* 0x00 */ u8 limb; // attached limb - /* 0x02 */ Sphere16 modelSphere; // model space sphere - /* 0x0A */ s16 scale; // world space sphere = model * scale * 0.01 -} ColliderJntSphElementDimInit; // size = 0x0C + /* 0x0 */ u8 limb; // attached limb + /* 0x2 */ Sphere16 modelSphere; // model space sphere + /* 0xA */ s16 scale; // world space sphere = model * scale * 0.01 +} ColliderJntSphElementDimInit; // size = 0xC typedef struct { /* 0x00 */ ColliderInfo info; @@ -128,15 +128,15 @@ typedef struct { } ColliderJntSphInit; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderJntSphElementInit* elements; + /* 0x0 */ ColliderInitType1 base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderJntSphElementInit* elements; } ColliderJntSphInitType1; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitToActor base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderJntSphElementInit* elements; + /* 0x0 */ ColliderInitToActor base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderJntSphElementInit* elements; } ColliderJntSphInitToActor; // size = 0x10 typedef struct { @@ -190,9 +190,9 @@ typedef struct { } ColliderTrisInit; // size = 0x10 typedef struct { - /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ s32 count; - /* 0x0C */ ColliderTrisElementInit* elements; + /* 0x0 */ ColliderInitType1 base; + /* 0x8 */ s32 count; + /* 0xC */ ColliderTrisElementInit* elements; } ColliderTrisInitType1; // size = 0x10 typedef struct { @@ -254,8 +254,8 @@ typedef struct { } CollisionCheckContext; // size = 0x29C typedef struct { - /* 0 */ u8 blood; - /* 1 */ u8 effect; + /* 0x0 */ u8 blood; + /* 0x1 */ u8 effect; } HitInfo; // size = 0x2 typedef enum { diff --git a/include/z64cutscene.h b/include/z64cutscene.h index aa0681de5..f4cc10802 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -5,11 +5,11 @@ #include "unk.h" typedef struct { - /* 0x00 */ s8 continueFlag; - /* 0x01 */ s8 cameraRoll; - /* 0x02 */ u16 nextPointFrame; - /* 0x04 */ f32 viewAngle; // in degrees - /* 0x08 */ Vec3s pos; + /* 0x0 */ s8 continueFlag; + /* 0x1 */ s8 cameraRoll; + /* 0x2 */ u16 nextPointFrame; + /* 0x4 */ f32 viewAngle; // in degrees + /* 0x8 */ Vec3s pos; } CutsceneCameraPoint; // size = 0x10 typedef struct { @@ -86,13 +86,13 @@ typedef struct { } CsCmdTextbox; // size = 0xC typedef enum { - /* 0 */ CS_TEXTBOX_TYPE_DEFAULT, - /* 1 */ CS_TEXTBOX_TYPE_1, - /* 2 */ CS_TEXTBOX_TYPE_LEARN_SONG, - /* 3 */ CS_TEXTBOX_TYPE_3, - /* 4 */ CS_TEXTBOX_TYPE_BOSSES_REMAINS, - /* 5 */ CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS, - /* 0xFFFF */ CS_TEXTBOX_TYPE_NONE = 0xFFFF + /* -1 */ CS_TEXTBOX_TYPE_NONE = -1, + /* 0 */ CS_TEXTBOX_TYPE_DEFAULT, + /* 1 */ CS_TEXTBOX_TYPE_1, + /* 2 */ CS_TEXTBOX_TYPE_LEARN_SONG, + /* 3 */ CS_TEXTBOX_TYPE_3, + /* 4 */ CS_TEXTBOX_TYPE_BOSSES_REMAINS, + /* 5 */ CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS } CutsceneTextboxType; typedef struct { @@ -145,13 +145,12 @@ typedef enum { /* 0x108 */ CS_CMD_UNK_108 = 0x108, /* 0x109 */ CS_CMD_UNK_109, /* 0x12C */ CS_CMD_PLAYSEQ = 0x12C, - /* 0x12D */ CS_CMD_UNK_12D, - /* 0x130 */ CS_CMD_130 = 0x130, + /* 0x12D */ CS_CMD_STOPSEQ, + /* 0x12E */ CS_CMD_PLAYAMBIENCE, + /* 0x12F */ CS_CMD_FADEAMBIENCE, + /* 0x130 */ CS_CMD_130, /* 0x131 */ CS_CMD_131, /* 0x132 */ CS_CMD_132, - /* 0x133 */ CS_CMD_STOPSEQ, - /* 0x134 */ CS_CMD_PLAYAMBIENCE, - /* 0x135 */ CS_CMD_FADEAMBIENCE, /* 0x15E */ CS_CMD_TERMINATOR = 0x15E, /* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES, /* 0x190 */ CS_CMD_RUMBLE = 0x190 @@ -166,7 +165,7 @@ typedef union CutsceneData { typedef struct { /* 0x0 */ CutsceneData* segmentedData; - /* 0x4 */ s16 nextEntranceIndex; + /* 0x4 */ s16 nextEntrance; /* 0x6 */ u8 unk6; /* 0x7 */ u8 unk7; // a weekEventReg bitpack? } CutsceneEntry; // size = 0x8 diff --git a/include/z64dma.h b/include/z64dma.h index 570aa8432..3b17d04d0 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -15,10 +15,10 @@ typedef struct { } DmaRequest; // size = 0x20 typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ u32 romStart; - /* 0x0C */ u32 romEnd; + /* 0x0 */ u32 vromStart; + /* 0x4 */ u32 vromEnd; + /* 0x8 */ u32 romStart; + /* 0xC */ u32 romEnd; } DmaEntry; // size = 0x10 #endif diff --git a/include/z64effect.h b/include/z64effect.h index fb9d9e159..dde996eb7 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -33,10 +33,10 @@ struct PlayState; #define rgObjBankIndex regs[11] typedef struct { - /* 0x00 */ u8 active; - /* 0x01 */ u8 unk1; - /* 0x02 */ u8 unk2; -} EffectStatus; // size = 0x03 + /* 0x0 */ u8 active; + /* 0x1 */ u8 unk1; + /* 0x2 */ u8 unk2; +} EffectStatus; // size = 0x3 typedef struct { /* 0x00 */ Vec3f velocity; @@ -227,11 +227,11 @@ typedef struct { } EffectInfo; // size = 0x14 typedef enum { - /* 0x00 */ EFFECT_SPARK, - /* 0x01 */ EFFECT_BLURE1, - /* 0x02 */ EFFECT_BLURE2, - /* 0x03 */ EFFECT_SHIELD_PARTICLE, - /* 0x04 */ EFFECT_TIRE_MARK + /* 0 */ EFFECT_SPARK, + /* 1 */ EFFECT_BLURE1, + /* 2 */ EFFECT_BLURE2, + /* 3 */ EFFECT_SHIELD_PARTICLE, + /* 4 */ EFFECT_TIRE_MARK } EffectType; /* Effect Soft Sprites */ @@ -243,9 +243,9 @@ typedef void(*EffectSsUpdateFunc)(struct PlayState* play, u32 index, struct Effe typedef void(*EffectSsDrawFunc)(struct PlayState* play, u32 index, struct EffectSs* particle); typedef struct { - /* 0x00 */ u32 type; - /* 0x04 */ EffectSsInitFunc init; -} EffectSsInit; // size = 0x08 + /* 0x0 */ u32 type; + /* 0x4 */ EffectSsInitFunc init; +} EffectSsInit; // size = 0x8 typedef struct { /* 0x00 */ u32 vromStart; diff --git a/include/z64item.h b/include/z64item.h index 5e8e3a656..f68355858 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -7,9 +7,9 @@ // TODO fill out these enums typedef enum { - /* 0x0 */ EQUIP_TYPE_SWORD, - /* 0x1 */ EQUIP_TYPE_SHIELD, - /* 0x2 */ EQUIP_TYPE_MAX + /* 0 */ EQUIP_TYPE_SWORD, + /* 1 */ EQUIP_TYPE_SHIELD, + /* 2 */ EQUIP_TYPE_MAX } EquipmentType; typedef enum { @@ -29,14 +29,14 @@ typedef enum { } EquipValueShield; typedef enum { - /* 0x00 */ UPG_QUIVER, - /* 0x01 */ UPG_BOMB_BAG, - /* 0x02 */ UPG_STRENGTH, - /* 0x03 */ UPG_SCALE, - /* 0x04 */ UPG_WALLET, - /* 0x05 */ UPG_BULLET_BAG, - /* 0x06 */ UPG_STICKS, - /* 0x07 */ UPG_NUTS + /* 0 */ UPG_QUIVER, + /* 1 */ UPG_BOMB_BAG, + /* 2 */ UPG_STRENGTH, + /* 3 */ UPG_SCALE, + /* 4 */ UPG_WALLET, + /* 5 */ UPG_BULLET_BAG, + /* 6 */ UPG_STICKS, + /* 7 */ UPG_NUTS } UpgradeType; typedef enum { @@ -210,7 +210,7 @@ typedef enum { /* 0x59 */ ITEM_WALLET_DEFAULT, /* 0x5A */ ITEM_WALLET_ADULT, /* 0x5B */ ITEM_WALLET_GIANT, - /* 0x5C */ ITEM_FISHING_POLE, + /* 0x5C */ ITEM_FISHING_ROD, /* 0x5D */ ITEM_REMAINS_ODOLWA, /* 0x5E */ ITEM_REMAINS_GOHT, /* 0x5F */ ITEM_REMAINS_GYORG, @@ -552,24 +552,4 @@ typedef enum { /* 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_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/z64light.h b/include/z64light.h index 60736b62e..df7c1b4fa 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -82,9 +82,9 @@ typedef struct LightContext { } LightContext; // size = 0x10 typedef enum LightType { - /* 0x00 */ LIGHT_POINT_NOGLOW, - /* 0x01 */ LIGHT_DIRECTIONAL, - /* 0x02 */ LIGHT_POINT_GLOW + /* 0 */ LIGHT_POINT_NOGLOW, + /* 1 */ LIGHT_DIRECTIONAL, + /* 2 */ LIGHT_POINT_GLOW } LightType; typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec); diff --git a/include/z64math.h b/include/z64math.h index 3732222cc..16ab72e8a 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -6,47 +6,47 @@ #define VEC_SET(V,X,Y,Z) V.x=X;V.y=Y;V.z=Z typedef struct { - /* 0x00 */ s16 x; - /* 0x02 */ s16 z; -} Vec2s; // size = 0x04 + /* 0x0 */ s16 x; + /* 0x2 */ s16 z; +} Vec2s; // size = 0x4 typedef struct { - /* 0x00 */ f32 x; - /* 0x04 */ f32 z; -} Vec2f; // size = 0x08 + /* 0x0 */ f32 x; + /* 0x4 */ f32 z; +} Vec2f; // size = 0x8 typedef struct { - /* 0x00 */ f32 x; - /* 0x04 */ f32 y; - /* 0x08 */ f32 z; -} Vec3f; // size = 0x0C + /* 0x0 */ f32 x; + /* 0x4 */ f32 y; + /* 0x8 */ f32 z; +} Vec3f; // size = 0xC typedef struct { - /* 0x00 */ u16 x; - /* 0x02 */ u16 y; - /* 0x04 */ u16 z; -} Vec3us; // size = 0x06 + /* 0x0 */ u16 x; + /* 0x2 */ u16 y; + /* 0x4 */ u16 z; +} Vec3us; // size = 0x6 typedef struct { - /* 0x00 */ s16 x; - /* 0x02 */ s16 y; - /* 0x04 */ s16 z; -} Vec3s; // size = 0x06 + /* 0x0 */ s16 x; + /* 0x2 */ s16 y; + /* 0x4 */ s16 z; +} Vec3s; // size = 0x6 typedef struct { - /* 0x00 */ s32 x; - /* 0x04 */ s32 y; - /* 0x08 */ s32 z; -} Vec3i; // size = 0x0C + /* 0x0 */ s32 x; + /* 0x4 */ s32 y; + /* 0x8 */ s32 z; +} Vec3i; // size = 0xC typedef struct { - /* 0x00 */ Vec3s center; - /* 0x06 */ s16 radius; -} Sphere16; // size = 0x08 + /* 0x0 */ Vec3s center; + /* 0x6 */ s16 radius; +} Sphere16; // size = 0x8 typedef struct { - /* 0x00 */ Vec3f center; - /* 0x0C */ f32 radius; + /* 0x0 */ Vec3f center; + /* 0xC */ f32 radius; } Spheref; // size = 0x10 /* @@ -64,11 +64,11 @@ typedef struct { } TriNorm; // size = 0x34 typedef struct { - /* 0x00 */ s16 radius; - /* 0x02 */ s16 height; - /* 0x04 */ s16 yShift; - /* 0x06 */ Vec3s pos; -} Cylinder16; // size = 0x0C + /* 0x0 */ s16 radius; + /* 0x2 */ s16 height; + /* 0x4 */ s16 yShift; + /* 0x6 */ Vec3s pos; +} Cylinder16; // size = 0xC typedef struct { /* 0x00 */ f32 radius; @@ -89,10 +89,10 @@ typedef struct { // Defines a point in the spherical coordinate system typedef struct { - /* 0x00 */ f32 r; // radius - /* 0x04 */ s16 pitch; // polar (zenith) angle - /* 0x06 */ s16 yaw; // azimuthal angle -} VecSph; // size = 0x08 + /* 0x0 */ f32 r; // radius + /* 0x4 */ s16 pitch; // polar (zenith) angle + /* 0x6 */ s16 yaw; // azimuthal angle +} VecSph; // size = 0x8 #define LERPIMP(v0, v1, t) ((v0) + (((v1) - (v0)) * (t))) #define F32_LERP(v0, v1, t) ((1.0f - (t)) * (f32)(v0) + (t) * (f32)(v1)) diff --git a/include/z64ocarina.h b/include/z64ocarina.h index 8cc82b51a..597580388 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -26,10 +26,10 @@ typedef enum { /* 19 */ OCARINA_SONG_EVAN_PART1, /* 20 */ OCARINA_SONG_EVAN_PART2, /* 21 */ OCARINA_SONG_ZELDAS_LULLABY, - /* 22 */ OCARINA_SONG_SCARECROW, + /* 22 */ OCARINA_SONG_SCARECROW_SPAWN, /* 23 */ OCARINA_SONG_TERMINA_WALL, /* 24 */ OCARINA_SONG_MAX, - /* 24 */ OCARINA_SONG_SCARECROW_LONG = OCARINA_SONG_MAX + /* 24 */ OCARINA_SONG_SCARECROW_LONG = OCARINA_SONG_MAX // anything larger than 24 is considered the long scarecrow's song } OcarinaSongId; typedef enum { @@ -38,6 +38,7 @@ typedef enum { /* 2 */ OCARINA_BTN_C_RIGHT, /* 3 */ OCARINA_BTN_C_LEFT, /* 4 */ OCARINA_BTN_C_UP, + /* 5 */ OCARINA_BTN_C_RIGHT_OR_C_LEFT, /* -1 */ OCARINA_BTN_INVALID = 0xFF } OcarinaButtonIndex; @@ -92,15 +93,19 @@ typedef enum { } OcarinaRecordingState; /** - * BFlat4Flag Note: + * bFlat4Flag Note: * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4) * gets mapped to either C_RIGHT and C_LEFT * * This is required as C_RIGHT and C_LEFT are the only notes - * that map to two semitones apart (NOTE_A4 and NOTE_B4) + * that map to two semitones apart (OCARINA_PITCH_A4 and OCARINA_PITCH_B4) * 0x40 - BTN_Z is pressed to lower note by a semitone * 0x80 - BTN_R is pressed to raise note by a semitone */ +#define OCARINA_BUTTON_MASK_PITCH 0x3F +#define OCARINA_BUTTON_MASK_FLAG 0xC0 +#define OCARINA_BUTTON_FLAG_BFLAT_LOWER 0x40 +#define OCARINA_BUTTON_FLAG_BFLAT_RAISE 0x80 typedef struct { /* 0x0 */ u8 pitch; // number of semitones above middle C @@ -108,7 +113,7 @@ typedef struct { /* 0x4 */ u8 volume; /* 0x5 */ u8 vibrato; /* 0x6 */ s8 bend; // frequency multiplicative offset from the pitch defined by pitch - /* 0x7 */ u8 BFlat4Flag; // See note above + /* 0x7 */ u8 bFlat4Flag; // See note above } OcarinaNote; // size = 0x8 typedef struct { diff --git a/include/z64player.h b/include/z64player.h index 0f74f5a6c..f49f30688 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -7,38 +7,38 @@ struct Player; typedef enum { - /* 0x00 */ PLAYER_SHIELD_NONE, - /* 0x01 */ PLAYER_SHIELD_HEROS_SHIELD, - /* 0x02 */ PLAYER_SHIELD_MIRROR_SHIELD, - /* 0x03 */ PLAYER_SHIELD_MAX + /* 0 */ PLAYER_SHIELD_NONE, + /* 1 */ PLAYER_SHIELD_HEROS_SHIELD, + /* 2 */ PLAYER_SHIELD_MIRROR_SHIELD, + /* 3 */ PLAYER_SHIELD_MAX } PlayerShield; typedef enum { - /* 0x00 */ PLAYER_BOOTS_FIERCE_DEITY, - /* 0x01 */ PLAYER_BOOTS_HYLIAN, - /* 0x02 */ PLAYER_BOOTS_GIANT, - /* 0x03 */ PLAYER_BOOTS_DEKU, - /* 0x04 */ PLAYER_BOOTS_ZORA_LAND, - /* 0x05 */ PLAYER_BOOTS_ZORA_UNDERWATER, - /* 0x06 */ PLAYER_BOOTS_GORON, - /* 0x07 */ PLAYER_BOOTS_MAX + /* 0 */ PLAYER_BOOTS_FIERCE_DEITY, + /* 1 */ PLAYER_BOOTS_HYLIAN, + /* 2 */ PLAYER_BOOTS_GIANT, + /* 3 */ PLAYER_BOOTS_DEKU, + /* 4 */ PLAYER_BOOTS_ZORA_LAND, + /* 5 */ PLAYER_BOOTS_ZORA_UNDERWATER, + /* 6 */ PLAYER_BOOTS_GORON, + /* 7 */ PLAYER_BOOTS_MAX } PlayerBoots; typedef enum { - /* 0x00 */ PLAYER_STRENGTH_DEKU, - /* 0x01 */ PLAYER_STRENGTH_HUMAN, - /* 0x02 */ PLAYER_STRENGTH_ZORA, - /* 0x03 */ PLAYER_STRENGTH_GORON, - /* 0x04 */ PLAYER_STRENGTH_MAX + /* 0 */ PLAYER_STRENGTH_DEKU, + /* 1 */ PLAYER_STRENGTH_HUMAN, + /* 2 */ PLAYER_STRENGTH_ZORA, + /* 3 */ PLAYER_STRENGTH_GORON, + /* 4 */ PLAYER_STRENGTH_MAX } PlayerStrength; typedef enum { - /* 0x00 */ PLAYER_FORM_FIERCE_DEITY, - /* 0x01 */ PLAYER_FORM_GORON, - /* 0x02 */ PLAYER_FORM_ZORA, - /* 0x03 */ PLAYER_FORM_DEKU, - /* 0x04 */ PLAYER_FORM_HUMAN, - /* 0x05 */ PLAYER_FORM_MAX + /* 0 */ PLAYER_FORM_FIERCE_DEITY, + /* 1 */ PLAYER_FORM_GORON, + /* 2 */ PLAYER_FORM_ZORA, + /* 3 */ PLAYER_FORM_DEKU, + /* 4 */ PLAYER_FORM_HUMAN, + /* 5 */ PLAYER_FORM_MAX } PlayerTransformation; typedef enum { @@ -70,10 +70,11 @@ typedef enum { /* 0x19 */ PLAYER_MASK_MAX } PlayerMask; -typedef enum { +typedef enum PlayerActionParam { + /* -1 */ PLAYER_AP_MINUS1 = -1, /* 0x00 */ PLAYER_AP_NONE, /* 0x01 */ PLAYER_AP_LAST_USED, - /* 0x02 */ PLAYER_AP_FISHING_POLE, + /* 0x02 */ PLAYER_AP_FISHING_ROD, /* 0x03 */ PLAYER_AP_SWORD_KOKIRI, /* 0x04 */ PLAYER_AP_SWORD_RAZOR, /* 0x05 */ PLAYER_AP_SWORD_GILDED, @@ -248,12 +249,12 @@ typedef struct { } struct_80122D44_arg1; // size >= 0x114 typedef struct struct_80122744_arg1 { - /* 0x00 */ s8 unk_00; - /* 0x01 */ s8 unk_01; - /* 0x02 */ s8 unk_02; - /* 0x03 */ s8 unk_03; - /* 0x04 */ Vec3s* unk_04; -} struct_80122744_arg1; // size = 0x08 + /* 0x0 */ s8 unk_00; + /* 0x1 */ s8 unk_01; + /* 0x2 */ s8 unk_02; + /* 0x3 */ s8 unk_03; + /* 0x4 */ Vec3s* unk_04; +} struct_80122744_arg1; // size = 0x8 // #define PLAYER_STATE1_1 (1 << 0) diff --git a/include/z64save.h b/include/z64save.h index 16bbe3425..fb0a0a141 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -56,16 +56,16 @@ typedef struct Inventory { } Inventory; // size = 0x88 typedef struct HorseData { - /* 0x00 */ s16 scene; // "spot_no" - /* 0x02 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" - /* 0x08 */ s16 yaw; // "horse_a" -} HorseData; // size = 0x0A + /* 0x0 */ s16 scene; // "spot_no" + /* 0x2 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" + /* 0x8 */ s16 yaw; // "horse_a" +} HorseData; // size = 0xA typedef struct RespawnData { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; /* 0x0E */ s16 playerParams; - /* 0x10 */ u16 entranceIndex; + /* 0x10 */ u16 entrance; /* 0x12 */ u8 roomIndex; /* 0x13 */ s8 data; /* 0x14 */ u32 tempSwitchFlags; @@ -92,36 +92,36 @@ typedef struct CycleSceneFlags { } CycleSceneFlags; // size = 0x14 typedef struct SaveOptions { - /* 0x00 */ u16 optionId; // "option_id" - /* 0x02 */ u8 language; // "j_n" - /* 0x03 */ s8 audioSetting; // "s_sound" - /* 0x04 */ u8 languageSetting; // "language" - /* 0x05 */ u8 zTargetSetting; // "z_attention", 0: Switch; 1: Hold -} SaveOptions; // size = 0x06 + /* 0x0 */ u16 optionId; // "option_id" + /* 0x2 */ u8 language; // "j_n" + /* 0x3 */ s8 audioSetting; // "s_sound" + /* 0x4 */ u8 languageSetting; // "language" + /* 0x5 */ u8 zTargetSetting; // "z_attention", 0: Switch; 1: Hold +} SaveOptions; // size = 0x6 typedef struct SavePlayerData { - /* 0x0000 */ char newf[6]; // "newf" Will always be "ZELDA3 for a valid save - /* 0x0006 */ u16 deaths; // "savect" - /* 0x0008 */ char playerName[8]; // "player_name" - /* 0x0010 */ s16 healthCapacity; // "max_life" - /* 0x0012 */ s16 health; // "now_life" - /* 0x0014 */ s8 magicLevel; // "magic_max" - /* 0x0015 */ s8 magic; // "magic_now" - /* 0x0016 */ s16 rupees; // "lupy_count" - /* 0x0018 */ u16 swordHealth; // "long_sword_hp" - /* 0x001A */ u16 tatlTimer; // "navi_timer" - /* 0x001C */ u8 magicAcquired; // "magic_mode" - /* 0x001D */ u8 doubleMagic; // "magic_ability" - /* 0x001E */ u8 doubleDefense; // "life_ability" - /* 0x001F */ u8 unk_1F; // "ocarina_round" - /* 0x0020 */ u8 unk_20; // "first_memory" - /* 0x0022 */ u16 owlActivationFlags; // "memory_warp_point" - /* 0x0024 */ u8 unk_24; // "last_warp_pt" - /* 0x0026 */ s16 savedSceneNum; // "scene_data_ID" + /* 0x00 */ char newf[6]; // "newf" Will always be "ZELDA3 for a valid save + /* 0x06 */ u16 deaths; // "savect" + /* 0x08 */ char playerName[8]; // "player_name" + /* 0x10 */ s16 healthCapacity; // "max_life" + /* 0x12 */ s16 health; // "now_life" + /* 0x14 */ s8 magicLevel; // "magic_max" + /* 0x15 */ s8 magic; // "magic_now" + /* 0x16 */ s16 rupees; // "lupy_count" + /* 0x18 */ u16 swordHealth; // "long_sword_hp" + /* 0x1A */ u16 tatlTimer; // "navi_timer" + /* 0x1C */ u8 magicAcquired; // "magic_mode" + /* 0x1D */ u8 doubleMagic; // "magic_ability" + /* 0x1E */ u8 doubleDefense; // "life_ability" + /* 0x1F */ u8 unk_1F; // "ocarina_round" + /* 0x20 */ u8 unk_20; // "first_memory" + /* 0x22 */ u16 owlActivationFlags; // "memory_warp_point" + /* 0x24 */ u8 unk_24; // "last_warp_pt" + /* 0x26 */ s16 savedSceneNum; // "scene_data_ID" } SavePlayerData; // size = 0x28 typedef struct Save { - /* 0x0000 */ u32 entranceIndex; // "scene_no" + /* 0x0000 */ u32 entrance; // "scene_no" /* 0x0004 */ u8 equippedMask; // "player_mask" /* 0x0005 */ u8 isFirstCycle; // "opening_flag" /* 0x0006 */ u8 unk_06; @@ -143,8 +143,8 @@ typedef struct Save { /* 0x00F8 */ PermanentSceneFlags permanentSceneFlags[120]; /* 0x0E18 */ u8 unk_E18[0x54]; /* 0x0E6C */ u32 dekuPlaygroundHighScores[3]; - /* 0x0E78 */ u32 pictoFlags0; - /* 0x0E7C */ u32 pictoFlags1; + /* 0x0E78 */ u32 pictoFlags0; // Flags set by `PictoActor`s if pictograph is valid + /* 0x0E7C */ u32 pictoFlags1; // Flags set by Snap_ValidatePictograph() to record errors; volatile since that function is run many times in succession /* 0x0E80 */ u32 unk_E80; /* 0x0E84 */ u32 unk_E84; /* 0x0E88 */ u32 unk_E88[7]; // Invadepoh flags @@ -167,7 +167,7 @@ typedef struct Save { /* 0x0F60 */ u32 mapsVisible; // "cloud_clear" /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" has scarecrows song /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" scarecrows song set? - /* 0x0F66 */ u8 scarecrowsSong[128]; + /* 0x0F66 */ u8 scarecrowSpawnSong[128]; /* 0x0FE6 */ s8 bombersCaughtNum; // "aikotoba_index" /* 0x0FE7 */ s8 bombersCaughtOrder[5]; // "aikotoba_table" /* 0x0FEC */ s8 lotteryCodes[3][3]; // "numbers_table", Preset lottery codes diff --git a/include/z64scene.h b/include/z64scene.h index 45a8c101e..136fd22be 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -9,211 +9,210 @@ #define SPAWN_ROT_FLAGS(rotation, flags) (((rotation) << 7) | (flags)) typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x0 */ uintptr_t vromStart; + /* 0x4 */ uintptr_t vromEnd; } RomFile; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdBase; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdBase; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdSpawnList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdSpawnList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdCsCameraList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdCsCameraList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdColHeader; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdColHeader; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdRoomList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdRoomList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ s8 west; - /* 0x05 */ s8 vertical; - /* 0x06 */ s8 south; - /* 0x07 */ u8 clothIntensity; -} SCmdWindSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ s8 west; + /* 0x5 */ s8 vertical; + /* 0x6 */ s8 south; + /* 0x7 */ u8 clothIntensity; +} SCmdWindSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdEntranceList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdEntranceList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 cUpElfMsgNum; - /* 0x04 */ u32 subKeepIndex; -} SCmdSpecialFiles; + /* 0x0 */ u8 code; + /* 0x1 */ u8 cUpElfMsgNum; + /* 0x4 */ u32 subKeepIndex; +} SCmdSpecialFiles; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 gpFlag1; - /* 0x04 */ u32 gpFlag2; -} SCmdRoomBehavior; + /* 0x0 */ u8 code; + /* 0x1 */ u8 gpFlag1; + /* 0x4 */ u32 gpFlag2; +} SCmdRoomBehavior; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdMesh; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdMesh; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdObjectList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdObjectList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdLightList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdLightList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdPathList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdPathList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdTransiActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdTransiActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdLightSettingList; -// Cloudmodding has this as Environment Settings + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdLightSettingList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 hour; - /* 0x05 */ u8 min; - /* 0x06 */ u8 unk6; -} SCmdTimeSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 hour; + /* 0x5 */ u8 min; + /* 0x6 */ u8 unk6; +} SCmdTimeSettings; // size = 0x7 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 skyboxId; - /* 0x05 */ u8 unk5; - /* 0x06 */ u8 unk6; -} SCmdSkyboxSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 skyboxId; + /* 0x5 */ u8 unk5; + /* 0x6 */ u8 unk6; +} SCmdSkyboxSettings; // size = 0x7 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[2]; - /* 0x04 */ u8 unk4; - /* 0x05 */ u8 unk5; -} SCmdSkyboxDisables; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[2]; + /* 0x4 */ u8 unk4; + /* 0x5 */ u8 unk5; +} SCmdSkyboxDisables; // size = 0x6 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdExitList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdExitList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdEndMarker; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdEndMarker; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 bgmId; - /* 0x02 */ UNK_TYPE1 pad2[4]; - /* 0x06 */ u8 nighttimeSFX; - /* 0x07 */ u8 musicSeq; -} SCmdSoundSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 bgmId; + /* 0x2 */ UNK_TYPE1 pad2[4]; + /* 0x6 */ u8 nighttimeSFX; + /* 0x7 */ u8 musicSeq; +} SCmdSoundSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x02 */ UNK_TYPE1 pad2[5]; - /* 0x07 */ u8 echo; -} SCmdEchoSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x2 */ UNK_TYPE1 pad2[5]; + /* 0x7 */ u8 echo; +} SCmdEchoSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdCutsceneData; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdCutsceneData; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 cameraMovement; - /* 0x04 */ u32 area; -} SCmdMiscSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 cameraMovement; + /* 0x4 */ u32 area; +} SCmdMiscSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdAltHeaders; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdAltHeaders; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ u32 data2; -} SCmdWorldMapVisited; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ u32 data2; +} SCmdWorldMapVisited; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdTextureAnimations; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdTextureAnimations; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdCutsceneActorList; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdCutsceneActorList; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 data1; - /* 0x04 */ void* segment; -} SCmdMinimapSettings; + /* 0x0 */ u8 code; + /* 0x1 */ u8 data1; + /* 0x4 */ void* segment; +} SCmdMinimapSettings; // size = 0x8 typedef struct { - /* 0x00 */ u8 code; - /* 0x01 */ u8 num; - /* 0x04 */ void* segment; -} SCmdMinimapChests; + /* 0x0 */ u8 code; + /* 0x1 */ u8 num; + /* 0x4 */ void* segment; +} SCmdMinimapChests; // size = 0x8 typedef struct { /* 0x0 */ Gfx* opaqueDl; @@ -292,43 +291,17 @@ typedef struct { struct { s8 room; // Room to switch to s8 bgCamDataId; // How the camera reacts during the transition. -2 for spiral staircase. -1 for generic door. 0+ will index scene CamData - } /* 0x00 */ sides[2]; // 0 = front, 1 = back - /* 0x04 */ s16 id; - /* 0x06 */ Vec3s pos; - /* 0x0C */ s16 rotY; - /* 0x0E */ u16 params; + } /* 0x0 */ sides[2]; // 0 = front, 1 = back + /* 0x4 */ s16 id; + /* 0x6 */ Vec3s pos; + /* 0xC */ s16 rotY; + /* 0xE */ u16 params; } TransitionActorEntry; // size = 0x10 typedef struct { - /* 0x00 */ u8 count; - /* 0x04 */ TransitionActorEntry* list; -} TransitionActorList; - -typedef struct { - /* 0x00 */ u16 mapId; - /* 0x02 */ s16 unk2; - /* 0x04 */ s16 unk4; - /* 0x06 */ s16 unk6; - /* 0x08 */ u16 unk8; -} MinimapEntry; // size = 0xA - -typedef struct { - /* 0x00 */ MinimapEntry* entry; - /* 0x04 */ s32 unk4; -} MinimapList; // size = 0x8 - -typedef struct { - /* 0x00 */ MinimapEntry* entry; - /* 0x04 */ s16 scale; -} MinimapList2; // size = 0x8 - -typedef struct { - /* 0x00 */ UNK_TYPE2 unk0; - /* 0x02 */ UNK_TYPE2 unk2; - /* 0x04 */ UNK_TYPE2 unk4; - /* 0x06 */ UNK_TYPE2 unk6; - /* 0x08 */ UNK_TYPE2 unk8; -} MinimapChest; // size = 0xA + /* 0x0 */ u8 count; + /* 0x4 */ TransitionActorEntry* list; +} TransitionActorList; // size = 0x8 typedef struct { /* 0x0 */ s16 id; @@ -369,7 +342,7 @@ typedef struct { /* 0xA */ u8 unk_A; /* 0xB */ u8 drawConfig; /* 0xC */ u8 unk_C; -} SceneTableEntry; // size = 0x10; +} SceneTableEntry; // size = 0x10 typedef struct { /* 0x0 */ u8 r; @@ -418,82 +391,109 @@ typedef struct { } ObjectContext; // size = 0x958 typedef struct { - u8 headerType; -} MeshHeaderBase; + /* 0x0 */ u8 headerType; +} MeshHeaderBase; // size = 0x1 typedef struct { - MeshHeaderBase base; - - u8 numEntries; - u32 dListStart; - u32 dListEnd; -} MeshHeader0; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ u32 dListStart; + /* 0x8 */ u32 dListEnd; +} MeshHeader0; // size = 0xC typedef struct { - u32 opaqueDList; - u32 translucentDList; -} MeshEntry0; + /* 0x0 */ u32 opaqueDList; + /* 0x4 */ u32 translucentDList; +} MeshEntry0; // size = 0x8 typedef struct { - MeshHeaderBase base; - u8 format; - u32 entryRecord; -} MeshHeader1Base; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 format; + /* 0x4 */ u32 entryRecord; +} MeshHeader1Base; // size = 0x8 typedef struct { - MeshHeader1Base base; - u32 imagePtr; // 0x08 - u32 unknown; // 0x0C - u32 unknown2; // 0x10 - u16 bgWidth; // 0x14 - u16 bgHeight; // 0x16 - u8 imageFormat; // 0x18 - u8 imageSize; // 0x19 - u16 imagePal; // 0x1A - u16 imageFlip; // 0x1C -} MeshHeader1Single; + /* 0x00 */ MeshHeader1Base base; + /* 0x08 */ u32 imagePtr; + /* 0x0C */ u32 unknown; + /* 0x10 */ u32 unknown2; + /* 0x14 */ u16 bgWidth; + /* 0x16 */ u16 bgHeight; + /* 0x18 */ u8 imageFormat; + /* 0x19 */ u8 imageSize; + /* 0x1A */ u16 imagePal; + /* 0x1C */ u16 imageFlip; +} MeshHeader1Single; // size = 0x20 typedef struct { - MeshHeader1Base base; - u8 bgCnt; - u32 bgRecordPtr; -} MeshHeader1Multi; + /* 0x0 */ MeshHeader1Base base; + /* 0x8 */ u8 bgCnt; + /* 0xC */ u32 bgRecordPtr; +} MeshHeader1Multi; // size = 0x10 typedef struct { - u16 unknown; // 0x00 - s8 bgID; // 0x02 - u32 imagePtr; // 0x04 - u32 unknown2; // 0x08 - u32 unknown3; // 0x0C - u16 bgWidth; // 0x10 - u16 bgHeight; // 0x12 - u8 imageFmt; // 0x14 - u8 imageSize; // 0x15 - u16 imagePal; // 0x16 - u16 imageFlip; // 0x18 -} BackgroundRecord; + /* 0x00 */ u16 unknown; + /* 0x02 */ s8 bgID; + /* 0x04 */ u32 imagePtr; + /* 0x08 */ u32 unknown2; + /* 0x0C */ u32 unknown3; + /* 0x10 */ u16 bgWidth; + /* 0x12 */ u16 bgHeight; + /* 0x14 */ u8 imageFmt; + /* 0x15 */ u8 imageSize; + /* 0x16 */ u16 imagePal; + /* 0x18 */ u16 imageFlip; +} BackgroundRecord; // size = 0x1C typedef struct { - s16 playerXMax, playerZMax; - s16 playerXMin, playerZMin; - u32 opaqueDList; - u32 translucentDList; -} MeshEntry2; + /* 0x0 */ s16 playerXMax; + /* 0x2 */ s16 playerZMax; + /* 0x4 */ s16 playerXMin; + /* 0x6 */ s16 playerZMin; + /* 0x8 */ u32 opaqueDList; + /* 0xC */ u32 translucentDList; +} MeshEntry2; // size = 0x10 typedef struct { - MeshHeaderBase base; - u8 numEntries; - u32 dListStart; - u32 dListEnd; -} MeshHeader2; + /* 0x0 */ MeshHeaderBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ u32 dListStart; + /* 0x8 */ u32 dListEnd; +} MeshHeader2; // size = 0xC typedef struct { - /* 0x00 */ u8 count; // number of points in the path - /* 0x01 */ u8 unk1; - /* 0x02 */ s16 unk2; - /* 0x04 */ Vec3s* points; // Segment Address to the array of points + /* 0x0 */ u8 count; // number of points in the path + /* 0x1 */ u8 unk1; + /* 0x2 */ s16 unk2; + /* 0x4 */ Vec3s* points; // Segment Address to the array of points } Path; // size = 0x8 +typedef struct { + /* 0x00 */ u16 mapId; + /* 0x02 */ s16 unk2; + /* 0x04 */ s16 unk4; + /* 0x06 */ s16 unk6; + /* 0x08 */ u16 unk8; +} MinimapEntry; // size = 0xA + +typedef struct { + /* 0x00 */ MinimapEntry* entry; + /* 0x04 */ s32 unk4; +} MinimapList; // size = 0x8 + +typedef struct { + /* 0x00 */ MinimapEntry* entry; + /* 0x04 */ s16 scale; +} MinimapList2; // size = 0x8 + +typedef struct { + /* 0x00 */ UNK_TYPE2 unk0; + /* 0x02 */ UNK_TYPE2 unk2; + /* 0x04 */ UNK_TYPE2 unk4; + /* 0x06 */ UNK_TYPE2 unk6; + /* 0x08 */ UNK_TYPE2 unk8; +} MinimapChest; // size = 0xA + // TODO: consider merging with bgCamInfo? typedef struct { /* 0x0 */ s16 setting; // camera setting described by CameraSettingType enum @@ -653,7 +653,128 @@ typedef enum { /* 0x6F */ SCENE_CLOCKTOWER, /* 0x70 */ SCENE_ALLEY, /* 0x71 */ SCENE_MAX -} SceneID; +} SceneId; + +typedef enum { + /* 0x00 */ ENTR_SCENE_MAYORS_RESIDENCE, + /* 0x01 */ ENTR_SCENE_MAJORAS_LAIR, + /* 0x02 */ ENTR_SCENE_MAGIC_HAGS_POTION_SHOP, + /* 0x03 */ ENTR_SCENE_RANCH_HOUSE, + /* 0x04 */ ENTR_SCENE_HONEY_AND_DARLINGS_SHOP, + /* 0x05 */ ENTR_SCENE_BENEATH_THE_GRAVERYARD, + /* 0x06 */ ENTR_SCENE_SOUTHERN_SWAMP_CLEARED, + /* 0x07 */ ENTR_SCENE_CURIOSITY_SHOP, + /* 0x08 */ ENTR_SCENE_UNSET_08, + /* 0x09 */ ENTR_SCENE_UNSET_09, + /* 0x0A */ ENTR_SCENE_GROTTOS, + /* 0x0B */ ENTR_SCENE_UNSET_0B, + /* 0x0C */ ENTR_SCENE_UNSET_0C, + /* 0x0D */ ENTR_SCENE_UNSET_0D, + /* 0x0E */ ENTR_SCENE_CUTSCENE, + /* 0x0F */ ENTR_SCENE_UNSET_0F, + /* 0x10 */ ENTR_SCENE_IKANA_CANYON, + /* 0x11 */ ENTR_SCENE_PIRATES_FORTRESS, + /* 0x12 */ ENTR_SCENE_MILK_BAR, + /* 0x13 */ ENTR_SCENE_STONE_TOWER_TEMPLE, + /* 0x14 */ ENTR_SCENE_TREASURE_CHEST_SHOP, + /* 0x15 */ ENTR_SCENE_STONE_TOWER_TEMPLE_INVERTED, + /* 0x16 */ ENTR_SCENE_CLOCK_TOWER_ROOFTOP, + /* 0x17 */ ENTR_SCENE_OPENING_DUNGEON, + /* 0x18 */ ENTR_SCENE_WOODFALL_TEMPLE, + /* 0x19 */ ENTR_SCENE_PATH_TO_MOUNTAIN_VILLAGE, + /* 0x1A */ ENTR_SCENE_IKANA_CASTLE, + /* 0x1B */ ENTR_SCENE_DEKU_SCRUB_PLAYGROUND, + /* 0x1C */ ENTR_SCENE_ODOLWAS_LAIR, + /* 0x1D */ ENTR_SCENE_TOWN_SHOOTING_GALLERY, + /* 0x1E */ ENTR_SCENE_SNOWHEAD_TEMPLE, + /* 0x1F */ ENTR_SCENE_MILK_ROAD, + /* 0x20 */ ENTR_SCENE_PIRATES_FORTRESS_INTERIOR, + /* 0x21 */ ENTR_SCENE_SWAMP_SHOOTING_GALLERY, + /* 0x22 */ ENTR_SCENE_PINNACLE_ROCK, + /* 0x23 */ ENTR_SCENE_FAIRY_FOUNTAIN, + /* 0x24 */ ENTR_SCENE_SWAMP_SPIDER_HOUSE, + /* 0x25 */ ENTR_SCENE_OCEANSIDE_SPIDER_HOUSE, + /* 0x26 */ ENTR_SCENE_ASTRAL_OBSERVATORY, + /* 0x27 */ ENTR_SCENE_MOON_DEKU_TRIAL, + /* 0x28 */ ENTR_SCENE_DEKU_PALACE, + /* 0x29 */ ENTR_SCENE_MOUNTAIN_SMITHY, + /* 0x2A */ ENTR_SCENE_TERMINA_FIELD, + /* 0x2B */ ENTR_SCENE_POST_OFFICE, + /* 0x2C */ ENTR_SCENE_MARINE_RESEARCH_LAB, + /* 0x2D */ ENTR_SCENE_DAMPES_HOUSE, + /* 0x2E */ ENTR_SCENE_UNSET_2E, + /* 0x2F */ ENTR_SCENE_GORON_SHRINE, + /* 0x30 */ ENTR_SCENE_ZORA_HALL, + /* 0x31 */ ENTR_SCENE_TRADING_POST, + /* 0x32 */ ENTR_SCENE_ROMANI_RANCH, + /* 0x33 */ ENTR_SCENE_TWINMOLDS_LAIR, + /* 0x34 */ ENTR_SCENE_GREAT_BAY_COAST, + /* 0x35 */ ENTR_SCENE_ZORA_CAPE, + /* 0x36 */ ENTR_SCENE_LOTTERY_SHOP, + /* 0x37 */ ENTR_SCENE_UNSET_37, + /* 0x38 */ ENTR_SCENE_PIRATES_FORTRESS_EXTERIOR, + /* 0x39 */ ENTR_SCENE_FISHERMANS_HUT, + /* 0x3A */ ENTR_SCENE_GORON_SHOP, + /* 0x3B */ ENTR_SCENE_DEKU_KINGS_CHAMBER, + /* 0x3C */ ENTR_SCENE_MOON_GORON_TRIAL, + /* 0x3D */ ENTR_SCENE_ROAD_TO_SOUTHERN_SWAMP, + /* 0x3E */ ENTR_SCENE_DOGGY_RACETRACK, + /* 0x3F */ ENTR_SCENE_CUCCO_SHACK, + /* 0x40 */ ENTR_SCENE_IKANA_GRAVEYARD, + /* 0x41 */ ENTR_SCENE_GOHTS_LAIR, + /* 0x42 */ ENTR_SCENE_SOUTHERN_SWAMP_POISONED, + /* 0x43 */ ENTR_SCENE_WOODFALL, + /* 0x44 */ ENTR_SCENE_MOON_ZORA_TRIAL, + /* 0x45 */ ENTR_SCENE_GORON_VILLAGE_SPRING, + /* 0x46 */ ENTR_SCENE_GREAT_BAY_TEMPLE, + /* 0x47 */ ENTR_SCENE_WATERFALL_RAPIDS, + /* 0x48 */ ENTR_SCENE_BENEATH_THE_WELL, + /* 0x49 */ ENTR_SCENE_ZORA_HALL_ROOMS, + /* 0x4A */ ENTR_SCENE_GORON_VILLAGE_WINTER, + /* 0x4B */ ENTR_SCENE_GORON_GRAVERYARD, + /* 0x4C */ ENTR_SCENE_SAKONS_HIDEOUT, + /* 0x4D */ ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER, + /* 0x4E */ ENTR_SCENE_GHOST_HUT, + /* 0x4F */ ENTR_SCENE_DEKU_SHRINE, + /* 0x50 */ ENTR_SCENE_ROAD_TO_IKANA, + /* 0x51 */ ENTR_SCENE_SWORDMANS_SCHOOL, + /* 0x52 */ ENTR_SCENE_MUSIC_BOX_HOUSE, + /* 0x53 */ ENTR_SCENE_IGOS_DU_IKANAS_LAIR, + /* 0x54 */ ENTR_SCENE_TOURIST_INFORMATION, + /* 0x55 */ ENTR_SCENE_STONE_TOWER, + /* 0x56 */ ENTR_SCENE_STONE_TOWER_INVERTED, + /* 0x57 */ ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING, + /* 0x58 */ ENTR_SCENE_PATH_TO_SNOWHEAD, + /* 0x59 */ ENTR_SCENE_SNOWHEAD, + /* 0x5A */ ENTR_SCENE_PATH_TO_GORON_VILLAGE_WINTER, + /* 0x5B */ ENTR_SCENE_PATH_TO_GORON_VILLAGE_SPRING, + /* 0x5C */ ENTR_SCENE_GYORGS_LAIR, + /* 0x5D */ ENTR_SCENE_SECRET_SHRINE, + /* 0x5E */ ENTR_SCENE_STOCK_POT_INN, + /* 0x5F */ ENTR_SCENE_GREAT_BAY_CUTSCENE, + /* 0x60 */ ENTR_SCENE_CLOCK_TOWER_INTERIOR, + /* 0x61 */ ENTR_SCENE_WOODS_OF_MYSTERY, + /* 0x62 */ ENTR_SCENE_LOST_WOODS, + /* 0x63 */ ENTR_SCENE_MOON_LINK_TRIAL, + /* 0x64 */ ENTR_SCENE_THE_MOON, + /* 0x65 */ ENTR_SCENE_BOMB_SHOP, + /* 0x66 */ ENTR_SCENE_GIANTS_CHAMBER, + /* 0x67 */ ENTR_SCENE_GORMAN_TRACK, + /* 0x68 */ ENTR_SCENE_GORON_RACETRACK, + /* 0x69 */ ENTR_SCENE_EAST_CLOCK_TOWN, + /* 0x6A */ ENTR_SCENE_WEST_CLOCK_TOWN, + /* 0x6B */ ENTR_SCENE_NORTH_CLOCK_TOWN, + /* 0x6C */ ENTR_SCENE_SOUTH_CLOCK_TOWN, + /* 0x6D */ ENTR_SCENE_LAUNDRY_POOL, + /* 0x6E */ ENTR_SCENE_MAX +} EntranceSceneId; + +/* +* 0xFE00: Index into sSceneEntranceTable (Scene) +* 0x01F0: Index into the scenes specific entrance table (Spawn) +* 0x000F: Index into the specific entrance table (Layer), stored seperately in sceneSetupIndex +*/ +#define ENTRANCE(scene, spawn) ((((ENTR_SCENE_##scene) & 0x7F) << 9) | (((spawn) & 0x1F) << 4)) // SceneTableEntry draw configs typedef enum { diff --git a/include/z64schedule.h b/include/z64schedule.h index 8dba85d4d..cff6224f4 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -32,25 +32,25 @@ #define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time) typedef enum { - /* 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 - /* 13 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch - /* 14 */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values - /* 15 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_S, // Branches if the current time is less than the command time, short range branch - /* 16 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_L, // Branches if the current time is less than the command time, long range branch - /* 17 */ SCHEDULE_CMD_ID_BRANCH_S, // Always branch, short range branch - /* 18 */ SCHEDULE_CMD_ID_BRANCH_L, // Always branch, long range branch + /* 0x00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch + /* 0x01 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch + /* 0x02 */ 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 + /* 0x03 */ 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 + /* 0x04 */ 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) + /* 0x05 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything + /* 0x06 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value + /* 0x07 */ SCHEDULE_CMD_ID_NOP, // No-Op + /* 0x08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch + /* 0x09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value + /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch + /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch + /* 0x0C */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch + /* 0x0D */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch + /* 0x0E */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values + /* 0x0F */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_S, // Branches if the current time is less than the command time, short range branch + /* 0x10 */ SCHEDULE_CMD_ID_CHECK_BEFORE_TIME_L, // Branches if the current time is less than the command time, long range branch + /* 0x11 */ SCHEDULE_CMD_ID_BRANCH_S, // Always branch, short range branch + /* 0x12 */ SCHEDULE_CMD_ID_BRANCH_L, // Always branch, long range branch } ScheduleCommandId; typedef enum { diff --git a/include/z64skin.h b/include/z64skin.h index fdc61a5ef..360e265e6 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -33,18 +33,18 @@ typedef struct { } SkinTransformation; // size = 0xA typedef struct { - /* 0x00 */ u16 vtxCount; // number of vertices in this modif entry - /* 0x02 */ u16 transformCount; - /* 0x04 */ u16 unk_04; // index of limbTransformations - /* 0x08 */ SkinVertex* skinVertices; - /* 0x0C */ SkinTransformation* limbTransformations; + /* 0x0 */ u16 vtxCount; // number of vertices in this modif entry + /* 0x2 */ u16 transformCount; + /* 0x4 */ u16 unk_04; // index of limbTransformations + /* 0x8 */ SkinVertex* skinVertices; + /* 0xC */ SkinTransformation* limbTransformations; } SkinLimbModif; // size = 0x10 typedef struct { - /* 0x00 */ u16 totalVtxCount; // total vertex count for all modif entries - /* 0x02 */ u16 limbModifCount; // count of limbModifCount - /* 0x04 */ SkinLimbModif* limbModifications; - /* 0x08 */ Gfx* dlist; + /* 0x0 */ u16 totalVtxCount; // total vertex count for all modif entries + /* 0x2 */ u16 limbModifCount; // count of limbModifCount + /* 0x4 */ SkinLimbModif* limbModifications; + /* 0x8 */ Gfx* dlist; } SkinAnimatedLimbData; // size = 0xC // ZAPD compatibility typedefs @@ -58,11 +58,11 @@ typedef SkinLimbModif Struct_800A598C; #define SKIN_LIMB_TYPE_NORMAL 11 typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; - /* 0x07 */ u8 sibling; - /* 0x08 */ s32 segmentType; // Type of data contained in segment - /* 0x0C */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise + /* 0x0 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x6 */ u8 child; + /* 0x7 */ u8 sibling; + /* 0x8 */ s32 segmentType; // Type of data contained in segment + /* 0xC */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise } SkinLimb; // size = 0x10 typedef struct { @@ -71,11 +71,11 @@ typedef struct { } SkinLimbVtx; // size = 0xC typedef struct { - /* 0x000 */ SkeletonHeader* skeletonHeader; - /* 0x004 */ MtxF mtx; - /* 0x044 */ s32 limbCount; - /* 0x048 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb - /* 0x04C */ SkelAnime skelAnime; + /* 0x00 */ SkeletonHeader* skeletonHeader; + /* 0x04 */ MtxF mtx; + /* 0x44 */ s32 limbCount; + /* 0x48 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb + /* 0x4C */ SkelAnime skelAnime; } Skin; // size = 0x90 typedef void (*SkinPostDraw)(struct Actor* thisx, struct PlayState* play, Skin* skin); diff --git a/include/z64snap.h b/include/z64snap.h new file mode 100644 index 000000000..fb3f86186 --- /dev/null +++ b/include/z64snap.h @@ -0,0 +1,52 @@ +#ifndef Z64_SNAP_H +#define Z64_SNAP_H + +#include "PR/ultratypes.h" +#include "z64actor.h" + +typedef s32 (*PictoValidationFunc)(struct PlayState*, Actor*); + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x144 */ PictoValidationFunc validationFunc; +} PictoActor; + +// Picto box flags + +typedef enum { + // Used externally, set and read by actors + /* 0x00 */ PICTOGRAPH_0, + /* 0x01 */ PICTOGRAPH_IN_SWAMP, + /* 0x02 */ PICTOGRAPH_MONKEY, + /* 0x03 */ PICTOGRAPH_BIG_OCTO, + /* 0x04 */ PICTOGRAPH_LULU_HEAD, + /* 0x05 */ PICTOGRAPH_LULU_RIGHT_ARM, + /* 0x06 */ PICTOGRAPH_LULU_LEFT_ARM, // Need all three of these to qualify as a good picture + /* 0x07 */ PICTOGRAPH_SCARECROW, + /* 0x08 */ PICTOGRAPH_TINGLE, + /* 0x09 */ PICTOGRAPH_PIRATE_GOOD, + /* 0x0A */ PICTOGRAPH_DEKU_KING, + /* 0x0B */ PICTOGRAPH_PIRATE_TOO_FAR, // overlaps with PICTOGRAPH_PIRATE_GOOD, but that is checked first + + // Used internally, test for failures of position, angle etc. + /* 0x3B */ PICTOGRAPH_BEHIND_COLLISION = 0x3B, + /* 0x3C */ PICTOGRAPH_BEHIND_BG, + /* 0x3D */ PICTOGRAPH_NOT_IN_VIEW, + /* 0x3E */ PICTOGRAPH_BAD_ANGLE, + /* 0x3F */ PICTOGRAPH_BAD_DISTANCE +} PictographFlag; + +// The following macros are subject to renaming once the capture system is better understood +#define PICTO_RESOLUTION_HORIZONTAL 150 +#define PICTO_RESOLUTION_VERTICAL 105 +#define PICTO_CAPTURE_REGION_TOPLEFT_X ((SCREEN_WIDTH - PICTO_RESOLUTION_HORIZONTAL) / 2) +#define PICTO_CAPTURE_REGION_TOPLEFT_Y ((SCREEN_HEIGHT - PICTO_RESOLUTION_VERTICAL) / 2) + +s32 Snap_RecordPictographedActors(PlayState* play); +void Snap_SetFlag(s32 flag); +void Snap_UnsetFlag(s32 flag); +u32 Snap_CheckFlag(s32 flag); +s16 Snap_AbsS(s16 val); +s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleRange); + +#endif diff --git a/include/z64subs.h b/include/z64subs.h index ff9404e9d..9f0b5fea3 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -104,7 +104,7 @@ Path* SubS_GetAdditionalPath(struct PlayState* play, u8 pathIndex, s32 max); Actor* SubS_FindNearestActor(Actor* actor, struct PlayState* play, u8 actorCategory, s16 actorId); -s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations, s32 index); +s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex); s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex); @@ -151,7 +151,7 @@ s32 SubS_ActorPathing_MoveWithGravity(struct PlayState* play, ActorPathing* acto s32 SubS_ActorPathing_MoveWithoutGravityReverse(struct PlayState* play, ActorPathing* actorPath); s32 SubS_ActorPathing_SetNextPoint(struct PlayState* play, ActorPathing* actorPath); -void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex, s32* curIndex); +void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animationInfo, s32 nextAnimIndex, s32* curAnimIndex); s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type); s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes); diff --git a/include/z64transition.h b/include/z64transition.h index 998dd9198..9630b4a3f 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -13,16 +13,16 @@ typedef struct { /* 0x18 */ void (*setColor)(void* transition, u32 color); /* 0x1C */ void (*setEnvColor)(void* transition, u32 color); /* 0x20 */ s32 (*isDone)(void* transition); -} TransitionInit; +} TransitionInit; // size = 0x24 typedef struct { - /* 0x000 */ char unk_0[0xC]; + /* 0x0 */ char unk_0[0xC]; } TransitionFade; // size = 0xC extern const TransitionInit TransitionFade_InitVars; typedef struct { - /* 0x000 */ char unk_0[0x20]; + /* 0x00 */ char unk_0[0x20]; } TransitionCircle; // size = 0x20 extern const TransitionInit TransitionCircle_InitVars; diff --git a/include/z_en_hy_code.h b/include/z_en_hy_code.h index 724b8c570..d272522c9 100644 --- a/include/z_en_hy_code.h +++ b/include/z_en_hy_code.h @@ -10,28 +10,28 @@ struct EnHy; //! TODO: Better animaion enum names when animations are documented typedef enum { - /* 0 */ ENHY_ANIMATION_AOB_0, - /* 1 */ ENHY_ANIMATION_BOJ_1, - /* 2 */ ENHY_ANIMATION_BOJ_2, - /* 3 */ ENHY_ANIMATION_BOJ_3, - /* 4 */ ENHY_ANIMATION_BOJ_4, - /* 5 */ ENHY_ANIMATION_BOJ_5, - /* 6 */ ENHY_ANIMATION_BBA_6, - /* 7 */ ENHY_ANIMATION_BJI_7, - /* 8 */ ENHY_ANIMATION_BJI_8, - /* 9 */ ENHY_ANIMATION_BJI_9, - /* 10 */ ENHY_ANIMATION_BOJ_10, - /* 11 */ ENHY_ANIMATION_OS_ANIME_11, - /* 12 */ ENHY_ANIMATION_BOJ_12, - /* 13 */ ENHY_ANIMATION_BOJ_13, - /* 14 */ ENHY_ANIMATION_BOJ_14, - /* 15 */ ENHY_ANIMATION_BOJ_15, - /* 16 */ ENHY_ANIMATION_BOJ_16, - /* 17 */ ENHY_ANIMATION_BOJ_17, - /* 18 */ ENHY_ANIMATION_BOJ_18, - /* 19 */ ENHY_ANIMATION_BOJ_19, - /* 20 */ ENHY_ANIMATION_BOJ_20, - /* 21 */ ENHY_ANIMATION_MAX + /* 0 */ ENHY_ANIM_AOB_0, + /* 1 */ ENHY_ANIM_BOJ_1, + /* 2 */ ENHY_ANIM_BOJ_2, + /* 3 */ ENHY_ANIM_BOJ_3, + /* 4 */ ENHY_ANIM_BOJ_4, + /* 5 */ ENHY_ANIM_BOJ_5, + /* 6 */ ENHY_ANIM_BBA_6, + /* 7 */ ENHY_ANIM_BJI_7, + /* 8 */ ENHY_ANIM_BJI_8, + /* 9 */ ENHY_ANIM_BJI_9, + /* 10 */ ENHY_ANIM_BOJ_10, + /* 11 */ ENHY_ANIM_OS_ANIME_11, + /* 12 */ ENHY_ANIM_BOJ_12, + /* 13 */ ENHY_ANIM_BOJ_13, + /* 14 */ ENHY_ANIM_BOJ_14, + /* 15 */ ENHY_ANIM_BOJ_15, + /* 16 */ ENHY_ANIM_BOJ_16, + /* 17 */ ENHY_ANIM_BOJ_17, + /* 18 */ ENHY_ANIM_BOJ_18, + /* 19 */ ENHY_ANIM_BOJ_19, + /* 20 */ ENHY_ANIM_BOJ_20, + /* 21 */ ENHY_ANIM_MAX } EnHyAnimation; typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); diff --git a/spec b/spec index a488e0dbd..e17d3af91 100644 --- a/spec +++ b/spec @@ -614,8 +614,7 @@ beginseg include "build/src/code/audio/code_80192BE0.o" include "build/data/code/code_80192BE0.data.o" include "build/src/code/audio/audio_dcache.o" - include "build/src/code/audio/code_80194790.o" - include "build/data/code/code_80194790.data.o" + include "build/src/code/audio/aisetnextbuf.o" include "build/src/code/audio/audio_playback.o" include "build/src/code/audio/audio_effects.o" include "build/src/code/audio/audio_seqplayer.o" @@ -632,15 +631,13 @@ beginseg pad_text include "build/src/code/audio/audio_sfx_params.o" include "build/src/code/audio/code_801A5BD0.o" - include "build/data/code/code_801A5BD0.data.o" - include "build/data/code/code_801A5BD0.bss.o" include "build/src/code/audio/code_801A7B10.o" include "build/data/code/code_801A7B10.data.o" include "build/data/code/code_801A7B10.bss.o" include "build/src/code/audio/audio_init_params.o" include "build/src/code/jpegutils.o" include "build/src/code/jpegdecoder.o" - include_readonly "build/src/code/z_game_over.o" + include_data_with_rodata "build/src/code/z_game_over.o" include "build/src/code/z_construct.o" include "build/data/code/audio_tables.rodata.o" include "build/data/code/aspMain.rodata.o" @@ -816,11 +813,7 @@ beginseg name "ovl_En_Arrow" compress include "build/src/overlays/actors/ovl_En_Arrow/z_en_arrow.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_En_Arrow/ovl_En_Arrow_reloc.o" -#else - include "build/data/ovl_En_Arrow/ovl_En_Arrow.reloc.o" -#endif endseg beginseg @@ -883,9 +876,7 @@ beginseg name "ovl_En_Viewer" compress include "build/src/overlays/actors/ovl_En_Viewer/z_en_viewer.o" - include "build/data/ovl_En_Viewer/ovl_En_Viewer.data.o" - include "build/data/ovl_En_Viewer/ovl_En_Viewer.bss.o" - include "build/data/ovl_En_Viewer/ovl_En_Viewer.reloc.o" + include "build/src/overlays/actors/ovl_En_Viewer/ovl_En_Viewer_reloc.o" endseg beginseg @@ -1501,8 +1492,7 @@ beginseg name "ovl_En_Ge1" compress include "build/src/overlays/actors/ovl_En_Ge1/z_en_ge1.o" - include "build/data/ovl_En_Ge1/ovl_En_Ge1.data.o" - include "build/data/ovl_En_Ge1/ovl_En_Ge1.reloc.o" + include "build/src/overlays/actors/ovl_En_Ge1/ovl_En_Ge1_reloc.o" endseg beginseg @@ -1875,8 +1865,7 @@ beginseg name "ovl_Effect_Ss_Fhg_Flash" compress include "build/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.o" - include "build/data/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.data.o" - include "build/data/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash_reloc.o" endseg beginseg @@ -1912,24 +1901,21 @@ beginseg name "ovl_Effect_Ss_En_Ice" compress include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.data.o" - include "build/data/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_En_Ice/ovl_Effect_Ss_En_Ice_reloc.o" endseg beginseg name "ovl_Effect_Ss_Fire_Tail" compress include "build/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.o" - include "build/data/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail.data.o" - include "build/data/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/ovl_Effect_Ss_Fire_Tail_reloc.o" endseg beginseg name "ovl_Effect_Ss_En_Fire" compress include "build/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.o" - include "build/data/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire.data.o" - include "build/data/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_En_Fire/ovl_Effect_Ss_En_Fire_reloc.o" endseg beginseg @@ -1951,8 +1937,7 @@ beginseg name "ovl_Effect_Ss_Dead_Dd" compress include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.o" - include "build/data/ovl_Effect_Ss_Dead_Dd/ovl_Effect_Ss_Dead_Dd.data.o" - include "build/data/ovl_Effect_Ss_Dead_Dd/ovl_Effect_Ss_Dead_Dd.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/ovl_Effect_Ss_Dead_Dd_reloc.o" endseg beginseg @@ -2050,8 +2035,7 @@ beginseg name "ovl_Obj_Mure3" compress include "build/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.o" - include "build/data/ovl_Obj_Mure3/ovl_Obj_Mure3.data.o" - include "build/data/ovl_Obj_Mure3/ovl_Obj_Mure3.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Mure3/ovl_Obj_Mure3_reloc.o" endseg beginseg @@ -2132,8 +2116,7 @@ beginseg name "ovl_Obj_Makekinsuta" compress include "build/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.o" - include "build/data/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta.data.o" - include "build/data/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Makekinsuta/ovl_Obj_Makekinsuta_reloc.o" endseg beginseg @@ -2380,11 +2363,7 @@ beginseg name "ovl_Bg_Spdweb" compress include "build/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Bg_Spdweb/ovl_Bg_Spdweb_reloc.o" -#else - include "build/data/ovl_Bg_Spdweb/ovl_Bg_Spdweb.reloc.o" -#endif endseg beginseg @@ -2525,11 +2504,7 @@ beginseg name "ovl_Obj_Spinyroll" compress include "build/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Obj_Spinyroll/ovl_Obj_Spinyroll_reloc.o" -#else - include "build/data/ovl_Obj_Spinyroll/ovl_Obj_Spinyroll.reloc.o" -#endif endseg beginseg @@ -2572,8 +2547,7 @@ beginseg name "ovl_En_Bigpamet" compress include "build/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.o" - include "build/data/ovl_En_Bigpamet/ovl_En_Bigpamet.data.o" - include "build/data/ovl_En_Bigpamet/ovl_En_Bigpamet.reloc.o" + include "build/src/overlays/actors/ovl_En_Bigpamet/ovl_En_Bigpamet_reloc.o" endseg beginseg @@ -2724,8 +2698,7 @@ beginseg name "ovl_En_Test2" compress include "build/src/overlays/actors/ovl_En_Test2/z_en_test2.o" - include "build/data/ovl_En_Test2/ovl_En_Test2.data.o" - include "build/data/ovl_En_Test2/ovl_En_Test2.reloc.o" + include "build/src/overlays/actors/ovl_En_Test2/ovl_En_Test2_reloc.o" endseg beginseg @@ -2812,8 +2785,7 @@ beginseg name "ovl_En_Mkk" compress include "build/src/overlays/actors/ovl_En_Mkk/z_en_mkk.o" - include "build/data/ovl_En_Mkk/ovl_En_Mkk.data.o" - include "build/data/ovl_En_Mkk/ovl_En_Mkk.reloc.o" + include "build/src/overlays/actors/ovl_En_Mkk/ovl_En_Mkk_reloc.o" endseg beginseg @@ -2877,8 +2849,7 @@ beginseg name "ovl_En_Rat" compress include "build/src/overlays/actors/ovl_En_Rat/z_en_rat.o" - include "build/data/ovl_En_Rat/ovl_En_Rat.data.o" - include "build/data/ovl_En_Rat/ovl_En_Rat.reloc.o" + include "build/src/overlays/actors/ovl_En_Rat/ovl_En_Rat_reloc.o" endseg beginseg @@ -2970,9 +2941,7 @@ beginseg name "ovl_Bg_Crace_Movebg" compress include "build/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.o" - include "build/data/ovl_Bg_Crace_Movebg/ovl_Bg_Crace_Movebg.data.o" - include "build/data/ovl_Bg_Crace_Movebg/ovl_Bg_Crace_Movebg.bss.o" - include "build/data/ovl_Bg_Crace_Movebg/ovl_Bg_Crace_Movebg.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Crace_Movebg/ovl_Bg_Crace_Movebg_reloc.o" endseg beginseg @@ -3151,8 +3120,7 @@ beginseg name "ovl_Dm_Char06" compress include "build/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.o" - include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.data.o" - include "build/data/ovl_Dm_Char06/ovl_Dm_Char06.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char06/ovl_Dm_Char06_reloc.o" endseg beginseg @@ -3174,8 +3142,7 @@ beginseg name "ovl_Dm_Char09" compress include "build/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.o" - include "build/data/ovl_Dm_Char09/ovl_Dm_Char09.data.o" - include "build/data/ovl_Dm_Char09/ovl_Dm_Char09.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Char09/ovl_Dm_Char09_reloc.o" endseg beginseg @@ -3227,8 +3194,7 @@ beginseg name "ovl_Bg_Hakugin_Elvpole" compress include "build/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.o" - include "build/data/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole.data.o" - include "build/data/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/ovl_Bg_Hakugin_Elvpole_reloc.o" endseg beginseg @@ -3571,8 +3537,7 @@ beginseg name "ovl_Mir_Ray2" compress include "build/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.o" - include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.data.o" - include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.reloc.o" + include "build/src/overlays/actors/ovl_Mir_Ray2/ovl_Mir_Ray2_reloc.o" endseg beginseg @@ -3744,8 +3709,7 @@ beginseg name "ovl_En_Pp" compress include "build/src/overlays/actors/ovl_En_Pp/z_en_pp.o" - include "build/data/ovl_En_Pp/ovl_En_Pp.data.o" - include "build/data/ovl_En_Pp/ovl_En_Pp.reloc.o" + include "build/src/overlays/actors/ovl_En_Pp/ovl_En_Pp_reloc.o" endseg beginseg @@ -3809,8 +3773,7 @@ beginseg name "ovl_En_Pst" compress include "build/src/overlays/actors/ovl_En_Pst/z_en_pst.o" - include "build/data/ovl_En_Pst/ovl_En_Pst.data.o" - include "build/data/ovl_En_Pst/ovl_En_Pst.reloc.o" + include "build/src/overlays/actors/ovl_En_Pst/ovl_En_Pst_reloc.o" endseg beginseg @@ -3824,11 +3787,7 @@ beginseg name "ovl_Obj_Spidertent" compress include "build/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Obj_Spidertent/ovl_Obj_Spidertent_reloc.o" -#else - include "build/data/ovl_Obj_Spidertent/ovl_Obj_Spidertent.reloc.o" -#endif endseg beginseg @@ -4231,8 +4190,7 @@ beginseg name "ovl_Obj_Taru" compress include "build/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.o" - include "build/data/ovl_Obj_Taru/ovl_Obj_Taru.data.o" - include "build/data/ovl_Obj_Taru/ovl_Obj_Taru.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Taru/ovl_Obj_Taru_reloc.o" endseg beginseg @@ -4384,8 +4342,7 @@ beginseg name "ovl_En_S_Goro" compress include "build/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.o" - include "build/data/ovl_En_S_Goro/ovl_En_S_Goro.data.o" - include "build/data/ovl_En_S_Goro/ovl_En_S_Goro.reloc.o" + include "build/src/overlays/actors/ovl_En_S_Goro/ovl_En_S_Goro_reloc.o" endseg beginseg @@ -4474,9 +4431,7 @@ beginseg name "ovl_Oceff_Wipe7" compress include "build/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.o" - include "build/data/ovl_Oceff_Wipe7/ovl_Oceff_Wipe7.data.o" - include "build/data/ovl_Oceff_Wipe7/ovl_Oceff_Wipe7.bss.o" - include "build/data/ovl_Oceff_Wipe7/ovl_Oceff_Wipe7.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe7/ovl_Oceff_Wipe7_reloc.o" endseg beginseg @@ -5011,8 +4966,7 @@ beginseg name "ovl_Bg_Last_Bwall" compress include "build/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.o" - include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.data.o" - include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall_reloc.o" endseg beginseg @@ -5036,8 +4990,7 @@ beginseg name "ovl_Obj_Danpeilift" compress include "build/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.o" - include "build/data/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift.data.o" - include "build/data/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Danpeilift/ovl_Obj_Danpeilift_reloc.o" endseg beginseg @@ -5065,8 +5018,7 @@ beginseg name "ovl_Dm_Ah" compress include "build/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.o" - include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.data.o" - include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.reloc.o" + include "build/src/overlays/actors/ovl_Dm_Ah/ovl_Dm_Ah_reloc.o" endseg beginseg @@ -5101,8 +5053,7 @@ beginseg name "ovl_En_Paper" compress include "build/src/overlays/actors/ovl_En_Paper/z_en_paper.o" - include "build/data/ovl_En_Paper/ovl_En_Paper.data.o" - include "build/data/ovl_En_Paper/ovl_En_Paper.reloc.o" + include "build/src/overlays/actors/ovl_En_Paper/ovl_En_Paper_reloc.o" endseg beginseg diff --git a/src/code/audio/aisetnextbuf.c b/src/code/audio/aisetnextbuf.c new file mode 100644 index 000000000..b82f28e6f --- /dev/null +++ b/src/code/audio/aisetnextbuf.c @@ -0,0 +1,107 @@ +#include "global.h" + +//! Note that this is not the same as the original libultra +//! osAiSetNextBuffer, see comments in the function + +s32 osAiSetNextBuffer(void* buf, u32 size) { + static u8 D_801D6010 = false; + u32 bufAdjusted = (u32)buf; + s32 status; + + if (D_801D6010) { + bufAdjusted = (u32)buf - 0x2000; + } + if ((((u32)buf + size) & 0x1FFF) == 0) { + D_801D6010 = true; + } else { + D_801D6010 = false; + } + + // Originally a call to __osAiDeviceBusy + status = HW_REG(AI_STATUS_REG, s32); + if (status & AI_STATUS_AI_FULL) { + return -1; + } + + // OS_K0_TO_PHYSICAL replaces osVirtualToPhysical, this replacement + // assumes that only KSEG0 addresses are given + HW_REG(AI_DRAM_ADDR_REG, u32) = OS_K0_TO_PHYSICAL(bufAdjusted); + HW_REG(AI_LEN_REG, u32) = size; + return 0; +} + +//! Note that the remaining data and functions are unused and not part of the +//! original libultra osAiSetNextBuffer + +s16 D_801D6014[] = { + 19720, 18360, 17680, 16320, 14960, 13600, 12240, 10880, 9520, 0, +}; +s8 D_801D6028[7][16] = { + { 0, 1, 2, 2, 1, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3 }, { 0, 1, 2, 3, 3, 2, 1, 4, 5, 6, 7, 8, 7, 6, 5, 4 }, + { 0, 1, 2, 3, 4, 4, 3, 2, 1, 5, 6, 7, 8, 7, 6, 5 }, { 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 6, 7, 8, 7, 6 }, + { 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 7, 8, 7 }, { 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 8 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1 }, +}; +s16 D_801D6098[7][17] = { + { 0, 268, 560, 834, 1126, 1418, 1692, 1966, 2240, 2514, 2718, 2922, 3196, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1674, 1966, 2240, 2514, 2788, 2992, 3196, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2222, 2514, 2788, 3062, 3266, 3470, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2204, 2478, 2770, 3062, 3336, 3540, 3744, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2222, 2514, 2752, 3026, 3318, 3610, 3814, 4018, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2134, 2408, 2682, 2956, 3230, 3504, 3796, 4088, 4292 }, + { 0, 268, 560, 834, 1108, 1382, 1656, 1930, 2134, 2338, 2612, 2886, 3163, 3434, 3708, 4000, 4292 }, +}; +s16* D_801D6188 = D_801D6098[0]; +s8* D_801D618C = D_801D6028[0]; + +// Unused +void func_80194804(s32 index) { + D_801D6188 = D_801D6098[index]; + D_801D618C = D_801D6028[index]; +} + +// Only used below +s16 func_80194840(s32 arg0) { + s32 i; + s32 j = 0; + + for (i = 1; i < 16; i++) { + if (arg0 < D_801D6188[i]) { + break; + } + j++; + } + + if (i == 16) { + return 0; + } else { + j = D_801D618C[j]; + return D_801D6014[j]; + } +} + +// Unused +s32 func_801948B0(s32* arg0, s32* arg1) { + s32 temp_v0; + s32 phi_s0 = *arg0; + s32 phi_s1 = *arg1; + + while (true) { + temp_v0 = func_80194840(phi_s0); + if (temp_v0 == 0) { + return -1; + } + + if (phi_s1 < temp_v0) { + break; + } + + phi_s1 -= temp_v0; + phi_s0++; + } + + *arg0 = phi_s0; + *arg1 = phi_s1; + + return 0; +} diff --git a/src/code/audio/audio_load.c b/src/code/audio/audio_load.c index b4997a94e..9ebdd1d85 100644 --- a/src/code/audio/audio_load.c +++ b/src/code/audio/audio_load.c @@ -1208,7 +1208,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) { gAudioContext.refreshRate = 60; } - Audio_InitMesgQueues(); + AudioThread_InitMesgQueues(); for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufLengths); i++) { gAudioContext.aiBufLengths[i] = 0xA0; @@ -1217,7 +1217,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) { gAudioContext.totalTaskCount = 0; gAudioContext.rspTaskIndex = 0; gAudioContext.curAiBuffferIndex = 0; - gAudioContext.soundMode = AUDIO_MODE_STEREO; + gAudioContext.soundMode = SOUNDMODE_STEREO; gAudioContext.curTask = NULL; gAudioContext.rspTask[0].task.t.dataSize = 0; gAudioContext.rspTask[1].task.t.dataSize = 0; diff --git a/src/code/audio/audio_playback.c b/src/code/audio/audio_playback.c index c7789bd36..e7f5153ac 100644 --- a/src/code/audio/audio_playback.c +++ b/src/code/audio/audio_playback.c @@ -34,7 +34,7 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at sub->bitField0.stereoStrongLeft = false; sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects; sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects; - if (stereoHeadsetEffects && gAudioContext.soundMode == AUDIO_MODE_HEADSET) { + if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_HEADSET) { smallPanIndex = pan >> 1; if (smallPanIndex > 0x3F) { smallPanIndex = 0x3F; @@ -46,7 +46,7 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at volLeft = gHeadsetPanVolume[pan]; volRight = gHeadsetPanVolume[0x7F - pan]; - } else if (stereoHeadsetEffects && gAudioContext.soundMode == AUDIO_MODE_STEREO) { + } else if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_STEREO) { strongLeft = strongRight = false; sub->headsetPanRight = 0; sub->headsetPanLeft = 0; @@ -80,7 +80,7 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at break; } - } else if (gAudioContext.soundMode == AUDIO_MODE_MONO) { + } else if (gAudioContext.soundMode == SOUNDMODE_MONO) { sub->bitField0.stereoHeadsetEffects = false; sub->bitField0.usesHeadsetPanEffects = false; volLeft = 0.707f; // approx 1/sqrt(2) diff --git a/src/code/audio/audio_seqplayer.c b/src/code/audio/audio_seqplayer.c index d504f9f3a..ebcc9a8d1 100644 --- a/src/code/audio/audio_seqplayer.c +++ b/src/code/audio/audio_seqplayer.c @@ -1633,7 +1633,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { break; case 0xA8: // channel: random range large (only cmd that differs from OoT) - rand = Audio_NextRandom(); + rand = AudioThread_NextRandom(); channel->unk_22 = (cmdArgs[0] == 0) ? (rand & 0xFFFF) : (rand % cmdArgs[0]); channel->unk_22 += cmdArgs[1]; temp2 = (channel->unk_22 / 0x100) + 0x80; diff --git a/src/code/audio/audio_sfx_params.c b/src/code/audio/audio_sfx_params.c index dd23da443..0066328b1 100644 --- a/src/code/audio/audio_sfx_params.c +++ b/src/code/audio/audio_sfx_params.c @@ -1,496 +1,40 @@ #include "global.h" -/** - * TODO: - * the number of #efined sfx's we have for each bank does not seem to line up with the - * number of SfxParam entries for each bank. So at some point either through hacking or - * decompilation/documentation of sequence 0, the sfxs should be verified, especially - * the ones that come at the end of the list (all the earlier sfxs in each bank seem fine). - * - * After that, defines should be paired with sfxparams to make it easier to look up - * specific sfxsparams for a a certain sfx i.e.: - * { 0x18, 0, 0x1 }, // NA_SE_EN_DODO_J_WALK - * { 0x30, 0, 0x1 }, // NA_SE_EN_DODO_J_CRY - * { 0x30, 0, 0x1 }, // NA_SE_EN_DODO_J_FIRE - */ +#define DEFINE_SFX(_0, importance, distParam, randParam, flags2, flags1) \ + { importance, flags2, \ + ((((distParam) << SFX_PARAM_DIST_RANGE_SHIFT) & SFX_PARAM_DIST_RANGE_MASK) | \ + (((randParam) << SFX_PARAM_RAND_FREQ_RAISE_SHIFT) & SFX_PARAM_RAND_FREQ_RAISE_MASK) | (flags1)) }, SfxParams sEnemyBankParams[] = { - { 0x18, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, - { 0x30, 0, 0x3 }, { 0x36, 0, 0 }, { 0x38, 0, 0 }, { 0x40, 0, 0x3 }, { 0x58, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x68, 0, 0x1003 }, { 0x40, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x40, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x54, 0, 0xB }, { 0x54, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x40, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x30, 0, 0x2003 }, - { 0x50, 0, 0x3 }, { 0x58, 0, 0x3 }, { 0x38, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x38, 0, 0 }, { 0x48, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0x1 }, { 0x18, 0, 0 }, - { 0x14, 0, 0 }, { 0x14, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x28, 0, 0x4000 }, - { 0x28, 0, 0 }, { 0x30, 0, 0x2 }, { 0x32, 0, 0x2 }, { 0x38, 0, 0x1 }, { 0x20, 0, 0 }, - { 0x40, 0, 0x1 }, { 0x18, 0, 0 }, { 0x28, 0, 0 }, { 0x18, 0, 0x40 }, { 0x30, 0, 0 }, - { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x14, 0, 0 }, { 0x18, 0, 0x80 }, { 0x38, 0, 0x2 }, - { 0x34, 0, 0 }, { 0x28, 0, 0x1 }, { 0x30, 0, 0 }, { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, - { 0x30, 0, 0 }, { 0x18, 0, 0 }, { 0x20, 0, 0 }, { 0x30, 0, 0 }, { 0x32, 0, 0 }, - { 0x20, 0, 0x1 }, { 0x37, 0, 0x1 }, { 0x38, 0, 0x1 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x40, 0, 0x2 }, { 0x38, 0, 0x2 }, { 0x20, 0, 0 }, { 0x18, 0, 0 }, { 0x40, 0, 0x4007 }, - { 0x40, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x40, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x34, 0, 0 }, - { 0x34, 0, 0 }, { 0x36, 0, 0 }, { 0x30, 0, 0x3 }, { 0x28, 0, 0 }, { 0x30, 0, 0 }, - { 0x18, 0, 0 }, { 0x30, 0, 0 }, { 0x28, 0, 0xC0 }, { 0x30, 0, 0x40 }, { 0x38, 0, 0x41 }, - { 0x40, 0, 0x41 }, { 0x30, 0, 0 }, { 0x36, 0, 0 }, { 0x40, 0, 0x1 }, { 0x14, 0, 0 }, - { 0x30, 0, 0 }, { 0x20, 0, 0 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x4 }, - { 0x30, 0, 0x4 }, { 0x20, 0, 0x4 }, { 0x38, 0, 0x4 }, { 0x20, 0, 0x3 }, { 0x38, 0, 0x1 }, - { 0x40, 0, 0x1 }, { 0x14, 0, 0 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0x1 }, { 0x20, 0, 0x1 }, - { 0x30, 0, 0x2 }, { 0x35, 0, 0x2 }, { 0x38, 0, 0x2 }, { 0x48, 0, 0x2 }, { 0x40, 0, 0x2 }, - { 0x45, 0, 0x81 }, { 0x34, 0, 0 }, { 0x40, 0, 0 }, { 0x20, 0, 0x2 }, { 0x28, 0, 0 }, - { 0x28, 0, 0 }, { 0x30, 0, 0 }, { 0x20, 0, 0x84 }, { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, - { 0x20, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x4 }, { 0x40, 0, 0x4 }, { 0x40, 0, 0x3 }, - { 0x40, 0, 0x1 }, { 0x28, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0 }, { 0x38, 0, 0x1 }, - { 0x30, 0, 0x4 }, { 0x30, 0, 0 }, { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x38, 0, 0x2000 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x14, 0, 0 }, { 0x38, 0, 0x1 }, - { 0x40, 0, 0x1 }, { 0x14, 0, 0 }, { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x30, 0, 0 }, - { 0x40, 0, 0x1 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x37, 0, 0x1 }, { 0x40, 0, 0x1 }, - { 0x28, 0, 0x5 }, { 0x36, 0, 0x5 }, { 0x38, 0, 0x5 }, { 0x48, 0, 0x5 }, { 0x30, 0, 0x3 }, - { 0x28, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x38, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x3 }, { 0x38, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x403 }, { 0x38, 0, 0x1 }, - { 0x30, 0, 0x43 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0 }, { 0x34, 0, 0 }, { 0x18, 0, 0x80 }, - { 0x30, 0, 0 }, { 0x38, 0, 0 }, { 0x30, 0, 0 }, { 0x14, 0, 0 }, { 0x34, 0, 0 }, - { 0x40, 0, 0 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x28, 0, 0 }, { 0x30, 0, 0x80 }, { 0x40, 0, 0x1 }, { 0x40, 0, 0x1 }, - { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x14, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x38, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x48, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x48, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x30, 0, 0x4083 }, { 0x30, 0, 0x4083 }, { 0x40, 0, 0x3 }, - { 0x38, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x28, 0, 0x3 }, { 0x28, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x2003 }, { 0x38, 0, 0x1 }, { 0x20, 0, 0 }, { 0x34, 0, 0 }, - { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x34, 0, 0x2000 }, { 0x20, 0, 0 }, { 0x38, 0, 0x42 }, - { 0x40, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x2 }, { 0x38, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x24, 0, 0x40 }, { 0x30, 0, 0x3 }, { 0x28, 0, 0x82 }, { 0x40, 0, 0x3 }, { 0x40, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x20, 0, 0x83 }, { 0x20, 0, 0 }, { 0x30, 0, 0x3 }, - { 0x20, 0, 0x80 }, { 0x30, 0, 0x83 }, { 0x18, 0, 0x83 }, { 0x34, 0, 0x83 }, { 0x30, 0, 0x83 }, - { 0x38, 0, 0x3 }, { 0x18, 0, 0x3 }, { 0x30, 0, 0x2000 }, { 0x38, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x40, 0, 0x2004 }, { 0x38, 0, 0x5 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x82 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x5 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x84 }, { 0x38, 0, 0x80 }, { 0x38, 0, 0x6083 }, - { 0x38, 0, 0x6083 }, { 0x38, 0, 0x6083 }, { 0x38, 0, 0x6083 }, { 0x40, 0, 0x4082 }, { 0x18, 0, 0x83 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0x3 }, { 0x24, 0, 0x5 }, { 0x28, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x3 }, { 0x18, 0, 0x1 }, { 0x34, 0, 0x3 }, { 0x30, 0, 0x5 }, { 0x34, 0, 0x3 }, - { 0x34, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x1 }, - { 0x14, 0, 0 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x20, 0, 0x1 }, - { 0x38, 0, 0x3 }, { 0x30, 0, 0 }, { 0x40, 0, 0x4003 }, { 0x30, 0, 0x4003 }, { 0x38, 0, 0x3 }, - { 0x38, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x40, 0, 0x83 }, { 0x40, 0, 0x83 }, { 0x40, 0, 0x3 }, - { 0x21, 0, 0x4003 }, { 0x54, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x34, 0, 0x2 }, - { 0x58, 0, 0x3 }, { 0x68, 0, 0x3 }, { 0x50, 0, 0x40C3 }, { 0x14, 0, 0 }, { 0x20, 0, 0x1 }, - { 0x48, 0, 0x4080 }, { 0x30, 0, 0x4080 }, { 0x50, 0, 0x1 }, { 0x50, 0, 0x1 }, { 0x50, 0, 0 }, - { 0x50, 0, 0 }, { 0x68, 0, 0x3 }, { 0x58, 0, 0x3 }, { 0x90, 0, 0x3 }, { 0x48, 0, 0x3 }, - { 0x28, 0, 0x2 }, { 0x30, 0, 0 }, { 0x38, 0, 0x1 }, { 0x28, 0, 0x2 }, { 0x50, 0, 0x3 }, - { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x40, 0, 0x4083 }, { 0x40, 0, 0x3 }, { 0x40, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x40, 0, 0x3 }, - { 0x48, 0, 0x3 }, { 0x48, 0, 0x3 }, { 0x48, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x34, 0, 0x2 }, - { 0x34, 0, 0x2002 }, { 0x28, 0, 0x2 }, { 0x28, 0, 0x2 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x2 }, - { 0x38, 0, 0x2 }, { 0x38, 0, 0x2 }, { 0x48, 0, 0x2 }, { 0x10, 0, 0 }, { 0x34, 0, 0 }, - { 0x18, 0, 0 }, { 0x30, 0, 0 }, { 0x14, 0, 0 }, { 0x34, 0, 0 }, { 0x28, 0, 0x1 }, - { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x38, 0, 0x1 }, { 0x36, 0, 0x1 }, - { 0x34, 0, 0x1 }, { 0x38, 0, 0x1 }, { 0x48, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x38, 0, 0x83 }, - { 0x30, 0, 0x3 }, { 0x20, 0, 0x2000 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x40, 0, 0x1 }, - { 0x30, 0, 0 }, { 0x20, 0, 0 }, { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x18, 0, 0 }, { 0x28, 0, 0 }, { 0x34, 0, 0x2 }, { 0x34, 0, 0x2 }, { 0x34, 0, 0 }, - { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x2 }, { 0x38, 0, 0 }, - { 0x48, 0, 0 }, { 0x28, 0, 0x4004 }, { 0x48, 0, 0x4 }, { 0x20, 0, 0x4 }, { 0x25, 0, 0x3 }, - { 0x40, 0, 0x2 }, { 0x18, 0, 0x80 }, { 0x44, 0, 0x3 }, { 0x44, 0, 0 }, { 0x18, 0, 0 }, - { 0x30, 0, 0 }, { 0x38, 0, 0x1 }, { 0x40, 0, 0x1 }, { 0x18, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x38, 0, 0x43 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x36, 0, 0x3 }, - { 0x34, 0, 0x3 }, { 0x34, 0, 0x82 }, { 0x58, 0, 0x3 }, { 0x68, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x34, 0, 0x2 }, { 0x34, 0, 0x3 }, { 0x40, 0, 0 }, { 0x30, 0, 0x3 }, - { 0x40, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0xC0 }, { 0x30, 0, 0xC0 }, { 0x40, 0, 0 }, - { 0x30, 0, 0x3 }, { 0x28, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x38, 0, 0x3 }, { 0x48, 0, 0x3 }, - { 0x20, 0, 0x3 }, { 0x48, 0, 0x3 }, { 0x36, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x38, 0, 0x3 }, { 0x38, 0, 0x3 }, { 0x20, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x44, 0, 0x3 }, - { 0x30, 0, 0x83 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x34, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x20, 0, 0x2 }, { 0x34, 0, 0x3 }, { 0x20, 0, 0x83 }, { 0x30, 0, 0x4 }, - { 0x30, 0, 0x4042 }, { 0x40, 0, 0x4042 }, { 0x40, 0, 0x83 }, { 0x30, 0, 0x4042 }, { 0x30, 0, 0x4042 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x1 }, { 0x32, 0, 0x4082 }, { 0x32, 0, 0x3 }, - { 0x54, 0, 0x1 }, { 0x52, 0, 0 }, { 0x54, 0, 0x3 }, { 0x30, 0, 0 }, { 0x08, 0, 0x1 }, - { 0x30, 0, 0x1 }, { 0x30, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x54, 0, 0x2000 }, { 0x34, 0, 0x3 }, - { 0x54, 0, 0x2000 }, { 0x08, 0, 0 }, { 0x54, 0, 0 }, { 0x34, 0, 0 }, { 0x15, 0, 0 }, - { 0x35, 0, 0 }, { 0x48, 0, 0 }, { 0x38, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0xC2 }, - { 0x38, 0, 0x2 }, { 0x38, 0, 0x2 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0x1, 0x80 }, { 0x30, 0xB4, 0x6 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x6 }, { 0x30, 0, 0x83 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x2 }, - { 0x30, 0, 0x2 }, { 0x48, 0, 0x2 }, { 0x28, 0, 0x1 }, { 0x36, 0, 0 }, { 0x38, 0, 0 }, - { 0x48, 0, 0 }, { 0x68, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x38, 0, 0x3 }, - { 0x48, 0, 0x3 }, { 0x58, 0, 0x3 }, { 0x68, 0, 0x3 }, { 0x29, 0, 0x3 }, { 0x54, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, - { 0x30, 0, 0 }, { 0x68, 0, 0x3 }, { 0x30, 0, 0 }, { 0x45, 0, 0x2 }, { 0x40, 0, 0x4043 }, - { 0x40, 0, 0x4043 }, { 0x30, 0, 0x4043 }, { 0x30, 0, 0x4043 }, { 0x30, 0, 0x4043 }, { 0x30, 0, 0x4043 }, - { 0x30, 0, 0x4083 }, { 0x30, 0, 0x4083 }, { 0x30, 0, 0x4083 }, { 0x50, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x10, 0, 0 }, { 0x54, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, - { 0x54, 0, 0x43 }, { 0x50, 0, 0x43 }, { 0x50, 0, 0x43 }, { 0x50, 0, 0x43 }, { 0x36, 0, 0x43 }, - { 0x34, 0, 0x43 }, { 0x34, 0, 0x83 }, { 0x36, 0, 0x43 }, { 0x35, 0, 0x43 }, { 0x34, 0, 0x83 }, - { 0x58, 0, 0x43 }, { 0x68, 0, 0x43 }, { 0x38, 0, 0x43 }, { 0x48, 0, 0x43 }, { 0x38, 0, 0x43 }, - { 0x48, 0, 0x43 }, { 0x34, 0, 0x83 }, { 0x34, 0, 0x4043 }, { 0x34, 0, 0x4043 }, { 0x34, 0, 0x83 }, - { 0x34, 0, 0x4043 }, { 0x50, 0, 0x43 }, { 0x34, 0, 0x43 }, { 0x50, 0, 0x43 }, { 0x36, 0, 0x43 }, - { 0x36, 0, 0x43 }, { 0x34, 0, 0x43 }, { 0x37, 0, 0x3 }, { 0x54, 0, 0x43 }, { 0x40, 0, 0x3 }, - { 0x40, 0, 0x3 }, { 0x57, 0, 0x3 }, { 0x34, 0, 0x2 }, { 0x40, 0, 0 }, { 0x32, 0, 0 }, - { 0x50, 0, 0x83 }, { 0x50, 0, 0x83 }, { 0x50, 0, 0x83 }, { 0x50, 0, 0x83 }, { 0x50, 0, 0x83 }, - { 0x58, 0, 0x83 }, { 0x58, 0, 0x83 }, { 0x68, 0, 0x3 }, { 0x68, 0, 0x3 }, { 0x48, 0, 0x3 }, - { 0x48, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x28, 0, 0x4 }, { 0x34, 0, 0x2 }, - { 0x30, 0, 0x4080 }, { 0x30, 0, 0x4080 }, { 0x30, 0, 0x4080 }, { 0x30, 0, 0x4080 }, { 0x30, 0, 0x1 }, - { 0x30, 0, 0x84 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, - { 0x58, 0, 0x3 }, { 0x58, 0, 0x3 }, { 0x68, 0, 0x3 }, { 0x50, 0, 0x3 }, { 0x50, 0, 0x3 }, - { 0x30, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0x1 }, { 0x34, 0, 0x80 }, - { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, - { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x54, 0, 0 }, - { 0x34, 0, 0 }, { 0x34, 0, 0x2000 }, { 0x34, 0, 0x2000 }, { 0x34, 0, 0 }, { 0x30, 0, 0x5 }, - { 0x30, 0, 0x1 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x34, 0, 0x4083 }, { 0x34, 0, 0x4083 }, - { 0x30, 0, 0x4083 }, { 0x30, 0, 0x4083 }, { 0x34, 0, 0 }, { 0x30, 0, 0 }, { 0x34, 0, 0x1083 }, - { 0x30, 0, 0x1005 }, { 0x30, 0, 0x4080 }, { 0x34, 0, 0 }, { 0x34, 0, 0 }, { 0x30, 0, 0x6 }, - { 0x30, 0, 0x6 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0x6 }, { 0x34, 0, 0 }, { 0x38, 0, 0 }, - { 0x48, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x85 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0x2 }, { 0x32, 0, 0x80 }, - { 0x50, 0, 0x2 }, { 0x50, 0, 0x2 }, { 0x58, 0, 0x2 }, { 0x68, 0, 0x2 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x50, 0, 0x2 }, { 0x50, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x54, 0, 0x5 }, - { 0x28, 0, 0x5 }, { 0x78, 0, 0x2000 }, { 0x78, 0, 0x2000 }, { 0x50, 0, 0x3 }, { 0x58, 0, 0x3 }, - { 0x68, 0, 0x3 }, { 0x54, 0, 0x3 }, { 0x40, 0, 0x3 }, { 0x78, 0, 0x3 }, { 0x48, 0, 0 }, - { 0x30, 0, 0x83 }, { 0x30, 0, 0x83 }, { 0x30, 0, 0x83 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0xC3 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x45 }, { 0x60, 0, 0x2 }, - { 0x70, 0, 0x2000 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x7 }, { 0x30, 0, 0x44 }, - { 0x30, 0, 0x44 }, { 0x30, 0, 0x83 }, { 0x48, 0, 0x3 }, { 0x58, 0, 0x3 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x3 }, { 0x36, 0, 0 }, { 0x40, 0, 0x2 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, +#include "tables/sfx/enemybank_table.h" }; SfxParams sPlayerBankParams[] = { - { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, - { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, - { 0x20, 0, 0x480 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, - { 0x20, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x40, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x40 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, - { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, - { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x80, 0, 0 }, - { 0x80, 0, 0 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0xC00 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x20, 0, 0x80 }, { 0x20, 0, 0x80 }, - { 0x20, 0, 0x80 }, { 0x20, 0, 0x80 }, { 0x20, 0, 0x40 }, { 0x20, 0, 0x40 }, { 0x20, 0, 0x40 }, - { 0x20, 0, 0x40 }, { 0x20, 0, 0x80 }, { 0x20, 0, 0x80 }, { 0x20, 0, 0x80 }, { 0x20, 0, 0 }, - { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x20, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, - { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, - { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, { 0x40, 0, 0 }, - { 0x40, 0, 0 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, - { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, - { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, - { 0x30, 0, 0x440 }, { 0x30, 0, 0x440 }, { 0x30, 0, 0xC00 }, { 0x30, 0, 0x4080 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x60, 0, 0x2 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x800 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x403 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x400 }, - { 0x60, 0, 0x40 }, { 0x40, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x50, 0, 0x43 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, - { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, - { 0x20, 0, 0x480 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, - { 0x20, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, - { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, - { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x400 }, - { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x480 }, - { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, - { 0x20, 0, 0x440 }, { 0x20, 0, 0x480 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, - { 0x20, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, - { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x40, 0, 0x440 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x50, 0, 0x400 }, { 0x50, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x60, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x4080 }, { 0x40, 0, 0x403 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x2400 }, { 0x30, 0, 0x2400 }, - { 0x30, 0, 0x2400 }, { 0x30, 0, 0x2400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x43 }, - { 0x30, 0, 0x43 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x400 }, +#include "tables/sfx/playerbank_table.h" }; SfxParams sItemBankParams[] = { - { 0x30, 0, 0x8040 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0x440 }, - { 0x30, 0, 0x440 }, { 0x60, 0, 0x83 }, { 0x30, 0, 0x440 }, { 0x80, 0, 0x43 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x40 }, { 0x38, 0, 0x400 }, { 0x30, 0, 0x401 }, { 0x50, 0, 0x100 }, { 0x90, 0, 0x2 }, - { 0x50, 0, 0x2 }, { 0x30, 0, 0x400 }, { 0x40, 0, 0x2 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x34, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x400 }, { 0x20, 0, 0x400 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x400 }, - { 0x30, 0, 0x400 }, { 0x60, 0, 0x43 }, { 0x30, 0, 0x1 }, { 0x30, 0, 0x401 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0xA0, 0, 0x2 }, { 0xA0, 0, 0x2 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0x100 }, - { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0x400 }, { 0x30, 0, 0 }, - { 0x60, 0, 0x81 }, { 0x30, 0, 0 }, { 0x30, 0, 0x400 }, { 0x60, 0, 0x8003 }, { 0x60, 0, 0x8003 }, - { 0x60, 0, 0x8003 }, { 0x30, 0, 0x4000 }, { 0x30, 0, 0x4000 }, { 0x30, 0, 0x40 }, { 0x80, 0, 0x3 }, - { 0x80, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x80, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x80, 0, 0 }, { 0x80, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0 }, - { 0x30, 0, 0 }, { 0x60, 0, 0x100 }, { 0x70, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0x483 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0x2000 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, +#include "tables/sfx/itembank_table.h" }; SfxParams sEnvBankParams[] = { - { 0x70, 0, 0x640 }, { 0x80, 0, 0x40 }, { 0x30, 0, 0 }, { 0x60, 0, 0x40 }, { 0x60, 0, 0x40 }, - { 0x70, 0, 0x40 }, { 0x30, 0, 0x480 }, { 0x70, 0, 0x2 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, - { 0x80, 0, 0x2 }, { 0xA0, 0, 0x3 }, { 0x30, 0, 0x103 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x40 }, { 0x50, 0, 0 }, - { 0x60, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x60, 0, 0 }, { 0x30, 0, 0x82 }, { 0x30, 0, 0 }, - { 0x40, 0, 0 }, { 0x68, 0, 0 }, { 0x58, 0, 0x40 }, { 0x60, 0, 0 }, { 0x70, 0, 0x3 }, - { 0x30, 0, 0x43 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0xA0, 0, 0x2008 }, { 0x20, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x800 }, { 0x30, 0, 0x8800 }, { 0x30, 0, 0x8000 }, { 0x30, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0x400 }, - { 0x30, 0, 0 }, { 0x80, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x40 }, { 0x10, 0, 0 }, - { 0xA0, 0, 0x3 }, { 0x30, 0, 0x100 }, { 0x30, 0, 0x10 }, { 0x30, 0, 0x3 }, { 0x60, 0x40, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, { 0xA0, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x70, 0, 0 }, { 0x60, 0, 0x8000 }, - { 0x30, 0, 0x8000 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, - { 0x30, 0, 0x2003 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2010 }, { 0x30, 0, 0x40 }, - { 0x60, 0, 0 }, { 0x60, 0, 0x3 }, { 0x30, 0, 0 }, { 0x58, 0, 0x1 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x40, 0, 0 }, { 0x30, 0, 0xC3 }, { 0x70, 0, 0x2 }, { 0x60, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x60, 0, 0x41 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, { 0x90, 0, 0x3 }, - { 0x90, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x3800 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x803 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x80 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x60, 0, 0 }, - { 0x30, 0, 0x640 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x2 }, { 0x80, 0, 0x2 }, { 0x40, 0, 0 }, - { 0x1C, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0x4 }, { 0x30, 0, 0x800 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x80, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x800 }, { 0x30, 0, 0x800 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x20, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x8000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x70, 0, 0x2 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x50, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2003 }, { 0x20, 0, 0 }, - { 0x30, 0, 0xC0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x6 }, { 0xA0, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0xC0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x4083 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0x83 }, - { 0x80, 0, 0x2000 }, { 0x50, 0, 0 }, { 0x60, 0, 0 }, { 0x90, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0xA0, 0, 0x800 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x20, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x2 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x5 }, { 0x30, 0, 0xC2 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x68, 0, 0x2 }, - { 0x30, 0, 0x2 }, { 0x30, 0, 0x4040 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, - { 0x30, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0xC0 }, { 0x80, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0xA0, 0, 0xA003 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x85 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x60, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0x40 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x40 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x80 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0xC0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x80, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x43 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x3 }, { 0xA0, 0, 0x4000 }, { 0x30, 0, 0x43 }, { 0x30, 0, 0x40 }, { 0x60, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2080 }, { 0x30, 0, 0x2080 }, { 0x30, 0, 0x2000 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, - { 0x30, 0, 0x2 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2 }, { 0x30, 0, 0x80 }, { 0x60, 0, 0x42 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, - { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x80, 0, 0 }, - { 0x80, 0, 0x3 }, { 0x80, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x80, 0, 0x2 }, { 0x80, 0, 0x2 }, - { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x42 }, { 0x30, 0, 0x42 }, - { 0x30, 0, 0x43 }, { 0x60, 0x80, 0x2000 }, { 0x60, 0x80, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0x2000 }, { 0x80, 0, 0x2000 }, { 0x80, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, - { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x80, 0, 0x3 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0x43 }, - { 0x30, 0, 0x3 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x10, 0, 0x7 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, - { 0x58, 0, 0x60 }, { 0x60, 0, 0x3 }, { 0x60, 0, 0x3 }, { 0x60, 0, 0x3 }, { 0x70, 0, 0x3 }, - { 0x70, 0, 0x3 }, { 0x30, 0, 0 }, { 0x70, 0, 0x3 }, { 0x30, 0, 0x4 }, { 0x30, 0, 0x3 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0x80, 0 }, { 0x30, 0x80, 0x40 }, { 0x30, 0x80, 0x40 }, { 0x60, 0, 0x2000 }, { 0x70, 0, 0x2000 }, - { 0x30, 0, 0x80 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x3 }, { 0x30, 0, 0 }, { 0x60, 0, 0x3 }, - { 0x70, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x40, 0, 0 }, { 0x58, 0, 0x40 }, { 0x58, 0, 0x40 }, - { 0x30, 0, 0x40 }, { 0x30, 0, 0x41 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, +#include "tables/sfx/environmentbank_table.h" }; SfxParams sSystemBankParams[] = { - { 0xC0, 0, 0 }, { 0xC0, 0, 0 }, { 0xB0, 0, 0x20 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x50, 0, 0 }, { 0x30, 0, 0x20 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x20, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x28, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x18, 0, 0 }, { 0x2C, 0, 0 }, { 0x2C, 0, 0 }, { 0x20, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x20, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0x20 }, { 0x60, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0xA0, 0, 0x8 }, { 0xA0, 0, 0x8 }, { 0x30, 0, 0 }, +#include "tables/sfx/systembank_table.h" }; SfxParams sOcarinaBankParams[] = { - { 0x30, 0, 0 }, { 0x30, 0, 0x20 }, { 0x30, 0, 0x642 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x2000 }, { 0x30, 0, 0x2000 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, +#include "tables/sfx/ocarinabank_table.h" }; SfxParams sVoiceBankParams[] = { - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x20, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x50, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x482 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x80, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x20, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x50, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x481 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0 }, { 0x60, 0, 0x20 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0 }, - { 0x30, 0, 0 }, { 0x30, 0, 0 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8000 }, { 0x30, 0, 0x8000 }, - { 0x30, 0, 0x8000 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8001 }, { 0x30, 0, 0x8043 }, { 0x30, 0, 0x8043 }, { 0x30, 0, 0x8043 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, - { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x8041 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x20, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x50, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x481 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x20, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x50, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x482 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x80, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x20, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x50, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x482 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x80, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x20, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x50, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x482 }, { 0x30, 0, 0x442 }, - { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x30, 0, 0x442 }, { 0x80, 0, 0x442 }, { 0x30, 0, 0x442 }, - { 0x30, 0x80, 0x442 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, - { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, { 0x30, 0, 0x402 }, +#include "tables/sfx/voicebank_table.h" }; +#undef DEFINE_SFX + SfxParams* gSfxParams[7] = { sPlayerBankParams, sItemBankParams, sEnvBankParams, sEnemyBankParams, sSystemBankParams, sOcarinaBankParams, sVoiceBankParams, diff --git a/src/code/audio/code_80192BE0.c b/src/code/audio/code_80192BE0.c index 20b4239da..e69f678ff 100644 --- a/src/code/audio/code_80192BE0.c +++ b/src/code/audio/code_80192BE0.c @@ -16,13 +16,13 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80193858.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_8019387C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/AudioThread_QueueCmdS32.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_QueueCmdS8.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/AudioThread_QueueCmdS8.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_801938D0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80193900.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/AudioThread_ScheduleProcessCmds.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80193990.s") @@ -76,6 +76,6 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/func_80194568.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_NextRandom.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/AudioThread_NextRandom.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_80192BE0/AudioThread_InitMesgQueues.s") diff --git a/src/code/audio/code_80194790.c b/src/code/audio/code_80194790.c deleted file mode 100644 index 9ba2436de..000000000 --- a/src/code/audio/code_80194790.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194790.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194804.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_80194840.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_80194790/func_801948B0.s") diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index 2e7cc91e1..b896facbc 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -18,15 +18,15 @@ typedef struct { } SfxSettings; // size = 0x9 typedef struct { - /* 0x0 */ f32 vol; + /* 0x0 */ f32 volume; /* 0x4 */ f32 freqScale; /* 0x8 */ s8 reverb; /* 0x9 */ s8 panSigned; /* 0xA */ s8 stereoBits; /* 0xB */ u8 filter; - /* 0xC */ u8 unk_0C; - /* 0xD */ u8 unk_0D; -} SfxPlayerState; // size = 0xE + /* 0xC */ u8 combFilterGain; + /* 0xD */ u8 zVolume; +} SfxChannelState; // size = 0xE typedef enum { /* 0x0 */ SFX_CHANNEL_PLAYER0, // SfxPlayerBank @@ -66,7 +66,7 @@ typedef struct { /* 0xC */ s32 remainingFrames; } FreqLerp; // size = 0x10 -s32 AudioOcarina_MemoryGameGenerateNotes(void); +s32 AudioOcarina_MemoryGameNextNote(void); s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); void func_801A3238(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); @@ -91,7 +91,7 @@ f32* sSfxVolumeCur; f32 sSfxVolumeTarget; f32 sSfxVolumeRate; u16 sSceneSeqId1; -SfxPlayerState sSfxChannelState[16]; +SfxChannelState sSfxChannelState[16]; // Sequence bss u8 D_801FD3A8; @@ -131,18 +131,18 @@ u16 D_801FD438; OcarinaStaff sPlayingStaff; OcarinaStaff sPlaybackStaff; OcarinaStaff sRecordingStaff; -u32 sOcarinaUpdateTaskCurrent; +u32 sOcarinaUpdateTaskStart; OcarinaControlStick sOcarinaInputStickRel; u32 sOcarinaInputButtonCur; u32 sOcarinaInputButtonStart; u32 sOcarinaInputButtonPrev; -s32 sOcaInputBtnPress; -u8 sOcarinaResetDelay; -u8 sOcarinaResetUnused; +s32 sOcarinaInputButtonPress; +u8 sOcarinaDisableTimer; +u8 sOcarinaUnused; u8 sOcarinaHasStartedSong; u8 sFirstOcarinaSongIndex; u8 sLastOcarinaSongIndex; -u32 sOcarinaAvailSongs; +u32 sOcarinaAvailableSongFlags; u8 sOcarinaStaffPlayingPos; u16 sMusicStaffPos[OCARINA_SONG_MAX]; u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX]; @@ -150,11 +150,12 @@ u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX]; u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX]; // Next required pitch in song playback u8 D_801FD518[OCARINA_SONG_MAX]; u32 D_801FD530[OCARINA_SONG_MAX]; -OcarinaNote sRecordingSongNote; +OcarinaNote sScarecrowsLongSongSecondNote; u16 sCustomSequencePc; // Sfx Data -u8 D_801D6600[] = { +// If the Sfx Bank has more than 255 values (max value of u8) +u8 gIsLargeSfxBank[] = { true, false, true, true, false, false, true, }; u8 D_801D6608[] = { @@ -192,7 +193,7 @@ u8 sEnterGanonsTowerTimer = 0; u16 sSfxVolumeDuration = 0; // System Data -s8 sAudioFileSelectSetting = AUDIO_FS_STEREO; +s8 sSoundMode = SOUNDMODE_STEREO; s8 sAudioIsWindowOpen = false; s8 sAudioCutsceneFlag = false; s8 sSpecReverb = 0; @@ -987,35 +988,35 @@ NatureAmbienceDataIO sNatureAmbienceData[20] = { u8 sIsOcarinaInputEnabled = false; s8 sOcarinaInstrumentId = OCARINA_INSTRUMENT_OFF; u8 sCurOcarinaPitch = OCARINA_PITCH_NONE; -u8 sPrevOcarinaPitch = 0; -u8 sCurOcarinaButtonIndex = 0; -u8 sMusicStaffPrevPitch = 0; +u8 sPrevOcarinaPitch = OCARINA_PITCH_C4; +u8 sCurOcarinaButtonIndex = OCARINA_BTN_A; +u8 sMusicStaffPrevPitch = OCARINA_PITCH_C4; f32 sCurOcarinaBendFreq = 1.0f; -f32 sDefaultOcarinaVolume = 0.68503935f; +f32 sDefaultOcarinaVolume = 87.0f / 127.0f; s8 sCurOcarinaBendIndex = 0; -s8 sCurOcarinaVolume = 0x57; +s8 sCurOcarinaVolume = 87; s8 sCurOcarinaVibrato = 0; u8 sPlaybackState = 0; -u8 D_801D6FE4 = 0xFF; -u8 D_801D6FE8 = 0xFF; +u8 sPlaybackStaffStopPos = 0xFF; +u8 sPlaybackStaffStartPos = 0xFF; u32 sOcarinaFlags = 0; s32 sPlaybackNoteTimer = 0; u16 sPlaybackNotePos = 0; u16 sPlaybackStaffPos = 0; -u32 sPrevOcarinaSongFlags = 0; // Stores sOcarinaFlags but never used -u8 sPlaybackNoteValue = OCARINA_PITCH_NONE; +u32 sPrevOcarinaWithMusicStaffFlags = 0; // Stores sOcarinaFlags but never used +u8 sPlaybackPitch = OCARINA_PITCH_NONE; // Pitch + PitchFlags u8 sNotePlaybackVolume = 0; u8 sNotePlaybackVibrato = 0; s8 sNotePlaybackBend = 0; -f32 sNormalizedNotePlaybackTone = 1.0f; -f32 sNormalizedNotePlaybackVolume = 1.0f; +f32 sRelativeNotePlaybackBend = 1.0f; +f32 sRelativeNotePlaybackVolume = 1.0f; u32 sOcarinaPlaybackTaskStart = 0; u32 sOcarinaWallCounter = 0; -u8 sCurOcarinaSong[8] = { +u8 sCurOcarinaSongWithoutMusicStaff[8] = { OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, OCARINA_PITCH_C4, }; -u8 sOcarinaSongAppendPos = 0; +u8 sOcarinaWithoutMusicStaffPos = 0; u8 sOcarinaSongStartingPos = 0; u8 sButtonToPitchMap[5] = { @@ -1027,10 +1028,10 @@ u8 sButtonToPitchMap[5] = { }; u8 sOcarinaMemoryGameAppendPos = 0; -u8 sOcaMemoryGameEndPos = 0; -u8 sOcaMemoryGameNumNotes[] = { 5, 6, 8 }; +u8 sOcarinaMemoryGameEndPos = 0; +u8 sOcarinaMemoryGameNumNotes[] = { 5, 6, 8 }; OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { - // 0: Sonata of Awakening + // OCARINA_SONG_SONATA { { OCARINA_PITCH_D5, 19, 92, 0, 0, 0 }, { OCARINA_PITCH_B4, 19, 90, 0, 0, 0 }, @@ -1042,7 +1043,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 86, 0, 0, 0 }, }, - // 1: Goron Lullaby + // OCARINA_SONG_GORON_LULLABY { { OCARINA_PITCH_D4, 41, 80, 0, 0, 0 }, { OCARINA_PITCH_A4, 40, 72, 0, 0, 0 }, @@ -1056,7 +1057,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 2: New Wave Bossa Nova + // OCARINA_SONG_NEW_WAVE { { OCARINA_PITCH_B4, 64, 74, 0, 0, 0 }, { OCARINA_PITCH_D5, 13, 88, 0, 0, 0 }, @@ -1068,7 +1069,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 3: Elegy of Emptyness + // OCARINA_SONG_ELEGY { { OCARINA_PITCH_A4, 85, 93, 0, 0, 0 }, { OCARINA_PITCH_B4, 43, 91, 0, 0, 0 }, @@ -1080,7 +1081,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 94, 0, 0, 0 }, }, - // 4: Oath to Order + // OCARINA_SONG_OATH { { OCARINA_PITCH_A4, 97, 104, 0, 0, 0 }, { OCARINA_PITCH_F4, 48, 88, 0, 0, 0 }, @@ -1092,7 +1093,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { }, - // 5: Sarias Song + // OCARINA_SONG_SARIAS { { OCARINA_PITCH_F4, 17, 84, 0, 0, 0 }, { OCARINA_PITCH_A4, 17, 88, 0, 0, 0 }, @@ -1103,7 +1104,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 6: Song of Time + // OCARINA_SONG_TIME { { OCARINA_PITCH_A4, 32, 84, 0, 0, 0 }, { OCARINA_PITCH_D4, 65, 88, 0, 0, 0 }, @@ -1114,7 +1115,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 7: Song of Healing + // OCARINA_SONG_HEALING { { OCARINA_PITCH_B4, 32, 88, 0, 0, 0 }, { OCARINA_PITCH_A4, 33, 88, 0, 0, 0 }, @@ -1126,7 +1127,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 8: Eponas Song + // OCARINA_SONG_EPONAS { { OCARINA_PITCH_D5, 18, 84, 0, 0, 0 }, { OCARINA_PITCH_B4, 18, 88, 0, 0, 0 }, @@ -1137,7 +1138,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 9: Song of Soaring + // OCARINA_SONG_SOARING { { OCARINA_PITCH_F4, 18, 84, 0, 0, 0 }, { OCARINA_PITCH_B4, 18, 80, 0, 0, 0 }, @@ -1148,7 +1149,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 10: Song of Storms + // OCARINA_SONG_STORMS { { OCARINA_PITCH_D4, 11, 84, 0, 0, 0 }, { OCARINA_PITCH_F4, 11, 88, 0, 0, 0 }, @@ -1159,7 +1160,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 11: Suns Song + // OCARINA_SONG_SUNS { { OCARINA_PITCH_A4, 12, 84, 0, 0, 0 }, { OCARINA_PITCH_F4, 13, 88, 0, 0, 0 }, @@ -1171,7 +1172,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 12: Inverted Song of Time + // OCARINA_SONG_INVERTED_TIME { { OCARINA_PITCH_F4, 32, 84, 0, 0, 0 }, { OCARINA_PITCH_D4, 65, 88, 0, 0, 0 }, @@ -1182,7 +1183,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 13: Song of Double Time + // OCARINA_SONG_DOUBLE_TIME { { OCARINA_PITCH_A4, 29, 84, 0, 0, 0 }, { OCARINA_PITCH_NONE, 3, 84, 0, 0, 0 }, @@ -1198,7 +1199,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 0, 0, 0, 0 }, }, - // 14: Goron Lullaby Intro + // OCARINA_SONG_GORON_LULLABY_INTRO { { OCARINA_PITCH_D4, 32, 78, 0, 0, 0 }, { OCARINA_PITCH_A4, 33, 90, 0, 0, 0 }, @@ -1209,7 +1210,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 15: Milk Bar Jam "Ballad of the Wind Fish" Human + // OCARINA_SONG_WIND_FISH_HUMAN { { OCARINA_PITCH_D5, 89, 80, 0, 0, 0 }, { OCARINA_PITCH_A4, 41, 72, 0, 0, 0 }, @@ -1219,7 +1220,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 16: Milk Bar Jam "Ballad of the Wind Fish" Goron + // OCARINA_SONG_WIND_FISH_GORON { { OCARINA_PITCH_D4, 52, 80, 0, 0, 0 }, { OCARINA_PITCH_NONE, 3, 66, 0, 0, 0 }, @@ -1238,7 +1239,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 17: Milk Bar Jam "Ballad of the Wind Fish" Zora + // OCARINA_SONG_WIND_FISH_ZORA { { OCARINA_PITCH_D5, 11, 80, 0, 0, 0 }, { OCARINA_PITCH_A4, 11, 72, 0, 0, 0 }, @@ -1251,7 +1252,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 18: Milk Bar Jam "Ballad of the Wind Fish" Deku + // OCARINA_SONG_WIND_FISH_DEKU { { OCARINA_PITCH_A4, 54, 80, 0, 0, 0 }, { OCARINA_PITCH_D4, 77, 72, 0, 0, 0 }, @@ -1261,7 +1262,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 19: Evan HP (Zora Band Leader) Song Part 1 + // OCARINA_SONG_EVAN_PART1 { { OCARINA_PITCH_A4, 33, 100, 0, 0, 0 }, { OCARINA_PITCH_NONE, 3, 92, 0, 0, 0 }, @@ -1276,7 +1277,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 20: Evan HP (Zora Band Leader) Song Part 2 + // OCARINA_SONG_EVAN_PART2 { { OCARINA_PITCH_B4, 33, 107, 0, 0, 0 }, { OCARINA_PITCH_NONE, 3, 100, 0, 0, 0 }, @@ -1291,7 +1292,7 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 66, 0, 0, 0 }, }, - // 21: Zeldas Lullaby + // OCARINA_SONG_ZELDAS_LULLABY { { OCARINA_PITCH_B4, 51, 84, 0, 0, 0 }, { OCARINA_PITCH_D5, 25, 88, 0, 0, 0 }, @@ -1302,13 +1303,13 @@ OcarinaNote sOcarinaSongNotes[OCARINA_SONG_MAX][20] = { { OCARINA_PITCH_NONE, 0, 90, 0, 0, 0 }, }, - // 22: Scarecrow + // OCARINA_SONG_SCARECROW_SPAWN { { OCARINA_PITCH_D4, 3, 0, 0, 0, 0 }, { OCARINA_PITCH_NONE, 0, 255, 0, 0, 0 }, }, - // 23: Termina Field 2D Song Buttons Appearing on Wall (In OoT, this is Ocarina Memory Game) + // OCARINA_SONG_TERMINA_WALL { { OCARINA_PITCH_D4, 3, 0, 0, 0, 0 }, { OCARINA_PITCH_NONE, 0, 255, 0, 0, 0 }, @@ -1434,7 +1435,7 @@ u8 sOoTOcarinaSongsNumNotes[] = { 6, // Suns Song }; -OcarinaNote* sPlaybackSong = sOcarinaSongNotes[OCARINA_SONG_SONATA]; +OcarinaNote* sPlaybackSong = sOcarinaSongNotes[0]; u8 sFrogsSongNotes[14] = { OCARINA_BTN_A, OCARINA_BTN_C_LEFT, OCARINA_BTN_C_RIGHT, OCARINA_BTN_C_DOWN, OCARINA_BTN_C_LEFT, OCARINA_BTN_C_RIGHT, OCARINA_BTN_C_DOWN, OCARINA_BTN_A, OCARINA_BTN_C_DOWN, OCARINA_BTN_A, @@ -1453,7 +1454,7 @@ u8 sPlayedOcarinaSongIndexPlusOne = 0; u8 sMusicStaffNumNotesPerTest = 0; u8 D_801D8530 = false; u32 D_801D8534 = 0; -u8 sIsOcarinaNoteChanged = false; +u8 sOcarinaDropInputTimer = 0; OcarinaNote sScarecrowsLongSongNotes[108] = { { OCARINA_PITCH_NONE, 0, 0, 0, 0, 0 }, @@ -1461,38 +1462,81 @@ OcarinaNote sScarecrowsLongSongNotes[108] = { }; OcarinaNote* gScarecrowLongSongPtr = sScarecrowsLongSongNotes; -u8* gScarecrowSpawnSongPtr = (u8*)&sOcarinaSongNotes[OCARINA_SONG_SCARECROW]; +u8* gScarecrowSpawnSongPtr = (u8*)&sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN]; OcarinaNote* sTerminaWallSongPtr = sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL]; u8 sPitchToButtonMap[16] = { - OCARINA_BTN_A, // OCARINA_PITCH_C4 - OCARINA_BTN_A, // OCARINA_PITCH_DFLAT4 - OCARINA_BTN_A, // OCARINA_PITCH_D4 - OCARINA_BTN_A, // OCARINA_PITCH_EFLAT4 - OCARINA_BTN_C_DOWN, // OCARINA_PITCH_E4 - OCARINA_BTN_C_DOWN, // OCARINA_PITCH_F4 - OCARINA_BTN_C_DOWN, // OCARINA_PITCH_GFLAT4 - OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_G4 - OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_AFLAT4 - OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_A4 - OCARINA_BTN_C_RIGHT + OCARINA_BTN_C_LEFT, // OCARINA_PITCH_BFLAT4: Interface/Overlap between C_RIGHT and C_LEFT - OCARINA_BTN_C_LEFT, // OCARINA_PITCH_B4 - OCARINA_BTN_C_LEFT, // OCARINA_PITCH_C5 - OCARINA_BTN_C_UP, // OCARINA_PITCH_DFLAT5 - OCARINA_BTN_C_UP, // OCARINA_PITCH_D5 - OCARINA_BTN_C_UP, // OCARINA_PITCH_EFLAT5 + OCARINA_BTN_A, // OCARINA_PITCH_C4 + OCARINA_BTN_A, // OCARINA_PITCH_DFLAT4 + OCARINA_BTN_A, // OCARINA_PITCH_D4 + OCARINA_BTN_A, // OCARINA_PITCH_EFLAT4 + OCARINA_BTN_C_DOWN, // OCARINA_PITCH_E4 + OCARINA_BTN_C_DOWN, // OCARINA_PITCH_F4 + OCARINA_BTN_C_DOWN, // OCARINA_PITCH_GFLAT4 + OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_G4 + OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_AFLAT4 + OCARINA_BTN_C_RIGHT, // OCARINA_PITCH_A4 + OCARINA_BTN_C_RIGHT_OR_C_LEFT, // OCARINA_PITCH_BFLAT4: Interface/Overlap between C_RIGHT and C_LEFT + OCARINA_BTN_C_LEFT, // OCARINA_PITCH_B4 + OCARINA_BTN_C_LEFT, // OCARINA_PITCH_C5 + OCARINA_BTN_C_UP, // OCARINA_PITCH_DFLAT5 + OCARINA_BTN_C_UP, // OCARINA_PITCH_D5 + OCARINA_BTN_C_UP, // OCARINA_PITCH_EFLAT5 }; // seqData written in the music macro language // Only used in unused functions +// clang-format off u8 sCustomSequenceScript[400] = { - 0xFE, 0xFE, 0xD3, 0x20, 0xD7, 0x00, 0x01, 0xCC, 0x00, 0x70, 0x90, 0x00, 0x16, 0xDB, 0x64, 0xDD, 0x78, - 0xFE, 0x00, 0xF3, 0xFC, 0xFF, 0xC3, 0x88, 0x00, 0x29, 0x89, 0x00, 0x2B, 0xDF, 0x7F, 0xE9, 0x0F, 0xDD, - 0x37, 0xD4, 0x40, 0xC1, 0x52, 0xFE, 0x80, 0xF3, 0xFC, 0xFF, 0xC2, 0xFB, 0xC0, 0x00, 0xC1, 0x57, 0xC9, + /* 0 */ 0xFE, // delay1 + /* 1 */ 0xFE, // delay1 + /* 2 */ 0xD3, 0x20, // mutebhv 0x20 + /* 4 */ 0xD7, 0x00, 0x01, // initchan 0x0001 + /* 7 */ 0xCC, 0x00, // ldi 0 + /* 9 */ 0x70, // stio 0 + /* 10 */ 0x90, 0x00, 22, // ldchan 0, chan0 + /* 13 */ 0xDB, 100, // vol 100 + /* 15 */ 0xDD, 120, // tempo 120 + + // .sequence seq_loop + /* 17 */ 0xFE, // delay1 + /* 18 */ 0x00, // testchan 0 + /* 19 */ 0xF3, -4, // rbeqz seq_loop + /* 21 */ 0xFF, // end + + // .channel chan0 + /* 22 */ 0xC3, // short + /* 23 */ 0x88, 0x00, 41, // ldlayer 0, layer0 + /* 26 */ 0x89, 0x00, 43, // ldlayer 1, layer1 + /* 29 */ 0xDF, 127, // vol 127 + /* 31 */ 0xE9, 0x0F, // notepri 0x0F + /* 33 */ 0xDD, 55, // pan 55 + /* 35 */ 0xD4, 64, // reverb 64 + /* 37 */ 0xC1, 82, // instr 82 + + // .channel chan_loop + /* 39 */ 0xFE, // delay1 + /* 40 */ 0x80, // testlayer 0 + + // (no end or loop; channel script seems to run into the note layers?) + + // .layer layer0 + /* 41 */ 0xF3, -4, // rbeqz chan_loop + + // .layer layer1 + /* 43 */ 0xFF, // end + + // .layer layer2? + /* 44 */ 0xC2, -5, // transpose -5 + /* 46 */ 0xC0, 0, // ldelay 0 + /* 48 */ 0xC1, 87, // shortvel 87 + /* 50 */ 0xC9, 0, // shortgate 0 + /* 52 */ 0, // empty until the end }; +// clang-format on OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { - // 0: Sonata of Awakening + // OCARINA_SONG_SONATA { 7, { @@ -1506,7 +1550,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 1: Goron Lullaby + // OCARINA_SONG_GORON_LULLABY { 8, { @@ -1521,7 +1565,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 2: New Wave Bossa Nova + // OCARINA_SONG_NEW_WAVE { 7, { @@ -1535,7 +1579,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 3: Elegy of Emptyness + // OCARINA_SONG_ELEGY { 7, { @@ -1549,7 +1593,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 4: Oath to Order + // OCARINA_SONG_OATH { 6, { @@ -1562,7 +1606,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 5; Sarias Song + // OCARINA_SONG_SARIAS { 6, { @@ -1575,7 +1619,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 6: Song of Time + // OCARINA_SONG_TIME { 6, { @@ -1588,7 +1632,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 7: Song of Healing + // OCARINA_SONG_HEALING { 6, { @@ -1601,7 +1645,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 8: Eponas Song + // OCARINA_SONG_EPONAS { 6, { @@ -1614,7 +1658,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 9: Song of Soaring + // OCARINA_SONG_SOARING { 6, { @@ -1627,7 +1671,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 10: Song of Storms + // OCARINA_SONG_STORMS { 6, { @@ -1640,7 +1684,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 11: Suns Song + // OCARINA_SONG_SUNS { 6, { @@ -1653,7 +1697,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 12: Inverted Song of Time + // OCARINA_SONG_INVERTED_TIME { 6, { @@ -1666,7 +1710,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 13; Song of Double Time + // OCARINA_SONG_DOUBLE_TIME { 6, { @@ -1679,7 +1723,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 14: Goron Lullaby Intro + // OCARINA_SONG_GORON_LULLABY_INTRO { 6, { @@ -1692,7 +1736,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 15: Milk Bar Jam "Ballad of the Wind Fish" Human + // OCARINA_SONG_WIND_FISH_HUMAN { 4, { @@ -1703,7 +1747,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 16: Milk Bar Jam "Ballad of the Wind Fish" Goron + // OCARINA_SONG_WIND_FISH_GORON { 8, { @@ -1718,7 +1762,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 17: Milk Bar Jam "Ballad of the Wind Fish" Zora + // OCARINA_SONG_WIND_FISH_ZORA { 8, { @@ -1733,7 +1777,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 18: Milk Bar Jam "Ballad of the Wind Fish" Deku + // OCARINA_SONG_WIND_FISH_DEKU { 5, { @@ -1745,7 +1789,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 19: Evan HP (Zora Band Leader) Song Part 1 + // OCARINA_SONG_EVAN_PART1 { 8, { @@ -1760,7 +1804,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 20: Evan HP (Zora Band Leader) Song Part 2 + // OCARINA_SONG_EVAN_PART2 { 8, { @@ -1775,7 +1819,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 21: Zeldas Lullaby + // OCARINA_SONG_ZELDAS_LULLABY { 6, { @@ -1788,7 +1832,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 22: Scarecrow + // OCARINA_SONG_SCARECROW_SPAWN { 8, { @@ -1803,7 +1847,7 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }, - // 23: Termina Field 2D Song Buttons Appearing on Wall (In OoT, this is Ocarina Memory Game) + // OCARINA_SONG_TERMINA_WALL { 8, { @@ -1819,26 +1863,6 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { }, }; -// Static In-Function Data -u8 sScarecrowAfterCreditsState = 0; -u8 sScarecrowAfterCreditsIntrumentId = OCARINA_INSTRUMENT_DEFAULT; -u16 sScarecrowAfterCreditsTimer = 1200; -u8 sRequestCustomSequence = false; -s8 D_801D8B30[] = { - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, - 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, -}; -f32 sBigBellsVolume[8] = { - 1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, -}; -u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; -f32 sSfxOriginalPos[] = { 0.0f, 0.0f, 0.0f }; - -// OoT's soundEffects from EnRiverSound const u16 gAudioEnvironmentalSfx[] = { NA_SE_EV_RIVER_STREAM - SFX_FLAG, NA_SE_EV_WAVE - SFX_FLAG, NA_SE_EV_WATER_WALL_BIG - SFX_FLAG, NA_SE_EV_WATER_WALL - SFX_FLAG, @@ -1853,8 +1877,6 @@ const u16 gAudioEnvironmentalSfx[] = { NA_SE_EV_WAVE_S - SFX_FLAG, NA_SE_EV_WAVE_S - SFX_FLAG, }; -extern const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX]; -/** const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { true, // OCARINA_SONG_SONATA true, // OCARINA_SONG_GORON_LULLABY @@ -1878,65 +1900,9 @@ const u8 sIsOcarinaSongReserved[OCARINA_SONG_MAX] = { true, // OCARINA_SONG_EVAN_PART1 true, // OCARINA_SONG_EVAN_PART2 false, // OCARINA_SONG_ZELDAS_LULLABY - true, // OCARINA_SONG_SCARECROW + true, // OCARINA_SONG_SCARECROW_SPAWN false, // OCARINA_SONG_TERMINA_WALL }; -*/ - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019AF00.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019AF58.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019AFE8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B02C.s") - -void AudioOcarina_MapSongFromNotesToButtons(u8 noteSongIndex, u8 buttonSongIndex, u8 numButtons); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_MapSongFromNotesToButtons.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B144.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B378.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B38C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B3D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B4B8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_StartDefault.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B568.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B5AC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B5EC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B618.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B654.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019B6B4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019BC44.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019BE98.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C1C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C1D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C268.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C2E4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_SetInstrumentId.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C398.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C5A0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019C8D8.s") const char sAudioOcarinaUnusedText0[] = "key step is too long !!! %d:%d>%d\n"; const char sAudioOcarinaUnusedText1[] = "You played %d Melody !!! (last step:%d)\n"; @@ -1947,21 +1913,1113 @@ const char sAudioOcarinaUnusedText5[] = "last key is bad !!! %d %d %02X %02X\n"; const char sAudioOcarinaUnusedText6[] = "last key step is too short !!! %d:%d %d<%d\n"; const char sAudioOcarinaUnusedText7[] = "check is over!!! %d %d %d\n"; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CD08.s") +void AudioOcarina_ReadControllerInput(void) { + Input inputs[4]; + Input* input = &inputs[0]; + u32 ocarinaInputButtonPrev = sOcarinaInputButtonCur; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CE34.s") + Padmgr_GetInput2(inputs, 0); + sOcarinaInputButtonCur = input->cur.button; + sOcarinaInputButtonPrev = ocarinaInputButtonPrev; + sOcarinaInputStickRel.x = input->rel.stick_x; + sOcarinaInputStickRel.y = input->rel.stick_y; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CE6C.s") +/** + * Looks up the frequency to bend the pitch by. + * The pitch will bend up to a maximum of 2 semitones + * in each direction giving a total range of 4 semitones + */ +f32 AudioOcarina_BendPitchTwoSemitones(s8 bendIndex) { + s8 adjBendIndex; + f32 bendFreq; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CEBC.s") + if (bendIndex > 64) { + adjBendIndex = 127; + } else if (bendIndex < -64) { + adjBendIndex = -128; + } else if (bendIndex >= 0) { + adjBendIndex = (bendIndex * 127) / 64; + } else { + adjBendIndex = (bendIndex * 128) / 64; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CF6C.s") + /** + * index 128 is in the middle of the table and + * contains the value 1.0f i.e. no bend + * absolute indices above 128 will bend the pitch 2 semitones upwards + * absolute indices below 128 will bend the pitch 2 semitones downwards + */ + bendFreq = gBendPitchTwoSemitonesFrequencies[adjBendIndex + 128]; + return bendFreq; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CF78.s") +/** + * If an available song has been played, then return that song index + * If the ocarina is on, but no song has been played then return 0xFE + * If the ocarina is off, return 0xFF + */ +u8 AudioOcarina_GetPlayingState(void) { + u8 playedOcarinaSongIndex; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlaybackStaff.s") + if (sPlayedOcarinaSongIndexPlusOne != 0) { + playedOcarinaSongIndex = sPlayedOcarinaSongIndexPlusOne - 1; + sPlayedOcarinaSongIndexPlusOne = 0; + } else if (sOcarinaFlags != 0) { + playedOcarinaSongIndex = 0xFE; + } else { + playedOcarinaSongIndex = 0xFF; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019CFA8.s") + return playedOcarinaSongIndex; +} + +u8 AudioOcarina_MapPitchToButton(u8 pitchAndBFlatFlag) { + u8 buttonIndex = sPitchToButtonMap[pitchAndBFlatFlag & 0x3F]; + + /** + * Special case for bFlat4: + * CRIGHT and CLEFT are the only two pitches that are 2 semitones apart + * which are pitches A4 and B4 respectively + * bFlat4 is in the middle of those two and is the only pitch that can not + * be resolved between the two buttons without external information. + * That information is stored as flags in pitch with the mask: + * (pitchAndBFlatFlag & 0xC0) + */ + if (buttonIndex == OCARINA_BTN_C_RIGHT_OR_C_LEFT) { + if (pitchAndBFlatFlag & OCARINA_BUTTON_FLAG_BFLAT_RAISE) { + return OCARINA_BTN_C_RIGHT; + } + // OCARINA_BUTTON_FLAG_BFLAT_LOWER + return OCARINA_BTN_C_LEFT; + } + + return buttonIndex; +} + +void AudioOcarina_MapSongFromPitchToButton(u8 noteSongIndex, u8 buttonSongIndex, u8 numButtons) { + u8 buttonSongPos = 0; + u8 noteSongPos = 0; + u8 pitch; + + while ((buttonSongPos < numButtons) && (noteSongPos < 16)) { + pitch = sOcarinaSongNotes[noteSongIndex][noteSongPos++].pitch; + + if (pitch != OCARINA_PITCH_NONE) { + gOcarinaSongButtons[buttonSongIndex].buttonIndex[buttonSongPos++] = sPitchToButtonMap[pitch]; + } + } + + gOcarinaSongButtons[buttonSongIndex].numButtons = numButtons; +} + +/** + * Ocarina flags: + * bitmask 0x3FFF: + * - Ocarina song id + * bitmask 0xC000: + * - 0x0000: Limits the notes to 8 notes at a time. Not playing a correct song after 8 notes will cause an ocarina + * error + * - 0x4000: (Identical to 0xC000) + * - 0x8000: Limits the notes to 1 note at a time. A single incorrect note will cause an ocarina error + * - 0xC000: Free-play, no limitations to the number of notes to play + * bitmask 0x7FFF0000: + * - ocarina action (only used to make flags != 0) + * bitmask 0x80000000: + * - unused (only used to make flags != 0) + */ + +// The ocarina songs that can be performed at any time = 0x3FFF +#define OCARINA_SONGS_PLAYABLE_FLAGS \ + ((1 << OCARINA_SONG_SONATA) | (1 << OCARINA_SONG_GORON_LULLABY) | (1 << OCARINA_SONG_NEW_WAVE) | \ + (1 << OCARINA_SONG_ELEGY) | (1 << OCARINA_SONG_OATH) | (1 << OCARINA_SONG_SARIAS) | (1 << OCARINA_SONG_TIME) | \ + (1 << OCARINA_SONG_HEALING) | (1 << OCARINA_SONG_EPONAS) | (1 << OCARINA_SONG_SOARING) | \ + (1 << OCARINA_SONG_STORMS) | (1 << OCARINA_SONG_SUNS) | (1 << OCARINA_SONG_INVERTED_TIME) | \ + (1 << OCARINA_SONG_DOUBLE_TIME)) + +void AudioOcarina_Start(u32 ocarinaFlags) { + u8 songIndex; + + if ((sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume != 0xFF) && + ((ocarinaFlags & OCARINA_SONGS_PLAYABLE_FLAGS) == OCARINA_SONGS_PLAYABLE_FLAGS)) { + ocarinaFlags |= (1 << OCARINA_SONG_SCARECROW_SPAWN); + } + + if ((ocarinaFlags == (0xC0000000 | OCARINA_SONGS_PLAYABLE_FLAGS)) && + (sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume != 0xFF)) { + ocarinaFlags = (0xC0000000 | OCARINA_SONGS_PLAYABLE_FLAGS); + } + + if ((ocarinaFlags == OCARINA_SONGS_PLAYABLE_FLAGS) && + (sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume != 0xFF)) { + ocarinaFlags = OCARINA_SONGS_PLAYABLE_FLAGS; + } + + if (ocarinaFlags != 0xFFFF) { + sOcarinaFlags = 0x80000000 + ocarinaFlags; + sFirstOcarinaSongIndex = 0; + sLastOcarinaSongIndex = OCARINA_SONG_MAX; + sOcarinaAvailableSongFlags = ocarinaFlags & 0xFFFFFF; + sMusicStaffNumNotesPerTest = 8; // Ocarina Check + sOcarinaHasStartedSong = false; + sPlayedOcarinaSongIndexPlusOne = 0; + sOcarinaStaffPlayingPos = 0; + sPlayingStaff.state = AudioOcarina_GetPlayingState(); + sIsOcarinaInputEnabled = true; + sPrevOcarinaWithMusicStaffFlags = 0; + + // Reset music staff song check + for (songIndex = OCARINA_SONG_SONATA; songIndex <= OCARINA_SONG_EVAN_PART2; songIndex++) { + for (sMusicStaffPos[songIndex] = 0; + sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]].pitch == OCARINA_PITCH_NONE;) { + sMusicStaffPos[songIndex]++; + } + + sMusicStaffCurHeldLength[songIndex] = 0; + sMusicStaffExpectedLength[songIndex] = 0; + sMusicStaffExpectedPitch[songIndex] = 0; + + if (D_801D8530) { + if ((1 << songIndex) & ocarinaFlags) { + D_801FD518[songIndex] = 0; + } else { + D_801FD518[songIndex] = 0xFF; + } + } + } + + if (ocarinaFlags & 0x80000000) { + sMusicStaffNumNotesPerTest = 0; // Ocarina Playback + } + + if (ocarinaFlags & 0x40000000) { + sOcarinaWithoutMusicStaffPos = 0; + } + + if (ocarinaFlags & 0xC0400000) { + AudioOcarina_MapSongFromPitchToButton(OCARINA_SONG_SCARECROW_SPAWN, OCARINA_SONG_SCARECROW_SPAWN, 8); + } + } else { + sOcarinaFlags = 0; + sIsOcarinaInputEnabled = false; + } +} + +#undef OCARINA_SONGS_PLAYABLE_FLAGS + +void AudioOcarina_SetSongStartingPos(void) { + sOcarinaSongStartingPos = sOcarinaWithoutMusicStaffPos; +} + +void AudioOcarina_StartAtSongStartingPos(u32 ocarinaFlags) { + D_801D8530 = false; + AudioOcarina_Start(ocarinaFlags); + if (sOcarinaSongStartingPos != 0) { + sOcarinaWithoutMusicStaffPos = sOcarinaSongStartingPos; + sOcarinaSongStartingPos = 0; + } +} + +void AudioOcarina_StartForSongCheck(u32 ocarinaFlags, u8 ocarinaStaffPlayingPosStart) { + u8 songIndex; + u8 j; + + AudioOcarina_Start(ocarinaFlags); + sMusicStaffNumNotesPerTest = 8; + sOcarinaStaffPlayingPos = ocarinaStaffPlayingPosStart; + + for (songIndex = 0; songIndex <= OCARINA_SONG_EVAN_PART2; songIndex++) { + for (j = 0; j < ocarinaStaffPlayingPosStart;) { + if (sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]].pitch != OCARINA_PITCH_NONE) { + j++; + } + sMusicStaffPos[songIndex]++; + } + + if (sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]].pitch == OCARINA_PITCH_NONE) { + sMusicStaffPos[songIndex]++; + } + } +} + +void AudioOcarina_StartWithSongNoteLengths(u32 ocarinaFlags) { + u8 songIndex; + + for (songIndex = 0; songIndex < OCARINA_SONG_MAX; songIndex++) { + if ((1 << songIndex) & ocarinaFlags) { + D_801FD530[songIndex] = 0; + } else { + D_801FD530[songIndex] = 0xFF; + } + } + + D_801D8530 = true; + D_801D8534 = ocarinaFlags; + AudioOcarina_Start(ocarinaFlags); +} + +void AudioOcarina_StartDefault(u32 ocarinaFlags) { + D_801D8530 = false; + AudioOcarina_Start(ocarinaFlags); +} + +u8 func_8019B568(void) { + u32 temp_v0 = D_801D8534; + u8 songIndex; + + for (songIndex = OCARINA_SONG_SONATA; !((temp_v0 >> songIndex) & 1) && (songIndex < OCARINA_SONG_MAX); + songIndex++) {} + + return songIndex; +} + +u8 func_8019B5AC(void) { + u8 songIndex = func_8019B568(); + + if (songIndex < OCARINA_SONG_MAX) { + return D_801FD518[songIndex]; + } + + return 0xFF; +} + +u8 func_8019B5EC(void) { + return D_801FD530[func_8019B568()]; +} + +void AudioOcarina_CheckIfStartedSong(void) { + if ((sCurOcarinaPitch != OCARINA_PITCH_NONE) && !sOcarinaHasStartedSong) { + sOcarinaHasStartedSong = true; + sMusicStaffPrevPitch = OCARINA_PITCH_NONE; + } +} + +void AudioOcarina_UpdateCurOcarinaSong(void) { + u8 i; + + if (sOcarinaWithoutMusicStaffPos == 8) { + for (i = 0; i < ARRAY_COUNT(sCurOcarinaSongWithoutMusicStaff) - 1; i++) { + sCurOcarinaSongWithoutMusicStaff[i] = sCurOcarinaSongWithoutMusicStaff[i + 1]; + } + } else { + sOcarinaWithoutMusicStaffPos++; + } +} + +/** + * Checks for ocarina songs from user input with a music staff prompt + * Type 1) Playback: tests note-by-note (ocarinaFlag & 0xC000 == 0x8000) eg: + * - learning a new song + * - playing the ocarina memory game + * Type 2) Check: tests in 8-note chunks (ocarinaFlag & 0xC000 == 0x0000) eg: + * - validating scarecrow spawn song as adult + * - ocarina prompt for zelda's lullaby, saria's song, Storms, Song of Time, etc... + */ +void AudioOcarina_CheckSongsWithMusicStaff(void) { + u32 curOcarinaSongFlag; + s32 pad; + u8 noNewValidInput = false; + s16 pad2; + s8 staffOcarinaPlayingPosOffset = 0; + u8 songIndex; + OcarinaNote* curNote; + OcarinaNote* nextNote; + + AudioOcarina_CheckIfStartedSong(); + + if (!sOcarinaHasStartedSong) { + return; + } + + if (ABS_ALT(sCurOcarinaBendIndex) > 20) { + sOcarinaFlags = 0; + for (songIndex = OCARINA_SONG_SONATA; songIndex < OCARINA_SONG_MAX; songIndex++) { + D_801FD518[songIndex] = 4; + } + sIsOcarinaInputEnabled = false; + return; + } + + if ((sPrevOcarinaPitch == sCurOcarinaPitch) || (sCurOcarinaPitch == OCARINA_PITCH_NONE)) { + noNewValidInput = true; + } else { + AudioOcarina_UpdateCurOcarinaSong(); + sCurOcarinaSongWithoutMusicStaff[sOcarinaWithoutMusicStaffPos - 1] = sCurOcarinaPitch; + } + + for (songIndex = sFirstOcarinaSongIndex; songIndex < sLastOcarinaSongIndex; songIndex++) { + curOcarinaSongFlag = 1 << songIndex; + + if (sOcarinaAvailableSongFlags & curOcarinaSongFlag) { + if (D_801D8530) { + sMusicStaffCurHeldLength[songIndex] += sOcarinaUpdateTaskStart - sOcarinaPlaybackTaskStart; + } else { + sMusicStaffCurHeldLength[songIndex] = sMusicStaffExpectedLength[songIndex] + 9; + } + + if (noNewValidInput) { + if ((sMusicStaffCurHeldLength[songIndex] > 8) && + (sMusicStaffPrevPitch != sMusicStaffExpectedPitch[songIndex])) { + sOcarinaAvailableSongFlags ^= curOcarinaSongFlag; + if (D_801D8530) { + D_801FD518[songIndex] = 1; + } + } + + if (D_801D8530 && ((sMusicStaffExpectedLength[songIndex] + 9) < sMusicStaffCurHeldLength[songIndex])) { + sOcarinaAvailableSongFlags ^= curOcarinaSongFlag; + D_801FD518[songIndex] = 3; + } else if ((sMusicStaffCurHeldLength[songIndex] >= (sMusicStaffExpectedLength[songIndex] - 9)) && + (sMusicStaffCurHeldLength[songIndex] >= sMusicStaffExpectedLength[songIndex]) && + (sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]].length == 0) && + (sMusicStaffPrevPitch == sMusicStaffExpectedPitch[songIndex])) { + // This case is taken if the song is finished and successfully played + // (i.e. .length == 0 indicates that the song is at the end) + sPlayedOcarinaSongIndexPlusOne = songIndex + 1; + sIsOcarinaInputEnabled = false; + sOcarinaFlags = 0; + if (D_801D8530) { + D_801FD518[songIndex] = 5; + } + } + } else if (sMusicStaffCurHeldLength[songIndex] >= (sMusicStaffExpectedLength[songIndex] - 9)) { + // This else-if statement always holds true, taken if a new note is played + if (sMusicStaffPrevPitch != OCARINA_PITCH_NONE) { + // New note is played + if (sMusicStaffPrevPitch == sMusicStaffExpectedPitch[songIndex]) { + // Note is part of expected song + if (D_801D8530) { + D_801FD530[songIndex] += + ABS_ALT(sMusicStaffExpectedLength[songIndex] - sMusicStaffCurHeldLength[songIndex]); + } + sMusicStaffCurHeldLength[songIndex] = 0; + } else { + // Note is not part of expected song, so this song is no longer available as an option in this + // playback + sOcarinaAvailableSongFlags ^= curOcarinaSongFlag; + if (D_801D8530) { + D_801FD518[songIndex] = 1; + } + } + } + + curNote = &sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]]; + nextNote = &sOcarinaSongNotes[songIndex][++sMusicStaffPos[songIndex]]; + sMusicStaffExpectedLength[songIndex] = curNote->length; + sMusicStaffExpectedPitch[songIndex] = curNote->pitch; + + while ((curNote->pitch == nextNote->pitch) || + ((nextNote->pitch == OCARINA_PITCH_NONE) && (nextNote->length != 0))) { + sMusicStaffExpectedLength[songIndex] += nextNote->length; + curNote = &sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]]; + nextNote = &sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex] + 1]; + sMusicStaffPos[songIndex]++; + } + } else if (sMusicStaffCurHeldLength[songIndex] < 9) { + // case never taken + staffOcarinaPlayingPosOffset = -1; + sMusicStaffCurHeldLength[songIndex] = 0; + sMusicStaffPrevPitch = sCurOcarinaPitch; + } else { + // case never taken + if (sOcarinaSongNotes[songIndex][sMusicStaffPos[songIndex]].length == 0) { + D_801FD518[songIndex] = 1; + } else if (D_801D8530) { + D_801FD518[songIndex] = 2; + } + sOcarinaAvailableSongFlags ^= curOcarinaSongFlag; + } + } + + // if a note is played that doesn't match a song, the song bit in sAvailOcarinaSongFlags is turned off + // if there are no more songs remaining that it could be and the maximum position has been exceeded, then + if ((sOcarinaAvailableSongFlags == 0) && (sOcarinaStaffPlayingPos >= sMusicStaffNumNotesPerTest)) { + sIsOcarinaInputEnabled = false; + if (!D_801D8530) { + if ((sOcarinaFlags & 0x40000000) && (sCurOcarinaPitch == sOcarinaSongNotes[songIndex][0].pitch)) { + // case never taken, this function is not called if (sOcarinaFlags & 0x40000000) is set + sPrevOcarinaWithMusicStaffFlags = sOcarinaFlags; + } + } + sOcarinaFlags = 0; + return; + } + } + + if (!noNewValidInput) { + sMusicStaffPrevPitch = sCurOcarinaPitch; + sOcarinaStaffPlayingPos += staffOcarinaPlayingPosOffset + 1; + } +} + +/** + * Checks for ocarina songs from user input with no music staff prompt. + * Includes ocarina actions such as free play, no warp + */ +void AudioOcarina_CheckSongsWithoutMusicStaff(void) { + u32 pitch; + u8 ocarinaStaffPlayingPosStart; + u8 songIndex; + u8 j; + u8 k; + + if (CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_L) && + CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) { + AudioOcarina_StartDefault(sOcarinaFlags); + return; + } + + AudioOcarina_CheckIfStartedSong(); + + if (!sOcarinaHasStartedSong) { + return; + } + + ocarinaStaffPlayingPosStart = sOcarinaStaffPlayingPos; + if ((sPrevOcarinaPitch != sCurOcarinaPitch) && (sCurOcarinaPitch != OCARINA_PITCH_NONE)) { + sOcarinaStaffPlayingPos++; + if (sOcarinaStaffPlayingPos > ARRAY_COUNT(sCurOcarinaSongWithoutMusicStaff)) { + sOcarinaStaffPlayingPos = 1; + } + + AudioOcarina_UpdateCurOcarinaSong(); + + if ((ABS_ALT(sCurOcarinaBendIndex) > 20) && (ocarinaStaffPlayingPosStart != sOcarinaStaffPlayingPos)) { + sCurOcarinaSongWithoutMusicStaff[sOcarinaWithoutMusicStaffPos - 1] = OCARINA_PITCH_NONE; + } else { + sCurOcarinaSongWithoutMusicStaff[sOcarinaWithoutMusicStaffPos - 1] = sCurOcarinaPitch; + } + + // This nested for-loop tests to see if the notes from the ocarina are identical + // to any of the songIndex from sFirstOcarinaSongIndex to sLastOcarinaSongIndex + + // Loop through each of the songs + for (songIndex = sFirstOcarinaSongIndex; songIndex < sLastOcarinaSongIndex; songIndex++) { + // Checks to see if the song is available to be played + if ((u32)sOcarinaAvailableSongFlags & (1 << songIndex)) { + // Loops through all possible starting indices? + // Loops through the notes of the song? + for (j = 0, k = 0; j < gOcarinaSongButtons[songIndex].numButtons && k == 0 && + sOcarinaWithoutMusicStaffPos >= gOcarinaSongButtons[songIndex].numButtons;) { + + pitch = sCurOcarinaSongWithoutMusicStaff[(sOcarinaWithoutMusicStaffPos - + gOcarinaSongButtons[songIndex].numButtons) + + j]; + + if (pitch == sButtonToPitchMap[gOcarinaSongButtons[songIndex].buttonIndex[j]]) { + j++; + } else { + k++; + } + } + + // This conditional is true if songIndex = i is detected + if (j == gOcarinaSongButtons[songIndex].numButtons) { + sPlayedOcarinaSongIndexPlusOne = songIndex + 1; + sIsOcarinaInputEnabled = false; + sOcarinaFlags = 0; + } + } + } + } +} + +void AudioOcarina_PlayControllerInput(u8 isOcarinaSfxSuppressedWhenCancelled) { + u32 ocarinaBtnsHeld; + + // Prevents two different ocarina notes from being played on two consecutive frames + if ((sOcarinaFlags != 0) && (sOcarinaDropInputTimer != 0)) { + sOcarinaDropInputTimer--; + return; + } + + // Ensures the button pressed to start the ocarina does not also play an ocarina note + if ((sOcarinaInputButtonStart == 0) || + ((sOcarinaInputButtonStart & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) != + (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)))) { + sOcarinaInputButtonStart = 0; + if (1) {} + sCurOcarinaPitch = OCARINA_PITCH_NONE; + sCurOcarinaButtonIndex = OCARINA_BTN_INVALID; + ocarinaBtnsHeld = (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) & + (sOcarinaInputButtonPrev & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)); + + if (!(sOcarinaInputButtonPress & ocarinaBtnsHeld) && (sOcarinaInputButtonCur != 0)) { + sOcarinaInputButtonPress = sOcarinaInputButtonCur; + } else { + sOcarinaInputButtonPress &= ocarinaBtnsHeld; + } + + // Interprets and transforms controller input into ocarina buttons and notes + if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_A)) { + sCurOcarinaPitch = OCARINA_PITCH_D4; + sCurOcarinaButtonIndex = OCARINA_BTN_A; + + } else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CDOWN)) { + sCurOcarinaPitch = OCARINA_PITCH_F4; + sCurOcarinaButtonIndex = OCARINA_BTN_C_DOWN; + + } else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CRIGHT)) { + sCurOcarinaPitch = OCARINA_PITCH_A4; + sCurOcarinaButtonIndex = OCARINA_BTN_C_RIGHT; + + } else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CLEFT)) { + sCurOcarinaPitch = OCARINA_PITCH_B4; + sCurOcarinaButtonIndex = OCARINA_BTN_C_LEFT; + + } else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CUP)) { + sCurOcarinaPitch = OCARINA_PITCH_D5; + sCurOcarinaButtonIndex = OCARINA_BTN_C_UP; + } + + if (sOcarinaInputButtonCur) {} + + // Pressing the R Button will raise the pitch by 1 semitone + if ((sCurOcarinaPitch != OCARINA_PITCH_NONE) && CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_R) && + (sRecordingState != OCARINA_RECORD_SCARECROW_SPAWN)) { + sCurOcarinaButtonIndex += OCARINA_BUTTON_FLAG_BFLAT_RAISE; // Flag to resolve B Flat 4 + sCurOcarinaPitch++; // Raise the pitch by 1 semitone + } + + // Pressing the Z Button will lower the pitch by 1 semitone + if ((sCurOcarinaPitch != OCARINA_PITCH_NONE) && CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_Z) && + (sRecordingState != OCARINA_RECORD_SCARECROW_SPAWN)) { + sCurOcarinaButtonIndex += OCARINA_BUTTON_FLAG_BFLAT_LOWER; // Flag to resolve B Flat 4 + sCurOcarinaPitch--; // Lower the pitch by 1 semitone + } + + if (sRecordingState != OCARINA_RECORD_SCARECROW_SPAWN) { + // Bend the pitch of the note based on y control stick + sCurOcarinaBendIndex = sOcarinaInputStickRel.y; + sCurOcarinaBendFreq = AudioOcarina_BendPitchTwoSemitones(sCurOcarinaBendIndex); + + // Add vibrato of the ocarina note based on the x control stick + sCurOcarinaVibrato = ABS_ALT(sOcarinaInputStickRel.x) >> 2; + // Sets vibrato to io port 6 + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 6, sCurOcarinaVibrato); + } else { + // no bending or vibrato for recording state OCARINA_RECORD_SCARECROW_SPAWN + sCurOcarinaBendIndex = 0; + sCurOcarinaVibrato = 0; + sCurOcarinaBendFreq = 1.0f; // No bend + } + + // Processes new and valid notes + if ((sCurOcarinaPitch != OCARINA_PITCH_NONE) && (sPrevOcarinaPitch != sCurOcarinaPitch)) { + // Sets ocarina instrument Id to io port 7, which is used + // as an index in seq 0 to get the true instrument Id + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 7, + sOcarinaInstrumentId - 1); + // Sets pitch to io port 5 + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 5, sCurOcarinaPitch); + AudioSfx_PlaySfx(NA_SE_OC_OCARINA, &gSfxDefaultPos, 4, &sCurOcarinaBendFreq, &sDefaultOcarinaVolume, + &gSfxDefaultReverb); + } else if ((sPrevOcarinaPitch != OCARINA_PITCH_NONE) && (sCurOcarinaPitch == OCARINA_PITCH_NONE) && + !isOcarinaSfxSuppressedWhenCancelled) { + // Stops ocarina sound when transitioning from playing to not playing a note + AudioSfx_StopById(NA_SE_OC_OCARINA); + } + } +} + +/** + * Directly enable the ocarina to receive input without + * properly resetting it based on an ocarina instrument id + * Unused. + */ +void AudioOcarina_EnableInput(u8 inputEnabled) { + sIsOcarinaInputEnabled = inputEnabled; +} + +/** + * Resets ocarina properties + */ +void AudioOcarina_ResetAndMute(void) { + sOcarinaInputButtonCur = 0; + sOcarinaInputButtonPrev = 0; + sOcarinaInputButtonPress = 0; + + sOcarinaInputButtonStart = 0xFFFF; + + AudioOcarina_PlayControllerInput(false); + AudioSfx_StopById(NA_SE_OC_OCARINA); + + if (gAudioSpecId != 12) { + AudioSfx_MuteBanks(0); + } + + sPlaybackState = 0; + sPlaybackStaffPos = 0; + sIsOcarinaInputEnabled = false; + + sOcarinaFlags = 0; + + // return to full volume for both bgm players after ocarina is finished + AudioSfx_RestoreBgmVolume(SFX_CHANNEL_OCARINA); + // return to full volume for all sfx channels except system & ocarina banks + Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(0x7F); +} + +void AudioOcarina_ResetAndReadInput(void) { + sOcarinaInputButtonCur = 0; + sOcarinaInputButtonPrev = 0; + sOcarinaInputButtonPress = 0; + + sOcarinaInputButtonStart = 0xFFFF; + + AudioOcarina_PlayControllerInput(true); + + sPlaybackState = 0; + sPlaybackStaffPos = 0; + sIsOcarinaInputEnabled = false; + + sOcarinaFlags = 0; + + sOcarinaInputButtonCur = 0; + + AudioOcarina_ReadControllerInput(); + sOcarinaInputButtonStart = sOcarinaInputButtonCur; +} + +/** + * Set a timer that will disable the ocarina once the timer reaches 0 + */ +void AudioOcarina_SetOcarinaDisableTimer(u8 unused, u8 timer) { + sOcarinaDisableTimer = timer; + sOcarinaUnused = unused; +} + +u32 AudioOcarina_SetInstrument(u8 ocarinaInstrumentId) { + if ((sOcarinaInstrumentId != ocarinaInstrumentId) || (ocarinaInstrumentId == OCARINA_INSTRUMENT_DEFAULT)) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | + ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(ocarinaInstrumentId)); + sOcarinaInstrumentId = ocarinaInstrumentId; + + if (ocarinaInstrumentId == OCARINA_INSTRUMENT_OFF) { + AudioOcarina_ResetAndMute(); + } else { + sOcarinaInputButtonCur = 0; + AudioOcarina_ReadControllerInput(); + sOcarinaInputButtonStart = sOcarinaInputButtonCur; + // lowers volume of all sfx channels except system & ocarina banks + Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(0x40); + // lowers volume of bgm players while playing ocarina + AudioSfx_LowerBgmVolume(SFX_CHANNEL_OCARINA); + } + } +} + +void AudioOcarina_SetPlaybackSong(s8 songIndexPlusOne, u8 playbackState) { + u8 i = 0; + + if (songIndexPlusOne == 0) { + sPlaybackState = 0; + AudioSfx_StopById(NA_SE_OC_OCARINA); + return; + } + + if (songIndexPlusOne < (OCARINA_SONG_MAX + 1)) { + sPlaybackSong = sOcarinaSongNotes[songIndexPlusOne - 1]; + } else { + sPlaybackSong = sScarecrowsLongSongNotes; + } + + sPlaybackNotePos = 0; + if (playbackState & 0x80) { + sPlaybackState = 1; + sPlaybackStaffStopPos = playbackState & 0xF; + sPlaybackStaffStartPos = 0xFF; + } else if (playbackState & 0x40) { + sPlaybackState = 1; + sPlaybackStaffStartPos = playbackState & 0xF; + sPlaybackStaffStopPos = 0xFF; + while (i < sPlaybackStaffStartPos) { + if (sOcarinaSongNotes[songIndexPlusOne - 1][sPlaybackNotePos].pitch != OCARINA_PITCH_NONE) { + i++; + } + sPlaybackNotePos++; + } + } else { + sPlaybackState = playbackState; + sPlaybackStaffStopPos = 0xFF; + sPlaybackStaffStartPos = 0xFF; + } + + sPlaybackNoteTimer = 0; + sPlaybackPitch = OCARINA_PITCH_NONE; + sPlaybackStaffPos = 0; + + if (sPlaybackStaffStartPos == 0xFF) { + while ((sPlaybackSong[sPlaybackNotePos].pitch == OCARINA_PITCH_NONE) && + (songIndexPlusOne > (OCARINA_SONG_EVAN_PART2 + 1))) { + sPlaybackNotePos++; + } + } +} + +/** + * Play a song with the ocarina to the user that is + * based on OcarinaNote data and not user input + */ +void AudioOcarina_PlaybackSong(void) { + s32 noteTimerStep; + s32 nextNoteTimerStep; + + if (sPlaybackState == 0) { + return; + } + + if (sPlaybackStaffPos == 0) { + noteTimerStep = 3; + } else { + noteTimerStep = sOcarinaUpdateTaskStart - sOcarinaPlaybackTaskStart; + } + + if (noteTimerStep < sPlaybackNoteTimer) { + sPlaybackNoteTimer -= noteTimerStep; + } else { + nextNoteTimerStep = noteTimerStep - sPlaybackNoteTimer; + sPlaybackNoteTimer = 0; + } + + if (sPlaybackNoteTimer == 0) { + + if (sPlaybackStaffPos == sPlaybackStaffStopPos) { + sPlaybackState = 0; + return; + } + + sPlaybackNoteTimer = sPlaybackSong[sPlaybackNotePos].length; + + if (sPlaybackNotePos == 1) { + sPlaybackNoteTimer++; + } + + if (sPlaybackNoteTimer == 0) { + sPlaybackState--; + if (sPlaybackState != 0) { + sPlaybackNotePos = 0; + sPlaybackStaffPos = 0; + sPlaybackPitch = OCARINA_PITCH_NONE; + } else { + AudioSfx_StopById(NA_SE_OC_OCARINA); + } + return; + } else { + sPlaybackNoteTimer -= nextNoteTimerStep; + } + + // Update volume + if (sNotePlaybackVolume != sPlaybackSong[sPlaybackNotePos].volume) { + sNotePlaybackVolume = sPlaybackSong[sPlaybackNotePos].volume; + sRelativeNotePlaybackVolume = sNotePlaybackVolume / 127.0f; + } + + // Update vibrato + sNotePlaybackVibrato = sPlaybackSong[sPlaybackNotePos].vibrato; + // Sets vibrato to io port 6 + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 6, sNotePlaybackVibrato); + + // Update bend + if (sNotePlaybackBend != sPlaybackSong[sPlaybackNotePos].bend) { + sNotePlaybackBend = sPlaybackSong[sPlaybackNotePos].bend; + sRelativeNotePlaybackBend = AudioOcarina_BendPitchTwoSemitones(sNotePlaybackBend); + } + + // No changes in volume, vibrato, or bend between notes + if ((sPlaybackSong[sPlaybackNotePos].volume == sPlaybackSong[sPlaybackNotePos - 1].volume && + (sPlaybackSong[sPlaybackNotePos].vibrato == sPlaybackSong[sPlaybackNotePos - 1].vibrato) && + (sPlaybackSong[sPlaybackNotePos].bend == sPlaybackSong[sPlaybackNotePos - 1].bend))) { + sPlaybackPitch = 0xFE; + } + + if (sPlaybackPitch != sPlaybackSong[sPlaybackNotePos].pitch) { + u8 pitch = sPlaybackSong[sPlaybackNotePos].pitch; + + // As bFlat4 is exactly in the middle of notes B & A, a flag is + // added to the pitch to resolve which button to map Bflat4 to + if (pitch == OCARINA_PITCH_BFLAT4) { + sPlaybackPitch = pitch + sPlaybackSong[sPlaybackNotePos].bFlat4Flag; + } else { + sPlaybackPitch = pitch; + } + + if (sPlaybackPitch != OCARINA_PITCH_NONE) { + sPlaybackStaffPos++; + // Sets ocarina instrument Id to io port 7, which is used + // as an index in seq 0 to get the true instrument Id + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 7, + sOcarinaInstrumentId - 1); + AudioThread_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | SFX_CHANNEL_OCARINA << 8 | 5, + sPlaybackPitch & OCARINA_BUTTON_MASK_PITCH); + AudioSfx_PlaySfx(NA_SE_OC_OCARINA, &gSfxDefaultPos, 4, &sRelativeNotePlaybackBend, + &sRelativeNotePlaybackVolume, &gSfxDefaultReverb); + } else { + AudioSfx_StopById(NA_SE_OC_OCARINA); + } + } + sPlaybackNotePos++; + } +} + +void AudioOcarina_SetRecordingSong(u8 isRecordingComplete) { + u16 i; + u16 i2; + u16 pad; + u8 pitch; + OcarinaNote* note; + u8 j; + u8 k; + s32 t; + OcarinaNote* recordedSong; + + if (sRecordingState == OCARINA_RECORD_SCARECROW_LONG) { + recordedSong = gScarecrowLongSongPtr; + } else { + /** + * OCARINA_RECORD_SCARECROW_SPAWN + * + * The notes for scarecrows spawn song are first recorded into the ocarina termina + * wall address to act as a buffer. That way, if a new scarecrow spawn song is + * rejected, the previous scarecrow spawn song is not overwritten. If the scarecrow + * spawn song is accepted, then the notes are copied over to the scarecrow spawn + * song address + */ + recordedSong = sTerminaWallSongPtr; + } + + recordedSong[sRecordSongPos].pitch = sRecordOcarinaPitch; + recordedSong[sRecordSongPos].length = sOcarinaUpdateTaskStart - sOcarinaRecordTaskStart; + recordedSong[sRecordSongPos].volume = sRecordOcarinaVolume; + recordedSong[sRecordSongPos].vibrato = sRecordOcarinaVibrato; + recordedSong[sRecordSongPos].bend = sRecordOcarinaBendIndex; + recordedSong[sRecordSongPos].bFlat4Flag = sRecordOcarinaButtonIndex & OCARINA_BUTTON_MASK_FLAG; + + sRecordOcarinaPitch = sCurOcarinaPitch; + sRecordOcarinaVolume = sCurOcarinaVolume; + sRecordOcarinaVibrato = sCurOcarinaVibrato; + sRecordOcarinaBendIndex = sCurOcarinaBendIndex; + sRecordOcarinaButtonIndex = sCurOcarinaButtonIndex; + + sRecordSongPos++; + + if ((sRecordSongPos != (ARRAY_COUNT(sScarecrowsLongSongNotes) - 1)) && !isRecordingComplete) { + // Continue recording + return; + } + + // Recording is complete + + i = sRecordSongPos; + pitch = OCARINA_PITCH_NONE; + while (i != 0 && pitch == OCARINA_PITCH_NONE) { + i--; + pitch = recordedSong[i].pitch; + } + + if (sRecordSongPos != (i + 1)) { + sRecordSongPos = i + 2; + recordedSong[sRecordSongPos - 1].length = 0; + } + + recordedSong[sRecordSongPos].length = 0; + + if (sRecordingState == OCARINA_RECORD_SCARECROW_SPAWN) { + if (sOcarinaStaffPlayingPos >= 8) { + for (i = 0; i < sRecordSongPos; i++) { + recordedSong[i] = recordedSong[i + 1]; + } + + // Copies Notes from buffer into scarecrows spawn buttons to be tested for acceptance or rejection + AudioOcarina_MapSongFromPitchToButton(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_SCARECROW_SPAWN, 8); + + // Tests to see if the notes from the scarecrow song contain identical + // notes within its song to any of the reserved songIndex from 0 to 21 + + // Loop through each of the songs + for (i = 0; i < OCARINA_SONG_SCARECROW_SPAWN; i++) { + // Checks to see if the song is reserved + if (sIsOcarinaSongReserved[i]) { + // Loops through all possible starting indices + for (j = 0; (j < 9 - gOcarinaSongButtons[i].numButtons); j++) { + // Loops through the notes of the song + for (k = 0; (k < gOcarinaSongButtons[i].numButtons) && (k + j < 8) && + (gOcarinaSongButtons[i].buttonIndex[k] == + gOcarinaSongButtons[OCARINA_SONG_SCARECROW_SPAWN].buttonIndex[k + j]); + k++) { + ; + } + + // This conditional is true if the recorded song contains a reserved song + // recorded song is cancelled + if (k == gOcarinaSongButtons[i].numButtons) { + sRecordingState = OCARINA_RECORD_REJECTED; + sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume = 0xFF; + return; + } + } + } + } + + // Counts how many times a note is repeated + i = 1; + while (i < 8) { + if (gOcarinaSongButtons[OCARINA_SONG_SCARECROW_SPAWN].buttonIndex[0] != + gOcarinaSongButtons[OCARINA_SONG_SCARECROW_SPAWN].buttonIndex[i]) { + i = 9; // break + } else { + i++; + } + } + + // This condition is true if all 8 notes are the same pitch + if (i == 8) { + sRecordingState = OCARINA_RECORD_REJECTED; + sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume = 0xFF; + return; + } + + // The scarecrow spawn song is accepted and copied from the buffer to the scarecrow spawn notes + for (i = 0; i < sRecordSongPos; i++) { + sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][i] = sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i]; + } + + sIsOcarinaInputEnabled = false; + } else { + sOcarinaSongNotes[OCARINA_SONG_SCARECROW_SPAWN][1].volume = 0xFF; + } + } + + sRecordingState = OCARINA_RECORD_OFF; +} + +/** + * recordingState = OCARINA_RECORD_OFF, end + * recordingState = OCARINA_RECORD_SCARECROW_LONG, start long scarecrows song + * recordingState = OCARINA_RECORD_SCARECROW_SPAWN, start spawn scarecrows song + */ +void AudioOcarina_SetRecordingState(u8 recordingState) { + if ((u32)recordingState == sRecordingState) { + return; + } + + if (recordingState != OCARINA_RECORD_OFF) { + sOcarinaRecordTaskStart = sOcarinaUpdateTaskStart; + sRecordOcarinaPitch = OCARINA_PITCH_NONE; + sRecordOcarinaVolume = 0x57; + sRecordOcarinaVibrato = 0; + sRecordOcarinaBendIndex = 0; + sRecordOcarinaButtonIndex = 0; + sRecordSongPos = 0; + sIsOcarinaInputEnabled = true; + sOcarinaStaffPlayingPos = 0; + sScarecrowsLongSongSecondNote = sScarecrowsLongSongNotes[1]; + } else { + if (sRecordSongPos == 0) { + sScarecrowsLongSongNotes[1] = sScarecrowsLongSongSecondNote; + } else { + if (sRecordingState == OCARINA_RECORD_SCARECROW_SPAWN) { + sOcarinaStaffPlayingPos = 1; + } + + AudioOcarina_SetRecordingSong(true); + } + + sIsOcarinaInputEnabled = false; + sOcarinaStaffPlayingPos = 0; + } + + sRecordingState = recordingState; +} + +void AudioOcarina_UpdateRecordingStaff(void) { + sRecordingStaff.state = sRecordingState; + sRecordingStaff.pos = sOcarinaStaffPlayingPos; + if (sRecordingState == OCARINA_RECORD_REJECTED) { + sRecordingState = OCARINA_RECORD_OFF; + } +} + +void AudioOcarina_UpdatePlayingStaff(void) { + if (sCurOcarinaButtonIndex != OCARINA_BTN_INVALID) { + sPlayingStaff.buttonIndex = sCurOcarinaButtonIndex & OCARINA_BUTTON_MASK_PITCH; + } + sPlayingStaff.state = AudioOcarina_GetPlayingState(); + sPlayingStaff.pos = sOcarinaStaffPlayingPos; +} + +void AudioOcarina_UpdatePlaybackStaff(void) { + if ((sPlaybackPitch & OCARINA_BUTTON_MASK_PITCH) <= OCARINA_PITCH_EFLAT5) { + sPlaybackStaff.buttonIndex = AudioOcarina_MapPitchToButton(sPlaybackPitch); + } + + sPlaybackStaff.state = sPlaybackState; + + if (sPlaybackSong != sScarecrowsLongSongNotes) { + sPlaybackStaff.pos = sPlaybackStaffPos; + } else if (sPlaybackStaffPos == 0) { + sPlaybackStaff.pos = 0; + } else { + sPlaybackStaff.pos = ((sPlaybackStaffPos - 1) % 8) + 1; + } +} + +OcarinaStaff* AudioOcarina_GetRecordingStaff(void) { + return &sRecordingStaff; +} + +OcarinaStaff* AudioOcarina_GetPlayingStaff(void) { + if (sPlayingStaff.state < 0xFE) { + sOcarinaFlags = 0; + } + + return &sPlayingStaff; +} + +OcarinaStaff* AudioOcarina_GetPlaybackStaff(void) { + return &sPlaybackStaff; +} + +void AudioOcarina_RecordSong(void) { + s32 noteChanged; + + if ((sRecordingState != OCARINA_RECORD_OFF) && ((sOcarinaUpdateTaskStart - sOcarinaRecordTaskStart) >= 3)) { + noteChanged = false; + if (sRecordOcarinaPitch != sCurOcarinaPitch) { + if (sCurOcarinaPitch != OCARINA_PITCH_NONE) { + sRecordingStaff.buttonIndex = sCurOcarinaButtonIndex & OCARINA_BUTTON_MASK_PITCH; + sOcarinaStaffPlayingPos++; + } else if ((sRecordingState == OCARINA_RECORD_SCARECROW_SPAWN) && (sOcarinaStaffPlayingPos == 8)) { + AudioOcarina_SetRecordingSong(true); + return; + } + + if (sOcarinaStaffPlayingPos > 8) { + if (sRecordingState == OCARINA_RECORD_SCARECROW_SPAWN) { + // notes played are over 8 and in recording mode. + AudioOcarina_SetRecordingSong(true); + return; + } + sOcarinaStaffPlayingPos = 1; + } + noteChanged = true; + } else if (sRecordOcarinaVolume != sCurOcarinaVolume) { + noteChanged = true; + } else if (sRecordOcarinaVibrato != sCurOcarinaVibrato) { + if (sRecordingState != OCARINA_RECORD_SCARECROW_SPAWN) { + noteChanged = true; + } + } else if ((sRecordOcarinaBendIndex != sCurOcarinaBendIndex) && + (sRecordingState != OCARINA_RECORD_SCARECROW_SPAWN)) { + noteChanged = true; + } + + if (noteChanged) { + AudioOcarina_SetRecordingSong(false); + sOcarinaRecordTaskStart = sOcarinaUpdateTaskStart; + } + } +} /** * Tests to see if the notes from songIndex contain identical notes @@ -2007,7 +3065,7 @@ s32 AudioOcarina_TerminaWallValidateNotes(u8 songIndex, u8 maxSongIndex) { */ void AudioOcarina_TerminaWallGenerateNotes(void) { OcarinaNote* ocarinaNote; - u8 randButtonIndex; + u8 randomButtonIndex; u8 i; u8 j; @@ -2017,8 +3075,8 @@ void AudioOcarina_TerminaWallGenerateNotes(void) { j = 0; for (; i < 8; i++) { - randButtonIndex = Audio_NextRandom() % ARRAY_COUNT(sButtonToPitchMap); - sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].pitch = sButtonToPitchMap[randButtonIndex]; + randomButtonIndex = AudioThread_NextRandom() % ARRAY_COUNT(sButtonToPitchMap); + sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].pitch = sButtonToPitchMap[randomButtonIndex]; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].length = 19; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].volume = 80; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j].vibrato = 0; @@ -2036,9 +3094,9 @@ void AudioOcarina_TerminaWallGenerateNotes(void) { sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j - 1].length = 22; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j + 1].pitch = OCARINA_PITCH_NONE; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][j + 1].length = 0; - AudioOcarina_MapSongFromNotesToButtons(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, 8); + AudioOcarina_MapSongFromPitchToButton(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, 8); } else { - j = Audio_NextRandom() % ARRAY_COUNT(sOoTOcarinaSongNotes); + j = AudioThread_NextRandom() % ARRAY_COUNT(sOoTOcarinaSongNotes); ocarinaNote = sOoTOcarinaSongNotes[j]; for (; ocarinaNote[i].length != 0; i++) { @@ -2047,8 +3105,8 @@ void AudioOcarina_TerminaWallGenerateNotes(void) { sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i].pitch = OCARINA_PITCH_NONE; sOcarinaSongNotes[OCARINA_SONG_TERMINA_WALL][i].length = 0; - AudioOcarina_MapSongFromNotesToButtons(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, - sOoTOcarinaSongsNumNotes[j]); + AudioOcarina_MapSongFromPitchToButton(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL, + sOoTOcarinaSongsNumNotes[j]); } } while (AudioOcarina_TerminaWallValidateNotes(OCARINA_SONG_TERMINA_WALL, OCARINA_SONG_TERMINA_WALL) != 0); } @@ -2056,7 +3114,7 @@ void AudioOcarina_TerminaWallGenerateNotes(void) { /** * Unused remnant of OoT */ -void AudioOcarina_MemoryGameSetNumNotes(u8 minigameRound) { +void AudioOcarina_MemoryGameInit(u8 minigameRound) { u8 i; if (minigameRound > 2) { @@ -2064,10 +3122,10 @@ void AudioOcarina_MemoryGameSetNumNotes(u8 minigameRound) { } sOcarinaMemoryGameAppendPos = 0; - sOcaMemoryGameEndPos = sOcaMemoryGameNumNotes[minigameRound]; + sOcarinaMemoryGameEndPos = sOcarinaMemoryGameNumNotes[minigameRound]; for (i = 0; i < 3; i++) { - AudioOcarina_MemoryGameGenerateNotes(); + AudioOcarina_MemoryGameNextNote(); } } @@ -2075,52 +3133,349 @@ void AudioOcarina_MemoryGameSetNumNotes(u8 minigameRound) { * Unused remnant of OoT, Id 14 now represent Goron Lullaby Intro instead of the OoT ocarina memory game * //! @bug calling this function in MM will overwrite Goron Lullaby Intro */ -#define OCARINA_SONG_MEMORYGAME 14 -s32 AudioOcarina_MemoryGameGenerateNotes(void) { - u32 randButtonIndex; - u8 randPitch; +#define OCARINA_SONG_MEMORY_GAME 14 +s32 AudioOcarina_MemoryGameNextNote(void) { + u32 randomButtonIndex; + u8 randomPitch; - if (sOcarinaMemoryGameAppendPos == sOcaMemoryGameEndPos) { + if (sOcarinaMemoryGameAppendPos == sOcarinaMemoryGameEndPos) { return true; } - randButtonIndex = Audio_NextRandom(); - randPitch = sButtonToPitchMap[randButtonIndex % ARRAY_COUNT(sButtonToPitchMap)]; + randomButtonIndex = AudioThread_NextRandom(); + randomPitch = sButtonToPitchMap[randomButtonIndex % ARRAY_COUNT(sButtonToPitchMap)]; - if (sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos - 1].pitch == randPitch) { - randPitch = sButtonToPitchMap[(randButtonIndex + 1) % ARRAY_COUNT(sButtonToPitchMap)]; + if (sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos - 1].pitch == randomPitch) { + randomPitch = sButtonToPitchMap[(randomButtonIndex + 1) % ARRAY_COUNT(sButtonToPitchMap)]; } - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].pitch = randPitch; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].length = 45; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].volume = 0x50; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].vibrato = 0; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].bend = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].pitch = randomPitch; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].length = 45; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].volume = 0x50; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].vibrato = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].bend = 0; sOcarinaMemoryGameAppendPos++; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].pitch = OCARINA_PITCH_NONE; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos].length = 0; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos + 1].pitch = OCARINA_PITCH_NONE; - sOcarinaSongNotes[OCARINA_SONG_MEMORYGAME][sOcarinaMemoryGameAppendPos + 1].length = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].length = 0; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].pitch = OCARINA_PITCH_NONE; + sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].length = 0; if (1) {} return false; } -#undef OCARINA_SONG_MEMORYGAME +#undef OCARINA_SONG_MEMORY_GAME -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D600.s") +void AudioOcarina_Update(void) { + sOcarinaUpdateTaskStart = gAudioContext.totalTaskCount; + if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) { + if (sIsOcarinaInputEnabled == true) { + AudioOcarina_ReadControllerInput(); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D758.s") + if ((sPlaybackState == 0) && (sIsOcarinaInputEnabled == true)) { + AudioOcarina_PlayControllerInput(false); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D864.s") + if (sOcarinaFlags != 0) { + if (sOcarinaFlags & 0x40000000) { + AudioOcarina_CheckSongsWithoutMusicStaff(); + } else { + AudioOcarina_CheckSongsWithMusicStaff(); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D8B4.s") + AudioOcarina_PlaybackSong(); + sOcarinaPlaybackTaskStart = sOcarinaUpdateTaskStart; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019D8E4.s") + if (sPlaybackState == 0) { + AudioOcarina_RecordSong(); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019DF28.s") + if ((sOcarinaFlags != 0) && (sPrevOcarinaPitch != sCurOcarinaPitch)) { + sOcarinaDropInputTimer = 1; // Drops ocarina input for 1 frame + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019DF64.s") + sPrevOcarinaPitch = sCurOcarinaPitch; + + if (sOcarinaDisableTimer != 0) { + sOcarinaDisableTimer--; + if (sOcarinaDisableTimer == 0) { + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + } + } + } + + AudioOcarina_UpdatePlayingStaff(); + AudioOcarina_UpdatePlaybackStaff(); + AudioOcarina_UpdateRecordingStaff(); +} + +#define OCARINA_INSTRUMENT_OOT_MAX 7 + +void AudioOcarina_PlayLongScarecrowAfterCredits(void) { + static u8 sScarecrowAfterCreditsState = 0; + static u8 sScarecrowAfterCreditsIntrumentId = OCARINA_INSTRUMENT_DEFAULT; + static u16 sScarecrowAfterCreditsTimer = 1200; + + switch (sScarecrowAfterCreditsState) { + case 0: + if (sScarecrowAfterCreditsTimer-- == 0) { + // OoT originally had 7 Ocarina instruments + // MM has more so this does not go all the way to the max + if (sScarecrowAfterCreditsIntrumentId < OCARINA_INSTRUMENT_OOT_MAX) { + // set next ocarina instrument and restart + sScarecrowAfterCreditsState++; + } else { + // finished + sScarecrowAfterCreditsState = 3; + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + } + sScarecrowAfterCreditsTimer = 1200; + } + break; + + case 1: + AudioSfx_MuteBanks(0); + AudioOcarina_SetInstrument(sScarecrowAfterCreditsIntrumentId); + AudioOcarina_SetPlaybackSong(OCARINA_SONG_SCARECROW_LONG + 1, 1); + sScarecrowAfterCreditsIntrumentId++; + sScarecrowAfterCreditsState++; + break; + + case 2: + if (AudioOcarina_GetPlaybackStaff()->state == 0) { + sScarecrowAfterCreditsState = 0; + } + break; + } +} + +u8 sRequestCustomSequence = false; + +void AudioOcarina_SetCustomSequence(void) { + // Never passes true as sRequestCustomSequence is never set true + if (sRequestCustomSequence && gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].enabled && + ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].soundScriptIO[0] == 0xFF)) { + gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].seqData = sCustomSequenceScript; + sRequestCustomSequence = false; + } +} + +// Called by unused function +void AudioOcarina_PlayCustomSequence(void) { + sRequestCustomSequence = true; + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | + (u32)(NA_BGM_DUNGEON_APPEAR)); +} + +// Unused +// Regalloc Swap https://decomp.me/scratch/QEovr +#ifdef NON_MATCHING +s32 AudioOcarina_CreateCustomSequence(void) { + OcarinaNote* prevNote; + u16 i; + u16 phi_s4; + u16 temp_a0; // delay1 + u16 phi_a2; // delay2 + u8 absPitch; + s8 phi_a0; // adjBendIndex + s8 phi_s2; // prevBend + u8 phi_t1; // vibrato + u8 phi_t5; // isLegato + u16 temp_t4; // prevNoteLength + + phi_a2 = 0; + phi_t1 = 0; + phi_s2 = 0; + phi_t5 = 0; + phi_s4 = 0; + + sCustomSequencePc = 39; // .channel chan_loop + + prevNote = &sScarecrowsLongSongNotes[0]; + for (i = 1; ((prevNote->pitch == OCARINA_PITCH_NONE) && (prevNote->length != 0)); i++) { + prevNote = &sScarecrowsLongSongNotes[i]; + } + + for (; (prevNote->length != 0) && (sCustomSequencePc < 394); i++) { + + temp_a0 = ((prevNote->length * 48) / 30); + + if (phi_t1 != prevNote->vibrato) { + sCustomSequenceScript[sCustomSequencePc++] = 0xFD; // delay cmd + + if (phi_a2 >= 0x80) { + // Store as compressed u16 + sCustomSequenceScript[sCustomSequencePc++] = (((phi_a2 >> 8) & 0xFF) & 0x7F) + 0x80; // delay arg + sCustomSequenceScript[sCustomSequencePc++] = phi_a2 & 0xFF; // delay arg + } else { + // Store as u8 + sCustomSequenceScript[sCustomSequencePc++] = phi_a2; // delay arg + } + + sCustomSequenceScript[sCustomSequencePc++] = 0xD8; // vibdepth cmd + sCustomSequenceScript[sCustomSequencePc++] = prevNote->vibrato; // vibdepth arg + + phi_a2 = temp_a0; + phi_t1 = prevNote->vibrato; + } else { + phi_a2 += temp_a0; + } + + prevNote = &sScarecrowsLongSongNotes[i]; + } + + if (phi_a2 != 0) { + sCustomSequenceScript[sCustomSequencePc++] = 0xFD; // delay cmd + if (phi_a2 >= 0x80) { + // Store as compressed u16 + sCustomSequenceScript[sCustomSequencePc++] = (((phi_a2 >> 8) & 0xFF) & 0x7F) + 0x80; // delay arg + sCustomSequenceScript[sCustomSequencePc++] = phi_a2 & 0xFF; // delay arg + } else { + // Store as u8 + sCustomSequenceScript[sCustomSequencePc++] = phi_a2; // delay arg + } + } + + sCustomSequenceScript[sCustomSequencePc++] = 0xFF; // end cmd + + // ldlayer 0, layer0 + sCustomSequenceScript[24] = sCustomSequencePc >> 8; + sCustomSequenceScript[25] = sCustomSequencePc & 0xFF; + + // ldlayer 1, layer1 + sCustomSequenceScript[27] = (sCustomSequencePc + 4) >> 8; + sCustomSequenceScript[28] = (sCustomSequencePc + 4) & 0xFF; + + sCustomSequenceScript[sCustomSequencePc++] = 0xC2; // transpose cmd + sCustomSequenceScript[sCustomSequencePc++] = -5; // transpose arg + + sCustomSequenceScript[sCustomSequencePc++] = 0xC0; // ldelay cmd + sCustomSequenceScript[sCustomSequencePc++] = 8; // ldelay arg + + sCustomSequenceScript[sCustomSequencePc++] = 0xC1; // shortvel cmd + sCustomSequenceScript[sCustomSequencePc++] = 87; // shortvel arg + + sCustomSequenceScript[sCustomSequencePc++] = 0xC9; // shortgate cmd + sCustomSequenceScript[sCustomSequencePc++] = 0; // shortgate arg + + if (1) {} + if (1) {} // TODO: Needed? + + prevNote = &sScarecrowsLongSongNotes[0]; + + for (i = 1; ((prevNote->pitch == OCARINA_PITCH_NONE) && (prevNote->length != 0)); i++) { + prevNote = &sScarecrowsLongSongNotes[i]; + } + + for (; ((temp_t4 = prevNote->length) != 0) && (sCustomSequencePc < 394); i++) { + + if (prevNote->pitch == sScarecrowsLongSongNotes[i].pitch) { + if ((sScarecrowsLongSongNotes[i].length != 0) && (phi_t5 == 0)) { + sCustomSequenceScript[sCustomSequencePc++] = 0xC4; // legato cmd + phi_t5 = 1; + } + } else if ((phi_t5 == 1) && (sScarecrowsLongSongNotes[i].pitch != OCARINA_PITCH_NONE) && + (sScarecrowsLongSongNotes[i].pitch != OCARINA_PITCH_C4)) { + sCustomSequenceScript[sCustomSequencePc++] = 0xC5; // nolegato cmd + phi_t5 = 0; + } + + if (phi_s2 != prevNote->bend) { + sCustomSequenceScript[sCustomSequencePc++] = 0xCE; // bendfine cmd + + if (ABS_ALT(prevNote->bend) > 64) { + phi_a0 = 127; + } else if (prevNote->bend < 0) { + phi_a0 = -prevNote->bend; + } else { + phi_a0 = ((prevNote->bend * 127) / 64); + } + + if (prevNote->bend < 0) { + phi_a0 *= -1; + } + + sCustomSequenceScript[sCustomSequencePc++] = phi_a0; // bendfine arg + + phi_s2 = prevNote->bend; + } + + absPitch = prevNote->pitch + 39; // convert ocarina pitch to absolute pitch, + PITCH_C4 (Middle C) + if (prevNote->pitch != OCARINA_PITCH_NONE) { + sCustomSequenceScript[sCustomSequencePc++] = absPitch; // shortdvg cmd, shortdvg arg + } else { + sCustomSequenceScript[sCustomSequencePc++] = 0xC0; // ldelay cmd + } + + // delay/duration + temp_a0 = ((temp_t4 * 48) + phi_s4) / 30; + + if (temp_a0 < 0x80) { + // Store as u8 + sCustomSequenceScript[sCustomSequencePc++] = temp_a0; // shortdvg/ldelay arg + } else { + // Store as compressed u16 + sCustomSequenceScript[sCustomSequencePc++] = (((temp_a0 >> 8) & 0xFF) & 0x7F) + 0x80; // shortdvg/ldelay arg + sCustomSequenceScript[sCustomSequencePc++] = temp_a0 & 0xFF; // shortdvg/ldelay arg + } + + if (1) {} + + phi_s4 = ((temp_t4 * 48) + phi_s4) - (temp_a0 * 30); + + prevNote = &sScarecrowsLongSongNotes[i]; + } + + sCustomSequenceScript[sCustomSequencePc++] = 0xFF; // end cmd + + AudioOcarina_PlayCustomSequence(); + + if (i >= 394) { + return -1; + } + + return 0; +} +#else +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/AudioOcarina_CreateCustomSequence.s") +#endif + +void AudioOcarina_ResetInstrument(void) { + if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | + ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(0)); + sOcarinaInstrumentId = OCARINA_INSTRUMENT_OFF; + AudioOcarina_ResetAndMute(); + } +} + +void AudioOcarina_ResetStaffs(void) { + u8 songIndex; + + sPlayingStaff.buttonIndex = OCARINA_BTN_INVALID; + sPlayingStaff.state = 0xFF; + sPlayingStaff.pos = 0; + + sPlaybackStaff.buttonIndex = OCARINA_BTN_INVALID; + sPlaybackStaff.state = 0; + sPlaybackStaff.pos = 0; + + sRecordingStaff.buttonIndex = OCARINA_BTN_INVALID; + sRecordingStaff.state = 0xFF; + sRecordingStaff.pos = 0; + + sOcarinaDisableTimer = 0; + sOcarinaDropInputTimer = 0; + + for (songIndex = OCARINA_SONG_SONATA; songIndex < OCARINA_SONG_MAX; songIndex++) { + D_801FD518[songIndex] = 0xFF; + D_801FD530[songIndex] = 0; + } + + D_801D8534 = 0; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019DFF8.s") @@ -2136,23 +3491,447 @@ s32 AudioOcarina_MemoryGameGenerateNotes(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E110.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E14C.s") +f32 AudioSfx_ComputeVolume(u8 bankId, u8 entryIndex) { + SfxBankEntry* bankEntry = &gSfxBanks[bankId][entryIndex]; + f32 minDist; + f32 phi_f14; + f32 baseDist; + f32 phi_f12; + f32 volume; // Also acts as intermediate volumeSquared + s32 pad[3]; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E324.s") + if (bankEntry->sfxParams & SFX_FLAG_VOLUME_NO_DIST) { + return 1.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E4B0.s") + if (bankEntry->dist > 10000.0f) { + volume = 0.0f; + } else { + if (bankEntry->sfxParams & SFX_PARAM_DIST_RANGE_MASK_UPPER) { + phi_f12 = 0.35f; + phi_f14 = 0.65f; + } else { + phi_f12 = 0.81f; + phi_f14 = 0.19f; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E634.s") + switch (bankEntry->sfxParams & SFX_PARAM_DIST_RANGE_MASK) { + case 0: + baseDist = 500.0f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E864.s") + case 1: + baseDist = 666.6667f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019EA40.s") + case 2: + baseDist = 952.381f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019EB2C.s") + case 3: + baseDist = 3846.154f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F024.s") + case 4: + baseDist = 1000.0f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F05C.s") + case 5: + baseDist = 666.6667f; + break; + + case 6: + baseDist = 500.0f; + break; + + case 7: + baseDist = 400.0f; + break; + } + + minDist = baseDist / 5.0f; + + if (bankEntry->dist < minDist) { + volume = 1.0f; + } else if (bankEntry->dist < baseDist) { + volume = + ((((baseDist - minDist) - (bankEntry->dist - minDist)) / (baseDist - minDist)) * phi_f14) + phi_f12; + } else { + volume = (1.0f - ((bankEntry->dist - baseDist) / (10000.0f - baseDist))) * phi_f12; + } + + volume = SQ(volume); + } + + return volume; +} + +s8 AudioSfx_ComputeReverb(u8 bankId, u8 entryIndex, u8 channelIndex) { + s8 distAdd = 0; + s32 scriptAdd = 0; + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + s32 reverb; + + if (!(entry->sfxParams & SFX_FLAG_REVERB_NO_DIST)) { + if (entry->dist < 2500.0f) { + distAdd = *entry->posZ > 0.0f ? (entry->dist / 2500.0f) * 70.0f : (entry->dist / 2500.0f) * 91.0f; + } else { + distAdd = 70; + } + } + + if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex])) { + scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1]; + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1] < 0) { + scriptAdd = 0; + } + } + + reverb = (*entry->reverbAdd & 0x7F) + distAdd; + + if (entry->state != SFX_STATE_READY) { + reverb += scriptAdd; + } + + if ((bankId != BANK_OCARINA) || (SFX_INDEX(entry->sfxId) >= 2)) { + reverb += sAudioEnvReverb + (sAudioCodeReverb & 0x3F) + sSpecReverb; + } + + if (reverb > 0x7F) { + reverb = 0x7F; + } + + return reverb; +} + +s8 AudioSfx_ComputePanSigned(f32 x, f32 z, u8 token) { + f32 absX = ABS_ALT(x); + f32 absZ = ABS_ALT(z); + f32 pan; + + if (absX > 8000.0f) { + absX = 8000.0f; + } + + if (absZ > 8000.0f) { + absZ = 8000.0f; + } + + if ((x == 0.0f) && (z == 0.0f)) { + pan = 0.5f; + } else if (absZ <= absX) { + pan = (16000.0f - absX) / (4.5f * (16000.0f - absZ)); + if (x >= 0.0f) { + pan = 1.0f - pan; + } + } else { + pan = (x / (3.6f * absZ)) + 0.5f; + } + + if ((absZ < 50.0f) && (absX < 50.0f)) { + pan = ((pan - 0.5f) * SQ(absX / 50.0f)) + 0.5f; + } + + return (pan * 127.0f) + 0.5f; +} + +f32 AudioSfx_ComputeFreqScale(u8 bankId, u8 entryIndex) { + s32 applyRandScaling = false; + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + f32 dist; + f32 freq = 1.0f; + + if (entry->sfxParams & SFX_PARAM_RAND_FREQ_LOWER) { + freq = 1.0f - ((gAudioContext.audioRandom & 0xF) / 192.0f); + } + + switch (bankId) { + case BANK_VOICE: + if (((entry->sfxId & 0xFF) < 0x40) && (sAudioBaseFilter2 != 0)) { + applyRandScaling = true; + } else if (((entry->sfxId & 0xFF) >= 0x40) && (sAudioExtraFilter2 != 0)) { + applyRandScaling = true; + } + break; + + case BANK_PLAYER: + case BANK_ITEM: + if (sAudioBaseFilter2 != 0) { + applyRandScaling = true; + } + break; + + case BANK_ENV: + case BANK_ENEMY: + if (((*entry->reverbAdd & 0x80) != 0) | (sAudioExtraFilter2 != 0)) { + applyRandScaling = true; + } + break; + + case BANK_SYSTEM: + case BANK_OCARINA: + break; + + default: + break; + } + + if ((applyRandScaling == true) && !(entry->sfxParams & SFX_PARAM_RAND_FREQ_SCALE)) { + freq *= 1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f); + } + + dist = entry->dist; + if (!(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST) && !(entry->sfxParams & SFX_FLAG_FREQ_NO_DIST)) { + if (dist >= 10000.0f) { + freq += 0.2f; + } else { + freq += (0.2f * (dist / 10000.0f)); + } + } + + if ((entry->sfxParams & SFX_PARAM_RAND_FREQ_RAISE_MASK) != (0 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT)) { + freq += (entry->randFreq / 192.0f); + } + + return freq; +} + +u8 AudioSfx_ComputeSurroundSoundFilter(f32 behindScreenZ, SfxBankEntry* entry, s8 panSigned) { + u8 lowPassCutoff; + u8 highPassCutoff; + u16* sfxParams; + f32 distParam; + f32 dist; + + // Remnant of OoT + if (*entry->posZ < behindScreenZ) { + lowPassCutoff = 0; + } else { + lowPassCutoff = 0; + } + + sfxParams = &entry->sfxParams; + + if (*sfxParams & SFX_FLAG_SURROUND_LOWPASS_FILTER) { + lowPassCutoff = 0xF; + } + + switch ((*sfxParams & SFX_PARAM_DIST_RANGE_MASK)) { + case 0: + distParam = 15.0f; + break; + + case 1: + distParam = 12.0f; + break; + + case 2: + distParam = 9.0f; + break; + + case 3: + distParam = 6.0f; + break; + + case 4: + distParam = 18.0f; + break; + + case 5: + distParam = 21.0f; + break; + + case 6: + distParam = 24.0f; + break; + + case 7: + distParam = 27.0f; + break; + + default: + break; + } + + if (!(entry->sfxFlags & SFX_FLAG2_SURROUND_NO_HIGHPASS_FILTER)) { + if (entry->dist > 1923.077f) { + dist = 1923.077f; + } else { + dist = entry->dist; + } + + highPassCutoff = (distParam * dist) / (2 * 1923.077f); + } else { + highPassCutoff = 0; + } + + return (lowPassCutoff << 4) + highPassCutoff; +} + +s8 AudioSfx_ComputeCombFilter(f32 posY, u16 sfxParams) { + s8 combFilterGain; + + if (posY < 0.0f) { + if (posY < -625.0f) { + combFilterGain = -32; + } else { + combFilterGain = (s8)(((625.0f + posY) / 625.0f) * 31.0f) + 0xE0; + } + } else if (posY > 1250.0f) { + combFilterGain = 127; + } else { + combFilterGain = (posY / 1250.0f) * 126.0f; + } + + return combFilterGain | 1; +} + +void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { + static s8 sZVolumes[] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, + 64, 65, 65, 65, 66, 66, 66, 67, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, + }; + f32 volume = 1.0f; + s8 volumeS8; + s8 reverb = 0; + f32 freqScale = 1.0f; + s8 panSigned = 0x40; + u8 pad; + u8 filter = 0; + s8 combFilterGain = 0; + s8 zVolume = -1; + f32 behindScreenZ; + u8 baseFilter = 0; + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + s32 pad2; + + switch (bankId) { + case BANK_PLAYER: + case BANK_ITEM: + case BANK_ENV: + case BANK_ENEMY: + case BANK_VOICE: + if (sSoundMode == SOUNDMODE_SURROUND) { + combFilterGain = AudioSfx_ComputeCombFilter(*entry->posY, entry->sfxParams); + } + // fallthrough + case BANK_OCARINA: + entry->dist = sqrtf(entry->dist * 10.0f); + volume = AudioSfx_ComputeVolume(bankId, entryIndex) * *entry->volume; + reverb = AudioSfx_ComputeReverb(bankId, entryIndex, channelIndex); + panSigned = AudioSfx_ComputePanSigned(*entry->posX, *entry->posZ, entry->token); + freqScale = AudioSfx_ComputeFreqScale(bankId, entryIndex) * *entry->freqScale; + + if (sSoundMode == SOUNDMODE_SURROUND) { + if (*entry->posZ >= 0.0f) { + if (*entry->posZ < 200.0f) { + zVolume = 32.0f - ((*entry->posZ / 300.0f) * 32.0f); + } else { + zVolume = 0; + } + } else if (*entry->posZ < 0.0f) { + if (*entry->posZ > -300.0f) { + zVolume = 32.0f - ((*entry->posZ / 300.0f) * 95.0f); + } else { + zVolume = 127; + } + } + zVolume = sZVolumes[zVolume]; + } + + if (sAudioBaseFilter != 0) { + if ((bankId == BANK_PLAYER) || (bankId == BANK_ITEM) || + ((bankId == BANK_VOICE) && (((entry->sfxId & 0xFF) < 0x40) || ((entry->sfxId & 0xFF) >= 0x80)))) { + baseFilter = sAudioBaseFilter; + if (sAudioExtraFilter) { + reverb >>= 2; + } + } + } + + if (((*entry->reverbAdd & 0x80) | baseFilter | sAudioExtraFilter | + (entry->sfxFlags & SFX_FLAG2_APPLY_LOWPASS_FILTER)) != 0) { + filter = ((((*entry->reverbAdd & 0x80) >> 2) | baseFilter | sAudioExtraFilter | + ((entry->sfxFlags & SFX_FLAG2_APPLY_LOWPASS_FILTER) >> 2)) * + 2); + filter &= 0xFF; + } else if ((sSoundMode == SOUNDMODE_SURROUND) && !(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST)) { + filter = AudioSfx_ComputeSurroundSoundFilter(behindScreenZ, entry, panSigned); + } + break; + + case BANK_SYSTEM: + break; + } + + if (sSfxChannelState[channelIndex].volume != volume) { + volumeS8 = (u8)(volume * 127.0f); + sSfxChannelState[channelIndex].volume = volume; + } else { + volumeS8 = -1; + } + + //! FAKE: + if (1) {} + + // CHAN_UPD_SCRIPT_IO (slot 2, sets volume) + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | (channelIndex << 8) | 2, volumeS8); + + if (sSfxChannelState[channelIndex].reverb != reverb) { + sSfxChannelState[channelIndex].reverb = reverb; + } + if (sSfxChannelState[channelIndex].freqScale != freqScale) { + sSfxChannelState[channelIndex].freqScale = freqScale; + } + if (sSfxChannelState[channelIndex].stereoBits != 0) { + sSfxChannelState[channelIndex].stereoBits = 0; + } + if (sSfxChannelState[channelIndex].filter != filter) { + sSfxChannelState[channelIndex].filter = filter; + } + if (sSfxChannelState[channelIndex].combFilterGain != combFilterGain) { + sSfxChannelState[channelIndex].combFilterGain = combFilterGain; + } + if (sSfxChannelState[channelIndex].zVolume != zVolume) { + sSfxChannelState[channelIndex].zVolume = zVolume; + } + if (sSfxChannelState[channelIndex].panSigned != panSigned) { + sSfxChannelState[channelIndex].panSigned = panSigned; + } +} + +u32 AudioSfx_SetFreqAndStereoBits(u8 seqScriptValIn, SequenceChannel* channel) { + channel->stereo.asByte = sSfxChannelState[seqScriptValIn].stereoBits; + channel->freqScale = sSfxChannelState[seqScriptValIn].freqScale; + channel->changes.s.freqScale = true; + + return seqScriptValIn; +} + +void AudioSfx_ResetSfxChannelState(void) { + SfxChannelState* state; + u8 i; + + for (i = 0; i < ARRAY_COUNT(sSfxChannelState); i++) { + state = &sSfxChannelState[i]; + state->volume = 1.0f; + state->freqScale = 1.0f; + state->reverb = 0; + state->panSigned = 0x40; + state->stereoBits = 0; + state->filter = 0xFF; + state->combFilterGain = 0xFF; + state->zVolume = 0xFF; + } + + sSfxChannelState[SFX_CHANNEL_OCARINA].combFilterGain = 0; + sPrevSeqMode = SEQ_MODE_DEFAULT; + sAudioCodeReverb = 0; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/play_sound.s") @@ -2166,9 +3945,75 @@ s32 AudioOcarina_MemoryGameGenerateNotes(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F230.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F258.s") +SfxSettings* AudioSfx_AddSfxSetting(Vec3f* pos) { + SfxSettings* sfxSettings; + u8 i = 0; + u8 sfxSettingIndex = 0xFF; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F300.s") + for (; i < ARRAY_COUNT(sSfxSettings); i++) { + sfxSettings = &sSfxSettings[i]; + + if ((sfxSettings->pos == NULL) && (sfxSettingIndex == 0xFF)) { + sfxSettingIndex = i; + } + + if (sfxSettings->pos == pos) { + return sfxSettings; + } + } + + if (sfxSettingIndex != 0xFF) { + sSfxSettingsFlags |= 1 << sfxSettingIndex; + sfxSettings = &sSfxSettings[sfxSettingIndex]; + sfxSettings->pos = pos; + return sfxSettings; + } + + return NULL; +} + +void AudioSfx_ProcessSfxSettings(void) { + SfxBankEntry* entry; + u8 sfxSettingsFlags; + u8 sfxSettingIndex = 0; + u8 bankId; + u8 entryIndex; + s32 found; + + if (sSfxSettingsFlags != 0) { + sfxSettingsFlags = sSfxSettingsFlags; + + while (sfxSettingsFlags != 0) { + bankId = BANK_ENV; + if ((sfxSettingsFlags & (1 << sfxSettingIndex))) { + + found = false; + while ((bankId <= BANK_ENEMY) && !found) { + entryIndex = gSfxBanks[bankId]->next; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[bankId][entryIndex]; + entryIndex = 0xFF; + if (entry->posX == &sSfxSettings[sfxSettingIndex].pos->x) { + found = true; + } else { + entryIndex = entry->next; + } + } + bankId++; + } + + if (!found) { + sSfxSettingsFlags ^= (1 << sfxSettingIndex); + sSfxSettings[sfxSettingIndex].pos = NULL; + } + + sfxSettingsFlags ^= (1 << sfxSettingIndex); + } + sfxSettingIndex++; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F420.s") @@ -2176,7 +4021,17 @@ s32 AudioOcarina_MemoryGameGenerateNotes(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F540.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F570.s") +void AudioSfx_LowerSfxSettingsReverb(Vec3f* pos, s8 isReverbLowered) { + SfxSettings* sfxSettings = AudioSfx_AddSfxSetting(pos); + + if (sfxSettings != NULL) { + if (isReverbLowered) { + sfxSettings->reverbAdd = -0x80; + } else { + sfxSettings->reverbAdd = 0; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019F5AC.s") @@ -2218,15 +4073,15 @@ s32 AudioOcarina_MemoryGameGenerateNotes(void) { * Used for EnRiverSound */ void Audio_PlaySfxForRiver(Vec3f* pos, f32 freqScale) { - if (!Audio_IsSfxPlaying(NA_SE_EV_RIVER_STREAM - SFX_FLAG)) { + if (!AudioSfx_IsPlaying(NA_SE_EV_RIVER_STREAM - SFX_FLAG)) { sRiverFreqScaleLerp.value = freqScale; } else if (freqScale != sRiverFreqScaleLerp.value) { sRiverFreqScaleLerp.target = freqScale; sRiverFreqScaleLerp.remainingFrames = 40; sRiverFreqScaleLerp.step = (sRiverFreqScaleLerp.target - sRiverFreqScaleLerp.value) / 40; } - Audio_PlaySfxGeneral(NA_SE_EV_RIVER_STREAM - SFX_FLAG, pos, 4, &sRiverFreqScaleLerp.value, &D_801DB4B0, - &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_EV_RIVER_STREAM - SFX_FLAG, pos, 4, &sRiverFreqScaleLerp.value, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultReverb); } /** @@ -2234,15 +4089,15 @@ void Audio_PlaySfxForRiver(Vec3f* pos, f32 freqScale) { * Used for Zora's River Waterfall */ void Audio_PlaySfxForWaterfall(Vec3f* pos, f32 freqScale) { - if (!Audio_IsSfxPlaying(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG)) { + if (!AudioSfx_IsPlaying(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG)) { sWaterfallFreqScaleLerp.value = freqScale; } else if (freqScale != sWaterfallFreqScaleLerp.value) { sWaterfallFreqScaleLerp.target = freqScale; sWaterfallFreqScaleLerp.remainingFrames = 40; sWaterfallFreqScaleLerp.step = (sWaterfallFreqScaleLerp.target - sWaterfallFreqScaleLerp.value) / 40; } - Audio_PlaySfxGeneral(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG, pos, 4, &sWaterfallFreqScaleLerp.value, - &sWaterfallFreqScaleLerp.value, &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG, pos, 4, &sWaterfallFreqScaleLerp.value, + &sWaterfallFreqScaleLerp.value, &gSfxDefaultReverb); } /** @@ -2259,6 +4114,9 @@ void Audio_StepFreqLerp(FreqLerp* lerp) { } } +f32 sBigBellsVolume[8] = { + 1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, +}; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0124.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0184.s") @@ -2285,7 +4143,7 @@ void Audio_SetGanonsTowerBgmVolumeLevel(u8 ganonsTowerLevel) { for (channelIndex = 0; channelIndex < 16; channelIndex++) { // CHAN_UPD_PAN_UNSIGNED - Audio_QueueCmdS8(((u8)(u32)channelIndex << 8) | 0x7000000, pan); + AudioThread_QueueCmdS8(((u8)(u32)channelIndex << 8) | 0x7000000, pan); } // Lowest room in Ganon's Tower (Entrance Room) @@ -2343,9 +4201,9 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { } // CHAN_UPD_REVERB - Audio_QueueCmdS8(_SHIFTL(5, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | - _SHIFTL(channelIndex, 8, 8), - (u8)reverb); + AudioThread_QueueCmdS8(_SHIFTL(5, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | + _SHIFTL(channelIndex, 8, 8), + (u8)reverb); } } } @@ -2401,7 +4259,29 @@ void Audio_UpdateRiverSoundVolumes(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A05F0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0654.s") +void AudioSfx_SetChannelIO(Vec3f* pos, u16 sfxId, u8 ioData) { + u8 channelIndex = 0; + u8 bankId = SFX_BANK_SHIFT(sfxId); + u8 entryIndex; + u8 i; + + for (i = 0; i < bankId; i++) { + channelIndex += gChannelsPerBank[gSfxChannelLayout][i]; + } + + for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) { + entryIndex = gActiveSfx[bankId][i].entryIndex; + + if (entryIndex != 0xFF) { + if ((sfxId == gSfxBanks[bankId][entryIndex].sfxId) && (&pos->x == gSfxBanks[bankId][entryIndex].posX)) { + AudioThread_QueueCmdS8(_SHIFTL(6, 24, 8) | _SHIFTL(SEQ_PLAYER_SFX, 16, 8) | + _SHIFTL(channelIndex, 8, 8) | _SHIFTL(6, 0, 8), + ioData); + } + } + channelIndex++; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0810.s") @@ -2447,7 +4327,7 @@ void func_801A09D4(Vec3f* pos, f32 xzDistToPlayer) { if (channelIndex != 9) { Audio_QueueSeqCmd(((u32)(6) << 28) | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 16) | ((u32)(channelIndex) << 8) | ((u8)(127.0f * volumeRel))); - Audio_QueueCmdS8(0x03000000 | ((u8)((u32)channelIndex) << 8), pan); + AudioThread_QueueCmdS8(0x03000000 | ((u8)((u32)channelIndex) << 8), pan); } } } @@ -2470,6 +4350,7 @@ void Audio_ClearSariaBgmAtPos(Vec3f* pos) { } } +u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; void Audio_SplitBgmChannels(s8 volumeSplit); #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SplitBgmChannels.s") @@ -2664,7 +4545,7 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4348.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4380.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBanks.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4428.s") @@ -2676,6 +4557,7 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A46F8.s") +f32 sSfxOriginalPos[] = { 0.0f, 0.0f, 0.0f }; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4748.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A479C.s") @@ -2686,11 +4568,27 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4A28.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4B80.s") +u32 Audio_SetNatureAmbienceRandomBend(u8 seqScriptValIn, SequenceChannel* channel); +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4C30.s") +void Audio_Init(void) { + AudioLoad_Init(NULL, 0); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4C54.s") +void AudioSfx_Init(u16 fadeTimer) { + u8 channelIndex; + + AudioThread_ScheduleProcessCmds(); + Audio_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0x70, fadeTimer); + + for (channelIndex = 0; channelIndex < ARRAY_COUNT(sSfxChannelState); channelIndex++) { + AudioThread_QueueCmdS32(0x10 << 24 | SEQ_PLAYER_SFX << 16 | ((u8)(u32)channelIndex << 8), + &sSfxChannelState[channelIndex]); + } + + AudioThread_QueueCmdS32(0xE4000000, AudioSfx_SetFreqAndStereoBits); + AudioThread_QueueCmdS32(0xE4000001, Audio_SetNatureAmbienceRandomBend); +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D00.s") diff --git a/src/code/audio/code_801A5BD0.c b/src/code/audio/code_801A5BD0.c index 8397fd52e..4cf1147bf 100644 --- a/src/code/audio/code_801A5BD0.c +++ b/src/code/audio/code_801A5BD0.c @@ -1,45 +1,951 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5BD0.s") +typedef struct { + /* 0x00 */ u16 sfxId; + /* 0x02 */ u8 token; + /* 0x04 */ s8* reverbAdd; + /* 0x08 */ Vec3f* pos; + /* 0x0C */ f32* freqScale; + /* 0x10 */ f32* volume; +} SfxRequest; // size = 0x14 -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5C28.s") +typedef struct { + /* 0x0 */ f32 value; + /* 0x4 */ f32 target; + /* 0x8 */ f32 step; + /* 0xC */ u16 remainingFrames; +} SfxBankLerp; // size = 0x10 -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5C8C.s") +typedef enum { + /* 0 */ SFX_RM_REQ_BY_BANK, + /* 1 */ SFX_RM_REQ_BY_POS_AND_BANK, + /* 2 */ SFX_RM_REQ_BY_POS, + /* 3 */ SFX_RM_REQ_BY_POS_AND_ID, + /* 4 */ SFX_RM_REQ_BY_TOKEN_AND_ID, + /* 5 */ SFX_RM_REQ_BY_ID +} SfxRemoveRequest; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/Audio_PlaySfxGeneral.s") +SfxBankEntry sSfxPlayerBank[9]; +SfxBankEntry sSfxItemBank[12]; +SfxBankEntry sSfxEnvironmentBank[32]; +SfxBankEntry sSfxEnemyBank[20]; +SfxBankEntry sSfxSystemBank[8]; +SfxBankEntry sSfxOcarinaBank[3]; +SfxBankEntry sSfxVoiceBank[5]; +SfxRequest sSfxRequests[0x100]; +u8 sSfxBankListEnd[7]; +u8 sSfxBankFreeListStart[7]; +u8 sSfxBankUnused[7]; +ActiveSfx gActiveSfx[7][3]; +u8 sCurSfxPlayerChannelIndex; +u8 gSfxBankMuted[7]; +SfxBankLerp sSfxBankLerp[7]; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5DDC.s") +// sSfxRequests ring buffer endpoints. read index <= write index, wrapping around mod 256. +u8 sSfxRequestWriteIndex = 0; +u8 sSfxRequestReadIndex = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A5F7C.s") +/** + * Array of pointers to arrays of SfxBankEntry of sizes: 9, 12, 32, 20, 8, 3, 5 + * + * 0 : Player Bank size 9 + * 1 : Item Bank size 12 + * 2 : Environment Bank size 32 + * 3 : Enemy Bank size 20 + * 4 : System Bank size 8 + * 5 : Ocarina Bank size 3 + * 6 : Voice Bank size 5 + */ +SfxBankEntry* gSfxBanks[7] = { + sSfxPlayerBank, sSfxItemBank, sSfxEnvironmentBank, sSfxEnemyBank, sSfxSystemBank, sSfxOcarinaBank, sSfxVoiceBank, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A6430.s") +u8 sSfxBankSizes[ARRAY_COUNT(gSfxBanks)] = { + ARRAY_COUNT(sSfxPlayerBank), ARRAY_COUNT(sSfxItemBank), ARRAY_COUNT(sSfxEnvironmentBank), + ARRAY_COUNT(sSfxEnemyBank), ARRAY_COUNT(sSfxSystemBank), ARRAY_COUNT(sSfxOcarinaBank), + ARRAY_COUNT(sSfxVoiceBank), +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A65C8.s") +u8 gSfxChannelLayout = 0; +u16 sSfxChannelLowVolumeFlag = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A6D0C.s") +// The center of the screen in projected coordinates. +// Gives the impression that the sfx has no specific location +Vec3f gSfxDefaultPos = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7084.s") +// Reused as either frequency or volume multiplicative scaling factor +// Does not alter or change frequency or volume +f32 gSfxDefaultFreqAndVolScale = 1.0f; +s32 D_801DB4B4 = 0; // unused -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7168.s") +// Adds no reverb to the existing reverb +s8 gSfxDefaultReverb = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7284.s") +void AudioSfx_MuteBanks(u16 muteMask) { + u8 bankId; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/Audio_StopSfxByPos.s") + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + if (muteMask & 1) { + gSfxBankMuted[bankId] = true; + } else { + gSfxBankMuted[bankId] = false; + } + muteMask = muteMask >> 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7328.s") +/** + * Lowers volumes of both bgm players so that sfx can be more pronounced. + * Each sfx channel stores its own bit to lower the volume. + * Only a single channel needs to request this to lower the volume. + */ +void AudioSfx_LowerBgmVolume(u8 channelIndex) { + sSfxChannelLowVolumeFlag |= (1 << channelIndex); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7484.s") + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A75E8.s") +/** + * Clears the flag for the specific channel to lower volume. + * If all flags are cleared, then both bgm players return to full volume + */ +void AudioSfx_RestoreBgmVolume(u8 channelIndex) { + sSfxChannelLowVolumeFlag &= ((1 << channelIndex) ^ 0xFFFF); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7720.s") + if (sSfxChannelLowVolumeFlag == 0) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7794.s") +/** + * The main function to request a sfx. All sfx requests begin here. + */ +void AudioSfx_PlaySfx(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* volume, s8* reverbAdd) { + u8 i; + SfxRequest* reqWrite; + SfxRequest* reqRead; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A7828.s") + if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) { + reqWrite = &sSfxRequests[sSfxRequestWriteIndex]; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A787C.s") + for (i = sSfxRequestReadIndex; sSfxRequestWriteIndex != i; i++) { + reqRead = &sSfxRequests[i]; + if ((reqRead->pos == pos) && (reqRead->sfxId == sfxId)) { + return; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/Audio_IsSfxPlaying.s") + reqWrite->sfxId = sfxId; + reqWrite->pos = pos; + reqWrite->token = token; + reqWrite->freqScale = freqScale; + reqWrite->volume = volume; + reqWrite->reverbAdd = reverbAdd; + sSfxRequestWriteIndex++; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A5BD0/func_801A794C.s") +void AudioSfx_RemoveMatchingRequests(u8 aspect, SfxBankEntry* entry) { + SfxRequest* req; + s32 remove; + u8 i = sSfxRequestReadIndex; + + for (; i != sSfxRequestWriteIndex; i++) { + remove = false; + req = &sSfxRequests[i]; + + switch (aspect) { + case SFX_RM_REQ_BY_BANK: + if (SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(entry->sfxId)) { + remove = true; + } + break; + + case SFX_RM_REQ_BY_POS_AND_BANK: + if ((SFX_BANK_MASK(req->sfxId) == SFX_BANK_MASK(entry->sfxId)) && (&req->pos->x == entry->posX)) { + remove = true; + } + break; + + case SFX_RM_REQ_BY_POS: + if (&req->pos->x == entry->posX) { + remove = true; + } + break; + + case SFX_RM_REQ_BY_POS_AND_ID: + if ((&req->pos->x == entry->posX) && (req->sfxId == entry->sfxId)) { + remove = true; + } + break; + + case SFX_RM_REQ_BY_TOKEN_AND_ID: + if ((req->token == entry->token) && (req->sfxId == entry->sfxId)) { + remove = true; + } + break; + + case SFX_RM_REQ_BY_ID: + if (req->sfxId == entry->sfxId) { + remove = true; + } + break; + + default: + break; + } + + if (remove) { + req->sfxId = 0; + } + } +} + +void AudioSfx_ProcessRequest(void) { + u16 sfxId; + u8 channelCount; + u8 index; + SfxRequest* req = &sSfxRequests[sSfxRequestReadIndex]; + SfxBankEntry* entry; + SfxParams* sfxParams; + s32 bankId; + u8 evictImportance; + u8 evictIndex = 0x80; + + if (req->sfxId == 0) { + return; + } + + bankId = SFX_BANK(req->sfxId); + channelCount = 0; + index = gSfxBanks[bankId][0].next; + + // Compare the sfx request to all sfx bank entries + while ((index != 0xFF) && (index != 0)) { + + // If an existing sfx from the same source exists in the bank, then we should either: + // renew if it is the same sfx, check if any sfx channels are available for that bank, + // interrupt that sfx and replace it with the new sfx request, or drop the new sfx request. + if (gSfxBanks[bankId][index].posX == &req->pos->x) { + + // If the new sfx has equal importance to the existing sfx, + // drop the request if the existing sfx has the "SFX_FLAG_BLOCK_EQUAL_IMPORTANCE" flag. + // Otherwise, keep processing the new sfx request + if ((gSfxParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].params & + SFX_FLAG_BLOCK_EQUAL_IMPORTANCE) && + (gSfxParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].importance == + gSfxBanks[bankId][index].sfxImportance)) { + // Drop the new request + return; + } + + if (gSfxBanks[bankId][index].sfxId == req->sfxId) { + // The new sfx is the same as the existing sfx + // Set channelCount to max value to reprocess the sfx + channelCount = gUsedChannelsPerBank[gSfxChannelLayout][bankId]; + } else { + // Determine which sfx to evict based on importance if there are no more channels available + if (channelCount == 0) { + // If this is the first sfx at the same source, than store the existing sfx info into evict temps + evictIndex = index; + sfxId = gSfxBanks[bankId][index].sfxId & 0xFFFF; + evictImportance = gSfxParams[SFX_BANK_SHIFT(sfxId)][SFX_INDEX(sfxId)].importance; + } else if (gSfxBanks[bankId][index].sfxImportance < evictImportance) { + // If a different existing sfx is at the same source, than update the evict temps if the next + // existing src has lower importance than the previous existing source + evictIndex = index; + sfxId = gSfxBanks[bankId][index].sfxId & 0xFFFF; + evictImportance = gSfxParams[SFX_BANK_SHIFT(sfxId)][SFX_INDEX(sfxId)].importance; + } + + channelCount++; + + // There are no channels available, evict the lowest importance + if (channelCount == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) { + if (gSfxParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].importance >= evictImportance) { + index = evictIndex; + } else { + index = 0; + } + } + } + + // Process this sfx by refreshing or replacing and existing sfx + if (channelCount == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) { + sfxParams = &gSfxParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)]; + + // Interrupt existing sfx and play the new sfx instead. + if ((req->sfxId & SFX_FLAG_MASK) || (sfxParams->flags & SFX_FLAG2_FORCE_RESET) || + (index == evictIndex)) { + + // Restore bgm if the sfx about to be replaced has the right flag + if ((gSfxBanks[bankId][index].sfxParams & SFX_FLAG_LOWER_VOLUME_BGM) && + (gSfxBanks[bankId][index].state != SFX_STATE_QUEUED)) { + AudioSfx_RestoreBgmVolume(gSfxBanks[bankId][index].channelIndex); + } + + gSfxBanks[bankId][index].token = req->token; + gSfxBanks[bankId][index].sfxId = req->sfxId; + gSfxBanks[bankId][index].state = SFX_STATE_QUEUED; + gSfxBanks[bankId][index].freshness = 2; + gSfxBanks[bankId][index].freqScale = req->freqScale; + gSfxBanks[bankId][index].volume = req->volume; + gSfxBanks[bankId][index].reverbAdd = req->reverbAdd; + gSfxBanks[bankId][index].sfxParams = sfxParams->params; + gSfxBanks[bankId][index].sfxFlags = sfxParams->flags; + gSfxBanks[bankId][index].sfxImportance = sfxParams->importance; + } else if (gSfxBanks[bankId][index].state == SFX_STATE_PLAYING_ONE_FRAME) { + // The new sfx is "one-frame" and equals the existing sfx, + // continue playing the "one-frame" sfx by setting "SFX_STATE_PLAYING". + // This will avoid triggering deletion and get "SFX_STATE_REFRESH" + // The state will be set back to "SFX_STATE_PLAYING_ONE_FRAME" at the end of the cycle + gSfxBanks[bankId][index].state = SFX_STATE_PLAYING; + } + // Terminate loop, function is finished (nothing more is processed) + index = 0; + } + } + + if (index != 0) { + index = gSfxBanks[bankId][index].next; + } + } + + if ((gSfxBanks[bankId][sSfxBankFreeListStart[bankId]].next != 0xFF) && (index != 0)) { + // Allocate from free list + index = sSfxBankFreeListStart[bankId]; + + entry = &gSfxBanks[bankId][index]; + entry->posX = &req->pos->x; + entry->posY = &req->pos->y; + entry->posZ = &req->pos->z; + entry->token = req->token; + entry->freqScale = req->freqScale; + entry->volume = req->volume; + entry->reverbAdd = req->reverbAdd; + + sfxParams = &gSfxParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)]; + + entry->sfxParams = sfxParams->params; + entry->sfxFlags = sfxParams->flags; + entry->sfxImportance = sfxParams->importance; + entry->sfxId = req->sfxId; + entry->state = SFX_STATE_QUEUED; + entry->freshness = 2; + entry->prev = sSfxBankListEnd[bankId]; + + gSfxBanks[bankId][sSfxBankListEnd[bankId]].next = sSfxBankFreeListStart[bankId]; + sSfxBankListEnd[bankId] = sSfxBankFreeListStart[bankId]; + sSfxBankFreeListStart[bankId] = gSfxBanks[bankId][sSfxBankFreeListStart[bankId]].next; + gSfxBanks[bankId][sSfxBankFreeListStart[bankId]].prev = 0xFF; + + entry->next = 0xFF; + } +} + +void AudioSfx_RemoveBankEntry(u8 bankId, u8 entryIndex) { + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + u8 i; + + if (entry->sfxParams & SFX_FLAG_LOWER_VOLUME_BGM) { + AudioSfx_RestoreBgmVolume(entry->channelIndex); + } + + if (entryIndex == sSfxBankListEnd[bankId]) { + sSfxBankListEnd[bankId] = entry->prev; + } else { + gSfxBanks[bankId][entry->next].prev = entry->prev; + } + + gSfxBanks[bankId][entry->prev].next = entry->next; + entry->next = sSfxBankFreeListStart[bankId]; + entry->prev = 0xFF; + gSfxBanks[bankId][sSfxBankFreeListStart[bankId]].prev = entryIndex; + sSfxBankFreeListStart[bankId] = entryIndex; + entry->state = SFX_STATE_EMPTY; + + for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) { + if (gActiveSfx[bankId][i].entryIndex == entryIndex) { + gActiveSfx[bankId][i].entryIndex = 0xFF; + i = gChannelsPerBank[gSfxChannelLayout][bankId]; + } + } +} + +void AudioSfx_ChooseActiveSfx(u8 bankId) { + u8 numChosenSfx = 0; + u8 numChannels; + u8 entryIndex; + u8 i; + u8 j; + u8 k; + u8 sfxImportance; + u8 needNewSfx; + u8 chosenEntryIndex; + s32 pad; + SfxBankEntry* entry; + ActiveSfx chosenSfx[MAX_CHANNELS_PER_BANK]; + ActiveSfx* activeSfx; + f32 entryPosY; + f32 entryPosX; + + for (i = 0; i < MAX_CHANNELS_PER_BANK; i++) { + chosenSfx[i].priority = 0x7FFFFFFF; + chosenSfx[i].entryIndex = 0xFF; + } + + entryIndex = gSfxBanks[bankId][0].next; + k = 0; + + // Delete stale sfx and prioritize remaining sfx into the gActiveSfx arrays + while (entryIndex != 0xFF) { + + // Update the freshness for an "all-frame" sfx if it is still queued + if ((gSfxBanks[bankId][entryIndex].state == SFX_STATE_QUEUED) && + (gSfxBanks[bankId][entryIndex].sfxId & SFX_FLAG_MASK)) { + gSfxBanks[bankId][entryIndex].freshness--; + + // If a "one-frame" sfx is still in "SFX_STATE_PLAYING_ONE_FRAME", then remove the sfx + } else if (!(gSfxBanks[bankId][entryIndex].sfxId & SFX_FLAG_MASK) && + (gSfxBanks[bankId][entryIndex].state == SFX_STATE_PLAYING_ONE_FRAME)) { + // CHAN_UPD_SCRIPT_IO (ioPort 0, force stop sfx in seq 0) + AudioThread_QueueCmdS8( + (0x6 << 24) | (SEQ_PLAYER_SFX << 16) | (gSfxBanks[bankId][entryIndex].channelIndex << 8), 0); + AudioSfx_RemoveBankEntry(bankId, entryIndex); + } + + // If a "all-frame" sfx goes 2 frames in the "queued" state + // (because it is too low priority), then remove the sfx + if (gSfxBanks[bankId][entryIndex].freshness == 0) { + AudioSfx_RemoveBankEntry(bankId, entryIndex); + } else if (gSfxBanks[bankId][entryIndex].state != SFX_STATE_EMPTY) { + // process the entry + entry = &gSfxBanks[bankId][entryIndex]; + + // Recompute distSq each frame since the sound's position may have changed + // (later converted into dist) + if (&gSfxDefaultPos.x == entry[0].posX) { + entry->dist = 0.0f; + } else { + entryPosY = *entry->posY * 1; + entryPosX = *entry->posX * 0.5f; + entry->dist = (SQ(entryPosX) + SQ(entryPosY) + SQ(*entry->posZ)) / 10.0f; + } + + // Recompute priority, possibly based on sfx position relative to the camera. + // (Note that the priority is the opposite of importance; lower is more preserved) + sfxImportance = entry->sfxImportance; + + if (entry->sfxParams & SFX_FLAG_PRIORITY_NO_DIST) { + // Priority is independent of distance + entry->priority = SQ(0xFF - sfxImportance) * SQ(76); + } else { + // Priority value increases with distance (more likely to eject) + if (entry->dist > 0x7FFFFFD0) { + // max distance + entry->dist = 0x70000008; + } + + entry->priority = (u32)entry->dist + (SQ(0xFF - sfxImportance) * SQ(76)); + if (*entry->posZ < 0.0f) { + entry->priority += (s32)(-*entry->posZ * 6.0f); + } + } + + // Sfx is too far away, do not consider for chosen sfx + if (entry->dist > SQ(1e5f)) { + + // If too far away and also playing, stop playing + if (entry->state == SFX_STATE_PLAYING) { + // CHAN_UPD_SCRIPT_IO (ioPort 0, force stop sfx in seq 0) + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | (entry->channelIndex << 8), 0); + if (entry->sfxId & SFX_FLAG_MASK) { + AudioSfx_RemoveBankEntry(bankId, entryIndex); + entryIndex = k; + } + } + } else { + // Loop through all channels allocated to a specific bank + // Choose which sfx from gSfxBanks to play + // This includes all sfx requests and sfx already playing + // Sort all current sfx entries in gSfxBanks by priority + // This is where the "active" sfx are chosen + numChannels = gChannelsPerBank[gSfxChannelLayout][bankId]; + + for (i = 0; i < numChannels; i++) { + // Sort all sfx entries by priority + if (chosenSfx[i].priority >= entry->priority) { + // Update the number of sfx to attampt to play + if (numChosenSfx < gChannelsPerBank[gSfxChannelLayout][bankId]) { + numChosenSfx++; + } + + for (j = numChannels - 1; j > i; j--) { + chosenSfx[j].priority = chosenSfx[j - 1].priority; + chosenSfx[j].entryIndex = chosenSfx[j - 1].entryIndex; + } + + chosenSfx[i].priority = entry->priority; + chosenSfx[i].entryIndex = entryIndex; + i = numChannels; // make this the last pass through the loop, here equivalent to "break" + } + } + } + + k = entryIndex; + } + + entryIndex = gSfxBanks[bankId][k].next; + } + + // If a sfx is chosen, update its state + for (i = 0; i < numChosenSfx; i++) { + entry = &gSfxBanks[bankId][chosenSfx[i].entryIndex]; + + if (entry->state == SFX_STATE_QUEUED) { + // sfx is a new entry + entry->state = SFX_STATE_READY; + } else if (entry->state == SFX_STATE_PLAYING) { + // sfx is already playing + entry->state = SFX_STATE_PLAYING_REFRESH; + } + } + + // Apply the chosenSfx to the activeSfx in each channel + numChannels = gChannelsPerBank[gSfxChannelLayout][bankId]; + for (i = 0; i < numChannels; i++) { + needNewSfx = false; + activeSfx = &gActiveSfx[bankId][i]; + + // Check if a sfx is already in the channel + if (activeSfx->entryIndex == 0xFF) { + // No sfx playing in the channel + // Available for use + needNewSfx = true; + } else { + // The channel is already playing a sfx + // Get the entry of the sfx playing + entry = &gSfxBanks[bankId][activeSfx[0].entryIndex]; + + // Check the state of the sfx playing + if (entry->state == SFX_STATE_PLAYING) { + if (entry->sfxId & SFX_FLAG_MASK) { + // For "all-frames" sfx, remove the entry + AudioSfx_RemoveBankEntry(bankId, activeSfx->entryIndex); + } else { + // For "one-frame" sfx, reset the state to queued + entry->state = SFX_STATE_QUEUED; + entry->freshness = 0x80; + } + needNewSfx = true; + } else if (entry->state == SFX_STATE_EMPTY) { + // The sfx already in the channel is empty + // Can replace the sfx + activeSfx->entryIndex = 0xFF; + needNewSfx = true; + } else { + // Sfx is already playing as it should, nothing to do. + for (j = 0; j < numChannels; j++) { + if (activeSfx->entryIndex == chosenSfx[j].entryIndex) { + chosenSfx[j].entryIndex = 0xFF; + j = numChannels; + } + } + + numChosenSfx--; + } + } + + // enter the new sfx into the activeSfx + if (needNewSfx == true) { + for (j = 0; j < numChannels; j++) { + chosenEntryIndex = chosenSfx[j].entryIndex; + if ((chosenEntryIndex != 0xFF) && + (gSfxBanks[bankId][chosenEntryIndex].state != SFX_STATE_PLAYING_REFRESH)) { + for (k = 0; k < numChannels; k++) { + if (chosenEntryIndex == gActiveSfx[bankId][k].entryIndex) { + needNewSfx = false; + k = numChannels; // "break; i.e. force for-loop to end" + } + } + + if (needNewSfx == true) { + activeSfx->entryIndex = chosenEntryIndex; + chosenSfx[j].entryIndex = 0xFF; + j = numChannels + 1; + numChosenSfx--; + } + } + } + if (j == numChannels) { + // nothing found + activeSfx->entryIndex = 0xFF; + } + } + } +} + +void AudioSfx_PlayActiveSfx(u8 bankId) { + u8 entryIndex; + SequenceChannel* channel; + SfxBankEntry* entry; + u8 i; + u8 ioPort5Data; + + for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) { + entryIndex = gActiveSfx[bankId][i].entryIndex; + // If entry is not empty + if (entryIndex != 0xFF) { + entry = &gSfxBanks[bankId][entryIndex]; + channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIndex]; + + if (entry->state == SFX_STATE_READY) { + // Initialize a sfx (new sfx request) + entry->channelIndex = sCurSfxPlayerChannelIndex; + if (entry->sfxParams & SFX_FLAG_LOWER_VOLUME_BGM) { + AudioSfx_LowerBgmVolume(sCurSfxPlayerChannelIndex); + } + + // Add noise that will offset the frequency of the sfx + if ((entry->sfxParams & SFX_PARAM_RAND_FREQ_RAISE_MASK) != (0 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT)) { + switch (entry->sfxParams & SFX_PARAM_RAND_FREQ_RAISE_MASK) { + case (1 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT): + entry->randFreq = AudioThread_NextRandom() & 0xF; + break; + + case (2 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT): + entry->randFreq = AudioThread_NextRandom() & 0x1F; + break; + + case (3 << SFX_PARAM_RAND_FREQ_RAISE_SHIFT): + entry->randFreq = AudioThread_NextRandom() & 0x3F; + break; + + default: + entry->randFreq = 0; + break; + } + } + + // Calculate all the properties of sfx + AudioSfx_SetProperties(bankId, entryIndex, sCurSfxPlayerChannelIndex); + + // CHAN_UPD_SCRIPT_IO (ioPort 0, enable the sfx to play in seq 0) + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((sCurSfxPlayerChannelIndex & 0xFF) << 8), + 1); + + // CHAN_UPD_SCRIPT_IO (ioPort 4, write the lower bits sfx index to seq 0 so it can find the right code + // to execute) + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | + ((sCurSfxPlayerChannelIndex & 0xFF) << 8) | 4, + entry->sfxId & 0xFF); + + // If the sfx bank has more than 255 entries (greater than a u8 can store), + // then store the Id in upper and lower bits + if (gIsLargeSfxBank[bankId]) { + // Store upper bits + ioPort5Data = ((u8)((entry->sfxId & 0x300) >> 7) + (u8)((entry->sfxId & 0xFF) >> 7)); + } else { + ioPort5Data = 0; + } + + if ((entry->sfxParams & SFX_FLAG_8) && (entry->freshness == 0x80)) { + ioPort5Data += 0x80; + } + + if (D_801D6608[bankId]) { + // CHAN_UPD_SCRIPT_IO (ioPort 5, write the upper bits sfx index and a flag to seq 0, for banks with + // > 0xFF entries) + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | + ((sCurSfxPlayerChannelIndex & 0xFF) << 8) | 5, + ioPort5Data); + } + + // Update playing state + if (entry->sfxId & SFX_FLAG_MASK) { + // "all-frames" sfx + entry->state = SFX_STATE_PLAYING; + } else { + // "one-frame" sfx + entry->state = SFX_STATE_PLAYING_ONE_FRAME; + } + } else if ((u8)channel->soundScriptIO[1] == 0xFF) { + // Signal from seq 0 that the sfx is finished playing. Remove entry + AudioSfx_RemoveBankEntry(bankId, entryIndex); + } else if (entry->state == SFX_STATE_PLAYING_REFRESH) { + // Sfx is playing but a refresh is requested + AudioSfx_SetProperties(bankId, entryIndex, sCurSfxPlayerChannelIndex); + + // Update playing state + if (entry->sfxId & SFX_FLAG_MASK) { + // "all-frames" sfx + entry->state = SFX_STATE_PLAYING; + } else { + // "one-frame" sfx + entry->state = SFX_STATE_PLAYING_ONE_FRAME; + } + } + } + + sCurSfxPlayerChannelIndex++; + } +} + +void AudioSfx_StopByBank(u8 bankId) { + SfxBankEntry* entry; + s32 pad; + SfxBankEntry entryToRemove; + u8 entryIndex = gSfxBanks[bankId][0].next; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[bankId][entryIndex]; + if (entry->state >= SFX_STATE_PLAYING_REFRESH) { + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((entry->channelIndex & 0xFF) << 8), 0); + } + + if (entry->state != SFX_STATE_EMPTY) { + AudioSfx_RemoveBankEntry(bankId, entryIndex); + } + entryIndex = gSfxBanks[bankId][0].next; + } + + entryToRemove.sfxId = bankId << 12; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_BANK, &entryToRemove); +} + +void AudioSfx_StopByPosAndBankImpl(u8 bankId, Vec3f* pos) { + SfxBankEntry* entry; + u8 entryIndex = gSfxBanks[bankId][0].next; + u8 prevEntryIndex = 0; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[bankId][entryIndex]; + if (entry->posX == &pos->x) { + if (entry->state >= SFX_STATE_PLAYING_REFRESH) { + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((entry->channelIndex & 0xFF) << 8), 0); + } + + if (entry->state != SFX_STATE_EMPTY) { + AudioSfx_RemoveBankEntry(bankId, entryIndex); + } + } else { + prevEntryIndex = entryIndex; + } + + entryIndex = gSfxBanks[bankId][prevEntryIndex].next; + } +} + +void AudioSfx_StopByPosAndBank(u8 bankId, Vec3f* pos) { + SfxBankEntry entryToRemove; + + AudioSfx_StopByPosAndBankImpl(bankId, pos); + entryToRemove.sfxId = bankId << 12; + entryToRemove.posX = &pos->x; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_POS_AND_BANK, &entryToRemove); +} + +void AudioSfx_StopByPos(Vec3f* pos) { + u8 bankId; + SfxBankEntry entryToRemove; + + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + AudioSfx_StopByPosAndBankImpl(bankId, pos); + } + + entryToRemove.posX = &pos->x; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_POS, &entryToRemove); +} + +void AudioSfx_StopByPosAndId(Vec3f* pos, u16 sfxId) { + SfxBankEntry* entry; + u8 entryIndex = gSfxBanks[SFX_BANK(sfxId)][0].next; + u8 prevEntryIndex = 0; + SfxBankEntry entryToRemove; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[SFX_BANK(sfxId)][entryIndex]; + if ((entry->posX == &pos->x) && (entry->sfxId == sfxId)) { + if (entry->state >= SFX_STATE_PLAYING_REFRESH) { + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((entry->channelIndex & 0xFF) << 8), 0); + } + + if (entry->state != SFX_STATE_EMPTY) { + AudioSfx_RemoveBankEntry(SFX_BANK(sfxId), entryIndex); + } + entryIndex = 0xFF; + } else { + prevEntryIndex = entryIndex; + } + + if (entryIndex != 0xFF) { + entryIndex = gSfxBanks[SFX_BANK(sfxId)][prevEntryIndex].next; + } + } + + entryToRemove.posX = &pos->x; + entryToRemove.sfxId = sfxId; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_POS_AND_ID, &entryToRemove); +} + +void AudioSfx_StopByTokenAndId(u8 token, u16 sfxId) { + SfxBankEntry* entry; + u8 entryIndex = gSfxBanks[SFX_BANK(sfxId)][0].next; + u8 prevEntryIndex = 0; + SfxBankEntry entryToRemove; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[SFX_BANK(sfxId)][entryIndex]; + if ((entry->token == token) && (entry->sfxId == sfxId)) { + if (entry->state >= SFX_STATE_PLAYING_REFRESH) { + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((entry->channelIndex & 0xFF) << 8), 0); + } + + if (entry->state != SFX_STATE_EMPTY) { + AudioSfx_RemoveBankEntry(SFX_BANK(sfxId), entryIndex); + } + } else { + prevEntryIndex = entryIndex; + } + + if (entryIndex != 0xFF) { + entryIndex = gSfxBanks[SFX_BANK(sfxId)][prevEntryIndex].next; + } + } + + entryToRemove.token = token; + entryToRemove.sfxId = sfxId; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_TOKEN_AND_ID, &entryToRemove); +} + +void AudioSfx_StopById(u32 sfxId) { + SfxBankEntry* entry; + u8 entryIndex = gSfxBanks[SFX_BANK(sfxId)][0].next; + u8 prevEntryIndex = 0; + SfxBankEntry entryToRemove; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[SFX_BANK(sfxId)][entryIndex]; + if (entry->sfxId == sfxId) { + if (entry->state >= SFX_STATE_PLAYING_REFRESH) { + AudioThread_QueueCmdS8((0x6 << 24) | (SEQ_PLAYER_SFX << 16) | ((entry->channelIndex & 0xFF) << 8), 0); + } + if (entry->state != SFX_STATE_EMPTY) { + AudioSfx_RemoveBankEntry(SFX_BANK(sfxId), entryIndex); + } + } else { + prevEntryIndex = entryIndex; + } + + entryIndex = gSfxBanks[SFX_BANK(sfxId)][prevEntryIndex].next; + } + + entryToRemove.sfxId = sfxId; + AudioSfx_RemoveMatchingRequests(SFX_RM_REQ_BY_ID, &entryToRemove); +} + +void AudioSfx_ProcessRequests(void) { + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].enabled) { + while (sSfxRequestWriteIndex != sSfxRequestReadIndex) { + AudioSfx_ProcessRequest(); + sSfxRequestReadIndex++; + } + } +} + +/** + * Unused + */ +void AudioSfx_SetBankLerp(u8 bankId, u8 target, u16 delay) { + if (delay == 0) { + delay++; + } + + sSfxBankLerp[bankId].target = target / 127.0f; + sSfxBankLerp[bankId].remainingFrames = delay; + sSfxBankLerp[bankId].step = ((sSfxBankLerp[bankId].value - sSfxBankLerp[bankId].target) / delay); +} + +/** + * Unused + */ +void AudioSfx_StepBankLerp(u8 bankId) { + if (sSfxBankLerp[bankId].remainingFrames != 0) { + sSfxBankLerp[bankId].remainingFrames--; + + if (sSfxBankLerp[bankId].remainingFrames != 0) { + sSfxBankLerp[bankId].value -= sSfxBankLerp[bankId].step; + } else { + sSfxBankLerp[bankId].value = sSfxBankLerp[bankId].target; + } + } +} + +void AudioSfx_ProcessActiveSfx(void) { + u8 bankId; + + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].enabled) { + sCurSfxPlayerChannelIndex = 0; + + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + AudioSfx_ChooseActiveSfx(bankId); + AudioSfx_PlayActiveSfx(bankId); + AudioSfx_StepBankLerp(bankId); + } + } +} + +u8 AudioSfx_IsPlaying(u32 sfxId) { + SfxBankEntry* entry; + u8 entryIndex = gSfxBanks[SFX_BANK(sfxId)][0].next; + + while (entryIndex != 0xFF) { + entry = &gSfxBanks[SFX_BANK(sfxId)][entryIndex]; + if (entry->sfxId == sfxId) { + return true; + } + entryIndex = entry->next; + } + + return false; +} + +void AudioSfx_Reset(void) { + u8 bankId; + u8 i; + u8 entryIndex; + + sSfxRequestWriteIndex = 0; + sSfxRequestReadIndex = 0; + sSfxChannelLowVolumeFlag = 0; + + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + sSfxBankListEnd[bankId] = 0; + sSfxBankFreeListStart[bankId] = 1; + sSfxBankUnused[bankId] = 0; + gSfxBankMuted[bankId] = false; + sSfxBankLerp[bankId].value = 1.0f; + sSfxBankLerp[bankId].remainingFrames = 0; + } + + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + for (i = 0; i < MAX_CHANNELS_PER_BANK; i++) { + gActiveSfx[bankId][i].entryIndex = 0xFF; + } + } + + for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { + gSfxBanks[bankId][0].prev = 0xFF; + gSfxBanks[bankId][0].next = 0xFF; + + for (i = 1; i < sSfxBankSizes[bankId] - 1; i++) { + gSfxBanks[bankId][i].prev = i - 1; + gSfxBanks[bankId][i].next = i + 1; + } + + gSfxBanks[bankId][i].prev = i - 1; + gSfxBanks[bankId][i].next = 0xFF; + } +} diff --git a/src/code/audio/code_801A7B10.c b/src/code/audio/code_801A7B10.c index 6d3faaeab..f2f37a013 100644 --- a/src/code/audio/code_801A7B10.c +++ b/src/code/audio/code_801A7B10.c @@ -1,6 +1,6 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7B10.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D04.s") diff --git a/src/code/audioMgr.c b/src/code/audioMgr.c index ee6014137..ce21bda37 100644 --- a/src/code/audioMgr.c +++ b/src/code/audioMgr.c @@ -78,7 +78,7 @@ void AudioMgr_ThreadEntry(void* arg) { s16* msg = NULL; s32 exit; - func_801A4C30(); + Audio_Init(); AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); func_801A4D00(); osSendMesg(&audioMgr->lockMsgQ, NULL, OS_MESG_BLOCK); diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index 5649ae80c..ee2070610 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -189,7 +189,7 @@ void* gItemIcons[] = { 0x08059000, // ITEM_WALLET_DEFAULT 0x0805A000, // ITEM_WALLET_ADULT 0x0805B000, // ITEM_WALLET_GIANT - 0x0805C000, // ITEM_FISHING_POLE + 0x0805C000, // ITEM_FISHING_ROD 0x0805D000, // ITEM_REMAINS_ODOLWA 0x0805E000, // ITEM_REMAINS_GOHT 0x0805F000, // ITEM_REMAINS_GYORG diff --git a/src/code/code_80172BC0.c b/src/code/code_80172BC0.c index 2ea9e6c67..94b55d4df 100644 --- a/src/code/code_80172BC0.c +++ b/src/code/code_80172BC0.c @@ -9,7 +9,7 @@ void AudioMgr_StopAllSfxExceptSystem(void) { for (bankIdPtr = sSfxBankIds; bankIdPtr < (sSfxBankIds + ARRAY_COUNT(sSfxBankIds)); bankIdPtr++) { if (*bankIdPtr != BANK_SYSTEM) { - func_801A7084(*bankIdPtr); + AudioSfx_StopByBank(*bankIdPtr); } } } diff --git a/src/code/graph.c b/src/code/graph.c index f625cb7b6..481aa1da0 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "system_malloc.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 862463b76..020edcf27 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -2,6 +2,74 @@ #include "system_malloc.h" #include "z64load.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_LoadGameState.s") +void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { + void* vramStart; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_FreeGameState.s") + if (overlayEntry->loadedRamAddr != NULL) { + return; + } + vramStart = overlayEntry->vramStart; + if (vramStart == NULL) { + overlayEntry->unk_28 = 0; + return; + } + overlayEntry->loadedRamAddr = Load2_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd, + (uintptr_t)vramStart, (uintptr_t)overlayEntry->vramEnd); + if (overlayEntry->loadedRamAddr != NULL) { + + overlayEntry->unk_14 = (uintptr_t)( + (overlayEntry->unk_14 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_14 - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->init = + (uintptr_t)((overlayEntry->init != NULL) + ? (void*)((uintptr_t)overlayEntry->init - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->destroy = (uintptr_t)( + (overlayEntry->destroy != NULL) + ? (void*)((uintptr_t)overlayEntry->destroy - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->unk_20 = (uintptr_t)( + (overlayEntry->unk_20 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_20 - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->unk_24 = (uintptr_t)( + (overlayEntry->unk_24 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_24 - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + + overlayEntry->unk_28 = 0; + } +} + +void Overlay_FreeGameState(GameStateOverlay* overlayEntry) { + s32 var_v0; + + if (overlayEntry->loadedRamAddr != NULL) { + var_v0 = overlayEntry->unk_28 != 0 ? -1 : 0; + if (var_v0 == 0) { + overlayEntry->unk_14 = (uintptr_t)( + (overlayEntry->unk_14 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_14 + (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->init = (uintptr_t)( + (overlayEntry->init != NULL) + ? (void*)((uintptr_t)overlayEntry->init + (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->destroy = (uintptr_t)( + (overlayEntry->destroy != NULL) + ? (void*)((uintptr_t)overlayEntry->destroy + (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->unk_20 = (uintptr_t)( + (overlayEntry->unk_20 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_20 + (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + overlayEntry->unk_24 = (uintptr_t)( + (overlayEntry->unk_24 != NULL) + ? (void*)((uintptr_t)overlayEntry->unk_24 + (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); + SystemArena_Free(overlayEntry->loadedRamAddr); + overlayEntry->loadedRamAddr = NULL; + } + } +} diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 79bc911f6..3d50f9c7b 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -391,13 +391,9 @@ void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) { } } -void Actor_GetProjectedPos(PlayState* play, Vec3f* arg1, Vec3f* arg2, f32* arg3) { - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, arg2, arg3); - if (*arg3 < 1.0f) { - *arg3 = 1.0f; - } else { - *arg3 = 1.0f / *arg3; - } +void Actor_GetProjectedPos(PlayState* play, Vec3f* worldPos, Vec3f* projectedPos, f32* invW) { + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, worldPos, projectedPos, invW); + *invW = (*invW < 1.0f) ? 1.0f : (1.0f / *invW); } void Target_SetPos(TargetContext* targetCtx, s32 index, f32 x, f32 y, f32 z) { @@ -419,7 +415,7 @@ TatlColor sTatlColorList[] = { { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 255, 255, 0, 255 }, { 200, 155, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, - { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } } + { { 0, 255, 0, 255 }, { 0, 255, 0, 0 } }, }; void func_800B4F78(TargetContext* targetCtx, s32 type, PlayState* play) { @@ -480,9 +476,9 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { TargetContextEntry* entry; s16 alpha = 255; f32 var1 = 1.0f; - Vec3f spBC; + Vec3f projectedPos; s32 spB8; - f32 spB4; + f32 invW; s32 spB0; s32 spAC; f32 var2; @@ -505,22 +501,22 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { alpha = targetCtx->unk48; } - Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &spBC, &spB4); + Actor_GetProjectedPos(play, &targetCtx->targetCenterPos, &projectedPos, &invW); - spBC.x = (160 * (spBC.x * spB4)) * var1; - spBC.x = CLAMP(spBC.x, -320.0f, 320.0f); + projectedPos.x = ((SCREEN_WIDTH / 2) * (projectedPos.x * invW)) * var1; + projectedPos.x = CLAMP(projectedPos.x, -SCREEN_WIDTH, SCREEN_WIDTH); - spBC.y = (120 * (spBC.y * spB4)) * var1; - spBC.y = CLAMP(spBC.y, -240.0f, 240.0f); + projectedPos.y = ((SCREEN_HEIGHT / 2) * (projectedPos.y * invW)) * var1; + projectedPos.y = CLAMP(projectedPos.y, -SCREEN_HEIGHT, SCREEN_HEIGHT); - spBC.z = spBC.z * var1; + projectedPos.z = projectedPos.z * var1; targetCtx->unk4C--; if (targetCtx->unk4C < 0) { targetCtx->unk4C = 2; } - Target_SetPos(targetCtx, targetCtx->unk4C, spBC.x, spBC.y, spBC.z); + Target_SetPos(targetCtx, targetCtx->unk4C, projectedPos.x, projectedPos.y, projectedPos.z); if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_730)) { OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39); @@ -588,8 +584,8 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS PlayState* play = (PlayState*)gameState; Actor* sp68 = NULL; s32 category; - Vec3f sp58; - f32 sp54; + Vec3f projectedPos; + f32 invW; if ((player->unk_730 != 0) && (player->unk_AE3[player->unk_ADE] == 2)) { targetCtx->unk_94 = NULL; @@ -641,8 +637,9 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS } if (actor != NULL && targetCtx->unk4B == 0) { - Actor_GetProjectedPos(play, &actor->focus.pos, &sp58, &sp54); - if ((sp58.z <= 0.0f) || (fabsf(sp58.x * sp54) >= 1.0f) || (fabsf(sp58.y * sp54) >= 1.0f)) { + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); + if ((projectedPos.z <= 0.0f) || (fabsf(projectedPos.x * invW) >= 1.0f) || + (fabsf(projectedPos.y * invW) >= 1.0f)) { actor = NULL; } } @@ -1853,10 +1850,10 @@ s32 Actor_ProcessTalkRequest(Actor* actor, GameState* gameState) { // Actor_PickUpExchange? Seems to be called with exchangeItemId -1 if the same actor used Actor_PickUp // This function is also used to toggle the "Speak" action on the A button -s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 exchangeItemId) { +s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, PlayerActionParam exchangeItemId) { Player* player = GET_PLAYER(play); - if ((player->actor.flags & ACTOR_FLAG_100) || ((exchangeItemId > EXCH_ITEM_NONE) && Player_InCsMode(play)) || + if ((player->actor.flags & ACTOR_FLAG_100) || ((exchangeItemId > PLAYER_AP_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && ((fabsf(actor->playerHeightRel) > fabsf(yRange)) || ((actor->xzDistToPlayer > player->targetActorDistance)) || (xzRange < actor->xzDistToPlayer)))) { @@ -1871,12 +1868,12 @@ s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 ex return true; } -s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, s32 exchangeItemId) { +s32 func_800B85E0(Actor* actor, PlayState* play, f32 radius, PlayerActionParam exchangeItemId) { return func_800B8500(actor, play, radius, radius, exchangeItemId); } s32 func_800B8614(Actor* actor, PlayState* play, f32 radius) { - return func_800B85E0(actor, play, radius, EXCH_ITEM_NONE); + return func_800B85E0(actor, play, radius, PLAYER_AP_NONE); } s32 func_800B863C(Actor* actor, PlayState* play) { @@ -1963,21 +1960,23 @@ s32 func_800B886C(Actor* actor, PlayState* play) { void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { Vec3f projectedPos; - f32 w; + f32 invW; - Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &w); - *x = (projectedPos.x * w * (SCREEN_WIDTH / 2)) + (SCREEN_WIDTH / 2); - *y = (projectedPos.y * w * -(SCREEN_HEIGHT / 2)) + (SCREEN_HEIGHT / 2); + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); + + *x = PROJECTED_TO_SCREEN_X(projectedPos, invW); + *y = PROJECTED_TO_SCREEN_Y(projectedPos, invW); } -s32 func_800B8934(PlayState* play, Actor* actor) { - Vec3f sp2C; - f32 sp28; +s32 Actor_OnScreen(PlayState* play, Actor* actor) { + Vec3f projectedPos; + f32 invW; s32 pad[2]; - Actor_GetProjectedPos(play, &actor->focus.pos, &sp2C, &sp28); + Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); - return (sp2C.x * sp28 >= -1.0f) && (sp2C.x * sp28 <= 1.0f) && (sp2C.y * sp28 >= -1.0f) && (sp2C.y * sp28 <= 1.0f); + return (projectedPos.x * invW >= -1.0f) && (projectedPos.x * invW <= 1.0f) && (projectedPos.y * invW >= -1.0f) && + (projectedPos.y * invW <= 1.0f); } s32 Actor_HasParent(Actor* actor, PlayState* play) { @@ -2128,7 +2127,8 @@ void func_800B8E58(Player* player, u16 sfxId) { if (player->currentMask == PLAYER_MASK_GIANT) { func_8019F170(&player->actor.projectedPos, sfxId); } else { - Audio_PlaySfxGeneral(sfxId, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); + AudioSfx_PlaySfx(sfxId, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } @@ -2568,13 +2568,14 @@ void func_800B9D1C(Actor* actor) { if (sfxId != 0) { if (actor->audioFlags & 2) { - Audio_PlaySfxGeneral(sfxId, &actor->projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); + AudioSfx_PlaySfx(sfxId, &actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultReverb); } else if (actor->audioFlags & 4) { play_sound(sfxId); } else if (actor->audioFlags & 8) { func_8019F128(sfxId); } else if (actor->audioFlags & 0x10) { - func_801A0810(&D_801DB4A4, NA_SE_SY_TIMER - SFX_FLAG, (sfxId - 1)); + func_801A0810(&gSfxDefaultPos, NA_SE_SY_TIMER - SFX_FLAG, (sfxId - 1)); } else if (actor->audioFlags & 1) { Audio_PlaySfxAtPos(&actor->projectedPos, sfxId); } @@ -3153,10 +3154,10 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { overlayEntry->numLoaded = 0; } - actorInit = - (uintptr_t)((overlayEntry->initInfo != NULL) - ? (void*)(-OVERLAY_RELOCATION_OFFSET(overlayEntry) + (uintptr_t)overlayEntry->initInfo) - : NULL); + actorInit = (uintptr_t)( + (overlayEntry->initInfo != NULL) + ? (void*)((uintptr_t)overlayEntry->initInfo - (intptr_t)OVERLAY_RELOCATION_OFFSET(overlayEntry)) + : NULL); } return actorInit; @@ -3339,7 +3340,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { actorCtx->targetContext.bgmEnemy = NULL; } - Audio_StopSfxByPos(&actor->projectedPos); + AudioSfx_StopByPos(&actor->projectedPos); Actor_Destroy(actor, play); newHead = Actor_RemoveFromCategory(play, actorCtx, actor); @@ -4057,7 +4058,7 @@ s32 func_800BD2B4(PlayState* play, Actor* actor, s16* arg2, f32 arg3, u16 (*text } else if (*arg2) { *arg2 = arg5(play, actor); return false; - } else if (!func_800B8934(play, actor)) { + } else if (!Actor_OnScreen(play, actor)) { return false; } else if (!func_800B8614(actor, play, arg3)) { return false; @@ -4292,18 +4293,18 @@ s16 func_800BDB6C(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { return arg2; } -void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animation, s32 index) { +void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 animIndex) { f32 frameCount; - animation += index; - if (animation->frameCount > 0.0f) { - frameCount = animation->frameCount; + animationInfo += animIndex; + if (animationInfo->frameCount > 0.0f) { + frameCount = animationInfo->frameCount; } else { - frameCount = Animation_GetLastFrame(&animation->animation->common); + frameCount = Animation_GetLastFrame(&animationInfo->animation->common); } - Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, frameCount, - animation->mode, animation->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + frameCount, animationInfo->mode, animationInfo->morphFrames); } // Unused @@ -4543,7 +4544,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0, (gameplayFrames * 2) & 0xFF, 64, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); effectAlphaScaled = effectAlpha * 255.0f; @@ -4574,7 +4575,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gFrozenIceVtxDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); } limbPos = limbPosStart; // reset limbPos @@ -4654,7 +4655,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16 gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } break; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 63a06b512..027b78a4a 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,42 +1,243 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_fabsf.s") +/** + * Returns the absolute value for floats + */ +f32 Camera_fabsf(f32 f) { + return ABS(f); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_LengthVec3f.s") +/** + * Returns the magnitude for 3D float vectors + */ +f32 Camera_Vec3fMagnitude(Vec3f* vec) { + return sqrtf(SQ(vec->x) + SQ(vec->y) + SQ(vec->z)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB270.s") +/** + * Interpolates along the curve shown below + * returns value y ranging from 0.0f to 1.0f for -xMax <= x <= xMax + * returns 1.0f otherwise + * + * y = 1.0f ________ _________ + * __ __ + * _ _ + * y axis _ _ + * ___ ___ + * _____ + * y = 0.0f | | | + * -xMax 0 xMax + * + * x axis + */ +f32 Camera_QuadraticAttenuation(f32 xRange, f32 x) { + f32 y; + f32 absX; + f32 percent40 = 0.4f; + f32 percent60; + f32 xQuadratic; + f32 xMaxQuadratic; // Normalizing constant -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_Lerpf.s") + absX = Camera_fabsf(x); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_Lerps.s") + if (absX > xRange) { + // fixed value outside xMax range + y = 1.0f; + } else { + // inside xMax range + percent60 = 1.0f - percent40; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB42C.s") + if (absX < (xRange * percent60)) { + // quadratic curve in the inner 60% of xMax range: +concavity (upward curve) + xQuadratic = SQ(x) * (1.0f - percent40); + xMaxQuadratic = SQ(xRange * percent60); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_LerpVec3f.s") + y = xQuadratic / xMaxQuadratic; + } else { + // quadratic curve in the outer 40% of xMax range: -concavity (flattening curve) + xQuadratic = SQ(xRange - absX) * percent40; + xMaxQuadratic = SQ(0.4f * xRange); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB544.s") + y = 1.0f - (xQuadratic / xMaxQuadratic); + } + } + return y; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB584.s") +/* + * Performs linear interpoloation between `cur` and `target`. If `cur` is within + * `minDiff` units, the result is rounded up to `target` + */ +f32 Camera_LerpCeilF(f32 target, f32 cur, f32 stepScale, f32 minDiff) { + f32 diff = target - cur; + f32 step = diff * stepScale; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB5DC.s") + return (Camera_fabsf(diff) >= minDiff) ? cur + step : target; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB60C.s") +/* + * Performs linear interpoloation between `cur` and `target`. If `cur` is within + * `minDiff` units, the result is rounded up to `target` + */ +s16 Camera_LerpCeilS(s16 target, s16 cur, f32 stepScale, s16 minDiff) { + s16 diff = target - cur; + s16 step = diff * stepScale + 0.5f; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB674.s") + return (ABS(diff) >= minDiff) ? cur + step : target; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB6C8.s") +/* + * Performs linear interpoloation between `cur` and `target`. If `cur` is within + * `minDiff` units, the result is rounded down to `cur` + */ +s16 Camera_LerpFloorS(s16 target, s16 cur, f32 stepScale, s16 minDiff) { + s16 diff = target - cur; + s16 step = diff * stepScale + 0.5f; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB700.s") + return (ABS(diff) >= minDiff) ? cur + step : cur; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB780.s") +/* + * Performs linear interpoloation between `cur` and `target`. If `cur` is within + * `minDiff` units, the result is rounded up to `target`. Output is written to `cur` + */ +void Camera_LerpCeilVec3f(Vec3f* target, Vec3f* cur, f32 xzStepScale, f32 yStepScale, f32 minDiff) { + cur->x = Camera_LerpCeilF(target->x, cur->x, xzStepScale, minDiff); + cur->y = Camera_LerpCeilF(target->y, cur->y, yStepScale, minDiff); + cur->z = Camera_LerpCeilF(target->z, cur->z, xzStepScale, minDiff); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB7CC.s") +void Camera_SetUpdateRatesFastPitch(Camera* camera) { + camera->yawUpdateRateInv = 100.0f; + camera->pitchUpdateRateInv = 16.0f; + camera->rUpdateRateInv = 20.0f; + camera->yOffsetUpdateRate = 0.05f; + camera->xzOffsetUpdateRate = 0.05f; + camera->fovUpdateRate = 0.05f; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB7F8.s") +void Camera_SetUpdateRatesFastYaw(Camera* camera) { + camera->rUpdateRateInv = 50.0f; + camera->pitchUpdateRateInv = 100.0f; + camera->yawUpdateRateInv = 50.0f; + camera->yOffsetUpdateRate = 0.01f; + camera->xzOffsetUpdateRate = 0.1f; + camera->fovUpdateRate = 0.01f; + if (camera->speedRatio > 1.0f) { + camera->speedRatio = 1.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB828.s") +void Camera_SetUpdateRatesSlow(Camera* camera) { + camera->rUpdateRateInv = 1800.0f; + camera->yawUpdateRateInv = 1800.0f; + camera->pitchUpdateRateInv = 1800.0f; + camera->yOffsetUpdateRate = 0.01; + camera->xzOffsetUpdateRate = 0.01; + camera->fovUpdateRate = 0.01; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB854.s") +/** + * Converts a 3D s16 vector into a 3D f32 vector + */ +Vec3f* Camera_Vec3sToVec3f(Vec3f* dest, Vec3s* src) { + Vec3f copy; + + copy.x = src->x; + copy.y = src->y; + copy.z = src->z; + + *dest = copy; + return dest; +} + +/** + * Returns the difference between two angles and scales the difference up + */ +s16 Camera_AngleDiffAndScale(s16 angle1, s16 angle2, f32 scale) { + return BINANG_SUB(angle1, angle2) * scale; +} + +/** + * Calculates the current offset between the camera's at-coordinates and the centered actor's coordinates + */ +void Camera_UpdateAtActorOffset(Camera* camera, Vec3f* actorOffset) { + camera->atActorOffset.x = camera->at.x - actorOffset->x; + camera->atActorOffset.y = camera->at.y - actorOffset->y; + camera->atActorOffset.z = camera->at.z - actorOffset->z; +} + +f32 Camera_GetFocalActorHeight(Camera* camera) { + PosRot actorFocus; + Actor* focalActor = camera->focalActor; + f32 focalHeight; + + if (focalActor == &GET_PLAYER(camera->play)->actor) { + focalHeight = Player_GetHeight((Player*)focalActor); + } else { + Actor_GetFocus(&actorFocus, focalActor); + focalHeight = actorFocus.pos.y - camera->focalActorPosRot.pos.y; + if (focalHeight == 0.0f) { + focalHeight = 10.0f; + } + } + return focalHeight; +} + +f32 Camera_GetRunSpeedLimit(Camera* camera) { + Actor* focalActor = camera->focalActor; + f32 runSpeedLimit; + + if (focalActor == &GET_PLAYER(camera->play)->actor) { + runSpeedLimit = Player_GetRunSpeedLimit((Player*)focalActor); + } else { + runSpeedLimit = 10.0f; + } + + return runSpeedLimit; +} + +s32 func_800CB7CC(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_10; + } else { + return 0; + } +} +s32 Camera_IsMountedOnHorse(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_800000; + } else { + return 0; + } +} + +s32 Camera_IsDekuHovering(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_2000; + } else { + return 0; + } +} + +/** + * When walking in a cutscene? Used during Postman's minigame. + */ +s32 func_800CB854(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_20; + } else { + return 0; + } +} s32 Camera_IsSwimming(Camera* camera) { Actor* focalActor = camera->focalActor; @@ -55,31 +256,184 @@ s32 Camera_IsSwimming(Camera* camera) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB8C8.s") +s32 Camera_IsDiving(Camera* camera) { + Actor* focalActor = camera->focalActor; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB8F4.s") + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags2 & PLAYER_STATE2_800; + } else { + return 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB924.s") +s32 Camera_IsPlayerFormZora(Camera* camera) { + Actor* focalActor = camera->focalActor; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CB950.s") + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->transformation == PLAYER_FORM_ZORA; + } else { + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBA08.s") +s32 func_800CB924(Camera* camera) { + Actor* focalActor = camera->focalActor; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBA34.s") + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_1000; + } else { + return 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBA7C.s") +s32 func_800CB950(Camera* camera) { + Player* player; + s32 phi_v0; + s32 ret; + f32 yDiff; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBAAC.s") + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + yDiff = Camera_fabsf(camera->focalActorPosRot.pos.y - camera->playerFloorHeight); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBAD4.s") + phi_v0 = false; + if (yDiff < 11.0f) { + phi_v0 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBB58.s") + ret = phi_v0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBB88.s") + if (!ret) { -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBC00.s") + ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBC30.s") + if (camera->focalActor->gravity > -0.1f) { + ret = true; + } + + player = (Player*)camera->focalActor; + if (!ret) { + // Using zora fins + ret = player->stateFlags1 & PLAYER_STATE1_200000; + ret = !!ret; + } + } + return ret; + } else { + return true; + } +} + +s32 Camera_IsClimbingLedge(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_4; + } else { + return 0; + } +} + +s32 Camera_IsChargingSwordOrDekuFlowerDive(Camera* camera) { + Actor* focalActor = camera->focalActor; + s32 ret; + + if (focalActor == &GET_PLAYER(camera->play)->actor) { + // Charging Sword + ret = !!(((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_1000); + if (!ret) { + // Deku Flower Dive + ret = !!(((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_100); + } + return ret; + } else { + return false; + } +} + +s32 func_800CBA7C(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags2 & PLAYER_STATE2_800000; + } else { + return 0; + } +} + +s32 func_800CBAAC(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->meleeWeaponState; + } else { + return 0; + } +} + +s32 Camera_GetFocalActorPos(Vec3f* dst, Camera* camera) { + PosRot focalPosRot; + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + *dst = ((Player*)focalActor)->bodyPartsPos[0]; + return dst; + } else { + Actor_GetWorldPosShapeRot(&focalPosRot, camera->focalActor); + *dst = focalPosRot.pos; + return dst; + } +} + +s32 Camera_IsUnderwaterAsZora(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->currentBoots == PLAYER_BOOTS_ZORA_UNDERWATER; + } else { + return 0; + } +} + +/** + * Evaluate if player is in one of two sword animations + */ +s32 func_800CBB88(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + if ((((Player*)focalActor)->meleeWeaponState != 0) && + (((Player*)focalActor)->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_BUTT)) { + return 3; + } + + if ((((Player*)focalActor)->stateFlags2 & PLAYER_STATE2_20000) || + ((((Player*)focalActor)->meleeWeaponState != 0) && + (((Player*)focalActor)->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_KICK))) { + return 1; + } + } + + return 0; +} + +s32 Camera_IsUsingZoraFins(Camera* camera) { + Actor* focalActor = camera->focalActor; + + if (camera->focalActor == &GET_PLAYER(camera->play)->actor) { + return ((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_200000; + } else { + return 0; + } +} + +s32 func_800CBC30(Camera* camera, f32 waterYMax, f32 waterYMin) { + if ((camera->playerFloorHeight != camera->waterYPos) && (camera->waterYPos < waterYMax) && + (camera->waterYPos > waterYMin)) { + return true; + } else { + return false; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800CBC84.s") @@ -372,9 +726,9 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE0E0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE0EC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_InitPlayerSettings.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE308.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeStatus.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DE324.s") @@ -416,7 +770,7 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_AddQuake.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFD78.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetViewParam.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFEF0.s") @@ -432,7 +786,7 @@ s32 Camera_GetWaterBoxBgCamSetting(Camera* camera, f32* waterY) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeDoorCam.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E007C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_Copy.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E01AC.s") diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 383f8928a..8923669a7 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -256,8 +256,7 @@ void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* } break; case 0x13: - // AudioOcarina_PlayLongScarecrowAfterCredits - func_8019D758(); + AudioOcarina_PlayLongScarecrowAfterCredits(); csCtx->frames = cmd->startFrame - 1; break; case 0x14: @@ -291,7 +290,7 @@ void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* break; case 0x1B: if (isStartFrame) { - play->nextEntranceIndex = 0x1C00; + play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.nextCutsceneIndex = 0xFFF8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -489,6 +488,7 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { } } #else +void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd); #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EADB0.s") #endif @@ -570,7 +570,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* gSaveContext.save.cutscene = 0; if (cmd->base == 1) { - play->nextEntranceIndex = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntranceIndex; + play->nextEntrance = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntrance; gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; if (gSaveContext.gameMode != 1) { @@ -583,11 +583,11 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* play->transitionType = TRANS_TYPE_04; } - if ((play->nextEntranceIndex & 0xF) > 0) { - gSaveContext.nextCutsceneIndex = (play->nextEntranceIndex & 0xF) + 0xFFEF; + if ((play->nextEntrance & 0xF) > 0) { + gSaveContext.nextCutsceneIndex = (play->nextEntrance & 0xF) + 0xFFEF; } - play->nextEntranceIndex &= ~0xF; + play->nextEntrance &= ~0xF; } } @@ -604,11 +604,11 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB switch (D_801F4DE2) { case 0x1F: if (gSaveContext.save.weekEventReg[20] & 2) { - play->nextEntranceIndex = 0x3010; + play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; } else { - play->nextEntranceIndex = 0x8600; + play->nextEntrance = ENTRANCE(WOODFALL, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -617,11 +617,11 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB case 0x44: if (gSaveContext.save.weekEventReg[33] & 0x80) { - play->nextEntranceIndex = 0xAE70; + play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; } else { - play->nextEntranceIndex = 0xAE00; + play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -630,7 +630,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB case 0x5F: gSaveContext.save.weekEventReg[55] |= 0x80; - play->nextEntranceIndex = 0x6A80; + play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -638,7 +638,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB case 0x36: gSaveContext.save.weekEventReg[52] |= 0x20; - play->nextEntranceIndex = 0x2000; + play->nextEntrance = ENTRANCE(IKANA_CANYON, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -659,12 +659,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 2: if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { - // Milk bar - play->nextEntranceIndex = 0x2400; + play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C00; + play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -672,12 +670,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 3: if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { - // Fairy's fountain - play->nextEntranceIndex = 0x4600; + play->nextEntrance = ENTRANCE(FAIRY_FOUNTAIN, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C10; + play->nextEntrance = ENTRANCE(CUTSCENE, 1); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -685,12 +681,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 4: if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) { - // Romani ranch - play->nextEntranceIndex = 0x6400; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C20; + play->nextEntrance = ENTRANCE(CUTSCENE, 2); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -698,12 +692,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 5: if (INV_CONTENT(ITEM_MASK_BLAST) == ITEM_MASK_BLAST) { - // West clock town - play->nextEntranceIndex = 0xD400; + play->nextEntrance = ENTRANCE(WEST_CLOCK_TOWN, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C30; + play->nextEntrance = ENTRANCE(CUTSCENE, 3); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -711,12 +703,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 6: if (INV_CONTENT(ITEM_MASK_CIRCUS_LEADER) == ITEM_MASK_CIRCUS_LEADER) { - // Milk bar - play->nextEntranceIndex = 0x2400; + play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C50; + play->nextEntrance = ENTRANCE(CUTSCENE, 5); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -724,32 +714,27 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 7: if (INV_CONTENT(ITEM_MASK_BREMEN) == ITEM_MASK_BREMEN) { - // Milk bar - play->nextEntranceIndex = 0x2400; + play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C60; + play->nextEntrance = ENTRANCE(CUTSCENE, 6); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; break; case 8: - // Ikana canyon - play->nextEntranceIndex = 0x2000; + play->nextEntrance = ENTRANCE(IKANA_CANYON, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; play->transitionTrigger = TRANS_TRIGGER_START; break; case 9: if (INV_CONTENT(ITEM_MASK_COUPLE) == ITEM_MASK_COUPLE) { - // Termina field - play->nextEntranceIndex = 0x5400; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); gSaveContext.nextCutsceneIndex = 0xFFF8; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C70; + play->nextEntrance = ENTRANCE(CUTSCENE, 7); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -757,12 +742,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 10: if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { - // Cucco shack - play->nextEntranceIndex = 0x7E00; + play->nextEntrance = ENTRANCE(CUCCO_SHACK, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C40; + play->nextEntrance = ENTRANCE(CUTSCENE, 4); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -770,12 +753,10 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt case 11: if (INV_CONTENT(ITEM_MASK_POSTMAN) == ITEM_MASK_POSTMAN) { - // Termina field - play->nextEntranceIndex = 0x5410; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1); gSaveContext.nextCutsceneIndex = 0xFFF8; } else { - // SPOT00 - play->nextEntranceIndex = 0x1C80; + play->nextEntrance = ENTRANCE(CUTSCENE, 8); gSaveContext.nextCutsceneIndex = 0xFFF9; } play->transitionTrigger = TRANS_TRIGGER_START; @@ -1131,8 +1112,6 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { } } -#ifdef NON_MATCHING -// Some stack issues, and a few instructions in the "wrong" places /** * Loops over the cutscene data itself (`cutscenePtr`), applying the effects of each command instantaneously (for most * commands). @@ -1161,14 +1140,13 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { */ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { s32 i; - s16 phi_s0; - s32 totalEntries; s32 j; - u32 cmdType; // sp5C s32 pad; - s32 cmdEntries; // sp58 - s32 cutsceneEndFrame; // sp50 - s16 phi_s0_23; + s32 totalEntries; + u32 cmdType; + s32 cmdEntries; + s32 pad2; + s32 cutsceneEndFrame; CsCmdBase* cmd; // Read the command list count and the ending frame for this cutscene @@ -1197,14 +1175,14 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc // Check special cases of command types. This are generic ActorActions // Ranges: [0x64, 0x96), 0xC9, [0x1C2, 0x258) if (((cmdType >= 100) && (cmdType < 150)) || (cmdType == 201) || ((cmdType >= 450) && (cmdType < 600))) { - for (phi_s0 = 0; phi_s0 < ARRAY_COUNT(D_801F4DC8); phi_s0++) { - if ((u16)cmdType == D_801F4DC8[phi_s0]) { - func_800ECD7C(csCtx, &cutscenePtr, phi_s0); + for (j = 0; j < ARRAY_COUNT(D_801F4DC8); j = (s16)(j + 1)) { + if (D_801F4DC8[j] == (u16)cmdType) { + func_800ECD7C(csCtx, &cutscenePtr, j); cmdType = -2; break; - } else if (D_801F4DC8[phi_s0] == 0) { - D_801F4DC8[phi_s0] = cmdType; - func_800ECD7C(csCtx, &cutscenePtr, phi_s0); + } else if (D_801F4DC8[j] == 0) { + D_801F4DC8[j] = cmdType; + func_800ECD7C(csCtx, &cutscenePtr, j); cmdType = -2; break; } @@ -1334,15 +1312,15 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { - csCtx->playerAction = (CsCmdActorAction*)cutscenePtr; + if ((cmd->startFrame <= csCtx->frames) && (csCtx->frames < cmd->endFrame)) { + csCtx->playerAction = (CsCmdActorAction*)cmd; } cutscenePtr += sizeof(CsCmdActorAction); } break; case CS_CMD_CAMERA: - cutscenePtr = &cutscenePtr[Cutscene_Command_Camera(play, cutscenePtr)]; + cutscenePtr += Cutscene_Command_Camera(play, cutscenePtr); break; case CS_CMD_TERMINATOR: @@ -1369,7 +1347,7 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; if (cmd->base != 0xFFFF) { - Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cutscenePtr); + Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cmd); } cutscenePtr += sizeof(CsCmdTextbox); } @@ -1415,10 +1393,6 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc } } } -#else -void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/Cutscene_ProcessCommands.s") -#endif /* End of command handling section */ @@ -1529,7 +1503,7 @@ void func_800EDBE0(PlayState* play) { if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { sp24 = play->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { - if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entranceIndex) + + if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex)) & 0x4000) != 0) { func_80151A68(play, sp24->titleTextId); diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 422bb401e..ea8a546d6 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -59,11 +59,11 @@ EffectSs* EffectSS_GetTable() { void EffectSS_Delete(EffectSs* effectSs) { if (effectSs->flags & 2) { - Audio_StopSfxByPos(&effectSs->pos); + AudioSfx_StopByPos(&effectSs->pos); } if (effectSs->flags & 4) { - Audio_StopSfxByPos(&effectSs->vec); + AudioSfx_StopByPos(&effectSs->vec); } EffectSS_ResetEntry(effectSs); @@ -188,8 +188,9 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initData) { Load2_LoadOverlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, entry->loadedRamAddr); } - initInfo = (uintptr_t)( - (entry->initInfo != NULL) ? (void*)(-OVERLAY_RELOCATION_OFFSET(entry) + (uintptr_t)entry->initInfo) : NULL); + initInfo = (uintptr_t)((entry->initInfo != NULL) + ? (void*)((uintptr_t)entry->initInfo - (intptr_t)OVERLAY_RELOCATION_OFFSET(entry)) + : NULL); } if (initInfo->init != NULL) { diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index b6a5c46fa..5258c2ecf 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -659,15 +659,15 @@ void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3 * param determines where the ligntning should go * 0: dont attach to any actor. spawns at the position specified by pos * 1: spawn at one of Player's body parts, chosen at random - * 2: spawn at one of Phantom Ganon's body parts, chosen at random + * 2 - 6: spawn at one of Goht's body parts */ -void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) { +void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params) { EffectSsFhgFlashInitParams initParams; initParams.actor = actor; Math_Vec3f_Copy(&initParams.pos, pos); initParams.scale = scale; - initParams.param = param; + initParams.params = params; initParams.type = FHGFLASH_SHOCK; EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams); @@ -780,15 +780,15 @@ void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) { // EffectSsEnIce Spawn Functions -void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, - f32 scale) { +void EffectSsEnIce_SpawnFlying(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, + f32 scale) { EffectSsEnIceInitParams initParams; initParams.actor = actor; Math_Vec3f_Copy(&initParams.pos, pos); Color_RGBA8_Copy(&initParams.primColor, prim); Color_RGBA8_Copy(&initParams.envColor, env); - initParams.type = 0; + initParams.type = ENICE_TYPE_FLYING; initParams.scale = scale; if (actor != NULL) { @@ -802,7 +802,7 @@ void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) { static Color_RGBA8 primColor = { 150, 150, 150, 250 }; static Color_RGBA8 envColor = { 235, 245, 255, 255 }; - EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale); + EffectSsEnIce_SpawnFlying(play, actor, pos, &primColor, &envColor, scale); } void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) { @@ -823,7 +823,7 @@ void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.scale = scale; initParams.life = life; - initParams.type = 1; + initParams.type = ENICE_TYPE_NORMAL; EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams); } @@ -872,14 +872,14 @@ void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPar // EffectSsEnFire Spawn Functions -void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); initParams.actor = actor; initParams.scale = scale; - initParams.unk_12 = arg4; + initParams.params = params; initParams.flags = flags; initParams.bodyPart = bodyPart; @@ -890,7 +890,7 @@ void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 sc EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams); } -void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags, +void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 params, s16 flags, s16 bodyPart) { EffectSsEnFireInitParams initParams; @@ -899,8 +899,8 @@ void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 sc initParams.pos.z = pos->z; initParams.actor = actor; initParams.scale = scale; - initParams.unk_12 = arg4; - initParams.flags = flags | 0x8000; + initParams.params = params; + initParams.flags = flags | ENFIRE_FLAGS_BODYPART_POS_VEC3S; initParams.bodyPart = bodyPart; if (actor != NULL) { @@ -978,7 +978,7 @@ void EffectSsDeadDd_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* a initParams.envColor.r = env->r; initParams.envColor.g = env->g; initParams.envColor.b = env->b; - initParams.type = 0; + initParams.type = DEADDD_TYPE_0; initParams.alphaStep = alphaStep; initParams.life = life; diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 6549ed9e1..5e32e5c95 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -11,7 +11,7 @@ #include "objects/object_boj/object_boj.h" #include "objects/object_os_anime/object_os_anime.h" -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gMamamuYanUnusedIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_boj_Anim_001494, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_boj_Anim_001494, 1.0f, 0, -1, ANIMMODE_LOOP, -8 }, @@ -45,15 +45,15 @@ s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; s32 isChanged = false; - if (animIndex >= ENHY_ANIMATION_AOB_0 && animIndex < ENHY_ANIMATION_MAX) { + if (animIndex >= ENHY_ANIM_AOB_0 && animIndex < ENHY_ANIM_MAX) { isChanged = true; - frameCount = sAnimations[animIndex].frameCount; + frameCount = sAnimationInfo[animIndex].frameCount; if (frameCount < 0) { - frameCount = Animation_GetLastFrame(&sAnimations[animIndex].animation->common); + frameCount = Animation_GetLastFrame(&sAnimationInfo[animIndex].animation->common); } - Animation_Change(skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].playSpeed, - sAnimations[animIndex].startFrame, frameCount, sAnimations[animIndex].mode, - sAnimations[animIndex].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } return isChanged; } diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index f77fc5158..d0b88b3db 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -162,7 +162,8 @@ void FireObj_Draw(PlayState* play, FireObj* fire) { Matrix_Scale(fire->xScale, fire->yScale, 1.0f, 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); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 2df62a054..a79c732d8 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -17,7 +17,7 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), 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_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)), GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)), diff --git a/src/code/z_lights.c b/src/code/z_lights.c index b602c66b1..e3e732eb3 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -379,22 +379,22 @@ void Lights_GlowCheck(PlayState* play) { LightPoint* params = &light->info->params.point; if (light->info->type == LIGHT_POINT_GLOW) { - Vec3f pos; - Vec3f multDest; - f32 wDest; + Vec3f worldPos; + Vec3f projectedPos; + f32 invW; - pos.x = params->x; - pos.y = params->y; - pos.z = params->z; - Actor_GetProjectedPos(play, &pos, &multDest, &wDest); + worldPos.x = params->x; + worldPos.y = params->y; + worldPos.z = params->z; + Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW); params->drawGlow = 0; - if ((multDest.z > 1) && (fabsf(multDest.x * wDest) < 1) && (fabsf(multDest.y * wDest) < 1)) { - s32 wX = multDest.x * wDest * 160 + 160; - s32 wY = multDest.y * wDest * -120 + 120; - s32 wZ = (s32)((multDest.z * wDest) * 16352) + 16352; - s32 zBuf = func_80178A94(wX, wY); + if ((projectedPos.z > 1) && (fabsf(projectedPos.x * invW) < 1) && (fabsf(projectedPos.y * invW) < 1)) { + s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)((projectedPos.z * invW) * 16352.0f) + 16352; + s32 zBuf = func_80178A94(screenPosX, screenPosY); if (wZ < zBuf) { params->drawGlow = 1; diff --git a/src/code/z_map_disp.c b/src/code/z_map_disp.c index 026eb0a87..cc9d572fe 100644 --- a/src/code/z_map_disp.c +++ b/src/code/z_map_disp.c @@ -208,7 +208,7 @@ s32 MapDisp_IsDataRotated(PlayState* play) { } s32 func_80103A10(PlayState* play) { - if ((gSaveContext.save.entranceIndex == 0x6400) && (Cutscene_GetSceneSetupIndex(play) != 0)) { + if ((gSaveContext.save.entrance == 0x6400) && (Cutscene_GetSceneSetupIndex(play) != 0)) { return false; } return true; @@ -957,7 +957,7 @@ void func_80105FE0(PlayState* play, s32 x, s32 z, s32 rot); #endif s32 func_80106408(PlayState* play) { - if ((gSaveContext.save.entranceIndex == 0x6400) && (Cutscene_GetSceneSetupIndex(play) != 0)) { + if ((gSaveContext.save.entrance == 0x6400) && (Cutscene_GetSceneSetupIndex(play) != 0)) { return true; } return false; diff --git a/src/code/z_message.c b/src/code/z_message.c index 14fe241c4..16e1203d7 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -254,62 +254,39 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D304.s") -#ifdef NON_EQUIVALENT -extern u16* D_801D0188; -extern s16* D_801D0250; +extern u16 D_801D0188[][9]; +extern s16 D_801D0250[]; void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { - f32 sp3C; - s16 temp_s0; - s16 temp_s1; - s16 temp_s1_2; + MessageContext* msgCtx = &play->msgCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 temp_s6; - s32 temp_s2; - s32 temp_s2_2; - u16* temp_v0; + s16 temp_s1 = *arg3; + s32 temp_s2 = *arg1; + f32 sp3C = *arg2; s16 phi_v0; s16 phi_s0; - s16 phi_s1; - s32 phi_s2; - s16 phi_s1_2; - s32 phi_s2_2; - temp_s1 = *arg3; - temp_s2 = *arg1; - sp3C = *arg2; if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { phi_v0 = 0xA; } else { - phi_v0 = play->pauseCtx.unk_238[PAUSE_WORLD_MAP]; + phi_v0 = pauseCtx->unk_238[PAUSE_WORLD_MAP]; } - temp_s6 = *(&D_801D0250 + (phi_v0 * 2)); - phi_s0 = 0; - phi_s1_2 = temp_s1; - phi_s2_2 = temp_s2; - if ((s32)temp_s6 > 0) { - phi_s1 = temp_s1; - phi_s2 = temp_s2; - do { - temp_v0 = (phi_v0 * 0x12) + &D_801D0188 + (phi_s0 * 2); - (play + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0; - Font_LoadChar(play, *temp_v0, phi_s2); - temp_s0 = phi_s0 + 1; - temp_s1_2 = phi_s1 + 1; - temp_s2_2 = phi_s2 + 0x80; - phi_s0 = temp_s0; - phi_s1 = temp_s1_2; - phi_s2 = temp_s2_2; - phi_s1_2 = temp_s1_2; - phi_s2_2 = temp_s2_2; - } while ((s32)temp_s0 < (s32)temp_s6); + + temp_s6 = D_801D0250[phi_v0]; + + for (phi_s0 = 0; phi_s0 < temp_s6; phi_s0++, temp_s1++, temp_s2 += 0x80) { + msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[phi_v0][phi_s0]; + Font_LoadChar(play, D_801D0188[phi_v0][phi_s0], temp_s2); } - *arg3 = phi_s1_2 - 1; - *arg1 = phi_s2_2; - *arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * play->msgCtx.unk12098)); + + temp_s1--; + sp3C += (temp_s6 - 1) * (16.0f * msgCtx->unk12098); + + *arg3 = temp_s1; + *arg1 = temp_s2; + *arg2 = sp3C; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D62C.s") -#endif #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D7B4.s") diff --git a/src/code/z_play.c b/src/code/z_play.c index 9e081e454..3151a0e0f 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -34,7 +34,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801660B8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Fini.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Destroy.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801663C4.s") @@ -46,7 +46,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166B30.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167814.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167DE4.s") @@ -56,7 +56,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80168DAC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Main.s") s32 Play_InCsMode(PlayState* this) { return (this->csCtx.state != 0) || Player_InCsMode(this); @@ -74,39 +74,217 @@ s32 Play_InCsMode(PlayState* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_SceneInit.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169474.s") +void Play_GetScreenPos(PlayState* this, Vec3f* worldPos, Vec3f* screenPos) { + f32 invW; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CreateSubCamera.s") + // screenPos temporarily stores the projectedPos + Actor_GetProjectedPos(this, worldPos, screenPos, &invW); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCamId.s") + screenPos->x = (SCREEN_WIDTH / 2) + (screenPos->x * invW * (SCREEN_WIDTH / 2)); + screenPos->y = (SCREEN_HEIGHT / 2) - (screenPos->y * invW * (SCREEN_HEIGHT / 2)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeStatus.s") +s16 Play_CreateSubCamera(PlayState* this) { + s16 subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearCamera.s") + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (this->cameraPtrs[subCamId] == NULL) { + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s") + // if no subCameras available + if (subCamId == NUM_CAMS) { + return CAM_ID_NONE; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCamera.s") + this->cameraPtrs[subCamId] = &this->subCameras[subCamId - CAM_ID_SUB_FIRST]; + Camera_Init(this->cameraPtrs[subCamId], &this->view, &this->colCtx, this); + this->cameraPtrs[subCamId]->camId = subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEye.s") + return subCamId; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s") +s16 Play_GetActiveCamId(PlayState* this) { + return this->activeCamId; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetFov.s") +s32 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetRoll.s") + if (status == CAM_STATUS_ACTIVE) { + this->activeCamId = camIdx; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CopyCamera.s") + return Camera_ChangeStatus(this->cameraPtrs[camIdx], status); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169A50.s") +void Play_ClearCamera(PlayState* this, s16 camId) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeSetting.s") + if (this->cameraPtrs[camIdx] != NULL) { + Camera_ChangeStatus(this->cameraPtrs[camIdx], CAM_STATUS_INACTIVE); + this->cameraPtrs[camIdx] = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AFC.s") +void Play_ClearAllSubCameras(PlayState* this) { + s16 subCamId; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraGetUID.s") + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (this->cameraPtrs[subCamId] != NULL) { + Play_ClearCamera(this, subCamId); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s") + this->activeCamId = CAM_ID_MAIN; +} + +Camera* Play_GetCamera(PlayState* this, s16 camId) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + + return this->cameraPtrs[camIdx]; +} + +/** + * @return bit-packed success if each of the params were applied + */ +s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { + s32 successfullySet = 0; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + + camera->dist = Math3D_Distance(at, eye); + + if (camera->focalActor != NULL) { + camera->atActorOffset.x = at->x - camera->focalActor->world.pos.x; + camera->atActorOffset.y = at->y - camera->focalActor->world.pos.y; + camera->atActorOffset.z = at->z - camera->focalActor->world.pos.z; + } else { + camera->atActorOffset.x = camera->atActorOffset.y = camera->atActorOffset.z = 0.0f; + } + + camera->atLerpStepScale = 0.01f; + + return successfullySet; +} + +/** + * @return bit-packed success if each of the params were applied + */ +s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { + s32 successfullySet = 0; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + successfullySet <<= 1; + successfullySet |= Camera_SetViewParam(camera, CAM_VIEW_UP, up); + + camera->dist = Math3D_Distance(at, eye); + + if (camera->focalActor != NULL) { + camera->atActorOffset.x = at->x - camera->focalActor->world.pos.x; + camera->atActorOffset.y = at->y - camera->focalActor->world.pos.y; + camera->atActorOffset.z = at->z - camera->focalActor->world.pos.z; + } else { + camera->atActorOffset.x = camera->atActorOffset.y = camera->atActorOffset.z = 0.0f; + } + + camera->atLerpStepScale = 0.01f; + + return successfullySet; +} + +/** + * @return true if the fov was successfully set + */ +s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov) { + s32 successfullySet = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1; + + if (1) {} + return successfullySet; +} + +s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + Camera* camera = this->cameraPtrs[camIdx]; + + camera->roll = roll; + + return 1; +} + +void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) { + s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? this->activeCamId : srcCamId; + s16 destCamId1 = (destCamId == CAM_ID_NONE) ? this->activeCamId : destCamId; + + Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]); +} + +// Same as Play_ChangeCameraSetting but also calls Camera_InitPlayerSettings +s32 func_80169A50(PlayState* this, s16 camId, Player* player, s16 setting) { + Camera* camera; + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + + camera = this->cameraPtrs[camIdx]; + Camera_InitPlayerSettings(camera, player); + return Camera_ChangeSetting(camera, setting); +} + +s32 Play_ChangeCameraSetting(PlayState* this, s16 camId, s16 setting) { + return Camera_ChangeSetting(Play_GetCamera(this, camId), setting); +} + +// Related to bosses and fishing +void func_80169AFC(PlayState* this, s16 camId, s16 timer) { + s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; + s16 i; + + Play_ClearCamera(this, camIdx); + + for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { + if (this->cameraPtrs[i] != NULL) { + Play_ClearCamera(this, i); + } + } + + if (timer <= 0) { + Play_ChangeCameraStatus(this, CAM_ID_MAIN, CAM_STATUS_ACTIVE); + this->cameraPtrs[CAM_ID_MAIN]->childCamId = this->cameraPtrs[CAM_ID_MAIN]->doorTimer2 = 0; + } +} + +s16 Play_GetCameraUID(PlayState* this, s16 camId) { + Camera* camera = this->cameraPtrs[camId]; + + if (camera != NULL) { + return camera->uid; + } else { + return -1; + } +} + +// Unused in both MM and OoT, purpose is very unclear +s16 func_80169BF8(PlayState* this, s16 camId, s16 uid) { + Camera* camera = this->cameraPtrs[camId]; + + if (camera != NULL) { + return 0; + } else if (camera->uid != uid) { + return 0; + } else if (camera->status != CAM_STATUS_ACTIVE) { + return 2; + } else { + return 1; + } +} u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex) { ActorCsCamInfo* actorCsCamList = &this->actorCsCamList[csCamDataIndex]; @@ -179,11 +357,11 @@ void Play_SaveCycleSceneFlags(GameState* thisx) { cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom; } -void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entranceIndex, s32 roomIndex, s32 playerParams, - Vec3f* pos, s16 yaw) { +void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 roomIndex, s32 playerParams, Vec3f* pos, + s16 yaw) { PlayState* this = (PlayState*)thisx; - gSaveContext.respawn[respawnMode].entranceIndex = Entrance_CreateIndex(entranceIndex >> 9, 0, entranceIndex & 0xF); + gSaveContext.respawn[respawnMode].entrance = Entrance_Create(entrance >> 9, 0, entrance & 0xF); gSaveContext.respawn[respawnMode].roomIndex = roomIndex; gSaveContext.respawn[respawnMode].pos = *pos; gSaveContext.respawn[respawnMode].yaw = yaw; @@ -198,7 +376,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) Player* player = GET_PLAYER(this); if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos - Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entranceIndex), + Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entrance), this->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } @@ -207,7 +385,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) // Override respawn data in Sakon's Hideout void func_80169ECC(PlayState* this) { if (this->sceneNum == SCENE_SECOM) { - this->nextEntranceIndex = 0x2060; + this->nextEntrance = ENTRANCE(IKANA_CANYON, 6); gSaveContext.respawnFlag = -7; } } @@ -220,7 +398,7 @@ void func_80169EFC(GameState* thisx) { gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2]; gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1]; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2]; - this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; + this->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance; gSaveContext.respawnFlag = 1; func_80169ECC(this); this->transitionTrigger = TRANS_TRIGGER_START; @@ -232,7 +410,7 @@ void func_80169EFC(GameState* thisx) { void func_80169F78(GameState* thisx) { PlayState* this = (PlayState*)thisx; - this->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; + this->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_TOP].entrance; gSaveContext.respawnFlag = -1; func_80169ECC(this); this->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 98a237b10..1566077f1 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -706,8 +706,8 @@ void func_80123E90(PlayState* play, Actor* actor) { player->unk_730 = actor; player->unk_A78 = actor; player->stateFlags1 |= PLAYER_STATE1_10000; - func_800DFD78(Play_GetCamera(play, CAM_ID_MAIN), 8, actor); - Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), 9); + Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, actor); + Camera_ChangeMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET); } s32 func_80123F14(PlayState* play) { @@ -774,11 +774,11 @@ s32 func_801240DC(Player* player) { } s32 func_80124110(Player* player, s32 actionParam) { - s32 temp_v0 = actionParam - PLAYER_AP_FISHING_POLE; + s32 temp_v0 = actionParam - PLAYER_AP_FISHING_ROD; if (player->transformation != PLAYER_FORM_GORON) { - if (((actionParam - PLAYER_AP_FISHING_POLE) > (PLAYER_AP_FISHING_POLE - PLAYER_AP_FISHING_POLE)) && - ((actionParam - PLAYER_AP_FISHING_POLE) < (PLAYER_AP_SWORD_GREAT_FAIRY - PLAYER_AP_FISHING_POLE))) { + if (((actionParam - PLAYER_AP_FISHING_ROD) > (PLAYER_AP_FISHING_ROD - PLAYER_AP_FISHING_ROD)) && + ((actionParam - PLAYER_AP_FISHING_ROD) < (PLAYER_AP_SWORD_GREAT_FAIRY - PLAYER_AP_FISHING_ROD))) { return temp_v0; } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index a0c2a51dc..2cb5ff2ee 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -454,7 +454,7 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; - if (gSaveContext.sceneSetupIndex) { + if (gSaveContext.sceneSetupIndex != 0) { altHeaderList = Lib_SegmentedToVirtual(cmd->altHeaders.segment); altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1]; @@ -527,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->transitionType = Entrance_GetTransitionFlags(play->nextEntranceIndex) & 0x7F; + play->transitionType = Entrance_GetTransitionFlags(play->nextEntrance) & 0x7F; } /** @@ -587,15 +587,15 @@ s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { } /** - * Creates an entrance index from the scene index, spawn index, and scene setup. + * Creates an entrance from the scene, spawn, and lyaer. */ -u16 Entrance_CreateIndex(s32 sceneIndex, s32 spawnIndex, s32 sceneSetup) { - return (((sceneIndex << 9) | (spawnIndex << 4)) | sceneSetup) & 0xFFFF; +u16 Entrance_Create(s32 scene, s32 spawn, s32 layer) { + return (scene << 9) | (spawn << 4) | layer; } /** - * Creates an entrance index from the current entrance index with the given spawn index. + * Creates an layer 0 entranace from the current entrance and the given spawn. */ -u16 Entrance_CreateIndexFromSpawn(s32 spawnIndex) { - return Entrance_CreateIndex(gSaveContext.save.entranceIndex >> 9, spawnIndex, 0); +u16 Entrance_CreateFromSpawn(s32 spawn) { + return Entrance_Create(gSaveContext.save.entrance >> 9, spawn, 0); } diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 8372c350a..108689978 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -7,119 +7,119 @@ { { 0, 0 }, 0, 0, 0, 0 } SceneTableEntry gSceneTable[] = { - SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(KAKUSIANA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(SPOT00, 0x0000, SCENE_DRAW_CFG_NOTHING), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_WITCH_SHOP, 0x011A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_HAKASHITA, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_AYASHIISHOP, 0x010E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_OMOYA, 0x0132, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOWLING, 0x0108, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SONCHONOIE, 0x010B, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_IKANA, 0x0141, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KAIZOKU, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MILK_BAR, 0x010C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_INISIE_N, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TAKARAYA, 0x0109, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_INISIE_R, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_OKUJOU, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_OPENINGDAN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MITURIN, 0x011F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_13HUBUKINOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_CASTLE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DEKUTES, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MITURIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SYATEKI_MIZU, 0x0107, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_HAKUGIN, 0x012B, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_ROMANYMAE, 0x0149, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_PIRATE, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SYATEKI_MORI, 0x011B, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SINKAI, 0x0135, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_YOUSEI_IZUMI, 0x013E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KINSTA1, 0x011E, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KINDAN2, 0x013F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TENMON_DAI, 0x0114, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_DEKU, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_22DEKUCITY, 0x0118, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KAJIYA, 0x0127, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_00KEIKOKU, 0x0100, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_POSTHOUSE, 0x0111, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_LABO, 0x013A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DANPEI2TEST, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_16GORON_HOUSE, 0x0124, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_33ZORACITY, 0x0136, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_8ITEMSHOP, 0x010F, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_F01, 0x012E, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_INISIE_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_30GYOSON, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_31MISAKI, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TAKARAKUJI, 0x0112, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY_NONE(), - SCENE_ENTRY(Z2_TORIDE, 0x0138, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_FISHERMAN, 0x013B, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORONSHOP, 0x0129, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_DEKU_KING, 0x011C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_GORON, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_24KEMONOMITI, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_F01_B, 0x0130, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F01C, 0x012F, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOTI, 0x0106, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_HAKUGIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_20SICHITAI, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_21MITURINMAE, 0x0117, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_ZORA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_11GORONNOSATO2, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SEA, 0x013D, SCENE_DRAW_CFG_GREAT_BAY_TEMPLE), - SCENE_ENTRY(Z2_35TAKI, 0x0137, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_REDEAD, 0x0145, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_BANDROOM, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_11GORONNOSATO, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORON_HAKA, 0x012A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SECOM, 0x0143, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), - SCENE_ENTRY(Z2_10YUKIYAMANOMURA, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_TOUGITES, 0x0146, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_DANPEI, 0x0120, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_IKANAMAE, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_DOUJOU, 0x0110, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_MUSICHOUSE, 0x0147, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), - SCENE_ENTRY(Z2_IKNINSIDE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_MAP_SHOP, 0x0119, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F40, 0x0140, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_F41, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_10YUKIYAMANOMURA2, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_14YUKIDAMANOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_12HAKUGINMAE, 0x0125, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_17SETUGEN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_17SETUGEN2, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_SEA_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_RANDOM, 0x012C, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_YADOYA, 0x010A, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KONPEKI_ENT, 0x0139, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_INSIDETOWER, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_26SARUNOMORI, 0x011D, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LOST_WOODS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_LAST_LINK, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_SOUGEN, 0x0000, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BOMYA, 0x010D, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_KYOJINNOMA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_KOEPONARACE, 0x0131, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_GORONRACE, 0x0126, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_TOWN, 0x0101, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_ICHIBA, 0x0102, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_BACKTOWN, 0x0103, SCENE_DRAW_CFG_DEFAULT), - SCENE_ENTRY(Z2_CLOCKTOWER, 0x0104, SCENE_DRAW_CFG_MAT_ANIM), - SCENE_ENTRY(Z2_ALLEY, 0x0105, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x00 */ SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x01 */ SCENE_ENTRY_NONE(), + /* 0x02 */ SCENE_ENTRY_NONE(), + /* 0x03 */ SCENE_ENTRY_NONE(), + /* 0x04 */ SCENE_ENTRY_NONE(), + /* 0x05 */ SCENE_ENTRY_NONE(), + /* 0x06 */ SCENE_ENTRY_NONE(), + /* 0x07 */ SCENE_ENTRY(KAKUSIANA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x08 */ SCENE_ENTRY(SPOT00, 0x0000, SCENE_DRAW_CFG_NOTHING), + /* 0x09 */ SCENE_ENTRY_NONE(), + /* 0x0A */ SCENE_ENTRY(Z2_WITCH_SHOP, 0x011A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0B */ SCENE_ENTRY(Z2_LAST_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0C */ SCENE_ENTRY(Z2_HAKASHITA, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0D */ SCENE_ENTRY(Z2_AYASHIISHOP, 0x010E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x0E */ SCENE_ENTRY_NONE(), + /* 0x0F */ SCENE_ENTRY_NONE(), + /* 0x10 */ SCENE_ENTRY(Z2_OMOYA, 0x0132, SCENE_DRAW_CFG_DEFAULT), + /* 0x11 */ SCENE_ENTRY(Z2_BOWLING, 0x0108, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x12 */ SCENE_ENTRY(Z2_SONCHONOIE, 0x010B, SCENE_DRAW_CFG_DEFAULT), + /* 0x13 */ SCENE_ENTRY(Z2_IKANA, 0x0141, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x14 */ SCENE_ENTRY(Z2_KAIZOKU, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x15 */ SCENE_ENTRY(Z2_MILK_BAR, 0x010C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x16 */ SCENE_ENTRY(Z2_INISIE_N, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x17 */ SCENE_ENTRY(Z2_TAKARAYA, 0x0109, SCENE_DRAW_CFG_DEFAULT), + /* 0x18 */ SCENE_ENTRY(Z2_INISIE_R, 0x0144, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x19 */ SCENE_ENTRY(Z2_OKUJOU, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x1A */ SCENE_ENTRY(Z2_OPENINGDAN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1B */ SCENE_ENTRY(Z2_MITURIN, 0x011F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1C */ SCENE_ENTRY(Z2_13HUBUKINOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x1D */ SCENE_ENTRY(Z2_CASTLE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1E */ SCENE_ENTRY(Z2_DEKUTES, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x1F */ SCENE_ENTRY(Z2_MITURIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x20 */ SCENE_ENTRY(Z2_SYATEKI_MIZU, 0x0107, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x21 */ SCENE_ENTRY(Z2_HAKUGIN, 0x012B, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x22 */ SCENE_ENTRY(Z2_ROMANYMAE, 0x0149, SCENE_DRAW_CFG_DEFAULT), + /* 0x23 */ SCENE_ENTRY(Z2_PIRATE, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x24 */ SCENE_ENTRY(Z2_SYATEKI_MORI, 0x011B, SCENE_DRAW_CFG_DEFAULT), + /* 0x25 */ SCENE_ENTRY(Z2_SINKAI, 0x0135, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x26 */ SCENE_ENTRY(Z2_YOUSEI_IZUMI, 0x013E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x27 */ SCENE_ENTRY(Z2_KINSTA1, 0x011E, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x28 */ SCENE_ENTRY(Z2_KINDAN2, 0x013F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x29 */ SCENE_ENTRY(Z2_TENMON_DAI, 0x0114, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2A */ SCENE_ENTRY(Z2_LAST_DEKU, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x2B */ SCENE_ENTRY(Z2_22DEKUCITY, 0x0118, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2C */ SCENE_ENTRY(Z2_KAJIYA, 0x0127, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2D */ SCENE_ENTRY(Z2_00KEIKOKU, 0x0100, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x2E */ SCENE_ENTRY(Z2_POSTHOUSE, 0x0111, SCENE_DRAW_CFG_DEFAULT), + /* 0x2F */ SCENE_ENTRY(Z2_LABO, 0x013A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x30 */ SCENE_ENTRY(Z2_DANPEI2TEST, 0x0113, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x31 */ SCENE_ENTRY_NONE(), + /* 0x32 */ SCENE_ENTRY(Z2_16GORON_HOUSE, 0x0124, SCENE_DRAW_CFG_DEFAULT), + /* 0x33 */ SCENE_ENTRY(Z2_33ZORACITY, 0x0136, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x34 */ SCENE_ENTRY(Z2_8ITEMSHOP, 0x010F, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x35 */ SCENE_ENTRY(Z2_F01, 0x012E, SCENE_DRAW_CFG_DEFAULT), + /* 0x36 */ SCENE_ENTRY(Z2_INISIE_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x37 */ SCENE_ENTRY(Z2_30GYOSON, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x38 */ SCENE_ENTRY(Z2_31MISAKI, 0x0134, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x39 */ SCENE_ENTRY(Z2_TAKARAKUJI, 0x0112, SCENE_DRAW_CFG_DEFAULT), + /* 0x3A */ SCENE_ENTRY_NONE(), + /* 0x3B */ SCENE_ENTRY(Z2_TORIDE, 0x0138, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3C */ SCENE_ENTRY(Z2_FISHERMAN, 0x013B, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3D */ SCENE_ENTRY(Z2_GORONSHOP, 0x0129, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3E */ SCENE_ENTRY(Z2_DEKU_KING, 0x011C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x3F */ SCENE_ENTRY(Z2_LAST_GORON, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x40 */ SCENE_ENTRY(Z2_24KEMONOMITI, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x41 */ SCENE_ENTRY(Z2_F01_B, 0x0130, SCENE_DRAW_CFG_DEFAULT), + /* 0x42 */ SCENE_ENTRY(Z2_F01C, 0x012F, SCENE_DRAW_CFG_DEFAULT), + /* 0x43 */ SCENE_ENTRY(Z2_BOTI, 0x0106, SCENE_DRAW_CFG_DEFAULT), + /* 0x44 */ SCENE_ENTRY(Z2_HAKUGIN_BS, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x45 */ SCENE_ENTRY(Z2_20SICHITAI, 0x0116, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x46 */ SCENE_ENTRY(Z2_21MITURINMAE, 0x0117, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x47 */ SCENE_ENTRY(Z2_LAST_ZORA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x48 */ SCENE_ENTRY(Z2_11GORONNOSATO2, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x49 */ SCENE_ENTRY(Z2_SEA, 0x013D, SCENE_DRAW_CFG_GREAT_BAY_TEMPLE), + /* 0x4A */ SCENE_ENTRY(Z2_35TAKI, 0x0137, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4B */ SCENE_ENTRY(Z2_REDEAD, 0x0145, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4C */ SCENE_ENTRY(Z2_BANDROOM, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4D */ SCENE_ENTRY(Z2_11GORONNOSATO, 0x0123, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4E */ SCENE_ENTRY(Z2_GORON_HAKA, 0x012A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x4F */ SCENE_ENTRY(Z2_SECOM, 0x0143, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), + /* 0x50 */ SCENE_ENTRY(Z2_10YUKIYAMANOMURA, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x51 */ SCENE_ENTRY(Z2_TOUGITES, 0x0146, SCENE_DRAW_CFG_DEFAULT), + /* 0x52 */ SCENE_ENTRY(Z2_DANPEI, 0x0120, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x53 */ SCENE_ENTRY(Z2_IKANAMAE, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x54 */ SCENE_ENTRY(Z2_DOUJOU, 0x0110, SCENE_DRAW_CFG_DEFAULT), + /* 0x55 */ SCENE_ENTRY(Z2_MUSICHOUSE, 0x0147, SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP), + /* 0x56 */ SCENE_ENTRY(Z2_IKNINSIDE, 0x0142, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x57 */ SCENE_ENTRY(Z2_MAP_SHOP, 0x0119, SCENE_DRAW_CFG_DEFAULT), + /* 0x58 */ SCENE_ENTRY(Z2_F40, 0x0140, SCENE_DRAW_CFG_DEFAULT), + /* 0x59 */ SCENE_ENTRY(Z2_F41, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x5A */ SCENE_ENTRY(Z2_10YUKIYAMANOMURA2, 0x0122, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5B */ SCENE_ENTRY(Z2_14YUKIDAMANOMITI, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x5C */ SCENE_ENTRY(Z2_12HAKUGINMAE, 0x0125, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5D */ SCENE_ENTRY(Z2_17SETUGEN, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5E */ SCENE_ENTRY(Z2_17SETUGEN2, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x5F */ SCENE_ENTRY(Z2_SEA_BS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x60 */ SCENE_ENTRY(Z2_RANDOM, 0x012C, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x61 */ SCENE_ENTRY(Z2_YADOYA, 0x010A, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x62 */ SCENE_ENTRY(Z2_KONPEKI_ENT, 0x0139, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x63 */ SCENE_ENTRY(Z2_INSIDETOWER, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x64 */ SCENE_ENTRY(Z2_26SARUNOMORI, 0x011D, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x65 */ SCENE_ENTRY(Z2_LOST_WOODS, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x66 */ SCENE_ENTRY(Z2_LAST_LINK, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x67 */ SCENE_ENTRY(Z2_SOUGEN, 0x0000, SCENE_DRAW_CFG_DEFAULT), + /* 0x68 */ SCENE_ENTRY(Z2_BOMYA, 0x010D, SCENE_DRAW_CFG_DEFAULT), + /* 0x69 */ SCENE_ENTRY(Z2_KYOJINNOMA, 0x0000, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x6A */ SCENE_ENTRY(Z2_KOEPONARACE, 0x0131, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x6B */ SCENE_ENTRY(Z2_GORONRACE, 0x0126, SCENE_DRAW_CFG_DEFAULT), + /* 0x6C */ SCENE_ENTRY(Z2_TOWN, 0x0101, SCENE_DRAW_CFG_DEFAULT), + /* 0x6D */ SCENE_ENTRY(Z2_ICHIBA, 0x0102, SCENE_DRAW_CFG_DEFAULT), + /* 0x6E */ SCENE_ENTRY(Z2_BACKTOWN, 0x0103, SCENE_DRAW_CFG_DEFAULT), + /* 0x6F */ SCENE_ENTRY(Z2_CLOCKTOWER, 0x0104, SCENE_DRAW_CFG_MAT_ANIM), + /* 0x70 */ SCENE_ENTRY(Z2_ALLEY, 0x0105, SCENE_DRAW_CFG_MAT_ANIM), }; static EntranceTableEntry sMayorsResidenceEntrance0[] = { @@ -486,22 +486,22 @@ static EntranceTableEntry* sTreasureChestShopEntranceTable[] = { sTreasureChestShopEntrance1, }; -static EntranceTableEntry sStoneTowerTempleReversedEntrance0[] = { +static EntranceTableEntry sStoneTowerTempleInvertedEntrance0[] = { { 0xE8, 0x00, 0xC102 }, }; -static EntranceTableEntry sStoneTowerTempleReversedEntrance1[] = { +static EntranceTableEntry sStoneTowerTempleInvertedEntrance1[] = { { 0xE8, 0x01, 0x8102 }, }; -static EntranceTableEntry sStoneTowerTempleReversedEntrance2[] = { +static EntranceTableEntry sStoneTowerTempleInvertedEntrance2[] = { { 0xE8, 0x02, 0x8102 }, }; -static EntranceTableEntry* sStoneTowerTempleReversedEntranceTable[] = { - sStoneTowerTempleReversedEntrance0, - sStoneTowerTempleReversedEntrance1, - sStoneTowerTempleReversedEntrance2, +static EntranceTableEntry* sStoneTowerTempleInvertedEntranceTable[] = { + sStoneTowerTempleInvertedEntrance0, + sStoneTowerTempleInvertedEntrance1, + sStoneTowerTempleInvertedEntrance2, }; static EntranceTableEntry sClockTowerRooftopEntrance0[] = { @@ -782,17 +782,17 @@ static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { sSwampShootingGalleryEntrance0, }; -static EntranceTableEntry sPinaccleRockEntrance0[] = { +static EntranceTableEntry sPinnacleRockEntrance0[] = { { 0x25, 0x00, 0x4A14 }, }; -static EntranceTableEntry sPinaccleRockEntrance1[] = { +static EntranceTableEntry sPinnacleRockEntrance1[] = { { 0x25, 0x01, 0x0A14 }, }; -static EntranceTableEntry* sPinaccleRockEntranceTable[] = { - sPinaccleRockEntrance0, - sPinaccleRockEntrance1, +static EntranceTableEntry* sPinnacleRockEntranceTable[] = { + sPinnacleRockEntrance0, + sPinnacleRockEntrance1, }; static EntranceTableEntry sFairyFountainEntrance0[] = { @@ -2657,134 +2657,134 @@ static EntranceTableEntry* sCutsceneEntranceTable[] = { { 0, NULL, NULL } static SceneEntranceTableEntry sSceneEntranceTable[] = { - SCENE_ENTRANCE(sMayorsResidenceEntranceTable, "Z2_SONCHONOIE"), - SCENE_ENTRANCE(sMajorasLairEntranceTable, "Z2_LAST_BS"), - SCENE_ENTRANCE(sMagicHagsPotionShopEntranceTable, "Z2_WITCH_SHOP"), - SCENE_ENTRANCE(sRanchHouseEntranceTable, "Z2_OMOYA"), - SCENE_ENTRANCE(sHoneyAndDarlingsShopEntranceTable, "Z2_BOWLING"), - SCENE_ENTRANCE(sBeneathTheGraveryardEntranceTable, "Z2_HAKASHITA"), - SCENE_ENTRANCE(sSouthernSwampClearedEntranceTable, "Z2_20SICHITAI2"), - SCENE_ENTRANCE(sCuriosityShopEntranceTable, "Z2_AYASHIISHOP"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sGrottosEntranceTable, "KAKUSIANA"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sCutsceneEntranceTable, "SPOT00"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sIkanaCanyonEntranceTable, "Z2_IKANA"), - SCENE_ENTRANCE(sPiratesFortressEntranceTable, "Z2_KAIZOKU"), - SCENE_ENTRANCE(sMilkBarEntranceTable, "Z2_MILK_BAR"), - SCENE_ENTRANCE(sStoneTowerTempleEntranceTable, "Z2_INISIE_N"), - SCENE_ENTRANCE(sTreasureChestShopEntranceTable, "Z2_TAKARAYA"), - SCENE_ENTRANCE(sStoneTowerTempleReversedEntranceTable, "Z2_INISIE_R"), - SCENE_ENTRANCE(sClockTowerRooftopEntranceTable, "Z2_OKUJOU"), - SCENE_ENTRANCE(sOpeningDungeonEntranceTable, "Z2_OPENINGDAN"), - SCENE_ENTRANCE(sWoodfallTempleEntranceTable, "Z2_MITURIN"), - SCENE_ENTRANCE(sPathToMountainVillageEntranceTable, "Z2_13HUBUKINOMITI"), - SCENE_ENTRANCE(sIkanaCastleEntranceTable, "Z2_CASTLE"), - SCENE_ENTRANCE(sDekuScrubPlaygroundEntranceTable, "Z2_DEKUTES"), - SCENE_ENTRANCE(sOdolwasLairEntranceTable, "Z2_MITURIN_BS"), - SCENE_ENTRANCE(sTownShootingGalleryEntranceTable, "Z2_SYATEKI_MIZU"), - SCENE_ENTRANCE(sSnowheadTempleEntranceTable, "Z2_HAKUGIN"), - SCENE_ENTRANCE(sMilkRoadEntranceTable, "Z2_ROMANYMAE"), - SCENE_ENTRANCE(sPiratesFortressInteriorEntranceTable, "Z2_PIRATE"), - SCENE_ENTRANCE(sSwampShootingGalleryEntranceTable, "Z2_SYATEKI_MORI"), - SCENE_ENTRANCE(sPinaccleRockEntranceTable, "Z2_SINKAI"), - SCENE_ENTRANCE(sFairyFountainEntranceTable, "Z2_YOUSEI_IZUMI"), - SCENE_ENTRANCE(sSwampSpiderHouseEntranceTable, "Z2_KINSTA1"), - SCENE_ENTRANCE(sOceansideSpiderHouseEntranceTable, "Z2_KINDAN2"), - SCENE_ENTRANCE(sAstralObservatoryEntranceTable, "Z2_TENMON_DAI"), - SCENE_ENTRANCE(sMoonDekuTrialEntranceTable, "Z2_LAST_DEKU"), - SCENE_ENTRANCE(sDekuPalaceEntranceTable, "Z2_22DEKUCITY"), - SCENE_ENTRANCE(sMountainSmithyEntranceTable, "Z2_KAJIYA"), - SCENE_ENTRANCE(sTerminaFieldEntranceTable, "Z2_00KEIKOKU"), - SCENE_ENTRANCE(sPostOfficeEntranceTable, "Z2_POSTHOUSE"), - SCENE_ENTRANCE(sMarineResearchLabEntranceTable, "Z2_LABO"), - SCENE_ENTRANCE(sDampesHouseEntranceTable, "Z2_DANPEI2TEST"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sGoronShrineEntranceTable, "Z2_16GORON_HOUSE"), - SCENE_ENTRANCE(sZoraHallEntranceTable, "Z2_33ZORACITY"), - SCENE_ENTRANCE(sTradingPostEntranceTable, "Z2_8ITEMSHOP"), - SCENE_ENTRANCE(sRomaniRanchEntranceTable, "Z2_F01"), - SCENE_ENTRANCE(sTwinmoldsLairEntranceTable, "Z2_INISIE_BS"), - SCENE_ENTRANCE(sGreatBayCoastEntranceTable, "Z2_30GYOSON"), - SCENE_ENTRANCE(sZoraCapeEntranceTable, "Z2_31MISAKI"), - SCENE_ENTRANCE(sLotteryShopEntranceTable, "Z2_TAKARAKUJI"), - SCENE_ENTRANCE_NONE(), - SCENE_ENTRANCE(sPiratesFortressExteriorEntranceTable, "Z2_TORIDE"), - SCENE_ENTRANCE(sFishermansHutEntranceTable, "Z2_FISHERMAN"), - SCENE_ENTRANCE(sGoronShopEntranceTable, "Z2_GORONSHOP"), - SCENE_ENTRANCE(sDekuKingsChamberEntranceTable, "Z2_DEKU_KING"), - SCENE_ENTRANCE(sMoonGoronTrialEntranceTable, "Z2_LAST_GORON"), - SCENE_ENTRANCE(sRoadToSouthernSwampEntranceTable, "Z2_24KEMONOMITI"), - SCENE_ENTRANCE(sDoggyRacetrackEntranceTable, "Z2_F01_B"), - SCENE_ENTRANCE(sCuccoShackEntranceTable, "Z2_F01C"), - SCENE_ENTRANCE(sIkanaGraveyardEntranceTable, "Z2_BOTI"), - SCENE_ENTRANCE(sGohtsLairEntranceTable, "Z2_HAKUGIN_BS"), - SCENE_ENTRANCE(sSouthernSwampPoisonedEntranceTable, "Z2_20SICHITAI"), - SCENE_ENTRANCE(sWoodfallEntranceTable, "Z2_21MITURINMAE"), - SCENE_ENTRANCE(sMoonZoraTrialEntranceTable, "Z2_LAST_ZORA"), - SCENE_ENTRANCE(sGoronVillageSpringEntranceTable, "Z2_11GORONNOSATO2"), - SCENE_ENTRANCE(sGreatBayTempleEntranceTable, "Z2_SEA"), - SCENE_ENTRANCE(sWaterfallRapidsEntranceTable, "Z2_35TAKI"), - SCENE_ENTRANCE(sBeneathTheWellEntranceTable, "Z2_REDEAD"), - SCENE_ENTRANCE(sZoraHallRoomsEntranceTable, "Z2_BANDROOM"), - SCENE_ENTRANCE(sGoronVillageWinterEntranceTable, "Z2_11GORONNOSATO"), - SCENE_ENTRANCE(sGoronGraveryardEntranceTable, "Z2_GORON_HAKA"), - SCENE_ENTRANCE(sSakonsHideoutEntranceTable, "Z2_SECOM"), - SCENE_ENTRANCE(sMountainVillageWinterEntranceTable, "Z2_10YUKIYAMANOMURA"), - SCENE_ENTRANCE(sGhostHutEntranceTable, "Z2_TOUGITES"), - SCENE_ENTRANCE(sDekuShrineEntranceTable, "Z2_DANPEI"), - SCENE_ENTRANCE(sRoadToIkanaEntranceTable, "Z2_IKANAMAE"), - SCENE_ENTRANCE(sSwordmansSchoolEntranceTable, "Z2_DOUJOU"), - SCENE_ENTRANCE(sMusicBoxHouseEntranceTable, "Z2_MUSICHOUSE"), - SCENE_ENTRANCE(sIgosDuIkanasLairEntranceTable, "Z2_IKNINSIDE"), - SCENE_ENTRANCE(sTouristInformationEntranceTable, "Z2_MAP_SHOP"), - SCENE_ENTRANCE(sStoneTowerEntranceTable, "Z2_F40"), - SCENE_ENTRANCE(sStoneTowerInvertedEntranceTable, "Z2_F41"), - SCENE_ENTRANCE(sMountainVillageSpringEntranceTable, "Z2_10YUKIYAMANOMURA2"), - SCENE_ENTRANCE(sPathToSnowheadEntranceTable, "Z2_14YUKIDAMANOMITI"), - SCENE_ENTRANCE(sSnowheadEntranceTable, "Z2_12HAKUGINMAE"), - SCENE_ENTRANCE(sPathToGoronVillageWinterEntranceTable, "Z2_17SETUGEN"), - SCENE_ENTRANCE(sPathToGoronVillageSpringEntranceTable, "Z2_17SETUGEN2"), - SCENE_ENTRANCE(sGyorgsLairEntranceTable, "Z2_SEA_BS"), - SCENE_ENTRANCE(sSecretShrineEntranceTable, "Z2_RANDOM"), - SCENE_ENTRANCE(sStockPotInnEntranceTable, "Z2_YADOYA"), - SCENE_ENTRANCE(sGreatBayCutsceneEntranceTable, "Z2_KONPEKI_ENT"), - SCENE_ENTRANCE(sClockTowerInteriorEntranceTable, "Z2_INSIDETOWER"), - SCENE_ENTRANCE(sWoodsOfMysteryEntranceTable, "Z2_26SARUNOMORI"), - SCENE_ENTRANCE(sLostWoodsEntranceTable, "Z2_LOST_WOODS"), - SCENE_ENTRANCE(sMoonLinkTrialEntranceTable, "Z2_LAST_LINK"), - SCENE_ENTRANCE(sTheMoonEntranceTable, "Z2_SOUGEN"), - SCENE_ENTRANCE(sBombShopEntranceTable, "Z2_BOMYA"), - SCENE_ENTRANCE(sGiantsChamberEntranceTable, "Z2_KYOJINNOMA"), - SCENE_ENTRANCE(sGormanTrackEntranceTable, "Z2_KOEPONARACE"), - SCENE_ENTRANCE(sGoronRacetrackEntranceTable, "Z2_GORONRACE"), - SCENE_ENTRANCE(sEastClockTownEntranceTable, "Z2_TOWN"), - SCENE_ENTRANCE(sWestClockTownEntranceTable, "Z2_ICHIBA"), - SCENE_ENTRANCE(sNorthClockTownEntranceTable, "Z2_BACKTOWN"), - SCENE_ENTRANCE(sSouthClockTownEntranceTable, "Z2_CLOCKTOWER"), - SCENE_ENTRANCE(sLaundryPoolEntranceTable, "Z2_ALLEY"), + /* 0x00 */ SCENE_ENTRANCE(sMayorsResidenceEntranceTable, "Z2_SONCHONOIE"), + /* 0x01 */ SCENE_ENTRANCE(sMajorasLairEntranceTable, "Z2_LAST_BS"), + /* 0x02 */ SCENE_ENTRANCE(sMagicHagsPotionShopEntranceTable, "Z2_WITCH_SHOP"), + /* 0x03 */ SCENE_ENTRANCE(sRanchHouseEntranceTable, "Z2_OMOYA"), + /* 0x04 */ SCENE_ENTRANCE(sHoneyAndDarlingsShopEntranceTable, "Z2_BOWLING"), + /* 0x05 */ SCENE_ENTRANCE(sBeneathTheGraveryardEntranceTable, "Z2_HAKASHITA"), + /* 0x06 */ SCENE_ENTRANCE(sSouthernSwampClearedEntranceTable, "Z2_20SICHITAI2"), + /* 0x07 */ SCENE_ENTRANCE(sCuriosityShopEntranceTable, "Z2_AYASHIISHOP"), + /* 0x08 */ SCENE_ENTRANCE_NONE(), + /* 0x09 */ SCENE_ENTRANCE_NONE(), + /* 0x0A */ SCENE_ENTRANCE(sGrottosEntranceTable, "KAKUSIANA"), + /* 0x0B */ SCENE_ENTRANCE_NONE(), + /* 0x0C */ SCENE_ENTRANCE_NONE(), + /* 0x0D */ SCENE_ENTRANCE_NONE(), + /* 0x0E */ SCENE_ENTRANCE(sCutsceneEntranceTable, "SPOT00"), + /* 0x0F */ SCENE_ENTRANCE_NONE(), + /* 0x10 */ SCENE_ENTRANCE(sIkanaCanyonEntranceTable, "Z2_IKANA"), + /* 0x11 */ SCENE_ENTRANCE(sPiratesFortressEntranceTable, "Z2_KAIZOKU"), + /* 0x12 */ SCENE_ENTRANCE(sMilkBarEntranceTable, "Z2_MILK_BAR"), + /* 0x13 */ SCENE_ENTRANCE(sStoneTowerTempleEntranceTable, "Z2_INISIE_N"), + /* 0x14 */ SCENE_ENTRANCE(sTreasureChestShopEntranceTable, "Z2_TAKARAYA"), + /* 0x15 */ SCENE_ENTRANCE(sStoneTowerTempleInvertedEntranceTable, "Z2_INISIE_R"), + /* 0x16 */ SCENE_ENTRANCE(sClockTowerRooftopEntranceTable, "Z2_OKUJOU"), + /* 0x17 */ SCENE_ENTRANCE(sOpeningDungeonEntranceTable, "Z2_OPENINGDAN"), + /* 0x18 */ SCENE_ENTRANCE(sWoodfallTempleEntranceTable, "Z2_MITURIN"), + /* 0x19 */ SCENE_ENTRANCE(sPathToMountainVillageEntranceTable, "Z2_13HUBUKINOMITI"), + /* 0x1A */ SCENE_ENTRANCE(sIkanaCastleEntranceTable, "Z2_CASTLE"), + /* 0x1B */ SCENE_ENTRANCE(sDekuScrubPlaygroundEntranceTable, "Z2_DEKUTES"), + /* 0x1C */ SCENE_ENTRANCE(sOdolwasLairEntranceTable, "Z2_MITURIN_BS"), + /* 0x1D */ SCENE_ENTRANCE(sTownShootingGalleryEntranceTable, "Z2_SYATEKI_MIZU"), + /* 0x1E */ SCENE_ENTRANCE(sSnowheadTempleEntranceTable, "Z2_HAKUGIN"), + /* 0x1F */ SCENE_ENTRANCE(sMilkRoadEntranceTable, "Z2_ROMANYMAE"), + /* 0x20 */ SCENE_ENTRANCE(sPiratesFortressInteriorEntranceTable, "Z2_PIRATE"), + /* 0x21 */ SCENE_ENTRANCE(sSwampShootingGalleryEntranceTable, "Z2_SYATEKI_MORI"), + /* 0x22 */ SCENE_ENTRANCE(sPinnacleRockEntranceTable, "Z2_SINKAI"), + /* 0x23 */ SCENE_ENTRANCE(sFairyFountainEntranceTable, "Z2_YOUSEI_IZUMI"), + /* 0x24 */ SCENE_ENTRANCE(sSwampSpiderHouseEntranceTable, "Z2_KINSTA1"), + /* 0x25 */ SCENE_ENTRANCE(sOceansideSpiderHouseEntranceTable, "Z2_KINDAN2"), + /* 0x26 */ SCENE_ENTRANCE(sAstralObservatoryEntranceTable, "Z2_TENMON_DAI"), + /* 0x27 */ SCENE_ENTRANCE(sMoonDekuTrialEntranceTable, "Z2_LAST_DEKU"), + /* 0x28 */ SCENE_ENTRANCE(sDekuPalaceEntranceTable, "Z2_22DEKUCITY"), + /* 0x29 */ SCENE_ENTRANCE(sMountainSmithyEntranceTable, "Z2_KAJIYA"), + /* 0x2A */ SCENE_ENTRANCE(sTerminaFieldEntranceTable, "Z2_00KEIKOKU"), + /* 0x2B */ SCENE_ENTRANCE(sPostOfficeEntranceTable, "Z2_POSTHOUSE"), + /* 0x2C */ SCENE_ENTRANCE(sMarineResearchLabEntranceTable, "Z2_LABO"), + /* 0x2D */ SCENE_ENTRANCE(sDampesHouseEntranceTable, "Z2_DANPEI2TEST"), + /* 0x2E */ SCENE_ENTRANCE_NONE(), + /* 0x2F */ SCENE_ENTRANCE(sGoronShrineEntranceTable, "Z2_16GORON_HOUSE"), + /* 0x30 */ SCENE_ENTRANCE(sZoraHallEntranceTable, "Z2_33ZORACITY"), + /* 0x31 */ SCENE_ENTRANCE(sTradingPostEntranceTable, "Z2_8ITEMSHOP"), + /* 0x32 */ SCENE_ENTRANCE(sRomaniRanchEntranceTable, "Z2_F01"), + /* 0x33 */ SCENE_ENTRANCE(sTwinmoldsLairEntranceTable, "Z2_INISIE_BS"), + /* 0x34 */ SCENE_ENTRANCE(sGreatBayCoastEntranceTable, "Z2_30GYOSON"), + /* 0x35 */ SCENE_ENTRANCE(sZoraCapeEntranceTable, "Z2_31MISAKI"), + /* 0x36 */ SCENE_ENTRANCE(sLotteryShopEntranceTable, "Z2_TAKARAKUJI"), + /* 0x37 */ SCENE_ENTRANCE_NONE(), + /* 0x38 */ SCENE_ENTRANCE(sPiratesFortressExteriorEntranceTable, "Z2_TORIDE"), + /* 0x39 */ SCENE_ENTRANCE(sFishermansHutEntranceTable, "Z2_FISHERMAN"), + /* 0x3A */ SCENE_ENTRANCE(sGoronShopEntranceTable, "Z2_GORONSHOP"), + /* 0x3B */ SCENE_ENTRANCE(sDekuKingsChamberEntranceTable, "Z2_DEKU_KING"), + /* 0x3C */ SCENE_ENTRANCE(sMoonGoronTrialEntranceTable, "Z2_LAST_GORON"), + /* 0x3D */ SCENE_ENTRANCE(sRoadToSouthernSwampEntranceTable, "Z2_24KEMONOMITI"), + /* 0x3E */ SCENE_ENTRANCE(sDoggyRacetrackEntranceTable, "Z2_F01_B"), + /* 0x3F */ SCENE_ENTRANCE(sCuccoShackEntranceTable, "Z2_F01C"), + /* 0x40 */ SCENE_ENTRANCE(sIkanaGraveyardEntranceTable, "Z2_BOTI"), + /* 0x41 */ SCENE_ENTRANCE(sGohtsLairEntranceTable, "Z2_HAKUGIN_BS"), + /* 0x42 */ SCENE_ENTRANCE(sSouthernSwampPoisonedEntranceTable, "Z2_20SICHITAI"), + /* 0x43 */ SCENE_ENTRANCE(sWoodfallEntranceTable, "Z2_21MITURINMAE"), + /* 0x44 */ SCENE_ENTRANCE(sMoonZoraTrialEntranceTable, "Z2_LAST_ZORA"), + /* 0x45 */ SCENE_ENTRANCE(sGoronVillageSpringEntranceTable, "Z2_11GORONNOSATO2"), + /* 0x46 */ SCENE_ENTRANCE(sGreatBayTempleEntranceTable, "Z2_SEA"), + /* 0x47 */ SCENE_ENTRANCE(sWaterfallRapidsEntranceTable, "Z2_35TAKI"), + /* 0x48 */ SCENE_ENTRANCE(sBeneathTheWellEntranceTable, "Z2_REDEAD"), + /* 0x49 */ SCENE_ENTRANCE(sZoraHallRoomsEntranceTable, "Z2_BANDROOM"), + /* 0x4A */ SCENE_ENTRANCE(sGoronVillageWinterEntranceTable, "Z2_11GORONNOSATO"), + /* 0x4B */ SCENE_ENTRANCE(sGoronGraveryardEntranceTable, "Z2_GORON_HAKA"), + /* 0x4C */ SCENE_ENTRANCE(sSakonsHideoutEntranceTable, "Z2_SECOM"), + /* 0x4D */ SCENE_ENTRANCE(sMountainVillageWinterEntranceTable, "Z2_10YUKIYAMANOMURA"), + /* 0x4E */ SCENE_ENTRANCE(sGhostHutEntranceTable, "Z2_TOUGITES"), + /* 0x4F */ SCENE_ENTRANCE(sDekuShrineEntranceTable, "Z2_DANPEI"), + /* 0x50 */ SCENE_ENTRANCE(sRoadToIkanaEntranceTable, "Z2_IKANAMAE"), + /* 0x51 */ SCENE_ENTRANCE(sSwordmansSchoolEntranceTable, "Z2_DOUJOU"), + /* 0x52 */ SCENE_ENTRANCE(sMusicBoxHouseEntranceTable, "Z2_MUSICHOUSE"), + /* 0x53 */ SCENE_ENTRANCE(sIgosDuIkanasLairEntranceTable, "Z2_IKNINSIDE"), + /* 0x54 */ SCENE_ENTRANCE(sTouristInformationEntranceTable, "Z2_MAP_SHOP"), + /* 0x55 */ SCENE_ENTRANCE(sStoneTowerEntranceTable, "Z2_F40"), + /* 0x56 */ SCENE_ENTRANCE(sStoneTowerInvertedEntranceTable, "Z2_F41"), + /* 0x57 */ SCENE_ENTRANCE(sMountainVillageSpringEntranceTable, "Z2_10YUKIYAMANOMURA2"), + /* 0x58 */ SCENE_ENTRANCE(sPathToSnowheadEntranceTable, "Z2_14YUKIDAMANOMITI"), + /* 0x59 */ SCENE_ENTRANCE(sSnowheadEntranceTable, "Z2_12HAKUGINMAE"), + /* 0x5A */ SCENE_ENTRANCE(sPathToGoronVillageWinterEntranceTable, "Z2_17SETUGEN"), + /* 0x5B */ SCENE_ENTRANCE(sPathToGoronVillageSpringEntranceTable, "Z2_17SETUGEN2"), + /* 0x5C */ SCENE_ENTRANCE(sGyorgsLairEntranceTable, "Z2_SEA_BS"), + /* 0x5D */ SCENE_ENTRANCE(sSecretShrineEntranceTable, "Z2_RANDOM"), + /* 0x5E */ SCENE_ENTRANCE(sStockPotInnEntranceTable, "Z2_YADOYA"), + /* 0x5F */ SCENE_ENTRANCE(sGreatBayCutsceneEntranceTable, "Z2_KONPEKI_ENT"), + /* 0x60 */ SCENE_ENTRANCE(sClockTowerInteriorEntranceTable, "Z2_INSIDETOWER"), + /* 0x61 */ SCENE_ENTRANCE(sWoodsOfMysteryEntranceTable, "Z2_26SARUNOMORI"), + /* 0x62 */ SCENE_ENTRANCE(sLostWoodsEntranceTable, "Z2_LOST_WOODS"), + /* 0x63 */ SCENE_ENTRANCE(sMoonLinkTrialEntranceTable, "Z2_LAST_LINK"), + /* 0x64 */ SCENE_ENTRANCE(sTheMoonEntranceTable, "Z2_SOUGEN"), + /* 0x65 */ SCENE_ENTRANCE(sBombShopEntranceTable, "Z2_BOMYA"), + /* 0x66 */ SCENE_ENTRANCE(sGiantsChamberEntranceTable, "Z2_KYOJINNOMA"), + /* 0x67 */ SCENE_ENTRANCE(sGormanTrackEntranceTable, "Z2_KOEPONARACE"), + /* 0x68 */ SCENE_ENTRANCE(sGoronRacetrackEntranceTable, "Z2_GORONRACE"), + /* 0x69 */ SCENE_ENTRANCE(sEastClockTownEntranceTable, "Z2_TOWN"), + /* 0x6A */ SCENE_ENTRANCE(sWestClockTownEntranceTable, "Z2_ICHIBA"), + /* 0x6B */ SCENE_ENTRANCE(sNorthClockTownEntranceTable, "Z2_BACKTOWN"), + /* 0x6C */ SCENE_ENTRANCE(sSouthClockTownEntranceTable, "Z2_CLOCKTOWER"), + /* 0x6D */ SCENE_ENTRANCE(sLaundryPoolEntranceTable, "Z2_ALLEY"), }; /** * Returns a pointer to an entrance table from a given entrance index. */ -EntranceTableEntry* Entrance_GetTableEntry(u16 entranceIndex) { - u32 entranceIndex2 = entranceIndex; - EntranceTableEntry** tableEntryP = sSceneEntranceTable[entranceIndex2 >> 9].table; - EntranceTableEntry* tableEntry = tableEntryP[(entranceIndex2 >> 4) & 0x1F]; +EntranceTableEntry* Entrance_GetTableEntry(u16 entrance) { + u32 entranceIndex = entrance; + EntranceTableEntry** tableEntryP = sSceneEntranceTable[entranceIndex >> 9].table; + EntranceTableEntry* tableEntry = tableEntryP[(entranceIndex >> 4) & 0x1F]; - return &tableEntry[entranceIndex2 & 0xF]; + return &tableEntry[entranceIndex & 0xF]; } /** * Returns the scene index from a given entrance index. */ -s32 Entrance_GetSceneNum(u16 entranceIndex) { - EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entranceIndex); +s32 Entrance_GetSceneNum(u16 entrance) { + EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); return tableEntry->sceneNum; } @@ -2792,8 +2792,8 @@ s32 Entrance_GetSceneNum(u16 entranceIndex) { /** * Returns the absolute value scene index (since for some reason some of them are negative) from a given entrance index. */ -s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex) { - EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entranceIndex); +s32 Entrance_GetSceneNumAbsolute(u16 entrance) { + EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); return ABS_ALT(tableEntry->sceneNum); } @@ -2801,8 +2801,8 @@ s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex) { /** * Returns the spawn index from a given entrance index. */ -s32 Entrance_GetSpawnNum(u16 entranceIndex) { - EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entranceIndex); +s32 Entrance_GetSpawnNum(u16 entrance) { + EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); return tableEntry->spawnNum; } @@ -2810,8 +2810,8 @@ s32 Entrance_GetSpawnNum(u16 entranceIndex) { /** * Returns the transition effect flags from a given entrance index. */ -s32 Entrance_GetTransitionFlags(u16 entranceIndex) { - EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entranceIndex); +s32 Entrance_GetTransitionFlags(u16 entrance) { + EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); return tableEntry->flags; } diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index a22357624..8321a309e 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -924,30 +924,30 @@ s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation) { } /** - * Linearly interpolates the start and tactoret frame tables with the given weight, putting the result in dst + * Linearly interpolates the start and target frame tables with the given weight, putting the result in dst */ -void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* tactoret, f32 weight) { +void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* target, f32 weight) { s32 i; s16 diff; s16 base; if (weight < 1.0f) { - for (i = 0; i < limbCount; i++, dst++, start++, tactoret++) { + for (i = 0; i < limbCount; i++, dst++, start++, target++) { base = start->x; - diff = tactoret->x - base; + diff = target->x - base; dst->x = (s16)(diff * weight) + base; base = start->y; - diff = tactoret->y - base; + diff = target->y - base; dst->y = (s16)(diff * weight) + base; base = start->z; - diff = tactoret->z - base; + diff = target->z - base; dst->z = (s16)(diff * weight) + base; } } else { - for (i = 0; i < limbCount; i++, dst++, tactoret++) { - dst->x = tactoret->x; - dst->y = tactoret->y; - dst->z = tactoret->z; + for (i = 0; i < limbCount; i++, dst++, target++) { + dst->x = target->x; + dst->y = target->y; + dst->z = target->z; } } } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 2156950f1..7a234ca22 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -1,80 +1,96 @@ #include "global.h" +#include "z64snap.h" +#include "overlays/actors/ovl_En_Kakasi/z_en_kakasi.h" -typedef struct { - Actor actor; - s32 (*pictoFunc)(PlayState* play, Actor* actor); -} PictoActor; +#define PICTO_SEEN_IN_SCENE 1 +#define PICTO_SEEN_ANYWHERE 2 -s32 func_8013A240(PlayState* play) { +/** + * Test every loaded actor to see if it is a pictographable `PictoActor`, and if so, run its `validationFunc` to set + * appropriate flags. + * + * @return s32 Number of pictograph actors validly captured. + */ +s32 Snap_RecordPictographedActors(PlayState* play) { PictoActor* pictoActor; Actor* actor; - s32 type = 0; + s32 category = 0; s32 seen; - s32 count = 0; + s32 validCount = 0; gSaveContext.save.pictoFlags0 = 0; gSaveContext.save.pictoFlags1 = 0; if (play->sceneNum == SCENE_20SICHITAI) { - func_8013A41C(1); + Snap_SetFlag(PICTOGRAPH_IN_SWAMP); } - for (; type < 12; type++) { - for (actor = play->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) { + for (; category < ACTORCAT_MAX; category++) { + for (actor = play->actorCtx.actorLists[category].first; actor != NULL; actor = actor->next) { seen = 0; + // Actors which must be pictographed in a specific scene switch (play->sceneNum) { case SCENE_20SICHITAI: if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) { - seen = 1; + seen = PICTO_SEEN_IN_SCENE; } break; + default: seen = 0; + break; } if (actor->id) { ; // Needed to match } + // Actors which may be pictographed anywhere switch (actor->id) { case ACTOR_EN_KAKASI: - if ((actor->params & 1) == 1) { - seen |= 2; + if (KAKASI_GET_ABOVE_GROUND(actor) == 1) { + seen |= PICTO_SEEN_ANYWHERE; break; //! @bug break is inside conditional, meaning it falls through if it is false } + // FALLTHROUGH case ACTOR_EN_ZOV: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_BAL: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_DNQ: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; + case ACTOR_EN_GE1: case ACTOR_EN_GE3: case ACTOR_EN_KAIZOKU: case ACTOR_EN_GE2: - seen |= 2; + seen |= PICTO_SEEN_ANYWHERE; break; } - if (seen != 0) { + // If actor is recordable, run its validity function and record if valid + if (seen) { pictoActor = (PictoActor*)actor; - if (pictoActor->pictoFunc != NULL) { - if ((pictoActor->pictoFunc)(play, actor) == 0) { - count++; + if (pictoActor->validationFunc != NULL) { + if ((pictoActor->validationFunc)(play, actor) == 0) { + validCount++; } } } } } - return count; + return validCount; } -void func_8013A41C(s32 flag) { +// Only used in this file +void Snap_SetFlag(s32 flag) { if (flag < 0x20) { gSaveContext.save.pictoFlags0 |= (1 << flag); } else { @@ -83,7 +99,8 @@ void func_8013A41C(s32 flag) { } } -void func_8013A46C(s32 flag) { +// Unused +void Snap_UnsetFlag(s32 flag) { if (flag < 0x20) { gSaveContext.save.pictoFlags0 &= ~(1 << flag); } else { @@ -92,7 +109,7 @@ void func_8013A46C(s32 flag) { } } -u32 func_8013A4C4(s32 flag) { +u32 Snap_CheckFlag(s32 flag) { SaveContext* saveCtx = &gSaveContext; if (flag < 0x20) { @@ -103,13 +120,29 @@ u32 func_8013A4C4(s32 flag) { } } -s16 func_8013A504(s16 val) { - return (val >= 0) ? val : -val; +s16 Snap_AbsS(s16 val) { + return ABS(val); } -s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, - s16 angleError) { - Vec3f screenSpace; +/** + * Test if a pictograph is a valid pictograph of an actor + * + * @param play + * @param actor Actor to test + * @param flag Flag to set if checks successful + * @param pos position of point to test (generally a particular point in the actor's model) + * @param rot rotation of point to test (for facing camera) + * @param distanceMin closest point may be + * @param distanceMax farthest away point may be + * @param angleRange Size of range that counts as facing the camera (-1 is used for any allowed) + * @return s32 0 on success, `or`ed combination of the validity flag indices if not + * + * @note It is generally not possible to recover the actual failure mode(s) from the return value: oring `ret` with the + * actual flag rather than its index would rectify this. + */ +s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, + f32 distanceMax, s16 angleRange) { + Vec3f projectedPos; s16 x; s16 y; f32 distance; @@ -119,42 +152,51 @@ s32 func_8013A530(PlayState* play, Actor* actor, s32 flag, Vec3f* pos, Vec3s* ro s32 ret = 0; s32 bgId; + // Check distance distance = OLib_Vec3fDist(pos, &camera->eye); if ((distance < distanceMin) || (distanceMax < distance)) { - func_8013A41C(0x3F); - ret = 0x3F; + Snap_SetFlag(PICTOGRAPH_BAD_DISTANCE); + ret = PICTOGRAPH_BAD_DISTANCE; } - x = func_8013A504(Camera_GetCamDirPitch(camera) + rot->x); - y = func_8013A504(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF)); - if ((0 < angleError) && ((angleError < x) || (angleError < y))) { - func_8013A41C(0x3E); - ret |= 0x3E; + // Check rot is facing camera? + x = Snap_AbsS(Camera_GetCamDirPitch(camera) + rot->x); + y = Snap_AbsS(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF)); + if ((0 < angleRange) && ((angleRange < x) || (angleRange < y))) { + Snap_SetFlag(PICTOGRAPH_BAD_ANGLE); + ret |= PICTOGRAPH_BAD_ANGLE; } - Actor_GetProjectedPos(play, pos, &screenSpace, &distance); - x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85; - y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67; - if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) { - func_8013A41C(0x3D); - ret |= 0x3D; + // Check in capture region + Actor_GetProjectedPos(play, pos, &projectedPos, &distance); + // Convert to projected position to device coordinates, shift to be relative to the capture region's top-left corner + x = (s16)PROJECTED_TO_SCREEN_X(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_X; + y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_Y; + + // checks if the coordinates are within the capture region + if ((x < 0) || (x > PICTO_RESOLUTION_HORIZONTAL) || (y < 0) || (y > PICTO_RESOLUTION_VERTICAL)) { + Snap_SetFlag(PICTOGRAPH_NOT_IN_VIEW); + ret |= PICTOGRAPH_NOT_IN_VIEW; } - if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true, + // Check not obscured by bg collision + if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &projectedPos, &poly, true, true, true, true, &bgId)) { - func_8013A41C(0x3C); - ret |= 0x3C; + Snap_SetFlag(PICTOGRAPH_BEHIND_BG); + ret |= PICTOGRAPH_BEHIND_BG; } + // Check not obscured by actor collision actors[0] = actor; actors[1] = &GET_PLAYER(play)->actor; if (CollisionCheck_LineOCCheck(play, &play->colChkCtx, pos, &camera->eye, actors, 2)) { - func_8013A41C(0x3B); - ret |= 0x3B; + Snap_SetFlag(PICTOGRAPH_BEHIND_COLLISION); + ret |= PICTOGRAPH_BEHIND_COLLISION; } + // If all of the above checks pass, set the flag if (ret == 0) { - func_8013A41C(flag); + Snap_SetFlag(flag); } return ret; diff --git a/src/code/z_sound_source.c b/src/code/z_sound_source.c index 2cdc3ab3a..15ebd018a 100644 --- a/src/code/z_sound_source.c +++ b/src/code/z_sound_source.c @@ -16,7 +16,7 @@ void SoundSource_UpdateAll(PlayState* play) { for (i = 0; i < ARRAY_COUNT(play->soundSources); i++) { if (source->countdown != 0) { if (DECR(source->countdown) == 0) { - Audio_StopSfxByPos(&source->projectedPos); + AudioSfx_StopByPos(&source->projectedPos); } else { SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &source->worldPos, &source->projectedPos); if (source->playSfxEachFrame) { @@ -54,7 +54,7 @@ void SoundSource_Add(PlayState* play, Vec3f* worldPos, u32 duration, u16 sfxId, // If no sound source is available, replace the sound source with the smallest remaining countdown if (i >= ARRAY_COUNT(play->soundSources)) { source = backupSource; - Audio_StopSfxByPos(&source->projectedPos); + AudioSfx_StopByPos(&source->projectedPos); } source->worldPos = *worldPos; diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index bb6308fb6..5f92d13e5 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -501,7 +501,7 @@ u16 Sram_CalcChecksum(void* data, size_t count) { // Resets `Save` substruct void Sram_ResetSave(void) { - gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.equippedMask = 0; gSaveContext.save.isFirstCycle = false; gSaveContext.save.unk_06 = 0; @@ -845,7 +845,7 @@ void Sram_InitDebugSave(void) { gSaveContext.save.horseData.pos.z = -1285; gSaveContext.save.horseData.yaw = -0x7554; - gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.isFirstCycle = true; // @@ -910,7 +910,13 @@ void func_80144A94(SramContext* sramCtx) { gSaveContext.jinxTimer = 0; } -u16 D_801C6A58[] = { 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30 }; +u16 D_801C6A58[] = { + ENTRANCE(GREAT_BAY_COAST, 11), ENTRANCE(ZORA_CAPE, 6), + ENTRANCE(SNOWHEAD, 3), ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8), + ENTRANCE(SOUTH_CLOCK_TOWN, 9), ENTRANCE(MILK_ROAD, 4), + ENTRANCE(WOODFALL, 4), ENTRANCE(SOUTHERN_SWAMP_POISONED, 10), + ENTRANCE(IKANA_CANYON, 4), ENTRANCE(STONE_TOWER, 3), +}; void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { s32 i; @@ -973,22 +979,24 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { } if (gSaveContext.save.isFirstCycle) { - gSaveContext.save.entranceIndex = 0xD800; + gSaveContext.save.entrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0); gSaveContext.save.day = 0; gSaveContext.save.time = 0x3FFF; } else { - gSaveContext.save.entranceIndex = 0x1C00; + gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0); gSaveContext.nextCutsceneIndex = 0; gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; } } else { - gSaveContext.save.entranceIndex = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; - if ((gSaveContext.save.entranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { + gSaveContext.save.entrance = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; + if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && + (gSaveContext.save.weekEventReg[20] & 2)) { // Unconfirmed weekEventReg: "Woodfall Temple Prison Entrance raised / Water cleansed" - gSaveContext.save.entranceIndex = 0xCA0; - } else if ((gSaveContext.save.entranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { + gSaveContext.save.entrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); + } else if ((gSaveContext.save.entrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && + (gSaveContext.save.weekEventReg[33] & 0x80)) { // Unconfirmed weekEventReg: "Mountain Village Unfrozen" - gSaveContext.save.entranceIndex = 0xAE80; + gSaveContext.save.entrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { @@ -1000,10 +1008,10 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { } if (gSaveContext.save.unk_F65) { - Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.scarecrowsSong, - sizeof(gSaveContext.save.scarecrowsSong)); + Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.scarecrowSpawnSong, + sizeof(gSaveContext.save.scarecrowSpawnSong)); - for (i = 0; i != ARRAY_COUNT(gSaveContext.save.scarecrowsSong); i++) {} + for (i = 0; i != ARRAY_COUNT(gSaveContext.save.scarecrowSpawnSong); i++) {} } fileNum = gSaveContext.fileNum; @@ -1513,7 +1521,7 @@ void func_80146DF8(SramContext* sramCtx) { } void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { - if (gSaveContext.save.entranceIndex) {} // Required to match + if (gSaveContext.save.entrance) {} // Required to match func_801A3D98(gSaveContext.options.audioSetting); } diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index afc7f7168..efc6774a7 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -531,24 +531,24 @@ Actor* SubS_FindNearestActor(Actor* actor, PlayState* play, u8 actorCategory, s1 return closestActor; } -s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations, s32 index) { +s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { s32 endFrame; s32 startFrame; - animations += index; - endFrame = animations->frameCount; - if (animations->frameCount < 0) { - endFrame = Animation_GetLastFrame(&animations->animation->common); + animationInfo += animIndex; + endFrame = animationInfo->frameCount; + if (animationInfo->frameCount < 0) { + endFrame = Animation_GetLastFrame(&animationInfo->animation->common); } - startFrame = animations->startFrame; + startFrame = animationInfo->startFrame; if (startFrame >= endFrame || startFrame < 0) { return false; } - if (animations->playSpeed < 0.0f) { + if (animationInfo->playSpeed < 0.0f) { SWAP(s32, endFrame, startFrame); } - Animation_Change(skelAnime, animations->animation, animations->playSpeed, startFrame, endFrame, animations->mode, - animations->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, startFrame, endFrame, + animationInfo->mode, animationInfo->morphFrames); return true; } @@ -1357,21 +1357,21 @@ s32 SubS_ActorPathing_SetNextPoint(PlayState* play, ActorPathing* actorPath) { return reupdate; } -void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex, - s32* curIndex) { - AnimationSpeedInfo* animation = &animations[nextIndex]; +void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animationInfo, s32 nextAnimIndex, + s32* curAnimIndex) { + AnimationSpeedInfo* animation = &animationInfo[nextAnimIndex]; f32 startFrame = skelAnime->curFrame; f32 endFrame; f32 morphFrames; - if ((*curIndex < 0) || (nextIndex == *curIndex)) { + if ((*curAnimIndex < 0) || (nextAnimIndex == *curAnimIndex)) { morphFrames = 0.0f; - if (*curIndex < 0) { + if (*curAnimIndex < 0) { startFrame = 0.0f; } } else { morphFrames = animation->morphFrames; - if (nextIndex != *curIndex) { + if (nextAnimIndex != *curAnimIndex) { startFrame = 0.0f; } } @@ -1383,7 +1383,7 @@ void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* a } Animation_Change(skelAnime, animation->animation, animation->playSpeed, startFrame, endFrame, animation->mode, morphFrames); - *curIndex = nextIndex; + *curAnimIndex = nextAnimIndex; } s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type) { diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h index cee615da1..7afe3a2ce 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -15,7 +15,7 @@ typedef struct ArmsHook { /* 0x1EC */ Vec3f unk1EC; /* 0x1F8 */ Actor* grabbed; /* 0x1FC */ Vec3f unk1FC; - /* 0x208 */ char unk208[0x2]; + /* 0x208 */ UNK_TYPE1 unk208[0x2]; /* 0x20A */ s16 timer; /* 0x20C */ ArmsHookActionFunc actionFunc; } ArmsHook; // size = 0x210 diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index 7880410a6..1a0cb5058 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -15,7 +15,23 @@ void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play); void BgCraceMovebg_Update(Actor* thisx, PlayState* play); void BgCraceMovebg_Draw(Actor* thisx, PlayState* play); -#if 0 +s32 func_80A7090C(PlayState* play); +void func_80A70970(BgCraceMovebg* this, PlayState* play); +void func_80A7099C(BgCraceMovebg* this, PlayState* play); +void func_80A709E4(BgCraceMovebg* this, PlayState* play); +void func_80A70A08(BgCraceMovebg* this, PlayState* play); +void func_80A70A84(BgCraceMovebg* this, PlayState* play); +void func_80A70A9C(BgCraceMovebg* this, PlayState* play); +void func_80A70C04(BgCraceMovebg* this, PlayState* play); +void func_80A70D74(BgCraceMovebg* this, PlayState* play); +void func_80A70DA8(BgCraceMovebg* this, PlayState* play); +void func_80A70E2C(BgCraceMovebg* this, PlayState* play); +void func_80A70E70(BgCraceMovebg* this, PlayState* play); +void func_80A70F14(BgCraceMovebg* this, PlayState* play); +void func_80A70F2C(BgCraceMovebg* this, PlayState* play); +void func_80A70FF4(BgCraceMovebg* this, PlayState* play); +void func_80A71040(BgCraceMovebg* this, PlayState* play); + const ActorInit Bg_Crace_Movebg_InitVars = { ACTOR_BG_CRACE_MOVEBG, ACTORCAT_BG, @@ -28,47 +44,256 @@ const ActorInit Bg_Crace_Movebg_InitVars = { (ActorFunc)BgCraceMovebg_Draw, }; -#endif +static u8 D_80A710A0 = 0; +static u8 D_80A710A4 = 0; +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), +}; +static Vec3f D_80A710AC[] = { 0.0f, 0.0f, 1.0f }; +u8 D_80A711B0[32]; -extern UNK_TYPE D_060003A0; -extern UNK_TYPE D_06000E00; +void BgCraceMovebg_Init(Actor* thisx, PlayState* play) { + BgCraceMovebg* this = THIS; + s32 i; + s32 j; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/BgCraceMovebg_Init.s") + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + if (D_80A710A0 == 0) { + for (i = 0; i < ARRAY_COUNT(D_80A711B0); i++) { + D_80A711B0[i] = 0; + } + D_80A710A0 = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A7090C.s") + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_crace_object_Colheader_000E00); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70970.s") + this->unk184 = this->dyna.actor.world.rot.x; + this->unk16C = this->dyna.actor.world.rot.z; + this->dyna.actor.world.rot.x = 0; + this->dyna.actor.world.rot.z = 0; + this->dyna.actor.home.rot.x = 0; + this->dyna.actor.home.rot.z = 0; + this->dyna.actor.flags |= ACTOR_FLAG_10000000; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A7099C.s") + switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { + case 0: + case 2: + for (j = 0; j < D_80A710A4; j++) { + if (D_80A711B0[j] == this->unk184) { + this->unk170 |= 8; + Actor_MarkForDeath(&this->dyna.actor); + return; + } + } + if (D_80A710A4 < ARRAY_COUNT(D_80A711B0)) { + D_80A711B0[(s32)D_80A710A4++] = this->unk184; + } + this->dyna.actor.room = -1; + switch (func_80A7090C(play)) { + case 0: + func_80A70D74(this, play); + break; + case 1: + func_80A70D74(this, play); + break; + case 2: + Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); + func_80A70D74(this, play); + break; + } + break; + case 1: + func_80A70970(this, play); + break; + default: + Actor_MarkForDeath(&this->dyna.actor); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A709E4.s") +s32 func_80A7090C(PlayState* play) { + s32 pad; + s32 returnVal = 0; + Actor* tempActor = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNO); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70A08.s") + if (tempActor != NULL) { + if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_3F80(tempActor))) { + returnVal = 2; + } else { + returnVal = 1; + } + } + return returnVal; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70A84.s") +void func_80A70970(BgCraceMovebg* this, PlayState* play) { + this->unk164 = 0.0f; + this->unk160 = 0.0f; + this->actionFunc = func_80A7099C; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70A9C.s") +void func_80A7099C(BgCraceMovebg* this, PlayState* play) { + if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) { + func_80A709E4(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/BgCraceMovebg_Destroy.s") +void func_80A709E4(BgCraceMovebg* this, PlayState* play) { + this->actionFunc = func_80A70A08; + this->unk164 = 180.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/BgCraceMovebg_Update.s") +void func_80A70A08(BgCraceMovebg* this, PlayState* play) { + func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); + Math_SmoothStepToF(&this->unk160, this->unk164, 2.0f, this->unk16C, 0.01f); + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; + if (this->unk160 == this->unk164) { + func_80A70A84(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70C04.s") +void func_80A70A84(BgCraceMovebg* this, PlayState* play) { + this->actionFunc = func_80A70A9C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70D74.s") +void func_80A70A9C(BgCraceMovebg* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70DA8.s") +void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play) { + BgCraceMovebg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70E2C.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + if (!(this->unk170 & 0x8)) { + switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { + case 0: + case 2: + Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx)); + Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx) + 1); + break; + case 1: + Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx)); + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70E70.s") +void BgCraceMovebg_Update(Actor* thisx, PlayState* play) { + BgCraceMovebg* this = THIS; + s32 pad; + Player* player = GET_PLAYER(play); + s16 tempRot; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70F14.s") + switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { + case 0: + case 2: + tempRot = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.home.rot.y; + if ((tempRot >= -0x4000) && (tempRot <= 0x4000)) { + this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; + } else { + this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + 0x8000; + } + default: + this->actionFunc(this, play); + Math_Vec3f_Copy(&this->unk188, &player->bodyPartsPos[0]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70F2C.s") +void func_80A70C04(BgCraceMovebg* this, PlayState* play) { + s32 pad; + Player* player = GET_PLAYER(play); + Vec3f intersect; + Vec3f diff; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A70FF4.s") + if ((BGCRACEMOVEBG_GET_F(&this->dyna.actor) != 2) && + SubS_LineSegVsPlane(&this->dyna.actor.home.pos, &this->dyna.actor.home.rot, D_80A710AC, &this->unk188, + &player->bodyPartsPos[0], &intersect)) { + Matrix_RotateYS(-this->dyna.actor.home.rot.y, MTXMODE_NEW); + Math_Vec3f_Diff(&player->bodyPartsPos[0], &this->dyna.actor.home.pos, &diff); + Matrix_MultVec3f(&diff, &this->unk178); + if (fabsf(this->unk178.x) < 100.0f && this->unk178.y >= -10.0f && this->unk178.y <= 180.0f) { + if (this->unk178.z < 0.0f) { + Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); + this->unk170 |= 2; + } else { + Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); + this->unk170 &= ~2; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/func_80A71040.s") +void func_80A70D74(BgCraceMovebg* this, PlayState* play) { + this->unk164 = 180.0f; + this->unk160 = 180.0f; + this->actionFunc = func_80A70DA8; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Crace_Movebg/BgCraceMovebg_Draw.s") +void func_80A70DA8(BgCraceMovebg* this, PlayState* play) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; + func_80A70C04(this, play); + if (this->unk170 & 1) { + func_80A70E2C(this, play); + } + if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) { + func_80A70F14(this, play); + } +} + +void func_80A70E2C(BgCraceMovebg* this, PlayState* play) { + this->unk174 = BGCRACEMOVEBG_GET_F800(&this->dyna.actor) * 10; + this->unk164 = 180.0f; + this->unk160 = 180.0f; + this->actionFunc = func_80A70E70; +} + +void func_80A70E70(BgCraceMovebg* this, PlayState* play) { + if (this->unk174 > 0) { + this->unk174--; + } + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; + func_80A70C04(this, play); + if (this->unk174 <= 0) { + this->unk160 = 180.0f; + this->unk164 = 0.0f; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f; + Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor)); + func_80A70F14(this, play); + } +} + +void func_80A70F14(BgCraceMovebg* this, PlayState* play) { + this->actionFunc = func_80A70F2C; +} + +void func_80A70F2C(BgCraceMovebg* this, PlayState* play) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; + func_80A70C04(this, play); + if (Math_StepToF(&this->unk160, 0.0f, 1.0f)) { + if (!(this->unk170 & 2) && !Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1)) { + play->unk_18845 = 1; + func_80169FDC(&play->state); + play_sound(NA_SE_OC_ABYSS); + } + func_80A70FF4(this, play); + } else { + func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_CLOSE_S - SFX_FLAG); + } +} + +void func_80A70FF4(BgCraceMovebg* this, PlayState* play) { + this->unk164 = 0.0f; + this->unk160 = 0.0f; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + this->actionFunc = func_80A71040; +} + +void func_80A71040(BgCraceMovebg* this, PlayState* play) { +} + +void BgCraceMovebg_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_crace_object_DL_0003A0); +} diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h index c1e4940d6..4faca7ba2 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h @@ -2,18 +2,29 @@ #define Z_BG_CRACE_MOVEBG_H #include "global.h" +#include "assets/objects/object_crace_object/object_crace_object.h" struct BgCraceMovebg; typedef void (*BgCraceMovebgActionFunc)(struct BgCraceMovebg*, PlayState*); +#define BGCRACEMOVEBG_GET_F(thisx) (((thisx)->params) & 0xF) +#define BGCRACEMOVEBG_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) +#define BGCRACEMOVEBG_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) +#define BGCRACEMOVEBG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F) + typedef struct BgCraceMovebg { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgCraceMovebgActionFunc actionFunc; - /* 0x160 */ char unk_160[0x10]; - /* 0x170 */ s32 unk_170; - /* 0x174 */ char unk_174[0x20]; + /* 0x160 */ f32 unk160; + /* 0x164 */ f32 unk164; + /* 0x168 */ UNK_TYPE1 pad168[0x4]; + /* 0x16C */ f32 unk16C; + /* 0x170 */ s32 unk170; + /* 0x174 */ s32 unk174; + /* 0x178 */ Vec3f unk178; + /* 0x184 */ u8 unk184; + /* 0x188 */ Vec3f unk188; } BgCraceMovebg; // size = 0x194 extern const ActorInit Bg_Crace_Movebg_InitVars; 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 555f92798..d849ab5ed 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 @@ -467,7 +467,7 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { phi_f2 = this->unk_178; temp2 = this->unk_17A; if ((phi_f2 * temp2) <= 0.0f) { - func_801A7328(&this->dyna.actor.projectedPos, NA_SE_EV_SEESAW_INCLINE - SFX_FLAG); + AudioSfx_StopByPosAndId(&this->dyna.actor.projectedPos, NA_SE_EV_SEESAW_INCLINE - SFX_FLAG); } phi_f2 *= 0.0022222223f; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 2bd5d103a..c42d96c0f 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -289,7 +289,7 @@ void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->unk_160 == 9) || (this->unk_160 == 8)) { - Audio_StopSfxByPos(&this->unk_1A8); + AudioSfx_StopByPos(&this->unk_1A8); } } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c index b119c46af..8100c6205 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c @@ -5,6 +5,7 @@ */ #include "z_bg_hakugin_elvpole.h" +#include "objects/object_hakugin_obj/object_hakugin_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -17,7 +18,6 @@ void BgHakuginElvpole_Draw(Actor* thisx, PlayState* play); void func_80ABD92C(BgHakuginElvpole* this, PlayState* play); -#if 0 const ActorInit Bg_Hakugin_Elvpole_InitVars = { ACTOR_BG_HAKUGIN_ELVPOLE, ACTORCAT_BG, @@ -30,17 +30,104 @@ const ActorInit Bg_Hakugin_Elvpole_InitVars = { (ActorFunc)BgHakuginElvpole_Draw, }; -#endif +void BgHakuginElvpole_Init(Actor* thisx, PlayState* play) { + s32 pad; + CollisionHeader* colHeader = NULL; + BgHakuginElvpole* this = THIS; -extern UNK_TYPE D_0600ACB8; -extern UNK_TYPE D_0600BF40; + Actor_SetScale(&this->dyna.actor, 0.1f); + this->actionFunc = func_80ABD92C; + DynaPolyActor_Init(&this->dyna, 0); + CollisionHeader_GetVirtual(&object_hakugin_obj_Colheader_00BF40, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->unk_15C = 0; + this->unk_160 = false; + if ((BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor) != 0x7F) && + Flags_GetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor))) { + this->unk_15E = 0x64; + } else { + this->unk_15E = -1; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 320.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Init.s") +void BgHakuginElvpole_Destroy(Actor* thisx, PlayState* play) { + BgHakuginElvpole* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Destroy.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/func_80ABD92C.s") +void func_80ABD92C(BgHakuginElvpole* this, PlayState* play) { + s32 pad; + s32 sp28 = false; + f32 var_fv1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Update.s") + if (this->unk_15E > 0) { + if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) < -120.0f) { + this->dyna.actor.world.pos.y += 4.0f; + sp28 = true; + } else if (this->unk_15E > 0) { + if (this->unk_15E == 100) { + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + } + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 120.0f; + //! FAKE: + if (1) {} + this->unk_15E--; + } + } else if (this->unk_15E == 0) { + if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) > -320.0f) { + this->dyna.actor.world.pos.y -= 4.0f; + sp28 = true; + } else { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 320.0f; + Flags_UnsetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor)); + this->unk_15E = -1; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + } + } else if ((BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor) != 0x7F) && + Flags_GetSwitch(play, BGHAKUGINELVPOLE_GET_SWITCHFLAG(&this->dyna.actor))) { + this->unk_15E = 0x64; + this->unk_160 = true; + } + if (sp28 || (this->unk_15C & 7)) { + if (this->unk_15C & 1) { + var_fv1 = 1.0f; + } else { + var_fv1 = -1.0f; + } + this->unk_15C++; + this->dyna.actor.world.pos.x = (Math_SinS(this->unk_15C * 0x2000) * var_fv1) + this->dyna.actor.home.pos.x; + this->dyna.actor.world.pos.z = (Math_CosS(this->unk_15C * 0x2000) * var_fv1) + this->dyna.actor.home.pos.z; + func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + } else { + this->unk_15C = 0; + } + if (this->unk_160) { + if (this->dyna.actor.cutscene == -1) { + this->unk_160 = false; + return; + } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + this->unk_160 = false; + return; + } + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Hakugin_Elvpole/BgHakuginElvpole_Draw.s") +void BgHakuginElvpole_Update(Actor* thisx, PlayState* play) { + BgHakuginElvpole* this = THIS; + + this->actionFunc(this, play); +} + +void BgHakuginElvpole_Draw(Actor* thisx, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + + 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++, object_hakugin_obj_DL_00ACB8); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h index 777c49864..b8316a4e6 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.h @@ -5,11 +5,15 @@ struct BgHakuginElvpole; +#define BGHAKUGINELVPOLE_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) + typedef void (*BgHakuginElvpoleActionFunc)(struct BgHakuginElvpole*, PlayState*); typedef struct BgHakuginElvpole { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x20]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ s16 unk_15C; + /* 0x15E */ s16 unk_15E; + /* 0x160 */ u16 unk_160; /* 0x164 */ BgHakuginElvpoleActionFunc actionFunc; } BgHakuginElvpole; // size = 0x168 diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index cc29867e5..0bc385cb7 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -153,7 +153,7 @@ void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { func_80C0A86C(this, play, 4, 14, 1); - Flags_UnsetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this)); + Flags_UnsetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor)); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); func_80C0AC74(this); } else { @@ -167,7 +167,7 @@ void func_80C0AC74(BgIkninSusceil* this) { } void func_80C0AC90(BgIkninSusceil* this, PlayState* play) { - if (Flags_GetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this))) { + if (Flags_GetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor))) { func_80C0ACD4(this); } } diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h index f5f5b384f..8fc32bd06 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.h @@ -3,7 +3,7 @@ #include "global.h" -#define GET_SUSCEIL_SWITCHFLAG(this) (((this)->dyna.actor.params) & 0x7F) +#define SUSCEIL_GET_SWITCHFLAG(thisx) (((thisx)->params) & 0x7F) struct BgIkninSusceil; 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 76c117032..7fb51ff8d 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -245,10 +245,10 @@ void func_809541B8(BgIngate* this, PlayState* play) { void func_809542A0(BgIngate* this, PlayState* play) { if (gSaveContext.eventInf[5] & 1) { - play->nextEntranceIndex = 0xA820; + play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 2); gSaveContext.eventInf[5] &= (u8)~1; } else { - play->nextEntranceIndex = 0xA810; + play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 1); } gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c index 60ca416bc..86854cbe8 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c @@ -145,7 +145,7 @@ void BgKin2Bombwall_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); bombwallCollider = &this->collider; Collider_InitCylinder(play, bombwallCollider); - if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this))) { + if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor))) { Actor_MarkForDeath(&this->dyna.actor); } else { DynaPolyActor_LoadMesh(play, &this->dyna, &gOceanSpiderHouseBombableWallCol); @@ -184,7 +184,7 @@ void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this) { void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this)); + Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h index 86b0afab3..17370427a 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.h @@ -1,7 +1,7 @@ #ifndef Z_BG_KIN2_BOMBWALL_H #define Z_BG_KIN2_BOMBWALL_H -#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) (thisx->dyna.actor.params & 0x7F) +#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #include "global.h" diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c index 43e5e94f1..36226212e 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c @@ -49,8 +49,8 @@ void BgLadder_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->switchFlag = GET_BGLADDER_SWITCHFLAG(thisx); - thisx->params = GET_BGLADDER_SIZE(thisx); + this->switchFlag = BGLADDER_GET_SWITCHFLAG(thisx); + thisx->params = BGLADDER_GET_SIZE(thisx); DynaPolyActor_Init(&this->dyna, 0); size = thisx->params; diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h index e5fe13b74..c53a80352 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.h @@ -3,8 +3,8 @@ #include "global.h" -#define GET_BGLADDER_SIZE(actor) ((actor)->params & 0xFF) -#define GET_BGLADDER_SWITCHFLAG(actor) (((actor)->params >> 8) & 0xFF) +#define BGLADDER_GET_SIZE(thisx) ((thisx)->params & 0xFF) +#define BGLADDER_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0xFF) struct BgLadder; @@ -18,10 +18,10 @@ typedef struct BgLadder { } BgLadder; // size = 0x164 typedef enum { - LADDER_SIZE_12RUNG, - LADDER_SIZE_16RUNG, - LADDER_SIZE_20RUNG, - LADDER_SIZE_24RUNG, + /* 0 */ LADDER_SIZE_12RUNG, + /* 1 */ LADDER_SIZE_16RUNG, + /* 2 */ LADDER_SIZE_20RUNG, + /* 3 */ LADDER_SIZE_24RUNG, } BgLadderSize; extern const ActorInit Bg_Ladder_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index a1795d849..2b4c24381 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -10,12 +10,33 @@ #define THIS ((BgLastBwall*)thisx) +typedef struct { + /* 0x0 */ Vec3s* posOffsets; + /* 0x4 */ s16* indices; + /* 0x8 */ s32 count; +} BgLastBwallInitColliderStruct; // size = 0xC + +typedef struct { + /* 0x0 */ Gfx* dList; + /* 0x4 */ void* pad4; + /* 0x8 */ CollisionHeader* colHeader; +} BgLastBwallModelInfo; // size = 0xC + void BgLastBwall_Init(Actor* thisx, PlayState* play); void BgLastBwall_Destroy(Actor* thisx, PlayState* play); void BgLastBwall_Update(Actor* thisx, PlayState* play); void BgLastBwall_Draw(Actor* thisx, PlayState* play); -#if 0 +void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider, + BgLastBwallInitColliderStruct* arg4); +void func_80C187E4(BgLastBwall* this); +void func_80C184EC(BgLastBwall* this, PlayState* play); +void func_80C187F8(BgLastBwall* this, PlayState* play); +void func_80C1886C(BgLastBwall* this, PlayState* play); +void func_80C18884(BgLastBwall* this, PlayState* play); +void func_80C188C4(BgLastBwall* this, PlayState* play); +void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play); + const ActorInit Bg_Last_Bwall_InitVars = { ACTOR_BG_LAST_BWALL, ACTORCAT_BG, @@ -28,57 +49,217 @@ const ActorInit Bg_Last_Bwall_InitVars = { (ActorFunc)BgLastBwall_Draw, }; -// static ColliderTrisElementInit sTrisElementsInit[2] = { -static ColliderTrisElementInit D_80C189C0[2] = { +static ColliderTrisElementInit sTrisElementsInit[] = { { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000008, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { -70.0f, 0.0f, 3.0f }, { 70.0f, 0.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000008, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { { { 70.0f, 0.0f, 3.0f }, { 70.0f, 200.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } }, }, }; -// static ColliderTrisInit sTrisInit = { -static ColliderTrisInit D_80C18A38 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_TRIS, }, - ARRAY_COUNT(sTrisElementsInit), D_80C189C0, // sTrisElementsInit, +static ColliderTrisInit sTrisInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_TRIS, + }, + ARRAY_COUNT(sTrisElementsInit), + sTrisElementsInit, }; -// static InitChainEntry sInitChain[] = { +static BgLastBwallModelInfo D_80C18A48[] = { + { object_last_obj_DL_0001A8, NULL, &object_last_obj_Colheader_000288 }, + { object_last_obj_DL_001318, NULL, &object_last_obj_Colheader_001450 }, +}; + +static Vec3s D_80C18A60[] = { + { 280, 280, -40 }, + { 280, 280, 120 }, + { 280, 400, 120 }, + { 280, 400, -40 }, +}; + +static s16 D_80C18A78[] = { 0, 1, 2, 0, 2, 3 }; + +static BgLastBwallInitColliderStruct D_80C18A84 = { D_80C18A60, D_80C18A78, 2 }; + +static Vec3s D_80C18A90[] = { + { -80, 400, -80 }, + { -80, 400, 80 }, + { 80, 400, 80 }, + { 80, 400, -80 }, +}; + +static s16 D_80C18AA8[] = { 0, 3, 2, 0, 2, 1 }; + +static BgLastBwallInitColliderStruct D_80C18AB4 = { D_80C18A90, D_80C18AA8, 2 }; + +static BgLastBwallInitColliderStruct* D_80C18AC0[] = { &D_80C18A84, &D_80C18AB4 }; + static InitChainEntry D_80C18AC8[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider, + BgLastBwallInitColliderStruct* arg4) { + s32 i; + s32 j; + Vec3f sp6C[3]; + Vec3f sp60; + Vec3f sp54; -extern ColliderTrisElementInit D_80C189C0[2]; -extern ColliderTrisInit D_80C18A38; -extern InitChainEntry D_80C18AC8[]; + Matrix_RotateYS(rot->y, MTXMODE_NEW); + Matrix_RotateXS(rot->x, MTXMODE_APPLY); + Matrix_RotateZS(rot->z, MTXMODE_APPLY); + for (i = 0; i < init->count; i++) { + for (j = 0; j < 3; j++) { + Math_Vec3s_ToVec3f(&sp60, &arg4->posOffsets[arg4->indices[j]]); + Matrix_MultVec3f(&sp60, &sp54); + Math_Vec3f_Sum(&sp54, pos, &sp6C[j]); + } -extern UNK_TYPE D_06000098; + arg4->indices += 3; + Collider_SetTrisVertices(collider, i, &sp6C[0], &sp6C[1], &sp6C[2]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18240.s") +void BgLastBwall_Init(Actor* thisx, PlayState* play) { + s32 pad; + BgLastBwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Init.s") + Actor_ProcessInitChain(&this->dyna.actor, D_80C18AC8); + this->type = BGLASTBWALL_GET_TYPE(&this->dyna.actor); + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80C18A48[this->type].colHeader); + Collider_InitTris(play, &this->colliderTris); + if (Flags_GetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor))) { + Actor_MarkForDeath(&this->dyna.actor); + } else if (!Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, &sTrisInit, this->colliderTrisElement)) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + BgLastBwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot, + &this->colliderTris, D_80C18AC0[this->type]); + SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + func_80C187E4(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Destroy.s") +void BgLastBwall_Destroy(Actor* thisx, PlayState* play) { + BgLastBwall* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C184EC.s") + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187E4.s") +void func_80C184EC(BgLastBwall* this, PlayState* play) { + f32 randVar; + Vec3f spD0; + Vec3f effectPosAndAccel; + s32 var_v0; + Vec3f effectVelocity; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187F8.s") + Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + Matrix_RotateZS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY); + for (i = 0; i < 30; i++) { + switch (this->type) { + case BGLASTBWALL_TYPE_0: + spD0.x = 280.0f; + spD0.y = Rand_Centered() * 160.0f + 320.0f; + spD0.z = Rand_Centered() * 160.0f; + Matrix_MultVec3f(&spD0, &effectPosAndAccel); + Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel); + break; + case BGLASTBWALL_TYPE_1: + spD0.x = Rand_Centered() * 160.0f; + spD0.y = 400.0f; + spD0.z = Rand_Centered() * 160.0f; + Matrix_MultVec3f(&spD0, &effectPosAndAccel); + Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel); + break; + } + func_800BBFB0(play, &effectPosAndAccel, 50.0f, 2, Rand_ZeroOne() * 120.0f + 20.0f, + Rand_ZeroOne() * 240.0f + 20.0f, 0); + effectVelocity.x = Rand_ZeroOne() * 2.5f; + effectVelocity.y = Rand_ZeroOne() * 2.5f + 1.0f; + effectVelocity.z = Rand_ZeroOne() * 2.5f; + randVar = Rand_ZeroOne(); + if (randVar < 0.2f) { + var_v0 = 0x60; + } else if (randVar < 0.6f) { + var_v0 = 0x40; + } else { + var_v0 = 0x20; + } + EffectSsKakera_Spawn(play, &effectPosAndAccel, &effectVelocity, &effectPosAndAccel, -260, var_v0, 20, 0, 0, 10, + 0, 0, 50, -1, OBJECT_LAST_OBJ, object_last_obj_DL_000098); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C1886C.s") +void func_80C187E4(BgLastBwall* this) { + this->actionFunc = func_80C187F8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18884.s") +void func_80C187F8(BgLastBwall* this, PlayState* play) { + if (this->colliderTris.base.acFlags & 2) { + this->colliderTris.base.acFlags &= ~2; + Flags_SetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor)); + func_80C1886C(this, play); + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C188C4.s") +void func_80C1886C(BgLastBwall* this, PlayState* play) { + this->actionFunc = func_80C18884; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18928.s") +void func_80C18884(BgLastBwall* this, PlayState* play) { + if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + func_80C188C4(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Update.s") +void func_80C188C4(BgLastBwall* this, PlayState* play) { + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + this->dyna.actor.draw = NULL; + func_80C184EC(this, play); + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); + this->actionFunc = BgLastBwall_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Draw.s") +void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play) { +} + +void BgLastBwall_Update(Actor* thisx, PlayState* play) { + BgLastBwall* this = THIS; + + this->actionFunc(this, play); +} + +void BgLastBwall_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + BgLastBwall* this = THIS; + + Gfx_DrawDListOpa(play, D_80C18A48[this->type].dList); +} diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h index c393b55af..d24b8ba42 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h @@ -2,16 +2,27 @@ #define Z_BG_LAST_BWALL_H #include "global.h" +#include "objects/object_last_obj/object_last_obj.h" struct BgLastBwall; typedef void (*BgLastBwallActionFunc)(struct BgLastBwall*, PlayState*); +#define BGLASTBWALL_GET_SWITCHFLAGS(thisx) ((thisx)->params & 0x7F) +#define BGLASTBWALL_GET_TYPE(thisx) (((thisx)->params >> 0xC) & 0xF) + +typedef enum { + BGLASTBWALL_TYPE_0 = 0, + BGLASTBWALL_TYPE_1 = 1, +} BgLastBwallType; + typedef struct BgLastBwall { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgLastBwallActionFunc actionFunc; - /* 0x160 */ char unk_160[0xDC]; + /* 0x160 */ ColliderTris colliderTris; + /* 0x180 */ ColliderTrisElement colliderTrisElement[2]; + /* 0x238 */ u8 type; + /* 0x23A */ s16 cutscenes[1]; } BgLastBwall; // size = 0x23C extern const ActorInit Bg_Last_Bwall_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index 4325bc259..296f56268 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -338,7 +338,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { if (this->unk_164 > 3.0f) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WEB_VIBRATION); } else { - func_801A75E8(NA_SE_EV_WEB_VIBRATION); + AudioSfx_StopById(NA_SE_EV_WEB_VIBRATION); } } @@ -350,23 +350,20 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -#ifdef NON_MATCHING void func_809CE830(BgSpdweb* this, PlayState* play) { Vec3f spDC; Vec3f spD0; Vec3f spC4; - f32 spB0; - f32 spA4; - f32 sp9C; - f32 sp94; - f32 sp90; - f32 temp_f20; - f32 temp_f22; - f32 temp_f28; - f32 temp_f30; s32 i; - s16 temp_s0; s16 temp_s3; + s16 temp_s0; + f32 cosF2; + f32 sinF2; + f32 cosQ; + f32 sinQ; + f32 cosF1; + f32 sinF1; + f32 temp_f28; if (this->unk_162 != 0) { this->unk_162--; @@ -382,38 +379,34 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { if ((this->unk_162 % 3) == 0) { temp_s3 = Rand_ZeroOne() * 0x2AAA; - spB0 = Math_CosS(this->dyna.actor.shape.rot.x); - temp_f20 = Math_SinS(this->dyna.actor.shape.rot.x); - temp_f30 = Math_CosS(this->dyna.actor.shape.rot.y); - spA4 = Math_SinS(this->dyna.actor.shape.rot.y); - if (1) {} + cosQ = Math_CosS(this->dyna.actor.shape.rot.x); + sinQ = Math_SinS(this->dyna.actor.shape.rot.x); + cosF1 = Math_CosS(this->dyna.actor.shape.rot.y); + sinF1 = Math_SinS(this->dyna.actor.shape.rot.y); - spC4.x = this->dyna.actor.world.pos.x + ((90.0f * temp_f20) * spA4); - spC4.y = this->dyna.actor.world.pos.y + (90.0f * spB0); - spC4.z = this->dyna.actor.world.pos.z + ((90.0f * temp_f20) * temp_f30); - - sp94 = temp_f20 * spA4; - sp90 = temp_f20 * temp_f30; + spC4.x = this->dyna.actor.world.pos.x + 90.0f * sinQ * sinF1; + spC4.y = this->dyna.actor.world.pos.y + 90.0f * cosQ; + spC4.z = this->dyna.actor.world.pos.z + 90.0f * sinQ * cosF1; for (i = 0; i < 6; i++) { temp_s0 = (s32)randPlusMinusPoint5Scaled(0x2800) + temp_s3; - temp_f20 = Math_SinS(temp_s0); - temp_f22 = Math_CosS(temp_s0); + sinF2 = Math_SinS(temp_s0); + cosF2 = Math_CosS(temp_s0); - spD0.x = spC4.x + (90.0f * ((sp94 * temp_f22) + (temp_f30 * temp_f20))); - spD0.y = spC4.y + ((90.0f * spB0) * temp_f22); - spD0.z = spC4.z + (90.0f * ((sp90 * temp_f22) - (spA4 * temp_f20))); + spD0.x = spC4.x + 90.0f * ((cosF1 * sinF2) + (sinQ * sinF1 * cosF2)); + spD0.y = spC4.y + 90.0f * cosQ * cosF2; + spD0.z = spC4.z + 90.0f * ((sinQ * cosF1 * cosF2) - (sinF1 * sinF2)); temp_f28 = Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &spD0) * (1.0f / 90.0f); if (temp_f28 < 0.65f) { temp_f28 = 1.0f - temp_f28; - temp_f20 = Math_SinS(BINANG_ROT180(temp_s0)); - temp_f22 = Math_CosS(BINANG_ROT180(temp_s0)); + sinF2 = Math_SinS(BINANG_ROT180(temp_s0)); + cosF2 = Math_CosS(BINANG_ROT180(temp_s0)); } - spDC.x = (6.5f * temp_f28) * ((temp_f30 * temp_f20) + (temp_f22 * sp94)); - spDC.y = temp_f22 * ((6.5f * temp_f28) * spB0); - spDC.z = (6.5f * temp_f28) * ((temp_f22 * sp90) - (spA4 * temp_f20)); + spDC.x = 6.5f * temp_f28 * ((cosF1 * sinF2) + (sinQ * sinF1 * cosF2)); + spDC.y = 6.5f * temp_f28 * cosQ * cosF2; + spDC.z = 6.5f * temp_f28 * ((sinQ * cosF1 * cosF2) - (sinF1 * sinF2)); EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &spDC, &gZeroVec3f, &D_809CF208, &D_809CF20C, 0x3C, 8, 0xE); @@ -423,9 +416,6 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spdweb/func_809CE830.s") -#endif void func_809CEBC0(BgSpdweb* this, PlayState* play) { Player* player = GET_PLAYER(play); 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 8a1d3e76b..3ed675c5f 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1634,8 +1634,8 @@ void func_809DD934(Boss02* this, PlayState* play) { if (player->stateFlags1 & 0x100) { Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_8016566C(150); this->unk_1D14 = 0; this->subCamAtVel = 0.0f; @@ -2032,7 +2032,7 @@ void func_809DD934(Boss02* this, PlayState* play) { this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY); Matrix_MultVecY(1.0f, &this->subCamUp); - Play_CameraSetAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); ShrinkWindow_SetLetterboxTarget(27); } } @@ -2060,8 +2060,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { } Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 2; this->unk_1D1C = 0; @@ -2157,8 +2157,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == -1) { Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->unk_1D20 = 101; this->unk_1D1C = 0; this->subCamAtVel = 1.0f; @@ -2238,7 +2238,7 @@ void func_809DEAC4(Boss02* this, PlayState* play) { 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); + Play_SetCameraAtEyeUp(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_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 4e48d076d..43cce6afa 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -808,8 +808,8 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) { if (this->unk_2B8 > 30.0f) { if ((&this->actor != player->actor.parent) && (play->grabPlayer(play, player) != 0)) { player->actor.parent = &this->actor; - Audio_PlaySfxGeneral(NA_SE_VO_LI_DAMAGE_S, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, - &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_VO_LI_DAMAGE_S, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Boss03_SetupChewPlayer(this, play); } } else { @@ -1152,8 +1152,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->actor.world.rot.y = -0x7B30; this->prevPlayerPos.y = 1850.0f; @@ -1410,8 +1410,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); } } @@ -1452,8 +1452,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(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 @@ -1616,7 +1616,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { this->actor.focus.pos.z, 0, 0, 0, 0); this->csTimer = 0; Actor_SetScale(&this->actor, 0.0f); - Audio_StopSfxByPos(&this->actor.projectedPos); + AudioSfx_StopByPos(&this->actor.projectedPos); } break; @@ -1644,7 +1644,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -1666,8 +1666,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 1); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); this->csState = 1; this->unk_2BE = 0xBB8; @@ -1735,7 +1735,7 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } 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 2fb1e79b7..3524efa53 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -260,8 +260,8 @@ void func_809EC568(Boss04* this, PlayState* play) { this->unk_704 = 0; Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(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; @@ -405,8 +405,8 @@ void func_809EC568(Boss04* this, PlayState* play) { } 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); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); Math_ApproachF(&this->subCamFov, 60.0f, 0.1f, 1.0f); } this->actor.shape.rot.y = this->actor.yawTowardsPlayer; 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 29506a372..045a76995 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -201,8 +201,8 @@ void func_809F24C8(Boss06* this, PlayState* play) { Cutscene_Start(play, &play->csCtx); func_800B7298(play, &this->actor, 7); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); D_809F4970->unk_151 = 1; this->unk_1C9 = 1; this->unk_1C8 = 1; @@ -340,7 +340,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { ShrinkWindow_SetLetterboxTarget(27); - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } #else @@ -625,7 +625,7 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); Matrix_Pop(); } diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h index ce809a32a..4b8227021 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h @@ -18,13 +18,22 @@ typedef struct BossHakuginEffect { #define BOSS_HAKUGIN_EFFECT_COUNT 180 +typedef struct BossHakuginFhgFlashUnkStruct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ char unk_0C[0x8]; +} BossHakuginFhgFlashUnkStruct; // size = 0x14 + typedef struct BossHakugin { /* 0x0000 */ Actor actor; /* 0x0144 */ char unk_0144[0x44]; /* 0x0188 */ BossHakuginActionFunc actionFunc; - /* 0x018C */ char unk_018C[0x86C]; + /* 0x018C */ char unk_018C[0x5]; + /* 0x0191 */ u8 unk_191; + /* 0x018C */ char unk_0192[0x866]; /* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT]; - /* 0x2618 */ char unk_2618[0x11F8]; + /* 0x2618 */ char unk_2618[0x8E8]; + /* 0x2F00 */ BossHakuginFhgFlashUnkStruct unk_2F00[7][15]; + /* 0x3734 */ char unk_3734[0xDC]; } BossHakugin; // size = 0x3810 extern const ActorInit Boss_Hakugin_InitVars; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 8aba01fc0..64c42a1ce 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -515,11 +515,11 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) { worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + Play_GetScreenPos(play, &worldPos, &screenPos); // checking if particle is on screen - if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && - screenPos.y < SCREEN_HEIGHT) { + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); scaleAlpha = this->effects[i].alpha / 50.0f; if (scaleAlpha > 1.0f) { @@ -604,11 +604,11 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) { worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; - func_80169474(play, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT + Play_GetScreenPos(play, &worldPos, &screenPos); // checking if effect is on screen - if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && - screenPos.y < SCREEN_HEIGHT) { + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); alphaScale = this->effects[i].alpha / 50.0f; if (alphaScale > 1.0f) { 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 57a6f3312..b3a79895e 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -183,19 +183,19 @@ void func_80C168D0(DemoSyoten* this, PlayState* play) { s32 pad; Path* path = this->unk_3E8; Vec3s* points; - Vec3f sp30; - Vec3f sp24; - f32 sp20; + Vec3f worldPos; + Vec3f projectedPos; + f32 invW; if (path != NULL) { points = Lib_SegmentedToVirtual(this->unk_3E8->points); points += this->unk_3EC; - Math_Vec3s_ToVec3f(&sp30, points); - Actor_GetProjectedPos(play, &sp30, &sp24, &sp20); - Math_Vec3f_Copy(&sp30, &this->actor.projectedPos); - sp30.z = sp30.y; - sp24.z = sp24.y; - this->actor.shape.rot.z = -Math_Vec3f_Yaw(&sp24, &sp30); + Math_Vec3s_ToVec3f(&worldPos, points); + Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW); + Math_Vec3f_Copy(&worldPos, &this->actor.projectedPos); + worldPos.z = worldPos.y; + projectedPos.z = projectedPos.y; + this->actor.shape.rot.z = -Math_Vec3f_Yaw(&projectedPos, &worldPos); } } diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 4a4fc6956..541a4d93d 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -15,10 +15,6 @@ void DmAh_Destroy(Actor* thisx, PlayState* play); void DmAh_Update(Actor* thisx, PlayState* play); void DmAh_Draw(Actor* thisx, PlayState* play); -void func_80C1D7FC(DmAh* this, PlayState* play); -void func_80C1D92C(DmAh* this, PlayState* play); - -#if 0 const ActorInit Dm_Ah_InitVars = { ACTOR_DM_AH, ACTORCAT_NPC, @@ -31,32 +27,232 @@ const ActorInit Dm_Ah_InitVars = { (ActorFunc)DmAh_Draw, }; -#endif +static AnimationInfoS sAnimations[] = { + { &object_ah_Anim_001860, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_ah_Anim_000DDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +}; -extern UNK_TYPE D_06009E70; +s32 func_80C1D410(DmAh* this, s32 animationIndex) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D410.s") + if (animationIndex != this->animationIndex) { + this->animationIndex = animationIndex; + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, animationIndex); + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D458.s") +void func_80C1D458(DmAh* this) { + if (DECR(this->unk_286) == 0) { + this->unk_284++; + if (this->unk_284 >= 4) { + this->unk_286 = Rand_S16Offset(30, 30); + this->unk_284 = 0; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D4D0.s") +s32 func_80C1D4D0(DmAh* this, s32 arg1) { + s32 pad; + Vec3f sp40; + Vec3f sp34; + s16 temp_v0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D6E0.s") + Math_Vec3f_Copy(&sp40, &this->unk_280->world.pos); + Math_Vec3f_Copy(&sp34, &this->actor.world.pos); + temp_v0 = Math_Vec3f_Yaw(&sp34, &sp40); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D78C.s") + Math_ApproachS(&this->unk_28C, (temp_v0 - this->unk_290) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_28C = CLAMP(this->unk_28C, -0x1FFE, 0x1FFE); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D7FC.s") + Math_ApproachS(&this->unk_290, (temp_v0 - this->unk_28C) - this->actor.shape.rot.y, 4, 0x2AA8); + this->unk_290 = CLAMP(this->unk_290, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D92C.s") + if (this->unk_280->id == ACTOR_PLAYER) { + sp40.y = ((Player*)this->unk_280)->bodyPartsPos[7].y + 3.0f; + } else { + Math_Vec3f_Copy(&sp40, &this->unk_280->focus.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Init.s") + Math_Vec3f_Copy(&sp34, &this->actor.focus.pos); + Math_ApproachS(&this->unk_28A, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28E, 4, 0x2AA8); + this->unk_28A = CLAMP(this->unk_28A, -0x1C70, 0x1C70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Destroy.s") + Math_ApproachS(&this->unk_28E, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28A, 4, 0x2AA8); + this->unk_28E = CLAMP(this->unk_28E, -0x1C70, 0x1C70); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Update.s") +s32 func_80C1D6E0(DmAh* this, PlayState* play) { + if (this->unk_280 != NULL) { + func_80C1D4D0(this, play); + this->unk_27C &= ~1; + this->unk_27C |= 2; + } else if (this->unk_27C & 2) { + this->unk_27C &= ~2; + this->unk_28A = 0; + this->unk_28C = 0; + this->unk_28E = 0; + this->unk_290 = 0; + this->unk_288 = 20; + } else if (DECR(this->unk_288) == 0) { + this->unk_27C |= 1; + } + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DAD4.s") +Actor* func_80C1D78C(PlayState* play) { + Actor* tempActor; + Actor* foundActor = NULL; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DB24.s") + while (true) { + foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AN); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Draw.s") + if ((foundActor == NULL) || (foundActor->update != NULL)) { + break; + } + + tempActor = foundActor->next; + if (tempActor == NULL || false) { + foundActor = NULL; + break; + } + foundActor = tempActor; + } + return foundActor; +} + +void func_80C1D7FC(DmAh* this, PlayState* play) { + s32 D_80C1DE00[] = { 0, 0, 0, 0, 0 }; + u16 csAction; + s32 actionIndex; + + if (play->csCtx.state != 0) { + if (!this->unk_29C) { + this->action = 0xFF; + this->unk_29C = 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; + func_80C1D410(this, D_80C1DE00[csAction]); + } + Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + } + } else if (this->unk_29C) { + this->unk_29C = false; + func_80C1D410(this, this->animationIndex2); + } +} + +void func_80C1D92C(DmAh* this, PlayState* play) { +} + +void DmAh_Init(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ah_Skel_009E70, NULL, this->morphTable, this->jointTable, + OBJECT_AH_LIMB_MAX); + this->animationIndex = -1; + func_80C1D410(this, 0); + this->actor.flags &= ~ACTOR_FLAG_1; + Actor_SetScale(&this->actor, 0.01f); + this->unk_27C |= 1; + if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + this->unk_280 = func_80C1D78C(play); + func_80C1D410(this, 1); + this->actionFunc = func_80C1D92C; + } else { + this->actionFunc = func_80C1D7FC; + } +} + +void DmAh_Destroy(Actor* thisx, PlayState* play) { +} + +void DmAh_Update(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + this->actionFunc(this, play); + func_80C1D6E0(this, play); + SkelAnime_Update(&this->skelAnime); + func_80C1D458(this); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); +} + +static Vec3f D_80C1DE14 = { 1000.0f, 0.0f, 0.0f }; + +void DmAh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + if (limbIndex == OBJECT_AH_LIMB_07) { + Matrix_MultVec3f(&D_80C1DE14, &thisx->focus.pos); + Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot); + } +} + +void DmAh_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { + DmAh* this = THIS; + s32 stepRot; + s32 overrideRot; + + if (!(this->unk_27C & 1)) { + if (this->unk_27C & 2) { + overrideRot = true; + } else { + overrideRot = false; + } + stepRot = true; + } else { + stepRot = false; + overrideRot = false; + } + + if (limbIndex == OBJECT_AH_LIMB_07) { + SubS_UpdateLimb(BINANG_ADD(this->unk_28A + this->unk_28E, 0x4000), + BINANG_ADD(this->unk_28C + this->unk_290 + this->actor.shape.rot.y, 0x4000), &this->unk_18C, + &this->unk_1A4, stepRot, overrideRot); + Matrix_Pop(); + Matrix_Translate(this->unk_18C.x, this->unk_18C.y, this->unk_18C.z, MTXMODE_NEW); + Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->unk_1A4.y, MTXMODE_APPLY); + Matrix_RotateXS(this->unk_1A4.x, MTXMODE_APPLY); + Matrix_RotateZS(this->unk_1A4.z, MTXMODE_APPLY); + Matrix_Push(); + } else if (limbIndex == OBJECT_AH_LIMB_02) { + SubS_UpdateLimb(BINANG_ADD(this->unk_28E, 0x4000), BINANG_ADD(this->unk_290 + this->actor.shape.rot.y, 0x4000), + &this->unk_198, &this->unk_1AA, stepRot, overrideRot); + Matrix_Pop(); + Matrix_Translate(this->unk_198.x, this->unk_198.y, this->unk_198.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->unk_1AA.y, MTXMODE_APPLY); + Matrix_RotateXS(this->unk_1AA.x, MTXMODE_APPLY); + Matrix_RotateZS(this->unk_1AA.z, MTXMODE_APPLY); + Matrix_Push(); + } +} + +static TexturePtr D_80C1DE20[] = { object_ah_Tex_008D70, object_ah_Tex_009570 }; + +static TexturePtr D_80C1DE28[] = { + object_ah_Tex_006D70, object_ah_Tex_007570, object_ah_Tex_007D70, object_ah_Tex_007570, object_ah_Tex_008570, +}; + +void DmAh_Draw(Actor* thisx, PlayState* play) { + DmAh* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1DE28[this->unk_284])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1DE20[0])); + + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, NULL, DmAh_PostLimbDraw, DmAh_TransformLimbDraw, + &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h index f52f92d69..dc9a437ed 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h @@ -2,6 +2,7 @@ #define Z_DM_AH_H #include "global.h" +#include "objects/object_ah/object_ah.h" struct DmAh; @@ -9,9 +10,27 @@ typedef void (*DmAhActionFunc)(struct DmAh*, PlayState*); typedef struct DmAh { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ DmAhActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x114]; + /* 0x18C */ Vec3f unk_18C; + /* 0x198 */ Vec3f unk_198; + /* 0x1A4 */ Vec3s unk_1A4; + /* 0x1AA */ Vec3s unk_1AA; + /* 0x1B0 */ Vec3s morphTable[OBJECT_AH_LIMB_MAX]; + /* 0x216 */ Vec3s jointTable[OBJECT_AH_LIMB_MAX]; + /* 0x27C */ u16 unk_27C; + /* 0x27E */ u8 action; + /* 0x280 */ Actor* unk_280; + /* 0x284 */ s16 unk_284; + /* 0x286 */ s16 unk_286; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ s16 unk_28C; + /* 0x28E */ s16 unk_28E; + /* 0x290 */ s16 unk_290; + /* 0x294 */ s32 animationIndex; + /* 0x298 */ s32 animationIndex2; + /* 0x29C */ s32 unk_29C; } DmAh; // size = 0x2A0 extern const ActorInit Dm_Ah_InitVars; 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 ce3e18ab2..6c7a1be69 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -27,16 +27,21 @@ const ActorInit Dm_Al_InitVars = { (ActorFunc)DmAl_Draw, }; -static AnimationInfoS sAnimationInfos[] = { +typedef enum { + /* 0 */ MADAME_AROMA_ANIM_0, + /* 1 */ MADAME_AROMA_ANIM_1 +} DmAlAnimation; + +static AnimationInfoS sAnimationInfo[] = { { &object_al_Anim_00DBE0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, }; -s32 DmAl_ChangeAnimation(DmAl* this, s32 animationIndex) { +s32 DmAl_ChangeAnim(DmAl* this, s32 animIndex) { s32 didAnimationChange = false; - if (animationIndex != this->animationIndex) { - this->animationIndex = animationIndex; - didAnimationChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfos, animationIndex); + if (animIndex != this->animIndex) { + this->animIndex = animIndex; + didAnimationChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); } return didAnimationChange; } @@ -50,20 +55,20 @@ void func_80C1BDD8(DmAl* this, PlayState* play) { if (!this->unk_45C) { this->action = 0xFF; this->unk_45C = true; - this->animationIndex2 = this->animationIndex; + this->animIndex2 = this->animIndex; } 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]); + DmAl_ChangeAnim(this, D_80C1C280[csAction]); } Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); } } else if (this->unk_45C) { this->unk_45C = false; - DmAl_ChangeAnimation(this, this->animationIndex2); + DmAl_ChangeAnim(this, this->animIndex2); } } @@ -73,8 +78,8 @@ void DmAl_Init(Actor* thisx, PlayState* play) { 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->animIndex = -1; + DmAl_ChangeAnim(this, MADAME_AROMA_ANIM_0); this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80C1BDD8; 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 f15513177..8f89a4448 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h @@ -16,16 +16,11 @@ typedef struct DmAl { /* 0x30C */ Vec3s jointTable[MADAME_AROMA_LIMB_MAX]; /* 0x3AE */ Vec3s morphTable[MADAME_AROMA_LIMB_MAX]; /* 0x450 */ u8 action; - /* 0x454 */ s32 animationIndex; - /* 0x458 */ s32 animationIndex2; + /* 0x454 */ s32 animIndex; + /* 0x458 */ s32 animIndex2; /* 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_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index aec59f032..64b6a7a98 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -33,7 +33,7 @@ const ActorInit Dm_An_InitVars = { (ActorFunc)NULL, }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_an1_Anim_007E08, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_an1_Anim_0071E8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_an4_Anim_006CC0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -83,7 +83,7 @@ s32 func_80C1C4D8(DmAn* this, PlayState* play, s32 arg2) { if ((objectIndex2 >= 0) && (arg2 != this->unk_2C8)) { gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex2].segment); this->unk_2C8 = arg2; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment); } return ret; diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index e6864bf3e..04dd13ca4 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -30,7 +30,7 @@ const ActorInit Dm_Bal_InitVars = { (ActorFunc)DmBal_Draw, }; -static AnimationInfo D_80C1F170[] = { +static AnimationInfo sAnimationInfo[] = { { &object_bal_Anim_0005FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &object_bal_Anim_000840, 1.5f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &object_bal_Anim_000840, 1.5f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, @@ -86,14 +86,14 @@ void func_80C1EAE8(DmBal* this, PlayState* play) { case 1: this->unk_336 = 0; this->eyeIndex = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80C1F170, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; case 2: this->unk_336 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80C1F170, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); break; case 3: - Actor_ChangeAnimationByInfo(&this->skelAnime, D_80C1F170, 13); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 13); break; } } else if (D_80C1F2C0 == 3) { 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 5efd088ae..177c5784d 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -32,7 +32,7 @@ const ActorInit Dm_Char00_InitVars = { (ActorFunc)DmChar00_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gameplay_keep_Anim_02B2E8, 1.0f, 0.0f, -1.0f, 0, 0.0f }, { &gameplay_keep_Anim_029140, 1.0f, 0.0f, -1.0f, 0, 0.0f }, { &object_delf_Anim_004FF4, 1.0f, 0.0f, -1.0f, 2, 0.0f }, @@ -542,7 +542,7 @@ void DmChar00_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, this->morphTable, 7); ActorShape_Init(&thisx->shape, 0.0f, NULL, 15.0f); - func_80AA5580(&this->skelAnime, sAnimations, 0); + func_80AA5580(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(thisx, 0.01f); this->actionFunc = func_80AA67F8; } @@ -783,7 +783,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { this->unk_261 = 0; break; } - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); } } Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); @@ -796,7 +796,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { case 0x4: case 0x5: this->unk_261 += 4; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); this->skelAnime.curFrame = 37.0f; break; @@ -805,7 +805,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { case 0x14: case 0x15: this->unk_261 += 2; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); break; case 0xA: @@ -833,18 +833,18 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { case 0x50: case 0x53: this->unk_261 += 1; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); break; case 0x2D: this->unk_261 = 19; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); break; case 0x46: case 0x4D: this->unk_261 = 0; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); break; } } @@ -856,7 +856,7 @@ void func_80AA67F8(DmChar00* this, PlayState* play) { if ((play->csCtx.state == 0) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) { if (this->unk_261 != 42) { this->unk_261 = 42; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); } Math_SmoothStepToF(&this->actor.world.pos.x, 0.0f, 0.5f, 0.5f, 0.001f); @@ -865,7 +865,7 @@ void func_80AA67F8(DmChar00* this, PlayState* play) { if (player->actor.world.pos.z < -625.0f) { this->unk_261 = 43; - func_80AA5580(&this->skelAnime, &sAnimations[this->unk_261], 0); + func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); this->actionFunc = func_80AA695C; this->skelAnime.playSpeed = 1.5f; } 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 1844783ff..5a6695816 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -32,32 +32,32 @@ 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; + /* 0 */ DMCHAR02_ANIM_HIT_GROUND, + /* 1 */ DMCHAR02_ANIM_TURN_AROUND, + /* 2 */ DMCHAR02_ANIM_JUGGLE, + /* 3 */ DMCHAR02_ANIM_FALL, +} DmChar02Animation; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &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_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animation, u16 index) { +void DmChar02_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animationInfo, u16 animIndex) { f32 frameCount; - animation += index; + animationInfo += animIndex; - if (animation->frameCount < 0.0f) { - frameCount = Animation_GetLastFrame(animation->animation); + if (animationInfo->frameCount < 0.0f) { + frameCount = Animation_GetLastFrame(animationInfo->animation); } else { - frameCount = animation->frameCount; + frameCount = animationInfo->frameCount; } - Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, frameCount, - animation->mode, animation->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + frameCount, animationInfo->mode, animationInfo->morphFrames); } void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) { @@ -84,11 +84,11 @@ void DmChar02_Init(Actor* thisx, PlayState* play) { DmChar02* this = THIS; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { - this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; + this->animIndex = DMCHAR02_ANIM_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_ChangeAnimation(&this->skelAnime, sAnimations, 0); + DmChar02_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmChar02_PerformCutsceneActions; } else { @@ -108,25 +108,25 @@ void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play) { if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { switch (play->csCtx.actorActions[actionIndex]->action) { default: - this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; + this->animIndex = DMCHAR02_ANIM_HIT_GROUND; shouldChangeAnimation = false; break; case 1: - this->animIndex = DMCHAR02_ANIMATION_HIT_GROUND; + this->animIndex = DMCHAR02_ANIM_HIT_GROUND; break; case 2: - this->animIndex = DMCHAR02_ANIMATION_TURN_AROUND; + this->animIndex = DMCHAR02_ANIM_TURN_AROUND; break; case 4: - this->animIndex = DMCHAR02_ANIMATION_FALL; + this->animIndex = DMCHAR02_ANIM_FALL; break; } if (shouldChangeAnimation) { - DmChar02_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); + DmChar02_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } @@ -134,9 +134,9 @@ void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->animIndex == DMCHAR02_ANIMATION_TURN_AROUND) { + if (this->animIndex == DMCHAR02_ANIM_TURN_AROUND) { this->animIndex++; - DmChar02_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); + DmChar02_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } } 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 6c44fb5e6..397fbfa3c 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -32,20 +32,20 @@ const ActorInit Dm_Char03_InitVars = { (ActorFunc)DmChar03_Draw, }; -AnimationInfo sAnimations[] = { { &object_osn_Anim_020530, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f } }; +AnimationInfo sAnimationInfo[] = { { &object_osn_Anim_020530, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f } }; -void DmChar03_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) { +void DmChar03_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animationInfo, u16 animIndex) { f32 frame; - animInfo += index; + animationInfo += animIndex; - if (animInfo->frameCount < 0.0f) { - frame = Animation_GetLastFrame(animInfo->animation); + if (animationInfo->frameCount < 0.0f) { + frame = Animation_GetLastFrame(animationInfo->animation); } else { - frame = animInfo->frameCount; + frame = animationInfo->frameCount; } - Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, frame, animInfo->mode, - animInfo->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, frame, + animationInfo->mode, animationInfo->morphFrames); } void DmChar03_Init(Actor* thisx, PlayState* play) { @@ -56,7 +56,7 @@ void DmChar03_Init(Actor* thisx, PlayState* play) { 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); + DmChar03_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmChar03_DoNothing; } @@ -119,7 +119,7 @@ void func_80AAB710(DmChar03* this, PlayState* play) { } if (shouldChangeAnim) { - DmChar03_ChangeAnimation(&this->skelAnime, &sAnimations[this->animIndex], 0); + DmChar03_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } Cutscene_ActorTranslateAndYaw(&this->actor, play, index); 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 6c97624a8..f7b4b47e8 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c @@ -30,10 +30,10 @@ const ActorInit Dm_Char04_InitVars = { (ActorFunc)DmChar04_Draw, }; -void DmChar04_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animation, u16 index) { +void DmChar04_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animation, u16 animIndex) { f32 endFrame; - animation += index; + animation += animIndex; if (animation->frameCount < 0.0f) { endFrame = Animation_GetLastFrame(animation->animation); @@ -44,7 +44,7 @@ void DmChar04_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animation, u16 ind animation->mode, animation->morphFrames); } -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &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 }, }; @@ -72,7 +72,7 @@ void DmChar04_Init(Actor* thisx, PlayState* play) { 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); + DmChar04_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80AABE34; } @@ -90,11 +90,11 @@ void func_80AABE34(DmChar04* this, PlayState* play) { 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; + this->animIndex = 0; } else { - this->animationIndex = 0; + this->animIndex = 0; } - DmChar04_ChangeAnim(&this->skelAnime, &sAnimations[this->animationIndex], 0); + DmChar04_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); 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 91de6d567..42c4a8501 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h @@ -16,7 +16,7 @@ typedef struct DmChar04 { /* 0x240 */ Color_RGBAf primColors; /* 0x250 */ Color_RGBAf envColors; /* 0x260 */ u8 csAction; - /* 0x261 */ u8 animationIndex; + /* 0x261 */ u8 animIndex; /* 0x262 */ u16 timer; } DmChar04; // size = 0x264 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 40807c77c..44e5732ad 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -47,7 +47,7 @@ const ActorInit Dm_Char05_InitVars = { (ActorFunc)DmChar05_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_dmask_Anim_001090, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dmask_Anim_004288, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dmask_Anim_0001A8, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, @@ -76,9 +76,9 @@ void func_80AAC63C(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_010B0, NULL, NULL, NULL, 0); if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { - func_80AAC5A0(&this->skelAnime, &sAnimations[0], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[0], 0); } else { - func_80AAC5A0(&this->skelAnime, &sAnimations[1], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[1], 0); } this->actionFunc = func_80AACC48; } @@ -88,7 +88,7 @@ void func_80AAC6E4(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_042B0, NULL, NULL, NULL, 0); - func_80AAC5A0(&this->skelAnime, &sAnimations[1], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[1], 0); this->actionFunc = func_80AACC48; } @@ -97,7 +97,7 @@ void func_80AAC770(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_dmask_Skel_001D0, NULL, NULL, NULL, 0); - func_80AAC5A0(&this->skelAnime, &sAnimations[3], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[3], 0); this->actionFunc = func_80AACC48; } @@ -106,7 +106,7 @@ void func_80AAC7FC(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &object_dmask_Skel_013D0, NULL, NULL, NULL, 0); - func_80AAC5A0(&this->skelAnime, &sAnimations[4], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[4], 0); this->actionFunc = func_80AACC48; } @@ -347,7 +347,7 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } if (sp2F) { - func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[this->unk_18C], 0); } } @@ -391,7 +391,7 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } if (sp2F) { - func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[this->unk_18C], 0); } } @@ -434,7 +434,7 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } if (sp2F) { - func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[this->unk_18C], 0); } } @@ -470,7 +470,7 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } if (sp2F) { - func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[this->unk_18C], 0); } } @@ -484,7 +484,7 @@ void func_80AACF04(DmChar05* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->unk_18C == 4) { this->unk_18C++; - func_80AAC5A0(&this->skelAnime, &sAnimations[this->unk_18C], 0); + func_80AAC5A0(&this->skelAnime, &sAnimationInfo[this->unk_18C], 0); } } break; diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c index 191fb16c4..a419ed5aa 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c @@ -15,11 +15,9 @@ void DmChar06_Destroy(Actor* thisx, PlayState* play); void DmChar06_Update(Actor* thisx, PlayState* play); void DmChar06_Draw(Actor* thisx, PlayState* play); +void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc); void func_80AAE6F0(DmChar06* this, PlayState* play); -void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc); - -#if 0 const ActorInit Dm_Char06_InitVars = { ACTOR_DM_CHAR06, ACTORCAT_ITEMACTION, @@ -32,18 +30,60 @@ const ActorInit Dm_Char06_InitVars = { (ActorFunc)DmChar06_Draw, }; -#endif +void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -extern UNK_TYPE D_06006868; +void DmChar06_Init(Actor* thisx, PlayState* play) { + DmChar06* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_SetupAction.s") + gSaveContext.save.weekEventReg[33] |= 0x80; + Actor_SetScale(&this->actor, 1.0f); + this->alpha = 255; + DmChar06_SetupAction(this, func_80AAE6F0); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Init.s") +void DmChar06_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Destroy.s") +void func_80AAE6F0(DmChar06* this, PlayState* play) { + if (Cutscene_CheckActorAction(play, 0x1CF)) { + s32 actionIndex = Cutscene_GetActorActionIndex(play, 0x1CF); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/func_80AAE6F0.s") + if ((play->csCtx.frames >= play->csCtx.actorActions[actionIndex]->startFrame) && + (play->csCtx.actorActions[actionIndex]->endFrame >= play->csCtx.frames)) { + if (play->csCtx.actorActions[actionIndex]->action == 1) { + this->alpha = 255; + } else if (play->csCtx.actorActions[actionIndex]->action == 2) { + f32 lerp = 1.0f - Environment_LerpWeight(play->csCtx.actorActions[actionIndex]->endFrame, + play->csCtx.actorActions[actionIndex]->startFrame, + play->csCtx.frames); + this->alpha = 255 * lerp; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Update.s") +void DmChar06_Update(Actor* thisx, PlayState* play) { + DmChar06* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char06/DmChar06_Draw.s") + this->actionFunc(this, play); +} + +void DmChar06_Draw(Actor* thisx, PlayState* play) { + s32 pad; + DmChar06* this = THIS; + + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_yukiyama_Matanimheader_006868)); + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + Scene_SetRenderModeXlu(play, 1, 2); + gDPPipeSync(POLY_XLU_DISP++); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, object_yukiyama_DL_0013A8); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h index 49a026063..c6b83b4ff 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.h @@ -2,6 +2,7 @@ #define Z_DM_CHAR06_H #include "global.h" +#include "assets/objects/object_yukiyama/object_yukiyama.h" struct DmChar06; @@ -9,9 +10,10 @@ typedef void (*DmChar06ActionFunc)(struct DmChar06*, PlayState*); typedef struct DmChar06 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x14C]; + /* 0x144 */ UNK_TYPE1 pad144[0x14C]; /* 0x290 */ DmChar06ActionFunc actionFunc; - /* 0x294 */ char unk_294[0x10]; + /* 0x294 */ UNK_TYPE1 pad294[0xC]; + /* 0x2A0 */ u8 alpha; } DmChar06; // size = 0x2A4 extern const ActorInit Dm_Char06_InitVars; 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 39f09856a..8d3528347 100644 --- a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h +++ b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h @@ -25,9 +25,9 @@ typedef enum { typedef struct DmChar07 { /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ char pad15C[0x14C]; + /* 0x15C */ UNK_TYPE1 pad15C[0x14C]; /* 0x2A8 */ DmChar07ActionFunc actionFunc; - /* 0x2AC */ char pad2AC[0xD]; + /* 0x2AC */ UNK_TYPE1 pad2AC[0xD]; /* 0x2B9 */ u8 spotlightFlags; /* 0x2BA */ u8 isStage; } DmChar07; // size = 0x2BC diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index b9847da81..8f02a8bb4 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -15,11 +15,9 @@ void DmChar09_Destroy(Actor* thisx, PlayState* play); void DmChar09_Update(Actor* thisx, PlayState* play); void DmChar09_Draw(Actor* thisx, PlayState* play); -void func_80AB1FDC(DmChar09* this, PlayState* play); -void func_80AB2258(DmChar09* this, PlayState* play); +void DmChar09_DoNothing(DmChar09* this, PlayState* play); void func_80AB2268(DmChar09* this, PlayState* play); -#if 0 const ActorInit Dm_Char09_InitVars = { ACTOR_DM_CHAR09, ACTORCAT_ITEMACTION, @@ -32,28 +30,197 @@ const ActorInit Dm_Char09_InitVars = { (ActorFunc)DmChar09_Draw, }; -#endif +static AnimationInfo sAnimationInfo[] = { + { &object_bee_Anim_00005C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, +}; -extern UNK_TYPE D_0600005C; +void DmChar09_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animationInfo, u16 animIndex) { + f32 frameCount; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB1E10.s") + animationInfo += animIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/DmChar09_Init.s") + if (animationInfo->frameCount < 0.0f) { + frameCount = Animation_GetLastFrame(animationInfo->animation); + } else { + frameCount = animationInfo->frameCount; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/DmChar09_Destroy.s") + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + frameCount, animationInfo->mode, animationInfo->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB1FA0.s") +void DmChar09_Init(Actor* thisx, PlayState* play) { + DmChar09* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB1FDC.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); + SkelAnime_Init(play, &this->skelAnime, &object_bee_Skel_001398, &object_bee_Anim_00005C, this->jointTable, + this->morphTable, OBJECT_BEE_LIMB_MAX); + DmChar09_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); + Actor_SetScale(&this->actor, 0.01f); + this->unk_228 = Rand_ZeroOne() * 65535.0f; + this->unk_22A = Rand_ZeroOne() * 65535.0f; + this->actionFunc = DmChar09_DoNothing; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB2258.s") +void DmChar09_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB2268.s") +void func_80AB1FA0(DmChar09* this, s32 arg1) { + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->unk_224[arg1]); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB24BC.s") +void func_80AB1FDC(DmChar09* this, PlayState* play) { + Actor* thisx = &this->actor; + Vec3f sp58; + f32 sp54; + f32 phi_fa0; + f32 phi_fv0; + Vec3f sp40; + s32 phi_a1; + Vec3s* temp_v1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/DmChar09_Update.s") + Math_Vec3f_Copy(&sp40, &thisx->world.pos); + Math_Vec3s_ToVec3f(&sp58, this->unk_224 + this->unk_21C + this->unk_220); + Math_Vec3f_Diff(&sp58, &thisx->world.pos, &thisx->velocity); + sp54 = Math3D_Vec3fMagnitude(&thisx->velocity); + if ((sp54 < (this->speed * 8.0f)) && (this->speed > 2.0f)) { + phi_fv0 = ((this->speed - 2.0f) * 0.1f) + 2.0f; + phi_fa0 = this->speed * 0.03f; + } else { + phi_fv0 = this->speed; + phi_fa0 = this->speed * 0.16f; + } + Math_StepToF(&thisx->speedXZ, phi_fv0, phi_fa0); + if ((thisx->speedXZ + 0.05f) < sp54) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / sp54); + thisx->world.pos.x += thisx->velocity.x; + thisx->world.pos.y += thisx->velocity.y; + thisx->world.pos.z += thisx->velocity.z; + } else { + this->unk_21C += this->unk_220; + thisx->speedXZ *= 0.4f; + phi_a1 = true; + if (((this->unk_21C >= this->unk_218) && (this->unk_220 > 0)) || + ((this->unk_21C <= 0) && (this->unk_220 < 0))) { + temp_v1 = this->unk_224 + this->unk_218; + if (((this->unk_224->x == temp_v1->x) && (this->unk_224->y == temp_v1->y)) && + (this->unk_224->z == temp_v1->z)) { + this->unk_21C = 0; + this->unk_220 = 1; + } else { + phi_a1 = false; + this->actionFunc = func_80AB2268; + } + } + if (phi_a1) { + func_80AB1FA0(this, this->unk_21C); + } + } + Math_SmoothStepToS(&thisx->world.rot.y, Math_Vec3f_Yaw(&thisx->world.pos, &sp40) + 0x7FFF, 1, 0x7D0, 0); + thisx->shape.rot.y = thisx->world.rot.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/func_80AB25D8.s") +void DmChar09_DoNothing(DmChar09* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char09/DmChar09_Draw.s") +void func_80AB2268(DmChar09* this, PlayState* play) { + Path* path; + s32 pad; + s32 i; + s32 actionIndex; + s32 max = 0; + s32 pathnum; + u8 temp = false; + + if (!DMCHAR09_GET_F(&this->actor)) { + if (play->csCtx.currentCsIndex == 1) { + temp = true; + } + } else if (play->csCtx.currentCsIndex == 0) { + temp = true; + } + + if (Cutscene_CheckActorAction(play, 0x1F7) && temp) { + actionIndex = Cutscene_GetActorActionIndex(play, 0x1F7); + if (this->unk_22F != play->csCtx.actorActions[actionIndex]->action) { + this->unk_22F = play->csCtx.actorActions[actionIndex]->action; + switch (play->csCtx.actorActions[actionIndex]->action) { + case 2: + max = 0; + break; + case 3: + max = 1; + break; + case 4: + max = 2; + break; + case 5: + max = 3; + break; + } + + if (play->csCtx.actorActions[actionIndex]->action >= 2) { + pathnum = DMCHAR09_GET_PATH(&this->actor); + path = &play->setupPathList[pathnum]; + + for (i = 0; i < max; i++) { + pathnum = path->unk1; + path = &play->setupPathList[pathnum]; + } + + this->unk_224 = Lib_SegmentedToVirtual(path->points); + this->unk_214 = path->count; + this->unk_21C = 0; + this->unk_218 = path->count - 1; + this->unk_220 = 1; + this->unk_22E = true; + + this->speed = (u16)play->csCtx.actorActions[actionIndex]->rot.z * 0.00390625f; + this->actionFunc = func_80AB1FDC; + } else { + this->unk_22E = false; + this->actionFunc = DmChar09_DoNothing; + } + } + } else { + this->unk_22F = 0x63; + } +} + +void func_80AB24BC(DmChar09* this, PlayState* play) { + this->unk_228 += 0xBB8; + this->unk_22A += 0x1388; + this->unk_204 = Math_SinS(this->unk_228) * 150.0f; + this->unk_208 = Math_SinS(this->unk_22A) * 150.0f; + this->unk_20C = Math_SinS(this->unk_228) * 150.0f; +} + +void DmChar09_Update(Actor* thisx, PlayState* play) { + DmChar09* this = THIS; + + SkelAnime_Update(&this->skelAnime); + this->actionFunc(this, play); + func_80AB2268(this, play); + func_80AB24BC(this, play); + if ((play->csCtx.state != 0) && this->unk_22E && DMCHAR09_GET_100(thisx)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_POSTMAN_WALK + SFX_FLAG); + } +} + +s32 DmChar09_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + DmChar09* this = THIS; + + Matrix_Translate(this->unk_204, this->unk_208, this->unk_20C, MTXMODE_APPLY); + return false; +} + +void DmChar09_Draw(Actor* thisx, PlayState* play) { + DmChar09* this = THIS; + + if ((play->csCtx.state != 0) && this->unk_22E) { + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar09_OverrideLimbDraw, NULL, + &this->actor); + } +} diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h index 770c9358c..ce01f164a 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h @@ -2,6 +2,11 @@ #define Z_DM_CHAR09_H #include "global.h" +#include "objects/object_bee/object_bee.h" + +#define DMCHAR09_GET_PATH(thisx) (((thisx)->params >> 4) & 0xF) +#define DMCHAR09_GET_100(thisx) ((thisx)->params & 0x100) +#define DMCHAR09_GET_F(thisx) ((thisx)->params & 0xF) struct DmChar09; @@ -9,9 +14,24 @@ typedef void (*DmChar09ActionFunc)(struct DmChar09*, PlayState*); typedef struct DmChar09 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0xBC]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[OBJECT_BEE_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[OBJECT_BEE_LIMB_MAX]; /* 0x200 */ DmChar09ActionFunc actionFunc; - /* 0x204 */ char unk_204[0x2C]; + /* 0x204 */ f32 unk_204; + /* 0x208 */ f32 unk_208; + /* 0x20C */ f32 unk_20C; + /* 0x210 */ f32 speed; + /* 0x214 */ s32 unk_214; + /* 0x218 */ s32 unk_218; + /* 0x21C */ s32 unk_21C; + /* 0x220 */ s32 unk_220; + /* 0x224 */ Vec3s* unk_224; + /* 0x228 */ s16 unk_228; + /* 0x22A */ s16 unk_22A; + /* 0x22C */ UNK_TYPE1 pad22C[2]; + /* 0x22E */ u8 unk_22E; + /* 0x22F */ u8 unk_22F; } DmChar09; // size = 0x230 extern const ActorInit Dm_Char09_InitVars; diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 823aa7fa2..2b9c62e19 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -33,7 +33,7 @@ const ActorInit Dm_Gm_InitVars = { (ActorFunc)NULL, }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_an1_Anim_007E08, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_an1_Anim_0071E8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_an4_Anim_006CC0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, @@ -83,7 +83,7 @@ s32 func_80C24428(DmGm* this, PlayState* play, s32 arg2) { if ((objectIndex2 >= 0) && (arg2 != this->unk_2C8)) { gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex2].segment); this->unk_2C8 = arg2; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment); } return ret; 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 30cf308b6..3dcde3787 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -28,14 +28,14 @@ const ActorInit Dm_Nb_InitVars = { (ActorFunc)DmNb_Draw, }; -static AnimationInfoS D_80C1E200[] = { { &object_nb_Anim_000990, 1.0f, 0, -1, ANIMMODE_LOOP, 0 } }; +static AnimationInfoS sAnimationInfo[] = { { &object_nb_Anim_000990, 1.0f, 0, -1, ANIMMODE_LOOP, 0 } }; s32 func_80C1DED0(DmNb* this, s32 arg1) { s32 ret = false; if (arg1 != this->unk1F0) { this->unk1F0 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80C1E200, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); } return ret; } diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c index aaaeea362..d9f775f6a 100644 --- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c +++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c @@ -30,7 +30,7 @@ const ActorInit Dm_Sa_InitVars = { (ActorFunc)DmSa_Draw, }; -static AnimationInfo D_80A2ED00[] = { { &gSkullKidTPoseAnim, 1.0f, 0, -1.0f, ANIMMODE_LOOP, 0 } }; +static AnimationInfo sAnimationInfo[] = { { &gSkullKidTPoseAnim, 1.0f, 0, -1.0f, ANIMMODE_LOOP, 0 } }; void func_80A2E960(SkelAnime* arg0, AnimationInfo* animations, u16 index) { f32 frameCount; @@ -53,7 +53,7 @@ void DmSa_Init(Actor* thisx, PlayState* play) { this->actor.targetArrowOffset = 3000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); - func_80A2E960(&this->skelAnime, D_80A2ED00, 0); + func_80A2E960(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmSa_DoNothing; } 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 0e5f57209..1417d8094 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -37,79 +37,79 @@ void DmStk_ClockTower_IdleWithOcarina(DmStk* this, PlayState* play); void DmStk_ClockTower_Idle(DmStk* this, PlayState* play); typedef enum { - /* 0 */ SK_ANIMATION_SHAKE_HEAD, - /* 1 */ SK_ANIMATION_WALK, - /* 2 */ SK_ANIMATION_LOOK_AROUND, // Not used in the final game - /* 3 */ SK_ANIMATION_IDLE, - /* 4 */ SK_ANIMATION_UNUSED_IDLE, // Unused duplicate of SK_ANIMATION_IDLE - /* 5 */ SK_ANIMATION_BENT_OVER_HEAD_TWITCH, - /* 6 */ SK_ANIMATION_GLITCHY_HORSE_RIDE_START, // Not used in the final game - /* 7 */ SK_ANIMATION_RECLINING_FLOAT, - /* 8 */ SK_ANIMATION_CURSE_START, - /* 9 */ SK_ANIMATION_CURSE_LOOP, - /* 10 */ SK_ANIMATION_LAUGH_START, - /* 11 */ SK_ANIMATION_LAUGH_LOOP, - /* 12 */ SK_ANIMATION_HIDE_OCARINA_START, - /* 13 */ SK_ANIMATION_HIDE_OCARINA_LOOP, - /* 14 */ SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING, - /* 15 */ SK_ANIMATION_PLAY_OCARINA_AND_LAUGH, - /* 16 */ SK_ANIMATION_PICK_UP_OCARINA, // Not used in the final game - /* 17 */ SK_ANIMATION_LOOK_AT_OCARINA, // Not used in the final game - /* 18 */ SK_ANIMATION_KICK_OVER_LINK, - /* 19 */ SK_ANIMATION_SEARCH_LINK, - /* 20 */ SK_ANIMATION_UNUSED_KICK_OVER_LINK, // Unused duplicate of SK_ANIMATION_KICK_OVER_LINK - /* 21 */ SK_ANIMATION_UNUSED_SEARCH_LINK, // Unused duplicate of SK_ANIMATION_SEARCH_LINK - /* 22 */ SK_ANIMATION_HORSE_RIDE_START, - /* 23 */ SK_ANIMATION_HORSE_RIDE_LOOP, - /* 24 */ SK_ANIMATION_RAISE_MASK_START, - /* 25 */ SK_ANIMATION_RAISE_MASK_LOOP, - /* 26 */ SK_ANIMATION_LOWER_MASK, - /* 27 */ SK_ANIMATION_JUMP_WHILE_HIDING_OCARINA, - /* 28 */ SK_ANIMATION_HORSE_RIDE_AND_ROTATE, // Used when Link gets thrown off his horse - /* 29 */ SK_ANIMATION_PLAY_OCARINA_WHILE_FLOATING, - /* 30 */ SK_ANIMATION_FLOATING_TURN_AROUND, - /* 31 */ SK_ANIMATION_OCARINA_JUGGLE, - /* 32 */ SK_ANIMATION_CALL_DOWN_MOON_START, - /* 33 */ SK_ANIMATION_CALL_DOWN_MOON_LOOP, - /* 34 */ SK_ANIMATION_SMACK_FAIRY_START, - /* 35 */ SK_ANIMATION_SMACK_FAIRY_LOOP, - /* 36 */ SK_ANIMATION_HIT_BY_BUBBLE, - /* 37 */ SK_ANIMATION_DROP_OCARINA, - /* 38 */ SK_ANIMATION_FLOATING_ARMS_CROSSED, - /* 39 */ SK_ANIMATION_DEFLECT_ATTACK, - /* 40 */ SK_ANIMATION_TELESCOPE_LOOK_UP_START, - /* 41 */ SK_ANIMATION_TELESCOPE_LOOK_UP_LOOP, - /* 42 */ SK_ANIMATION_SURPRISE_START, - /* 43 */ SK_ANIMATION_SURPRISE_LOOP, - /* 44 */ SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_START, - /* 45 */ SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_LOOP, - /* 46 */ SK_ANIMATION_HOLD_HEAD_AND_SHAKE_START, - /* 47 */ SK_ANIMATION_HOLD_HEAD_AND_SHAKE_LOOP, - /* 48 */ SK_ANIMATION_HOLD_HEAD_AND_SCREAM_START, - /* 49 */ SK_ANIMATION_HOLD_HEAD_AND_SCREAM_LOOP, - /* 50 */ SK_ANIMATION_HUDDLE_WITH_FAIRIES, - /* 51 */ SK_ANIMATION_SEARCH_MASK_SALESMAN, - /* 52 */ SK_ANIMATION_HOLD_UP_MASK_START, - /* 53 */ SK_ANIMATION_HOLD_UP_MASK_LOOP, - /* 54 */ SK_ANIMATION_SHIVER, - /* 55 */ SK_ANIMATION_DRAW, - /* 56 */ SK_ANIMATION_BENT_OVER_LOOK_UP, - /* 57 */ SK_ANIMATION_SPANK, - /* 58 */ SK_ANIMATION_HIP_SHAKE_AND_JUMP, - /* 59 */ SK_ANIMATION_PLAY_FLUTE, - /* 60 */ SK_ANIMATION_CARTWHEEL, - /* 61 */ SK_ANIMATION_LIE_FLAT, - /* 62 */ SK_ANIMATION_DANGLE_FROM_MASK_START, - /* 63 */ SK_ANIMATION_DANGLE_FROM_MASK_LOOP, - /* 64 */ SK_ANIMATION_DROPPED_FROM_MASK, - /* 65 */ SK_ANIMATION_LOOK_UP_AT_GIANTS, - /* 66 */ SK_ANIMATION_ASHAMED_START, - /* 67 */ SK_ANIMATION_ASHAMED_LOOP, - /* 68 */ SK_ANIMATION_LOOK_LEFT_START, - /* 69 */ SK_ANIMATION_LOOK_LEFT_LOOP, - /* 70 */ SK_ANIMATION_SNIFF, - /* 71 */ SK_ANIMATION_LAUGH_AFTER_SNIFF, -} SkullKidAnimationIndex; + /* 0 */ SK_ANIM_SHAKE_HEAD, + /* 1 */ SK_ANIM_WALK, + /* 2 */ SK_ANIM_LOOK_AROUND, // Not used in the final game + /* 3 */ SK_ANIM_IDLE, + /* 4 */ SK_ANIM_UNUSED_IDLE, // Unused duplicate of SK_ANIM_IDLE + /* 5 */ SK_ANIM_BENT_OVER_HEAD_TWITCH, + /* 6 */ SK_ANIM_GLITCHY_HORSE_RIDE_START, // Not used in the final game + /* 7 */ SK_ANIM_RECLINING_FLOAT, + /* 8 */ SK_ANIM_CURSE_START, + /* 9 */ SK_ANIM_CURSE_LOOP, + /* 10 */ SK_ANIM_LAUGH_START, + /* 11 */ SK_ANIM_LAUGH_LOOP, + /* 12 */ SK_ANIM_HIDE_OCARINA_START, + /* 13 */ SK_ANIM_HIDE_OCARINA_LOOP, + /* 14 */ SK_ANIM_PICK_UP_OCARINA_AND_START_PLAYING, + /* 15 */ SK_ANIM_PLAY_OCARINA_AND_LAUGH, + /* 16 */ SK_ANIM_PICK_UP_OCARINA, // Not used in the final game + /* 17 */ SK_ANIM_LOOK_AT_OCARINA, // Not used in the final game + /* 18 */ SK_ANIM_KICK_OVER_LINK, + /* 19 */ SK_ANIM_SEARCH_LINK, + /* 20 */ SK_ANIM_UNUSED_KICK_OVER_LINK, // Unused duplicate of SK_ANIM_KICK_OVER_LINK + /* 21 */ SK_ANIM_UNUSED_SEARCH_LINK, // Unused duplicate of SK_ANIM_SEARCH_LINK + /* 22 */ SK_ANIM_HORSE_RIDE_START, + /* 23 */ SK_ANIM_HORSE_RIDE_LOOP, + /* 24 */ SK_ANIM_RAISE_MASK_START, + /* 25 */ SK_ANIM_RAISE_MASK_LOOP, + /* 26 */ SK_ANIM_LOWER_MASK, + /* 27 */ SK_ANIM_JUMP_WHILE_HIDING_OCARINA, + /* 28 */ SK_ANIM_HORSE_RIDE_AND_ROTATE, // Used when Link gets thrown off his horse + /* 29 */ SK_ANIM_PLAY_OCARINA_WHILE_FLOATING, + /* 30 */ SK_ANIM_FLOATING_TURN_AROUND, + /* 31 */ SK_ANIM_OCARINA_JUGGLE, + /* 32 */ SK_ANIM_CALL_DOWN_MOON_START, + /* 33 */ SK_ANIM_CALL_DOWN_MOON_LOOP, + /* 34 */ SK_ANIM_SMACK_FAIRY_START, + /* 35 */ SK_ANIM_SMACK_FAIRY_LOOP, + /* 36 */ SK_ANIM_HIT_BY_BUBBLE, + /* 37 */ SK_ANIM_DROP_OCARINA, + /* 38 */ SK_ANIM_FLOATING_ARMS_CROSSED, + /* 39 */ SK_ANIM_DEFLECT_ATTACK, + /* 40 */ SK_ANIM_TELESCOPE_LOOK_UP_START, + /* 41 */ SK_ANIM_TELESCOPE_LOOK_UP_LOOP, + /* 42 */ SK_ANIM_SURPRISE_START, + /* 43 */ SK_ANIM_SURPRISE_LOOP, + /* 44 */ SK_ANIM_LOOK_AROUND_FOR_GIANTS_START, + /* 45 */ SK_ANIM_LOOK_AROUND_FOR_GIANTS_LOOP, + /* 46 */ SK_ANIM_HOLD_HEAD_AND_SHAKE_START, + /* 47 */ SK_ANIM_HOLD_HEAD_AND_SHAKE_LOOP, + /* 48 */ SK_ANIM_HOLD_HEAD_AND_SCREAM_START, + /* 49 */ SK_ANIM_HOLD_HEAD_AND_SCREAM_LOOP, + /* 50 */ SK_ANIM_HUDDLE_WITH_FAIRIES, + /* 51 */ SK_ANIM_SEARCH_MASK_SALESMAN, + /* 52 */ SK_ANIM_HOLD_UP_MASK_START, + /* 53 */ SK_ANIM_HOLD_UP_MASK_LOOP, + /* 54 */ SK_ANIM_SHIVER, + /* 55 */ SK_ANIM_DRAW, + /* 56 */ SK_ANIM_BENT_OVER_LOOK_UP, + /* 57 */ SK_ANIM_SPANK, + /* 58 */ SK_ANIM_HIP_SHAKE_AND_JUMP, + /* 59 */ SK_ANIM_PLAY_FLUTE, + /* 60 */ SK_ANIM_CARTWHEEL, + /* 61 */ SK_ANIM_LIE_FLAT, + /* 62 */ SK_ANIM_DANGLE_FROM_MASK_START, + /* 63 */ SK_ANIM_DANGLE_FROM_MASK_LOOP, + /* 64 */ SK_ANIM_DROPPED_FROM_MASK, + /* 65 */ SK_ANIM_LOOK_UP_AT_GIANTS, + /* 66 */ SK_ANIM_ASHAMED_START, + /* 67 */ SK_ANIM_ASHAMED_LOOP, + /* 68 */ SK_ANIM_LOOK_LEFT_START, + /* 69 */ SK_ANIM_LOOK_LEFT_LOOP, + /* 70 */ SK_ANIM_SNIFF, + /* 71 */ SK_ANIM_LAUGH_AFTER_SNIFF, +} SkullKidAnimation; typedef enum { /* 0 */ SK_MASK_TYPE_NO_MASK, @@ -219,7 +219,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gSkullKidShakeHeadAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gSkullKidWalkAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { &gSkullKidLookAroundAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f }, @@ -300,13 +300,11 @@ static AnimationInfo sAnimations[] = { void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { s32 objectIndex; - 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)) { + if (((this->animIndex >= SK_ANIM_SHAKE_HEAD) && (this->animIndex <= SK_ANIM_BENT_OVER_HEAD_TWITCH)) || + (this->animIndex == SK_ANIM_CALL_DOWN_MOON_START) || (this->animIndex == SK_ANIM_CALL_DOWN_MOON_LOOP) || + (this->animIndex == SK_ANIM_TELESCOPE_LOOK_UP_START) || (this->animIndex == SK_ANIM_TELESCOPE_LOOK_UP_LOOP)) { objectIndex = this->objectStkObjectIndex; - } else if (this->animIndex >= SK_ANIMATION_LOOK_UP_AT_GIANTS) { + } else if (this->animIndex >= SK_ANIM_LOOK_UP_AT_GIANTS) { objectIndex = this->objectStk3ObjectIndex; } else { objectIndex = this->objectStk2ObjectIndex; @@ -320,16 +318,16 @@ void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) { /** * This function is always called with unusedExtraOffset = 0. */ -void DmStk_ChangeAnimation(DmStk* this, PlayState* play, SkelAnime* skelAnime, AnimationInfo* animation, - u16 unusedExtraOffset) { +void DmStk_ChangeAnim(DmStk* this, PlayState* play, SkelAnime* skelAnime, AnimationInfo* animationInfo, + u16 unusedExtraOffset) { DmStk_LoadObjectForAnimation(this, play); - animation += unusedExtraOffset; + animationInfo += unusedExtraOffset; - Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, - (animation->frameCount < 0.0f) ? Animation_GetLastFrame(&animation->animation->common) - : animation->frameCount, - animation->mode, animation->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + (animationInfo->frameCount < 0.0f) ? Animation_GetLastFrame(animationInfo->animation) + : animationInfo->frameCount, + animationInfo->mode, animationInfo->morphFrames); } /** @@ -530,7 +528,7 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 365: - func_801A0654(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 0); + AudioSfx_SetChannelIO(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 0); break; case 650: @@ -596,7 +594,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla break; } - if ((this->animIndex == SK_ANIMATION_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { + if ((this->animIndex == SK_ANIM_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { if (Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); } else if (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { @@ -730,11 +728,12 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 2000: - func_801A5BD0(0x7F); + AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | + (1 << BANK_SYSTEM) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); break; } - if (this->animIndex == SK_ANIMATION_SHAKE_HEAD) { + if (this->animIndex == SK_ANIM_SHAKE_HEAD) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } @@ -742,12 +741,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->animIndex == SK_ANIMATION_LAUGH_AFTER_SNIFF) { + } else if (this->animIndex == SK_ANIM_LAUGH_AFTER_SNIFF) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_MASK_OFF); } - } else if ((this->animIndex == SK_ANIMATION_SNIFF) && + } else if ((this->animIndex == SK_ANIM_SNIFF) && (Animation_OnFrame(&this->skelAnime, 16.0f) || Animation_OnFrame(&this->skelAnime, 23.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_NOSE); } @@ -983,20 +982,20 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { } } - if (this->animIndex == SK_ANIMATION_WALK) { + if (this->animIndex == SK_ANIM_WALK) { if (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_WALK); } - } else if (this->animIndex == SK_ANIMATION_SEARCH_LINK) { + } else if (this->animIndex == SK_ANIM_SEARCH_LINK) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 20.0f) || Animation_OnFrame(&this->skelAnime, 27.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_CALM_HIT); } - } else if (this->animIndex == SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING) { + } else if (this->animIndex == SK_ANIM_PICK_UP_OCARINA_AND_START_PLAYING) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_PL_PUT_OUT_ITEM); } - } else if (this->animIndex == SK_ANIMATION_PLAY_OCARINA_AND_LAUGH) { + } else if (this->animIndex == SK_ANIM_PLAY_OCARINA_AND_LAUGH) { if (Animation_OnFrame(&this->skelAnime, 14.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_UNSKILLFUL_OCARINA); } @@ -1024,7 +1023,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->tatlMessageTimer = 0; this->deflectCount = 0; this->maskType = SK_MASK_TYPE_NORMAL; - this->animIndex = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIM_IDLE; this->fogR = play->lightCtx.unk7; this->fogG = play->lightCtx.unk8; this->fogB = play->lightCtx.unk9; @@ -1044,7 +1043,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); - if (gSaveContext.save.entranceIndex == 0x2C00) { + if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) { if (gSaveContext.sceneSetupIndex == 0) { if (gSaveContext.unk_3DD0[3] == 0) { // Starts a 5 minute (300 second) timer until the moon falls. @@ -1062,7 +1061,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { } } else if (gSaveContext.sceneSetupIndex == 3) { - this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; if (gSaveContext.unk_3DD0[3] == 0) { // 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 +1074,12 @@ void DmStk_Init(Actor* thisx, PlayState* play) { sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = DmStk_ClockTower_Idle; } else { - this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; this->actionFunc = DmStk_ClockTower_DoNothing; } } else { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_READY; - this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; this->actor.world.pos.y = 120.0f; sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = DmStk_ClockTower_Idle; @@ -1099,7 +1098,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fogN = 996; this->fogF = 1000; this->fogScale = 0.7f; - this->animIndex = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; + this->animIndex = SK_ANIM_BENT_OVER_HEAD_TWITCH; this->actionFunc = DmStk_WaitForTelescope; } else { if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { @@ -1123,7 +1122,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->animIndex], 0); + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); } Actor_SetScale(&this->actor, 0.01f); @@ -1152,9 +1151,10 @@ void DmStk_WaitForTelescope(DmStk* this, PlayState* play) { Vec3f screenPos; if (!(gSaveContext.save.weekEventReg[74] & 0x20)) { - func_80169474(play, &this->actor.world.pos, &screenPos); + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); if (play->view.fovy < 25.0f) { - if ((screenPos.x >= 70.0f) && (screenPos.x < 250.0f) && (screenPos.y >= 30.0f) && (screenPos.y < 210.0f)) { + if ((screenPos.x >= 70.0f) && (screenPos.x < (SCREEN_WIDTH - 70.0f)) && (screenPos.y >= 30.0f) && + (screenPos.y < (SCREEN_HEIGHT - 30.0f))) { func_800FE484(); this->actionFunc = DmStk_StartTelescopeCutscene; } @@ -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->animIndex = SK_ANIMATION_CALL_DOWN_MOON_LOOP; + this->animIndex = SK_ANIM_CALL_DOWN_MOON_LOOP; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[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->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); this->actionFunc = DmStk_ClockTower_Idle; } } @@ -1279,8 +1279,8 @@ void DmStk_ClockTower_DeflectHit(DmStk* this, PlayState* play) { } } - this->animIndex = SK_ANIMATION_DEFLECT_ATTACK; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + this->animIndex = SK_ANIM_DEFLECT_ATTACK; + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); 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->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[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->animIndex = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIM_IDLE; break; case 2: - this->animIndex = SK_ANIMATION_WALK; + this->animIndex = SK_ANIM_WALK; break; case 3: - this->animIndex = SK_ANIMATION_UNUSED_KICK_OVER_LINK; + this->animIndex = SK_ANIM_UNUSED_KICK_OVER_LINK; break; case 4: - this->animIndex = SK_ANIMATION_KICK_OVER_LINK; + this->animIndex = SK_ANIM_KICK_OVER_LINK; break; case 6: - this->animIndex = SK_ANIMATION_PICK_UP_OCARINA; + this->animIndex = SK_ANIM_PICK_UP_OCARINA; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 7: - this->animIndex = SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING; + this->animIndex = SK_ANIM_PICK_UP_OCARINA_AND_START_PLAYING; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 8: - this->animIndex = SK_ANIMATION_SHAKE_HEAD; + this->animIndex = SK_ANIM_SHAKE_HEAD; break; case 9: - this->animIndex = SK_ANIMATION_IDLE; + this->animIndex = SK_ANIM_IDLE; this->fadeInState = SK_FADE_IN_STATE_START; break; case 12: - this->animIndex = SK_ANIMATION_HIDE_OCARINA_START; + this->animIndex = SK_ANIM_HIDE_OCARINA_START; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 13: - this->animIndex = SK_ANIMATION_JUMP_WHILE_HIDING_OCARINA; + this->animIndex = SK_ANIM_JUMP_WHILE_HIDING_OCARINA; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; break; case 14: - this->animIndex = SK_ANIMATION_HORSE_RIDE_START; + this->animIndex = SK_ANIM_HORSE_RIDE_START; break; case 15: - this->animIndex = SK_ANIMATION_HORSE_RIDE_LOOP; + this->animIndex = SK_ANIM_HORSE_RIDE_LOOP; break; case 16: - this->animIndex = SK_ANIMATION_HORSE_RIDE_AND_ROTATE; + this->animIndex = SK_ANIM_HORSE_RIDE_AND_ROTATE; break; case 17: - this->animIndex = SK_ANIMATION_RECLINING_FLOAT; + this->animIndex = SK_ANIM_RECLINING_FLOAT; break; case 18: - this->animIndex = SK_ANIMATION_CURSE_START; + this->animIndex = SK_ANIM_CURSE_START; break; case 19: - this->animIndex = SK_ANIMATION_LAUGH_START; + this->animIndex = SK_ANIM_LAUGH_START; break; case 20: - this->animIndex = SK_ANIMATION_RAISE_MASK_START; + this->animIndex = SK_ANIM_RAISE_MASK_START; break; case 21: - this->animIndex = SK_ANIMATION_LOWER_MASK; + this->animIndex = SK_ANIM_LOWER_MASK; break; case 22: - this->animIndex = SK_ANIMATION_PLAY_OCARINA_WHILE_FLOATING; + this->animIndex = SK_ANIM_PLAY_OCARINA_WHILE_FLOATING; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 23: - this->animIndex = SK_ANIMATION_FLOATING_TURN_AROUND; + this->animIndex = SK_ANIM_FLOATING_TURN_AROUND; this->handType = SK_HAND_TYPE_JUGGLING_OR_DROPPING_OCARINA; break; case 24: - this->animIndex = SK_ANIMATION_CALL_DOWN_MOON_START; + this->animIndex = SK_ANIM_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->animIndex = SK_ANIMATION_SMACK_FAIRY_START; + this->animIndex = SK_ANIM_SMACK_FAIRY_START; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 27: - this->animIndex = SK_ANIMATION_HIT_BY_BUBBLE; + this->animIndex = SK_ANIM_HIT_BY_BUBBLE; if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 28: - this->animIndex = SK_ANIMATION_DROP_OCARINA; + this->animIndex = SK_ANIM_DROP_OCARINA; this->handType = SK_HAND_TYPE_JUGGLING_OR_DROPPING_OCARINA; break; case 30: - this->animIndex = SK_ANIMATION_FLOATING_ARMS_CROSSED; + this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; break; case 31: - this->animIndex = SK_ANIMATION_DEFLECT_ATTACK; + this->animIndex = SK_ANIM_DEFLECT_ATTACK; break; case 32: - this->animIndex = SK_ANIMATION_SURPRISE_START; + this->animIndex = SK_ANIM_SURPRISE_START; break; case 33: - this->animIndex = SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_START; + this->animIndex = SK_ANIM_LOOK_AROUND_FOR_GIANTS_START; break; case 34: - this->animIndex = SK_ANIMATION_HOLD_HEAD_AND_SHAKE_START; + this->animIndex = SK_ANIM_HOLD_HEAD_AND_SHAKE_START; break; case 35: - this->animIndex = SK_ANIMATION_HOLD_HEAD_AND_SCREAM_START; + this->animIndex = SK_ANIM_HOLD_HEAD_AND_SCREAM_START; break; case 36: - this->animIndex = SK_ANIMATION_HUDDLE_WITH_FAIRIES; + this->animIndex = SK_ANIM_HUDDLE_WITH_FAIRIES; break; case 37: - this->animIndex = SK_ANIMATION_SEARCH_MASK_SALESMAN; + this->animIndex = SK_ANIM_SEARCH_MASK_SALESMAN; break; case 38: - this->animIndex = SK_ANIMATION_HOLD_UP_MASK_START; + this->animIndex = SK_ANIM_HOLD_UP_MASK_START; break; case 39: - this->animIndex = SK_ANIMATION_SHIVER; + this->animIndex = SK_ANIM_SHIVER; break; case 40: - this->animIndex = SK_ANIMATION_DRAW; + this->animIndex = SK_ANIM_DRAW; break; case 41: - this->animIndex = SK_ANIMATION_TELESCOPE_LOOK_UP_START; + this->animIndex = SK_ANIM_TELESCOPE_LOOK_UP_START; break; case 42: - this->animIndex = SK_ANIMATION_BENT_OVER_HEAD_TWITCH; + this->animIndex = SK_ANIM_BENT_OVER_HEAD_TWITCH; break; case 43: - this->animIndex = SK_ANIMATION_BENT_OVER_LOOK_UP; + this->animIndex = SK_ANIM_BENT_OVER_LOOK_UP; break; case 44: - this->animIndex = SK_ANIMATION_SPANK; + this->animIndex = SK_ANIM_SPANK; break; case 45: - this->animIndex = SK_ANIMATION_HIP_SHAKE_AND_JUMP; + this->animIndex = SK_ANIM_HIP_SHAKE_AND_JUMP; this->fadeOutState = SK_FADE_OUT_STATE_FADING_OUT; break; case 46: this->handType = SK_HAND_TYPE_HOLDING_FLUTE; - this->animIndex = SK_ANIMATION_PLAY_FLUTE; + this->animIndex = SK_ANIM_PLAY_FLUTE; break; case 47: - this->animIndex = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIM_CARTWHEEL; break; case 48: - this->animIndex = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIM_CARTWHEEL; break; case 49: - this->animIndex = SK_ANIMATION_LOOK_UP_AT_GIANTS; + this->animIndex = SK_ANIM_LOOK_UP_AT_GIANTS; break; case 50: - this->animIndex = SK_ANIMATION_ASHAMED_START; + this->animIndex = SK_ANIM_ASHAMED_START; break; case 51: - this->animIndex = SK_ANIMATION_LOOK_LEFT_START; + this->animIndex = SK_ANIM_LOOK_LEFT_START; break; case 52: - this->animIndex = SK_ANIMATION_SNIFF; + this->animIndex = SK_ANIM_SNIFF; break; case 53: - this->animIndex = SK_ANIMATION_CARTWHEEL; + this->animIndex = SK_ANIM_CARTWHEEL; break; case 54: - this->animIndex = SK_ANIMATION_LIE_FLAT; + this->animIndex = SK_ANIM_LIE_FLAT; break; case 55: - this->animIndex = SK_ANIMATION_DANGLE_FROM_MASK_START; + this->animIndex = SK_ANIM_DANGLE_FROM_MASK_START; break; case 56: - this->animIndex = SK_ANIMATION_DROPPED_FROM_MASK; + this->animIndex = SK_ANIM_DROPPED_FROM_MASK; break; case 57: - this->animIndex = SK_ANIMATION_LOOK_UP_AT_GIANTS; + this->animIndex = SK_ANIM_LOOK_UP_AT_GIANTS; break; case 58: - this->animIndex = SK_ANIMATION_ASHAMED_START; + this->animIndex = SK_ANIM_ASHAMED_START; break; case 59: - this->animIndex = SK_ANIMATION_LOOK_LEFT_START; + this->animIndex = SK_ANIM_LOOK_LEFT_START; break; case 60: - this->animIndex = SK_ANIMATION_SNIFF; + this->animIndex = SK_ANIM_SNIFF; break; case 5: @@ -1574,11 +1574,11 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { break; default: - this->animIndex = SK_ANIMATION_SHAKE_HEAD; + this->animIndex = SK_ANIM_SHAKE_HEAD; break; } - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } @@ -1643,57 +1643,56 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->animIndex) { - case SK_ANIMATION_LOOK_AROUND: - case SK_ANIMATION_CURSE_START: - case SK_ANIMATION_LAUGH_START: - case SK_ANIMATION_HIDE_OCARINA_START: - case SK_ANIMATION_PICK_UP_OCARINA_AND_START_PLAYING: - case SK_ANIMATION_PICK_UP_OCARINA: - case SK_ANIMATION_KICK_OVER_LINK: - case SK_ANIMATION_UNUSED_KICK_OVER_LINK: - case SK_ANIMATION_HORSE_RIDE_START: - case SK_ANIMATION_RAISE_MASK_START: - case SK_ANIMATION_FLOATING_TURN_AROUND: - case SK_ANIMATION_CALL_DOWN_MOON_START: - case SK_ANIMATION_SMACK_FAIRY_START: - case SK_ANIMATION_TELESCOPE_LOOK_UP_START: - case SK_ANIMATION_SURPRISE_START: - case SK_ANIMATION_LOOK_AROUND_FOR_GIANTS_START: - case SK_ANIMATION_HOLD_HEAD_AND_SHAKE_START: - case SK_ANIMATION_HOLD_HEAD_AND_SCREAM_START: - case SK_ANIMATION_HOLD_UP_MASK_START: - case SK_ANIMATION_DANGLE_FROM_MASK_START: - case SK_ANIMATION_ASHAMED_START: - case SK_ANIMATION_LOOK_LEFT_START: - case SK_ANIMATION_SNIFF: + case SK_ANIM_LOOK_AROUND: + case SK_ANIM_CURSE_START: + case SK_ANIM_LAUGH_START: + case SK_ANIM_HIDE_OCARINA_START: + case SK_ANIM_PICK_UP_OCARINA_AND_START_PLAYING: + case SK_ANIM_PICK_UP_OCARINA: + case SK_ANIM_KICK_OVER_LINK: + case SK_ANIM_UNUSED_KICK_OVER_LINK: + case SK_ANIM_HORSE_RIDE_START: + case SK_ANIM_RAISE_MASK_START: + case SK_ANIM_FLOATING_TURN_AROUND: + case SK_ANIM_CALL_DOWN_MOON_START: + case SK_ANIM_SMACK_FAIRY_START: + case SK_ANIM_TELESCOPE_LOOK_UP_START: + case SK_ANIM_SURPRISE_START: + case SK_ANIM_LOOK_AROUND_FOR_GIANTS_START: + case SK_ANIM_HOLD_HEAD_AND_SHAKE_START: + case SK_ANIM_HOLD_HEAD_AND_SCREAM_START: + case SK_ANIM_HOLD_UP_MASK_START: + case SK_ANIM_DANGLE_FROM_MASK_START: + case SK_ANIM_ASHAMED_START: + case SK_ANIM_LOOK_LEFT_START: + case SK_ANIM_SNIFF: this->animIndex++; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); break; - case SK_ANIMATION_LOWER_MASK: - this->animIndex = SK_ANIMATION_IDLE; + case SK_ANIM_LOWER_MASK: + this->animIndex = SK_ANIM_IDLE; this->maskType = SK_MASK_TYPE_NORMAL; this->handType = SK_HAND_TYPE_DEFAULT; - DmStk_ChangeAnimation(this, play, &this->skelAnime, &sAnimations[this->animIndex], 0); + DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); break; } } - 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)) { + if (((this->animIndex == SK_ANIM_RAISE_MASK_START) && (this->skelAnime.curFrame >= 16.0f)) || + (this->animIndex == SK_ANIM_RAISE_MASK_LOOP) || (this->animIndex == SK_ANIM_LOWER_MASK)) { this->maskType = SK_MASK_TYPE_RAISED; this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK; - } 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)) || + } else if (((this->animIndex >= SK_ANIM_HUDDLE_WITH_FAIRIES) && (this->animIndex <= SK_ANIM_DRAW)) || + ((this->animIndex >= SK_ANIM_PLAY_FLUTE) && (this->animIndex <= SK_ANIM_CARTWHEEL)) || ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { this->maskType = SK_MASK_TYPE_NO_MASK; - if ((this->animIndex == SK_ANIMATION_HOLD_UP_MASK_START) || - (this->animIndex == SK_ANIMATION_HOLD_UP_MASK_LOOP)) { + if ((this->animIndex == SK_ANIM_HOLD_UP_MASK_START) || (this->animIndex == SK_ANIM_HOLD_UP_MASK_LOOP)) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE; } } - if (this->animIndex == SK_ANIMATION_DROPPED_FROM_MASK) { + if (this->animIndex == SK_ANIM_DROPPED_FROM_MASK) { this->maskType = SK_MASK_TYPE_NO_MASK; } } @@ -1745,7 +1744,7 @@ void DmStk_ClockTower_Idle(DmStk* this, PlayState* play) { DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; - if (this->animIndex == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { + if (this->animIndex == SK_ANIM_CALL_DOWN_MOON_LOOP) { this->actor.targetArrowOffset = 3100.0f; } else { this->actor.targetArrowOffset = 200.0f; @@ -1762,7 +1761,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->animIndex == SK_ANIMATION_CALL_DOWN_MOON_LOOP) { + if (this->animIndex == SK_ANIM_CALL_DOWN_MOON_LOOP) { Actor_SetFocus(&this->actor, 40.0f); } else { Actor_SetFocus(&this->actor, 6.0f); @@ -1770,7 +1769,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { DmStk_LoadObjectForAnimation(this, play); - if (this->animIndex != SK_ANIMATION_LIE_FLAT) { + if (this->animIndex != SK_ANIM_LIE_FLAT) { SkelAnime_Update(&this->skelAnime); } @@ -1874,8 +1873,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->animIndex == SK_ANIMATION_LOOK_LEFT_LOOP) || (this->animIndex == SK_ANIMATION_LAUGH_LOOP) || - (this->animIndex == SK_ANIMATION_LAUGH_AFTER_SNIFF)) { + if ((this->animIndex == SK_ANIM_LOOK_LEFT_LOOP) || (this->animIndex == SK_ANIM_LAUGH_LOOP) || + (this->animIndex == SK_ANIM_LAUGH_AFTER_SNIFF)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidLaughingHeadDL); gSPDisplayList(POLY_OPA_DISP++, gSkullKidLaughingEyesDL); } else { diff --git a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c index 57ef38bf6..47706cb9f 100644 --- a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c +++ b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c @@ -29,7 +29,7 @@ const ActorInit Dm_Zl_InitVars = { (ActorFunc)DmZl_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gDmZl4FacingAwayHandsOverEmblemLoop, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, { &gDmZl4TurningAround2Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -10.0f }, { &gDmZl4HandsOverEmblemLoopAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, @@ -48,7 +48,7 @@ typedef enum { /* 5 */ ZELDA_ANIM_PLAYING_OCARINA_START, /* 6 */ ZELDA_ANIM_PLAYING_OCARINA, /* 7 */ ZELDA_ANIM_MAX, -} DmZlAnimations; +} DmZlAnimation; static TexturePtr sMouthTextures[] = { gZl4MouthNeutralTex, @@ -98,27 +98,28 @@ typedef enum { /** * This function is always called with unusedExtraOffset = 0. */ -void DmZl_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo animation[], u16 unusedExtraOffset) { +void DmZl_ChangeAnimation(SkelAnime* skelAnime, AnimationInfo animationInfo[], u16 unusedExtraOffset) { f32 endFrame; - animation += unusedExtraOffset; - endFrame = (animation->frameCount < 0.0f) ? Animation_GetLastFrame(animation->animation) : animation->frameCount; + animationInfo += unusedExtraOffset; + endFrame = (animationInfo->frameCount < 0.0f) ? Animation_GetLastFrame(animationInfo->animation) + : animationInfo->frameCount; - Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, endFrame, - animation->mode, animation->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame, + animationInfo->mode, animationInfo->morphFrames); } void DmZl_Init(Actor* thisx, PlayState* play) { s32 pad; DmZl* this = THIS; - this->animationIndex = ZELDA_ANIM_FACING_AWAY; + this->animIndex = ZELDA_ANIM_FACING_AWAY; this->unk_2BA = 0; this->actor.targetArrowOffset = 1000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); // these three set to NULL should mean they are dynamically allocated SkelAnime_InitFlex(play, &this->skelAnime, &gZl4Skeleton, NULL, NULL, NULL, 0); - DmZl_ChangeAnimation(&this->skelAnime, &sAnimations[this->animationIndex], 0); + DmZl_ChangeAnimation(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmZl_DoNothing; } @@ -135,26 +136,26 @@ void DmZl_UpdateCutscene(DmZl* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 0x66)) { actionIndex = Cutscene_GetActorActionIndex(play, 0x66); if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - s16 nextAnimationIndex = ZELDA_ANIM_FACING_AWAY; + s16 nextAnimIndex = ZELDA_ANIM_FACING_AWAY; switch (play->csCtx.actorActions[actionIndex]->action) { default: case 1: break; case 2: - nextAnimationIndex = ZELDA_ANIM_TURNING_TOWARD_PLAYER; + nextAnimIndex = ZELDA_ANIM_TURNING_TOWARD_PLAYER; break; case 3: - nextAnimationIndex = ZELDA_ANIM_GIVING_OCARINA_START; + nextAnimIndex = ZELDA_ANIM_GIVING_OCARINA_START; break; case 4: - nextAnimationIndex = ZELDA_ANIM_PLAYING_OCARINA_START; + nextAnimIndex = ZELDA_ANIM_PLAYING_OCARINA_START; break; } - if (nextAnimationIndex != this->animationIndex) { - this->animationIndex = nextAnimationIndex; - DmZl_ChangeAnimation(&this->skelAnime, &sAnimations[this->animationIndex], 0); + if (nextAnimIndex != this->animIndex) { + this->animIndex = nextAnimIndex; + DmZl_ChangeAnimation(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } @@ -162,13 +163,13 @@ void DmZl_UpdateCutscene(DmZl* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - actionIndex = this->animationIndex; + actionIndex = this->animIndex; if ((actionIndex == ZELDA_ANIM_TURNING_TOWARD_PLAYER) || (actionIndex == ZELDA_ANIM_GIVING_OCARINA_START) || (actionIndex == ZELDA_ANIM_PLAYING_OCARINA_START)) { // these animations don't loop at the end, they lead into the next animation - this->animationIndex++; - DmZl_ChangeAnimation(&this->skelAnime, &sAnimations[this->animationIndex], 0); + this->animIndex++; + DmZl_ChangeAnimation(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } } @@ -245,7 +246,7 @@ void DmZl_UpdateFace(DmZl* this) { break; } - if (this->animationIndex == ZELDA_ANIM_PLAYING_OCARINA) { + if (this->animIndex == ZELDA_ANIM_PLAYING_OCARINA) { this->eyeTextureIndexLeft = this->eyeTextureIndexRight = ZELDA_EYE_CLOSED; } } @@ -267,8 +268,7 @@ void DmZl_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, DmZl* this = THIS; if (limbIndex == ZL4_LIMB_RIGHT_HAND) { - if ((this->animationIndex >= ZELDA_ANIM_GIVING_OCARINA_START) && - (this->animationIndex <= ZELDA_ANIM_PLAYING_OCARINA)) { + if ((this->animIndex >= ZELDA_ANIM_GIVING_OCARINA_START) && (this->animIndex <= ZELDA_ANIM_PLAYING_OCARINA)) { OPEN_DISPS(play->state.gfxCtx); gSPDisplayList(POLY_OPA_DISP++, gDmZl4OcarinaDL); diff --git a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h index 1d9a80166..c267d9ae9 100644 --- a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h +++ b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.h @@ -15,7 +15,7 @@ typedef struct DmZl { /* 0x1F4 */ Vec3s morphTable[ZL4_LIMB_MAX]; /* 0x260 */ DmZlActionFunc actionFunc; /* 0x264 */ ColliderCylinder collider; // unused, assumed to be here based on OoT documentation - /* 0x2B0 */ s16 animationIndex; + /* 0x2B0 */ s16 animIndex; /* 0x2B2 */ u8 eyeTextureIndexLeft; /* 0x2B3 */ u8 eyeTextureIndexRight; /* 0x2B4 */ u8 mouthTextureIndex; 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 7edb7af4d..173c3ea52 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -52,9 +52,10 @@ static ColliderCylinderInit sCylinderInit = { { 50, 10, 0, { 0, 0, 0 } }, }; -static u16 sEntranceIndexes[] = { - 0x1A00, 0x1400, 0x1410, 0x1420, 0x1430, 0x1440, 0x1450, 0x1460, - 0x1470, 0x1480, 0x1490, 0x14A0, 0x14B0, 0x14C0, 0x14D0, +static u16 sEntrances[] = { + ENTRANCE(UNSET_0D, 0), ENTRANCE(GROTTOS, 0), ENTRANCE(GROTTOS, 1), ENTRANCE(GROTTOS, 2), ENTRANCE(GROTTOS, 3), + ENTRANCE(GROTTOS, 4), ENTRANCE(GROTTOS, 5), ENTRANCE(GROTTOS, 6), ENTRANCE(GROTTOS, 7), ENTRANCE(GROTTOS, 8), + ENTRANCE(GROTTOS, 9), ENTRANCE(GROTTOS, 10), ENTRANCE(GROTTOS, 11), ENTRANCE(GROTTOS, 12), ENTRANCE(GROTTOS, 13), }; void DoorAna_SetupAction(DoorAna* this, DoorAnaActionFunc actionFunction) { @@ -135,7 +136,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { if (grottoType == DOORANA_TYPE_VISIBLE_SCENE_EXIT) { s32 exitIndex = DOORANA_GET_EXIT_INDEX(&this->actor); - play->nextEntranceIndex = play->setupExitList[exitIndex]; + play->nextEntrance = play->setupExitList[exitIndex]; } else { s32 destinationIdx = DOORANA_GET_ENTRANCE(&this->actor); @@ -151,7 +152,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { destinationIdx = DOORANA_GET_EX_ENTRANCE(&this->actor); } - play->nextEntranceIndex = sEntranceIndexes[destinationIdx]; + play->nextEntrance = sEntrances[destinationIdx]; } DoorAna_SetupAction(this, DoorAna_GrabLink); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 78861d55c..e0d5653e2 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -10,7 +10,7 @@ typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); #define DOORSHUTTER_GET_1F(thisx) ((thisx)->params & 0x1F) #define DOORSHUTTER_GET_7F(thisx) ((thisx)->params & 0x7F) #define DOORSHUTTER_GET_380(thisx) (((thisx)->params >> 7) & 7) -#define DOORSHUTTER_GET_FC00(thisx) (((u16)(thisx)->params >> 0xA)) +#define DOORSHUTTER_GET_FC00(thisx) ((u16)(thisx)->params >> 0xA) typedef struct DoorShutter { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 8aa604b58..36135c942 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -16,10 +16,6 @@ #define THIS ((DoorSpiral*)thisx) -#define GET_ORIENTATION_PARAM(this) ((((Actor*)(this))->params >> 7) & 0x1) -#define GET_UNK145_PARAM(this) ((((Actor*)(this))->params >> 8) & 0x3) -#define GET_TRANSITION_ID_PARAM(this) ((u16)((Actor*)(this))->params >> 10) - typedef enum { /* 0 */ SPIRAL_OVERWORLD, // does not display anything as there is not a DL in GAMEPLAY_KEEP for it /* 1 */ SPIRAL_DUNGEON, @@ -179,7 +175,7 @@ static InitChainEntry sInitChain[] = { void DoorSpiral_Init(Actor* thisx, PlayState* play) { DoorSpiral* this = THIS; s32 pad; - s32 transition = GET_TRANSITION_ID_PARAM(thisx); + s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); s8 objBankId; if (this->actor.room != play->transitionActors.list[transition].sides[0].room) { @@ -188,8 +184,8 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) { } Actor_ProcessInitChain(&this->actor, sInitChain); - this->unk145 = GET_UNK145_PARAM(thisx); // set but never used - this->orientation = GET_ORIENTATION_PARAM(thisx); + this->unk145 = DOORSPIRAL_GET_UNK145(thisx); // set but never used + this->orientation = DOORSPIRAL_GET_ORIENTATION(thisx); this->objectType = DoorSpiral_GetObjectType(play); objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId); this->bankIndex = objBankId; @@ -204,7 +200,7 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) { } void DoorSpiral_Destroy(Actor* thisx, PlayState* play) { - s32 transition = GET_TRANSITION_ID_PARAM(thisx); + s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); play->transitionActors.list[transition].id *= -1; } @@ -281,7 +277,7 @@ void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) { player->doorType = 4; player->doorDirection = this->orientation; player->doorActor = &this->actor; - transition = GET_TRANSITION_ID_PARAM(this); + transition = DOORSPIRAL_GET_TRANSITION_ID(&this->actor); player->doorNext = ((u16)play->transitionActors.list[transition].params) >> 10; func_80122F28(player); diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h index 207765e38..f12b79d84 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h @@ -5,6 +5,10 @@ struct DoorSpiral; +#define DOORSPIRAL_GET_ORIENTATION(thisx) (((thisx)->params >> 7) & 0x1) +#define DOORSPIRAL_GET_UNK145(thisx) (((thisx)->params >> 8) & 0x3) +#define DOORSPIRAL_GET_TRANSITION_ID(thisx) ((u16)(thisx)->params >> 10) + typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*); typedef struct DoorSpiral { 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 881785fe1..9399bf5ca 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -446,7 +446,8 @@ void func_808B977C(DoorWarp1* this, PlayState* play) { if (func_808B866C(this, play) && !Play_InCsMode(play)) { Player* player = GET_PLAYER(play); - Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; @@ -484,7 +485,7 @@ void func_808B98A8(DoorWarp1* this, PlayState* play) { if ((gSaveContext.nextCutsceneIndex == 0xFFEF) && (D_808BC000 < this->unk_1D0) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) { if (DOORWARP1_GET_FF00_1(&this->dyna.actor) != 0xFF) { - play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; + play->nextEntrance = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; } else { @@ -619,7 +620,8 @@ void func_808B9FD0(DoorWarp1* this, PlayState* play) { ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); } else { ActorCutscene_Start(play->playerActorCsIds[9], NULL); - Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801DB4B0, &D_801DB4B0, &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, Animation_GetLastFrame(&object_warp1_Anim_001374.common), Animation_GetLastFrame(&object_warp1_Anim_001374.common), 2, 40.0f, 1); @@ -698,7 +700,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; } - play->nextEntranceIndex = 0xCC00; + play->nextEntrance = ENTRANCE(GIANTS_CHAMBER, 0); if (phi_v0_3 < 10) { gSaveContext.nextCutsceneIndex = phi_v0_3 + 0xFFF0; } @@ -711,12 +713,12 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { case 0: if (gSaveContext.save.weekEventReg[20] & 2) { gSaveContext.save.weekEventReg[7] |= 0x80; - play->nextEntranceIndex = 0x3010; + play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { - play->nextEntranceIndex = 0x8600; + play->nextEntrance = ENTRANCE(WOODFALL, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -726,7 +728,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { case 1: gSaveContext.save.weekEventReg[33] |= 0x80; - play->nextEntranceIndex = 0xAE70; + play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; @@ -734,14 +736,14 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { case 3: if (gSaveContext.save.weekEventReg[55] & 0x80) { - play->nextEntranceIndex = 0x6A90; + play->nextEntrance = ENTRANCE(ZORA_CAPE, 9); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; } else { gSaveContext.save.weekEventReg[55] |= 0x80; - play->nextEntranceIndex = 0x6A80; + play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -751,7 +753,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { case 2: gSaveContext.save.weekEventReg[52] |= 0x20; - play->nextEntranceIndex = 0x20F0; + play->nextEntrance = ENTRANCE(IKANA_CANYON, 15); gSaveContext.nextCutsceneIndex = 0xFFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -763,7 +765,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { if (DOORWARP1_GET_FF(&this->dyna.actor) == ENDOORWARP1_FF_6) { gSaveContext.respawnFlag = ~1; } - play->nextEntranceIndex = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; + play->nextEntrance = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)]; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; } else { 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 bfc6d197b..7c0dfa71c 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -81,7 +81,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_ah_Anim_001860, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_ah_Anim_001860, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_ah_Anim_002280, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -146,7 +146,7 @@ s32 func_80BD2B0C(EnAh* this, s32 arg1) { if (phi_v1) { this->unk_300 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_2DC = this->skelAnime.playSpeed; } return ret; @@ -554,7 +554,7 @@ void EnAh_Update(Actor* thisx, PlayState* play) { radius = this->collider.dim.radius + 60; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_2D8 & 7); + func_8013C964(&this->actor, play, radius, height, PLAYER_AP_NONE, this->unk_2D8 & 7); if (!(this->unk_2D8 & 0x10)) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); 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 faf39aece..4e7a51c97 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -62,7 +62,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 27, 32, 0, { 0, 0, 0 } }, }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dnt_Anim_005488, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_00B0B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_004AA0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -1154,7 +1154,7 @@ void func_80BEE938(EnAkindonuts* this, PlayState* play) { void func_80BEEB20(EnAkindonuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 sp24 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); + s16 sp24 = Animation_GetLastFrame(&sAnimationInfo[this->unk_338].animation->common); s16 phi_v0; Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -1177,7 +1177,7 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { this->actionFunc = func_80BEEDC0; this->unk_338 = 3; this->collider.dim.height = 64; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); return; } } @@ -1187,19 +1187,19 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { this->unk_338 = 17; this->collider.dim.height = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 17); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_338 == 2) { this->unk_338 = 16; this->collider.dim.height = 32; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 16); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_338 == 17) { phi_v0 = DECR(this->unk_33A); if (phi_v0 == 0) { this->unk_33A = Rand_ZeroOne() * 10.0f; this->unk_338 = 2; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 2); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 2); } } else if (this->unk_338 == 16) { phi_v0 = DECR(this->unk_33A); @@ -1207,7 +1207,7 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { this->unk_33A = Rand_S16Offset(40, 40); this->unk_338 = 18; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 18); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 18); } } } @@ -1216,7 +1216,7 @@ void func_80BEEB20(EnAkindonuts* this, PlayState* play) { void func_80BEEDC0(EnAkindonuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80BEEE10; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); } } @@ -1234,7 +1234,7 @@ void func_80BEEE10(EnAkindonuts* this, PlayState* play) { } else if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_338 = 4; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80BEEB20; } } @@ -1258,7 +1258,7 @@ void func_80BEEFA8(EnAkindonuts* this, PlayState* play) { play->msgCtx.stateTimer = 4; this->unk_338 = 8; this->unk_33C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); this->actionFunc = func_80BEF518; } else { this->unk_2DC(this, play); @@ -1296,18 +1296,18 @@ void func_80BEF18C(EnAkindonuts* this, PlayState* play) { void func_80BEF20C(EnAkindonuts* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 sp24 = this->skelAnime.curFrame; - s16 sp22 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); + s16 sp22 = Animation_GetLastFrame(&sAnimationInfo[this->unk_338].animation->common); if (this->unk_356 == 40) { this->unk_338 = 5; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 5); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 5); } this->unk_356++; if ((sp24 == sp22) && (this->unk_338 == 5)) { this->unk_338 = 6; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 6); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 6); } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -1358,7 +1358,7 @@ void func_80BEF4B8(EnAkindonuts* this, PlayState* play) { void func_80BEF518(EnAkindonuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 sp24 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); + s16 sp24 = Animation_GetLastFrame(&sAnimationInfo[this->unk_338].animation->common); switch (sp26) { case 10: @@ -1432,7 +1432,7 @@ void func_80BEF518(EnAkindonuts* this, PlayState* play) { if (sp26 == sp24) { this->unk_33E = 3; this->unk_338 = 19; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_32C &= ~2; this->unk_32C |= 0x80; @@ -1465,7 +1465,7 @@ void func_80BEF770(EnAkindonuts* this, PlayState* play) { void func_80BEF83C(EnAkindonuts* this, PlayState* play) { Vec3f sp34; s16 sp32 = this->skelAnime.curFrame; - s16 sp30 = Animation_GetLastFrame(&sAnimations[this->unk_338].animation->common); + s16 sp30 = Animation_GetLastFrame(&sAnimationInfo[this->unk_338].animation->common); if (sp32 == sp30) { Math_SmoothStepToS(&this->unk_362, 0x1C71, 3, 0x100, 0); @@ -1491,7 +1491,7 @@ void func_80BEF83C(EnAkindonuts* this, PlayState* play) { if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { this->unk_34C = 0.3f; this->unk_338 = 9; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80BEF9F0; } @@ -1510,7 +1510,7 @@ void func_80BEF9F0(EnAkindonuts* this, PlayState* play) { if ((this->actor.home.pos.y + 200.0f) < this->actor.world.pos.y) { Math_ApproachF(&this->actor.velocity.y, 0.0f, 0.2f, 1.0f); this->unk_338 = 10; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_338); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_338); if (ENAKINDONUTS_GET_3(&this->actor) == ENAKINDONUTS_3_2) { this->unk_32C |= 0x2; } @@ -1613,7 +1613,7 @@ void EnAkindonuts_Init(Actor* thisx, PlayState* play) { } } - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->unk_32C |= 0x2; this->unk_32C |= 0x4; this->unk_338 = 4; 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 c3b893a5d..8792f8038 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -119,7 +119,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_al_Anim_000C54, 1.0f, 0, -1, 0, -4 }, { &object_al_Anim_00DBE0, 1.0f, 0, -1, 0, 0 }, { &object_al_Anim_00DBE0, 1.0f, 0, -1, 0, -4 }, { &object_al_Anim_00ACA0, 1.0f, 0, -1, 2, 0 }, { &object_al_Anim_00ACA0, -1.0f, 0, -1, 2, 0 }, { &object_al_Anim_00CA28, 1.0f, 0, -1, 0, -4 }, @@ -178,7 +178,7 @@ s32 func_80BDE27C(EnAl* this, s32 arg1) { if (phi_v1) { this->unk_4F8 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_4C8 = this->skelAnime.playSpeed; } @@ -659,7 +659,7 @@ s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { break; case 2: - this->unk_4F0 = EXCH_ITEM_NONE; + this->unk_4F0 = PLAYER_AP_NONE; this->unk_4EA = 0; func_80BDE27C(this, 2); break; @@ -672,7 +672,7 @@ s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->actor.flags |= ACTOR_FLAG_1; this->actor.targetMode = 0; - this->unk_4F0 = EXCH_ITEM_NONE; + this->unk_4F0 = PLAYER_AP_NONE; this->unk_4C2 = 0; this->unk_4D4 = 40.0f; 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 c1cb31614..88ddcd0f8 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -128,7 +128,7 @@ void EnAni_Init(Actor* thisx, PlayState* play) { this->treeReachTimer = 0; this->blinkFunc = EnAni_DefaultBlink; - if (GET_ANI_TYPE(thisx) == ANI_TYPE_TREE_HANGING) { + if (ANI_GET_TYPE(thisx) == ANI_TYPE_TREE_HANGING) { Animation_Change(&this->skelAnime, &gAniTreeHangingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gAniTreeHangingAnim), ANIMMODE_ONCE, 0.0f); this->actionFunc = EnAni_HangInTree; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 52e60fc31..fcced964b 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -33,6 +33,6 @@ enum EnAniType { /* 1 */ ANI_TYPE_TREE_HANGING = 1, }; -#define GET_ANI_TYPE(thisx) (thisx->params & 0xFF) +#define ANI_GET_TYPE(thisx) ((thisx)->params & 0xFF) #endif // Z_EN_ANI_H 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 3b825641c..33f8225d3 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 @@ -44,7 +44,7 @@ const ActorInit En_Aob_01_InitVars = { (ActorFunc)EnAob01_Draw, }; -static AnimationInfo D_809C3790[6] = { +static AnimationInfo sAnimationInfo[] = { { &gMamamuYanIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &gMamamuYanLaughStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, { &gMamamuYanLaughLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, @@ -144,12 +144,12 @@ void func_809C1304(EnAob01* this, PlayState* play) { s32 func_809C1424(EnAob01* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(D_809C3790[this->unk_43C].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_43C].animation); if (this->unk_43C == 1) { if (curFrame == lastFrame) { this->unk_43C = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); return true; } } else if (this->unk_43C == 2) { @@ -160,18 +160,18 @@ s32 func_809C1424(EnAob01* this) { s32 func_809C14D0(EnAob01* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(D_809C3790[this->unk_43C].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_43C].animation); if ((this->unk_43C == 0) || (this->unk_43C == 5)) { if (curFrame == lastFrame) { this->unk_43C = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); return true; } } else if (this->unk_43C == 3) { if (curFrame == lastFrame) { this->unk_43C = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); return true; } } else if (this->unk_43C == 4) { @@ -182,12 +182,12 @@ s32 func_809C14D0(EnAob01* this) { s32 func_809C15BC(EnAob01* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(D_809C3790[this->unk_43C].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_43C].animation); if ((this->unk_43C != 0) && (this->unk_43C != 5)) { if (curFrame == lastFrame) { this->unk_43C = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); return true; } } else { @@ -329,7 +329,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x40; this->unk_2D2 |= 0x10; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 0x3525: @@ -344,7 +344,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x40; this->unk_2D2 |= 0x10; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; } @@ -359,7 +359,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { this->unk_2D2 |= 4; this->unk_2D2 |= 0x10; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 0x3527: @@ -371,7 +371,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { this->unk_210 = 0x3536; this->unk_2D2 |= 0x40; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; } @@ -379,7 +379,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { this->unk_210 = 0x3537; this->unk_2D2 |= 0x40; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; } @@ -416,7 +416,7 @@ void func_809C1C9C(EnAob01* this, PlayState* play) { gSaveContext.save.weekEventReg[63] &= (u8)~2; this->unk_2D2 |= 0x20; func_800FD750(0x40); - play->nextEntranceIndex = 0x7C10; + play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 2; @@ -556,7 +556,7 @@ void func_809C21E0(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x10; this->unk_2D2 |= 0x40; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x354B, &this->actor); } this->unk_2D2 &= ~8; @@ -672,7 +672,7 @@ void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; if (func_809C25E4(this, play)) { if (func_801A8A50(0) != 0x41) { - play->nextEntranceIndex = 0x7C10; + play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; @@ -734,7 +734,7 @@ void func_809C28B8(EnAob01* this, PlayState* play) { this->unk_210 = 0x352D; this->unk_2D2 |= 0x40; this->unk_43C = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; } @@ -930,7 +930,7 @@ void EnAob01_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_43C = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, D_809C3790, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); Actor_SetScale(&this->actor, 0.01f); switch (gSaveContext.eventInf[0] & 7) { 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 ab68d8769..46d42a817 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -315,9 +315,6 @@ void func_8088AA98(EnArrow* this, PlayState* play) { } } -#ifdef NON_MATCHING -// Stack. Scoped variable required to fix code gen at the bottom, likely sp60/54 there, -// but sp50 must be declared below those so maybe not? void func_8088ACE0(EnArrow* this, PlayState* play) { CollisionPoly* spAC; s32 spA8; @@ -329,8 +326,6 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { f32 sp78; f32 sp74; f32 temp_f12_2; - Vec3f sp60; - Vec3f sp54; s32 sp50; if ((DECR(this->unk_260) == 0) || @@ -470,9 +465,8 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp9C, - &this->actor.wallPoly, true, true, true, true, &spA8); - if (this->unk_262 != 0) { + if ((this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, + &sp9C, &this->actor.wallPoly, true, true, true, true, &spA8))) { func_800B90AC(play, &this->actor, this->actor.wallPoly, spA8, &sp9C); Math_Vec3f_Copy(&this->actor.world.pos, &sp9C); this->actor.wallBgId = spA8; @@ -485,7 +479,8 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { if (this->unk_264 != NULL) { if (this->unk_264->update != NULL) { - s32 pad; + Vec3f sp60; + Vec3f sp54; Math_Vec3f_Sum(&this->unk_228, &this->unk_268, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_268, &sp54); @@ -511,9 +506,6 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { } } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Arrow/func_8088ACE0.s") -#endif void func_8088B630(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->arrow.skelAnime); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 6a7bd87ad..72ca1ba8e 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -103,12 +103,12 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati this->unkToggle28A &= 1; switch (animationState) { // only case 2 and 5 are ever called in AttackNiw - case NIW_ANIMATION_STILL: + case NIW_ANIM_STILL: this->targetLeftWingRotZ = 0.0f; this->targetRightWingRotZ = 0.0f; break; - case NIW_ANIMATION_HEAD_PECKING: + case NIW_ANIM_HEAD_PECKING: this->unkTimer250 = 3; this->targetLeftWingRotZ = 7000.0f; this->targetRightWingRotZ = 7000.0f; @@ -118,7 +118,7 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati } break; - case NIW_ANIMATION_PECKING_AND_WAVING: + case NIW_ANIM_PECKING_AND_WAVING: this->unkTimer250 = 2; this->targetLeftWingRotZ = -10000.0f; this->targetRightWingRotZ = -10000.0f; @@ -132,7 +132,7 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati } break; - case NIW_ANIMATION_PECKING_AND_FORFLAPPING: + case NIW_ANIM_PECKING_AND_FORFLAPPING: this->unkTimer250 = 2; this->targetRightWingRotY = 10000.0f; this->targetLeftWingRotY = 10000.0f; @@ -142,12 +142,12 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati } break; - case NIW_ANIMATION_FREEZE: + case NIW_ANIM_FREEZE: this->unusedTimer24E = 5; this->unkTimer24C = this->unusedTimer24E; break; - case NIW_ANIMATION_PECKING_SLOW_FORFLAPPING: + case NIW_ANIM_PECKING_SLOW_FORFLAPPING: this->unkTimer250 = 5; this->targetRightWingRotY = 14000.0f; this->targetLeftWingRotY = 14000.0f; @@ -276,7 +276,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { this->unkTimer24C = 10; this->targetBodyRotY = -10000.0f; this->targetHeadRotZ = -3000.0f; - EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } } @@ -325,10 +325,10 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) { this->actionFunc = EnAttackNiw_FlyAway; } else if (this->actor.bgCheckFlags & 1) { // touching floor - EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_SLOW_FORFLAPPING); } else { - EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } } @@ -341,7 +341,7 @@ void EnAttackNiw_FlyAway(EnAttackNiw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.x, this->targetRotX, 5, this->rotStep, 0); Math_ApproachF(&this->rotStep, 5000.0f, 1.0f, 100.0f); Math_ApproachF(&this->actor.velocity.y, 5.0f, 0.3f, 1.0f); - EnAttackNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } void EnAttackNiw_Update(Actor* thisx, PlayState* play) { 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 b96fb35c0..4d783942d 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -62,7 +62,7 @@ const ActorInit En_Baba_InitVars = { (ActorFunc)EnBaba_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gBbaIdleHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &gBbaIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, @@ -300,7 +300,7 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { } void EnBaba_TriggerTransition(PlayState* play, u16 nextEntrance) { - play->nextEntranceIndex = nextEntrance; + play->nextEntrance = nextEntrance; play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; play->transitionTrigger = TRANS_TRIGGER_START; @@ -488,7 +488,7 @@ void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) { 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); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_KnockedOver; break; } @@ -506,11 +506,12 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { if (play->sceneNum == SCENE_BOMYA) { this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_Idle; } else if (play->sceneNum == SCENE_BACKTOWN) { 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)) { + (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && + (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)))) { Actor_MarkForDeath(&this->actor); @@ -519,10 +520,10 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->sakonDeadTimer = 50; this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_FollowSchedule; } else if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_IDLE) && - (gSaveContext.save.entranceIndex == 0xD670)) { + (gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7))) { if (gSaveContext.save.weekEventReg[81] & 2) { Actor_MarkForDeath(&this->actor); return; @@ -535,7 +536,7 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->stateFlags |= BOMB_SHOP_LADY_STATE_AUTOTALK; this->actionFunc = EnBaba_Idle; } else { @@ -547,15 +548,15 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { if (BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_SWAY) { this->actor.flags &= ~ACTOR_FLAG_1; this->animIndex = BOMB_SHOP_LADY_ANIM_SWAY; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 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); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_Walk; } else { this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_FaceForward; } } @@ -603,12 +604,12 @@ void EnBaba_Talk(EnBaba* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { if (play->msgCtx.unk120B1 == 0) { gSaveContext.save.weekEventReg[81] |= 2; - EnBaba_TriggerTransition(play, 0xD670); + EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); return; } } else { gSaveContext.save.weekEventReg[81] |= 2; - EnBaba_TriggerTransition(play, 0xD670); + EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } } else { this->textId = 0; @@ -626,7 +627,7 @@ void EnBaba_Talk(EnBaba* this, PlayState* play) { } else if (talkState == TEXT_STATE_DONE) { if (Message_ShouldAdvance(play) && (play->msgCtx.unk120B1 == 0)) { gSaveContext.save.weekEventReg[81] |= 2; - EnBaba_TriggerTransition(play, 0xD670); + EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } } } @@ -646,7 +647,7 @@ void EnBaba_GaveBlastMask(EnBaba* this, PlayState* play) { EnBaba_HandleConversation(this, play); this->actionFunc = EnBaba_Talk; } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -682,7 +683,7 @@ void EnBaba_FollowSchedule(EnBaba* this, PlayState* play) { void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 endFrame = Animation_GetLastFrame(sAnimations[this->animIndex].animation); + s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); this->collider.dim.height = 37; this->collider.dim.radius = 23; @@ -694,12 +695,12 @@ void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { if (curFrame == endFrame) { this->animIndex = BOMB_SHOP_LADY_ANIM_LYING_DOWN; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } } else { if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->sakonDeadTimer) == 0)) { Audio_QueueSeqCmd(0x101400FF); - EnBaba_TriggerTransition(play, 0xD670); + EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { Actor_MoveWithGravity(&this->actor); } 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 e14bc8ce5..3555f0998 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -57,9 +57,9 @@ static ColliderCylinderInit sCylinderInit = { static u16 sTextIds[] = { 0x2ABD, 0x2ABB, 0x2AD5, 0x2AD6, 0x2AD7, 0x2AD8, 0x2AC6 }; -static AnimationHeader* D_80BE8E4C[] = { &object_bai_Anim_0011C0, &object_bai_Anim_0008B4, &object_bai_Anim_008198 }; +static AnimationHeader* sAnimations[] = { &object_bai_Anim_0011C0, &object_bai_Anim_0008B4, &object_bai_Anim_008198 }; -static u8 sAnimModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; void EnBaisen_Init(Actor* thisx, PlayState* play) { EnBaisen* this = THIS; @@ -100,11 +100,11 @@ void EnBaisen_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnBaisen_ChangeAnimation(EnBaisen* this, s32 animIndex) { +void EnBaisen_ChangeAnim(EnBaisen* this, s32 animIndex) { this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(D_80BE8E4C[animIndex]); - Animation_Change(&this->skelAnime, D_80BE8E4C[this->animIndex], 1.0f, 0.0f, this->frameCount, - sAnimModes[this->animIndex], -10.0f); + this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + sAnimationModes[this->animIndex], -10.0f); } void func_80BE871C(EnBaisen* this) { @@ -138,10 +138,10 @@ void func_80BE87B0(EnBaisen* this, PlayState* play) { void func_80BE87FC(EnBaisen* this) { if (this->paramCopy == 0) { this->textIdIndex = 2; - EnBaisen_ChangeAnimation(this, 2); + EnBaisen_ChangeAnim(this, 2); this->unk29E = this->actor.world.rot.y; } else { - EnBaisen_ChangeAnimation(this, 0); + EnBaisen_ChangeAnim(this, 0); } this->actor.textId = sTextIds[this->textIdIndex]; @@ -190,12 +190,12 @@ void func_80BE89D8(EnBaisen* this, PlayState* play) { if (&this->actor == this->unk2A4) { this->unk29E = this->actor.world.rot.y; if (this->animIndex == 0) { - EnBaisen_ChangeAnimation(this, 1); + EnBaisen_ChangeAnim(this, 1); } } else { this->unk29E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2A4->world.pos); if (this->animIndex != 0) { - EnBaisen_ChangeAnimation(this, 0); + EnBaisen_ChangeAnim(this, 0); } } if ((play->msgCtx.currentTextId == 0x2AC6) || (play->msgCtx.currentTextId == 0x2AC7) || @@ -212,14 +212,14 @@ void func_80BE8AAC(EnBaisen* this, PlayState* play) { if ((this->textIdIndex % 2) != 0) { this->unk29E = this->actor.world.rot.y; if (this->animIndex == 0) { - EnBaisen_ChangeAnimation(this, 1); + EnBaisen_ChangeAnim(this, 1); } } else { if (this->unk2A4 != NULL) { this->unk29E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2A4->world.pos); } if (this->animIndex != 0) { - EnBaisen_ChangeAnimation(this, 0); + EnBaisen_ChangeAnim(this, 0); } } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.c b/src/overlays/actors/ovl_En_Bal/z_en_bal.c index 9617e0559..dec839006 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.c +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.c @@ -100,7 +100,7 @@ extern UNK_TYPE D_0600D530; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61A44.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61A6C.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/EnBal_ValidatePictograph.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bal/func_80A61ADC.s") diff --git a/src/overlays/actors/ovl_En_Bal/z_en_bal.h b/src/overlays/actors/ovl_En_Bal/z_en_bal.h index 9184cfa68..7f64293db 100644 --- a/src/overlays/actors/ovl_En_Bal/z_en_bal.h +++ b/src/overlays/actors/ovl_En_Bal/z_en_bal.h @@ -2,14 +2,15 @@ #define Z_EN_BAL_H #include "global.h" +#include "z64snap.h" struct EnBal; typedef void (*EnBalActionFunc)(struct EnBal*, PlayState*); typedef struct EnBal { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x48]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ char unk_148[0x44]; /* 0x18C */ EnBalActionFunc actionFunc; /* 0x190 */ char unk_190[0x224]; } EnBal; // size = 0x3B4 diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index a9314b9fa..488ed0482 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -699,7 +699,7 @@ void EnBb_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->gameplayFrames * -20) & 0x1FF, 32, 128)); currentMatrixState->mf[3][1] -= 47.0f * this->flameScaleY; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 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 7bfbf596c..d141c6514 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 @@ -150,7 +150,7 @@ s32 func_809CC270(EnBba01* this, PlayState* play) { Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); //! @bug: Both x and y conditionals are always true, || should be an && if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { - func_800B85E0(&this->enHy.actor, play, 30.0f, EXCH_ITEM_2E); + func_800B85E0(&this->enHy.actor, play, 30.0f, PLAYER_AP_MAGIC_BEANS); } return true; } @@ -158,7 +158,7 @@ s32 func_809CC270(EnBba01* this, PlayState* play) { void EnBba01_FinishInit(EnHy* this, PlayState* play) { //! @bug: gBbaSkel does not match EnHy's skeleton assumptions. //! Since gBbaSkel has more limbs than expected, joint and morph tables will overflow - if (EnHy_Init(this, play, &gBbaSkel, ENHY_ANIMATION_BBA_6)) { + if (EnHy_Init(this, play, &gBbaSkel, ENHY_ANIM_BBA_6)) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnBba01_Draw; this->waitingOnInit = false; diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index c489ba806..2193203fe 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -741,7 +741,7 @@ void EnBbfall_Draw(Actor* thisx, PlayState* play2) { currentMatrixState->mf[3][1] = pos->y; currentMatrixState->mf[3][2] = pos->z; gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); opacity -= 35; if (opacity < 0) { 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 2b1111809..bb3f28bee 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -15,7 +15,7 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play); void EnBigokuta_Update(Actor* thisx, PlayState* play); void EnBigokuta_Draw(Actor* thisx, PlayState* play); -void func_80AC2B4C(PlayState* play, EnBigokuta* this); +s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx); void EnBigokuta_SetupIdle(EnBigokuta* this); void EnBigokuta_Idle(EnBigokuta* this, PlayState* play); void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play); @@ -95,28 +95,28 @@ static InitChainEntry sInitChain[] = { void EnBigokuta_Init(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->picto.actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gBigOctoSkel, &gBigOctoIdleAnim, this->jointTable, this->morphTable, BIGOKUTA_LIMB_MAX); - Collider_InitAndSetCylinder(play, &this->shellCollider, &this->actor, &sShellCylinderInit); - Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + Collider_InitAndSetCylinder(play, &this->shellCollider, &this->picto.actor, &sShellCylinderInit); + Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sBodyCylinderInit); + CollisionCheck_SetInfo(&this->picto.actor.colChkInfo, NULL, &sColChkInfoInit); + this->cutscene = ActorCutscene_GetAdditionalCutscene(this->picto.actor.cutscene); if (gSaveContext.save.weekEventReg[20] & 2 || - ((this->actor.params != 0xFF) && Flags_GetSwitch(play, this->actor.params))) { - Actor_MarkForDeath(&this->actor); + ((this->picto.actor.params != 0xFF) && Flags_GetSwitch(play, this->picto.actor.params))) { + Actor_MarkForDeath(&this->picto.actor); } else { - this->actor.world.pos.y -= 99.0f; + this->picto.actor.world.pos.y -= 99.0f; EnBigokuta_SetupIdle(this); } - 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->subCamAt.x = (Math_SinS(this->picto.actor.home.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->subCamAt.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->subCamAt.z = (Math_CosS(this->picto.actor.home.rot.y) * 66.0f) + this->picto.actor.world.pos.z; - this->unkFunc = func_80AC2B4C; // set but never called + this->picto.validationFunc = EnBigokuta_ValidatePictograph; } void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { @@ -129,15 +129,15 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* subCamAt, Vec3f* subCamEye) { s16 angle; - ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - Play_CameraSetAtEye(play, this->subCamId, subCamAt, subCamEye); + ActorCutscene_Start(this->picto.actor.cutscene, &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + Play_SetCameraAtEye(play, this->subCamId, subCamAt, subCamEye); - angle = BINANG_SUB(Actor_YawToPoint(&this->actor, subCamEye), this->actor.home.rot.y); + angle = BINANG_SUB(Actor_YawToPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); if (angle > 0) { - angle = BINANG_ADD(this->actor.home.rot.y, 0x1800); + angle = BINANG_ADD(this->picto.actor.home.rot.y, 0x1800); } else { - angle = BINANG_SUB(this->actor.home.rot.y, 0x1800); + angle = BINANG_SUB(this->picto.actor.home.rot.y, 0x1800); } this->subCamEye.x = (Math_SinS(angle) * 250.0f) + this->subCamAt.x; @@ -150,7 +150,7 @@ void EnBigokuta_MoveCamera(EnBigokuta* this, PlayState* play) { 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); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCam->eye); } void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { @@ -158,39 +158,40 @@ void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->actor.cutscene); + ActorCutscene_Stop(this->picto.actor.cutscene); } } void EnBigokuta_ShootPlayer(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (&this->actor == player->actor.parent) { + if (&this->picto.actor == player->actor.parent) { player->actor.parent = NULL; player->unk_AE8 = 100; player->actor.velocity.y = 0.0f; - player->actor.world.pos.x += 20.0f * Math_SinS(this->actor.home.rot.y); - player->actor.world.pos.z += 20.0f * Math_CosS(this->actor.home.rot.y); - func_800B8D50(play, &this->actor, 10.0f, this->actor.home.rot.y, 10.0f, 4); + player->actor.world.pos.x += 20.0f * Math_SinS(this->picto.actor.home.rot.y); + player->actor.world.pos.z += 20.0f * Math_CosS(this->picto.actor.home.rot.y); + func_800B8D50(play, &this->picto.actor, 10.0f, this->picto.actor.home.rot.y, 10.0f, 4); } EnBigokuta_ResetCamera(this, play); } -void func_80AC2B4C(PlayState* play, EnBigokuta* this) { - func_8013A530(play, &this->actor, 3, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_BIG_OCTO, &thisx->focus.pos, &thisx->shape.rot, 280.0f, + 1800.0f, -1); } s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { WaterBox* box; s32 bgId; - this->actor.floorHeight = - BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->actor.home.pos.y, &box) || - (this->actor.home.pos.y <= this->actor.floorHeight)) { + this->picto.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->picto.actor.floorPoly, &bgId, + &this->picto.actor, &this->picto.actor.world.pos); + if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->picto.actor.world.pos.x, this->picto.actor.world.pos.z, + &this->picto.actor.home.pos.y, &box) || + (this->picto.actor.home.pos.y <= this->picto.actor.floorHeight)) { return false; } else { return true; @@ -200,9 +201,9 @@ s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { void EnBigokuta_SpawnRipple(EnBigokuta* this, PlayState* play) { Vec3f ripplePos; - ripplePos.x = this->actor.world.pos.x; - ripplePos.y = this->actor.home.pos.y; - ripplePos.z = this->actor.world.pos.z; + ripplePos.x = this->picto.actor.world.pos.x; + ripplePos.y = this->picto.actor.home.pos.y; + ripplePos.z = this->picto.actor.world.pos.z; EffectSsGRipple_Spawn(play, &ripplePos, 1000, 1400, 0); } @@ -215,9 +216,10 @@ void EnBigokuta_Idle(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 99.0f, 2.5f); - Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); - if ((this->actor.xzDistToPlayer < 300.0f) && ((player->actor.world.pos.y - this->actor.home.pos.y) < 100.0f)) { + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 99.0f, 2.5f); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 0x1000); + if ((this->picto.actor.xzDistToPlayer < 300.0f) && + ((player->actor.world.pos.y - this->picto.actor.home.pos.y) < 100.0f)) { EnBigokuta_SetupRise(this, play); } } @@ -228,19 +230,19 @@ void EnBigokuta_SetupRise(EnBigokuta* this, PlayState* play) { s16 angle = 0; Animation_PlayOnce(&this->skelAnime, &gBigOctoRiseOutOfWaterAnim); - splashPos.y = this->actor.home.pos.y; + splashPos.y = this->picto.actor.home.pos.y; for (i = 0; i < 8; i++) { - splashPos.x = Math_SinS(angle) * 70.0f + this->actor.world.pos.x; - splashPos.z = Math_CosS(angle) * 70.0f + this->actor.world.pos.z; + splashPos.x = Math_SinS(angle) * 70.0f + this->picto.actor.world.pos.x; + splashPos.z = Math_CosS(angle) * 70.0f + this->picto.actor.world.pos.z; EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, Rand_S16Offset(1000, 200)); angle = BINANG_ADD(angle, 0x2000); } - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_LAND); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_LAND); this->actionFunc = EnBigokuta_RiseOutOfWater; } void EnBigokuta_RiseOutOfWater(EnBigokuta* this, PlayState* play) { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 15.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 15.0f); if (SkelAnime_Update(&this->skelAnime)) { EnBigokuta_SetupIdleAboveWater(this); } @@ -253,27 +255,27 @@ void EnBigokuta_SetupIdleAboveWater(EnBigokuta* this) { void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 2.5f); - Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 2.5f); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 0x1000); - if ((this->actor.xzDistToPlayer > 400.0f) || (this->actor.playerHeightRel > 200.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_SINK); + if ((this->picto.actor.xzDistToPlayer > 400.0f) || (this->picto.actor.playerHeightRel > 200.0f)) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_SINK); EnBigokuta_SetupIdle(this); - } else if ((this->actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { + } else if ((this->picto.actor.xzDistToPlayer < 200.0f) && play->grabPlayer(play, GET_PLAYER(play))) { EnBigokuta_SetupSuckInPlayer(this, play); } } void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { - if (this->actor.cutscene != -1) { + if (this->picto.actor.cutscene != -1) { if (this->subCamId != SUB_CAM_ID_DONE) { EnBigokuta_MoveCamera(this, play); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + } else if (ActorCutscene_GetCanPlayNext(this->picto.actor.cutscene)) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); EnBigokuta_SetupCutsceneCamera(this, play, &mainCam->at, &mainCam->eye); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); } } } @@ -281,19 +283,19 @@ void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->actor.parent = &this->actor; - this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + player->actor.parent = &this->picto.actor; + this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); this->timer = 0; Animation_Change(&this->skelAnime, &gBigOctoIdleAnim, 1.0f, 12.0f, 12.0f, ANIMMODE_ONCE, -3.0f); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); - this->playerHoldPos.x = (Math_SinS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.x; - this->playerHoldPos.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->playerHoldPos.z = (Math_CosS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.z; + this->playerHoldPos.x = (Math_SinS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->playerHoldPos.z = (Math_CosS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.z; - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_SLIME_DEAD); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_SLIME_DEAD); this->actionFunc = EnBigokuta_SuckInPlayer; } @@ -302,7 +304,7 @@ void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play) { EnBigokuta_UpdateOrSetupCam(this, play); SkelAnime_Update(&this->skelAnime); - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 49.5f, 10.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 49.5f, 10.0f); if (this->timer < 9) { this->timer++; @@ -311,19 +313,19 @@ void EnBigokuta_SuckInPlayer(EnBigokuta* this, PlayState* play) { player->unk_AE8 = 0; Math_Vec3f_Copy(&player->actor.world.pos, &this->playerPos); if (Math_Vec3f_StepTo(&player->actor.world.pos, &this->playerHoldPos, sqrtf(this->timer) * 5.0f) < 0.1f) { - s16 rotY = this->actor.shape.rot.y; + s16 rotY = this->picto.actor.shape.rot.y; - if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x800)) { + if (Math_ScaledStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 0x800)) { EnBigokuta_SetupHoldPlayer(this); } - this->playerHoldPos.x = (Math_SinS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.x; - this->playerHoldPos.y = (this->actor.home.pos.y - 49.5f) + 42.899998f; - this->playerHoldPos.z = (Math_CosS(this->actor.shape.rot.y) * 66.0f) + this->actor.world.pos.z; + this->playerHoldPos.x = (Math_SinS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.x; + this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; + this->playerHoldPos.z = (Math_CosS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.z; Math_Vec3f_Copy(&player->actor.world.pos, &this->playerHoldPos); Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); - player->actor.shape.rot.y += BINANG_SUB(this->actor.shape.rot.y, rotY); + player->actor.shape.rot.y += BINANG_SUB(this->picto.actor.shape.rot.y, rotY); } else { Math_Vec3f_Copy(&this->playerPos, &player->actor.world.pos); player->actor.velocity.y = 0.0f; @@ -345,7 +347,7 @@ void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play) { if (this->timer == 0) { EnBigokuta_ShootPlayer(this, play); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_REVERSE); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_REVERSE); } } else if (this->timer == -24) { EnBigokuta_SetupIdleAboveWater(this); @@ -362,21 +364,21 @@ void EnBigokuta_SetupDeathCutscene(EnBigokuta* this) { void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { Player* player; - this->actor.colorFilterTimer = Animation_GetLastFrame(&gBigOctoDeathAnim); + this->picto.actor.colorFilterTimer = Animation_GetLastFrame(&gBigOctoDeathAnim); if (this->timer != 0) { this->timer--; if (this->timer == 0) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->drawDmgEffAlpha = 0.0f; - Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); + Actor_SpawnIceEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); EnBigokuta_SetupDeathEffects(this); } } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + ActorCutscene_Start(this->cutscene, &this->picto.actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(play, &this->actor, 7); + func_800B724C(play, &this->picto.actor, 7); } else { player = GET_PLAYER(play); player->stateFlags1 |= 0x20; @@ -394,8 +396,8 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { void EnBigokuta_SetupDeathEffects(EnBigokuta* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBigOctoDeathAnim, -5.0f); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_DAIOCTA_DEAD2); - this->actor.flags &= ~1; + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_DAIOCTA_DEAD2); + this->picto.actor.flags &= ~1; this->timer = 10; this->actionFunc = EnBigokuta_PlayDeathEffects; } @@ -407,7 +409,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { static Color_RGBA8 D_80AC45B8 = { 150, 150, 150, 0 }; if (SkelAnime_Update(&this->skelAnime)) { - this->actor.world.pos.y -= 0.2f; + this->picto.actor.world.pos.y -= 0.2f; if (this->timer > 0) { this->timer--; @@ -415,44 +417,44 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { if (this->timer == 6) { Vec3f dustPos; - dustPos.x = this->actor.world.pos.x; - dustPos.y = this->actor.world.pos.y + 150.0f; - dustPos.z = this->actor.world.pos.z; + dustPos.x = this->picto.actor.world.pos.x; + dustPos.y = this->picto.actor.world.pos.y + 150.0f; + dustPos.z = this->picto.actor.world.pos.z; func_800B0DE0(play, &dustPos, &gZeroVec3f, &gZeroVec3f, &D_80AC45B0, &D_80AC45B4, 1200, 20); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD2); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_OCTAROCK_DEAD2); } } else { - this->actor.world.pos.y -= 0.2f; + this->picto.actor.world.pos.y -= 0.2f; - if (Math_StepToF(&this->actor.scale.y, 0.001f, 0.001f)) { + if (Math_StepToF(&this->picto.actor.scale.y, 0.001f, 0.001f)) { s32 i; Vec3f bubbleVel; Vec3f bubblePos; - SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); - bubblePos.y = this->actor.world.pos.y; + SoundSource_PlaySfxAtFixedWorldPos(play, &this->picto.actor.world.pos, 50, NA_SE_EN_COMMON_WATER_MID); + bubblePos.y = this->picto.actor.world.pos.y; for (i = 0; i < 20; i++) { bubbleVel.x = randPlusMinusPoint5Scaled(10.0f); bubbleVel.y = Rand_ZeroFloat(5.5f) + 5.5f; bubbleVel.z = randPlusMinusPoint5Scaled(10.0f); - bubblePos.x = this->actor.world.pos.x + (2.0f * bubbleVel.x); - bubblePos.z = this->actor.world.pos.z + (2.0f * bubbleVel.z); + bubblePos.x = this->picto.actor.world.pos.x + (2.0f * bubbleVel.x); + bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z); EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0, &D_80AC45B8, Rand_S16Offset(150, 50), 25, 0); } - if (this->actor.params != 0xFF) { - Flags_SetSwitch(play, this->actor.params); + if (this->picto.actor.params != 0xFF) { + Flags_SetSwitch(play, this->picto.actor.params); } ActorCutscene_Stop(this->cutscene); - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); if (!(gSaveContext.eventInf[4] & 2) && !(gSaveContext.eventInf[3] & 0x20)) { - func_800B724C(play, &this->actor, 6); + func_800B724C(play, &this->picto.actor, 6); } else { Player* player = GET_PLAYER(play); @@ -461,18 +463,19 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { } if (this->drawDmgEffAlpha > 0.0f) { - this->drawDmgEffAlpha = this->actor.scale.y * 30.30303f; + this->drawDmgEffAlpha = this->picto.actor.scale.y * 30.30303f; } } } else { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 16.5f, 15.0f); + Math_StepToF(&this->picto.actor.world.pos.y, this->picto.actor.home.pos.y - 16.5f, 15.0f); } } s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { - this->actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); + this->picto.actor.child = SubS_FindActor(play, NULL, ACTORCAT_BG, ACTOR_BG_INGATE); - if ((this->actor.child != NULL) && (Actor_XZDistanceBetweenActors(&this->actor, this->actor.child) < 250.0f)) { + if ((this->picto.actor.child != NULL) && + (Actor_XZDistanceBetweenActors(&this->picto.actor, this->picto.actor.child) < 250.0f)) { return true; } else { return false; @@ -484,7 +487,7 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { ((this->bodyCollider.base.acFlags & AC_HIT) || ((play->sceneNum == SCENE_20SICHITAI || play->sceneNum == SCENE_20SICHITAI2) && EnBigokuta_IsNearSwampBoat(this, play)))) { - Enemy_StartFinishingBlow(play, &this->actor); + Enemy_StartFinishingBlow(play, &this->picto.actor); if (this->bodyCollider.base.acFlags & AC_HIT) { if (this->bodyCollider.info.acHitInfo->toucher.dmgFlags & 0x1000) { // Ice Arrow @@ -503,7 +506,7 @@ void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { } this->bodyCollider.base.acFlags &= ~AC_HIT; - Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); + Actor_SetColorFilter(&this->picto.actor, 0x4000, 255, 0, Animation_GetLastFrame(&gBigOctoDeathAnim)); EnBigokuta_ShootPlayer(this, play); EnBigokuta_SetupDeathCutscene(this); } @@ -514,7 +517,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { EnBigokuta* this = THIS; if (!EnBigokuta_IsInWater(this, play)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); return; } @@ -526,9 +529,11 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((this->bodyCollider.base.acFlags & AC_ON)) { - this->shellCollider.dim.pos.x = Math_SinS(this->actor.shape.rot.y) * -20.0f + this->actor.world.pos.x; - this->shellCollider.dim.pos.y = this->actor.world.pos.y; - this->shellCollider.dim.pos.z = Math_CosS(this->actor.shape.rot.y) * -20.0f + this->actor.world.pos.z; + this->shellCollider.dim.pos.x = + Math_SinS(this->picto.actor.shape.rot.y) * -20.0f + this->picto.actor.world.pos.x; + this->shellCollider.dim.pos.y = this->picto.actor.world.pos.y; + this->shellCollider.dim.pos.z = + Math_CosS(this->picto.actor.shape.rot.y) * -20.0f + this->picto.actor.world.pos.z; this->bodyCollider.dim.pos.x = this->shellCollider.dim.pos.x; this->bodyCollider.dim.pos.y = this->shellCollider.dim.pos.y; @@ -537,7 +542,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->shellCollider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->shellCollider.base); - Actor_SetFocus(&this->actor, 82.5f); + Actor_SetFocus(&this->picto.actor, 82.5f); } if (this->drawDmgEffAlpha > 0.0f) { @@ -546,7 +551,7 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play) { this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.6f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 1.2f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 1.2f, 0.030000001f)) { - func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + func_800B9010(&this->picto.actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } } @@ -658,18 +663,18 @@ void EnBigokuta_Draw(Actor* thisx, PlayState* play) { gDPSetEnvColor(&gfx[1], 255, 255, 255, 255); POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnBigokuta_OverrideLimbDraw, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + EnBigokuta_OverrideLimbDraw, EnBigokuta_PostLimbDraw, &this->picto.actor, &gfx[2]); } else { Scene_SetRenderModeXlu(play, 1, 2); gfx = POLY_XLU_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); - gDPSetEnvColor(&gfx[1], 0, 0, 0, (this->actor.scale.y * 7727.273f)); + gDPSetEnvColor(&gfx[1], 0, 0, 0, (this->picto.actor.scale.y * 7727.273f)); POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - NULL, EnBigokuta_PostLimbDraw, &this->actor, &gfx[2]); + NULL, EnBigokuta_PostLimbDraw, &this->picto.actor, &gfx[2]); } - Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + Actor_DrawDamageEffects(play, &this->picto.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_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index ba59e9a97..fdb9d561d 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -2,16 +2,15 @@ #define Z_EN_BIGOKUTA_H #include "global.h" +#include "z64snap.h" #include "assets/objects/object_bigokuta/object_bigokuta.h" struct EnBigokuta; typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); -typedef void (*EnBigokutaUnkFunc)(PlayState*, struct EnBigokuta*); typedef struct EnBigokuta { - /* 0x000 */ Actor actor; - /* 0x144 */ EnBigokutaUnkFunc unkFunc; // possibly something to do with photographing + /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ EnBigokutaActionFunc actionFunc; /* 0x190 */ u8 drawDmgEffType; diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 1820a91c8..d24b2df49 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -6,6 +6,8 @@ #include "z_en_bigpamet.h" #include "z64rumble.h" +#include "overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_400) @@ -30,8 +32,19 @@ void func_80A28D0C(EnBigpamet* this, PlayState* play); void func_80A28DC0(EnBigpamet* this, PlayState* play); void func_80A28E98(EnBigpamet* this, PlayState* play); void func_80A28EE8(EnBigpamet* this, PlayState* play); +void func_80A281B4(EnBigpamet* this); +void func_80A28274(EnBigpamet* this); +void func_80A28378(EnBigpamet* this); +void func_80A28E40(EnBigpamet* this); +void func_80A28618(EnBigpamet* this); +void func_80A2966C(Actor* thisx, PlayState* play); +void func_80A286C0(EnBigpamet* this); +void func_80A28760(EnBigpamet* this); +void func_80A28970(EnBigpamet* this); +void func_80A28A28(EnBigpamet* this); +void func_80A28D80(EnBigpamet* this); +void func_80A28ED4(EnBigpamet* this); -#if 0 const ActorInit En_Bigpamet_InitVars = { ACTOR_EN_BIGPAMET, ACTORCAT_BOSS, @@ -44,18 +57,29 @@ const ActorInit En_Bigpamet_InitVars = { (ActorFunc)EnBigpamet_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A29700 = { - { COLTYPE_HARD, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x04 }, { 0xF7CF7FFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HARD, + AT_NONE | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x04 }, + { 0xF7CF7FFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 53, 50, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A2972C = { 1, 53, 60, 250 }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 53, 60, 250 }; -// static DamageTable sDamageTable = { -static DamageTable D_80A29734 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -90,121 +114,760 @@ static DamageTable D_80A29734 = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A29764[] = { - ICHAIN_S8(hintId, 1, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), - ICHAIN_F32(gravity, -2, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 4333, ICHAIN_CONTINUE), +TexturePtr D_80A29754[] = { + object_tl_Tex_0055A0, + object_tl_Tex_0057A0, + object_tl_Tex_0059A0, + object_tl_Tex_0057A0, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_S8(hintId, 1, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), + ICHAIN_F32(gravity, -2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 4333, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, 5, ICHAIN_STOP), }; -#endif +s32 D_80A29778 = 0; +Vec3f D_80A2977C = { 0.0f, 1.0f, 0.0f }; +Color_RGBA8 D_80A29788 = { 250, 250, 250, 255 }; +Color_RGBA8 D_80A2978C = { 180, 180, 180, 255 }; -extern ColliderCylinderInit D_80A29700; -extern CollisionCheckInfoInit D_80A2972C; -extern DamageTable D_80A29734; -extern InitChainEntry D_80A29764[]; +void EnBigpamet_Init(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + s32 i; -extern UNK_TYPE D_06000440; -extern UNK_TYPE D_06000AF4; -extern UNK_TYPE D_06001C68; -extern UNK_TYPE D_060031DC; -extern UNK_TYPE D_06004210; -extern UNK_TYPE D_0600823C; + Actor_ProcessInitChain(&this->actor, sInitChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Init.s") + SkelAnime_InitFlex(play, &this->skelAnime2, &object_tl_Skel_007C70, &object_tl_Anim_004210, this->jointTable2, + this->morphTable2, OBJECT_TL_2_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime1, &object_tl_Skel_001A50, &object_tl_Anim_000B30, this->jointTable1, + this->morphTable1, OBJECT_TL_1_LIMB_MAX); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 55.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2768C.s") + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A276F4.s") + if (!D_80A29778) { + for (i = 0; i < ARRAY_COUNT(D_80A29754); i++) { + D_80A29754[i] = Lib_SegmentedToVirtual(D_80A29754[i]); + } + D_80A29778 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2778C.s") + this->actor.params = ENBIGPAMET_1; + func_80A281B4(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27970.s") +void EnBigpamet_Destroy(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27B58.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27DD8.s") +void func_80A2768C(EnBigpamet* this) { + if (this->unk_29C != 0) { + this->unk_29C++; + if (this->unk_29C == 4) { + this->unk_29C = 0; + } + } else if (Rand_ZeroOne() < 0.05f) { + this->unk_29C = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A27FE8.s") +void func_80A276F4(EnBigpamet* this) { + if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + this->actor.parent->shape.rot.y = this->actor.shape.rot.y; + this->actor.parent->shape.rot.z = this->actor.shape.rot.z; + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->unk_2AC, this->actor.world.pos.z, + &this->actor.shape.rot); + Matrix_MultVecY(46.0f, &this->actor.parent->world.pos); + } else if (this->actor.parent->params == GEKKO_REAR_ON_SNAPPER) { + this->actor.parent->world.pos.x = this->actor.world.pos.x; + this->actor.parent->world.pos.z = this->actor.world.pos.z; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2811C.s") +void func_80A2778C(EnBigpamet* this) { + f32 temp_fs1; + s16 temp_s1; + s16 temp_s2; + s32 i; + EnBigpametStruct* ptr; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A281B4.s") + this->unk_2A2 = 40; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A281DC.s") + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + temp_s2 = (s32)Rand_Next() >> 0x10; + temp_s1 = Rand_S16Offset(0x1800, 0x2800); + temp_fs1 = Rand_ZeroFloat(5.0f) + 7.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28274.s") + ptr->unk_0C.x = (temp_fs1 * Math_CosS(temp_s1)) * Math_SinS(temp_s2); + ptr->unk_0C.y = (temp_fs1 * Math_SinS(temp_s1)) + 3.0f; + ptr->unk_0C.z = (temp_fs1 * Math_CosS(temp_s1)) * Math_CosS(temp_s2); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A282C8.s") + ptr->unk_18.x = (s32)Rand_Next() >> 0x10; + ptr->unk_18.y = (s32)Rand_Next() >> 0x10; + ptr->unk_18.z = (s32)Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28378.s") + ptr->unk_00.x = (Math_SinS(temp_s2) * 40.0f) + this->actor.world.pos.x; + ptr->unk_00.y = this->actor.floorHeight; + ptr->unk_00.z = (Math_CosS(temp_s2) * 40.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A283A0.s") + ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A283F0.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2844C.s") +void func_80A27970(EnBigpamet* this, PlayState* play2) { + Vec3f sp9C; + f32 temp_fs1 = this->actor.depthInWater + this->actor.world.pos.y; + s32 sp94; + s32 i; + s16 temp_s0; + f32 temp_fs0; + CollisionPoly* sp84; + PlayState* play = play2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A284E4.s") + for (i = 0; i < 2; i++) { + temp_fs0 = Rand_ZeroFloat(30.0f) + 30.0f; + temp_s0 = Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2855C.s") + sp9C.x = (Math_SinS(temp_s0) * temp_fs0) + this->actor.world.pos.x; + sp9C.y = Rand_ZeroFloat(10.0f) + this->actor.floorHeight + 8.0f; + sp9C.z = (Math_CosS(temp_s0) * temp_fs0) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28618.s") + if (BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &sp84, &sp94, &this->actor, &sp9C) < temp_fs1) { + sp9C.y = temp_fs1; + EffectSsGSplash_Spawn(play, &sp9C, NULL, NULL, 0, Rand_S16Offset(1000, 200)); + } else { + func_800B12F0(play, &sp9C, &D_80A2977C, &gZeroVec3f, Rand_S16Offset(950, 100), Rand_S16Offset(10, 10), 20); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2866C.s") +void func_80A27B58(EnBigpamet* this) { + EnBigpametStruct* ptr; + s32 i; + Vec3f sp64; + f32 temp_fs0; + s16 temp_s2; + f32 temp_fs2; + s16 temp_s1; + f32 temp_fs3; + s16 var_s1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A286C0.s") + sp64.x = (Math_SinS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.x; + sp64.y = this->actor.world.pos.y; + sp64.z = (Math_CosS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28708.s") + this->unk_2A2 = 40; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28760.s") + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + temp_s1 = (s32)randPlusMinusPoint5Scaled(20480.0f) + this->actor.wallYaw; + temp_s2 = Rand_S16Offset(0x1000, 0x3000); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A287E8.s") + temp_fs2 = Math_SinS(temp_s2); + temp_fs3 = Math_CosS(temp_s2); + temp_fs0 = Rand_ZeroFloat(5.0f) + 7.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28970.s") + ptr->unk_0C.x = Math_SinS(temp_s1) * (temp_fs0 * temp_fs3); + ptr->unk_0C.y = (temp_fs0 * temp_fs2) + 3.0f; + ptr->unk_0C.z = Math_CosS(temp_s1) * (temp_fs0 * temp_fs3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A289C8.s") + ptr->unk_18.x = (s32)Rand_Next() >> 0x10; + ptr->unk_18.y = (s32)Rand_Next() >> 0x10; + ptr->unk_18.z = (s32)Rand_Next() >> 0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28A28.s") + if ((s16)(temp_s1 - this->actor.wallYaw) > 0) { + var_s1 = this->actor.wallYaw + 0x4000; + } else { + var_s1 = this->actor.wallYaw - 0x4000; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28A98.s") + ptr->unk_00.x = (Math_SinS(var_s1) * (60.0f * temp_fs3)) + sp64.x; + ptr->unk_00.y = (60.0f * temp_fs2) + sp64.y; + ptr->unk_00.z = (Math_CosS(var_s1) * (60.0f * temp_fs3)) + sp64.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28B98.s") + ptr->unk_20 = Rand_ZeroFloat(0.0025000002f) + 0.002f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28D0C.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_BREAK); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28D80.s") +void func_80A27DD8(EnBigpamet* this, PlayState* play) { + s32 i; + Vec3f pos; + Vec3f sp8C; + f32 temp_fs0; + f32 temp_fs4; + f32 temp_fs5; + s16 temp_s0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28DC0.s") + temp_fs4 = Math_SinS(this->actor.wallYaw + 0x4000); + temp_fs5 = Math_CosS(this->actor.wallYaw + 0x4000); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28E40.s") + sp8C.x = Math_SinS(this->actor.wallYaw + 0x8000) * 50.0f + this->actor.world.pos.x; + sp8C.y = this->actor.world.pos.y; + sp8C.z = (Math_CosS(this->actor.wallYaw + 0x8000) * 50.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28E98.s") + sp8C.x += (this->actor.world.pos.x - sp8C.x) * 0.3f; + sp8C.z += (this->actor.world.pos.z - sp8C.z) * 0.3f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28ED4.s") + for (i = 0; i < 4; i++) { + temp_fs0 = Rand_ZeroFloat(60.0f) + 50.0f; + temp_s0 = Rand_Next() >> 0x11; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A28EE8.s") + pos.x = (Math_CosS(temp_s0) * temp_fs0 * temp_fs4) + sp8C.x; + pos.y = (Math_SinS(temp_s0) * temp_fs0) + sp8C.y; + pos.z = (Math_CosS(temp_s0) * temp_fs0 * temp_fs5) + sp8C.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29028.s") + func_800B12F0(play, &pos, &gZeroVec3f, &gZeroVec3f, Rand_S16Offset(950, 100), Rand_S16Offset(20, 10), 20); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29094.s") +void func_80A27FE8(EnBigpamet* this, PlayState* play) { + Vec3f pos; + s16 sp32; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Update.s") + if (this->actor.depthInWater > 0.0f) { + pos.x = this->actor.world.pos.x; + pos.z = this->actor.world.pos.z; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A292A8.s") + EffectSsGRipple_Spawn(play, &pos, 500, 900, 0); + pos.y += 8.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A293E4.s") + if (this->actionFunc != func_80A28D0C) { + sp32 = (s32)randPlusMinusPoint5Scaled(0x8000) + this->actor.world.rot.y; + pos.x -= 55.0f * Math_SinS(sp32); + pos.z -= 55.0f * Math_CosS(sp32); + } + EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, Rand_S16Offset(1400, 200)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29494.s") +void func_80A2811C(EnBigpamet* this, PlayState* play) { + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/EnBigpamet_Draw.s") + if ((this->actor.depthInWater > 0.0f) && ((play->gameplayFrames % 14) == 0)) { + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; + pos.z = this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29580.s") + EffectSsGRipple_Spawn(play, &pos, 500, 900, 0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A29628.s") +void func_80A281B4(EnBigpamet* this) { + this->actor.draw = NULL; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionFunc = func_80A281DC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bigpamet/func_80A2966C.s") +void func_80A281DC(EnBigpamet* this, PlayState* play) { + WaterBox* sp2C; + f32 sp28; + + if (this->actor.parent->params == GEKKO_GET_SNAPPER) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, &sp2C)) { + this->actor.depthInWater = sp28 - this->actor.world.pos.y; + } else { + this->actor.depthInWater = this->actor.world.pos.y; + } + + func_80A2778C(this); + func_80A27970(this, play); + func_80A28274(this); + } +} + +void func_80A28274(EnBigpamet* this) { + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_004210); + this->actor.draw = EnBigpamet_Draw; + this->unk_29E = 20; + this->actionFunc = func_80A282C8; +} + +void func_80A282C8(EnBigpamet* this, PlayState* play) { + if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 0.7f, 30.0f, 10.0f) < 1.0f) { + this->unk_29E--; + if (this->unk_29E >= 16) { + func_80A27970(this, play); + } + if (this->unk_29E == 0) { + func_80A28378(this); + } + } else { + func_80A27970(this, play); + } +} + +void func_80A28378(EnBigpamet* this) { + this->actor.parent->params = GEKKO_INIT_SNAPPER; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A283A0; +} + +void func_80A283A0(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + func_80A28E40(this); + } +} + +void func_80A283F0(EnBigpamet* this) { + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_00823C); + this->actor.speedXZ = 1.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actor.params = ENBIGPAMET_1; + this->actionFunc = func_80A2844C; +} + +void func_80A2844C(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + + if (this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) { + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->actor.parent), 0x400); + this->actor.world.rot.y = this->actor.shape.rot.y; + } else if (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER) { + this->actor.speedXZ = 0.0f; + } else if (this->actor.parent->params == GEKKO_ON_SNAPPER) { + func_80A28E40(this); + } +} + +void func_80A284E4(EnBigpamet* this) { + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_001C68, -3.0f); + this->unk_29E = 0; + this->unk_2A8 = 1.0f; + this->unk_2A4 = 1.0f; + this->actor.speedXZ = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_VOICE); + Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_FROG_VOICE1); + this->actionFunc = func_80A2855C; +} + +void func_80A2855C(EnBigpamet* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime2)) { + func_80A28618(this); + } else if (this->skelAnime2.curFrame > 2.0f) { + this->unk_2A8 = 1.5f - ((this->skelAnime2.curFrame - 2.0f) * 0.23333333f); + this->unk_2A4 = 1.5f - ((this->skelAnime2.curFrame - 2.0f) * 0.083333336f); + } else { + f32 curFrame = this->skelAnime2.curFrame; + + this->unk_2A4 = this->unk_2A8 = (0.25f * curFrame) + 1.0f; + } +} + +void func_80A28618(EnBigpamet* this) { + this->actor.draw = func_80A2966C; + this->unk_2A8 = 0.5f; + this->actor.speedXZ = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_ON); + this->actionFunc = func_80A2866C; +} + +void func_80A2866C(EnBigpamet* this, PlayState* play) { + this->unk_2A8 += 0.2f; + if (this->unk_2A8 > 1.1f) { + func_80A286C0(this); + } +} + +void func_80A286C0(EnBigpamet* this) { + this->collider.info.bumper.dmgFlags = 0xF7CF7FFF; + this->collider.base.atFlags |= AT_ON; + this->actor.shape.rot.z = 0x680; + this->unk_29E = 15; + this->unk_2A8 = 1.0f; + this->actionFunc = func_80A28708; +} + +void func_80A28708(EnBigpamet* this, PlayState* play) { + this->unk_29E--; + this->actor.shape.rot.y += 0x3B00; + func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG); + if (this->unk_29E == 0) { + func_80A28760(this); + } +} + +void func_80A28760(EnBigpamet* this) { + this->actor.speedXZ = 15.0f; + if (this->actor.bgCheckFlags & 8) { + s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.wallYaw; + + this->actor.bgCheckFlags &= ~8; + + if (temp_v1 > 0x3C00) { + this->actor.world.rot.y = this->actor.wallYaw + 0x3C00; + } else if (temp_v1 < -0x3C00) { + this->actor.world.rot.y = this->actor.wallYaw - 0x3C00; + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + } + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + } + this->unk_29E = 0; + this->actionFunc = func_80A287E8; +} + +void func_80A287E8(EnBigpamet* this, PlayState* play) { + s16 quake; + + this->actor.shape.rot.y += 0x3B00; + func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG); + this->unk_29E++; + this->unk_29E = CLAMP_MAX(this->unk_29E, 20); + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + if ((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0) { + this->actor.world.rot.y = this->actor.world.rot.y - 0x300; + } else { + this->actor.world.rot.y = this->actor.world.rot.y + 0x300; + } + } + + if (play->gameplayFrames & 1) { + func_80A27FE8(this, play); + } + + if (this->actor.bgCheckFlags & 8) { + quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + this->actor.velocity.y = this->unk_29E * 0.375f; + Quake_SetSpeed(quake, 0x4E20); + Quake_SetQuakeValues(quake, 15, 0, 0, 0); + Quake_SetCountdown(quake, 10); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + func_80A27B58(this); + func_80A27DD8(this, play); + func_80A28970(this); + } +} + +void func_80A28970(EnBigpamet* this) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PAMET_CUTTER_OFF); + this->actor.shape.rot.z = 0; + this->collider.base.atFlags &= ~AT_ON; + this->collider.info.bumper.dmgFlags = 0xF7CFFFFF; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A289C8; +} + +void func_80A289C8(EnBigpamet* this, PlayState* play) { + this->unk_2A8 -= 0.1f; + if (this->unk_2A8 < 0.5f) { + func_80A28A28(this); + } + func_80A27DD8(this, play); +} + +void func_80A28A28(EnBigpamet* this) { + this->actor.draw = EnBigpamet_Draw; + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_0031DC, -3.0f); + this->unk_2A8 = 0.1f; + this->unk_2A4 = 1.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_80A28A98; +} + +void func_80A28A98(EnBigpamet* this, PlayState* play) { + f32 curFrame; + + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x600); + + if (SkelAnime_Update(&this->skelAnime2)) { + if ((this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + func_80A283F0(this); + } else { + func_80A284E4(this); + } + } else { + curFrame = this->skelAnime2.curFrame; + + if (curFrame > 7.0f) { + this->unk_2A8 = 1.5f - ((curFrame - 7.0f) * (1.0f / 6.0f)); + this->unk_2A4 = 1.5f - ((curFrame - 7.0f) * (1.0f / 6.0f)); + } else { + this->unk_2A8 = (0.2f * curFrame) + 0.1f; + this->unk_2A4 = ((1.0f / 14.0f) * curFrame) + 1.0f; + } + } +} + +void func_80A28B98(EnBigpamet* this, PlayState* play) { + Actor* collectible; + + Animation_PlayLoop(&this->skelAnime2, &object_tl_Anim_000AF4); + + this->collider.base.atFlags &= ~AT_ON; + this->collider.info.bumper.dmgFlags = 0xF7CFFFFF; + this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + this->collider.base.acFlags &= ~AC_ON; + + this->actor.velocity.y = 22.0f; + this->actor.speedXZ = 5.0f; + + if ((this->actor.draw == func_80A2966C) && (this->actionFunc != func_80A28DC0)) { + this->actor.draw = EnBigpamet_Draw; + } else if (this->collider.base.ac != NULL) { + this->actor.world.rot.y = BINANG_ROT180(Actor_YawBetweenActors(&this->actor, this->collider.base.ac)); + } + + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.bgCheckFlags &= ~1; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.params = ENBIGPAMET_0; + + if ((this->actor.parent->params == GEKKO_ON_SNAPPER) || (this->actor.parent->params == GEKKO_REAR_ON_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + this->actor.parent->params = GEKKO_CUTSCENE; + } + + collectible = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); + if (collectible != NULL) { + collectible->velocity.y = 15.0f; + collectible->world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_B_PAMET_REVERSE); + this->actionFunc = func_80A28D0C; +} + +void func_80A28D0C(EnBigpamet* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime2); + if (this->actor.bgCheckFlags & 1) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_LAND); + func_80A27FE8(this, play); + func_80A28D80(this); + } + this->actor.shape.rot.x += 0x800; + this->actor.shape.rot.z += 0x1000; +} + +void func_80A28D80(EnBigpamet* this) { + this->actor.draw = func_80A2966C; + this->actor.speedXZ = 0.0f; + this->actor.shape.rot.x = 0; + this->actor.shape.rot.z = 0; + this->unk_2A8 = 0.0f; + this->collider.base.acFlags |= AC_ON; + this->actionFunc = func_80A28DC0; +} + +void func_80A28DC0(EnBigpamet* this, PlayState* play) { + this->actor.shape.rot.x = (s32)Rand_Next() >> 0x16; + this->actor.shape.rot.z = (s32)Rand_Next() >> 0x16; + if ((this->actor.parent->params == GEKKO_RETURN_TO_SNAPPER) || + (this->actor.parent->params == GEKKO_JUMP_ON_SNAPPER)) { + func_80A28A28(this); + } else if (this->actor.parent->params == GEKKO_DEFEAT) { + func_80A28ED4(this); + } +} + +void func_80A28E40(EnBigpamet* this) { + Animation_MorphToPlayOnce(&this->skelAnime2, &object_tl_Anim_000440, -2.0f); + this->actor.flags |= ACTOR_FLAG_1; + this->actor.speedXZ = 0.0f; + this->actionFunc = func_80A28E98; +} + +void func_80A28E98(EnBigpamet* this, PlayState* play) { + if (SkelAnime_Update(&this->skelAnime2)) { + func_80A284E4(this); + } +} + +void func_80A28ED4(EnBigpamet* this) { + this->actionFunc = func_80A28EE8; +} + +void func_80A28EE8(EnBigpamet* this, PlayState* play) { + Vec3f pos; + s16 sp3A; + + this->actor.shape.rot.x = (s32)Rand_Next() >> 0x16; + this->actor.shape.rot.z = (s32)Rand_Next() >> 0x16; + + if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.00075f)) { + sp3A = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + + pos.x = (Math_SinS(sp3A) * 20.0f) + this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 25.0f; + pos.z = (Math_CosS(sp3A) * 20.0f) + this->actor.world.pos.z; + + func_800B0DE0(play, &pos, &gZeroVec3f, &gZeroVec3f, &D_80A29788, &D_80A2978C, 800, 50); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_NPC_FADEAWAY); + Actor_MarkForDeath(&this->actor); + } + + this->actor.scale.y = this->actor.scale.x; + this->actor.scale.z = this->actor.scale.x; +} + +void func_80A29028(EnBigpamet* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + if ((this->actor.colChkInfo.damageEffect == 0xF) && (this->actor.parent->params != GEKKO_JUMP_ON_SNAPPER) && + (this->actionFunc != func_80A28E98)) { + func_80A28B98(this, play); + } + } +} + +void func_80A29094(EnBigpamet* this) { + EnBigpametStruct* ptr = &this->unk_2FC[0]; + s32 i; + + for (i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + ptr->unk_0C.y -= 1.0f; + + Math_Vec3f_Sum(&ptr->unk_00, &ptr->unk_0C, &ptr->unk_00); + + ptr->unk_18.x += (s16)((Rand_Next() >> 0x17) + 0x700); + ptr->unk_18.y += (s16)((Rand_Next() >> 0x17) + 0x900); + ptr->unk_18.z += (s16)((Rand_Next() >> 0x17) + 0xB00); + } +} + +void EnBigpamet_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnBigpamet* this = THIS; + + func_80A2768C(this); + func_80A29028(this, play); + + this->actionFunc(this, play); + + if (this->unk_2A2 > 0) { + this->unk_2A2--; + func_80A29094(this); + } + + if ((this->actionFunc != func_80A281DC) && (this->actionFunc != func_80A282C8)) { + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 50.0f, 60.0f, 0x1F); + func_80A276F4(this); + Actor_SetFocus(&this->actor, 25.0f); + + Collider_UpdateCylinder(&this->actor, &this->collider); + + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + + if (this->actionFunc != func_80A287E8) { + func_80A2811C(this, play); + } + } +} + +void func_80A292A8(EnBigpamet* this, PlayState* play) { + s32 i; + EnBigpametStruct* ptr; + + if (this->unk_2A2 > 0) { + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); + gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); + + for (ptr = &this->unk_2FC[0], i = 0; i < ARRAY_COUNT(this->unk_2FC); i++, ptr++) { + Matrix_SetTranslateRotateYXZ(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, &ptr->unk_18); + Matrix_Scale(ptr->unk_20, ptr->unk_20, ptr->unk_20, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_06AB30); + } + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +s32 EnBigpamet_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if ((this->actionFunc == func_80A2855C) || (this->actionFunc == func_80A28A98)) { + if (limbIndex == OBJECT_TL_2_LIMB_02) { + Matrix_Scale(this->unk_2A4, this->unk_2A8, this->unk_2A4, MTXMODE_APPLY); + } else if ((limbIndex == OBJECT_TL_2_LIMB_0B) || (limbIndex == OBJECT_TL_2_LIMB_09) || + (limbIndex == OBJECT_TL_2_LIMB_07) || (limbIndex == OBJECT_TL_2_LIMB_05)) { + Matrix_Scale(this->unk_2A4, this->unk_2A8, this->unk_2A8, MTXMODE_APPLY); + } + } + return false; +} + +void EnBigpamet_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_2_LIMB_01) { + this->unk_2AC = Matrix_GetCurrent()->yw; + } +} + +void EnBigpamet_Draw(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, D_80A29754[this->unk_29C]); + + SkelAnime_DrawFlexOpa(play, this->skelAnime2.skeleton, this->skelAnime2.jointTable, this->skelAnime2.dListCount, + EnBigpamet_OverrideLimbDraw2, EnBigpamet_PostLimbDraw2, &this->actor); + func_80A292A8(this, play); + + CLOSE_DISPS(play->state.gfxCtx); +} + +s32 EnBigpamet_OverrideLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_1_LIMB_01) { + if (this->actionFunc == func_80A28D0C) { + pos->y -= 2500.0f; + } else { + pos->y -= 700.0f; + } + } + + if ((this->unk_2A8 != 1.0f) && (limbIndex == OBJECT_TL_1_LIMB_03)) { + Matrix_Scale(1.0f, this->unk_2A8, this->unk_2A8, MTXMODE_APPLY); + } + + return false; +} + +void EnBigpamet_PostLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnBigpamet* this = THIS; + + if (limbIndex == OBJECT_TL_1_LIMB_01) { + this->unk_2AC = Matrix_GetCurrent()->yw; + } +} + +void func_80A2966C(Actor* thisx, PlayState* play) { + EnBigpamet* this = THIS; + + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime1.skeleton, this->skelAnime1.jointTable, this->skelAnime1.dListCount, + EnBigpamet_OverrideLimbDraw1, EnBigpamet_PostLimbDraw1, &this->actor); + func_80A292A8(this, play); +} diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h index b2d01d468..07d3265c0 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h @@ -2,18 +2,42 @@ #define Z_EN_BIGPAMET_H #include "global.h" +#include "objects/object_tl/object_tl.h" struct EnBigpamet; typedef void (*EnBigpametActionFunc)(struct EnBigpamet*, PlayState*); +enum { + /* 0 */ ENBIGPAMET_0, + /* 1 */ ENBIGPAMET_1, +}; + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3s unk_18; + /* 0x20 */ f32 unk_20; +} EnBigpametStruct; // size = 0x24 + typedef struct EnBigpamet { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x154]; + /* 0x144 */ SkelAnime skelAnime2; + /* 0x188 */ Vec3s jointTable2[OBJECT_TL_2_LIMB_MAX]; + /* 0x1D6 */ Vec3s morphTable2[OBJECT_TL_2_LIMB_MAX]; + /* 0x224 */ SkelAnime skelAnime1; + /* 0x268 */ Vec3s jointTable1[OBJECT_TL_1_LIMB_MAX]; + /* 0x280 */ Vec3s morphTable1[OBJECT_TL_1_LIMB_MAX]; /* 0x298 */ EnBigpametActionFunc actionFunc; - /* 0x29C */ char unk_29C[0x10]; + /* 0x29C */ u8 unk_29C; + /* 0x29E */ s16 unk_29E; + /* 0x2A0 */ UNK_TYPE1 pad2A0[2]; + /* 0x2A2 */ s16 unk_2A2; + /* 0x2A4 */ f32 unk_2A4; + /* 0x2A8 */ f32 unk_2A8; /* 0x2AC */ f32 unk_2AC; - /* 0x2B0 */ char unk_2B0[0x31C]; + /* 0x2B0 */ ColliderCylinder collider; + /* 0x2FC */ EnBigpametStruct unk_2FC[20]; } EnBigpamet; // size = 0x5CC extern const ActorInit En_Bigpamet_InitVars; 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 6ba8eac96..8121db9e2 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -181,8 +181,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, sInitChain); - // thisx req to match - this->switchFlags = GET_BIGPO_SWITCHFLAGS(thisx); + this->switchFlags = BIGPO_GET_SWITCHFLAGS(thisx); thisx->params &= 0xFF; if (thisx->params == ENBIGPO_POSSIBLEFIRE) { if (Flags_GetSwitch(play, this->switchFlags)) { @@ -278,7 +277,7 @@ void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, PlayState* play) { subCam->eye.x -= 1.5f * Math_SinS(this->actor.yawTowardsPlayer); subCam->eye.z -= 1.5f * Math_CosS(this->actor.yawTowardsPlayer); } - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } } @@ -338,7 +337,7 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, PlayState* play) { 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->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_SpawnCutsceneStage2; } @@ -460,7 +459,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { this->idleTimer--; if (this->idleTimer == 0) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; if (this->actor.params == ENBIGPO_SUMMONED) { dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); @@ -957,7 +956,7 @@ void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, PlayState* play) { 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->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } this->actionFunc = EnBigpo_DoNothing; @@ -1444,7 +1443,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); @@ -1471,7 +1470,7 @@ void EnBigpo_RevealedFire(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(play->state.gfxCtx); } 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 248c9356c..9117bd97c 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -64,6 +64,6 @@ enum EnBigpoType { /* 5 */ ENBIGPO_UNK5, }; -#define GET_BIGPO_SWITCHFLAGS(thisx) ((u8)(thisx->params >> 0x8)) +#define BIGPO_GET_SWITCHFLAGS(thisx) (u8)((thisx)->params >> 0x8) #endif // Z_EN_BIGPO_H 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 6f48cdb7a..12076537e 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -389,7 +389,7 @@ void EnBigslime_Destroy(Actor* thisx, PlayState* play) { } Collider_DestroyCylinder(play, &this->gekkoCollider); - Audio_StopSfxByPos(&this->gekkoProjectedPos); + AudioSfx_StopByPos(&this->gekkoProjectedPos); } void EnBigslime_DynamicVtxCopyState(EnBigslime* this) { @@ -795,7 +795,7 @@ void EnBigslime_UpdateCameraGrabPlayer(EnBigslime* this, PlayState* play) { Math_StepToF(&subCamAt.y, GBT_ROOM_5_MIN_Y + 87.5f, 10.0f); Math_StepToF(&subCamAt.z, this->actor.world.pos.z, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } /** @@ -810,7 +810,7 @@ void EnBigslime_JerkCameraPlayerHit(EnBigslime* this, PlayState* play) { Math_Vec3f_Diff(&subCam->eye, &subCam->at, &subCamEye); Math_Vec3f_Scale(&subCamEye, 0.9f); Math_Vec3f_Sum(&subCamEye, &subCam->at, &subCamEye); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** @@ -828,7 +828,7 @@ void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, PlayState* play, s32 notic subCamEye.z = Math_CosS(yawOffset) * zoom + subCam->at.z; subCamEye.y = subCam->at.y + -4.0f + (noticeTimer * 2.0f); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } /** @@ -836,7 +836,7 @@ void EnBigslime_UpdateCameraIntroCs(EnBigslime* this, PlayState* play, s32 notic * center of the roof. This is used when the minislimes merges into bigslime. */ void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, PlayState* play) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &Play_GetCamera(play, this->subCamId)->eye); } void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { @@ -844,7 +844,7 @@ void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); @@ -1495,7 +1495,7 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, PlayState* play) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); s16 yaw; - Play_CameraSetAtEye(play, this->subCamId, &mainCam->at, &mainCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &mainCam->at, &mainCam->eye); this->grabPlayerTimer = 15; this->wavySurfaceTimer = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; @@ -2343,7 +2343,7 @@ void EnBigslime_SetupCutsceneDefeat(EnBigslime* this, PlayState* play) { subCamEye.x = (Math_SinS(yawOffset) * 250.0f) + subCamAt.x; subCamEye.y = subCamAt.y + 60.0f; subCamEye.z = (Math_CosS(yawOffset) * 250.0f) + subCamAt.z; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); for (i = 0; i < MINISLIME_NUM_SPAWN; i++) { this->minislime[i]->actor.params = MINISLIME_DEFEAT_IDLE; @@ -2370,7 +2370,7 @@ void EnBigslime_CutsceneDefeat(EnBigslime* this, PlayState* play) { subCamAt.x = this->actor.world.pos.x; subCamAt.y = this->actor.world.pos.y + 40.0f; subCamAt.z = this->actor.world.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); } } @@ -2410,7 +2410,7 @@ void EnBigslime_GekkoDespawn(EnBigslime* this, PlayState* play) { Math_Vec3f_Diff(&subCam->eye, &this->subCamDistToFrog, &subCamEye); subCamEye.y -= 1.8f; subCamAt.y -= 1.7f; - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } } @@ -2466,7 +2466,7 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) { subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom); subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom); subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); if (this->spawnFrogTimer == 0) { EnBigslime_EndCutscene(this, play); diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index a84e9e430..e49b743b8 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 @@ -62,7 +62,7 @@ static ColliderCylinderInit sCylinderInit = { }; /* Animations struct */ -static AnimationSpeedInfo D_809CDC7C[] = { +static AnimationSpeedInfo sAnimationInfo[] = { { &object_bji_Anim_000FDC, 1.0f, ANIMMODE_LOOP, 0.0f }, /* Looking through telescope */ { &object_bji_Anim_005B58, 1.0f, ANIMMODE_LOOP, 10.0f }, /* Breathing? Unused? */ { &object_bji_Anim_000AB0, 1.0f, ANIMMODE_LOOP, 0.0f }, /* Talking */ @@ -82,7 +82,7 @@ void func_809CCDE0(EnBji01* this, PlayState* play) { } void func_809CCE98(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 0, &this->animationIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex); this->actor.textId = 0; this->actionFunc = func_809CCEE8; } @@ -109,7 +109,7 @@ void func_809CCEE8(EnBji01* this, PlayState* play) { } else { this->moonsTear = (ObjMoonStone*)SubS_FindActor(play, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); } - func_800B8500(&this->actor, play, 60.0f, 10.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 60.0f, 10.0f, PLAYER_AP_NONE); } } @@ -162,7 +162,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { this->textId = 0x5F1; } func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, - EXCH_ITEM_NONE); + PLAYER_AP_NONE); break; case PLAYER_FORM_HUMAN: this->textId = 0x5F7; @@ -191,7 +191,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { } break; } - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 2, &this->animationIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); this->actionFunc = EnBji01_DialogueHandler; } @@ -237,7 +237,7 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; switch (play->msgCtx.currentTextId) { case 0x5DE: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 3, &this->animationIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 3, &this->animIndex); func_80151938(play, 0x5DF); break; case 0x5E4: @@ -287,16 +287,17 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { func_809CCE98(this, play); break; } - if ((this->animationIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 2, &this->animationIndex); + if ((this->animIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); } } void func_809CD634(EnBji01* this, PlayState* play) { - func_801A5BD0(0x6F); + AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | + (1 << BANK_OCARINA) | (1 << BANK_VOICE)); Audio_QueueSeqCmd(0xE0000101); - play->nextEntranceIndex = 0x54A0; /* Termina Field from telescope */ - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 10); /* Telescope entrance */ + gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = play->nextEntrance; func_80169EFC(&play->state); /* Load new entrance? */ gSaveContext.respawnFlag = -2; this->actionFunc = EnBji01_DoNothing; @@ -306,7 +307,7 @@ void EnBji01_DoNothing(EnBji01* this, PlayState* play) { } void func_809CD6C0(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_809CDC7C, 2, &this->animationIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); this->actionFunc = func_809CD70C; } @@ -336,21 +337,21 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 0; this->actor.child = NULL; - this->animationIndex = -1; + this->animIndex = -1; Actor_SetScale(&this->actor, 0.01f); SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->moonsTear = (ObjMoonStone*)SubS_FindActor(play, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); - switch (gSaveContext.save.entranceIndex) { - case 0x4C00: /* Observatory from ECT */ - case 0x4C10: /* Observatory from Termina Field door */ + switch (gSaveContext.save.entrance) { + case ENTRANCE(ASTRAL_OBSERVATORY, 0): /* ECT entrance*/ + case ENTRANCE(ASTRAL_OBSERVATORY, 1): /* TF door entrance */ this->actor.params = SHIKASHI_TYPE_DEFAULT; func_809CCE98(this, play); break; - case 0x4C20: /* Observatory from Termina Field telescope */ + case ENTRANCE(ASTRAL_OBSERVATORY, 2): /* Telescope entrance */ this->actor.flags |= ACTOR_FLAG_10000; - func_801A5BD0(0); + AudioSfx_MuteBanks(0); Audio_QueueSeqCmd(0xE0000100); this->actor.params = SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE; func_809CCE98(this, play); 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 ac738bc71..8ab601e1b 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 @@ -22,7 +22,7 @@ typedef struct EnBji01 { /* 0x18C */ ColliderCylinder collider; /* 0x1D8 */ Vec3s jointTable[SHIKASHI_LIMB_MAX]; /* 0x238 */ Vec3s morphTable[SHIKASHI_LIMB_MAX]; - /* 0x298 */ s32 animationIndex; + /* 0x298 */ s32 animIndex; /* 0x29C */ s16 eyeTexIndex; /* 0x29E */ s16 blinkSeqIndex; /* 0x2A0 */ s16 blinkTimer; 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 91c6d6a4f..788759e3c 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -88,9 +88,9 @@ typedef enum { /* 3 */ TOILET_HAND_ANIM_THUMBS_UP, // Right /* 4 */ TOILET_HAND_ANIM_OPEN_HAND, /* 5 */ TOILET_HAND_ANIM_FIST // i.e. holding the reward -} ToiletHandAnimations; +} ToiletHandAnimation; -static AnimationInfoS sAnimationInfos[] = { +static AnimationInfoS sAnimationInfo[] = { /* 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 }, @@ -104,22 +104,21 @@ void EnBjt_UpdateSkelAnime(EnBjt* this) { SkelAnime_Update(&this->skelAnime); } -s32 EnBjt_ChangeAnimation(EnBjt* this, s32 animIndex) { +s32 EnBjt_ChangeAnim(EnBjt* this, s32 animIndex) { s32 changeAnim = false; s32 changed = false; 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))) { + if (!((this->animIndex == TOILET_HAND_ANIM_WAITING) || (this->animIndex == TOILET_HAND_ANIM_WAITING_MORPH))) { changeAnim = true; } - } else if (this->curAnimIndex != animIndex) { + } else if (this->animIndex != animIndex) { changeAnim = true; } if (changeAnim) { - this->curAnimIndex = animIndex; - changed = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfos, animIndex); + this->animIndex = animIndex; + changed = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->animPlaySpeed = this->skelAnime.playSpeed; } @@ -144,27 +143,27 @@ void EnBjt_UpdateCollision(EnBjt* this, PlayState* play) { s32 EnBjt_TakeItem(s32 exchangeItem) { switch (exchangeItem) { - case EXCH_ITEM_LETTER_TO_KAFEI: + case PLAYER_AP_LETTER_TO_KAFEI: Inventory_DeleteItem(ITEM_LETTER_TO_KAFEI, SLOT(ITEM_LETTER_TO_KAFEI)); break; - case EXCH_ITEM_DEED_SWAMP: + case PLAYER_AP_DEED_SWAMP: Inventory_DeleteItem(ITEM_DEED_SWAMP, SLOT(ITEM_DEED_SWAMP)); break; - case EXCH_ITEM_DEED_MOUNTAIN: + case PLAYER_AP_DEED_MOUNTAIN: Inventory_DeleteItem(ITEM_DEED_MOUNTAIN, SLOT(ITEM_DEED_MOUNTAIN)); break; - case EXCH_ITEM_DEED_OCEAN: + case PLAYER_AP_DEED_OCEAN: Inventory_DeleteItem(ITEM_DEED_OCEAN, SLOT(ITEM_DEED_OCEAN)); break; - case EXCH_ITEM_DEED_LAND: + case PLAYER_AP_DEED_LAND: Inventory_DeleteItem(ITEM_DEED_LAND, SLOT(ITEM_DEED_LAND)); break; - case EXCH_ITEM_LETTER_MAMA: + case PLAYER_AP_LETTER_MAMA: Inventory_DeleteItem(ITEM_LETTER_MAMA, SLOT(ITEM_LETTER_MAMA)); break; @@ -251,10 +250,10 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { // 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); + if ((itemAP == PLAYER_AP_DEED_LAND) || (itemAP == PLAYER_AP_LETTER_TO_KAFEI) || + (itemAP == PLAYER_AP_DEED_SWAMP) || (itemAP == PLAYER_AP_DEED_MOUNTAIN) || + (itemAP == PLAYER_AP_DEED_OCEAN) || (itemAP == PLAYER_AP_LETTER_MAMA)) { + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_WAITING_MORPH); this->playedSfx = false; this->behaviour++; scriptBranch = 1; // Right item @@ -275,9 +274,9 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { break; case TOILET_HAND_BEHAVIOUR_TAKE_ITEM: - if (player->exchangeItemId != EXCH_ITEM_NONE) { + if (player->exchangeItemId != PLAYER_AP_NONE) { EnBjt_TakeItem(player->exchangeItemId); - player->exchangeItemId = EXCH_ITEM_NONE; + player->exchangeItemId = PLAYER_AP_NONE; } if (EnBjt_Vanish(this)) { this->timer = 60; @@ -288,7 +287,7 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { case TOILET_HAND_BEHAVIOUR_USE_ITEM: if (DECR(this->timer) == 0) { - EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_FIST); // change while not visible + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_FIST); // change while not visible this->playedSfx = false; this->behaviour++; } else if (this->timer == 10) { @@ -304,7 +303,7 @@ s32 EnBjt_ChooseBehaviour(Actor* thisx, PlayState* play) { break; case TOILET_HAND_BEHAVIOUR_REWARD_GIVEN: - EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_OPEN_HAND); + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_OPEN_HAND); this->behaviour++; scriptBranch = 1; // Right item break; @@ -339,11 +338,11 @@ s32 EnBjt_ChooseAnimation(EnBjt* this, PlayState* play) { if (this->textId != curTextId) { switch (curTextId) { case 0x2949: // Wrong item - EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAGGING_FINGER); + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_WAGGING_FINGER); break; case 0x294A: // Right item - EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_THUMBS_UP); + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_THUMBS_UP); break; default: @@ -353,7 +352,7 @@ s32 EnBjt_ChooseAnimation(EnBjt* this, PlayState* play) { this->textId = curTextId; } else if (this->stateFlags & TOILET_HAND_STATE_TEXTBOX) { this->stateFlags &= ~TOILET_HAND_STATE_TEXTBOX; - EnBjt_ChangeAnimation(this, TOILET_HAND_ANIM_WAITING); + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_WAITING); } return 0; } @@ -422,8 +421,8 @@ void EnBjt_Init(Actor* thisx, PlayState* play) { 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); + this->animIndex = TOILET_HAND_ANIM_NONE; + EnBjt_ChangeAnim(this, TOILET_HAND_ANIM_WAITING); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); @@ -447,7 +446,7 @@ void EnBjt_Update(Actor* thisx, PlayState* 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); + func_8013C964(&this->actor, play, 60.0f, 10.0f, PLAYER_AP_NONE, this->stateFlags & 7); Actor_SetFocus(&this->actor, 26.0f); EnBjt_UpdateCollision(this, play); } 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 d1aabb999..f26be4d22 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.h @@ -27,7 +27,7 @@ typedef struct EnBjt { /* 0x244 */ UNK_TYPE1 unk_244[4]; /* 0x248 */ s32 playedSfx; // to only play once /* 0x24C */ MsgEventFunc msgEventCallback; - /* 0x250 */ s32 curAnimIndex; + /* 0x250 */ s32 animIndex; /* 0x254 */ UNK_TYPE1 pad_254[8]; } EnBjt; // size = 0x25C diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 3271d8bcb..6b79d6021 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -24,13 +24,13 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a void func_80872BC0(PlayState* play, s32 arg1); typedef struct { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ Vec3f unk_0C; - /* 0x18 */ s16 unk_18; - /* 0x1A */ s16 unk_1A; -} EnBomStruct; // size = 0x1C + /* 0x00 */ Vec3f pos; + /* 0x0C */ Vec3f velocity; + /* 0x18 */ s16 rotY; + /* 0x1A */ s16 rotX; +} PowderKegFuseSegment; // size = 0x1C -static EnBomStruct D_80874650[16]; +static PowderKegFuseSegment sPowderKegFuseSegments[16]; const ActorInit En_Bom_InitVars = { ACTOR_EN_BOM, @@ -610,7 +610,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { Matrix_MultVec3f(&D_80872EE0, &this->actor.home.pos); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_015FA0); + gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateXS(0x4000, MTXMODE_APPLY); @@ -619,7 +619,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, (s8)this->unk_1F4, 0, 40, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, (s8)this->unk_1F4, 0, 40, 255); - gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_015DB0); + gSPDisplayList(POLY_OPA_DISP++, gBombBodyDL); } else { Vec3f sp58; Vec3f sp4C; @@ -640,8 +640,8 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873CA0); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_808742F8); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegBarrelDL); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegGoronSkullDL); func_808726DC(play, &this->actor.home.pos, &sp58, &sp4C, this->timer); func_80872BC0(play, this->timer); @@ -652,14 +652,14 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { } void func_80872648(PlayState* play, Vec3f* arg1) { - EnBomStruct* ptr = &D_80874650[0]; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; s32 i; - for (i = 0; i < ARRAY_COUNT(D_80874650); i++, ptr++) { - Math_Vec3f_Copy(&ptr->unk_00, arg1); - Math_Vec3f_Copy(&ptr->unk_0C, &gZeroVec3f); - ptr->unk_18 = 0; - ptr->unk_1A = 0x4000; + for (i = 0; i < ARRAY_COUNT(sPowderKegFuseSegments); i++, fuseSegmentPtr++) { + Math_Vec3f_Copy(&fuseSegmentPtr->pos, arg1); + Math_Vec3f_Copy(&fuseSegmentPtr->velocity, &gZeroVec3f); + fuseSegmentPtr->rotY = 0; + fuseSegmentPtr->rotX = 0x4000; } } @@ -668,23 +668,23 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a f32 temp_f20; Vec3f spCC; Vec3f spC0; - EnBomStruct* ptr = &D_80874650[0]; - EnBomStruct* ptr2 = &D_80874650[1]; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; + PowderKegFuseSegment* fuseSegmentPtr2 = &sPowderKegFuseSegments[1]; f32 temp_f26 = Math_Vec3f_DistXYZ(arg3, arg1); s32 spB0; f32 temp_f2; f32 distXZ; - Math_Vec3f_Copy(&ptr->unk_00, arg1); + Math_Vec3f_Copy(&fuseSegmentPtr->pos, arg1); Math_Vec3f_Diff(arg2, arg1, &spCC); - ptr->unk_18 = Math_FAtan2F(spCC.z, spCC.x); + fuseSegmentPtr->rotY = Math_FAtan2F(spCC.z, spCC.x); distXZ = sqrtf(SQXZ(spCC)); - ptr->unk_1A = Math_FAtan2F(distXZ, spCC.y); + fuseSegmentPtr->rotX = Math_FAtan2F(distXZ, spCC.y); spB0 = (arg4 / 240) + 1; - for (i = 0; i < spB0; i++, ptr++, ptr2++, arg4 -= 240) { + for (i = 0; i < spB0; i++, fuseSegmentPtr++, fuseSegmentPtr2++, arg4 -= 240) { f32 phi_f22; CollisionPoly* spA0; s32 sp9C; @@ -696,8 +696,8 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a phi_f22 = (arg4 % 240) * (1.0f / 240) * 8.0f; } - Math_Vec3f_Sum(&ptr2->unk_00, &ptr2->unk_0C, &ptr2->unk_00); - temp_f20 = Math_Vec3f_DistXYZAndStoreDiff(arg3, &ptr2->unk_00, &spCC); + Math_Vec3f_Sum(&fuseSegmentPtr2->pos, &fuseSegmentPtr2->velocity, &fuseSegmentPtr2->pos); + temp_f20 = Math_Vec3f_DistXYZAndStoreDiff(arg3, &fuseSegmentPtr2->pos, &spCC); if (temp_f20 < temp_f26) { if (temp_f20 == 0.0f) { spCC.x = 0.0f; @@ -709,33 +709,35 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a spCC.y *= temp_f20; spCC.z *= temp_f20; } - Math_Vec3f_Sum(arg3, &spCC, &ptr2->unk_00); + Math_Vec3f_Sum(arg3, &spCC, &fuseSegmentPtr2->pos); } - if (Math_Vec3f_DistXYZAndStoreDiff(&ptr->unk_00, &ptr2->unk_00, &spCC) == 0.0f) { + if (Math_Vec3f_DistXYZAndStoreDiff(&fuseSegmentPtr->pos, &fuseSegmentPtr2->pos, &spCC) == 0.0f) { spCC.x = 0.0f; spCC.y = phi_f22; spCC.z = 0.0f; } - ptr2->unk_18 = Math_FAtan2F(spCC.z, spCC.x); + fuseSegmentPtr2->rotY = Math_FAtan2F(spCC.z, spCC.x); distXZ = sqrtf(SQXZ(spCC)); - ptr2->unk_1A = Math_FAtan2F(distXZ, spCC.y); + fuseSegmentPtr2->rotX = Math_FAtan2F(distXZ, spCC.y); - ptr2->unk_18 = (s16)CLAMP(BINANG_SUB(ptr2->unk_18, ptr->unk_18), -8000, 8000) + ptr->unk_18; - ptr2->unk_1A = (s16)CLAMP(BINANG_SUB(ptr2->unk_1A, ptr->unk_1A), -8000, 8000) + ptr->unk_1A; + fuseSegmentPtr2->rotY = + (s16)CLAMP(BINANG_SUB(fuseSegmentPtr2->rotY, fuseSegmentPtr->rotY), -8000, 8000) + fuseSegmentPtr->rotY; + fuseSegmentPtr2->rotX = + (s16)CLAMP(BINANG_SUB(fuseSegmentPtr2->rotX, fuseSegmentPtr->rotX), -8000, 8000) + fuseSegmentPtr->rotX; - temp_f20 = Math_CosS(ptr2->unk_1A) * phi_f22; - spC0.x = Math_SinS(ptr2->unk_18) * temp_f20; - spC0.z = Math_CosS(ptr2->unk_18) * temp_f20; - spC0.y = Math_SinS(ptr2->unk_1A) * phi_f22; + temp_f20 = Math_CosS(fuseSegmentPtr2->rotX) * phi_f22; + spC0.x = Math_SinS(fuseSegmentPtr2->rotY) * temp_f20; + spC0.z = Math_CosS(fuseSegmentPtr2->rotY) * temp_f20; + spC0.y = Math_SinS(fuseSegmentPtr2->rotX) * phi_f22; - Math_Vec3f_Sum(&ptr->unk_00, &spC0, &ptr2->unk_00); - Math_Vec3f_Copy(&sp90, &ptr2->unk_00); + Math_Vec3f_Sum(&fuseSegmentPtr->pos, &spC0, &fuseSegmentPtr2->pos); + Math_Vec3f_Copy(&sp90, &fuseSegmentPtr2->pos); sp90.y += 50.0f; - temp_f2 = BgCheck_EntityRaycastFloor3(&play->colCtx, &spA0, &sp9C, &sp90) - ptr2->unk_00.y; + temp_f2 = BgCheck_EntityRaycastFloor3(&play->colCtx, &spA0, &sp9C, &sp90) - fuseSegmentPtr2->pos.y; if (temp_f2 >= 0.0f) { spC0.y += temp_f2; if (phi_f22 < spC0.y) { @@ -753,48 +755,48 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a spC0.z *= temp_f2; } - Math_Vec3f_Sum(&ptr->unk_00, &spC0, &ptr2->unk_00); - Math_Vec3f_Copy(&ptr2->unk_0C, &gZeroVec3f); + Math_Vec3f_Sum(&fuseSegmentPtr->pos, &spC0, &fuseSegmentPtr2->pos); + Math_Vec3f_Copy(&fuseSegmentPtr2->velocity, &gZeroVec3f); } - ptr2->unk_0C.y += -1.0f; - if (ptr2->unk_0C.y < -10.0f) { - ptr2->unk_0C.y = -10.0f; + fuseSegmentPtr2->velocity.y += -1.0f; + if (fuseSegmentPtr2->velocity.y < -10.0f) { + fuseSegmentPtr2->velocity.y = -10.0f; } } - Math_Vec3f_Copy(arg1, &ptr->unk_00); + Math_Vec3f_Copy(arg1, &fuseSegmentPtr->pos); } void func_80872BC0(PlayState* play, s32 arg1) { s32 temp_s5; s32 i; - EnBomStruct* ptr = &D_80874650[0]; - EnBomStruct* ptr2; + PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; + PowderKegFuseSegment* fuseSegmentPtr2; OPEN_DISPS(play->state.gfxCtx); - Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW); - Matrix_RotateZYX(ptr->unk_1A, ptr->unk_18, 0, MTXMODE_APPLY); + Matrix_Translate(fuseSegmentPtr->pos.x, fuseSegmentPtr->pos.y, fuseSegmentPtr->pos.z, MTXMODE_NEW); + Matrix_RotateZYX(fuseSegmentPtr->rotX, fuseSegmentPtr->rotY, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80872F98); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseMaterialDL); temp_s5 = (arg1 / 240) + 1; - ptr2 = &D_80874650[1]; + fuseSegmentPtr2 = &sPowderKegFuseSegments[1]; - for (i = 1; i < temp_s5; i++, ptr2++) { - Matrix_Translate(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, MTXMODE_NEW); - Matrix_RotateZYX(ptr2->unk_1A, ptr2->unk_18, 0, MTXMODE_APPLY); + for (i = 1; i < temp_s5; i++, fuseSegmentPtr2++) { + Matrix_Translate(fuseSegmentPtr2->pos.x, fuseSegmentPtr2->pos.y, fuseSegmentPtr2->pos.z, MTXMODE_NEW); + Matrix_RotateZYX(fuseSegmentPtr2->rotX, fuseSegmentPtr2->rotY, 0, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if ((i % 2) == 0) { - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873020); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseModel1DL); } else { - gSPDisplayList(POLY_OPA_DISP++, ovl_En_Bom_DL_80873040); + gSPDisplayList(POLY_OPA_DISP++, gPowderKegFuseModel2DL); } } 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 b87f43b37..21fc9901f 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 @@ -97,7 +97,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, this->unk_29A, 0x3F); this->unk_2C8 = 80.0f; - if ((gSaveContext.save.entranceIndex == 0xD220) && (gSaveContext.save.weekEventReg[73] & 0x80) && + if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && (gSaveContext.save.weekEventReg[73] & 0x80) && !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { this->unk_2D6 = this->actor.cutscene; if (this->unk_2D6 == 0) { @@ -332,7 +332,7 @@ void func_809C51B4(EnBomBowlMan* this, PlayState* play) { if ((play->msgCtx.unk120B1 == 0) && ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { - play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + play->nextEntrance = Entrance_CreateFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; @@ -509,7 +509,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) { } else { this->actor.textId = 0x716; } - func_800B8500(&this->actor, play, 400.0f, 400.0f, -1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); this->actionFunc = func_809C5AA4; } else { Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f); @@ -524,7 +524,7 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C5598; } } else { - func_800B8500(&this->actor, play, 400.0f, 400.0f, -1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index b2b4ec362..b1b9f8d14 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -116,7 +116,6 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState } normDotUp = DOTXYZ(normal, this->axisUp); - if (fabsf(normDotUp) >= 0.999f) { return false; } @@ -129,7 +128,6 @@ s32 EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayState Math3D_CrossProduct(&this->axisUp, &normal, &vec); magnitude = Math3D_Vec3fMagnitude(&vec); - if (magnitude < 0.001f) { EnBomChu_Explode(this, play); return false; @@ -357,7 +355,8 @@ void EnBomChu_WaitForDeath(EnBomChu* this, PlayState* play) { } /** - * Transform coordinates from actor coordinate space to world space, according to current orientation. + * Transform coordinates from actor coordinate space (origin at actor's world.pos, z-axis is facing + * angle, i.e. shape.rot.y) to world space, according to current orientation. * `offset` is expected to already be at world scale. */ void EnBomChu_ActorCoordsToWorld(EnBomChu* this, Vec3f* offset, Vec3f* pos) { @@ -497,7 +496,7 @@ void EnBomChu_Update(Actor* thisx, PlayState* play) { if (this->isMoving) { this->visualJitter = - (5.0f + (Rand_ZeroOne() * 3.0f)) * Math_SinS((((s32)(Rand_ZeroOne() * 512.0f) + 0x3000) * this->timer)); + (5.0f + (Rand_ZeroOne() * 3.0f)) * Math_SinS((((s32)(Rand_ZeroOne() * 0x200) + 0x3000) * this->timer)); EnBomChu_ActorCoordsToWorld(this, &sBlureP1Offset, &blureP1); EnBomChu_ActorCoordsToWorld(this, &sBlureP2LeftOffset, &blureP2); 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 265388ff7..9f70629e6 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -64,7 +64,7 @@ static AnimationHeader* sAnimations[] = { &object_cs_Anim_0060E8, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, }; -static u8 sAnimModes[] = { +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, }; @@ -94,7 +94,7 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { this->jointTable, OBJECT_CS_LIMB_MAX); this->actor.targetMode = 6; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if ((gSaveContext.save.weekEventReg[73] & 0x80) || (gSaveContext.save.entranceIndex == 0xD220)) { + if ((gSaveContext.save.weekEventReg[73] & 0x80) || (gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2))) { this->actor.world.pos.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; cos = Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; this->unk_2AC = 1; @@ -120,7 +120,7 @@ void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed) { lastFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); this->lastAnimFrame = lastFrame; Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, lastFrame, - sAnimModes[this->animIndex], -10.0f); + sAnimationModes[this->animIndex], -10.0f); } void func_80C04B40(EnBombers2* this) { 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 75ad8576d..6c5a6f235 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -757,7 +757,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { if (D_80C009F0 >= 104) { D_80C009F0 = 0; func_801477B4(play); - play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + play->nextEntrance = Entrance_CreateFromSpawn(6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; 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 ba777bbc6..a9d9756be 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -81,7 +81,7 @@ static AnimationHeader* sAnimations[] = { &object_cs_Anim_0031C4, &object_cs_Anim_010B68, }; -static u8 sAnimModes[] = { +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, @@ -177,8 +177,8 @@ void EnBomjimb_Destroy(Actor* thisx, PlayState* play) { void func_80C0113C(EnBomjimb* this, s32 arg1, f32 arg2) { this->unk_2DC = arg1; this->unk_2B8 = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[this->unk_2DC], arg2, 0.0f, this->unk_2B8, sAnimModes[this->unk_2DC], - -4.0f); + Animation_Change(&this->skelAnime, sAnimations[this->unk_2DC], arg2, 0.0f, this->unk_2B8, + sAnimationModes[this->unk_2DC], -4.0f); } void func_80C011CC(EnBomjimb* this) { @@ -790,12 +790,12 @@ void func_80C02BCC(EnBomjimb* this, PlayState* play) { void func_80C02CA4(EnBomjimb* this, PlayState* play) { if (BREG(13) == 0) { - play->nextEntranceIndex = play->setupExitList[this->unk_2B2]; + play->nextEntrance = play->setupExitList[this->unk_2B2]; gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; } else { - play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(5); + play->nextEntrance = Entrance_CreateFromSpawn(5); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; 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 3ad9f3bd1..c457a623e 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 @@ -558,8 +558,8 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { case 1: Cutscene_Start(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, this->subCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); this->subCamEye.x = mainCam->eye.x; @@ -570,7 +570,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { this->subCamAt.z = mainCam->at.z; Message_StartTextbox(play, 0xF, NULL); this->cameraState = 2; - func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_LISTEN, 0x20); + func_8019FDC8(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); case 2: if (player->actor.world.pos.z > 0.0f) { player->actor.world.pos.z = 290.0f; @@ -595,7 +595,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(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 a9aa59c7b..889055ee8 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 @@ -142,13 +142,13 @@ s32 func_809CB4A0(EnCne01* this, PlayState* play) { Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); //! @bug: Both x and y conditionals are always true, || should be an && if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { - func_800B85E0(&this->enHy.actor, play, 30.0f, EXCH_ITEM_2E); + func_800B85E0(&this->enHy.actor, play, 30.0f, PLAYER_AP_MAGIC_BEANS); } return true; } void EnCne01_FinishInit(EnHy* this, PlayState* play) { - if (EnHy_Init(this, play, &gCneSkel, ENHY_ANIMATION_OS_ANIME_11)) { + if (EnHy_Init(this, play, &gCneSkel, ENHY_ANIM_OS_ANIME_11)) { this->actor.flags |= ACTOR_FLAG_1; this->actor.draw = EnCne01_Draw; this->waitingOnInit = false; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 61eefbe1e..4f8d5eaaa 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -128,7 +128,7 @@ s32 func_80B3E5B4(EnDai* this, PlayState* play) { } s32 func_80B3E5DC(EnDai* this, s32 arg1) { - static AnimationInfoS D_80B3FBFC[] = { + static AnimationInfoS sAnimationInfo[] = { { &object_dai_Anim_0079E4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dai_Anim_0079E4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_dai_Anim_007354, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, @@ -167,7 +167,7 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { if (phi_v1) { this->unk_A70 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80B3FBFC, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); } return ret; @@ -561,7 +561,7 @@ void EnDai_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); func_80B3E834(this); if (!(this->unk_1CE & 0x200)) { - func_8013C964(&this->actor, play, 0.0f, 0.0f, EXCH_ITEM_NONE, this->unk_1CE & 7); + func_8013C964(&this->actor, play, 0.0f, 0.0f, PLAYER_AP_NONE, this->unk_1CE & 7); } func_80B3E460(this); } 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 2e7442fa4..45777c681 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -63,7 +63,7 @@ static AnimationHeader* sAnimations[] = { &object_daiku_Anim_001114, &object_daiku_Anim_00B690, &object_daiku_Anim_00BEAC, }; -static u8 sAnimModes[] = { +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, }; @@ -131,7 +131,7 @@ void EnDaiku_Destroy(Actor* thisx, PlayState* play) { void func_8094373C(EnDaiku* this, s32 arg1) { this->unk_284 = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, this->unk_284, sAnimModes[arg1], -4.0f); + Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, this->unk_284, sAnimationModes[arg1], -4.0f); } void func_809437C8(EnDaiku* this) { 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 4b6eae5bb..47e11a2e8 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 @@ -15,7 +15,7 @@ void EnDemoheishi_Destroy(Actor* thisx, PlayState* play); void EnDemoheishi_Update(Actor* thisx, PlayState* play); void EnDemoheishi_Draw(Actor* thisx, PlayState* play); -void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex); +void EnDemoheishi_ChangeAnim(EnDemoheishi* this, s32 animIndex); void EnDemoheishi_SetupIdle(EnDemoheishi* this); void EnDemoheishi_Idle(EnDemoheishi* this, PlayState* play); void EnDemoheishi_SetupTalk(EnDemoheishi* this); @@ -23,12 +23,12 @@ void EnDemoheishi_Talk(EnDemoheishi* this, PlayState* play); s32 EnDemoheishi_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); typedef enum { - /* 0 */ DEMOHEISHI_ANIMATION_STAND_HAND_ON_HIP, - /* 1 */ DEMOHEISHI_ANIMATION_CHEER_WITH_SPEAR, - /* 2 */ DEMOHEISHI_ANIMATION_WAVE, - /* 3 */ DEMOHEISHI_ANIMATION_SIT_AND_REACH, - /* 4 */ DEMOHEISHI_ANIMATION_STAND_UP -} EnDemoheishiAnimationIndex; + /* 0 */ DEMOHEISHI_ANIM_STAND_HAND_ON_HIP, + /* 1 */ DEMOHEISHI_ANIM_CHEER_WITH_SPEAR, + /* 2 */ DEMOHEISHI_ANIM_WAVE, + /* 3 */ DEMOHEISHI_ANIM_SIT_AND_REACH, + /* 4 */ DEMOHEISHI_ANIM_STAND_UP +} EnDemoheishiAnimation; const ActorInit En_Demo_heishi_InitVars = { ACTOR_EN_DEMO_HEISHI, @@ -83,19 +83,19 @@ void EnDemoheishi_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliderCylinder); } -void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex) { +void EnDemoheishi_ChangeAnim(EnDemoheishi* this, s32 animIndex) { static AnimationHeader* sAnimations[] = { &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, }; - static u8 sAnimModes[] = { + static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, }; this->animIndex = animIndex; this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]); Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, - sAnimModes[this->animIndex], -10.0f); + sAnimationModes[this->animIndex], -10.0f); } void EnDemoheishi_SetHeadRotation(EnDemoheishi* this) { @@ -114,7 +114,7 @@ void EnDemoheishi_SetHeadRotation(EnDemoheishi* this) { } void EnDemoheishi_SetupIdle(EnDemoheishi* this) { - EnDemoheishi_ChangeAnimation(this, DEMOHEISHI_ANIMATION_STAND_HAND_ON_HIP); + EnDemoheishi_ChangeAnim(this, DEMOHEISHI_ANIM_STAND_HAND_ON_HIP); this->textIdIndex = 0; this->actor.textId = sTextIds[this->textIdIndex]; this->isTalking = false; 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 8b9d67e64..ef93a501a 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -165,26 +165,26 @@ static DamageTable sDamageTable = { }; 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; + /* 0 */ DOG_ANIM_WALK_AFTER_TALKING, + /* 1 */ DOG_ANIM_WALK, + /* 2 */ DOG_ANIM_RUN, + /* 3 */ DOG_ANIM_BARK, + /* 4 */ DOG_ANIM_SIT_DOWN_ONCE, // unused + /* 5 */ DOG_ANIM_SIT_DOWN, + /* 6 */ DOG_ANIM_LYING_DOWN_START_1, // unused + /* 7 */ DOG_ANIM_LYING_DOWN_LOOP, // unused + /* 8 */ DOG_ANIM_LYING_DOWN_START_2, // unused + /* 9 */ DOG_ANIM_LYING_DOWN_START_3, // unused + /* 10 */ DOG_ANIM_LYING_DOWN_START_4, // unused + /* 11 */ DOG_ANIM_WALK_BACKWARDS, + /* 12 */ DOG_ANIM_JUMP, + /* 13 */ DOG_ANIM_LONG_JUMP, // unused + /* 14 */ DOG_ANIM_JUMP_ATTACK, + /* 15 */ DOG_ANIM_SWIM, + /* 16 */ DOG_ANIM_MAX +} DogAnimation; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &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 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, @@ -199,10 +199,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP), }; -void EnDg_ChangeAnimation(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 index) { +void EnDg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { f32 frameCount; - animationInfo += index; + animationInfo += animIndex; if (animationInfo->frameCount < 0) { frameCount = Animation_GetLastFrame(animationInfo->animation); } else { @@ -398,15 +398,15 @@ void EnDg_SetupIdleMove(EnDg* this, PlayState* play) { if (!(this->actor.bgCheckFlags & 0x20)) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } else if (play->sceneNum == SCENE_CLOCKTOWER) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); } else { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } this->actionFunc = EnDg_IdleMove; @@ -488,7 +488,7 @@ void EnDg_TryPickUp(EnDg* this, PlayState* play) { this->dogFlags |= DOG_FLAG_HELD; } - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SIT_DOWN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SIT_DOWN); this->actor.flags &= ~ACTOR_FLAG_1; this->actor.speedXZ = 0.0f; if (Player_GetMask(play) == PLAYER_MASK_TRUTH) { @@ -555,7 +555,7 @@ void EnDg_CheckForBremenMaskMarch(EnDg* this, PlayState* play) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); this->actionFunc = EnDg_SetupBremenMaskApproachPlayer; } else if ((this->actionFunc == EnDg_ApproachPlayer) || (this->actionFunc == EnDg_SitNextToPlayer)) { if (DECR(this->bremenBarkTimer) == 0) { @@ -620,7 +620,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_ApproachPlayer; } @@ -634,7 +634,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); this->timer = 50; this->actionFunc = EnDg_BackAwayFromGoron; } @@ -649,7 +649,7 @@ void EnDg_ChooseActionForForm(EnDg* this, PlayState* play) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_ApproachPlayerToAttack; } @@ -684,7 +684,7 @@ void EnDg_IdleMove(EnDg* this, PlayState* play) { if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(20, 20); - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK); this->actionFunc = EnDg_IdleBark; } } @@ -722,7 +722,7 @@ void EnDg_BackAwayFromGoron(EnDg* this, PlayState* play) { if (DECR(this->timer) == 0) { this->timer = 50; - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_RunAwayFromGoron; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); @@ -764,7 +764,7 @@ void EnDg_RunAwayFromGoron(EnDg* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } } else { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK); this->actionFunc = EnDg_BarkAtGoron; } @@ -789,7 +789,7 @@ 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) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); this->timer = 50; this->actionFunc = EnDg_BackAwayFromGoron; } @@ -815,11 +815,11 @@ void EnDg_ApproachPlayerToAttack(EnDg* this, PlayState* play) { this->attackTimer = 20; if (yawDiff < 0x4000) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_JUMP_ATTACK); this->actionFunc = EnDg_JumpAttack; } else { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); - sAnimations[DOG_ANIMATION_WALK_BACKWARDS].playSpeed = -1.0f; + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); + sAnimationInfo[DOG_ANIM_WALK_BACKWARDS].playSpeed = -1.0f; this->actionFunc = EnDg_SlowlyBackUpBeforeAttacking; } } @@ -866,9 +866,9 @@ void EnDg_SitNextToPlayer(EnDg* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; } else { if (player->stateFlags3 & 0x20000000) { // bremen mask march - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); } else { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } this->actionFunc = EnDg_ApproachPlayer; @@ -892,7 +892,7 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { this->dogFlags |= DOG_FLAG_BOUNCED; this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speedXZ *= -1.0f; - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_RunAfterAttacking; return; } @@ -900,13 +900,13 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { if (DECR(this->attackTimer) == 0) { this->attackTimer = 60; this->dogFlags &= ~DOG_FLAG_JUMP_ATTACKING; - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_RunAfterAttacking; } if (curFrame < 9) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - sAnimations[DOG_ANIMATION_JUMP_ATTACK].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; + sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = randPlusMinusPoint5Scaled(1.0f) + 3.0f; } EnDg_SpawnFloorDustRing(this, play); @@ -915,7 +915,7 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 9.0f)) { f32 rand = randPlusMinusPoint5Scaled(1.5f); - sAnimations[DOG_ANIMATION_JUMP_ATTACK].playSpeed = 1.2f; + sAnimationInfo[DOG_ANIM_JUMP_ATTACK].playSpeed = 1.2f; this->actor.velocity.y = 2.0f * rand + 3.0f; this->actor.speedXZ = 8.0f + rand; } else if (curFrame > 20) { @@ -939,10 +939,10 @@ void EnDg_JumpAttack(EnDg* this, PlayState* play) { */ void EnDg_WalkToPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); this->actionFunc = EnDg_BackAwayFromPlayer; } else if (this->actor.xzDistToPlayer < 200.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK); this->actionFunc = EnDg_BarkAtPlayer; } else { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xC00); @@ -965,7 +965,7 @@ void EnDg_SetupBremenMaskApproachPlayer(EnDg* this, PlayState* play) { void EnDg_Fall(EnDg* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_IdleMove; } @@ -990,7 +990,7 @@ void EnDg_ApproachPlayer(EnDg* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.xzDistToPlayer < 40.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SIT_DOWN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SIT_DOWN); this->actionFunc = EnDg_SitNextToPlayer; } else if (player->stateFlags3 & 0x20000000) { // bremen mask march if ((this->actor.xzDistToPlayer > 40.0f) && (player->linearVelocity == 0.0f)) { @@ -1019,14 +1019,14 @@ void EnDg_ApproachPlayer(EnDg* this, PlayState* play) { */ void EnDg_SlowlyBackUpBeforeAttacking(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 72.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_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; - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_JUMP_ATTACK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_JUMP_ATTACK); this->actionFunc = EnDg_JumpAttack; } @@ -1045,10 +1045,10 @@ void EnDg_SlowlyBackUpBeforeAttacking(EnDg* this, PlayState* play) { */ void EnDg_BackAwayFromPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer > 200.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); this->actionFunc = EnDg_WalkToPlayer; } else if (this->actor.xzDistToPlayer > 150.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_BARK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_BARK); this->actionFunc = EnDg_BarkAtPlayer; } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); @@ -1073,10 +1073,10 @@ void EnDg_BackAwayFromPlayer(EnDg* this, PlayState* play) { */ void EnDg_BarkAtPlayer(EnDg* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK_BACKWARDS); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_BACKWARDS); this->actionFunc = EnDg_BackAwayFromPlayer; } else if (this->actor.xzDistToPlayer > 200.0f) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_WALK); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); this->actionFunc = EnDg_WalkToPlayer; } @@ -1180,7 +1180,7 @@ void EnDg_Swim(EnDg* this, PlayState* play) { this->behavior = DOG_BEHAVIOR_DEFAULT; this->timer = Rand_S16Offset(60, 60); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); this->actionFunc = EnDg_IdleMove; } @@ -1226,7 +1226,7 @@ void EnDg_JumpOutOfWater(EnDg* this, PlayState* play) { this->actor.gravity = -3.0f; this->timer = Rand_S16Offset(60, 60); Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_OUT_OF_WATER); - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_RUN); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); this->actionFunc = EnDg_IdleMove; Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else { @@ -1292,7 +1292,7 @@ void EnDg_SetupTalk(EnDg* this, PlayState* play) { 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); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK_AFTER_TALKING); this->actionFunc = EnDg_Held; } } @@ -1349,7 +1349,7 @@ void EnDg_Update(Actor* thisx, PlayState* play) { } if ((this->actor.bgCheckFlags & 0x40) && Actor_HasNoParent(&this->actor, play)) { - EnDg_ChangeAnimation(&this->skelAnime, sAnimations, DOG_ANIMATION_SWIM); + EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_SWIM); this->actionFunc = EnDg_SetupSwim; } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index c9719f613..eb7719150 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -365,7 +365,7 @@ void func_8089ABF4(EnDinofos* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Camera* subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { @@ -488,7 +488,7 @@ void func_8089B288(EnDinofos* this, PlayState* play) { this->unk_290--; Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, this->unk_2AC); Math_Vec3f_StepTo(&subCam->at, &this->unk_2C8, this->unk_2A8); - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCam->eye); if (this->unk_290 == 0) { func_8089B320(this); } @@ -522,7 +522,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { subCamAt.y = subCam->at.y; } - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); if (this->actor.bgCheckFlags & 1) { func_8089B4A4(this); } @@ -547,7 +547,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { this->unk_290++; if (this->unk_290 < 8) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } if (this->skelAnime.curFrame > 35.0f) { @@ -556,7 +556,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); if (this->skelAnime.curFrame <= 55.0f) { func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); } @@ -1215,7 +1215,7 @@ void func_8089D318(EnDinofos* this, PlayState* play) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y; subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); func_8089CFAC(this); } else { func_8089B100(this, play); diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 7a2f1cf80..7afd4e224 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -93,7 +93,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gDekuPalaceGuardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDekuPalaceGuardStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, { &gDekuPalaceGuardWaitAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, @@ -138,18 +138,18 @@ s32 func_80A514F0(SkelAnime* skelAnime, s16 animIndex) { s32 sp30 = false; if (animIndex >= 0) { - if (animIndex < ARRAY_COUNT(sAnimations)) { + if (animIndex < ARRAY_COUNT(sAnimationInfo)) { sp30 = true; - frameCount = sAnimations[animIndex].frameCount; + frameCount = sAnimationInfo[animIndex].frameCount; if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimations[animIndex].animation); + frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } - frame = sAnimations[animIndex].startFrame; + frame = sAnimationInfo[animIndex].startFrame; if (frame < 0) { frame = frameCount; } - Animation_Change(skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].playSpeed, frame, - frameCount, sAnimations[animIndex].mode, sAnimations[animIndex].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, frame, + frameCount, sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); } } return sp30; 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 102fc6d9b..d935a1dae 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -146,20 +146,20 @@ void func_80A715DC(EnDno* this, PlayState* play) { Vec3f sp70; do { - crace = (BgCraceMovebg*)SubS_FindActor(play, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); + crace = (BgCraceMovebg*)SubS_FindActor(play, &crace->dyna.actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (crace != NULL) { - if (ENDNO_GET_F(&crace->actor) == ENDNO_GET_F_0 && !(crace->unk_170 & 1)) { - if (SubS_LineSegVsPlane(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C, + if (ENDNO_GET_F(&crace->dyna.actor) == ENDNO_GET_F_0 && !(crace->unk170 & 1)) { + if (SubS_LineSegVsPlane(&crace->dyna.actor.home.pos, &crace->dyna.actor.home.rot, &D_80A73B2C, &this->actor.prevPos, &this->actor.world.pos, &sp88)) { - Math_Vec3f_Diff(&this->actor.world.pos, &crace->actor.home.pos, &sp7C); - Matrix_RotateYS(-crace->actor.home.rot.y, MTXMODE_NEW); + Math_Vec3f_Diff(&this->actor.world.pos, &crace->dyna.actor.home.pos, &sp7C); + Matrix_RotateYS(-crace->dyna.actor.home.rot.y, MTXMODE_NEW); Matrix_MultVec3f(&sp7C, &sp70); if ((fabsf(sp70.x) < 100.0f) && (sp70.y >= -10.0f) && (sp70.y <= 180.0f) && (sp70.z < 0.0f)) { - crace->unk_170 |= 1; + crace->unk170 |= 1; } } } - crace = (BgCraceMovebg*)crace->actor.next; + crace = (BgCraceMovebg*)crace->dyna.actor.next; } } while (crace != NULL); } @@ -517,7 +517,7 @@ void func_80A724B8(EnDno* this, PlayState* play) { } void func_80A7256C(EnDno* this, PlayState* play) { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_MINUS1); } void func_80A72598(EnDno* this, PlayState* play) { @@ -1000,7 +1000,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(&gfxXlu[2], 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(&gfxXlu[3], 255, 0, 0, 0); - gSPDisplayList(&gfxXlu[4], gGameplayKeepDrawFlameDL); + gSPDisplayList(&gfxXlu[4], gEffFire1DL); POLY_XLU_DISP = gfxXlu + 5; 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 3d084d849..604453640 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -56,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dnp_Anim_0007D8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, { &object_dnp_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnp_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, @@ -135,7 +135,7 @@ s32 func_80B3CC38(EnDnp* this, s32 arg1) { if (arg1 != this->unk_340) { this->unk_340 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); } return ret; @@ -304,7 +304,7 @@ void func_80B3D338(EnDnp* this, PlayState* play) { } else { this->actor.textId = 0x971; player->actor.textId = this->actor.textId; - func_800B8500(&this->actor, play, 9999.9f, 9999.9f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 9999.9f, 9999.9f, PLAYER_AP_MINUS1); } } } @@ -409,7 +409,7 @@ void EnDnp_Update(Actor* thisx, PlayState* play) { if ((this->unk_322 & 0x400) && !(gSaveContext.save.weekEventReg[23] & 0x20)) { Actor_PickUp(&this->actor, play, GI_MAX, sp2C, sp28); } - func_8013C964(&this->actor, play, sp2C, sp28, EXCH_ITEM_NONE, this->unk_322 & 7); + func_8013C964(&this->actor, play, sp2C, sp28, PLAYER_AP_NONE, this->unk_322 & 7); Actor_SetFocus(&this->actor, 30.0f); func_80B3CC80(this, play); } 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 36a8b6911..6b21d3fc1 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -57,7 +57,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS D_80A5349C[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dnq_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnq_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_dnq_Anim_007528, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, @@ -80,8 +80,9 @@ static AnimationInfoS D_80A5349C[] = { { &object_dnq_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; -void func_80A52530(PlayState* play, EnDnq* this) { - func_8013A530(play, &this->actor, 10, &this->actor.focus.pos, &this->actor.world.rot, 120.0f, 480.0f, 0x38E3); +s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_DEKU_KING, &thisx->focus.pos, &thisx->world.rot, 120.0f, + 480.0f, 0x38E3); } s32 func_80A5257C(EnDnq* this, s32 arg1) { @@ -104,14 +105,14 @@ s32 func_80A5257C(EnDnq* this, s32 arg1) { if (phi_v1) { this->unk_398 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80A5349C, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); } return ret; } void func_80A52604(EnDnq* this, PlayState* play) { - Collider_UpdateCylinder(&this->actor, &this->collider); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -120,7 +121,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { if (play->csCtx.state != 0) { if (!(this->unk_37C & 0x20)) { - this->actor.flags &= ~ACTOR_FLAG_1; + this->picto.actor.flags &= ~ACTOR_FLAG_1; this->unk_1DC = 0xFF; this->unk_37C |= 0x20; } @@ -128,7 +129,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { ret = true; } else { if (this->unk_37C & 0x20) { - this->actor.flags |= ACTOR_FLAG_1; + this->picto.actor.flags |= ACTOR_FLAG_1; this->unk_1DC = 0xFF; this->unk_37C &= ~0x20; SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -196,10 +197,10 @@ s32 func_80A52944(EnDnq* this) { if (this->unk_386 == 0) { func_80A5257C(this, 12); this->unk_38C = 1; - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; this->unk_386 = 1; phi_v1 = this->unk_38C * 0x2000; - this->actor.shape.rot.y += phi_v1; + this->picto.actor.shape.rot.y += phi_v1; } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_386++; if (this->unk_386 >= 6) { @@ -214,8 +215,8 @@ s32 func_80A52944(EnDnq* this) { func_80A5257C(this, 13); this->skelAnime.curFrame = 0.0f; } - this->actor.shape.rot.y = this->actor.world.rot.y; - this->actor.shape.rot.y += phi_v1; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; + this->picto.actor.shape.rot.y += phi_v1; } this->unk_38A = 0; @@ -233,7 +234,7 @@ s32 func_80A52A78(EnDnq* this, PlayState* play) { this->unk_388 = play->state.frames % 5; } - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; if (this->unk_38C != 0) { this->unk_38C--; } @@ -256,7 +257,7 @@ s32 func_80A52B68(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 temp = play->msgCtx.currentTextId; - if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->actor)) { + if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->picto.actor)) { switch (temp) { case 0x89B: func_80A5257C(this, 18); @@ -300,9 +301,9 @@ void func_80A52C6C(EnDnq* this, PlayState* play) { Vec3f sp1C; Math_Vec3f_Copy(&sp1C, &player->actor.world.pos); - Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.world.rot.y, &sp34, &sp28); + Lib_Vec3f_TranslateAndRotateY(&this->picto.actor.world.pos, this->picto.actor.world.rot.y, &sp34, &sp28); Math_Vec3f_Copy(&this->unk_370, &sp28); - this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&sp28, &sp1C); + this->picto.actor.xzDistToPlayer = Math_Vec3f_DistXZ(&sp28, &sp1C); } s32* func_80A52CF8(EnDnq* this, PlayState* play) { @@ -320,7 +321,7 @@ s32* func_80A52CF8(EnDnq* this, PlayState* play) { s32 func_80A52D44(EnDnq* this, PlayState* play) { s32 ret = false; - if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { SubS_UpdateFlags(&this->unk_37C, 0, 7); this->unk_380 = func_80A52CF8(this, play); this->actionFunc = func_80A52FB8; @@ -332,7 +333,7 @@ s32 func_80A52D44(EnDnq* this, PlayState* play) { void func_80A52DC8(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + s16 yaw = this->picto.actor.yawTowardsPlayer - this->picto.actor.world.rot.y; if (yaw <= 0x3800) { SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -350,37 +351,37 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { } } - this->unk_394 = this->actor.xzDistToPlayer; + this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); - if (this->actor.xzDistToPlayer < this->unk_390) { + if (this->picto.actor.xzDistToPlayer < this->unk_390) { player->unk_B2B = 0x1A; } - this->actor.xzDistToPlayer = this->unk_394; + this->picto.actor.xzDistToPlayer = this->unk_394; if (gSaveContext.save.weekEventReg[83] & 8) { func_80A52A78(this, play); } else if (this->unk_3A4 == 0) { - Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 3, 0x2AA8); func_80A526F8(this); } else { func_80A52944(this); } } else { - Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, this->picto.actor.world.rot.y, 3, 0x2AA8); this->unk_390 = 70.0f; } } void func_80A52FB8(EnDnq* this, PlayState* play) { - s16 sp2E = this->actor.yawTowardsPlayer; + s16 sp2E = this->picto.actor.yawTowardsPlayer; - if (func_8010BF58(&this->actor, play, this->unk_380, NULL, &this->unk_1E0)) { + if (func_8010BF58(&this->picto.actor, play, this->unk_380, NULL, &this->unk_1E0)) { SubS_UpdateFlags(&this->unk_37C, 3, 7); this->unk_386 = 0; this->actionFunc = func_80A52DC8; } else { - Math_ApproachS(&this->actor.shape.rot.y, sp2E, 3, 0x2AA8); + Math_ApproachS(&this->picto.actor.shape.rot.y, sp2E, 3, 0x2AA8); } } @@ -400,7 +401,7 @@ void func_80A53038(EnDnq* this, PlayState* play) { } if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KINGNUTS_DAMAGE); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_KINGNUTS_DAMAGE); } if (((this->unk_398 == 3) || (this->unk_398 == 6)) && @@ -408,21 +409,21 @@ void func_80A53038(EnDnq* this, PlayState* play) { func_80A5257C(this, this->unk_398 + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, temp_v0); } } void EnDnq_Init(Actor* thisx, PlayState* play) { EnDnq* this = THIS; - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 14.0f); + ActorShape_Init(&this->picto.actor.shape, 0.0f, NULL, 14.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_dnq_Skel_00EB48, NULL, this->jointTable, this->morphTable, 33); this->unk_398 = -1; func_80A5257C(this, 0); - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - Actor_SetScale(&this->actor, 0.02f); - this->actor.targetMode = 1; + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->picto.actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + Actor_SetScale(&this->picto.actor, 0.02f); + this->picto.actor.targetMode = 1; this->unk_386 = 0; this->unk_37C = 0; SubS_UpdateFlags(&this->unk_37C, 3, 7); @@ -431,7 +432,7 @@ void EnDnq_Init(Actor* thisx, PlayState* play) { } else { this->unk_3A4 = 0; } - this->unk_144 = func_80A52530; + this->picto.validationFunc = EnDnq_ValidatePictograph; this->actionFunc = func_80A52DC8; } @@ -451,13 +452,13 @@ void EnDnq_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80A52B68(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); - this->unk_394 = this->actor.xzDistToPlayer; + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 30.0f, 12.0f, 0.0f, 4); + this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); - func_8013C964(&this->actor, play, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, EXCH_ITEM_NONE, - this->unk_37C & 7); - this->actor.xzDistToPlayer = this->unk_394; - Actor_SetFocus(&this->actor, 46.0f); + func_8013C964(&this->picto.actor, play, this->unk_390, fabsf(this->picto.actor.playerHeightRel) + 1.0f, + PLAYER_AP_NONE, this->unk_37C & 7); + this->picto.actor.xzDistToPlayer = this->unk_394; + Actor_SetFocus(&this->picto.actor, 46.0f); func_80A52604(this, play); } } @@ -467,5 +468,5 @@ void EnDnq_Draw(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); + NULL, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h index 6c3027c8b..9e4bbd52a 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h @@ -2,15 +2,14 @@ #define Z_EN_DNQ_H #include "global.h" +#include "z64snap.h" struct EnDnq; typedef void (*EnDnqActionFunc)(struct EnDnq*, PlayState*); -typedef void (*EnDnqFunc)(PlayState*, struct EnDnq*); typedef struct EnDnq { - /* 0x000 */ Actor actor; - /* 0x144 */ EnDnqFunc unk_144; + /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ EnDnqActionFunc actionFunc; /* 0x190 */ ColliderCylinder collider; 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 92dbc1126..f8588614f 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -20,18 +20,18 @@ void EnDns_DoNothing(EnDns* this, PlayState* play); void func_8092D4D8(EnDns* this, PlayState* play); typedef enum { - /* 0 */ EN_DNS_ANIMATION_IDLE_1, - /* 1 */ EN_DNS_ANIMATION_IDLE_2, - /* 2 */ EN_DNS_ANIMATION_WALK_1, - /* 3 */ EN_DNS_ANIMATION_WALK_2, - /* 4 */ EN_DNS_ANIMATION_SURPRISE_START, - /* 5 */ EN_DNS_ANIMATION_SURPRISE_LOOP, - /* 6 */ EN_DNS_ANIMATION_RUN_START, - /* 7 */ EN_DNS_ANIMATION_RUN_LOOP, - /* 8 */ EN_DNS_ANIMATION_DANCE, - /* 9 */ EN_DNS_ANIMATION_FLIP, - /* 10 */ EN_DNS_ANIMATION_MAX, -} EnDnsAnimationIndex; + /* 0 */ EN_DNS_ANIM_IDLE_1, + /* 1 */ EN_DNS_ANIM_IDLE_2, + /* 2 */ EN_DNS_ANIM_WALK_1, + /* 3 */ EN_DNS_ANIM_WALK_2, + /* 4 */ EN_DNS_ANIM_SURPRISE_START, + /* 5 */ EN_DNS_ANIM_SURPRISE_LOOP, + /* 6 */ EN_DNS_ANIM_RUN_START, + /* 7 */ EN_DNS_ANIM_RUN_LOOP, + /* 8 */ EN_DNS_ANIM_DANCE, + /* 9 */ EN_DNS_ANIM_FLIP, + /* 10 */ EN_DNS_ANIM_MAX, +} EnDnsAnimation; static s32 D_8092DCB0[] = { 0x00172000, 0x050E082F, 0x0C100E08, 0x200C1000, 0x00172000, 0x050E0830, 0x0C100E08, 0x210C1000, @@ -73,7 +73,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gKingsChamberDekuGuardIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &gKingsChamberDekuGuardWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -89,8 +89,8 @@ static AnimationInfoS sAnimations[] = { void func_8092C5C0(EnDns* this) { s32 pad; - if (((this->animationIndex == EN_DNS_ANIMATION_WALK_1) || (this->animationIndex == EN_DNS_ANIMATION_WALK_2) || - (this->animationIndex == EN_DNS_ANIMATION_RUN_START) || (this->animationIndex == EN_DNS_ANIMATION_RUN_LOOP)) && + if (((this->animIndex == EN_DNS_ANIM_WALK_1) || (this->animIndex == EN_DNS_ANIM_WALK_2) || + (this->animIndex == EN_DNS_ANIM_RUN_START) || (this->animIndex == EN_DNS_ANIM_RUN_LOOP)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 3.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK); } @@ -101,31 +101,29 @@ s32 func_8092C63C(EnDns* this, s32 arg1) { s32 ret = false; switch (arg1) { - case EN_DNS_ANIMATION_IDLE_1: - case EN_DNS_ANIMATION_IDLE_2: - if ((this->animationIndex != EN_DNS_ANIMATION_IDLE_1) && - (this->animationIndex != EN_DNS_ANIMATION_IDLE_2)) { + case EN_DNS_ANIM_IDLE_1: + case EN_DNS_ANIM_IDLE_2: + if ((this->animIndex != EN_DNS_ANIM_IDLE_1) && (this->animIndex != EN_DNS_ANIM_IDLE_2)) { phi_v1 = true; } break; - case EN_DNS_ANIMATION_WALK_1: - case EN_DNS_ANIMATION_WALK_2: - if ((this->animationIndex != EN_DNS_ANIMATION_WALK_1) && - (this->animationIndex != EN_DNS_ANIMATION_WALK_2)) { + case EN_DNS_ANIM_WALK_1: + case EN_DNS_ANIM_WALK_2: + if ((this->animIndex != EN_DNS_ANIM_WALK_1) && (this->animIndex != EN_DNS_ANIM_WALK_2)) { phi_v1 = true; } break; default: - if (this->animationIndex != arg1) { + if (this->animIndex != arg1) { phi_v1 = true; } } if (phi_v1) { - this->animationIndex = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + this->animIndex = arg1; + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); } return ret; @@ -236,7 +234,7 @@ s32 func_8092CAD0(EnDns* this, PlayState* play) { this->unk_2F0 = 0.0f; if (this->unk_2D2 != 0) { this->unk_2F0 = this->skelAnime.curFrame; - func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); + func_8092C63C(this, EN_DNS_ANIM_WALK_1); } this->unk_2DA = this->actor.world.rot.y; } @@ -306,7 +304,7 @@ s32 func_8092CCEC(EnDns* this, PlayState* play) { } s32 func_8092CE38(EnDns* this) { - static s32 D_8092DE00[] = { EN_DNS_ANIMATION_DANCE, EN_DNS_ANIMATION_DANCE, EN_DNS_ANIMATION_FLIP }; + static s32 D_8092DE00[] = { EN_DNS_ANIM_DANCE, EN_DNS_ANIM_DANCE, EN_DNS_ANIM_FLIP }; s16 frame; s32 pad; Vec3f sp2C; @@ -406,11 +404,11 @@ void func_8092D1B8(EnDns* this, PlayState* play) { play_sound(NA_SE_SY_FOUND); gSaveContext.eventInf[1] |= 0x20; this->unk_2F4 = func_8092CCEC; - func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); + func_8092C63C(this, EN_DNS_ANIM_WALK_1); this->actionFunc = EnDns_DoNothing; } else if (gSaveContext.eventInf[1] & 0x40) { func_8092CCEC(this, play); - func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); + func_8092C63C(this, EN_DNS_ANIM_WALK_1); this->actionFunc = func_8092D330; } Math_ApproachS(&this->actor.shape.rot.y, sp22, 3, 0x2AA8); @@ -439,7 +437,7 @@ void func_8092D330(EnDns* this, PlayState* play) { } if ((this->unk_2C6 & 0x100) && (DECR(this->unk_2D0) == 0)) { this->unk_2C6 &= ~0x100; - play->nextEntranceIndex = 0x5010; + play->nextEntrance = ENTRANCE(DEKU_PALACE, 1); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -452,7 +450,7 @@ void func_8092D4D8(EnDns* this, PlayState* play) { if (ENDNS_GET_4000(&this->actor) && (this->unk_2D2 == 0)) { if (func_8092CE38(this)) { - func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); + func_8092C63C(this, EN_DNS_ANIM_WALK_1); } } else if (func_8010BF58(&this->actor, play, this->unk_1E0, this->unk_2F4, &this->unk_1DC)) { SubS_UpdateFlags(&this->unk_2C6, 3, 7); @@ -461,7 +459,7 @@ void func_8092D4D8(EnDns* this, PlayState* play) { if (!(gSaveContext.eventInf[1] & 0x20)) { this->skelAnime.curFrame = this->unk_2F0; this->actor.world.rot.y = this->unk_2DA; - func_8092C63C(this, EN_DNS_ANIMATION_DANCE); + func_8092C63C(this, EN_DNS_ANIM_DANCE); } this->unk_2CC = 0; this->unk_2CE = 0; @@ -475,10 +473,10 @@ void func_8092D4D8(EnDns* this, PlayState* play) { void func_8092D5E8(EnDns* this, PlayState* play) { static s32 D_8092DE0C[] = { - EN_DNS_ANIMATION_IDLE_1, - EN_DNS_ANIMATION_IDLE_1, - EN_DNS_ANIMATION_SURPRISE_START, - EN_DNS_ANIMATION_RUN_START, + EN_DNS_ANIM_IDLE_1, + EN_DNS_ANIM_IDLE_1, + EN_DNS_ANIM_SURPRISE_START, + EN_DNS_ANIM_RUN_START, }; s32 temp_v0; u32 temp_v1; @@ -491,10 +489,9 @@ void func_8092D5E8(EnDns* this, PlayState* play) { this->unk_1D8 = temp_v1; } - if (((this->animationIndex == EN_DNS_ANIMATION_SURPRISE_START) || - (this->animationIndex == EN_DNS_ANIMATION_RUN_START)) && + if (((this->animIndex == EN_DNS_ANIM_SURPRISE_START) || (this->animIndex == EN_DNS_ANIM_RUN_START)) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_8092C63C(this, this->animationIndex + 1); + func_8092C63C(this, this->animIndex + 1); } Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); @@ -512,8 +509,8 @@ void EnDns_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 18.0f); SkelAnime_Init(play, &this->skelAnime, &gKingsChamberDekuGuardSkel, NULL, this->jointTable, this->morphTable, KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX); - this->animationIndex = -1; - func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); + this->animIndex = -1; + func_8092C63C(this, EN_DNS_ANIM_WALK_1); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); @@ -553,7 +550,7 @@ void EnDns_Update(Actor* thisx, PlayState* play) { func_8092C934(this); func_8092C86C(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); - func_8013C964(&this->actor, play, 80.0f, 40.0f, EXCH_ITEM_NONE, this->unk_2C6 & 7); + func_8013C964(&this->actor, play, 80.0f, 40.0f, PLAYER_AP_NONE, this->unk_2C6 & 7); Actor_SetFocus(&this->actor, 34.0f); func_8092C6FC(this, play); func_8092C5C0(this); diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index 3a252b1ec..3a382c192 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -53,7 +53,7 @@ typedef struct EnDns { /* 0x2EC */ f32 unk_2EC; /* 0x2F0 */ f32 unk_2F0; /* 0x2F4 */ EnDnsFunc unk_2F4; - /* 0x2F8 */ s32 animationIndex; + /* 0x2F8 */ s32 animIndex; /* 0x2FC */ s32 unk_2FC; } EnDns; // size = 0x300 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 ece3c0903..901efc0d2 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -25,11 +25,11 @@ void EnDragon_Attack(EnDragon* this, PlayState* play); void EnDragon_Dead(EnDragon* this, PlayState* play); typedef enum { - /* 0 */ DEEP_PYTHON_ANIMATION_SMALL_SIDE_SWAY, - /* 1 */ DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY, - /* 2 */ DEEP_PYTHON_ANIMATION_VERTICAL_SWAY, - /* 3 */ DEEP_PYTHON_ANIMATION_IDLE -} DeepPythonAnimationIndex; + /* 0 */ DEEP_PYTHON_ANIM_SMALL_SIDE_SWAY, + /* 1 */ DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY, + /* 2 */ DEEP_PYTHON_ANIM_VERTICAL_SWAY, + /* 3 */ DEEP_PYTHON_ANIM_IDLE +} DeepPythonAnimation; typedef enum { /* 0 */ DEEP_PYTHON_EXTEND_STATE_NOT_FULLY_EXTENDED, @@ -264,18 +264,18 @@ static AnimationHeader* sAnimations[] = { static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE }; -void EnDragon_ChangeAnimation(EnDragon* this, s32 animationIndex) { +void EnDragon_ChangeAnim(EnDragon* this, s32 animIndex) { f32 startFrame; - this->animationIndex = animationIndex; - this->endFrame = Animation_GetLastFrame(sAnimations[animationIndex]); + this->animIndex = animIndex; + this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); startFrame = 0.0f; - if (this->animationIndex == DEEP_PYTHON_ANIMATION_IDLE) { + if (this->animIndex == DEEP_PYTHON_ANIM_IDLE) { startFrame = this->endFrame; } - Animation_Change(&this->skelAnime, sAnimations[animationIndex], 1.0f, startFrame, this->endFrame, - sAnimationModes[this->animationIndex], -4.0f); + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, startFrame, this->endFrame, + sAnimationModes[this->animIndex], -4.0f); } static Color_RGBA8 sBubblePrimColors[] = { @@ -329,7 +329,7 @@ void EnDragon_RetreatOnceTimerEnds(EnDragon* this, PlayState* play) { } void EnDragon_SetupRetreatOrIdle(EnDragon* this) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_IDLE); + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_IDLE); this->state = 0; this->unk_2CC = 0; this->hasGrabbedPlayer = false; @@ -397,8 +397,8 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, extendedPos.z, 0.3f, 50.0f); if ((fabsf(this->actor.world.pos.x - extendedPos.x) < 4.0f) && (fabsf(this->actor.world.pos.z - extendedPos.z) < 4.0f)) { - if (this->animationIndex != DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY); + if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } this->state = DEEP_PYTHON_EXTEND_STATE_FULLY_EXTENDED; @@ -419,8 +419,8 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { if (yaw < 0x5000) { // Player is in front of the jaw if ((this->endFrame <= currentFrame) && (this->largeSwayWaitTimer == 0)) { - if (this->animationIndex != DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY); + if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } this->state = DEEP_PYTHON_EXTEND_STATE_REPEAT_LARGE_SWAY; @@ -430,7 +430,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { } else { // Player is in behind the jaw if (this->state == DEEP_PYTHON_EXTEND_STATE_REPEAT_LARGE_SWAY) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_SMALL_SIDE_SWAY); + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_SMALL_SIDE_SWAY); this->largeSwayWaitTimer = Rand_ZeroFloat(20.0f) + this->endFrame; this->state = DEEP_PYTHON_EXTEND_STATE_REPEAT_SMALL_SWAY; } @@ -449,7 +449,7 @@ void EnDragon_SetSubCamEyeAt(EnDragon* this, PlayState* play, Vec3f subCamEye, V 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); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { @@ -471,7 +471,7 @@ void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { this->state = DEEP_PYTHON_GRAB_STATE_START; this->grabTimer = 0; this->hasGrabbedPlayer = false; - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_IDLE); + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_IDLE); this->actionFunc = EnDragon_Grab; } } @@ -548,8 +548,8 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { } void EnDragon_SetupAttack(EnDragon* this) { - if (this->animationIndex != DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY); + if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } this->behindJawRetreatTimer = 0; @@ -603,8 +603,8 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { if ((this->state <= DEEP_PYTHON_ATTACK_STATE_START) && (this->endFrame <= currentFrame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_UTSUBO_BITE); - if (this->animationIndex != DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY) { - EnDragon_ChangeAnimation(this, DEEP_PYTHON_ANIMATION_LARGE_SIDE_SWAY); + if (this->animIndex != DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY) { + EnDragon_ChangeAnim(this, DEEP_PYTHON_ANIM_LARGE_SIDE_SWAY); } this->state++; 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 b12c63dd0..321d0ad95 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h @@ -26,7 +26,7 @@ typedef struct EnDragon { /* 0x188 */ Vec3s jointTable[DEEP_PYTHON_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[DEEP_PYTHON_LIMB_MAX]; /* 0x248 */ EnDragonActionFunc actionFunc; - /* 0x24C */ s32 animationIndex; + /* 0x24C */ s32 animIndex; /* 0x250 */ s32 pythonIndex; /* 0x254 */ Vec3f jawPos; /* 0x260 */ Vec3f burrowEntrancePos; // Vertically and horizontally centered on the burrow opening. Set by Bg_Sinkai_Kabe diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index eecd6be2d..5ecab4fd4 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -51,7 +51,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations = { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; +static AnimationInfoS sAnimationInfo = { &gWeddingDressMannequinIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }; void EnDrs_CollisionUpdate(EnDrs* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); @@ -65,7 +65,7 @@ void EnDrs_Setup(EnDrs* this, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gWeddingDressMannequinSkel, NULL, this->jointTable, this->morphTable, WEDDING_DRESS_MANNEQUIN_LIMB_MAX); - SubS_ChangeAnimationByInfoS(&this->skelAnime, &sAnimations, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, &sAnimationInfo, 0); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c index 0d274c0e4..7e517ce09 100644 --- a/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c +++ b/src/overlays/actors/ovl_En_Ds2n/z_en_ds2n.c @@ -32,7 +32,7 @@ const ActorInit En_Ds2n_InitVars = { (ActorFunc)EnDs2n_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gDs2nIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, }; @@ -43,7 +43,7 @@ static TexturePtr sEyeTextures[] = { gDs2nEyeOpenTex, gDs2nEyeHalfTex, gDs2nEyeC void EnDs2n_SetupIdle(EnDs2n* this) { this->blinkTimer = 20; this->blinkState = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = EnDs2n_Idle; } diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h index 9a0b53223..6d5d93ec4 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h @@ -15,7 +15,7 @@ typedef struct EnDyExtra { /* 0x14C */ s16 unk14C; /* 0x14E */ s16 unk14E; /* 0x150 */ f32 unk150; - /* 0x154 */ char unk154[0xC]; + /* 0x154 */ UNK_TYPE1 unk154[0xC]; /* 0x160 */ Vec3f unk160; } EnDyExtra; // size = 0x16C 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 795b2cb9e..bc84c329b 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1468,7 +1468,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { } if (Actor_ProcessTalkRequest(thisx, &play->state)) { - func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_LISTEN, 0x20); + func_8019FDC8(&gSfxDefaultPos, NA_SE_VO_NA_LISTEN, 0x20); thisx->focus.pos = thisx->world.pos; if (thisx->textId == ElfMessage_GetFirstCycleHint(play)) { diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index d7c0cc561..d771f3511 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -114,7 +114,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.targetMode = 6; this->dyna.actor.colChkInfo.health = 1; this->scale = 0.1; - this->switchFlag = GET_ENCOUNT2_SWITCH_FLAG(this); + this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor); if (this->switchFlag == 0x7F) { this->switchFlag = -1; @@ -137,6 +137,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { void EnEncount2_Destroy(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); Collider_DestroyJntSph(play, &this->collider); } diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 8f2a6c66a..9927653e2 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -33,7 +33,7 @@ typedef struct EnEncount2 { /* 0x01D0 */ EnEncount2Effect effects[EN_ENCOUNT2_EFFECT_COUNT]; } EnEncount2; // size = 0x2A70 -#define GET_ENCOUNT2_SWITCH_FLAG(actor) ((s16)(((Actor*)actor)->params & 0x7F)) +#define ENCOUNT2_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) extern const ActorInit En_Encount2_InitVars; 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 646d8b08c..7e3a93fa8 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -341,7 +341,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { ActorCutscene_SetIntentToPlay(0xB); } } else if (play->csCtx.frames > 1600) { - play->nextEntranceIndex = 0x2C00; + play->nextEntrance = ENTRANCE(CLOCK_TOWER_ROOFTOP, 0); gSaveContext.nextCutsceneIndex = 0xFFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_02; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 8cebddded..cc447a1a1 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -166,7 +166,7 @@ void EnFamos_Init(Actor* thisx, PlayState* play) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - if (GET_FAMOS_PATH(thisx) != 0xFF) { + if (FAMOS_GET_PATH(thisx) != 0xFF) { path = &play->setupPathList[this->actor.params]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathNodeCount = path->count; @@ -193,7 +193,7 @@ void EnFamos_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = 250; this->baseHeight = this->actor.world.pos.y; // params: [this->actor.shape.rot.x] is used to set aggro distance - this->aggroDistance = (GET_FAMOS_AGGRO_DISTANCE(thisx) <= 0) ? (200.0f) : (this->actor.shape.rot.x * 40.0f * 0.1f); + this->aggroDistance = (FAMOS_GET_AGGRO_DISTANCE(thisx) <= 0) ? (200.0f) : (this->actor.shape.rot.x * 40.0f * 0.1f); this->actor.shape.rot.x = 0; this->actor.world.rot.x = 0; this->hasFinishedRotating = true; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.h b/src/overlays/actors/ovl_En_Famos/z_en_famos.h index c446c2113..874da9034 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.h +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.h @@ -15,8 +15,8 @@ typedef struct EnFamosRock { /* 0x20 */ f32 scale; } EnFamosRock; // size = 0x24 -#define GET_FAMOS_PATH(thisx) (thisx->params) -#define GET_FAMOS_AGGRO_DISTANCE(thisx) (thisx->shape.rot.x) +#define FAMOS_GET_PATH(thisx) ((thisx)->params) +#define FAMOS_GET_AGGRO_DISTANCE(thisx) ((thisx)->shape.rot.x) // stateTimer gets reused: // after spotting player, counts frames until first attack (8) diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 065f2c370..8ad22ff53 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -95,27 +95,27 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_fr_Anim_001534, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_fr_Anim_0011C0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_fr_Anim_0007BC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, }; -s32 EnFg_UpdateAnimation(SkelAnime* skelAnime, s16 animIndex) { +s32 EnFg_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; s32 ret; ret = false; if (animIndex >= 0 && animIndex < 4) { ret = true; - frameCount = sAnimations[animIndex].frameCount; + frameCount = sAnimationInfo[animIndex].frameCount; if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimations[animIndex].animation); + frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } - Animation_Change(skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].playSpeed, - sAnimations[animIndex].startFrame, frameCount, sAnimations[animIndex].mode, - sAnimations[animIndex].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } return ret; } @@ -221,7 +221,7 @@ void EnFg_Idle(EnFg* this, PlayState* play) { default: if (DECR(this->timer) == 0) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_JUMP); - EnFg_UpdateAnimation(&this->skelAnime, 3); + EnFg_ChangeAnim(&this->skelAnime, 3); this->actor.velocity.y = 10.0f; this->timer = Rand_S16Offset(30, 30); this->actionFunc = EnFg_Jump; @@ -256,7 +256,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { case FG_DMGEFFECT_EXPLOSION: this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_FROG_CRY_0); - EnFg_UpdateAnimation(&this->skelAnime, 0); + EnFg_ChangeAnim(&this->skelAnime, 0); this->actor.params = FG_BLACK; this->skelAnime.playSpeed = 0.0f; ac = this->collider.base.ac; @@ -276,7 +276,7 @@ void EnFg_Jump(EnFg* this, PlayState* play) { } if ((this->actor.velocity.y <= 0.0f) && (this->actor.bgCheckFlags & 1)) { - EnFg_UpdateAnimation(&this->skelAnime, 0); + EnFg_ChangeAnim(&this->skelAnime, 0); this->actionFunc = EnFg_Idle; this->actor.velocity.y = 0.0f; } else { @@ -316,7 +316,7 @@ void EnFg_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_fr_Skel_00B538, NULL, this->jointTable, this->morphTable, 24); - EnFg_UpdateAnimation(&this->skelAnime, 0); + EnFg_ChangeAnim(&this->skelAnime, 0); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); 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 f0e2d5c42..6b8ae91aa 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -823,7 +823,7 @@ void func_80B2A094(EnFish2* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &subCamEye); } - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_350 == NULL) || (this->unk_350->update == NULL)) { this->unk_350 = NULL; this->unk_2B0++; @@ -857,7 +857,7 @@ void func_80B2A23C(EnFish2* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &subCamAt); } - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraAtEye(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 5f79700c9..67dfa98f7 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -34,7 +34,7 @@ typedef struct EnFish2 { /* 0x02C8 */ u8 unk_2C8; /* 0x02CA */ s16 subCamId; /* 0x02CC */ f32 unk_2CC; - /* 0x02D0 */ char unk_2D0[0x4]; + /* 0x02D0 */ UNK_TYPE1 unk_2D0[0x4]; /* 0x02D4 */ f32 unk_2D4; /* 0x02D8 */ f32 unk_2D8; /* 0x02DC */ Vec3f subCamEye; @@ -53,7 +53,6 @@ typedef struct EnFish2 { /* 0x0348 */ s16 unk_348; /* 0x034A */ s16 unk_34A; /* 0x034C */ s16 unk_34C; - /* 0x034E */ char unk_34E[0x02]; /* 0x0350 */ Actor* unk_350; /* 0x0354 */ struct EnFish2* unk_354; /* 0x0358 */ ColliderJntSph collider; 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 0aabfc969..59e3abdb4 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -5156,8 +5156,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 1: sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); mainCam = Play_GetCamera(play, CAM_ID_MAIN); sSubCamEye.x = mainCam->eye.x; sSubCamEye.y = mainCam->eye.y; @@ -5283,8 +5283,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 10: Cutscene_Start(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); @@ -5324,8 +5324,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 20: Cutscene_Start(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); - Play_CameraChangeStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); - Play_CameraChangeStatus(play, sSubCamId, CAM_STATUS_ACTIVE); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); func_800B7298(play, &this->actor, 4); mainCam = Play_GetCamera(play, CAM_ID_MAIN); @@ -5432,7 +5432,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if (sSubCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); + Play_SetCameraAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { 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 b67c61c43..fe7a91667 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -81,7 +81,7 @@ const ActorInit En_Fsn_InitVars = { (ActorFunc)EnFsn_Draw, }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gFsnIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gFsnScratchBackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gFsnTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -212,7 +212,7 @@ void EnFsn_HandleSetupResumeInteraction(EnFsn* this, PlayState* 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); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); if (ENFSN_IS_SHOP(&this->actor)) { this->actor.textId = 0; } @@ -711,21 +711,21 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) { this->stickAnimTween = this->arrowAnimTween = 0.0f; } this->blinkTimer = 20; - this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_START; + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START; this->eyeTextureIdx = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnFsn_Idle; } void EnFsn_Idle(EnFsn* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->animationIndex == FSN_ANIM_HANDS_ON_COUNTER_START) { + if (this->animIndex == FSN_ANIM_HANDS_ON_COUNTER_START) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (curFrame == frameCount) { - this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } return; } @@ -758,29 +758,29 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { void EnFsn_Haggle(EnFsn* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->flags & ENFSN_ANGRY) { this->flags &= ~ENFSN_ANGRY; - this->animationIndex = FSN_ANIM_SLAM_COUNTER_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_SLAM_COUNTER_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { - if (this->animationIndex == FSN_ANIM_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) { + if (this->animIndex == 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_ANIM_HANDS_ON_COUNTER_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else if (this->flags & ENFSN_OFFER_FINAL_PRICE) { this->flags &= ~ENFSN_OFFER_FINAL_PRICE; - this->animationIndex = FSN_ANIM_MAKE_OFFER; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_MAKE_OFFER; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { - if (this->animationIndex == FSN_ANIM_MAKE_OFFER) { + if (this->animIndex == FSN_ANIM_MAKE_OFFER) { if (curFrame == frameCount) { - this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } else { if (Animation_OnFrame(&this->skelAnime, 28.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); @@ -839,7 +839,7 @@ void EnFsn_StartBuying(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_DeterminePrice; break; case 0x29CF: - player->exchangeItemId = EXCH_ITEM_NONE; + player->exchangeItemId = PLAYER_AP_NONE; this->actionFunc = EnFsn_SetupDeterminePrice; break; } @@ -986,7 +986,7 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { break; case 1: func_8019F230(); - player->exchangeItemId = EXCH_ITEM_NONE; + player->exchangeItemId = PLAYER_AP_NONE; this->actionFunc = EnFsn_SetupDeterminePrice; break; } @@ -1042,7 +1042,7 @@ void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_ConverseBackroom; } } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1430,8 +1430,8 @@ void EnFsn_Init(Actor* thisx, PlayState* play) { this->eyeTextureIdx = 0; this->actor.flags |= ACTOR_FLAG_1; this->actor.targetMode = 0; - this->animationIndex = FSN_ANIM_IDLE; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = FSN_ANIM_IDLE; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnFsn_IdleBackroom; } } diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h index f003a7921..9479e982e 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h @@ -64,7 +64,7 @@ typedef struct EnFsn { /* 0x444 */ u8 arrowAnimState; /* 0x445 */ u8 stickAnimState; /* 0x448 */ f32 shopItemSelectedTween; - /* 0x44C */ s16 animationIndex; + /* 0x44C */ s16 animIndex; /* 0x44E */ u16 flags; } EnFsn; // size = 0x450 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 1fc17535f..5e3b46fe6 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -73,7 +73,7 @@ static Vec3f D_80964B0C = { 0.0f, 60.0f, -8.0f }; static Vec3f D_80964B18 = { 0.0f, 55.0f, 12.0f }; static Vec3f D_80964B24 = { 0.0f, 60.0f, 0.0f }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_mu_Anim_0053E0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_mu_Anim_001F74, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_mu_Anim_002F64, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, @@ -371,7 +371,7 @@ void func_8096209C(EnFu* this, PlayState* play) { } void func_809622FC(EnFu* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80962340; } @@ -536,7 +536,7 @@ void func_80962660(EnFu* this, PlayState* play) { func_801477B4(play); player->stateFlags1 |= 0x20; this->unk_53C = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_801A2BB8(NA_BGM_MINI_GAME_2); if (this->unk_542 == 0) { if (this->unk_546 == 1) { @@ -935,7 +935,7 @@ void func_80963630(EnFu* this, PlayState* play) { player->stateFlags1 &= ~0x20; } else { this->actor.child->freezeTimer = 10; - func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, PLAYER_AP_MINUS1); } } @@ -1214,7 +1214,7 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x2842: case 0x2844: case 0x2848: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 0x2840: @@ -1240,21 +1240,21 @@ void func_80964190(EnFu* this, PlayState* play) { case 0x286B: case 0x286D: case 0x2871: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); break; case 0x2860: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); break; case 0x285F: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); break; case 0x287E: case 0x2880: case 0x2883: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); break; } } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index 9ed3b69c5..e35c961e7 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -12,12 +12,12 @@ typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); typedef struct { /* 0x00 */ f32 unk_00; - /* 0x04 */ char unk_04[0x4]; + /* 0x04 */ UNK_TYPE1 unk_04[0x4]; /* 0x08 */ Vec3f unk_08; /* 0x14 */ Vec3f unk_14; /* 0x20 */ Vec3f unk_20; /* 0x2C */ s16 unk_2C; - /* 0x2E */ char unk_2E[0x8]; + /* 0x2E */ UNK_TYPE1 unk_2E[0x8]; /* 0x36 */ u8 unk_36; /* 0x37 */ u8 unk_37; } EnFuUnkStruct; // size = 0x38 @@ -36,7 +36,7 @@ typedef struct EnFu { /* 0x520 */ s32 unk_520; /* 0x524 */ s16 unk_524[3]; /* 0x52A */ s16 unk_52A[3]; - /* 0x530 */ char unk530[0x8]; + /* 0x530 */ UNK_TYPE1 unk530[0x8]; /* 0x538 */ Vec3s* unk_538; /* 0x53C */ s16 unk_53C; /* 0x53E */ s16 unk_53E; diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index 8c7d883da..cc19acb63 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -106,12 +106,12 @@ void EnGakufu_ProcessNotes(EnGakufu* this) { s32 songIndex; AudioOcarina_TerminaWallGenerateNotes(); - AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_DEFAULT); + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); AudioOcarina_StartDefault((1 << this->songIndex) | 0x80000000); playbackStaff = AudioOcarina_GetPlaybackStaff(); playbackStaff->pos = 0; playbackStaff->state = 0xFF; - AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); songIndex = this->songIndex; ocarinaSongButtons = &gOcarinaSongButtons[songIndex]; 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 38ef56ecb..17bec0df6 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -356,14 +356,14 @@ void func_80B0FD8C(EnGb2* this, PlayState* play) { void func_80B0FE18(PlayState* play) { func_800FD750(0x38); - play->nextEntranceIndex = 0x9C10; + play->nextEntrance = ENTRANCE(GHOST_HUT, 1); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; play->transitionTrigger = TRANS_TRIGGER_START; } void func_80B0FE7C(PlayState* play) { - play->nextEntranceIndex = 0x9C20; + play->nextEntrance = ENTRANCE(GHOST_HUT, 2); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; play->transitionTrigger = TRANS_TRIGGER_START; @@ -890,7 +890,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { Actor_MarkForDeath(&this->actor); } - if (gSaveContext.save.entranceIndex == 0x9C10) { + if (gSaveContext.save.entrance == ENTRANCE(GHOST_HUT, 1)) { func_800FE484(); this->actionFunc = func_80B10240; break; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index ae4903c02..ad0d3de24 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -15,7 +15,6 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play); void EnGe1_Update(Actor* thisx, PlayState* play); void EnGe1_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit En_Ge1_InitVars = { ACTOR_EN_GE1, ACTORCAT_NPC, @@ -28,45 +27,432 @@ const ActorInit En_Ge1_InitVars = { (ActorFunc)EnGe1_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809464D0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_ENEMY, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x01000202, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_ENEMY, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x01000202, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 20, 40, 0, { 0, 0, 0 } }, }; -#endif +//! State flags -extern ColliderCylinderInit D_809464D0; +//! Disable normal movement to let pathing function control it completely. +#define GERUDO_WHITE_STATE_DISABLE_MOVEMENT (1 << 3) -extern UNK_TYPE D_06002B98; +typedef enum { + /* 0 */ GERUDO_WHITE_HAIR_BOB, + /* 1 */ GERUDO_WHITE_HAIR_STRAIGHT, + /* 2 */ GERUDO_WHITE_HAIR_SPIKEY +} GerudoWhiteHairstyle; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Init.s") +typedef enum { + /* -1 */ GERUDO_WHITE_ANIM_NONE = -1, + /* 0 */ GERUDO_WHITE_ANIM_ARMS_FOLDED, + /* 1 */ GERUDO_WHITE_ANIM_UNFOLDING_ARMS, // Unused + /* 2 */ GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, + /* 3 */ GERUDO_WHITE_ANIM_STIFFENING, + /* 4 */ GERUDO_WHITE_ANIM_STIFF_SHIVERING, + /* 5 */ GERUDO_WHITE_ANIM_TRUDGING_OFF, + /* 6 */ GERUDO_WHITE_ANIM_EXCITED_CLAPPING, + /* 7 */ GERUDO_WHITE_ANIM_SALUTE, + /* 8 */ GERUDO_WHITE_ANIM_LEADING_BOAT, + /* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY, +} GerudoWhiteAnimations; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Destroy.s") +void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames); +void EnGe1_ShadowDraw(Actor* actor, Lights* lights, PlayState* play); +void EnGe1_Wait(EnGe1* this, PlayState* play); +void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play); +s32 EnGe1_ValidatePictograph(PlayState* play, Actor* this); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_809457EC.s") +void EnGe1_Init(Actor* thisx, PlayState* play) { + EnGe1* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945924.s") + ActorShape_Init(&this->picto.actor.shape, 0.0f, EnGe1_ShadowDraw, 30.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteArmsFoldedAnim, this->jointTable, + this->morphTable, GERUDO_WHITE_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + this->picto.actor.targetMode = 6; + Actor_SetScale(&this->picto.actor, 0.01f); + this->animIndex = this->csAction = -1; // GERUDO_WHITE_ANIM_NONE + this->stateFlags = 0; + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); + this->actionFunc = EnGe1_Wait; + this->picto.validationFunc = EnGe1_ValidatePictograph; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945A00.s") + switch (GERUDO_WHITE_GET_TYPE(&this->picto.actor)) { + default: + this->hairstyle = GERUDO_WHITE_HAIR_BOB; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945A9C.s") + case GERUDO_WHITE_TYPE_HAIR_STRAIGHT: + this->hairstyle = GERUDO_WHITE_HAIR_STRAIGHT; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945B60.s") + case GERUDO_WHITE_TYPE_HAIR_SPIKEY: + this->hairstyle = GERUDO_WHITE_HAIR_SPIKEY; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945C50.s") + case GERUDO_WHITE_TYPE_CUTSCENE: // Only type used in-game + this->hairstyle = GERUDO_WHITE_HAIR_BOB; + this->actionFunc = EnGe1_PerformCutsceneActions; + this->picto.actor.draw = NULL; + this->picto.actor.flags |= ACTOR_FLAG_20 | ACTOR_FLAG_10; + this->picto.actor.flags &= ~ACTOR_FLAG_1; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945CAC.s") + this->picto.actor.terminalVelocity = -9.0f; + this->picto.actor.velocity.y = -9.0f; + this->picto.actor.gravity = -1.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80945CE4.s") +void EnGe1_Destroy(Actor* thisx, PlayState* play) { + EnGe1* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Update.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946190.s") +void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) { + static AnimationHeader* sAnimations[] = { + &gGerudoWhiteArmsFoldedAnim, // GERUDO_WHITE_ANIM_ARMS_FOLDED, + &gGerudoWhiteUnfoldingArmsAnim, // GERUDO_WHITE_ANIM_UNFOLDING_ARMS + &gGerudoWhiteStandingHeadBowedAnim, // GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, + &gGerudoWhiteStiffeningAnim, // GERUDO_WHITE_ANIM_STIFFENING, + &gGerudoWhiteStiffShiveringAnim, // GERUDO_WHITE_ANIM_STIFF_SHIVERING, + &gGerudoWhiteTrudgingOffAnim, // GERUDO_WHITE_ANIM_TRUDGING_OFF, + &gGerudoWhiteExcitedClappingAnim, // GERUDO_WHITE_ANIM_EXCITED_CLAPPING, + &gGerudoWhiteSaluteAnim, // GERUDO_WHITE_ANIM_SALUTE, + &gGerudoWhiteGreatBayCutsceneAnim, // GERUDO_WHITE_ANIM_LEADING_BOAT, + &gGerudoWhiteGreatBayCutsceneAnim, // GERUDO_WHITE_ANIM_BLOWN_AWAY, + }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946238.s") + // The GERUDO_WHITE_ANIM_LEADING_BOAT / GERUDO_WHITE_ANIM_BLOWN_AWAY cases are single frames of an "animation" used + // as static poses. + switch (animIndex) { + case GERUDO_WHITE_ANIM_LEADING_BOAT: + Animation_Change(&this->skelAnime, sAnimations[animIndex], 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/func_80946368.s") + case GERUDO_WHITE_ANIM_BLOWN_AWAY: + Animation_Change(&this->skelAnime, sAnimations[animIndex], 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ge1/EnGe1_Draw.s") + default: + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames); + break; + } + + this->animIndex = animIndex; +} + +void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) { + s16 yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + + if ((ABS_ALT(yawDiff) <= 0x4300) && (this->picto.actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->picto.actor, &this->headRot, &this->torsoRot, this->picto.actor.focus.pos); + } else { + Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); + } +} + +void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play) { + Vec3f pos; + EnGe1* this = THIS; + + Math_Vec3f_Copy(&pos, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->picto.actor.world.pos, &this->waistPos); + func_800B4AEC(play, &this->picto.actor, 50.0f); + this->picto.actor.world.pos.y = MAX(this->picto.actor.floorHeight, pos.y); + ActorShadow_DrawCircle(&this->picto.actor, lights, play); + Math_Vec3f_Copy(&this->picto.actor.world.pos, &pos); +} + +void EnGe1_SetupPath(EnGe1* this, PlayState* play) { + s32 pad; + Vec3s* point; + Vec3f nextPoint; + + this->curPoint = 0; + if (GERUDO_WHITE_GET_PATH(&this->picto.actor) != 0x3F) { + this->path = &play->setupPathList[GERUDO_WHITE_GET_PATH(&this->picto.actor)]; + if (this->path != NULL) { + point = Lib_SegmentedToVirtual(this->path->points); + Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, point); + this->curPoint++; + point++; + Math_Vec3s_ToVec3f(&nextPoint, point); + + this->picto.actor.world.rot.y = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.world.rot.x = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &nextPoint); + this->picto.actor.speedXZ = 15.0f; + } + } else { + this->path = NULL; + } +} + +/** + * @return s32 true if close to next point or no path set. + */ +s32 EnGe1_FollowPath(EnGe1* this) { + s32 pad; + Path* path = this->path; + Vec3s* points; + Vec3f point; + s16 yawTarget; + s16 pitchTarget; + + if (path == NULL) { + return true; + } + + points = Lib_SegmentedToVirtual(this->path->points); + points += this->curPoint; + + Math_Vec3s_ToVec3f(&point, points); + yawTarget = Math_Vec3f_Yaw(&this->picto.actor.world.pos, &point); + pitchTarget = Math_Vec3f_Pitch(&this->picto.actor.world.pos, &point); + Math_SmoothStepToS(&this->picto.actor.world.rot.y, yawTarget, 0xA, 0x3E8, 0x64); + Math_SmoothStepToS(&this->picto.actor.world.rot.x, pitchTarget, 6, 0x7D0, 0xC8); + Actor_MoveWithoutGravityReverse(&this->picto.actor); + + if (Math_Vec3f_DistXYZ(&this->picto.actor.world.pos, &point) < 40.0f) { + return true; + } else { + return false; + } +} + +void EnGe1_Scream(EnGe1* this) { + if ((s32)Rand_ZeroFloat(2.0f) == 0) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO00); + } else { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_VO_FPVO01); + } +} + +void EnGe1_Wait(EnGe1* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); + EnGe1_LookAtPlayer(this, play); +} + +void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { + s16 csAction; + + if (SkelAnime_Update(&this->skelAnime) && (this->csAction == 3)) { + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_STIFF_SHIVERING, ANIMMODE_LOOP, 0.0f); + } + + if (Cutscene_CheckActorAction(play, 0x79)) { + this->picto.actor.draw = EnGe1_Draw; + csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x79)]->action; + switch (csAction) { + case 8: + this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + break; + + case 9: + this->stateFlags |= GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + break; + + default: + this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 0x79)); + break; + } + + if (this->csAction != csAction) { + this->csAction = csAction; + + switch (this->csAction) { + // Aveil cutscene + case 1: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); + break; + + case 2: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED, ANIMMODE_LOOP, 0.0f); + break; + + case 3: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_STIFFENING, ANIMMODE_ONCE, 0.0f); + break; + + case 4: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_TRUDGING_OFF, ANIMMODE_ONCE, 0.0f); + break; + + case 5: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_EXCITED_CLAPPING, ANIMMODE_LOOP, 0.0f); + break; + + case 6: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_SALUTE, ANIMMODE_ONCE, 0.0f); + break; + + case 7: + Actor_MarkForDeath(&this->picto.actor); + break; + + // Twister cutscene + case 8: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_LEADING_BOAT, ANIMMODE_ONCE, 0.0f); + break; + + case 9: + EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_BLOWN_AWAY, ANIMMODE_ONCE, 0.0f); + EnGe1_SetupPath(this, play); + this->stateFlags |= GERUDO_WHITE_STATE_DISABLE_MOVEMENT; + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + break; + } + + SkelAnime_Update(&this->skelAnime); + } + + if ((this->animIndex == GERUDO_WHITE_ANIM_TRUDGING_OFF) && + (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 25.0f))) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + + if ((this->animIndex == GERUDO_WHITE_ANIM_SALUTE) && Animation_OnFrame(&this->skelAnime, 14.0f)) { + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_PIRATE_WALK); + } + } else { + this->picto.actor.draw = NULL; + } + + if (this->csAction == 9) { + if ((this->curPoint < this->path->count) && EnGe1_FollowPath(this)) { + this->curPoint++; + } + + // Tumble in the air + this->picto.actor.shape.rot.x += 0x3E8; + this->picto.actor.shape.rot.y += 0x7D0; + this->picto.actor.shape.rot.z += 0x1F4; + + if (this->screamTimer > 0) { + this->screamTimer--; + } else { + this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); + EnGe1_Scream(this); + } + } +} + +void EnGe1_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnGe1* this = THIS; + + if (this->picto.actor.draw != NULL) { + Collider_UpdateCylinder(&this->picto.actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + if (!(this->stateFlags & GERUDO_WHITE_STATE_DISABLE_MOVEMENT)) { + Actor_MoveWithGravity(&this->picto.actor); + } + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, 5); + this->actionFunc(this, play); + this->torsoRot.x = this->torsoRot.y = this->torsoRot.z = 0; + + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); + } + + this->eyeIndex = this->blinkTimer; + if (this->eyeIndex >= 3) { + this->eyeIndex = 0; + } +} + +s32 EnGe1_ValidatePictograph(PlayState* play, Actor* thisx) { + s32 ret = Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 400.0f, -1); + + ret |= Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f, + 1200.0f, -1); + + return ret; +} + +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + s32 pad; + EnGe1* this = THIS; + + if (limbIndex == GERUDO_WHITE_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; + } + if (this->animIndex == GERUDO_WHITE_ANIM_ARMS_FOLDED) { + // Make small fidgeting movements if in standing animation. + if ((limbIndex == GERUDO_WHITE_LIMB_TORSO) || (limbIndex == GERUDO_WHITE_LIMB_LEFT_FOREARM) || + (limbIndex == GERUDO_WHITE_LIMB_RIGHT_FOREARM)) { + rot->y += (s16)(Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f); + rot->z += (s16)(Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f); + } + } + return false; +} + +void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Gfx* sHairstyleDLs[] = { + gGerudoWhiteHairstyleBobDL, + gGerudoWhiteHairstyleStraightFringeDL, + gGerudoWhiteHairstyleSpikyDL, + }; + static Vec3f sInitialFocusPos = { 600.0f, 700.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + EnGe1* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + switch (limbIndex) { + case GERUDO_WHITE_LIMB_WAIST: + Matrix_MultVec3f(&sZeroVec, &this->waistPos); + break; + + case GERUDO_WHITE_LIMB_HEAD: + gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLs[this->hairstyle]); + Matrix_MultVec3f(&sInitialFocusPos, &this->picto.actor.focus.pos); + break; + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnGe1_Draw(Actor* thisx, PlayState* play) { + static TexturePtr sEyeTextures[] = { + gGerudoWhiteEyeOpenTex, + gGerudoWhiteEyeHalfTex, + gGerudoWhiteEyeClosedTex, + }; + s32 pad; + EnGe1* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C5B0(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, &this->picto.actor); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index a3c04a93a..ae6cc601e 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -2,14 +2,41 @@ #define Z_EN_GE1_H #include "global.h" +#include "z64snap.h" +#include "objects/object_ge1/object_ge1.h" + +#define GERUDO_WHITE_GET_TYPE(thisx) (((thisx)->params) & 0xF) +#define GERUDO_WHITE_GET_PATH(thisx) ((((thisx)->params) & 0xFC00) >> 10) + +//! Only the first type is used +typedef enum { + /* 0 */ GERUDO_WHITE_TYPE_CUTSCENE, + /* 1 */ GERUDO_WHITE_TYPE_HAIR_STRAIGHT, + /* 2 */ GERUDO_WHITE_TYPE_HAIR_SPIKEY +} GerudoWhiteType; struct EnGe1; typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); typedef struct EnGe1 { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x184]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ ColliderCylinder collider; + /* 0x194 */ SkelAnime skelAnime; + /* 0x1D8 */ Vec3f waistPos; + /* 0x1E4 */ Vec3s jointTable[GERUDO_WHITE_LIMB_MAX]; + /* 0x244 */ Vec3s morphTable[GERUDO_WHITE_LIMB_MAX]; + /* 0x2A4 */ Vec3s headRot; + /* 0x2AA */ Vec3s torsoRot; + /* 0x2B0 */ Path* path; + /* 0x2B4 */ s32 curPoint; + /* 0x2B8 */ s16 eyeIndex; + /* 0x2BA */ s16 blinkTimer; + /* 0x2BC */ u16 stateFlags; + /* 0x2BE */ s16 animIndex; + /* 0x2C0 */ s16 csAction; + /* 0x2C2 */ s16 screamTimer; + /* 0x2C4 */ u8 hairstyle; /* 0x2C8 */ EnGe1ActionFunc actionFunc; } EnGe1; // size = 0x2CC 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 b3e98dde3..1766b8e32 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -126,7 +126,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -379,7 +379,7 @@ void func_80BB1FCC(EnGeg* this, PlayState* play) { void func_80BB2020(EnGeg* this, PlayState* play) { gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->unk_4AC); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_4AC); } s32 func_80BB2088(EnGeg* this, PlayState* play) { @@ -609,7 +609,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { void func_80BB2944(EnGeg* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_4AC].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation); if (this->unk_4AC == 19) { if (curFrame == lastFrame) { @@ -699,13 +699,13 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { } this->unk_4E0--; } - func_8019F570(&this->actor.projectedPos, 1); + AudioSfx_LowerSfxSettingsReverb(&this->actor.projectedPos, true); func_8019F4AC(&this->actor.projectedPos, NA_SE_EN_GOLON_SIRLOIN_EAT - SFX_FLAG); } void func_80BB2E00(EnGeg* this, PlayState* play) { s16 sp2E = this->skelAnime.curFrame; - s16 sp2C = Animation_GetLastFrame(sAnimations[this->unk_4AC].animation); + s16 sp2C = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation); if (this->unk_4AC == 2) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); 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 04acac9dc..5c4606185 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -95,7 +95,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f }, @@ -170,46 +170,46 @@ void func_80B35250(EnGg* this) { this->unk_2E4 = 20; this->unk_2E2 = 0; this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80B35450; } void func_80B352A4(EnGg* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E6].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E6].animation); if (sp26 == lastFrame) { switch (this->actor.textId) { case 0xCE5: this->unk_2E6 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 0xCE6: case 0xCEC: this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; case 0xCE8: this->unk_2E6 = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); break; case 0xCE9: this->unk_2E6 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); break; case 0xCED: case 0xCEE: this->unk_2E6 = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); break; default: this->unk_2E6 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; } gSaveContext.save.weekEventReg[19] |= 0x80; @@ -219,7 +219,7 @@ void func_80B352A4(EnGg* this, PlayState* play) { this->skelAnime.playSpeed = 2.0f; } else { this->unk_2E6 = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); } } } @@ -326,7 +326,7 @@ void func_80B35634(EnGg* this, PlayState* play) { this->unk_2DA = 0; break; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_2DA); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2DA); } if (this->unk_2DA == 14) { @@ -366,11 +366,11 @@ void func_80B3584C(EnGg* this) { void func_80B358D8(EnGg* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2DA].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2DA].animation); if ((this->unk_2E6 == 14) && (sp1E == lastFrame)) { this->unk_2E6 = 15; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 15); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 15); } } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index 61eac74f8..7021b0e0c 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -32,23 +32,23 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play); * These values are used to index into sAnimations to pick the appropriate animation. */ typedef enum { - /* 0 */ GIANT_ANIMATION_LOOK_UP_START, - /* 1 */ GIANT_ANIMATION_LOOK_UP_LOOP, - /* 2 */ GIANT_ANIMATION_FALLING_OVER, - /* 3 */ GIANT_ANIMATION_RAISED_ARMS_START, - /* 4 */ GIANT_ANIMATION_RAISED_ARMS_LOOP, - /* 5 */ GIANT_ANIMATION_STRUGGLE_START, - /* 6 */ GIANT_ANIMATION_STRUGGLE_LOOP, - /* 7 */ GIANT_ANIMATION_IDLE_LOOP, - /* 8 */ GIANT_ANIMATION_WALKING_LOOP, - /* 9 */ GIANT_ANIMATION_BIG_CALL_START, - /* 10 */ GIANT_ANIMATION_BIG_CALL_LOOP, - /* 11 */ GIANT_ANIMATION_BIG_CALL_END, - /* 12 */ GIANT_ANIMATION_SMALL_CALL_START, - /* 13 */ GIANT_ANIMATION_SMALL_CALL_LOOP, - /* 14 */ GIANT_ANIMATION_SMALL_CALL_END, - /* 15 */ GIANT_ANIMATION_MAX -} GiantAnimationIndex; + /* 0 */ GIANT_ANIM_LOOK_UP_START, + /* 1 */ GIANT_ANIM_LOOK_UP_LOOP, + /* 2 */ GIANT_ANIM_FALLING_OVER, + /* 3 */ GIANT_ANIM_RAISED_ARMS_START, + /* 4 */ GIANT_ANIM_RAISED_ARMS_LOOP, + /* 5 */ GIANT_ANIM_STRUGGLE_START, + /* 6 */ GIANT_ANIM_STRUGGLE_LOOP, + /* 7 */ GIANT_ANIM_IDLE_LOOP, + /* 8 */ GIANT_ANIM_WALKING_LOOP, + /* 9 */ GIANT_ANIM_BIG_CALL_START, + /* 10 */ GIANT_ANIM_BIG_CALL_LOOP, + /* 11 */ GIANT_ANIM_BIG_CALL_END, + /* 12 */ GIANT_ANIM_SMALL_CALL_START, + /* 13 */ GIANT_ANIM_SMALL_CALL_LOOP, + /* 14 */ GIANT_ANIM_SMALL_CALL_END, + /* 15 */ GIANT_ANIM_MAX +} GiantAnimation; /** * Used as values for csAction. The UNKNOWN ones are never used in-game. @@ -91,16 +91,16 @@ static AnimationHeader* sAnimations[] = { &gGiantSmallCallStartAnim, &gGiantSmallCallLoopAnim, &gGiantSmallCallEndAnim, }; -void EnGiant_ChangeAnimation(EnGiant* this, s16 newAnimationId) { - if (newAnimationId >= GIANT_ANIMATION_LOOK_UP_START && newAnimationId < GIANT_ANIMATION_MAX) { - if ((this->animationId == GIANT_ANIMATION_WALKING_LOOP && newAnimationId != GIANT_ANIMATION_WALKING_LOOP) || - (newAnimationId == GIANT_ANIMATION_WALKING_LOOP && this->animationId != GIANT_ANIMATION_WALKING_LOOP)) { - Animation_Change(&this->skelAnime, sAnimations[newAnimationId], 1.0f, 0.0f, - Animation_GetLastFrame(&sAnimations[newAnimationId]->common), ANIMMODE_ONCE, 10.0f); +void EnGiant_ChangeAnim(EnGiant* this, s16 animIndex) { + if (animIndex >= GIANT_ANIM_LOOK_UP_START && animIndex < GIANT_ANIM_MAX) { + if (((this->animIndex == GIANT_ANIM_WALKING_LOOP) && (animIndex != GIANT_ANIM_WALKING_LOOP)) || + ((animIndex == GIANT_ANIM_WALKING_LOOP) && (this->animIndex != GIANT_ANIM_WALKING_LOOP))) { + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(&sAnimations[animIndex]->common), ANIMMODE_ONCE, 10.0f); } else { - Animation_PlayOnce(&this->skelAnime, sAnimations[newAnimationId]); + Animation_PlayOnce(&this->skelAnime, sAnimations[animIndex]); } - this->animationId = newAnimationId; + this->animIndex = animIndex; } } @@ -153,7 +153,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.32f); SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable, GIANT_LIMB_MAX); - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); this->csAction = GIANT_CS_ACTION_NONE; this->actionFunc = EnGiant_PerformCutsceneActions; this->actor.draw = NULL; @@ -246,14 +246,14 @@ void EnGiant_Destroy(Actor* thisx, PlayState* play) { * this function is to play the requested start animation if it has not been * played yet and play the respetive looping animation otherwise. */ -void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimationId) { - s16 nextAnimationId = requestedAnimationId + 1; +void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimIndex) { + s16 nextAnimIndex = requestedAnimIndex + 1; - if (this->animationId != nextAnimationId) { - if (this->animationId != requestedAnimationId) { - EnGiant_ChangeAnimation(this, requestedAnimationId); + if (this->animIndex != nextAnimIndex) { + if (this->animIndex != requestedAnimIndex) { + EnGiant_ChangeAnim(this, requestedAnimIndex); } else { - EnGiant_ChangeAnimation(this, nextAnimationId); + EnGiant_ChangeAnim(this, nextAnimIndex); } } } @@ -261,45 +261,45 @@ void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimationI /** * Immediately switches to the specified animation for this cutscene action. */ -void EnGiant_ChangeAnimationBasedOnCsAction(EnGiant* this) { +void EnGiant_ChangeAnimBasedOnCsAction(EnGiant* this) { switch (this->csAction) { case GIANT_CS_ACTION_IDLE: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; case GIANT_CS_ACTION_WALKING: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; case GIANT_CS_ACTION_STRUGGLING: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_STRUGGLE_START); + EnGiant_ChangeAnim(this, GIANT_ANIM_STRUGGLE_START); break; case GIANT_CS_ACTION_FALLING_OVER: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_FALLING_OVER); + EnGiant_ChangeAnim(this, GIANT_ANIM_FALLING_OVER); break; case GIANT_CS_ACTION_IDLE_FADE_IN: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); this->alpha = 0; break; case GIANT_CS_ACTION_TALKING: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_START); + EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_START); break; case GIANT_CS_ACTION_DONE_TALKING: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_END); + EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_END); break; case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_START); + EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_START); break; case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_END); + EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_END); break; case GIANT_CS_ACTION_UNKNOWN_12: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; case GIANT_CS_ACTION_UNKNOWN_13: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; case GIANT_CS_ACTION_UNKNOWN_14: - if (this->animationId != GIANT_ANIMATION_WALKING_LOOP) { - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_WALKING_LOOP); + if (this->animIndex != GIANT_ANIM_WALKING_LOOP) { + EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); } break; case GIANT_CS_ACTION_HOLDING_UP_MOON_IN_CLOCK_TOWER: @@ -336,31 +336,31 @@ void EnGiant_UpdateAlpha(EnGiant* this) { */ void EnGiant_PlayAndUpdateAnimation(EnGiant* this) { if (SkelAnime_Update(&this->skelAnime) && - (this->animationId != GIANT_ANIMATION_FALLING_OVER || this->csAction != GIANT_CS_ACTION_FALLING_OVER)) { - EnGiant_ChangeAnimation(this, this->animationId); + (this->animIndex != GIANT_ANIM_FALLING_OVER || this->csAction != GIANT_CS_ACTION_FALLING_OVER)) { + EnGiant_ChangeAnim(this, this->animIndex); switch (this->csAction) { case GIANT_CS_ACTION_LOOKING_UP: - EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_LOOK_UP_START); + EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START); break; case GIANT_CS_ACTION_RAISING_ARMS: - EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_RAISED_ARMS_START); + EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START); break; case GIANT_CS_ACTION_STRUGGLING: - EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_STRUGGLE_START); + EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START); break; case GIANT_CS_ACTION_FALLING_OVER: // Unused - EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIMATION_FALLING_OVER); + EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER); break; case GIANT_CS_ACTION_TALKING: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_BIG_CALL_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP); break; case GIANT_CS_ACTION_DONE_TALKING: case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_IDLE_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER: - EnGiant_ChangeAnimation(this, GIANT_ANIMATION_SMALL_CALL_LOOP); + EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP); break; } SkelAnime_Update(&this->skelAnime); @@ -369,20 +369,20 @@ void EnGiant_PlayAndUpdateAnimation(EnGiant* this) { void EnGiant_PlaySound(EnGiant* this) { if (this->actor.draw != NULL && this->alpha > 0) { - if (this->animationId == GIANT_ANIMATION_WALKING_LOOP && + if (this->animIndex == GIANT_ANIM_WALKING_LOOP && (Animation_OnFrame(&this->skelAnime, 40.0f) || Animation_OnFrame(&this->skelAnime, 100.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_WALK); } - if (this->animationId == GIANT_ANIMATION_FALLING_OVER && Animation_OnFrame(&this->skelAnime, 40.0f)) { + if (this->animIndex == GIANT_ANIM_FALLING_OVER && Animation_OnFrame(&this->skelAnime, 40.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_VOICE_FAIL); } if (this->sfxId != 0xFFFF && - ((this->animationId == GIANT_ANIMATION_BIG_CALL_START && this->skelAnime.curFrame >= 18.0f) || - this->animationId == GIANT_ANIMATION_BIG_CALL_LOOP)) { + ((this->animIndex == GIANT_ANIM_BIG_CALL_START && this->skelAnime.curFrame >= 18.0f) || + this->animIndex == GIANT_ANIM_BIG_CALL_LOOP)) { func_800B9010(&this->actor, this->sfxId); } - if ((this->animationId == GIANT_ANIMATION_SMALL_CALL_START && this->skelAnime.curFrame >= 18.0f) || - this->animationId == GIANT_ANIMATION_SMALL_CALL_LOOP) { + if ((this->animIndex == GIANT_ANIM_SMALL_CALL_START && this->skelAnime.curFrame >= 18.0f) || + this->animIndex == GIANT_ANIM_SMALL_CALL_LOOP) { func_800B9010(&this->actor, NA_SE_EV_KYOJIN_SIGN - SFX_FLAG); } } @@ -405,7 +405,7 @@ void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) { play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { this->csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; - EnGiant_ChangeAnimationBasedOnCsAction(this); + EnGiant_ChangeAnimBasedOnCsAction(this); } EnGiant_UpdateAlpha(this); } @@ -430,7 +430,7 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play) { play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { this->csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; - EnGiant_ChangeAnimationBasedOnCsAction(this); + EnGiant_ChangeAnimBasedOnCsAction(this); } EnGiant_UpdateAlpha(this); } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.h b/src/overlays/actors/ovl_En_Giant/z_en_giant.h index ff4a79485..3b2cac192 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.h +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.h @@ -47,7 +47,7 @@ typedef struct EnGiant { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[GIANT_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[GIANT_LIMB_MAX]; - /* 0x248 */ s16 animationId; + /* 0x248 */ s16 animIndex; /* 0x24A */ u16 actorActionCommand; /* 0x24C */ u16 csAction; /* 0x24E */ s16 alpha; 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 585f5df17..758d3eae0 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 @@ -42,7 +42,15 @@ const ActorInit En_Ginko_Man_InitVars = { (ActorFunc)EnGinkoMan_Draw, }; -static AnimationInfo sAnimations[] = { +typedef enum { + /* 0 */ GINKO_ANIM_LEGSMACKING, + /* 1 */ GINKO_ANIM_SITTING, + /* 2 */ GINKO_ANIM_REACHING, + /* 3 */ GINKO_ANIM_AMAZED, + /* 4 */ GINKO_ANIM_ADVERTISING, +} GinkoAnimation; + +static AnimationInfo sAnimationInfo[] = { { &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, @@ -72,7 +80,7 @@ void EnGinkoMan_Destroy(Actor* thisx, PlayState* play) { void EnGinkoMan_SetupIdle(EnGinkoMan* this) { this->actor.flags |= ACTOR_FLAG_1; // targetable - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); this->actionFunc = EnGinkoMan_Idle; } @@ -82,11 +90,11 @@ void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SwitchAnimation(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x44C, &this->actor); this->curTextId = 0x44C; // would you like to make an account } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(play, 0x467, &this->actor); this->curTextId = 0x467; // "What's this? You need somethin' on a day like this? @@ -109,7 +117,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { switch (this->curTextId) { case 0x44C: // "Hey there, little guy! Won't you deposit some Rupees? (first dialogue) - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); if (gSaveContext.save.weekEventReg[10] & 8) { Message_StartTextbox(play, 0x44E, &this->actor); this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" @@ -124,7 +132,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" break; case 0x44F: // "...So, what'll it be? Deposit Rupees Don't deposit Rupees" - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x450, &this->actor); this->curTextId = 0x450; // "How much? How much? [rupee prompt] break; @@ -135,14 +143,14 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { if (this->isNewAccount == true) { this->isNewAccount = false; if (this->curTextId != 0x453) { // "That's it? That ain't nothing at all, big spender! - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); } Message_StartTextbox(play, 0x461, &this->actor); this->curTextId = 0x461; // So, little guy, what's your name? } else { if (this->curTextId == 0x453) { // "That's it? That ain't nothing at all, big spender! - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); } play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; @@ -172,17 +180,17 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { Message_StartTextbox(play, 0x45D, &this->actor); this->curTextId = 0x45D; // "What's this? You've already saved up 5000 Rupees?! } else if (this->previousBankValue < (s16)(gSaveContext.save.bankRupees & 0xFFFF)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x45E, &this->actor); this->curTextId = 0x45E; // "...Hang on there, little guy. I can't take any more deposits. Sorry..." } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x460, &this->actor); this->curTextId = 0x460; // "Come back and deposit some after you save up a bunch!" } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x460, &this->actor); this->curTextId = 0x460; // "Come back and deposit some after you save up a bunch!" } @@ -212,7 +220,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupStamp(this); // stamp player break; case 0x465: // "There! Now I'll know you when I see you!" - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" @@ -269,7 +277,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { break; case 0x476: // "...You haven't deposited that many Rupees, so that much isn't available for withdrawal. Do the // math! - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); case 0x475: // "What's this? Look, little guy, you can't hold this many rupees! You got that?" case 0x47C: // "Is that so? Think it over, little guy! So what are you gonna do?" case 0x47D: // duplicate of 48 @@ -336,7 +344,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { if (gSaveContext.save.playerData.rupees < play->msgCtx.bankRupeesSelected) { play_sound(NA_SE_SY_ERROR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x459, &this->actor); this->curTextId = 0x459; // HEY you dont have that much } else { @@ -348,7 +356,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { Message_StartTextbox(play, 0x454, &this->actor); this->curTextId = 0x454; // Seriously? that's a lot. A lot! } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x453, &this->actor); this->curTextId = 0x453; // That's it? That aint nothing at all } @@ -365,7 +373,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { } } else { // GINKOMAN_CHOICE_NO func_8019F230(); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { Message_StartTextbox(play, 0x456, &this->actor); this->curTextId = 0x456; // Is that so? think about it @@ -398,7 +406,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { if ((s32)((gSaveContext.save.bankRupees & 0xFFFF)) < ((s32)(play->msgCtx.bankRupeesSelected + this->serviceFee))) { play_sound(NA_SE_SY_ERROR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_FLOORSMACKING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x476, &this->actor); this->curTextId = 0x476; // you dont have enough deposited to withdrawl } else if (CUR_CAPACITY(UPG_WALLET) < @@ -441,7 +449,7 @@ void EnGinkoMan_WaitForRupeeCount(EnGinkoMan* this, PlayState* play) { switch (this->curTextId) { case 0x450: // "How much? How much?" [rupee prompt] Set the amount with [Control Stick] and if (play->msgCtx.bankRupeesSelected == 0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x457, &this->actor); this->curTextId = 0x457; // Zero Rupees? Cruel joke! } else { @@ -545,7 +553,7 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { Message_StartTextbox(play, 0x47A, &this->actor); this->curTextId = 0x47A; // Message after receiving reward for depositing 200 rupees. } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x47B, &this->actor); this->curTextId = 0x47B; // Message after receiving reward for depositing 1000 rupees. } @@ -559,12 +567,12 @@ void EnGinkoMan_BankAward2(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SetupIdle(this); } } else { - func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, PLAYER_AP_MINUS1); } } void EnGinkoMan_SetupStamp(EnGinkoMan* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_REACHING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_REACHING); this->actionFunc = EnGinkoMan_Stamp; } @@ -577,12 +585,12 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { switch (this->curTextId) { case 0x464: // "Hey, relax! It doesn't leave any marks, and it's not gonna hurt." - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x465, &this->actor); this->curTextId = 0x465; // "There! Now I'll know you when I see you!" break; case 0x469: // "Excuse me, but let me take a look at you..." - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_SITTING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); play->msgCtx.bankRupees = (gSaveContext.save.bankRupees & 0xFFFF); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(play, 0x46C, &this->actor); @@ -603,12 +611,12 @@ void EnGinkoMan_SwitchAnimation(EnGinkoMan* this, PlayState* play) { if (this->animTimer == 0) { if (this->skelAnime.animation != &object_boj_Anim_004A7C) { this->animTimer = 40; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_ADVERTISING); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_ADVERTISING); } } } else if ((this->animTimer == 0) && (this->skelAnime.animation != &object_boj_Anim_000AC4)) { this->animTimer = 40; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, GINKO_AMAZED); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_AMAZED); } DECR(this->animTimer); diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h index 3ed6bc89b..808ea7c2f 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h @@ -34,12 +34,4 @@ extern const ActorInit En_Ginko_Man_InitVars; #define GINKOMAN_CHOICE_YES 0 #define GINKOMAN_CHOICE_NO 1 -typedef enum { - /* 0 */ GINKO_FLOORSMACKING, - /* 1 */ GINKO_SITTING, - /* 2 */ GINKO_REACHING, - /* 3 */ GINKO_AMAZED, - /* 4 */ GINKO_ADVERTISING, -} GinkoAnimationIndex; - #endif // Z_EN_GINKO_MAN_H 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 3f00e0c0c..235b4ba9f 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -102,7 +102,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, 0, 0.0f }, @@ -259,7 +259,7 @@ s32 func_80B50854(EnGk* this, PlayState* play) { (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY)) { Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); this->unk_2E4 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80B521E8; return true; } @@ -483,21 +483,21 @@ s32 func_80B5123C(EnGk* this, PlayState* play) { void func_80B51308(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_31A].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_31A].animation); if ((this->unk_2E4 == 7) && (sp1E == lastFrame)) { this->unk_2E4 = 8; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); } } void func_80B51398(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[9].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[9].animation); if ((this->unk_2E4 == 9) && (sp1E == lastFrame)) { this->unk_2E4 = 10; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 10); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10); } } @@ -577,7 +577,7 @@ void func_80B51510(EnGk* this, PlayState* play) { Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor)); break; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_31A); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_31A); } if (this->unk_31A == 7) { @@ -593,19 +593,19 @@ void func_80B51510(EnGk* this, PlayState* play) { void func_80B51698(EnGk* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); if (sp26 == lastFrame) { switch (this->unk_2E4) { case 0: this->unk_2E4 = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80B5216C; break; case 2: this->unk_2E4 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80B5202C; break; } @@ -617,16 +617,16 @@ void func_80B51760(EnGk* this, PlayState* play) { s16 lastFrame; if (this->unk_2E4 == 11) { - lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); + lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); if (sp2E == lastFrame) { this->unk_2E4 = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_2E4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4); } } else if (this->unk_2E4 == 10) { - lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); + lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); if (sp2E == lastFrame) { this->unk_2E4 = 11; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_2E4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4); } } else { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { @@ -645,7 +645,7 @@ void func_80B51760(EnGk* this, PlayState* play) { this->unk_1E4 |= 2; } } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && - (gSaveContext.save.entranceIndex != 0xD010)) { + (gSaveContext.save.entrance != 0xD010)) { func_800B863C(&this->actor, play); } @@ -692,7 +692,7 @@ void func_80B51970(EnGk* this, PlayState* play) { if (this->unk_2E4 != 10) { if (this->unk_2E4 != 9) { this->unk_2E4 = 9; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); } else { func_80B51398(this, play); } @@ -720,7 +720,7 @@ void func_80B51B40(EnGk* this, PlayState* play) { } if (this->unk_31C == 0xE8F) { - play->nextEntranceIndex = 0xD010; + play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; gSaveContext.nextTransitionType = TRANS_TYPE_03; @@ -759,7 +759,7 @@ void func_80B51B40(EnGk* this, PlayState* play) { if (this->unk_2E4 != 10) { if (this->unk_2E4 != 9) { this->unk_2E4 = 9; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); } else { func_80B51398(this, play); } @@ -778,7 +778,7 @@ void func_80B51D9C(EnGk* this, PlayState* play) { if (this->unk_1E4 & 4) { this->unk_1E4 &= ~4; this->unk_2E4 = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); this->actionFunc = func_80B51EA4; } else { this->unk_1E4 |= 4; @@ -879,18 +879,18 @@ void func_80B5216C(EnGk* this, PlayState* play) { void func_80B521E8(EnGk* this, PlayState* play) { s16 sp1E = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); if (sp1E == lastFrame) { this->unk_2E4 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80B5227C; } } void func_80B5227C(EnGk* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_2E4].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation); if ((sp26 + 1) == lastFrame) { func_800B14D4(play, 20.0f, &this->actor.home.pos); @@ -1018,7 +1018,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { if (ENGK_GET_F(&this->actor) == ENGK_F_1) { this->unk_2E4 = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); if (play->sceneNum == SCENE_17SETUGEN2) { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { Actor_MarkForDeath(&this->actor); @@ -1029,9 +1029,9 @@ void EnGk_Init(Actor* thisx, PlayState* play) { } } else if (play->sceneNum == SCENE_GORONRACE) { if (gSaveContext.save.weekEventReg[33] & 0x80) { - if (gSaveContext.save.entranceIndex == 0xD010) { + if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { this->actionFunc = func_80B51760; - } else if (gSaveContext.save.entranceIndex == 0xD020) { + } else if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2)) { this->actionFunc = func_80B52340; } else { this->actionFunc = func_80B51760; @@ -1056,7 +1056,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->unk_318 = this->actor.cutscene; this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80B5202C; } else { this->actionFunc = func_80B52654; 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 0a49db1d1..3ad077fec 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -209,7 +209,7 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS D_80951CC0[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -317,7 +317,7 @@ s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { if (phi_v1) { if (tmp >= 0) { this->unk_3E8 = arg2; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80951CC0, arg2); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2); this->unk_3A8 = this->skelAnime.playSpeed; } } @@ -1710,7 +1710,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) { func_8094DFF8(this, play); func_8094E2D0(this); func_8094F2E8(this); - func_8013C964(&this->actor, play, this->unk_3B4, 30.0f, EXCH_ITEM_NONE, this->unk_3A4 & 7); + func_8013C964(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_AP_NONE, this->unk_3A4 & 7); if ((this->unk_258 != 3) && (this->unk_258 != 5) && (this->unk_258 != 8)) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 1019062c6..491e1c95e 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -186,7 +186,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -793,7 +793,7 @@ s32 func_80A12C48(EnGo* this, PlayState* play, s32 arg2) { if (objIdx2 >= 0) { gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIdx2].segment); this->unk_3DC = arg2; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg2); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2); this->unk_398 = this->skelAnime.playSpeed; gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIdx].segment); } @@ -1082,7 +1082,7 @@ void func_80A137C0(EnGo* this, PlayState* play, f32 arg2, f32 arg3) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)arg3); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); @@ -1373,7 +1373,8 @@ void func_80A143A8(EnGo* this, PlayState* play) { } void func_80A14430(EnGo* this, PlayState* play) { - if (((gSaveContext.save.entranceIndex == 0xD000) || (gSaveContext.save.entranceIndex == 0xD020)) && + if (((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 0)) || + (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2))) && (gSaveContext.save.weekEventReg[33] & 0x80)) { func_80A14018(this, play); this->actionFunc = func_80A149B0; @@ -1383,7 +1384,8 @@ void func_80A14430(EnGo* this, PlayState* play) { } void func_80A1449C(EnGo* this, PlayState* play) { - if ((gSaveContext.save.entranceIndex == 0xD010) || (gSaveContext.save.entranceIndex == 0x1C00)) { + if ((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) || + (gSaveContext.save.entrance == ENTRANCE(CUTSCENE, 0))) { func_80A14104(this, play); this->actionFunc = func_80A149B0; } else { @@ -1511,7 +1513,7 @@ void func_80A14798(EnGo* this, PlayState* play) { void func_80A149B0(EnGo* this, PlayState* play) { s16 sp26 = this->actor.world.rot.y; - if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.save.entranceIndex == 0xD010)) { + if ((ENGO_GET_F(&this->actor) == ENGO_F_2) && (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); } else if (ENGO_GET_F(&this->actor) != ENGO_F_8) { if (func_80A1222C(this, play)) { @@ -1926,10 +1928,10 @@ void EnGo_Update(Actor* thisx, PlayState* play) { } else { phi_f0 = this->colliderCylinder.dim.radius + 40; } - func_8013C964(&this->actor, play, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); + func_8013C964(&this->actor, play, phi_f0, 20.0f, PLAYER_AP_NONE, this->unk_390 & 7); } else if ((this->unk_390 & 0x200) && (this->unk_3EC != 0)) { phi_f0 = this->colliderCylinder.dim.radius + 40; - func_8013C964(&this->actor, play, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7); + func_8013C964(&this->actor, play, phi_f0, 20.0f, PLAYER_AP_NONE, this->unk_390 & 7); } if ((ENGO_GET_F(&this->actor) != ENGO_F_8) && (ENGO_GET_F(&this->actor) != ENGO_F_2) && 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 1fa6a22a7..e831328f6 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -184,7 +184,7 @@ void func_80997D38(EnGs* this, PlayState* play) { 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); + PLAYER_AP_NONE, 0x2000, 0x2000); } } @@ -1099,7 +1099,7 @@ void EnGs_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 20, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); 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 843657b60..a08d0835f 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 @@ -16,7 +16,7 @@ void EnGuardNuts_Destroy(Actor* thisx, PlayState* play); void EnGuardNuts_Update(Actor* thisx, PlayState* play); void EnGuardNuts_Draw(Actor* thisx, PlayState* play); -void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 index); +void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 animIndex); void EnGuardNuts_SetupWait(EnGuardNuts* this); void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play); void func_80ABB540(EnGuardNuts* this); @@ -72,7 +72,7 @@ static AnimationHeader* sAnimations[] = { &gDekuPalaceGuardWalkAnim, }; -static u8 sAnimModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE }; +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE }; static TexturePtr sEyeTextures[] = { gDekuPalaceGuardEyeOpenTex, @@ -126,13 +126,13 @@ void EnGuardNuts_Destroy(Actor* thisx, PlayState* play) { * @brief Changes the animation to the provided index. Updates animIndex and animFrameCount for the animation. * * @param this - * @param index the index of sAnimations to change to + * @param animIndex the index of sAnimations to change to */ -void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 index) { - this->animIndex = index; +void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 animIndex) { + this->animIndex = animIndex; this->animFrameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animFrameCount, - sAnimModes[this->animIndex], -2.0f); + sAnimationModes[this->animIndex], -2.0f); } void EnGuardNuts_SetupWait(EnGuardNuts* this) { 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 8fe8d58f7..a57effdcc 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -62,9 +62,9 @@ static ColliderCylinderInit sCylinderInit = { { 15, 20, 0, { 0, 0, 0 } }, }; -static AnimationHeader* D_80BC79CC[] = { &object_fu_Anim_000B04, &object_fu_Anim_00057C }; -static u8 D_80BC79D4[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; -static f32 D_80BC79D8[] = { 1.0f, 1.0f }; +static AnimationHeader* sAnimations[] = { &object_fu_Anim_000B04, &object_fu_Anim_00057C }; +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; +static f32 sPlaySpeeds[] = { 1.0f, 1.0f }; static TexturePtr sEyeTextures[] = { object_fu_Tex_005F20, object_fu_Tex_006320 }; static TexturePtr sMouthTextures[] = { object_fu_Tex_006720, object_fu_Tex_006920 }; @@ -105,17 +105,17 @@ void EnGuruguru_Destroy(Actor* thisx, PlayState* play) { } } -void EnGuruguru_ChangeAnimation(EnGuruguru* this, s32 arg1) { - this->frameCount = Animation_GetLastFrame(D_80BC79CC[arg1]); - Animation_Change(&this->skelAnime, D_80BC79CC[arg1], D_80BC79D8[arg1], 0.0f, this->frameCount, D_80BC79D4[arg1], - -4.0f); +void EnGuruguru_ChangeAnim(EnGuruguru* this, s32 animIndex) { + this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->frameCount, + sAnimationModes[animIndex], -4.0f); } void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play) { } void func_80BC6E10(EnGuruguru* this) { - EnGuruguru_ChangeAnimation(this, 0); + EnGuruguru_ChangeAnim(this, 0); this->textIdIndex = 0; this->unk270 = 0; if (this->actor.params == 0) { @@ -295,7 +295,7 @@ void func_80BC7440(EnGuruguru* this, PlayState* play) { this->textIdIndex++; this->actor.textId = textIDs[this->textIdIndex]; func_801A3B48(1); - func_800B8500(&this->actor, play, 400.0f, 400.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); this->unk268 = 0; gSaveContext.save.weekEventReg[38] |= 0x40; this->actionFunc = func_80BC7520; @@ -309,7 +309,7 @@ void func_80BC7520(EnGuruguru* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BC7068; } else { - func_800B8500(&this->actor, play, 400.0f, 400.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h index 2178c6278..0262cd41d 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.h @@ -15,10 +15,10 @@ typedef struct EnGuruguru { /* 0x248 */ EnGuruguruActionFunc actionFunc; /* 0x24C */ s16 headZRot; /* 0x24E */ s16 headXRot; - /* 0x250 */ char unk250[0x2]; + /* 0x250 */ UNK_TYPE1 unk250[0x2]; /* 0x252 */ s16 headZRotTarget; /* 0x254 */ s16 headXRotTarget; - /* 0x256 */ char unk256[0xE]; + /* 0x256 */ UNK_TYPE1 unk256[0xE]; /* 0x264 */ s16 unusedTimer; // set to 6 and decremented, but never has any effect /* 0x266 */ s16 unk266; /* 0x268 */ s16 unk268; diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 38f86041b..de0880e96 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -323,7 +323,7 @@ void func_80B23910(EnHanabi* this, PlayState* play) { } void func_80B23934(EnHanabi* this, PlayState* play) { - if ((gSaveContext.save.entranceIndex == 0x5410) && (gSaveContext.sceneSetupIndex == 7)) { + if ((gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 1)) && (gSaveContext.sceneSetupIndex == 7)) { if (play->csCtx.frames > 1650) { func_80B236C8(this, play); func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); 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 aba6b4f90..b69429d1a 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -15,18 +15,18 @@ void EnHeishi_Destroy(Actor* thisx, PlayState* play); void EnHeishi_Update(Actor* thisx, PlayState* play); void EnHeishi_Draw(Actor* thisx, PlayState* play); -void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex); +void EnHeishi_ChangeAnim(EnHeishi* this, s32 animIndex); void EnHeishi_SetHeadRotation(EnHeishi* this); void EnHeishi_SetupIdle(EnHeishi* this); void EnHeishi_Idle(EnHeishi* this, PlayState* play); typedef enum { - /* 0 */ HEISHI_ANIMATION_STAND_HAND_ON_HIP, - /* 1 */ HEISHI_ANIMATION_CHEER_WITH_SPEAR, - /* 2 */ HEISHI_ANIMATION_WAVE, - /* 3 */ HEISHI_ANIMATION_SIT_AND_REACH, - /* 4 */ HEISHI_ANIMATION_STAND_UP -} EnHeishiAnimationIndex; + /* 0 */ HEISHI_ANIM_STAND_HAND_ON_HIP, + /* 1 */ HEISHI_ANIM_CHEER_WITH_SPEAR, + /* 2 */ HEISHI_ANIM_WAVE, + /* 3 */ HEISHI_ANIM_SIT_AND_REACH, + /* 4 */ HEISHI_ANIM_STAND_UP +} EnHeishiAnimation; const ActorInit En_Heishi_InitVars = { ACTOR_EN_HEISHI, @@ -99,11 +99,11 @@ void EnHeishi_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliderCylinder); } -void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex) { +void EnHeishi_ChangeAnim(EnHeishi* this, s32 animIndex) { static AnimationHeader* sAnimations[] = { &gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp, }; - static u8 sAnimModes[] = { + static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, @@ -112,7 +112,7 @@ void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex) { this->animIndex = animIndex; this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]); Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, - sAnimModes[this->animIndex], -10.0f); + sAnimationModes[this->animIndex], -10.0f); } void EnHeishi_SetHeadRotation(EnHeishi* this) { @@ -131,9 +131,9 @@ void EnHeishi_SetHeadRotation(EnHeishi* this) { } void EnHeishi_SetupIdle(EnHeishi* this) { - s8 animIndex = HEISHI_ANIMATION_STAND_HAND_ON_HIP; + s8 animIndex = HEISHI_ANIM_STAND_HAND_ON_HIP; - EnHeishi_ChangeAnimation(this, animIndex); + EnHeishi_ChangeAnim(this, animIndex); this->unk278 = animIndex; this->actionFunc = EnHeishi_Idle; } 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 8c0be4adf..83e0935f5 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -101,7 +101,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, 0x80, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_harfgibud_Anim_00260C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_harfgibud_Anim_009D44, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_harfgibud_Anim_00A164, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, @@ -148,7 +148,7 @@ void EnHg_Destroy(Actor* thisx, PlayState* play) { } void func_80BCF354(EnHg* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80BCF398; } @@ -166,7 +166,7 @@ void func_80BCF398(EnHg* this, PlayState* play) { } void func_80BCF468(EnHg* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80BCF4AC; } @@ -190,7 +190,7 @@ void func_80BCF4AC(EnHg* this, PlayState* play) { } void func_80BCF5F0(EnHg* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80BCF634; } @@ -203,7 +203,7 @@ void func_80BCF634(EnHg* this, PlayState* play) { } void func_80BCF68C(EnHg* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80BCF6D0; } @@ -277,30 +277,30 @@ void func_80BCF95C(EnHg* this, PlayState* play) { this->cutscenes[3] = play->csCtx.actorActions[actionIndex]->action; switch (play->csCtx.actorActions[actionIndex]->action) { case 1: - this->currentAnimation = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + this->animIndex = 0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; case 2: this->cutscenes[2] = 0; - this->currentAnimation = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + this->animIndex = 3; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); break; case 3: this->cutscenes[2] = 0; - this->currentAnimation = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + this->animIndex = 5; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); break; case 4: this->cutscenes[2] = 0; - this->currentAnimation = 7; + this->animIndex = 7; if ((this->unk218 == 1) || (this->unk218 == 3)) { func_8019F128(NA_SE_EN_HALF_REDEAD_TRANS); } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); break; case 5: - this->currentAnimation = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 6: gSaveContext.save.weekEventReg[75] |= 0x20; @@ -309,19 +309,19 @@ void func_80BCF95C(EnHg* this, PlayState* play) { } } else { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - switch (this->currentAnimation) { + switch (this->animIndex) { case 3: - this->currentAnimation = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + this->animIndex = 4; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); break; case 5: - this->currentAnimation = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + this->animIndex = 6; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); break; } } } - switch (this->currentAnimation) { + switch (this->animIndex) { case 3: case 4: func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_LOOP - SFX_FLAG); 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 288314379..c81d61d49 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.h +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.h @@ -16,7 +16,7 @@ typedef struct EnHg { /* 0x1D4 */ EnHgActionFunc actionFunc; /* 0x1D8 */ MtxF unk1D8; /* 0x218 */ s32 unk218; - /* 0x21C */ s32 currentAnimation; + /* 0x21C */ s32 animIndex; /* 0x220 */ Vec3s jointTable[HARFGIBUD_GIBDO_LIMB_MAX]; /* 0x292 */ Vec3s morphTable[HARFGIBUD_GIBDO_LIMB_MAX]; /* 0x304 */ UNK_TYPE1 pad304[0xC]; 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 c8de1f210..83fbe5988 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -39,7 +39,7 @@ const ActorInit En_Hgo_InitVars = { (ActorFunc)EnHgo_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_harfgibud_Anim_00B644, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_harfgibud_Anim_013684, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &object_harfgibud_Anim_0152EC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, @@ -127,7 +127,7 @@ void func_80BD0434(EnHgo* this, PlayState* play) { } void func_80BD049C(EnHgo* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80BD04E0; } @@ -258,28 +258,28 @@ s32 func_80BD0898(EnHgo* this, PlayState* play) { switch (play->csCtx.actorActions[actionIndex]->action) { case 1: this->unk_218 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); break; case 2: this->actor.draw = EnHgo_Draw; this->unk_218 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); break; case 3: this->unk_218 = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); break; case 4: this->unk_218 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); break; case 5: this->unk_218 = 4; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); break; case 6: this->unk_218 = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -295,11 +295,11 @@ s32 func_80BD0898(EnHgo* this, PlayState* play) { break; case 2: this->unk_218 = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); break; case 5: this->unk_218 = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); } } 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 ee337e9a9..3664fcede 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 @@ -126,7 +126,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0xF), }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, @@ -181,7 +181,7 @@ void func_80C1FE20(EnHintSkb* this, PlayState* play) { } void func_80C1FE30(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actor.speedXZ = 1.6f; this->actionFunc = func_80C1FE80; } @@ -200,7 +200,7 @@ void func_80C1FE80(EnHintSkb* this, PlayState* play) { void func_80C1FF30(EnHintSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speedXZ = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80C1FF88; } @@ -274,12 +274,12 @@ void func_80C2016C(EnHintSkb* this, PlayState* play) { void func_80C20274(EnHintSkb* this) { if (this->skelAnime.animation == &object_skb_Anim_00697C) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->actor.gravity = -1.0f; this->actor.speedXZ = 1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); if (this->actor.bgCheckFlags & 1) { this->actor.speedXZ = -4.0f; } @@ -316,7 +316,7 @@ void func_80C20334(EnHintSkb* this, PlayState* play) { } void func_80C20484(EnHintSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->unk_3E8 |= 4; if (this->actor.bgCheckFlags & 1) { this->actor.speedXZ = -6.0f; @@ -348,7 +348,7 @@ void func_80C20590(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -375,7 +375,7 @@ void func_80C2069C(EnHintSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_3E8 |= 1; func_80C20274(this); @@ -404,10 +404,10 @@ void func_80C2077C(EnHintSkb* this, PlayState* play) { this->actor.speedXZ = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; } @@ -466,7 +466,7 @@ void func_80C208D0(EnHintSkb* this, PlayState* play) { Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Message_StartTextbox(play, 0x1147, &this->actor); this->unk_3E6 = 0x1147; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); } } @@ -541,7 +541,7 @@ void func_80C20C24(EnHintSkb* this, PlayState* play) { case 0x1147: Message_StartTextbox(play, 0x1148, &this->actor); this->unk_3E6 = 0x1148; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); break; case 0x1148: @@ -590,7 +590,7 @@ void func_80C20D64(EnHintSkb* this, PlayState* play) { this->actor.hintId = 255; this->actor.textId = 0; if (this->actionFunc == func_80C1FE80) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); } func_80C2075C(this); } @@ -700,7 +700,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80C2066C(this); break; @@ -719,7 +719,7 @@ void func_80C20E90(EnHintSkb* this, PlayState* play) { case 13: Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80C20274(this); break; diff --git a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h index f48ffbe9d..0a1383e0a 100644 --- a/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h +++ b/src/overlays/actors/ovl_En_Hit_Tag/z_en_hit_tag.h @@ -7,7 +7,7 @@ struct EnHitTag; typedef void (*EnHitTagActionFunc)(struct EnHitTag*, PlayState*); -#define ENHITTAG_GET_SWITCHFLAG(thisx) (s32)(((thisx)->params & 0xFE00) >> 9) +#define ENHITTAG_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFE00) >> 9) typedef struct EnHitTag { /* 0x000 */ Actor actor; 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 96e378e54..a95ea5e6e 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -188,7 +188,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { func_8012EBF8(play, &play->roomCtx); } } else if (this->type == EN_HOLL_TYPE_SCENE_CHANGER) { - play->nextEntranceIndex = play->setupExitList[EN_HOLL_GET_EXIT_LIST_INDEX(&this->actor)]; + play->nextEntrance = play->setupExitList[EN_HOLL_GET_EXIT_LIST_INDEX(&this->actor)]; gSaveContext.unk_3DBB = 1; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; 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 1922a2f4b..259594d56 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -25,7 +25,7 @@ void EnHorse_StartMountedIdleResetAnim(EnHorse* this); void EnHorse_StartMountedIdle(EnHorse* this); void EnHorse_MountedIdle(EnHorse* this, PlayState* play); void EnHorse_MountedIdleAnim(EnHorse* this); -void EnHorse_MountedIdleWhinney(EnHorse* this); +void EnHorse_MountedIdleWhinny(EnHorse* this); void EnHorse_StartTurning(EnHorse* this); void EnHorse_StartWalkingFromIdle(EnHorse* this); void EnHorse_StartWalkingInterruptable(EnHorse* this); @@ -108,20 +108,32 @@ typedef struct { RaceWaypoint* waypoints; } RaceInfo; -static AnimationHeader* sEponaAnimHeaders[] = { +typedef enum { + /* 0 */ ENHORSE_ANIM_IDLE, + /* 1 */ ENHORSE_ANIM_WHINNY, + /* 2 */ ENHORSE_ANIM_STOPPING, + /* 3 */ ENHORSE_ANIM_REARING, + /* 4 */ ENHORSE_ANIM_WALK, + /* 5 */ ENHORSE_ANIM_TROT, + /* 6 */ ENHORSE_ANIM_GALLOP, + /* 7 */ ENHORSE_ANIM_LOW_JUMP, + /* 8 */ ENHORSE_ANIM_HIGH_JUMP +} EnHorseAnimation; + +static AnimationHeader* sEponaAnimations[] = { &object_horse_link_child_Anim_006D44, &object_horse_link_child_Anim_007468, &object_horse_link_child_Anim_005F64, &object_horse_link_child_Anim_004DE8, &object_horse_link_child_Anim_007D50, &object_horse_link_child_Anim_0043AC, &object_horse_link_child_Anim_002F98, &object_horse_link_child_Anim_0035B0, &object_horse_link_child_Anim_003D38, }; -static AnimationHeader* sHniAnimHeaders[] = { +static AnimationHeader* sHniAnimations[] = { &object_ha_Anim_00C850, &object_ha_Anim_00CE70, &object_ha_Anim_00B9C8, &object_ha_Anim_00B00C, &object_ha_Anim_00D648, &object_ha_Anim_00A650, &object_ha_Anim_009208, &object_ha_Anim_009858, &object_ha_Anim_00A05C, }; static AnimationHeader** sAnimationHeaders[] = { - NULL, NULL, sEponaAnimHeaders, sHniAnimHeaders, sHniAnimHeaders, + NULL, NULL, sEponaAnimations, sHniAnimations, sHniAnimations, }; static f32 sPlaybackSpeeds[] = { @@ -228,11 +240,15 @@ static u8 sResetNoInput[] = { true, true, true, false, false, false, false, false, false, false, false, false, }; -static s32 sIdleAnimIds[] = { - 1, 3, 0, 3, 1, 0, +static s32 sIdleAnimIndices[] = { + ENHORSE_ANIM_WHINNY, ENHORSE_ANIM_REARING, ENHORSE_ANIM_IDLE, + ENHORSE_ANIM_REARING, ENHORSE_ANIM_WHINNY, ENHORSE_ANIM_IDLE, }; -static s16 sIngoAnimations[] = { 7, 6, 2, 2, 1, 1, 0, 0, 0, 0 }; +static s16 sIngoAnimIndices[] = { + ENIN_ANIM_7, ENIN_ANIM_6, ENIN_ANIM_2, ENIN_ANIM_2, ENIN_ANIM_1, + ENIN_ANIM_1, ENIN_ANIM_0, ENIN_ANIM_0, ENIN_ANIM_0, ENIN_ANIM_0, +}; static EnHorseCsFunc sCutsceneInitFuncs[] = { NULL, @@ -549,7 +565,7 @@ s32 func_8087C38C(PlayState* play, EnHorse* this, Vec3f* arg2) { } void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { - if ((this->animationIdx == ENHORSE_ANIM_IDLE) && + if ((this->animIndex == ENHORSE_ANIM_IDLE) && (((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))) && @@ -560,7 +576,7 @@ void EnHorse_IdleAnimSounds(EnHorse* this, PlayState* play) { } 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)) { + } else if ((this->animIndex == 3) && (this->curFrame > 25.0f) && !(this->stateFlags & ENHORSE_LAND2_SOUND)) { this->stateFlags |= ENHORSE_LAND2_SOUND; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); @@ -653,10 +669,12 @@ void EnHorse_ResetRace(EnHorse* this, PlayState* play) { s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 1) || (func_800B7128(GET_PLAYER(play)) == true) || (player->stateFlags1 & 0x100000) || + if ((player->stateFlags1 & PLAYER_STATE1_1) || (func_800B7128(GET_PLAYER(play)) == true) || + (player->stateFlags1 & PLAYER_STATE1_100000) || (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || - (this->action == 19) || (player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != 0) || - (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & 0x20) || (player->csMode != 0)) { + (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_100) || + (play->csCtx.state != CS_STATE_0) || (ActorCutscene_GetCurrentIndex() != -1) || + (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != 0)) { return false; } return true; @@ -716,7 +734,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { thisx->objBankIndex = Object_Spawn(&play->objectCtx, OBJECT_HORSE_LINK_CHILD); Actor_SetObjectDependency(play, &this->actor); Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); this->unk_1EC |= 0x200; } else { thisx->update = func_8087D540; @@ -775,13 +793,13 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { } if (((play->sceneNum == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || - ((gSaveContext.save.entranceIndex == 0x6400) && Cutscene_GetSceneSetupIndex(play))) { + ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && Cutscene_GetSceneSetupIndex(play))) { this->stateFlags |= ENHORSE_FLAG_25; } thisx->gravity = -3.5f; ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawHorse, 20.0f); - this->action = ENHORSE_ACT_IDLE; + this->action = ENHORSE_ACTION_IDLE; thisx->speedXZ = 0.0f; if (this->type == HORSE_TYPE_2) { @@ -823,7 +841,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } - this->animationIdx = 0; + this->animIndex = 0; this->numBoosts = 6; this->boostRegenTime = 0; this->postDrawFunc = NULL; @@ -926,7 +944,7 @@ void func_8087D540(Actor* thisx, PlayState* play) { } else { Skin_Init(&play->state, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][0]); } - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); } } @@ -934,7 +952,7 @@ void EnHorse_Destroy(Actor* thisx, PlayState* play) { EnHorse* this = THIS; if (this->stateFlags & ENHORSE_DRAW) { - Audio_StopSfxByPos(&this->unk_218); + AudioSfx_StopByPos(&this->unk_218); } Skin_Free(&play->state, &this->skin); Collider_DestroyCylinder(play, &this->colliderCylinder1); @@ -951,8 +969,8 @@ void EnHorse_RotateToPlayer(EnHorse* this, PlayState* play) { } void EnHorse_Freeze(EnHorse* this, PlayState* play) { - if ((this->action != ENHORSE_ACT_HBA) && (this->action != ENHORSE_ACT_21) && - (this->action != ENHORSE_ACT_FLEE_PLAYER)) { + if ((this->action != ENHORSE_ACTION_CS_UPDATE) && (this->action != ENHORSE_ACTION_21) && + (this->action != ENHORSE_ACTION_HBA)) { if (sResetNoInput[this->actor.params] && (this->actor.params != ENHORSE_6)) { Player* player = GET_PLAYER(play); @@ -962,11 +980,11 @@ void EnHorse_Freeze(EnHorse* this, PlayState* play) { player->actor.world.pos.y += 70.0f; } this->prevAction = this->action; - this->action = ENHORSE_ACT_FROZEN; + this->action = ENHORSE_ACTION_FROZEN; this->colliderCylinder1.base.ocFlags1 &= ~OC1_ON; this->colliderCylinder2.base.ocFlags1 &= ~OC1_ON; this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; } } @@ -983,13 +1001,13 @@ void EnHorse_Frozen(EnHorse* this, PlayState* play) { EnHorse_StartMountedIdleResetAnim(this); } else if (this->actor.params == ENHORSE_11) { this->actor.params = ENHORSE_7; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_0) { EnHorse_StartMountedIdle(this); } else { this->actor.speedXZ = 8.0f; EnHorse_StartGalloping(this); } - } else if (this->prevAction == ENHORSE_ACT_IDLE) { + } else if (this->prevAction == ENHORSE_ACTION_IDLE) { EnHorse_StartMountedIdle(this); } else { EnHorse_StartMountedIdleResetAnim(this); @@ -998,9 +1016,9 @@ void EnHorse_Frozen(EnHorse* this, PlayState* play) { if (this->actor.params != ENHORSE_0) { this->actor.params = ENHORSE_0; } - } else if (this->prevAction == ENHORSE_ACT_MOUNTED_TURN) { + } else if (this->prevAction == ENHORSE_ACTION_MOUNTED_IDLE) { EnHorse_ChangeIdleAnimation(this, 0, 0.0f); - } else if (this->prevAction == ENHORSE_ACT_MOUNTED_WALK) { + } else if (this->prevAction == ENHORSE_ACTION_MOUNTED_IDLE_WHINNYING) { EnHorse_ChangeIdleAnimation(this, 0, 0.0f); } else { EnHorse_ChangeIdleAnimation(this, 0, 0.0f); @@ -1099,8 +1117,8 @@ void EnHorse_StartMountedIdleResetAnim(EnHorse* this) { void EnHorse_StartMountedIdle(EnHorse* this) { f32 curFrame; - this->action = ENHORSE_ACT_MOUNTED_TURN; - this->animationIdx = ENHORSE_ANIM_IDLE; + this->action = ENHORSE_ACTION_MOUNTED_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; if (((this->curFrame > 35.0f) && (this->type == HORSE_TYPE_EPONA)) || ((this->curFrame > 28.0f) && (this->type == HORSE_TYPE_HNI))) { @@ -1114,8 +1132,8 @@ void EnHorse_StartMountedIdle(EnHorse* this) { } } curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, curFrame, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, curFrame, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { @@ -1145,16 +1163,16 @@ void EnHorse_MountedIdle(EnHorse* this, PlayState* play) { void EnHorse_MountedIdleAnim(EnHorse* this) { this->skin.skelAnime.curFrame = 0.0f; - EnHorse_MountedIdleWhinney(this); + EnHorse_MountedIdleWhinny(this); } -void EnHorse_MountedIdleWhinney(EnHorse* this) { +void EnHorse_MountedIdleWhinny(EnHorse* this) { f32 curFrame; - this->action = ENHORSE_ACT_MOUNTED_WALK; - this->animationIdx = ENHORSE_ANIM_WHINNEY; + this->action = ENHORSE_ACTION_MOUNTED_IDLE_WHINNYING; + this->animIndex = ENHORSE_ANIM_WHINNY; curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, curFrame, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, curFrame, Animation_GetLastFrame(sAnimationHeaders[this->type][1]), ANIMMODE_ONCE, -3.0f); if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { @@ -1165,7 +1183,7 @@ void EnHorse_MountedIdleWhinney(EnHorse* this) { } } -void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play) { +void EnHorse_MountedIdleWhinnying(EnHorse* this, PlayState* play) { f32 stickMag; s16 stickAngle = 0; @@ -1191,10 +1209,10 @@ void EnHorse_MountedIdleWhinneying(EnHorse* this, PlayState* play) { } void EnHorse_StartTurning(EnHorse* this) { - this->action = ENHORSE_ACT_MOUNTED_TROT; + this->action = ENHORSE_ACTION_MOUNTED_TURN; this->soundTimer = 0; - this->animationIdx = ENHORSE_ANIM_WALK; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, + this->animIndex = ENHORSE_ANIM_WALK; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][4]), ANIMMODE_ONCE, -3.0f); } @@ -1254,20 +1272,20 @@ void EnHorse_StartWalkingInterruptable(EnHorse* this) { } void EnHorse_StartWalking(EnHorse* this) { - this->action = ENHORSE_ACT_MOUNTED_GALLOP; + this->action = ENHORSE_ACTION_MOUNTED_WALK; this->soundTimer = 0; - this->animationIdx = ENHORSE_ANIM_WALK; + this->animIndex = ENHORSE_ANIM_WALK; this->waitTimer = 0; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][4]), ANIMMODE_ONCE, -3.0f); } void EnHorse_MountedWalkingReset(EnHorse* this) { - this->action = ENHORSE_ACT_MOUNTED_GALLOP; + this->action = ENHORSE_ACTION_MOUNTED_WALK; this->soundTimer = 0; - this->animationIdx = ENHORSE_ANIM_WALK; + this->animIndex = ENHORSE_ANIM_WALK; this->waitTimer = 0; - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); } void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { @@ -1326,16 +1344,16 @@ void EnHorse_MountedWalk(EnHorse* this, PlayState* play) { } void EnHorse_StartTrotting(EnHorse* this) { - this->action = ENHORSE_ACT_MOUNTED_REARING; - this->animationIdx = ENHORSE_ANIM_TROT; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + this->action = ENHORSE_ACTION_MOUNTED_TROT; + this->animIndex = ENHORSE_ANIM_TROT; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_MountedTrotReset(EnHorse* this) { - this->action = ENHORSE_ACT_MOUNTED_REARING; - this->animationIdx = ENHORSE_ANIM_TROT; - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + this->action = ENHORSE_ACTION_MOUNTED_TROT; + this->animIndex = ENHORSE_ANIM_TROT; + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); } void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { @@ -1370,29 +1388,29 @@ void EnHorse_StartGallopingInterruptable(EnHorse* this) { } void EnHorse_StartGalloping(EnHorse* this) { - this->action = ENHORSE_ACT_STOPPING; - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->action = ENHORSE_ACTION_MOUNTED_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; this->unk_230 = 0; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_MountedGallopReset(EnHorse* this) { this->noInputTimer = 0; this->noInputTimerMax = 0; - this->action = ENHORSE_ACT_STOPPING; - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->action = ENHORSE_ACTION_MOUNTED_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; this->unk_230 = 0; - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); } void EnHorse_JumpLanding(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - this->action = ENHORSE_ACT_STOPPING; - this->animationIdx = ENHORSE_ANIM_GALLOP; - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + this->action = ENHORSE_ACTION_MOUNTED_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); jointTable = this->skin.skelAnime.jointTable; y = jointTable->y; this->riderPos.y += y * 0.01f * this->unk_528 * 0.01f; @@ -1436,10 +1454,10 @@ void EnHorse_MountedGallop(EnHorse* this, PlayState* play) { } void EnHorse_StartRearing(EnHorse* this) { - this->action = ENHORSE_ACT_REVERSE; - this->animationIdx = ENHORSE_ANIM_REARING; + this->action = ENHORSE_ACTION_MOUNTED_REARING; + this->animIndex = ENHORSE_ANIM_REARING; - if (sAnimationHeaders[this->type][this->animationIdx] == NULL) { + if (sAnimationHeaders[this->type][this->animIndex] == NULL) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { @@ -1464,8 +1482,8 @@ void EnHorse_StartRearing(EnHorse* this) { } Rumble_Request(0.0f, 180, 20, 100); - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { @@ -1511,9 +1529,9 @@ void EnHorse_MountedRearing(EnHorse* this, PlayState* play) { } void EnHorse_StartBraking(EnHorse* this, PlayState* play) { - this->action = ENHORSE_ACT_LOW_JUMP; - this->animationIdx = ENHORSE_ANIM_STOPPING; - if (sAnimationHeaders[this->type][this->animationIdx] == NULL) { + this->action = ENHORSE_ACTION_STOPPING; + this->animIndex = ENHORSE_ANIM_STOPPING; + if (sAnimationHeaders[this->type][this->animIndex] == NULL) { if (Rand_ZeroOne() > 0.5f) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { @@ -1534,8 +1552,8 @@ void EnHorse_StartBraking(EnHorse* this, PlayState* play) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_SLIP); } - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); this->stateFlags |= ENHORSE_STOPPING_NEIGH_SOUND; this->stateFlags &= ~ENHORSE_BOOST; } @@ -1551,7 +1569,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { if ((this->stateFlags & ENHORSE_STOPPING_NEIGH_SOUND) && (this->skin.skelAnime.curFrame > 29.0f)) { this->actor.speedXZ = 0.0f; if ((Rand_ZeroOne() > 0.5f) && - ((gSaveContext.save.entranceIndex != 0x6400) || !Cutscene_GetSceneSetupIndex(play))) { + ((gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0)) || !Cutscene_GetSceneSetupIndex(play))) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); @@ -1591,11 +1609,11 @@ void EnHorse_StartReversingInterruptable(EnHorse* this) { } void EnHorse_StartReversing(EnHorse* this) { - this->action = ENHORSE_ACT_HIGH_JUMP; - this->animationIdx = ENHORSE_ANIM_WALK; + this->action = ENHORSE_ACTION_REVERSE; + this->animIndex = ENHORSE_ANIM_WALK; this->soundTimer = 0; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_LOOP, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_LOOP, -3.0f); } void EnHorse_Reverse(EnHorse* this, PlayState* play) { @@ -1624,8 +1642,8 @@ void EnHorse_Reverse(EnHorse* this, PlayState* play) { } else if (stickMag < 10.0f) { stickAngle = -0x7FFF; } - } else if ((player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != 0) || - (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & 0x20)) { + } else if ((player->actor.flags & ACTOR_FLAG_100) || (play->csCtx.state != CS_STATE_0) || + (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & PLAYER_STATE1_20)) { EnHorse_StartMountedIdleResetAnim(this); this->actor.speedXZ = 0.0f; return; @@ -1672,11 +1690,11 @@ void EnHorse_StartLowJump(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - this->action = ENHORSE_ACT_BRIDGE_JUMP; - this->animationIdx = ENHORSE_ANIM_LOW_JUMP; + this->action = ENHORSE_ACTION_LOW_JUMP; + this->animIndex = ENHORSE_ANIM_LOW_JUMP; curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.5f, curFrame, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, curFrame, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); this->postDrawFunc = NULL; this->jumpStartY = this->actor.world.pos.y; this->actor.gravity = 0.0f; @@ -1768,11 +1786,11 @@ void EnHorse_StartHighJump(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - this->action = ENHORSE_ACT_CS_UPDATE; - this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; + this->action = ENHORSE_ACTION_HIGH_JUMP; + this->animIndex = ENHORSE_ANIM_HIGH_JUMP; curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.5f, curFrame, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, curFrame, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); this->postDrawFunc = NULL; this->jumpStartY = this->actor.world.pos.y; @@ -1860,8 +1878,8 @@ void EnHorse_InitInactive(EnHorse* this) { this->colliderCylinder1.base.ocFlags1 &= ~OC1_ON; this->colliderCylinder2.base.ocFlags1 &= ~OC1_ON; this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; - this->action = ENHORSE_ACT_INACTIVE; - this->animationIdx = ENHORSE_ANIM_WALK; + this->action = ENHORSE_ACTION_INACTIVE; + this->animIndex = ENHORSE_ANIM_WALK; this->stateFlags |= ENHORSE_INACTIVE; this->followTimer = 0; } @@ -1888,10 +1906,10 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play) { } void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { - this->action = ENHORSE_ACT_IDLE; + this->action = ENHORSE_ACTION_IDLE; this->actor.speedXZ = 0.0f; - if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNEY) && (anim != ENHORSE_ANIM_REARING)) { + if ((anim != ENHORSE_ANIM_IDLE) && (anim != ENHORSE_ANIM_WHINNY) && (anim != ENHORSE_ANIM_REARING)) { anim = ENHORSE_ANIM_IDLE; } @@ -1899,12 +1917,12 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta anim = ENHORSE_ANIM_IDLE; } - if (anim != this->animationIdx) { - this->animationIdx = anim; + if (anim != this->animIndex) { + this->animIndex = anim; if (anim == ENHORSE_ANIM_IDLE) { this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; } else { - if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { + if (this->animIndex == ENHORSE_ANIM_WHINNY) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); @@ -1912,7 +1930,7 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_GROAN); } } - } else if (this->animationIdx == ENHORSE_ANIM_REARING) { + } else if (this->animIndex == ENHORSE_ANIM_REARING) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); @@ -1923,8 +1941,8 @@ void EnHorse_PlayIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 sta this->stateFlags &= ~ENHORSE_LAND2_SOUND; } } - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, startFrames, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, morphFrames); } } @@ -1934,8 +1952,8 @@ void EnHorse_ChangeIdleAnimation(EnHorse* this, s32 anim, f32 morphFrames) { } void EnHorse_ResetIdleAnimation(EnHorse* this) { - this->animationIdx = ENHORSE_ANIM_WALK; - EnHorse_PlayIdleAnimation(this, this->animationIdx, 0.0f, 0.0f); + this->animIndex = ENHORSE_ANIM_WALK; + EnHorse_PlayIdleAnimation(this, this->animIndex, 0.0f, 0.0f); } void EnHorse_StartIdleRidable(EnHorse* this) { @@ -1971,37 +1989,37 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - s32 idleAnimIdx = 0; + s32 idleAnimIndex = 0; - if (this->animationIdx != 0) { - if (this->animationIdx == 1) { - idleAnimIdx = 1; - } else if (this->animationIdx == 3) { - idleAnimIdx = 2; + if (this->animIndex != ENHORSE_ANIM_IDLE) { + if (this->animIndex == ENHORSE_ANIM_WHINNY) { + idleAnimIndex = 1; + } else if (this->animIndex == ENHORSE_ANIM_REARING) { + idleAnimIndex = 2; } } // Play one of the two other idle animations - EnHorse_PlayIdleAnimation(this, sIdleAnimIds[((Rand_ZeroOne() > 0.5f) ? 0 : 1) + idleAnimIdx * 2], 0.0f, 0.0f); + EnHorse_PlayIdleAnimation(this, sIdleAnimIndices[((Rand_ZeroOne() > 0.5f) ? 0 : 1) + idleAnimIndex * 2], 0.0f, + 0.0f); } } void EnHorse_StartMovingAnimation(EnHorse* this, s32 anim, f32 morphFrames, f32 startFrames) { - this->action = ENHORSE_ACT_FOLLOW_PLAYER; + this->action = ENHORSE_ACTION_FOLLOW_PLAYER; this->stateFlags &= ~ENHORSE_TURNING_TO_PLAYER; if ((anim != ENHORSE_ANIM_TROT) && (anim != ENHORSE_ANIM_GALLOP) && (anim != ENHORSE_ANIM_WALK)) { anim = ENHORSE_ANIM_WALK; } - if (anim != this->animationIdx) { - this->animationIdx = anim; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, startFrames, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + if (anim != this->animIndex) { + this->animIndex = anim; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, morphFrames); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, startFrames, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, startFrames, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } @@ -2015,13 +2033,13 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { anim = ENHORSE_ANIM_TROT; } - if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + if (this->animIndex == ENHORSE_ANIM_GALLOP) { if (distToPlayer > 400.0f) { anim = ENHORSE_ANIM_GALLOP; } else { anim = ENHORSE_ANIM_TROT; } - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { if (distToPlayer > 400.0f) { anim = ENHORSE_ANIM_GALLOP; } else if (distToPlayer < 300.0f) { @@ -2029,7 +2047,7 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { } else { anim = ENHORSE_ANIM_TROT; } - } else if (this->animationIdx == ENHORSE_ANIM_WALK) { + } else if (this->animIndex == ENHORSE_ANIM_WALK) { if (distToPlayer > 300.0f) { anim = ENHORSE_ANIM_TROT; } else { @@ -2050,7 +2068,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER)) { f32 angleDiff; - this->animationIdx = ENHORSE_ANIM_REARING; + this->animIndex = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; this->angleToPlayer = Actor_YawBetweenActors(&this->actor, &GET_PLAYER(play)->actor); @@ -2062,9 +2080,9 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { } this->followPlayerTurnSpeed = - angleDiff / Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]); + angleDiff / Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]); - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); this->skin.skelAnime.playSpeed = 1.0f; this->stateFlags &= ~ENHORSE_LAND2_SOUND; } else if (this->stateFlags & ENHORSE_TURNING_TO_PLAYER) { @@ -2082,14 +2100,14 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { EnHorse_RotateToPlayer(this, play); } - if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + if (this->animIndex == ENHORSE_ANIM_GALLOP) { this->actor.speedXZ = 8.0f; this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; } else { - if (this->animationIdx == ENHORSE_ANIM_TROT) { + if (this->animIndex == ENHORSE_ANIM_TROT) { this->actor.speedXZ = 6.0f; this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; - } else if (this->animationIdx == ENHORSE_ANIM_WALK) { + } else if (this->animIndex == ENHORSE_ANIM_WALK) { this->actor.speedXZ = 3.0f; EnHorse_PlayWalkingSound(this); this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; @@ -2114,9 +2132,9 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + if (this->animIndex == ENHORSE_ANIM_GALLOP) { func_8087C1C0(this); - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { func_8087C178(this); } @@ -2140,13 +2158,13 @@ void EnHorse_InitIngoHorse(EnHorse* this) { } } -void EnHorse_SetIngoAnimation(s32 anim, f32 curFrame, s32 arg2, s16* animIdxOut) { - *animIdxOut = sIngoAnimations[anim]; - if (arg2 == 1) { - if (anim == 5) { - *animIdxOut = 4; - } else if (anim == 6) { - *animIdxOut = 3; +void EnHorse_SetIngoAnimation(s32 animIndex, f32 curFrame, s32 arg2, s16* animIndexOut) { + *animIndexOut = sIngoAnimIndices[animIndex]; + if (arg2 == ENIN_ANIM_1) { + if (animIndex == ENHORSE_ANIM_TROT) { + *animIndexOut = ENIN_ANIM_4; + } else if (animIndex == ENHORSE_ANIM_GALLOP) { + *animIndexOut = ENIN_ANIM_3; } } } @@ -2155,41 +2173,41 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { s32 animChanged = false; f32 animSpeed; - this->action = ENHORSE_ACT_INGO_RACE; + this->action = ENHORSE_ACTION_INGO_RACE; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; if (this->actor.speedXZ == 0.0f) { - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; } else if (this->actor.speedXZ <= 3.0f) { - if (this->animationIdx != ENHORSE_ANIM_WALK) { + if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_WALK; + this->animIndex = ENHORSE_ANIM_WALK; } else if (this->actor.speedXZ <= 6.0f) { - if (this->animationIdx != ENHORSE_ANIM_TROT) { + if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_TROT; + this->animIndex = ENHORSE_ANIM_TROT; } else { - if (this->animationIdx != ENHORSE_ANIM_GALLOP) { + if (this->animIndex != ENHORSE_ANIM_GALLOP) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { animSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); @@ -2201,40 +2219,38 @@ void EnHorse_UpdateIngoHorseAnim(EnHorse* this) { } if (animChanged == true) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * animSpeed * 1.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * animSpeed * 1.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * animSpeed * 1.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * animSpeed * 1.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { f32 playSpeed; - if ((this->animationIdx == ENHORSE_ANIM_IDLE) || (this->animationIdx == ENHORSE_ANIM_WHINNEY)) { + if ((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) { EnHorse_IdleAnimSounds(this, play); - } else if (this->animationIdx == ENHORSE_ANIM_WALK) { + } else if (this->animIndex == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } if (!this->inRace) { this->actor.speedXZ = 0.0f; this->rider->actor.speedXZ = 0.0f; - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateIngoHorseAnim(this); } } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { playSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == 5) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { playSpeed = this->actor.speedXZ * 0.25f; - } else if (this->animationIdx == 6) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { playSpeed = this->actor.speedXZ * 0.2f; } else { playSpeed = 1.0f; @@ -2242,7 +2258,7 @@ void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = playSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animationIdx == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { EnHorse_UpdateIngoHorseAnim(this); } } @@ -2255,11 +2271,11 @@ void func_8088126C(EnHorse* this, PlayState* play) { void func_80881290(EnHorse* this, PlayState* play) { f32 curFrame; - this->action = ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING; - this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; + this->action = ENHORSE_ACTION_6; + this->animIndex = ENHORSE_ANIM_HIGH_JUMP; curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.5f, curFrame, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, curFrame, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); this->postDrawFunc = NULL; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; @@ -2323,9 +2339,9 @@ void func_8088159C(EnHorse* this, PlayState* play) { Vec3s* jointTable; f32 y; - this->action = ENHORSE_ACT_MOUNTED_IDLE; - this->animationIdx = ENHORSE_ANIM_GALLOP; - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + this->action = ENHORSE_ACTION_5; + this->animIndex = ENHORSE_ANIM_GALLOP; + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); jointTable = this->skin.skelAnime.jointTable; y = jointTable->y; this->riderPos.y += y * 0.01f * this->unk_528 * 0.01f; @@ -2347,41 +2363,41 @@ void func_8088168C(EnHorse* this) { f32 animSpeed; f32 finalAnimSpeed; - this->action = ENHORSE_ACT_MOUNTED_IDLE; + this->action = ENHORSE_ACTION_5; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; if (this->actor.speedXZ == 0.0f) { - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; } else if (this->actor.speedXZ <= 3.0f) { - if (this->animationIdx != ENHORSE_ANIM_WALK) { + if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_WALK; + this->animIndex = ENHORSE_ANIM_WALK; } else if (this->actor.speedXZ <= 6.0f) { - if (this->animationIdx != ENHORSE_ANIM_TROT) { + if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_TROT; + this->animIndex = ENHORSE_ANIM_TROT; } else { - if (this->animationIdx != ENHORSE_ANIM_GALLOP) { + if (this->animIndex != ENHORSE_ANIM_GALLOP) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { animSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); } else { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); @@ -2392,19 +2408,17 @@ void func_8088168C(EnHorse* this) { animSpeed = 1.0f; } - finalAnimSpeed = sPlaybackSpeeds[this->animationIdx] * animSpeed * 1.5f; + finalAnimSpeed = sPlaybackSpeeds[this->animIndex] * animSpeed * 1.5f; if (finalAnimSpeed < 1.0f) { finalAnimSpeed = 1.0f; } if (animChanged == true) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], finalAnimSpeed, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], finalAnimSpeed, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], finalAnimSpeed, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], finalAnimSpeed, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } @@ -2412,16 +2426,16 @@ void func_808819D8(EnHorse* this, PlayState* play) { Path* path; f32 animSpeed; - if ((this->animationIdx == ENHORSE_ANIM_IDLE) || (this->animationIdx == ENHORSE_ANIM_WHINNEY)) { + if ((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) { EnHorse_IdleAnimSounds(this, play); - } else if (this->animationIdx == ENHORSE_ANIM_WALK) { + } else if (this->animIndex == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } if (!this->inRace) { this->actor.speedXZ = 0.0f; this->rider->actor.speedXZ = 0.0f; - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateIngoHorseAnim(this); } } @@ -2436,16 +2450,16 @@ void func_808819D8(EnHorse* this, PlayState* play) { if (!this->inRace) { this->actor.speedXZ = 0.0f; - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { func_8088168C(this); } } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { animSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; } else { animSpeed = 1.0f; @@ -2453,22 +2467,22 @@ void func_808819D8(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = animSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animationIdx == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { func_8088168C(this); } if (GET_RACE_FLAGS == 3) { this->rider->unk488 = 7; } else { - EnHorse_SetIngoAnimation(this->animationIdx, this->skin.skelAnime.curFrame, this->unk_394 & 1, + EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1, &this->rider->unk488); } } void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; - Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], + Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], this->actor.speedXZ * 0.2f * 1.5f); } @@ -2492,7 +2506,7 @@ void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* act if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); Rumble_Request(0.0f, 120, 8, 255); - Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], + Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], this->actor.speedXZ * 0.3f); } } @@ -2507,10 +2521,10 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { f32 y; Vec3s* jointTable; - this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; + this->animIndex = ENHORSE_ANIM_HIGH_JUMP; curFrame = this->skin.skelAnime.curFrame; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.5f, curFrame, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.5f, curFrame, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); this->postDrawFunc = NULL; this->jumpStartY = this->actor.world.pos.y; this->actor.gravity = 0.0f; @@ -2582,8 +2596,8 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; func_800B1598(play, 25.0f, &this->actor.world.pos); - this->animationIdx = ENHORSE_ANIM_GALLOP; - Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], + this->animIndex = ENHORSE_ANIM_GALLOP; + Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], sPlaybackSpeeds[6]); jointTable = this->skin.skelAnime.jointTable; @@ -2595,7 +2609,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->animationIdx = ENHORSE_ANIM_REARING; + this->animIndex = ENHORSE_ANIM_REARING; this->cutsceneAction = 3; this->cutsceneFlags &= ~4; this->stateFlags &= ~ENHORSE_LAND2_SOUND; @@ -2606,8 +2620,8 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* act Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { @@ -2624,15 +2638,15 @@ void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) } if (SkelAnime_Update(&this->skin.skelAnime)) { - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; if (!(this->cutsceneFlags & 4)) { this->cutsceneFlags |= 4; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_LOOP, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_LOOP, 0.0f); } } @@ -2647,9 +2661,9 @@ void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* acti this->actor.world.rot.y = action->urot.y; this->actor.shape.rot = this->actor.world.rot; - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 4; - Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], + Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], this->actor.speedXZ * 0.3f); } @@ -2673,7 +2687,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* if (SkelAnime_Update(&this->skin.skelAnime)) { func_8087C1C0(this); Rumble_Request(0.0f, 120, 8, 255); - Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], + Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], this->actor.speedXZ * 0.3f); } } @@ -2687,7 +2701,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* this->actor.world.rot.y = action->urot.y; this->actor.shape.rot = this->actor.world.rot; - this->animationIdx = ENHORSE_ANIM_REARING; + this->animIndex = ENHORSE_ANIM_REARING; this->cutsceneAction = 5; this->cutsceneFlags &= ~4; this->stateFlags &= ~ENHORSE_LAND2_SOUND; @@ -2699,8 +2713,8 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_HORSE_NEIGH); } } - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { @@ -2717,15 +2731,15 @@ void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* act } if (SkelAnime_Update(&this->skin.skelAnime)) { - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; if (!(this->cutsceneFlags & 4)) { this->cutsceneFlags |= 4; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_LOOP, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_LOOP, 0.0f); } } @@ -2733,7 +2747,7 @@ void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* act void EnHorse_InitCutscene(EnHorse* this, PlayState* play) { this->playerControlled = false; - this->action = ENHORSE_ACT_HBA; + this->action = ENHORSE_ACTION_CS_UPDATE; this->cutsceneAction = 0; this->actor.speedXZ = 0.0f; } @@ -2758,10 +2772,10 @@ void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; CsCmdActorAction* playerAction = play->csCtx.playerAction; - if (play->csCtx.state == 3) { + if (play->csCtx.state == CS_STATE_3) { this->playerControlled = true; this->actor.params = ENHORSE_12; - this->action = ENHORSE_ACT_IDLE; + this->action = ENHORSE_ACTION_IDLE; EnHorse_Freeze(this, play); return; } @@ -2838,32 +2852,32 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { s32 animChanged = false; f32 animSpeed; - this->action = ENHORSE_ACT_FLEE_PLAYER; + this->action = ENHORSE_ACTION_HBA; if (this->actor.speedXZ == 0.0f) { - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; } else if (this->actor.speedXZ <= 3.0f) { - if (this->animationIdx != ENHORSE_ANIM_WALK) { + if (this->animIndex != ENHORSE_ANIM_WALK) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_WALK; + this->animIndex = ENHORSE_ANIM_WALK; } else if (this->actor.speedXZ <= 6.0f) { - if (this->animationIdx != ENHORSE_ANIM_TROT) { + if (this->animIndex != ENHORSE_ANIM_TROT) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_TROT; + this->animIndex = ENHORSE_ANIM_TROT; } else { - if (this->animationIdx != ENHORSE_ANIM_GALLOP) { + if (this->animIndex != ENHORSE_ANIM_GALLOP) { animChanged = true; } - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { animSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { animSpeed = this->actor.speedXZ * 0.25f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); @@ -2871,7 +2885,7 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } Rumble_Request(0.0f, 60, 8, 255); - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { animSpeed = this->actor.speedXZ * 0.2f; if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN); @@ -2884,15 +2898,13 @@ void EnHorse_UpdateHbaAnim(EnHorse* this) { } if (animChanged == true) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * animSpeed * 1.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * animSpeed * 1.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * animSpeed * 1.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * animSpeed * 1.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } @@ -2900,7 +2912,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { f32 playSpeed; s32 sp28; - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { EnHorse_PlayWalkingSound(this); } @@ -2926,16 +2938,16 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (this->hbaStarted == 0) { this->actor.speedXZ = 0.0f; - if (this->animationIdx != ENHORSE_ANIM_IDLE) { + if (this->animIndex != ENHORSE_ANIM_IDLE) { EnHorse_UpdateHbaAnim(this); } } - if (this->animationIdx == ENHORSE_ANIM_WALK) { + if (this->animIndex == ENHORSE_ANIM_WALK) { playSpeed = this->actor.speedXZ * 0.5f; - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { playSpeed = this->actor.speedXZ * 0.25f; - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { playSpeed = this->actor.speedXZ * 0.2f; } else { playSpeed = 1.0f; @@ -2943,7 +2955,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = playSpeed; if (SkelAnime_Update(&this->skin.skelAnime) || - ((this->animationIdx == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { + ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->actor.speedXZ != 0.0f))) { EnHorse_UpdateHbaAnim(this); } } @@ -2953,7 +2965,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { f32 distToHome; f32 playerDistToHome; f32 distToPlayer; - s32 nextAnim = this->animationIdx; + s32 nextAnimIndex = this->animIndex; s32 animFinished; s16 yaw; @@ -2996,25 +3008,26 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { if (this->actor.speedXZ >= 6.0f) { this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.3f; - nextAnim = ENHORSE_ANIM_GALLOP; + nextAnimIndex = ENHORSE_ANIM_GALLOP; } else if (this->actor.speedXZ >= 3.0f) { this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.375f; - nextAnim = ENHORSE_ANIM_TROT; + nextAnimIndex = ENHORSE_ANIM_TROT; } else if (this->actor.speedXZ > 0.1f) { this->skin.skelAnime.playSpeed = this->actor.speedXZ * 0.75f; - nextAnim = ENHORSE_ANIM_WALK; + nextAnimIndex = ENHORSE_ANIM_WALK; EnHorse_PlayWalkingSound(this); } else { if (Rand_ZeroOne() > 0.5f) { - nextAnim = ENHORSE_ANIM_WHINNEY; + nextAnimIndex = ENHORSE_ANIM_WHINNY; } else { - nextAnim = ENHORSE_ANIM_IDLE; + nextAnimIndex = ENHORSE_ANIM_IDLE; } EnHorse_IdleAnimSounds(this, play); this->skin.skelAnime.playSpeed = 1.0f; } - if ((nextAnim == ENHORSE_ANIM_GALLOP) || (nextAnim == ENHORSE_ANIM_TROT) || (nextAnim == ENHORSE_ANIM_WALK)) { + if ((nextAnimIndex == ENHORSE_ANIM_GALLOP) || (nextAnimIndex == ENHORSE_ANIM_TROT) || + (nextAnimIndex == ENHORSE_ANIM_WALK)) { if (playerDistToHome < 300.0f) { yaw = player->actor.shape.rot.y; yaw += ((Actor_YawBetweenActors(&this->actor, &player->actor) > 0) ? 1 : -1) * 0x3FFF; @@ -3034,35 +3047,36 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { animFinished = SkelAnime_Update(&this->skin.skelAnime); - if (((this->animationIdx == ENHORSE_ANIM_IDLE) || (this->animationIdx == ENHORSE_ANIM_WHINNEY)) && - ((nextAnim == ENHORSE_ANIM_GALLOP) || (nextAnim == ENHORSE_ANIM_TROT) || (nextAnim == ENHORSE_ANIM_WALK))) { - this->animationIdx = nextAnim; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][nextAnim]), ANIMMODE_ONCE, -3.0f); - if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + if (((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) && + ((nextAnimIndex == ENHORSE_ANIM_GALLOP) || (nextAnimIndex == ENHORSE_ANIM_TROT) || + (nextAnimIndex == ENHORSE_ANIM_WALK))) { + this->animIndex = nextAnimIndex; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][nextAnimIndex]), ANIMMODE_ONCE, -3.0f); + if (this->animIndex == ENHORSE_ANIM_GALLOP) { func_8087C1C0(this); - } else if (this->animationIdx == ENHORSE_ANIM_TROT) { + } else if (this->animIndex == ENHORSE_ANIM_TROT) { func_8087C178(this); } } else if (animFinished) { - if (nextAnim == ENHORSE_ANIM_GALLOP) { + if (nextAnimIndex == ENHORSE_ANIM_GALLOP) { func_8087C1C0(this); - } else if (nextAnim == ENHORSE_ANIM_TROT) { + } else if (nextAnimIndex == ENHORSE_ANIM_TROT) { func_8087C178(this); } - if ((this->animationIdx == ENHORSE_ANIM_IDLE) || (this->animationIdx == ENHORSE_ANIM_WHINNEY)) { - if (nextAnim != this->animationIdx) { - this->animationIdx = nextAnim; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), - ANIMMODE_ONCE, -3.0f); + if ((this->animIndex == ENHORSE_ANIM_IDLE) || (this->animIndex == ENHORSE_ANIM_WHINNY)) { + if (nextAnimIndex != this->animIndex) { + this->animIndex = nextAnimIndex; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, + -3.0f); } else { if (Rand_ZeroOne() > 0.5f) { - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; } else { - this->animationIdx = ENHORSE_ANIM_WHINNEY; + this->animIndex = ENHORSE_ANIM_WHINNY; if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_GROAN); @@ -3071,26 +3085,25 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { } } } - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), - ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, + -3.0f); } - } else if (nextAnim != this->animationIdx) { - this->animationIdx = nextAnim; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + } else if (nextAnimIndex != this->animIndex) { + this->animIndex = nextAnimIndex; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } - } else if ((this->animationIdx == ENHORSE_ANIM_WALK) && - ((nextAnim == ENHORSE_ANIM_IDLE) || (nextAnim == ENHORSE_ANIM_WHINNEY))) { - this->animationIdx = nextAnim; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - -3.0f); + } else if ((this->animIndex == ENHORSE_ANIM_WALK) && + ((nextAnimIndex == ENHORSE_ANIM_IDLE) || (nextAnimIndex == ENHORSE_ANIM_WHINNY))) { + this->animIndex = nextAnimIndex; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } } @@ -3107,21 +3120,20 @@ void func_80883B70(EnHorse* this, CsCmdActorAction* action) { void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); - this->animationIdx = ENHORSE_ANIM_IDLE; + this->animIndex = ENHORSE_ANIM_IDLE; this->unk_3E0 = 1; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); this->stateFlags |= ENHORSE_SANDDUST_SOUND; } void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { EnHorse_IdleAnimSounds(this, play); if (SkelAnime_Update(&this->skin.skelAnime)) { - this->animationIdx = ENHORSE_ANIM_IDLE; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + this->animIndex = ENHORSE_ANIM_IDLE; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } @@ -3168,36 +3180,34 @@ void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorAction* action) { void func_80884010(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 5; - this->animationIdx = ENHORSE_ANIM_WALK; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + this->animIndex = ENHORSE_ANIM_WALK; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { EnHorse_PlayWalkingSound(this); Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } void func_80884194(EnHorse* this, PlayState* play, CsCmdActorAction* action) { func_80883B70(this, action); this->unk_3E0 = 6; - this->animationIdx = ENHORSE_ANIM_GALLOP; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + this->animIndex = ENHORSE_ANIM_GALLOP; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); func_8087C1C0(this); } void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action) { Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); if (SkelAnime_Update(&this->skin.skelAnime)) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); func_8087C1C0(this); } } @@ -3269,7 +3279,7 @@ void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { void func_808846F0(EnHorse* this, PlayState* play) { this->playerControlled = false; - this->action = ENHORSE_ACT_21; + this->action = ENHORSE_ACTION_21; this->unk_3E0 = -1; this->actor.speedXZ = 0.0f; } @@ -3307,9 +3317,9 @@ void func_80884718(EnHorse* this, PlayState* play) { } void func_80884868(EnHorse* this) { - this->action = ENHORSE_ACT_23; - this->animationIdx = ENHORSE_ANIM_WALK; - Animation_PlayLoop(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + this->action = ENHORSE_ACTION_23; + this->animIndex = ENHORSE_ANIM_WALK; + Animation_PlayLoop(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); this->stateFlags |= ENHORSE_UNRIDEABLE; } @@ -3329,10 +3339,10 @@ void func_808848C8(EnHorse* this, PlayState* play) { void func_80884994(EnHorse* this) { this->unk_534 = -1; - this->animationIdx = ENHORSE_ANIM_TROT; - this->action = ENHORSE_ACT_24; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 2.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); + this->animIndex = ENHORSE_ANIM_TROT; + this->action = ENHORSE_ACTION_24; + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 2.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } void func_80884A40(EnHorse* this, PlayState* play) { @@ -3340,43 +3350,42 @@ void func_80884A40(EnHorse* this, PlayState* play) { s32 sp40; s32 temp_v0; - if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { + if (this->animIndex == ENHORSE_ANIM_WHINNY) { temp_v0 = ENHORSE_ANIM_IDLE; } else { - temp_v0 = this->animationIdx; + temp_v0 = this->animIndex; } sp40 = sp44[this->unk_538] != temp_v0; if (SkelAnime_Update(&this->skin.skelAnime) || sp40) { - this->animationIdx = sp44[this->unk_538]; - if ((this->animationIdx == ENHORSE_ANIM_IDLE) && (Rand_ZeroOne() < 0.5f)) { - this->animationIdx = ENHORSE_ANIM_WHINNEY; + this->animIndex = sp44[this->unk_538]; + if ((this->animIndex == ENHORSE_ANIM_IDLE) && (Rand_ZeroOne() < 0.5f)) { + this->animIndex = ENHORSE_ANIM_WHINNY; } if (sp40) { - if (this->animationIdx == ENHORSE_ANIM_IDLE) { - Animation_MorphToPlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - -3.0f); + if (this->animIndex == ENHORSE_ANIM_IDLE) { + Animation_MorphToPlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], -3.0f); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 2.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), - ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 2.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, + -3.0f); } - } else if (this->animationIdx == ENHORSE_ANIM_IDLE) { - Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]); + } else if (this->animIndex == ENHORSE_ANIM_IDLE) { + Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex]); } else { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], 2.0f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 2.0f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } 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 == OBJ_UM_ANIM_IDLE) { - if (this->animationIdx == ENHORSE_ANIM_IDLE) { + if (this->animIndex == ENHORSE_ANIM_IDLE) { EnHorse_IdleAnimSounds(this, play); - } else if (this->animationIdx == ENHORSE_ANIM_WHINNEY) { + } else if (this->animIndex == ENHORSE_ANIM_WHINNY) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HORSE_GROAN); } } @@ -3387,14 +3396,14 @@ void func_80884D04(EnHorse* this, PlayState* play) { f32 playSpeed; this->actor.speedXZ = 10.0f; - this->action = ENHORSE_ACT_25; + this->action = ENHORSE_ACTION_25; this->unk_540 = this->actor.world.pos; Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_INGO_HORSE_NEIGH); - this->animationIdx = ENHORSE_ANIM_GALLOP; + this->animIndex = ENHORSE_ANIM_GALLOP; playSpeed = this->actor.speedXZ * 0.2f; - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * playSpeed * 2.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * playSpeed * 2.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } // Action func: EnHorse_UpdateBandit? @@ -3406,10 +3415,9 @@ void func_80884E0C(EnHorse* this, PlayState* play) { this->skin.skelAnime.playSpeed = playSpeed; if (SkelAnime_Update(&this->skin.skelAnime)) { - Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], - sPlaybackSpeeds[this->animationIdx] * playSpeed * 2.5f, 0.0f, - Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], + sPlaybackSpeeds[this->animIndex] * playSpeed * 2.5f, 0.0f, + Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_HORSE_RUN); } @@ -3421,7 +3429,7 @@ void func_80884E0C(EnHorse* this, PlayState* play) { if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) { this->rider->unk488 = 7; } else { - EnHorse_SetIngoAnimation(this->animationIdx, this->skin.skelAnime.curFrame, this->unk_394 & 1, + EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1, &this->rider->unk488); } @@ -3479,14 +3487,14 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, Collisio * 5: Obstructed behind */ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, s32 galloping) { - if (this->action != ENHORSE_ACT_HBA) { - if ((this->action == ENHORSE_ACT_MOUNTED_IDLE) || (this->action == ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING)) { + if (this->action != ENHORSE_ACTION_CS_UPDATE) { + if ((this->action == ENHORSE_ACTION_5) || (this->action == ENHORSE_ACTION_6)) { this->actor.world.pos = this->actor.prevPos; this->actor.world.rot.y -= 0x640; this->actor.speedXZ = 0.0f; this->actor.shape.rot.y = this->actor.world.rot.y; this->unk_1EC |= 4; - } else if (this->action == ENHORSE_ACT_25) { + } else if (this->action == ENHORSE_ACTION_25) { this->unk_1EC |= 0x80; this->actor.world.pos = this->actor.prevPos; this->actor.speedXZ = 0.0f; @@ -3495,8 +3503,8 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, this->actor.world.pos = this->lastPos; this->stateFlags |= ENHORSE_OBSTACLE; if (this->playerControlled == 0) { - if (this->animationIdx != 3) {} - } else if (this->action != ENHORSE_ACT_REVERSE) { + if (this->animIndex != 3) {} + } else if (this->action != ENHORSE_ACTION_MOUNTED_REARING) { if (this->stateFlags & ENHORSE_JUMPING) { this->stateFlags &= ~ENHORSE_JUMPING; this->actor.gravity = -3.5f; @@ -3768,7 +3776,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { } if ((this->stateFlags & ENHORSE_JUMPING) || (this->stateFlags & ENHORSE_FLAG_28) || (this->actor.speedXZ < 0.0f) || - (this->action == ENHORSE_ACT_LOW_JUMP) || (this->action == ENHORSE_ACT_REVERSE)) { + (this->action == ENHORSE_ACTION_STOPPING) || (this->action == ENHORSE_ACTION_MOUNTED_REARING)) { return; } @@ -3867,7 +3875,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { (Math3D_DistPlaneToPos(COLPOLY_GET_NORMAL(obstacleFloor->normal.x), COLPOLY_GET_NORMAL(obstacleFloor->normal.y), COLPOLY_GET_NORMAL(obstacleFloor->normal.z), obstacleFloor->dist, &this->actor.world.pos) > 40.0f)) { - if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && + if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); @@ -3880,7 +3888,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) && - (this->action != ENHORSE_ACT_LOW_JUMP) && (play->sceneNum != SCENE_KOEPONARACE)) { + (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } @@ -3898,11 +3906,11 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if (((obstacleTop.y < intersect.y) && ((horseGameCheck == NULL) || (horseGameCheck->actor.id != ACTOR_EN_HORSE_GAME_CHECK) || ((horseGameCheck->actor.params & 0xFF) != 5))) || - ((this->stateFlags & ENHORSE_CANT_JUMP) && (this->action != ENHORSE_ACT_MOUNTED_IDLE))) { + ((this->stateFlags & ENHORSE_CANT_JUMP) && (this->action != ENHORSE_ACTION_5))) { return; } - if ((this->action == ENHORSE_ACT_MOUNTED_IDLE) && !(this->stateFlags & ENHORSE_FLAG_30)) { + if ((this->action == ENHORSE_ACTION_5) && !(this->stateFlags & ENHORSE_FLAG_30)) { horseGameCheck = DynaPoly_GetActor(&play->colCtx, bgId); if ((horseGameCheck != NULL) && (horseGameCheck->actor.id == ACTOR_EN_HORSE_GAME_CHECK) && ((horseGameCheck->actor.params & 0xFF) == 5)) { @@ -3942,13 +3950,13 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y); if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { - if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && + if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -70.0f) { - if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACT_LOW_JUMP) && + if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); @@ -3982,8 +3990,8 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { void func_80886C00(EnHorse* this, PlayState* play) { Input* input = &play->state.input[this->unk_52C]; - if (((this->action == ENHORSE_ACT_MOUNTED_GALLOP) || (this->action == ENHORSE_ACT_MOUNTED_REARING) || - (this->action == ENHORSE_ACT_STOPPING)) && + if (((this->action == ENHORSE_ACTION_MOUNTED_WALK) || (this->action == ENHORSE_ACTION_MOUNTED_TROT) || + (this->action == ENHORSE_ACTION_MOUNTED_GALLOP)) && (CHECK_BTN_ALL(input->press.button, BTN_A) || (func_801A5100() == 5)) && (play->interfaceCtx.unk_212 == 8) && !(this->stateFlags & ENHORSE_BOOST) && !(this->stateFlags & ENHORSE_FLAG_8) && !(this->stateFlags & ENHORSE_FLAG_9)) { @@ -4017,22 +4025,13 @@ void func_80886C00(EnHorse* this, PlayState* play) { } void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { - s32 playSfx; - if ((this->numBoosts < 6) && (this->numBoosts > 0)) { this->boostRegenTime--; this->boostTimer++; if (this->boostRegenTime <= 0) { this->numBoosts++; - if (((this->action == ENHORSE_ACT_MOUNTED_TURN) || (this->action == ENHORSE_ACT_FROZEN) || - (this->action == ENHORSE_ACT_MOUNTED_WALK)) && - !(this->stateFlags & ENHORSE_FLAG_19) && !(this->stateFlags & ENHORSE_FLAG_25)) { - playSfx = true; - } else { - playSfx = false; - } - if (!playSfx) { + if (!EN_HORSE_CHECK_4(this)) { play_sound(NA_SE_SY_CARROT_RECOVER); } @@ -4046,15 +4045,8 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { if (this->boostRegenTime <= 0) { this->boostRegenTime = 0; this->numBoosts = 6; - if (((this->action == ENHORSE_ACT_MOUNTED_TURN) || (this->action == ENHORSE_ACT_FROZEN) || - (this->action == ENHORSE_ACT_MOUNTED_WALK)) && - !(this->stateFlags & ENHORSE_FLAG_19) && !(this->stateFlags & ENHORSE_FLAG_25)) { - playSfx = true; - } else { - playSfx = false; - } - if (!playSfx) { + if (!EN_HORSE_CHECK_4(this)) { play_sound(NA_SE_SY_CARROT_RECOVER); } } @@ -4147,32 +4139,32 @@ s32 EnHorse_RandInt(f32 arg0) { } static EnHorseActionFunc sActionFuncs[] = { - EnHorse_Frozen, - EnHorse_Inactive, - EnHorse_Idle, - EnHorse_FollowPlayer, - EnHorse_UpdateIngoRace, - func_808819D8, - func_80881398, - EnHorse_MountedIdle, - EnHorse_MountedIdleWhinneying, - EnHorse_MountedTurn, - EnHorse_MountedWalk, - EnHorse_MountedTrot, - EnHorse_MountedGallop, - EnHorse_MountedRearing, - EnHorse_Stopping, - EnHorse_Reverse, - EnHorse_LowJump, - EnHorse_HighJump, - EnHorse_CutsceneUpdate, - EnHorse_UpdateHorsebackArchery, - EnHorse_FleePlayer, - func_80884718, - func_8087CA04, - func_808848C8, - func_80884A40, - func_80884E0C, + EnHorse_Frozen, // ENHORSE_ACTION_FROZEN + EnHorse_Inactive, // ENHORSE_ACTION_INACTIVE + EnHorse_Idle, // ENHORSE_ACTION_IDLE + EnHorse_FollowPlayer, // ENHORSE_ACTION_FOLLOW_PLAYER + EnHorse_UpdateIngoRace, // ENHORSE_ACTION_INGO_RACE + func_808819D8, // ENHORSE_ACTION_5 + func_80881398, // ENHORSE_ACTION_6 + EnHorse_MountedIdle, // ENHORSE_ACTION_MOUNTED_IDLE + EnHorse_MountedIdleWhinnying, // ENHORSE_ACTION_MOUNTED_IDLE_WHINNYING + EnHorse_MountedTurn, // ENHORSE_ACTION_MOUNTED_TURN + EnHorse_MountedWalk, // ENHORSE_ACTION_MOUNTED_WALK + EnHorse_MountedTrot, // ENHORSE_ACTION_MOUNTED_TROT + EnHorse_MountedGallop, // ENHORSE_ACTION_MOUNTED_GALLOP + EnHorse_MountedRearing, // ENHORSE_ACTION_MOUNTED_REARING + EnHorse_Stopping, // ENHORSE_ACTION_STOPPING + EnHorse_Reverse, // ENHORSE_ACTION_REVERSE + EnHorse_LowJump, // ENHORSE_ACTION_LOW_JUMP + EnHorse_HighJump, // ENHORSE_ACTION_HIGH_JUMP + EnHorse_CutsceneUpdate, // ENHORSE_ACTION_CS_UPDATE + EnHorse_UpdateHorsebackArchery, // ENHORSE_ACTION_HBA + EnHorse_FleePlayer, // ENHORSE_ACTION_FLEE_PLAYER + func_80884718, // ENHORSE_ACTION_21 + func_8087CA04, // ENHORSE_ACTION_22 + func_808848C8, // ENHORSE_ACTION_23 + func_80884A40, // ENHORSE_ACTION_24 + func_80884E0C, // ENHORSE_ACTION_25 }; void EnHorse_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; @@ -4202,7 +4194,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->stateFlags &= ~ENHORSE_FLAG_20; EnHorse_StartRearing(this); } else if (!(this->stateFlags & ENHORSE_FLAG_20) && (this->stateFlags & ENHORSE_FLAG_21) && - (this->action != ENHORSE_ACT_REVERSE) && (this->inRace == true)) { + (this->action != ENHORSE_ACTION_MOUNTED_REARING) && (this->inRace == true)) { this->stateFlags &= ~ENHORSE_FLAG_21; EnHorse_StartRearing(this); } @@ -4212,7 +4204,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->stateFlags &= ~ENHORSE_OBSTACLE; this->unk_3EC = thisx->world.rot.y; - if ((this->animationIdx == ENHORSE_ANIM_STOPPING) || (this->animationIdx == ENHORSE_ANIM_REARING)) { + if ((this->animIndex == ENHORSE_ANIM_STOPPING) || (this->animIndex == ENHORSE_ANIM_REARING)) { this->skin.skelAnime.jointTable[0].y += 0x154; } @@ -4220,8 +4212,8 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->lastPos = thisx->world.pos; if (!(this->stateFlags & ENHORSE_INACTIVE)) { - if ((this->action == ENHORSE_ACT_STOPPING) || (this->action == ENHORSE_ACT_MOUNTED_REARING) || - (this->action == ENHORSE_ACT_MOUNTED_GALLOP)) { + if ((this->action == ENHORSE_ACTION_MOUNTED_GALLOP) || (this->action == ENHORSE_ACTION_MOUNTED_TROT) || + (this->action == ENHORSE_ACTION_MOUNTED_WALK)) { func_80886C00(this, play); } @@ -4233,19 +4225,19 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { thisx->speedXZ = 0.0f; } - if (this->action != ENHORSE_ACT_25) { + if (this->action != ENHORSE_ACTION_25) { Actor_MoveWithGravity(&this->actor); } if (this->rider != NULL) { - if ((this->action == ENHORSE_ACT_INGO_RACE) || (this->action == ENHORSE_ACT_MOUNTED_IDLE) || - (this->action == ENHORSE_ACT_25)) { + if ((this->action == ENHORSE_ACTION_INGO_RACE) || (this->action == ENHORSE_ACTION_5) || + (this->action == ENHORSE_ACTION_25)) { this->rider->actor.world.pos.x = thisx->world.pos.x; this->rider->actor.world.pos.y = thisx->world.pos.y + 10.0f; this->rider->actor.world.pos.z = thisx->world.pos.z; this->rider->actor.shape.rot.x = thisx->shape.rot.x; this->rider->actor.shape.rot.y = thisx->shape.rot.y; - } else if (this->action == ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING) { + } else if (this->action == ENHORSE_ACTION_6) { EnIn* in = this->rider; s16 jnt = in->jointTable[0].y; @@ -4271,8 +4263,8 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } } - if ((this->action != ENHORSE_ACT_INGO_RACE) && (this->action != ENHORSE_ACT_MOUNTED_IDLE) && - (this->action != ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING)) { + if ((this->action != ENHORSE_ACTION_INGO_RACE) && (this->action != ENHORSE_ACTION_5) && + (this->action != ENHORSE_ACTION_6)) { EnHorse_TiltBody(this, play); } @@ -4329,7 +4321,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder2.base); } - if ((player->stateFlags1 & ENHORSE_BOOST) && (player->rideActor != NULL)) { + if ((player->stateFlags1 & PLAYER_STATE1_1) && (player->rideActor != NULL)) { EnHorse_UpdateConveyors(this, play); } @@ -4431,11 +4423,11 @@ s32 EnHorse_MountSideCheck(EnHorse* this, PlayState* play, Player* player) { } s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play) { - if (this->action != ENHORSE_ACT_IDLE) { + if (this->action != ENHORSE_ACTION_IDLE) { return 0; } - if ((this->animationIdx != ENHORSE_ANIM_IDLE) && (this->animationIdx != ENHORSE_ANIM_WHINNEY)) { + if ((this->animIndex != ENHORSE_ANIM_IDLE) && (this->animIndex != ENHORSE_ANIM_WHINNY)) { return 0; } @@ -4485,7 +4477,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sp38, &this->unk_218, &sp34); - if ((this->animationIdx == ENHORSE_ANIM_IDLE) && (this->action != ENHORSE_ACT_FROZEN) && + if ((this->animIndex == ENHORSE_ANIM_IDLE) && (this->action != ENHORSE_ACTION_FROZEN) && (((curFrame > 40.0f) && (curFrame < 45.0f) && (this->type == 0)) || ((curFrame > 28.0f) && (curFrame < 33.0f) && (this->type == 1)))) { if (Rand_ZeroOne() < 0.02f) { @@ -4494,7 +4486,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { this->frontRightHoof.y -= 5.0f; } } else { - if (this->action == ENHORSE_ACT_LOW_JUMP) { + if (this->action == ENHORSE_ACTION_STOPPING) { if (((curFrame > 10.0f) && (curFrame < 13.0f)) || ((curFrame > 25.0f) && (curFrame < 33.0f))) { if (Rand_ZeroOne() < 0.02f) { this->dustFlags |= 2; @@ -4539,7 +4531,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } EnHorse_RandomOffset(&sp64, 10.0f, &this->backRightHoof); } - } else if (this->animationIdx == ENHORSE_ANIM_GALLOP) { + } else if (this->animIndex == ENHORSE_ANIM_GALLOP) { if ((curFrame > 14.0f) && (curFrame < 16.0f) && (Rand_ZeroOne() < 0.02f)) { this->dustFlags |= 1; if (this->type == HORSE_TYPE_2) { @@ -4573,7 +4565,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } EnHorse_RandomOffset(&sp64, 10.0f, &this->backLeftHoof); } - } else if ((this->action == ENHORSE_ACT_BRIDGE_JUMP) && (curFrame > 6.0f) && + } else if ((this->action == ENHORSE_ACTION_LOW_JUMP) && (curFrame > 6.0f) && (Rand_ZeroOne() < (1.0f - ((curFrame - 6.0f) * (1.0f / 17.0f))))) { if (Rand_ZeroOne() < 0.05f) { this->dustFlags |= 8; @@ -4593,7 +4585,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } EnHorse_RandomOffset(&sp64, 10.0f, &this->backRightHoof); } - } else if ((this->action == ENHORSE_ACT_CS_UPDATE) && (curFrame > 5.0f)) { + } else if ((this->action == ENHORSE_ACTION_HIGH_JUMP) && (curFrame > 5.0f)) { if (Rand_ZeroOne() < (1.0f - ((curFrame - 5.0f) * 0.04f))) { if (Rand_ZeroOne() < 0.05f) { this->dustFlags |= 8; 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 9f32331c6..97ab2c898 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -46,33 +46,33 @@ typedef void (*EnHorseCsFunc)(struct EnHorse*, PlayState*, CsCmdActorAction*); #define ENHORSE_FLAG_30 (1 << 30) /* 0x40000000 */ #define ENHORSE_FLAG_31 (1 << 31) /* 0x80000000 */ -typedef enum { - /* 0 */ ENHORSE_ACT_FROZEN, - /* 1 */ ENHORSE_ACT_INACTIVE, - /* 2 */ ENHORSE_ACT_IDLE, - /* 3 */ ENHORSE_ACT_FOLLOW_PLAYER, - /* 4 */ ENHORSE_ACT_INGO_RACE, - /* 5 */ ENHORSE_ACT_MOUNTED_IDLE, - /* 6 */ ENHORSE_ACT_MOUNTED_IDLE_WHINNEYING, - /* 7 */ ENHORSE_ACT_MOUNTED_TURN, - /* 8 */ ENHORSE_ACT_MOUNTED_WALK, - /* 9 */ ENHORSE_ACT_MOUNTED_TROT, - /* 10 */ ENHORSE_ACT_MOUNTED_GALLOP, - /* 11 */ ENHORSE_ACT_MOUNTED_REARING, - /* 12 */ ENHORSE_ACT_STOPPING, - /* 13 */ ENHORSE_ACT_REVERSE, - /* 14 */ ENHORSE_ACT_LOW_JUMP, - /* 15 */ ENHORSE_ACT_HIGH_JUMP, - /* 16 */ ENHORSE_ACT_BRIDGE_JUMP, - /* 17 */ ENHORSE_ACT_CS_UPDATE, - /* 18 */ ENHORSE_ACT_HBA, - /* 19 */ ENHORSE_ACT_FLEE_PLAYER, - /* 20 */ ENHORSE_ACT_20, - /* 21 */ ENHORSE_ACT_21, - /* 22 */ ENHORSE_ACT_22, - /* 23 */ ENHORSE_ACT_23, - /* 24 */ ENHORSE_ACT_24, - /* 25 */ ENHORSE_ACT_25, +typedef enum EnHorseAction { + /* 0 */ ENHORSE_ACTION_FROZEN, + /* 1 */ ENHORSE_ACTION_INACTIVE, + /* 2 */ ENHORSE_ACTION_IDLE, + /* 3 */ ENHORSE_ACTION_FOLLOW_PLAYER, + /* 4 */ ENHORSE_ACTION_INGO_RACE, + /* 5 */ ENHORSE_ACTION_5, + /* 6 */ ENHORSE_ACTION_6, + /* 7 */ ENHORSE_ACTION_MOUNTED_IDLE, + /* 8 */ ENHORSE_ACTION_MOUNTED_IDLE_WHINNYING, + /* 9 */ ENHORSE_ACTION_MOUNTED_TURN, + /* 10 */ ENHORSE_ACTION_MOUNTED_WALK, + /* 11 */ ENHORSE_ACTION_MOUNTED_TROT, + /* 12 */ ENHORSE_ACTION_MOUNTED_GALLOP, + /* 13 */ ENHORSE_ACTION_MOUNTED_REARING, + /* 14 */ ENHORSE_ACTION_STOPPING, + /* 15 */ ENHORSE_ACTION_REVERSE, + /* 16 */ ENHORSE_ACTION_LOW_JUMP, + /* 17 */ ENHORSE_ACTION_HIGH_JUMP, + /* 18 */ ENHORSE_ACTION_CS_UPDATE, + /* 19 */ ENHORSE_ACTION_HBA, + /* 20 */ ENHORSE_ACTION_FLEE_PLAYER, + /* 21 */ ENHORSE_ACTION_21, + /* 22 */ ENHORSE_ACTION_22, + /* 23 */ ENHORSE_ACTION_23, + /* 24 */ ENHORSE_ACTION_24, + /* 25 */ ENHORSE_ACTION_25 } EnHorseAction; typedef enum { @@ -84,18 +84,6 @@ typedef enum { /* 5 */ PLAYER_DIR_SIDE_L } EnHorsePlayerDir; -typedef enum { - /* 0 */ ENHORSE_ANIM_IDLE, - /* 1 */ ENHORSE_ANIM_WHINNEY, - /* 2 */ ENHORSE_ANIM_STOPPING, - /* 3 */ ENHORSE_ANIM_REARING, - /* 4 */ ENHORSE_ANIM_WALK, - /* 5 */ ENHORSE_ANIM_TROT, - /* 6 */ ENHORSE_ANIM_GALLOP, - /* 7 */ ENHORSE_ANIM_LOW_JUMP, - /* 8 */ ENHORSE_ANIM_HIGH_JUMP -} EnHorseAnimationIndex; - typedef enum { /* 0 */ HORSE_TYPE_EPONA, /* 1 */ HORSE_TYPE_HNI, @@ -144,7 +132,7 @@ typedef enum { typedef struct EnHorse { /* 0x000 */ Actor actor; - /* 0x144 */ s32 action; + /* 0x144 */ EnHorseAction action; /* 0x148 */ s32 noInputTimer; /* 0x14C */ s32 noInputTimerMax; /* 0x150 */ s32 type; @@ -157,7 +145,7 @@ typedef struct EnHorse { /* 0x200 */ s32 curRaceWaypoint; /* 0x204 */ s32 boostSpeed; /* 0x208 */ s32 playerControlled; - /* 0x20C */ s32 animationIdx; + /* 0x20C */ s32 animIndex; /* 0x210 */ f32 curFrame; /* 0x214 */ s32 soundTimer; /* 0x218 */ Vec3f unk_218; @@ -232,6 +220,19 @@ typedef struct EnHorse { /* 0x590 */ s32 unk_590; } EnHorse; // size = 0x594 -extern const ActorInit En_Horse_InitVars; +#define EN_HORSE_CHECK_1(horseActor) (((horseActor)->stateFlags & ENHORSE_FLAG_6) ? true : false) + +#define EN_HORSE_CHECK_2(horseActor) (((horseActor)->stateFlags & ENHORSE_FLAG_8) ? true : false) + +#define EN_HORSE_CHECK_3(horseActor) (((horseActor)->stateFlags & ENHORSE_FLAG_9) ? true : false) + +#define EN_HORSE_CHECK_4(horseActor) \ + (((((horseActor)->action == ENHORSE_ACTION_MOUNTED_IDLE) || ((horseActor)->action == ENHORSE_ACTION_FROZEN) || \ + ((horseActor)->action == ENHORSE_ACTION_MOUNTED_IDLE_WHINNYING)) && \ + !((horseActor)->stateFlags & ENHORSE_FLAG_19) && !((horseActor)->stateFlags & ENHORSE_FLAG_25)) \ + ? true \ + : false) + +#define EN_HORSE_CHECK_JUMPING(horseActor) (((horseActor)->stateFlags & ENHORSE_JUMPING) ? true : false) #endif // Z_EN_HORSE_H 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 f3ec0c245..1d2d0352c 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 @@ -138,8 +138,8 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { this->unk_17C = -1; Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_FREE0); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &mainCamAt, &mainCamEye); - Play_CameraSetFov(play, CAM_ID_MAIN, 45.0f); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &mainCamAt, &mainCamEye); + Play_SetCameraFov(play, CAM_ID_MAIN, 45.0f); func_800FE484(); return false; } @@ -152,7 +152,7 @@ s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play) { s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->nextEntranceIndex == 0xCE20) { + if (play->nextEntrance == ENTRANCE(GORMAN_TRACK, 2)) { return false; } @@ -172,7 +172,7 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) { if (player->stateFlags1 & 0x800000) { D_801BDAA0 = 1; } - play->nextEntranceIndex = 0xCE20; + play->nextEntrance = ENTRANCE(GORMAN_TRACK, 2); 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 15a735128..5fec47594 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -162,7 +162,7 @@ void func_80953098(EnHs* this, PlayState* play) { this->actionFunc = func_8095345C; this->actor.flags |= ACTOR_FLAG_10000; this->stateFlags |= 0x10; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { this->stateFlags |= 8; if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { @@ -216,7 +216,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->nextEntrance = play->setupExitList[HS_GET_EXIT_INDEX(&this->actor)]; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[25] |= 8; this->actionFunc = EnHs_DoNothing; @@ -264,7 +264,7 @@ void func_8095345C(EnHs* this, PlayState* play) { this->actionFunc = func_80953354; this->stateTimer = 40; } else if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_10000)) { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); this->stateFlags |= 1; } else if ((this->actor.xzDistToPlayer < 120.0f) && Player_IsFacingActor(&this->actor, 0x2000, play)) { func_800B8614(&this->actor, play, 130.0f); 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 cf24adfd0..bc1ca559b 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -143,7 +143,7 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -237,7 +237,7 @@ s32 func_80BF1284(EnIg* this, s32 arg1) { if (phi_v1) { this->unk_3FC = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_3D4 = this->skelAnime.playSpeed; } @@ -950,7 +950,7 @@ void EnIg_Update(Actor* thisx, PlayState* play) { func_80BF1258(this); func_80BF13E4(this); func_80BF15EC(this); - func_8013C964(&this->actor, play, 60.0f, 30.0f, EXCH_ITEM_NONE, this->unk_3D0 & 7); + func_8013C964(&this->actor, play, 60.0f, 30.0f, PLAYER_AP_NONE, this->unk_3D0 & 7); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); func_80BF1354(this, play); 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 f1f8aff6e..a1c33264e 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -647,7 +647,7 @@ void EnIk_SetupReactToAttack(EnIk* this, s32 arg1) { 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); + Play_SetCameraAtEye(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) { @@ -742,7 +742,7 @@ void EnIk_PlayCutscene(EnIk* this, PlayState* play) { 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); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); } if (this->actor.colChkInfo.health != 0) { EnIk_SetupReactToAttack(this, false); 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 e7d37de26..e5f56d857 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -118,7 +118,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -146,19 +146,19 @@ static TrackOptionsSet sTrackOptions = { { 0x1770, 4, 1, 6 }, }; -s32 func_808F30B0(SkelAnime* skelAnime, s16 animIndex) { +s32 EnIn_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; s32 ret = false; if (animIndex >= 0 && animIndex < 18) { ret = true; - frameCount = sAnimations[animIndex].frameCount; + frameCount = sAnimationInfo[animIndex].frameCount; if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimations[animIndex].animation); + frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } - Animation_Change(skelAnime, sAnimations[animIndex].animation, sAnimations[animIndex].playSpeed, - sAnimations[animIndex].startFrame, frameCount, sAnimations[animIndex].mode, - sAnimations[animIndex].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } return ret; } @@ -274,7 +274,7 @@ void EnIn_DoNothing(EnIn* this, PlayState* play) { void func_808F3618(EnIn* this, PlayState* play) { if (ENIN_GET_PATH(&this->actor) != 0x3F) { - func_808F30B0(&this->skelAnime, 9); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_9); } if (ENIN_GET_PATH(&this->actor) != 0x3F) { this->actionFunc = func_808F3690; @@ -388,7 +388,7 @@ void func_808F3AD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } @@ -412,7 +412,7 @@ void func_808F3BD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } @@ -436,7 +436,7 @@ void func_808F3CD4(EnIn* this, PlayState* play) { this->unk48C = 1; this->actionFunc = func_808F5A94; } else { - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } @@ -819,7 +819,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3475: SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); - play->nextEntranceIndex = 0xCE50; + play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[57] |= 1; @@ -871,8 +871,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3476: Actor_ContinueText(play, &this->actor, 0x3477); - func_808F30B0(&this->skelAnime, 1); - func_808F30B0(&this->unk4A4->skelAnime, 7); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); + EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); ret = false; break; case 0x3477: @@ -881,8 +881,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; break; case 0x347A: - func_808F30B0(&this->skelAnime, 1); - func_808F30B0(&this->unk4A4->skelAnime, 7); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); + EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); if (INV_CONTENT(ITEM_MASK_GARO) == ITEM_MASK_GARO) { Actor_ContinueText(play, &this->actor, 0x347E); ret = false; @@ -1066,14 +1066,14 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3475: SET_RACE_FLAGS(RACE_FLAG_START); func_800FD750(NA_BGM_HORSE); - play->nextEntranceIndex = 0xCE50; + play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5); play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[57] |= 1; break; case 0x349D: - func_808F30B0(&this->skelAnime, 1); - func_808F30B0(&this->unk4A4->skelAnime, 7); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); + EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); if (INV_CONTENT(ITEM_MASK_GARO) == ITEM_MASK_GARO) { Actor_ContinueText(play, &this->actor, 0x34A1); ret = false; @@ -1118,8 +1118,8 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3499: Actor_ContinueText(play, &this->actor, 0x349A); - func_808F30B0(&this->skelAnime, 1); - func_808F30B0(&this->unk4A4->skelAnime, 7); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); + EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); ret = false; break; case 0x349A: @@ -1240,7 +1240,7 @@ s32 func_808F5728(PlayState* play, EnIn* this, s32 arg2, s32* arg3) { } return 0; } - if (!func_800B8934(play, &this->actor)) { + if (!Actor_OnScreen(play, &this->actor)) { return 0; } yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)); @@ -1358,7 +1358,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, 20); - func_808F30B0(&this->skelAnime, 0); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0); Collider_InitCylinder(play, &this->colliderCylinder); Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); @@ -1395,9 +1395,9 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->unk23C = 0; D_801BDAA0 = 0; if (GET_RACE_FLAGS == RACE_FLAG_2) { - func_808F30B0(&this->skelAnime, 6); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_6); } else { - func_808F30B0(&this->skelAnime, 4); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_4); } if (GET_RACE_FLAGS == RACE_FLAG_2) { this->skelAnime.curFrame = ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.endFrame; @@ -1414,7 +1414,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->unk4AC |= 2; if (type == ENIN_BLUE_SHIRT) { if (func_808F33B8()) { - func_808F30B0(&this->skelAnime, 0); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0); this->actionFunc = func_808F5A94; } else { if (gSaveContext.save.weekEventReg[52] & 1) { @@ -1423,7 +1423,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y, this->actor.shape.rot.z, 0xF); Actor_MarkForDeath(&this->actor); } else { - func_808F30B0(&this->skelAnime, 0); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0); this->actionFunc = func_808F5A94; } } @@ -1431,7 +1431,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { if (gSaveContext.save.weekEventReg[52] & 1) { Actor_MarkForDeath(&this->actor); } else { - func_808F30B0(&this->skelAnime, 7); + EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_7); this->actionFunc = func_808F5B58; } } 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 6c6a2f3dd..9221c94ce 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -15,6 +15,27 @@ typedef enum { /* 4 */ ENIN_BLUE_SHIRT } EnInType; +typedef enum { + /* 0 */ ENIN_ANIM_0, + /* 1 */ ENIN_ANIM_1, + /* 2 */ ENIN_ANIM_2, + /* 3 */ ENIN_ANIM_3, + /* 4 */ ENIN_ANIM_4, + /* 5 */ ENIN_ANIM_5, + /* 6 */ ENIN_ANIM_6, + /* 7 */ ENIN_ANIM_7, + /* 8 */ ENIN_ANIM_8, + /* 9 */ ENIN_ANIM_9, + /* 10 */ ENIN_ANIM_10, + /* 11 */ ENIN_ANIM_11, + /* 12 */ ENIN_ANIM_12, + /* 13 */ ENIN_ANIM_13, + /* 14 */ ENIN_ANIM_14, + /* 15 */ ENIN_ANIM_15, + /* 16 */ ENIN_ANIM_16, + /* 17 */ ENIN_ANIM_17, +} EnInAnimation; + #define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF) #define ENIN_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE @@ -25,7 +46,7 @@ typedef struct EnIn { /* 0x18C */ ColliderJntSph colliderJntSph; /* 0x1AC */ ColliderJntSphElement colliderJntSphElement; /* 0x1EC */ ColliderCylinder colliderCylinder; - /* 0x238 */ char unk238[0x4]; + /* 0x238 */ UNK_TYPE1 unk238[0x4]; /* 0x23C */ u8 unk23C; /* 0x23D */ u8 unk23D; /* 0x240 */ Path* path; @@ -39,19 +60,19 @@ typedef struct EnIn { /* 0x352 */ Vec3s trackTarget; /* 0x358 */ Vec3s headRot; /* 0x35E */ Vec3s torsoRot; - /* 0x364 */ char unk364[0x12]; + /* 0x364 */ UNK_TYPE1 unk364[0x12]; /* 0x376 */ s16 unk376[20]; /* 0x39E */ s16 unk39E[20]; - /* 0x3C6 */ char unk3C6[0xBC]; + /* 0x3C6 */ UNK_TYPE1 unk3C6[0xBC]; /* 0x482 */ s16 unk482; /* 0x484 */ s16 unk484; /* 0x486 */ s16 unk486; /* 0x488 */ s16 unk488; /* 0x48A */ u16 unk48A; /* 0x48C */ s32 unk48C; - /* 0x490 */ char unk490[0x4]; + /* 0x490 */ UNK_TYPE1 unk490[0x4]; /* 0x494 */ s32 unk494; - /* 0x498 */ char unk498[0xC]; + /* 0x498 */ UNK_TYPE1 unk498[0xC]; /* 0x4A4 */ struct EnIn* unk4A4; /* 0x4A8 */ s32 unk4A8; /* 0x4AC */ s32 unk4AC; 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 14ac9ccee..2ac167235 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1363,16 +1363,16 @@ void func_80B45648(EnInvadepoh* this) { } } -s32 func_80B456A8(PlayState* play, Vec3f* vec) { - Vec3f multDest; - f32 wDest; +s32 func_80B456A8(PlayState* play, Vec3f* worldPos) { + Vec3f projectedPos; + f32 invW; - Actor_GetProjectedPos(play, vec, &multDest, &wDest); - if (((multDest.z > 1.0f) && (fabsf(multDest.x * wDest) < 1.0f)) && (fabsf(multDest.y * wDest) < 1.0f)) { - s32 wX = (multDest.x * wDest * 160.0f) + 160.0f; - s32 wY = (multDest.y * wDest * -120.0f) + 120.0f; - s32 wZ = (s32)(multDest.z * wDest * 16352.0f) + 0x3FE0; - s32 zBuf = func_80178A94(wX, wY); + Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); + if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { + s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; + s32 zBuf = func_80178A94(screenPosX, screenPosY); if (wZ < zBuf) { return true; } @@ -1657,10 +1657,10 @@ void func_80B4627C(EnInvadepoh* this, PlayState* play) { func_80B46F88(this); } } else if (D_80B4E940 == 3) { - if (gSaveContext.save.entranceIndex == 0x6460) { + if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { func_80B471C0(this); - } else if (gSaveContext.save.entranceIndex == 0x6470) { + } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { func_80B47248(this); } else { func_80B47248(this); @@ -1757,7 +1757,7 @@ void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { } } else if (temp != 8) { if (temp == 9) { - if (gSaveContext.save.entranceIndex != 0x6460) { + if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { Actor_MarkForDeath(&this->actor); return; } @@ -1993,7 +1993,7 @@ void func_80B47108(EnInvadepoh* this, PlayState* play) { } this->actionTimer--; if (this->actionTimer <= 0) { - play->nextEntranceIndex = 0x6460; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_73; @@ -2011,7 +2011,7 @@ void func_80B471C0(EnInvadepoh* this) { void func_80B471E0(EnInvadepoh* this, PlayState* play) { if (D_80B4E998) { - play->nextEntranceIndex = 0x6470; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; @@ -2034,7 +2034,7 @@ void func_80B47278(EnInvadepoh* this) { } void func_80B47298(EnInvadepoh* this, PlayState* play) { - play->nextEntranceIndex = 0x6400; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_72; @@ -3453,7 +3453,7 @@ void func_80B4AF94(EnInvadepoh* this, PlayState* play) { func_80151BB4(play, 5); func_80B4ADB8(this); } else { - func_800B85E0(&this->actor, play, 2000.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 2000.0f, PLAYER_AP_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h index 3826397a8..cafae5f23 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -34,32 +34,32 @@ typedef enum { } EnInvadepohDirection; typedef struct unkStruct80B50350 { - /* 0x000 */ s8 unk0; - /* 0x001 */ s8 unk1; - /* 0x002 */ u8 unk2; - /* 0x004 */ Vec3f unk4; + /* 0x0 */ s8 unk0; + /* 0x1 */ s8 unk1; + /* 0x2 */ u8 unk2; + /* 0x4 */ Vec3f unk4; } unkStruct80B50350; // size = 0x10; typedef struct { - /* 0x00 */ s8* unk00; - /* 0x04 */ s8 unk04; -} unkstructInvadepoh0; // size = 0x08 + /* 0x0 */ s8* unk00; + /* 0x4 */ s8 unk04; +} unkstructInvadepoh0; // size = 0x8 typedef struct { - /* 0x00 */ s8 unk00; - /* 0x04 */ f32 unk04; -} unkstructInvadepoh1; // size = 0x08 + /* 0x0 */ s8 unk00; + /* 0x4 */ f32 unk04; +} unkstructInvadepoh1; // size = 0x8 typedef struct { - /* 0x00 */ s8 unk00; - /* 0x04 */ unkstructInvadepoh0* unk04; -} unkstructInvadepoh2; // size = 0x08 + /* 0x0 */ s8 unk00; + /* 0x4 */ unkstructInvadepoh0* unk04; +} unkstructInvadepoh2; // size = 0x8 typedef struct { - /* 0x00 */ s8 unk0; - /* 0x04 */ unkstructInvadepoh0* unk4; - /* 0x08 */ s8 unk8; - /* 0x0C */ unkstructInvadepoh1* unkC; + /* 0x0 */ s8 unk0; + /* 0x4 */ unkstructInvadepoh0* unk4; + /* 0x8 */ s8 unk8; + /* 0xC */ unkstructInvadepoh1* unkC; } unkstructInvadepoh3; // size = 0x10 typedef struct { @@ -72,38 +72,38 @@ typedef struct { } unkstructInvadepoh4; // size = 0x14 typedef struct { - /* 0x00 */ f32 unk00; - /* 0x04 */ s16 unk04; - /* 0x06 */ s16 unk06; -} unkstruct80B4EE0C; // size = 0x08 + /* 0x0 */ f32 unk00; + /* 0x4 */ s16 unk04; + /* 0x6 */ s16 unk06; +} unkstruct80B4EE0C; // size = 0x8 typedef struct EnInvadePohStruct { - /* 0x000 */ unkstructInvadepoh4* unk0; - /* 0x004 */ s8 unk4; - /* 0x008 */ unkstructInvadepoh4* unk8; - /* 0x00C */ s16 unkC; - /* 0x00E */ s8 unkE; - /* 0x00F */ s8 unkF; + /* 0x0 */ unkstructInvadepoh4* unk0; + /* 0x4 */ s8 unk4; + /* 0x8 */ unkstructInvadepoh4* unk8; + /* 0xC */ s16 unkC; + /* 0xE */ s8 unkE; + /* 0xF */ s8 unkF; } EnInvadePohStruct; // size = 0x10; typedef struct AlienBehaviorInfo { - /* 0x000 */ EnInvadePohStruct unk0; - /* 0x010 */ EnInvadePohStruct unk10; - /* 0x020 */ Vec3s unk20; - /* 0x026 */ Vec3s unk26; - /* 0x02C */ s16 unk2C; - /* 0x02E */ u16 unk2E; - /* 0x030 */ f32 unk30; - /* 0x034 */ f32 unk34; - /* 0x038 */ f32 unk38; - /* 0x03C */ f32 unk3C; - /* 0x040 */ s16 unk40; - /* 0x042 */ s16 unk42; - /* 0x044 */ f32 unk44; - /* 0x048 */ s16 unk48; - /* 0x04A */ char unk4A[0x2]; - /* 0x04C */ s16 unk4C; - /* 0x04E */ s16 unk4E; + /* 0x00 */ EnInvadePohStruct unk0; + /* 0x10 */ EnInvadePohStruct unk10; + /* 0x20 */ Vec3s unk20; + /* 0x26 */ Vec3s unk26; + /* 0x2C */ s16 unk2C; + /* 0x2E */ u16 unk2E; + /* 0x30 */ f32 unk30; + /* 0x34 */ f32 unk34; + /* 0x38 */ f32 unk38; + /* 0x3C */ f32 unk3C; + /* 0x40 */ s16 unk40; + /* 0x42 */ s16 unk42; + /* 0x44 */ f32 unk44; + /* 0x48 */ s16 unk48; + /* 0x4A */ UNK_TYPE1 unk4A[0x2]; + /* 0x4C */ s16 unk4C; + /* 0x4E */ s16 unk4E; } AlienBehaviorInfo; // size = 0x50 typedef struct EnInvadepoh { @@ -148,7 +148,7 @@ typedef struct EnInvadepoh { /* 0x3A8 */ s16 scaleAdjAngle; /* 0x3AA */ s16 unk3AA; /* 0x3AC */ s8 unk3AC; // index for D_80B4EDD0 - /* 0x3AD */ char unk3AD[0xF]; + /* 0x3AD */ UNK_TYPE1 unk3AD[0xF]; /* 0x3BC */ s8 unk3BC; } EnInvadepoh; // size = 0x3C0 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 aa2dce882..f615c05fe 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -89,7 +89,7 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_boj_Anim_002734, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_002734, 1.0f, 0, -1, 0, -4 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, -4 }, { &object_boj_Anim_004078, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_005CE4, 1.0f, 0, -1, 0, 0 }, @@ -105,7 +105,7 @@ s32 func_80BC192C(EnJa* this, s32 arg1) { if (arg1 != this->unk_36C) { this->unk_36C = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_344 = this->skelAnime.playSpeed; } @@ -385,7 +385,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) { radius = this->collider.dim.radius + 30; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_340 & 7); + func_8013C964(&this->actor, play, radius, height, PLAYER_AP_NONE, this->unk_340 & 7); if (this->unk_1D8.unk_00 != 2) { Actor_MoveWithGravity(&this->actor); 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 add52b0e4..bb5ec72ee 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -35,27 +35,27 @@ s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play); void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play); typedef enum { - /* 0 */ EN_JG_ANIMATION_IDLE, - /* 1 */ EN_JG_ANIMATION_WALK, - /* 2 */ EN_JG_ANIMATION_WAVING, - /* 3 */ EN_JG_ANIMATION_SHAKING_HEAD, - /* 4 */ EN_JG_ANIMATION_SURPRISE_START, - /* 5 */ EN_JG_ANIMATION_SURPRISE_LOOP, - /* 6 */ EN_JG_ANIMATION_ANGRY, - /* 7 */ EN_JG_ANIMATION_FROZEN_START, - /* 8 */ EN_JG_ANIMATION_FROZEN_LOOP, - /* 9 */ EN_JG_ANIMATION_WALK_2, - /* 10 */ EN_JG_ANIMATION_TAKING_OUT_DRUM, - /* 11 */ EN_JG_ANIMATION_DRUM_IDLE, - /* 12 */ EN_JG_ANIMATION_PLAYING_DRUM, - /* 13 */ EN_JG_ANIMATION_THINKING, - /* 14 */ EN_JG_ANIMATION_REMEMBERING, - /* 15 */ EN_JG_ANIMATION_STRONG_REMEMBERING, - /* 16 */ EN_JG_ANIMATION_DEPRESSED, - /* 17 */ EN_JG_ANIMATION_CUTSCENE_IDLE, - /* 18 */ EN_JG_ANIMATION_CRADLE, - /* 19 */ EN_JG_ANIMATION_MAX, -} EnJgAnimationIndex; + /* 0 */ EN_JG_ANIM_IDLE, + /* 1 */ EN_JG_ANIM_WALK, + /* 2 */ EN_JG_ANIM_WAVING, + /* 3 */ EN_JG_ANIM_SHAKING_HEAD, + /* 4 */ EN_JG_ANIM_SURPRISE_START, + /* 5 */ EN_JG_ANIM_SURPRISE_LOOP, + /* 6 */ EN_JG_ANIM_ANGRY, + /* 7 */ EN_JG_ANIM_FROZEN_START, + /* 8 */ EN_JG_ANIM_FROZEN_LOOP, + /* 9 */ EN_JG_ANIM_WALK_2, + /* 10 */ EN_JG_ANIM_TAKING_OUT_DRUM, + /* 11 */ EN_JG_ANIM_DRUM_IDLE, + /* 12 */ EN_JG_ANIM_PLAYING_DRUM, + /* 13 */ EN_JG_ANIM_THINKING, + /* 14 */ EN_JG_ANIM_REMEMBERING, + /* 15 */ EN_JG_ANIM_STRONG_REMEMBERING, + /* 16 */ EN_JG_ANIM_DEPRESSED, + /* 17 */ EN_JG_ANIM_CUTSCENE_IDLE, + /* 18 */ EN_JG_ANIM_CRADLE, + /* 19 */ EN_JG_ANIM_MAX, +} EnJgAnimation; typedef enum { /* 0x0 */ EN_JG_ACTION_FIRST_THAW, @@ -133,7 +133,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, { &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, { &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, @@ -177,7 +177,7 @@ Actor* EnJg_GetShrineGoronToFocusOn(PlayState* play, u8 focusedShrineGoronParam) while (actorIterator != NULL) { if ((actorIterator->id == ACTOR_EN_S_GORO) && - (EN_S_GORO_GET_PARAM_F(actorIterator) == focusedShrineGoronParam)) { + (EN_S_GORO_GET_MAIN_TYPE(actorIterator) == focusedShrineGoronParam)) { return actorIterator; } @@ -296,20 +296,20 @@ void EnJg_SetupGoronShrineCheer(EnJg* this) { void EnJg_SetupTalk(EnJg* this, PlayState* play) { switch (this->textId) { case 0xDAC: // What was I doing? - this->animationIndex = EN_JG_ANIMATION_SHAKING_HEAD; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_SHAKING_HEAD; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; case 0xDAD: // I must hurry! - this->animationIndex = EN_JG_ANIMATION_SURPRISE_START; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_SURPRISE_START; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_AlternateTalkOrWalkInPlace; break; case 0xDB7: // You're Darmani! - this->animationIndex = EN_JG_ANIMATION_SURPRISE_START; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_SURPRISE_START; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; @@ -319,8 +319,8 @@ void EnJg_SetupTalk(EnJg* this, PlayState* play) { case 0xDBA: // I've been made a fool of! case 0xDBD: // "...What?" case 0xDC4: // It's so cold I can't play - this->animationIndex = EN_JG_ANIMATION_IDLE; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_IDLE; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; @@ -328,15 +328,15 @@ void EnJg_SetupTalk(EnJg* this, PlayState* play) { case 0xDBB: // If I can see past the illusion, you'll vanish case 0xDBC: // Following me won't do you any good case 0xDC6: // I am counting on you - this->animationIndex = EN_JG_ANIMATION_ANGRY; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_ANGRY; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; case 0xDB4: // This is our problem (first) case 0xDB5: // This is our problem (repeat) - this->animationIndex = EN_JG_ANIMATION_WAVING; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_WAVING; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Talk; break; } @@ -417,23 +417,23 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (this->animationIndex == EN_JG_ANIMATION_SURPRISE_START) { + if (this->animIndex == EN_JG_ANIM_SURPRISE_START) { if (currentFrame == lastFrame) { - this->animationIndex = EN_JG_ANIMATION_SURPRISE_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } - } else if (this->animationIndex == EN_JG_ANIMATION_SURPRISE_LOOP) { + } else if (this->animIndex == EN_JG_ANIM_SURPRISE_LOOP) { if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; - this->animationIndex = EN_JG_ANIMATION_WALK; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_WALK; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Walk; } - } else if (this->animationIndex == EN_JG_ANIMATION_WALK) { + } else if (this->animIndex == EN_JG_ANIM_WALK) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(this, play); } @@ -455,7 +455,7 @@ void EnJg_Walk(EnJg* this, PlayState* play) { if (EnJg_ReachedPoint(this, this->path, this->currentPoint)) { if (this->currentPoint >= (this->path->count - 1)) { // Force the elder to walk in place - this->animationIndex = EN_JG_ANIMATION_WALK; + this->animIndex = EN_JG_ANIM_WALK; this->actionFunc = EnJg_AlternateTalkOrWalkInPlace; } else { this->currentPoint++; @@ -472,12 +472,12 @@ void EnJg_Walk(EnJg* this, PlayState* play) { void EnJg_Talk(EnJg* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); u16 temp; - if ((this->animationIndex == EN_JG_ANIMATION_SURPRISE_START) && (currentFrame == lastFrame)) { - this->animationIndex = EN_JG_ANIMATION_SURPRISE_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (currentFrame == lastFrame)) { + this->animIndex = EN_JG_ANIM_SURPRISE_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -529,10 +529,10 @@ void EnJg_Talk(EnJg* this, PlayState* play) { } void EnJg_SetupWalk(EnJg* this, PlayState* play) { - if (this->animationIndex != EN_JG_ANIMATION_WALK) { - this->animationIndex = EN_JG_ANIMATION_WALK; + if (this->animIndex != EN_JG_ANIM_WALK) { + this->animIndex = EN_JG_ANIM_WALK; this->freezeTimer = 1000; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Walk; } else { this->freezeTimer = 1000; @@ -542,7 +542,7 @@ void EnJg_SetupWalk(EnJg* this, PlayState* play) { void EnJg_Freeze(EnJg* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->action == EN_JG_ACTION_SPAWNING) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; @@ -551,18 +551,18 @@ void EnJg_Freeze(EnJg* this, PlayState* play) { this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, 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, 0xFF50); - this->animationIndex = EN_JG_ANIMATION_FROZEN_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_FROZEN_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_FrozenIdle; - } else if (this->animationIndex == EN_JG_ANIMATION_FROZEN_START) { + } else if (this->animIndex == EN_JG_ANIM_FROZEN_START) { this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW; if (currentFrame == lastFrame) { this->freezeTimer = 1000; this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, 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, 0xFF50); - this->animationIndex = EN_JG_ANIMATION_FROZEN_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_FROZEN_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_FrozenIdle; } } @@ -571,20 +571,20 @@ void EnJg_Freeze(EnJg* this, PlayState* play) { void EnJg_FrozenIdle(EnJg* this, PlayState* play) { if (this->icePoly->update == NULL) { this->icePoly = NULL; - if (this->animationIndex == EN_JG_ANIMATION_FROZEN_LOOP) { + if (this->animIndex == EN_JG_ANIM_FROZEN_LOOP) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { - this->animationIndex = EN_JG_ANIMATION_IDLE; + this->animIndex = EN_JG_ANIM_IDLE; // If you've never talked to the elder before, he stands // around idle until you've talked to him at least once. // Otherwise, he immediately begins walking after being // thawed out. if (this->textId == 0xDAC) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Idle; } else { this->freezeTimer = 1000; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Walk; } } @@ -630,7 +630,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { switch (play->csCtx.actorActions[actionIndex]->action) { case 1: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_CUTSCENE_IDLE; + this->cutsceneAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE; if (this->drum != NULL) { Actor_MarkForDeath(this->drum); this->drum = NULL; @@ -638,50 +638,50 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { break; case 2: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_TAKING_OUT_DRUM; + this->cutsceneAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM; break; case 3: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_DRUM_IDLE; + this->cutsceneAnimIndex = EN_JG_ANIM_DRUM_IDLE; break; case 4: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_PLAYING_DRUM; + this->cutsceneAnimIndex = EN_JG_ANIM_PLAYING_DRUM; break; case 5: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_THINKING; + this->cutsceneAnimIndex = EN_JG_ANIM_THINKING; break; case 6: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_REMEMBERING; + this->cutsceneAnimIndex = EN_JG_ANIM_REMEMBERING; break; case 7: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_STRONG_REMEMBERING; + this->cutsceneAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING; break; case 8: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_DEPRESSED; + this->cutsceneAnimIndex = EN_JG_ANIM_DEPRESSED; break; case 9: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_CRADLE; + this->cutsceneAnimIndex = EN_JG_ANIM_CRADLE; break; default: - this->cutsceneAnimationIndex = EN_JG_ANIMATION_IDLE; + this->cutsceneAnimIndex = EN_JG_ANIM_IDLE; break; } - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->cutsceneAnimationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->cutsceneAnimIndex); } if ((!(this->flags & FLAG_DRUM_SPAWNED)) && - (((this->cutsceneAnimationIndex == EN_JG_ANIMATION_TAKING_OUT_DRUM) && - (Animation_OnFrame(&this->skelAnime, 14.0f)) && (this->action != EN_JG_ACTION_LULLABY_INTRO_CS)) || - (((this->cutsceneAnimationIndex == EN_JG_ANIMATION_DRUM_IDLE) || - (this->cutsceneAnimationIndex == EN_JG_ANIMATION_PLAYING_DRUM)) && + (((this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && (Animation_OnFrame(&this->skelAnime, 14.0f)) && + (this->action != EN_JG_ACTION_LULLABY_INTRO_CS)) || + (((this->cutsceneAnimIndex == EN_JG_ANIM_DRUM_IDLE) || + (this->cutsceneAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) && (this->action == EN_JG_ACTION_LULLABY_INTRO_CS)))) { this->flags |= FLAG_DRUM_SPAWNED; this->drum = Actor_SpawnAsChildAndCutscene( @@ -690,7 +690,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { this->actor.params, this->actor.cutscene, this->actor.unk20, NULL); } - if (this->cutsceneAnimationIndex == EN_JG_ANIMATION_TAKING_OUT_DRUM) { + if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) { if (Animation_OnFrame(&this->skelAnime, 23.0f)) { Audio_PlaySfxAtPos(&sSfxPos, NA_SE_EV_WOOD_BOUND_S); } else if (Animation_OnFrame(&this->skelAnime, 38.0f)) { @@ -899,7 +899,7 @@ void EnJg_SpawnBreath(EnJg* this, PlayState* play) { */ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->flags |= FLAG_LOOKING_AT_PLAYER; @@ -925,8 +925,8 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play this->freezeTimer--; if ((this->freezeTimer <= 0) && (currentFrame == lastFrame)) { - this->animationIndex = EN_JG_ANIMATION_FROZEN_START; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = EN_JG_ANIM_FROZEN_START; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); Audio_PlaySfxAtPos(&sSfxPos, NA_SE_EV_FREEZE_S); this->actionFunc = EnJg_Freeze; } @@ -951,25 +951,25 @@ void EnJg_Init(Actor* thisx, PlayState* play) { if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && (play->csCtx.currentCsIndex == 0)) { // This is the elder that appears in the cutscene for learning the full Goron Lullaby. - this->animationIndex = EN_JG_ANIMATION_IDLE; + this->animIndex = EN_JG_ANIM_IDLE; this->action = EN_JG_ACTION_LULLABY_INTRO_CS; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_LullabyIntroCutsceneAction; } else { // This is the elder that appears in Mountain Village or the Path to Goron Village in winter. this->path = SubS_GetPathByIndex(play, EN_JG_GET_PATH(thisx), 0x3F); - this->animationIndex = EN_JG_ANIMATION_SURPRISE_START; + this->animIndex = EN_JG_ANIM_SURPRISE_START; this->action = EN_JG_ACTION_SPAWNING; this->freezeTimer = 1000; this->textId = 0xDAC; // What was I doing? - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_Freeze; } } else { // This is the elder that appears in Goron Shrine in spring. - this->animationIndex = EN_JG_ANIMATION_IDLE; + this->animIndex = EN_JG_ANIM_IDLE; this->cutscene = this->actor.cutscene; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_GoronShrineIdle; } } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.h b/src/overlays/actors/ovl_En_Jg/z_en_jg.h index f225b51f7..8564f8ad1 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h @@ -26,14 +26,14 @@ typedef struct EnJg { /* 0x1F8 */ Vec3s jointTable[GORON_ELDER_LIMB_MAX]; /* 0x2CA */ Vec3s morphTable[GORON_ELDER_LIMB_MAX]; /* 0x39C */ s16 rootRotationWhenTalking; - /* 0x39E */ s16 animationIndex; + /* 0x39E */ s16 animIndex; /* 0x3A0 */ s16 action; /* 0x3A2 */ s16 freezeTimer; /* 0x3A4 */ Vec3f breathPos; /* 0x3B0 */ Vec3f breathVelocity; /* 0x3BC */ Vec3f breathAccel; /* 0x3C8 */ s16 cutscene; - /* 0x3CA */ u8 cutsceneAnimationIndex; + /* 0x3CA */ u8 cutsceneAnimIndex; /* 0x3CB */ u8 csAction; /* 0x3CC */ u16 flags; /* 0x3CE */ u16 textId; 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 f6ef666b2..8957cfc21 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 @@ -48,7 +48,7 @@ const ActorInit En_Jgame_Tsn_InitVars = { (ActorFunc)EnJgameTsn_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, { &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, { &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, @@ -94,7 +94,7 @@ void EnJgameTsn_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.velocity.y = 0.0f; - if (gSaveContext.save.entranceIndex == 0x68D0) { + if (gSaveContext.save.entrance == ENTRANCE(GREAT_BAY_COAST, 13)) { this->actor.flags |= ACTOR_FLAG_10000; } @@ -145,7 +145,7 @@ void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) { } void func_80C13B74(EnJgameTsn* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80C13BB8; } @@ -156,15 +156,15 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { if (this->actor.flags & ACTOR_FLAG_10000) { this->actor.flags &= ~ACTOR_FLAG_10000; if (gSaveContext.unk_3DE0[4] > 0) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else if (gSaveContext.minigameScore < 20) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x10A3, &this->actor); this->unk_300 = 0x10A3; } @@ -174,11 +174,11 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x1094; } else if (this->unk_2F8 == 0) { this->unk_2F8 = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x1095, &this->actor); this->unk_300 = 0x1095; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x1096, &this->actor); this->unk_300 = 0x1096; } @@ -211,11 +211,11 @@ void func_80C13E90(EnJgameTsn* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x1098, &this->actor); this->unk_300 = 0x1098; } @@ -335,7 +335,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_2FC++; if ((player->actor.bgCheckFlags & 2) && func_80C149B0(play, &this->unk_200)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x109F, &this->actor); this->unk_300 = 0x109F; player->stateFlags1 |= 0x20; @@ -343,7 +343,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { func_801A2C20(); func_80C14030(this); } else if ((player->actor.bgCheckFlags & 0x40) || (player->actor.bgCheckFlags & 0x20)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x10A0, &this->actor); this->unk_300 = 0x10A0; player->stateFlags1 |= 0x20; @@ -367,7 +367,7 @@ void func_80C144E4(EnJgameTsn* this) { } void func_80C144F8(EnJgameTsn* this, PlayState* play) { - play->nextEntranceIndex = 0x68D0; + play->nextEntrance = ENTRANCE(GREAT_BAY_COAST, 13); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_80; gSaveContext.nextTransitionType = TRANS_TYPE_03; @@ -412,12 +412,12 @@ void func_80C14684(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x109E; Rupees_ChangeBy(-20); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x109D, &this->actor); this->unk_300 = 0x109D; } } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Message_StartTextbox(play, 0x109C, &this->actor); this->unk_300 = 0x109C; } @@ -460,7 +460,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { break; case 0x109A: - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); Message_StartTextbox(play, 0x109B, &this->actor); this->unk_300 = 0x109B; break; 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 31fe29369..b78b65a19 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -21,7 +21,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play); void EnKakasi_InitTimeSkipDialogue(EnKakasi* this); void EnKakasi_SetupIdleStanding(EnKakasi* this); -void EnKakasi_8096F88C(PlayState* play, EnKakasi* this); +s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx); void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play); void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play); @@ -122,15 +122,15 @@ typedef enum { /* 0x6 */ ENKAKASI_ANIM_WAVE, // "wave" short sideways shake, stops early, partial? unused? /* 0x7 */ ENKAKASI_ANIM_SLOWROLL, // partial bounch, ends looking left, OFFER anim takes over /* 0x8 */ ENKAKASI_ANIM_IDLE, // slow stretching wiggle, ends in regular position -} EnKakasi_Animations; +} EnKakasiAnimation; -static AnimationHeader* kakasiAnimations[] = { +static AnimationHeader* sAnimations[] = { &object_ka_Anim_007444, &object_ka_Anim_00686C, &object_ka_Anim_0081A4, &object_ka_Anim_007B90, &object_ka_Anim_0071EC, &object_ka_Anim_007444, &object_ka_Anim_00686C, &object_ka_Anim_0081A4, &object_ka_Anim_000214, }; -static u8 sAnimModes[] = { +static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, }; @@ -146,44 +146,44 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { s32 tempCutscene; s32 i; - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &D_80971D80); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80); SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); - this->songSummonDist = GET_KAKASI_SUMMON_DISTANCE(&this->actor) * 20.0f; + this->songSummonDist = KAKASI_GET_SUMMON_DISTANCE(&this->picto.actor) * 20.0f; if (this->songSummonDist < 40.0f) { this->songSummonDist = 40.0f; } - this->unkHeight = (this->actor.world.rot.z * 20.0f) + 60.0f; - 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 = GET_KAKASI_TARGETMODE(thisx); + this->unkHeight = (this->picto.actor.world.rot.z * 20.0f) + 60.0f; + this->picto.actor.world.rot.z = 0; + this->picto.actor.targetMode = 0; + if (this->picto.actor.world.rot.x > 0 && this->picto.actor.world.rot.x < 8) { + this->picto.actor.targetMode = KAKASI_GET_TARGETMODE(thisx); } - this->actor.shape.rot.y = this->actor.world.rot.y; + this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; - this->aboveGroundStatus = GET_KAKASI_ABOVE_GROUND(&this->actor); - this->actor.world.rot.x = 0; - this->actor.flags |= ACTOR_FLAG_400; - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Actor_SetScale(&this->actor, 0.01f); + this->aboveGroundStatus = KAKASI_GET_ABOVE_GROUND(&this->picto.actor); + this->picto.actor.world.rot.x = 0; + this->picto.actor.flags |= ACTOR_FLAG_400; + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); i = 0; - tempCutscene = this->actor.cutscene; + tempCutscene = this->picto.actor.cutscene; while (tempCutscene != -1) { //! FAKE: tempCutscene = ActorCutscene_GetAdditionalCutscene(this->actorCutscenes[i] = tempCutscene); i++; } - if (this->aboveGroundStatus) { + if (this->aboveGroundStatus != 0) { if (gSaveContext.save.weekEventReg[79] & 8) { this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; EnKakasi_SetupIdleUnderground(this); } else { - Actor_SetFocus(&this->actor, 60.0f); - this->unkFunc = EnKakasi_8096F88C; + Actor_SetFocus(&this->picto.actor, 60.0f); + this->picto.validationFunc = EnKakasi_ValidatePictograph; if (gSaveContext.save.weekEventReg[83] & 1) { EnKakasi_InitTimeSkipDialogue(this); } else { @@ -195,42 +195,39 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { } } -void EnKakasi_SetAnimation(EnKakasi* this, s32 index) { - this->animIndex = index; - this->animeFrameCount = Animation_GetLastFrame(&kakasiAnimations[this->animIndex]->common); +void EnKakasi_ChangeAnim(EnKakasi* this, s32 animIndex) { + this->animIndex = animIndex; + this->animeFrameCount = Animation_GetLastFrame(&sAnimations[this->animIndex]->common); // 1: regular playback speed, 0: starting frame - Animation_Change(&this->skelanime, kakasiAnimations[this->animIndex], 1.0f, 0.0f, this->animeFrameCount, - sAnimModes[this->animIndex], -4.0f); + Animation_Change(&this->skelanime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animeFrameCount, + sAnimationModes[this->animIndex], -4.0f); } -/* - * set by init, called... nowhere? left over from OOT? - */ -void EnKakasi_8096F88C(PlayState* play, EnKakasi* this) { - func_8013A530(play, &this->actor, 0x7, &this->actor.focus.pos, &this->actor.shape.rot, 280.0f, 1800.0f, -1); +s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { + return Snap_ValidatePictograph(play, thisx, 0x7, &thisx->focus.pos, &thisx->shape.rot, 280.0f, 1800.0f, -1); } void EnKakasi_CheckAnimationSfx(EnKakasi* this) { if (this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING || this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL) { if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } if (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR || this->animIndex == ENKAKASI_ANIM_SLOWROLL) { if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_SWING); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 9.0f) || Animation_OnFrame(&this->skelanime, 16.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_KAKASHI_JUMP); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); } if (Animation_OnFrame(&this->skelanime, 18.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASHI_ROLL); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } if (this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER || this->animIndex == ENKAKASI_ANIM_TWIRL) { if (Animation_OnFrame(&this->skelanime, 1.0f)) { - Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KAKASH_LONGI_ROLL); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } } } @@ -249,7 +246,7 @@ void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { player->actor.world.pos.z = -190.0f; } - Math_SmoothStepToS(&player->actor.shape.rot.y, (this->actor.yawTowardsPlayer + 0x8000), 5, 1000, 0); + Math_SmoothStepToS(&player->actor.shape.rot.y, (this->picto.actor.yawTowardsPlayer + 0x8000), 5, 1000, 0); } /* @@ -268,8 +265,8 @@ void func_8096FAAC(EnKakasi* this, PlayState* play) { Math_ApproachF(&this->subCamFov, this->subCamFovNext, 0.3f, 10.0f); - Play_CameraSetAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - Play_CameraSetFov(play, this->subCamId, this->subCamFov); + Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); + Play_SetCameraFov(play, this->subCamId, this->subCamFov); } } @@ -283,19 +280,19 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) { this->unk190++; } if (this->unk190 != 0 && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (this->unk190 > 8) { this->unk190 = 8; } if (this->unk190 != 0) { Math_ApproachF(&this->skelanime.playSpeed, 1.0f, 0.1f, 0.2f); - this->actor.shape.rot.y += 0x800; + this->picto.actor.shape.rot.y += 0x800; } } void EnKakasi_InitTimeSkipDialogue(EnKakasi* this) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SLOWROLL); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SLOWROLL); this->actionFunc = EnKakasi_TimeSkipDialogue; } @@ -306,22 +303,22 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && !(gSaveContext.eventInf[1] & 0x80)) { - if (this->actor.textId == 0) { + if (this->picto.actor.textId == 0) { // dialogue after skipped time 'did you feel that? went by in an instant' - this->actor.textId = 0x1653; + this->picto.actor.textId = 0x1653; gSaveContext.save.weekEventReg[83] &= (u8)~1; this->talkState = TEXT_STATE_5; player->stateFlags1 |= 0x20; - this->actor.flags |= ACTOR_FLAG_10000; + this->picto.actor.flags |= ACTOR_FLAG_10000; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { player->stateFlags1 &= ~0x20; this->unkState196 = 2; - this->actor.flags &= ~ACTOR_FLAG_10000; + this->picto.actor.flags &= ~ACTOR_FLAG_10000; this->actionFunc = EnKakasi_RegularDialogue; } else { - func_800B8500(&this->actor, play, 9999.9f, 9999.9f, -1); + func_800B8500(&this->picto.actor, play, 9999.9f, 9999.9f, PLAYER_AP_MINUS1); } } } @@ -338,53 +335,53 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { s16 y; // first talk to scarecrow dialogue - this->actor.textId = 0x1644; - if (func_800B8718(&this->actor, &play->state)) { + this->picto.actor.textId = 0x1644; + if (func_800B8718(&this->picto.actor, &play->state)) { this->skelanime.playSpeed = 1.0f; EnKakasi_SetupSongTeach(this, play); return; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->skelanime.playSpeed = 1.0f; EnKakasi_SetupDialogue(this); return; } if (play->actorCtx.unk5 & 0x4) { - Actor_GetScreenPos(play, &this->actor, &x, &y); - if (this->actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && + Actor_GetScreenPos(play, &this->picto.actor, &x, &y); + if (this->picto.actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { // faster shaking - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; } } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; } } else if (saveContextDay == 3 && gSaveContext.save.isNight) { this->skelanime.playSpeed = 1.0f; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, 1); + EnKakasi_ChangeAnim(this, 1); } } else if (this->animIndex != ENKAKASI_ANIM_IDLE) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_IDLE); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_IDLE); } - if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8614(&this->actor, play, 100.0f); - func_800B874C(&this->actor, play, 100.0f, 80.0f); + if (this->picto.actor.xzDistToPlayer < 120.0f) { + func_800B8614(&this->picto.actor, play, 100.0f); + func_800B874C(&this->picto.actor, play, 100.0f, 80.0f); } } void EnKakasi_SetupDialogue(EnKakasi* this) { // bug? starts one animation then changes it a few lines down? if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } this->talkState = TEXT_STATE_5; this->unkState196 = 1; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); this->actionFunc = EnKakasi_RegularDialogue; } @@ -392,27 +389,27 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { u32 saveContextDay = gSaveContext.save.day; f32 currentAnimeFrame = this->skelanime.curFrame; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 2000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 2000, 0); // if first dialogue - if (this->actor.textId != 0x1644 && this->animeFrameCount <= currentAnimeFrame && + if (this->picto.actor.textId != 0x1644 && this->animeFrameCount <= currentAnimeFrame && this->animIndex == ENKAKASI_ANIM_SLOWROLL) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); this->unkCounter1A4 = 0; } // if dialogue: oh sorry come back again - if (this->actor.textId == 0x1651 || this->actor.textId == 0x1659) { + if (this->picto.actor.textId == 0x1651 || this->picto.actor.textId == 0x1659) { if (this->animeFrameCount <= currentAnimeFrame && this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER) { if (++this->unkCounter1A4 >= 2) { this->unkCounter1A4 = 0; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); } } } if (this->unkState1A8 == 2 && this->unkState196 == 2) { - func_800B7298(play, &this->actor, 0x49); + func_800B7298(play, &this->picto.actor, 0x49); this->unkState1A8 = 0; } @@ -420,35 +417,35 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { func_801477B4(play); if (this->talkState == TEXT_STATE_5) { // bad song input - if (this->unkState196 == 2 && this->actor.textId == 0x1647) { - func_800B7298(play, &this->actor, 6); + if (this->unkState196 == 2 && this->picto.actor.textId == 0x1647) { + func_800B7298(play, &this->picto.actor, 6); } // after timeskip - if (this->actor.textId == 0x1653) { + if (this->picto.actor.textId == 0x1653) { u32 saveContextDay2 = gSaveContext.save.day; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (saveContextDay2 == 3 && gSaveContext.save.isNight) { // text: dangerous outside - this->actor.textId = 0x164F; + this->picto.actor.textId = 0x164F; } else if (gSaveContext.save.isNight) { // text: would you like to skip time? - this->actor.textId = 0x164E; + this->picto.actor.textId = 0x164E; } else { // text: would you like to skip time? 2 - this->actor.textId = 0x1645; + this->picto.actor.textId = 0x1645; } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); return; - } else if (this->actor.textId == 0x165D || this->actor.textId == 0x165F || this->actor.textId == 0x1660 || - this->actor.textId == 0x1652) { - func_800B7298(play, &this->actor, 4); + } else if (this->picto.actor.textId == 0x165D || this->picto.actor.textId == 0x165F || + this->picto.actor.textId == 0x1660 || this->picto.actor.textId == 0x1652) { + func_800B7298(play, &this->picto.actor, 4); if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); @@ -458,55 +455,55 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); this->actionFunc = EnKakasi_DancingRemark; } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); this->actionFunc = EnKakasi_DancingRemark; } } return; - } else if (this->actor.textId == 0x1645 || this->actor.textId == 0x164E) { - this->actor.textId = 0x1650; // "Shall we dance? No Yes" + } else if (this->picto.actor.textId == 0x1645 || this->picto.actor.textId == 0x164E) { + this->picto.actor.textId = 0x1650; // "Shall we dance? No Yes" if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x1644) { + } else if (this->picto.actor.textId == 0x1644) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (gSaveContext.save.isNight) { - this->actor.textId = 0x164E; + this->picto.actor.textId = 0x164E; } else { - this->actor.textId = 0x1645; + this->picto.actor.textId = 0x1645; } - } else if (this->actor.textId == 0x164F) { + } else if (this->picto.actor.textId == 0x164F) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->actor.textId = 0x165A; - } else if (this->actor.textId == 0x1651) { + this->picto.actor.textId = 0x165A; + } else if (this->picto.actor.textId == 0x1651) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - this->actor.textId = 0x1654; - } else if (this->actor.textId == 0x1654) { - this->actor.textId = 0x1655; - } else if (this->actor.textId == 0x1655) { - this->actor.textId = 0x1656; + this->picto.actor.textId = 0x1654; + } else if (this->picto.actor.textId == 0x1654) { + this->picto.actor.textId = 0x1655; + } else if (this->picto.actor.textId == 0x1655) { + this->picto.actor.textId = 0x1656; 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; + } else if (this->picto.actor.textId == 0x1658) { + this->picto.actor.textId = 0x1659; + } else if (this->picto.actor.textId == 0x165A) { + this->picto.actor.textId = 0x165B; + } else if (this->picto.actor.textId == 0x165B) { + this->picto.actor.textId = 0x165C; this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x165E) { - this->actor.textId = 0x165F; + } else if (this->picto.actor.textId == 0x165E) { + this->picto.actor.textId = 0x165F; } else { EnKakasi_SetupIdleStanding(this); return; @@ -516,42 +513,42 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (play->msgCtx.choiceIndex == 1) { func_8019F208(); - if (this->actor.textId == 0x1656) { - this->actor.textId = 0x1658; - } else if (this->actor.textId == 0x165C) { - this->actor.textId = 0x165E; + if (this->picto.actor.textId == 0x1656) { + this->picto.actor.textId = 0x1658; + } else if (this->picto.actor.textId == 0x165C) { + this->picto.actor.textId = 0x165E; } else if (saveContextDay == 3 && gSaveContext.save.isNight) { - this->actor.textId = 0x164F; + this->picto.actor.textId = 0x164F; } else { - this->actor.textId = 0x1652; + this->picto.actor.textId = 0x1652; } - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); } else { func_8019F230(); - if (this->actor.textId == 0x1656) { // would you like to learn a song? yes/no - this->actor.textId = 0x1657; - } else if (this->actor.textId == 0x165C) { // would you like to learn a song? yes/no - this->actor.textId = 0x165D; + if (this->picto.actor.textId == 0x1656) { // would you like to learn a song? yes/no + this->picto.actor.textId = 0x1657; + } else if (this->picto.actor.textId == 0x165C) { // would you like to learn a song? yes/no + this->picto.actor.textId = 0x165D; } else { - this->actor.textId = 0x1651; + this->picto.actor.textId = 0x1651; } this->unkCounter1A4 = 0; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); } } } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); } } void EnKakasi_SetupSongTeach(EnKakasi* this, PlayState* play) { - this->actor.textId = 0x1646; - Message_StartTextbox(play, this->actor.textId, &this->actor); + this->picto.actor.textId = 0x1646; + Message_StartTextbox(play, this->picto.actor.textId, &this->picto.actor); this->subCamId = SUB_CAM_ID_DONE; this->subCamFov = 0.0f; this->subCamFovNext = 60.0f; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); this->unkState196 = 2; this->actionFunc = EnKakasi_OcarinaRemark; } @@ -575,9 +572,9 @@ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { } else { this->unkState1A8 = 1; - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->actionFunc = EnKakasi_TeachingSong; } } @@ -587,7 +584,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { Vec3f tempVec; EnKakasi_CheckPlayerPosition(this, play); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); if (this->unkState1A8 == 0) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); @@ -598,21 +595,21 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->unkState1A8 = 1; this->unkState1A8 = 1; } if (this->unkState1A8 == 1) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; 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->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &tempVec, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.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); @@ -623,20 +620,20 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { this->unk190 = 0; this->unkCounter1A4 = 0; ActorCutscene_Stop(this->actorCutscenes[0]); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YASE_DEAD); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; this->subCamId = SUB_CAM_ID_DONE; - this->actor.textId = 0x1647; + this->picto.actor.textId = 0x1647; this->unkState1A8 = 2; this->talkState = TEXT_STATE_5; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); this->actionFunc = EnKakasi_RegularDialogue; } else if (play->msgCtx.ocarinaMode == 3) { // song success this->postTeachTimer = 30; this->skelanime.playSpeed = 2.0f; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); this->actionFunc = EnKakasi_PostSongLearnTwirl; } } @@ -646,7 +643,7 @@ void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { f32 animeFrame = this->skelanime.curFrame; if (this->postTeachTimer == 0 && this->animIndex != ENKAKASI_ANIM_TWIRL) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); this->skelanime.playSpeed = 2.0f; } if (this->postTeachTimer == 0 && this->animIndex == ENKAKASI_ANIM_TWIRL && this->animeFrameCount <= animeFrame) { @@ -659,7 +656,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { play->msgCtx.ocarinaMode = 4; this->unk190 = 0; this->unkCounter1A4 = 0; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); this->subCamId = SUB_CAM_ID_DONE; this->talkState = TEXT_STATE_5; this->unkState1A8 = 1; @@ -673,31 +670,31 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { f32 tempAnimFrame = this->skelanime.curFrame; Vec3f vec3fCopy; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 1, 3000, 0); - Math_SmoothStepToS(&player->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); + Math_SmoothStepToS(&player->actor.shape.rot.y, this->picto.actor.yawTowardsPlayer + 0x8000, 5, 1000, 0); if (this->unk190 == 0) { func_801477B4(play); - func_800B7298(play, &this->actor, 0x56); - this->actor.textId = 0x1648; - Message_StartTextbox(play, (this->actor.textId), &this->actor); + func_800B7298(play, &this->picto.actor, 0x56); + this->picto.actor.textId = 0x1648; + Message_StartTextbox(play, (this->picto.actor.textId), &this->picto.actor); this->unkState1A8 = 0; this->unk190 = 1; } - if (this->actor.textId == 0x1648 && this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR && + if (this->picto.actor.textId == 0x1648 && this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR && this->animeFrameCount <= tempAnimFrame) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); } } - if (this->actor.textId == 0x164B && this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING && + if (this->picto.actor.textId == 0x164B && this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING && this->animeFrameCount <= tempAnimFrame) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); } } @@ -711,21 +708,21 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); return; } - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); - func_800B7298(play, &this->actor, 0x56); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + func_800B7298(play, &this->picto.actor, 0x56); this->unkState1A8 = 1; } if (this->subCamId != SUB_CAM_ID_DONE) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; EnKakasi_CheckPlayerPosition(this, play); 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); + OLib_DbCameraVec3fSum(&this->picto.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; @@ -746,26 +743,26 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->unk190 = 5; } - if (this->actor.textId == 0x1648) { - func_800B7298(play, &this->actor, 7); - this->actor.textId = 0x1649; + if (this->picto.actor.textId == 0x1648) { + func_800B7298(play, &this->picto.actor, 7); + this->picto.actor.textId = 0x1649; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); } - } else if (this->actor.textId == 0x1649) { - this->actor.textId = 0x1660; + } else if (this->picto.actor.textId == 0x1649) { + this->picto.actor.textId = 0x1660; this->talkState = TEXT_STATE_CHOICE; - } else if (this->actor.textId == 0x164A) { - this->actor.textId = 0x164B; + } else if (this->picto.actor.textId == 0x164A) { + this->picto.actor.textId = 0x164B; - } else if (this->actor.textId == 0x164B) { - this->actor.textId = 0x164C; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); + } else if (this->picto.actor.textId == 0x164B) { + this->picto.actor.textId = 0x164C; + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); } else { - if (this->actor.textId == 0x164C || this->actor.textId == 0x1661) { + if (this->picto.actor.textId == 0x164C || this->picto.actor.textId == 0x1661) { EnKakasi_SetupDigAway(this); return; } @@ -774,14 +771,14 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } else { this->talkState = TEXT_STATE_5; if (play->msgCtx.choiceIndex == 1) { - func_8019F208(); // play 0x4808 sfx (decide) and calls func_801A75E8 - this->actor.textId = 0x164A; + func_8019F208(); // play 0x4808 sfx (decide) and calls AudioSfx_StopById + this->picto.actor.textId = 0x164A; } else { - func_8019F230(); // play 0x480A sfx (cancel) and calls func_801A75E8 - this->actor.textId = 0x1661; + func_8019F230(); // play 0x480A sfx (cancel) and calls AudioSfx_StopById + this->picto.actor.textId = 0x1661; } } - func_80151938(play, this->actor.textId); + func_80151938(play, this->picto.actor.textId); } } @@ -798,8 +795,8 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { } else if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); + this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { @@ -814,8 +811,8 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) { this->unkCounter1A4 = 0; this->subCamFov = 0.0f; this->subCamFovNext = 60.0f; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); func_8016566C(0xB4); this->actionFunc = EnKakasi_DancingNightAway; } @@ -827,14 +824,14 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { currentFrame = this->skelanime.curFrame; EnKakasi_CheckPlayerPosition(this, 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; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; 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); + OLib_DbCameraVec3fSum(&this->picto.actor.home, &localVec3f, &this->subCamEyeNext, 1); if (1) {} this->subCamAtNext.x = D_80971EEC[this->unk190].x + this->unk22C.x; @@ -845,7 +842,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); } if (this->unk190 >= 7 && this->unk190 != 0xE) { - this->actor.shape.rot.y += 0x800; + this->picto.actor.shape.rot.y += 0x800; } func_8096FAAC(this, play); @@ -862,7 +859,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { if (this->unk204 == 0 && this->animeFrameCount <= currentFrame) { this->unk204 = 0x14; this->unk190++; - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } return; case 2: @@ -919,7 +916,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->unk190++; this->unk204 = 0xA; if (this->unk190 == 0xE) { - func_800B7298(play, &this->actor, 0x49); + func_800B7298(play, &this->picto.actor, 0x49); func_80165690(); this->unk204 = 0x14; } @@ -927,12 +924,12 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { return; case 14: // goes off once for some camera changes, - // otherwise its the end when camera is back to normal and link is confused - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); + // otherwise it's the end when camera is back to normal and Player is confused + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); if (this->unk204 == 0) { player = GET_PLAYER(play); - Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), player->unk_3CE, + Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, Entrance_CreateFromSpawn(0), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); func_80169EFC(&play->state); @@ -957,13 +954,13 @@ void EnKakasi_DoNothing(EnKakasi* this, PlayState* play) { void EnKakasi_SetupDigAway(EnKakasi* this) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } this->unk190 = 0; this->unkCounter1A4 = 0; this->subCamFovNext = 60.0f; this->subCamFov = 60.0f; - Math_Vec3f_Copy(&this->unk22C, &this->actor.home.pos); + Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->unkState196 = 4; this->actionFunc = EnKakasi_DiggingAway; } @@ -973,13 +970,13 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Vec3f tempWorldPos; if (this->subCamId != SUB_CAM_ID_DONE) { - this->unk22C.y = this->actor.home.pos.y + 50.0f; + this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; this->subCamEyeNext.x = D_80972030.x; this->subCamEyeNext.y = D_80972030.y; this->subCamEyeNext.z = D_80972030.z; Math_Vec3f_Copy(&tempunk238, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->actor.home, &tempunk238, &this->subCamEyeNext, 1); + OLib_DbCameraVec3fSum(&this->picto.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; @@ -993,11 +990,11 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { return; } - this->actor.shape.rot.y += 0x3000; + this->picto.actor.shape.rot.y += 0x3000; Math_SmoothStepToS(&this->unk190, 500, 5, 50, 0); if ((play->gameplayFrames % 4) == 0) { - Math_Vec3f_Copy(&tempWorldPos, &this->actor.world.pos); - tempWorldPos.y = this->actor.floorHeight; + Math_Vec3f_Copy(&tempWorldPos, &this->picto.actor.world.pos); + tempWorldPos.y = this->picto.actor.floorHeight; tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); @@ -1006,16 +1003,16 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); } else { - Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 5, 4.0f, 200, 10, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, + this->picto.actor.shape.shadowScale - 20.0f, 5, 4.0f, 200, 10, 1); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } } - Math_ApproachF(&this->actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); - if (fabsf(this->actor.shape.yOffset + 6000.0f) < 10.0f) { + Math_ApproachF(&this->picto.actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); + if (fabsf(this->picto.actor.shape.yOffset + 6000.0f) < 10.0f) { gSaveContext.save.weekEventReg[79] |= 8; - func_800B7298(play, &this->actor, 6); + func_800B7298(play, &this->picto.actor, 6); ActorCutscene_Stop(this->actorCutscenes[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; @@ -1024,17 +1021,17 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupIdleUnderground(EnKakasi* this) { - this->actor.shape.yOffset = -7000.0; - this->actor.draw = NULL; - this->actor.flags |= ACTOR_FLAG_8000000; + this->picto.actor.shape.yOffset = -7000.0; + this->picto.actor.draw = NULL; + this->picto.actor.flags |= ACTOR_FLAG_8000000; this->unkState196 = 5; this->actionFunc = EnKakasi_IdleUnderground; } void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { - if ((gSaveContext.save.weekEventReg[79] & 8) && this->actor.xzDistToPlayer < this->songSummonDist && + if ((gSaveContext.save.weekEventReg[79] & 8) && this->picto.actor.xzDistToPlayer < this->songSummonDist && (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { - this->actor.flags &= ~ACTOR_FLAG_8000000; + this->picto.actor.flags &= ~ACTOR_FLAG_8000000; play->msgCtx.ocarinaMode = 4; this->actionFunc = EnKakasi_SetupRiseOutOfGround; } @@ -1056,27 +1053,27 @@ void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->actorCutscenes[cutsceneIndex]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->actor); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actor.draw = EnKakasi_Draw; + ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->picto.actor); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); + this->picto.actor.draw = EnKakasi_Draw; this->unkState196 = 6; this->actionFunc = EnKakasi_RisingOutOfGround; } } void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { - this->actor.shape.rot.y += 0x3000; + this->picto.actor.shape.rot.y += 0x3000; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { - EnKakasi_SetAnimation(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); + EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - if (this->actor.shape.yOffset < -10.0f) { + if (this->picto.actor.shape.yOffset < -10.0f) { if ((play->gameplayFrames % 8) == 0) { - Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale - 20.0f, - 10, 8.0f, 500, 10, 1); - Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); + Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->picto.actor.world.pos, + this->picto.actor.shape.shadowScale - 20.0f, 10, 8.0f, 500, 10, 1); + Actor_PlaySfxAtPos(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); } - Math_ApproachF(&this->actor.shape.yOffset, 0.0f, 0.5f, 200.0f); + Math_ApproachF(&this->picto.actor.shape.yOffset, 0.0f, 0.5f, 200.0f); } else { EnKakasi_SetupIdleRisen(this); } @@ -1084,23 +1081,23 @@ void EnKakasi_RisingOutOfGround(EnKakasi* this, PlayState* play) { void EnKakasi_SetupIdleRisen(EnKakasi* this) { // text: great to see you again - this->actor.textId = 0x164D; + this->picto.actor.textId = 0x164D; this->unkState196 = 7; this->actionFunc = EnKakasi_IdleRisen; - this->actor.shape.yOffset = 0.0f; + this->picto.actor.shape.yOffset = 0.0f; } void EnKakasi_IdleRisen(EnKakasi* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = EnKakasi_RisenDialogue; } else { - func_800B8614(&this->actor, play, 70.0f); + func_800B8614(&this->picto.actor, play, 70.0f); } } void EnKakasi_RisenDialogue(EnKakasi* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 1000, 0); + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 1000, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); @@ -1113,33 +1110,33 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelanime); - if (this->actor.draw != NULL) { + if (this->picto.actor.draw != NULL) { EnKakasi_CheckAnimationSfx(this); } - this->actor.world.rot.y = this->actor.shape.rot.y; + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; DECR(this->postTeachTimer); DECR(this->unk204); if (this->unkState196 != 5) { 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; + Math_Vec3f_Copy(&this->picto.actor.focus.pos, &this->unk1BC); + this->picto.actor.focus.pos.y += 10.0f; if (this->subCamId == CAM_ID_MAIN) { - Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); + Math_Vec3s_Copy(&this->picto.actor.focus.rot, &this->picto.actor.world.rot); } else { - Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.home.rot); + Math_Vec3s_Copy(&this->picto.actor.focus.rot, &this->picto.actor.home.rot); } } } else { - Actor_SetFocus(&this->actor, this->unkHeight); + Actor_SetFocus(&this->picto.actor, this->unkHeight); } this->actionFunc(this, play); - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); - if (this->actor.draw != NULL) { - Collider_UpdateCylinder(&this->actor, &this->collider); + Actor_MoveWithGravity(&this->picto.actor); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 50.0f, 50.0f, 100.0f, 0x1C); + if (this->picto.actor.draw != NULL) { + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } @@ -1157,5 +1154,5 @@ void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, - EnKakasi_PostLimbDraw, &this->actor); + EnKakasi_PostLimbDraw, &this->picto.actor); } 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 c1a788d46..59ef3272a 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -2,15 +2,14 @@ #define Z_EN_KAKASI_H #include "global.h" +#include "z64snap.h" struct EnKakasi; typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*); -typedef void (*EnKakasiUnkFunc)(PlayState*, struct EnKakasi*); typedef struct EnKakasi { - /* 0x000 */ Actor actor; - /* 0x144 */ EnKakasiUnkFunc unkFunc; // used for one z_snap calling function? + /* 0x000 */ PictoActor picto; /* 0x148 */ EnKakasiActionFunc actionFunc; /* 0x14C */ SkelAnime skelanime; /* 0x190 */ s16 unk190; // camera index for song teaching angles? @@ -45,8 +44,8 @@ extern const ActorInit En_Kakasi_InitVars; #define ENKAKASI_ABOVE_GROUND_TYPE 2 -#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) +#define KAKASI_GET_SUMMON_DISTANCE(thisx) (((thisx)->params >> 0x8) & 0xFF) +#define KAKASI_GET_ABOVE_GROUND(thisx) ((thisx)->params & 0x1) +#define KAKASI_GET_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 1c03c38e0..d90bdf93d 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 @@ -71,10 +71,12 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfo sAnimations[] = { - { &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, 0, -8.0f }, { &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, 0, -8.0f }, - { &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, 0, -8.0f }, { &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, 2, -8.0f }, - { &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, 0, -8.0f }, +static AnimationInfo sAnimationInfo[] = { + { &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, + { &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, }; s16 D_80B27CE0[][3] = { @@ -117,7 +119,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { this->actor.home.rot.z, 0x10); Actor_MarkForDeath(&this->actor); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); } } else if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) { Actor_MarkForDeath(&this->actor); @@ -220,7 +222,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); @@ -238,7 +240,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk12070) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); @@ -328,7 +330,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { if (this->unk_288 == 0x272C) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); } if ((this->unk_288 == 0x272E) || (this->unk_288 == 0x272F) || (this->unk_288 == 0x2730)) { @@ -514,7 +516,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { func_80B26F14(this, play); } else if (!func_80B26F6C(this, play)) { if (this->skelAnime.animation == &object_js_Anim_00016C) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); } this->unk_286 = 2; func_801477B4(play); @@ -539,7 +541,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { player->stateFlags1 |= 0x20; Message_StartTextbox(play, 0x2729, &this->actor); this->unk_288 = 0x2729; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); break; default: @@ -555,7 +557,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) { if ((this->skelAnime.animation == &object_js_Anim_0003DC) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); } if (this->unk_284 == 7) { 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 9a63f38a1..de2d1c207 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -17,7 +17,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play); void EnKgy_Update(Actor* thisx, PlayState* play); void EnKgy_Draw(Actor* thisx, PlayState* play); -void EnKgy_ChangeAnim(EnKgy* this, s16 arg1, u8 arg2, f32 arg3); +void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames); EnKbt* EnKgy_FindZubora(PlayState* play); ObjIcePoly* EnKgy_FindIceBlock(PlayState* play); void func_80B40D30(PlayState* play); @@ -108,7 +108,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) { LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } -void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 transitionRate) { +void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames) { static AnimationHeader* sAnimations[] = { &object_kgy_Anim_004B98, &object_kgy_Anim_0008FC, &object_kgy_Anim_00292C, &object_kgy_Anim_0042E4, &object_kgy_Anim_0101F0, &object_kgy_Anim_001764, &object_kgy_Anim_003334, &object_kgy_Anim_010B84, @@ -116,7 +116,7 @@ void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 transitionRate) { }; Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[animIndex]), mode, transitionRate); + Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames); this->unk_2D2 = animIndex; } @@ -239,12 +239,12 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { } if (this->unk_29C & 2) { - Vec3f sp38; - f32 sp34; + Vec3f projectedPos; + f32 invW; f32 temp_f0; - Actor_GetProjectedPos(play, &this->unk_2B4, &sp38, &sp34); - temp_f0 = sp38.x * sp34; + Actor_GetProjectedPos(play, &this->unk_2B4, &projectedPos, &invW); + temp_f0 = projectedPos.x * invW; if (this->unk_2E6 > 0) { this->unk_2E6--; } @@ -512,7 +512,7 @@ void func_80B41A48(EnKgy* this, PlayState* play) { if (this->unk_2E4 > 0) { this->unk_2E4--; } else { - play->nextEntranceIndex = play->setupExitList[ENKGY_GET_1F(&this->actor)]; + play->nextEntrance = play->setupExitList[ENKGY_GET_1F(&this->actor)]; play->transitionTrigger = TRANS_TRIGGER_START; } } @@ -586,7 +586,7 @@ void func_80B41CBC(EnKgy* this, PlayState* play) { this->actionFunc = func_80B41E18; func_80B411DC(this, play, 4); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -595,7 +595,7 @@ void func_80B41D64(EnKgy* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80B41CBC; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { Actor_PickUp(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); } @@ -744,7 +744,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC46: case 0xC55: func_80123D50(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE); - player->exchangeItemId = EXCH_ITEM_NONE; + player->exchangeItemId = PLAYER_AP_NONE; this->unk_29C &= ~0x8; play->msgCtx.msgLength = 0; func_80B41368(this, play, 4); @@ -759,7 +759,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC47: func_80B40BC0(this, 1); if (this->unk_29C & 8) { - player->exchangeItemId = EXCH_ITEM_NONE; + player->exchangeItemId = PLAYER_AP_NONE; this->unk_29C &= ~8; } func_80B40EBC(this, play, textId); @@ -948,7 +948,7 @@ void func_80B4296C(EnKgy* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_NONE); } } diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.h b/src/overlays/actors/ovl_En_Knight/z_en_knight.h index a4fca8554..167a96682 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.h +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.h @@ -12,16 +12,16 @@ typedef struct EnKnight { /* 0x144 */ s16 unk_144; /* 0x146 */ char unk_146[0x2]; /* 0x148 */ s8 unk_148; - /* 0x149 */ char pad149[8]; + /* 0x149 */ char unk_149[0x8]; /* 0x151 */ s8 unk_151; - /* 0x152 */ char pad152[1]; + /* 0x152 */ char unk_152[0x1]; /* 0x153 */ u8 unk_153; /* 0x154 */ u8 unk_154; - /* 0x155 */ char pad155[0x2CB]; + /* 0x155 */ char unk_155[0x2CB]; /* 0x420 */ EnKnightActionFunc actionFunc; /* 0x424 */ char unk_424[0x25C]; /* 0x680 */ u8 unk_680; - /* 0x681 */ char pad681[9]; + /* 0x681 */ char unk_681[0x9]; /* 0x68A */ s16 unk_68A; /* 0x68C */ char pad68C[0x48]; } EnKnight; // size = 0x6D4 diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index ca3d2c326..dc3ecc56c 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -244,12 +244,12 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { s32 collectible; s32 collectableParams; - if ((GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_GRASS) || (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_BUSH)) { + if ((KUSA_GET_TYPE(&this->actor) == ENKUSA_TYPE_GRASS) || (KUSA_GET_TYPE(&this->actor) == ENKUSA_TYPE_BUSH)) { if (!KUSA_GET_PARAMS_0C(&this->actor)) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, KUSA_GET_RAND_COLLECTIBLE_ID(&this->actor) * 0x10); } - } else if (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_REGROWING_GRASS) { + } else if (KUSA_GET_TYPE(&this->actor) == ENKUSA_TYPE_REGROWING_GRASS) { Item_DropCollectible(play, &this->actor.world.pos, 3); } else { collectible = func_800A8150(KUSA_GET_PARAMS_3F(&this->actor)); @@ -362,7 +362,7 @@ void EnKusa_InitCollider(Actor* thisx, PlayState* play) { void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = THIS; s32 pad; - s32 kusaType = GET_KUSA_TYPE(&this->actor); + s32 kusaType = KUSA_GET_TYPE(&this->actor); Actor_ProcessInitChain(&this->actor, sInitChain); @@ -393,7 +393,7 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { this->isInWater |= 1; } - this->objIndex = Object_GetIndex(&play->objectCtx, objectIds[(GET_KUSA_TYPE(&this->actor))]); + this->objIndex = Object_GetIndex(&play->objectCtx, objectIds[(KUSA_GET_TYPE(&this->actor))]); if (this->objIndex < 0) { Actor_MarkForDeath(&this->actor); return; @@ -429,7 +429,7 @@ void EnKusa_WaitObject(EnKusa* this, PlayState* play) { s32 pad; if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { - s32 kusaType = GET_KUSA_TYPE(&this->actor); + s32 kusaType = KUSA_GET_TYPE(&this->actor); if (this->isCut) { EnKusa_SetupCut(this); @@ -466,11 +466,11 @@ void EnKusa_WaitForInteract(EnKusa* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); if (KUSA_SHOULD_SPAWN_BUGS(&this->actor)) { - if (GET_KUSA_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { + if (KUSA_GET_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { EnKusa_SpawnBugs(this, play); } } - if (GET_KUSA_TYPE(&this->actor) == ENKUSA_TYPE_BUSH) { + if (KUSA_GET_TYPE(&this->actor) == ENKUSA_TYPE_BUSH) { Actor_MarkForDeath(&this->actor); } else { EnKusa_SetupCut(this); @@ -489,7 +489,7 @@ void EnKusa_WaitForInteract(EnKusa* this, PlayState* play) { if (this->actor.xzDistToPlayer < 400.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { - if (GET_KUSA_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { + if (KUSA_GET_TYPE(&this->actor) != ENKUSA_TYPE_GRASS_2) { Actor_LiftActor(&this->actor, play); } } @@ -558,7 +558,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { } EnKusa_SpawnFragments(this, play); EnKusa_DropCollectible(this, play); - switch (GET_KUSA_TYPE(&this->actor)) { + switch (KUSA_GET_TYPE(&this->actor)) { case ENKUSA_TYPE_BUSH: case ENKUSA_TYPE_GRASS: Actor_MarkForDeath(&this->actor); @@ -611,7 +611,7 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { } void EnKusa_SetupCut(EnKusa* this) { - switch (GET_KUSA_TYPE(&this->actor)) { + switch (KUSA_GET_TYPE(&this->actor)) { case ENKUSA_TYPE_GRASS: case ENKUSA_TYPE_GRASS_2: this->actionFunc = EnKusa_DoNothing; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index a4be56cf6..eca474d5f 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -34,6 +34,6 @@ extern const ActorInit En_Kusa_InitVars; #define KUSA_GET_PARAMS_3F(thisx) (((thisx)->params >> 0x2) & 0x3F) -#define GET_KUSA_TYPE(thisx)((thisx)->params & 0x3) +#define KUSA_GET_TYPE(thisx)((thisx)->params & 0x3) #endif // Z_EN_KUSA_H diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h index 67e172ee8..eb8276ac6 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.h @@ -9,8 +9,8 @@ struct EnKusa2UnkBssSubStruct; typedef void (*EnKusa2ActionFunc)(struct EnKusa2*, PlayState*); typedef void (*EnKusa2BssFunc)(struct EnKusa2UnkBssSubStruct*); -#define ENKUSA2_GET_1(thisx) (((thisx)->params) & 1) -#define ENKUSA2_GET_7F00(thisx) (u8)((((thisx)->params) >> 8) & 0x7F) +#define ENKUSA2_GET_1(thisx) ((thisx)->params & 1) +#define ENKUSA2_GET_7F00(thisx) (u8)(((thisx)->params >> 8) & 0x7F) typedef struct EnKusa2UnkBssSubStruct { /* 0x00 */ Vec3f unk_00; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 538b7b28d..e50cf0da5 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -174,7 +174,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->unk_144 * -20) & 0x1FF, 0x20, 0x80)); - sp68 = gGameplayKeepDrawFlameDL; + sp68 = gEffFire1DL; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sp6C->unk_00.r, sp6C->unk_00.g, sp6C->unk_00.b, sp6C->unk_00.a); gDPSetEnvColor(POLY_XLU_DISP++, sp6C->unk_04.r, sp6C->unk_04.g, sp6C->unk_04.b, 0); } else { 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 7441a14fd..de053c46a 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 @@ -295,7 +295,7 @@ void EnLookNuts_SendPlayerToSpawn(EnLookNuts* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); - play->nextEntranceIndex = Entrance_CreateIndexFromSpawn(this->spawnIndex); + play->nextEntrance = Entrance_CreateFromSpawn(this->spawnIndex); gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; 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 b7d67fbc3..a10b26514 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -134,10 +134,10 @@ static AnimationSpeedInfo sAnimationInfo[] = { { &gRomaniSittingLookDownAnim, 1.0f, ANIMMODE_LOOP, -6.0f }, }; -void EnMa4_ChangeAnim(EnMa4* this, s32 index) { - Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, - sAnimationInfo[index].morphFrames); +void EnMa4_ChangeAnim(EnMa4* this, s32 animIndex) { + Animation_Change(&this->skelAnime, sAnimationInfo[animIndex].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[animIndex].animation), sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } void func_80ABDD9C(EnMa4* this, PlayState* play) { @@ -214,10 +214,10 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { } else { EnMa4_InitPath(this, play); - if (gSaveContext.save.entranceIndex == 0x6410) { + if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 1)) { EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_AFTERHORSEBACKGAME; - } else if (gSaveContext.save.entranceIndex == 0x64A0) { + } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 10)) { EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_AFTERDESCRIBETHEMCS; } else { @@ -243,30 +243,30 @@ void EnMa4_Destroy(Actor* thisx, PlayState* play) { // Running in circles in the ranch void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { - static s32 sCurrentAnim = 9; + static s32 sAnimIndex = 9; static s32 D_80AC0250 = 0; static s16 D_80AC0254 = 10; Vec3f sp34; s32 pad; s16 sp2E; - if (sCurrentAnim != 9 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (sCurrentAnim == 3) { + if (sAnimIndex != 9 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if (sAnimIndex == 3) { if (D_80AC0250 < 3) { D_80AC0250++; } else { D_80AC0250 = 0; EnMa4_ChangeAnim(this, 13); - sCurrentAnim = 13; + sAnimIndex = 13; } } else { this->actor.speedXZ = 2.7f; EnMa4_ChangeAnim(this, 9); - sCurrentAnim = 9; + sAnimIndex = 9; } } - if (sCurrentAnim == 13 && Animation_OnFrame(&this->skelAnime, 37.0f)) { + if (sAnimIndex == 13 && Animation_OnFrame(&this->skelAnime, 37.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK); } @@ -282,7 +282,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { this->actor.speedXZ = 0.0f; D_80AC0254 = 2; EnMa4_ChangeAnim(this, 3); - sCurrentAnim = 3; + sAnimIndex = 3; } else { if (D_80AC0254 > 0) { D_80AC0254--; @@ -662,7 +662,7 @@ void EnMa4_SetupBeginHorsebackGame(EnMa4* this) { } void EnMa4_BeginHorsebackGame(EnMa4* this, PlayState* play) { - play->nextEntranceIndex = 0x6400; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_80; @@ -753,7 +753,7 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) { } } else if (sFrameCounter == 50) { play->actorCtx.unk268 = 0; - play->nextEntranceIndex = 0x6410; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 1); gSaveContext.nextCutsceneIndex = 0; sFrameCounter = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -828,7 +828,7 @@ void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); player->stateFlags1 |= 0x20; - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); D_80AC0260 = 99; this->hasBow = true; EnMa4_SetupEndEponasSongCs(this); @@ -850,7 +850,7 @@ void EnMa4_EndEponasSongCs(EnMa4* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; EnMa4_SetupDialogueHandler(this); } else { - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } @@ -859,7 +859,7 @@ void EnMa4_SetupBeginDescribeThemCs(EnMa4* this) { } void EnMa4_BeginDescribeThemCs(EnMa4* this, PlayState* play) { - play->nextEntranceIndex = 0x6400; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_64; 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 48817003a..e90b2decc 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 @@ -59,7 +59,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play); void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play); void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play); void EnMaYto_BarnStartDialogue(EnMaYto* this, PlayState* play); -void EnMaYto_ChangeAnim(EnMaYto* this, s32 index); +void EnMaYto_ChangeAnim(EnMaYto* this, s32 animIndex); void EnMaYto_UpdateEyes(EnMaYto* this); void func_80B90E50(EnMaYto* this, s16); void EnMaYto_SetRomaniFaceExpression(EnMaYto* this, s16 overrideEyeTexIndex, s16 mouthTexIndex); @@ -161,7 +161,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { this->unk31E = 0; this->blinkTimer = 100; - this->type = EN_MA_YTO_PARSE_TYPE(this->actor.params); + this->type = EN_MA_YTO_GET_TYPE(&this->actor); if (!EnMaYto_CheckValidSpawn(this, play)) { Actor_MarkForDeath(&this->actor); return; @@ -304,7 +304,7 @@ s32 EnMaYto_SearchRomani(EnMaYto* this, PlayState* play) { while (npcActor != NULL) { if (npcActor->id == ACTOR_EN_MA_YTS) { EnMaYts* romani = (EnMaYts*)npcActor; - s16 romaniType = EN_MA_YTS_PARSE_TYPE(&romani->actor); + s16 romaniType = EN_MA_YTS_GET_TYPE(&romani->actor); if ((this->type == MA_YTO_TYPE_DINNER && romaniType == MA_YTS_TYPE_SITTING) || (this->type == MA_YTO_TYPE_BARN && romaniType == MA_YTS_TYPE_BARN)) { @@ -380,10 +380,10 @@ void EnMaYto_KeepLookingForRomani(EnMaYto* this, PlayState* play) { void EnMaYto_SetupDefaultWait(EnMaYto* this) { if (this->actor.shape.rot.y == this->actor.home.rot.y) { - this->currentAnim = 11; + this->animIndex = 11; EnMaYto_ChangeAnim(this, 11); } else { - this->currentAnim = 1; + this->animIndex = 1; EnMaYto_ChangeAnim(this, 1); } @@ -398,8 +398,8 @@ void EnMaYto_DefaultWait(EnMaYto* this, PlayState* play) { direction = rotY - this->actor.yawTowardsPlayer; if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x3000, 0x100) == 0 && - this->currentAnim == 1) { - this->currentAnim = 11; + this->animIndex == 1) { + this->animIndex = 11; EnMaYto_ChangeAnim(this, 11); } @@ -1002,7 +1002,7 @@ void EnMaYto_PostMilkRunExplainReward(EnMaYto* this, PlayState* play) { EnMaYto_SetupPostMilkRunWaitDialogueEnd(this); } } else { - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } @@ -1091,11 +1091,9 @@ void EnMaYto_SetupPostMilkRunEnd(EnMaYto* this) { void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) { if (this->unk310 == 3) { - // Termina Field - play->nextEntranceIndex = 0x54D0; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 13); } else { - // Romani Ranch - play->nextEntranceIndex = 0x6480; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 8); } gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1270,10 +1268,10 @@ void EnMaYto_BarnStartDialogue(EnMaYto* this, PlayState* play) { } } -void EnMaYto_ChangeAnim(EnMaYto* this, s32 index) { - Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, - sAnimationInfo[index].morphFrames); +void EnMaYto_ChangeAnim(EnMaYto* this, s32 animIndex) { + Animation_Change(&this->skelAnime, sAnimationInfo[animIndex].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[animIndex].animation), sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } void func_80B90C78(EnMaYto* this, PlayState* play) { 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 7f2c50fb3..e21b30c29 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 @@ -20,7 +20,7 @@ typedef struct EnMaYto { /* 0x28C */ Vec3s morphTable[CREMIA_LIMB_MAX]; /* 0x310 */ s16 unk310; // state? /* 0x312 */ UNK_TYPE1 unk_312[0x2]; - /* 0x314 */ s16 currentAnim; // Used only in DefaultWait + /* 0x314 */ s16 animIndex; // Used only in DefaultWait /* 0x316 */ s16 overrideEyeTexIndex; // If non-zero, then this index will be used instead of eyeTexIndex /* 0x318 */ s16 mouthTexIndex; /* 0x31A */ s16 eyeTexIndex; @@ -40,7 +40,7 @@ typedef enum { /* 4 */ MA_YTO_TYPE_4 // HugCutscene? Doesn't seem to work properly in-game } EnMaYtoType; -#define EN_MA_YTO_PARSE_TYPE(params) (((params)&0xF000) >> 12) +#define EN_MA_YTO_GET_TYPE(thisx) (((thisx)->params & 0xF000) >> 12) #define EN_MA_YTO_PARAM(enMaYtsType, arg1) (((enMaYtsType) << 12) | ((arg1) << 8)) #endif // Z_EN_MA_YTO_H 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 72357758a..5fcf1c7f0 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 @@ -113,10 +113,10 @@ static TexturePtr sEyeTextures[] = { gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, }; -void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) { - Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[index].animation), sAnimationInfo[index].mode, - sAnimationInfo[index].morphFrames); +void EnMaYts_ChangeAnim(EnMaYts* this, s32 animIndex) { + Animation_Change(&this->skelAnime, sAnimationInfo[animIndex].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimationInfo[animIndex].animation), sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } void func_80B8D12C(EnMaYts* this, PlayState* play) { @@ -218,7 +218,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { EnMaYts* this = THIS; s32 pad; - this->type = EN_MA_YTS_PARSE_TYPE(thisx); + this->type = EN_MA_YTS_GET_TYPE(thisx); if (!EnMaYts_CheckValidSpawn(this, play)) { Actor_MarkForDeath(&this->actor); } 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 c3da6b71d..e34ef3d0e 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 @@ -16,16 +16,16 @@ typedef struct EnMaYts { /* 0x1D8 */ struct_800BD888_arg1 unk_1D8; /* 0x200 */ s32 unk_200; // Set, but not used /* 0x204 */ Vec3s jointTable[ROMANI_LIMB_MAX]; - /* 0x28E */ char unk_28E[0x6]; + /* 0x28E */ UNK_TYPE1 unk_28E[0x6]; /* 0x294 */ Vec3s morphTable[ROMANI_LIMB_MAX]; - /* 0x31E */ char unk_31E[0x8]; + /* 0x31E */ UNK_TYPE1 unk_31E[0x8]; /* 0x326 */ s16 blinkTimer; /* 0x328 */ s16 overrideEyeTexIndex; // If non-zero, then this index will be used instead of eyeTexIndex /* 0x32A */ s16 eyeTexIndex; /* 0x32C */ s16 unk_32C; // flag? /* 0x32E */ s16 mouthTexIndex; /* 0x330 */ s16 type; - /* 0x332 */ char unk_332[0x2]; + /* 0x332 */ UNK_TYPE1 unk_332[0x2]; /* 0x334 */ s16 endCreditsFlag; /* 0x336 */ s16 hasBow; /* 0x338 */ u16 textId; @@ -40,7 +40,7 @@ typedef enum { /* 3 */ MA_YTS_TYPE_ENDCREDITS } EnMaYtsType; -#define EN_MA_YTS_PARSE_TYPE(actor) ((((actor)->params)&0xF000) >> 12) +#define EN_MA_YTS_GET_TYPE(thisx) (((thisx)->params & 0xF000) >> 12) #define EN_MA_YTS_PARAM(enMaYtsType) ((enMaYtsType) << 12) /** 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 15af26aff..f71a25621 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -391,7 +391,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { gSaveContext.gameMode = 2; // Go to FileChoose play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_02; - play->nextEntranceIndex = 0x1C00; + play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.cutscene = 0; gSaveContext.sceneSetupIndex = 0; } 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 ad8bd2468..1e92e1f77 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -475,7 +475,7 @@ void EnMinifrog_EndChoir(EnMinifrog* this, PlayState* play) { Message_StartTextbox(play, 0xD7E, &this->actor); // "Let us do it again sometime." this->actionFunc = EnMinifrog_YellowFrogDialog; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -486,7 +486,7 @@ void EnMinifrog_GetFrogHP(EnMinifrog* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnMinifrog_EndChoir; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_NONE); } else { Actor_PickUp(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f); } 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 03dda25ad..cb25445b9 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -365,7 +365,7 @@ void func_80959C94(EnMk* this, PlayState* play) { Message_StartTextbox(play, 0xFB3, &this->actor); } else { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 350.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 350.0f, 1000.0f, PLAYER_AP_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index c383a000c..c8cc1abb1 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -5,6 +5,7 @@ */ #include "z_en_mkk.h" +#include "objects/object_mkk/object_mkk.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -22,8 +23,18 @@ void func_80A4E60C(EnMkk* this, PlayState* play); void func_80A4E72C(EnMkk* this, PlayState* play); void func_80A4EE48(EnMkk* this, PlayState* play); void func_80A4EF74(EnMkk* this, PlayState* play); +void func_80A4E0CC(EnMkk* this); +void func_80A4E190(EnMkk* this); +void func_80A4E2B8(EnMkk* this); +void func_80A4E58C(EnMkk* this); +void func_80A4EDF0(EnMkk* this); +void func_80A4EEF4(EnMkk* this); +void func_80A4F16C(Actor* thisx, PlayState* play); +void func_80A4F4C8(Actor* thisx, PlayState* play); +void func_80A4E67C(EnMkk* this); +void func_80A4E84C(EnMkk* this); +void func_80A4EBBC(EnMkk* this, PlayState* play); -#if 0 const ActorInit En_Mkk_InitVars = { ACTOR_EN_MKK, ACTORCAT_ENEMY, @@ -36,18 +47,36 @@ const ActorInit En_Mkk_InitVars = { (ActorFunc)EnMkk_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_80A4F720 = { - { COLTYPE_HIT3, AT_NONE | AT_TYPE_ENEMY, AC_NONE | 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_NONE | 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 }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A4F74C = { 1, 15, 30, 10 }; +typedef struct EnMkkDlists { + /* 0x00 */ Gfx* unk0; + /* 0x04 */ Gfx* unk4; + /* 0x08 */ Gfx* unk8; + /* 0x0C */ Gfx* unkC; +} EnMkkDlists; // size = 0x10 -// static DamageTable sDamageTable = { -static DamageTable D_80A4F754 = { +static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 30, 10 }; + +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -82,62 +111,499 @@ static DamageTable D_80A4F754 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A4F774[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(terminalVelocity, -5, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 3000, ICHAIN_STOP), }; -#endif +static Color_RGBA8 D_80A4F780 = { 250, 250, 250, 255 }; -extern ColliderSphereInit D_80A4F720; -extern CollisionCheckInfoInit D_80A4F74C; -extern DamageTable D_80A4F754; -extern InitChainEntry D_80A4F774[]; +static Color_RGBA8 D_80A4F784 = { 180, 180, 180, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Init.s") +static Vec3f D_80A4F788 = { 0.0f, 0.45f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Destroy.s") +static Color_RGBA8 sEffPrimColors[] = { { 50, 50, 50, 255 }, { 255, 255, 255, 255 } }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E0CC.s") +static Color_RGBA8 sEffEnvColors[] = { { 200, 200, 200, 255 }, { 255, 255, 255, 255 } }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E100.s") +static EnMkkDlists sBoeDLists[] = { + { object_mkk_DL_000030, object_mkk_DL_0000B0, object_mkk_DL_0000C8, object_mkk_DL_000140 }, + { object_mkk_DL_0001F0, object_mkk_DL_000278, object_mkk_DL_000290, object_mkk_DL_000310 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E190.s") +static Color_RGBA8 D_80A4F7C4[] = { + { 255, 255, 255, 255 }, { 128, 128, 128, 255 }, { 0, 0, 0, 255 }, + { 0, 0, 0, 255 }, { 128, 128, 128, 255 }, { 255, 255, 255, 255 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E1F0.s") +void EnMkk_Init(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; + s32 paramsFF00; + s32 params2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E22C.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); + this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + ActorShape_Init(&this->actor.shape, 1000.0f, NULL, 0.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E2B8.s") + this->primColorSelect = 0; + this->unk_149 = 0; + this->unk_152 = (this->actor.shape.rot.x >= 0) ? this->actor.shape.rot.x : this->actor.shape.rot.x * -0x50; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E2E8.s") + this->unk_14C = CLAMP(this->actor.shape.rot.z, 0, 16); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E58C.s") + this->actor.shape.rot.z = 0; + this->actor.world.rot.z = 0; + this->actor.shape.rot.x = 0; + this->actor.world.rot.x = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E60C.s") + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + this->unk_14B = ENMKK_GET_4(thisx) ? 8 : 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E67C.s") + paramsFF00 = ENMKK_GET_FF00(&this->actor); + params2 = ENMKK_GET_2(&this->actor); + this->actor.params &= 1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E72C.s") + if (this->actor.params == 1) { + this->actor.hintId = 0x3C; + } else { + this->actor.hintId = 0x2C; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E84C.s") + if ((paramsFF00 == 0) || (paramsFF00 == 255)) { + func_80A4E0CC(this); + this->unk_178 = 30000.0f; + if (params2 > 0) { + this->unk_14B |= 4; + } + } else { + this->unk_178 = paramsFF00 * 40.0f * 0.1f; + func_80A4EDF0(this); + this->unk_14E = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EBBC.s") +void EnMkk_Destroy(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Update.s") + Collider_DestroySphere(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EDF0.s") +void func_80A4E0CC(EnMkk* this) { + this->alpha = 0; + this->unk_14B |= 3; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionFunc = func_80A4E100; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EE48.s") +void func_80A4E100(EnMkk* this, PlayState* play) { + s32 newAlpha; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EEF4.s") + if (this->unk_14B & 4) { + newAlpha = this->alpha + 15; + } else { + newAlpha = this->alpha + 5; + } + if (newAlpha >= 255) { + this->primColorSelect = 3; + this->collider.base.acFlags |= AC_ON; + this->alpha = 255; + this->actor.flags |= ACTOR_FLAG_1; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->unk_14B &= ~4; + func_80A4E190(this); + } else { + this->alpha = newAlpha; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EF74.s") +void func_80A4E190(EnMkk* this) { + this->unk_14E = (s32)(Rand_ZeroOne() * 20.0f) + 10; + if (this->unk_149 != 0) { + this->unk_149--; + } + this->actionFunc = func_80A4E1F0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4F16C.s") +void func_80A4E1F0(EnMkk* this, PlayState* play) { + this->unk_14E--; + if (this->unk_14E == 0) { + func_80A4E2B8(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Draw.s") +void func_80A4E22C(EnMkk* this, PlayState* play) { + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4F4C8.s") + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 15.0f; + pos.z = this->actor.world.pos.z; + func_800B0DE0(play, &pos, &gZeroVec3f, &D_80A4F788, &D_80A4F780, &D_80A4F784, 350, 20); +} + +void func_80A4E2B8(EnMkk* this) { + this->unk_14E = 30; + this->unk_150 = this->actor.shape.rot.y; + this->unk_14B &= ~1; + this->actionFunc = func_80A4E2E8; +} + +void func_80A4E2E8(EnMkk* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp20; + + this->unk_14E--; + if ((this->actor.params == 1) && (this->actor.bgCheckFlags & 1) && (this->actor.speedXZ > 2.5f) && + ((play->gameplayFrames % 3) == 0)) { + func_80A4E22C(this, play); + } + if (this->unk_14E > 0) { + Math_StepToF(&this->actor.speedXZ, 5.0f, 0.7f); + sp20 = false; + } else { + sp20 = Math_StepToF(&this->actor.speedXZ, 0.0f, 0.7f); + } + if ((player->stateFlags3 & 0x100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { + Math_ScaledStepToS(&this->unk_150, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x400); + } else if ((player->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { + Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer + 0x8000, 0x400); + } else { + Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); + } + this->actor.shape.rot.y = + (s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speedXZ)) + this->unk_150; + func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); + if (sp20) { + this->unk_14B &= ~2; + func_80A4E190(this); + } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & 0x100)) && + (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & 1) && + (Actor_IsFacingPlayer(&this->actor, 0x1800)) && (this->actor.xzDistToPlayer < 120.0f) && + (fabsf(this->actor.playerHeightRel) < 100.0f)) { + func_80A4E58C(this); + } +} + +void func_80A4E58C(EnMkk* this) { + this->unk_14B |= 1; + this->actor.speedXZ = 3.0f; + this->actor.velocity.y = 5.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUROSUKE_ATTACK); + this->collider.base.atFlags |= AT_ON; + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); + this->actionFunc = func_80A4E60C; +} + +void func_80A4E60C(EnMkk* this, PlayState* play) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~(AT_ON | AT_HIT); + } + if ((this->actor.velocity.y < 0.0f) && (this->actor.bgCheckFlags & 1)) { + this->unk_149 = 2; + this->collider.base.atFlags &= ~AT_ON; + func_80A4E2B8(this); + } +} + +void func_80A4E67C(EnMkk* this) { + this->unk_14B |= 1; + this->actor.flags &= ~ACTOR_FLAG_1; + this->collider.base.acFlags &= ~AC_ON; + this->actor.flags |= ACTOR_FLAG_10; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); + this->alpha = 254; + func_800BE568(&this->actor, &this->collider); + this->actor.speedXZ = 7.0f; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.velocity.y = 5.0f; + this->actor.gravity = -1.3f; + this->actor.bgCheckFlags &= ~1; + this->actionFunc = func_80A4E72C; +} + +void func_80A4E72C(EnMkk* this, PlayState* play) { + Vec3f temp; + + if (this->actor.bgCheckFlags & 1) { + if (this->actor.velocity.y > -1.0f) { + temp.x = this->actor.world.pos.x; + temp.y = this->actor.world.pos.y + 15.0f; + temp.z = this->actor.world.pos.z; + EffectSsDeadDb_Spawn(play, &temp, &gZeroVec3f, &gZeroVec3f, &sEffPrimColors[this->actor.params], + &sEffEnvColors[this->actor.params], 0x46, 4, 0xC); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EXTINCT); + if (this->unk_14C != 0) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, this->unk_14C * 0x10); + } + func_80A4EEF4(this); + } else { + this->actor.velocity.y *= -0.8f; + this->actor.bgCheckFlags &= ~1; + } + } +} + +void func_80A4E84C(EnMkk* this) { + if (this->unk_14B & 3) { + Vec3f sp34; + f32 temp_fv0 = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.prevPos); + + Math_Vec3f_Copy(&sp34, &this->unk_154); + if (temp_fv0 < 0.001f) { + Math_Vec3f_Copy(&this->unk_154, &this->actor.prevPos); + } else { + temp_fv0 = 1.0f / temp_fv0; + + this->unk_154.x = + ((this->actor.prevPos.x - this->actor.world.pos.x) * temp_fv0 * 10.0f) + this->actor.world.pos.x; + this->unk_154.y = + ((this->actor.prevPos.y - this->actor.world.pos.y) * temp_fv0 * 10.0f) + this->actor.world.pos.y; + this->unk_154.z = + ((this->actor.prevPos.z - this->actor.world.pos.z) * temp_fv0 * 10.0f) + this->actor.world.pos.z; + } + temp_fv0 = Math_Vec3f_DistXYZ(&this->unk_154, &sp34); + if (temp_fv0 < 0.001f) { + Math_Vec3f_Copy(&this->unk_160, &sp34); + } else { + temp_fv0 = 1.0f / temp_fv0; + + this->unk_160.x = ((sp34.x - this->unk_154.x) * temp_fv0 * 12.0f) + this->unk_154.x; + this->unk_160.y = ((sp34.y - this->unk_154.y) * temp_fv0 * 12.0f) + this->unk_154.y; + this->unk_160.z = ((sp34.z - this->unk_154.z) * temp_fv0 * 12.0f) + this->unk_154.z; + } + } else { + this->unk_160.y = this->unk_154.y; + this->unk_154.y = this->actor.world.pos.y; + this->unk_154.x = this->actor.world.pos.x - + 10.0f * Math_SinS(this->actor.shape.rot.y + + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_154.z = this->actor.world.pos.z - + 10.0f * Math_CosS(this->actor.shape.rot.y + + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_160.x = this->unk_154.x - + 12.0f * Math_SinS(this->actor.shape.rot.y - + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_160.z = this->unk_154.z - + 12.0f * Math_CosS(this->actor.shape.rot.y - + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + } +} + +void func_80A4EBBC(EnMkk* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlag(&this->actor, &this->collider.info); + Enemy_StartFinishingBlow(play, &this->actor); + func_80A4E67C(this); + } +} + +void EnMkk_Update(Actor* thisx, PlayState* play) { + s32 pad; + Player* player; + EnMkk* this = THIS; + + if (this->primColorSelect > 0) { + this->primColorSelect--; + } else if ((Rand_ZeroOne() < 0.075f) && (this->actor.params != 1)) { + this->primColorSelect = 6; + } + func_80A4EBBC(this, play); + this->actionFunc(this, play); + this->actor.world.rot.y = this->actor.shape.rot.y; + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 0x1D); + if (this->actor.params == 0) { + func_80A4E84C(this); + } + if (Actor_IsFacingPlayer(&this->actor, 0x3000)) { + player = GET_PLAYER(play); + this->actor.shape.rot.x = Actor_PitchToPoint(&this->actor, &player->actor.focus.pos); + this->actor.shape.rot.x = CLAMP(this->actor.shape.rot.x, -0x1800, 0x1800); + } + Actor_SetFocus(&this->actor, 10.0f); + 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->collider.base.acFlags & AT_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} + +void func_80A4EDF0(EnMkk* this) { + this->alpha = 0; + this->unk_14B |= 3; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.draw = NULL; + this->actor.update = func_80A4F16C; + this->actor.gravity = -0.5f; + this->unk_14E = this->unk_152; + this->actionFunc = func_80A4EE48; +} + +void func_80A4EE48(EnMkk* this, PlayState* play) { + if (this->unk_14E > 0) { + this->unk_14E--; + if (this->unk_14E == 0) { + this->actor.flags &= ~ACTOR_FLAG_10; + } + } else if ((this->actor.xzDistToPlayer < this->unk_178) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + this->actor.update = EnMkk_Update; + this->actor.draw = EnMkk_Draw; + this->actor.flags &= ~ACTOR_FLAG_10; + func_80A4E0CC(this); + } +} + +void func_80A4EEF4(EnMkk* this) { + Math_Vec3f_Copy(&this->unk_16C, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + Actor_SetScale(&this->actor, 0.005f); + this->actor.update = func_80A4F16C; + this->actor.draw = func_80A4F4C8; + this->actionFunc = func_80A4EF74; +} + +void func_80A4EF74(EnMkk* this, PlayState* play) { + s32 newAlpha = this->alpha - 20; + + if (newAlpha <= 0) { + if (this->unk_14B & 8) { + Actor_SetScale(&this->actor, 0.01f); + this->primColorSelect = 0; + this->unk_149 = 0; + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 0.0f; + func_80A4EDF0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } else { + this->alpha = newAlpha; + this->actor.world.pos.x += 0.3f + (3.0f * Rand_ZeroOne()); + this->actor.world.pos.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_16C.x -= 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_16C.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_154.z += 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_154.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_160.z -= 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_160.y += 0.5f + (3.5f * Rand_ZeroOne()); + } +} + +void func_80A4F16C(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; + + this->actionFunc(this, play); +} + +void EnMkk_Draw(Actor* thisx, PlayState* play) { + EnMkkDlists* dLists = &sBoeDLists[thisx->params]; + Gfx* gfx; + Color_RGBA8* primColors; + EnMkk* this = THIS; + + if (this->actor.projectedPos.z > 0.0f) { + MtxF* matrix; + + OPEN_DISPS(play->state.gfxCtx); + + if (this->alpha == 255) { + primColors = &D_80A4F7C4[this->primColorSelect]; + gfx = POLY_OPA_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetPrimColor(&gfx[1], 0, 0xFF, primColors->r, primColors->g, primColors->b, primColors->a); + gSPSegment(&gfx[2], 0x08, D_801AEFA0); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unkC); + POLY_OPA_DISP = &gfx[5]; + } + gfx = POLY_XLU_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], 255, 255, 255, this->alpha); + gSPDisplayList(&gfx[2], dLists->unk0); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unk4); + if (thisx->params == 0) { + matrix = Matrix_GetCurrent(); + matrix->mf[3][0] = this->unk_154.x; + matrix->mf[3][1] = this->unk_154.y + 8.5f; + matrix->mf[3][2] = this->unk_154.z; + + Matrix_Scale(0.85f, 0.85f, 0.85f, MTXMODE_APPLY); + gSPMatrix(&gfx[5], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[6], dLists->unk4); + + matrix->mf[3][0] = this->unk_160.x; + matrix->mf[3][1] = this->unk_160.y + 7.2250004f; + matrix->mf[3][2] = this->unk_160.z; + + Matrix_Scale(0.85f, 0.85f, 0.85f, MTXMODE_APPLY); + gSPMatrix(&gfx[7], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[8], dLists->unk4); + gSPDisplayList(&gfx[9], dLists->unk8); + + POLY_XLU_DISP = &gfx[10]; + } else { + gSPDisplayList(&gfx[5], dLists->unk8); + POLY_XLU_DISP = &gfx[6]; + } + } + CLOSE_DISPS(play->state.gfxCtx); +} + +void func_80A4F4C8(Actor* thisx, PlayState* play) { + s32 pad; + Gfx* gfx; + MtxF* matrix; + EnMkkDlists* dLists = &sBoeDLists[thisx->params]; + EnMkk* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + gfx = POLY_XLU_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], 255, 255, 255, this->alpha); + gSPDisplayList(&gfx[2], dLists->unk0); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unk4); + + matrix = Matrix_GetCurrent(); + matrix->mf[3][0] = this->unk_154.x; + matrix->mf[3][1] = this->unk_154.y + 5.0f; + matrix->mf[3][2] = this->unk_154.z; + + gSPMatrix(&gfx[5], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[6], dLists->unk4); + + matrix->mf[3][0] = this->unk_160.x; + matrix->mf[3][1] = this->unk_160.y + 5.0f; + matrix->mf[3][2] = this->unk_160.z; + + gSPMatrix(&gfx[7], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[8], dLists->unk4); + + matrix->mf[3][0] = this->unk_16C.x; + matrix->mf[3][1] = this->unk_16C.y + 5.0f; + matrix->mf[3][2] = this->unk_16C.z; + + gSPMatrix(&gfx[9], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[10], dLists->unk4); + gSPDisplayList(&gfx[11], dLists->unk8); + POLY_XLU_DISP = &gfx[12]; + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h index 200186c44..a8e047284 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h @@ -3,6 +3,10 @@ #include "global.h" +#define ENMKK_GET_2(thisx) ((thisx)->params & 2) +#define ENMKK_GET_4(thisx) ((thisx)->params & 4) +#define ENMKK_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) + struct EnMkk; typedef void (*EnMkkActionFunc)(struct EnMkk*, PlayState*); @@ -10,7 +14,19 @@ typedef void (*EnMkkActionFunc)(struct EnMkk*, PlayState*); typedef struct EnMkk { /* 0x000 */ Actor actor; /* 0x144 */ EnMkkActionFunc actionFunc; - /* 0x148 */ char unk_148[0x8C]; + /* 0x148 */ u8 primColorSelect; + /* 0x149 */ u8 unk_149; + /* 0x14A */ u8 alpha; + /* 0x14B */ u8 unk_14B; + /* 0x14C */ u8 unk_14C; + /* 0x14E */ s16 unk_14E; + /* 0x150 */ s16 unk_150; + /* 0x152 */ s16 unk_152; + /* 0x154 */ Vec3f unk_154; + /* 0x160 */ Vec3f unk_160; + /* 0x16C */ Vec3f unk_16C; + /* 0x178 */ f32 unk_178; + /* 0x17C */ ColliderSphere collider; } EnMkk; // size = 0x1D4 extern const ActorInit En_Mkk_InitVars; 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 d263df3c8..0f7308826 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -63,11 +63,15 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfo sAnimations[] = { - { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, 2, -7.0f }, - { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, 2, -7.0f }, - { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, 0, -12.0f }, - { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, 0, -12.0f }, { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, 2, -10.0f }, +static AnimationInfo sAnimationInfo[] = { + { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, + { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, + { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, + { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, + { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, + { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f }, }; #include "overlays/ovl_En_Mm3/ovl_En_Mm3.c" @@ -119,7 +123,7 @@ s32 func_80A6F22C(EnMm3* this) { void func_80A6F270(EnMm3* this) { this->unk_1DC = 1; this->unk_2B0 &= ~1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); this->actionFunc = func_80A6F2C8; } @@ -211,7 +215,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { } this->unk_1DC = 0; this->unk_2B0 |= 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); break; case 0x278B: @@ -355,7 +359,7 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { } if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); } if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && @@ -366,7 +370,8 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { } void func_80A6FBA0(EnMm3* this) { - func_801A5BD0(0x6F); + AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | + (1 << BANK_OCARINA) | (1 << BANK_VOICE)); func_801A0238(0, 5); gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; @@ -391,7 +396,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - func_801A5BD0(0); + AudioSfx_MuteBanks(0); func_801A0238(0x7F, 5); Message_StartTextbox(play, 0x2791, &this->actor); this->unk_2B4 = 0x2791; diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c index fb8be21f2..14c235f51 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.c @@ -73,7 +73,7 @@ extern UNK_TYPE D_060105DC; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5A64.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5B38.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/EnMnk_ValidatePictograph.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mnk/func_80AB5B84.s") diff --git a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h index 495b8f07b..9baee87f0 100644 --- a/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h +++ b/src/overlays/actors/ovl_En_Mnk/z_en_mnk.h @@ -2,14 +2,15 @@ #define Z_EN_MNK_H #include "global.h" +#include "z64snap.h" struct EnMnk; typedef void (*EnMnkActionFunc)(struct EnMnk*, PlayState*); typedef struct EnMnk { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x2A4]; + /* 0x000 */ PictoActor picto; + /* 0x148 */ char unk_148[0x2A0]; /* 0x3E8 */ EnMnkActionFunc actionFunc; } EnMnk; // size = 0x3EC 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 0a3573516..01b5c4bec 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -149,7 +149,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { void EnMs_Sell(EnMs* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.textId = 0; - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_NONE); this->actionFunc = EnMs_TalkAfterPurchase; } else { Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, this->actor.xzDistToPlayer, this->actor.playerHeightRel); @@ -161,7 +161,7 @@ void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { func_80151938(play, 0x936); // "You can plant 'em whenever you want [...]" this->actionFunc = EnMs_Talk; } else { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_MINUS1); } } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 2200154aa..b20edf2b4 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 @@ -233,7 +233,7 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { */ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; - play->nextEntranceIndex = 0xD020; + play->nextEntrance = ENTRANCE(GORON_RACETRACK, 2); if (gSaveContext.save.weekEventReg[33] & 0x80) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -418,7 +418,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { if (((talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) || talkState == TEXT_STATE_CLOSING)) { if (this->shouldRestartRace) { - play->nextEntranceIndex = 0xD010; + play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); if (gSaveContext.save.weekEventReg[33] & 0x80) { // Spring @@ -478,7 +478,7 @@ void EnMttag_Init(Actor* thisx, PlayState* play) { Player* player; EnMttag* this = THIS; - if (gSaveContext.save.entranceIndex == 0xD010) { + if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { player = GET_PLAYER(play); player->stateFlags1 |= 0x20; this->raceInitialized = false; 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 c568e8f6e..69861434b 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -16,7 +16,7 @@ void EnMuto_Destroy(Actor* thisx, PlayState* play); void EnMuto_Update(Actor* thisx, PlayState* play); void EnMuto_Draw(Actor* thisx, PlayState* play); -void EnMuto_ChangeAnim(EnMuto* this, s32 arg1); +void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex); void EnMuto_SetHeadRotation(EnMuto* this); void EnMuto_SetupIdle(EnMuto* this); void EnMuto_Idle(EnMuto* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0f392dcfd..112871c90 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -187,7 +187,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { if (this->unkTimer24C == 0) { // targetLimbRots[0] is bodyRotY - if (animationState == NIW_ANIMATION_STILL) { + if (animationState == NIW_ANIM_STILL) { this->targetLimbRots[0] = 0.0f; } else { this->targetLimbRots[0] = -10000.0f * tempOne; @@ -197,7 +197,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { this->unkTimer24C = 3; if ((this->unk292 % 2) == 0) { this->targetLimbRots[0] = 0.0f; - if (animationState == NIW_ANIMATION_STILL) { + if (animationState == NIW_ANIM_STILL) { this->unkTimer24C = Rand_ZeroFloat(30.0f); } } @@ -208,11 +208,11 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { this->unkToggle296 &= 1; switch (animationState) { - case NIW_ANIMATION_STILL: + case NIW_ANIM_STILL: this->targetLimbRots[2] = 0.0f; // both wingRotZ this->targetLimbRots[1] = 0.0f; break; - case NIW_ANIMATION_HEAD_PECKING: + case NIW_ANIM_HEAD_PECKING: this->unkTimer24E = 3; this->targetLimbRots[2] = 7000.0f * tempOne; // both wingRotZ this->targetLimbRots[1] = 7000.0f * tempOne; @@ -222,7 +222,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { } break; - case NIW_ANIMATION_PECKING_AND_WAVING: + case NIW_ANIM_PECKING_AND_WAVING: this->unkTimer24E = 2; this->targetLimbRots[2] = -10000.0f; // both wingRotZ this->targetLimbRots[1] = -10000.0f; @@ -236,7 +236,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { } break; - case NIW_ANIMATION_PECKING_AND_FORFLAPPING: + case NIW_ANIM_PECKING_AND_FORFLAPPING: this->unkTimer24E = 2; this->targetLimbRots[5] = 10000.0f; // both wingRotY this->targetLimbRots[7] = 10000.0f; @@ -246,11 +246,11 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { } break; - case NIW_ANIMATION_FREEZE: + case NIW_ANIM_FREEZE: this->unkTimer24C = 5; break; - case NIW_ANIMATION_PECKING_SLOW_FORFLAPPING: + case NIW_ANIM_PECKING_SLOW_FORFLAPPING: this->unkTimer24E = 5; this->targetLimbRots[5] = 14000.0f; // both wingRotY this->targetLimbRots[7] = 14000.0f; @@ -348,7 +348,7 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { targetRotY = this->yawTowardsPlayer + runningDirection; Math_SmoothStepToS(&this->actor.world.rot.y, targetRotY, 3, this->unk300, 0); Math_ApproachF(&this->unk300, 3000.0f, 1.0f, 500.0f); - EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_SLOW_FORFLAPPING); + EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_SLOW_FORFLAPPING); } void EnNiw_SetupIdle(EnNiw* this) { @@ -363,7 +363,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { f32 posZ2; f32 posX1 = randPlusMinusPoint5Scaled(100.0f); f32 posZ1 = randPlusMinusPoint5Scaled(100.0f); - s16 nextAnimation; + s16 nextAnimIndex; if (this->niwType == NIW_TYPE_REGULAR) { if (Actor_HasParent(&this->actor, play)) { // picked up @@ -382,7 +382,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { this->unkIdleTimer2 = 10; } - nextAnimation = NIW_ANIMATION_STILL; // probably a scoped variable here, where their scope was different + nextAnimIndex = NIW_ANIM_STILL; // probably a scoped variable here, where their scope was different if (this->unkIdleTimer2 != 0) { if (Rand_ZeroFloat(3.99f) < 1.0f) { this->headRotationToggle++; @@ -423,7 +423,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { if (this->unkIdleTimer != 0) { Math_ApproachZeroF(&this->targetLimbRots[9], 0.5f, 4000.0f); // head rot - nextAnimation = NIW_ANIMATION_HEAD_PECKING; + nextAnimIndex = NIW_ANIM_HEAD_PECKING; Math_ApproachF(&this->actor.world.pos.x, this->unk2B0.x, 1.0f, this->unk300); Math_ApproachF(&this->actor.world.pos.z, this->unk2B0.z, 1.0f, this->unk300); Math_ApproachF(&this->unk300, 3.0f, 1.0f, 0.3f); @@ -447,7 +447,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { Math_ApproachF(&this->unk304, 10000.0f, 1.0f, 1000.0f); } - EnNiw_AnimateWingHead(this, play, nextAnimation); + EnNiw_AnimateWingHead(this, play, nextAnimIndex); } void EnNiw_Held(EnNiw* this, PlayState* play) { @@ -489,7 +489,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actionFunc = EnNiw_Thrown; } - EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } void EnNiw_Thrown(EnNiw* this, PlayState* play) { @@ -531,7 +531,7 @@ void EnNiw_Thrown(EnNiw* this, PlayState* play) { if (this->hoppingTimer > 5) { Actor_LiftActor(&this->actor, play); } - EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } } @@ -585,7 +585,7 @@ void EnNiw_Swimming(EnNiw* this, PlayState* play) { } } - EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } void EnNiw_Trigger(EnNiw* this, PlayState* play) { @@ -597,7 +597,7 @@ void EnNiw_Trigger(EnNiw* this, PlayState* play) { } this->cuccoStormTimer = 10; - this->niwState = this->nextAnimation = state; // NIW_ANIMATION_HEAD_PECKING + this->niwState = this->nextAnimIndex = state; // NIW_ANIM_HEAD_PECKING this->actionFunc = EnNiw_Upset; } @@ -607,12 +607,12 @@ void EnNiw_Upset(EnNiw* this, PlayState* play) { if (this->cuccoStormTimer == 0) { this->cuccoStormTimer = 60; this->unkTimer24C = 10; - this->nextAnimation = NIW_ANIMATION_FREEZE; + this->nextAnimIndex = NIW_ANIM_FREEZE; this->niwState = NIW_STATE_ANGRY2; this->actionFunc = EnNiw_SetupCuccoStorm; } - EnNiw_AnimateWingHead(this, play, this->nextAnimation); + EnNiw_AnimateWingHead(this, play, this->nextAnimIndex); } // the long crow with head back before they descend @@ -640,7 +640,7 @@ void EnNiw_SetupCuccoStorm(EnNiw* this, PlayState* play) { this->actionFunc = EnNiw_CuccoStorm; } - EnNiw_AnimateWingHead(this, play, this->nextAnimation); + EnNiw_AnimateWingHead(this, play, this->nextAnimIndex); } void EnNiw_CuccoStorm(EnNiw* this, PlayState* play) { @@ -697,7 +697,7 @@ void EnNiw_RunAway(EnNiw* this, PlayState* play) { } this->yawTowardsPlayer = Math_Atan2S(dX, dZ); EnNiw_UpdateRunning(this, play, false); - EnNiw_AnimateWingHead(this, play, NIW_ANIMATION_PECKING_AND_WAVING); + EnNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING); } } @@ -877,7 +877,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->headRotY = 0.0f; // clang-format off - this->isStormActive = this->unusedCounter28C = this->unk292 = this->unk29E = this->unk298 = this->isRunningRight = this->nextAnimation = 0; + this->isStormActive = this->unusedCounter28C = this->unk292 = this->unk29E = this->unk298 = this->isRunningRight = this->nextAnimIndex = 0; // clang-format on for (i = 0; i < 10; i++) { diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 2be60884e..c1cec3b88 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -61,7 +61,7 @@ typedef struct EnNiw { /* 0x296 */ s16 unkToggle296; /* 0x298 */ s16 unk298; /* 0x29C */ s16 isRunningRight; // toggle (direction cucco is turning while running) - /* 0x29C */ u16 nextAnimation; + /* 0x29C */ u16 nextAnimIndex; /* 0x29E */ s16 unk29E; // three states 0/1/2 /* 0x2A0 */ s16 isStormActive; // we have a data value shared between all cucco, this shouldn't need to exist /* 0x2A2 */ s16 niwType; @@ -100,13 +100,12 @@ typedef struct EnNiw { // the attacking cuccos are not here, they are a different actor: [ ovl_En_Attack_Niw ] typedef enum { - /* 0 */ NIW_ANIMATION_STILL, - /* 1 */ NIW_ANIMATION_HEAD_PECKING, // forward and backward, feeding - /* 2 */ NIW_ANIMATION_PECKING_AND_WAVING, // wings move along their axis, like human hand waving - /* 3 */ NIW_ANIMATION_PECKING_AND_FORFLAPPING, // (unused) low (yaw based) flapping, forward and back - /* 4 */ NIW_ANIMATION_FREEZE, // used during Cucco Storm - /* 5 */ NIW_ANIMATION_PECKING_SLOW_FORFLAPPING, // wing speed half that of 3 - + /* 0 */ NIW_ANIM_STILL, + /* 1 */ NIW_ANIM_HEAD_PECKING, // forward and backward, feeding + /* 2 */ NIW_ANIM_PECKING_AND_WAVING, // wings move along their axis, like human hand waving + /* 3 */ NIW_ANIM_PECKING_AND_FORFLAPPING, // (unused) low (yaw based) flapping, forward and back + /* 4 */ NIW_ANIM_FREEZE, // used during Cucco Storm + /* 5 */ NIW_ANIM_PECKING_SLOW_FORFLAPPING, // wing speed half that of 3 } EnNiwHeadAndWingAnimationState; diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 972513c04..2f842c8ae 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -236,7 +236,7 @@ void EnNwc_CheckFound(EnNwc* this, PlayState* play) { } EnNwc_ChangeState(this, NWC_STATE_FOLLOWING); - func_801A0868(&D_801DB4A4, NA_SE_SY_CHICK_JOIN_CHIME, currentChickCount); + func_801A0868(&gSfxDefaultPos, NA_SE_SY_CHICK_JOIN_CHIME, currentChickCount); } } 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 445787abe..b2fee9d8d 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -28,7 +28,7 @@ const ActorInit En_Osn_InitVars = { (ActorFunc)EnOsn_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_osn_Anim_0201BC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &object_osn_Anim_002F74, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &object_osn_Anim_0037C4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, @@ -179,27 +179,27 @@ s32 func_80AD08B0(PlayState* play) { void func_80AD0998(EnOsn* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_1EC].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_1EC].animation); if (this->unk_1EC == 0x12 && curFrame == lastFrame) { this->unk_1EC = 0x13; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0x13); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0x13); } } void func_80AD0A24(EnOsn* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_1EC].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_1EC].animation); if (this->unk_1EC == 0x15 && curFrame == lastFrame) { this->unk_1EC = 0x16; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0x16); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0x16); } } void func_80AD0AB0(EnOsn* this) { s16 curFrame = this->skelAnime.curFrame; - s16 lastFrame = Animation_GetLastFrame(sAnimations[this->unk_1EC].animation); + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_1EC].animation); if (curFrame == lastFrame) { this->unk_1FA -= 8; @@ -608,7 +608,7 @@ void func_80AD144C(EnOsn* this, PlayState* play) { u32 sp1C = Flags_GetSwitch(play, 0); this->cutscene = this->actor.cutscene; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); if (sp1C == 0) { this->actionFunc = func_80AD16A8; } else { @@ -728,7 +728,7 @@ void func_80AD16A8(EnOsn* this, PlayState* play) { this->unk_1EC = 0; break; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_1EC); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_1EC); } if ((this->unk_1EC == 5) && (play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && @@ -789,17 +789,19 @@ void EnOsn_Init(Actor* thisx, PlayState* play) { this->unk_1FA = 255; switch (ENOSN_GET_3(&this->actor)) { case 0: - if (((gSaveContext.save.entranceIndex == 0xC020) || (gSaveContext.save.entranceIndex == 0xC030)) || - (gSaveContext.save.entranceIndex == 0xC060)) { + if (((gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 2)) || + (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 3))) || + (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 6))) { this->unk_1EA |= 1; } this->unk_1F0 = 1; if (play->sceneNum == SCENE_INSIDETOWER) { - if ((gSaveContext.save.entranceIndex == 0xC020) || (gSaveContext.save.entranceIndex == 0xC060)) { + if ((gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 2)) || + (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 6))) { this->actionFunc = func_80AD16A8; return; } - if (gSaveContext.save.entranceIndex == 0xC030) { + if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 3)) { func_80AD1398(this); this->actionFunc = func_80AD1634; return; @@ -812,13 +814,13 @@ void EnOsn_Init(Actor* thisx, PlayState* play) { case 1: this->unk_1EC = 0xF; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_1EC); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_1EC); this->actionFunc = EnOsn_Idle; break; case 2: this->unk_1EC = 0x10; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_1EC); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_1EC); this->actionFunc = EnOsn_Idle; break; 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 8e747abe2..fc5a2a724 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -60,36 +60,36 @@ typedef enum { } EnOssanCutsceneState; 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; typedef enum { - /* 00 */ ANI_ANIMATION_STANDING_NORMAL_LOOP_1, - /* 01 */ ANI_ANIMATION_STANDING_NORMAL_LOOP_2, - /* 02 */ ANI_ANIMATION_STANDING_NORMAL_ONCE_FORWARD_1, - /* 03 */ ANI_ANIMATION_STANDING_NORMAL_ONCE_REVERSE, - /* 04 */ ANI_ANIMATION_STANDING_NORMAL_ONCE_FORWARD_2, - /* 05 */ ANI_ANIMATION_STANDING_NORMAL_LOOP_3, - /* 06 */ ANI_ANIMATION_STANDING_NORMAL_ONCE_FORWARD_3, - /* 07 */ ANI_ANIMATION_STANDING_NORMAL_LOOP_4, - /* 08 */ ANI_ANIMATION_APOLOGY_START, - /* 09 */ ANI_ANIMATION_APOLOGY_LOOP, - /* 10 */ ANI_ANIMATION_STANDING_NORMAL_ONCE_FORWARD_4, - /* 11 */ ANI_ANIMATION_STANDING_NORMAL_LOOP_5, - /* 12 */ ANI_ANIMATION_MAX + /* 0 */ ANI_ANIM_STANDING_NORMAL_LOOP_1, + /* 1 */ ANI_ANIM_STANDING_NORMAL_LOOP_2, + /* 2 */ ANI_ANIM_STANDING_NORMAL_ONCE_FORWARD_1, + /* 3 */ ANI_ANIM_STANDING_NORMAL_ONCE_REVERSE, + /* 4 */ ANI_ANIM_STANDING_NORMAL_ONCE_FORWARD_2, + /* 5 */ ANI_ANIM_STANDING_NORMAL_LOOP_3, + /* 6 */ ANI_ANIM_STANDING_NORMAL_ONCE_FORWARD_3, + /* 7 */ ANI_ANIM_STANDING_NORMAL_LOOP_4, + /* 8 */ ANI_ANIM_APOLOGY_START, + /* 9 */ ANI_ANIM_APOLOGY_LOOP, + /* 10 */ ANI_ANIM_STANDING_NORMAL_ONCE_FORWARD_4, + /* 11 */ ANI_ANIM_STANDING_NORMAL_LOOP_5, + /* 12 */ ANI_ANIM_MAX } AniAnimation; const ActorInit En_Ossan_InitVars = { @@ -104,7 +104,7 @@ const ActorInit En_Ossan_InitVars = { (ActorFunc)NULL, }; -static AnimationInfoS sCuriosityShopManAnimations[] = { +static AnimationInfoS sCuriosityShopManAnimationInfo[] = { { &gFsnIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gFsnScratchBackAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gFsnTurnAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -120,7 +120,7 @@ static AnimationInfoS sCuriosityShopManAnimations[] = { { &gFsnMakeOfferAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, }; -static AnimationInfoS sPartTimerAnimations[] = { +static AnimationInfoS sPartTimerAnimationInfo[] = { { &gAniStandingNormalAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, { &gAniStandingNormalAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, { &gAniStandingNormalAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -137,7 +137,7 @@ static AnimationInfoS sPartTimerAnimations[] = { static s16 sObjectIds[] = { OBJECT_FSN, OBJECT_ANI }; -static AnimationInfoS* sAnimations[] = { sCuriosityShopManAnimations, sPartTimerAnimations }; +static AnimationInfoS* sAnimationInfo[] = { sCuriosityShopManAnimationInfo, sPartTimerAnimationInfo }; static f32 sActorScales[] = { 0.01f, 0.01f }; @@ -389,11 +389,11 @@ void EnOssan_Idle(EnOssan* this, PlayState* play) { } void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { - AnimationInfoS* animations = sAnimations[this->actor.params]; + AnimationInfoS* animationInfo = sAnimationInfo[this->actor.params]; s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(animations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(animationInfo[this->animIndex].animation); - if (this->animationIndex == FSN_ANIMATION_TURN_AROUND_REVERSE) { + if (this->animIndex == FSN_ANIM_TURN_AROUND_REVERSE) { frameCount = 0; } if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_WAITING) { @@ -406,40 +406,40 @@ void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { } if (this->actor.params == ENOSSAN_CURIOSITY_SHOP_MAN) { if (curFrame == frameCount) { - switch (this->animationIndex) { - case FSN_ANIMATION_SCRATCH_BACK: - this->animationIndex = FSN_ANIMATION_TURN_AROUND_FORWARD; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, FSN_ANIMATION_TURN_AROUND_FORWARD); + switch (this->animIndex) { + case FSN_ANIM_SCRATCH_BACK: + this->animIndex = FSN_ANIM_TURN_AROUND_FORWARD; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, FSN_ANIM_TURN_AROUND_FORWARD); break; - case FSN_ANIMATION_TURN_AROUND_FORWARD: + case FSN_ANIM_TURN_AROUND_FORWARD: EnOssan_SetHaveMet(this); this->textId = EnOssan_CuriosityShopMan_GetWelcome(this, play); - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, this->animationIndex); + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, this->animIndex); break; - case FSN_ANIMATION_HANDS_ON_COUNTER_START: - case FSN_ANIMATION_HAND_ON_FACE_START: - case FSN_ANIMATION_LEAN_FORWARD_START: - case FSN_ANIMATION_SLAM_COUNTER_START: - this->animationIndex++; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, this->animationIndex); + case FSN_ANIM_HANDS_ON_COUNTER_START: + case FSN_ANIM_HAND_ON_FACE_START: + case FSN_ANIM_LEAN_FORWARD_START: + case FSN_ANIM_SLAM_COUNTER_START: + this->animIndex++; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, this->animIndex); Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, false); break; - case FSN_ANIMATION_HANDS_ON_COUNTER_LOOP: - case FSN_ANIMATION_HAND_ON_FACE_LOOP: - case FSN_ANIMATION_LEAN_FORWARD_LOOP: - case FSN_ANIMATION_SLAM_COUNTER_LOOP: - this->animationIndex = FSN_ANIMATION_TURN_AROUND_REVERSE; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, FSN_ANIMATION_TURN_AROUND_REVERSE); + case FSN_ANIM_HANDS_ON_COUNTER_LOOP: + case FSN_ANIM_HAND_ON_FACE_LOOP: + case FSN_ANIM_LEAN_FORWARD_LOOP: + case FSN_ANIM_SLAM_COUNTER_LOOP: + this->animIndex = FSN_ANIM_TURN_AROUND_REVERSE; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, FSN_ANIM_TURN_AROUND_REVERSE); break; - case FSN_ANIMATION_TURN_AROUND_REVERSE: - this->animationIndex = FSN_ANIMATION_SCRATCH_BACK; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, FSN_ANIMATION_SCRATCH_BACK); + case FSN_ANIM_TURN_AROUND_REVERSE: + this->animIndex = FSN_ANIM_SCRATCH_BACK; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, FSN_ANIM_SCRATCH_BACK); EnOssan_SetupAction(this, EnOssan_Idle); break; default: - this->animationIndex = FSN_ANIMATION_SCRATCH_BACK; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, FSN_ANIMATION_SCRATCH_BACK); + this->animIndex = FSN_ANIM_SCRATCH_BACK; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, FSN_ANIM_SCRATCH_BACK); EnOssan_SetupAction(this, EnOssan_Idle); break; } @@ -557,16 +557,16 @@ u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIdx, u8 shelfSlotMax) { } void EnOssan_Hello(EnOssan* this, PlayState* play) { - AnimationInfoS* animations = sAnimations[this->actor.params]; + AnimationInfoS* animationInfo = sAnimationInfo[this->actor.params]; u8 talkState = Message_GetState(&play->msgCtx); s32 pad; Player* player = GET_PLAYER(play); EnOssan_RotateHead(this, 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); + if ((this->animIndex == ANI_ANIM_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { + this->animIndex = ANI_ANIM_STANDING_NORMAL_LOOP_2; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, 1); } this->flags &= ~LOOKED_AT_PLAYER; if (player->transformation == PLAYER_FORM_DEKU) { @@ -582,24 +582,24 @@ void EnOssan_Hello(EnOssan* this, PlayState* play) { } 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); + this->animIndex = ANI_ANIM_APOLOGY_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, ANI_ANIM_APOLOGY_LOOP); } - if ((this->animationIndex == FSN_ANIMATION_SLAM_COUNTER_LOOP) && Animation_OnFrame(&this->skelAnime, 18.0f)) { + if ((this->animIndex == FSN_ANIM_SLAM_COUNTER_LOOP) && Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO); } } s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { - AnimationInfoS* animations = sAnimations[this->actor.params]; + AnimationInfoS* animationInfo = sAnimationInfo[this->actor.params]; Player* player = GET_PLAYER(play); switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); if ((this->actor.params == ENOSSAN_PART_TIME_WORKER) && (player->transformation == PLAYER_FORM_ZORA)) { - this->animationIndex = ANI_ANIMATION_APOLOGY_LOOP; - SubS_ChangeAnimationByInfoS(&this->skelAnime, animations, 9); + this->animIndex = ANI_ANIM_APOLOGY_LOOP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, 9); } EnOssan_SetupAction(this, EnOssan_TalkToShopkeeper); func_80151938(play, sTalkOptionTextIds[this->actor.params]); @@ -663,12 +663,12 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { } void EnOssan_TalkToShopkeeper(EnOssan* this, PlayState* play) { - AnimationInfoS* animations = sAnimations[this->actor.params]; + AnimationInfoS* animationInfo = sAnimationInfo[this->actor.params]; 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); + if ((this->animIndex == ANI_ANIM_APOLOGY_LOOP) && (this->actor.params == ENOSSAN_PART_TIME_WORKER)) { + this->animIndex = ANI_ANIM_STANDING_NORMAL_LOOP_2; + SubS_ChangeAnimationByInfoS(&this->skelAnime, animationInfo, 1); } EnOssan_StartShopping(play, this); } @@ -1109,7 +1109,7 @@ void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1132,7 +1132,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { player->stateFlags2 |= 0x20000000; Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 100.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 100.0f, PLAYER_AP_MINUS1); break; case 1: default: @@ -1150,7 +1150,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) { player->stateFlags2 |= 0x20000000; Message_StartTextbox(play, this->textId, &this->actor); EnOssan_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 100.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 100.0f, PLAYER_AP_MINUS1); } } @@ -1174,7 +1174,7 @@ void EnOssan_ItemPurchased(EnOssan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80151938(play, 0x642); } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1379,31 +1379,31 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) { u16 textId = Text_GetFaceReaction(play, 0x2F); if (textId != 0) { - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_START; + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START; this->flags |= END_INTERACTION; return textId; } switch (player->transformation) { case PLAYER_FORM_DEKU: - this->animationIndex = FSN_ANIMATION_SLAM_COUNTER_START; + this->animIndex = FSN_ANIM_SLAM_COUNTER_START; if (gSaveContext.save.weekEventReg[18] & 0x10) { return sWelcomeDekuTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeDekuFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_ZORA: - this->animationIndex = FSN_ANIMATION_LEAN_FORWARD_START; + this->animIndex = FSN_ANIM_LEAN_FORWARD_START; if (gSaveContext.save.weekEventReg[18] & 8) { return sWelcomeZoraTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeZoraFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; case PLAYER_FORM_GORON: - this->animationIndex = FSN_ANIMATION_HAND_ON_FACE_START; + this->animIndex = FSN_ANIM_HAND_ON_FACE_START; if (gSaveContext.save.weekEventReg[18] & 4) { return sWelcomeGoronTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } return sWelcomeGoronFirstTimeTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } - this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_START; + this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START; return sWelcomeHumanTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } @@ -1526,8 +1526,8 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) { this->shopItemSelectedTween = 0.0f; Actor_SetScale(&this->actor, sActorScales[this->actor.params]); - this->animationIndex = 1; // FSN_ANIMATION_SCRATCH_BACK and ANI_ANIMATION_STANDING_NORMAL_LOOP_2 - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations[this->actor.params], 1); + this->animIndex = 1; // FSN_ANIM_SCRATCH_BACK and ANI_ANIM_STANDING_NORMAL_LOOP_2 + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo[this->actor.params], 1); EnOssan_SpawnShopItems(this, play, shopItems); this->blinkTimer = 20; this->eyeTexIndex = 0; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index 32c6fc288..539906ea8 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -56,7 +56,7 @@ typedef struct EnOssan { /* 0x2F8 */ s16 limbRotTableZ[19]; /* 0x31E */ Vec3s jointTable[ENOSSAN_LIMB_MAX]; /* 0x390 */ Vec3s morphTable[ENOSSAN_LIMB_MAX]; - /* 0x402 */ s16 animationIndex; + /* 0x402 */ s16 animIndex; /* 0x404 */ Vec3s partTimerHeadRot; /* 0x40A */ u16 flags; } EnOssan; // size = 0x40C 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 ad10226ed..6ea2c6153 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -163,7 +163,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.gravity = 0.0f; SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->skelAnime.curFrame = Rand_ZeroOne() * this->skelAnime.endFrame; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_744.r = 255; @@ -300,7 +300,7 @@ void func_80B5BB38(Color_RGB8* arg0, Color_RGB8* arg1, f32 arg2) { } void func_80B5BDA8(EnOt* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->actionFunc = func_80B5BE04; } @@ -322,7 +322,7 @@ void func_80B5BE04(EnOt* this, PlayState* play) { } void func_80B5BE88(EnOt* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); this->actionFunc = func_80B5BED4; } @@ -337,7 +337,7 @@ void func_80B5BED4(EnOt* this, PlayState* play) { void func_80B5BF60(EnOt* this, PlayState* play) { this->unk_32C |= 0x40; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5BFB8; } @@ -410,8 +410,8 @@ void func_80B5C25C(EnOt* this, PlayState* play) { if ((this->unk_33C == 2) && (this->unk_32C & 0x80) && (this->unk_360->unk_32C & 0x80)) { this->unk_32C |= 0x100; this->unk_360->unk_32C |= 0x100; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 2, &this->animIdx); - SubS_ChangeAnimationBySpeedInfo(&this->unk_360->skelAnime, sAnimations, 2, &this->unk_360->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 2, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->unk_360->skelAnime, sAnimations, 2, &this->unk_360->animIndex); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); this->unk_360->actor.flags |= ACTOR_FLAG_8000000; @@ -489,7 +489,7 @@ void func_80B5C64C(EnOt* this, PlayState* play) { void func_80B5C684(EnOt* this, PlayState* play) { this->actor.speedXZ = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5C6DC; } @@ -606,7 +606,7 @@ void func_80B5CB0C(EnOt* this, PlayState* play) { void func_80B5CBA0(EnOt* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_NONE); this->actionFunc = func_80B5CBEC; } @@ -617,7 +617,7 @@ void func_80B5CBEC(EnOt* this, PlayState* play) { } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_NONE); } } @@ -635,7 +635,7 @@ void func_80B5CCA0(EnOt* this, PlayState* play) { } void func_80B5CCF4(EnOt* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5CD40; } @@ -676,7 +676,7 @@ void func_80B5CD40(EnOt* this, PlayState* play) { void func_80B5CE6C(EnOt* this, PlayState* play) { this->unk_384 = 0; this->unk_32C |= 0x20; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5CEC8; } @@ -693,7 +693,7 @@ void func_80B5CEC8(EnOt* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); if (this->unk_32C & 0x800) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { @@ -731,7 +731,7 @@ void func_80B5CEC8(EnOt* this, PlayState* play) { } void func_80B5D114(EnOt* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->actionFunc = func_80B5D160; } @@ -886,7 +886,7 @@ void func_80B5D648(EnOt* this, PlayState* play) { this->actorPath.pointOffset.z = 0.0f; this->actor.gravity = 0.0f; this->actor.speedXZ = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Flags_SetSwitch(play, ENOT_GET_3F80(&this->actor)); @@ -929,7 +929,7 @@ void EnOt_Update(Actor* thisx, PlayState* play) { s32 pad; EnOt* this = THIS; - if ((this->animIdx == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if ((this->animIndex == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SEAHORSE_SWIM); } 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 e123b8871..5399e2278 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -35,7 +35,7 @@ typedef struct EnOt { /* 0x18C */ ColliderCylinder collider; /* 0x1D8 */ Vec3s jointTable[19]; /* 0x24A */ Vec3s morphTable[19]; - /* 0x2BC */ s32 animIdx; + /* 0x2BC */ s32 animIndex; /* 0x2C0 */ ActorPathing actorPath; /* 0x32C */ u16 unk_32C; /* 0x330 */ Vec3f unk_330; 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 6b9bce5ab..f1bfcd57f 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -229,7 +229,7 @@ s32 func_8095A978(EnOwl* this, PlayState* play, u16 textId, f32 targetDist, f32 this->actor.textId = textId; if (this->actor.xzDistToPlayer < targetDist) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, targetDist, arg4, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, targetDist, arg4, PLAYER_AP_NONE); } return false; @@ -242,7 +242,7 @@ s32 func_8095A9FC(EnOwl* this, PlayState* play, u16 textId) { this->actor.textId = textId; if (this->actor.xzDistToPlayer < 120.0f) { - func_800B8500(&this->actor, play, 350.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 350.0f, 1000.0f, PLAYER_AP_NONE); } return false; @@ -505,7 +505,7 @@ void func_8095B574(EnOwl* this, PlayState* play) { this->unk_406 = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 200.0f, 400.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 400.0f, PLAYER_AP_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -718,11 +718,11 @@ void func_8095BE0C(EnOwl* this, PlayState* play) { this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { if (this->actor.isTargeted) { - func_800B8500(&this->actor, play, 200.0f, 200.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 200.0f, PLAYER_AP_NONE); } } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 200.0f, 200.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 200.0f, 200.0f, PLAYER_AP_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; } 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 603d08fb5..075ced540 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -105,7 +105,7 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_pamera_Anim_0005BC, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_pamera_Anim_008AE0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_pamera_Anim_008E38, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, @@ -155,12 +155,14 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { func_80BD8658(this); if (1) {} if (!(gSaveContext.save.weekEventReg[14] & 4) || (gSaveContext.save.weekEventReg[52] & 0x20) || - (gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.entranceIndex == 0x2090)) { + (gSaveContext.save.weekEventReg[75] & 0x20) || (gSaveContext.save.entrance == ENTRANCE(IKANA_CANYON, 9))) { Actor_MarkForDeath(&this->actor); } if (gSaveContext.save.weekEventReg[61] & 4) { - if (!(gSaveContext.save.weekEventReg[59] & 1) || (gSaveContext.save.entranceIndex != 0x2020)) { - if ((gSaveContext.save.entranceIndex != 0x2020) && (gSaveContext.save.weekEventReg[59] & 1)) { + if (!(gSaveContext.save.weekEventReg[59] & 1) || + (gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 2))) { + if ((gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 2)) && + (gSaveContext.save.weekEventReg[59] & 1)) { gSaveContext.save.weekEventReg[59] &= (u8)~1; } func_80BD8700(this); @@ -232,7 +234,7 @@ void EnPamera_Destroy(Actor* thisx, PlayState* play) { void func_80BD8700(EnPamera* this) { this->hideInisdeTimer = 0; this->actor.flags &= ~ACTOR_FLAG_1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80BD8758; } @@ -243,7 +245,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[0])), &this->actor); this->actor.speedXZ = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; func_80BD9338(this, play); @@ -252,7 +254,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } else { this->actor.speedXZ = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; func_80BD9338(this, play); @@ -274,7 +276,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { void func_80BD8908(EnPamera* this) { this->actor.draw = EnPamera_Draw; this->actor.flags |= ACTOR_FLAG_1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80BD8964; } @@ -287,14 +289,14 @@ void func_80BD8964(EnPamera* this, PlayState* play) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &vec, 1.0f) < 5.0f) { this->actor.speedXZ = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); gSaveContext.save.weekEventReg[59] |= 1; func_80BD8B50(this); } } void func_80BD8A38(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80BD8A7C; } @@ -341,14 +343,14 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { void func_80BD8CCC(EnPamera* this) { this->hideInisdeTimer = 0; this->actor.speedXZ = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80BD8D1C; } void func_80BD8D1C(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 200) { this->actor.speedXZ = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); func_80BD8D80(this); } } @@ -384,14 +386,14 @@ void func_80BD8DB0(EnPamera* this, PlayState* play) { void EnPamera_LookDownWell(EnPamera* this) { func_80BD93CC(this, 1, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80BD8F60; } void func_80BD8F60(EnPamera* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x3000, 0x1000); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actor.speedXZ = 3.0f; func_80BD93CC(this, 0, 0); func_80BD8D80(this); @@ -408,7 +410,7 @@ void func_80BD8FF0(EnPamera* this) { pameraYaw = Math_Vec3f_Yaw(&pameraPos, &this->actor.world.pos); this->actor.shape.rot.y = pameraYaw; this->actor.world.rot.y = pameraYaw; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80BD909C; } @@ -684,7 +686,7 @@ void func_80BD9B4C(EnPamera* this, PlayState* play) { } void func_80BD9C70(EnPamera* this, PlayState* play) { - play->nextEntranceIndex = 0x2020; + play->nextEntrance = ENTRANCE(IKANA_CANYON, 2); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_70; gSaveContext.nextTransitionType = TRANS_TYPE_02; @@ -747,7 +749,7 @@ void func_80BD9E78(EnPamera* this, PlayState* play) { } void func_80BD9E88(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->unk_31E = 0; this->setupFunc = func_80BD9ED0; } @@ -756,7 +758,7 @@ void func_80BD9ED0(EnPamera* this, PlayState* play) { } void func_80BD9EE0(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); func_80BD93CC(this, 1, 0); this->unk_31E = 1; this->setupFunc = func_80BD9F3C; @@ -773,14 +775,14 @@ void func_80BD9F3C(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); } } } void func_80BDA038(EnPamera* this) { func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); this->unk_31E = 0; this->setupFunc = func_80BDA090; } @@ -790,7 +792,7 @@ void func_80BDA090(EnPamera* this, PlayState* play) { void func_80BDA0A0(EnPamera* this) { func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->unk_31E = 1; this->setupFunc = func_80BDA0FC; } @@ -800,7 +802,7 @@ void func_80BDA0FC(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); } } } @@ -808,7 +810,7 @@ void func_80BDA0FC(EnPamera* this, PlayState* play) { void func_80BDA170(EnPamera* this) { this->unk_31E = 1; func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); this->setupFunc = func_80BDA1C8; } @@ -821,7 +823,7 @@ void func_80BDA1C8(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 10); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10); } } } @@ -829,7 +831,7 @@ void func_80BDA1C8(EnPamera* this, PlayState* play) { void func_80BDA288(EnPamera* this) { this->unk_31E = 1; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); this->setupFunc = func_80BDA2E0; } @@ -837,7 +839,7 @@ void func_80BDA2E0(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); } } } 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 420d40b78..5feb50245 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -332,7 +332,7 @@ void EnPametfrog_ShakeCamera(EnPametfrog* this, PlayState* play, f32 magShakeXZ, subCamEye.x = (Math_SinS(subCamYaw) * magShakeXZ) + subCam->at.x; subCamEye.y = subCam->at.y + magShakeY; subCamEye.z = (Math_CosS(subCamYaw) * magShakeXZ) + subCam->at.z; - Play_CameraSetAtEye(play, this->subCamId, &subCam->at, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCamEye); } void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { @@ -340,7 +340,7 @@ void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { subCam = Play_GetCamera(play, this->subCamId); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; ActorCutscene_Stop(this->cutscene); func_800B724C(play, &this->actor, 6); @@ -509,7 +509,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, PlayState* play) { subCamEye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 100.0f; subCamEye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); this->actionFunc = EnPametfrog_FallOffSnapper; } @@ -839,7 +839,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.world.pos.x + (xzDist * this->unk_2DC.x); subCamEye.y = (this->actor.world.pos.y + this->actor.home.pos.y) * 0.5f; subCamEye.z = this->actor.world.pos.z + (xzDist * this->unk_2DC.z); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); } this->actionFunc = EnPametfrog_FallInAir; @@ -857,7 +857,7 @@ void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { } else { this->spinYaw += 0xF00; if (this->subCamId != SUB_CAM_ID_DONE) { - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &Play_GetCamera(play, this->subCamId)->eye); } @@ -906,7 +906,7 @@ void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); subCamEye.y = this->actor.child->focus.pos.y + 20.0f; subCamEye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); - Play_CameraSetAtEye(play, this->subCamId, &this->actor.child->focus.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.child->focus.pos, &subCamEye); this->actor.params = GEKKO_DEFEAT; this->timer = 38; this->actionFunc = EnPametfrog_DefeatGekko; @@ -931,7 +931,7 @@ void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) { subCamEye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; subCamEye.y = this->actor.world.pos.y + 20.0f; subCamEye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; - Play_CameraSetAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &this->actor.world.pos, &subCamEye); this->timer = 20; this->actionFunc = EnPametfrog_DefeatSnapper; } @@ -1189,7 +1189,7 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { subCamEye.y = subCamAt.y + 4.0f; // Zooms in on Gekko - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->timer = 0; this->actor.hintId = 0x5F; this->actionFunc = EnPametfrog_CallSnapper; @@ -1221,7 +1221,7 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { subCamEye.z = (Math_CosS(yaw) * 500.0f) + subCamAt.z; // Zooms in on Snapper spawn point - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); this->quake = Quake_Add(GET_ACTIVE_CAM(play), 6); Quake_SetSpeed(this->quake, 18000); Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.c b/src/overlays/actors/ovl_En_Paper/z_en_paper.c index 5554c9182..fd6ac6778 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.c +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.c @@ -5,6 +5,7 @@ */ #include "z_en_paper.h" +#include "objects/object_bal/object_bal.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000) @@ -17,8 +18,11 @@ void EnPaper_Draw(Actor* thisx, PlayState* play); void func_80C1F480(EnPaper* this, PlayState* play); void func_80C1F4FC(EnPaper* this, PlayState* play); +void func_80C1F46C(EnPaper* this); +void func_80C1F4E8(EnPaper* this); +void func_80C1F55C(EnPaper* this, EnPaperStruct* arg1); +void func_80C1F6E0(EnPaper* this, EnPaperStruct* arg1); -#if 0 const ActorInit En_Paper_InitVars = { ACTOR_EN_PAPER, ACTORCAT_ITEMACTION, @@ -31,28 +35,165 @@ const ActorInit En_Paper_InitVars = { (ActorFunc)EnPaper_Draw, }; -#endif +Vec3f D_80C1FC60 = { 0.0f, 0.0f, 1.0f }; -extern UNK_TYPE D_0600D5A0; +void EnPaper_Init(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Init.s") + Actor_SetScale(&this->actor, 0.01f); + this->timer = 70; + this->unk_D78 = D_80C1FC60; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + func_80C1F46C(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Destroy.s") +void EnPaper_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F46C.s") +void func_80C1F46C(EnPaper* this) { + this->actionFunc = func_80C1F480; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F480.s") +void func_80C1F480(EnPaper* this, PlayState* play) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F4E8.s") + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++) { + func_80C1F55C(this, &this->unk_148[i]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F4FC.s") + func_80C1F4E8(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F55C.s") +void func_80C1F4E8(EnPaper* this) { + this->actionFunc = func_80C1F4FC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F6E0.s") +void func_80C1F4FC(EnPaper* this, PlayState* play) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/func_80C1F87C.s") + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++) { + func_80C1F6E0(this, &this->unk_148[i]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Update.s") +void func_80C1F55C(EnPaper* this, EnPaperStruct* arg1) { + Matrix_RotateZYX(Rand_Next(), Rand_Next(), Rand_Next(), MTXMODE_NEW); + Matrix_MultVec3f(&D_80C1FC60, &arg1->unk_0C); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Paper/EnPaper_Draw.s") + arg1->unk_18 = this->actor.world.pos; + + arg1->unk_18.x += Rand_Centered() * 4.0f; + arg1->unk_18.y += Rand_Centered() * 4.0f; + arg1->unk_18.z += Rand_Centered() * 4.0f; + + arg1->unk_24 = this->actor.velocity; + + arg1->unk_24.x += Rand_Centered() * 9.0f; + arg1->unk_24.y += Rand_ZeroOne() * 6.0f; + arg1->unk_24.z += Rand_Centered() * 9.0f; + + arg1->unk_30 = Rand_Next(); + arg1->unk_32 = (Rand_Next() >> 4) + 0x16C; + + Matrix_RotateAxisS(arg1->unk_30, &arg1->unk_0C, MTXMODE_NEW); + Matrix_MultVec3f(&D_80C1FC60, &arg1->unk_00); +} + +void func_80C1F6E0(EnPaper* this, EnPaperStruct* arg1) { + f32 sp1C = Math_CosS(arg1->unk_30); + f32 sp18 = Math_SinS(arg1->unk_30); + f32 temp_ft4 = 1.0f - sp1C; + + if (arg1->unk_18.y < (this->actor.floorHeight - 40.0f)) { + return; + } + + arg1->unk_24.y += this->actor.gravity; + + arg1->unk_24.x -= 0.2f * fabsf(arg1->unk_00.x) * (arg1->unk_24.x + this->unk_D78.x); + arg1->unk_24.y -= 0.2f * fabsf(arg1->unk_00.y) * (arg1->unk_24.y + this->unk_D78.y); + arg1->unk_24.z -= 0.2f * fabsf(arg1->unk_00.z) * (arg1->unk_24.z + this->unk_D78.z); + + arg1->unk_30 += arg1->unk_32; + + arg1->unk_18.x += arg1->unk_24.x; + arg1->unk_18.y += arg1->unk_24.y; + arg1->unk_18.z += arg1->unk_24.z; + + arg1->unk_00.x = (arg1->unk_0C.x * temp_ft4 * arg1->unk_0C.z) - (arg1->unk_0C.y * sp18); + arg1->unk_00.y = (arg1->unk_0C.y * temp_ft4 * arg1->unk_0C.z) + (arg1->unk_0C.x * sp18); + arg1->unk_00.z = (arg1->unk_0C.z * temp_ft4 * arg1->unk_0C.z) + sp1C; +} + +void func_80C1F87C(EnPaper* this) { + f32 sp2C = (Rand_Centered() * 4.0f) + 6.0f; + f32 sp28; + + this->unk_D78.y = Math_SinS(this->actor.shape.rot.x) * -sp2C; + + sp28 = Math_CosS(this->actor.shape.rot.x) * -sp2C; + this->unk_D78.x = Math_SinS(this->actor.shape.rot.y) * sp28; + this->unk_D78.z = Math_CosS(this->actor.shape.rot.y) * sp28; + + this->actor.shape.rot.x += (s16)(Rand_Next() >> 8); + this->actor.shape.rot.y += (s16)(Rand_Next() >> 6); + + if (ABS_ALT(this->actor.shape.rot.x) > 0x1555) { + if (this->actor.shape.rot.x > 0) { + this->actor.shape.rot.x = 0x1555; + } else { + this->actor.shape.rot.x = -0x1555; + } + } +} + +void EnPaper_Update(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; + + this->actionFunc(this, play); + + func_80C1F87C(this); + if (this->timer == 0) { + Actor_MarkForDeath(&this->actor); + } else { + this->timer--; + } +} + +void EnPaper_Draw(Actor* thisx, PlayState* play) { + EnPaper* this = THIS; + EnPaperStruct* ptr = this->unk_148; + s32 i; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C5B0(play->state.gfxCtx); + + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); + gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, SHADE, 0, 0, 0, SHADE, PRIMITIVE, 0, COMBINED, 0, 0, 0, 0, COMBINED); + gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_FOG | G_LIGHTING | G_SHADING_SMOOTH); + + for (i = 0; i < ARRAY_COUNT(this->unk_148); i++, ptr++) { + if (i == 0) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + } else if (i == 30) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 32, 32, 255); + } else if (i == 40) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 64, 128, 255, 255); + } else if (i == 50) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 64, 255, 128, 255); + } + + if ((this->actor.floorHeight - 40.0f) < ptr->unk_18.y) { + MtxF* mf = GRAPH_ALLOC(play->state.gfxCtx, sizeof(MtxF)); + + func_8017842C(mf, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, ptr->unk_30, ptr->unk_0C.x, + ptr->unk_0C.y, ptr->unk_0C.z, ptr->unk_18.x, ptr->unk_18.y, ptr->unk_18.z); + + gSPMatrix(POLY_OPA_DISP++, mf, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_bal_DL_00D5A0); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.h b/src/overlays/actors/ovl_En_Paper/z_en_paper.h index 9c4e6cc50..457229c3d 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.h +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.h @@ -7,10 +7,21 @@ struct EnPaper; typedef void (*EnPaperActionFunc)(struct EnPaper*, PlayState*); +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3f unk_18; + /* 0x24 */ Vec3f unk_24; + /* 0x30 */ s16 unk_30; + /* 0x32 */ s16 unk_32; +} EnPaperStruct; // size = 0x34 + typedef struct EnPaper { /* 0x000 */ Actor actor; /* 0x144 */ EnPaperActionFunc actionFunc; - /* 0x148 */ char unk_148[0xC40]; + /* 0x148 */ EnPaperStruct unk_148[60]; + /* 0xD78 */ Vec3f unk_D78; + /* 0xD84 */ s16 timer; } EnPaper; // size = 0xD88 extern const ActorInit En_Paper_InitVars; 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 e1eadb5cf..3995207e9 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -526,7 +526,7 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_mm_Anim_002238, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_mm_Anim_002238, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_mm_Anim_00A4E0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -718,7 +718,7 @@ s32 func_80AF7E98(EnPm* this, s32 arg1) { if (phi_v1) { this->unk_384 = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_35C = this->skelAnime.playSpeed; } @@ -1380,7 +1380,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { if (scheduleOutput->result == 24) { Flags_UnsetSwitch(play, 0); Flags_UnsetSwitch(play, 1); - this->unk_394 = EXCH_ITEM_NONE; + this->unk_394 = PLAYER_AP_NONE; this->unk_368 = 60.0f; func_80AF7E98(this, 9); } @@ -1568,7 +1568,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->actor.flags |= ACTOR_FLAG_1; this->actor.targetMode = 0; - this->unk_394 = EXCH_ITEM_NONE; + this->unk_394 = PLAYER_AP_NONE; this->unk_356 = 0; this->unk_368 = 40.0f; diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 955b7d524..a2c537606 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -129,7 +129,7 @@ void EnPoFusen_Init(Actor* thisx, PlayState* play) { this->limb9Rot = 0x71C; this->randBaseRotChange = 0; - if (GET_IS_FUSE_TYPE_PARAM(&this->actor)) { + if (ENPOFUSEN_IS_FUSE_TYPE(&this->actor)) { EnPoFusen_InitFuse(this); return; } @@ -147,7 +147,7 @@ u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { Actor* actorPtr; actorPtr = play->actorCtx.actorLists[ACTORCAT_NPC].first; - if (GET_IS_FUSE_TYPE_PARAM(&this->actor)) { + if (ENPOFUSEN_IS_FUSE_TYPE(&this->actor)) { return true; } @@ -168,7 +168,7 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { } this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; - this->collider.dim.worldSphere.center.y = (this->actor.world.pos.y + 20.0f); + this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + 20.0f; this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->collider.base.acFlags & AC_HIT) && (this->actor.colChkInfo.damageEffect == 0xF)) { @@ -243,7 +243,7 @@ void EnPoFusen_Pop(EnPoFusen* this, PlayState* play) { void EnPoFusen_InitFuse(EnPoFusen* this) { s16 rotZ = this->actor.shape.rot.z; - this->fuse = GET_FUSE_LEN_PARAM(&this->actor); + this->fuse = ENPOFUSEN_GET_FUSE_LEN(&this->actor); this->actor.shape.rot.z = 0; this->randScaleChange = rotZ & 0xFFFF; this->actionFunc = EnPoFusen_IdleFuse; diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h index 92f75afab..991b0cf9e 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h @@ -5,8 +5,8 @@ struct EnPoFusen; -#define GET_FUSE_LEN_PARAM(thisx) ((thisx)->params & 0x3FF) -#define GET_IS_FUSE_TYPE_PARAM(thisx) ((thisx)->params & 0x8000) +#define ENPOFUSEN_GET_FUSE_LEN(thisx) ((thisx)->params & 0x3FF) +#define ENPOFUSEN_IS_FUSE_TYPE(thisx) ((thisx)->params & 0x8000) typedef void (*EnPoFusenActionFunc)(struct EnPoFusen*, PlayState*); 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 4ee47164f..b9afa5229 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 @@ -1252,7 +1252,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { 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); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index d165c12d5..9d1dca75e 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -679,7 +679,7 @@ void func_80B2E230(EnPoh* this, PlayState* play) { } void func_80B2E3B0(EnPoh* this) { - func_801A7328(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); + AudioSfx_StopByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = func_80B2E3F8; } diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index ee58c770a..7766fa8fa 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -5,6 +5,7 @@ */ #include "z_en_pp.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -15,41 +16,103 @@ void EnPp_Destroy(Actor* thisx, PlayState* play); void EnPp_Update(Actor* thisx, PlayState* play); void EnPp_Draw(Actor* thisx, PlayState* play); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_80B21624 = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0xF), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0xC), - /* Zora boomerang */ DMG_ENTRY(1, 0xF), - /* Normal arrow */ DMG_ENTRY(1, 0xF), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(1, 0xD), - /* Goron punch */ DMG_ENTRY(1, 0xC), - /* Sword */ DMG_ENTRY(1, 0xF), - /* Goron pound */ DMG_ENTRY(0, 0xE), - /* Fire arrow */ DMG_ENTRY(1, 0x2), - /* Ice arrow */ DMG_ENTRY(1, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0xF), - /* Deku spin */ DMG_ENTRY(0, 0x1), - /* Deku bubble */ DMG_ENTRY(1, 0xF), - /* Deku launch */ DMG_ENTRY(2, 0xC), - /* 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, 0xF), - /* Zora punch */ DMG_ENTRY(1, 0xF), - /* Spin attack */ DMG_ENTRY(1, 0xF), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0xC), +void EnPp_SetupIdle(EnPp* this); +void EnPp_Idle(EnPp* this, PlayState* play); +void EnPp_SetupCharge(EnPp* this); +void EnPp_Charge(EnPp* this, PlayState* play); +void EnPp_SetupAttack(EnPp* this); +void EnPp_Attack(EnPp* this, PlayState* play); +void EnPp_SetupBounced(EnPp* this); +void EnPp_Bounced(EnPp* this, PlayState* play); +void EnPp_SetupRoar(EnPp* this); +void EnPp_Roar(EnPp* this, PlayState* play); +void EnPp_SetupJump(EnPp* this); +void EnPp_Jump(EnPp* this, PlayState* play); +void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play); +void EnPp_Damaged(EnPp* this, PlayState* play); +void EnPp_SetupDead(EnPp* this, PlayState* play); +void EnPp_Dead(EnPp* this, PlayState* play); +void EnPp_Mask_Detach(EnPp* this, PlayState* play); +void EnPp_BodyPart_SetupMove(EnPp* this); +void EnPp_BodyPart_Move(EnPp* this, PlayState* play); + +typedef enum { + /* 0 */ EN_PP_COLLISION_RESULT_OK, + /* 1 */ EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_INTO_WALL, + /* 2 */ EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE, +} EnPpCollisionResult; + +typedef enum { + /* 0 */ EN_PP_ACTION_IDLE, + /* 1 */ EN_PP_ACTION_CHARGE, + /* 2 */ EN_PP_ACTION_ATTACK, + /* 3 */ EN_PP_ACTION_BOUNCED, + /* 4 */ EN_PP_ACTION_ROAR, + /* 5 */ EN_PP_ACTION_JUMP, + /* 6 */ EN_PP_ACTION_STUNNED_OR_FROZEN, + /* 7 */ EN_PP_ACTION_MASK_DETACH, + /* 8 */ EN_PP_ACTION_DAMAGED, + /* 9 */ EN_PP_ACTION_DEAD, + /* 10 */ EN_PP_ACTION_MASK_DEAD, + /* 11 */ EN_PP_ACTION_SPAWN_BODY_PARTS, + /* 12 */ EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS, + /* 13 */ EN_PP_ACTION_BODY_PART_MOVE, +} EnPpAction; + +typedef enum { + /* 0 */ EN_PP_MASK_DETACH_STATE_START, + /* 1 */ EN_PP_MASK_DETACH_STATE_FALL, + /* 2 */ EN_PP_MASK_DETACH_STATE_DIE, +} EnPpMaskDetachState; + +static s32 sCurrentDeadBodyPartIndex = 0; + +typedef enum { + /* 0x0 */ EN_PP_DMGEFF_JUMP, // Forces the Hiploop to jump + /* 0x1 */ EN_PP_DMGEFF_STUN, // Stuns the Hiploop + /* 0x2 */ EN_PP_DMGEFF_FIRE, // Damages and sets the Hiploop on fire + /* 0x3 */ EN_PP_DMGEFF_FREEZE, // Damages and freezes the Hiploop in ice + /* 0x4 */ EN_PP_DMGEFF_LIGHT_ORB, // Damages and surrounds the Hiploop with light orbs + /* 0x5 */ EN_PP_DMGEFF_ELECTRIC_STUN, // Stuns and surrounds the Hiploop with electric sparks + /* 0xC */ EN_PP_DMGEFF_KNOCK_OFF_MASK = 0xC, // Knocks off the Hiploop's mask or deals regular damage + /* 0xD */ EN_PP_DMGEFF_HOOKSHOT, // Pulls the Hiploop's mask to the player or deals regular damage + /* 0xE */ EN_PP_DMGEFF_GORON_POUND, // Knocks off the Hiploop's mask or forces it to jump + /* 0xF */ EN_PP_DMGEFF_DAMAGE, // Deals regular damage +} EnPpDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Horse trample */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Explosives */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* Zora boomerang */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Normal arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Hookshot */ DMG_ENTRY(1, EN_PP_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* Sword */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Goron pound */ DMG_ENTRY(0, EN_PP_DMGEFF_GORON_POUND), + /* Fire arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(1, EN_PP_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, EN_PP_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Deku spin */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Deku bubble */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Deku launch */ DMG_ENTRY(2, EN_PP_DMGEFF_KNOCK_OFF_MASK), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, EN_PP_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, EN_PP_DMGEFF_ELECTRIC_STUN), + /* Normal shield */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Light ray */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Thrown object */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Zora punch */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Spin attack */ DMG_ENTRY(1, EN_PP_DMGEFF_DAMAGE), + /* Sword beam */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Normal Roll */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Unblockable */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_PP_DMGEFF_JUMP), + /* Powder Keg */ DMG_ENTRY(1, EN_PP_DMGEFF_KNOCK_OFF_MASK), }; const ActorInit En_Pp_InitVars = { @@ -64,116 +127,1500 @@ const ActorInit En_Pp_InitVars = { (ActorFunc)EnPp_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80B21664[1] = { +static ColliderJntSphElementInit sMaskColliderJntSphElementsInit[1] = { { - { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x04, 0x10 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK2, + { 0xF7CFFFFF, 0x04, 0x10 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 0 }, 1 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80B21688 = { - { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80B21664, // sJntSphElementsInit, +static ColliderJntSphInit sMaskColliderJntSphInit = { + { + COLTYPE_HARD, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sMaskColliderJntSphElementsInit), + sMaskColliderJntSphElementsInit, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80B21698[1] = { +static ColliderJntSphElementInit sBodyColliderJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 0 }, 1 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80B216BC = { - { COLTYPE_HARD, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80B21698, // sJntSphElementsInit, +static ColliderJntSphInit sBodyColliderJntSphInit = { + { + COLTYPE_HARD, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sBodyColliderJntSphElementsInit), + sBodyColliderJntSphElementsInit, }; -// static ColliderQuadInit sQuadInit = { -static ColliderQuadInit D_80B216CC = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_QUAD, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x04, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, BUMP_NONE, OCELEM_NONE, }, +static ColliderQuadInit sQuadInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_QUAD, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x04, 0x08 }, + { 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 } } }, }; -#endif +static Color_RGBA8 sDustPrimColor = { 60, 50, 20, 255 }; -extern DamageTable D_80B21624; -extern ColliderJntSphElementInit D_80B21664[1]; -extern ColliderJntSphInit D_80B21688; -extern ColliderJntSphElementInit D_80B21698[1]; -extern ColliderJntSphInit D_80B216BC; -extern ColliderQuadInit D_80B216CC; +static Color_RGBA8 sDustEnvColor = { 40, 30, 30, 255 }; -extern UNK_TYPE D_0600A844; +typedef enum { + /* 0 */ EN_PP_ANIM_IDLE, + /* 1 */ EN_PP_ANIM_WALK, + /* 2 */ EN_PP_ANIM_WIND_UP, + /* 3 */ EN_PP_ANIM_CHARGE, + /* 4 */ EN_PP_ANIM_ATTACK, + /* 5 */ EN_PP_ANIM_DAMAGE, + /* 6 */ EN_PP_ANIM_ROAR, + /* 7 */ EN_PP_ANIM_TURN_TO_FACE_PLAYER, + /* 8 */ EN_PP_ANIM_JUMP, + /* 9 */ EN_PP_ANIM_LAND +} EnPpAnimation; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Init.s") +static AnimationHeader* sAnimations[] = { + &gHiploopIdleAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopChargeAnim, &gHiploopAttackAnim, + &gHiploopDamageAnim, &gHiploopRoarAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopWalkAnim, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Destroy.s") +static u8 sAnimationModes[] = { + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, + ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E29C.s") +static s16 sLedgeCheckAngles[] = { 0x0000, 0x1000, 0xF000 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E3D4.s") +void EnPp_Init(Actor* thisx, PlayState* play) { + EnPp* this = THIS; + EffectBlureInit1 blureInit; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E5A8.s") + this->actor.targetMode = 4; + this->actor.colChkInfo.mass = 60; + this->actor.colChkInfo.health = 3; + this->actor.colChkInfo.damageTable = &sDamageTable; + SkelAnime_InitFlex(play, &this->skelAnime, &gHiploopSkel, &gHiploopIdleAnim, this->jointTable, this->morphTable, + HIPLOOP_LIMB_MAX); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E680.s") + if (EN_PP_GET_ATTACK_RANGE(&this->actor) == 0) { + this->attackRange = 200.0f; + } else { + this->attackRange = EN_PP_GET_ATTACK_RANGE(&this->actor) * 40.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E778.s") + this->chargesInStraightLines = EN_PP_DOES_CHARGE_IN_STRAIGHT_LINES(&this->actor); + if (this->chargesInStraightLines) { + this->actor.params &= 1; + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E958.s") + if (this->actor.params < 0) { + this->actor.params = EN_PP_TYPE_MASKED; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1E970.s") + if (EN_PP_GET_TYPE(&this->actor) >= EN_PP_TYPE_BODY_PART_BASE) { + this->deadBodyPartIndex = sCurrentDeadBodyPartIndex; + sCurrentDeadBodyPartIndex++; + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_SetScale(&this->actor, 0.03f); + EnPp_BodyPart_SetupMove(this); + } else { + Collider_InitAndSetJntSph(play, &this->maskCollider, &this->actor, &sMaskColliderJntSphInit, + this->maskColliderElements); + Collider_InitAndSetJntSph(play, &this->bodyCollider, &this->actor, &sBodyColliderJntSphInit, + this->bodyColliderElements); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EBD8.s") + this->bodyCollider.elements[0].dim.scale = 1.0f; + if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { + this->actor.hintId = 0x25; + this->maskColliderElements[0].info.toucherFlags &= ~TOUCH_ON; + this->maskColliderElements[0].info.bumperFlags &= ~BUMP_ON; + this->maskColliderElements[0].info.ocElemFlags &= ~OCELEM_ON; + this->maskCollider.base.colType = COLTYPE_HIT2; + this->maskCollider.elements[0].dim.modelSphere.radius = 42; + this->maskCollider.elements[0].dim.scale = 1.0f; + this->maskCollider.elements[0].dim.modelSphere.center.x = 400; + this->maskCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyCollider.elements[0].dim.modelSphere.radius = 20; + this->bodyCollider.elements[0].dim.scale = 1.0f; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } else { + this->actor.hintId = 0x26; + this->maskCollider.elements[0].dim.modelSphere.radius = 10; + this->maskCollider.elements[0].dim.scale = 1.0f; + this->maskCollider.elements[0].dim.modelSphere.center.x = 1000; + this->maskCollider.elements[0].dim.modelSphere.center.y = -500; + this->bodyCollider.elements[0].dim.modelSphere.radius = 25; + this->bodyCollider.elements[0].dim.scale = 1.0f; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyColliderElements[0].info.bumperFlags |= BUMP_HOOKABLE; + this->maskCollider.elements[0].info.toucher.damage = 0x10; + //! FAKE: Needed to fix some regs + //! https://decomp.me/scratch/6Yd1B + if (this->actor.world.rot.z) {} + if (this->actor.world.rot.z) {} + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EC24.s") + Collider_InitQuad(play, &this->hornCollider); + Collider_SetQuad(play, &this->hornCollider, &this->actor, &sQuadInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1EFFC.s") + blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = + blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = + blureInit.p1EndColor[0] = blureInit.p1EndColor[1] = blureInit.p1EndColor[2] = blureInit.p2EndColor[0] = + blureInit.p2EndColor[1] = blureInit.p2EndColor[2] = 255; + blureInit.p2StartColor[3] = 64; + blureInit.p1EndColor[3] = blureInit.p2EndColor[3] = 0; + blureInit.elemDuration = 8; + blureInit.unkFlag = false; + blureInit.calcMode = 2; + Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F048.s") + Actor_SetScale(&this->actor, 0.03f); + this->floorPolyForCircleShadow = NULL; + this->actor.gravity = -3.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F0A4.s") + if ((EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) || + (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_NO_MASK)) { + EnPp_SetupIdle(this); + } else { + EnPp_SetupJump(this); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F188.s") +void EnPp_Destroy(Actor* thisx, PlayState* play) { + EnPp* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F244.s") + if (EN_PP_GET_TYPE(&this->actor) < EN_PP_TYPE_BODY_PART_BASE) { + Collider_DestroyJntSph(play, &this->maskCollider); + Collider_DestroyJntSph(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->hornCollider); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F29C.s") + Effect_Destroy(play, this->blureIndex); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F4A0.s") +/** + * This function converts the Hiploop's world position to polar coordinates, + * converts those polar coordinates back into Cartesian coordinates, and then + * checks to see if this doubly-converted position is similar to the original + * world position. This seemingly always returns true, and logically it should + * always return true unless there are errors in how math is implemented. + */ +s32 EnPp_PointlessPosCheck(EnPp* this) { + f32 diffX = this->actor.home.pos.x - this->actor.world.pos.x; + f32 diffZ = this->actor.home.pos.z - this->actor.world.pos.z; + f32 radius; + s16 angle; + Vec3f nearDuplicateWorldPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F560.s") + // This converts the vector between the Hiploop's home and world positions into polar + // coordinates. In other words, if the home position is at the origin, then the world + // position can be found at (radius, angle). + radius = sqrtf(SQ(diffX) + SQ(diffZ)); + angle = Math_Vec3f_Yaw(&this->actor.home.pos, &this->actor.world.pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F664.s") + // This takes the polar coordinates we found earlier and converts them *back* into + // Cartesian coordinates by adding them back to the home position. This ends up creating + // a near-duplicate of the Hiploop's original world position. + Math_Vec3f_Copy(&nearDuplicateWorldPos, &this->actor.home.pos); + nearDuplicateWorldPos.x += Math_SinS(angle) * radius; + nearDuplicateWorldPos.z += Math_CosS(angle) * radius; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F6B4.s") + Math_ApproachF(&this->actor.world.pos.x, nearDuplicateWorldPos.x, 0.3f, 2.0f); + Math_ApproachF(&this->actor.world.pos.z, nearDuplicateWorldPos.z, 0.3f, 2.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F770.s") + // This computes the difference between the Hiploop's original world position and the + // near-duplicate position created earlier. Since the two positions are almost identical, + // the differences are tiny. + diffX = this->actor.world.pos.x - nearDuplicateWorldPos.x; + diffZ = this->actor.world.pos.z - nearDuplicateWorldPos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1F940.s") + // Since the two differences are always tiny, this is always true. + if (sqrtf(SQ(diffX) + SQ(diffZ)) < 2.0f) { + this->actor.world.pos.x = nearDuplicateWorldPos.x; + this->actor.world.pos.z = nearDuplicateWorldPos.z; + return true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FAD0.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FC7C.s") +/** + * Spawns dust behind the Hiploop's back feet. + */ +void EnPp_SpawnDust(EnPp* this, PlayState* play) { + s32 i; + Vec3f pos; + Vec3f velocity; + Vec3f accel; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B1FF20.s") + for (i = 0; i < ARRAY_COUNT(this->backFootPos); i++) { + velocity.x = randPlusMinusPoint5Scaled(2.0f); + velocity.y = Rand_ZeroFloat(2.0f) + 1.0f; + velocity.z = randPlusMinusPoint5Scaled(2.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20030.s") + accel.y = -0.1f; + accel.z = 0.0f; + accel.x = 0.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B202B8.s") + pos.x = this->backFootPos[i].x + randPlusMinusPoint5Scaled(10.0f); + pos.y = Rand_ZeroFloat(3.0f) + this->actor.floorHeight + 1.0f; + pos.z = this->backFootPos[i].z + randPlusMinusPoint5Scaled(10.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B203BC.s") + func_800B0EB0(play, &pos, &velocity, &accel, &sDustPrimColor, &sDustEnvColor, (Rand_ZeroFloat(50.0f) + 60.0f), + 30, (Rand_ZeroFloat(5.0f) + 20.0f)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20668.s") +void EnPp_ChangeAnim(EnPp* this, s32 animIndex) { + f32 morphFrames = -10.0f; + f32 playSpeed; + f32 startFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Update.s") + this->animIndex = animIndex; + this->endFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20E6C.s") + if (this->animIndex >= EN_PP_ANIM_WIND_UP) { + morphFrames = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/func_80B20F70.s") + playSpeed = 1.0f; + if (this->animIndex == EN_PP_ANIM_TURN_TO_FACE_PLAYER) { + playSpeed = 2.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pp/EnPp_Draw.s") + startFrame = 0.0f; + if (this->action == EN_PP_ACTION_BODY_PART_MOVE) { + startFrame = this->endFrame; + } + + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, startFrame, this->endFrame, + sAnimationModes[this->animIndex], morphFrames); +} + +void EnPp_PlaySfxForAnimation(EnPp* this) { + if (this->action != EN_PP_ACTION_STUNNED_OR_FROZEN) { + switch (this->animIndex) { + case EN_PP_ANIM_WALK: + case EN_PP_ANIM_TURN_TO_FACE_PLAYER: + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOTSTEP); + } + break; + + case EN_PP_ANIM_WIND_UP: + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_FOOT - SFX_FLAG); + break; + + case EN_PP_ANIM_CHARGE: + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_RUN - SFX_FLAG); + break; + + case EN_PP_ANIM_ATTACK: + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + } + break; + + case EN_PP_ANIM_ROAR: + if (Animation_OnFrame(&this->skelAnime, 6.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_PAUSE); + } + break; + + default: + break; + } + } +} + +/** + * Checks to see if the Hiploop is about to walk off a ledge or into a wall. + */ +s32 EnPp_CheckCollision(EnPp* this, PlayState* play) { + s16 angle; + s32 i; + + angle = this->actor.world.rot.y; + if (this->action == EN_PP_ACTION_DAMAGED) { + angle = this->targetRotY; + } + + Math_Vec3f_Copy(&this->wallCheckPos, &this->actor.world.pos); + for (i = 0; i < ARRAY_COUNT(this->ledgeCheckPos); i++) { + Math_Vec3f_Copy(&this->ledgeCheckPos[i], &this->actor.world.pos); + this->ledgeCheckPos[i].x += Math_SinS(sLedgeCheckAngles[i] + angle) * 70.0f; + this->ledgeCheckPos[i].y = this->actor.floorHeight - 10.0f; + this->ledgeCheckPos[i].z += Math_CosS(sLedgeCheckAngles[i] + angle) * 70.0f; + if (!BgCheck_SphVsFirstPoly(&play->colCtx, &this->ledgeCheckPos[i], 20.0f)) { + return EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE; + } + } + + this->wallCheckPos.x += Math_SinS(angle) * 40.0f; + this->wallCheckPos.y = this->actor.world.pos.y + 20.0f; + if (this->chargesInStraightLines) { + // This prevents the Hiploops in Woodfall from acting strangely when they move from + // a wooden platform onto one of the ramps; without this, they'll suddenly slow down + // and start roaring when they try to climb the small lip. + this->wallCheckPos.y += 20.0f; + } + + this->wallCheckPos.z += Math_CosS(angle) * 40.0f; + if (BgCheck_SphVsFirstWall(&play->colCtx, &this->wallCheckPos, 10.0f)) { + return EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_INTO_WALL; + } + + return EN_PP_COLLISION_RESULT_OK; +} + +void EnPp_SetupIdle(EnPp* this) { + this->action = EN_PP_ACTION_IDLE; + this->actionFunc = EnPp_Idle; +} + +/** + * Alternates between stopping in place, spinning around in random directions, and walking forward. + */ +void EnPp_Idle(EnPp* this, PlayState* play) { + Vec3f posToLookAt; + + SkelAnime_Update(&this->skelAnime); + if (this->hasBeenDamaged || (this->actor.xzDistToPlayer < this->attackRange)) { + EnPp_SetupCharge(this); + } else { + if ((this->timer == 0) && (this->secondaryTimer == 0)) { + this->secondaryTimer = Rand_ZeroFloat(20.0f) + 20.0f; + Math_Vec3f_Copy(&posToLookAt, &this->actor.home.pos); + posToLookAt.x += randPlusMinusPoint5Scaled(50.0f); + posToLookAt.z += randPlusMinusPoint5Scaled(50.0f); + this->targetRotY = Math_Vec3f_Yaw(&this->actor.world.pos, &posToLookAt); + this->actor.speedXZ = 0.0f; + if (this->animIndex != EN_PP_ANIM_IDLE) { + EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); + } + } + + if (this->secondaryTimer == 1) { + this->timer = Rand_ZeroFloat(40.0f) + 40.0f; + } + + if (EnPp_CheckCollision(this, play) != EN_PP_COLLISION_RESULT_OK) { + this->timer = 0; + if (this->animIndex != EN_PP_ANIM_WALK) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WALK); + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, 0x258, 0); + } else if ((this->secondaryTimer == 0) && (this->timer != 0)) { + if (this->animIndex == EN_PP_ANIM_IDLE) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WALK); + } + + if ((this->maskBounceRotationalVelocity < 0x64) && + (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f)) { + Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.3f, 1.0f); + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, + (this->maskBounceRotationalVelocity + 0x258), 0); + Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); + } + } +} + +void EnPp_SetupCharge(EnPp* this) { + this->secondaryTimer = this->timer = 0; + this->actionVar.isCharging = false; + EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); + this->action = EN_PP_ACTION_CHARGE; + this->actionFunc = EnPp_Charge; +} + +/** + * Charges either directly at the player or in a straight line, depending on the type of Hiploop. + */ +void EnPp_Charge(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + s32 yawDiff; + Vec3f distanceFromWorldPos; + + SkelAnime_Update(&this->skelAnime); + + if (!this->actionVar.isCharging || (this->animIndex == EN_PP_ANIM_WIND_UP)) { + this->targetRotY = this->actor.yawTowardsPlayer; + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(300.0f, &distanceFromWorldPos); + this->targetPos.x += distanceFromWorldPos.x; + this->targetPos.z += distanceFromWorldPos.z; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, (this->maskBounceRotationalVelocity + 0x7D0), + 0); + } + + Math_SmoothStepToS(&this->maskBounceRotationalVelocity, 0, 1, 0x1F4, 0); + if (!this->actionVar.isCharging) { + Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); + if (fabsf(this->actor.world.rot.y - this->targetRotY) < 100.0f) { + if (this->chargesInStraightLines) { + this->actor.world.rot.y = this->targetRotY; + } + + this->actionVar.isCharging = true; + } + } else if (this->animIndex == EN_PP_ANIM_TURN_TO_FACE_PLAYER) { + EnPp_ChangeAnim(this, EN_PP_ANIM_WIND_UP); + } else if (this->animIndex == EN_PP_ANIM_WIND_UP) { + if (this->endFrame <= curFrame) { + this->chargeAndBounceSpeed = 14.0f; + this->timer = 20; + EnPp_ChangeAnim(this, EN_PP_ANIM_CHARGE); + } + } else if (this->animIndex == EN_PP_ANIM_CHARGE) { + if (EnPp_CheckCollision(this, play) != EN_PP_COLLISION_RESULT_OK) { + this->actor.speedXZ = 0.0f; + EnPp_SetupRoar(this); + return; + } + + if (!this->chargesInStraightLines) { + Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.3f, 1.0f); + } else { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + if (this->timer < 10) { + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + } + } + + if (this->timer == 0) { + EnPp_SetupRoar(this); + return; + } + + if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && (!(this->bodyCollider.base.atFlags & AT_BOUNCED))) { + if ((this->maskCollider.base.atFlags & AT_HIT) || (this->bodyCollider.base.atFlags & AT_HIT)) { + EnPp_SetupAttack(this); + return; + } + } else if (this->chargesInStraightLines) { + EnPp_SetupBounced(this); + return; + } else { + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED) { + this->actor.speedXZ *= -1.0f; + } else { + this->actor.speedXZ *= -0.5f; + } + + EnPp_SetupRoar(this); + return; + } + } + + if (((this->animIndex == EN_PP_ANIM_WIND_UP) || (this->animIndex == EN_PP_ANIM_CHARGE)) && + (this->secondaryTimer == 0)) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } +} + +void EnPp_SetupAttack(EnPp* this) { + EnPp_ChangeAnim(this, EN_PP_ANIM_ATTACK); + this->hornColliderOn = true; + this->action = EN_PP_ACTION_ATTACK; + this->actor.speedXZ = 0.0f; + this->actionFunc = EnPp_Attack; +} + +void EnPp_Attack(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + + SkelAnime_Update(&this->skelAnime); + if (this->endFrame <= curFrame) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupBounced(EnPp* this) { + Vec3f distanceFromWorldPos; + s32 yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &distanceFromWorldPos); + this->timer = 10; + this->targetPos.x += distanceFromWorldPos.x; + this->targetPos.z += distanceFromWorldPos.z; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->actor.speedXZ = 0.0f; + this->action = EN_PP_ACTION_BOUNCED; + this->chargeAndBounceSpeed = 14.0f; + this->actionFunc = EnPp_Bounced; +} + +/** + * Pushes the Hiploop back for a half-second, then forces it to charge again. + */ +void EnPp_Bounced(EnPp* this, PlayState* play) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + if ((this->timer == 0) && (EnPp_PointlessPosCheck(this))) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupRoar(EnPp* this) { + this->actionVar.hasDoneFirstRoar = false; + this->timer = 20; + this->secondaryTimer = 0; + this->chargeAndBounceSpeed = 14.0f; + EnPp_ChangeAnim(this, EN_PP_ANIM_ROAR); + this->action = EN_PP_ACTION_ROAR; + this->actionFunc = EnPp_Roar; +} + +/** + * Slows the Hiploop down and makes it do two roars. Afterwards, it will make the Hiploop charge again. + */ +void EnPp_Roar(EnPp* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 curFrame = this->skelAnime.curFrame; + + SkelAnime_Update(&this->skelAnime); + + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->actor.speedXZ = 0.0f; + this->chargeAndBounceSpeed = 0.0f; + } + + if (!this->chargesInStraightLines) { + if ((fabsf(this->actor.home.pos.y - this->actor.world.pos.y) > 100.0f) && + (fabsf(this->actor.floorHeight - player->actor.floorHeight) > 100.0f)) { + EnPp_SetupDead(this, play); + return; + } + } else if (this->chargeAndBounceSpeed) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, + fabsf(Math_SinS(this->targetRotY) * this->chargeAndBounceSpeed)); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, + fabsf(Math_CosS(this->targetRotY) * this->chargeAndBounceSpeed)); + if (this->timer < 10) { + Math_ApproachZeroF(&this->chargeAndBounceSpeed, 0.3f, 0.2f); + } + } + + Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 1.0f); + if ((this->actor.speedXZ > 0.3f) && (this->secondaryTimer == 0)) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + if (!this->actionVar.hasDoneFirstRoar && (this->endFrame <= curFrame)) { + this->skelAnime.startFrame = 6.0f; + this->actionVar.hasDoneFirstRoar = true; + } + + if (this->timer == 0) { + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupJump(EnPp* this) { + s32 yawDiff; + + this->secondaryTimer = 0; + this->actionVar.hasLandedFromJump = false; + this->timer = this->secondaryTimer; + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 20.0f; + this->actor.gravity = -3.0f; + EnPp_ChangeAnim(this, EN_PP_ANIM_JUMP); + + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->actor.world.rot.y = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->actor.world.rot.y = this->actor.home.rot.y; + } + + this->targetRotY = this->actor.world.rot.y; + } + + this->actionVar.hasLandedFromJump = false; + this->action = EN_PP_ACTION_JUMP; + this->actionFunc = EnPp_Jump; +} + +/** + * Makes the Hiploop jump straight up. Once it lands, the Hiploop will be forced to be idle. + */ +void EnPp_Jump(EnPp* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + s32 yawDiff; + + SkelAnime_Update(&this->skelAnime); + + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + EnPp_PointlessPosCheck(this); + } else { + this->targetRotY = this->actor.yawTowardsPlayer; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRotY, 1, 0x1388, 0); + if (!this->actionVar.hasLandedFromJump) { + if (this->actor.bgCheckFlags & 1) { + this->actionVar.hasLandedFromJump = true; + EnPp_ChangeAnim(this, EN_PP_ANIM_LAND); + } + } else if (this->endFrame <= curFrame) { + EnPp_SetupIdle(this); + } +} + +void EnPp_SetupStunnedOrFrozen(EnPp* this) { + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + this->actor.speedXZ = 0.0f; + this->action = EN_PP_ACTION_STUNNED_OR_FROZEN; + this->actionFunc = EnPp_StunnedOrFrozen; +} + +/** + * Locks the Hiploop in place until the draw damage effect timer or the stun timer reaches 0. + * When the stun wears off, this forces the Hiploop to charge. + */ +void EnPp_StunnedOrFrozen(EnPp* this, PlayState* play) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { + if ((this->drawDmgEffTimer != 0) && (this->drawDmgEffTimer < 60)) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + } + } + + if ((this->secondaryTimer == 0) && (this->drawDmgEffTimer == 0)) { + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, + 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + EnPp_SetupCharge(this); + } +} + +void EnPp_SetupDamaged(EnPp* this, PlayState* play) { + Vec3f temp; + s32 pad; + s32 yawDiff; + + if (!this->chargesInStraightLines) { + Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); + Matrix_MultVecZ(-30.0f, &temp); + Math_Vec3f_Copy(&this->damagedVelocity, &temp); + } else { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &temp); + this->timer = 10; + this->targetPos.x += temp.x; + this->targetPos.z += temp.z; + } + + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer != 0)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + this->secondaryTimer = 0; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->targetRotY = this->actor.yawTowardsPlayer + 0x8000; + this->action = EN_PP_ACTION_DAMAGED; + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->damagedVelocity.z = 0.0f; + this->damagedVelocity.x = 0.0f; + this->actor.speedXZ = 0.0f; + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_DAMAGE); + this->actionFunc = EnPp_Damaged; +} + +/** + * Makes the Hiploop move backwards and spin quickly. + */ +void EnPp_Damaged(EnPp* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + SkelAnime_Update(&this->skelAnime); + this->actor.world.rot.y += 0x1000; + if (this->secondaryTimer == 0) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + if (this->chargesInStraightLines) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, 25.0f); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, 25.0f); + this->actor.world.rot.y += 0x1000; + if ((this->timer == 0) && (EnPp_PointlessPosCheck(this))) { + EnPp_SetupCharge(this); + } + } else if ((this->actor.colorFilterTimer == 0) && (this->damagedVelocity.x < 1.0f) && + (this->damagedVelocity.z < 1.0f)) { + EnPp_SetupCharge(this); + } + + if (EnPp_CheckCollision(this, play) == EN_PP_COLLISION_RESULT_ABOUT_TO_RUN_OFF_LEDGE) { + this->damagedVelocity.z = 0.0f; + this->damagedVelocity.x = 0.0f; + this->actor.speedXZ = 0.0f; + } + + if ((fabsf(this->actor.home.pos.y - this->actor.world.pos.y) > 100.0f) && + (fabsf(this->actor.floorHeight - player->actor.floorHeight) > 100.0f)) { + EnPp_SetupDead(this, play); + } +} + +void EnPp_SetupDead(EnPp* this, PlayState* play) { + Vec3f deadVelocity; + s32 yawDiff; + + this->secondaryTimer = this->timer = 0; + if (!this->chargesInStraightLines) { + Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); + Matrix_MultVecZ(-30.0f, &deadVelocity); + Math_Vec3f_Copy(&this->damagedVelocity, &deadVelocity); + } else { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + this->targetRotY = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + this->targetRotY = this->actor.home.rot.y; + } + + Math_Vec3f_Copy(&this->targetPos, &this->actor.world.pos); + Matrix_RotateYS(this->targetRotY, MTXMODE_NEW); + Matrix_MultVecZ(-200.0f, &deadVelocity); + this->targetPos.x += deadVelocity.x; + this->targetPos.z += deadVelocity.z; + } + + this->maskBounceRotationalVelocity = this->actionVar.isCharging = 0; + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->timer = 15; + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Enemy_StartFinishingBlow(play, &this->actor); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_HIPLOOP_DEAD); + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + this->action = EN_PP_ACTION_DEAD; + this->actionFunc = EnPp_Dead; +} + +/** + * Makes the Hiploop move backwards and spin even quicker than when it's damaged. + * If the Hiploop ends up in the water while it's moving backwards, this function + * will make some splashes too. After a short amount of time, this will spawn body + * parts that fly away from the Hiploop. + */ +void EnPp_Dead(EnPp* this, PlayState* play) { + Vec3f splashPos; + WaterBox* waterBox; + f32 waterSurface; + s32 isUnderWater; + s32 i; + + SkelAnime_Update(&this->skelAnime); + this->actor.world.rot.y += 0x3000; + waterSurface = this->actor.world.pos.y - 30.0f; + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + if (this->drawDmgEffTimer == 0) { + return; + } + + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + if (this->secondaryTimer == 0) { + EnPp_SpawnDust(this, play); + this->secondaryTimer = 3; + } + + isUnderWater = false; + if ((this->action == EN_PP_ACTION_DEAD) && + (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox))) { + if (this->actor.world.pos.y < waterSurface) { + for (i = 0; i < 5; i++) { + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); + splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + isUnderWater = true; + } + } + + if (this->chargesInStraightLines) { + Math_ApproachF(&this->actor.world.pos.x, this->targetPos.x, 0.5f, 25.0f); + Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, 25.0f); + } + + if ((this->action == EN_PP_ACTION_DEAD) && (isUnderWater || (this->timer == 1))) { + this->action = EN_PP_ACTION_SPAWN_BODY_PARTS; + } + + if (this->action == EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS) { + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_UNMASKED) { + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x70); + } else { + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xE0); + } + + Actor_MarkForDeath(&this->actor); + } +} + +/** + * Spawns an unmasked Hiploop and prepares the mask to fly through the air. + */ +void EnPp_Mask_SetupDetach(EnPp* this, PlayState* play) { + s32 yawDiff; + EnPp* pp = (EnPp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PP, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, this->actor.world.rot.x, this->actor.shape.rot.y, + this->actor.world.rot.z, EN_PP_TYPE_UNMASKED); + + if (pp != NULL) { + if (this->chargesInStraightLines) { + yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + pp->chargesInStraightLines = true; + pp->actor.world.rot.y = this->actor.home.rot.y + 0x8000; + if (yawDiff < 0x3000) { + pp->actor.world.rot.y = this->actor.home.rot.y; + } + } + + this->actor.gravity = 0.0f; + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_START; + EnPp_ChangeAnim(this, EN_PP_ANIM_IDLE); + SkelAnime_Update(&this->skelAnime); + this->action = EN_PP_ACTION_MASK_DETACH; + this->actionFunc = EnPp_Mask_Detach; + } +} + +/** + * Moves the mask through the air and eventually makes it burst into flames. + */ +void EnPp_Mask_Detach(EnPp* this, PlayState* play) { + if (((this->actor.flags & ACTOR_FLAG_2000) != ACTOR_FLAG_2000) || (this->action == EN_PP_ACTION_MASK_DEAD)) { + switch (this->actionVar.maskDetachState) { + case EN_PP_MASK_DETACH_STATE_START: + this->action = EN_PP_ACTION_MASK_DEAD; + this->maskAccelY = 50.0f; + this->maskVelocity.y = -230.0f; + this->maskVelocity.x = -150.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HIPLOOP_MASC_OFF); + this->actionVar.maskDetachState = EN_PP_MASK_DETACH_STATE_FALL; + break; + + case EN_PP_MASK_DETACH_STATE_FALL: + if (this->maskPos.y > 800.0f) { + this->maskAccelY = 50.0f; + this->actionVar.maskDetachState++; + this->maskVelocity.y = -200.0f; + this->maskVelocity.x = -150.0f; + } + break; + + case EN_PP_MASK_DETACH_STATE_DIE: + if (this->maskPos.y > 900.0f) { + if (this->maskVelocity.y > 0.0f) { + Vec3f maskFirePos; + Vec3f sMaskFireVelocityAndAccel[] = { + { 1.0f, 0.0f, 0.5f }, { 1.0f, 0.0f, -0.5f }, { -1.0f, 0.0f, 0.5f }, + { -1.0f, 0.0f, -0.5f }, { 0.5f, 0.0f, 1.0f }, { -0.5f, 0.0f, 1.0f }, + { 0.5f, 0.0f, -1.0f }, { -0.5f, 0.0f, -1.0f }, { 0.0f, 0.0f, 0.0f }, + }; + s32 i; + + for (i = 0; i < ARRAY_COUNT(sMaskFireVelocityAndAccel); i++) { + Math_Vec3f_Copy(&maskFirePos, &this->maskFlamesBasePos); + maskFirePos.x += randPlusMinusPoint5Scaled(20.0f); + maskFirePos.y = this->actor.floorHeight; + maskFirePos.z += randPlusMinusPoint5Scaled(20.0f); + func_800B3030(play, &maskFirePos, &sMaskFireVelocityAndAccel[i], + &sMaskFireVelocityAndAccel[i], 70, 0, 2); + } + + Actor_MarkForDeath(&this->actor); + } + } + break; + } + + this->maskVelocity.y += this->maskAccelY; + this->maskRot.z += 0x2000; + this->maskPos.x += this->maskVelocity.x; + this->maskPos.y += this->maskVelocity.y; + this->maskPos.z += this->maskVelocity.z; + } +} + +void EnPp_BodyPart_SetupMove(EnPp* this) { + EnPp_ChangeAnim(this, EN_PP_ANIM_DAMAGE); + this->actor.velocity.y = Rand_ZeroFloat(5.0f) + 13.0f; + this->actor.gravity = -2.0f; + this->timer = Rand_S16Offset(30, 30); + this->deadBodyPartRotationalVelocity.x = (this->deadBodyPartIndex * 0x2E) + 0xFF00; + this->deadBodyPartRotationalVelocity.z = (this->deadBodyPartIndex * 0x2E) + 0xFF00; + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_BODY_PART_BODY) { + this->actor.speedXZ = Rand_ZeroFloat(4.0f) + 4.0f; + this->actor.world.rot.y = ((s32)randPlusMinusPoint5Scaled(223.0f) + 0x1999) * this->deadBodyPartIndex; + } + + this->action = EN_PP_ACTION_BODY_PART_MOVE; + this->actionFunc = EnPp_BodyPart_Move; +} + +/** + * Makes the body part fly through the air. If it touches water, it will make a splash. + */ +void EnPp_BodyPart_Move(EnPp* this, PlayState* play) { + s32 pad; + Vec3f splashPos; + WaterBox* waterBox; + f32 waterSurface; + s32 i; + + SkelAnime_Update(&this->skelAnime); + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + this->deadBodyPartDrawDmgEffCount = 10; + for (i = 0; i < ARRAY_COUNT(this->deadBodyPartDrawDmgEffPos); i++) { + Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[i], &this->deadBodyPartPos); + this->deadBodyPartDrawDmgEffPos[i].x += Math_SinS(0xCCC * i) * 15.0f; + this->deadBodyPartDrawDmgEffPos[i].y += -5.0f; + this->deadBodyPartDrawDmgEffPos[i].z += Math_CosS(0xCCC * i) * 15.0f; + } + } else { + Math_Vec3f_Copy(&this->deadBodyPartDrawDmgEffPos[0], &this->deadBodyPartPos); + this->deadBodyPartDrawDmgEffCount = 1; + this->actor.shape.rot.x += this->deadBodyPartRotationalVelocity.x; + this->actor.shape.rot.z += this->deadBodyPartRotationalVelocity.z; + } + + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox) && + (this->actor.world.pos.y < (waterSurface + 5.0f))) { + this->timer = 0; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + for (i = 0; i < 6; i++) { + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.x += randPlusMinusPoint5Scaled(10 + (5 * i)); + splashPos.z += randPlusMinusPoint5Scaled(40 + (5 * i)); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (Rand_ZeroOne() * 100.0f) + 400.0f); + } + } else { + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, 400); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + } + + if ((this->timer == 0) || (this->actor.bgCheckFlags & 1)) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnPp_UpdateDamage(EnPp* this, PlayState* play) { + s16 yawDiff = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); + s32 attackBouncedOffMask = false; + s32 attackDealsDamage = false; + + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + if ((yawDiff < (BREG(2) + 0x4A9C)) || (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED)) { + this->actor.flags |= ACTOR_FLAG_200; + } else { + this->actor.flags &= ~ACTOR_FLAG_200; + } + } + + if ((EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) && (this->action < EN_PP_ACTION_MASK_DETACH)) { + if (this->maskCollider.elements[0].info.bumperFlags & BUMP_HIT) { + if (yawDiff < (BREG(2) + 0x4A9C)) { + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_HOOKSHOT) { + EnPp_Mask_SetupDetach(this, play); + } else if ((this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_GORON_POUND) || + (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_KNOCK_OFF_MASK)) { + EnPp_Mask_SetupDetach(this, play); + this->action = EN_PP_ACTION_MASK_DEAD; + } + } else { + attackBouncedOffMask = true; + } + } else if (this->maskCollider.elements[0].info.bumperFlags & BUMP_HIT) { + attackBouncedOffMask = true; + } + } + + if (this->bodyCollider.elements[0].info.bumperFlags & BUMP_HIT) { + if (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED) { + if ((this->action < EN_PP_ACTION_DAMAGED) && (this->action != EN_PP_ACTION_JUMP)) { + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_HOOKSHOT) { + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + return; + } + attackDealsDamage = true; + } + + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_ELECTRIC_STUN) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_STUN) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 255, 0, 40); + this->secondaryTimer = 40; + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if ((this->actor.colChkInfo.damageEffect != EN_PP_DMGEFF_GORON_POUND) && + (this->actor.colChkInfo.damageEffect != EN_PP_DMGEFF_JUMP)) { + attackDealsDamage = true; + this->hasBeenDamaged = true; + this->actor.speedXZ = 0.0f; + if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_FIRE) { + this->drawDmgEffTimer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } else if (this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_FREEZE) { + if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0)) { + Actor_ApplyDamage(&this->actor); + this->drawDmgEffTimer = 80; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; + this->drawDmgEffScale = 0.0f; + this->drawDmgEffFrozenSteamScale = 1.5f; + } + + if (this->actor.colChkInfo.health <= 0) { + EnPp_SetupDead(this, play); + } else { + EnPp_SetupStunnedOrFrozen(this); + } + return; + } else if ((this->actor.colChkInfo.damageEffect == EN_PP_DMGEFF_LIGHT_ORB) && + ((((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX)) && + (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || + (this->drawDmgEffTimer == 0))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, + this->actor.focus.pos.y, this->actor.focus.pos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); + Actor_SetColorFilter(&this->actor, 0x8000, 255, 0, 25); + this->drawDmgEffTimer = 20; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + } + } else if (this->action != EN_PP_ACTION_JUMP) { + EnPp_SetupJump(this); + } + } + + if (attackDealsDamage) { + Actor_ApplyDamage(&this->actor); + if (this->actor.colChkInfo.health > 0) { + EnPp_SetupDamaged(this, play); + } else { + EnPp_SetupDead(this, play); + } + } + } else { + attackBouncedOffMask = true; + } + } + + if (attackBouncedOffMask && (((this->action == EN_PP_ACTION_IDLE)) || (this->action == EN_PP_ACTION_CHARGE) || + (this->action == EN_PP_ACTION_ROAR))) { + this->secondaryTimer = 0; + this->timer = 10; + this->maskBounceRotationalVelocity = 0x20D0; + this->actor.speedXZ = 0.0f; + if (this->action == EN_PP_ACTION_CHARGE) { + this->actionVar.isCharging = false; + EnPp_ChangeAnim(this, EN_PP_ANIM_TURN_TO_FACE_PLAYER); + this->maskBounceRotationalVelocity = 0x1B58; + } + + this->targetRotY = this->actor.yawTowardsPlayer; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_SHIELD_BOUND); + } + } +} + +void EnPp_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnPp* this = THIS; + WaterBox* waterBox; + f32 waterSurface; + + DECR(this->timer); + + if (this->secondaryTimer != 0) { + this->secondaryTimer--; + } + + if (this->drawDmgEffTimer != 0) { + this->drawDmgEffTimer--; + } + + this->actionFunc(this, play); + EnPp_PlaySfxForAnimation(this); + Actor_MoveWithGravity(&this->actor); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { + this->maskCollider.elements[0].dim.modelSphere.radius = 42; + this->maskCollider.elements[0].dim.modelSphere.center.x = 400; + this->maskCollider.elements[0].dim.modelSphere.center.y = -400; + this->bodyCollider.elements[0].dim.modelSphere.radius = 20; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } else { + this->maskCollider.elements[0].dim.modelSphere.radius = 25; + this->maskCollider.elements[0].dim.modelSphere.center.x = 780; + this->maskCollider.elements[0].dim.modelSphere.center.y = -500; + this->bodyCollider.elements[0].dim.modelSphere.radius = 25; + this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; + this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; + } + } + + if ((this->action < EN_PP_ACTION_DEAD) && + (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox)) && + (this->actor.world.pos.y < waterSurface)) { + EnPp_SetupDead(this, play); + return; + } + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + EnPp_UpdateDamage(this, play); + Actor_SetFocus(&this->actor, 40.0f); + if ((this->action == EN_PP_ACTION_DEAD) || (this->actor.bgCheckFlags & 1)) { + this->actor.world.pos.x += this->damagedVelocity.x; + this->actor.world.pos.z += this->damagedVelocity.z; + Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); + Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); + } + } + + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, 0x1F); + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + this->actor.shape.rot.y = this->actor.world.rot.y; + } + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (this->floorPolyForCircleShadow == NULL) { + this->floorPolyForCircleShadow = this->actor.floorPoly; + } + + if ((this->action < EN_PP_ACTION_DEAD) || (this->action == EN_PP_ACTION_JUMP)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->maskCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + } + + if ((this->action < EN_PP_ACTION_MASK_DETACH) && (this->action != EN_PP_ACTION_STUNNED_OR_FROZEN)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->maskCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); + } + + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + if (this->hornColliderOn) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->hornCollider.base); + } + } +} + +s32 EnPp_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnPp* this = THIS; + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if ((limbIndex != HIPLOOP_LIMB_MASK) && + ((this->action == EN_PP_ACTION_MASK_DETACH) || (this->action == EN_PP_ACTION_MASK_DEAD))) { + *dList = NULL; + } + + if ((limbIndex == HIPLOOP_LIMB_MASK) && (EN_PP_GET_TYPE(&this->actor) != EN_PP_TYPE_MASKED)) { + *dList = NULL; + } + + if (limbIndex == HIPLOOP_LIMB_MASK) { + rot->x += (s16)this->maskRot.x; + rot->y += (s16)this->maskRot.y; + rot->z += (s16)this->maskRot.z; + pos->x += this->maskPos.x; + pos->y += this->maskPos.y; + pos->z += this->maskPos.z; + } + } else if ((limbIndex + EN_PP_TYPE_BODY_PART_BASE) != EN_PP_GET_TYPE(&this->actor)) { + *dList = NULL; + } + + return false; +} + +void EnPp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f sVertexOffset1 = { 0.0f, 0.0f, 0.0f }; + static Vec3f sVertexOffset2 = { 0.0f, 0.0f, 0.0f }; + EnPp* this = THIS; + Vec3f blureVertex1; + Vec3f blureVertex2; + + Matrix_Push(); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + if (limbIndex == HIPLOOP_LIMB_BACK_RIGHT_FOOT) { + Matrix_MultVec3f(&gZeroVec3f, &this->backFootPos[0]); + } + + if (limbIndex == HIPLOOP_LIMB_BACK_LEFT_FOOT) { + Matrix_MultVec3f(&gZeroVec3f, &this->backFootPos[1]); + } + + if ((limbIndex == HIPLOOP_LIMB_MASK) && (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_MASKED)) { + Matrix_MultVec3f(&gZeroVec3f, &this->maskFlamesBasePos); + if (this->hornColliderOn) { + if ((this->skelAnime.curFrame > 26.0f) || (this->action >= EN_PP_ACTION_MASK_DETACH)) { + this->hornColliderOn = false; + EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); + } else if ((this->skelAnime.curFrame > 0.0f) && (this->skelAnime.curFrame < 10.0f)) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + sVertexOffset1.x = 1160.0f; + sVertexOffset1.y = -900.0f; + sVertexOffset1.z = 0.0f; + sVertexOffset2.x = 100.0f; + sVertexOffset2.y = 300.0f; + sVertexOffset2.z = 0.0f; + Math_Vec3f_Copy(&this->hornCollider.dim.quad[3], &this->hornCollider.dim.quad[1]); + Math_Vec3f_Copy(&this->hornCollider.dim.quad[2], &this->hornCollider.dim.quad[0]); + Matrix_MultVec3f(&sVertexOffset1, &this->hornCollider.dim.quad[1]); + Matrix_MultVec3f(&sVertexOffset2, &this->hornCollider.dim.quad[0]); + Collider_SetQuadVertices(&this->hornCollider, &this->hornCollider.dim.quad[0], + &this->hornCollider.dim.quad[1], &this->hornCollider.dim.quad[2], + &this->hornCollider.dim.quad[3]); + Matrix_MultVec3f(&sVertexOffset1, &blureVertex1); + Matrix_MultVec3f(&sVertexOffset2, &blureVertex2); + EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &blureVertex1, &blureVertex2); + } + } + } + } else { + if ((EN_PP_GET_TYPE(&this->actor) >= EN_PP_TYPE_BODY_PART_BASE) && + ((limbIndex + EN_PP_TYPE_BODY_PART_BASE) == EN_PP_GET_TYPE(&this->actor))) { + Matrix_MultVec3f(&gZeroVec3f, &this->deadBodyPartPos); + } + } + + Matrix_Pop(); + + if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { + Collider_UpdateSpheres(limbIndex, &this->maskCollider); + Collider_UpdateSpheres(limbIndex, &this->bodyCollider); + if ((limbIndex == HIPLOOP_LIMB_BODY) || (limbIndex == HIPLOOP_LIMB_FRONT_LEFT_LOWER_LEG) || + (limbIndex == HIPLOOP_LIMB_FRONT_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_LEFT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_BACK_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_CENTER_WING_BASE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_BACK_LEFT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_EYE) || + (limbIndex == HIPLOOP_LIMB_LEFT_EYE)) { + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosCount]); + this->bodyPartsPosCount++; + if (this->bodyPartsPosCount >= ARRAY_COUNT(this->bodyPartsPos)) { + this->bodyPartsPosCount = 0; + } + + if ((this->action == EN_PP_ACTION_SPAWN_BODY_PARTS) && (this->deadBodyPartsSpawnedCount < 6) && + ((limbIndex == HIPLOOP_LIMB_BODY) || (limbIndex == HIPLOOP_LIMB_FRONT_LEFT_LOWER_LEG) || + (limbIndex == HIPLOOP_LIMB_FRONT_RIGHT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_LEFT_WING_MIDDLE) || + (limbIndex == HIPLOOP_LIMB_RIGHT_WING_MIDDLE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE))) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PP, 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, limbIndex + 7); + this->deadBodyPartsSpawnedCount++; + if (this->deadBodyPartsSpawnedCount >= 6) { + this->action = EN_PP_ACTION_DONE_SPAWNING_BODY_PARTS; + } + } + } + } +} + +void EnPp_Draw(Actor* thisx, PlayState* play) { + EnPp* this = THIS; + MtxF mtxF; + Vec3f pos; + f32 scale; + f32 alpha; + + func_8012C2DC(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPp_OverrideLimbDraw, EnPp_PostLimbDraw, &this->actor); + + if (this->deadBodyPartDrawDmgEffCount != 0) { + scale = 0.4f; + if (EN_PP_GET_TYPE(&this->actor) == EN_PP_TYPE_BODY_PART_BODY) { + scale = 0.6f; + } + + Actor_DrawDamageEffects(play, &this->actor, this->deadBodyPartDrawDmgEffPos, this->deadBodyPartDrawDmgEffCount, + scale, scale, 1.0f, ACTOR_DRAW_DMGEFF_BLUE_FIRE); + } + + if (this->drawDmgEffTimer != 0) { + alpha = this->drawDmgEffTimer * 0.05f; + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + this->drawDmgEffScale += 0.3f; + if (this->drawDmgEffScale > 0.5f) { + this->drawDmgEffScale = 0.5f; + } + + Math_ApproachF(&this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, 0.1f, 0.04f); + } else { + this->drawDmgEffScale = 0.8f; + this->drawDmgEffFrozenSteamScale = 0.8f; + } + + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, alpha, this->drawDmgEffType); + } + + if (this->floorPolyForCircleShadow != NULL) { + if ((this->action != EN_PP_ACTION_MASK_DETACH) && (this->action < EN_PP_ACTION_DEAD)) { + OPEN_DISPS(play->state.gfxCtx); + + func_8012C448(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); + + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.x += (Math_SinS(this->actor.world.rot.y) * -13.0f); + pos.y = this->actor.floorHeight; + pos.z += (Math_CosS(this->actor.world.rot.y) * -13.0f); + func_800C0094(this->actor.floorPoly, pos.x, pos.y, pos.z, &mtxF); + + Matrix_Mult(&mtxF, MTXMODE_NEW); + Matrix_Scale(0.5f, 1.0f, 0.5f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); + + CLOSE_DISPS(play->state.gfxCtx); + } + } +} diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 4fab409b2..291c6473b 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -2,16 +2,82 @@ #define Z_EN_PP_H #include "global.h" +#include "objects/object_pp/object_pp.h" struct EnPp; typedef void (*EnPpActionFunc)(struct EnPp*, PlayState*); +#define EN_PP_GET_TYPE(thisx) ((thisx)->params) +#define EN_PP_DOES_CHARGE_IN_STRAIGHT_LINES(thisx) (((thisx)->params >> 8) & 1) +#define EN_PP_GET_ATTACK_RANGE(thisx) ((thisx)->world.rot.z) + +typedef enum { + /* 0 */ EN_PP_TYPE_MASKED, + /* 1 */ EN_PP_TYPE_NO_MASK, + /* 2 */ EN_PP_TYPE_UNMASKED, + /* 7 */ EN_PP_TYPE_BODY_PART_BASE = 7, + /* 8 */ EN_PP_TYPE_BODY_PART_BODY, + /* 10 */ EN_PP_TYPE_BODY_PART_FRONT_LEFT_LOWER_LEG = 10, + /* 13 */ EN_PP_TYPE_BODY_PART_FRONT_RIGHT_LOWER_LEG = 13, + /* 17 */ EN_PP_TYPE_BODY_PART_LEFT_WING_MIDDLE = 17, + /* 23 */ EN_PP_TYPE_BODY_PART_RIGHT_WING_MIDDLE = 23, + /* 26 */ EN_PP_TYPE_BODY_PART_CENTER_WING_MIDDLE = 26, +} EnPpType; + typedef struct EnPp { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x17C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[HIPLOOP_LIMB_MAX]; + /* 0x224 */ Vec3s morphTable[HIPLOOP_LIMB_MAX]; /* 0x2C0 */ EnPpActionFunc actionFunc; - /* 0x2C4 */ char unk_2C4[0x328]; + /* 0x2C4 */ s16 chargesInStraightLines; // If false, the Hiploop will instead charge directly at the player. + /* 0x2C6 */ s16 deadBodyPartIndex; + /* 0x2C8 */ s16 action; + /* 0x2CA */ s16 timer; + /* 0x2CC */ s16 secondaryTimer; + /* 0x2C8 */ s16 hornColliderOn; + /* 0x2D0 */ s16 targetRotY; + /* 0x2D2 */ union { + s16 isCharging; + s16 hasDoneFirstRoar; + s16 hasLandedFromJump; + s16 maskDetachState; + } actionVar; + /* 0x2D4 */ s16 maskBounceRotationalVelocity; // Controls the speed that the Hiploop rotates to face the player when an attack bounces off the mask. + /* 0x2D6 */ s16 deadBodyPartsSpawnedCount; + /* 0x2D8 */ f32 endFrame; + /* 0x2DC */ f32 chargeAndBounceSpeed; + /* 0x2DC */ Vec3f ledgeCheckPos[3]; + /* 0x304 */ Vec3f wallCheckPos; + /* 0x310 */ Vec3f backFootPos[2]; + /* 0x328 */ Vec3f maskFlamesBasePos; + /* 0x334 */ Vec3f maskPos; + /* 0x340 */ Vec3f maskRot; + /* 0x34C */ Vec3f maskVelocity; + /* 0x358 */ Vec3f targetPos; + /* 0x364 */ Vec3f deadBodyPartPos; + /* 0x370 */ s32 deadBodyPartDrawDmgEffCount; + /* 0x374 */ Vec3f deadBodyPartDrawDmgEffPos[10]; + /* 0x3EC */ Vec3s deadBodyPartRotationalVelocity; + /* 0x3F2 */ s16 drawDmgEffTimer; + /* 0x3F4 */ s16 drawDmgEffType; + /* 0x3F8 */ f32 drawDmgEffScale; + /* 0x3FC */ f32 drawDmgEffFrozenSteamScale; + /* 0x400 */ f32 attackRange; + /* 0x404 */ s32 hasBeenDamaged; + /* 0x408 */ Vec3f bodyPartsPos[11]; + /* 0x48C */ s16 bodyPartsPosCount; + /* 0x490 */ f32 maskAccelY; + /* 0x494 */ ColliderJntSph maskCollider; + /* 0x4B4 */ ColliderJntSphElement maskColliderElements[1]; + /* 0x4F4 */ ColliderJntSph bodyCollider; + /* 0x514 */ ColliderJntSphElement bodyColliderElements[1]; + /* 0x554 */ ColliderQuad hornCollider; + /* 0x5D4 */ CollisionPoly* floorPolyForCircleShadow; + /* 0x5D8 */ s32 blureIndex; + /* 0x5DC */ s32 animIndex; + /* 0x5DC */ Vec3f damagedVelocity; } EnPp; // size = 0x5EC extern const ActorInit En_Pp_InitVars; diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index e26ac6bed..78458e062 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -15,10 +15,109 @@ void EnPst_Destroy(Actor* thisx, PlayState* play); void EnPst_Update(Actor* thisx, PlayState* play); void EnPst_Draw(Actor* thisx, PlayState* play); -void func_80B2BD98(EnPst* this, PlayState* play); -void func_80B2BE54(EnPst* this, PlayState* play); +void EnPst_FollowSchedule(EnPst* this, PlayState* play); +void EnPst_Talk(EnPst* this, PlayState* play); + +typedef enum { + /* 0 */ POSTBOX_SCH_NONE, + /* 1 */ POSTBOX_SCH_AVAILABLE, + /* 2 */ POSTBOX_SCH_CHECKED_BY_POSTMAN +} PostboxScheduleResult; + +typedef enum { + /* 0 */ POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM, + /* 1 */ POSTBOX_BEHAVIOUR_TAKE_ITEM, +} PostboxBehaviour; + +static u8 D_80B2C200[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(9, 31, 9, 35, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C20C[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 3, 10, 7, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C218[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 35, 10, 39, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C224[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 53, 10, 57, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +static u8 D_80B2C230[] = { + /* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(11, 25, 11, 29, 0x9 - 0x6), + /* 0x6 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_AVAILABLE), + /* 0x9 */ SCHEDULE_CMD_RET_VAL_L(POSTBOX_SCH_CHECKED_BY_POSTMAN), +}; + +s32 D_80B2C23C[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C288[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C2D4[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C320[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C36C[] = { + 0x0E27840C, 0x0E00FF2B, 0x00000031, 0x00392800, 0x0A122C27, 0xA40C2F00, 0x000C1012, + 0x2C27870C, 0x2F00000C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F, + 0x27892D00, 0x180C1012, 0x2C27850C, 0x2FFFD20E, 0x27860C10, +}; + +s32 D_80B2C3B8[] = { + 0x0E27A10C, 0x0F27A20C, 0x12005108, 0x000F0600, 0x0C000013, 0x000C0C11, + 0x51080700, 0x0C060001, 0x00001300, 0x010C0700, 0x000E27A3, 0x0C161000, +}; + +s32 D_80B2C3E8[] = { + 0x2C27870C, 0x111B022A, 0x002F001B, 0x4000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C408[] = { + 0x2C27870C, 0x111B042A, 0x002F001B, 0x8000080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C428[] = { + 0x2C27870C, 0x111B082A, 0x002F001C, 0x0100080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C448[] = { + 0x2C27870C, 0x111B102A, 0x002F001C, 0x0200080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C468[] = { + 0x2C27870C, 0x111B202A, 0x002F001C, 0x0400080F, 0x27882D00, 0x180C100F, 0x27892D00, 0x180C1000, +}; + +s32 D_80B2C488[] = { 0x2C27A40C, 0x10000000 }; + +s32 D_80B2C490[] = { 0x2C27850C, 0x10000000 }; -#if 0 const ActorInit En_Pst_InitVars = { ACTOR_EN_PST, ACTORCAT_PROP, @@ -31,51 +130,315 @@ const ActorInit En_Pst_InitVars = { (ActorFunc)EnPst_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B2C4B8 = { - { 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, + }, { 28, 72, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80B2C4E4 = { 1, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -#endif +static AnimationInfoS sAnimationInfo[] = { { &gPostboxOpenSlotAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 } }; -extern ColliderCylinderInit D_80B2C4B8; -extern CollisionCheckInfoInit2 D_80B2C4E4; +void EnPst_UpdateCollision(EnPst* this, PlayState* play) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} -extern UNK_TYPE D_06001A80; +s32 EnPst_HandleLetterDay1(EnPst* this) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x2; + case POSTBOX_NORTH_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x4; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x8; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x10; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x20; + default: + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B830.s") +s32 EnPst_HandleLetterDay2(EnPst* this) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x40; + case POSTBOX_NORTH_CLOCKTOWN: + return gSaveContext.save.weekEventReg[27] & 0x80; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x1; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x2; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return gSaveContext.save.weekEventReg[28] & 0x4; + default: + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B874.s") +s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) { + s32 itemActionParam = 0; + s32 scriptBranch = 0; + EnPst* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B8F4.s") + switch (this->behaviour) { + case POSTBOX_BEHAVIOUR_WAIT_FOR_ITEM: + switch (Message_GetState(&play->msgCtx)) { + case TEXT_STATE_CHOICE: + case TEXT_STATE_5: + if (Message_ShouldAdvance(play)) { + case TEXT_STATE_16: + itemActionParam = func_80123810(play); + scriptBranch = 0; + if ((itemActionParam == PLAYER_AP_LETTER_TO_KAFEI) || + (itemActionParam == PLAYER_AP_LETTER_MAMA)) { + this->exchangeItemId = itemActionParam; + this->behaviour++; + scriptBranch = 1; + } else if (itemActionParam < PLAYER_AP_NONE) { + this->behaviour++; + scriptBranch = 3; + } else if (itemActionParam != PLAYER_AP_NONE) { + this->behaviour++; + scriptBranch = 2; + } + } + break; + } + break; + case POSTBOX_BEHAVIOUR_TAKE_ITEM: + if (this->exchangeItemId == PLAYER_AP_LETTER_TO_KAFEI) { + scriptBranch = 1; + } + break; + } + return scriptBranch; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2B974.s") +s32* EnPst_GetMsgEventScript(EnPst* this, PlayState* play) { + if (Player_GetMask(play) == PLAYER_MASK_POSTMAN) { + return D_80B2C3B8; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BAA4.s") + if (this->stateFlags & 0x10) { + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return D_80B2C3E8; + case POSTBOX_NORTH_CLOCKTOWN: + return D_80B2C408; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return D_80B2C428; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return D_80B2C448; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return D_80B2C468; + default: + return NULL; + } + } else if (this->stateFlags & 0x20) { + if (this->exchangeItemId == PLAYER_AP_LETTER_MAMA) { + return D_80B2C488; + } else { + return D_80B2C490; + } + } else { + this->msgEventCallback = EnPst_ChooseBehaviour; + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return D_80B2C23C; + case POSTBOX_NORTH_CLOCKTOWN: + return D_80B2C288; + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return D_80B2C2D4; + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return D_80B2C320; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return D_80B2C36C; + default: + return NULL; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BBFC.s") +s32 EnPst_CheckTalk(EnPst* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BCF8.s") + if (this->stateFlags & 7) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->stateFlags &= ~0x30; + if (player->exchangeItemId == PLAYER_AP_LETTER_TO_KAFEI) { + this->stateFlags |= 0x10; + this->exchangeItemId = player->exchangeItemId; + } else if (player->exchangeItemId != PLAYER_AP_NONE) { + this->stateFlags |= 0x20; + this->exchangeItemId = player->exchangeItemId; + } + // If Letter to Kafei is deposited, value is set to 2 + this->isLetterToKafeiDeposited = EnPst_HandleLetterDay1(this); + SubS_UpdateFlags(&this->stateFlags, 0, 7); + this->behaviour = 0; + this->msgEventCallback = NULL; + this->stateFlags |= 0x40; + this->msgEventScript = EnPst_GetMsgEventScript(this, play); + this->actionFunc = EnPst_Talk; + ret = true; + } + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD30.s") +s32 EnPst_UpdateFlagsSubs(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { + SubS_UpdateFlags(&this->stateFlags, 3, 7); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD88.s") +s32 EnPst_ProcessScheduleOutput(EnPst* this, PlayState* play, ScheduleOutput* scheduleOutput) { + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BD98.s") + this->stateFlags = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2BE54.s") + switch (scheduleOutput->result) { + case POSTBOX_SCH_AVAILABLE: + ret = EnPst_UpdateFlagsSubs(this, play, scheduleOutput); + break; + case POSTBOX_SCH_CHECKED_BY_POSTMAN: + ret = true; + break; + } + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Init.s") +/* The postbox does not have any necessary custom logic when following their schedule, + * instead it is all done in the process step. This is why this function is empty + */ +void EnPst_HandleSchedule(EnPst* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Destroy.s") +void EnPst_FollowSchedule(EnPst* this, PlayState* play) { + static u8* sScheduleScripts[] = { + D_80B2C200, D_80B2C20C, D_80B2C218, D_80B2C224, D_80B2C230, + }; + s16 params = this->actor.params; + ScheduleOutput scheduleOutput; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Update.s") + if (!Schedule_RunScript(play, sScheduleScripts[params], &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && + !EnPst_ProcessScheduleOutput(this, play, &scheduleOutput))) { + this->actor.shape.shadowDraw = NULL; + this->actor.flags &= ~ACTOR_FLAG_1; + scheduleOutput.result = POSTBOX_SCH_NONE; + } else { + this->actor.shape.shadowDraw = ActorShadow_DrawCircle; + this->actor.flags |= ACTOR_FLAG_1; + } + this->scheduleResult = scheduleOutput.result; + EnPst_HandleSchedule(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/func_80B2C11C.s") +void EnPst_Talk(EnPst* this, PlayState* play) { + if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->msgEventArg4)) { + if (EnPst_HandleLetterDay1(this) != this->isLetterToKafeiDeposited) { + switch (gSaveContext.save.day) { + case 1: + gSaveContext.save.weekEventReg[91] |= 4; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Pst/EnPst_Draw.s") + case 2: + if (EnPst_HandleLetterDay2(this)) { + gSaveContext.save.weekEventReg[91] |= 8; + } else { + gSaveContext.save.weekEventReg[91] |= 4; + } + break; + + default: + gSaveContext.save.weekEventReg[91] |= 8; + break; + } + } + SubS_UpdateFlags(&this->stateFlags, 3, 7); + this->msgEventArg4 = 0; + this->actionFunc = EnPst_FollowSchedule; + } +} + +void EnPst_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnPst* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gPostboxSkel, NULL, this->jointTable, this->morphTable, + POSTBOX_LIMB_MAX); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); + SubS_UpdateFlags(&this->stateFlags, 3, 7); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); + this->actor.targetMode = 0; + Actor_SetScale(&this->actor, 0.02f); + this->actionFunc = EnPst_FollowSchedule; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); +} + +void EnPst_Destroy(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void EnPst_Update(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + EnPst_CheckTalk(this, play); + this->actionFunc(this, play); + if (this->scheduleResult != POSTBOX_SCH_NONE) { + if (Actor_IsFacingPlayer(&this->actor, 0x1FFE)) { + this->unk214 = 0; + func_8013C964(&this->actor, play, 60.0f, 20.0f, 0, this->stateFlags & 7); + } + Actor_SetFocus(&this->actor, 20.0f); + EnPst_UpdateCollision(this, play); + } +} + +s32 EnPst_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnPst* this = THIS; + f32 yTranslation; + + if (limbIndex == POSTBOX_LIMB_MAIL_SLOT) { + if (this->stateFlags & 0x40) { + yTranslation = -100.0f; + } else { + yTranslation = 0.0f; + } + Matrix_Translate(0.0f, yTranslation, 0.0f, MTXMODE_APPLY); + } + return false; +} + +void EnPst_Draw(Actor* thisx, PlayState* play) { + EnPst* this = THIS; + + if (this->scheduleResult != POSTBOX_SCH_NONE) { + func_8012C28C(play->state.gfxCtx); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnPst_OverrideLimbDraw, NULL, &this->actor); + } +} diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.h b/src/overlays/actors/ovl_En_Pst/z_en_pst.h index ba60b4bf0..1f85a1dec 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.h +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.h @@ -2,16 +2,38 @@ #define Z_EN_PST_H #include "global.h" +#include "objects/object_pst/object_pst.h" + +typedef enum { + /* 0 */ POSTBOX_SOUTH_UPPER_CLOCKTOWN, + /* 1 */ POSTBOX_NORTH_CLOCKTOWN, + /* 2 */ POSTBOX_EAST_UPPER_CLOCKTOWN, + /* 3 */ POSTBOX_EAST_LOWER_CLOCKTOWN, + /* 4 */ POSTBOX_SOUTH_LOWER_CLOCKTOWN, +} PostboxType; struct EnPst; typedef void (*EnPstActionFunc)(struct EnPst*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnPst { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x44]; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnPstActionFunc actionFunc; - /* 0x18C */ char unk_18C[0x94]; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ u8 scheduleResult; + /* 0x1DC */ s32* msgEventScript; + /* 0x1E0 */ s32 msgEventArg4; + /* 0x1E4 */ Vec3s jointTable[POSTBOX_LIMB_MAX]; + /* 0x1F6 */ Vec3s morphTable[POSTBOX_LIMB_MAX]; + /* 0x208 */ u16 stateFlags; + /* 0x20A */ UNK_TYPE1 pad20A[4]; + /* 0x20E */ s16 behaviour; + /* 0x210 */ MsgEventFunc msgEventCallback; + /* 0x214 */ s32 unk214; // Set and not used + /* 0x218 */ s32 exchangeItemId; + /* 0x21C */ s32 isLetterToKafeiDeposited; } EnPst; // size = 0x220 extern const ActorInit En_Pst_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 529ac9f4e..66b2a0a1e 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -204,26 +204,26 @@ static DamageTable sDamageTable = { }; 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; + /* 0 */ RACEDOG_ANIM_IDLE, + /* 1 */ RACEDOG_ANIM_WALK_1, // unused + /* 2 */ RACEDOG_ANIM_RUN, + /* 3 */ RACEDOG_ANIM_BARK, // unused + /* 4 */ RACEDOG_ANIM_SIT_DOWN_ONCE, // unused + /* 5 */ RACEDOG_ANIM_SIT_DOWN, // unused + /* 6 */ RACEDOG_ANIM_LYING_DOWN_START_1, // unused + /* 7 */ RACEDOG_ANIM_LYING_DOWN_LOOP, // unused + /* 8 */ RACEDOG_ANIM_LYING_DOWN_START_2, // unused + /* 9 */ RACEDOG_ANIM_LYING_DOWN_START_3, // unused + /* 10 */ RACEDOG_ANIM_LYING_DOWN_START_4, // unused + /* 11 */ RACEDOG_ANIM_WALK_BACKWARDS, // unused + /* 12 */ RACEDOG_ANIM_JUMP, + /* 13 */ RACEDOG_ANIM_LONG_JUMP, // unused + /* 14 */ RACEDOG_ANIM_JUMP_ATTACK, // unused + /* 15 */ RACEDOG_ANIM_SWIM, // unused + /* 16 */ RACEDOG_ANIM_MAX +} RacedogAnimation; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &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 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, @@ -238,10 +238,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP), }; -void EnRacedog_ChangeAnimation(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 index) { +void EnRacedog_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { f32 frameCount; - animationInfo += index; + animationInfo += animIndex; if (animationInfo->frameCount < 0) { frameCount = Animation_GetLastFrame(animationInfo->animation); } else { @@ -354,8 +354,8 @@ void EnRacedog_Init(Actor* thisx, PlayState* play) { sSelectedDogInfo = sDogInfo[(s16)((gSaveContext.eventInf[0] & 0xF8) >> 3)]; this->selectedDogIndex = sSelectedDogInfo.index; - EnRacedog_ChangeAnimation(&this->skelAnime, sAnimations, RACEDOG_ANIMATION_IDLE); - sAnimations[RACEDOG_ANIMATION_IDLE].playSpeed = Rand_ZeroFloat(0.5f) + 1.0f; + EnRacedog_ChangeAnim(&this->skelAnime, sAnimationInfo, RACEDOG_ANIM_IDLE); + sAnimationInfo[RACEDOG_ANIM_IDLE].playSpeed = Rand_ZeroFloat(0.5f) + 1.0f; this->actionFunc = EnRacedog_RaceStart; } @@ -376,7 +376,7 @@ void EnRacedog_RaceStart(EnRacedog* this, PlayState* play) { play_sound(NA_SE_SY_START_SHOT); } - EnRacedog_ChangeAnimation(&this->skelAnime, sAnimations, RACEDOG_ANIMATION_RUN); + EnRacedog_ChangeAnim(&this->skelAnime, sAnimationInfo, RACEDOG_ANIM_RUN); this->actionFunc = EnRacedog_Race; } } @@ -601,9 +601,9 @@ void EnRacedog_CheckForFinish(EnRacedog* this) { */ void EnRacedog_UpdateRunAnimationPlaySpeed(EnRacedog* this) { if (this->actor.speedXZ < 3.0f) { - sAnimations[RACEDOG_ANIMATION_RUN].playSpeed = 0.9f; + sAnimationInfo[RACEDOG_ANIM_RUN].playSpeed = 0.9f; } else { - sAnimations[RACEDOG_ANIMATION_RUN].playSpeed = 1.0f; + sAnimationInfo[RACEDOG_ANIM_RUN].playSpeed = 1.0f; } } diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index edd407921..a3d91bba9 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -35,13 +35,13 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play); void EnRaf_DrawEffects(EnRaf* this, PlayState* play); typedef enum { - /* 0 */ EN_RAF_ANIMATION_IDLE, - /* 1 */ EN_RAF_ANIMATION_CLOSE, - /* 2 */ EN_RAF_ANIMATION_CHEW, - /* 3 */ EN_RAF_ANIMATION_SPIT, - /* 4 */ EN_RAF_ANIMATION_CONVULSE, - /* 5 */ EN_RAF_ANIMATION_DEATH, -} EnRafAnimationIndex; + /* 0 */ EN_RAF_ANIM_IDLE, + /* 1 */ EN_RAF_ANIM_CLOSE, + /* 2 */ EN_RAF_ANIM_CHEW, + /* 3 */ EN_RAF_ANIM_SPIT, + /* 4 */ EN_RAF_ANIM_CONVULSE, + /* 5 */ EN_RAF_ANIM_DEATH, +} EnRafAnimation; typedef enum { /* 0 */ EN_RAF_ACTION_IDLE, @@ -260,7 +260,7 @@ void EnRaf_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnRaf_ChangeAnimation(EnRaf* this, s32 index) { +void EnRaf_ChangeAnim(EnRaf* this, s32 animIndex) { static AnimationHeader* sAnimations[] = { &gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadCloseAnim, &gCarnivorousLilyPadChewAnim, &gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadConvulseAnim, &gCarnivorousLilyPadDeathAnim, @@ -271,22 +271,22 @@ void EnRaf_ChangeAnimation(EnRaf* this, s32 index) { f32 startFrame = 0.0f; f32 playSpeed = 1.0f; - this->endFrame = Animation_GetLastFrame(sAnimations[index]); - if (index == EN_RAF_ANIMATION_IDLE) { + this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); + if (animIndex == EN_RAF_ANIM_IDLE) { startFrame = this->endFrame; - } else if (index == EN_RAF_ANIMATION_CLOSE) { + } else if (animIndex == EN_RAF_ANIM_CLOSE) { playSpeed = 2.0f; } - Animation_Change(&this->skelAnime, sAnimations[index], playSpeed, startFrame, this->endFrame, - sAnimationModes[index], -4.0f); + Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, startFrame, this->endFrame, + sAnimationModes[animIndex], -4.0f); } void EnRaf_SetupIdle(EnRaf* this) { Vec3f targetLimbScale = { 1.0f, 1.0f, 1.0f }; s32 i; - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_IDLE); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_IDLE); for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) { Math_Vec3f_Copy(&this->targetLimbScale[i], &targetLimbScale); @@ -358,7 +358,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { } void EnRaf_SetupGrab(EnRaf* this) { - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_CLOSE); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_CLOSE); this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_GRAB; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_SUISEN_DRINK); this->action = EN_RAF_ACTION_GRAB; @@ -387,7 +387,7 @@ void EnRaf_Grab(EnRaf* this, PlayState* play) { void EnRaf_SetupChew(EnRaf* this) { s32 i; - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_CHEW); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_CHEW); this->chewCount = 0; for (i = 0; i < ARRAY_COUNT(this->chewLimbRot); i++) { this->chewLimbRot[i].x = Rand_S16Offset(8, 8) << 8; @@ -461,7 +461,7 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { void EnRaf_SetupThrow(EnRaf* this, PlayState* play) { Player* player = GET_PLAYER(play); - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_SPIT); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT); player->actor.freezeTimer = 10; this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW; this->action = EN_RAF_ACTION_THROW; @@ -557,7 +557,7 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) { } void EnRaf_SetupConvulse(EnRaf* this) { - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_CONVULSE); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_CONVULSE); this->chewCount = 0; this->action = EN_RAF_ACTION_CONVULSE; this->actionFunc = EnRaf_Convulse; @@ -584,7 +584,7 @@ void EnRaf_Convulse(EnRaf* this, PlayState* play) { } void EnRaf_SetupDissolve(EnRaf* this) { - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_DEATH); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_DEATH); this->action = EN_RAF_ACTION_DISSOLVE; this->dissolveTimer = 0; this->actionFunc = EnRaf_Dissolve; @@ -671,7 +671,7 @@ void EnRaf_Dormant(EnRaf* this, PlayState* play) { DECR(this->reviveTimer); if (this->reviveTimer == 0) { - EnRaf_ChangeAnimation(this, EN_RAF_ANIMATION_SPIT); + EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT); for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) { 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 1c8756148..095ee3fec 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 @@ -62,7 +62,7 @@ const ActorInit En_Rail_Skb_InitVars = { (ActorFunc)EnRailSkb_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_skb_Anim_0064E0, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, @@ -312,7 +312,7 @@ void EnRailSkb_Destroy(Actor* thisx, PlayState* play) { void func_80B70FA0(EnRailSkb* this) { this->unk_3F2 = 0; if (this->actionFunc != func_80B716A8) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); } this->actionFunc = func_80B70FF8; } @@ -356,7 +356,7 @@ void func_80B7114C(EnRailSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); @@ -380,7 +380,7 @@ void func_80B7123C(EnRailSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); @@ -406,7 +406,7 @@ void func_80B71314(EnRailSkb* this, PlayState* play) { void func_80B71354(EnRailSkb* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80B713A4; } @@ -415,7 +415,7 @@ void func_80B713A4(EnRailSkb* this, PlayState* play) { if ((this->actor.xzDistToPlayer > 65.0f) || (Player_GetMask(play) == PLAYER_MASK_CAPTAIN)) { func_80B70FA0(this); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); } } @@ -456,7 +456,7 @@ void func_80B7151C(EnRailSkb* this) { this->actor.draw = EnRailSkb_Draw; this->actor.shape.shadowAlpha = 0; this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80B715AC; } @@ -479,7 +479,7 @@ void func_80B715AC(EnRailSkb* this, PlayState* play) { void func_80B71650(EnRailSkb* this) { this->unk_3FE = 0; if (this->actionFunc != func_80B70FF8) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); } this->actionFunc = func_80B716A8; } @@ -496,7 +496,7 @@ void func_80B716A8(EnRailSkb* this, PlayState* play) { Message_StartTextbox(play, 0x13F5, &this->actor); this->unk_400 = 0x13F5; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); func_80B717C8(this); } else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) { func_800B8614(&this->actor, play, 100.0f); @@ -558,7 +558,7 @@ void func_80B718C4(EnRailSkb* this, PlayState* play) { } void func_80B71910(EnRailSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80B71954; } @@ -576,7 +576,7 @@ void func_80B71954(EnRailSkb* this, PlayState* play) { void func_80B71A08(EnRailSkb* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80B71A58; } @@ -585,7 +585,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) { this->unk_22C->dyna.actor.colChkInfo.health--; } else { @@ -608,7 +608,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) { void func_80B71B6C(EnRailSkb* this) { this->unk_3F2 = 10; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80B71BB8; } @@ -641,7 +641,7 @@ void func_80B71BB8(EnRailSkb* this, PlayState* play) { if ((sp34 < 50.0f) && (this->actor.bgCheckFlags & 1)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); this->actor.velocity.y = 10.0f; for (i = 0; i < 4; i++) { @@ -674,7 +674,7 @@ void func_80B71DF0(EnRailSkb* this) { this->drawDmgEffTimer = 0; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); this->actionFunc = func_80B71EA8; } @@ -1000,7 +1000,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_402 |= 1; func_80B712FC(this); break; @@ -1026,7 +1026,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80B71228(this); break; @@ -1045,7 +1045,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { case 13: Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80B712FC(this); break; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 1a197d6b5..10bbf2f83 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -50,27 +50,27 @@ void EnRailgibud_SinkIntoGround(EnRailgibud* this, PlayState* play); void EnRailgibud_Cutscene_Update(Actor* thisx, PlayState* play); typedef enum { - /* 0 */ EN_RAILGIBUD_ANIMATION_GRAB_ATTACK, - /* 1 */ EN_RAILGIBUD_ANIMATION_GRAB_END, - /* 2 */ EN_RAILGIBUD_ANIMATION_GRAB_START, - /* 3 */ EN_RAILGIBUD_ANIMATION_LOOK_BACK, - /* 4 */ EN_RAILGIBUD_ANIMATION_CROUCH_WIPING_TEARS, - /* 5 */ EN_RAILGIBUD_ANIMATION_CROUCH_CRYING, - /* 6 */ EN_RAILGIBUD_ANIMATION_DEATH, - /* 7 */ EN_RAILGIBUD_ANIMATION_DAMAGE, - /* 8 */ EN_RAILGIBUD_ANIMATION_CROUCH_END, - /* 9 */ EN_RAILGIBUD_ANIMATION_IDLE, - /* 10 */ EN_RAILGIBUD_ANIMATION_WALK, - /* 11 */ EN_RAILGIBUD_ANIMATION_DANCE_SQUAT, - /* 12 */ EN_RAILGIBUD_ANIMATION_DANCE_PIROUETTE, - /* 13 */ EN_RAILGIBUD_ANIMATION_DANCE_CLAP, - /* 14 */ EN_RAILGIBUD_ANIMATION_CROUCH_END_2, - /* 15 */ EN_RAILGIBUD_ANIMATION_SLUMP_START, - /* 16 */ EN_RAILGIBUD_ANIMATION_SLUMP_LOOP, - /* 17 */ EN_RAILGIBUD_ANIMATION_CONVULSION, - /* 18 */ EN_RAILGIBUD_ANIMATION_ARMS_UP_START, - /* 19 */ EN_RAILGIBUD_ANIMATION_ARMS_UP_LOOP, -} EnRailgibudAnimations; + /* 0 */ EN_RAILGIBUD_ANIM_GRAB_ATTACK, + /* 1 */ EN_RAILGIBUD_ANIM_GRAB_END, + /* 2 */ EN_RAILGIBUD_ANIM_GRAB_START, + /* 3 */ EN_RAILGIBUD_ANIM_LOOK_BACK, + /* 4 */ EN_RAILGIBUD_ANIM_CROUCH_WIPING_TEARS, + /* 5 */ EN_RAILGIBUD_ANIM_CROUCH_CRYING, + /* 6 */ EN_RAILGIBUD_ANIM_DEATH, + /* 7 */ EN_RAILGIBUD_ANIM_DAMAGE, + /* 8 */ EN_RAILGIBUD_ANIM_CROUCH_END, + /* 9 */ EN_RAILGIBUD_ANIM_IDLE, + /* 10 */ EN_RAILGIBUD_ANIM_WALK, + /* 11 */ EN_RAILGIBUD_ANIM_DANCE_SQUAT, + /* 12 */ EN_RAILGIBUD_ANIM_DANCE_PIROUETTE, + /* 13 */ EN_RAILGIBUD_ANIM_DANCE_CLAP, + /* 14 */ EN_RAILGIBUD_ANIM_CROUCH_END_2, + /* 15 */ EN_RAILGIBUD_ANIM_SLUMP_START, + /* 16 */ EN_RAILGIBUD_ANIM_SLUMP_LOOP, + /* 17 */ EN_RAILGIBUD_ANIM_CONVULSION, + /* 18 */ EN_RAILGIBUD_ANIM_ARMS_UP_START, + /* 19 */ EN_RAILGIBUD_ANIM_ARMS_UP_LOOP, +} EnRailgibudAnimation; typedef enum { /* 0 */ EN_RAILGIBUD_TYPE_GIBDO, @@ -95,7 +95,7 @@ const ActorInit En_Railgibud_InitVars = { (ActorFunc)EnRailgibud_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gGibdoRedeadGrabAttackAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &gGibdoRedeadGrabEndAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f }, { &gGibdoRedeadGrabStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, @@ -286,7 +286,7 @@ void EnRailgibud_Destroy(Actor* thisx, PlayState* play) { void EnRailgibud_SetupWalkInCircles(EnRailgibud* this) { this->actor.speedXZ = 0.6f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); this->actionFunc = EnRailgibud_WalkInCircles; } @@ -336,7 +336,7 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupAttemptPlayerFreeze(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_IDLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE); this->actionFunc = EnRailgibud_AttemptPlayerFreeze; } @@ -357,7 +357,7 @@ void EnRailgibud_AttemptPlayerFreeze(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupWalkToPlayer(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); this->actor.speedXZ = 0.4f; if (this->actionFunc == EnRailgibud_AttemptPlayerFreeze) { @@ -418,7 +418,7 @@ void EnRailgibud_WalkToPlayer(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupGrab(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_GRAB_START); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_START); this->grabDamageTimer = 0; this->actor.flags &= ~ACTOR_FLAG_1; this->grabState = EN_RAILGIBUD_GRAB_START; @@ -436,9 +436,9 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { inPositionToAttack = EnRailgibud_MoveToIdealGrabPositionAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (inPositionToAttack == true)) { this->grabState = EN_RAILGIBUD_GRAB_ATTACK; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_GRAB_ATTACK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_ATTACK); } else if (!(player->stateFlags2 & 0x80)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_GRAB_END); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_END); this->actor.flags |= ACTOR_FLAG_1; this->grabState = EN_RAILGIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; @@ -468,7 +468,7 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { player->unk_AE8 = 100; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_GRAB_END); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_GRAB_END); this->actor.flags |= ACTOR_FLAG_1; this->grabState = EN_RAILGIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; @@ -488,7 +488,7 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupGrabFail(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_DAMAGE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DAMAGE); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->actor.speedXZ = -2.0f; this->actionFunc = EnRailgibud_GrabFail; @@ -510,7 +510,7 @@ void EnRailgibud_GrabFail(EnRailgibud* this, PlayState* play) { void EnRailgibud_SetupTurnAwayAndShakeHead(EnRailgibud* this) { this->headShakeTimer = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); this->actionFunc = EnRailgibud_TurnAwayAndShakeHead; } @@ -528,7 +528,7 @@ void EnRailgibud_TurnAwayAndShakeHead(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupWalkToHome(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); this->actor.speedXZ = 0.4f; this->actionFunc = EnRailgibud_WalkToHome; } @@ -561,7 +561,7 @@ void EnRailgibud_WalkToHome(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupDamage(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_DAMAGE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DAMAGE); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->stunTimer = 0; this->grabWaitTimer = 0; @@ -618,7 +618,7 @@ void EnRailgibud_Stunned(EnRailgibud* this, PlayState* play) { } void EnRailgibud_SetupDead(EnRailgibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_DEATH); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_DEATH); this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; @@ -1113,7 +1113,7 @@ void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (gSaveContext.save.entranceIndex != 0x2090) { // NOT Cutscene: Music Box House Opens + if (gSaveContext.save.entrance != ENTRANCE(IKANA_CANYON, 9)) { // NOT Cutscene: Music Box House Opens Actor_MarkForDeath(&this->actor); } @@ -1180,38 +1180,38 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { this->csAction = play->csCtx.actorActions[actionIndex]->action; switch (play->csCtx.actorActions[actionIndex]->action) { case 1: - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_IDLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_IDLE); + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_IDLE; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE); break; case 2: - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_SLUMP_START; + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_WEAKENED2); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_SLUMP_START); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_START); break; case 3: - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_CONVULSION; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_CONVULSION); + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_CONVULSION); break; case 4: - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_ARMS_UP_START; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_ARMS_UP_START); + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_START); break; case 5: - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_WALK; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_WALK); + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_WALK; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK); break; } } else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->cutsceneAnimationIndex == EN_RAILGIBUD_ANIMATION_SLUMP_START) { - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_SLUMP_LOOP; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_SLUMP_LOOP); - } else if (this->cutsceneAnimationIndex == EN_RAILGIBUD_ANIMATION_ARMS_UP_START) { - this->cutsceneAnimationIndex = EN_RAILGIBUD_ANIMATION_ARMS_UP_LOOP; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_RAILGIBUD_ANIMATION_ARMS_UP_LOOP); + if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) { + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_LOOP); + } else if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) { + this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_LOOP); EnRailgibud_SetupSinkIntoGround(this); } } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index 65e8e9736..78655f870 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -33,7 +33,7 @@ typedef struct EnRailgibud { /* 0x3EE */ s16 shouldWalkForwardNextFrame; // Only used by the "main" Gibdo /* 0x3F0 */ union { s16 grabState; - s16 cutsceneAnimationIndex; + s16 cutsceneAnimIndex; }; /* 0x3F2 */ union { s16 playerStunWaitTimer; // Cannot stun the player if this is non-zero diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 207cf7323..1054876aa 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -5,6 +5,8 @@ */ #include "z_en_rat.h" +#include "objects/gameplay_keep/gameplay_keep.h" +#include "overlays/actors/ovl_En_Bom/z_en_bom.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200) @@ -15,7 +17,24 @@ void EnRat_Destroy(Actor* thisx, PlayState* play); void EnRat_Update(Actor* thisx, PlayState* play); void EnRat_Draw(Actor* thisx, PlayState* play); -#if 0 +void EnRat_InitializeAxes(EnRat* this); +void EnRat_UpdateRotation(EnRat* this); +void EnRat_Revive(EnRat* this, PlayState* play); +void EnRat_SetupIdle(EnRat* this); +void EnRat_Idle(EnRat* this, PlayState* play); +void EnRat_SetupSpottedPlayer(EnRat* this); +void EnRat_SpottedPlayer(EnRat* this, PlayState* play); +void EnRat_SetupChasePlayer(EnRat* this); +void EnRat_ChasePlayer(EnRat* this, PlayState* play); +void EnRat_Bounced(EnRat* this, PlayState* play); +void EnRat_Explode(EnRat* this, PlayState* play); +void EnRat_PostDetonation(EnRat* this, PlayState* play); + +typedef enum { + /* -2 */ EN_RAT_HOOK_STARTED = -2, + /* -1 */ EN_RAT_HOOKED, +} EnRatHookedState; + const ActorInit En_Rat_InitVars = { ACTOR_EN_RAT, ACTORCAT_ENEMY, @@ -28,123 +47,920 @@ const ActorInit En_Rat_InitVars = { (ActorFunc)EnRat_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_80A58400 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x08 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderSphereInit sSphereInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_SPHERE, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x08 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_HARD, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 23 }, 100 }, }; -// static DamageTable sDamageTable = { -static DamageTable D_80A5842C = { - /* 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(0, 0xF), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0x0), - /* Ice arrow */ DMG_ENTRY(2, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* 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(1, 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), +typedef enum { + /* 0x0 */ EN_RAT_DMGEFF_NONE, + /* 0x1 */ EN_RAT_DMGEFF_STUN, + /* 0xF */ EN_RAT_DMGEFF_HOOKSHOT = 0xF, // Pulls the Real Bombchu towards the player +} EnRatDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, EN_RAT_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(0, EN_RAT_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, EN_RAT_DMGEFF_NONE), + /* Ice arrow */ DMG_ENTRY(2, EN_RAT_DMGEFF_NONE), + /* Light arrow */ DMG_ENTRY(2, EN_RAT_DMGEFF_NONE), + /* Goron spikes */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, EN_RAT_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, EN_RAT_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_RAT_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, EN_RAT_DMGEFF_NONE), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A5844C = { 1, 30, 30, 50 }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 30, 30, 50 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A58464[] = { +static TexturePtr sSparkTextures[] = { + gElectricSpark1Tex, + gElectricSpark2Tex, + gElectricSpark3Tex, + gElectricSpark4Tex, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, 97, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 5000, ICHAIN_STOP), }; -#endif +static EffectBlureInit2 sBlureInit = { + 0, 0, 0, { 250, 0, 0, 250 }, { 200, 0, 0, 130 }, { 150, 0, 0, 100 }, { 100, 0, 0, 50 }, 16, + 0, 0, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, +}; -extern ColliderSphereInit D_80A58400; -extern DamageTable D_80A5842C; -extern CollisionCheckInfoInit D_80A5844C; -extern InitChainEntry D_80A58464[]; +static s32 sTexturesDesegmented = false; -extern UNK_TYPE D_06000174; -extern UNK_TYPE D_0600026C; +void EnRat_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnRat* this = THIS; + s32 attackRange; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/EnRat_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); + this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/EnRat_Destroy.s") + attackRange = EN_RAT_GET_ATTACK_RANGE(&this->actor); + if (EN_RAT_IS_OVERWORLD_TYPE(&this->actor)) { + this->actor.params = EN_RAT_TYPE_OVERWORLD; + } else { + this->actor.params = EN_RAT_TYPE_DUNGEON; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A563CC.s") + SkelAnime_InitFlex(play, &this->skelAnime, &gRealBombchuSkel, &gRealBombchuRunAnim, this->jointTable, + this->morphTable, REAL_BOMBCHU_LIMB_MAX); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A56444.s") + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { + Effect_Add(play, &this->blure1Index, EFFECT_BLURE2, 0, 0, &sBlureInit); + Effect_Add(play, &this->blure2Index, EFFECT_BLURE2, 0, 0, &sBlureInit); + this->timer = 30; + } else { + this->timer = 150; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A5665C.s") + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + EnRat_InitializeAxes(this); + EnRat_UpdateRotation(this); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A566E0.s") + if ((attackRange == 255) || (attackRange == 0)) { + this->attackRange = 350.0f; + } else if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { + this->attackRange = attackRange * 0.1f * 40.0f; + } else { + this->attackRange = attackRange * 0.5f * 40.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A56994.s") + if (!sTexturesDesegmented) { + for (i = 0; i < ARRAY_COUNT(sSparkTextures); i++) { + sSparkTextures[i] = Lib_SegmentedToVirtual(sSparkTextures[i]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A56AFC.s") + sTexturesDesegmented = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A56EB8.s") + EnRat_SetupIdle(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A56F68.s") +void EnRat_Destroy(Actor* thisx, PlayState* play) { + EnRat* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57010.s") + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { + Effect_Destroy(play, this->blure1Index); + Effect_Destroy(play, this->blure2Index); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57118.s") + Collider_DestroySphere(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57180.s") +void EnRat_InitializeAxes(EnRat* this) { + Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); + Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A5723C.s") + Matrix_MultVecZ(1.0f, &this->axisForwards); + Matrix_MultVecY(1.0f, &this->axisUp); + Matrix_MultVecX(1.0f, &this->axisLeft); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57330.s") +/** + * Returns true if floorPoly is valid for the Real Bombchu to move on, false otherwise. + */ +s32 EnRat_UpdateFloorPoly(EnRat* this, CollisionPoly* floorPoly, PlayState* play) { + Vec3f normal; + Vec3f vec; + f32 angle; + f32 magnitude; + f32 normDotUp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57384.s") + this->actor.floorPoly = floorPoly; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57488.s") + if (floorPoly != NULL) { + normal.x = COLPOLY_GET_NORMAL(floorPoly->normal.x); + normal.y = COLPOLY_GET_NORMAL(floorPoly->normal.y); + normal.z = COLPOLY_GET_NORMAL(floorPoly->normal.z); + } else { + normal.x = 0.0f; + normal.z = 0.0f; + normal.y = 1.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A574E8.s") + normDotUp = DOTXYZ(normal, this->axisUp); + if (fabsf(normDotUp) >= 0.999f) { + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57570.s") + angle = func_80086C48(normDotUp); + if (angle < 0.001f) { + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A575F4.s") + Math3D_CrossProduct(&this->axisUp, &normal, &vec); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A5764C.s") + magnitude = Math3D_Vec3fMagnitude(&vec); + if (magnitude < 0.001f) { + EnRat_Explode(this, play); + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57918.s") + Math_Vec3f_Scale(&vec, 1.0f / magnitude); + Matrix_RotateAxisF(angle, &vec, MTXMODE_NEW); + Matrix_MultVec3f(&this->axisLeft, &vec); + Math_Vec3f_Copy(&this->axisLeft, &vec); + Math3D_CrossProduct(&this->axisLeft, &normal, &this->axisForwards); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57984.s") + magnitude = Math3D_Vec3fMagnitude(&this->axisForwards); + if (magnitude < 0.001f) { + EnRat_Explode(this, play); + return false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57A08.s") + Math_Vec3f_Scale(&this->axisForwards, 1.0f / magnitude); + Math_Vec3f_Copy(&this->axisUp, &normal); + return true; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57A9C.s") +void EnRat_UpdateRotation(EnRat* this) { + MtxF mf; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/EnRat_Update.s") + mf.xx = this->axisLeft.x; + mf.yx = this->axisLeft.y; + mf.zx = this->axisLeft.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57F10.s") + mf.xy = this->axisUp.x; + mf.yy = this->axisUp.y; + mf.zy = this->axisUp.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/func_80A57F4C.s") + mf.xz = this->axisForwards.x; + mf.yz = this->axisForwards.y; + mf.zz = this->axisForwards.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Rat/EnRat_Draw.s") + Matrix_MtxFToYXZRot(&mf, &this->actor.world.rot, false); + this->actor.world.rot.x = -this->actor.world.rot.x; +} + +/** + * Chooses to either look at the player (if the Real Bombchu has spotted the player or + * is chasing after them) or at some other semi-random point (if the Bombchu is idle). + */ +void EnRat_ChooseDirection(EnRat* this) { + Vec3f newAxisForwards; + s16 angle; + + if (this->actionFunc != EnRat_Idle) { + angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (this->axisUp.y < -0.25f) { + angle -= 0x8000; + } + } else { + if (Actor_DistanceToPoint(&this->actor, &this->actor.home.pos) > 50.0f) { + Vec3f homeInHome; + Vec3f worldInHome; + Vec3f worldPlusForwardInHome; + Vec3f upInHome; + + // Set up matrix to unrotate, to make the "home rot" the new basis triad + Matrix_RotateZS(-this->actor.home.rot.z, MTXMODE_NEW); + Matrix_RotateXS(-this->actor.home.rot.x, MTXMODE_APPLY); + Matrix_RotateYS(-this->actor.home.rot.y, MTXMODE_APPLY); + + // Unrotate axisUp into "home rot" triad and store in upfInHome + Matrix_MultVec3f(&this->axisUp, &upInHome); + + // Move world.pos forward by axisForwards and store in homeInHome + Math_Vec3f_Sum(&this->actor.world.pos, &this->axisForwards, &homeInHome); + + // Unrotate homeInHome into "home rot" triad and store in worldPlusForwardInHome + Matrix_MultVec3f(&homeInHome, &worldPlusForwardInHome); + + // Unrotate home into "home rot" triad + Matrix_MultVec3f(&this->actor.home.pos, &homeInHome); + + // Unrotate world into "home rot" triad + Matrix_MultVec3f(&this->actor.world.pos, &worldInHome); + + angle = Math_Vec3f_Yaw(&worldInHome, &homeInHome) - Math_Vec3f_Yaw(&worldInHome, &worldPlusForwardInHome); + if (upInHome.y < -0.25f) { + angle -= 0x8000; + } + + angle += (s16)randPlusMinusPoint5Scaled(0x800); + } else { + angle = (Rand_ZeroOne() < 0.1f) ? (s16)randPlusMinusPoint5Scaled(0x800) : 0; + } + } + + angle = CLAMP(angle, -0x800, 0x800); + Matrix_RotateAxisF(angle * (M_PI / 0x8000), &this->axisUp, MTXMODE_NEW); + Matrix_MultVec3f(&this->axisForwards, &newAxisForwards); + Math_Vec3f_Copy(&this->axisForwards, &newAxisForwards); + Math3D_CrossProduct(&this->axisUp, &this->axisForwards, &this->axisLeft); + this->shouldRotateOntoSurfaces = true; +} + +/** + * Returns true if the Real Bombchu is on a collision poly or is on the water's surface. + */ +s32 EnRat_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** poly, + s32* bgId) { + WaterBox* waterBox; + s32 isOnWater; + f32 waterSurface; + + if (WaterBox_GetSurface1(play, &play->colCtx, posB->x, posB->z, &waterSurface, &waterBox) && + (waterSurface <= posA->y) && (posB->y <= waterSurface)) { + isOnWater = true; + } else { + isOnWater = false; + } + + if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, 1, 1, 1, 1, bgId)) { + if (!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30) && (!isOnWater || (waterSurface <= posResult->y))) { + return true; + } + } + + if (isOnWater) { + posResult->x = posB->x; + posResult->y = waterSurface; + posResult->z = posB->z; + *poly = NULL; + *bgId = BGCHECK_SCENE; + return true; + } + + return false; +} + +s32 EnRat_IsTouchingSurface(EnRat* this, PlayState* play) { + CollisionPoly* polySide = NULL; + CollisionPoly* polyUpDown = NULL; + s32 bgIdSide; + s32 bgIdUpDown; + s32 i; + f32 lineLength; + Vec3f posA; + Vec3f posB; + Vec3f posSide; + Vec3f posUpDown; + + bgIdUpDown = bgIdSide = BGCHECK_SCENE; + + lineLength = 2.0f * this->actor.speedXZ; + + posA.x = this->actor.world.pos.x + (this->axisUp.x * 5.0f); + posA.y = this->actor.world.pos.y + (this->axisUp.y * 5.0f); + posA.z = this->actor.world.pos.z + (this->axisUp.z * 5.0f); + + posB.x = this->actor.world.pos.x - (this->axisUp.x * 4.0f); + posB.y = this->actor.world.pos.y - (this->axisUp.y * 4.0f); + posB.z = this->actor.world.pos.z - (this->axisUp.z * 4.0f); + + if (EnRat_IsOnCollisionPoly(play, &posA, &posB, &posUpDown, &polyUpDown, &bgIdUpDown)) { + posB.x = (this->axisForwards.x * lineLength) + posA.x; + posB.y = (this->axisForwards.y * lineLength) + posA.y; + posB.z = (this->axisForwards.z * lineLength) + posA.z; + + if (EnRat_IsOnCollisionPoly(play, &posA, &posB, &posSide, &polySide, &bgIdSide)) { + if ((polySide != NULL) && this->hasLostTrackOfPlayer) { + return false; + } + + this->shouldRotateOntoSurfaces |= EnRat_UpdateFloorPoly(this, polySide, play); + Math_Vec3f_Copy(&this->actor.world.pos, &posSide); + this->actor.floorBgId = bgIdSide; + this->actor.speedXZ = 0.0f; + } else { + if (polyUpDown != this->actor.floorPoly) { + this->shouldRotateOntoSurfaces |= EnRat_UpdateFloorPoly(this, polyUpDown, play); + } + + Math_Vec3f_Copy(&this->actor.world.pos, &posUpDown); + this->actor.floorBgId = bgIdUpDown; + } + } else { + this->actor.speedXZ = 0.0f; + lineLength *= 3.0f; + Math_Vec3f_Copy(&posA, &posB); + + for (i = 0; i < 3; i++) { + if (i == 0) { + // backwards + posB.x = posA.x - (this->axisForwards.x * lineLength); + posB.y = posA.y - (this->axisForwards.y * lineLength); + posB.z = posA.z - (this->axisForwards.z * lineLength); + } else if (i == 1) { + // left + posB.x = posA.x + (this->axisLeft.x * lineLength); + posB.y = posA.y + (this->axisLeft.y * lineLength); + posB.z = posA.z + (this->axisLeft.z * lineLength); + } else { + // right + posB.x = posA.x - (this->axisLeft.x * lineLength); + posB.y = posA.y - (this->axisLeft.y * lineLength); + posB.z = posA.z - (this->axisLeft.z * lineLength); + } + + if (EnRat_IsOnCollisionPoly(play, &posA, &posB, &posSide, &polySide, &bgIdSide)) { + this->shouldRotateOntoSurfaces |= EnRat_UpdateFloorPoly(this, polySide, play); + Math_Vec3f_Copy(&this->actor.world.pos, &posSide); + this->actor.floorBgId = bgIdSide; + break; + } + } + + if (i == 3) { + // no collision nearby + return false; + } + } + + return true; +} + +/** + * Transform coordinates from actor coordinate space (origin at actor's world.pos, z-axis is facing + * angle, i.e. shape.rot.y) to world space, according to current orientation. + * `offset` is expected to already be at world scale. + */ +void EnRat_ActorCoordsToWorld(EnRat* this, Vec3f* offset, Vec3f* pos) { + f32 x = offset->x + this->visualJitter; + + pos->x = this->actor.world.pos.x + (this->axisLeft.x * x) + (this->axisUp.x * offset->y) + + (this->axisForwards.x * offset->z); + pos->y = this->actor.world.pos.y + (this->axisLeft.y * x) + (this->axisUp.y * offset->y) + + (this->axisForwards.y * offset->z); + pos->z = this->actor.world.pos.z + (this->axisLeft.z * x) + (this->axisUp.z * offset->y) + + (this->axisForwards.z * offset->z); +} + +/** + * This function will spawn splashes and ripples as the Real Bombchu runs across the water's surface. + */ +void EnRat_SpawnWaterEffects(EnRat* this, PlayState* play) { + s32 pad; + Vec3f splashPos; + + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 70, 500, 0); + splashPos.x = this->actor.world.pos.x - (this->axisForwards.x * 10.0f); + splashPos.z = this->actor.world.pos.z - (this->axisForwards.z * 10.0f); + splashPos.y = this->actor.world.pos.y + 5.0f; + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 1, 450); +} + +void EnRat_HandleNonSceneCollision(EnRat* this, PlayState* play) { + s16 yaw = this->actor.shape.rot.y; + f32 sin; + f32 cos; + f32 tempX; + + BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.floorBgId, &this->actor); + + if (yaw != this->actor.shape.rot.y) { + yaw = this->actor.shape.rot.y - yaw; + + sin = Math_SinS(yaw); + cos = Math_CosS(yaw); + + tempX = this->axisForwards.x; + this->axisForwards.x = (sin * this->axisForwards.z) + (cos * tempX); + this->axisForwards.z = (cos * this->axisForwards.z) - (sin * tempX); + + tempX = this->axisUp.x; + this->axisUp.x = (sin * this->axisUp.z) + (cos * tempX); + this->axisUp.z = (cos * this->axisUp.z) - (sin * tempX); + + tempX = this->axisLeft.x; + this->axisLeft.x = (sin * this->axisLeft.z) + (cos * tempX); + this->axisLeft.z = (cos * this->axisLeft.z) - (sin * tempX); + } +} + +static Vec3f sSmokeAccel = { 0.0f, 0.6f, 0.0f }; +static Color_RGBA8 sSmokeColor = { 255, 255, 255, 255 }; + +void EnRat_SpawnSmoke(EnRat* this, PlayState* play) { + func_800B0EB0(play, &this->smokePos, &gZeroVec3f, &sSmokeAccel, &sSmokeColor, &sSmokeColor, 75, 7, 8); +} + +void EnRat_SetupRevive(EnRat* this) { + this->hasLostTrackOfPlayer = false; + this->timer = 200; + this->damageReaction.stunTimer = 0; + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + this->actor.shape.yOffset = 0.0f; + this->actor.shape.rot.x = this->actor.home.rot.x; + this->actor.shape.rot.y = this->actor.home.rot.y; + this->actor.shape.rot.z = this->actor.home.rot.z; + EnRat_InitializeAxes(this); + EnRat_UpdateRotation(this); + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.speedXZ = 0.0f; + Animation_PlayLoopSetSpeed(&this->skelAnime, &gRealBombchuSpotAnim, 0.0f); + this->revivePosY = 2666.6667f; + this->actor.draw = NULL; + this->actor.shape.shadowDraw = NULL; + this->actionFunc = EnRat_Revive; +} + +/** + * Makes the Real Bombchu respawn after a certain amount of time by tunneling up from underground. + * Used only by Overworld-type Bombchu. + */ +void EnRat_Revive(EnRat* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + if (this->timer == 0) { + this->actor.flags |= ACTOR_FLAG_1; + this->actor.draw = EnRat_Draw; + this->skelAnime.playSpeed = 1.0f; + } + } else { + Math_StepToF(&this->revivePosY, 0.0f, 666.6667f); + if (Animation_OnFrame(&this->skelAnime, 2.0f)) { + func_800B1210(play, &this->actor.world.pos, &this->axisUp, &gZeroVec3f, 600, 100); + this->actor.shape.shadowDraw = ActorShadow_DrawCircle; + } + + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + this->actor.flags &= ~ACTOR_FLAG_10; + this->timer = 150; + EnRat_SetupIdle(this); + } + } +} + +void EnRat_SetupIdle(EnRat* this) { + Animation_PlayLoop(&this->skelAnime, &gRealBombchuRunAnim); + this->animLoopCounter = 5; + this->actor.speedXZ = 2.0f; + this->actionFunc = EnRat_Idle; +} + +/** + * Move around randomly near the Bombchu's home until it spots the player. + */ +void EnRat_Idle(EnRat* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + this->actor.speedXZ = 2.0f; + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + if (this->animLoopCounter != 0) { + this->animLoopCounter--; + } + } + + if ((this->animLoopCounter == 0) && (Rand_ZeroOne() < 0.05f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_VOICE); + this->animLoopCounter = 5; + } + + if (!(player->stateFlags3 & PLAYER_STATE3_100) && (this->actor.xzDistToPlayer < this->attackRange) && + (Player_GetMask(play) != PLAYER_MASK_STONE) && Actor_IsFacingPlayer(&this->actor, 0x3800)) { + EnRat_SetupSpottedPlayer(this); + } +} + +void EnRat_SetupSpottedPlayer(EnRat* this) { + this->actor.flags |= ACTOR_FLAG_10; + Animation_MorphToLoop(&this->skelAnime, &gRealBombchuSpotAnim, -5.0f); + this->animLoopCounter = 3; + this->actor.speedXZ = 0.0f; + this->actionFunc = EnRat_SpottedPlayer; +} + +/** + * Play the "spotted" animation a few times, then start chasing the player. + */ +void EnRat_SpottedPlayer(EnRat* this, PlayState* play) { + if ((this->animLoopCounter == 3) && Animation_OnFrame(&this->skelAnime, 5.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_AIM); + } + + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + this->animLoopCounter--; + if (this->animLoopCounter == 0) { + EnRat_SetupChasePlayer(this); + } + } +} + +void EnRat_UpdateSparkOffsets(EnRat* this) { + s32 i; + Vec3f* ptr; + + for (i = 0; i < ARRAY_COUNT(this->sparkOffsets); i++) { + ptr = &this->sparkOffsets[i]; + ptr->x = randPlusMinusPoint5Scaled(6.0f); + ptr->y = randPlusMinusPoint5Scaled(6.0f); + ptr->z = randPlusMinusPoint5Scaled(6.0f); + } +} + +void EnRat_SetupChasePlayer(EnRat* this) { + Animation_MorphToLoop(&this->skelAnime, &gRealBombchuRunAnim, -5.0f); + this->actor.speedXZ = 6.1f; + EnRat_UpdateSparkOffsets(this); + this->actionFunc = EnRat_ChasePlayer; +} + +static Vec3f sBlureP1Offset = { 0.0f, 10.5f, -9.0f }; +static Vec3f sBlureP2LeftOffset = { 18.0f, 0.0f, -7.5f }; +static Vec3f sBlureP2RightOffset = { -18.0f, 0.0f, -7.5f }; +static Vec3f sDustVelocity = { 0.0f, 3.0f, 0.0f }; + +/** + * Run towards the player. If the player puts on the Stone Mask or burrows into a Deku + * Flower, the Real Bombchu will lose track of the player and run in a straight line. + */ +void EnRat_ChasePlayer(EnRat* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f blureP1; + Vec3f blureP2; + + this->actor.speedXZ = 6.1f; + if (this->hasLostTrackOfPlayer) { + if (!(player->stateFlags3 & PLAYER_STATE3_100) && (Player_GetMask(play) != PLAYER_MASK_STONE) && + Actor_IsFacingPlayer(&this->actor, 0x3000)) { + this->hasLostTrackOfPlayer = false; + } + } else if ((player->stateFlags3 & PLAYER_STATE3_100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { + this->hasLostTrackOfPlayer = true; + } + + if (Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->animLoopCounter != 0) { + this->animLoopCounter--; + } + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_WALK); + } + + DECR(this->timer); + + if ((this->timer == 0) && (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON)) { + this->timer = 30; + } + + EnRat_SpawnSmoke(this, play); + this->visualJitter = + (5.0f + (Rand_ZeroOne() * 3.0f)) * Math_SinS(((Rand_ZeroOne() * 0x200) + 0x3000) * this->timer); + + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { + EnRat_ActorCoordsToWorld(this, &sBlureP1Offset, &blureP1); + + EnRat_ActorCoordsToWorld(this, &sBlureP2LeftOffset, &blureP2); + EffectBlure_AddVertex(Effect_GetByIndex(this->blure1Index), &blureP1, &blureP2); + + EnRat_ActorCoordsToWorld(this, &sBlureP2RightOffset, &blureP2); + EffectBlure_AddVertex(Effect_GetByIndex(this->blure2Index), &blureP1, &blureP2); + } else if ((this->actor.floorPoly != NULL) && ((play->gameplayFrames % 4) == 0)) { + func_800B1210(play, &this->actor.world.pos, &sDustVelocity, &gZeroVec3f, 550, 50); + } + + if ((this->actor.floorPoly == NULL) && (Animation_OnFrame(&this->skelAnime, 0.0f))) { + EnRat_SpawnWaterEffects(this, play); + } + + if ((this->animLoopCounter == 0) && (Rand_ZeroOne() < 0.05f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BOMCHU_AIM); + this->animLoopCounter = 5; + } + + func_800B9010(&this->actor, NA_SE_EN_BOMCHU_RUN - SFX_FLAG); + EnRat_UpdateSparkOffsets(this); +} + +void EnRat_SetupBounced(EnRat* this) { + this->actor.speedXZ = 5.0f; + this->actor.velocity.y = 8.0f; + this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; + this->actor.gravity = -1.0f; + EnRat_UpdateSparkOffsets(this); + this->actor.bgCheckFlags &= ~(0x10 | 0x8 | 0x1); + this->actionFunc = EnRat_Bounced; +} + +/** + * Fly backwards until the Real Bombchu touches a wall, ceiling, or floor, then explode. + */ +void EnRat_Bounced(EnRat* this, PlayState* play) { + this->actor.shape.rot.x -= 0x700; + Math_StepToF(&this->actor.shape.yOffset, 1700.0f, 170.0f); + this->timer--; + if (this->timer == 0) { + this->timer = 30; + } + + if (this->actor.bgCheckFlags & (0x10 | 0x8 | 0x1)) { + EnRat_Explode(this, play); + } +} + +void EnRat_Explode(EnRat* this, PlayState* play) { + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + + if (bomb != NULL) { + bomb->timer = 0; + } + + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_OVERWORLD) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x100); + } + + this->actor.speedXZ = 0.0f; + this->actionFunc = EnRat_PostDetonation; +} + +/** + * If the Real Bombchu is an Overworld-type Bombchu, this will set it up to revive. + * Otherwise, it will simply kill the Bombchu. + */ +void EnRat_PostDetonation(EnRat* this, PlayState* play) { + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_OVERWORLD) { + EnRat_SetupRevive(this); + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void EnRat_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnRat* this = THIS; + + this->shouldRotateOntoSurfaces = false; + if (this->damageReaction.stunTimer == 0) { + SkelAnime_Update(&this->skelAnime); + } + + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + this->collider.base.acFlags &= ~AC_HIT; + this->collider.base.ocFlags1 &= ~OC1_HIT; + if (this->collider.base.atFlags & AT_BOUNCED) { + EnRat_SetupBounced(this); + } else { + EnRat_Explode(this, play); + return; + } + } else if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + if (this->actor.colChkInfo.damageEffect == EN_RAT_DMGEFF_HOOKSHOT) { + this->damageReaction.hookedState = EN_RAT_HOOK_STARTED; + } else if (this->actor.colChkInfo.damageEffect == EN_RAT_DMGEFF_STUN) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_COMMON_FREEZE); + Actor_SetColorFilter(&this->actor, 0, 120, 0, 40); + if (this->actionFunc == EnRat_Bounced) { + this->actor.speedXZ = 0.0f; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + } else { + this->damageReaction.stunTimer = 40; + } + } else { + EnRat_Explode(this, play); + return; + } + } else if (((this->collider.base.ocFlags1 & OC1_HIT) && (((this->collider.base.oc->category == ACTORCAT_ENEMY)) || + (this->collider.base.oc->category == ACTORCAT_BOSS) || + (this->collider.base.oc->category == ACTORCAT_PLAYER))) || + ((this->actionFunc == EnRat_ChasePlayer) && (this->timer == 0))) { + this->collider.base.ocFlags1 &= ~OC1_HIT; + EnRat_Explode(this, play); + return; + } + + this->actionFunc(this, play); + + if ((this->actionFunc != EnRat_PostDetonation) && (this->actionFunc != EnRat_Revive)) { + if (this->damageReaction.stunTimer > 0) { + this->damageReaction.stunTimer--; + } else if (this->damageReaction.hookedState < 0) { + if (this->damageReaction.hookedState == EN_RAT_HOOK_STARTED) { + // The player just hit the Real Bombchu with the Hookshot. + this->damageReaction.hookedState = EN_RAT_HOOKED; + } else if ((this->actor.flags & ACTOR_FLAG_2000) != ACTOR_FLAG_2000) { + // The player has hooked the Real Bombchu for more than one frame, but + // the actor flag indicating that the Hookshot is attached is *not* set. + EnRat_Explode(this, play); + return; + } + } else if (this->actionFunc != EnRat_Bounced) { + if (this->actor.floorBgId != BGCHECK_SCENE) { + EnRat_HandleNonSceneCollision(this, play); + } + + if (!this->hasLostTrackOfPlayer) { + EnRat_ChooseDirection(this); + } + + if ((this->actionFunc != EnRat_SpottedPlayer) && !EnRat_IsTouchingSurface(this, play)) { + EnRat_Explode(this, play); + return; + } + + if (this->shouldRotateOntoSurfaces) { + EnRat_UpdateRotation(this); + this->actor.shape.rot.x = -this->actor.world.rot.x; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.shape.rot.z = this->actor.world.rot.z; + } + + Actor_MoveWithoutGravity(&this->actor); + this->actor.floorHeight = this->actor.world.pos.y; + } else { + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 30.0f, 60.0f, 7); + } + + if (SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + EnRat_Explode(this, play); + return; + } + + this->collider.dim.worldSphere.center.x = this->actor.world.pos.x + (this->axisUp.x * 10.0f); + this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + (this->axisUp.y * 10.0f); + this->collider.dim.worldSphere.center.z = this->actor.world.pos.z + (this->axisUp.z * 10.0f); + + if (this->actionFunc != EnRat_Revive) { + if (this->damageReaction.stunTimer == 0) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + + Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.015f); + } +} + +s32 EnRat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnRat* this = THIS; + + if (limbIndex == REAL_BOMBCHU_LIMB_BODY) { + pos->y -= this->revivePosY; + } + + if (limbIndex == REAL_BOMBCHU_LIMB_TAIL_END) { + *dList = NULL; + } + + return false; +} + +void EnRat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + PlayState* play = play2; + EnRat* this = THIS; + MtxF* currentMatrixState; + Vec3f* ptr; + f32 redModifier; + + if (limbIndex == REAL_BOMBCHU_LIMB_TAIL_END) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_MultZero(&this->smokePos); + this->smokePos.y += 15.0f; + currentMatrixState = Matrix_GetCurrent(); + + if (this->actionFunc == EnRat_ChasePlayer) { + s32 i; + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); + Matrix_Scale(45.0f, 45.0f, 45.0f, MTXMODE_APPLY); + + for (i = 0; i < ARRAY_COUNT(this->sparkOffsets); i++) { + ptr = &this->sparkOffsets[i]; + currentMatrixState->mf[3][0] = this->smokePos.x + ptr->x; + currentMatrixState->mf[3][1] = this->smokePos.y + ptr->y; + currentMatrixState->mf[3][2] = this->smokePos.z + ptr->z; + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_XLU_DISP++, 0x08, sSparkTextures[(play->gameplayFrames + i) & 3]); + gSPDisplayList(POLY_XLU_DISP++, gEffSparkDL); + } + + Matrix_Scale(1.0f / 45.0f, 1.0f / 45.0f, 1.0f / 45.0f, MTXMODE_APPLY); + currentMatrixState->mf[3][0] = this->smokePos.x; + currentMatrixState->mf[3][1] = this->smokePos.y - 15.0f; + currentMatrixState->mf[3][2] = this->smokePos.z; + } + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); + if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { + redModifier = fabsf(cos_rad(this->timer * (M_PI / 30.f))); + } else { + if (this->timer >= 120) { + redModifier = fabsf(cos_rad((this->timer % 30) * (M_PI / 30.0f))); + } else if (this->timer >= 30) { + redModifier = fabsf(cos_rad((this->timer % 6) * (M_PI / 6.0f))); + } else { + redModifier = fabsf(cos_rad((this->timer % 3) * (M_PI / 3.0f))); + } + } + + gDPSetEnvColor(POLY_OPA_DISP++, (s32)((1.0f - redModifier) * 255.0f), 0, 40, 255); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, (s32)((1.0f - redModifier) * 255.0f), 0, 40, 255); + Matrix_RotateZYX(0x4000, 0, 0, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gBombBodyDL); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +void EnRat_Draw(Actor* thisx, PlayState* play) { + EnRat* this = THIS; + + func_8012C28C(play->state.gfxCtx); + func_8012C974(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRat_OverrideLimbDraw, EnRat_PostLimbDraw, &this->actor); +} diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.h b/src/overlays/actors/ovl_En_Rat/z_en_rat.h index c3ad7eedc..6dd51d10a 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.h +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.h @@ -2,12 +2,57 @@ #define Z_EN_RAT_H #include "global.h" +#include "objects/object_rat/object_rat.h" + +#define EN_RAT_IS_OVERWORLD_TYPE(thisx) ((thisx)->params & 0x8000) +#define EN_RAT_GET_TYPE(thisx) ((thisx)->params) +#define EN_RAT_GET_ATTACK_RANGE(thisx) ((thisx)->params & 0xFF) + +/** + * There are many differences between the two types of Real Bombchu: + * - Dungeon-type don't respawn, while Overworld-type do. + * - Dungeon-type leave a blure trail behind them as they chase the player, + * while Overworld-type spawn dust around themselves instead. + * - Dungeon-type won't detonate automatically, while Overworld-type will + * detonate after 150 frames of chasing the player. + * - So long as EN_RAT_GET_ATTACK_RANGE returns something other than 0 or 255, + * Dungeon-type have 1/5th of the attack range compared to Overworld-type. + * - Dungeon-type do not drop items upon defeat, while Overworld-type do. + */ +typedef enum { + /* 0 */ EN_RAT_TYPE_DUNGEON, + /* 1 */ EN_RAT_TYPE_OVERWORLD, +} EnRatType; struct EnRat; +typedef void (*EnRatActionFunc)(struct EnRat*, PlayState*); + typedef struct EnRat { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x17C]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ EnRatActionFunc actionFunc; + /* 0x18C */ u8 hasLostTrackOfPlayer; + /* 0x18D */ u8 shouldRotateOntoSurfaces; + /* 0x18E */ s16 animLoopCounter; + /* 0x190 */ s16 timer; // Used for both exploding and reviving + /* 0x192 */ union { + s16 stunTimer; + s16 hookedState; + } damageReaction; + /* 0x194 */ Vec3s jointTable[REAL_BOMBCHU_LIMB_MAX]; + /* 0x1D0 */ Vec3s morphTable[REAL_BOMBCHU_LIMB_MAX]; + /* 0x20C */ Vec3f axisForwards; + /* 0x218 */ Vec3f axisUp; + /* 0x224 */ Vec3f axisLeft; + /* 0x230 */ Vec3f smokePos; + /* 0x23C */ Vec3f sparkOffsets[2]; + /* 0x254 */ f32 visualJitter; + /* 0x258 */ f32 attackRange; + /* 0x25C */ f32 revivePosY; + /* 0x260 */ s32 blure1Index; + /* 0x264 */ s32 blure2Index; + /* 0x268 */ ColliderSphere collider; } EnRat; // size = 0x2C0 extern const ActorInit En_Rat_InitVars; diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 2415993b1..896947fa6 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -724,7 +724,7 @@ void func_80BF4FC4(EnRg* this, PlayState* play) { void EnRg_Init(Actor* thisx, PlayState* play) { EnRg* this = THIS; - if (gSaveContext.save.entranceIndex == 0xD010) { + if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, GORON_LIMB_MAX); diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c index dd25ce9b9..d7a4f9170 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c @@ -30,10 +30,10 @@ const ActorInit En_Rsn_InitVars = { (ActorFunc)EnRsn_Draw, }; -static AnimationInfo sAnimations[] = { { &gBombShopkeeperSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f } }; +static AnimationInfo sAnimationInfo[] = { { &gBombShopkeeperSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f } }; void func_80C25D40(EnRsn* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80C25D84; } diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index 00637ba25..ccc11a002 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -4,18 +4,96 @@ * Description: Goron in Goron Shrine / Bomb Shop Goron */ +/* +This actor appears to be used in three scenes. +-- Goron Shrine: Winter + Three variants (one instance of each used in game). + Main behavior determined by whether the Goron Elder's Son is asleep, and whether they themselves have been put to +sleep. One of them also has a dialogue tree that checks whether you have lit the chandelier (at least if the kid is not +crying) +-- Goron Shrine: Spring + Six variants - one instance of each appearing in a circle around the elder on the upper level of the shrine if +you've beaten Goht during that cycle. Dialogue determined by whether you have talked to elder in that context as a goron +at least once during that cycle. They have a cheering animation used while the elder is talking to you, otherwise they +stand idle. +-- Bomb Shop + Only one variant. Goron who sells you powder kegs in the bomb shop. +*/ + +/* +Week Event Flags: + 22 Bit 2 -- Goron Elder's Son has been pacified (Winter) + 77 Bit 7 -- You have spoken to the Goron Elder in goron form during spring + + 36 All Bits + 37 Bits 0 - 2 + Track whether or not you have ever spoken to each of the three winter shrine gorons + in various forms. ("Ever" being since last time reset, of course) +*/ + #include "z_en_s_goro.h" +#include "overlays/actors/ovl_En_Gk/z_en_gk.h" // Goron Elder's Son +#include "overlays/actors/ovl_En_Jg/z_en_jg.h" // Goron Elder +#include "objects/object_taisou/object_taisou.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) - #define THIS ((EnSGoro*)thisx) +#define EN_S_GORO_ROLLEDUP_YOFFSET 14.0f +#define EN_S_GORO_OFTYPE_WSHRINE (EN_S_GORO_GET_MAIN_TYPE(&this->actor) < 3) + +#define EN_S_GORO_ACTIONFLAG_ROLLEDUP (1 << 0) +#define EN_S_GORO_ACTIONFLAG_FACEPLAYER (1 << 1) +#define EN_S_GORO_ACTIONFLAG_EYESOPEN (1 << 2) +#define EN_S_GORO_ACTIONFLAG_EARSCOVERED (1 << 3) +#define EN_S_GORO_ACTIONFLAG_ENGAGED (1 << 4) +#define EN_S_GORO_ACTIONFLAG_LASTMESSAGE (1 << 5) +#define EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED (1 << 6) +#define EN_S_GORO_ACTIONFLAG_SNOREPHASE (1 << 7) +#define EN_S_GORO_ACTIONFLAG_UNK0100 (1 << 8) +#define EN_S_GORO_ACTIONFLAG_HANDTAP (1 << 9) +#define EN_S_GORO_ACTIONFLAG_TIRED (1 << 10) +#define EN_S_GORO_ACTIONFLAG_SUPPRESS_SNORE (1 << 11) + +#define EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN (1 << 0) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_GORONPK (1 << 1) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU (1 << 2) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA (1 << 3) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN_FINALNIGHT (1 << 4) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_GOROKPK_FINALNIGHT (1 << 5) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU_FINALNIGHT (1 << 6) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA_FINALNIGHT (1 << 7) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_GORON (1 << 8) +#define EN_S_GORO_BOMBBUYFLAG_TALKED_GORON_FINALNIGHT (1 << 9) +#define EN_S_GORO_BOMBBUYFLAG_YESBUY (1 << 10) + void EnSGoro_Init(Actor* thisx, PlayState* play); void EnSGoro_Destroy(Actor* thisx, PlayState* play); void EnSGoro_Update(Actor* thisx, PlayState* play); void EnSGoro_Draw(Actor* thisx, PlayState* play); -#if 0 +typedef enum EnSGoroEyeTexture { + /* 0x0 */ EN_S_GORO_EYETEX_OPEN, + /* 0x1 */ EN_S_GORO_EYETEX_HALF, + /* 0x2 */ EN_S_GORO_EYETEX_CLOSED, + /* 0x3 */ EN_S_GORO_EYETEX_CLOSED2 +} EnSGoroEyeTexture; + +typedef enum EnSGoroAnimation { + /* 0x0 */ EN_S_GORO_ANIM_IDLE_LIEDOWN_A, + /* 0x1 */ EN_S_GORO_ANIM_IDLE_LIEDOWN_B, + /* 0x2 */ EN_S_GORO_ANIM_UNROLL_A, + /* 0x3 */ EN_S_GORO_ANIM_UNROLL_B, + /* 0x4 */ EN_S_GORO_ANIM_ROLLUP, + /* 0x5 */ EN_S_GORO_ANIM_SHIVER_A, + /* 0x6 */ EN_S_GORO_ANIM_SHIVER_B, + /* 0xB */ EN_S_GORO_ANIM_COVEREARS = 11, + /* 0xC */ EN_S_GORO_ANIM_TAISOU_CHEER, + /* 0xD */ EN_S_GORO_ANIM_STAND_HANDTAP, + /* 0xE */ EN_S_GORO_ANIM_SLEEPY, + /* 0xF */ EN_S_GORO_ANIM_IDLE_STAND +} EnSGoroAnimation; + const ActorInit En_S_Goro_InitVars = { ACTOR_EN_S_GORO, ACTORCAT_NPC, @@ -28,18 +106,29 @@ const ActorInit En_S_Goro_InitVars = { (ActorFunc)EnSGoro_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BBF820 = { - { COLTYPE_HIT1, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT1, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON, + BUMP_ON, + OCELEM_ON, + }, { 0, 0, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80BBF84C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_80BBF858 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -74,85 +163,1314 @@ static DamageTable D_80BBF858 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -#endif +static AnimationInfoS sAnimationInfo[] = { + { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_taisou_Anim_004DD4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_taisou_Anim_00283C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_taisou_Anim_007764, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_taisou_Anim_005790, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_taisou_Anim_002C48, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gGoronStandingHandTappingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gGoronSleepyAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -8 }, +}; -extern ColliderCylinderInit D_80BBF820; -extern CollisionCheckInfoInit2 D_80BBF84C; -extern DamageTable D_80BBF858; +static TexturePtr sEyeTextures[] = { + gGoronEyeOpenTex, + gGoronEyeHalfTex, + gGoronEyeClosedTex, + gGoronEyeClosed2Tex, +}; -extern UNK_TYPE D_060091A8; -extern UNK_TYPE D_06012DE0; +u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play); +u16 EnSGoro_BombshopGoron_NextTextId(EnSGoro* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBCA80.s") +s32 EnSGoro_FindGoronElder(EnSGoro* this, PlayState* play); +s32 EnSGoro_FindGoronChild(EnSGoro* this, PlayState* play); +s32 EnSGoro_CheckLullaby(EnSGoro* this, PlayState* play); +s32 EnSGoro_CheckGKBehavior(EnSGoro* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBD348.s") +void EnSGoro_SetupAction(EnSGoro* this, PlayState* play); +void EnSGoro_WinterShrineGoron_Idle(EnSGoro* this, PlayState* play); +void EnSGoro_WinterShrineGoron_Talk(EnSGoro* this, PlayState* play); +void EnSGoro_SpringShrineGoron_Idle(EnSGoro* this, PlayState* play); +void EnSGoro_SpringShrineGoron_Talk(EnSGoro* this, PlayState* play); +void EnSGoro_ShopGoron_Idle(EnSGoro* this, PlayState* play); +void EnSGoro_ShopGoron_FinishUnroll(EnSGoro* this, PlayState* play); +void EnSGoro_ShopGoron_Talk(EnSGoro* this, PlayState* play); +void EnSGoro_ShopGoron_TakePayment(EnSGoro* this, PlayState* play); +void EnSGoro_ShopGoron_FinishTransaction(EnSGoro* this, PlayState* play); +void EnSGoro_Sleep(EnSGoro* this, PlayState* play); +void EnSGoro_SleepTalk(EnSGoro* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBD8F0.s") +s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play); +s32 EnSGoro_UpdateRotationToPlayer(EnSGoro* this, PlayState* play); +s32 EnSGoro_UpdateAttentionTarget(EnSGoro* this, PlayState* play); +void EnSGoro_UpdateToHandtapAnimation(EnSGoro* this); +void EnSGoro_UpdateSleepyAnimation(EnSGoro* this); +void EnSGoro_UpdateToIdleAnimation(EnSGoro* this); +void EnSGoro_UpdateEyes(EnSGoro* this); +void EnSGoro_UpdateActorFocus(EnSGoro* this); +void EnSGoro_UpdateSleeping(EnSGoro* this, PlayState* play); +void EnSGoro_UpdateCollider(EnSGoro* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBD93C.s") +s32 EnSGoro_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRot, s32 overrideRot); +s32 EnSGoro_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +void EnSGoro_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx); +void EnSGoro_DrawUnrolled(EnSGoro* this, PlayState* play); +void EnSGoro_DrawRolledUp(EnSGoro* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBD98C.s") +/** + * Dialogue tree for EnSGoro when use in Goron Shrine context. Returns ID of next message to display. + */ +u16 EnSGoro_ShrineGoron_NextTextId(EnSGoro* this, PlayState* play) { + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDACC.s") + switch (EN_S_GORO_GET_MAIN_TYPE(&this->actor)) { + case EN_S_GORO_TYPE_SHRINE_WINTER_A: + if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[36] & 2)) { + switch (this->textId) { + case 0xCFB: + return 0xCFC; + case 0xCFC: + return 0xCFD; + case 0xCFD: + gSaveContext.save.weekEventReg[36] |= 2; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xCFE; + default: + return 0xCFB; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xCFE; + } + } else { + if (!(gSaveContext.save.weekEventReg[36] & 1)) { + gSaveContext.save.weekEventReg[36] |= 1; + return 0xCF9; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xCFA; + } + } else { + // Scene flag - Checks whether the chandelier has been lit + if (!Flags_GetSwitch(play, EN_S_GORO_SCENEFLAG_INDEX(&this->actor))) { + if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[36] & 8)) { + if (this->textId == 0xD02) { + gSaveContext.save.weekEventReg[36] |= 8; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD03; + } + return 0xD02; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD04; + } + if (!(gSaveContext.save.weekEventReg[36] & 4)) { + if (this->textId == 0xCFF) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + gSaveContext.save.weekEventReg[36] |= 4; + return 0xD00; + } + return 0xCFF; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD01; + } + if (!(gSaveContext.save.weekEventReg[36] & 0x10)) { + if (this->textId == 0xD05) { + gSaveContext.save.weekEventReg[36] |= 0x10; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD06; + } + return 0xD05; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD07; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDC34.s") + case EN_S_GORO_TYPE_SHRINE_WINTER_B: + if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[36] & 0x40)) { + switch (this->textId) { + case 0xD15: + return 0xD16; + case 0xD16: + gSaveContext.save.weekEventReg[36] |= 0x40; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD17; + default: + return 0xD15; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD17; + } + } else { + if (!(gSaveContext.save.weekEventReg[36] & 0x20)) { + gSaveContext.save.weekEventReg[36] |= 0x20; + return 0xD13; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD14; + } + } else if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[37] & 1)) { + switch (this->textId) { + case 0xD1E: + return 0xD1F; + case 0xD1F: + gSaveContext.save.weekEventReg[37] |= 1; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD20; + default: + return 0xD1E; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD21; + } + } else { + if (!(gSaveContext.save.weekEventReg[36] & 0x80)) { + switch (this->textId) { + case 0xD18: + return 0xD19; + case 0xD19: + return 0xD1A; + case 0xD1A: + return 0xD1B; + case 0xD1B: + gSaveContext.save.weekEventReg[36] |= 0x80; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD1C; + default: + return 0xD18; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD1D; + } + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDCFC.s") + case EN_S_GORO_TYPE_SHRINE_WINTER_C: + if (!(gSaveContext.save.weekEventReg[22] & 4)) { + if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[37] & 2)) { + switch (this->textId) { + case 0xD09: + return 0xD0A; + case 0xD0A: + return 0xD0B; + case 0xD0B: + gSaveContext.save.weekEventReg[37] |= 2; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD0C; + default: + return 0xD09; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD0D; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD08; + } + } else if (player->transformation == PLAYER_FORM_GORON) { + if (!(gSaveContext.save.weekEventReg[37] & 4)) { + switch (this->textId) { + case 0xD0E: + return 0xD0F; + case 0xD0F: + gSaveContext.save.weekEventReg[37] |= 4; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD10; + default: + return 0xD0E; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD11; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xD12; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDDF8.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_A: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (this->textId == 0xDE3) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE4; + } + return 0xDE3; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE2; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDE78.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_B: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (this->textId == 0xDE7) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE8; + } + return 0xDE7; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE6; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE5; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDF28.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_C: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (this->textId == 0xDEB) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDEC; + } + return 0xDEB; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDEA; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDE9; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBDFA8.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_D: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (this->textId == 0xDF1) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF2; + } + return 0xDF1; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF0; + } + switch (this->textId) { + case 0xDED: + return 0xDEE; + case 0xDEE: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDEF; + default: + return 0xDED; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE05C.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_E: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + if (this->textId == 0xDF6) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF7; + } + return 0xDF6; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF5; + } + if (this->textId == 0xDF3) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF4; + } + return 0xDF3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE0E4.s") + case EN_S_GORO_TYPE_SHRINE_SPRING_F: + if (player->transformation == PLAYER_FORM_GORON) { + if (gSaveContext.save.weekEventReg[77] & 0x80) { + switch (this->textId) { + case 0xDFB: + return 0xDFC; + case 0xDFC: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDFD; + default: + return 0xDFB; + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDFA; + } + } else { + if (this->textId == 0xDF8) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0xDF9; + } + return 0xDF8; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE144.s") + default: + return 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE374.s") +/** + * Dialogue tree for bomb shop goron. Returns ID of next message to display. + */ +u16 EnSGoro_BombshopGoron_NextTextId(EnSGoro* this, PlayState* play) { + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE498.s") + switch (this->textId) { + case 0x0: + switch (player->transformation) { + case PLAYER_FORM_GORON: + // Check if Powder Keg is in Powder Key slot. + if (INV_CONTENT(ITEM_POWDER_KEG) == ITEM_POWDER_KEG) { + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_GOROKPK_FINALNIGHT)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_GOROKPK_FINALNIGHT; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x677; + } + return 0x67A; + } + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_GORONPK)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_GORONPK; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x66E; + } + return 0x679; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE73C.s") + // No powder keg + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_GORON_FINALNIGHT)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_GORON_FINALNIGHT; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x67E; + } + return 0x683; + } + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_GORON)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_GORON; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x67B; + } + return 0x681; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE844.s") + case PLAYER_FORM_ZORA: + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA_FINALNIGHT)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA_FINALNIGHT; + return 0x668; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; + return 0x66D; + } + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_ZORA; + return 0x664; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; + return 0x66C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE904.s") + case PLAYER_FORM_DEKU: + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU_FINALNIGHT)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU_FINALNIGHT; + return 0x668; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x66D; + } + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_DEKU; + return 0x664; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x66C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBE9F8.s") + case PLAYER_FORM_HUMAN: + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN_FINALNIGHT)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN_FINALNIGHT; + return 0x668; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x66D; + } + if (!(this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN)) { + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_TALKED_HUMAN; + return 0x664; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x66C; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBEAD8.s") + case 0x664: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x665; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBEBF8.s") + case 0x665: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x666; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBECBC.s") + case 0x666: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; + return 0x667; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBEEB4.s") + case 0x668: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x669; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBEF34.s") + case 0x669: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x66A; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBEFA0.s") + case 0x66A: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; + return 0x66B; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF01C.s") + case 0x677: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x678; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/EnSGoro_Init.s") + case 0x678: + return 0x670; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/EnSGoro_Destroy.s") + case 0x66E: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x66F; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/EnSGoro_Update.s") + case 0x66F: + return 0x670; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF298.s") + case 0x679: + return 0x670; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF3D0.s") + case 0x67A: + return 0x670; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF3EC.s") + case 0x67E: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x67F; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF5F0.s") + case 0x67F: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x680; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/func_80BBF6BC.s") + case 0x67B: + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_HANDTAP; + return 0x67C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_S_Goro/EnSGoro_Draw.s") + case 0x67C: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x67D; + + case 0x681: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x682; + + case 0x683: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x684; + + case 0x670: + if (this->bombbuyFlags & EN_S_GORO_BOMBBUYFLAG_YESBUY) { + if (AMMO(ITEM_POWDER_KEG) != 0) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + play_sound(NA_SE_SY_ERROR); + return 0x673; + } + this->powderKegPrice = play->msgCtx.unk1206C; + if (gSaveContext.save.playerData.rupees < this->powderKegPrice) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; + play_sound(NA_SE_SY_ERROR); + return 0x674; + } + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + func_8019F208(); + return 0x676; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + func_8019F208(); + return 0x675; + } + if ((gSaveContext.save.day == 3) && gSaveContext.save.isNight) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x672; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + return 0x671; + } + return 0; +} + +/** + * Links to actor of type EN_JG (Goron Elder), returns whether operation successful. + */ +s32 EnSGoro_FindGoronElder(EnSGoro* this, PlayState* play) { + this->otherGoron = SubS_FindActor(play, this->otherGoron, ACTORCAT_NPC, ACTOR_EN_JG); + if (this->otherGoron != NULL) { + return true; + } + return false; +} + +/** + * Links to actor of type EN_GK (Goron Elder's Son), returns whether operation successful. + */ +s32 EnSGoro_FindGoronChild(EnSGoro* this, PlayState* play) { + this->otherGoron = NULL; + this->otherGoron = SubS_FindActor(play, this->otherGoron, ACTORCAT_NPC, ACTOR_EN_GK); + if (this->otherGoron != NULL) { + return true; + } + return false; +} + +/** + * Looks like it manages the snoring cycle for when rolled up and asleep. + */ +void EnSGoro_UpdateSleeping(EnSGoro* this, PlayState* play) { + s16 curFrame = this->skelAnime.curFrame; + + this->snorePhase += 0x400; + this->scaleFactor = Math_SinS(this->snorePhase) * 0.01f * 0.1f; + this->actor.scale.y = 0.01f - this->scaleFactor; + this->actor.scale.z = 0.01f - this->scaleFactor; + this->actor.scale.x = 0.01f + this->scaleFactor; + + if (!(this->actionFlags & EN_S_GORO_ACTIONFLAG_SUPPRESS_SNORE)) { + if (this->snorePhase == 0) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_SNOREPHASE) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_SNOREPHASE; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE2); + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_SNOREPHASE; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_GOLON_SNORE1); + } + } + } else if (gSaveContext.save.weekEventReg[22] & 4) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_SUPPRESS_SNORE; + } + + if (!(this->actionFlags & EN_S_GORO_ACTIONFLAG_ROLLEDUP) && (curFrame == 0)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_ROLLEDUP; + this->actor.shape.yOffset = EN_S_GORO_ROLLEDUP_YOFFSET; + } + + this->actor.shape.yOffset = (this->actor.scale.y / 0.01f) * EN_S_GORO_ROLLEDUP_YOFFSET; +} + +s32 EnSGoro_UpdateCheerAnimation(EnSGoro* this, PlayState* play) { + if (this->animInfoIndex == EN_S_GORO_ANIM_IDLE_STAND) { + if (((EnJg*)this->otherGoron)->flags & 1) { + this->loadedObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); + if (this->loadedObjIndex >= 0) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + this->animInfoIndex = EN_S_GORO_ANIM_TAISOU_CHEER; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + return true; + } + } + } else if ((this->animInfoIndex == EN_S_GORO_ANIM_TAISOU_CHEER) && !(((EnJg*)this->otherGoron)->flags & 1)) { + this->loadedObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); + if (this->loadedObjIndex >= 0) { + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + this->skelAnime.curFrame = this->skelAnime.endFrame; + return true; + } + } + return false; +} + +s32 EnSGoro_CheckLullaby(EnSGoro* this, PlayState* play) { + s32 actorType; + Player* player = GET_PLAYER(play); + + if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3)) { + if (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) { + this->animInfoIndex = EN_S_GORO_ANIM_ROLLUP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + + actorType = EN_S_GORO_GET_MAIN_TYPE(&this->actor); + this->snorePhase = 0x400 << (actorType + 1); + + /* + * Should be: + * if ((actorType % 2) == 0) + * However, the original code checks the negative case whereas the above does not. + * So unfortunately, this is the only way to get it to match. + */ + if (!(actorType % 2)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_SNOREPHASE; + } + this->actionFunc = EnSGoro_Sleep; + return true; + } + } + return false; +} + +s32 EnSGoro_CheckGKBehavior(EnSGoro* this, PlayState* play) { + s32 actorType; + + if (!EnSGoro_FindGoronChild(this, play)) { + return false; + } + if ((!(this->actionFlags & EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED)) && + ((((EnGk*)this->otherGoron)->unk_1E4 & 0x80) || (gSaveContext.save.weekEventReg[22] & 4))) { + + this->actionFlags |= EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED; + this->animInfoIndex = EN_S_GORO_ANIM_ROLLUP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + + actorType = EN_S_GORO_GET_MAIN_TYPE(&this->actor); + this->snorePhase = 0x400 << (actorType + 1); + + /* + * Should be: + * if ((actorType % 2) == 0) + * However, the original code checks the negative case whereas the above does not. + * So unfortunately, this is the only way to get it to match. + */ + if (!(actorType % 2)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_SNOREPHASE; + } + this->actionFlags |= EN_S_GORO_ACTIONFLAG_SUPPRESS_SNORE; + this->actionFunc = EnSGoro_Sleep; + return true; + } + return false; +} + +void EnSGoro_UpdateToHandtapAnimation(EnSGoro* this) { + s16 curFrame = this->skelAnime.curFrame; + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animInfoIndex].animation); + + if ((this->animInfoIndex != EN_S_GORO_ANIM_STAND_HANDTAP) && (curFrame == lastFrame)) { + this->animInfoIndex = EN_S_GORO_ANIM_STAND_HANDTAP; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } +} + +void EnSGoro_UpdateSleepyAnimation(EnSGoro* this) { + s16 curFrame = this->skelAnime.curFrame; + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animInfoIndex].animation); + + if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { + if (curFrame == lastFrame) { + this->animInfoIndex = EN_S_GORO_ANIM_SLEEPY; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } + } else if (curFrame == lastFrame) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_TIRED; + this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } +} + +void EnSGoro_UpdateToIdleAnimation(EnSGoro* this) { + s16 curFrame = this->skelAnime.curFrame; + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animInfoIndex].animation); + + if ((this->animInfoIndex != EN_S_GORO_ANIM_IDLE_STAND) && (curFrame == lastFrame)) { + this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } +} + +void EnSGoro_UpdateCollider(EnSGoro* this, PlayState* play) { + Vec3f world_pos = this->actor.world.pos; + f32 radius = 24.0f; + f32 height = 62.0f; + + this->collider.dim.pos.x = world_pos.x; + this->collider.dim.pos.y = world_pos.y; + this->collider.dim.pos.z = world_pos.z; + this->collider.dim.radius = radius; + this->collider.dim.height = height; + + //! @bug: It is not clear what this is for. + if ((s32)this != -0x190) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } +} + +void EnSGoro_UpdateEyes(EnSGoro* this) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_EYESOPEN) { + if (DECR(this->eyeTimer) == 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex > EN_S_GORO_EYETEX_CLOSED) { + this->eyeTimer = Rand_S16Offset(30, 30); + this->eyeTexIndex = EN_S_GORO_EYETEX_OPEN; + } + } + } +} + +void EnSGoro_UpdateActorFocus(EnSGoro* this) { + f32 yDelta; + + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_ROLLEDUP) { + yDelta = this->actor.shape.yOffset; + } else { + yDelta = 58.0f; + } + + this->actor.focus.pos.x = this->actor.world.pos.x; + this->actor.focus.pos.y = this->actor.world.pos.y + yDelta; + this->actor.focus.pos.z = this->actor.world.pos.z; + this->actor.focus.rot.x = this->actor.world.rot.x; + this->actor.focus.rot.y = this->actor.world.rot.y; + this->actor.focus.rot.z = this->actor.world.rot.z; +} + +s32 EnSGoro_UpdateRotationToPlayer(EnSGoro* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f playerPos; + Vec3f thisPos; + s16 target = (this->actor.yawTowardsPlayer - this->bodyRotY) - this->actor.shape.rot.y; + + Math_SmoothStepToS(&this->headRotY, target, 4, 0x2AA8, 1); + this->headRotY = CLAMP(this->headRotY, -0x1FFE, 0x1FFE); + + target = (this->actor.yawTowardsPlayer - this->headRotY) - this->actor.shape.rot.y; + Math_SmoothStepToS(&this->bodyRotY, target, 4, 0x2AA8, 1); + this->bodyRotY = CLAMP(this->bodyRotY, -0x1C70, 0x1C70); + + playerPos = player->actor.world.pos; + playerPos.y = player->bodyPartsPos[7].y + 3.0f; + thisPos = this->actor.world.pos; + thisPos.y += 70.0f; + + target = Math_Vec3f_Pitch(&thisPos, &playerPos) - this->bodyRotZ; + Math_SmoothStepToS(&this->headRotZ, target, 4, 0x2AA8, 1); + this->headRotZ = CLAMP(this->headRotZ, -0x1C70, 0x1C70); + + target = Math_Vec3f_Pitch(&thisPos, &playerPos) - this->headRotZ; + Math_SmoothStepToS(&this->bodyRotZ, target, 4, 0x2AA8, 1); + this->bodyRotZ = CLAMP(this->bodyRotZ, -0x1C70, 0x1C70); + + return true; +} + +s32 EnSGoro_UpdateAttentionTarget(EnSGoro* this, PlayState* play) { + if (DECR(this->loseAttentionTimer) != 0) { + // EnSGoro is in the process of returning to idle position from previously looking at the player. + if ((this->actionFlags & EN_S_GORO_ACTIONFLAG_EARSCOVERED) && + (this->actionFlags & EN_S_GORO_ACTIONFLAG_EYESOPEN)) { + // If ears are covered, but eyes are open, close eyes. + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_EYESOPEN; + this->eyeTexIndex = EN_S_GORO_EYETEX_CLOSED2; + } + // Reset position to idle. EnSGoro cannot return attention to player until the timer is up. + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_FACEPLAYER; + this->headRotZ = 0; + this->headRotY = 0; + this->bodyRotZ = 0; + this->bodyRotY = 0; + return true; + } + + // Turn to face player if either player has engaged EnSGoro or if player is in range and EnSGoro isn't covering his + // ears. + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_ENGAGED) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_FACEPLAYER; + EnSGoro_UpdateRotationToPlayer(this, play); + } else if (!(this->actionFlags & EN_S_GORO_ACTIONFLAG_EARSCOVERED) && + Actor_IsFacingAndNearPlayer(&this->actor, 120.0f, 0x3FFC)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_FACEPLAYER; + EnSGoro_UpdateRotationToPlayer(this, play); + } else { + // Unengaged or player out of range. + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) { + // Previously facing player, but now player out of range. + // Start counter for frames/function calls to ignore player while in process of returning to idle. + this->loseAttentionTimer = 20; + } + // Start animation to return to idle position. + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_FACEPLAYER; + this->headRotZ = 0; + this->headRotY = 0; + this->bodyRotZ = 0; + this->bodyRotY = 0; + } + return true; +} + +void EnSGoro_SetupAction(EnSGoro* this, PlayState* play) { + if (Object_IsLoaded(&play->objectCtx, this->loadedObjIndex)) { + this->actionFlags = 0; + if (EN_S_GORO_OFTYPE_WSHRINE) { + if (gSaveContext.save.weekEventReg[22] & 4) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_GKQUIET_ACKNOWLEDGED; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_EYESOPEN; + this->animInfoIndex = EN_S_GORO_ANIM_SHIVER_A; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } else { + this->eyeTexIndex = EN_S_GORO_EYETEX_CLOSED2; + this->actionFlags |= EN_S_GORO_ACTIONFLAG_EARSCOVERED; + this->animInfoIndex = EN_S_GORO_ANIM_COVEREARS; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } + } else { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_EYESOPEN; + this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + } + + this->scaleFactor = 0.01f; + Actor_SetScale(&this->actor, 0.01f); + this->actor.gravity = -1.0f; + this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_2000000; + this->actor.targetMode = 1; + + switch (EN_S_GORO_GET_MAIN_TYPE(&this->actor)) { + case EN_S_GORO_TYPE_SHRINE_WINTER_A: + this->actionFunc = EnSGoro_WinterShrineGoron_Idle; + break; + case EN_S_GORO_TYPE_SHRINE_WINTER_B: + this->actionFunc = EnSGoro_WinterShrineGoron_Idle; + break; + case EN_S_GORO_TYPE_SHRINE_WINTER_C: + this->actionFunc = EnSGoro_WinterShrineGoron_Idle; + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_A: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_B: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_C: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_D: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_E: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_SHRINE_SPRING_F: + if (EnSGoro_FindGoronElder(this, play)) { + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + } + break; + case EN_S_GORO_TYPE_BOMBSHOP: + this->actionFlags |= EN_S_GORO_ACTIONFLAG_ROLLEDUP; + this->actionFunc = EnSGoro_ShopGoron_Idle; + this->actor.shape.yOffset = EN_S_GORO_ROLLEDUP_YOFFSET; + break; + default: + Actor_MarkForDeath(&this->actor); + break; + } + } +} + +void EnSGoro_WinterShrineGoron_Idle(EnSGoro* this, PlayState* play) { + if (!EnSGoro_CheckLullaby(this, play) && !EnSGoro_CheckGKBehavior(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_ENGAGED; + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_EARSCOVERED) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_EYESOPEN; + this->eyeTexIndex = EN_S_GORO_EYETEX_OPEN; + } + this->textId = EnSGoro_ShrineGoron_NextTextId(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + this->actionFunc = EnSGoro_WinterShrineGoron_Talk; + } else if ((this->actor.xzDistToPlayer < 250.0f) || this->actor.isTargeted) { + func_800B863C(&this->actor, play); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; + } +} + +void EnSGoro_WinterShrineGoron_Talk(EnSGoro* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && (Message_ShouldAdvance(play))) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_LASTMESSAGE) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_ENGAGED; + this->actionFunc = EnSGoro_WinterShrineGoron_Idle; + return; + } + this->textId = EnSGoro_ShrineGoron_NextTextId(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; +} + +void EnSGoro_SpringShrineGoron_Idle(EnSGoro* this, PlayState* play) { + if ((EN_S_GORO_GET_MAIN_TYPE(&this->actor) == EN_S_GORO_TYPE_SHRINE_SPRING_F) || + !EnSGoro_UpdateCheerAnimation(this, play)) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_ENGAGED; + this->textId = EnSGoro_ShrineGoron_NextTextId(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + this->actionFunc = EnSGoro_SpringShrineGoron_Talk; + } else if ((this->actor.xzDistToPlayer < 250.0f) || (this->actor.isTargeted)) { + func_800B863C(&this->actor, play); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; + } +} + +void EnSGoro_SpringShrineGoron_Talk(EnSGoro* this, PlayState* play) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_LASTMESSAGE) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_ENGAGED; + play->msgCtx.msgMode = 0x43; + play->msgCtx.stateTimer = 4; + this->actionFunc = EnSGoro_SpringShrineGoron_Idle; + return; + } + this->textId = EnSGoro_ShrineGoron_NextTextId(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; +} + +void EnSGoro_ShopGoron_Idle(EnSGoro* this, PlayState* play) { + if (!(this->actionFlags & EN_S_GORO_ACTIONFLAG_ROLLEDUP)) { + EnSGoro_UpdateToIdleAnimation(this); + } + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + this->actionFlags |= EN_S_GORO_ACTIONFLAG_ENGAGED; + this->textId = EnSGoro_BombshopGoron_NextTextId(this, play); + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_ROLLEDUP) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_ROLLEDUP; + this->animInfoIndex = EN_S_GORO_ANIM_UNROLL_A; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + this->actionFunc = EnSGoro_ShopGoron_FinishUnroll; + } else { + Message_StartTextbox(play, this->textId, &this->actor); + this->actionFunc = EnSGoro_ShopGoron_Talk; + } + } else if ((this->actor.xzDistToPlayer < 250.0f) || this->actor.isTargeted) { + func_800B863C(&this->actor, play); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; +} + +void EnSGoro_ShopGoron_FinishUnroll(EnSGoro* this, PlayState* play) { + s16 curFrame = this->skelAnime.curFrame; + s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animInfoIndex].animation); + + if ((this->animInfoIndex == EN_S_GORO_ANIM_UNROLL_A) && (curFrame == lastFrame)) { + this->animInfoIndex = EN_S_GORO_ANIM_IDLE_STAND; + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animInfoIndex); + Message_StartTextbox(play, this->textId, &this->actor); + this->actionFunc = EnSGoro_ShopGoron_Talk; + } + + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; +} + +void EnSGoro_ShopGoron_Talk(EnSGoro* this, PlayState* play) { + u8 talkState = Message_GetState(&play->msgCtx); + + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_HANDTAP) { + EnSGoro_UpdateToHandtapAnimation(this); + } else if (this->actionFlags & EN_S_GORO_ACTIONFLAG_TIRED) { + EnSGoro_UpdateSleepyAnimation(this); + } else { + EnSGoro_UpdateToIdleAnimation(this); + } + + if (talkState == TEXT_STATE_DONE) { + if (Message_ShouldAdvance(play)) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_LASTMESSAGE) { + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_LASTMESSAGE; + this->actionFlags &= ~EN_S_GORO_ACTIONFLAG_ENGAGED; + this->textId = 0; + this->actionFunc = EnSGoro_ShopGoron_Idle; + return; + } + this->textId = EnSGoro_BombshopGoron_NextTextId(this, play); + Message_StartTextbox(play, this->textId, &this->actor); + } + } else if ((talkState == TEXT_STATE_CHOICE) && (Message_ShouldAdvance(play))) { + switch (play->msgCtx.choiceIndex) { + case 0: + this->bombbuyFlags |= EN_S_GORO_BOMBBUYFLAG_YESBUY; + break; + case 1: + func_8019F230(); + this->bombbuyFlags &= ~EN_S_GORO_BOMBBUYFLAG_YESBUY; + break; + } + + this->textId = EnSGoro_BombshopGoron_NextTextId(this, play); + if ((this->textId == 0x675) || (this->textId == 0x676)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.stateTimer = 4; + Actor_PickUp(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); + this->actionFunc = EnSGoro_ShopGoron_TakePayment; + } else { + Message_StartTextbox(play, this->textId, &this->actor); + } + } + + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; +} + +void EnSGoro_ShopGoron_TakePayment(EnSGoro* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { + this->actor.parent = NULL; + Rupees_ChangeBy(-this->powderKegPrice); + this->actionFunc = EnSGoro_ShopGoron_FinishTransaction; + } else { + Actor_PickUp(&this->actor, play, GI_POWDER_KEG, 300.0f, 300.0f); + } +} + +void EnSGoro_ShopGoron_FinishTransaction(EnSGoro* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, this->textId, &this->actor); + this->actionFunc = EnSGoro_ShopGoron_Talk; + } else { + func_800B85E0(&this->actor, play, 400.0f, -1); + } +} + +void EnSGoro_Sleep(EnSGoro* this, PlayState* play) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + Message_StartTextbox(play, 0x23A, &this->actor); + this->actionFunc = EnSGoro_SleepTalk; + } else if (this->actor.isTargeted) { + func_800B863C(&this->actor, play); + } + EnSGoro_UpdateSleeping(this, play); +} + +void EnSGoro_SleepTalk(EnSGoro* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) { + if (Message_ShouldAdvance(play)) { + play->msgCtx.msgMode = 0x43; + play->msgCtx.stateTimer = 4; + this->actionFunc = EnSGoro_Sleep; + } + } + EnSGoro_UpdateSleeping(this, play); +} + +void EnSGoro_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnSGoro* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, &gGoronUnrollAnim, this->jointTable, this->morphTable, + GORON_LIMB_MAX); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + if (this->actor.update != NULL) { + s32 objIndex = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP); + + this->loadedObjIndex = objIndex; + if (objIndex < 0) { + Actor_MarkForDeath(&this->actor); + } + } + this->actor.draw = EnSGoro_Draw; + this->actionFunc = EnSGoro_SetupAction; +} + +void EnSGoro_Destroy(Actor* thisx, PlayState* play) { + EnSGoro* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void EnSGoro_Update(Actor* thisx, PlayState* play) { + EnSGoro* this = (EnSGoro*)thisx; + + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); + gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->loadedObjIndex].segment); + SkelAnime_Update(&this->skelAnime); + if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { + EnSGoro_UpdateAttentionTarget(this, play); + } + EnSGoro_UpdateEyes(this); + EnSGoro_UpdateActorFocus(this); + EnSGoro_UpdateCollider(this, play); +} + +/** + * This function appears to be identical to SubS_UpdateLimb. But it's here! + */ +s32 EnSGoro_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRot, s32 overrideRot) { + Vec3f newPos; + Vec3f zeroVec = gZeroVec3f; + Vec3s newRot; + MtxF curState; + + Matrix_MultVec3f(&zeroVec, &newPos); + Matrix_Get(&curState); + Matrix_MtxFToYXZRot(&curState, &newRot, MTXMODE_NEW); + + *pos = newPos; + + if (!stepRot && !overrideRot) { + rot->x = newRot.x; + rot->y = newRot.y; + rot->z = newRot.z; + return true; + } + + if (overrideRot) { + newRot.z = newRotZ; + newRot.y = newRotY; + } + + Math_SmoothStepToS(&rot->x, newRot.x, 3, 0x2AA8, 0xB6); + Math_SmoothStepToS(&rot->y, newRot.y, 3, 0x2AA8, 0xB6); + Math_SmoothStepToS(&rot->z, newRot.z, 3, 0x2AA8, 0xB6); + return true; +} + +s32 EnSGoro_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + return false; +} + +void EnSGoro_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { + s32 stepRot; + s32 overrideRot; + EnSGoro* this = THIS; + + if (limbIndex != GORON_LIMB_BODY) { + if ((limbIndex == GORON_LIMB_HEAD) && (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY)) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) { + overrideRot = true; + } else { + overrideRot = false; + } + if (this->loseAttentionTimer != 0) { + stepRot = true; + } else { + stepRot = false; + } + + EnSGoro_UpdateLimb(this->headRotZ + this->bodyRotZ + 0x4000, + this->headRotY + this->bodyRotY + this->actor.shape.rot.y + 0x4000, &this->headTranslate, + &this->headRotate, stepRot, overrideRot); + + Matrix_Pop(); + Matrix_Translate(this->headTranslate.x, this->headTranslate.y, this->headTranslate.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->headRotate.y, MTXMODE_APPLY); + Matrix_RotateXS(this->headRotate.x, MTXMODE_APPLY); + Matrix_RotateZS(this->headRotate.z, MTXMODE_APPLY); + Matrix_Push(); + } + } else if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) { + overrideRot = true; + } else { + overrideRot = false; + } + if (this->loseAttentionTimer != 0) { + stepRot = true; + } else { + stepRot = false; + } + + EnSGoro_UpdateLimb(this->bodyRotZ + 0x4000, this->bodyRotY + this->actor.shape.rot.y + 0x4000, + &this->bodyTranslate, &this->bodyRotate, stepRot, overrideRot); + + Matrix_Pop(); + Matrix_Translate(this->bodyTranslate.x, this->bodyTranslate.y, this->bodyTranslate.z, MTXMODE_NEW); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + Matrix_RotateYS(this->bodyRotate.y, MTXMODE_APPLY); + Matrix_RotateXS(this->bodyRotate.x, MTXMODE_APPLY); + Matrix_RotateZS(this->bodyRotate.z, MTXMODE_APPLY); + Matrix_Push(); + } +} + +void EnSGoro_DrawUnrolled(EnSGoro* this, PlayState* play) { + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x8, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex])); + gDPPipeSync(POLY_OPA_DISP++); + + SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + this->skelAnime.dListCount, EnSGoro_OverrideLimbDraw, NULL, + EnSGoro_TransformLimbDraw, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnSGoro_DrawRolledUp(EnSGoro* this, PlayState* play) { + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + this->actor.shape.yOffset, + this->actor.world.pos.z, MTXMODE_NEW); + Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); + Matrix_Translate(0.0f, -this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY); + Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_Translate(0.0f, this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY); + Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gGoronRolledUpDL); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EnSGoro_Draw(Actor* thisx, PlayState* play) { + EnSGoro* this = (EnSGoro*)thisx; + + if (this->actionFlags & EN_S_GORO_ACTIONFLAG_ROLLEDUP) { + EnSGoro_DrawRolledUp(this, play); + } else { + EnSGoro_DrawUnrolled(this, play); + } +} diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h index 7d8e7627f..0d7ac9edb 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.h @@ -2,20 +2,59 @@ #define Z_EN_S_GORO_H #include "global.h" +#include "objects/object_oF1d_map/object_oF1d_map.h" -#define EN_S_GORO_GET_PARAM_F(thisx) ((thisx)->params & 0xF) +#define EN_S_GORO_GET_MAIN_TYPE(thisx) ((thisx)->params & 0xF) +#define EN_S_GORO_SCENEFLAG_INDEX(thisx) (((thisx)->params & 0x7F0) >> 4) struct EnSGoro; typedef void (*EnSGoroActionFunc)(struct EnSGoro*, PlayState*); -typedef struct EnSGoro { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x48]; - /* 0x18C */ EnSGoroActionFunc actionFunc; - /* 0x190 */ char unk_190[0x180]; -} EnSGoro; // size = 0x310 - extern const ActorInit En_S_Goro_InitVars; +typedef struct EnSGoro { + /* 0x000 */ Actor actor; + /* 0x144 */ Actor* otherGoron; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ EnSGoroActionFunc actionFunc; + /* 0x190 */ ColliderCylinder collider; + /* 0x1DC */ u16 actionFlags; + /* 0x1DE */ u16 bombbuyFlags; + /* 0x1E0 */ UNK_TYPE1 unk_1E0[0xC]; + /* 0x1EC */ s16 eyeTexIndex; + /* 0x1EE */ s16 eyeTimer; + /* 0x1F0 */ s16 loseAttentionTimer; + /* 0x1F4 */ s32 loadedObjIndex; + /* 0x1F8 */ Vec3s jointTable[GORON_LIMB_MAX]; + /* 0x264 */ Vec3s morphTable[GORON_LIMB_MAX]; + /* 0x2D0 */ f32 scaleFactor; + /* 0x2D4 */ s16 headRotZ; + /* 0x2D6 */ s16 headRotY; + /* 0x2D8 */ s16 bodyRotZ; + /* 0x2DA */ s16 bodyRotY; + /* 0x2DC */ Vec3f headTranslate; + /* 0x2E8 */ Vec3s headRotate; + /* 0x2F0 */ Vec3f bodyTranslate; + /* 0x2FC */ Vec3s bodyRotate; + /* 0x302 */ UNK_TYPE1 unk_302[2]; + /* 0x304 */ u16 textId; + /* 0x306 */ s16 snorePhase; + /* 0x308 */ s32 animInfoIndex; + /* 0x30C */ s16 powderKegPrice; +} EnSGoro; // size = 0x310 + +typedef enum EnSGoroType { + /* 0x0 */ EN_S_GORO_TYPE_SHRINE_WINTER_A, + /* 0x1 */ EN_S_GORO_TYPE_SHRINE_WINTER_B, + /* 0x2 */ EN_S_GORO_TYPE_SHRINE_WINTER_C, + /* 0x3 */ EN_S_GORO_TYPE_SHRINE_SPRING_A, + /* 0x4 */ EN_S_GORO_TYPE_SHRINE_SPRING_B, + /* 0x5 */ EN_S_GORO_TYPE_SHRINE_SPRING_C, + /* 0x6 */ EN_S_GORO_TYPE_SHRINE_SPRING_D, + /* 0x7 */ EN_S_GORO_TYPE_SHRINE_SPRING_E, + /* 0x8 */ EN_S_GORO_TYPE_SHRINE_SPRING_F, + /* 0x9 */ EN_S_GORO_TYPE_BOMBSHOP +} EnSGoroType; + #endif // Z_EN_S_GORO_H diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index b7a417531..fce03f2b8 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -214,11 +214,12 @@ f32 func_80BCD4D0(Path* path, s32 count, Vec3f* arg2, Vec3s* arg3) { } void func_80BCD590(EnScopecrow* this, PlayState* play) { - Vec3f sp1C; + Vec3f screenPos; - func_80169474(play, &this->actor.world.pos, &sp1C); + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); - if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f) && (sp1C.y < 150.0f)) { + if ((screenPos.x >= 130.0f) && (screenPos.x < (SCREEN_WIDTH - 130.0f)) && (screenPos.y >= 90.0f) && + (screenPos.y < (SCREEN_HEIGHT - 90.0f))) { this->actor.draw = EnScopecrow_Draw; this->actionFunc = func_80BCD640; } 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 2954bc041..2553962f9 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -64,7 +64,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 27, 32, 0, { 0, 0, 0 } }, }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dnt_Anim_005488, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_00B0B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_004AA0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -190,14 +190,14 @@ s16 func_80BCAF0C(EnScopenuts* this) { } void func_80BCAFA8(EnScopenuts* this, PlayState* play) { - Vec3f sp1C; + Vec3f screenPos; - func_80169474(play, &this->actor.world.pos, &sp1C); - if ((sp1C.x >= 130.0f) && (sp1C.x < 190.0f) && (sp1C.y >= 90.0f)) { - if (sp1C.y < 150.0f) { + Play_GetScreenPos(play, &this->actor.world.pos, &screenPos); + if ((screenPos.x >= 130.0f) && (screenPos.x < (SCREEN_WIDTH - 130.0f)) && (screenPos.y >= 90.0f)) { + if (screenPos.y < (SCREEN_HEIGHT - 90.0f)) { this->actor.draw = EnScopenuts_Draw; this->unk_348 = 10; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 10); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 10); this->actionFunc = func_80BCB078; } } @@ -246,7 +246,7 @@ void func_80BCB1C8(EnScopenuts* this, PlayState* play) { void func_80BCB230(EnScopenuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 sp24 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); + s16 sp24 = Animation_GetLastFrame(sAnimationInfo[this->unk_348].animation); Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); @@ -257,30 +257,30 @@ void func_80BCB230(EnScopenuts* this, PlayState* play) { this->unk_348 = 3; this->collider.dim.height = 64; func_80BCAC40(this, play); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); } else if (sp26 == sp24) { if ((this->unk_348 == 4) || (this->unk_348 == 18)) { this->unk_348 = 17; this->collider.dim.height = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 17); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_348 == 2) { this->unk_348 = 16; this->collider.dim.height = 32; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 16); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_348 == 17) { if (DECR(this->unk_34E) == 0) { this->unk_34E = Rand_ZeroOne() * 10.0f; this->unk_348 = 2; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 2); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 2); } } else if ((this->unk_348 == 16) && (DECR(this->unk_34E) == 0)) { this->unk_34E = Rand_S16Offset(40, 40); this->unk_348 = 18; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 18); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 18); } } } @@ -288,7 +288,7 @@ void func_80BCB230(EnScopenuts* this, PlayState* play) { void func_80BCB4DC(EnScopenuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80BCB52C; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); } } @@ -306,7 +306,7 @@ void func_80BCB52C(EnScopenuts* this, PlayState* play) { } else if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_348 = 4; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80BCB230; } } @@ -323,7 +323,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_328 &= ~4; this->unk_348 = 8; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 8); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 8); this->actionFunc = func_80BCBA00; } else { this->unk_33C = func_80BCAF0C(this); @@ -388,7 +388,7 @@ void func_80BCB980(EnScopenuts* this, PlayState* play) { void func_80BCBA00(EnScopenuts* this, PlayState* play) { s16 sp26 = this->skelAnime.curFrame; - s16 sp24 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); + s16 sp24 = Animation_GetLastFrame(sAnimationInfo[this->unk_348].animation); switch (sp26) { case 10: @@ -463,7 +463,7 @@ void func_80BCBA00(EnScopenuts* this, PlayState* play) { if (sp26 == sp24) { this->unk_35A = 3; this->unk_348 = 19; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 19); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 19); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_328 &= ~2; this->unk_34E = 50; @@ -498,7 +498,7 @@ void func_80BCBC60(EnScopenuts* this, PlayState* play) { void func_80BCBD28(EnScopenuts* this, PlayState* play) { Vec3f sp44; s16 sp42 = this->skelAnime.curFrame; - s16 sp40 = Animation_GetLastFrame(sAnimations[this->unk_348].animation); + s16 sp40 = Animation_GetLastFrame(sAnimationInfo[this->unk_348].animation); Vec3s sp38; func_80BCC448(this->path, this->unk_334, &this->actor.world.pos, &sp38); @@ -527,7 +527,7 @@ void func_80BCBD28(EnScopenuts* this, PlayState* play) { if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { this->unk_368 = 0.3f; this->unk_348 = 9; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 9); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 9); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); func_80BCAC40(this, play); this->actionFunc = func_80BCBF0C; @@ -547,7 +547,7 @@ void func_80BCBF0C(EnScopenuts* this, PlayState* play) { if ((this->actor.home.pos.y + 50.0f) < this->actor.world.pos.y) { Math_ApproachF(&this->actor.velocity.y, 0.0f, 0.2f, 1.0f); this->unk_348 = 10; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 10); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 10); this->unk_328 |= 2; this->unk_36E = 0; this->actionFunc = func_80BCBFFC; @@ -728,7 +728,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { this->unk_358 = 150; this->unk_348 = 4; this->unk_35A = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80BCB230; } } else { 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 aacfa5685..d4a726887 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -80,7 +80,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 27, 32, 0, { 0, 0, 0 } }, }; -static AnimationInfoS D_80ADD990[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_dnt_Anim_005488, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_00B0B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_dnt_Anim_004AA0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, @@ -235,25 +235,25 @@ f32 func_80ADB08C(PlayState* play) { void func_80ADB0D8(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if (currentFrame == frameCount) { switch (this->unk_340) { case 0x611: case 0x62A: this->unk_34C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80ADBFA0; break; case 0x618: if (this->unk_34C == 1) { this->unk_34C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80ADB544; } else { this->unk_34C = 1; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 1); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80ADBFA0; } break; @@ -264,7 +264,7 @@ void func_80ADB0D8(EnSellnuts* this, PlayState* play) { case 0x614: case 0x628: this->unk_34C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); this->actionFunc = func_80ADB924; break; @@ -273,14 +273,14 @@ void func_80ADB0D8(EnSellnuts* this, PlayState* play) { case 0x616: case 0x629: this->unk_34C = 1; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 1); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80ADB924; break; case 0x613: case 0x619: this->unk_34C = 7; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 7); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 7); this->actionFunc = func_80ADBD64; break; } @@ -289,7 +289,7 @@ void func_80ADB0D8(EnSellnuts* this, PlayState* play) { void func_80ADB254(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); if (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f) ? true : false) && @@ -298,31 +298,31 @@ void func_80ADB254(EnSellnuts* this, PlayState* play) { this->actionFunc = func_80ADB4F4; this->unk_34C = 3; this->collider.dim.height = 64; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); } else if (currentFrame == frameCount) { if ((this->unk_34C == 4) || (this->unk_34C == 18)) { this->unk_34C = 17; this->collider.dim.height = 0; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 17); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_34C == 2) { this->unk_34C = 16; this->collider.dim.height = 32; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 16); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 16); } else if (this->unk_34C == 17) { if (DECR(this->unk_34E) == 0) { this->unk_34E = Rand_ZeroOne() * 10.0f; this->unk_34C = 2; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 2); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 2); } } else if (this->unk_34C == 16) { if (DECR(this->unk_34E) == 0) { this->unk_34E = Rand_S16Offset(40, 40); this->unk_34C = 18; this->collider.dim.height = 32; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 18); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 18); } } } @@ -331,7 +331,7 @@ void func_80ADB254(EnSellnuts* this, PlayState* play) { void func_80ADB4F4(EnSellnuts* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->actionFunc = func_80ADB544; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); } } @@ -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_MOON_TEAR) { + if (Player_GetExchangeItemId(play) == PLAYER_AP_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_MOON_TEAR); + func_800B85E0(&this->actor, play, 80.0f, PLAYER_AP_MOON_TEAR); if (player->transformation == PLAYER_FORM_DEKU) { if (gSaveContext.save.day == 3) { this->unk_33A = 2; @@ -409,7 +409,7 @@ void func_80ADB544(EnSellnuts* this, PlayState* play) { if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_34C = 4; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80ADB254; } } @@ -421,8 +421,8 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { if (talkState == TEXT_STATE_16) { item = func_80123810(play); - if (item > EXCH_ITEM_NONE) { - if (item == EXCH_ITEM_MOON_TEAR) { + if (item > PLAYER_AP_NONE) { + if (item == PLAYER_AP_MOON_TEAR) { player->actor.textId = D_80ADD928[this->unk_33A]; this->unk_340 = player->actor.textId; player->exchangeItemId = item; @@ -433,7 +433,7 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { this->actionFunc = func_80ADB0D8; } func_801477B4(play); - } else if (item < EXCH_ITEM_NONE) { + } else if (item < PLAYER_AP_NONE) { this->unk_340 = D_80ADD920[this->unk_33A]; func_80151938(play, this->unk_340); this->actionFunc = func_80ADB0D8; @@ -454,18 +454,18 @@ void func_80ADB924(EnSellnuts* this, PlayState* play) { void func_80ADBAB8(EnSellnuts* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if (this->unk_368 == 0x28) { this->unk_34C = 5; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 5); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 5); } this->unk_368++; if ((currentFrame == frameCount) && (this->unk_34C == 5)) { this->unk_34C = 6; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 6); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 6); } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -491,14 +491,14 @@ void func_80ADBC60(EnSellnuts* this, PlayState* play) { Message_StartTextbox(play, this->unk_340, &this->actor); this->actionFunc = func_80ADB0D8; } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; } } void func_80ADBCE4(EnSellnuts* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); this->unk_340 = D_80ADD930[this->unk_33A]; this->actionFunc = func_80ADBC60; } @@ -507,11 +507,11 @@ void func_80ADBCE4(EnSellnuts* this, PlayState* play) { void func_80ADBD64(EnSellnuts* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if ((currentFrame == frameCount) && (this->unk_34C == 7)) { this->unk_34C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -520,14 +520,14 @@ void func_80ADBD64(EnSellnuts* this, PlayState* play) { this->unk_338 &= ~2; this->actor.flags &= ~ACTOR_FLAG_1; this->unk_34C = 8; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 8); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 8); this->actionFunc = func_80ADBE80; } } void func_80ADBE80(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); func_80ADAE64(this); if (this->unk_366 == 0) { @@ -546,7 +546,7 @@ void func_80ADBE80(EnSellnuts* this, PlayState* play) { if (currentFrame == frameCount) { this->unk_350 = 4; this->unk_34C = 19; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 19); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 19); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); this->unk_338 &= ~1; this->unk_338 |= 8; @@ -580,7 +580,7 @@ void func_80ADC034(EnSellnuts* this, PlayState* play) { if ((this->actor.home.pos.y + 200.0f) < this->actor.world.pos.y) { Math_ApproachF(&this->actor.velocity.y, 0.0f, 0.2f, 1.0f); this->unk_34C = 10; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 10); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 10); this->unk_368 = 0; this->actionFunc = func_80ADC37C; } @@ -589,7 +589,7 @@ void func_80ADC034(EnSellnuts* this, PlayState* play) { void func_80ADC118(EnSellnuts* this, PlayState* play) { Vec3f sp34; s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if (currentFrame == frameCount) { Math_SmoothStepToS(&this->unk_364, 0x1C71, 3, 0x100, 0); @@ -615,7 +615,7 @@ void func_80ADC118(EnSellnuts* this, PlayState* play) { if ((this->actor.home.pos.y + 22.5f) < this->actor.world.pos.y) { this->unk_34C = 9; this->unk_360 = 0.3f; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 9); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 9); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80ADC034; } @@ -793,7 +793,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { this->actor.gravity = -1.0f; this->actor.velocity.y = -1.0f; this->actor.speedXZ = 0.0f; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->unk_338 &= ~1; this->unk_338 &= ~2; this->actionFunc = func_80ADCA64; @@ -808,7 +808,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { void func_80ADCA64(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if (this->unk_34C == 22) { Math_SmoothStepToS(&this->unk_364, 0, 3, 0x100, 0); @@ -821,7 +821,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { this->unk_350 = 4; this->unk_34C = 19; this->actor.velocity.y = 0.0f; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN); } return; @@ -832,7 +832,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { if (this->unk_34C == 19) { this->unk_34C = 17; this->collider.dim.height = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, 17); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_34C == 17) { ActorCutscene_Stop(this->cutscene); gSaveContext.save.weekEventReg[73] |= 4; @@ -843,7 +843,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { void func_80ADCC04(EnSellnuts* this, PlayState* play) { s16 currentFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->unk_34C].animation); if (this->unk_34C == 3) { if (currentFrame == frameCount) { @@ -852,7 +852,7 @@ void func_80ADCC04(EnSellnuts* this, PlayState* play) { this->unk_354 = 1.0f; this->unk_358 = 1.0f; this->unk_35C = 1.0f; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); } } else if (this->unk_34C == 21) { func_80ADAFC0(this); @@ -863,7 +863,7 @@ void func_80ADCC04(EnSellnuts* this, PlayState* play) { } this->unk_340 = 0x626; this->unk_34C = 0; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADC5A4; } } @@ -884,7 +884,7 @@ void func_80ADCD3C(EnSellnuts* this, PlayState* play) { this->unk_34C = 3; this->unk_350 = 4; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADCC04; } else if (D_80ADD940 != 0) { this->collider.dim.height = 64; @@ -989,7 +989,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; this->unk_34A = 50; this->unk_34C = 4; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADB254; return; } @@ -1007,7 +1007,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->unk_358 = 1.0f; this->unk_354 = 1.0f; this->unk_360 = 1.0f; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADC5A4; } else { this->unk_338 |= 2; @@ -1018,7 +1018,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { this->unk_34C = 4; this->unk_34E = 20; this->collider.dim.height = 64; - SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80ADD990, this->unk_34C); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_34C); this->actionFunc = func_80ADCD3C; } } 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 817648daa..93b75e96b 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -6,6 +6,7 @@ */ #include "z_en_shn.h" +#include "z64snap.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,7 +16,7 @@ void EnShn_Init(Actor* thisx, PlayState* play); void EnShn_Destroy(Actor* thisx, PlayState* play); 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); // Could be something related to text/dialogue? @@ -62,30 +63,27 @@ const ActorInit En_Shn_InitVars = { (ActorFunc)EnShn_Draw, }; -static AnimationInfoS sAnimations[] = { - { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, 0 }, - { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, -4 }, - { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, 0 }, - { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, -4 }, -}; - -static s32 D_80AE7258[] = { 0, 2, 3, 8, 10, 1 }; - void func_80AE6130(EnShn* this) { this->skelAnime.playSpeed = this->playSpeed; SkelAnime_Update(&this->skelAnime); } -s32 func_80AE615C(EnShn* this, s32 arg1) { +s32 func_80AE615C(EnShn* this, s32 animIndex) { + static AnimationInfoS sAnimationInfo[] = { + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, 0 }, + { &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, -4 }, + { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, 0 }, + { &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, -4 }, + }; s32 phi_v0 = 0; s32 phi_v1 = 0; - if (arg1 != this->unk_2E8) { + if (animIndex != this->unk_2E8) { phi_v0 = 1; } if (phi_v0 != 0) { - this->unk_2E8 = arg1; - phi_v1 = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, arg1); + this->unk_2E8 = animIndex; + phi_v1 = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->playSpeed = this->skelAnime.playSpeed; } return phi_v1; @@ -103,7 +101,7 @@ s32 EnShn_IsFacingPlayer(EnShn* this) { } if (phi_v1 == 0) { this->unk_2EC ^= 1; - this->unk_2C8 = Rand_S16Offset(0x1E, 0x1E); + this->unk_2C8 = Rand_S16Offset(30, 30); } if (this->unk_2EC != 0) { range = 120.0f; @@ -228,6 +226,10 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { } s32 func_80AE6704(Actor* thisx, PlayState* play) { + static s32 sPictographFlags[] = { + PICTOGRAPH_0, PICTOGRAPH_MONKEY, PICTOGRAPH_BIG_OCTO, + PICTOGRAPH_TINGLE, PICTOGRAPH_DEKU_KING, PICTOGRAPH_IN_SWAMP, + }; EnShn* this = THIS; s32 ret = 0; @@ -240,12 +242,13 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { this->unk_2C6++; } break; + case 1: case 2: case 3: case 4: case 5: - if (func_8013A4C4(D_80AE7258[this->unk_2C6])) { + if (Snap_CheckFlag(sPictographFlags[this->unk_2C6])) { this->unk_2C6 = 6; ret = 1; REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); @@ -253,10 +256,11 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { this->unk_2C6++; } break; + case 6: gSaveContext.save.weekEventReg[90] &= (u8)~0x40; func_800B7298(play, &this->actor, 7); - play->nextEntranceIndex = 0x8460; + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_03; @@ -284,15 +288,15 @@ UNK_TYPE* func_80AE6880(EnShn* this, PlayState* play) { s32 func_80AE68F0(EnShn* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 ret = 0; + s32 ret = false; if (this->unk_1D8 & 7) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk_1D8 &= ~0x180; - if (player->exchangeItemId == EXCH_ITEM_13) { + if (player->exchangeItemId == PLAYER_AP_PICTO_BOX) { this->unk_1D8 |= 0x80; this->unk_2E4 = player->exchangeItemId; - } else if (player->exchangeItemId != EXCH_ITEM_NONE) { + } else if (player->exchangeItemId != PLAYER_AP_NONE) { this->unk_1D8 |= 0x100; this->unk_2E4 = player->exchangeItemId; } @@ -303,7 +307,7 @@ s32 func_80AE68F0(EnShn* this, PlayState* play) { this->unk_1D8 |= 8; } this->actionFunc = func_80AE6A64; - ret = 1; + ret = true; } } return ret; @@ -356,7 +360,7 @@ void EnShn_Init(Actor* thisx, PlayState* play) { this->unk_2E0 = 0; this->unk_2D8 = 0; this->unk_1D8 = 0; - if (gSaveContext.save.entranceIndex != 0xA820) { + if (gSaveContext.save.entrance != ENTRANCE(TOURIST_INFORMATION, 2)) { SubS_UpdateFlags(&this->unk_1D8, 3, 7); this->unk_2BE = 0; } else { @@ -378,7 +382,7 @@ void EnShn_Update(Actor* thisx, PlayState* play) { func_80AE6130(this); func_80AE63A8(this, play); this->unk_2E0 = 0; - func_8013C964(&this->actor, play, 120.0f, 40.0f, EXCH_ITEM_NONE, this->unk_1D8 & 7); + func_8013C964(&this->actor, play, 120.0f, 40.0f, PLAYER_AP_NONE, this->unk_1D8 & 7); } s32 EnShn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { 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 21df2d8f9..e3c5b1730 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -49,7 +49,7 @@ void func_809964A0(EnSkb* this, PlayState* play); s32 func_80996594(EnSkb* this, PlayState* play); void func_80996BEC(EnSkb* this, PlayState* play); -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_skb_Anim_0064E0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0 }, { &object_skb_Anim_003584, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &object_skb_Anim_002190, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, @@ -287,7 +287,7 @@ void func_80994DA8(EnSkb* this, PlayState* play) { } void func_80994E2C(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_APPEAR); this->unk_3D0 = 0; @@ -342,7 +342,7 @@ void func_80995068(EnSkb* this, PlayState* play) { if (this->unk_3E0 == 1) { Message_StartTextbox(play, 0x13F8, &this->actor); if (this->unk_3DE == 2) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); } } else { Message_StartTextbox(play, 0x13F6, &this->actor); @@ -374,7 +374,7 @@ void func_80995190(EnSkb* this, PlayState* play) { if (Message_ShouldAdvance(play)) { Message_StartTextbox(play, 0x13F7, &this->actor); if (this->unk_3DE == 2) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); } } break; @@ -412,7 +412,7 @@ void func_80995244(EnSkb* this, PlayState* play) { } void func_809952D8(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_3DE = 9; this->actionFunc = func_8099533C; @@ -434,7 +434,7 @@ void func_8099533C(EnSkb* this, PlayState* play) { } void func_809953E8(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_3DE = 10; this->actionFunc = func_8099544C; @@ -456,7 +456,7 @@ void func_8099544C(EnSkb* this, PlayState* play) { } void func_809954F8(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_3DE = 11; this->actionFunc = func_8099556C; @@ -499,14 +499,14 @@ void func_8099571C(EnSkb* this) { this->unk_3DC = 0; this->actor.shape.shadowScale = 0.0f; if (this->unk_3DE == 9) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->actor.speedXZ = 2.4f; this->actor.gravity = -1.0f; this->actor.velocity.y = 3.0f; } else if (this->unk_3DE == 0xA) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); } else if (this->unk_3DE == 0xB) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); this->actor.speedXZ = 3.2f; this->actor.gravity = -1.0f; this->actor.velocity.y = 2.0f; @@ -560,7 +560,7 @@ void func_8099599C(EnSkb* this, PlayState* play) { } void func_80995A30(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actor.speedXZ = 1.6f; this->unk_3DA = 0; this->unk_3DE = 2; @@ -573,7 +573,7 @@ void func_80995A8C(EnSkb* this, PlayState* play) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->actor.hintId = 0xFF; this->actor.colChkInfo.mass = MASS_HEAVY; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); func_8099504C(this); return; } @@ -596,7 +596,7 @@ void func_80995A8C(EnSkb* this, PlayState* play) { } void func_80995C24(EnSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->collider.base.atFlags &= ~AT_BOUNCED; this->actor.speedXZ = 0.0f; this->unk_3DE = 3; @@ -682,17 +682,17 @@ void func_80995E64(EnSkb* this, PlayState* play) { void func_80995F98(EnSkb* this) { if ((this->unk_3DE == 9) || (this->unk_3DE == 0xA)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); this->actor.gravity = -1.0f; this->actor.speedXZ = 1.0f; } else if (this->unk_3DE == 0xB) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); this->actor.speedXZ = 3.2f; this->actor.velocity.y = 2.0f; this->actor.gravity = -1.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); if (this->actor.bgCheckFlags & 1) { this->actor.speedXZ = -4.0f; } @@ -728,7 +728,7 @@ void func_809960AC(EnSkb* this, PlayState* play) { } void func_809961E4(EnSkb* this, PlayState* play) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->unk_3D8 |= 0x40; if (this->actor.bgCheckFlags & 1) { this->actor.speedXZ = -6.0f; @@ -760,7 +760,7 @@ void func_8099630C(EnSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_3D8 |= 1; func_80995F98(this); } else { @@ -782,7 +782,7 @@ void func_809963D8(EnSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->unk_3D8 |= 1; func_80995F98(this); } else { @@ -953,7 +953,7 @@ void func_8099672C(EnSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_809963C4(this); break; @@ -971,7 +971,7 @@ void func_8099672C(EnSkb* this, PlayState* play) { case 13: Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); func_80995F98(this); break; } 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 ce8cb0cf6..aa8f651ec 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -58,7 +58,7 @@ typedef enum { /* 2 */ BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_LOOP } BombShopkeeperAnimation; -static AnimationInfoS sAnimationsBombShopkeeper[] = { +static AnimationInfoS sAnimationInfoBombShopkeeper[] = { { &gBombShopkeeperWalkAnim, 2.0f, 0, -1, ANIMMODE_LOOP, 20 }, { &gBombShopkeeperSitAtCounterStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gBombShopkeeperSitAtCounterLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -156,10 +156,10 @@ static Vec3f sPosOffset[] = { { 0.0f, -4.0f, 0.0f }, }; -void EnSob1_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animations, s32 index) { +void EnSob1_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animations, s32 animIndex) { f32 frameCount; - animations += index; + animations += animIndex; if (animations->frameCount < 0) { frameCount = Animation_GetLastFrame(animations->animation); } else { @@ -722,7 +722,8 @@ void EnSob1_EndWalk(EnSob1* this, PlayState* play) { if (distSq < 12.0f) { this->actor.speedXZ = 0.0f; if (animLastFrame == curFrame) { - EnSob1_ChangeAnim(&this->skelAnime, sAnimationsBombShopkeeper, BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_START); + EnSob1_ChangeAnim(&this->skelAnime, sAnimationInfoBombShopkeeper, + BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_START); EnSob1_SetupAction(this, EnSob1_SetupIdle); } } @@ -733,7 +734,7 @@ void EnSob1_SetupIdle(EnSob1* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; if (Animation_GetLastFrame(&gBombShopkeeperSitAtCounterStartAnim) == curFrame) { - EnSob1_ChangeAnim(&this->skelAnime, sAnimationsBombShopkeeper, BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_LOOP); + EnSob1_ChangeAnim(&this->skelAnime, sAnimationInfoBombShopkeeper, BOMB_SHOPKEEPER_ANIM_SIT_AT_COUNTER_LOOP); EnSob1_SetupAction(this, EnSob1_Idle); } EnSob1_Walking(this, play); @@ -823,7 +824,7 @@ void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80151938(play, 0x647); } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1079,7 +1080,7 @@ void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1095,7 +1096,7 @@ void EnSob1_ContinueShopping(EnSob1* this, PlayState* play) { player->stateFlags2 |= 0x20000000; Message_StartTextbox(play, this->welcomeTextId, &this->actor); EnSob1_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 200.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 200.0f, PLAYER_AP_MINUS1); } } 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 d7c41603e..6e7915539 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -206,39 +206,40 @@ void EnSsh_InitColliders(EnSsh* this, PlayState* play) { Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->collider2Elements); } -f32 EnSsh_SetAnimation(EnSsh* this, s32 arg0) { - AnimationHeader* animation[] = { &object_ssh_Anim_006D78, &object_ssh_Anim_001494, &object_ssh_Anim_001494, - &object_ssh_Anim_006788, &object_ssh_Anim_001494, &object_ssh_Anim_001494, - &object_ssh_Anim_006D78 }; - f32 playerbackSpeed[] = { 1.0f, 4.0f, 1.0f, 1.0f, 8.0f, 6.0f, 2.0f }; - u8 mode[] = { +f32 EnSsh_ChangeAnim(EnSsh* this, s32 animIndex) { + AnimationHeader* sAnimations[] = { &object_ssh_Anim_006D78, &object_ssh_Anim_001494, &object_ssh_Anim_001494, + &object_ssh_Anim_006788, &object_ssh_Anim_001494, &object_ssh_Anim_001494, + &object_ssh_Anim_006D78 }; + f32 sPlaySpeeds[] = { 1.0f, 4.0f, 1.0f, 1.0f, 8.0f, 6.0f, 2.0f }; + u8 sAnimationModes[] = { ANIMMODE_ONCE_INTERP, ANIMMODE_ONCE_INTERP, ANIMMODE_LOOP_INTERP, ANIMMODE_ONCE_INTERP, ANIMMODE_LOOP_INTERP, ANIMMODE_LOOP_INTERP, ANIMMODE_LOOP_INTERP, }; - f32 frameCount = Animation_GetLastFrame(animation[arg0]); + f32 frameCount = Animation_GetLastFrame(sAnimations[animIndex]); s32 pad; - Animation_Change(&this->skelAnime, animation[arg0], playerbackSpeed[arg0], 0.0f, frameCount, mode[arg0], -6.0f); + Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, frameCount, + sAnimationModes[animIndex], -6.0f); return frameCount; } void EnSsh_SetWaitAnimation(EnSsh* this) { - EnSsh_SetAnimation(this, SSH_ANIM_WAIT); + EnSsh_ChangeAnim(this, SSH_ANIM_WAIT); } void EnSsh_SetReturnAnimation(EnSsh* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTU_UP); - EnSsh_SetAnimation(this, SSH_ANIM_UP); + EnSsh_ChangeAnim(this, SSH_ANIM_UP); } void EnSsh_SetLandAnimation(EnSsh* this) { this->actor.world.pos.y = this->floorHeightOffset + this->actor.floorHeight; - this->animTimer = EnSsh_SetAnimation(this, SSH_ANIM_LAND); + this->animTimer = EnSsh_ChangeAnim(this, SSH_ANIM_LAND); } void EnSsh_SetDropAnimation(EnSsh* this) { if (this->unkTimer == 0) { - this->animTimer = EnSsh_SetAnimation(this, SSH_ANIM_DROP); + this->animTimer = EnSsh_ChangeAnim(this, SSH_ANIM_DROP); } this->actor.velocity.y = -10.0f; } @@ -724,11 +725,11 @@ void EnSsh_Idle(EnSsh* this, PlayState* play) { } if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { - EnSsh_SetAnimation(this, SSH_ANIM_WAIT); + EnSsh_ChangeAnim(this, SSH_ANIM_WAIT); } if ((this->animTimer != 0) && (DECR(this->animTimer) == 0)) { - EnSsh_SetAnimation(this, SSH_ANIM_WAIT); + EnSsh_ChangeAnim(this, SSH_ANIM_WAIT); } if (!EnSsh_IsCloseToLink(this, play)) { @@ -752,11 +753,11 @@ void EnSsh_Idle(EnSsh* this, PlayState* play) { void EnSsh_Land(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { - EnSsh_SetAnimation(this, SSH_ANIM_WAIT); + EnSsh_ChangeAnim(this, SSH_ANIM_WAIT); } if ((this->animTimer != 0) && (DECR(this->animTimer) == 0)) { - EnSsh_SetAnimation(this, SSH_ANIM_WAIT); + EnSsh_ChangeAnim(this, SSH_ANIM_WAIT); } if ((this->actor.floorHeight + this->floorHeightOffset) <= this->actor.world.pos.y) { @@ -768,7 +769,7 @@ void EnSsh_Land(EnSsh* this, PlayState* play) { void EnSsh_Drop(EnSsh* this, PlayState* play) { if ((this->unkTimer != 0) && (DECR(this->unkTimer) == 0)) { - EnSsh_SetAnimation(this, SSH_ANIM_DROP); + EnSsh_ChangeAnim(this, SSH_ANIM_DROP); } if (!EnSsh_IsCloseToLink(this, play)) { diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index e8c9eaeb9..b3c353f1f 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -152,7 +152,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_st_Anim_000304, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_st_Anim_005B98, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, { &object_st_Anim_000304, 4.0f, 0, -1, ANIMMODE_ONCE, -4 }, @@ -447,7 +447,7 @@ s32 func_808A6064(EnSt* this) { } void func_808A60E0(EnSt* this) { - s32 idx = (this->unk_2C8 > 0.0f) ? 2 : 6; + s32 animIndex = (this->unk_2C8 > 0.0f) ? 2 : 6; f32 sp20 = (this->unk_2C8 > 0.0f) ? 4.0f : 9.0f; f32 sp1C; u16 sfxId = (this->unk_2C8 < 0.0f) ? NA_SE_EN_STALTU_DOWN : NA_SE_EN_STALTU_UP; @@ -455,7 +455,7 @@ void func_808A60E0(EnSt* this) { sp1C = this->skelAnime.curFrame / (this->skelAnime.animLength - 1.0f); if (sp1C == 1.0f) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, idx); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); Actor_PlaySfxAtPos(&this->actor, sfxId); } @@ -507,7 +507,7 @@ void func_808A6220(EnSt* this, PlayState* play) { } void func_808A63E8(EnSt* this) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); this->unk_2C8 = 1.0f; func_808A5D7C(this); this->unk_30C = 0; @@ -520,7 +520,7 @@ void func_808A63E8(EnSt* this) { void func_808A6468(EnSt* this, PlayState* play) { func_808A5050(this, play); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 4); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 4); this->unk_18C |= (0x8 | 0x4); this->unk_18C &= ~(0x10 | 0x2); this->unk_2C8 = -1.0f; @@ -535,9 +535,9 @@ void func_808A6468(EnSt* this, PlayState* play) { } void func_808A650C(EnSt* this) { - s32 idx = (this->unk_2C8 > 0.0f) ? 2 : 6; + s32 animIndex = (this->unk_2C8 > 0.0f) ? 2 : 6; - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, idx); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->unk_2CC = 0.0f; this->unk_2D4 = 0.0f; this->unk_2D8 = 0.0f; @@ -604,7 +604,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { this->unk_314 = 20; this->unk_312 = 0; Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_314); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 1); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 1); this->unk_18C |= 8; this->actionFunc = func_808A6D84; this->unk_2C8 = -1.0f; @@ -645,7 +645,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { } if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 7); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 7); this->unk_2CC = 0.0f; this->unk_2D4 = 0.0f; this->actor.gravity = -1.0f; @@ -690,7 +690,7 @@ void func_808A6A78(EnSt* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->unk_2C0)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 8.0f); SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); @@ -721,7 +721,7 @@ void func_808A6C04(EnSt* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if ((this->unk_18C & 8) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); this->unk_18C &= ~8; } else if ((this->unk_310 == 0) && func_808A5F28(this, play) && !func_808A6064(this)) { func_808A650C(this); @@ -763,7 +763,7 @@ void func_808A6E24(EnSt* this, PlayState* play) { } if (count == ARRAY_COUNT(this->unk_31C)) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 7); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 7); this->drawDmgEffType = ACTOR_DRAW_DMGEFF_BLUE_FIRE; this->unk_2CC = 0.0f; this->unk_2D4 = 0.0f; 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 664a74aa1..77c40d173 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -275,7 +275,7 @@ void func_80B67348(EnSth* this, PlayState* play) { } Message_StartTextbox(play, phi_a1, &this->actor); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -286,7 +286,7 @@ void func_80B67458(EnSth* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80B67348; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); if (CURRENT_DAY == 3) { func_80B670A4(this, 6); } else { @@ -470,7 +470,7 @@ void func_80B67AB4(EnSth* this, PlayState* play) { gSaveContext.save.weekEventReg[34] |= 0x40; Message_StartTextbox(play, 0x918, &this->actor); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -481,7 +481,7 @@ void func_80B67B50(EnSth* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80B67AB4; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { this->unk_29C &= ~1; gSaveContext.save.weekEventReg[34] |= 8; 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 3fed1f8f2..10cdec079 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -49,7 +49,7 @@ const ActorInit En_Suttari_InitVars = { (ActorFunc)EnSuttari_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &object_boj_Anim_00071C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &object_boj_Anim_0128F4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, { &object_boj_Anim_011F84, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, @@ -222,8 +222,8 @@ Actor* EnSuttari_GetActorById(PlayState* play, s16 actorId) { return NULL; } -void EnSuttari_SetNextEntrance(PlayState* play, u16 nextEntranceIndex) { - play->nextEntranceIndex = nextEntranceIndex; +void EnSuttari_TriggerTransition(PlayState* play, u16 entrance) { + play->nextEntrance = entrance; play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; play->transitionTrigger = TRANS_TRIGGER_START; @@ -250,7 +250,7 @@ s32 func_80BAA904(EnSuttari* this, PlayState* play) { void func_80BAA9B4(EnSuttari* this) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); switch (this->textId) { case 0x1454: @@ -261,15 +261,15 @@ void func_80BAA9B4(EnSuttari* this) { case 0x1459: case 0x145A: case 0x145B: - if ((this->animationIndex != 8) && (curFrame == frameCount)) { - this->animationIndex = 8; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if ((this->animIndex != 8) && (curFrame == frameCount)) { + this->animIndex = 8; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } break; default: - if ((this->animationIndex != 1) && (curFrame == frameCount)) { - this->animationIndex = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if ((this->animIndex != 1) && (curFrame == frameCount)) { + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } } } @@ -277,8 +277,8 @@ void func_80BAA9B4(EnSuttari* this) { void func_80BAAA94(EnSuttari* this) { switch (this->textId) { case 0x29E5: - this->animationIndex = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; case 0x29E9: this->enFsn->flags |= ENFSN_ANGRY; @@ -290,12 +290,12 @@ void func_80BAAA94(EnSuttari* this) { this->enFsn->flags |= ENFSN_OFFER_FINAL_PRICE; break; case 0x29EC: - this->animationIndex = 7; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 7; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; case 0x29ED: - this->animationIndex = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; } } @@ -417,14 +417,14 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { void func_80BAAF1C(EnSuttari* this) { s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if (this->animationIndex == 5) { - this->animationIndex = 3; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); - } else if ((this->animationIndex == 3) && (curFrame == frameCount)) { - this->animationIndex = 6; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if (this->animIndex == 5) { + this->animIndex = 3; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); + } else if ((this->animIndex == 3) && (curFrame == frameCount)) { + this->animIndex = 6; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->flags1 &= ~0x100; } } @@ -842,7 +842,7 @@ s32 func_80BAC220(EnSuttari* this, PlayState* play) { void func_80BAC2FC(EnSuttari* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); switch (this->unk428) { case 12: @@ -851,9 +851,9 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { func_80BABFD4(this, play); break; case 15: - if ((this->animationIndex == 1) && (curFrame == frameCount)) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if ((this->animIndex == 1) && (curFrame == frameCount)) { + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } if (!(gSaveContext.save.weekEventReg[83] & 4) && !(this->flags1 & 0x1000)) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { @@ -884,9 +884,9 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->flags1 |= 0x80; this->flags1 |= 0x20; this->enFsn->flags &= ~ENFSN_HAGGLE; - if (this->animationIndex != 2) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if (this->animIndex != 2) { + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } func_80BAC220(this, play); break; @@ -915,9 +915,9 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { break; case 4: if (!(gSaveContext.save.weekEventReg[33] & 8)) { - if (this->animationIndex == 2 || this->animationIndex == 1) { - this->animationIndex = 5; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if (this->animIndex == 2 || this->animIndex == 1) { + this->animIndex = 5; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } this->flags1 |= 0x10; if (this->flags2 & 2) { @@ -945,16 +945,16 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { if (play->sceneNum == SCENE_IKANA) { this->flags1 |= 1; if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->flags1 |= 0x80; this->actionFunc = func_80BACA14; return; } else if ((gSaveContext.save.day == 3) && (gSaveContext.save.time <= CLOCK_TIME(19, 0)) && !(gSaveContext.save.weekEventReg[61] & 8) && !(gSaveContext.save.weekEventReg[33] & 8) && (gSaveContext.save.weekEventReg[51] & 8)) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = func_80BACEE0; return; } @@ -962,15 +962,16 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_MarkForDeath(&this->actor); } - if ((gSaveContext.save.entranceIndex == 0xD670) || (gSaveContext.save.weekEventReg[58] & 0x40)) { + if ((gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7)) || + (gSaveContext.save.weekEventReg[58] & 0x40)) { Actor_MarkForDeath(&this->actor); } this->cutscenes[0] = this->actor.cutscene; this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); this->flags1 |= 0x80; this->flags1 |= 8; - this->animationIndex = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = func_80BAD004; return; } else if (play->sceneNum == SCENE_ICHIBA) { @@ -978,8 +979,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { Actor_MarkForDeath(&this->actor); return; } - this->animationIndex = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->flags1 |= 2; this->actionFunc = func_80BAD5F8; return; @@ -988,8 +989,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { Actor_MarkForDeath(&this->actor); return; } - this->animationIndex = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + this->animIndex = 0; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->cutscenes[0] = this->actor.cutscene; this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); this->flags1 |= 4; @@ -1007,9 +1008,9 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { void func_80BACA14(EnSuttari* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->animationIndex == 1 || this->animationIndex == 8) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if (this->animIndex == 1 || this->animIndex == 8) { + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } func_80BABA90(this, 0, 0); func_80BAB434(this); @@ -1232,7 +1233,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { this->actor.speedXZ = 0.0f; Audio_QueueSeqCmd(0x101400FF); this->flags2 |= 4; - EnSuttari_SetNextEntrance(play, 0xD670); + EnSuttari_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { this->unk3F2 = this->headRot.y; Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 0.5f); @@ -1245,11 +1246,11 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { void func_80BAD5F8(EnSuttari* this, PlayState* play) { ScheduleOutput scheduleOutput; s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - if ((curFrame == frameCount) && (this->animationIndex == 0) && (this->flags1 & 0x20)) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if ((curFrame == frameCount) && (this->animIndex == 0) && (this->flags1 & 0x20)) { + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || @@ -1280,14 +1281,14 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { void func_80BAD7F8(EnSuttari* this, PlayState* play) { ScheduleOutput scheduleOutput; s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->enFsn == NULL) { this->enFsn = (EnFsn*)EnSuttari_GetActorById(play, ACTOR_EN_FSN); } else { - if ((this->flags1 & 0x2000) && (this->animationIndex == 1) && (curFrame == frameCount)) { - this->animationIndex = 2; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + if ((this->flags1 & 0x2000) && (this->animIndex == 1) && (curFrame == frameCount)) { + this->animIndex = 2; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || @@ -1329,14 +1330,14 @@ void func_80BADA08(EnSuttari* this, PlayState* play) { void func_80BADA9C(EnSuttari* this, PlayState* play) { u8 talkstate = Message_GetState(&play->msgCtx); s16 curFrame = this->skelAnime.curFrame; - s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation); + s16 frameCount = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); if (this->flags1 & 1) { this->unk3F2 = this->headRot.y; func_80BAA9B4(this); - } else if ((this->animationIndex == 7) && (curFrame == frameCount)) { - this->animationIndex = 1; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex); + } else if ((this->animIndex == 7) && (curFrame == frameCount)) { + this->animIndex = 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } if (talkstate == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { @@ -1482,11 +1483,11 @@ void EnSuttari_Update(Actor* thisx, PlayState* play) { EnSuttari_UpdateTime(); } if (this->unk428 != 0) { - if (this->animationIndex == 2 || this->animationIndex == 6) { + if (this->animIndex == 2 || this->animIndex == 6) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); } - } else if (this->animationIndex == 0 || this->animationIndex == 5) { + } else if (this->animIndex == 0 || this->animIndex == 5) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_PAMERA_WALK); } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 2861e5971..35a9b6e2e 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -54,7 +54,7 @@ typedef struct EnSuttari { /* 0x436 */ s16 unk436; /* 0x438 */ Vec3f unk438; /* 0x444 */ Vec3f unk444; - /* 0x450 */ s32 animationIndex; + /* 0x450 */ s32 animIndex; /* 0x454 */ UNK_TYPE1 unk_454[0x2]; /* 0x456 */ s16 cutscenes[2]; /* 0x45A */ s16 cutsceneIdx; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 35893a1f0..a69cbe213 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -134,7 +134,7 @@ static DamageTable sDamageTable2 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_st_Anim_000304, 1.0f, 0, -1, ANIMMODE_ONCE_INTERP, 0 }, { &object_st_Anim_000304, 1.0f, 0, -1, ANIMMODE_ONCE_INTERP, -4 }, { &object_st_Anim_0055A8, 1.0f, 0, -1, ANIMMODE_LOOP_INTERP, -4 }, @@ -678,7 +678,7 @@ s32 func_808DA08C(EnSw* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; if (!ENSW_GET_3(&this->actor)) { - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 3); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 3); } switch (this->actor.colChkInfo.damageEffect) { @@ -781,11 +781,10 @@ void func_808DA3F4(EnSw* this, PlayState* play) { func_808D94D0(this, play, 0, 0, temp_s1); } -#ifdef NON_MATCHING void func_808DA578(EnSw* this, PlayState* play) { f32 temp_f0; - s32 test; - s32 test2; + f32 temp; + s16 temp2; Vec3f sp30; if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -795,7 +794,8 @@ void func_808DA578(EnSw* this, PlayState* play) { if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp30, &this->unk_374); func_808D9894(this, &sp30); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp30.z, sp30.x)); + temp2 = Math_FAtan2F(sp30.z, sp30.x); + func_808D94D0(this, play, 0, 0, temp2); } } else if (this->unk_410 & 0x20) { Math_Vec3f_Copy(&this->unk_374, &this->actor.home.pos); @@ -805,28 +805,18 @@ void func_808DA578(EnSw* this, PlayState* play) { this->skelAnime.curFrame = 0.0f; } - temp_f0 = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - if (!(this->unk_410 & 0x20)) { - test = this->unk_414; - test2 = temp_f0; - if ((test != 0) && (test < test2)) { - this->unk_410 |= 0x20; - } + temp = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); + if (!(this->unk_410 & 0x20) && ((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)temp)) { + this->unk_410 |= 0x20; } - this->unk_414 = temp_f0; + this->unk_414 = temp; } -#else -void func_808DA578(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA578.s") -#endif -#ifdef NON_MATCHING void func_808DA6FC(EnSw* this, PlayState* play) { f32 sp4C; - s32 temp; - s32 temp2; - Vec3f sp38; f32 temp_f0; + s16 temp2; + Vec3f sp38; if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; @@ -835,7 +825,8 @@ void func_808DA6FC(EnSw* this, PlayState* play) { if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + temp2 = Math_FAtan2F(sp38.z, sp38.x); + func_808D94D0(this, play, 0, 0, temp2); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -843,9 +834,8 @@ void func_808DA6FC(EnSw* this, PlayState* play) { } sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - temp = this->unk_414; - temp2 = sp4C; - if ((temp != 0) && (temp < temp2)) { + + if (((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)sp4C)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374); this->unk_454 = Rand_S16Offset(20, 20); this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f; @@ -854,10 +844,6 @@ void func_808DA6FC(EnSw* this, PlayState* play) { } this->unk_414 = sp4C; } -#else -void func_808DA6FC(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA6FC.s") -#endif void func_808DA89C(EnSw* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -966,15 +952,13 @@ void func_808DAA60(EnSw* this, PlayState* play) { func_808D94D0(this, play, 0, 0, sp40); } -#ifdef NON_MATCHING void func_808DACF4(EnSw* this, PlayState* play) { f32 sp4C; - f32 temp_f0; - s32 temp_f6; + f32 temp; + s16 temp_f6; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 0) { Vec3f sp38; - f32 temp; temp = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.1f * temp; @@ -983,7 +967,8 @@ void func_808DACF4(EnSw* this, PlayState* play) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + temp_f6 = Math_FAtan2F(sp38.z, sp38.x); + func_808D94D0(this, play, 0, 0, temp_f6); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -991,8 +976,8 @@ void func_808DACF4(EnSw* this, PlayState* play) { } sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - temp_f6 = this->unk_414; - if ((temp_f6 != 0) && (temp_f6 < (s32)sp4C)) { + + if (((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)sp4C)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374); this->unk_4A0 += this->unk_49C; if ((this->unk_4A0 >= this->unk_1E4->count) || (this->unk_4A0 < 0)) { @@ -1009,10 +994,6 @@ void func_808DACF4(EnSw* this, PlayState* play) { } this->unk_414 = sp4C; } -#else -void func_808DACF4(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DACF4.s") -#endif void func_808DAEB4(EnSw* this, PlayState* play) { Vec3f sp5C; @@ -1158,7 +1139,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { if (!func_808D9968(this, play)) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); SkelAnime_Init(play, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); this->skelAnime.playSpeed = 4.0f; Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); 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 887e62657..fcb1e8330 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 @@ -68,7 +68,7 @@ static ColliderCylinderInit sCylinderInit = { static Cylinder16 D_80A2CADC[] = { { 24, 40, 0, { 0, 0, 0 } } }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gDekuScrubUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &gDekuScrubBurrowAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &gDekuScrubIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, @@ -231,7 +231,7 @@ void func_80A2C168(EnSyatekiDekunuts* this, PlayState* play) { void func_80A2C1AC(EnSyatekiDekunuts* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actionFunc = func_80A2C208; @@ -250,7 +250,7 @@ void func_80A2C208(EnSyatekiDekunuts* this, PlayState* play) { } void func_80A2C27C(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { this->actionFunc = func_80A2C2E0; } else { @@ -281,7 +281,7 @@ void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) { } void func_80A2C3AC(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80A2C3F0; } @@ -330,7 +330,7 @@ void func_80A2C4D0(EnSyatekiDekunuts* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); this->unk_1E2 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->unk_1D8 = 160; this->actionFunc = func_80A2C5DC; } @@ -342,7 +342,7 @@ void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (this->unk_1D8 == 160) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); this->unk_1D8--; } else if (this->unk_1D8 < 160) { 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 975d1dabf..7852aa24b 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 @@ -72,12 +72,12 @@ const ActorInit En_Syateki_Man_InitVars = { }; 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; + /* 0 */ EN_SYATEKI_MAN_ANIM_HANDS_ON_TABLE, + /* 1 */ EN_SYATEKI_MAN_ANIM_SWAMP_HEAD_SCRATCH_LOOP, + /* 2 */ EN_SYATEKI_MAN_ANIM_SWAMP_HEAD_SCRATCH_END, +} EnSyatekiManAnimation; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &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 }, @@ -260,7 +260,7 @@ void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { u16 faceReactionTextId; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_SYATEKI_MAN_ANIMATION_SWAMP_HEAD_SCRATCH_END); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_MAN_ANIM_SWAMP_HEAD_SCRATCH_END); faceReactionTextId = Text_GetFaceReaction(play, 0x31); if (faceReactionTextId != 0) { Message_StartTextbox(play, faceReactionTextId, &this->actor); @@ -479,7 +479,7 @@ void EnSyatekiMan_Swamp_Talk(EnSyatekiMan* this, PlayState* play) { if (this->skelAnime.animation == &gSwampShootingGalleryManHeadScratchEndAnim) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_SYATEKI_MAN_ANIMATION_HANDS_ON_TABLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_MAN_ANIM_HANDS_ON_TABLE); } } } @@ -899,7 +899,7 @@ void EnSyatekiMan_Swamp_GiveReward(EnSyatekiMan* this, PlayState* play) { this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Swamp_Talk; } else { - func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, PLAYER_AP_MINUS1); } } @@ -963,7 +963,7 @@ void EnSyatekiMan_Town_GiveReward(EnSyatekiMan* this, PlayState* play) { this->shootingGameState = SG_GAME_STATE_NONE; this->actionFunc = EnSyatekiMan_Town_Talk; } else { - func_800B85E0(&this->actor, play, 500.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 500.0f, PLAYER_AP_MINUS1); } } 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 eda6337a0..9077b38c4 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 @@ -60,7 +60,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, -30, { 0, 0, 0 } }, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gOctorokShootAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &gOctorokDieAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, { &gOctorokHideAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, @@ -185,7 +185,7 @@ void func_80A36350(EnSyatekiOkuta* this, PlayState* play) { void func_80A36360(EnSyatekiOkuta* this) { this->actor.draw = EnSyatekiOkuta_Draw; this->unk_2AA = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); this->actionFunc = func_80A363B4; } @@ -205,7 +205,7 @@ void func_80A363B4(EnSyatekiOkuta* this, PlayState* play) { } void func_80A36444(EnSyatekiOkuta* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80A36488; } @@ -218,7 +218,7 @@ void func_80A36488(EnSyatekiOkuta* this, PlayState* play) { } void func_80A364C0(EnSyatekiOkuta* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80A36504; } @@ -238,7 +238,7 @@ void func_80A3657C(EnSyatekiOkuta* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_OCTAROCK_DEAD1); } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actionFunc = func_80A365EC; } 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 7c6073bb2..d15859a74 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 @@ -113,7 +113,7 @@ const ActorInit En_Syateki_Wf_InitVars = { (ActorFunc)EnSyatekiWf_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gWolfosWaitingAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, { &gWolfosRunningAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &gWolfosRunningAnim, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, @@ -257,7 +257,7 @@ void func_80A20320(EnSyatekiWf* this, PlayState* play) { } void func_80A20378(EnSyatekiWf* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); this->actor.speedXZ = 10.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.draw = EnSyatekiWf_Draw; @@ -328,7 +328,7 @@ void func_80A20670(EnSyatekiWf* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); this->actor.velocity.y = 20.0f; this->actor.speedXZ = 5.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); this->actionFunc = func_80A206DC; } @@ -340,7 +340,7 @@ void func_80A206DC(EnSyatekiWf* this, PlayState* play) { void func_80A20710(EnSyatekiWf* this) { this->actor.speedXZ = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); this->actionFunc = func_80A2075C; } @@ -354,7 +354,7 @@ void func_80A2079C(EnSyatekiWf* this) { this->unk_29A = 40; this->actor.speedXZ = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); this->actionFunc = func_80A20800; } @@ -374,7 +374,7 @@ void func_80A20858(EnSyatekiWf* this, PlayState* play) { this->actor.speedXZ = 0.0f; EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); syatekiMan->score += 100; this->actionFunc = func_80A208F8; } 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 7d2bbb9bb..860ad9d0c 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -552,7 +552,7 @@ void EnTab_Update(Actor* thisx, PlayState* play) { radius = this->collider.dim.radius + this->unk_30C; height = this->collider.dim.height + 10; - func_8013C964(&this->actor, play, radius, height, EXCH_ITEM_NONE, this->unk_2FC & 7); + func_8013C964(&this->actor, play, radius, height, PLAYER_AP_NONE, this->unk_2FC & 7); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); func_80BE0620(this, play); diff --git a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.h b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.h index 7a9fe909a..a58b2b1d3 100644 --- a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.h +++ b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.h @@ -7,7 +7,7 @@ struct EnTagObj; typedef struct EnTagObj { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x50]; + /* 0x144 */ UNK_TYPE1 unk_144[0x50]; /* 0x194 */ s32 hasSpawnedSeahorse; } EnTagObj; // size = 0x198 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 fff6d29fa..f1268e1e0 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 @@ -75,21 +75,21 @@ typedef enum { } EnTalkGibudRequestedItemIndex; typedef enum { - /* 0 */ EN_TALK_GIBUD_ANIMATION_GRAB_ATTACK, - /* 1 */ EN_TALK_GIBUD_ANIMATION_GRAB_END, - /* 2 */ EN_TALK_GIBUD_ANIMATION_GRAB_START, - /* 3 */ EN_TALK_GIBUD_ANIMATION_LOOK_BACK, - /* 4 */ EN_TALK_GIBUD_ANIMATION_CROUCH_WIPING_TEARS, - /* 5 */ EN_TALK_GIBUD_ANIMATION_CROUCH_CRYING, - /* 6 */ EN_TALK_GIBUD_ANIMATION_DEATH, - /* 7 */ EN_TALK_GIBUD_ANIMATION_DAMAGE, - /* 8 */ EN_TALK_GIBUD_ANIMATION_CROUCH_END, - /* 9 */ EN_TALK_GIBUD_ANIMATION_IDLE, - /* 10 */ EN_TALK_GIBUD_ANIMATION_WALK, - /* 11 */ EN_TALK_GIBUD_ANIMATION_DANCE_SQUAT, - /* 12 */ EN_TALK_GIBUD_ANIMATION_DANCE_PIROUETTE, - /* 13 */ EN_TALK_GIBUD_ANIMATION_DANCE_CLAP, -} EnTalkGibudAnimations; + /* 0 */ EN_TALK_GIBUD_ANIM_GRAB_ATTACK, + /* 1 */ EN_TALK_GIBUD_ANIM_GRAB_END, + /* 2 */ EN_TALK_GIBUD_ANIM_GRAB_START, + /* 3 */ EN_TALK_GIBUD_ANIM_LOOK_BACK, + /* 4 */ EN_TALK_GIBUD_ANIM_CROUCH_WIPING_TEARS, + /* 5 */ EN_TALK_GIBUD_ANIM_CROUCH_CRYING, + /* 6 */ EN_TALK_GIBUD_ANIM_DEATH, + /* 7 */ EN_TALK_GIBUD_ANIM_DAMAGE, + /* 8 */ EN_TALK_GIBUD_ANIM_CROUCH_END, + /* 9 */ EN_TALK_GIBUD_ANIM_IDLE, + /* 10 */ EN_TALK_GIBUD_ANIM_WALK, + /* 11 */ EN_TALK_GIBUD_ANIM_DANCE_SQUAT, + /* 12 */ EN_TALK_GIBUD_ANIM_DANCE_PIROUETTE, + /* 13 */ EN_TALK_GIBUD_ANIM_DANCE_CLAP, +} EnTalkGibudAnimation; typedef enum { /* 0 */ EN_TALK_GIBUD_TYPE_GIBDO, @@ -114,7 +114,7 @@ const ActorInit En_Talk_Gibud_InitVars = { (ActorFunc)EnTalkGibud_Draw, }; -static AnimationInfo sAnimations[] = { +static AnimationInfo sAnimationInfo[] = { { &gGibdoRedeadGrabAttackAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, { &gGibdoRedeadGrabEndAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f }, { &gGibdoRedeadGrabStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, @@ -282,7 +282,7 @@ void EnTalkGibud_Destroy(Actor* thisx, PlayState* play) { } void EnTalkGibud_SetupIdle(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_IDLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_IDLE); this->actionFunc = EnTalkGibud_Idle; } @@ -300,7 +300,7 @@ void EnTalkGibud_Idle(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupAttemptPlayerFreeze(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_IDLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_IDLE); this->actionFunc = EnTalkGibud_AttemptPlayerFreeze; } @@ -321,7 +321,7 @@ void EnTalkGibud_AttemptPlayerFreeze(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupWalkToPlayer(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_WALK); this->actor.speedXZ = 0.4f; if (this->actionFunc == EnTalkGibud_AttemptPlayerFreeze) { @@ -381,7 +381,7 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupGrab(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_GRAB_START); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_GRAB_START); this->grabDamageTimer = 0; this->actor.flags &= ~ACTOR_FLAG_1; this->grabState = EN_TALK_GIBUD_GRAB_START; @@ -399,7 +399,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { inPositionToAttack = EnTalkGibud_MoveToIdealGrabPositionAndRotation(this, play); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (inPositionToAttack == true)) { this->grabState = EN_TALK_GIBUD_GRAB_ATTACK; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_GRAB_ATTACK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_GRAB_ATTACK); } break; @@ -426,7 +426,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { player->unk_AE8 = 100; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_GRAB_END); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_GRAB_END); this->actor.flags |= ACTOR_FLAG_1; this->grabState = EN_TALK_GIBUD_GRAB_RELEASE; this->grabDamageTimer = 0; @@ -446,7 +446,7 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupGrabFail(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_DAMAGE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DAMAGE); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->actor.speedXZ = -2.0f; this->actionFunc = EnTalkGibud_GrabFail; @@ -468,7 +468,7 @@ void EnTalkGibud_GrabFail(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupTurnAwayAndShakeHead(EnTalkGibud* this) { this->headShakeTimer = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_WALK); this->actionFunc = EnTalkGibud_TurnAwayAndShakeHead; } @@ -486,7 +486,7 @@ void EnTalkGibud_TurnAwayAndShakeHead(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupWalkToHome(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_WALK); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_WALK); this->actor.speedXZ = 0.4f; this->actionFunc = EnTalkGibud_WalkToHome; } @@ -547,7 +547,7 @@ void EnTalkGibud_Stunned(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupDamage(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_DAMAGE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DAMAGE); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DAMAGE); this->stunTimer = 0; this->grabWaitTimer = 0; @@ -583,7 +583,7 @@ void EnTalkGibud_Damage(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupDead(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_DEATH); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_DEATH); this->actor.flags &= ~ACTOR_FLAG_1; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_REDEAD_DEAD); this->deathTimer = 0; @@ -761,7 +761,7 @@ void EnTalkGibud_CheckPresentedItem(EnTalkGibud* this, PlayState* play) { void EnTalkGibud_SetupPassiveIdle(EnTalkGibud* this) { this->isTalking = false; if (this->actionFunc != EnTalkGibud_Talk) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_IDLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_IDLE); } this->actionFunc = EnTalkGibud_PassiveIdle; } @@ -842,7 +842,7 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { } void EnTalkGibud_SetupDisappear(EnTalkGibud* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, EN_TALK_GIBUD_ANIMATION_IDLE); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_TALK_GIBUD_ANIM_IDLE); this->actor.flags &= ~ACTOR_FLAG_1; this->disappearanceTimer = 40; this->actionFunc = EnTalkGibud_Disappear; diff --git a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h index 13d060e2e..fb565a5c8 100644 --- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h +++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.h @@ -9,7 +9,7 @@ typedef void (*EnTanron6ActionFunc)(struct EnTanron6*, PlayState*); typedef struct EnTanron6 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0xBC]; + /* 0x144 */ UNK_TYPE1 unk_144[0xBC]; /* 0x200 */ EnTanron6ActionFunc actionFunc; } EnTanron6; // size = 0x204 diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index 962925216..4a051fc23 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -5,6 +5,12 @@ */ #include "z_en_test2.h" +#include "objects/object_dekucity_ana_obj/object_dekucity_ana_obj.h" +#include "objects/object_sichitai_obj/object_sichitai_obj.h" +#include "objects/object_yukimura_obj/object_yukimura_obj.h" +#include "objects/object_hakugin_obj/object_hakugin_obj.h" +#include "objects/object_meganeana_obj/object_meganeana_obj.h" +#include "objects/object_haka_obj/object_haka_obj.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80) @@ -12,8 +18,15 @@ void EnTest2_Init(Actor* thisx, PlayState* play); void EnTest2_Update(Actor* thisx, PlayState* play); +void EnTest2_UpdateForLens(Actor* thisx, PlayState* play); +void EnTest2_Draw(Actor* thisx, PlayState* play); + +typedef struct EnTest2ModelInfo { + /* 0x0 */ Gfx* dList1; + /* 0x4 */ Gfx* dList2; + /* 0x8 */ AnimatedMaterial* animMat; +} EnTest2ModelInfo; // size = 0xC -#if 0 const ActorInit En_Test2_InitVars = { ACTOR_EN_TEST2, ACTORCAT_BG, @@ -26,22 +39,105 @@ const ActorInit En_Test2_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A3E74C[] = { +static EnTest2ModelInfo sModelInfo[] = { + { object_dekucity_ana_obj_DL_000040, NULL, NULL }, + { object_sichitai_obj_DL_001820, NULL, NULL }, + { object_yukimura_obj_DL_0008C0, NULL, NULL }, + { object_hakugin_obj_DL_0016D8, NULL, object_hakugin_obj_Matanimheader_0017A8 }, + { object_hakugin_obj_DL_002018, NULL, object_hakugin_obj_Matanimheader_0020E8 }, + { object_hakugin_obj_DL_005268, NULL, object_hakugin_obj_Matanimheader_005338 }, + { object_meganeana_obj_DL_000110, object_meganeana_obj_DL_000080, NULL }, + { object_haka_obj_DL_000F70, NULL, NULL }, + { object_haka_obj_DL_001200, NULL, NULL }, + { object_hakugin_obj_DL_004928, NULL, object_hakugin_obj_Matanimheader_0049F8 }, + { object_hakugin_obj_DL_002978, NULL, object_hakugin_obj_Matanimheader_002A58 }, + { object_hakugin_obj_DL_000D38, NULL, object_hakugin_obj_Matanimheader_000E48 }, + { object_hakugin_obj_DL_0035A8, NULL, object_hakugin_obj_Matanimheader_003888 }, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP), }; -#endif +static s16 sObjectIds[] = { + OBJECT_DEKUCITY_ANA_OBJ, OBJECT_SICHITAI_OBJ, OBJECT_YUKIMURA_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, + OBJECT_HAKUGIN_OBJ, OBJECT_MEGANEANA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKUGIN_OBJ, + OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, +}; -extern InitChainEntry D_80A3E74C[]; +void EnTest2_Init(Actor* thisx, PlayState* play) { + EnTest2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + if ((this->actor.params == EN_TEST2_PARAMS_B) || (this->actor.params == EN_TEST2_PARAMS_C)) { + this->actor.flags |= ACTOR_FLAG_20; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Update.s") +void EnTest2_Update(Actor* thisx, PlayState* play) { + s32 pad; + s32 objectIndex; + EnTest2ModelInfo* modelInfo; + EnTest2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E4EC.s") + objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[this->actor.params]); + if (objectIndex < 0) { + Actor_MarkForDeath(&this->actor); + return; + } + if (Object_IsLoaded(&play->objectCtx, objectIndex)) { + modelInfo = &sModelInfo[this->actor.params]; + this->actor.objBankIndex = objectIndex; + this->actor.draw = EnTest2_Draw; + if (modelInfo->animMat != NULL) { + Actor_SetObjectDependency(play, &this->actor); + this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); + } + if (play->roomCtx.currRoom.unk5) { + this->actor.update = EnTest2_UpdateForLens; + } else { + this->actor.update = Actor_Noop; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E524.s") +void EnTest2_UpdateForLens(Actor* thisx, PlayState* play) { + EnTest2* this = THIS; + + if (play->actorCtx.unk4 == 100) { + this->actor.flags |= ACTOR_FLAG_80; + } else { + this->actor.flags &= ~ACTOR_FLAG_80; + } +} + +void EnTest2_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnTest2* this = THIS; + Gfx* dList = sModelInfo[this->actor.params].dList2; + + if (this->animMat != NULL) { + AnimatedMat_Draw(play, this->animMat); + } + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) { + 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); + + if (dList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, dList); + } + gSPDisplayList(POLY_XLU_DISP++, sModelInfo[this->actor.params].dList1); + + CLOSE_DISPS(play->state.gfxCtx); + } else { + if (dList != NULL) { + Gfx_DrawDListXlu(play, dList); + } + Gfx_DrawDListOpa(play, sModelInfo[this->actor.params].dList1); + } +} diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.h b/src/overlays/actors/ovl_En_Test2/z_en_test2.h index b8eabec2c..ccbba11e7 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.h +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.h @@ -7,9 +7,14 @@ struct EnTest2; typedef struct EnTest2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ AnimatedMaterial* animMat; } EnTest2; // size = 0x148 +typedef enum { + /* 0xB */ EN_TEST2_PARAMS_B = 0xB, + /* 0xC */ EN_TEST2_PARAMS_C +} EnTest2_Params; + extern const ActorInit En_Test2_InitVars; #endif // Z_EN_TEST2_H 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 f180eec2c..73309f615 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -398,8 +398,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { func_80A41FA4(this, play); } else { gSaveContext.screenScale = 0.0f; - Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, Entrance_CreateIndexFromSpawn(0), - player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); + Play_SetRespawnData(&play->state, RESPAWN_MODE_DOWN, Entrance_CreateFromSpawn(0), player->unk_3CE, + 0xBFF, &player->unk_3C0, player->unk_3CC); func_80169EFC(&play->state); if (player->stateFlags1 & 0x800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; @@ -440,20 +440,20 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (play->sceneNum == SCENE_CLOCKTOWER))) { s32 playerParams; - u32 entranceIndex = gSaveContext.save.entranceIndex; + u32 entrance = gSaveContext.save.entrance; if ((play->actorCtx.unk5 & 2)) { playerParams = 0xCFF; } else { playerParams = 0xBFF; } - Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, entranceIndex, player->unk_3CE, playerParams, + Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, entrance, player->unk_3CE, playerParams, &player->unk_3C0, player->unk_3CC); if ((play->sceneNum == SCENE_TENMON_DAI) || (play->sceneNum == SCENE_00KEIKOKU)) { - play->nextEntranceIndex = 0x5400; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); } else { - play->nextEntranceIndex = 0xD800; + play->nextEntrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0); } gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionTrigger = TRANS_TRIGGER_START; 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 7d26a6fb8..82af65e3c 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -577,7 +577,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { VEC3F_LERPIMPDST(&subCamEye, &subCam->eye, &sp54, sp4C); - Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye); + Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); } else if ((this->unk_27A < 11) && (this->unk_27A > 0)) { subCam->fov += (mainCam->fov - subCam->fov) / this->unk_27A; } @@ -593,9 +593,9 @@ void func_80A91760(EnTest6* this, PlayState* play) { (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B))) { this->unk_286 = 1; if (ENTEST6_GET(&this->actor) == ENTEST6_25) { - func_801A75E8(NA_SE_SY_TIME_CONTROL_SLOW); + AudioSfx_StopById(NA_SE_SY_TIME_CONTROL_SLOW); } else if (ENTEST6_GET(&this->actor) == ENTEST6_24) { - func_801A75E8(NA_SE_SY_TIME_CONTROL_NORMAL); + AudioSfx_StopById(NA_SE_SY_TIME_CONTROL_NORMAL); } } @@ -750,9 +750,9 @@ void func_80A92188(EnTest6* this, PlayState* play) { } else if (this->unk_27A < 16) { subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); - Play_CameraSetAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); - Play_CameraSetFov(play, subCamId, this->subCamFov); - Play_CameraSetRoll(play, subCamId, 0); + Play_SetCameraAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); + Play_SetCameraFov(play, subCamId, this->subCamFov); + Play_SetCameraRoll(play, subCamId, 0); } switch (this->unk_27A) { @@ -976,11 +976,11 @@ void func_80A92950(EnTest6* this, PlayState* play) { return; case 9: - Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), - player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); + Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entrance & 0xFFFF), player->unk_3CE, + 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; play->transitionTrigger = TRANS_TRIGGER_START; - play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_02; if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; @@ -1057,11 +1057,11 @@ void func_80A92950(EnTest6* this, PlayState* play) { case 9: if (gSaveContext.save.time > CLOCK_TIME(12, 0)) { - Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entranceIndex & 0xFFFF), + Play_SetRespawnData(&play->state, 1, ((void)0, gSaveContext.save.entrance & 0xFFFF), player->unk_3CE, 0xBFF, &player->unk_3C0, player->unk_3CC); this->unk_276 = 99; play->transitionTrigger = TRANS_TRIGGER_START; - play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_02; gSaveContext.respawnFlag = 2; play->msgCtx.ocarinaMode = 4; 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 b9b62e9f7..ed9d2870c 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -638,7 +638,11 @@ void func_80AF2318(EnTest7* this, PlayState* play) { } u16 D_80AF343C[] = { - 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30, + ENTRANCE(GREAT_BAY_COAST, 11), ENTRANCE(ZORA_CAPE, 6), + ENTRANCE(SNOWHEAD, 3), ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8), + ENTRANCE(SOUTH_CLOCK_TOWN, 9), ENTRANCE(MILK_ROAD, 4), + ENTRANCE(WOODFALL, 4), ENTRANCE(SOUTHERN_SWAMP_POISONED, 10), + ENTRANCE(IKANA_CANYON, 4), ENTRANCE(STONE_TOWER, 3), }; void func_80AF2350(EnTest7* this, PlayState* play) { @@ -655,17 +659,19 @@ void func_80AF2350(EnTest7* this, PlayState* play) { this->unk_148.unk_10 -= 0x2EE0; if (play->sceneNum == SCENE_SECOM) { - play->nextEntranceIndex = 0x2060; + play->nextEntrance = ENTRANCE(IKANA_CANYON, 6); } else if (ENTEST7_GET(&this->actor) == ENTEST7_26) { func_80169F78(&play->state); - gSaveContext.respawn[2].playerParams = (gSaveContext.respawn[2].playerParams & 0xFF) | 0x600; + gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = + (gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams & 0xFF) | 0x600; gSaveContext.respawnFlag = -6; } else { - play->nextEntranceIndex = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; - if ((play->nextEntranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { - play->nextEntranceIndex = 0xCA0; - } else if ((play->nextEntranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { - play->nextEntranceIndex = 0xAE80; + play->nextEntrance = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; + if ((play->nextEntrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && (gSaveContext.save.weekEventReg[20] & 2)) { + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); + } else if ((play->nextEntrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && + (gSaveContext.save.weekEventReg[33] & 0x80)) { + play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } } 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 849795b06..03c7d0e1d 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -5,7 +5,6 @@ */ #include "z_en_thiefbird.h" -#include "objects/object_thiefbird/object_thiefbird.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000) @@ -150,8 +149,8 @@ void EnThiefbird_Init(Actor* thisx, PlayState* play) { ColliderJntSphElementDim* dim; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &object_thiefbird_Skel_0061A0, &object_thiefbird_Anim_000604, - this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(play, &this->skelAnime, &gTakkuriSkel, &gTakkuriFlyAnim, this->jointTable, this->morphTable, + TAKKURI_LIMB_MAX); Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { @@ -206,7 +205,7 @@ void func_80C10984(EnThiefbird* this, s32 arg1) { } s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { - static Gfx* D_80C13680[] = { object_thiefbird_DL_004348, object_thiefbird_DL_004B88, object_thiefbird_DL_0055E0 }; + static Gfx* D_80C13680[] = { gTakkuriStolenKokiriSwordDL, gTakkuriStolenRazorSwordDL, gTakkuriStolenGildedSwordDL }; s32 isItemFound = false; s32 phi_a3 = 0; s32 slotId = SLOT_BOTTLE_1; @@ -239,7 +238,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { if (isItemFound) { Inventory_DeleteItem(itemId2, slotId); - this->unk_3E8 = object_thiefbird_DL_0033B0; + this->unk_3E8 = gTakkuriStolenBottleDL; if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { Message_StartTextbox(play, 0xF4, NULL); } @@ -256,7 +255,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { itemId1 = phi_a3 + (ITEM_SWORD_KOKIRI - 1); if (phi_a3 == 4) { Inventory_DeleteItem(ITEM_SWORD_GREAT_FAIRY, SLOT_SWORD_GREAT_FAIRY); - this->unk_3E8 = object_thiefbird_DL_003D58; + this->unk_3E8 = gTakkuriStolenGreatFairySwordDL; itemId1 = ITEM_SWORD_GREAT_FAIRY; } else { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; @@ -461,7 +460,7 @@ void func_80C114C0(EnThiefbird* this, PlayState* play) { } void func_80C11538(EnThiefbird* this) { - Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_000604, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gTakkuriFlyAnim, -4.0f); this->unk_18E = 60; this->collider.base.acFlags |= AC_ON; this->actionFunc = func_80C11590; @@ -525,7 +524,7 @@ void func_80C11590(EnThiefbird* this, PlayState* play) { } void func_80C118E4(EnThiefbird* this) { - Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_0063C4, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gTakkuriAttackAnim, -10.0f); this->unk_18E = 300; this->actionFunc = func_80C1193C; this->actor.speedXZ = 5.0f; @@ -591,7 +590,7 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { void func_80C11C60(EnThiefbird* this) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - Animation_PlayOnce(&this->skelAnime, &object_thiefbird_Anim_000088); + Animation_PlayOnce(&this->skelAnime, &gTakkuriDeathAnim); this->actor.bgCheckFlags &= ~1; this->actor.shape.rot.x = 0; this->unk_18E = 40; @@ -663,7 +662,7 @@ void func_80C11DF0(EnThiefbird* this, PlayState* play) { } void func_80C11F6C(EnThiefbird* this, PlayState* play) { - Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_000278, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gTakkuriFlyWithItemAnim, -4.0f); func_80C10984(this, 15); if (this->actor.colChkInfo.damageEffect != 3) { this->actor.speedXZ = 4.0f; @@ -747,7 +746,7 @@ void func_80C1215C(EnThiefbird* this, PlayState* play) { } void func_80C12308(EnThiefbird* this) { - Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_000278, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gTakkuriFlyWithItemAnim, -4.0f); func_80C10984(this, 15); this->unk_190 = -0x1000; this->unk_192 = BINANG_ROT180(this->actor.yawTowardsPlayer); @@ -776,7 +775,7 @@ void func_80C12378(EnThiefbird* this, PlayState* play) { } void func_80C1242C(EnThiefbird* this) { - Animation_Change(&this->skelAnime, &object_thiefbird_Anim_000278, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->skelAnime, &gTakkuriFlyWithItemAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); this->actor.flags |= ACTOR_FLAG_10; this->collider.base.acFlags |= AC_ON; this->actionFunc = func_80C124B0; @@ -836,8 +835,8 @@ void func_80C126D8(EnThiefbird* this, PlayState* play) { } void func_80C12744(EnThiefbird* this) { - Animation_MorphToLoop(&this->skelAnime, &object_thiefbird_Anim_000604, -4.0f); - Animation_Change(&this->skelAnime, &object_thiefbird_Anim_000604, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gTakkuriFlyAnim, -4.0f); + Animation_Change(&this->skelAnime, &gTakkuriFlyAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -4.0f); this->unk_190 = 0; this->collider.base.acFlags |= AC_ON; this->actor.flags |= ACTOR_FLAG_10; @@ -1030,8 +1029,8 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { } func_80C12D00(this); - if (((this->skelAnime.animation == &object_thiefbird_Anim_000604) && Animation_OnFrame(&this->skelAnime, 13.0f)) || - ((this->skelAnime.animation == &object_thiefbird_Anim_000278) && Animation_OnFrame(&this->skelAnime, 1.0f))) { + if (((this->skelAnime.animation == &gTakkuriFlyAnim) && Animation_OnFrame(&this->skelAnime, 13.0f)) || + ((this->skelAnime.animation == &gTakkuriFlyWithItemAnim) && Animation_OnFrame(&this->skelAnime, 1.0f))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_FLUTTER); } } @@ -1039,12 +1038,12 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { s32 EnThiefbird_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnThiefbird* this = THIS; - if ((limbIndex == 10) || (limbIndex == 11)) { + if ((limbIndex == TAKKURI_LIMB_RIGHT_EAR) || (limbIndex == TAKKURI_LIMB_LEFT_EAR)) { this->unk_3E4 = *dList; *dList = NULL; - } else if (limbIndex == 16) { + } else if (limbIndex == TAKKURI_LIMB_STOLEN_ITEM) { *dList = NULL; - } else if (limbIndex == 8) { + } else if (limbIndex == TAKKURI_LIMB_NECK) { rot->z += this->unk_194; } @@ -1061,7 +1060,7 @@ void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s s8 idx; Collider_UpdateSpheres(limbIndex, &this->collider); - if ((limbIndex == 10) || (limbIndex == 11)) { + if ((limbIndex == TAKKURI_LIMB_RIGHT_EAR) || (limbIndex == TAKKURI_LIMB_LEFT_EAR)) { OPEN_DISPS(play->state.gfxCtx); gfx = POLY_OPA_DISP; @@ -1071,11 +1070,11 @@ void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s POLY_OPA_DISP = &gfx[2]; CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 16) { + } else if (limbIndex == TAKKURI_LIMB_STOLEN_ITEM) { if (this->unk_3E8 != NULL) { OPEN_DISPS(play->state.gfxCtx); - if (this->unk_3E8 == object_thiefbird_DL_0033B0) { + if (this->unk_3E8 == gTakkuriStolenBottleDL) { gfx = POLY_XLU_DISP; } else { gfx = POLY_OPA_DISP; @@ -1084,7 +1083,7 @@ void EnThiefbird_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfx[1], this->unk_3E8); - if (this->unk_3E8 == object_thiefbird_DL_0033B0) { + if (this->unk_3E8 == gTakkuriStolenBottleDL) { POLY_XLU_DISP = &gfx[2]; } else { POLY_OPA_DISP = &gfx[2]; @@ -1117,7 +1116,7 @@ void func_80C13354(EnThiefbird* this, PlayState* play2) { gfx = POLY_OPA_DISP; gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); - gSPDisplayList(&gfx[1], object_thiefbird_DL_003060); + gSPDisplayList(&gfx[1], gTakkuriFeatherMaterialDL); gfx = &gfx[2]; for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) { @@ -1130,7 +1129,7 @@ void func_80C13354(EnThiefbird* this, PlayState* play2) { Matrix_Scale(ptr->unk_18, ptr->unk_18, 1.0f, MTXMODE_APPLY); gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&gfx[1], object_thiefbird_DL_0030D8); + gSPDisplayList(&gfx[1], gTakkuriFeatherModelDL); gfx = &gfx[2]; } } diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h index 698d963be..1bbee73e0 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.h @@ -2,6 +2,7 @@ #define Z_EN_THIEFBIRD_H #include "global.h" +#include "objects/object_thiefbird/object_thiefbird.h" struct EnThiefbird; @@ -27,8 +28,8 @@ typedef struct EnThiefbird { /* 0x192 */ s16 unk_192; /* 0x194 */ s16 unk_194; /* 0x196 */ s16 unk_196[6]; - /* 0x1A2 */ Vec3s jointTable[17]; - /* 0x208 */ Vec3s morphTable[17]; + /* 0x1A2 */ Vec3s jointTable[TAKKURI_LIMB_MAX]; + /* 0x208 */ Vec3s morphTable[TAKKURI_LIMB_MAX]; /* 0x270 */ ColliderJntSph collider; /* 0x290 */ ColliderJntSphElement colliderElements[3]; /* 0x350 */ Vec3f limbPos[11]; 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 36d127711..b6dea09f3 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 @@ -263,7 +263,7 @@ void func_80ACA714(EnTimeTag* this, PlayState* play) { void func_80ACA724(EnTimeTag* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { - play->nextEntranceIndex = play->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; + play->nextEntrance = play->setupExitList[ENTIMETAG_GET_1F(&this->actor)]; 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 52ffa365f..60c4b4dd0 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -486,7 +486,7 @@ s32 func_80AECE60(EnTk* this, PlayState* play) { } if (!(this->unk_3CE & 8) && !(this->unk_2CA & 0x10) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8013E8F8(&this->actor, play, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); + func_8013E8F8(&this->actor, play, 100.0f, 100.0f, PLAYER_AP_NONE, 0x4000, 0x4000); } return false; @@ -696,10 +696,10 @@ void func_80AED940(EnTk* this, PlayState* play) { func_80AEDE10(this, play); } else if (!(this->unk_2CA & 0x80)) { if (this->actor.xzDistToPlayer < 100.0f) { - func_8013E8F8(&this->actor, play, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000); + func_8013E8F8(&this->actor, play, 100.0f, 100.0f, PLAYER_AP_NONE, 0x4000, 0x4000); } } else { - func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); + func_800B8500(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, PLAYER_AP_NONE); } } 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 753b5a664..473ff1edd 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -258,7 +258,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { if (this->unk2B6 != 0) { this->text = D_80BA5044; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 9999.9f, 9999.9f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 9999.9f, 9999.9f, PLAYER_AP_NONE); } else { this->actor.flags &= ~ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 50.0f); 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 5d2ffec87..6402e5920 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -64,7 +64,7 @@ void EnTrt_Blink(EnTrt* this); void EnTrt_OpenEyes2(EnTrt* this); void EnTrt_NodOff(EnTrt* this); -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -97,17 +97,17 @@ static ShopItem sShop[] = { { SI_POTION_BLUE, { -12, 32, -36 } }, }; -void EnTrt_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animations, s32 idx) { +void EnTrt_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { f32 frameCount; - animations += idx; - if (animations->frameCount < 0) { - frameCount = Animation_GetLastFrame(animations->animation); + animationInfo += animIndex; + if (animationInfo->frameCount < 0) { + frameCount = Animation_GetLastFrame(animationInfo->animation); } else { - frameCount = animations->frameCount; + frameCount = animationInfo->frameCount; } - Animation_Change(skelAnime, animations->animation, animations->playSpeed, animations->startFrame, frameCount, - animations->mode, animations->morphFrames); + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, + frameCount, animationInfo->mode, animationInfo->morphFrames); } s32 EnTrt_TestItemSelected(PlayState* play) { @@ -466,7 +466,7 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); this->actionFunc = EnTrt_ItemGiven; } } @@ -785,8 +785,8 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { } if (DECR(this->timer) == 0) { this->timer = 40; - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 1); - this->animationIndex = 1; + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 1); + this->animIndex = 1; this->actionFunc = EnTrt_IdleAwake; this->blinkFunc = EnTrt_OpenThenCloseEyes; } @@ -821,7 +821,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { if (player->transformation == PLAYER_FORM_HUMAN) { this->flags |= ENTRT_MET; } - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 2); + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2); this->blinkFunc = EnTrt_EyesClosed; this->timer = 45; this->actionFunc = EnTrt_BeginInteraction; @@ -831,8 +831,8 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { } if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(150, 100); - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 2); - this->animationIndex = 2; + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2); + this->animIndex = 2; this->sleepSoundTimer = 10; this->actor.textId = 0; this->actionFunc = EnTrt_IdleSleeping; @@ -852,10 +852,10 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { ActorCutscene_SetIntentToPlay(this->cutscene); } } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { - if (this->animationIndex != 5) { + if (this->animIndex != 5) { if (curFrame == animLastFrame) { - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 3); - this->animationIndex = 3; + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 3); + this->animIndex = 3; this->blinkFunc = EnTrt_OpenEyesThenSetToBlink; this->timer = 10; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; @@ -868,9 +868,9 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { } } else if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(40, 20); - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 5); + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5); Message_StartTextbox(play, this->textId, &this->actor); - this->animationIndex = 5; + this->animIndex = 5; switch (this->textId) { case 0x834: if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) && @@ -910,8 +910,8 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) { } } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { if (DECR(this->timer) == 0) { - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 4); - this->animationIndex = 4; + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 4); + this->animIndex = 4; this->blinkFunc = EnTrt_OpenEyes2; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_SURPRISED); this->timer = 30; @@ -919,9 +919,9 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) { } } else if (DECR(this->timer) == 0) { this->timer = Rand_S16Offset(40, 20); - EnTrt_ChangeAnim(&this->skelAnime, sAnimations, 5); + EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5); Message_StartTextbox(play, this->textId, &this->actor); - this->animationIndex = 5; + this->animIndex = 5; this->actionFunc = EnTrt_TryToGiveRedPotionAfterSurprised; } } @@ -1010,7 +1010,7 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { } func_80151938(play, this->textId); } else { - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1034,9 +1034,9 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { } if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (gSaveContext.save.weekEventReg[20] & 2) { - play->nextEntranceIndex = 0xC50; + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 5); } else { - play->nextEntranceIndex = 0x8450; + play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 5); } play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_64; @@ -1083,7 +1083,7 @@ void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play) { this->cutscene = this->lookToShopkeeperCutscene; ActorCutscene_SetIntentToPlay(this->cutscene); } - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); } } @@ -1106,7 +1106,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) { player->stateFlags2 |= 0x20000000; Message_StartTextbox(play, this->textId, &this->actor); EnTrt_SetupStartShopping(play, this, true); - func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1); + func_800B85E0(&this->actor, play, 400.0f, PLAYER_AP_MINUS1); break; case 1: default: @@ -1371,8 +1371,8 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { } } else if (talkState == TEXT_STATE_16) { itemGiven = func_80123810(play); - if (itemGiven > EXCH_ITEM_NONE) { - if (itemGiven == EXCH_ITEM_1E) { + if (itemGiven > PLAYER_AP_NONE) { + if (itemGiven == PLAYER_AP_BOTTLE_MUSHROOM) { if (gSaveContext.save.weekEventReg[53] & 8) { player->actor.textId = 0x888; } else { @@ -1391,7 +1391,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { this->actionFunc = EnTrt_Goodbye; } func_801477B4(play); - } else if (itemGiven < EXCH_ITEM_NONE) { + } else if (itemGiven < PLAYER_AP_NONE) { if (this->flags & ENTRT_GIVEN_MUSHROOM) { this->textId = 0x88B; } else { diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.h b/src/overlays/actors/ovl_En_Trt/z_en_trt.h index 13af94bcc..46f070797 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.h +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.h @@ -41,7 +41,7 @@ typedef struct EnTrt { /* 0x3F0 */ Color_RGBAu32 cursorColor; /* 0x400 */ u8 drawCursor; /* 0x402 */ s16 timer; - /* 0x404 */ s16 animationIndex; + /* 0x404 */ s16 animIndex; /* 0x406 */ u16 textId; /* 0x408 */ u16 prevTextId; /* 0x40A */ u16 talkOptionTextId; 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 0dd9da893..9e791dbea 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -26,7 +26,7 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play); void func_80AD5234(EnTrt2* this, PlayState* play); void func_80AD56E8(Actor* thisx, PlayState* play); -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, @@ -170,7 +170,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) { if (DECR(this->unk_3AE) == 0) { this->unk_3AE = Rand_S16Offset(20, 20); - func_80AD3380(&this->skelAnime, sAnimations, 7); + func_80AD3380(&this->skelAnime, sAnimationInfo, 7); this->unk_3B2 = 5; } } @@ -277,7 +277,7 @@ void func_80AD3A24(EnTrt2* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f); } else if (DECR(this->unk_3AE) == 0) { this->unk_3AE = Rand_S16Offset(100, 50); - func_80AD3380(&this->skelAnime, sAnimations, 6); + func_80AD3380(&this->skelAnime, sAnimationInfo, 6); this->unk_3B2 = 4; } Actor_MoveWithGravity(&this->actor); @@ -288,7 +288,7 @@ void func_80AD3AE4(EnTrt2* this, PlayState* play) { Math_ApproachF(&this->actor.velocity.y, 0.5f, 0.2f, 0.1f); } else { this->actor.velocity.y = 0.0f; - func_80AD3380(&this->skelAnime, sAnimations, 6); + func_80AD3380(&this->skelAnime, sAnimationInfo, 6); this->unk_3B2 = 4; } Actor_MoveWithGravity(&this->actor); @@ -298,7 +298,7 @@ void func_80AD3B6C(EnTrt2* this, PlayState* play) { if (DECR(this->unk_3B0) == 0) { this->unk_3B0 = 10; this->actor.velocity.y = -1.0f; - func_80AD3380(&this->skelAnime, sAnimations, 8); + func_80AD3380(&this->skelAnime, sAnimationInfo, 8); this->unk_3B2 = 8; } } @@ -311,7 +311,7 @@ void func_80AD3BE4(EnTrt2* this, PlayState* play) { this->actor.world.rot.y += this->unk_3C0; this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.world.pos.y < 5.0f) { - func_80AD3380(&this->skelAnime, sAnimations, 9); + func_80AD3380(&this->skelAnime, sAnimationInfo, 9); this->unk_3B2 = 9; } } @@ -335,7 +335,7 @@ void func_80AD3CEC(EnTrt2* this, PlayState* play) { } else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - func_80AD3380(&this->skelAnime, sAnimations, 6); + func_80AD3380(&this->skelAnime, sAnimationInfo, 6); this->unk_3B2 = 4; } } @@ -436,7 +436,7 @@ void func_80AD417C(EnTrt2* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; if (this->unk_3A8 == 0x84C) { - func_80AD3380(&this->skelAnime, sAnimations, 6); + func_80AD3380(&this->skelAnime, sAnimationInfo, 6); this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); this->unk_3B2 = 18; } else if (this->unk_3A8 == 0x88F) { @@ -510,7 +510,7 @@ void func_80AD4550(EnTrt2* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) { - func_80AD3380(&this->skelAnime, sAnimations, 7); + func_80AD3380(&this->skelAnime, sAnimationInfo, 7); this->unk_3B2 = 17; } @@ -665,7 +665,7 @@ s32 func_80AD4B4C(EnTrt2* this, PlayState* play) { } else { this->unk_3A8 = 0x84F; this->unk_3D8 = true; - func_80AD3380(&this->skelAnime, sAnimations, 7); + func_80AD3380(&this->skelAnime, sAnimationInfo, 7); this->unk_3B2 = 7; } } 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 943742da3..996a32bef 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -106,7 +106,7 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 20, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS D_80A8B2D8[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_tru_Anim_00F9A0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_tru_Anim_00F9A0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_tru_Anim_0108AC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, @@ -424,7 +424,7 @@ s32 func_80A86924(EnTru* this, s32 arg1) { if (arg1 != this->unk_37C) { this->unk_37C = arg1; - ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, D_80A8B2D8, arg1); + ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1); this->unk_358 = this->skelAnime.playSpeed; } @@ -994,7 +994,7 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { break; case 2: - func_801A75E8(NA_SE_EN_KOUME_MAGIC); + AudioSfx_StopById(NA_SE_EN_KOUME_MAGIC); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_AWAY); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOUME_LAUGH); func_80A86924(this, 13); @@ -1105,7 +1105,7 @@ void func_80A881E0(EnTru* this, PlayState* play) { void EnTru_Init(Actor* thisx, PlayState* play) { EnTru* this = THIS; - if ((gSaveContext.save.entranceIndex != 0xC200) || (gSaveContext.save.weekEventReg[12] & 8)) { + if ((gSaveContext.save.entrance != 0xC200) || (gSaveContext.save.weekEventReg[12] & 8)) { Actor_MarkForDeath(&this->actor); return; } @@ -1128,7 +1128,7 @@ void EnTru_Init(Actor* thisx, PlayState* play) { if (gSaveContext.save.weekEventReg[16] & 0x10) { func_80A86924(this, 5); } else { - this->unk_388 = EXCH_ITEM_NONE; + this->unk_388 = PLAYER_AP_NONE; } this->actionFunc = func_80A87FD0; @@ -1154,7 +1154,7 @@ void EnTru_Update(Actor* thisx, PlayState* play) { func_80A86DB8(this); radius = this->collider.dim.worldSphere.radius + 30; - this->unk_388 = !(this->unk_34E & 0x80) ? EXCH_ITEM_NONE : EXCH_ITEM_NONE; + this->unk_388 = !(this->unk_34E & 0x80) ? PLAYER_AP_NONE : PLAYER_AP_NONE; func_8013C964(&this->actor, play, radius, 20.0f, this->unk_388, this->unk_34E & 7); func_80A8697C(this, play); 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 f2159e4d3..ac772a940 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 @@ -87,7 +87,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -static AnimationInfoS D_80B7755C[] = { +static AnimationInfoS sAnimationInfo[] = { { &object_tru_Anim_00F9A0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_tru_Anim_00F9A0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &object_tru_Anim_0108AC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, @@ -115,19 +115,19 @@ s32 func_80B76030(SkelAnime* skelAnime, s16 arg1) { s16 startFrame; s32 ret = false; - if ((arg1 >= 0) && (arg1 < ARRAY_COUNT(D_80B7755C))) { - endFrame = D_80B7755C[arg1].frameCount; + if ((arg1 >= 0) && (arg1 < ARRAY_COUNT(sAnimationInfo))) { + endFrame = sAnimationInfo[arg1].frameCount; if (endFrame < 0) { - endFrame = Animation_GetLastFrame(D_80B7755C[arg1].animation); + endFrame = Animation_GetLastFrame(sAnimationInfo[arg1].animation); } - startFrame = D_80B7755C[arg1].startFrame; + startFrame = sAnimationInfo[arg1].startFrame; if (startFrame < 0) { - startFrame = Animation_GetLastFrame(D_80B7755C[arg1].animation); + startFrame = Animation_GetLastFrame(sAnimationInfo[arg1].animation); } - Animation_Change(skelAnime, D_80B7755C[arg1].animation, D_80B7755C[arg1].playSpeed, startFrame, endFrame, - D_80B7755C[arg1].mode, D_80B7755C[arg1].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[arg1].animation, sAnimationInfo[arg1].playSpeed, startFrame, + endFrame, sAnimationInfo[arg1].mode, sAnimationInfo[arg1].morphFrames); ret = true; } return ret; @@ -373,7 +373,7 @@ void func_80B76A64(EnTruMt* this, PlayState* play) { void func_80B76BB8(EnTruMt* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play)) { - play->nextEntranceIndex = 0xA810; + play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 1); 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 ddf924872..15d4cf3e5 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -5,6 +5,7 @@ */ #include "z_en_tsn.h" +#include "z64snap.h" #include "objects/object_tsn/object_tsn.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_2000000) @@ -324,12 +325,12 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { this->actionFunc = func_80AE0704; if (sp24 == 19) { if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { - if (func_8013A4C4(1 | 8)) { + if (Snap_CheckFlag(PICTOGRAPH_PIRATE_GOOD)) { player->actor.textId = 0x107B; return; } - if (func_8013A4C4(1 | 2 | 8)) { + if (Snap_CheckFlag(PICTOGRAPH_PIRATE_TOO_FAR)) { player->actor.textId = 0x10A9; return; } diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h index ce6137649..396918fdb 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.h @@ -10,7 +10,7 @@ typedef void (*EnTsnActionFunc)(struct EnTsn*, PlayState*); #define ENTSN_GET_F(thisx) ((thisx)->params & 0xF) #define ENTSN_GET_100(thisx) ((thisx)->params & 0x100) #define ENTSN_GET_Z(thisx) ((thisx)->home.rot.z) -#define ENTSN_SET_Z(thisx, state) ((thisx)->home.rot.z = state) +#define ENTSN_SET_Z(thisx, state) ((thisx)->home.rot.z = (state)) #define ENTSN_F_0 0 #define ENTSN_F_1 1 diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index ca6b6a419..43c2dc1e5 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -12,16 +12,17 @@ void EnViewer_Init(Actor* thisx, PlayState* play); void EnViewer_Destroy(Actor* thisx, PlayState* play); -void EnViewer_Update(Actor* thisx, PlayState* play); +void EnViewer_Update(Actor* thisx, PlayState* play2); void EnViewer_Draw(Actor* thisx, PlayState* play); void func_8089F17C(EnViewer* this, PlayState* play); void func_8089F218(EnViewer* this, PlayState* play); void func_8089F2C4(EnViewer* this, PlayState* play); -void EnViewer_SetupAction(EnViewer* this, EnViewerActionFunc actionFunc); +static u8 D_8089F3E0 = 0; + +static u8 D_8089F3E4 = 0; -#if 0 const ActorInit En_Viewer_InitVars = { ACTOR_EN_VIEWER, ACTORCAT_ITEMACTION, @@ -34,24 +35,124 @@ const ActorInit En_Viewer_InitVars = { (ActorFunc)EnViewer_Draw, }; -#endif +u32 D_8089F4D0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/EnViewer_SetupAction.s") +void EnViewer_SetupAction(EnViewer* this, EnViewerActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/EnViewer_Init.s") +void EnViewer_Init(Actor* thisx, PlayState* play) { + EnViewer* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/EnViewer_Destroy.s") + this->unk_154 = D_8089F3E0; + D_8089F3E0++; + switch (ENVIEWER_GET_3(&this->actor)) { + case ENVIEWER_PARAMS_0: + this->unk_148 = ENVIEWER_GET_8000(&this->actor) * 40.0f; + this->unk_150 = (u8)ENVIEWER_GET_1FC(&this->actor) * 40.0f; + EnViewer_SetupAction(this, func_8089F17C); + break; + case ENVIEWER_PARAMS_1: + this->unk_148 = (u16)ENVIEWER_GET_FE00(&this->actor) * 40.0f; + this->unk_150 = (u8)ENVIEWER_GET_1FC(&this->actor) * 40.0f; + this->unk_14C = (u16)(this->actor.world.rot.y) * 40.0f; + EnViewer_SetupAction(this, func_8089F218); + break; + case ENVIEWER_PARAMS_2: + this->unk_148 = (u16)ENVIEWER_GET_FE00(&this->actor) * 40.0f; + this->unk_14C = (u8)ENVIEWER_GET_1FC(&this->actor) * 40.0f; + EnViewer_SetupAction(this, func_8089F2C4); + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/func_8089F014.s") +void EnViewer_Destroy(Actor* thisx, PlayState* play) { + D_8089F3E0--; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/func_8089F0A0.s") +void func_8089F014(EnViewer* this, PlayState* play, f32 arg2) { + if (arg2 > 1.0f) { + arg2 = 1.0f; + } else if (arg2 < 0.0f) { + arg2 = 0.0f; + } + play->envCtx.lightSettingOverride = 0; + play->envCtx.unk_E0 = 2; + play->envCtx.unk_C1 = this->actor.world.rot.x; + play->envCtx.unk_C2 = this->actor.world.rot.z; + play->envCtx.lightBlend = arg2; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/func_8089F17C.s") +void func_8089F0A0(EnViewer* this, PlayState* play) { + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/func_8089F218.s") + D_8089F3E4++; + if ((D_8089F3E4 == D_8089F3E0) && (play->envCtx.lightSettingOverride != 255)) { + play->envCtx.lightSettingOverride = 255; + play->envCtx.unk_E0 = 0; + play->envCtx.lightBlend = 1.0f; + func_800FAAB4( + play, SurfaceType_GetLightSettingIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)); + play->envCtx.lightBlend = 1.0f; + play->envCtx.unk_C2 = play->envCtx.unk_C1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/func_8089F2C4.s") +void func_8089F17C(EnViewer* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 xzDist = fabsf(this->actor.xzDistToPlayer); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/EnViewer_Update.s") + if ((((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148)) && + (this->actor.playerHeightRel <= this->unk_150)) && + (this->actor.world.pos.y <= player->actor.world.pos.y)) { + xzDist = this->actor.playerHeightRel / this->unk_150; + func_8089F014(this, play, xzDist); + } else { + func_8089F0A0(this, play); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Viewer/EnViewer_Draw.s") +void func_8089F218(EnViewer* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 xzDist = fabsf(this->actor.xzDistToPlayer); + f32 temp; + + if ((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148) && + (this->actor.playerHeightRel <= this->unk_150) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { + temp = (xzDist - this->unk_14C) / (this->unk_148 - this->unk_14C); + func_8089F014(this, play, temp); + } else { + func_8089F0A0(this, play); + } +} + +void func_8089F2C4(EnViewer* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f sp20; + f32 temp; + + Actor_OffsetOfPointInActorCoords(&this->actor, &sp20, &player->actor.world.pos); + if (this->unk_14C == 0.0f) { + this->unk_14C = 0.1f; + } + if ((play->roomCtx.currRoom.num == this->actor.room) && (sp20.x < fabsf(this->unk_148))) { + temp = sp20.z / this->unk_14C; + func_8089F014(this, play, temp); + } else { + func_8089F0A0(this, play); + } +} + +void EnViewer_Update(Actor* thisx, PlayState* play2) { + PlayState* play = play2; + EnViewer* this = THIS; + + if (D_8089F4D0 != play->state.frames) { + D_8089F4D0 = play->state.frames; + D_8089F3E4 = 0; + } + this->actionFunc(this, play); +} + +void EnViewer_Draw(Actor* thisx, PlayState* play) { +} diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index 17cd47230..c4819f788 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -3,6 +3,11 @@ #include "global.h" +#define ENVIEWER_GET_3(thisx) ((thisx)->params & 3) +#define ENVIEWER_GET_FE00(thisx) ((thisx)->params >> 9) +#define ENVIEWER_GET_1FC(thisx) (((thisx)->params >> 2) & 0x7F) +#define ENVIEWER_GET_8000(thisx) (((thisx)->params & 0xFFFF) >> 9) + struct EnViewer; typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); @@ -10,9 +15,18 @@ typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); typedef struct EnViewer { /* 0x000 */ Actor actor; /* 0x144 */ EnViewerActionFunc actionFunc; - /* 0x148 */ char unk_148[0x10]; + /* 0x148 */ f32 unk_148; + /* 0x14C */ f32 unk_14C; + /* 0x150 */ f32 unk_150; + /* 0x154 */ u8 unk_154; } EnViewer; // size = 0x158 +typedef enum { + /* 0x0 */ ENVIEWER_PARAMS_0, + /* 0x1 */ ENVIEWER_PARAMS_1, + /* 0x2 */ ENVIEWER_PARAMS_2 +} EnViewerParams; + extern const ActorInit En_Viewer_InitVars; #endif // Z_EN_VIEWER_H diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index b59b68410..16cfa6a4b 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -247,7 +247,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { (player->actor.freezeTimer > 0) || !(player->actor.bgCheckFlags & 1) || ((WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_PROXIMITY) && (Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos) > (120.f + this->detectionRadius)))) { - func_801A75E8(NA_SE_EN_FALL_AIM); + AudioSfx_StopById(NA_SE_EN_FALL_AIM); this->timer = 130; } diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index e67d8a630..34c8db4bb 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -111,8 +111,8 @@ void func_80A66278(EnWarpUzu* this, PlayState* play) { } void func_80A66384(EnWarpUzu* this, PlayState* play) { - play->nextEntranceIndex = 0x22A0; - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; + play->nextEntrance = ENTRANCE(PIRATES_FORTRESS, 10); + gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = play->nextEntrance; func_80169EFC(&play->state); gSaveContext.respawnFlag = -2; this->actionFunc = EnWarpUzu_DoNothing; 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 3430e15f4..4f302e268 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 @@ -51,10 +51,10 @@ void EnWarptag_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetFocus(&this->dyna.actor, 0.0f); - if (GET_WARPTAG_3C0_MAX(thisx) == WARPTAG_3C0_MAX) { + if (WARPTAG_GET_3C0_MAX(thisx) == WARPTAG_3C0_MAX) { this->dyna.actor.flags &= ~ACTOR_FLAG_1; - if (GET_WARPTAG_INVISIBLE(&this->dyna.actor)) { + if (WARPTAG_GET_INVISIBLE(&this->dyna.actor)) { this->actionFunc = EnWarpTag_WaitForPlayer; } else { @@ -93,7 +93,7 @@ void EnWarpTag_CheckDungeonKeepObject(EnWarptag* this, PlayState* play) { void EnWarpTag_WaitForPlayer(EnWarptag* this, PlayState* play) { if (!Player_InCsMode(play) && (this->dyna.actor.xzDistToPlayer <= 30.0f) && (this->dyna.actor.playerHeightRel <= 10.0f)) { - if (GET_WARPTAG_INVISIBLE(&this->dyna.actor)) { + if (WARPTAG_GET_INVISIBLE(&this->dyna.actor)) { func_800B7298(play, NULL, 0x51); this->actionFunc = EnWarpTag_GrottoReturn; } else { @@ -112,8 +112,8 @@ void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { // this actor doesnt have that flag set default, or in init, and this is called shortly after init // and I doubt its set externally by another actor, so I believe this is unused // might be a bug, they might have meant to set actor flag (0x2000 0000) up above but mistyped (0x200 0000) - // also GET_WARPTAG_3C0 should always return 2C0 -> 0xF for all known in-game uses, which is OOB - func_80152434(play, D_809C1000[GET_WARPTAG_3C0(&this->dyna.actor)]); // unk message function + // also WARPTAG_GET_3C0 should always return 2C0 -> 0xF for all known in-game uses, which is OOB + func_80152434(play, D_809C1000[WARPTAG_GET_3C0(&this->dyna.actor)]); // unk message function this->actionFunc = EnWarpTag_Unused809C0A20; } else { @@ -144,7 +144,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { Player* player; s32 playerSpawnIndex; s32 new15E; - s32 entranceIndex; + s32 entrance; u32 playerSpawnIndexPerForm[PLAYER_FORM_MAX]; u8 playerForm; s16 playerParams; @@ -180,7 +180,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { player->actor.gravity = -0.5f; if (this->dyna.actor.playerHeightRel < -80.0f) { - playerSpawnIndexPerForm[PLAYER_FORM_FIERCE_DEITY] = GET_WARPTAG_EXIT_INDEX(&this->dyna.actor); + playerSpawnIndexPerForm[PLAYER_FORM_FIERCE_DEITY] = WARPTAG_GET_EXIT_INDEX(&this->dyna.actor); playerSpawnIndexPerForm[PLAYER_FORM_HUMAN] = playerSpawnIndexPerForm[PLAYER_FORM_FIERCE_DEITY]; playerSpawnIndexPerForm[PLAYER_FORM_GORON] = this->dyna.actor.world.rot.x; playerSpawnIndexPerForm[PLAYER_FORM_ZORA] = this->dyna.actor.world.rot.y; @@ -192,7 +192,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { playerForm = player->transformation; } - entranceIndex = gSaveContext.save.entranceIndex; + entrance = gSaveContext.save.entrance; playerSpawnIndex = playerSpawnIndexPerForm[playerForm]; playerActorEntry = &play->linkActorEntry[playerSpawnIndex]; @@ -200,7 +200,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { newRespawnPos.y = playerActorEntry->pos.y; newRespawnPos.z = playerActorEntry->pos.z; - if (GET_WARPTAG_3C0_MAX(&this->dyna.actor) == WARPTAG_3C0_MAX) { + if (WARPTAG_GET_3C0_MAX(&this->dyna.actor) == WARPTAG_3C0_MAX) { playerParams = 0x9FF; } else { // not used by any known variant playerParams = 0x8FF; @@ -209,7 +209,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { // why are we getting player home rotation from the room data? doesnt player have home.rot.y? // especially because we are converting from deg to binang, but isnt home.rot.y already in binang?? Play_SetRespawnData( - &play->state, 0, entranceIndex, // parameter 3 is called "sceneSetup" + &play->state, 0, entrance, // parameter 3 is called "sceneSetup" play->setupEntranceList[playerSpawnIndex].room, playerParams, &newRespawnPos, ((((playerActorEntry->rot.y >> 7) & 0x1FF) / 180.0f) * 32768.0f)); // DEG_TO_BINANG ? @@ -241,7 +241,7 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { } if (this->grottoExitDelay++ == 10) { - play->nextEntranceIndex = play->setupExitList[GET_WARPTAG_EXIT_INDEX(&this->dyna.actor)]; + play->nextEntrance = play->setupExitList[WARPTAG_GET_EXIT_INDEX(&this->dyna.actor)]; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h index 8bc521f15..ea7eff8ab 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.h @@ -24,10 +24,10 @@ extern const ActorInit En_Warp_tag_InitVars; // Goron Trial (MOON): 0x03C1 // Deku Playground: 0x83C0 -#define GET_WARPTAG_3C0_MAX(thisx) ((thisx)->params & 0x3C0) -#define GET_WARPTAG_3C0(thisx) (((thisx)->params >> 6) & 0xF) -#define GET_WARPTAG_EXIT_INDEX(thisx) ((thisx)->params & 0x3F) -#define GET_WARPTAG_INVISIBLE(thisx) ((thisx)->params < 0) // 0x8000 flag +#define WARPTAG_GET_3C0_MAX(thisx) ((thisx)->params & 0x3C0) +#define WARPTAG_GET_3C0(thisx) (((thisx)->params >> 6) & 0xF) +#define WARPTAG_GET_EXIT_INDEX(thisx) ((thisx)->params & 0x3F) +#define WARPTAG_GET_INVISIBLE(thisx) ((thisx)->params < 0) // 0x8000 flag #define WARPTAG_3C0_MAX 0x3C0 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 3969f9c6e..752447a5d 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 @@ -69,7 +69,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { // flag: is targetable. Should do nothing as not set by default above this->actor.flags &= ~ACTOR_FLAG_1; - switch (WEATHER_TAG_TYPE(this)) { + switch (WEATHER_TAG_TYPE(&this->actor)) { case WEATHERTAG_TYPE_UNK0: this->unk154 = 0; this->fadeDistance = this->actor.world.rot.x; @@ -101,7 +101,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966BF4); break; case WEATHERTAG_TYPE_WATERMURK: - pathID = WEATHER_TAG_PATHID(this); + pathID = WEATHER_TAG_PATHID(&this->actor); path = &play->setupPathList[pathID]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; @@ -119,7 +119,7 @@ u8 func_80966608(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, Player* player = GET_PLAYER(play); u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { + if (WEATHER_TAG_RANGE100(&this->actor) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { @@ -147,7 +147,7 @@ u8 func_80966758(EnWeatherTag* this, PlayState* play, UNK_TYPE a3, UNK_TYPE a4, Player* player = GET_PLAYER(play); u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { + if (WEATHER_TAG_RANGE100(&this->actor) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { if (play->envCtx.unk_1F == play->envCtx.unk_20) { D_801BDBB8 = 1; if (!(play->envCtx.unk_1E == 0) || ((play->envCtx.unk_1F != 1) && (play->envCtx.unk_21 == 0))) { @@ -199,7 +199,7 @@ void func_8096689C(EnWeatherTag* this, PlayState* play) { // WEATHERTAG_TYPE_UNK0 void func_80966A08(EnWeatherTag* this, PlayState* play) { this->unk154 += this->unk158; - if (this->unk154 >= 0x8001) { + if (this->unk154 > 0x8000) { this->unk154 = 0x8000; EnWeatherTag_SetupAction(this, func_80966A68); } @@ -346,7 +346,7 @@ void func_80966F74(EnWeatherTag* this, PlayState* play) { // all of them have shorter distances though, like 0xA and 0x6, so their locations are important void func_80966FEC(EnWeatherTag* this, PlayState* play) { // weirdly, not the same as the other param lookup used in the rest of the file, which is float - s32 distance = WEATHER_TAG_RANGE100INT(this); + s32 distance = WEATHER_TAG_RANGE100INT(&this->actor); if (distance > 0) { D_801F4E7A = distance; } @@ -359,17 +359,18 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) { // type 4_2 pirates fortres only? void func_80967060(EnWeatherTag* this, PlayState* play) { - Vec3f vec1; - Vec3f vec2; + Vec3f worldPos; + Vec3f screenPos; - vec1.x = 1055.0f; - vec1.y = -145.0f; - vec1.z = 181.0f; + worldPos.x = 1055.0f; + worldPos.y = -145.0f; + worldPos.z = 181.0f; - func_80169474(play, &vec1, &vec2); + Play_GetScreenPos(play, &worldPos, &screenPos); if (play->view.fovy < 25.0f) { - if ((vec2.x >= 70.0f) && (vec2.x < 250.0f) && (vec2.y >= 30.0f) && (vec2.y < 210.0f)) { + if ((screenPos.x >= 70.0f) && (screenPos.x < (SCREEN_WIDTH - 70.0f)) && (screenPos.y >= 30.0f) && + (screenPos.y < (SCREEN_HEIGHT - 30.0f))) { EnWeatherTag_SetupAction(this, func_80967148); } } @@ -423,7 +424,7 @@ void func_809672DC(EnWeatherTag* this, PlayState* play) { &this->actor.world.pos, false); distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); - range = WEATHER_TAG_RANGE100(this); + range = WEATHER_TAG_RANGE100(&this->actor); if (distance < range) { play->envCtx.sandstormState = 6; @@ -447,7 +448,7 @@ void func_809672DC(EnWeatherTag* this, PlayState* play) { void func_809674C8(EnWeatherTag* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { + if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(&this->actor)) { if (CURRENT_DAY == 2) { if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && (play->envCtx.unk_F2[2] == 0)) { @@ -470,7 +471,8 @@ 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)) { + if ((WEATHER_TAG_RANGE100(&this->actor) + 10.0f) < + Actor_XZDistanceBetweenActors(&GET_PLAYER(play)->actor, &this->actor)) { gWeatherMode = 0; EnWeatherTag_SetupAction(this, func_809674C8); } 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 fe18c8e1b..84aa36b03 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 @@ -21,10 +21,10 @@ typedef struct EnWeatherTag { extern const ActorInit En_Weather_Tag_InitVars; -#define WEATHER_TAG_TYPE(x) (x->actor.params & 0xF) -#define WEATHER_TAG_PATHID(x) (x->actor.params >> 4 & 0xF) -#define WEATHER_TAG_RANGE100(x) ((u8)(((x->actor.params >> 8) & 0xFF)) * 100.0f) -#define WEATHER_TAG_RANGE100INT(x) ((u8)(((x->actor.params >> 8))) * 100) +#define WEATHER_TAG_TYPE(thisx) ((thisx)->params & 0xF) +#define WEATHER_TAG_PATHID(thisx) (((thisx)->params >> 4) & 0xF) +#define WEATHER_TAG_RANGE100(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100.0f) +#define WEATHER_TAG_RANGE100INT(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100) typedef enum { /* 0 */ WEATHERTAG_TYPE_UNK0, 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 d694d186c..d28a06fa0 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -29,7 +29,7 @@ void EnYb_TeachingDance(EnYb* this, PlayState* play); void EnYb_WaitForMidnight(EnYb* this, PlayState* play); void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play); -void EnYb_SetAnimation(PlayState*, EnYb*, s16, u8, f32); +void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 morphFrames); s32 EnYb_CanTalk(EnYb* this, PlayState* play); const ActorInit En_Yb_InitVars = { @@ -93,11 +93,11 @@ void EnYb_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actionFunc = EnYb_Idle; - this->currentAnimIndex = 3; // gets overwritten to 2 in EnYb_SetAnimation later + this->animIndex = 3; // gets overwritten to 2 in EnYb_ChangeAnim later this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - EnYb_SetAnimation(play, this, 2, ANIMMODE_LOOP, 0.0f); + EnYb_ChangeAnim(play, this, 2, ANIMMODE_LOOP, 0.0f); tempCutscene = this->actor.cutscene; for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { @@ -147,7 +147,7 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { EnYb* this = THIS; if (this->alpha > 0) { - if (this->currentAnimIndex == 2) { + if (this->animIndex == 2) { f32 tempScale = (((27.0f - this->shadowPos.y) + this->actor.world.pos.y) * ((1 / 2.25f) * 0.001f)) + 0.01f; this->actor.scale.x = tempScale; } @@ -167,19 +167,19 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { } } -void EnYb_SetAnimation(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 transitionRate) { +void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 morphFrames) { if (animIndex >= 0 && animIndex < 3) { - if (animIndex != this->currentAnimIndex || animMode != ANIMMODE_LOOP) { + if (animIndex != this->animIndex || animMode != ANIMMODE_LOOP) { if (animIndex > 0) { if (animMode == ANIMMODE_LOOP) { LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, - transitionRate); + morphFrames); } else { // unused case, (only called once with animMode = ANIMMODE_LOOP) LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, - transitionRate); + morphFrames); } } else { // unused case, (only called once with animIndex = 2) @@ -188,9 +188,9 @@ void EnYb_SetAnimation(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, if (1) {} Animation_Change(&this->skelAnime, gYbUnusedAnimations[animIndex], 1.0f, 0.0f, - Animation_GetLastFrame(animationPtr), animMode, transitionRate); + Animation_GetLastFrame(animationPtr), animMode, morphFrames); } - this->currentAnimIndex = animIndex; + this->animIndex = animIndex; } } } @@ -205,7 +205,7 @@ s32 EnYb_CanTalk(EnYb* this, PlayState* play) { } void EnYb_UpdateAnimation(EnYb* this, PlayState* play) { - if (this->currentAnimIndex <= 0) { + if (this->animIndex <= 0) { SkelAnime_Update(&this->skelAnime); } else { LinkAnimation_Update(play, &this->skelAnime); @@ -263,7 +263,7 @@ void EnYb_SetupLeaving(EnYb* this, PlayState* play) { Message_StartTextbox(play, 0x147D, &this->actor); func_80BFA2FC(play); } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } EnYb_EnableProximityMusic(this); } @@ -275,7 +275,7 @@ void EnYb_ReceiveMask(EnYb* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = EnYb_SetupLeaving; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { Actor_PickUp(&this->actor, play, GI_MASK_KAMARO, 10000.0f, 100.0f); } @@ -326,7 +326,7 @@ void EnYb_TeachingDanceFinish(EnYb* this, PlayState* play) { Message_StartTextbox(play, 0x147C, &this->actor); this->actor.flags &= ~ACTOR_FLAG_10000; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } EnYb_EnableProximityMusic(this); } @@ -341,7 +341,7 @@ void EnYb_TeachingDance(EnYb* this, PlayState* play) { EnYb_FinishTeachingCutscene(this); this->actionFunc = EnYb_TeachingDanceFinish; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } EnYb_EnableProximityMusic(this); } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.h b/src/overlays/actors/ovl_En_Yb/z_en_yb.h index 72d92d817..c7b977653 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.h +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.h @@ -18,7 +18,7 @@ typedef struct EnYb { /* 0x3B8 */ ColliderCylinder collider; /* 0x404 */ Vec3f shadowPos; /* 0x410 */ u16 playerOcarinaOut; - /* 0x412 */ s16 currentAnimIndex; + /* 0x412 */ s16 animIndex; /* 0x414 */ s16 alpha; /* 0x416 */ s16 cutscenes[2]; /* 0x41A */ s16 cutsceneIndex; 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 68051705e..c4bf8f56d 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -88,7 +88,7 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0), }; -static AnimationInfoS sAnimations[] = { +static AnimationInfoS sAnimationInfo[] = { { &gZoraIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gZoraIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, { &gZoraSurfacingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, @@ -102,19 +102,19 @@ s8 sBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1 s8 sParentBodyParts[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 }; u8 sShadowSizes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -s32 EnZo_SetAnimation(SkelAnime* skelAnime, s16 index) { +s32 EnZo_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s16 frameCount; s32 didChange = false; - if ((index >= 0) && (index < ARRAY_COUNT(sAnimations))) { + if ((animIndex >= 0) && (animIndex < ARRAY_COUNT(sAnimationInfo))) { didChange = true; - frameCount = sAnimations[index].frameCount; + frameCount = sAnimationInfo[animIndex].frameCount; if (frameCount < 0) { - frameCount = Animation_GetLastFrame(sAnimations[index].animation); + frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); } - Animation_Change(skelAnime, sAnimations[index].animation, sAnimations[index].playSpeed, - sAnimations[index].startFrame, frameCount, sAnimations[index].mode, - sAnimations[index].morphFrames); + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); } return didChange; } @@ -206,7 +206,7 @@ void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { void EnZo_Walk(EnZo* this, PlayState* play) { if (ENZO_GET_PATH(&this->actor) != 0x3F) { - EnZo_SetAnimation(&this->skelAnime, 6); + EnZo_ChangeAnim(&this->skelAnime, 6); } if (ENZO_GET_PATH(&this->actor) != 0x3F) { @@ -230,7 +230,7 @@ void EnZo_FollowPath(EnZo* this, PlayState* play) { } if (this->actor.depthInWater > 60.0f) { - EnZo_SetAnimation(&this->skelAnime, 1); + EnZo_ChangeAnim(&this->skelAnime, 1); this->actionFunc = EnZo_TreadWater; this->actor.gravity = 0.0f; this->actor.speedXZ = 0.0f; @@ -257,7 +257,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, ZORA_LIMB_MAX); - EnZo_SetAnimation(&this->skelAnime, 0); + EnZo_ChangeAnim(&this->skelAnime, 0); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); 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 cf1913e1c..1419a7ecd 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -227,7 +227,7 @@ void func_80BBB2C4(EnZos* this, PlayState* play) { this->actionFunc = func_80BBB8AC; this->actor.flags &= ~ACTOR_FLAG_10000; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -239,7 +239,7 @@ void func_80BBB354(EnZos* this, PlayState* play) { this->actionFunc = func_80BBB2C4; gSaveContext.save.weekEventReg[39] |= 0x20; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { if (gSaveContext.save.weekEventReg[39] & 0x20) { getItemId = GI_RUPEE_PURPLE; @@ -498,7 +498,7 @@ void func_80BBBCBC(EnZos* this, PlayState* play) { Message_StartTextbox(play, 0x124D, &this->actor); this->actionFunc = func_80BBB574; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -507,7 +507,7 @@ void func_80BBBD5C(EnZos* this, PlayState* play) { if (!Cutscene_CheckActorAction(play, 0x1F5)) { this->actionFunc = func_80BBBCBC; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } 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 0933d2240..bced0c6f3 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -5,6 +5,7 @@ */ #include "z_en_zot.h" +#include "z64snap.h" #include "objects/object_zo/object_zo.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -515,7 +516,7 @@ void func_80B975F8(EnZot* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80B973BC; } else { - func_800B8500(&this->actor, play, 10000.0f, 1000.0f, EXCH_ITEM_NONE); + func_800B8500(&this->actor, play, 10000.0f, 1000.0f, PLAYER_AP_NONE); } } @@ -930,7 +931,7 @@ void func_80B9849C(EnZot* this, PlayState* play) { } this->actionFunc = func_80B98728; } else { - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } } @@ -940,7 +941,7 @@ void func_80B9854C(EnZot* this, PlayState* play) { this->actor.parent = NULL; this->actionFunc = func_80B9849C; this->actor.flags |= ACTOR_FLAG_10000; - func_800B8500(&this->actor, play, 1000.0f, 1000.0f, EXCH_ITEM_MINUS1); + func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_AP_MINUS1); } else { Actor_PickUp(&this->actor, play, this->unk_2D4, 10000.0f, 50.0f); } @@ -955,8 +956,9 @@ void func_80B985EC(EnZot* this, PlayState* play) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { func_801477B4(play); - if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && func_8013A4C4(4)) { - if (func_8013A4C4(5) && func_8013A4C4(6)) { + if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && + Snap_CheckFlag(PICTOGRAPH_LULU_HEAD)) { + if (Snap_CheckFlag(PICTOGRAPH_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTOGRAPH_LULU_LEFT_ARM)) { player->actor.textId = 0x12AE; } else { player->actor.textId = 0x12AC; @@ -1103,14 +1105,14 @@ void func_80B98AD0(EnZot* this, PlayState* play) { func_801477B4(play); this->actionFunc = func_80B98CA8; gSaveContext.save.weekEventReg[41] &= (u8)~0x20; - AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; case 0x12BA: func_801477B4(play); this->actionFunc = func_80B98CA8; gSaveContext.save.weekEventReg[41] |= 0x20; - AudioOcarina_SetInstrumentId(OCARINA_INSTRUMENT_OFF); + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); break; default: 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 e026843e2..05726ddce 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -26,7 +26,7 @@ void func_80BD1C84(EnZov* this, PlayState* play); void func_80BD1D94(EnZov* this, PlayState* play); void func_80BD1DB8(EnZov* this, PlayState* play); void func_80BD1F1C(EnZov* this, PlayState* play); -s32 func_80BD1FC8(PlayState* play, EnZov* this); +s32 EnZov_ValidatePictograph(PlayState* play, Actor* thisx); const ActorInit En_Zov_InitVars = { ACTOR_EN_ZOV, @@ -82,10 +82,10 @@ static s8 D_80BD2770[] = { void EnZov_Init(Actor* thisx, PlayState* play) { EnZov* this = THIS; - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - Actor_SetScale(&this->actor, 0.01f); - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); + this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; + Actor_SetScale(&this->picto.actor, 0.01f); + Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); SkelAnime_InitFlex(play, &this->skelAnime, &object_zov_Skel_016258, &object_zov_Anim_00D3EC, this->jontTable, this->morphTable, 23); Animation_PlayLoop(&this->skelAnime, &object_zov_Anim_00D3EC); @@ -93,35 +93,35 @@ void EnZov_Init(Actor* thisx, PlayState* play) { this->unk_320 = 0; this->unk_32C = -1; this->unk_326 = -1; - this->unk_328[0] = this->actor.cutscene; + this->unk_328[0] = this->picto.actor.cutscene; this->unk_328[1] = 0x7C; this->unk_322 = 0; this->actionFunc = func_80BD1C84; - this->unk_144 = func_80BD1FC8; + this->picto.validationFunc = EnZov_ValidatePictograph; - Math_Vec3f_Copy(&this->unk_2FC, &this->actor.world.pos); - Math_Vec3f_Copy(&this->unk_308, &this->actor.world.pos); - Math_Vec3f_Copy(&this->unk_314, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_2FC, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->unk_308, &this->picto.actor.world.pos); + Math_Vec3f_Copy(&this->unk_314, &this->picto.actor.world.pos); - switch (ENZOV_GET_F(&this->actor)) { + switch (ENZOV_GET_F(&this->picto.actor)) { case ENZOV_F_1: this->actionFunc = func_80BD1F1C; func_80BD1570(this, 9, ANIMMODE_LOOP); if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); return; } break; case ENZOV_F_2: this->actionFunc = func_80BD1C38; - this->actor.shape.shadowDraw = NULL; + this->picto.actor.shape.shadowDraw = NULL; break; default: this->unk_320 |= 2; if ((gSaveContext.save.weekEventReg[55] & 0x80) || (gSaveContext.save.weekEventReg[53] & 0x20)) { - Actor_MarkForDeath(&this->actor); + Actor_MarkForDeath(&this->picto.actor); } break; } @@ -175,8 +175,8 @@ void func_80BD1570(EnZov* this, s16 index, u8 mode) { } s32 func_80BD15A4(EnZov* this, PlayState* play) { - if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && - Actor_IsFacingPlayer(&this->actor, 0x3000)) { + if ((this->picto.actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->picto.actor, 0x3000, play) && + Actor_IsFacingPlayer(&this->picto.actor, 0x3000)) { return true; } return false; @@ -213,7 +213,7 @@ void func_80BD160C(EnZov* this, PlayState* play) { this->unk_320 |= 1; if (textId != 0) { - Message_StartTextbox(play, textId, &this->actor); + Message_StartTextbox(play, textId, &this->picto.actor); } } @@ -314,9 +314,9 @@ void func_80BD19FC(EnZov* this, PlayState* play) { this->unk_324--; } else { func_80BD13DC(this); - Message_StartTextbox(play, 0x1021, &this->actor); + Message_StartTextbox(play, 0x1021, &this->picto.actor); ((EnElf*)(GET_PLAYER(play)->tatlActor))->unk_264 |= 4; - Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); + Actor_ChangeFocus(&this->picto.actor, play, GET_PLAYER(play)->tatlActor); this->actionFunc = func_80BD187C; } } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { @@ -367,18 +367,18 @@ void func_80BD1BF0(EnZov* this, PlayState* play) { void func_80BD1C38(EnZov* this, PlayState* play) { if (func_80BD1AE0(this, play)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 504)); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 504)); } } void func_80BD1C84(EnZov* this, PlayState* play) { func_80BD1764(this); - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = func_80BD187C; func_80BD160C(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + func_800B8614(&this->picto.actor, play, 120.0f); } if (Cutscene_CheckActorAction(play, 0x1F8)) { @@ -399,7 +399,7 @@ void func_80BD1D30(EnZov* this, PlayState* play) { } else { textId = 0x1031; } - Message_StartTextbox(play, textId, &this->actor); + Message_StartTextbox(play, textId, &this->picto.actor); } void func_80BD1D94(EnZov* this, PlayState* play) { @@ -408,8 +408,8 @@ void func_80BD1D94(EnZov* this, PlayState* play) { void func_80BD1DB8(EnZov* this, PlayState* play) { func_80BD1764(this); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); - this->actor.world.rot.y = this->actor.shape.rot.y; + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 2, 0x1000, 0x200); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { @@ -423,7 +423,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { break; case 0x1039: - play->nextEntranceIndex = play->setupExitList[ENZOV_GET_FE00(&this->actor)]; + play->nextEntrance = play->setupExitList[ENZOV_GET_FE00(&this->picto.actor)]; play->transitionType = TRANS_TYPE_05; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.weekEventReg[78] |= 1; @@ -443,26 +443,29 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { void func_80BD1F1C(EnZov* this, PlayState* play) { func_80BD1764(this); - if (this->actor.home.rot.y != this->actor.shape.rot.y) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200); - this->actor.world.rot.y = this->actor.shape.rot.y; + if (this->picto.actor.home.rot.y != this->picto.actor.shape.rot.y) { + Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 2, 0x1000, 0x200); + this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { + if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { this->actionFunc = func_80BD1DB8; func_80BD1D30(this, play); } else if (func_80BD15A4(this, play)) { - func_800B8614(&this->actor, play, 120.0f); + func_800B8614(&this->picto.actor, play, 120.0f); } } -s32 func_80BD1FC8(PlayState* play, EnZov* this) { +s32 EnZov_ValidatePictograph(PlayState* play, Actor* thisx) { s32 ret; - s32 pad; + EnZov* this = THIS; - ret = func_8013A530(play, &this->actor, 4, &this->actor.focus.pos, &this->actor.shape.rot, 10.0f, 300.0f, -1); - ret |= func_8013A530(play, &this->actor, 5, &this->unk_308, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); - ret |= func_8013A530(play, &this->actor, 6, &this->unk_314, &this->actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret = Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_HEAD, &this->picto.actor.focus.pos, + &this->picto.actor.shape.rot, 10.0f, 300.0f, -1); + ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_RIGHT_ARM, &this->unk_308, + &this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000); + ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_LEFT_ARM, &this->unk_314, + &this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000); return ret; } @@ -470,10 +473,10 @@ void EnZov_Update(Actor* thisx, PlayState* play) { s32 pad; EnZov* this = THIS; - Actor_MoveWithGravity(&this->actor); - Collider_UpdateCylinder(&this->actor, &this->collider); + Actor_MoveWithGravity(&this->picto.actor); + Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 10.0f, 10.0f, 10.0f, 4); this->actionFunc(this, play); @@ -482,7 +485,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { } if ((this->unk_320 & 1) && func_80BD15A4(this, play)) { - Actor_TrackPlayer(play, &this->actor, &this->unk_2F0, &this->unk_2F6, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->picto.actor, &this->unk_2F0, &this->unk_2F6, this->picto.actor.focus.pos); } else { if ((this->unk_320 & 0x10) && (this->unk_322 == 0)) { Math_SmoothStepToS(&this->unk_2F0.x, -0x1B58, 6, 0x1838, 0x64); @@ -508,7 +511,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { ActorCutscene_Stop(0x7C); ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); } else if (ActorCutscene_GetCanPlayNext(this->unk_328[this->unk_32C])) { - ActorCutscene_Start(this->unk_328[this->unk_32C], &this->actor); + ActorCutscene_Start(this->unk_328[this->unk_32C], &this->picto.actor); } else { ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); } @@ -535,8 +538,8 @@ void EnZov_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnZov* this = THIS; if (limbIndex == 12) { - Matrix_MultVec3f(&D_80BD2744, &this->actor.focus.pos); - Math_Vec3f_Copy(&this->unk_2FC, &this->actor.focus.pos); + Matrix_MultVec3f(&D_80BD2744, &this->picto.actor.focus.pos); + Math_Vec3f_Copy(&this->unk_2FC, &this->picto.actor.focus.pos); this->unk_2FC.y += 10.0f; } @@ -629,5 +632,5 @@ void EnZov_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnZov_OverrideLimbDraw, EnZov_PostLimbDraw, &this->actor); + EnZov_OverrideLimbDraw, EnZov_PostLimbDraw, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.h b/src/overlays/actors/ovl_En_Zov/z_en_zov.h index cabb82b43..25966f994 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.h +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.h @@ -2,11 +2,11 @@ #define Z_EN_ZOV_H #include "global.h" +#include "z64snap.h" struct EnZov; typedef void (*EnZovActionFunc)(struct EnZov*, PlayState*); -typedef s32 (*EnZovUnkFunc)(PlayState*, struct EnZov*); #define ENZOV_GET_F(thisx) ((thisx)->params & 0xF) #define ENZOV_GET_FE00(thisx) (((thisx)->params & 0xFE00) >> 9) @@ -15,8 +15,7 @@ typedef s32 (*EnZovUnkFunc)(PlayState*, struct EnZov*); #define ENZOV_F_2 2 typedef struct EnZov { - /* 0x000 */ Actor actor; - /* 0x144 */ EnZovUnkFunc unk_144; + /* 0x000 */ PictoActor picto; /* 0x148 */ Vec3s jontTable[23]; /* 0x1D2 */ Vec3s morphTable[23]; /* 0x25C */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h index ccf7b43bd..b89e10edd 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h @@ -7,7 +7,7 @@ struct ItemBHeart; typedef struct ItemBHeart { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x20]; + /* 0x144 */ UNK_TYPE1 unk_144[0x20]; /* 0x164 */ f32 unk_164; /* 0x168 */ f32 unk_168; } ItemBHeart; // size = 0x16C diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c index 6acbc2689..215b63776 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c @@ -15,7 +15,6 @@ void MirRay2_Destroy(Actor* thisx, PlayState* play); void MirRay2_Update(Actor* thisx, PlayState* play); void MirRay2_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Mir_Ray2_InitVars = { ACTOR_MIR_RAY2, ACTORCAT_ITEMACTION, @@ -28,33 +27,102 @@ const ActorInit Mir_Ray2_InitVars = { (ActorFunc)MirRay2_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80AF4350[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0x00200000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x00200000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 0, { { 0, 0, 0 }, 50 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80AF4374 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_OTHER, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_80AF4350, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_OTHER, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; -#endif +void func_80AF3F70(MirRay2* this) { + this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements->dim.worldSphere.center.y = this->actor.world.pos.y; + this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; + this->collider.elements->dim.worldSphere.radius = this->range * this->collider.elements->dim.scale; +} -extern ColliderJntSphElementInit D_80AF4350[1]; -extern ColliderJntSphInit D_80AF4374; +void func_80AF3FE0(MirRay2* this, PlayState* play) { + if (this->actor.xzDistToPlayer < this->range) { + Math_StepToS(&this->radius, 150, 50); + } else { + Math_StepToS(&this->radius, 0, 50); + } + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, + this->actor.world.pos.z, 255, 255, 255, this->radius); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3F70.s") +void MirRay2_Init(Actor* thisx, PlayState* play) { + s32 pad; + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3FE0.s") + if (this->actor.home.rot.x <= 0) { + this->range = 100.0f; + } else { + this->range = this->actor.home.rot.x * 4.0f; + } + Actor_SetScale(&this->actor, 1.0f); + if (MIRRAY2_GET_F(&this->actor) != 1) { + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawWhiteCircle, this->range * 0.02f); + } + func_80AF3FE0(this, play); + this->light = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->elements); + func_80AF3F70(this); + this->actor.shape.rot.x = 0; + this->actor.world.rot.x = this->actor.shape.rot.x; + if (MIRRAY2_GET_F(thisx) != 1) { + if ((MIRRAY2_GET_SWITCH_FLAGS(thisx) != 0x7F) && !Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) { + this->unk1A4 |= 1; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Init.s") +void MirRay2_Destroy(Actor* thisx, PlayState* play) { + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Destroy.s") + LightContext_RemoveLight(play, &play->lightCtx, this->light); + Collider_DestroyJntSph(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Update.s") +void MirRay2_Update(Actor* thisx, PlayState* play) { + MirRay2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Draw.s") + if (this->unk1A4 & 1) { + if (Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) { + this->unk1A4 &= ~1; + } + } else { + func_80AF3FE0(this, play); + if (MIRRAY2_GET_F(thisx) != 1) { + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + this->actor.shape.shadowAlpha = 0x50; + } else { + func_80AF3F70(this); + } + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } +} + +void MirRay2_Draw(Actor* thisx, PlayState* play) { +} diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h index 26f478ea3..ac5202bdb 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h @@ -5,9 +5,18 @@ struct MirRay2; +#define MIRRAY2_GET_F(thisx) ((thisx)->params & 0xF) +#define MIRRAY2_GET_SWITCH_FLAGS(thisx) (((thisx)->params & 0xFE00) >> 9) + typedef struct MirRay2 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x7C]; + /* 0x144 */ ColliderJntSph collider; + /* 0x164 */ ColliderJntSphElement elements; + /* 0x1A4 */ u16 unk1A4; + /* 0x1A6 */ s16 radius; + /* 0x1A8 */ f32 range; + /* 0x1AC */ LightNode* light; + /* 0x1B0 */ LightInfo lightInfo; } MirRay2; // size = 0x1C0 extern const ActorInit Mir_Ray2_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 7c7359040..f0049800d 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -288,8 +288,10 @@ void ObjAqua_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZS(rotation * -1, MTXMODE_APPLY); Matrix_Scale(10.0f / 13.0f, 1.0f, 1.0f, MTXMODE_APPLY); } + Matrix_RotateYS(yaw, 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); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 55ff4fe14..c13fde9b0 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -545,7 +545,7 @@ void func_80937FC8(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { - if (Player_GetExchangeItemId(play) == EXCH_ITEM_2E) { + if (Player_GetExchangeItemId(play) == PLAYER_AP_MAGIC_BEANS) { func_809383B4(this); Flags_SetSwitch(play, OBJBEAN_GET_3F80(&this->dyna.actor, 0)); } diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h index 76265bcec..c55381ad3 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.h @@ -14,10 +14,10 @@ typedef struct ObjBell { /* 0x210 */ s16 unk_210; /* 0x212 */ s16 unk_212; /* 0x214 */ s16 unk_214; - /* 0x216 */ char unk_216[0x06]; + /* 0x216 */ UNK_TYPE1 unk_216[0x06]; /* 0x21C */ f32 unk_21C; // bell speed? /* 0x220 */ f32 unk_220; - /* 0x224 */ char unk_224[0x04]; + /* 0x224 */ UNK_TYPE1 unk_224[0x04]; } ObjBell; // size = 0x228 extern const ActorInit Obj_Bell_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 7bfeaf96c..8e555a19f 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -231,7 +231,7 @@ void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { } this->actor.shape.rot.z = (Math_SinS(this->unk1D4) * this->unk1D0); if ((this->stateFlags & OBJCHAN_STATE_START_CUTSCENE) && - SubS_StartActorCutscene(&this->actor, this->cutscenes[0], -1, 0)) { + SubS_StartActorCutscene(&this->actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->stateFlags |= OBJCHAN_STATE_CUTSCENE; this->stateFlags &= ~OBJCHAN_STATE_START_CUTSCENE; } @@ -429,7 +429,7 @@ void ObjChan_DrawFire(ObjChan* this, PlayState* play) { gSPSegment(&dl[1], 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -sp4C * 20, 32, 128)); gDPSetPrimColor(&dl[2], 128, 128, 255, 255, 0, 255); gDPSetEnvColor(&dl[3], 255, 0, 0, 0); - gSPDisplayList(&dl[4], &gGameplayKeepDrawFlameDL); + gSPDisplayList(&dl[4], gEffFire1DL); POLY_XLU_DISP = &dl[5]; CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index fb395f8d0..be3f365e3 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -15,7 +15,12 @@ void ObjDanpeilift_Destroy(Actor* thisx, PlayState* play); void ObjDanpeilift_Update(Actor* thisx, PlayState* play); void ObjDanpeilift_Draw(Actor* thisx, PlayState* play); -#if 0 +void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index); +void ObjDanpeilift_DoNothing(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Teleport(ObjDanpeilift* this, PlayState* play); +void ObjDanpeilift_Wait(ObjDanpeilift* this, PlayState* play); + const ActorInit Obj_Danpeilift_InitVars = { ACTOR_OBJ_DANPEILIFT, ACTORCAT_BG, @@ -28,35 +33,171 @@ const ActorInit Obj_Danpeilift_InitVars = { (ActorFunc)ObjDanpeilift_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80C1B540[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index) { + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]); +} -extern InitChainEntry D_80C1B540[]; +void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { + Path* path; + ObjDanpeiliftActionFunc tempActionFunc; + ObjDanpeilift* this = THIS; -extern UNK_TYPE D_06000180; -extern UNK_TYPE D_06000BA0; + Actor_ProcessInitChain(&this->dyna.actor, 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_obj_danpeilift_Colheader_000BA0); + if (this->dyna.bgId == BG_ACTOR_MAX) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + this->speed = OBJDANPEILIFT_GET_SPEED(thisx); + if (this->speed < 0.0f) { + this->speed = -this->speed; + } + if (this->speed < 0.01f) { + this->actionFunc = ObjDanpeilift_DoNothing; + } else { + path = &play->setupPathList[OBJDANPEILIFT_GET_PATH(thisx)]; + this->curPoint = OBJDANPEILIFT_GET_STARTING_POINT(thisx); + this->endPoint = path->count - 1; + this->direction = 1; + this->points = Lib_SegmentedToVirtual(path->points); + ObjDanpeilift_UpdatePosition(this, this->curPoint); + this->actionFunc = ObjDanpeilift_Move; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1ADC0.s") +void ObjDanpeilift_Destroy(Actor* thisx, PlayState* play) { + ObjDanpeilift* this = THIS; + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Init.s") +void ObjDanpeilift_DoNothing(ObjDanpeilift* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Destroy.s") +void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { + Actor* thisx = &this->dyna.actor; + Vec3f nextPoint; + f32 speed; + f32 target; + f32 step; + s32 isTeleporting; + s32 isPosUpdated; + Vec3s* endPoint; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1AF84.s") + 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; + } else { + target = this->speed; + step = this->speed * 0.16f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1AF94.s") + 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; + thisx->speedXZ *= 0.4f; + isTeleporting = OBJDANPEILIFT_SHOULD_TELEPORT(thisx); + isPosUpdated = true; + if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || + ((this->curPoint <= 0) && (this->direction < 0))) { + if (!isTeleporting) { + this->direction = -this->direction; + this->waitTimer = 10; + this->actionFunc = ObjDanpeilift_Wait; + } else { + endPoint = &this->points[this->endPoint]; + this->curPoint = this->direction > 0 ? 0 : this->endPoint; + if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || + (this->points[0].z != endPoint->z)) { + this->actionFunc = ObjDanpeilift_Teleport; + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + isPosUpdated = false; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1B210.s") + if (isPosUpdated) { + ObjDanpeilift_UpdatePosition(this, this->curPoint); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/func_80C1B26C.s") +void ObjDanpeilift_Teleport(ObjDanpeilift* this, PlayState* play) { + if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + ObjDanpeilift_UpdatePosition(this, this->curPoint); + func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + this->actionFunc = ObjDanpeilift_Move; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Update.s") +void ObjDanpeilift_Wait(ObjDanpeilift* this, PlayState* play) { + this->waitTimer--; + if (this->waitTimer <= 0) { + this->actionFunc = ObjDanpeilift_Move; + this->dyna.actor.speedXZ = 0.0f; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Danpeilift/ObjDanpeilift_Draw.s") +void ObjDanpeilift_Update(Actor* thisx, PlayState* play) { + f32 step; + ObjDanpeilift* 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); + } + } + if (OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx)) { + f32 target; + + this->isWeightOnPrev = this->isWeightOn; + this->isWeightOn = DynaPolyActor_IsInRidingMovingState(&this->dyna) ? 1 : 0; + if ((this->isWeightOn != this->isWeightOnPrev) && (this->maxHeight < 1.0f)) { + this->cycle = -0x8000; + this->maxHeight = 6.0f; + } + this->cycle += 0xCE4; + Math_StepToF(&this->maxHeight, 0.0f, 0.12f); + step = this->isWeightOn ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f + : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; + target = this->isWeightOn ? -8.0f : 0.0f; + Math_StepToF(&this->cycleSpeed, target, step); + this->dyna.actor.shape.yOffset = ((Math_SinS(this->cycle) * this->maxHeight) + this->cycleSpeed) * 10.0f; + } + if ((OBJDANPEILIFT_GET_TYPE(thisx) == 1) && (this->dyna.actor.child != NULL)) { + if (this->dyna.actor.child->update == NULL) { + this->dyna.actor.child = NULL; + } else { + this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x; + this->dyna.actor.child->world.pos.y = + this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y); + this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z; + } + } +} + +void ObjDanpeilift_Draw(Actor* thisx, PlayState* play) { + Gfx_DrawDListOpa(play, object_obj_danpeilift_DL_000180); +} diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 8b915a184..31f6b90c4 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -2,16 +2,34 @@ #define Z_OBJ_DANPEILIFT_H #include "global.h" +#include "objects/object_obj_danpeilift/object_obj_danpeilift.h" struct ObjDanpeilift; typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, PlayState*); +#define OBJDANPEILIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) +#define OBJDANPEILIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) +#define OBJDANPEILIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) +#define OBJDANPEILIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) +#define OBJDANPEILIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) +#define OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx) (((thisx)->params >> 0xE) & 1) + typedef struct ObjDanpeilift { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x18]; + /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjDanpeiliftActionFunc actionFunc; - /* 0x160 */ char unk_160[0x2C]; + /* 0x160 */ f32 speed; + /* 0x164 */ s32 endPoint; + /* 0x168 */ s32 curPoint; + /* 0x16C */ s32 direction; + /* 0x170 */ Vec3s* points; + /* 0x174 */ s32 isWeightOn; + /* 0x178 */ s32 isWeightOnPrev; + /* 0x17C */ f32 cycleSpeed; + /* 0x180 */ f32 maxHeight; + /* 0x184 */ s16 cycle; + /* 0x186 */ s16 waitTimer; + /* 0x188 */ s16 cutsceneTimer; } ObjDanpeilift; // size = 0x18C extern const ActorInit Obj_Danpeilift_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h index 275928f47..34c71f6b8 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.h @@ -10,7 +10,7 @@ typedef void (*ObjGhakaActionFunc)(struct ObjGhaka*, PlayState*); typedef struct ObjGhaka { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjGhakaActionFunc actionFunc; - /* 0x160 */ char unk160[0x8]; + /* 0x160 */ UNK_TYPE1 unk160[0x8]; /* 0x168 */ s16 unk_168; } ObjGhaka; // size = 0x16C 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 5fec022ad..df880906e 100644 --- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c +++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c @@ -8,6 +8,7 @@ #include "z_obj_grass.h" #include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "prevent_bss_reordering.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index a013560a4..3289699b0 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -213,7 +213,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { D_80B9DED0 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_000BF0); D_80B9DED4 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_001888); - SubS_FillCutscenesList(&this->dyna.actor, &this->unk_170, 1); + SubS_FillCutscenesList(&this->dyna.actor, this->unk_170, ARRAY_COUNT(this->unk_170)); this->unk_18C = 0; switch (this->unk_160) { @@ -326,7 +326,8 @@ void ObjHunsui_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->unk_172 & 0x40) && SubS_StartActorCutscene(&this->dyna.actor, this->unk_17C, -1, 0)) { + if ((this->unk_172 & 0x40) && + SubS_StartActorCutscene(&this->dyna.actor, this->unk_17C, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_172 &= ~0x40; } @@ -354,7 +355,7 @@ void func_80B9CE64(ObjHunsui* this, PlayState* play) { if (!(this->unk_172 & 1)) { if (sp2C != this->unk_180) { - this->unk_17C = this->unk_170; + this->unk_17C = this->unk_170[0]; this->unk_172 |= 0x40; } } @@ -446,7 +447,7 @@ void func_80B9D120(ObjHunsui* this, PlayState* play) { } if (func_80B9C450(play, this->unk_168, this->unk_164)) { - this->unk_17C = this->unk_170; + this->unk_17C = this->unk_170[0]; this->unk_172 |= 0x40; func_80B9D4D0(this, play); } @@ -559,7 +560,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { } if (!(this->unk_172 & 1) && !func_80B9C450(play, this->unk_168, this->unk_164)) { - this->unk_17C = this->unk_170; + this->unk_17C = this->unk_170[0]; this->unk_172 |= 0x40; func_80B9D0FC(this, play); } diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h index d84069ec0..2f3d968a6 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h @@ -31,7 +31,7 @@ typedef struct ObjHunsui { /* 0x16C */ s8 unk_16C; /* 0x16D */ s8 unk_16D; /* 0x16E */ s8 unk_16E; - /* 0x170 */ s16 unk_170; + /* 0x170 */ s16 unk_170[1]; /* 0x172 */ u16 unk_172; /* 0x174 */ f32 unk_174; /* 0x178 */ f32 unk_178; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 45503c0de..0210b5ba7 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -354,7 +354,7 @@ void ObjIcePoly_Draw(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, 0, (play->gameplayFrames * 2) % 256, 0x40, 0x20)); gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_148); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_050D10); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 394172d72..b01f22ae6 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -914,7 +914,7 @@ void ObjIceblock_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.z = 0; this->dyna.actor.home.rot.x = 0; this->dyna.actor.home.rot.z = 0; - if (!GET_ICEBLOCK_SNAP_ROT(&this->dyna.actor)) { + if (!ICEBLOCK_GET_SNAP_ROT(&this->dyna.actor)) { this->dyna.actor.shape.rot.y = (this->dyna.actor.shape.rot.y + 0x2000) & 0xC000; this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y; this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; @@ -926,7 +926,7 @@ void ObjIceblock_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->collider.dim.yShift = -100; this->collider.dim.height = 126; this->collider.dim.radius = 29; @@ -948,7 +948,7 @@ void ObjIceblock_Init(Actor* thisx, PlayState* play) { } } - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->unk_2B4 = -1.0f; } @@ -997,7 +997,7 @@ void func_80A2586C(ObjIceblock* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.scale.x, 0.1f, 0.02f)) { Actor_SetScale(&this->dyna.actor, 0.1f); - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->unk_2B4 = 0.05f; } func_80A25978(this); @@ -1030,7 +1030,7 @@ void func_80A25994(ObjIceblock* this, PlayState* play) { if (this->dyna.actor.flags & ACTOR_FLAG_40) { func_80A2339C(play, &this->dyna.actor.world.pos, this->dyna.actor.scale.x, 1.2f, 15); - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { sp30.x = this->dyna.actor.world.pos.x; sp30.y = this->dyna.actor.world.pos.y - 30.0f; sp30.z = this->dyna.actor.world.pos.z; @@ -1038,7 +1038,7 @@ void func_80A25994(ObjIceblock* this, PlayState* play) { } } - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->unk_2B4 = 0.1f; } @@ -1074,7 +1074,7 @@ void func_80A25AA8(ObjIceblock* this, PlayState* play) { this->dyna.actor.shape.yOffset = 300.0f; this->unk_248.y += sp24; - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->collider.dim.yShift = -69; } else { this->collider.dim.yShift = 0; @@ -1400,7 +1400,7 @@ void func_80A266E0(ObjIceblock* this, PlayState* play) { actor->scale.z = actor->scale.x; } - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor)) { this->unk_2B4 = actor->scale.y; this->collider.dim.height = (s32)(actor->scale.y * 1230.0f) + 1; this->collider.dim.yShift = actor->scale.y * -1000.0f; @@ -1483,7 +1483,7 @@ void ObjIceblock_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); if (this->unk_1B0 & 0x10) { - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { this->collider.base.ocFlags1 &= ~OC1_NO_PUSH; this->collider.base.ocFlags1 |= (OC1_TYPE_2 | OC1_TYPE_1 | OC1_TYPE_PLAYER); this->collider.info.bumper.dmgFlags |= @@ -1511,7 +1511,7 @@ void func_80A26B64(ObjIceblock* this, PlayState* play) { // draw func void func_80A26B74(ObjIceblock* this, PlayState* play) { Gfx_DrawDListXlu(play, gIceBlockCubeDL); - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); Gfx_DrawDListXlu(play, gIceBlockIceBergDL); } @@ -1541,7 +1541,7 @@ void func_80A26BF8(ObjIceblock* this, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gIceBlockCubeDL); } - if (GET_ICEBLOCK_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { + if (ICEBLOCK_GET_ICEBERG(&this->dyna.actor) && (this->unk_2B4 > 0.0f)) { AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gIceBlockIceBergSublimatingAirTexAnim)); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y - 20.0f, this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h index fa817781a..46ebc0c40 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.h @@ -8,8 +8,8 @@ struct ObjIceblock; typedef void (*ObjIceblockActionFunc)(struct ObjIceblock*, PlayState*); typedef void (*ObjIceblockExtendedDrawFunc)(struct ObjIceblock*, PlayState*); -#define GET_ICEBLOCK_SNAP_ROT(thisx) (((thisx)->params >> 1) & 1) -#define GET_ICEBLOCK_ICEBERG(thisx) ((thisx)->params & 1) +#define ICEBLOCK_GET_SNAP_ROT(thisx) (((thisx)->params >> 1) & 1) +#define ICEBLOCK_GET_ICEBERG(thisx) ((thisx)->params & 1) typedef struct { /* 0x00 */ s16 unk_00; diff --git a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c index cc65a7730..21b764593 100644 --- a/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c +++ b/src/overlays/actors/ovl_Obj_Jgame_Light/z_obj_jgame_light.c @@ -204,7 +204,7 @@ void ObjJgameLight_Draw(Actor* thisx, PlayState* play) { 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); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index b6fd674ef..dafd9bc2c 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -100,9 +100,9 @@ void ObjLightswitch_UpdateSwitchFlags(ObjLightswitch* this, PlayState* play, s32 if (this) {} if (set) { - Flags_SetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(&this->actor)); + Flags_SetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); } else { - Flags_UnsetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(&this->actor)); + Flags_UnsetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); } } @@ -150,13 +150,13 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { u32 isSwitchActivated; s32 isTriggered; - isSwitchActivated = Flags_GetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(&this->actor)); + isSwitchActivated = Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor)); isTriggered = false; Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetFocus(&this->actor, 0.0f); if (isSwitchActivated) { - if (GET_LIGHTSWITCH_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FAKE) { + if (LIGHTSWITCH_GET_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FAKE) { isTriggered = true; } else { ObjLightSwitch_SetupEnabled(this); @@ -167,7 +167,7 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { ObjLightswitch_InitCollider(this, play); - if (GET_LIGHTSWITCH_INVISIBLE(&this->actor)) { + if (LIGHTSWITCH_GET_INVISIBLE(&this->actor)) { // the stone tower exterior switch is part of the scene mesh, the actor is invisble on top this->actor.draw = NULL; } @@ -209,7 +209,7 @@ void ObjLightswitch_SetupIdle(ObjLightswitch* this) { } void ObjLightswitch_Idle(ObjLightswitch* this, PlayState* play) { - s32 actorType = GET_LIGHTSWITCH_TYPE(&this->actor); + s32 actorType = LIGHTSWITCH_GET_TYPE(&this->actor); if (this->hitState >= 10) { if (actorType == LIGHTSWITCH_TYPE_FAKE) { @@ -260,11 +260,11 @@ void ObjLightSwitch_SetupEnabled(ObjLightswitch* this) { } void ObjLightSwitch_Enabled(ObjLightswitch* this, PlayState* play) { - s32 actorType = GET_LIGHTSWITCH_TYPE(&this->actor); + s32 actorType = LIGHTSWITCH_GET_TYPE(&this->actor); if (actorType == LIGHTSWITCH_TYPE_REGULAR) { // switch can be disabled outside of this actor by flag - if (!Flags_GetSwitch(play, GET_LIGHTSWITCH_SWITCHFLAG(&this->actor))) { + if (!Flags_GetSwitch(play, LIGHTSWITCH_GET_SWITCHFLAG(&this->actor))) { ObjLightSwitch_SetupDisabled(this); } } else if (actorType == LIGHTSWITCH_TYPE_FLIP) { @@ -329,7 +329,7 @@ void ObjLightswitch_Update(Actor* thisx, PlayState* play) { // dmgFlags enum doesn't exist yet, 0x2000 is light arrows if ((this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x2000) != 0) { this->hitState = 10; - } else if (GET_LIGHTSWITCH_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FLIP) { + } else if (LIGHTSWITCH_GET_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FLIP) { if (this->hitState == 0) { if ((this->previousACFlags & AC_HIT) == 0) { this->hitState = 1; @@ -438,7 +438,7 @@ void ObjLightswitch_Draw(Actor* thisx, PlayState* play) { ObjLightswitch* this = THIS; s32 alpha = (u8)(this->colorAlpha >> 6); - if ((GET_LIGHTSWITCH_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FAKE) && (alpha > 0) && (alpha < 255)) { + if ((LIGHTSWITCH_GET_TYPE(&this->actor) == LIGHTSWITCH_TYPE_FAKE) && (alpha > 0) && (alpha < 255)) { ObjLightSwitch_DrawXlu(this, play); } else { ObjLightSwitch_DrawOpa(this, play); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index 7a8e0043f..a07900138 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -40,8 +40,8 @@ extern const ActorInit Obj_Lightswitch_InitVars; #define LIGHTSWITCH_TYPE_UNK2 2 #define LIGHTSWITCH_TYPE_FAKE 3 -#define GET_LIGHTSWITCH_TYPE(thisx) (((thisx)->params >> 4) & 0x3) -#define GET_LIGHTSWITCH_INVISIBLE(thisx) (((thisx)->params >> 3) & 1) -#define GET_LIGHTSWITCH_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0x7F) +#define LIGHTSWITCH_GET_TYPE(thisx) (((thisx)->params >> 4) & 0x3) +#define LIGHTSWITCH_GET_INVISIBLE(thisx) (((thisx)->params >> 3) & 1) +#define LIGHTSWITCH_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0x7F) #endif // Z_OBJ_LIGHTSWITCH_H diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 6c2d8a356..90aa5fa40 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -14,7 +14,10 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play); void ObjMakekinsuta_Update(Actor* thisx, PlayState* play); -#if 0 +s32 func_8099FA40(ObjMakekinsuta* this, PlayState* play); +void func_8099FB64(Actor* thisx, PlayState* play); +void func_8099FD7C(Actor* thisx, PlayState* play); + const ActorInit Obj_Makekinsuta_InitVars = { ACTOR_OBJ_MAKEKINSUTA, ACTORCAT_ITEMACTION, @@ -27,25 +30,112 @@ const ActorInit Obj_Makekinsuta_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8099FE30[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1, ICHAIN_STOP), }; -#endif +s32 func_8099FA40(ObjMakekinsuta* this, PlayState* play) { + s32 chestFlag = -1; + s32 skulltulaParams = (OBJMAKEKINSUTA_GET_1F(&this->actor) << 2) | 0xFF01; -extern InitChainEntry D_8099FE30[]; + if (OBJMAKEKINSUTA_GETS_3(skulltulaParams)) { + chestFlag = OBJMAKEKINSUTA_GETS_3FC(skulltulaParams); + } + return (chestFlag < 0) == true || !Flags_GetTreasure(play, chestFlag); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FA40.s") +void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Init.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + if (!func_8099FA40(this, play)) { + this->unk144 = -1; + } + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + Actor_MarkForDeath(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Destroy.s") +void ObjMakekinsuta_Destroy(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FB64.s") + if (func_8099FA40(this, play)) { + Flags_UnsetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/ObjMakekinsuta_Update.s") +void func_8099FB64(Actor* thisx, PlayState* play) { + s32 pad[0x2]; + Actor* actor; + Vec3f destVec; + s16 rotY; + f32 speedXZ; + s32 rotCheck; + static Vec3f D_8099FE3C = { 0.0f, 1.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Makekinsuta/func_8099FD7C.s") + rotCheck = thisx->shape.rot.x == 0; + if (rotCheck) { + rotCheck = thisx->shape.rot.z == 0; + } + + if (rotCheck) { + rotY = thisx->shape.rot.y; + } else { + Matrix_RotateYS(thisx->shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(thisx->shape.rot.x, MTXMODE_APPLY); + Matrix_RotateZS(thisx->shape.rot.z, MTXMODE_APPLY); + Matrix_MultVec3f(&D_8099FE3C, &destVec); + rotY = Math_FAtan2F(destVec.z, destVec.x); + } + actor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, + 0, rotY, 0, (OBJMAKEKINSUTA_GET_1F(thisx) << 2) | 0xFF01); + if (actor != NULL) { + actor->parent = thisx; + if (rotCheck) { + actor->velocity.y = 10.0f; + actor->speedXZ = 3.0f; + } else { + speedXZ = sqrtf((destVec.x * destVec.x) + (destVec.z * destVec.z)); + actor->velocity.y = (4 * destVec.y) + 4.0f; + actor->speedXZ = (2 * speedXZ) + 2.0f; + } + } +} + +void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { + ObjMakekinsuta* this = THIS; + + if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { + this->actor.update = func_8099FD7C; + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } else { + if (this->unk144 >= 0) { + if (this->unk144 == 0) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALGOLD_ROLL); + if (Rand_ZeroOne() < 0.1f) { + this->unk144 = Rand_S16Offset(0x28, 0x50); + } else { + this->unk144 = 8; + } + } else { + this->unk144--; + } + } + } +} + +void func_8099FD7C(Actor* thisx, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(thisx->cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx); + if (thisx->cutscene >= 0) { + func_800B7298(play, thisx, 4); + } + func_8099FB64(thisx, play); + thisx->update = Actor_Noop; + thisx->flags &= ~ACTOR_FLAG_10; + } else { + ActorCutscene_SetIntentToPlay(thisx->cutscene); + } +} diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h index 57c855179..d5bc998f0 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h @@ -5,9 +5,14 @@ struct ObjMakekinsuta; +#define OBJMAKEKINSUTA_GET_1F(thisx) (((thisx)->params >> 8) & 0x1F) +#define OBJMAKEKINSUTA_GETS_3(params) ((params & 3) & 0xFF) +#define OBJMAKEKINSUTA_GETS_3FC(params) (((params & 0x3FC) >> 2) & 0xFF) +#define OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx) ((thisx)->params & 0x7F) + typedef struct ObjMakekinsuta { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s8 unk144; } ObjMakekinsuta; // size = 0x148 extern const ActorInit Obj_Makekinsuta_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 8e2756f0b..b5f9d67b2 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -27,8 +27,8 @@ const ActorInit Obj_Makeoshihiki_InitVars = { s32 ObjMakeoshihiki_GetChildSpawnPointIndex(ObjMakeoshihiki* this, PlayState* play) { s32 pad; - s32 pathIndexOffset1 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this)) ? 1 : 0; - s32 pathIndexOffset2 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(this)) ? 2 : 0; + s32 pathIndexOffset1 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(&this->actor)) ? 1 : 0; + s32 pathIndexOffset2 = Flags_GetSwitch(play, OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(&this->actor)) ? 2 : 0; return pathIndexOffset1 + pathIndexOffset2; } @@ -39,8 +39,8 @@ void ObjMakeoshihiki_SetSwitchFlags(ObjMakeoshihiki* this, PlayState* play, s32 s32 switchFlag1; s32 switchFlag2; - switchFlag2 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(this); - switchFlag1 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this); + switchFlag2 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(&this->actor); + switchFlag1 = OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(&this->actor); if (pathIndex & 2) { Flags_SetSwitch(play, switchFlag2); @@ -61,7 +61,7 @@ void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { Path* path; s32 childPointIndex; - path = &play->setupPathList[OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(this)]; + path = &play->setupPathList[OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(&this->actor)]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; childPointIndex = ObjMakeoshihiki_GetChildSpawnPointIndex(this, play); diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h index 708da99d6..8a419c550 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h @@ -5,9 +5,9 @@ struct ObjMakeoshihiki; -#define OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(this) (((this)->actor.params >> 7) & 0x7F) -#define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(this) ((this)->actor.home.rot.z & 0x7F) -#define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(this) ((this)->actor.params & 0x7F) +#define OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(thisx) (((thisx)->params >> 7) & 0x7F) +#define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(thisx) ((thisx)->home.rot.z & 0x7F) +#define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(thisx) ((thisx)->params & 0x7F) typedef struct ObjMakeoshihiki { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.h b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.h index 6bba9c014..c5f313661 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.h +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.h @@ -7,7 +7,7 @@ struct ObjMilkBin; typedef struct ObjMilkBin { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ UNK_TYPE1 unk_144[0x4]; /* 0x148 */ ColliderCylinder collider; /* 0x194 */ s32 disableDraw; /* 0x198 */ s32 type; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h index fbdf40280..375d40fad 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.h @@ -9,7 +9,7 @@ typedef void (*ObjMoonStoneActionFunc)(struct ObjMoonStone*, PlayState*); typedef struct ObjMoonStone { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4C]; + /* 0x144 */ UNK_TYPE1 unk_144[0x4C]; /* 0x190 */ ObjMoonStoneActionFunc actionFunc; /* 0x194 */ s16 unk194; } ObjMoonStone; // size = 0x198 diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 65a173498..9a8072edd 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -91,10 +91,10 @@ s32 func_808D7928(ObjMure* this, PlayState* play) { void ObjMure_Init(Actor* thisx, PlayState* play) { ObjMure* this = THIS; - this->chNum = OBJ_MURE_GET_CHNUM(this->actor.params); - this->ptn = OBJ_MURE_GET_PTN(this->actor.params); - this->svNum = OBJ_MURE_GET_SVNUM(this->actor.params); - this->type = OBJ_MURE_GET_TYPE(this->actor.params); + this->chNum = OBJ_MURE_GET_CHNUM(&this->actor); + this->ptn = OBJ_MURE_GET_PTN(&this->actor); + this->svNum = OBJ_MURE_GET_SVNUM(&this->actor); + this->type = OBJ_MURE_GET_TYPE(&this->actor); if (this->ptn >= 4) { Actor_MarkForDeath(&this->actor); return; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h index 03ed6dc4e..bc3669697 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -11,7 +11,7 @@ typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); typedef struct { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x53]; + /* 0x144 */ UNK_TYPE1 unk_144[0x53]; /* 0x197 */ u8 unk_197; } ObjMureChild; // size = 0x198 @@ -31,9 +31,9 @@ typedef struct ObjMure { extern const ActorInit Obj_Mure_InitVars; -#define OBJ_MURE_GET_CHNUM(params) ((params >> 12) & 0xF) -#define OBJ_MURE_GET_PTN(params) ((params >> 8) & 0x7) -#define OBJ_MURE_GET_SVNUM(params) ((params >> 5) & 0x3) -#define OBJ_MURE_GET_TYPE(params) (params & 0x1F) +#define OBJ_MURE_GET_CHNUM(thisx) (((thisx)->params >> 12) & 0xF) +#define OBJ_MURE_GET_PTN(thisx) (((thisx)->params >> 8) & 0x7) +#define OBJ_MURE_GET_SVNUM(thisx) (((thisx)->params >> 5) & 0x3) +#define OBJ_MURE_GET_TYPE(thisx) ((thisx)->params & 0x1F) #endif // Z_OBJ_MURE_H diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index c8a5188b0..edefba93a 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -14,11 +14,13 @@ void ObjMure3_Init(Actor* thisx, PlayState* play); void ObjMure3_Destroy(Actor* thisx, PlayState* play); void ObjMure3_Update(Actor* thisx, PlayState* play); +void func_8098F598(ObjMure3* this); void func_8098F5AC(ObjMure3* this, PlayState* play); +void func_8098F5D0(ObjMure3* this); void func_8098F5E4(ObjMure3* this, PlayState* play); +void func_8098F66C(ObjMure3* this); void func_8098F680(ObjMure3* this, PlayState* play); -#if 0 const ActorInit Obj_Mure3_InitVars = { ACTOR_OBJ_MURE3, ACTORCAT_BG, @@ -31,41 +33,168 @@ const ActorInit Obj_Mure3_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8098F748[] = { +static s16 sRupeeCounts[] = { 5, 5, 7, 0 }; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), }; -#endif +void func_8098F040(ObjMure3* this, PlayState* play) { + s32 i; + Vec3f spawnPos; -extern InitChainEntry D_8098F748[]; + Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos); + for (i = 0; i < 5; i++, spawnPos.y += 20.0f) { + if (!((this->unk164 >> i) & 1)) { + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x10001); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F040.s") +void func_8098F110(ObjMure3* this, PlayState* play) { + s32 i; + Vec3f spawnPos; + f32 sin = Math_SinS(this->actor.world.rot.y); + f32 cos = Math_CosS(this->actor.world.rot.y); + f32 dist; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F110.s") + spawnPos.y = this->actor.world.pos.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F220.s") + for (i = 0, dist = -40.0f; i < 5; i++, dist += 20.0f) { + if (!((this->unk164 >> i) & 1)) { + spawnPos.x = this->actor.world.pos.x + (sin * dist); + spawnPos.z = this->actor.world.pos.z + (cos * dist); + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x4000); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F364.s") +void func_8098F220(ObjMure3* this, PlayState* play) { + s16 yRot; + Vec3f spawnPos; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F438.s") + spawnPos.y = this->actor.world.pos.y; + yRot = this->actor.world.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Init.s") + for (i = 0; i < 6; i++) { + if (!((this->unk164 >> i) & 1)) { + spawnPos.x = (Math_SinS(yRot) * 40.0f) + this->actor.world.pos.x; + spawnPos.z = (Math_CosS(yRot) * 40.0f) + this->actor.world.pos.z; + this->unk148[i] = (EnItem00*)Item_DropCollectible2(play, &spawnPos, 0x4000); + if (this->unk148[i] != NULL) { + this->unk148[i]->actor.room = this->actor.room; + } + } + yRot += 0x2AAA; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Destroy.s") + if (!((this->unk164 >> 6) & 1)) { + spawnPos.x = this->actor.world.pos.x; + spawnPos.z = this->actor.world.pos.z; + this->unk160 = Item_DropCollectible2(play, &spawnPos, 0x4002); + if (this->unk160 != NULL) { + this->unk160->room = this->actor.room; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F598.s") +void func_8098F364(ObjMure3* this, s32 play) { + s16 count = sRupeeCounts[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)]; + s32 i; + EnItem00** collectible; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5AC.s") + for (i = 0; i < count; i++) { + collectible = &this->unk148[i]; + if ((!((this->unk164 >> i) & 1)) && (*collectible != NULL)) { + if (((*collectible)->unk1A4 != 0) || ((*collectible)->actor.update == NULL)) { + this->unk164 |= (1 << i); + } else { + Actor_MarkForDeath(&(*collectible)->actor); + } + } + *collectible = NULL; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5D0.s") +void func_8098F438(ObjMure3* this, PlayState* play) { + s16 count = sRupeeCounts[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)]; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F5E4.s") + for (i = 0; i < count; i++) { + EnItem00** collectible = &this->unk148[i]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F66C.s") + if ((*collectible != NULL) && !((this->unk164 >> i) & 1)) { + if ((*collectible)->unk1A4 != 0) { + Flags_SetSwitch(play, OBJMURE3_PARAMS_7F(&this->actor)); + } + if ((*collectible)->actor.update == NULL) { + this->unk164 |= (1 << i); + this->unk148[i] = NULL; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/func_8098F680.s") +void ObjMure3_Init(Actor* thisx, PlayState* play) { + ObjMure3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure3/ObjMure3_Update.s") + if (Flags_GetSwitch(play, OBJMURE3_PARAMS_7F(&this->actor))) { + Actor_MarkForDeath(&this->actor); + return; + } + Actor_ProcessInitChain(&this->actor, sInitChain); + func_8098F598(this); +} + +void ObjMure3_Destroy(Actor* thisx, PlayState* play) { +} + +void func_8098F598(ObjMure3* this) { + this->actionFunc = func_8098F5AC; +} + +void func_8098F5AC(ObjMure3* this, PlayState* play) { + func_8098F5D0(this); +} + +void func_8098F5D0(ObjMure3* this) { + this->actionFunc = func_8098F5E4; +} + +void func_8098F5E4(ObjMure3* this, PlayState* play) { + static ObjMure3SpawnFunc sSpawnFuncs[] = { func_8098F040, func_8098F110, func_8098F220 }; + + if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) { + this->actor.flags |= ACTOR_FLAG_10; + sSpawnFuncs[OBJMURE3_PARAMS_RUPEEINDEX(&this->actor)](this, play); + func_8098F66C(this); + } +} + +void func_8098F66C(ObjMure3* this) { + this->actionFunc = func_8098F680; +} + +void func_8098F680(ObjMure3* this, PlayState* play) { + func_8098F438(this, play); + if (Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z) >= SQ(1450.0f)) { + this->actor.flags &= ~ACTOR_FLAG_10; + func_8098F364(this, play); + func_8098F5D0(this); + } +} + +void ObjMure3_Update(Actor* thisx, PlayState* play) { + ObjMure3* this = THIS; + + this->actionFunc(this, play); +} diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h index d21751198..2b6c4f891 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -3,14 +3,20 @@ #include "global.h" +#define OBJMURE3_PARAMS_7F(thisx) ((thisx)->params & 0x7F) +#define OBJMURE3_PARAMS_RUPEEINDEX(thisx) (((thisx)->params >> 13) & 7) + struct ObjMure3; typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); +typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, PlayState*); typedef struct ObjMure3 { /* 0x000 */ Actor actor; /* 0x144 */ ObjMure3ActionFunc actionFunc; - /* 0x148 */ char unk_148[0x20]; + /* 0x148 */ EnItem00* unk148[6]; + /* 0x160 */ Actor* unk160; + /* 0x164 */ u16 unk164; } ObjMure3; // size = 0x168 extern const ActorInit Obj_Mure3_InitVars; 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 a5b640133..681faf3c1 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -362,7 +362,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) { play->roomCtx.unk7A[0] = this->dyna.actor.velocity.x; - func_8019FAD8(&D_801DB4A4, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speedXZ); + func_8019FAD8(&gSfxDefaultPos, NA_SE_EV_SECOM_CONVEYOR - SFX_FLAG, this->dyna.actor.speedXZ); } void func_80BA3044(ObjNozoki* this, PlayState* play) { @@ -441,7 +441,7 @@ void func_80BA3344(ObjNozoki* this, PlayState* play) { ObjNozoki_SetupAction(this, func_80BA3230); } } else if ((this->dyna.actor.textId == 0) || Actor_TextboxIsClosing(&this->dyna.actor, play)) { - play->nextEntranceIndex = 0xE20; + play->nextEntrance = ENTRANCE(CURIOSITY_SHOP, 2); play->transitionTrigger = TRANS_TRIGGER_START; } } diff --git a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c index 9d3476ff6..6a5298728 100644 --- a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c +++ b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c @@ -19,11 +19,11 @@ void ObjRotlift_Draw(Actor* thisx, PlayState* play); void ObjRotlift_MoveDekuFlowers(ObjRotlift* this); -typedef struct ModelInfo { +typedef struct ObjRotliftModelInfo { /* 0x0 */ Gfx* dList; /* 0x4 */ AnimatedMaterial* animMat; /* 0x8 */ CollisionHeader* colHeader; -} ModelInfo; // size = 0xC +} ObjRotliftModelInfo; // size = 0xC const ActorInit Obj_Rotlift_InitVars = { ACTOR_OBJ_ROTLIFT, @@ -37,7 +37,7 @@ const ActorInit Obj_Rotlift_InitVars = { (ActorFunc)ObjRotlift_Draw, }; -struct ModelInfo sModelInfo[] = { +struct ObjRotliftModelInfo sModelInfo[] = { { gDekuMoonDungeonRotatingPlatformsDL, gDekuMoonDungeonRotatingPlatformsUnusedTexAnim, @@ -87,7 +87,7 @@ void ObjRotlift_Init(Actor* thisx, PlayState* play2) { s32 type = OBJROTLIFT_GET_TYPE(&this->dyna.actor); s32 dekuFlowerParams; s32 i; - ModelInfo* modelInfo; + ObjRotliftModelInfo* modelInfo; ObjEtcetera** dekuFlowers; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -146,7 +146,7 @@ void ObjRotlift_Update(Actor* thisx, PlayState* play) { void ObjRotlift_Draw(Actor* thisx, PlayState* play) { s32 pad; ObjRotlift* this = THIS; - ModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)]; + ObjRotliftModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)]; // Neither of the displaylists reference other segments, so this call is ultimately pointless. AnimatedMat_Draw(play, modelInfo->animMat); diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 4fb83303b..05fe851a9 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -695,15 +695,11 @@ void func_80B30AD4(ObjSpidertent* this) { this->actionFunc = func_80B30AF8; } -#ifdef NON_MATCHING void func_80B30AF8(ObjSpidertent* this, PlayState* play) { ObjSpidertentStruct* temp_s0 = &D_80B31350[OBJSPIDERTENT_GET_1(&this->dyna.actor)]; - TriNorm* triNorm; s32 i; s32 j; s32 pad; - Vec3f sp60; - f32 sp5C; this->unk_3C6++; @@ -762,10 +758,10 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } - if (this->unk_3C1 >= 0x20) { + if (this->unk_3C1 >= 32) { if (this->unk_3C7 > 0) { this->unk_3C7--; - } else if (this->unk_3C1 >= 0x33) { + } else if (this->unk_3C1 > 50) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_EXTINCT); this->unk_3C7 = Rand_S16Offset(2, 2); } else { @@ -781,11 +777,15 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { } for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { - triNorm = &this->collider.elements[i].dim; + TriNorm* triNorm = &this->collider.elements[i].dim; + Vec3f sp60; + f32 sp5C; for (j = 0; j < ARRAY_COUNT(this->unk_3B0); j++) { - if (!(this->unk_3B0[j] < 5.0f) && !(this->unk_3C0 & (1 << j)) && - func_80B2FB94(&this->unk_3A4, this->unk_3B0[j], triNorm, &sp60, &sp5C)) { + if ((this->unk_3B0[j] < 5.0f) || (this->unk_3C0 & (1 << j))) { + continue; + } + if (func_80B2FB94(&this->unk_3A4, this->unk_3B0[j], triNorm, &sp60, &sp5C)) { func_80B300F4(this, play, triNorm, &sp60, sp5C, j); } } @@ -795,9 +795,6 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { Actor_MarkForDeath(&this->dyna.actor); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spidertent/func_80B30AF8.s") -#endif void ObjSpidertent_Update(Actor* thisx, PlayState* play) { ObjSpidertent* this = THIS; diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 3a1cae372..0db945c96 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -272,26 +272,25 @@ void func_80A1DFA0(ObjSpinyroll* this) { for (i = 0; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++) { for (j = 0, phi_f12 = temp_f0; j < this->unk_3A4.unk_F4; j++, phi_f12 -= temp_f2) { - this->unk_3A4.unk_00[i].unk_00[j].unk_00 = phi_f12; + this->unk_3A4.unk_00[i][j].unk_00 = phi_f12; } } } -#ifdef NON_MATCHING -// play not in s reg, something with ptr->unk_F0 = temp_s1; line s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { + f32 temp_f0; + ObjSpinyrollStruct* ptr = &this->unk_3A4; + f32 temp_f20; s32 i; s32 j; - ObjSpinyrollStruct2* ptr = &this->unk_3A4; - f32 temp_f0; - f32 temp_f20; Vec3f spC8; Vec3f spBC; Vec3f spB0; - ObjSpinyrollStruct* temp_s1; + ObjSpinyrollSubStruct* temp_s1; f32 temp_f22; f32 temp_f24; f32 temp; + s32 pad; s32 sp98; spC8.y = this->dyna.actor.world.pos.y + 10.0f; @@ -304,19 +303,17 @@ s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { temp = D_80A1F1F4[i]; temp_f22 = temp * this->unk_4C4.x; temp_f24 = temp * this->unk_4C4.z; - temp_s1 = &ptr->unk_00[i]; for (j = 0; j < ptr->unk_F4; j++) { - spC8.x = - (temp_s1->unk_00[j].unk_00 * Math_CosS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.x; - spC8.z = - (temp_s1->unk_00[j].unk_00 * -Math_SinS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.z; + temp_s1 = &ptr->unk_00[i][j]; + spC8.x = (temp_s1->unk_00 * Math_CosS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.x; + spC8.z = (temp_s1->unk_00 * -Math_SinS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.z; spBC.x = temp_f22 + spC8.x; spBC.z = temp_f24 + spC8.z; - if (BgCheck_EntityLineTest3(&play->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_00[j].unk_04, 1, 0, 0, 1, - &temp_s1->unk_00[j].bgId, &this->dyna.actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_04, 1, 0, 0, 1, + &temp_s1->bgId, &this->dyna.actor, 0.0f)) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { func_80A1DA50(play, this, &spC8, &spB0); } @@ -334,10 +331,6 @@ s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { return sp98; } -#else -s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E074.s") -#endif s32 func_80A1E2D8(ObjSpinyroll* this, PlayState* play, s32 arg2) { Vec3f sp1C; @@ -363,10 +356,9 @@ s32 func_80A1E394(CollisionContext* colCtx, f32* arg1, CollisionPoly** polyOut, return BgCheck_EntityCheckCeiling(colCtx, arg1, arg4, 24.0f, polyOut, bgId, &this->dyna.actor); } -#ifdef NON_MATCHING s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { - f32 temp_f20; - ObjSpinyrollStruct2* spC8; + f32 phi_f26; + ObjSpinyrollStruct* spC8 = &this->unk_3A4; f32 phi_f22; ObjSpinyrollColFunc spC0; s32 i; @@ -374,11 +366,12 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { Vec3f spAC; Vec3f spA0; Vec3f sp94; - ObjSpinyrollStruct* temp_s0; - f32 phi_f26; + ObjSpinyrollSubStruct* temp_s0; + f32 temp_f20; + s32 pad; s32 sp84; - - spC8 = &this->unk_3A4; + s32 pad2; + f32* temp; if (this->unk_4C4.y > 0.0f) { spC0 = func_80A1E394; @@ -393,18 +386,19 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { phi_f22 = FLT_MAX; spC8->unk_F0 = NULL; - for (i = 0; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++) { - sp94.z = D_80A1F1FC[i]; - temp_s0 = &spC8->unk_00[i]; + for (i = 0, temp = D_80A1F1FC; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++, temp++) { + sp94.z = *temp; for (j = 0; j < spC8->unk_F4; j++) { - sp94.x = temp_s0->unk_00[j].unk_00; + temp_s0 = &spC8->unk_00[i][j]; + + sp94.x = temp_s0->unk_00; func_80A1DAAC(&spAC, &sp94, this->dyna.actor.world.rot.y); spAC.x += this->dyna.actor.world.pos.x; spAC.z += this->dyna.actor.world.pos.z; - if (spC0(&play->colCtx, &spA0.y, &temp_s0->unk_00[j].unk_04, &temp_s0->unk_00[j].bgId, &spAC, this)) { + if (spC0(&play->colCtx, &spA0.y, &temp_s0->unk_04, &temp_s0->bgId, &spAC, this)) { temp_f20 = fabsf(spA0.y - spAC.y); if (temp_f20 <= 24.0f) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { @@ -425,10 +419,6 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { } return sp84; } -#else -s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E3D8.s") -#endif s32 func_80A1E648(ObjSpinyroll* this, PlayState* play, s32 arg2) { f32 sp1C; @@ -442,7 +432,7 @@ s32 func_80A1E648(ObjSpinyroll* this, PlayState* play, s32 arg2) { DynaPolyActor* func_80A1E694(ObjSpinyroll* this, PlayState* play) { if (this->unk_3A4.unk_F0 != NULL) { - return DynaPoly_GetActor(&play->colCtx, this->unk_3A4.unk_F0->unk_00[0].bgId); + return DynaPoly_GetActor(&play->colCtx, this->unk_3A4.unk_F0->bgId); } return NULL; } diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h index 741385264..10322586a 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h @@ -24,22 +24,16 @@ typedef struct { } ObjSpinyrollSubStruct; // size = 0xC typedef struct { - /* 0x00 */ ObjSpinyrollSubStruct unk_00[10]; -} ObjSpinyrollStruct; // size = 0x78 - -typedef struct { - /* 0x00 */ ObjSpinyrollStruct unk_00[2]; - /* 0xF0 */ ObjSpinyrollStruct* unk_F0; + /* 0x00 */ ObjSpinyrollSubStruct unk_00[2][10]; + /* 0xF0 */ ObjSpinyrollSubStruct* unk_F0; /* 0xF4 */ s32 unk_F4; -} ObjSpinyrollStruct2; // size = 0xF8? +} ObjSpinyrollStruct; // size = 0xF8? typedef struct ObjSpinyroll { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ColliderTris collider; /* 0x17C */ ColliderTrisElement colliderElements[6]; - /* 0x3A4 */ ObjSpinyrollStruct2 unk_3A4; - ///* 0x494 */ ObjSpinyrollStruct* unk_494; // alternative testing - ///* 0x498 */ s32 unk_498; + /* 0x3A4 */ ObjSpinyrollStruct unk_3A4; /* 0x49C */ s32 unk_49C; /* 0x4A0 */ ObjSpinyrollActionFunc actionFunc; /* 0x4A4 */ f32 unk_4A4; diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index c653bd25d..7625b403f 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -254,8 +254,8 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize) + OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS; } } - Audio_PlaySfxGeneral(NA_SE_EV_FLAME_IGNITION, &thisx->projectedPos, 4, &D_801DB4B0, &D_801DB4B0, - &D_801DB4B8); + AudioSfx_PlaySfx(NA_SE_EV_FLAME_IGNITION, &thisx->projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } } @@ -315,8 +315,9 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY); Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - thisx->shape.rot.y), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, 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); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h index 618b86ed5..d1a0be1c8 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h @@ -50,10 +50,10 @@ typedef enum { #define OBJ_SYOKUDAI_SNUFF_TIMER_JUST_LIT_BONUS 10 #define OBJ_SYOKUDAI_LIGHT_RADIUS_MAX 250 -#define OBJ_SYOKUDAI_GET_TYPE(thisx) (thisx->params >> 0xC) -#define OBJ_SYOKUDAI_GET_START_LIT(thisx) (thisx->params & 0x800) -#define OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx) ((thisx->params >> 7) & 0xF) -#define OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx) (thisx->params & 0x7F) +#define OBJ_SYOKUDAI_GET_TYPE(thisx) ((thisx)->params >> 0xC) +#define OBJ_SYOKUDAI_GET_START_LIT(thisx) ((thisx)->params & 0x800) +#define OBJ_SYOKUDAI_GET_GROUP_SIZE(thisx) (((thisx)->params >> 7) & 0xF) +#define OBJ_SYOKUDAI_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) #define OBJ_SYOKUDAI_SNUFF_TIMER_INITIAL(groupSize) ((groupSize * 50) + 100) diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 32a44878b..9aadc668c 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -1,10 +1,15 @@ /* * File: z_obj_taru.c * Overlay: ovl_Obj_Taru - * Description: Wooden Barrel + * Description: Wooden Barrel and Breakable Pirate Panel */ #include "z_obj_taru.h" +#include "overlays/actors/ovl_En_Sw/z_en_sw.h" +#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h" +#include "objects/object_taru/object_taru.h" +#include "objects/object_kibako2/object_kibako2.h" #define FLAGS 0x00000000 @@ -15,7 +20,10 @@ void ObjTaru_Destroy(Actor* thisx, PlayState* play); void ObjTaru_Update(Actor* thisx, PlayState* play); void ObjTaru_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80B9C07C(ObjTaru* this, PlayState* play); +void func_80B9C174(ObjTaru* this, PlayState* play); +void func_80B9C1A0(ObjTaru* this, PlayState* play); + const ActorInit Obj_Taru_InitVars = { ACTOR_OBJ_TARU, ACTORCAT_BG, @@ -28,55 +36,309 @@ const ActorInit Obj_Taru_InitVars = { (ActorFunc)ObjTaru_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80B9C340 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x80000508, 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_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x80000508, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 30, 50, 0, { 0, 0, 0 } }, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B9C36C[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 3300, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 200, ICHAIN_STOP), }; -#endif +s32 func_80B9B6E0(ObjTaru* this, PlayState* play) { + s32 chestFlag = -1; + s32 skulltulaParams = (OBJ_TSUBO_P001F(&this->dyna.actor) * 4) | 0xFF01; -extern ColliderCylinderInit D_80B9C340; -extern InitChainEntry D_80B9C36C[]; + if (ENSW_GETS_3(skulltulaParams)) { + chestFlag = ENSW_GETS_3FC(skulltulaParams); + } -extern UNK_TYPE D_06000420; -extern UNK_TYPE D_06001040; -extern UNK_TYPE D_06001100; -extern UNK_TYPE D_06001CB0; + return (chestFlag < 0) == true || !Flags_GetTreasure(play, chestFlag); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B6E0.s") +void func_80B9B74C(ObjTaru* this, PlayState* play) { + s32 pad[2]; + Vec3f* thisPos = &this->dyna.actor.world.pos; + Vec3f pos; + Vec3f velocity; + s16 angle; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B74C.s") + for (i = 0, angle = 0; i < 0x10; i++, angle += 0x4E20) { + f32 sin = Math_SinS(angle); + f32 cos = Math_CosS(angle); + f32 tempRand = Rand_ZeroOne() * 30.0f; + s32 phi_s0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9B9C8.s") + pos.x = sin * tempRand; + pos.y = (Rand_ZeroOne() * 10.0f) + 2.0f; + pos.z = cos * tempRand; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BC64.s") + velocity.x = pos.x * 0.2f; + velocity.y = (Rand_ZeroOne() * 10.0f) + 2.0f; + velocity.z = pos.z * 0.2f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BCBC.s") + pos.x += thisPos->x; + pos.y += thisPos->y; + pos.z += thisPos->z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BD84.s") + tempRand = Rand_ZeroOne(); + if (tempRand < 0.05f) { + phi_s0 = 0x60; + } else if (tempRand < 0.7f) { + phi_s0 = 0x40; + } else { + phi_s0 = 0x20; + } + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -200, phi_s0, 28, 2, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, 0, + 70, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragment1DL); + } + func_800BBFB0(play, thisPos, 90.0f, 6, 100, 160, 1); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Init.s") +void func_80B9B9C8(ObjTaru* this, PlayState* play) { + s32 phi_s5; + s32 i; + s32 j; + Vec3f spD8; + Vec3f spCC; + s32 pad[2]; + f32 sin; + f32 cos; + s32 phi_fp; + Vec3f* thisPos = &this->dyna.actor.world.pos; + f32 temp_fs0; + f32 temp_fs1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Destroy.s") + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9BF7C.s") + if (OBJ_TARU_GET_100(&this->dyna.actor)) { + phi_fp = 0; + phi_s5 = 8; + } else { + phi_fp = 2; + phi_s5 = 6; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C07C.s") + for (i = 0; i < 4; i++) { + for (j = phi_fp; j < phi_s5; j++) { + temp_fs0 = randPlusMinusPoint5Scaled(10.0f) + -105.0f + (j * 30.0f); + temp_fs1 = randPlusMinusPoint5Scaled(4.0f); + spD8.x = temp_fs0 * cos; + spD8.y = randPlusMinusPoint5Scaled(10.0f) + 15.0f + (i * 30.0f); + spD8.z = temp_fs0 * sin; + spCC.x = (spD8.x * 0.05f) + (temp_fs1 * sin); + spCC.y = Rand_ZeroFloat(5.0f) + 2.0f; + spCC.z = (spD8.z * 0.05f) + (temp_fs1 * cos); + spD8.x += thisPos->x; + spD8.y += thisPos->y; + spD8.z += thisPos->z; + EffectSsKakera_Spawn(play, &spD8, &spCC, &spD8, -0x64, 0x20, 0x1C, 4, 0, (Rand_ZeroOne() * 30.0f) + 5.0f, 0, + 0, 0x5A, KAKERA_COLOR_NONE, OBJECT_KIBAKO2, gLargeCrateFragment2DL); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C174.s") +void func_80B9BC64(ObjTaru* this, PlayState* play) { + s32 item; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/func_80B9C1A0.s") + item = func_800A8150(OBJ_TARU_GET_3F(&this->dyna.actor)); + if (item >= 0) { + Item_DropCollectible(play, &this->dyna.actor.world.pos, (OBJ_TARU_GET_7F00(&this->dyna.actor) << 8) | item); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Update.s") +void func_80B9BCBC(ObjTaru* this, PlayState* play) { + s32 pad; + s32 params1F; + Actor* spawnedActor; + s16 rotY; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Taru/ObjTaru_Draw.s") + if (func_80B9B6E0(this, play)) { + params1F = (OBJ_TARU_GET_1F(&this->dyna.actor) * 4) | 0xFF01; + rotY = (Rand_Next() >> 0x11) + this->dyna.actor.yawTowardsPlayer + 0xC000; + spawnedActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, rotY, 0, params1F); + if (spawnedActor != NULL) { + spawnedActor->parent = &this->dyna.actor; + spawnedActor->velocity.y = 12.0f; + spawnedActor->speedXZ = 2.0f; + } + } +} + +void func_80B9BD84(ObjTaru* this, PlayState* play) { + if (!OBJ_TARU_GET_8000(&this->dyna.actor)) { + func_80B9BC64(this, play); + } else { + func_80B9BCBC(this, play); + } +} + +void ObjTaru_Init(Actor* thisx, PlayState* play) { + s32 pad; + ObjTaru* this = THIS; + s32 params8000; + + DynaPolyActor_Init(&this->dyna, 0); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + + if (OBJ_TARU_GET_80(thisx)) { + if (Flags_GetSwitch(play, OBJ_TARU_GET_7F(thisx))) { + Actor_MarkForDeath(&this->dyna.actor); + } else { + DynaPolyActor_LoadMesh(play, &this->dyna, &object_taru_Colheader_001CB0); + } + if (OBJ_TARU_GET_100(&this->dyna.actor)) { + this->dyna.actor.scale.x = 0.2f; + } + } else { + params8000 = OBJ_TARU_GET_8000(thisx); + DynaPolyActor_LoadMesh(play, &this->dyna, &object_taru_Colheader_000FC8); + Collider_InitAndSetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + + if (params8000 == 0) { + if (Item_CanDropBigFairy(play, OBJ_TARU_GET_3F(&this->dyna.actor), OBJ_TARU_GET_7F00(&this->dyna.actor))) { + this->unk_1AC = 1; + this->dyna.actor.flags |= ACTOR_FLAG_10; + } + } + if ((params8000 != 1) || (!func_80B9B6E0(this, play))) { + this->unk_1AD = -1; + } + } + this->actionFunc = func_80B9C07C; +} + +void ObjTaru_Destroy(Actor* thisx, PlayState* play) { + ObjTaru* this = THIS; + + if (!OBJ_TARU_GET_80(thisx)) { + Collider_DestroyCylinder(play, &this->collider); + } + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} + +s32 func_80B9BF7C(ObjTaru* this) { + s32 pad; + s32 phi_a3 = false; + + if ((!OBJ_TARU_GET_80(&this->dyna.actor)) && (this->collider.base.acFlags & AC_HIT)) { + Actor* ac = this->collider.base.ac; + + this->collider.base.acFlags &= ~AC_HIT; + if (ac != NULL) { + if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80000000) { + phi_a3 = false; + if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &ac->world.pos) < SQ(160.0f)) { + phi_a3 = true; + } + } else if (this->collider.info.acHitInfo->toucher.dmgFlags & 8) { + if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &ac->world.pos) < SQ(100.0f)) { + phi_a3 = true; + } + } else if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x500) { + phi_a3 = true; + } + } + } else if (this->dyna.actor.home.rot.z != 0) { + phi_a3 = true; + } + return phi_a3; +} + +void func_80B9C07C(ObjTaru* this, PlayState* play) { + if (func_80B9BF7C(this)) { + if (!OBJ_TARU_GET_80(&this->dyna.actor)) { + func_80B9B74C(this, play); + } else { + func_80B9B9C8(this, play); + } + SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 0x14, NA_SE_EV_WOODBOX_BREAK); + if (OBJ_TARU_GET_80(&this->dyna.actor)) { + this->actionFunc = func_80B9C1A0; + } else { + this->dyna.actor.flags |= ACTOR_FLAG_10; + func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + this->dyna.actor.draw = NULL; + this->actionFunc = func_80B9C174; + } + } else { + if (this->dyna.actor.xzDistToPlayer < 600.0f) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + } +} + +void func_80B9C174(ObjTaru* this, PlayState* play) { + func_80B9BD84(this, play); + Actor_MarkForDeath(&this->dyna.actor); +} + +void func_80B9C1A0(ObjTaru* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + Flags_SetSwitch(play, OBJ_TARU_GET_7F(&this->dyna.actor)); + Actor_MarkForDeath(&this->dyna.actor); + } else { + ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + } +} + +void ObjTaru_Update(Actor* thisx, PlayState* play) { + ObjTaru* this = THIS; + + if (!OBJ_TARU_GET_80(thisx)) { + if (this->unk_1AC != 0) { + play->actorCtx.unk5 |= 8; + } + if (this->unk_1AD >= 0) { + switch (this->unk_1AD) { + case 0: + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_STALGOLD_ROLL); + if (Rand_ZeroOne() < 0.1f) { + this->unk_1AD = Rand_S16Offset(40, 80); + } else { + this->unk_1AD = 8; + } + break; + default: + this->unk_1AD--; + break; + } + } + } + this->actionFunc(this, play); +} + +void ObjTaru_Draw(Actor* thisx, PlayState* play) { + Gfx* dList; + ObjTaru* this = THIS; + + if (OBJ_TARU_GET_80(thisx)) { + dList = gObjTaruBreakablePiratePanelDL; + } else { + dList = gObjTaruBarrelDL; + } + Gfx_DrawDListOpa(play, dList); +} diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h index d1220bf33..063e90ef4 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.h @@ -3,15 +3,24 @@ #include "global.h" +#define OBJ_TARU_GET_100(thisx) ((thisx)->params & 0x100) +#define OBJ_TARU_GET_1F(thisx) ((thisx)->params & 0x1F) +#define OBJ_TARU_GET_3F(thisx) ((thisx)->params & 0x3F) +#define OBJ_TARU_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJ_TARU_GET_7F00(thisx) (((thisx)->params >> 8) & 0x7F) +#define OBJ_TARU_GET_80(thisx) ((thisx)->params & 0x80) +#define OBJ_TARU_GET_8000(thisx) (((thisx)->params >> 0xF) & 1) + struct ObjTaru; typedef void (*ObjTaruActionFunc)(struct ObjTaru*, PlayState*); typedef struct ObjTaru { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x64]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ ColliderCylinder collider; /* 0x1A8 */ ObjTaruActionFunc actionFunc; - /* 0x1AC */ char unk_1AC[0x4]; + /* 0x1AC */ s8 unk_1AC; + /* 0x1AD */ s8 unk_1AD; } ObjTaru; // size = 0x1B0 extern const ActorInit Obj_Taru_InitVars; 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 9b78bc273..79b2e577e 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -457,7 +457,7 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; gSaveContext.respawnFlag = 2; play->transitionTrigger = TRANS_TRIGGER_START; - play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; + play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_02; if (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == 0xCFF) { gSaveContext.nextTransitionType = TRANS_TYPE_21; 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 32a0a0d54..c2cc74a82 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -498,7 +498,7 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10; } } - if ((this->actor.xzDistToPlayer < 800.0f) || (gSaveContext.save.entranceIndex == 0xD010)) { + if ((this->actor.xzDistToPlayer < 800.0f) || (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1))) { Collider_UpdateCylinder(&this->actor, &this->cylinderCollider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinderCollider.base); if (this->actor.xzDistToPlayer < 150.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 658cae652..9bae7169e 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -58,7 +58,7 @@ void ObjUm_Update(Actor* thisx, PlayState* play); void ObjUm_Draw(Actor* thisx, PlayState* play); void ObjUm_DefaultAnim(ObjUm* this, PlayState* play); -void ObjUm_UpdateAnim(ObjUm* this, PlayState* play, ObjUmAnimimations index); +void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation index); void ObjUm_SetupAction(ObjUm* this, ObjUmActionFunc actionFunc); const ActorInit Obj_Um_InitVars = { @@ -679,8 +679,8 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { this->wheelRot = 0; ObjUm_DefaultAnim(this, play); - this->type = OBJ_UM_PARSE_TYPE(thisx); - this->initialPathIndex = OBJ_UM_PARSE_PATH_INDEX(thisx); + this->type = OBJ_UM_GET_TYPE(thisx); + this->initialPathIndex = OBJ_UM_GET_PATH_INDEX(thisx); // if (!AliensDefeated) if (!(gSaveContext.save.weekEventReg[22] & 1)) { @@ -795,7 +795,7 @@ void ObjUm_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); for (i = 0; i < ARRAY_COUNT(this->potPos); i++) { - Audio_StopSfxByPos(&this->potPos[i]); + AudioSfx_StopByPos(&this->potPos[i]); } Collider_DestroyCylinder(play, &this->banditsCollisions[0]); @@ -833,7 +833,7 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { player = GET_PLAYER(play); func_8019F208(); gSaveContext.save.weekEventReg[31] |= 0x80; - play->nextEntranceIndex = 0x64B0; + play->nextEntrance = ENTRANCE(ROMANI_RANCH, 11); if (player->stateFlags1 & PLAYER_STATE1_800000) { D_801BDAA0 = 1; } @@ -992,7 +992,7 @@ void ObjUm_RanchWait(ObjUm* this, PlayState* play) { this->dyna.actor.flags |= ACTOR_FLAG_1; SkelAnime_Update(&this->skelAnime); - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(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)) { @@ -1121,9 +1121,9 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { } } - if (this->currentAnimIndex == OBJ_UM_ANIM_TROT) { + if (this->animIndex == OBJ_UM_ANIM_TROT) { this->dyna.actor.speedXZ = 4.0f; - } else if (this->currentAnimIndex == OBJ_UM_ANIM_GALLOP) { + } else if (this->animIndex == OBJ_UM_ANIM_GALLOP) { this->dyna.actor.speedXZ = 8.0f; } @@ -1133,14 +1133,14 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { this->wheelRot += 0x3E8; this->flags &= ~OBJ_UM_FLAG_WAITING; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_ChangeAnim(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->nextEntrance = ENTRANCE(MILK_ROAD, 5); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1156,7 +1156,7 @@ void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { } void ObjUm_RanchStartCs(ObjUm* this, PlayState* play) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -1185,9 +1185,9 @@ void func_80B7A070(ObjUm* this, PlayState* play) { } void func_80B7A0E0(ObjUm* this, PlayState* play) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); if (gSaveContext.save.time != this->lastTime) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); ObjUm_SetupAction(this, func_80B7A070); } } @@ -1199,7 +1199,7 @@ void func_80B7A144(ObjUm* this, PlayState* 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_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); ObjUm_SetupAction(this, ObjUm_RanchStartCs); } @@ -1227,7 +1227,7 @@ void ObjUm_PreMilkRunDialogueHandler(ObjUm* this, PlayState* play) { } void func_80B7A240(ObjUm* this, PlayState* play) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); if (gSaveContext.save.time != this->lastTime) { ObjUm_SetupAction(this, func_80B7A2AC); } @@ -1238,12 +1238,12 @@ void func_80B7A240(ObjUm* this, PlayState* play) { void func_80B7A2AC(ObjUm* this, PlayState* play) { this->wheelRot += 0x3E8; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_ChangeAnim(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->nextEntrance = ENTRANCE(GORMAN_TRACK, 4); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1265,7 +1265,7 @@ 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_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); ObjUm_SetupAction(this, func_80B7A2AC); } } @@ -1290,7 +1290,7 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { ObjUm_RotatePlayer(this, play, 0x7FFF); this->wheelRot += 0x7D0; this->flags |= OBJ_UM_FLAG_0010; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_GALLOP); switch (ObjUm_UpdatePath(this, play)) { case OBJUM_PATH_STATE_1: @@ -1301,14 +1301,14 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) { if (!this->areAllPotsBroken) { - play->nextEntranceIndex = 0x3E60; + play->nextEntrance = ENTRANCE(MILK_ROAD, 6); 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->nextEntrance = ENTRANCE(ROMANI_RANCH, 8); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1333,7 +1333,7 @@ void func_80B7A614(ObjUm* this, PlayState* play) { this->wheelRot += 0x7D0; this->flags |= OBJ_UM_FLAG_0010; this->flags |= OBJ_UM_FLAG_PLAYING_MINIGAME; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_GALLOP); if (ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_3 && this->unk_4DC == 0) { this->unk_4DC = 1; @@ -1387,7 +1387,7 @@ void func_80B7A7AC(ObjUm* this, PlayState* play) { this->flags |= OBJ_UM_FLAG_0010; func_80B78DF0(this, play); this->flags |= 4; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_GALLOP); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_GALLOP); ObjUm_SetupAction(this, func_80B7A614); } @@ -1488,7 +1488,7 @@ void func_80B7A860(ObjUm* this, PlayState* play) { } void func_80B7AB78(ObjUm* this, PlayState* play) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); if (gSaveContext.save.time != this->lastTime) { ObjUm_SetupAction(this, func_80B7ABE4); } @@ -1500,7 +1500,7 @@ void func_80B7AB78(ObjUm* this, PlayState* play) { void func_80B7ABE4(ObjUm* this, PlayState* play) { this->wheelRot += 0x3E8; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); switch (ObjUm_UpdatePath(this, play)) { case OBJUM_PATH_STATE_FINISH: func_80B79524(this); @@ -1543,14 +1543,14 @@ void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play) { ObjUm_RotatePlayer(this, play, 0); this->flags |= OBJ_UM_FLAG_0004; this->wheelRot += 0x3E8; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_TROT); + ObjUm_ChangeAnim(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->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1566,7 +1566,7 @@ void ObjUm_PostMilkRunStartCs(ObjUm* this, PlayState* play) { ObjUm_SetPlayerPosition(this, play); ObjUm_RotatePlayer(this, play, 0); this->flags |= OBJ_UM_FLAG_0004; - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); @@ -1577,7 +1577,7 @@ void ObjUm_PostMilkRunStartCs(ObjUm* this, PlayState* play) { } void ObjUm_TerminaFieldIdle(ObjUm* this, PlayState* play) { - ObjUm_UpdateAnim(this, play, OBJ_UM_ANIM_IDLE); + ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); SkelAnime_Update(&this->skelAnime); } @@ -1627,7 +1627,7 @@ void func_80B7AF30(ObjUm* this, PlayState* play) { void ObjUm_DefaultAnim(ObjUm* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gUmTrotAnim); - this->currentAnimIndex = OBJ_UM_ANIM_TROT; + this->animIndex = OBJ_UM_ANIM_TROT; } typedef struct { @@ -1643,45 +1643,45 @@ struct_80B7C25C sUmAnims[] = { { &gUmLookBackAnim, false }, // OBJ_UM_ANIM_LOOK_BACK }; -void ObjUm_UpdateAnim(ObjUm* this, PlayState* play, ObjUmAnimimations index) { +void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { s32 changeAnim; s32 temp; - s32 indexTemp = index; + s32 indexTemp = animIndex; f32 animPlaybackSpeed = 0.0f; - if (sUmAnims[index].doesMove) { + if (sUmAnims[animIndex].doesMove) { this->flags |= OBJ_UM_FLAG_MOVING; } else { this->flags &= ~OBJ_UM_FLAG_MOVING; } - if (index == OBJ_UM_ANIM_TROT) { + if (animIndex == OBJ_UM_ANIM_TROT) { animPlaybackSpeed = this->dyna.actor.speedXZ * 0.25f; - } else if (index == OBJ_UM_ANIM_GALLOP) { + } else if (animIndex == OBJ_UM_ANIM_GALLOP) { animPlaybackSpeed = this->dyna.actor.speedXZ * 0.2f; - } else if (index == OBJ_UM_ANIM_IDLE) { + } else if (animIndex == 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; + animIndex = OBJ_UM_ANIM_MINUS_1; } - changeAnim = (index != this->currentAnimIndex); + changeAnim = (animIndex != this->animIndex); if (SkelAnime_Update(&this->skelAnime) || changeAnim) { - this->currentAnimIndex = index; + this->animIndex = animIndex; - if (index != OBJ_UM_ANIM_MINUS_1) { + if (animIndex != OBJ_UM_ANIM_MINUS_1) { if (this->donkey != NULL) { - this->donkey->unk_538 = index; + this->donkey->unk_538 = animIndex; } if (changeAnim) { - Animation_MorphToPlayOnce(&this->skelAnime, sUmAnims[index].anim, -3.0f); + Animation_MorphToPlayOnce(&this->skelAnime, sUmAnims[animIndex].anim, -3.0f); } else { - Animation_PlayOnce(&this->skelAnime, sUmAnims[index].anim); + Animation_PlayOnce(&this->skelAnime, sUmAnims[animIndex].anim); } } else { EnHorse* donkey = this->donkey; @@ -1691,10 +1691,10 @@ void ObjUm_UpdateAnim(ObjUm* this, PlayState* play, ObjUmAnimimations index) { } if (changeAnim) { - temp = 3 - index; // OBJ_UM_ANIM_LOOK_BACK + temp = 3 - animIndex; // OBJ_UM_ANIM_LOOK_BACK Animation_MorphToPlayOnce(&this->skelAnime, sUmAnims[temp].anim, -10.0f); } else { - temp = 3 - index; // OBJ_UM_ANIM_LOOK_BACK + temp = 3 - animIndex; // OBJ_UM_ANIM_LOOK_BACK Animation_PlayOnce(&this->skelAnime, sUmAnims[temp].anim); } } 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 9d228eda8..a6644009e 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.h +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.h @@ -11,14 +11,14 @@ typedef void (*ObjUmActionFunc)(struct ObjUm*, PlayState*); #define MILK_POTS_COUNT 3 -typedef enum ObjUmAnimimations { +typedef enum ObjUmAnimation { /* -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; +} ObjUmAnimation; typedef struct ObjUm { /* 0x000 */ DynaPolyActor dyna; @@ -40,7 +40,7 @@ typedef struct ObjUm { /* 0x2F4 */ s32 flags; /* 0x2BC */ Vec3s unk_2F8; /* 0x2FE */ Vec3s unk_2FE; - /* 0x304 */ ObjUmAnimimations currentAnimIndex; + /* 0x304 */ ObjUmAnimation animIndex; /* 0x308 */ Vec3f unk_308; /* 0x314 */ s32 potsLife[MILK_POTS_COUNT]; /* 0x320 */ s32 wasPotHit[MILK_POTS_COUNT]; // resets to false in the same frame @@ -72,8 +72,8 @@ typedef enum { /* 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_GET_TYPE(thisx) (((thisx)->params & 0xFF00) >> 8) +#define OBJ_UM_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) #define OBJ_UM_FLAG_NONE (0) #define OBJ_UM_FLAG_0001 (1 << 0) 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 5a733ecba..83e06a1a3 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -76,7 +76,7 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) { 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); + Play_SetCameraAtEye(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->subCamId, this->actor.shape.rot.z); + Play_SetCameraRoll(play, this->subCamId, this->actor.shape.rot.z); } void func_808A7C04(ObjWturn* this, PlayState* play) { @@ -107,15 +107,15 @@ void func_808A7C78(ObjWturn* this, PlayState* play) { this->unk_14A++; player->actor.world.pos.y = this->actor.world.pos.y + this->unk_14A * 4.0f; - Play_CameraSetAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp); + Play_SetCameraAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp); if (this->unk_14A == 1) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; gSaveContext.nextCutsceneIndex = 0; - if (play->sceneNum == 0x58) { - play->nextEntranceIndex = 0xAC00; + if (play->sceneNum == SCENE_F40) { + play->nextEntrance = ENTRANCE(STONE_TOWER_INVERTED, 0); } else { - play->nextEntranceIndex = 0xAA10; + play->nextEntrance = ENTRANCE(STONE_TOWER, 1); } play->transitionTrigger = TRANS_TRIGGER_START; } diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 0b4e2014e..0247cd23a 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -501,8 +501,8 @@ void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { void func_808DD3C8(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjectKankyo* this = THIS; - Vec3f spC4; - Vec3f spB8; + Vec3f worldPos; + Vec3f screenPos; s16 i; u8 pad2; u8 spB4; @@ -535,12 +535,14 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { } for (i = 0; i < sp68; i++) { - spC4.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; - spC4.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; - spC4.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(play, &spC4, &spB8); + worldPos.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; + worldPos.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; + worldPos.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - if ((spB8.x >= 0.0f) && (spB8.x < 320.0f) && (spB8.y >= 0.0f) && (spB8.y < 240.0f)) { + Play_GetScreenPos(play, &worldPos, &screenPos); + + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { if (!spB4) { spB4 = true; @@ -555,10 +557,10 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex)); } - Matrix_Translate(spC4.x, spC4.y, spC4.z, MTXMODE_NEW); + Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); tempf = (i & 7) * 0.008f; Matrix_Scale(0.05f + tempf, 0.05f + tempf, 0.05f + tempf, MTXMODE_APPLY); - temp_f2 = Math_Vec3f_DistXYZ(&spC4, &play->view.eye) / 300.0f; + temp_f2 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye) / 300.0f; temp_f2 = ((1.0f < temp_f2) ? 0.0f : (((1.0f - temp_f2) > 1.0f) ? 1.0f : 1.0f - temp_f2)); gDPPipeSync(POLY_XLU_DISP++); @@ -577,8 +579,8 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { void func_808DD970(Actor* thisx, PlayState* play2) { f32 temp_f0; f32 temp_f20; - Vec3f spBC; - Vec3f spB0; + Vec3f worldPos; + Vec3f screenPos; f32 tempf; s16 i; f32 phi_f26; @@ -607,15 +609,17 @@ void func_808DD970(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); for (i = 0; i < this->unk_114C; i++) { - spBC.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; - spBC.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; - spBC.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - func_80169474(play, &spBC, &spB0); + worldPos.x = this->unk_14C[i].unk_00 + this->unk_14C[i].unk_0C; + worldPos.y = this->unk_14C[i].unk_04 + this->unk_14C[i].unk_10; + worldPos.z = this->unk_14C[i].unk_08 + this->unk_14C[i].unk_14; - if ((spB0.x >= 0.0f) && (spB0.x < 320.0f) && (spB0.y >= 0.0f) && (spB0.y < 240.0f)) { - Matrix_Translate(spBC.x, spBC.y, spBC.z, MTXMODE_NEW); + Play_GetScreenPos(play, &worldPos, &screenPos); + + if ((screenPos.x >= 0.0f) && (screenPos.x < SCREEN_WIDTH) && (screenPos.y >= 0.0f) && + (screenPos.y < SCREEN_HEIGHT)) { + Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); - temp_f0 = Math_Vec3f_DistXYZ(&spBC, &play->view.eye); + temp_f0 = Math_Vec3f_DistXYZ(&worldPos, &play->view.eye); temp_f0 = (u8)(255.0f * phi_f26) * (1.0f - (temp_f0 / 300.0f)); gDPPipeSync(POLY_XLU_DISP++); @@ -644,23 +648,22 @@ f32 func_808DDE74(void) { } #ifdef NON_MATCHING -// play->envCtx.unk_F2[1] needs to be loaded into s0 and then copied to s7 +// s2/s3 swapped void func_808DDE9C(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjectKankyo* this = THIS; Player* player = GET_PLAYER(play); s32 i; - s16 temp; + u8 phi_s5; + u16 end = play->envCtx.unk_F2[1]; f32 temp_f12; f32 temp_f20; f32 temp_f22; f32 temp_f2; - u8 phi_s5; - s32 end = play->envCtx.unk_F2[1]; OPEN_DISPS(play->state.gfxCtx); - if (end != 0) { + if (end) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 255, 255, 25); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); diff --git a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c index 3eee00a94..5a71ef0d1 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c +++ b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.c @@ -15,7 +15,6 @@ void OceffWipe7_Destroy(Actor* thisx, PlayState* play); void OceffWipe7_Update(Actor* thisx, PlayState* play); void OceffWipe7_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe7_InitVars = { ACTOR_OCEFF_WIPE7, ACTORCAT_ITEMACTION, @@ -28,12 +27,77 @@ const ActorInit Oceff_Wipe7_InitVars = { (ActorFunc)OceffWipe7_Draw, }; -#endif +#include "assets/overlays/ovl_Oceff_Wipe7/ovl_Oceff_Wipe7.c" -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe7/OceffWipe7_Init.s") +s32 D_80BCEB10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe7/OceffWipe7_Destroy.s") +void OceffWipe7_Init(Actor* thisx, PlayState* play) { + OceffWipe7* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe7/OceffWipe7_Update.s") + Actor_SetScale(&this->actor, 1.0f); + this->counter = 0; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe7/OceffWipe7_Draw.s") +void OceffWipe7_Destroy(Actor* thisx, PlayState* play) { + OceffWipe7* this = THIS; + + func_80115D5C(&play->state); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe7_Update(Actor* thisx, PlayState* play) { + OceffWipe7* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->counter < 100) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void OceffWipe7_Draw(Actor* thisx, PlayState* play) { + OceffWipe7* this = THIS; + f32 z; + u8 alpha; + s32 i; + s32 counter; + Vec3f activeCamEye = GET_ACTIVE_CAM(play)->eye; + s32 pad; + Vec3f quakeOffset; + s32 pad2; + + Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play)); + + if (this->counter < 32) { + z = Math_SinS(this->counter * 0x200) * 1220.0f; + } else { + z = 1220.0f; + } + + if (this->counter >= 80) { + alpha = 12 * (100 - this->counter); + } else { + alpha = 255; + } + + for (i = 1; i < ARRAY_COUNT(sSongofHealingEffectFrustrumVtx); i += 2) { + sSongofHealingEffectFrustrumVtx[i].v.cn[3] = alpha; + } + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + Matrix_Translate(activeCamEye.x + quakeOffset.x, activeCamEye.y + quakeOffset.y, activeCamEye.z + quakeOffset.z, + MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateXS(0x708, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + AnimatedMat_Draw(play, sSongofHealingEffectTexAnim); + gSPDisplayList(POLY_XLU_DISP++, sSongOfHealingEffectFrustumDL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.h b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.h index df517e1fe..d5d82130c 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.h +++ b/src/overlays/actors/ovl_Oceff_Wipe7/z_oceff_wipe7.h @@ -7,7 +7,7 @@ struct OceffWipe7; typedef struct OceffWipe7 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 counter; } OceffWipe7; // size = 0x148 extern const ActorInit Oceff_Wipe7_InitVars; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index b1d6bb8af..6dfbce5a1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -5,23 +5,141 @@ */ #include "z_eff_ss_dead_dd.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScale regs[0] +#define rPrimColorR regs[2] +#define rPrimColorG regs[3] +#define rPrimColorB regs[4] +#define rAlpha regs[5] +#define rEnvColorR regs[6] +#define rEnvColorG regs[7] +#define rEnvColorB regs[8] +#define rScaleStep regs[9] +#define rAlphaStep regs[10] +#define rAlphaMode regs[11] #define PARAMS ((EffectSsDeadDdInitParams*)initParamsx) -s32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Dead_Dd_InitVars = { EFFECT_SS_DEAD_DD, EffectSsDeadDd_Init, }; -#endif +u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsDeadDdInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Dd/EffectSsDeadDd_Init.s") + if (initParams->type == DEADDD_TYPE_0) { + this->pos = initParams->pos; + this->velocity = initParams->velocity; + this->accel = initParams->accel; + this->life = initParams->life; + this->rScaleStep = initParams->scaleStep; + this->rAlphaMode = initParams->alphaStep; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Dd/EffectSsDeadDd_Draw.s") + if (initParams->alphaStep != 0) { + this->rAlphaStep = initParams->alphaStep; + } else { + this->rAlphaStep = initParams->primColor.a / initParams->life; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Dd/EffectSsDeadDd_Update.s") + this->draw = EffectSsDeadDd_Draw; + this->update = EffectSsDeadDd_Update; + this->rScale = initParams->scale; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rAlpha = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + + } else if (initParams->type == DEADDD_TYPE_1) { + s32 i; + + this->life = initParams->life; + this->rScaleStep = initParams->scaleStep; + this->rAlphaMode = 0; + this->rAlphaStep = 155 / initParams->life; + this->rScale = initParams->scale; + this->rPrimColorR = 255; + this->rPrimColorG = 255; + this->rPrimColorB = 155; + this->rAlpha = 155; + this->rEnvColorR = 250; + this->rEnvColorG = 180; + this->rEnvColorB = 0; + this->draw = EffectSsDeadDd_Draw; + this->update = EffectSsDeadDd_Update; + + for (i = initParams->randIter; i > 0; i--) { + this->pos.x = ((Rand_ZeroOne() - 0.5f) * initParams->randPosScale) + initParams->pos.x; + this->pos.y = ((Rand_ZeroOne() - 0.5f) * initParams->randPosScale) + initParams->pos.y; + this->pos.z = ((Rand_ZeroOne() - 0.5f) * initParams->randPosScale) + initParams->pos.z; + this->accel.x = this->velocity.x = (Rand_ZeroOne() - 0.5f) * 2.0f; + this->accel.y = this->velocity.y = (Rand_ZeroOne() - 0.5f) * 2.0f; + this->accel.z = this->velocity.z = (Rand_ZeroOne() - 0.5f) * 2.0f; + } + } else { + return 0; + } + + return 1; +} + +void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + MtxF mfTrans; + MtxF mfScale; + MtxF mfResult; + Mtx* mtx; + f32 scale; + + OPEN_DISPS(gfxCtx); + + scale = this->rScale * 0.01f; + SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); + SkinMatrix_SetScale(&mfScale, scale, scale, scale); + SkinMatrix_MtxFMtxFMult(&mfTrans, &mfScale, &mfResult); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); + + if (mtx != NULL) { + func_8012C974(gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rAlpha); + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, + PRIMITIVE, 0); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054940); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this) { + + this->rScale += this->rScaleStep; + + if (this->rScale < 0) { + this->rScale = 0; + } + + if (this->rAlphaMode != 0) { + this->rAlpha += this->rAlphaStep; + if (this->rAlpha > 255) { + this->rAlpha = 255; + } + } else { + if (this->rAlpha < this->rAlphaStep) { + this->rAlpha = 0; + } else { + this->rAlpha -= this->rAlphaStep; + } + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h index e344df407..9c9dcf28e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h @@ -3,6 +3,11 @@ #include "global.h" +typedef enum { + /* 0 */ DEADDD_TYPE_0, + /* 1 */ DEADDD_TYPE_1 // Unused +} DeadDDType; + typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 49448b32e..fab6f8788 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -5,23 +5,144 @@ */ #include "z_eff_ss_en_fire.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScaleMax regs[0] +#define rScale regs[1] +#define rLifespan regs[2] +#define rUnused regs[3] +#define rPitch regs[4] +#define rYaw regs[5] +#define rReg6 regs[6] +#define rBodyPart regs[7] +#define rFlags regs[8] +#define rScroll regs[9] #define PARAMS ((EffectSsEnFireInitParams*)initParamsx) -s32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; -#endif +u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsEnFireInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Init.s") + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = 20; + this->rLifespan = this->life; + this->actor = initParams->actor; + this->rScroll = Rand_ZeroOne() * 20.0f; + this->draw = EffectSsEnFire_Draw; + this->update = EffectSsEnFire_Update; + this->rUnused = -15; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Draw.s") + if (initParams->bodyPart < 0) { + this->rYaw = Math_Vec3f_Yaw(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.y; + this->rPitch = + Math_Vec3f_Pitch(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.x; + this->vec.z = Math_Vec3f_DistXYZ(&initParams->pos, &initParams->actor->world.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Update.s") + this->rScaleMax = initParams->scale; + + if (initParams->params & ENFIRE_PARAMS_USE_SCALE) { + this->rScale = initParams->scale; + } else { + this->rScale = 0; + } + + this->rReg6 = initParams->params & 0x7FFF; + this->rBodyPart = initParams->bodyPart; + this->rFlags = initParams->flags; + + return 1; +} + +void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + f32 scale; + s16 camYaw; + s32 pad[3]; + s16 redGreen; + + OPEN_DISPS(gfxCtx); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000); + Matrix_RotateYS(camYaw, MTXMODE_APPLY); + + scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + redGreen = this->life - 5; + + if (redGreen < 0) { + redGreen = 0; + } + + func_8012C2DC(play->state.gfxCtx); + gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0); + gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -20) & 0x1FF, 0x20, 0x80)); + + if ((this->rFlags & 0x7FFF) || (this->life < 18)) { + gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); + } else { + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + } + + CLOSE_DISPS(gfxCtx); +} + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3f firePos[10]; +} FireActorF; // size = 0x1BC + +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3s firePos[10]; +} FireActorS; // size = 0x180 + +void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) { + this->rScroll++; + + if (this->actor != NULL) { + if (this->actor->colorFilterTimer >= 22) { + this->life++; + } + if (this->actor->update != NULL) { + Math_SmoothStepToS(&this->rScale, this->rScaleMax, 1, this->rScaleMax >> 3, 0); + + if (this->rBodyPart < 0) { + Matrix_Translate(this->actor->world.pos.x, this->actor->world.pos.y, this->actor->world.pos.z, + MTXMODE_NEW); + Matrix_RotateYS(this->rYaw + this->actor->shape.rot.y, MTXMODE_APPLY); + Matrix_RotateXS(this->rPitch + this->actor->shape.rot.x, MTXMODE_APPLY); + Matrix_MultVec3f(&this->vec, &this->pos); + } else if (this->rFlags & ENFIRE_FLAGS_BODYPART_POS_VEC3S) { + this->pos.x = ((FireActorS*)this->actor)->firePos[this->rBodyPart].x; + this->pos.y = ((FireActorS*)this->actor)->firePos[this->rBodyPart].y; + this->pos.z = ((FireActorS*)this->actor)->firePos[this->rBodyPart].z; + } else { + this->pos.x = ((FireActorF*)this->actor)->firePos[this->rBodyPart].x; + this->pos.y = ((FireActorF*)this->actor)->firePos[this->rBodyPart].y; + this->pos.z = ((FireActorF*)this->actor)->firePos[this->rBodyPart].z; + } + } else if (this->rReg6 != 0) { + this->life = 0; + } else { + this->actor = NULL; + } + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index 987e426da..9fb959824 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -3,11 +3,14 @@ #include "global.h" +#define ENFIRE_FLAGS_BODYPART_POS_VEC3S (1 << 15) +#define ENFIRE_PARAMS_USE_SCALE (1 << 15) + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 scale; - /* 0x12 */ s16 unk_12; + /* 0x12 */ s16 params; /* 0x14 */ s16 flags; /* 0x16 */ s16 bodyPart; } EffectSsEnFireInitParams; // size = 0x18 diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index aa5ec5140..7d6cf277c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -1,30 +1,157 @@ /* * File: z_eff_ss_en_ice.c * Overlay: ovl_Effect_Ss_En_Ice - * Description: + * Description: Ice clumps */ #include "z_eff_ss_en_ice.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rLifespan regs[0] +#define rYaw regs[1] +#define rPitch regs[2] +#define rRotSpeed regs[3] +#define rPrimColorR regs[4] +#define rPrimColorG regs[5] +#define rPrimColorB regs[6] +#define rPrimColorA regs[7] +#define rEnvColorR regs[8] +#define rEnvColorG regs[9] +#define rEnvColorB regs[10] +#define rAlphaMode regs[11] +#define rScale regs[12] #define PARAMS ((EffectSsEnIceInitParams*)initParamsx) -s32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); -void func_8097F62C(PlayState* play, u32 index, EffectSs* this); -void func_8097F7EC(PlayState* play, u32 index, EffectSs* this); +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; -#endif +u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsEnIceInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Init.s") + if (initParams->type == ENICE_TYPE_FLYING) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Draw.s") + if (initParams->actor != NULL) { + Math_Vec3f_Diff(&this->pos, &initParams->actor->world.pos, &this->vec); + } else { + Math_Vec3f_Copy(&this->vec, &initParams->pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F62C.s") + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = 10; + this->actor = initParams->actor; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_UpdateFlying; + this->rScale = initParams->scale * 100.0f; + 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->rAlphaMode = 1; + this->rPitch = randPlusMinusPoint5Scaled(0x10000); + } else if (initParams->type == ENICE_TYPE_NORMAL) { + Math_Vec3f_Copy(&this->pos, &initParams->pos); + Math_Vec3f_Copy(&this->vec, &initParams->pos); + Math_Vec3f_Copy(&this->velocity, &initParams->velocity); + Math_Vec3f_Copy(&this->accel, &initParams->accel); + this->life = initParams->life; + this->draw = EffectSsEnIce_Draw; + this->update = EffectSsEnIce_Update; + this->rLifespan = initParams->life; + this->rScale = initParams->scale * 100.0f; + this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x); + this->rPitch = 0; + 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->rAlphaMode = 0; + } else { + return 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F7EC.s") + return 1; +} + +void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; + f32 scale = this->rScale * 0.01f; + u32 gameplayFrames = play->gameplayFrames; + f32 alpha; + + OPEN_DISPS(gfxCtx); + + if (this->rAlphaMode != 0) { + alpha = this->life * 12.0f; + } else if ((this->rLifespan > 0) && (this->life < (this->rLifespan >> 1))) { + alpha = (this->life * 2.0f) / this->rLifespan; + alpha *= 255.0f; + } else { + alpha = 255.0f; + } + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_RotateYS(this->rYaw, MTXMODE_APPLY); + Matrix_RotateXS(this->rPitch, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + func_8012C2DC(play->state.gfxCtx); + func_800BCC68(&this->pos, play); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0, + (gameplayFrames * 2) & 0xFF, 0x40, 0x20)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, + this->rPrimColorA); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, (u32)alpha); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) { + s16 rand; + + if ((this->actor != NULL) && (this->actor->update != NULL)) { + if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) { + Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos); + this->life++; + } else if (this->life == 9) { + this->accel.x = Math_SinS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f); + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } else { + this->actor = NULL; + if (this->life >= 9) { + rand = randPlusMinusPoint5Scaled(0xFFFF); + this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f); + this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f); + this->life = 8; + this->accel.y = -1.5f; + this->velocity.y = 5.0f; + } + } +} + +void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) { + this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing +} diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index ed0c6d457..46b162cc1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -3,6 +3,11 @@ #include "global.h" +typedef enum EffectSsEnIceType { + /* 0 */ ENICE_TYPE_FLYING, + /* 1 */ ENICE_TYPE_NORMAL +} EffectSsEnIceType; + typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 073b6bb1d..764828bf4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -1,27 +1,119 @@ /* * File: z_eff_ss_fhg_flash.c * Overlay: ovl_Effect_Ss_Fhg_Flash - * Description: + * Description: Shock and Light Ball Effect */ #include "z_eff_ss_fhg_flash.h" +#include "overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h" +#include "assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.h" + +#define rAlpha regs[0] +#define rXZRot regs[3] +#define rParams regs[4] +#define rScale regs[8] #define PARAMS ((EffectSsFhgFlashInitParams*)initParamsx) -s32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, EffectSsFhgFlash_Init, }; -#endif +u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + EffectSsFhgFlashInitParams* initParams = PARAMS; + Vec3f noActorPos = { 0.0f, -1000.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Init.s") + this->actor = initParams->actor; + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); + Math_Vec3f_Copy(&this->accel, &gZeroVec3f); + this->life = (s32)(Rand_ZeroOne() * 10.0f) + 111; + this->rScale = (s32)Rand_ZeroFloat(initParams->scale) + initParams->scale; + this->rAlpha = 255; + this->draw = EffectSsFhgFlash_Draw; + this->update = EffectSsFhgFlash_Update; + this->rParams = initParams->params; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Draw.s") + if (initParams->params != FHGFLASH_SHOCK_NO_ACTOR) { + this->pos = noActorPos; + this->gfx = gEffFhgFlashDL; + } else { + this->pos = initParams->pos; + this->gfx = gEffFhgFlashDL; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Update.s") + return 1; +} + +#include "overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.c" + +void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this) { + s32 pad; + GraphicsContext* gfxCtx = play->state.gfxCtx; + f32 scale = this->rScale / 100.0f; + + OPEN_DISPS(gfxCtx); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + if (this->rParams != FHGFLASH_SHOCK_NO_ACTOR) { + func_8012C448(play->state.gfxCtx); + Matrix_RotateXS(this->rXZRot, MTXMODE_APPLY); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2); + } else { + func_8012C2DC(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); + gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); + } + gDPPipeSync(POLY_XLU_DISP++); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 155, 0); + Matrix_RotateZS(this->rXZRot, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { + s16 randBodyPart; + s16 rand = Rand_ZeroOne() * 20000.0f; + + this->rXZRot = (this->rXZRot + rand) + 0x4000; + if (this->rParams == FHGFLASH_SHOCK_PLAYER) { + Player* player = GET_PLAYER(play); + + randBodyPart = Rand_ZeroFloat(18 - 0.1f); + this->pos.x = player->bodyPartsPos[randBodyPart].x + randPlusMinusPoint5Scaled(10.0f); + this->pos.y = player->bodyPartsPos[randBodyPart].y + randPlusMinusPoint5Scaled(15.0f); + this->pos.z = player->bodyPartsPos[randBodyPart].z + randPlusMinusPoint5Scaled(10.0f); + } else if ((this->rParams >= FHGFLASH_SHOCK_GOHT_2) && (this->rParams <= FHGFLASH_SHOCK_GOHT_6)) { + s32 pad; + Vec3f* bodyPartPos; + BossHakugin* goht = (BossHakugin*)this->actor; + s32 index = goht->unk_191 - 3; + + if (index < 0) { + bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00; + } else { + bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00; + } + + this->pos.x = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->x; + this->pos.y = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->y; + this->pos.z = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->z; + } + if (this->life < 100) { + this->rAlpha -= 50; + if (this->rAlpha < 0) { + this->rAlpha = 0; + this->life = 0; + } + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h index 0598377f8..c464047b5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h @@ -23,7 +23,11 @@ typedef enum { typedef enum { /* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR, /* 0x01 */ FHGFLASH_SHOCK_PLAYER, - /* 0x02 */ FHGFLASH_SHOCK_PG + /* 0x02 */ FHGFLASH_SHOCK_GOHT_2, + /* 0x03 */ FHGFLASH_SHOCK_GOHT_3, + /* 0x04 */ FHGFLASH_SHOCK_GOHT_4, + /* 0x05 */ FHGFLASH_SHOCK_GOHT_5, + /* 0x06 */ FHGFLASH_SHOCK_GOHT_6 } FhgFlashLightningParam; typedef struct { @@ -31,7 +35,7 @@ typedef struct { /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; /* 0x24 */ s16 scale; - /* 0x26 */ u8 param; + /* 0x26 */ u8 params; /* 0x28 */ Actor* actor; /* 0x2C */ u8 type; } EffectSsFhgFlashInitParams; // size = 0x30 diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index ea4c47da5..da4de14d6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -1,27 +1,142 @@ /* * File: z_eff_ss_fire_tail.c * Overlay: ovl_Effect_Ss_Fire_Tail - * Description: + * Description: Fire (burned by something) */ #include "z_eff_ss_fire_tail.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScale regs[0] +#define rLifespan regs[1] +#define rReg2 regs[2] +#define rReg3 regs[3] +#define rPrimColorR regs[4] +#define rPrimColorG regs[5] +#define rPrimColorB regs[6] +#define rEnvColorR regs[7] +#define rEnvColorG regs[8] +#define rEnvColorB regs[9] +#define rReg10 regs[10] +#define rBodyPart regs[11] +#define rType regs[12] #define PARAMS ((EffectSsFireTailInitParams*)initParamsx) -s32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; -#endif +u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsFireTailInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Init.s") + this->pos = initParams->pos; + this->vec = initParams->unk_14; + this->velocity.x = 0.0f; + this->velocity.y = 0.0f; + this->velocity.z = 0.0f; + this->accel.x = 0.0f; + this->accel.y = 0.0f; + this->accel.z = 0.0f; + this->life = initParams->life; + this->actor = initParams->actor; + this->draw = EffectSsFireTail_Draw; + this->update = EffectSsFireTail_Update; + this->rScale = initParams->scale * 1000.0f; + this->rLifespan = initParams->life; + this->rReg2 = -10; + this->rReg3 = -15; + if (initParams->unk_20 == 0) { + initParams->unk_20 = 1; + } + this->rReg10 = initParams->unk_20; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rBodyPart = initParams->bodyPart; + this->rType = initParams->type; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fire_Tail/EffectSsFireTail_Update.s") +void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; + s16 yawDiff; + Vec3f scale; + f32 temp1; + f32 temp2; + f32 dist; + + OPEN_DISPS(gfxCtx); + + scale.x = scale.y = scale.z = 0.0f; + + if (this->actor != NULL) { + this->vec = this->actor->velocity; + + if (this->rBodyPart < 0) { + Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, + this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); + } else { + Player* player = GET_PLAYER(play); + s16 bodyPart = this->rBodyPart; + + this->pos.x = + player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); + this->pos.y = player->bodyPartsPos[bodyPart].y; + this->pos.z = + player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))) * 5.0f); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + } + } else { + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + } + + yawDiff = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); + temp1 = fabsf(Math_CosS(yawDiff)); + temp2 = Math_SinS(yawDiff); + dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); + Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(temp2 * this->rReg2 * dist), MTXMODE_APPLY); + temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); + temp2 = 1.0f - SQ(temp2); + scale.x = scale.y = scale.z = temp2 * (this->rScale * (0.001f * 0.01f)); + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); + temp1 = (this->rReg3 * 0.01f * temp1 * dist) + 1.0f; + + if (temp1 < 0.1f) { + temp1 = 0.1f; + } + + Matrix_Scale(1.0f, temp1, 1.0f / temp1, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C2DC(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0); + gSPSegment( + POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (play->state.frames * -20) & 0x1FF, 32, 128)); + + if (this->rType != 0) { + gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL); + } else { + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + } + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this) { + this->rScale *= 0.9f; +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 8b59e40fa..ebc28b469 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -66,12 +66,12 @@ void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_RotateXS(this->rPitch, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_8012C2DC(play->state.gfxCtx); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (s32)alpha & 0xFF); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)(s32)alpha); func_800BCC68(&this->pos, play); gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20)); - gSPDisplayList(POLY_XLU_DISP++, gEffIceFragmentDL); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL); CLOSE_DISPS(gfxCtx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index d027f09dd..4aa209639 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -76,7 +76,7 @@ void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); CLOSE_DISPS(gfxCtx); } diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index cf8c4f93c..bc5e46940 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -7,7 +7,7 @@ #include "z_opening.h" void Opening_SetupForTitleCutscene(OpeningContext* this) { - static s32 openingEntrances[] = { 0x1C00, 0x1C10 }; + static s32 openingEntrances[] = { ENTRANCE(CUTSCENE, 0), ENTRANCE(CUTSCENE, 1) }; static s32 openingCutscenes[] = { 0xFFFA, 0xFFFA }; gSaveContext.eventInf[1] &= (u8)~0x80; @@ -15,7 +15,7 @@ void Opening_SetupForTitleCutscene(OpeningContext* this) { Sram_InitNewSave(); - gSaveContext.save.entranceIndex = openingEntrances[D_801BB12C]; + gSaveContext.save.entrance = openingEntrances[D_801BB12C]; gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = openingCutscenes[D_801BB12C]; gSaveContext.sceneSetupIndex = 0; @@ -57,8 +57,8 @@ void Opening_Init(GameState* thisx) { this->gameState.destroy = Opening_Destroy; gSaveContext.respawnFlag = 0; - gSaveContext.respawn[RESPAWN_MODE_GORON].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_ZORA].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_DEKU].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_HUMAN].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_ZORA].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_DEKU].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_HUMAN].entrance = 0xFF; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index e7925f400..0147cca64 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -17,7 +17,7 @@ void MapSelect_LoadTitle(MapSelectState* this) { SET_NEXT_GAMESTATE(&this->state, Title_Init, TitleContext); } -void MapSelect_LoadGame(MapSelectState* this, u32 entranceIndex, s32 opt) { +void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { if (gSaveContext.fileNum == 0xFF) { Sram_InitDebugSave(); } @@ -33,26 +33,26 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entranceIndex, s32 opt) { gSaveContext.unk_3F24 = 0; Audio_QueueSeqCmd(NA_BGM_STOP); - gSaveContext.save.entranceIndex = entranceIndex; + gSaveContext.save.entrance = entrance; - if (opt != 0) { - gSaveContext.save.entranceIndex = - Entrance_CreateIndex((s32)gSaveContext.save.entranceIndex >> 9, opt, gSaveContext.save.entranceIndex & 0xF); + if (spawn != 0) { + gSaveContext.save.entrance = + Entrance_Create((s32)gSaveContext.save.entrance >> 9, spawn, gSaveContext.save.entrance & 0xF); } - if (gSaveContext.save.entranceIndex == 0xC000) { + if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 0)) { gSaveContext.save.day = 0; gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; } - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = 0xFFFF; + gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = 0xFFFF; gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; gSaveContext.nightSeqIndex = 0xFF; gSaveContext.showTitleCard = true; gSaveContext.respawnFlag = 0; - gSaveContext.respawn[RESPAWN_MODE_GORON].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_ZORA].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_DEKU].entranceIndex = 0xFF; - gSaveContext.respawn[RESPAWN_MODE_HUMAN].entranceIndex = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_ZORA].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_DEKU].entrance = 0xFF; + gSaveContext.respawn[RESPAWN_MODE_HUMAN].entrance = 0xFF; gWeatherMode = 0; do { @@ -65,434 +65,443 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entranceIndex, s32 opt) { // "Translation" (Actual name) static SceneSelectEntry sScenes[] = { // "0: OP Woods for Cutscene Use" (Forest Opening Scene) - { " 0:OP" GFXP_KATAKANA "デモ" GFXP_HIRAGANA "ヨウ シンリン", MapSelect_LoadGame, 0x1C00 }, + { " 0:OP" GFXP_KATAKANA "デモ" GFXP_HIRAGANA "ヨウ シンリン", MapSelect_LoadGame, ENTRANCE(CUTSCENE, 0) }, // "0-0: Lost Woods" (Lost Woods) - { " 0-0:" GFXP_HIRAGANA "マヨイ ノ モリ", MapSelect_LoadGame, 0xC400 }, + { " 0-0:" GFXP_HIRAGANA "マヨイ ノ モリ", MapSelect_LoadGame, ENTRANCE(LOST_WOODS, 0) }, // "1: Town Outskirts" (Termina Field) - { " 1:" GFXP_KATAKANA "タウン " GFXP_HIRAGANA "コウガイ", MapSelect_LoadGame, 0x5400 }, + { " 1:" GFXP_KATAKANA "タウン " GFXP_HIRAGANA "コウガイ", MapSelect_LoadGame, ENTRANCE(TERMINA_FIELD, 0) }, // "1-0: Astral Observatory" (Astral Observatory) - { " 1-0:" GFXP_HIRAGANA "テンモンカンソクジョ", MapSelect_LoadGame, 0x4C00 }, + { " 1-0:" GFXP_HIRAGANA "テンモンカンソクジョ", MapSelect_LoadGame, ENTRANCE(ASTRAL_OBSERVATORY, 0) }, // "1-1: Astral Observatory Telescope" (Astral Observatory - Telescope) - { " 1-1:" GFXP_HIRAGANA "テンモンカンソクジョ デ ボウエンキョウ", MapSelect_LoadGame, 0x54A0 }, + { " 1-1:" GFXP_HIRAGANA "テンモンカンソクジョ デ ボウエンキョウ", MapSelect_LoadGame, ENTRANCE(TERMINA_FIELD, 10) }, // "1-2: Ikana Graveyard" (Ikana Canyon Graveyard) - { " 1-2:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ノ ハカバ", MapSelect_LoadGame, 0x8000 }, + { " 1-2:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ノ ハカバ", MapSelect_LoadGame, ENTRANCE(IKANA_GRAVEYARD, 0) }, // "2: Romani Ranch" (Romani Ranch) - { " 2:" GFXP_KATAKANA "ロマニー " GFXP_HIRAGANA "ボクジョウ", MapSelect_LoadGame, 0x6400 }, + { " 2:" GFXP_KATAKANA "ロマニー " GFXP_HIRAGANA "ボクジョウ", MapSelect_LoadGame, ENTRANCE(ROMANI_RANCH, 0) }, // "3: Milk Road" (Milk Road) - { " 3:" GFXP_KATAKANA "ミルクロード", MapSelect_LoadGame, 0x3E00 }, + { " 3:" GFXP_KATAKANA "ミルクロード", MapSelect_LoadGame, ENTRANCE(MILK_ROAD, 0) }, // "4: Main Building" ("Ranch House) - { " 4:" GFXP_HIRAGANA "オモヤ", MapSelect_LoadGame, 0x610 }, + { " 4:" GFXP_HIRAGANA "オモヤ", MapSelect_LoadGame, ENTRANCE(RANCH_HOUSE, 1) }, // "5: Cow Shed" (Cow Shed) - { " 5:" GFXP_HIRAGANA "ウシゴヤ", MapSelect_LoadGame, 0x600 }, + { " 5:" GFXP_HIRAGANA "ウシゴヤ", MapSelect_LoadGame, ENTRANCE(RANCH_HOUSE, 0) }, // "6: Cucco Shed" (Cucco Shed) - { " 6:" GFXP_KATAKANA "コッコ " GFXP_HIRAGANA "ゴヤ", MapSelect_LoadGame, 0x7E00 }, + { " 6:" GFXP_KATAKANA "コッコ " GFXP_HIRAGANA "ゴヤ", MapSelect_LoadGame, ENTRANCE(CUCCO_SHACK, 0) }, // "7: Dog Racing Area" (Doggy Racetrack) - { " 7:" GFXP_KATAKANA "ドッグレース" GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, 0x7C00 }, + { " 7:" GFXP_KATAKANA "ドッグレース" GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, ENTRANCE(DOGGY_RACETRACK, 0) }, // "8: Gorman Track" (Gorman Track) - { " 8:" GFXP_KATAKANA "ゴーマン トラック", MapSelect_LoadGame, 0xCE00 }, + { " 8:" GFXP_KATAKANA "ゴーマン トラック", MapSelect_LoadGame, ENTRANCE(GORMAN_TRACK, 0) }, // "10: Mountain Village -Winter-" (Mountain Village - Winter) - { " 10:" GFXP_HIRAGANA "ヤマザト -フユ-", MapSelect_LoadGame, 0x9A00 }, + { " 10:" GFXP_HIRAGANA "ヤマザト -フユ-", MapSelect_LoadGame, ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 0) }, // "10-0: Mountain Village -Spring-" (Mountain Village - Spring) - { " 10-0:" GFXP_HIRAGANA "ヤマザト -ハル-", MapSelect_LoadGame, 0xAE00 }, + { " 10-0:" GFXP_HIRAGANA "ヤマザト -ハル-", MapSelect_LoadGame, ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 0) }, // "10-1: Mountain Village Blacksmith" (Mountain Smithy) - { " 10-1:" GFXP_HIRAGANA "ヤマザト ノ カジヤ", MapSelect_LoadGame, 0x5200 }, + { " 10-1:" GFXP_HIRAGANA "ヤマザト ノ カジヤ", MapSelect_LoadGame, ENTRANCE(MOUNTAIN_SMITHY, 0) }, // "11: Goron Village -Winter-" (Goron Village - Winter) - { " 11:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -フユ-", MapSelect_LoadGame, 0x9400 }, + { " 11:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -フユ-", MapSelect_LoadGame, ENTRANCE(GORON_VILLAGE_WINTER, 0) }, // "11-0: Goron Village -Spring-" (Goron Village - Spring) - { " 11-0:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -ハル-", MapSelect_LoadGame, 0x8A00 }, + { " 11-0:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ サト -ハル-", MapSelect_LoadGame, ENTRANCE(GORON_VILLAGE_SPRING, 0) }, // "11-1: Goron Shrine" (Goron Shrine) - { " 11-1:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ ホコラ", MapSelect_LoadGame, 0x5E00 }, + { " 11-1:" GFXP_KATAKANA "ゴロン" GFXP_HIRAGANA " ノ ホコラ", MapSelect_LoadGame, ENTRANCE(GORON_SHRINE, 0) }, // "11-2: Lone Peak Shrine" (Lone Peak Shrine) - { " 11-2:" GFXP_HIRAGANA "ハナレヤマ ノ ホコラ", MapSelect_LoadGame, 0x1500 }, + { " 11-2:" GFXP_HIRAGANA "ハナレヤマ ノ ホコラ", MapSelect_LoadGame, ENTRANCE(GROTTOS, 16) }, // "11-3: Goron Shop" (Goron Shop) - { " 11-3:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x7400 }, + { " 11-3:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, ENTRANCE(GORON_SHOP, 0) }, // "12: Snowhead" (Snowhead) - { " 12:" GFXP_KATAKANA "スノーヘッド", MapSelect_LoadGame, 0xB200 }, + { " 12:" GFXP_KATAKANA "スノーヘッド", MapSelect_LoadGame, ENTRANCE(SNOWHEAD, 0) }, // "13: Blizzard Path" (Path to Goron Village - Part 1) - { " 13:" GFXP_HIRAGANA "フブキ ノ ミチ", MapSelect_LoadGame, 0x3200 }, + { " 13:" GFXP_HIRAGANA "フブキ ノ ミチ", MapSelect_LoadGame, ENTRANCE(PATH_TO_MOUNTAIN_VILLAGE, 0) }, // "14: Snowball Path" (Path to Goron Village - Part 2) - { " 14:" GFXP_HIRAGANA "ユキダマ ノ ミチ", MapSelect_LoadGame, 0xB000 }, + { " 14:" GFXP_HIRAGANA "ユキダマ ノ ミチ", MapSelect_LoadGame, ENTRANCE(PATH_TO_SNOWHEAD, 0) }, // "15: Goron Racetrack" (Goron Racetrack) - { " 15:" GFXP_KATAKANA "ゴロンレース " GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, 0xD000 }, + { " 15:" GFXP_KATAKANA "ゴロンレース " GFXP_HIRAGANA "ジョウ", MapSelect_LoadGame, ENTRANCE(GORON_RACETRACK, 0) }, // "16: Goron Grave" (Darmani's Grave) - { " 16:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ハカ", MapSelect_LoadGame, 0x9600 }, + { " 16:" GFXP_KATAKANA "ゴロン " GFXP_HIRAGANA "ノ ハカ", MapSelect_LoadGame, ENTRANCE(GORON_GRAVERYARD, 0) }, // "17: Snow Field Battle -Winter-" (Path to Goron Village - Winter) - { " 17:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-フユ-", MapSelect_LoadGame, 0xB400 }, + { " 17:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-フユ-", MapSelect_LoadGame, + ENTRANCE(PATH_TO_GORON_VILLAGE_WINTER, 0) }, // "17-0: Snow Field Battle -Spring-" (Path to Goron Village - Spring) - { " 17-0:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-ハル-", MapSelect_LoadGame, 0xB600 }, + { " 17-0:" GFXP_HIRAGANA "セツゲン " GFXP_KATAKANA "バトル " GFXP_HIRAGANA "-ハル-", MapSelect_LoadGame, + ENTRANCE(PATH_TO_GORON_VILLAGE_SPRING, 0) }, // "20: Swampland" (Southern Swamp) - { " 20:" GFXP_HIRAGANA "ヌマチ", MapSelect_LoadGame, 0x8400 }, + { " 20:" GFXP_HIRAGANA "ヌマチ", MapSelect_LoadGame, ENTRANCE(SOUTHERN_SWAMP_POISONED, 0) }, // "20-0: Swampland - Afterwards" (Southern Swamp - After Odolwa) - { " 20-0:" GFXP_HIRAGANA "ヌマチ ソノゴ", MapSelect_LoadGame, 0xC00 }, + { " 20-0:" GFXP_HIRAGANA "ヌマチ ソノゴ", MapSelect_LoadGame, ENTRANCE(SOUTHERN_SWAMP_CLEARED, 0) }, // "20-1: Swamp Tourist Information" (Tourist Information) - { " 20-1:" GFXP_HIRAGANA "ヌマ ノ カンコウアンナイ", MapSelect_LoadGame, 0xA800 }, + { " 20-1:" GFXP_HIRAGANA "ヌマ ノ カンコウアンナイ", MapSelect_LoadGame, ENTRANCE(TOURIST_INFORMATION, 0) }, // "20-2: Magic Hags' Potion Shop" (Magic Hags' Potion Shop) - { " 20-2:" GFXP_HIRAGANA "マホウオババ ノ クスリヤ", MapSelect_LoadGame, 0x400 }, + { " 20-2:" GFXP_HIRAGANA "マホウオババ ノ クスリヤ", MapSelect_LoadGame, ENTRANCE(MAGIC_HAGS_POTION_SHOP, 0) }, // "21: Wood Mountain" (Woodfall) - { " 21:" GFXP_KATAKANA "ウッドマウンテン", MapSelect_LoadGame, 0x8600 }, + { " 21:" GFXP_KATAKANA "ウッドマウンテン", MapSelect_LoadGame, ENTRANCE(WOODFALL, 0) }, // "21-0: Deku Princess's Prison" (Deku Princess's Prison Cutscene: Tatl Apologizes) - { " 21-0:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "ヒメ ノ ロウヤ", MapSelect_LoadGame, 0x3010 }, + { " 21-0:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "ヒメ ノ ロウヤ", MapSelect_LoadGame, ENTRANCE(WOODFALL_TEMPLE, 1) }, // "22: Deku Castle" (Deku Palace) - { " 22:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ シロ", MapSelect_LoadGame, 0x5000 }, + { " 22:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ シロ", MapSelect_LoadGame, ENTRANCE(DEKU_PALACE, 0) }, // "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-0:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ0", MapSelect_LoadGame, ENTRANCE(GROTTOS, 6) }, // "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-1:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ1", MapSelect_LoadGame, ENTRANCE(GROTTOS, 14) }, // "22-2: Boe Hole 2" (Deku Palace Grotto 2 - Skullwalltula Wall, Lower Entrance) - { " 22-2:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ2", MapSelect_LoadGame, 0x1480 }, + { " 22-2:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ2", MapSelect_LoadGame, ENTRANCE(GROTTOS, 8) }, // "22-3: Boe Hole 3" (Deku Palace Grotto 3 - Skullwalltula Wall, Upper Entrance) - { " 22-3:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ3", MapSelect_LoadGame, 0x14F0 }, + { " 22-3:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ3", MapSelect_LoadGame, ENTRANCE(GROTTOS, 15) }, // "22-4: Boe Hole 4" (Deku Palace Grotto 4 - Bean Seller) - { " 22-4:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ4", MapSelect_LoadGame, 0x14C0 }, + { " 22-4:" GFXP_KATAKANA "クロスケ " GFXP_HIRAGANA "ノ アナ4", MapSelect_LoadGame, ENTRANCE(GROTTOS, 12) }, // "24: Beast Path" (Road to Swamp) - { " 24:" GFXP_HIRAGANA "ケモノミチ", MapSelect_LoadGame, 0x7A00 }, + { " 24:" GFXP_HIRAGANA "ケモノミチ", MapSelect_LoadGame, ENTRANCE(ROAD_TO_SOUTHERN_SWAMP, 0) }, // "24-0: Forest Shooting Gallery" (Swamp Shooting Gallery) - { " 24-0:" GFXP_HIRAGANA "モリ ノ シャテキジョウ", MapSelect_LoadGame, 0x4200 }, + { " 24-0:" GFXP_HIRAGANA "モリ ノ シャテキジョウ", MapSelect_LoadGame, ENTRANCE(SWAMP_SHOOTING_GALLERY, 0) }, // "25: Deku King's Chamber" (Deku Palace Throne Room) - { " 25:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "オウ ノ マ", MapSelect_LoadGame, 0x7600 }, + { " 25:" GFXP_KATAKANA "デク" GFXP_HIRAGANA "オウ ノ マ", MapSelect_LoadGame, ENTRANCE(DEKU_KINGS_CHAMBER, 0) }, // "26: Woods of Mystery" (Woods of Mystery) - { " 26:" GFXP_HIRAGANA "フシギ ノ モリ", MapSelect_LoadGame, 0xC200 }, + { " 26:" GFXP_HIRAGANA "フシギ ノ モリ", MapSelect_LoadGame, ENTRANCE(WOODS_OF_MYSTERY, 0) }, // "30: Great Bay Coast" (Great Bay Coast - Entrance Area) - { " 30:" GFXP_KATAKANA "グレートベイ" GFXP_HIRAGANA " ノ カイガン", MapSelect_LoadGame, 0x6800 }, + { " 30:" GFXP_KATAKANA "グレートベイ" GFXP_HIRAGANA " ノ カイガン", MapSelect_LoadGame, ENTRANCE(GREAT_BAY_COAST, 0) }, // "30-0: Ocean Laboratory" (Marine Research Lab) - { " 30-0:" GFXP_HIRAGANA "カイヨウ ケンキュウジョ", MapSelect_LoadGame, 0x5800 }, + { " 30-0:" GFXP_HIRAGANA "カイヨウ ケンキュウジョ", MapSelect_LoadGame, ENTRANCE(MARINE_RESEARCH_LAB, 0) }, // "30-1: Fisherman's House" (Fisherman's Hut) - { " 30-1:" GFXP_HIRAGANA "リョウシ ノ イエ", MapSelect_LoadGame, 0x7200 }, + { " 30-1:" GFXP_HIRAGANA "リョウシ ノ イエ", MapSelect_LoadGame, ENTRANCE(FISHERMANS_HUT, 0) }, // "30-2: Pointed Rock" (Twin Pillars) - { " 30-2:" GFXP_HIRAGANA "トンガリ イワ", MapSelect_LoadGame, 0x4400 }, + { " 30-2:" GFXP_HIRAGANA "トンガリ イワ", MapSelect_LoadGame, ENTRANCE(PINNACLE_ROCK, 0) }, // "31: Cape" (Great Bay Coast - River Area) - { " 31:" GFXP_HIRAGANA "ミサキ", MapSelect_LoadGame, 0x6A00 }, + { " 31:" GFXP_HIRAGANA "ミサキ", MapSelect_LoadGame, ENTRANCE(ZORA_CAPE, 0) }, // "32: Outside of Pirates' Fortress" (Pirates' Fortress - Exterior) - { " 32:" GFXP_HIRAGANA "カイゾクノトリデマエ", MapSelect_LoadGame, 0x7000 }, + { " 32:" GFXP_HIRAGANA "カイゾクノトリデマエ", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_EXTERIOR, 0) }, // "32-0: Pirates' Fortress" (Pirates' Fortress - Courtyard) - { " 32-0:" GFXP_HIRAGANA "カイゾクノトリデ", MapSelect_LoadGame, 0x2200 }, + { " 32-0:" GFXP_HIRAGANA "カイゾクノトリデ", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS, 0) }, // "32-1: Pirates' Fortress - Telescope" (Pirates' Fortress - Secret Entrance, Looking Through Telescope) - { " 32-1:" GFXP_HIRAGANA "カイゾクノトリデ ボウエンキョウ", MapSelect_LoadGame, 0x22A0 }, + { " 32-1:" GFXP_HIRAGANA "カイゾクノトリデ ボウエンキョウ", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS, 10) }, // "32-2: Pirates' Fortress - Interior 0" (Pirates' Fortress - Throne Room) - { " 32-2:" GFXP_HIRAGANA "カイゾクノトリデナイブ0", MapSelect_LoadGame, 0x4000 }, + { " 32-2:" GFXP_HIRAGANA "カイゾクノトリデナイブ0", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 0) }, // "32-3: Pirates' Fortress - Interior 1" (Pirates' Fortress - View of Throne Room, Wasp Nest) - { " 32-3:" GFXP_HIRAGANA "カイゾクノトリデナイブ1", MapSelect_LoadGame, 0x4010 }, + { " 32-3:" GFXP_HIRAGANA "カイゾクノトリデナイブ1", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 1) }, // "32-4: Pirates' Fortress - Interior 2" (Pirates' Fortress - Tempting Treasure Chest, Leading to 32-5) - { " 32-4:" GFXP_HIRAGANA "カイゾクノトリデナイブ2", MapSelect_LoadGame, 0x4020 }, + { " 32-4:" GFXP_HIRAGANA "カイゾクノトリデナイブ2", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 2) }, // "32-5: Pirates' Fortress - Interior 3" (Pirates' Fortress - Zora Egg Room, One Shell Blade) - { " 32-5:" GFXP_HIRAGANA "カイゾクノトリデナイブ3", MapSelect_LoadGame, 0x4030 }, + { " 32-5:" GFXP_HIRAGANA "カイゾクノトリデナイブ3", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 3) }, // "32-6: Pirates' Fortress - Interior 4" (Pirates' Fortress - Oil Drum Room, Leading to 32-7) - { " 32-6:" GFXP_HIRAGANA "カイゾクノトリデナイブ4", MapSelect_LoadGame, 0x4040 }, + { " 32-6:" GFXP_HIRAGANA "カイゾクノトリデナイブ4", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 4) }, // "32-7: Pirates' Fortress - Interior 5" (Pirates' Fortress - Zora Egg Room, One Shell Blade) - { " 32-7:" GFXP_HIRAGANA "カイゾクノトリデナイブ5", MapSelect_LoadGame, 0x4050 }, + { " 32-7:" GFXP_HIRAGANA "カイゾクノトリデナイブ5", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 5) }, // "32-8: Pirates' Fortress - Interior 6" (Pirates' Fortress - Fenced Indoor Walkway, Leading to 32-9) - { " 32-8:" GFXP_HIRAGANA "カイゾクノトリデナイブ6", MapSelect_LoadGame, 0x4060 }, + { " 32-8:" GFXP_HIRAGANA "カイゾクノトリデナイブ6", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 6) }, // "32-9: Pirates' Fortress - Interior 7" (Pirates' Fortress - Zora Egg Room, One Desbreko & Treasure Chest) - { " 32-9:" GFXP_HIRAGANA "カイゾクノトリデナイブ7", MapSelect_LoadGame, 0x4070 }, + { " 32-9:" GFXP_HIRAGANA "カイゾクノトリデナイブ7", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 7) }, // "32-10: Pirates' Fortress - Interior 8" (Pirates' Fortress - End of Secret Entrance: Telescope Room) - { " 32-10:" GFXP_HIRAGANA "カイゾクノトリデナイブ8", MapSelect_LoadGame, 0x4080 }, + { " 32-10:" GFXP_HIRAGANA "カイゾクノトリデナイブ8", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 8) }, // "32-11: Pirates' Fortress - Interior 9" (Pirates' Fortress - Start of Secret Entrance) - { " 32-11:" GFXP_HIRAGANA "カイゾクノトリデナイブ9", MapSelect_LoadGame, 0x4090 }, + { " 32-11:" GFXP_HIRAGANA "カイゾクノトリデナイブ9", MapSelect_LoadGame, ENTRANCE(PIRATES_FORTRESS_INTERIOR, 9) }, // "33: Zora Shrine" (Zora Hall) - { " 33:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, 0x6000 }, + { " 33:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, ENTRANCE(ZORA_HALL, 0) }, // "33-0: Zora Shop" (Zora Shop) - { " 33-0:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x9250 }, + { " 33-0:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, ENTRANCE(ZORA_HALL_ROOMS, 5) }, // "33-1: Zora Waiting Room" (Mikau & Tijo's Room) - { " 33-1:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ヒカエシツ", MapSelect_LoadGame, 0x9200 }, + { " 33-1:" GFXP_KATAKANA "ゾーラ " GFXP_HIRAGANA "ノ ヒカエシツ", MapSelect_LoadGame, ENTRANCE(ZORA_HALL_ROOMS, 0) }, // "34: Great Bay" (Great Bay Cutscene: Pirates Approach Temple) - { " 34:" GFXP_KATAKANA "グレートベイ", MapSelect_LoadGame, 0xBE00 }, + { " 34:" GFXP_KATAKANA "グレートベイ", MapSelect_LoadGame, ENTRANCE(GREAT_BAY_CUTSCENE, 0) }, // "35: Mountain Stream Above Falls" (Waterfall Rapids) - { " 35:" GFXP_HIRAGANA "タキウエ ノ ケイリュウ", MapSelect_LoadGame, 0x8E00 }, + { " 35:" GFXP_HIRAGANA "タキウエ ノ ケイリュウ", MapSelect_LoadGame, ENTRANCE(WATERFALL_RAPIDS, 0) }, // "40: Rock Building Shaft" (Stone Tower) - { " 40:" GFXP_KATAKANA "ロックビル" GFXP_HIRAGANA " ノ タテアナ", MapSelect_LoadGame, 0xAA00 }, + { " 40:" GFXP_KATAKANA "ロックビル" GFXP_HIRAGANA " ノ タテアナ", MapSelect_LoadGame, ENTRANCE(STONE_TOWER, 0) }, // "40-0: Heaven & Earth Are Overturned" (Stone Tower Cutscene: Tower is Flipped) - { " 40-0:" GFXP_HIRAGANA "テンチ ギャクテン", MapSelect_LoadGame, 0xAC00 }, + { " 40-0:" GFXP_HIRAGANA "テンチ ギャクテン", MapSelect_LoadGame, ENTRANCE(STONE_TOWER_INVERTED, 0) }, // "41: Road to Ikana" (Road to Ikana) - { " 41:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ヘノ ミチ", MapSelect_LoadGame, 0xA000 }, + { " 41:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ヘノ ミチ", MapSelect_LoadGame, ENTRANCE(ROAD_TO_IKANA, 0) }, // "42: Ancient Castle of Ikana" (Ancient Castle of Ikana) - { " 42:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " コジョウ", MapSelect_LoadGame, 0x3400 }, + { " 42:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " コジョウ", MapSelect_LoadGame, ENTRANCE(IKANA_CASTLE, 0) }, // "42-0: Ancient Castle of Ikana - Interior" (Ancient Castle of Ikana - Interior) - { " 42-0:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " ノ コジョウ ナイブ", MapSelect_LoadGame, 0x3430 }, + { " 42-0:" GFXP_KATAKANA "イカーナ" GFXP_HIRAGANA " ノ コジョウ ナイブ", MapSelect_LoadGame, ENTRANCE(IKANA_CASTLE, 3) }, // "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 }, + MapSelect_LoadGame, ENTRANCE(IGOS_DU_IKANAS_LAIR, 0) }, // "43: Ikana Canyon" (Ikana Canyon) - { " 43:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク", MapSelect_LoadGame, 0x2000 }, + { " 43:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク", MapSelect_LoadGame, ENTRANCE(IKANA_CANYON, 0) }, // "43-0: Ikana Canyon Cave" (Sharp's Cave) - { " 43-0:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク ドウクツ", MapSelect_LoadGame, 0x20E0 }, + { " 43-0:" GFXP_KATAKANA "イカーナ " GFXP_HIRAGANA "ケイコク ドウクツ", MapSelect_LoadGame, ENTRANCE(IKANA_CANYON, 14) }, // "43-1: Secom's House" (Sakon's Hideout) - { " 43-1:" GFXP_KATAKANA "セコム " GFXP_HIRAGANA "ノ イエ", MapSelect_LoadGame, 0x9800 }, + { " 43-1:" GFXP_KATAKANA "セコム " GFXP_HIRAGANA "ノ イエ", MapSelect_LoadGame, ENTRANCE(SAKONS_HIDEOUT, 0) }, // "43-2: Music Box House" (Music Box House) - { " 43-2:" GFXP_KATAKANA "オルゴール ハウス", MapSelect_LoadGame, 0xA400 }, + { " 43-2:" GFXP_KATAKANA "オルゴール ハウス", MapSelect_LoadGame, ENTRANCE(MUSIC_BOX_HOUSE, 0) }, // "50: Clock Town -East-" (East Clock Town) - { " 50:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ヒガシ-", MapSelect_LoadGame, 0xD200 }, + { " 50:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ヒガシ-", MapSelect_LoadGame, ENTRANCE(EAST_CLOCK_TOWN, 0) }, // "50-0: Town Target Range" (Shooting Gallery) - { " 50-0:" GFXP_HIRAGANA "マチ ノ シャテキジョウ", MapSelect_LoadGame, 0x3A00 }, + { " 50-0:" GFXP_HIRAGANA "マチ ノ シャテキジョウ", MapSelect_LoadGame, ENTRANCE(TOWN_SHOOTING_GALLERY, 0) }, // "50-1: Honey and Darling's Shop" (Honey & Darling's Shop) - { " 50-1:" GFXP_KATAKANA "ハニー アンド ダーリン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, 0x800 }, + { " 50-1:" GFXP_KATAKANA "ハニー アンド ダーリン " GFXP_HIRAGANA "ノ ミセ", MapSelect_LoadGame, + ENTRANCE(HONEY_AND_DARLINGS_SHOP, 0) }, // "50-2: Treasure Chest Shop" (Treasure Chest Shop) - { " 50-2:" GFXP_HIRAGANA "タカラバコヤ", MapSelect_LoadGame, 0x2800 }, + { " 50-2:" GFXP_HIRAGANA "タカラバコヤ", MapSelect_LoadGame, ENTRANCE(TREASURE_CHEST_SHOP, 0) }, // "50-3: Pots 'n' Pans Inn" (Stockpot Inn) - { " 50-3:" GFXP_KATAKANA "ナベ" GFXP_HIRAGANA "カマ テイ", MapSelect_LoadGame, 0xBC00 }, + { " 50-3:" GFXP_KATAKANA "ナベ" GFXP_HIRAGANA "カマ テイ", MapSelect_LoadGame, ENTRANCE(STOCK_POT_INN, 0) }, // "50-4: Mayor's House" (The Mayor's Residence) - { " 50-4:" GFXP_HIRAGANA "チョウチョウ ノ イエ", MapSelect_LoadGame, 0 }, + { " 50-4:" GFXP_HIRAGANA "チョウチョウ ノ イエ", MapSelect_LoadGame, ENTRANCE(MAYORS_RESIDENCE, 0) }, // "50-5: Milk Bar" (Milk Bar) - { " 50-5:" GFXP_KATAKANA "ミルクバー", MapSelect_LoadGame, 0x2400 }, + { " 50-5:" GFXP_KATAKANA "ミルクバー", MapSelect_LoadGame, ENTRANCE(MILK_BAR, 0) }, // "51: Clock Town -West-" (West Clock Town) - { " 51:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ニシ-", MapSelect_LoadGame, 0xD400 }, + { " 51:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ニシ-", MapSelect_LoadGame, ENTRANCE(WEST_CLOCK_TOWN, 0) }, // "51-0: Bomb Shop" (Bomb Shop) - { " 51-0:" GFXP_HIRAGANA "バクダン ヤ", MapSelect_LoadGame, 0xCA00 }, + { " 51-0:" GFXP_HIRAGANA "バクダン ヤ", MapSelect_LoadGame, ENTRANCE(BOMB_SHOP, 0) }, // "51-1: Maniac Mart" (Curiosity Shop) - { " 51-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ", MapSelect_LoadGame, 0xE00 }, + { " 51-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ", MapSelect_LoadGame, ENTRANCE(CURIOSITY_SHOP, 0) }, // "51-2: General Store" (Trading Post) - { " 51-2:" GFXP_HIRAGANA "ザッカ ヤ", MapSelect_LoadGame, 0x6200 }, + { " 51-2:" GFXP_HIRAGANA "ザッカ ヤ", MapSelect_LoadGame, ENTRANCE(TRADING_POST, 0) }, // "51-3: Sword Dojo" (Swordsman's School) - { " 51-3:" GFXP_HIRAGANA "ケンドウジョウ", MapSelect_LoadGame, 0xA200 }, + { " 51-3:" GFXP_HIRAGANA "ケンドウジョウ", MapSelect_LoadGame, ENTRANCE(SWORDMANS_SCHOOL, 0) }, // "51-4: Post House" (Post Office) - { " 51-4:" GFXP_HIRAGANA "ポストハウス", MapSelect_LoadGame, 0x5600 }, + { " 51-4:" GFXP_HIRAGANA "ポストハウス", MapSelect_LoadGame, ENTRANCE(POST_OFFICE, 0) }, // "51-5: Lottery Shop" (Lottery Shop) - { " 51-5:" GFXP_HIRAGANA "タカラクジヤ", MapSelect_LoadGame, 0x6C00 }, + { " 51-5:" GFXP_HIRAGANA "タカラクジヤ", MapSelect_LoadGame, ENTRANCE(LOTTERY_SHOP, 0) }, // "52: Clock Town -North-" (North Clock Town) - { " 52:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-キタ-", MapSelect_LoadGame, 0xD600 }, + { " 52:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-キタ-", MapSelect_LoadGame, ENTRANCE(NORTH_CLOCK_TOWN, 0) }, // "53: Clocktown -South-" (South Clock Town) - { " 53:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ミナミ-", MapSelect_LoadGame, 0xD800 }, + { " 53:" GFXP_KATAKANA "クロックタウン " GFXP_HIRAGANA "-ミナミ-", MapSelect_LoadGame, ENTRANCE(SOUTH_CLOCK_TOWN, 0) }, // "53-0: Clock Tower Interior" (Clock Tower Interior) - { " 53-0:" GFXP_HIRAGANA "トケイトウナイブ", MapSelect_LoadGame, 0xC000 }, + { " 53-0:" GFXP_HIRAGANA "トケイトウナイブ", MapSelect_LoadGame, ENTRANCE(CLOCK_TOWER_INTERIOR, 0) }, // "54: Clock Tower Rooftop" (Clock Tower Rooftop) - { " 54:" GFXP_HIRAGANA "トケイトウ オクジョウ", MapSelect_LoadGame, 0x2C00 }, + { " 54:" GFXP_HIRAGANA "トケイトウ オクジョウ", MapSelect_LoadGame, ENTRANCE(CLOCK_TOWER_ROOFTOP, 0) }, // "55: Laundry Area" (Laundry Pool) - { " 55:" GFXP_HIRAGANA "センタクジョウ", MapSelect_LoadGame, 0xDA00 }, + { " 55:" GFXP_HIRAGANA "センタクジョウ", MapSelect_LoadGame, ENTRANCE(LAUNDRY_POOL, 0) }, // "55-0: Maniac Mart - Rear Entrance" (Curiosity Shop - Back Room) - { " 55-0:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ウラグチ", MapSelect_LoadGame, 0xE10 }, + { " 55-0:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ウラグチ", MapSelect_LoadGame, ENTRANCE(CURIOSITY_SHOP, 1) }, // "55-1: Maniac Mart - Peephole" (Curiosity Shop Back Room - Peephole) - { " 55-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ノゾキアナ", MapSelect_LoadGame, 0xE20 }, + { " 55-1:" GFXP_KATAKANA "マニ" GFXP_HIRAGANA "ヤ ノ ノゾキアナ", MapSelect_LoadGame, ENTRANCE(CURIOSITY_SHOP, 2) }, // "100: Wood Mountain Temple" (Woodfall Temple) - { "100:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x3000 }, + { "100:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, ENTRANCE(WOODFALL_TEMPLE, 0) }, // "100-B: Wood Mountain Temple - Boss" (Odolwa's Lair) - { "100-B:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x3800 }, + { "100-B:" GFXP_KATAKANA "ウッドマウンテン " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, + ENTRANCE(ODOLWAS_LAIR, 0) }, // "101: Snowhead Temple" (Snowhead Temple) - { "101:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x3C00 }, + { "101:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, ENTRANCE(SNOWHEAD_TEMPLE, 0) }, // "101-B: Snowhead Temple - Boss" (Goht's Lair) - { "101-B:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x8200 }, + { "101-B:" GFXP_KATAKANA "スノーヘッド " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, + ENTRANCE(GOHTS_LAIR, 0) }, // "102: Great Bay Temple" (Great Bay Temple) - { "102:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, 0x8C00 }, + { "102:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン", MapSelect_LoadGame, ENTRANCE(GREAT_BAY_TEMPLE, 0) }, // "102-B: Great Bay Temple - Boss" (Gyorg's Lair) - { "102-B:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0xB800 }, + { "102-B:" GFXP_KATAKANA "グレートベイ " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, + ENTRANCE(GYORGS_LAIR, 0) }, // "103: Rock Building Temple -Top Side-" (Stone Tower Temple) - { "103:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-オモテー", MapSelect_LoadGame, 0x2600 }, + { "103:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-オモテー", MapSelect_LoadGame, + ENTRANCE(STONE_TOWER_TEMPLE, 0) }, // "103-0: Rock Building Temple -Underside-" (Stone Tower Temple - Flipped) - { "103-0:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-ウラー", MapSelect_LoadGame, 0x2A00 }, + { "103-0:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン-ウラー", MapSelect_LoadGame, + ENTRANCE(STONE_TOWER_TEMPLE_INVERTED, 0) }, // "103-B: Rock Building Temple - Boss" (Twinmold's Lair) - { "103-B:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, 0x6600 }, + { "103-B:" GFXP_KATAKANA "ロックビル " GFXP_HIRAGANA "ノ シンデン" GFXP_KATAKANA "-ボス-", MapSelect_LoadGame, + ENTRANCE(TWINMOLDS_LAIR, 0) }, // "104: Steppe" (On the Moon) - { "104:" GFXP_KATAKANA "ソウゲン", MapSelect_LoadGame, 0xC800 }, + { "104:" GFXP_KATAKANA "ソウゲン", MapSelect_LoadGame, ENTRANCE(THE_MOON, 0) }, // "104-0: Last Deku Dungeon" (Deku Trial) - { "104-0:" GFXP_KATAKANA "ラスト デク ダンジョン", MapSelect_LoadGame, 0x4E00 }, + { "104-0:" GFXP_KATAKANA "ラスト デク ダンジョン", MapSelect_LoadGame, ENTRANCE(MOON_DEKU_TRIAL, 0) }, // "104-1: Last Goron Dungeon" (Goron Trial) - { "104-1:" GFXP_KATAKANA "ラスト ゴロン ダンジョン", MapSelect_LoadGame, 0x7800 }, + { "104-1:" GFXP_KATAKANA "ラスト ゴロン ダンジョン", MapSelect_LoadGame, ENTRANCE(MOON_GORON_TRIAL, 0) }, // "104-2: Last Zora Dungeon" (Zora Trial) - { "104-2:" GFXP_KATAKANA "ラスト ゾーラ ダンジョン", MapSelect_LoadGame, 0x8800 }, + { "104-2:" GFXP_KATAKANA "ラスト ゾーラ ダンジョン", MapSelect_LoadGame, ENTRANCE(MOON_ZORA_TRIAL, 0) }, // "104-3: Last Link Dungeon" (Link Trial) - { "104-3:" GFXP_KATAKANA "ラスト リンク ダンジョン", MapSelect_LoadGame, 0xC600 }, + { "104-3:" GFXP_KATAKANA "ラスト リンク ダンジョン", MapSelect_LoadGame, ENTRANCE(MOON_LINK_TRIAL, 0) }, // "104-B: Last Dungeon -Boss-" (Majora's Lair) - { "104-B:" GFXP_KATAKANA "ラストダンジョン -ボス-", MapSelect_LoadGame, 0x200 }, + { "104-B:" GFXP_KATAKANA "ラストダンジョン -ボス-", MapSelect_LoadGame, ENTRANCE(MAJORAS_LAIR, 0) }, // "119: Deku Shrine" (Deku Shrine) - { "119:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, 0x9E00 }, + { "119:" GFXP_KATAKANA "デクナッツ " GFXP_HIRAGANA "ノ ホコラ", MapSelect_LoadGame, ENTRANCE(DEKU_SHRINE, 0) }, // "121: Secret Shrine" (Secret Shrine) - { "121:" GFXP_HIRAGANA "ヒミツ ノ ホコラ", MapSelect_LoadGame, 0xBA00 }, + { "121:" GFXP_HIRAGANA "ヒミツ ノ ホコラ", MapSelect_LoadGame, ENTRANCE(SECRET_SHRINE, 0) }, // "122: Opening Dungeon" (Pond Area Cutscene: Falling of the Cliff) - { "122:" GFXP_KATAKANA "オープニング ダンジョン", MapSelect_LoadGame, 0x2E00 }, + { "122:" GFXP_KATAKANA "オープニング ダンジョン", MapSelect_LoadGame, ENTRANCE(OPENING_DUNGEON, 0) }, // "123: Giants' Chamber" (Giants' Chamber) - { "123:" GFXP_HIRAGANA "キョジン ノ マ", MapSelect_LoadGame, 0xCC00 }, + { "123:" GFXP_HIRAGANA "キョジン ノ マ", MapSelect_LoadGame, ENTRANCE(GIANTS_CHAMBER, 0) }, // "126: Deku Minigame" (Deku Rupee Minigame) - { "126:" GFXP_KATAKANA "デクナッツ ミニゲーム", MapSelect_LoadGame, 0x3600 }, + { "126:" GFXP_KATAKANA "デクナッツ ミニゲーム", MapSelect_LoadGame, ENTRANCE(DEKU_SCRUB_PLAYGROUND, 0) }, // "127-0: Fairy Fountain 0" (Fairy Fountain - Clock Town) - { "127-0:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 0", MapSelect_LoadGame, 0x4600 }, + { "127-0:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 0", MapSelect_LoadGame, ENTRANCE(FAIRY_FOUNTAIN, 0) }, // "127-1: Fairy Fountain 1" (Fairy Fountain - Woodfall) - { "127-1:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 1", MapSelect_LoadGame, 0x4610 }, + { "127-1:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 1", MapSelect_LoadGame, ENTRANCE(FAIRY_FOUNTAIN, 1) }, // "127-2: Fairy Fountain 2" (Fairy Fountain - Snowhead) - { "127-2:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 2", MapSelect_LoadGame, 0x4620 }, + { "127-2:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 2", MapSelect_LoadGame, ENTRANCE(FAIRY_FOUNTAIN, 2) }, // "127-3: Fairy Fountain 3" (Fairy Fountain - Great Bay Coast) - { "127-3:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 3", MapSelect_LoadGame, 0x4630 }, + { "127-3:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 3", MapSelect_LoadGame, ENTRANCE(FAIRY_FOUNTAIN, 3) }, // "127-4: Fairy Fountain 4" (Fairy Fountain - Ikana Canyon) - { "127-4:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 4", MapSelect_LoadGame, 0x4640 }, + { "127-4:" GFXP_HIRAGANA "ヨウセイ ノ イズミ 4", MapSelect_LoadGame, ENTRANCE(FAIRY_FOUNTAIN, 4) }, // "128: Swamp Spider Manor" (Swamp Spider House) - { "128:" GFXP_HIRAGANA "ヌマ ノ クモヤカタ", MapSelect_LoadGame, 0x4800 }, + { "128:" GFXP_HIRAGANA "ヌマ ノ クモヤカタ", MapSelect_LoadGame, ENTRANCE(SWAMP_SPIDER_HOUSE, 0) }, // "129: Ocean Spider Manor" (Oceanside Spider House) - { "129:" GFXP_HIRAGANA "ウミ ノ クモヤカタ", MapSelect_LoadGame, 0x4A00 }, + { "129:" GFXP_HIRAGANA "ウミ ノ クモヤカタ", MapSelect_LoadGame, ENTRANCE(OCEANSIDE_SPIDER_HOUSE, 0) }, // "130: Beneath the Graves - Dampe" (Beneath the Graveyard) - { "130:" GFXP_HIRAGANA "ハカ ノ シタ-" GFXP_KATAKANA "ダンペイ-", MapSelect_LoadGame, 0x5A00 }, + { "130:" GFXP_HIRAGANA "ハカ ノ シタ-" GFXP_KATAKANA "ダンペイ-", MapSelect_LoadGame, ENTRANCE(DAMPES_HOUSE, 0) }, // "131: Beneath the Well" (Beneath the Well) - { "131:" GFXP_HIRAGANA "イド ノ シタ", MapSelect_LoadGame, 0x9000 }, + { "131:" GFXP_HIRAGANA "イド ノ シタ", MapSelect_LoadGame, ENTRANCE(BENEATH_THE_WELL, 0) }, // "132: Ghost Hut" (Ghost Hut) - { "132:" GFXP_HIRAGANA "ユウレイゴヤ", MapSelect_LoadGame, 0x9C00 }, + { "132:" GFXP_HIRAGANA "ユウレイゴヤ", MapSelect_LoadGame, ENTRANCE(GHOST_HUT, 0) }, // "133-0: Beneath the Graves 0" (Beneath the Graveyard - Part 1) - { "133-0:" GFXP_HIRAGANA "ハカ ノ シタ0", MapSelect_LoadGame, 0xA00 }, + { "133-0:" GFXP_HIRAGANA "ハカ ノ シタ0", MapSelect_LoadGame, ENTRANCE(BENEATH_THE_GRAVERYARD, 0) }, // "133-1: Beneath the Graves 1" (Beneath the Graveyard - Part 2) - { "133-1:" GFXP_HIRAGANA "ハカ ノ シタ1", MapSelect_LoadGame, 0xA10 }, + { "133-1:" GFXP_HIRAGANA "ハカ ノ シタ1", MapSelect_LoadGame, ENTRANCE(BENEATH_THE_GRAVERYARD, 1) }, // "134-0: Secret Grotto 0" (Secret Grotto - Four Gossip Stones) - { "134-0:" GFXP_HIRAGANA "カクシアナ 0", MapSelect_LoadGame, 0x1400 }, + { "134-0:" GFXP_HIRAGANA "カクシアナ 0", MapSelect_LoadGame, ENTRANCE(GROTTOS, 0) }, // "134-1: Secret Grotto 1" (Secret Grotto - Four Gossip Stones, Skulltula) - { "134-1:" GFXP_HIRAGANA "カクシアナ 1", MapSelect_LoadGame, 0x1410 }, + { "134-1:" GFXP_HIRAGANA "カクシアナ 1", MapSelect_LoadGame, ENTRANCE(GROTTOS, 1) }, // "134-2: Secret Grotto 2" (Secret Grotto - Four Gossip Stones, Water Puddles) - { "134-2:" GFXP_HIRAGANA "カクシアナ 2", MapSelect_LoadGame, 0x1420 }, + { "134-2:" GFXP_HIRAGANA "カクシアナ 2", MapSelect_LoadGame, ENTRANCE(GROTTOS, 2) }, // "134-3: Secret Grotto 3" (Secret Grotto - Four Gossip Stones, Water Puddle With Bugs) - { "134-3:" GFXP_HIRAGANA "カクシアナ 3", MapSelect_LoadGame, 0x1430 }, + { "134-3:" GFXP_HIRAGANA "カクシアナ 3", MapSelect_LoadGame, ENTRANCE(GROTTOS, 3) }, // "134-4: Secret Grotto 4" (Secret Grotto - Chest with Blue Rupee, Deku Babas) - { "134-4:" GFXP_HIRAGANA "カクシアナ 4", MapSelect_LoadGame, 0x1440 }, + { "134-4:" GFXP_HIRAGANA "カクシアナ 4", MapSelect_LoadGame, ENTRANCE(GROTTOS, 4) }, // "134-5: Secret Grotto 5" (Secret Grotto - Hot Spring, Deku Babas, Large Stones) - { "134-5:" GFXP_HIRAGANA "カクシアナ5", MapSelect_LoadGame, 0x1450 }, + { "134-5:" GFXP_HIRAGANA "カクシアナ5", MapSelect_LoadGame, ENTRANCE(GROTTOS, 5) }, // "134-7: Secret Grotto 7" (Secret Grotto - Two Dondogos) - { "134-7:" GFXP_HIRAGANA "カクシアナ 7", MapSelect_LoadGame, 0x1470 }, + { "134-7:" GFXP_HIRAGANA "カクシアナ 7", MapSelect_LoadGame, ENTRANCE(GROTTOS, 7) }, // "134-9: Secret Grotto 9" (Secret Grotto - Tall Grass With Box, Pot, Bugs) - { "134-9:" GFXP_HIRAGANA "カクシアナ 9", MapSelect_LoadGame, 0x1490 }, + { "134-9:" GFXP_HIRAGANA "カクシアナ 9", MapSelect_LoadGame, ENTRANCE(GROTTOS, 9) }, // "134-10: Secret Grotto 10" (Secret Grotto - Two Cows Surrounded by Grass) - { "134-10:" GFXP_HIRAGANA "カクシアナ10", MapSelect_LoadGame, 0x14A0 }, + { "134-10:" GFXP_HIRAGANA "カクシアナ10", MapSelect_LoadGame, ENTRANCE(GROTTOS, 10) }, // "134-11: Secret Grotto 11" (Secret Grotto - Watery Hole Filled with Underwater Babas, Fish) - { "134-11:" GFXP_HIRAGANA "カクシアナ11", MapSelect_LoadGame, 0x14B0 }, + { "134-11:" GFXP_HIRAGANA "カクシアナ11", MapSelect_LoadGame, ENTRANCE(GROTTOS, 11) }, // "134-13: Secret Grotto 13" (Secret Grotto - Peahat in Center) - { "134-13:" GFXP_HIRAGANA "カクシアナ13", MapSelect_LoadGame, 0x14D0 }, + { "134-13:" GFXP_HIRAGANA "カクシアナ13", MapSelect_LoadGame, ENTRANCE(GROTTOS, 13) }, // "X 1: SPOT00" (Opening Cutscene) - { "X 1:SPOT00", MapSelect_LoadGame, 0x1C00 }, + { "X 1:SPOT00", MapSelect_LoadGame, ENTRANCE(CUTSCENE, 0) }, // "Title" (Title Screen) - { "title", (void*)MapSelect_LoadTitle, 0x0000 }, + { "title", (void*)MapSelect_LoadTitle, 0 }, }; void MapSelect_UpdateMenu(MapSelectState* this) { @@ -516,8 +525,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { gSaveContext.minigameState = 0; if (this->scenes[this->currentScene].loadFunc != NULL) { - this->scenes[this->currentScene].loadFunc(this, this->scenes[this->currentScene].entranceIndex, - this->opt); + this->scenes[this->currentScene].loadFunc(this, this->scenes[this->currentScene].entrance, this->opt); } } diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h index 4791a2427..efe5f9945 100644 --- a/src/overlays/gamestates/ovl_select/z_select.h +++ b/src/overlays/gamestates/ovl_select/z_select.h @@ -10,7 +10,7 @@ typedef void (*Select_LoadFunc)(struct MapSelectState*, u32, s32); typedef struct { /* 0x00 */ char* name; /* 0x04 */ Select_LoadFunc loadFunc; - /* 0x08 */ s32 entranceIndex; + /* 0x08 */ s32 entrance; } SceneSelectEntry; // size = 0xC typedef struct MapSelectState { diff --git a/tools/Makefile b/tools/Makefile index a7fc3da90..887f146af 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -4,12 +4,14 @@ PROGRAMS := vtxdis all: $(PROGRAMS) $(MAKE) -C ZAPD + $(MAKE) -C fado $(MAKE) -C buildtools $(MAKE) -C z64compress clean: $(RM) $(PROGRAMS) $(MAKE) -C ZAPD clean + $(MAKE) -C fado clean $(MAKE) -C buildtools clean $(MAKE) -C z64compress clean diff --git a/tools/buildtools/.gitignore b/tools/buildtools/.gitignore index 9edb09b20..ecf2dd851 100644 --- a/tools/buildtools/.gitignore +++ b/tools/buildtools/.gitignore @@ -3,4 +3,5 @@ elf2rom makeromfs mkldscript +reloc_prereq yaz0 diff --git a/tools/buildtools/Makefile b/tools/buildtools/Makefile index e6d601324..6f34b5cfa 100644 --- a/tools/buildtools/Makefile +++ b/tools/buildtools/Makefile @@ -1,16 +1,32 @@ CC := gcc CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 -PROGRAMS := yaz0 makeromfs elf2rom mkldscript +PROGRAMS := elf2rom makeromfs mkldscript reloc_prereq yaz0 +ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0) + CC := clang +else + CC := gcc +endif + +LLD ?= 0 + +ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) + LLD := 1 +endif + +ifneq ($(LLD),0) + CFLAGS += -fuse-ld=lld +endif all: $(PROGRAMS) clean: $(RM) $(PROGRAMS) -mkldscript_SOURCES := mkldscript.c util.c -elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c -yaz0_SOURCES := yaz0tool.c yaz0.c util.c -makeromfs_SOURCES := makeromfs.c n64chksum.c util.c +elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c +makeromfs_SOURCES := makeromfs.c n64chksum.c util.c +mkldscript_SOURCES := mkldscript.c spec.c util.c +reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c +yaz0_SOURCES := yaz0tool.c yaz0.c util.c define COMPILE = $(1): $($1_SOURCES) diff --git a/tools/buildtools/mkldscript.c b/tools/buildtools/mkldscript.c index 6446f24d0..76191b86d 100644 --- a/tools/buildtools/mkldscript.c +++ b/tools/buildtools/mkldscript.c @@ -6,360 +6,51 @@ #include #include +#include "spec.h" #include "util.h" -#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) +// Note: *SECTION ALIGNMENT* Object files built with a compiler such as GCC can, by default, use narrower +// alignment for sections size, compared to IDO padding sections to a 0x10-aligned size. +// To properly generate relocations relative to section starts, sections currently need to be aligned +// explicitly (to 0x10 currently, a narrower alignment might work), otherwise the linker does implicit alignment +// and inserts padding between the address indicated by section start symbols (such as *SegmentRoDataStart) and +// the actual aligned start of the section. +// With IDO, the padding of sections to an aligned size makes the section start at aligned addresses out of the box, +// so the explicit alignment has no further effect. -static FILE *fout; +struct Segment* g_segments; +int g_segmentsCount; -enum -{ - STMT_address, - STMT_after, - STMT_align, - STMT_beginseg, - STMT_compress, - STMT_endseg, - STMT_entry, - STMT_flags, - STMT_include, - STMT_include_readonly, - STMT_name, - STMT_number, - STMT_romalign, - STMT_stack, - STMT_increment, - STMT_pad_text, -}; - -enum -{ - FLAG_BOOT = (1 << 0), - FLAG_OBJECT = (1 << 1), - FLAG_RAW = (1 << 2), - FLAG_NOLOAD = (1 << 3), -}; - -struct Include -{ - char *fpath; - int linkerPadding; - uint8_t dataReadOnly; -}; - -struct Segment -{ - uint32_t fields; - char *name; - char *after; - uint32_t flags; - uint32_t address; - uint32_t stack; - uint32_t align; - uint32_t romalign; - uint32_t increment; - uint32_t entry; - uint32_t number; - struct Include *includes; - int includesCount; - bool compress; -}; - -static struct Segment *g_segments = NULL; -static int g_segmentsCount = 0; - -static struct Segment *add_segment(void) -{ - struct Segment *seg; - - g_segmentsCount++; - g_segments = realloc(g_segments, g_segmentsCount * sizeof(*g_segments)); - - seg = &g_segments[g_segmentsCount - 1]; - memset(seg, 0, sizeof(*seg)); - - seg->align = 16; - - return seg; -} - -static char *skip_whitespace(char *str) -{ - while (isspace(*str)) - str++; - return str; -} - -// null terminates the current token and returns a pointer to the next token -static char *token_split(char *str) -{ - while (!isspace(*str)) - { - if (*str == 0) - return str; // end of string - str++; - } - *str = 0; // terminate token - str++; - - return skip_whitespace(str); -} - -// null terminates the current line and returns a pointer to the next line -static char *line_split(char *str) -{ - while (*str != '\n') - { - if (*str == 0) - return str; // end of string - str++; - } - *str = 0; // terminate line - return str + 1; -} - -static bool parse_number(const char *str, unsigned int *num) -{ - char *endptr; - long int n = strtol(str, &endptr, 0); - *num = n; - return endptr > str; -} - -static bool parse_flags(char *str, unsigned int *flags) -{ - unsigned int f = 0; - - while (str[0] != 0) - { - char *next = token_split(str); - - if (strcmp(str, "BOOT") == 0) - f |= FLAG_BOOT; - else if (strcmp(str, "OBJECT") == 0) - f |= FLAG_OBJECT; - else if (strcmp(str, "RAW") == 0) - f |= FLAG_RAW; - else if (strcmp(str, "NOLOAD") == 0) - f |= FLAG_NOLOAD; - else - return false; - - str = next; - } - *flags = f; - return true; -} - -static bool parse_quoted_string(char *str, char **out) -{ - if (*str != '"') - return false; - - str++; - *out = str; - - while (*str != '"') - { - if (*str == 0) - return false; // unterminated quote - str++; - } - *str = 0; - str++; - - str = skip_whitespace(str); - if (*str != 0) - return false; // garbage after filename - - return true; -} - -static bool is_pow_of_2(unsigned int n) -{ - return (n & (n - 1)) == 0; -} - -static const char *const stmtNames[] = -{ - [STMT_address] = "address", - [STMT_after] = "after", - [STMT_align] = "align", - [STMT_beginseg] = "beginseg", - [STMT_compress] = "compress", - [STMT_endseg] = "endseg", - [STMT_entry] = "entry", - [STMT_flags] = "flags", - [STMT_include] = "include", - [STMT_include_readonly] = "include_readonly", - [STMT_name] = "name", - [STMT_number] = "number", - [STMT_romalign] = "romalign", - [STMT_stack] = "stack", - [STMT_increment] = "increment", - [STMT_pad_text] = "pad_text", -}; - -static void parse_rom_spec(char *spec) -{ - int lineNum = 1; - char *line = spec; - - struct Segment *currSeg = NULL; - - // iterate over lines - while (line[0] != 0) - { - char *nextLine = line_split(line); - - if (line[0] != 0) - { - char *stmtName = skip_whitespace(line); - if (strlen(stmtName) == 0) // skip empty lines - goto no_stmt; - char *args = token_split(stmtName); - unsigned int stmt; - - for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) - if (strcmp(stmtName, stmtNames[stmt]) == 0) - goto got_stmt; - util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); - got_stmt: - - if (currSeg != NULL) - { - // ensure no duplicates (except for 'include' or 'pad_text') - if (stmt != STMT_include && stmt != STMT_include_readonly && stmt != STMT_pad_text && - (currSeg->fields & (1 << stmt))) - util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtName); - - currSeg->fields |= 1 << stmt; - currSeg->compress = false; - - // statements valid within a segment definition - switch (stmt) - { - case STMT_beginseg: - util_fatal_error("line %i: '%s' inside of a segment definition", lineNum, stmtName); - break; - case STMT_endseg: - // verify segment data - if (currSeg->name == NULL) - util_fatal_error("line %i: no name specified for segment", lineNum); - if (currSeg->includesCount == 0) - util_fatal_error("line %i: no includes specified for segment", lineNum); - currSeg = NULL; - break; - case STMT_name: - if (!parse_quoted_string(args, &currSeg->name)) - util_fatal_error("line %i: invalid name", lineNum); - break; - case STMT_after: - if (!parse_quoted_string(args, &currSeg->after)) - util_fatal_error("line %i: invalid name for 'after'", lineNum); - break; - case STMT_address: - if (!parse_number(args, &currSeg->address)) - util_fatal_error("line %i: expected number after 'address'", lineNum); - break; - case STMT_number: - if (!parse_number(args, &currSeg->number)) - util_fatal_error("line %i: expected number after 'number'", lineNum); - break; - case STMT_flags: - if (!parse_flags(args, &currSeg->flags)) - util_fatal_error("line %i: invalid flags", lineNum); - break; - case STMT_align: - if (!parse_number(args, &currSeg->align)) - util_fatal_error("line %i: expected number after 'align'", lineNum); - if (!is_pow_of_2(currSeg->align)) - util_fatal_error("line %i: alignment is not a power of two", lineNum); - break; - case STMT_romalign: - if (!parse_number(args, &currSeg->romalign)) - util_fatal_error("line %i: expected number after 'romalign'", lineNum); - if (!is_pow_of_2(currSeg->romalign)) - util_fatal_error("line %i: alignment is not a power of two", lineNum); - break; - case STMT_include: - case STMT_include_readonly: - currSeg->includesCount++; - currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes)); - - if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1].fpath)) - util_fatal_error("line %i: invalid filename", lineNum); - - currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0; - currSeg->includes[currSeg->includesCount - 1].dataReadOnly = (stmt == STMT_include_readonly); - break; - case STMT_increment: - if (!parse_number(args, &currSeg->increment)) - util_fatal_error("line %i: expected number after 'increment'", lineNum); - break; - case STMT_compress: - currSeg->compress = true; - break; - case STMT_pad_text: - currSeg->includes[currSeg->includesCount - 1].linkerPadding += 0x10; - break; - default: - fprintf(stderr, "warning: '%s' is not implemented\n", stmtName); - break; - } - } - else - { - // commands valid outside a segment definition - switch (stmt) - { - case STMT_beginseg: - currSeg = add_segment(); - break; - case STMT_endseg: - util_fatal_error("line %i: '%s' outside of a segment definition", lineNum, stmtName); - break; - default: - fprintf(stderr, "warning: '%s' is not implemented\n", stmtName); - break; - } - } - } - no_stmt: - line = nextLine; - lineNum++; - } -} - -static void write_ld_script(void) -{ +static void write_ld_script(FILE* fout) { int i; int j; - fputs("SECTIONS {\n" + fputs("OUTPUT_ARCH (mips)\n\n" + "SECTIONS {\n" " _RomSize = 0;\n" " _RomStart = _RomSize;\n\n", fout); - for (i = 0; i < g_segmentsCount; i++) - { - const struct Segment *seg = &g_segments[i]; + for (i = 0; i < g_segmentsCount; i++) { + const struct Segment* seg = &g_segments[i]; // align start of ROM segment if (seg->fields & (1 << STMT_romalign)) fprintf(fout, " _RomSize = (_RomSize + %i) & ~ %i;\n", seg->romalign - 1, seg->romalign - 1); - else if (seg->fields & (1 << STMT_increment)) // align only start of ROM segment + else if (seg->fields & (1 << STMT_increment)) // align only start of ROM segment fprintf(fout, " _RomSize = (_RomSize + %i) & ~ %i;\n", seg->increment - 1, seg->increment - 1); // initialized data (.text, .data, .rodata, .sdata) // Increment the start of the section - //if (seg->fields & (1 << STMT_increment)) - //fprintf(fout, " . += 0x%08X;\n", seg->increment); + // if (seg->fields & (1 << STMT_increment)) + // fprintf(fout, " . += 0x%08X;\n", seg->increment); - fprintf(fout, " _%sSegmentRomStartTemp = _RomSize;\n" - " _%sSegmentRomStart = _%sSegmentRomStartTemp;\n" - " ..%s ", seg->name, seg->name, seg->name, seg->name); + fprintf(fout, + " _%sSegmentRomStartTemp = _RomSize;\n" + " _%sSegmentRomStart = _%sSegmentRomStartTemp;\n" + " ..%s ", + seg->name, seg->name, seg->name, seg->name); if (seg->fields & (1 << STMT_after)) fprintf(fout, "_%sSegmentEnd ", seg->after); @@ -369,7 +60,8 @@ static void write_ld_script(void) fprintf(fout, "0x%08X ", seg->address); // (AT(_RomSize) isn't necessary, but adds useful "load address" lines to the map file) - fprintf(fout, ": AT(_RomSize)\n {\n" + fprintf(fout, + ": AT(_RomSize)\n {\n" " _%sSegmentStart = .;\n" " . = ALIGN(0x10);\n" " _%sSegmentTextStart = .;\n", @@ -382,52 +74,85 @@ static void write_ld_script(void) fprintf(fout, " %s (.text)\n", seg->includes[j].fpath); if (seg->includes[j].linkerPadding != 0) fprintf(fout, " . += 0x%X;\n", seg->includes[j].linkerPadding); + fprintf(fout, " . = ALIGN(0x10);\n"); } fprintf(fout, " _%sSegmentTextEnd = .;\n", seg->name); - fprintf(fout, " _%sSegmentTextSize = ABSOLUTE( _%sSegmentTextEnd - _%sSegmentTextStart );\n", seg->name, seg->name, seg->name); + fprintf(fout, " _%sSegmentTextSize = ABSOLUTE( _%sSegmentTextEnd - _%sSegmentTextStart );\n", seg->name, + seg->name, seg->name); fprintf(fout, " _%sSegmentDataStart = .;\n", seg->name); for (j = 0; j < seg->includesCount; j++) { - if (!seg->includes[j].dataReadOnly) - fprintf(fout, " %s (.data)\n", seg->includes[j].fpath); + if (!seg->includes[j].dataWithRodata) + fprintf(fout, + " %s (.data)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); } /* - for (j = 0; j < seg->includesCount; j++) + for (j = 0; j < seg->includesCount; j++) fprintf(fout, " %s (.rodata)\n", seg->includes[j].fpath); - for (j = 0; j < seg->includesCount; j++) + for (j = 0; j < seg->includesCount; j++) fprintf(fout, " %s (.sdata)\n", seg->includes[j].fpath); */ - //fprintf(fout, " . = ALIGN(0x10);\n"); + // fprintf(fout, " . = ALIGN(0x10);\n"); fprintf(fout, " _%sSegmentDataEnd = .;\n", seg->name); - fprintf(fout, " _%sSegmentDataSize = ABSOLUTE( _%sSegmentDataEnd - _%sSegmentDataStart );\n", seg->name, seg->name, seg->name); - + fprintf(fout, " _%sSegmentDataSize = ABSOLUTE( _%sSegmentDataEnd - _%sSegmentDataStart );\n", seg->name, + seg->name, seg->name); + fprintf(fout, " _%sSegmentRoDataStart = .;\n", seg->name); for (j = 0; j < seg->includesCount; j++) { - if (seg->includes[j].dataReadOnly) - fprintf(fout, " %s (.data)\n", seg->includes[j].fpath); - fprintf(fout, " %s (.rodata)\n", seg->includes[j].fpath); - } + if (seg->includes[j].dataWithRodata) + fprintf(fout, + " %s (.data)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); - //fprintf(fout, " . = ALIGN(0x10);\n"); + fprintf(fout, + " %s (.rodata)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + // Compilers other than IDO, such as GCC, produce different sections such as + // the ones named directly below. These sections do not contain values that + // need relocating, but we need to ensure that the base .rodata section + // always comes first. The reason this is important is due to relocs assuming + // the base of .rodata being the offset for the relocs and thus needs to remain + // the beginning of the entire rodata area in order to remain consistent. + // Inconsistencies will lead to various .rodata reloc crashes as a result of + // either missing relocs or wrong relocs. + fprintf(fout, + " %s (.rodata.str1.4)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + fprintf(fout, + " %s (.rodata.cst4)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + fprintf(fout, + " %s (.rodata.cst8)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + } fprintf(fout, " _%sSegmentRoDataEnd = .;\n", seg->name); - fprintf(fout, " _%sSegmentRoDataSize = ABSOLUTE( _%sSegmentRoDataEnd - _%sSegmentRoDataStart );\n", seg->name, seg->name, seg->name); + fprintf(fout, " _%sSegmentRoDataSize = ABSOLUTE( _%sSegmentRoDataEnd - _%sSegmentRoDataStart );\n", + seg->name, seg->name, seg->name); fprintf(fout, " _%sSegmentSDataStart = .;\n", seg->name); for (j = 0; j < seg->includesCount; j++) - fprintf(fout, " %s (.sdata)\n", seg->includes[j].fpath); - - fprintf(fout, " . = ALIGN(0x10);\n"); + fprintf(fout, + " %s (.sdata)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); fprintf(fout, " _%sSegmentSDataEnd = .;\n", seg->name); @@ -436,107 +161,193 @@ static void write_ld_script(void) for (j = 0; j < seg->includesCount; j++) fprintf(fout, " %s (.ovl)\n", seg->includes[j].fpath); - fprintf(fout, " . = ALIGN(0x10);\n"); - fprintf(fout, " _%sSegmentOvlEnd = .;\n", seg->name); - //if (seg->fields & (1 << STMT_increment)) - // fprintf(fout, " . += 0x%08X;\n", seg->increment); - + if (seg->fields & (1 << STMT_increment)) + fprintf(fout, " . += 0x%08X;\n", seg->increment); fputs(" }\n", fout); - //fprintf(fout, " _RomSize += ( _%sSegmentDataEnd - _%sSegmentTextStart );\n", seg->name, seg->name); + fprintf(fout, " _RomSize += ( _%sSegmentOvlEnd - _%sSegmentTextStart );\n", seg->name, seg->name); - fprintf(fout, " _%sSegmentRomEndTemp = _RomSize;\n" - "_%sSegmentRomEnd = _%sSegmentRomEndTemp;\n\n", - seg->name, seg->name, seg->name); + fprintf(fout, + " _%sSegmentRomEndTemp = _RomSize;\n" + "_%sSegmentRomEnd = _%sSegmentRomEndTemp;\n\n", + seg->name, seg->name, seg->name); - // algn end of ROM segment + // align end of ROM segment if (seg->fields & (1 << STMT_romalign)) fprintf(fout, " _RomSize = (_RomSize + %i) & ~ %i;\n", seg->romalign - 1, seg->romalign - 1); // uninitialized data (.sbss, .scommon, .bss, COMMON) - fprintf(fout, " ..%s.bss ADDR(..%s) + SIZEOF(..%s) (NOLOAD) :\n" - /*" ..%s.bss :\n"*/ - " {\n" - " . = ALIGN(0x10);\n" - " _%sSegmentBssStart = .;\n", - seg->name, seg->name, seg->name, seg->name); + fprintf(fout, + " ..%s.bss ADDR(..%s) + SIZEOF(..%s) (NOLOAD) :\n" + /*" ..%s.bss :\n"*/ + " {\n" + " . = ALIGN(0x10);\n" + " _%sSegmentBssStart = .;\n", + seg->name, seg->name, seg->name, seg->name); + if (seg->fields & (1 << STMT_align)) fprintf(fout, " . = ALIGN(0x%X);\n", seg->align); + for (j = 0; j < seg->includesCount; j++) - fprintf(fout, " %s (.sbss)\n", seg->includes[j].fpath); + fprintf(fout, + " %s (.sbss)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + for (j = 0; j < seg->includesCount; j++) - fprintf(fout, " %s (.scommon)\n", seg->includes[j].fpath); + fprintf(fout, + " %s (.scommon)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + for (j = 0; j < seg->includesCount; j++) - fprintf(fout, " %s (.bss)\n", seg->includes[j].fpath); + fprintf(fout, + " %s (.bss)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + for (j = 0; j < seg->includesCount; j++) - fprintf(fout, " %s (COMMON)\n", seg->includes[j].fpath); - fprintf(fout, " . = ALIGN(0x10);\n" - " _%sSegmentBssEnd = .;\n" - " _%sSegmentEnd = .;\n" - " }\n" - " _%sSegmentBssSize = ABSOLUTE( _%sSegmentBssEnd - _%sSegmentBssStart );\n\n", - seg->name, seg->name, seg->name, seg->name, seg->name); + fprintf(fout, + " %s (COMMON)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath); + + fprintf(fout, + " . = ALIGN(0x10);\n" + " _%sSegmentBssEnd = .;\n" + " _%sSegmentEnd = .;\n" + " }\n" + " _%sSegmentBssSize = ABSOLUTE( _%sSegmentBssEnd - _%sSegmentBssStart );\n\n", + seg->name, seg->name, seg->name, seg->name, seg->name); // Increment the end of the segment - //if (seg->fields & (1 << STMT_increment)) - // fprintf(fout, " . += 0x%08X;\n", seg->increment); + // if (seg->fields & (1 << STMT_increment)) + // fprintf(fout, " . += 0x%08X;\n", seg->increment); - //fprintf(fout, " ..%s.ovl ADDR(..%s) + SIZEOF(..%s) :\n" - // /*" ..%s.bss :\n"*/ - // " {\n", - // seg->name, seg->name, seg->name); - //fprintf(fout, " _%sSegmentOvlStart = .;\n", seg->name); + // fprintf(fout, " ..%s.ovl ADDR(..%s) + SIZEOF(..%s) :\n" + // /*" ..%s.bss :\n"*/ + // " {\n", + // seg->name, seg->name, seg->name); + // fprintf(fout, " _%sSegmentOvlStart = .;\n", seg->name); - //for (j = 0; j < seg->includesCount; j++) - // fprintf(fout, " %s (.ovl)\n", seg->includes[j].fpath); + // for (j = 0; j < seg->includesCount; j++) + // fprintf(fout, " %s (.ovl)\n", seg->includes[j].fpath); ////fprintf(fout, " . = ALIGN(0x10);\n"); - //fprintf(fout, " _%sSegmentOvlEnd = .;\n", seg->name); + // fprintf(fout, " _%sSegmentOvlEnd = .;\n", seg->name); - //fprintf(fout, "\n }\n"); + // fprintf(fout, "\n }\n"); } - fputs(" _RomEnd = _RomSize;\n}\n", fout); + fputs(" _RomEnd = _RomSize;\n\n", fout); + + // Debugging sections + fputs( + // mdebug debug sections + " .mdebug : { *(.mdebug) }" + "\n" + " .mdebug.abi32 : { *(.mdebug.abi32) }" + "\n" + // DWARF debug sections + // Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. + // DWARF 1 + " .debug 0 : { *(.debug) }" + "\n" + " .line 0 : { *(.line) }" + "\n" + // GNU DWARF 1 extensions + " .debug_srcinfo 0 : { *(.debug_srcinfo) }" + "\n" + " .debug_sfnames 0 : { *(.debug_sfnames) }" + "\n" + // DWARF 1.1 and DWARF 2 + " .debug_aranges 0 : { *(.debug_aranges) }" + "\n" + " .debug_pubnames 0 : { *(.debug_pubnames) }" + "\n" + // DWARF 2 + " .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }" + "\n" + " .debug_abbrev 0 : { *(.debug_abbrev) }" + "\n" + " .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }" + "\n" + " .debug_frame 0 : { *(.debug_frame) }" + "\n" + " .debug_str 0 : { *(.debug_str) }" + "\n" + " .debug_loc 0 : { *(.debug_loc) }" + "\n" + " .debug_macinfo 0 : { *(.debug_macinfo) }" + "\n" + // SGI/MIPS DWARF 2 extensions + " .debug_weaknames 0 : { *(.debug_weaknames) }" + "\n" + " .debug_funcnames 0 : { *(.debug_funcnames) }" + "\n" + " .debug_typenames 0 : { *(.debug_typenames) }" + "\n" + " .debug_varnames 0 : { *(.debug_varnames) }" + "\n" + // DWARF 3 + " .debug_pubtypes 0 : { *(.debug_pubtypes) }" + "\n" + " .debug_ranges 0 : { *(.debug_ranges) }" + "\n" + // DWARF Extension + " .debug_macro 0 : { *(.debug_macro) }" + "\n" + " .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }" + "\n", + fout); + + // Discard all other sections not mentioned above + fputs(" /DISCARD/ :" + "\n" + " {" + "\n" + " *(*);" + "\n" + " }" + "\n", + fout); + fputs("}\n", fout); } -static void usage(const char *execname) -{ - fprintf(stderr, "Nintendo 64 linker script generation tool v0.02\n" - "usage: %s [-c SEGMENTS] SPEC_FILE LD_SCRIPT\n" - "SPEC_FILE file describing the organization of object files into segments\n" - "LD_SCRIPT filename of output linker script\n" - "-c SEGMENTS (optional) output compression script for compressed segments in SEGMENTS folder\n", - execname); +static void usage(const char* execname) { + fprintf(stderr, + "Nintendo 64 linker script generation tool v0.03\n" + "usage: %s SPEC_FILE LD_SCRIPT\n" + "SPEC_FILE file describing the organization of object files into segments\n" + "LD_SCRIPT filename of output linker script\n", + execname); } -int main(int argc, char **argv) -{ - const char *spec_arg = NULL; - const char *ldscript_arg = NULL; +int main(int argc, char** argv) { + FILE* ldout; + void* spec; + size_t size; - void *spec; - size_t size; - - if (argc == 3) { - spec_arg = argv[1]; - ldscript_arg = argv[2]; - } else { - usage(argv[0]); - return 1; + if (argc != 3) { + usage(argv[0]); + return 1; } - spec = util_read_whole_file(spec_arg, &size); - parse_rom_spec(spec); - fout = fopen(ldscript_arg, "w"); - if (fout == NULL) - util_fatal_error("failed to open file '%s' for writing", ldscript_arg); - write_ld_script(); + spec = util_read_whole_file(argv[1], &size); + parse_rom_spec(spec, &g_segments, &g_segmentsCount); + + ldout = fopen(argv[2], "w"); + if (ldout == NULL) + util_fatal_error("failed to open file '%s' for writing", argv[2]); + write_ld_script(ldout); + fclose(ldout); + + free_rom_spec(g_segments, g_segmentsCount); free(spec); - fclose(fout); - return 0; + return 0; } diff --git a/tools/buildtools/reloc_prereq.c b/tools/buildtools/reloc_prereq.c new file mode 100644 index 000000000..ea117f12e --- /dev/null +++ b/tools/buildtools/reloc_prereq.c @@ -0,0 +1,89 @@ +#include +#include +#include +#include + +#include "spec.h" +#include "util.h" + +void print_usage(char* prog_name) { + printf("USAGE: %s SPEC OVERLAY_SEGMENT_NAME\n" + "Search the preprocessed SPEC for an overlay segment name, \n" + "e.g. \"ovl_En_Firefly\", and return a space-separated list of the files it\n" + "includes. The relocation file must be the last include in the segment\n" + "OVERLAY_SEGMENT_NAME, and have the filename \"OVERLAY_SEGMENT_NAME_reloc.o\",\n" + "but can be in a different directory from the other files.\n", + prog_name); +} + +int main(int argc, char** argv) { + char* spec_path; + char* overlay_name; + char* spec; + size_t size; + Segment segment; + int exit_status = 0; + bool segmentFound = false; + + if (argc != 3) { + print_usage(argv[0]); + return 1; + } + + spec_path = argv[1]; + overlay_name = argv[2]; + + // printf("spec path: %s\n", spec_path); + // printf("overlay name: %s\n", overlay_name); + + spec = util_read_whole_file(spec_path, &size); + segmentFound = get_single_segment_by_name(&segment, spec, overlay_name); + + if (!segmentFound) { + fprintf(stderr, ERRMSG_START "no segment \"%s\" found\n" ERRMSG_END, overlay_name); + goto error_out; + } + + { + size_t overlay_name_length; + const char* reloc_suffix = "_reloc.o"; + char* expected_filename; + + /* Relocation file must be the last `include` (so .ovl section is linked last) */ + if (strstr(segment.includes[segment.includesCount - 1].fpath, reloc_suffix) == NULL) { + fprintf(stderr, ERRMSG_START "last include in overlay segment \"%s\" is not a `%s` file\n" ERRMSG_END, + overlay_name, reloc_suffix); + goto error_out; + } + + overlay_name_length = strlen(overlay_name); + expected_filename = malloc(overlay_name_length + strlen(reloc_suffix) + 1); + strcpy(expected_filename, overlay_name); + strcat(expected_filename, reloc_suffix); + + if (strstr(segment.includes[segment.includesCount - 1].fpath, expected_filename) == NULL) { + fprintf(stderr, ERRMSG_START "Relocation file \"%s\" should have filename \"%s\"\n" ERRMSG_END, + segment.includes[segment.includesCount - 1].fpath, expected_filename); + goto error_out; + } + free(expected_filename); + } + { + int i; + /* Skip `_reloc.o` include */ + for (i = 0; i < segment.includesCount - 1; i++) { + printf("%s ", segment.includes[i].fpath); + } + putchar('\n'); + } + + if (0) { + error_out: + exit_status = 1; + } + + free_single_segment_elements(&segment); + free(spec); + + return exit_status; +} diff --git a/tools/buildtools/spec.c b/tools/buildtools/spec.c new file mode 100644 index 000000000..5a11c47c7 --- /dev/null +++ b/tools/buildtools/spec.c @@ -0,0 +1,365 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "util.h" +#include "spec.h" + +#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) + +static struct Segment* add_segment(struct Segment** segments, int* segments_count) { + struct Segment* seg; + + (*segments_count)++; + *segments = realloc(*segments, *segments_count * sizeof(**segments)); + + seg = &(*segments)[*segments_count - 1]; + memset(seg, 0, sizeof(*seg)); + + seg->align = 16; + + return seg; +} + +static char* skip_whitespace(char* str) { + while (isspace(*str)) + str++; + return str; +} + +// null terminates the current token and returns a pointer to the next token +static char* token_split(char* str) { + while (!isspace(*str)) { + if (*str == 0) + return str; // end of string + str++; + } + *str = 0; // terminate token + str++; + + return skip_whitespace(str); +} + +// null terminates the current line and returns a pointer to the next line +static char* line_split(char* str) { + while (*str != '\n') { + if (*str == 0) + return str; // end of string + str++; + } + *str = 0; // terminate line + return str + 1; +} + +static bool parse_number(const char* str, unsigned int* num) { + char* endptr; + long int n = strtol(str, &endptr, 0); + *num = n; + return endptr > str; +} + +static bool parse_flags(char* str, unsigned int* flags) { + unsigned int f = 0; + + while (str[0] != 0) { + char* next = token_split(str); + + if (strcmp(str, "BOOT") == 0) + f |= FLAG_BOOT; + else if (strcmp(str, "OBJECT") == 0) + f |= FLAG_OBJECT; + else if (strcmp(str, "RAW") == 0) + f |= FLAG_RAW; + else if (strcmp(str, "NOLOAD") == 0) + f |= FLAG_NOLOAD; + else + return false; + + str = next; + } + *flags = f; + return true; +} + +static bool parse_quoted_string(char* str, char** out) { + if (*str != '"') + return false; + + str++; + *out = str; + + while (*str != '"') { + if (*str == 0) + return false; // unterminated quote + str++; + } + *str = 0; + str++; + + str = skip_whitespace(str); + if (*str != 0) + return false; // garbage after filename + + return true; +} + +static bool is_pow_of_2(unsigned int n) { + return (n & (n - 1)) == 0; +} + +// clang-format off +static const char* const stmtNames[] = { + [STMT_address] = "address", + [STMT_after] = "after", + [STMT_align] = "align", + [STMT_beginseg] = "beginseg", + [STMT_compress] = "compress", + [STMT_endseg] = "endseg", + [STMT_entry] = "entry", + [STMT_flags] = "flags", + [STMT_include] = "include", + [STMT_include_data_with_rodata] = "include_data_with_rodata", + [STMT_name] = "name", + [STMT_number] = "number", + [STMT_romalign] = "romalign", + [STMT_stack] = "stack", + [STMT_increment] = "increment", + [STMT_pad_text] = "pad_text", +}; +// clang-format on + +STMTId get_stmt_id_by_stmt_name(const char* stmtName, int lineNum) { + STMTId stmt; + + for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) { + if (strcmp(stmtName, stmtNames[stmt]) == 0) + return stmt; + } + util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); + return -1; +} + +bool parse_segment_statement(struct Segment* currSeg, STMTId stmt, char* args, int lineNum) { + // ensure no duplicates (except for 'include' or 'pad_text') + if (stmt != STMT_include && stmt != STMT_include_data_with_rodata && stmt != STMT_pad_text && + (currSeg->fields & (1 << stmt))) + util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtNames[stmt]); + + currSeg->fields |= 1 << stmt; + currSeg->compress = false; + + // statements valid within a segment definition + switch (stmt) { + case STMT_beginseg: + util_fatal_error("line %i: '%s' inside of a segment definition", lineNum, stmtNames[stmt]); + break; + + case STMT_endseg: + // verify segment data + if (currSeg->name == NULL) + util_fatal_error("line %i: no name specified for segment", lineNum); + if (currSeg->includesCount == 0) + util_fatal_error("line %i: no includes specified for segment", lineNum); + return true; + break; + + case STMT_name: + if (!parse_quoted_string(args, &currSeg->name)) + util_fatal_error("line %i: invalid name", lineNum); + break; + + case STMT_after: + if (!parse_quoted_string(args, &currSeg->after)) + util_fatal_error("line %i: invalid name for 'after'", lineNum); + break; + + case STMT_address: + if (!parse_number(args, &currSeg->address)) + util_fatal_error("line %i: expected number after 'address'", lineNum); + break; + + case STMT_number: + if (!parse_number(args, &currSeg->number)) + util_fatal_error("line %i: expected number after 'number'", lineNum); + break; + + case STMT_flags: + if (!parse_flags(args, &currSeg->flags)) + util_fatal_error("line %i: invalid flags", lineNum); + break; + + case STMT_align: + if (!parse_number(args, &currSeg->align)) + util_fatal_error("line %i: expected number after 'align'", lineNum); + if (!is_pow_of_2(currSeg->align)) + util_fatal_error("line %i: alignment is not a power of two", lineNum); + break; + + case STMT_romalign: + if (!parse_number(args, &currSeg->romalign)) + util_fatal_error("line %i: expected number after 'romalign'", lineNum); + if (!is_pow_of_2(currSeg->romalign)) + util_fatal_error("line %i: alignment is not a power of two", lineNum); + break; + + case STMT_include: + case STMT_include_data_with_rodata: + currSeg->includesCount++; + currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes)); + + if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1].fpath)) + util_fatal_error("line %i: invalid filename", lineNum); + + currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0; + currSeg->includes[currSeg->includesCount - 1].dataWithRodata = (stmt == STMT_include_data_with_rodata); + break; + case STMT_increment: + if (!parse_number(args, &currSeg->increment)) + util_fatal_error("line %i: expected number after 'increment'", lineNum); + break; + + case STMT_compress: + currSeg->compress = true; + break; + + case STMT_pad_text: + currSeg->includes[currSeg->includesCount - 1].linkerPadding += 0x10; + break; + + default: + fprintf(stderr, "warning: '%s' is not implemented\n", stmtNames[stmt]); + break; + } + return false; +} + +/** + * `segments` should be freed with `free_rom_spec` after use. + * Will write to the contents of `spec` to introduce string terminating '\0's. + * `segments` also contains pointers to inside `spec`, so `spec` should not be freed before `segments` + */ +void parse_rom_spec(char* spec, struct Segment** segments, int* segment_count) { + int lineNum = 1; + char* line = spec; + + struct Segment* currSeg = NULL; + + // iterate over lines + while (line[0] != 0) { + char* nextLine = line_split(line); + char* stmtName; + + if (line[0] != 0) { + stmtName = skip_whitespace(line); + } + + if (line[0] != 0 && stmtName[0] != 0) { + char* args = token_split(stmtName); + STMTId stmt = get_stmt_id_by_stmt_name(stmtName, lineNum); + + if (currSeg != NULL) { + bool segmentEnded = parse_segment_statement(currSeg, stmt, args, lineNum); + if (segmentEnded) { + currSeg = NULL; + } + } else { + // commands valid outside a segment definition + switch (stmt) { + case STMT_beginseg: + currSeg = add_segment(segments, segment_count); + currSeg->includes = NULL; + break; + case STMT_endseg: + util_fatal_error("line %i: '%s' outside of a segment definition", lineNum, stmtName); + break; + default: + fprintf(stderr, "warning: '%s' is not implemented\n", stmtName); + break; + } + } + } + + line = nextLine; + lineNum++; + } +} + +/** + * @brief Parses the spec, looking only for the segment with the name `segmentName`. + * Returns true if the segment was found, false otherwise + * + * @param[out] dstSegment The Segment to be filled. Will only contain the data of the searched segment, or garbage if + * the segment was not found. dstSegment must be previously allocated, a stack variable is recommended + * @param[in,out] spec A null-terminated string containing the whole spec file. This string will be modified by this + * function + * @param[in] segmentName The name of the segment being searched + */ +bool get_single_segment_by_name(struct Segment* dstSegment, char* spec, const char* segmentName) { + bool insideSegment = false; + int lineNum = 1; + char* line = spec; + + memset(dstSegment, 0, sizeof(struct Segment)); + + // iterate over lines + while (line[0] != '\0') { + char* nextLine = line_split(line); + char* stmtName = skip_whitespace(line); + + if (stmtName[0] != '\0') { + char* args = token_split(stmtName); + STMTId stmt = get_stmt_id_by_stmt_name(stmtName, lineNum); + + if (insideSegment) { + bool segmentEnded = parse_segment_statement(dstSegment, stmt, args, lineNum); + + if (stmt == STMT_name) { + if (strcmp(segmentName, dstSegment->name) != 0) { + // Not the segment we are looking for + insideSegment = false; + } + } else if (segmentEnded) { + return true; + } + } else { + if (stmt == STMT_beginseg) { + insideSegment = true; + if (dstSegment->includes != NULL) { + free(dstSegment->includes); + } + memset(dstSegment, 0, sizeof(struct Segment)); + } + } + } + + line = nextLine; + lineNum++; + } + + return false; +} + +/** + * @brief Frees the elements of the passed Segment. Will not free the pointer itself + * + * @param segment + */ +void free_single_segment_elements(struct Segment* segment) { + if (segment->includes != NULL) { + free(segment->includes); + } +} + +void free_rom_spec(struct Segment* segments, int segment_count) { + int i; + + for (i = 0; i < segment_count; i++) { + if (segments[i].includes != NULL) + free(segments[i].includes); + } + free(segments); +} diff --git a/tools/buildtools/spec.h b/tools/buildtools/spec.h new file mode 100644 index 000000000..aeabd07d1 --- /dev/null +++ b/tools/buildtools/spec.h @@ -0,0 +1,64 @@ +#ifndef SPEC_H +#define SPEC_H + +#include +#include + +typedef enum { + STMT_address, + STMT_after, + STMT_align, + STMT_beginseg, + STMT_compress, + STMT_endseg, + STMT_entry, + STMT_flags, + STMT_include, + STMT_include_data_with_rodata, + STMT_name, + STMT_number, + STMT_romalign, + STMT_stack, + STMT_increment, + STMT_pad_text, +} STMTId; + +enum { + FLAG_BOOT = (1 << 0), + FLAG_OBJECT = (1 << 1), + FLAG_RAW = (1 << 2), + FLAG_NOLOAD = (1 << 3), +}; + +struct Include { + char* fpath; + int linkerPadding; + uint8_t dataWithRodata; +}; + +typedef struct Segment { + uint32_t fields; + char* name; + char* after; + uint32_t flags; + uint32_t address; + uint32_t stack; + uint32_t align; + uint32_t romalign; + uint32_t increment; + uint32_t entry; + uint32_t number; + struct Include* includes; + int includesCount; + bool compress; +} Segment; + +void parse_rom_spec(char* spec, struct Segment** segments, int* segment_count); + +bool get_single_segment_by_name(struct Segment* dstSegment, char *spec, const char *segmentName); + +void free_single_segment_elements(struct Segment *segment); + +void free_rom_spec(struct Segment* segments, int segment_count); + +#endif diff --git a/tools/buildtools/util.c b/tools/buildtools/util.c index e826906cd..824e089e0 100644 --- a/tools/buildtools/util.c +++ b/tools/buildtools/util.c @@ -12,18 +12,18 @@ void util_fatal_error(const char *msgfmt, ...) { va_list args; - fputs("error: ", stderr); + fputs(ERRMSG_START, stderr); va_start(args, msgfmt); vfprintf(stderr, msgfmt, args); va_end(args); - fputc('\n', stderr); + fputs(ERRMSG_END "\n", stderr); exit(1); } -// reads a whole file into memory, and returns a pointer to the data +// reads a whole file into memory, and returns a malloc'd pointer to the data. void *util_read_whole_file(const char *filename, size_t *pSize) { FILE *file = fopen(filename, "rb"); @@ -59,13 +59,13 @@ void *util_read_whole_file(const char *filename, size_t *pSize) void util_write_whole_file(const char *filename, const void *data, size_t size) { FILE *file = fopen(filename, "wb"); - + if (file == NULL) util_fatal_error("failed to open file '%s' for writing: %s", filename, strerror(errno)); if (fwrite(data, size, 1, file) != 1) util_fatal_error("error writing to file '%s': %s", filename, strerror(errno)); - + fclose(file); } diff --git a/tools/buildtools/util.h b/tools/buildtools/util.h index 8659e6f35..ed692bf53 100644 --- a/tools/buildtools/util.h +++ b/tools/buildtools/util.h @@ -1,8 +1,15 @@ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef UTIL_H +#define UTIL_H + +#include +#include +#include + +#define ERRMSG_START "\x1b[91merror\x1b[97m: " +#define ERRMSG_END "\x1b[0m" #ifdef __GNUC__ -__attribute__((format(printf, 1, 2))) +__attribute__((format(printf, 1, 2), noreturn)) #endif void util_fatal_error(const char *msgfmt, ...); diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index a73d5d35f..fa87f8e51 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -484,7 +484,7 @@ 0x8018EB60 : "audio_load", 0x80192BE0 : "code_80192BE0", 0x80194710 : "audio_dcache", - 0x80194790 : "code_80194790", + 0x80194790 : "aisetnextbuf", 0x80194930 : "audio_playback", 0x80196A00 : "audio_effects", 0x801974D0 : "audio_seqplayer", @@ -588,7 +588,7 @@ 0x801D5FB0 : "audio_synthesis", 0x801D5FE0 : "audio_load", 0x801D5FF0 : "code_80192BE0", - 0x801D6010 : "code_80194790", + 0x801D6010 : "aisetnextbuf", 0x801D6190 : "audio_effects", 0x801D61A0 : "audio_seqplayer", 0x801D6200 : "audio_dramStack", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 55f7518ce..faf9c502c 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -635,7 +635,7 @@ 0x800B2810:("EffectSsKakera_Spawn",), 0x800B28C8:("EffectSsIcePiece_Spawn",), 0x800B2930:("EffectSsIcePiece_SpawnBurst",), - 0x800B2AC4:("EffectSsEnIce_SpawnFlyingVec3f",), + 0x800B2AC4:("EffectSsEnIce_SpawnFlying",), 0x800B2B44:("func_800B2B44",), 0x800B2B7C:("func_800B2B7C",), 0x800B2BC0:("EffectSsEnIce_Spawn",), @@ -783,7 +783,7 @@ 0x800B882C:("func_800B882C",), 0x800B886C:("func_800B886C",), 0x800B8898:("Actor_GetScreenPos",), - 0x800B8934:("func_800B8934",), + 0x800B8934:("Actor_OnScreen",), 0x800B89F8:("Actor_HasParent",), 0x800B8A1C:("Actor_PickUp",), 0x800B8B84:("Actor_PickUpNearby",), @@ -1113,37 +1113,37 @@ 0x800CAFDC:("DynaPolyActor_IsInHeavySwitchPressedState",), 0x800CB000:("DynaPolyActor_ValidateMove",), 0x800CB210:("Camera_fabsf",), - 0x800CB240:("Camera_LengthVec3f",), - 0x800CB270:("func_800CB270",), - 0x800CB330:("Camera_Lerpf",), - 0x800CB398:("Camera_Lerps",), - 0x800CB42C:("func_800CB42C",), - 0x800CB4C0:("Camera_LerpVec3f",), - 0x800CB544:("func_800CB544",), - 0x800CB584:("func_800CB584",), - 0x800CB5DC:("func_800CB5DC",), - 0x800CB60C:("func_800CB60C",), - 0x800CB674:("func_800CB674",), - 0x800CB6C8:("func_800CB6C8",), - 0x800CB700:("func_800CB700",), - 0x800CB780:("func_800CB780",), + 0x800CB240:("Camera_Vec3fMagnitude",), + 0x800CB270:("Camera_QuadraticAttenuation",), + 0x800CB330:("Camera_LerpCeilF",), + 0x800CB398:("Camera_LerpCeilS",), + 0x800CB42C:("Camera_LerpFloorS",), + 0x800CB4C0:("Camera_LerpCeilVec3f",), + 0x800CB544:("Camera_SetUpdateRatesFastPitch",), + 0x800CB584:("Camera_SetUpdateRatesFastYaw",), + 0x800CB5DC:("Camera_SetUpdateRatesSlow",), + 0x800CB60C:("Camera_Vec3sToVec3f",), + 0x800CB674:("Camera_AngleDiffAndScale",), + 0x800CB6C8:("Camera_UpdateAtActorOffset",), + 0x800CB700:("Camera_GetFocalActorHeight",), + 0x800CB780:("Camera_GetRunSpeedLimit",), 0x800CB7CC:("func_800CB7CC",), - 0x800CB7F8:("func_800CB7F8",), - 0x800CB828:("func_800CB828",), + 0x800CB7F8:("Camera_IsMountedOnHorse",), + 0x800CB828:("Camera_IsDekuHovering",), 0x800CB854:("func_800CB854",), 0x800CB880:("Camera_IsSwimming",), - 0x800CB8C8:("func_800CB8C8",), - 0x800CB8F4:("func_800CB8F4",), + 0x800CB8C8:("Camera_IsDiving",), + 0x800CB8F4:("Camera_IsPlayerFormZora",), 0x800CB924:("func_800CB924",), 0x800CB950:("func_800CB950",), - 0x800CBA08:("func_800CBA08",), - 0x800CBA34:("func_800CBA34",), + 0x800CBA08:("Camera_IsClimbingLedge",), + 0x800CBA34:("Camera_IsChargingSwordOrDekuFlowerDive",), 0x800CBA7C:("func_800CBA7C",), 0x800CBAAC:("func_800CBAAC",), - 0x800CBAD4:("func_800CBAD4",), - 0x800CBB58:("func_800CBB58",), + 0x800CBAD4:("Camera_GetFocalActorPos",), + 0x800CBB58:("Camera_IsUnderwaterAsZora",), 0x800CBB88:("func_800CBB88",), - 0x800CBC00:("func_800CBC00",), + 0x800CBC00:("Camera_IsUsingZoraFins",), 0x800CBC30:("func_800CBC30",), 0x800CBC84:("func_800CBC84",), 0x800CBFA4:("func_800CBFA4",), @@ -1258,8 +1258,8 @@ 0x800DDDD0:("Camera_Init",), 0x800DDFE0:("func_800DDFE0",), 0x800DE0E0:("func_800DE0E0",), - 0x800DE0EC:("func_800DE0EC",), - 0x800DE308:("func_800DE308",), + 0x800DE0EC:("Camera_InitPlayerSettings",), + 0x800DE308:("Camera_ChangeStatus",), 0x800DE324:("func_800DE324",), 0x800DE62C:("func_800DE62C",), 0x800DE840:("func_800DE840",), @@ -1280,7 +1280,7 @@ 0x800DFCB4:("Camera_GetCamDirPitch",), 0x800DFCDC:("Camera_GetCamDirYaw",), 0x800DFD04:("Camera_AddQuake",), - 0x800DFD78:("func_800DFD78",), + 0x800DFD78:("Camera_SetViewParam",), 0x800DFEF0:("func_800DFEF0",), 0x800DFF18:("func_800DFF18",), 0x800DFF34:("func_800DFF34",), @@ -1288,7 +1288,7 @@ 0x800DFF60:("Camera_SetFlags",), 0x800DFF84:("Camera_ClearFlags",), 0x800DFFAC:("Camera_ChangeDoorCam",), - 0x800E007C:("func_800E007C",), + 0x800E007C:("Camera_Copy",), 0x800E01AC:("func_800E01AC",), 0x800E01B8:("Camera_GetQuakeOffset",), 0x800E01DC:("func_800E01DC",), @@ -2456,8 +2456,8 @@ 0x80130674:("Scene_HeaderCmdAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), 0x801306E8:("Scene_ProcessHeader",), - 0x80130768:("Entrance_CreateIndex",), - 0x80130784:("Entrance_CreateIndexFromSpawn",), + 0x80130768:("Entrance_Create",), + 0x80130784:("Entrance_CreateFromSpawn",), 0x801307C0:("Scene_ExecuteDrawConfig",), 0x801307F4:("Scene_DrawConfigDefault",), 0x80130834:("AnimatedMat_TexScroll",), @@ -2649,12 +2649,12 @@ 0x80139FA0:("SkinMatrix_SetYRotation",), 0x8013A068:("SkinMatrix_MulYRotation",), 0x8013A174:("SkinMatrix_SetZRotation",), - 0x8013A240:("func_8013A240",), - 0x8013A41C:("func_8013A41C",), - 0x8013A46C:("func_8013A46C",), - 0x8013A4C4:("func_8013A4C4",), - 0x8013A504:("func_8013A504",), - 0x8013A530:("func_8013A530",), + 0x8013A240:("Snap_RecordPictographedActors",), + 0x8013A41C:("Snap_SetFlag",), + 0x8013A46C:("Snap_UnsetFlag",), + 0x8013A4C4:("Snap_CheckFlag",), + 0x8013A504:("Snap_AbsS",), + 0x8013A530:("Snap_ValidatePictograph",), 0x8013A7C0:("SubS_FindDoor",), 0x8013A860:("SubS_DrawTransformFlexLimb",), 0x8013AB00:("SubS_DrawTransformFlex",), @@ -2986,18 +2986,18 @@ 0x80165EC0:("func_80165EC0",), 0x80166060:("func_80166060",), 0x801660B8:("func_801660B8",), - 0x8016613C:("Play_Fini",), + 0x8016613C:("Play_Destroy",), 0x801663C4:("func_801663C4",), 0x80166644:("func_80166644",), 0x801668B4:("func_801668B4",), 0x80166968:("func_80166968",), 0x80166B30:("func_80166B30",), - 0x80167814:("func_80167814",), + 0x80167814:("Play_Update",), 0x80167DE4:("func_80167DE4",), 0x80167F0C:("func_80167F0C",), 0x80168090:("Play_Draw",), 0x80168DAC:("func_80168DAC",), - 0x80168F64:("Play_Update",), + 0x80168F64:("Play_Main",), 0x801690CC:("Play_InCsMode",), 0x80169100:("func_80169100",), 0x801691F0:("func_801691F0",), @@ -3005,22 +3005,22 @@ 0x8016927C:("func_8016927C",), 0x801692C4:("func_801692C4",), 0x801693D4:("Play_SceneInit",), - 0x80169474:("func_80169474",), + 0x80169474:("Play_GetScreenPos",), 0x801694DC:("Play_CreateSubCamera",), 0x80169584:("Play_GetActiveCamId",), - 0x80169590:("Play_CameraChangeStatus",), + 0x80169590:("Play_ChangeCameraStatus",), 0x80169600:("Play_ClearCamera",), 0x80169668:("Play_ClearAllSubCameras",), 0x801696D4:("Play_GetCamera",), - 0x8016970C:("Play_CameraSetAtEye",), - 0x8016981C:("Play_CameraSetAtEyeUp",), - 0x80169940:("Play_CameraSetFov",), - 0x80169988:("Play_CameraSetRoll",), + 0x8016970C:("Play_SetCameraAtEye",), + 0x8016981C:("Play_SetCameraAtEyeUp",), + 0x80169940:("Play_SetCameraFov",), + 0x80169988:("Play_SetCameraRoll",), 0x801699D4:("Play_CopyCamera",), 0x80169A50:("func_80169A50",), - 0x80169AC0:("Play_CameraChangeSetting",), + 0x80169AC0:("Play_ChangeCameraSetting",), 0x80169AFC:("func_80169AFC",), - 0x80169BC4:("Play_CameraGetUID",), + 0x80169BC4:("Play_GetCameraUID",), 0x80169BF8:("func_80169BF8",), 0x80169C64:("Play_GetActorCsCamSetting",), 0x80169C84:("Play_GetActorCsCamFuncData",), @@ -3688,10 +3688,10 @@ 0x80193774:("func_80193774",), 0x8019380C:("func_8019380C",), 0x80193858:("func_80193858",), - 0x8019387C:("func_8019387C",), - 0x801938A0:("Audio_QueueCmdS8",), + 0x8019387C:("AudioThread_QueueCmdS32",), + 0x801938A0:("AudioThread_QueueCmdS8",), 0x801938D0:("func_801938D0",), - 0x80193900:("func_80193900",), + 0x80193900:("AudioThread_ScheduleProcessCmds",), 0x80193990:("func_80193990",), 0x801939A8:("func_801939A8",), 0x80193AEC:("func_80193AEC",), @@ -3718,11 +3718,11 @@ 0x80194528:("func_80194528",), 0x80194548:("func_80194548",), 0x80194568:("func_80194568",), - 0x80194668:("Audio_NextRandom",), - 0x801946E4:("Audio_InitMesgQueues",), + 0x80194668:("AudioThread_NextRandom",), + 0x801946E4:("AudioThread_InitMesgQueues",), 0x80194710:("Audio_InvalDCache",), 0x80194750:("Audio_WritebackDCache",), - 0x80194790:("func_80194790",), + 0x80194790:("osAiSetNextBuffer",), 0x80194804:("func_80194804",), 0x80194840:("func_80194840",), 0x801948B0:("func_801948B0",), @@ -3805,52 +3805,52 @@ 0x8019ADBC:("AudioSeq_InitSequencePlayers",), 0x8019AE40:("func_8019AE40",), 0x8019AEC0:("func_8019AEC0",), - 0x8019AF00:("func_8019AF00",), - 0x8019AF58:("func_8019AF58",), - 0x8019AFE8:("func_8019AFE8",), - 0x8019B02C:("func_8019B02C",), - 0x8019B074:("AudioOcarina_MapSongFromNotesToButtons",), - 0x8019B144:("func_8019B144",), - 0x8019B378:("func_8019B378",), - 0x8019B38C:("func_8019B38C",), - 0x8019B3D0:("func_8019B3D0",), - 0x8019B4B8:("func_8019B4B8",), + 0x8019AF00:("AudioOcarina_ReadControllerInput",), + 0x8019AF58:("AudioOcarina_BendPitchTwoSemitones",), + 0x8019AFE8:("AudioOcarina_GetPlayingState",), + 0x8019B02C:("AudioOcarina_MapPitchToButton",), + 0x8019B074:("AudioOcarina_MapSongFromPitchToButton",), + 0x8019B144:("AudioOcarina_Start",), + 0x8019B378:("AudioOcarina_SetSongStartingPos",), + 0x8019B38C:("AudioOcarina_StartAtSongStartingPos",), + 0x8019B3D0:("AudioOcarina_StartForSongCheck",), + 0x8019B4B8:("AudioOcarina_StartWithSongNoteLengths",), 0x8019B544:("AudioOcarina_StartDefault",), 0x8019B568:("func_8019B568",), 0x8019B5AC:("func_8019B5AC",), 0x8019B5EC:("func_8019B5EC",), - 0x8019B618:("func_8019B618",), - 0x8019B654:("func_8019B654",), - 0x8019B6B4:("func_8019B6B4",), - 0x8019BC44:("func_8019BC44",), - 0x8019BE98:("func_8019BE98",), - 0x8019C1C0:("func_8019C1C0",), - 0x8019C1D0:("func_8019C1D0",), - 0x8019C268:("func_8019C268",), - 0x8019C2E4:("func_8019C2E4",), - 0x8019C300:("AudioOcarina_SetInstrumentId",), - 0x8019C398:("func_8019C398",), - 0x8019C5A0:("func_8019C5A0",), - 0x8019C8D8:("func_8019C8D8",), - 0x8019CD08:("func_8019CD08",), - 0x8019CE34:("func_8019CE34",), - 0x8019CE6C:("func_8019CE6C",), - 0x8019CEBC:("func_8019CEBC",), - 0x8019CF6C:("func_8019CF6C",), - 0x8019CF78:("func_8019CF78",), + 0x8019B618:("AudioOcarina_CheckIfStartedSong",), + 0x8019B654:("AudioOcarina_UpdateCurOcarinaSong",), + 0x8019B6B4:("AudioOcarina_CheckSongsWithMusicStaff",), + 0x8019BC44:("AudioOcarina_CheckSongsWithoutMusicStaff",), + 0x8019BE98:("AudioOcarina_PlayControllerInput",), + 0x8019C1C0:("AudioOcarina_EnableInput",), + 0x8019C1D0:("AudioOcarina_ResetAndMute",), + 0x8019C268:("AudioOcarina_ResetAndReadInput",), + 0x8019C2E4:("AudioOcarina_SetOcarinaDisableTimer",), + 0x8019C300:("AudioOcarina_SetInstrument",), + 0x8019C398:("AudioOcarina_SetPlaybackSong",), + 0x8019C5A0:("AudioOcarina_PlaybackSong",), + 0x8019C8D8:("AudioOcarina_SetRecordingSong",), + 0x8019CD08:("AudioOcarina_SetRecordingState",), + 0x8019CE34:("AudioOcarina_UpdateRecordingStaff",), + 0x8019CE6C:("AudioOcarina_UpdatePlayingStaff",), + 0x8019CEBC:("AudioOcarina_UpdatePlaybackStaff",), + 0x8019CF6C:("AudioOcarina_GetRecordingStaff",), + 0x8019CF78:("AudioOcarina_GetPlayingStaff",), 0x8019CF9C:("AudioOcarina_GetPlaybackStaff",), - 0x8019CFA8:("func_8019CFA8",), + 0x8019CFA8:("AudioOcarina_RecordSong",), 0x8019D134:("AudioOcarina_TerminaWallValidateNotes",), 0x8019D26C:("AudioOcarina_TerminaWallGenerateNotes",), - 0x8019D488:("AudioOcarina_MemoryGameSetNumNotes",), - 0x8019D4F8:("AudioOcarina_MemoryGameGenerateNotes",), - 0x8019D600:("func_8019D600",), - 0x8019D758:("func_8019D758",), - 0x8019D864:("func_8019D864",), - 0x8019D8B4:("func_8019D8B4",), - 0x8019D8E4:("func_8019D8E4",), - 0x8019DF28:("func_8019DF28",), - 0x8019DF64:("func_8019DF64",), + 0x8019D488:("AudioOcarina_MemoryGameInit",), + 0x8019D4F8:("AudioOcarina_MemoryGameNextNote",), + 0x8019D600:("AudioOcarina_Update",), + 0x8019D758:("AudioOcarina_PlayLongScarecrowAfterCredits",), + 0x8019D864:("AudioOcarina_SetCustomSequence",), + 0x8019D8B4:("AudioOcarina_PlayCustomSequence",), + 0x8019D8E4:("AudioOcarina_CreateCustomSequence",), + 0x8019DF28:("AudioOcarina_ResetInstrument",), + 0x8019DF64:("AudioOcarina_ResetStaffs",), 0x8019DFF8:("func_8019DFF8",), 0x8019E000:("func_8019E000",), 0x8019E00C:("func_8019E00C",), @@ -3858,27 +3858,27 @@ 0x8019E0FC:("func_8019E0FC",), 0x8019E104:("func_8019E104",), 0x8019E110:("func_8019E110",), - 0x8019E14C:("func_8019E14C",), - 0x8019E324:("func_8019E324",), - 0x8019E4B0:("func_8019E4B0",), - 0x8019E634:("func_8019E634",), - 0x8019E864:("func_8019E864",), - 0x8019EA40:("func_8019EA40",), - 0x8019EB2C:("func_8019EB2C",), - 0x8019F024:("func_8019F024",), - 0x8019F05C:("func_8019F05C",), + 0x8019E14C:("AudioSfx_ComputeVolume",), + 0x8019E324:("AudioSfx_ComputeReverb",), + 0x8019E4B0:("AudioSfx_ComputePanSigned",), + 0x8019E634:("AudioSfx_ComputeFreqScale",), + 0x8019E864:("AudioSfx_ComputeSurroundSoundFilter",), + 0x8019EA40:("AudioSfx_ComputeCombFilter",), + 0x8019EB2C:("AudioSfx_SetProperties",), + 0x8019F024:("AudioSfx_SetFreqAndStereoBits",), + 0x8019F05C:("AudioSfx_ResetSfxChannelState",), 0x8019F0C8:("play_sound",), 0x8019F128:("func_8019F128",), 0x8019F170:("func_8019F170",), 0x8019F1C0:("Audio_PlaySfxAtPos",), 0x8019F208:("func_8019F208",), 0x8019F230:("func_8019F230",), - 0x8019F258:("func_8019F258",), - 0x8019F300:("func_8019F300",), + 0x8019F258:("AudioSfx_AddSfxSetting",), + 0x8019F300:("AudioSfx_ProcessSfxSettings",), 0x8019F420:("func_8019F420",), 0x8019F4AC:("func_8019F4AC",), 0x8019F540:("func_8019F540",), - 0x8019F570:("func_8019F570",), + 0x8019F570:("AudioSfx_LowerSfxSettingsReverb",), 0x8019F5AC:("func_8019F5AC",), 0x8019F638:("func_8019F638",), 0x8019F780:("func_8019F780",), @@ -3912,7 +3912,7 @@ 0x801A0554:("func_801A0554",), 0x801A05E4:("func_801A05E4",), 0x801A05F0:("func_801A05F0",), - 0x801A0654:("func_801A0654",), + 0x801A0654:("AudioSfx_SetChannelIO",), 0x801A0810:("func_801A0810",), 0x801A0868:("func_801A0868",), 0x801A09D4:("func_801A09D4",), @@ -3990,7 +3990,7 @@ 0x801A42C8:("func_801A42C8",), 0x801A4324:("func_801A4324",), 0x801A4348:("func_801A4348",), - 0x801A4380:("func_801A4380",), + 0x801A4380:("Audio_SetSfxVolumeExceptSystemAndOcarinaBanks",), 0x801A4428:("func_801A4428",), 0x801A44A4:("Audio_PreNMI",), 0x801A44C4:("func_801A44C4",), @@ -4001,9 +4001,9 @@ 0x801A47DC:("func_801A47DC",), 0x801A48E0:("func_801A48E0",), 0x801A4A28:("func_801A4A28",), - 0x801A4B80:("func_801A4B80",), - 0x801A4C30:("func_801A4C30",), - 0x801A4C54:("func_801A4C54",), + 0x801A4B80:("Audio_SetNatureAmbienceRandomBend",), + 0x801A4C30:("Audio_Init",), + 0x801A4C54:("AudioSfx_Init",), 0x801A4D00:("func_801A4D00",), 0x801A4D50:("func_801A4D50",), 0x801A4DA4:("func_801A4DA4",), @@ -4030,29 +4030,29 @@ 0x801A5808:("func_801A5808",), 0x801A5A10:("func_801A5A10",), 0x801A5A1C:("func_801A5A1C",), - 0x801A5BD0:("func_801A5BD0",), - 0x801A5C28:("func_801A5C28",), - 0x801A5C8C:("func_801A5C8C",), - 0x801A5CFC:("Audio_PlaySfxGeneral",), - 0x801A5DDC:("func_801A5DDC",), - 0x801A5F7C:("func_801A5F7C",), - 0x801A6430:("func_801A6430",), - 0x801A65C8:("func_801A65C8",), - 0x801A6D0C:("func_801A6D0C",), - 0x801A7084:("func_801A7084",), - 0x801A7168:("func_801A7168",), - 0x801A7284:("func_801A7284",), - 0x801A72CC:("Audio_StopSfxByPos",), - 0x801A7328:("func_801A7328",), - 0x801A7484:("func_801A7484",), - 0x801A75E8:("func_801A75E8",), - 0x801A7720:("func_801A7720",), - 0x801A7794:("func_801A7794",), - 0x801A7828:("func_801A7828",), - 0x801A787C:("func_801A787C",), - 0x801A78E4:("Audio_IsSfxPlaying",), - 0x801A794C:("func_801A794C",), - 0x801A7B10:("func_801A7B10",), + 0x801A5BD0:("AudioSfx_MuteBanks",), + 0x801A5C28:("AudioSfx_LowerBgmVolume",), + 0x801A5C8C:("AudioSfx_RestoreBgmVolume",), + 0x801A5CFC:("AudioSfx_PlaySfx",), + 0x801A5DDC:("AudioSfx_RemoveMatchingRequests",), + 0x801A5F7C:("AudioSfx_ProcessRequest",), + 0x801A6430:("AudioSfx_RemoveBankEntry",), + 0x801A65C8:("AudioSfx_ChooseActiveSfx",), + 0x801A6D0C:("AudioSfx_PlayActiveSfx",), + 0x801A7084:("AudioSfx_StopByBank",), + 0x801A7168:("AudioSfx_StopByPosAndBankImpl",), + 0x801A7284:("AudioSfx_StopByPosAndBank",), + 0x801A72CC:("AudioSfx_StopByPos",), + 0x801A7328:("AudioSfx_StopByPosAndId",), + 0x801A7484:("AudioSfx_StopByTokenAndId",), + 0x801A75E8:("AudioSfx_StopById",), + 0x801A7720:("AudioSfx_ProcessRequests",), + 0x801A7794:("AudioSfx_SetBankLerp",), + 0x801A7828:("AudioSfx_StepBankLerp",), + 0x801A787C:("AudioSfx_ProcessActiveSfx",), + 0x801A78E4:("AudioSfx_IsPlaying",), + 0x801A794C:("AudioSfx_Reset",), + 0x801A7B10:("Audio_StartSequence",), 0x801A7D04:("func_801A7D04",), 0x801A7D84:("func_801A7D84",), 0x801A89A8:("Audio_QueueSeqCmd",), @@ -5237,7 +5237,7 @@ 0x8087DF64:("EnHorse_MountedIdle",), 0x8087E080:("EnHorse_MountedIdleAnim",), 0x8087E0A4:("EnHorse_MountedIdleWhinney",), - 0x8087E18C:("EnHorse_MountedIdleWhinneying",), + 0x8087E18C:("EnHorse_MountedIdleWhinnying",), 0x8087E2A8:("EnHorse_StartTurning",), 0x8087E350:("EnHorse_MountedTurn",), 0x8087E564:("EnHorse_StartWalkingFromIdle",), @@ -6703,7 +6703,7 @@ 0x808F25A4:("EnKarebaba_Update",), 0x808F280C:("func_808F280C",), 0x808F28F8:("EnKarebaba_Draw",), - 0x808F30B0:("func_808F30B0",), + 0x808F30B0:("EnIn_ChangeAnim",), 0x808F3178:("func_808F3178",), 0x808F322C:("func_808F322C",), 0x808F32A0:("func_808F32A0",), @@ -7539,18 +7539,18 @@ 0x809455A0:("ItemInbox_Draw",), 0x80945650:("EnGe1_Init",), 0x809457C0:("EnGe1_Destroy",), - 0x809457EC:("func_809457EC",), - 0x80945924:("func_80945924",), - 0x80945A00:("func_80945A00",), - 0x80945A9C:("func_80945A9C",), - 0x80945B60:("func_80945B60",), - 0x80945C50:("func_80945C50",), - 0x80945CAC:("func_80945CAC",), - 0x80945CE4:("func_80945CE4",), + 0x809457EC:("EnGe1_ChangeAnim",), + 0x80945924:("EnGe1_LookAtPlayer",), + 0x80945A00:("EnGe1_ShadowDraw",), + 0x80945A9C:("EnGe1_SetupPath",), + 0x80945B60:("EnGe1_FollowPath",), + 0x80945C50:("EnGe1_Scream",), + 0x80945CAC:("EnGe1_Wait",), + 0x80945CE4:("EnGe1_PerformCutsceneActions",), 0x8094607C:("EnGe1_Update",), - 0x80946190:("func_80946190",), - 0x80946238:("func_80946238",), - 0x80946368:("func_80946368",), + 0x80946190:("EnGe1_ValidatePictograph",), + 0x80946238:("EnGe1_OverrideLimbDraw",), + 0x80946368:("EnGe1_PostLimbDraw",), 0x80946400:("EnGe1_Draw",), 0x809466A0:("ObjBlockstop_Init",), 0x809466F0:("ObjBlockstop_CheckForBlock",), @@ -8016,8 +8016,8 @@ 0x8096F4DC:("BgF40Swlift_Draw",), 0x8096F5E0:("EnKakasi_Destroy",), 0x8096F60C:("EnKakasi_Init",), - 0x8096F800:("EnKakasi_SetAnimation",), - 0x8096F88C:("EnKakasi_8096F88C",), + 0x8096F800:("EnKakasi_ChangeAnim",), + 0x8096F88C:("EnKakasi_ValidatePictograph",), 0x8096F8D8:("func_8096F8D8",), 0x8096FA18:("func_8096FA18",), 0x8096FAAC:("func_8096FAAC",), @@ -8083,7 +8083,7 @@ 0x80974118:("EnSsh_AddBlureVertex",), 0x80974220:("EnSsh_AddBlureSpace",), 0x8097424C:("EnSsh_InitColliders",), - 0x80974374:("EnSsh_SetAnimation",), + 0x80974374:("EnSsh_ChangeAnim",), 0x809744A8:("EnSsh_SetWaitAnimation",), 0x809744C8:("EnSsh_SetReturnAnimation",), 0x809744FC:("EnSsh_SetLandAnimation",), @@ -8221,8 +8221,8 @@ 0x8097F020:("EffectSsIcePiece_Update",), 0x8097F0D0:("EffectSsEnIce_Init",), 0x8097F2F0:("EffectSsEnIce_Draw",), - 0x8097F62C:("func_8097F62C",), - 0x8097F7EC:("func_8097F7EC",), + 0x8097F62C:("EffectSsEnIce_UpdateFlying",), + 0x8097F7EC:("EffectSsEnIce_Update",), 0x8097F880:("EffectSsFireTail_Init",), 0x8097F99C:("EffectSsFireTail_Draw",), 0x8097FE8C:("EffectSsFireTail_Update",), @@ -8305,7 +8305,7 @@ 0x80987A3C:("OceffWipe3_Destroy",), 0x80987A70:("OceffWipe3_Update",), 0x80987AD0:("OceffWipe3_Draw",), - 0x80989140:("EnDg_ChangeAnimation",), + 0x80989140:("EnDg_ChangeAnim",), 0x80989204:("EnDg_UpdateCollision",), 0x8098933C:("EnDg_GetFloorRot",), 0x80989418:("EnDg_HasReachedPoint",), @@ -8615,7 +8615,7 @@ 0x8099D7DC:("OceffWipe4_Destroy",), 0x8099D810:("OceffWipe4_Update",), 0x8099D870:("OceffWipe4_Draw",), - 0x8099E790:("EnZo_SetAnimation",), + 0x8099E790:("EnZo_ChangeAnim",), 0x8099E858:("EnZo_PlayWalkingSound",), 0x8099E96C:("EnZo_Blink",), 0x8099E9E0:("EnZo_UpdateCollider",), @@ -9749,7 +9749,7 @@ 0x80A16D6C:("EnRaf_ClearPixelPetal",), 0x80A16D90:("EnRaf_Init",), 0x80A17018:("EnRaf_Destroy",), - 0x80A17060:("EnRaf_ChangeAnimation",), + 0x80A17060:("EnRaf_ChangeAnim",), 0x80A1712C:("EnRaf_SetupIdle",), 0x80A171D8:("EnRaf_Idle",), 0x80A17414:("EnRaf_SetupGrab",), @@ -10036,11 +10036,11 @@ 0x80A29094:("func_80A29094",), 0x80A29150:("EnBigpamet_Update",), 0x80A292A8:("func_80A292A8",), - 0x80A293E4:("func_80A293E4",), - 0x80A29494:("func_80A29494",), + 0x80A293E4:("EnBigpamet_OverrideLimbDraw2",), + 0x80A29494:("EnBigpamet_PostLimbDraw2",), 0x80A294D8:("EnBigpamet_Draw",), - 0x80A29580:("func_80A29580",), - 0x80A29628:("func_80A29628",), + 0x80A29580:("EnBigpamet_OverrideLimbDraw1",), + 0x80A29628:("EnBigpamet_PostLimbDraw1",), 0x80A2966C:("func_80A2966C",), 0x80A29A80:("func_80A29A80",), 0x80A29C18:("BgDblueMovebg_Init",), @@ -10090,7 +10090,7 @@ 0x80A2CF50:("func_80A2CF50",), 0x80A2CF7C:("func_80A2CF7C",), 0x80A2D0FC:("ElfMsg3_Update",), - 0x80A2D280:("EnFg_UpdateAnimation",), + 0x80A2D280:("EnFg_ChangeAnim",), 0x80A2D348:("func_80A2D348",), 0x80A2D3D4:("func_80A2D3D4",), 0x80A2D400:("func_80A2D400",), @@ -10347,8 +10347,8 @@ 0x80A3E248:("ObjSmork_Draw",), 0x80A3E390:("EnTest2_Init",), 0x80A3E3E4:("EnTest2_Update",), - 0x80A3E4EC:("func_80A3E4EC",), - 0x80A3E524:("func_80A3E524",), + 0x80A3E4EC:("EnTest2_UpdateForLens",), + 0x80A3E524:("EnTest2_Draw",), 0x80A3E7E0:("func_80A3E7E0",), 0x80A3E80C:("func_80A3E80C",), 0x80A3E870:("func_80A3E870",), @@ -10591,7 +10591,7 @@ 0x80A52018:("func_80A52018",), 0x80A52074:("func_80A52074",), 0x80A52134:("func_80A52134",), - 0x80A52530:("func_80A52530",), + 0x80A52530:("EnDnq_ValidatePictograph",), 0x80A5257C:("func_80A5257C",), 0x80A52604:("func_80A52604",), 0x80A52648:("func_80A52648",), @@ -10641,32 +10641,32 @@ 0x80A560F0:("EnFirefly2_Draw",), 0x80A56150:("EnRat_Init",), 0x80A56370:("EnRat_Destroy",), - 0x80A563CC:("func_80A563CC",), - 0x80A56444:("func_80A56444",), - 0x80A5665C:("func_80A5665C",), - 0x80A566E0:("func_80A566E0",), - 0x80A56994:("func_80A56994",), - 0x80A56AFC:("func_80A56AFC",), - 0x80A56EB8:("func_80A56EB8",), - 0x80A56F68:("func_80A56F68",), - 0x80A57010:("func_80A57010",), - 0x80A57118:("func_80A57118",), - 0x80A57180:("func_80A57180",), - 0x80A5723C:("func_80A5723C",), - 0x80A57330:("func_80A57330",), - 0x80A57384:("func_80A57384",), - 0x80A57488:("func_80A57488",), - 0x80A574E8:("func_80A574E8",), - 0x80A57570:("func_80A57570",), - 0x80A575F4:("func_80A575F4",), - 0x80A5764C:("func_80A5764C",), - 0x80A57918:("func_80A57918",), - 0x80A57984:("func_80A57984",), - 0x80A57A08:("func_80A57A08",), - 0x80A57A9C:("func_80A57A9C",), + 0x80A563CC:("EnRat_InitializeAxes",), + 0x80A56444:("EnRat_UpdateFloorPoly",), + 0x80A5665C:("EnRat_UpdateRotation",), + 0x80A566E0:("EnRat_ChooseDirection",), + 0x80A56994:("EnRat_IsOnCollisionPoly",), + 0x80A56AFC:("EnRat_IsTouchingSurface",), + 0x80A56EB8:("EnRat_ActorCoordsToWorld",), + 0x80A56F68:("EnRat_SpawnWaterEffects",), + 0x80A57010:("EnRat_HandleNonSceneCollision",), + 0x80A57118:("EnRat_SpawnSmoke",), + 0x80A57180:("EnRat_SetupRevive",), + 0x80A5723C:("EnRat_Revive",), + 0x80A57330:("EnRat_SetupIdle",), + 0x80A57384:("EnRat_Idle",), + 0x80A57488:("EnRat_SetupSpottedPlayer",), + 0x80A574E8:("EnRat_SpottedPlayer",), + 0x80A57570:("EnRat_UpdateSparkOffsets",), + 0x80A575F4:("EnRat_SetupChasePlayer",), + 0x80A5764C:("EnRat_ChasePlayer",), + 0x80A57918:("EnRat_SetupBounced",), + 0x80A57984:("EnRat_Bounced",), + 0x80A57A08:("EnRat_Explode",), + 0x80A57A9C:("EnRat_PostDetonation",), 0x80A57AE0:("EnRat_Update",), - 0x80A57F10:("func_80A57F10",), - 0x80A57F4C:("func_80A57F4C",), + 0x80A57F10:("EnRat_OverrideLimbDraw",), + 0x80A57F4C:("EnRat_PostLimbDraw",), 0x80A58354:("EnRat_Draw",), 0x80A587A0:("func_80A587A0",), 0x80A58908:("func_80A58908",), @@ -10760,7 +10760,7 @@ 0x80A619EC:("EnBal_Destroy",), 0x80A61A18:("func_80A61A18",), 0x80A61A44:("func_80A61A44",), - 0x80A61A6C:("func_80A61A6C",), + 0x80A61A6C:("EnBal_ValidatePictograph",), 0x80A61ADC:("func_80A61ADC",), 0x80A61B5C:("func_80A61B5C",), 0x80A61C9C:("func_80A61C9C",), @@ -11464,7 +11464,7 @@ 0x80A9FB54:("DmOpstage_Update",), 0x80A9FBB8:("DmOpstage_Draw",), 0x80A9FDB0:("DmStk_LoadObjectForAnimation",), - 0x80A9FE3C:("DmStk_ChangeAnimation",), + 0x80A9FE3C:("DmStk_ChangeAnim",), 0x80A9FED8:("DmStk_PlaySfxForIntroCutsceneFirstPart",), 0x80AA00CC:("DmStk_PlaySfxForTitleCutscene",), 0x80AA0100:("DmStk_PlaySfxForIntroCutsceneSecondPart",), @@ -11547,7 +11547,7 @@ 0x80AA90F4:("func_80AA90F4",), 0x80AA9140:("DmChar01_Update",), 0x80AA922C:("DmChar01_Draw",), - 0x80AAAE30:("DmChar02_ChangeAnimation",), + 0x80AAAE30:("DmChar02_ChangeAnim",), 0x80AAAECC:("DmChar02_PlaySfxForDroppingOcarinaCutscene",), 0x80AAAF2C:("DmChar02_PlaySfxForCutscenes",), 0x80AAAF78:("DmChar02_Init",), @@ -11558,7 +11558,7 @@ 0x80AAB258:("DmChar02_PostLimbDraw",), 0x80AAB270:("DmChar02_TransformLimbDraw",), 0x80AAB284:("DmChar02_Draw",), - 0x80AAB4A0:("DmChar03_ChangeAnimation",), + 0x80AAB4A0:("DmChar03_ChangeAnim",), 0x80AAB53C:("DmChar03_Init",), 0x80AAB5E8:("DmChar03_Destroy",), 0x80AAB5F8:("func_80AAB5F8",), @@ -11656,16 +11656,16 @@ 0x80AB0E7C:("func_80AB0E7C",), 0x80AB0F90:("func_80AB0F90",), 0x80AB1124:("DmChar08_Draw",), - 0x80AB1E10:("func_80AB1E10",), + 0x80AB1E10:("DmChar09_ChangeAnim",), 0x80AB1EAC:("DmChar09_Init",), 0x80AB1F90:("DmChar09_Destroy",), 0x80AB1FA0:("func_80AB1FA0",), 0x80AB1FDC:("func_80AB1FDC",), - 0x80AB2258:("func_80AB2258",), + 0x80AB2258:("DmChar09_DoNothing",), 0x80AB2268:("func_80AB2268",), 0x80AB24BC:("func_80AB24BC",), 0x80AB2544:("DmChar09_Update",), - 0x80AB25D8:("func_80AB25D8",), + 0x80AB25D8:("DmChar09_OverrideLimbDraw",), 0x80AB261C:("DmChar09_Draw",), 0x80AB2790:("ObjTokeidai_GetTargetSunMoonPanelRotation",), 0x80AB27B4:("ObjTokeidai_SetupClockOrExteriorGear",), @@ -11720,7 +11720,7 @@ 0x80AB53DC:("EnMnk_Init",), 0x80AB59E8:("EnMnk_Destroy",), 0x80AB5A64:("func_80AB5A64",), - 0x80AB5B38:("func_80AB5B38",), + 0x80AB5B38:("EnMnk_ValidatePictograph",), 0x80AB5B84:("func_80AB5B84",), 0x80AB5BCC:("func_80AB5BCC",), 0x80AB5C14:("func_80AB5C14",), @@ -11916,7 +11916,7 @@ 0x80AC299C:("EnBigokuta_MoveCamera",), 0x80AC2A1C:("EnBigokuta_ResetCamera",), 0x80AC2A7C:("EnBigokuta_ShootPlayer",), - 0x80AC2B4C:("func_80AC2B4C",), + 0x80AC2B4C:("EnBigokuta_ValidatePictograph",), 0x80AC2B98:("EnBigokuta_IsInWater",), 0x80AC2C30:("EnBigokuta_SpawnRipple",), 0x80AC2C84:("EnBigokuta_SetupIdle",), @@ -12865,12 +12865,12 @@ 0x80B00F08:("EnTalkGibud_OverrideLimbDraw",), 0x80B00F64:("EnTalkGibud_PostLimbDraw",), 0x80B01040:("EnTalkGibud_Draw",), - 0x80B01990:("EnGiant_ChangeAnimation",), + 0x80B01990:("EnGiant_ChangeAnim",), 0x80B01A74:("EnGiant_IsImprisoned",), 0x80B01B30:("EnGiant_Init",), 0x80B01E74:("EnGiant_Destroy",), 0x80B01E84:("EnGiant_ChangeToStartOrLoopAnimation",), - 0x80B01EE8:("EnGiant_ChangeAnimationBasedOnCsAction",), + 0x80B01EE8:("EnGiant_ChangeAnimBasedOnCsAction",), 0x80B020A0:("EnGiant_UpdateAlpha",), 0x80B0211C:("EnGiant_PlayAndUpdateAnimation",), 0x80B02234:("EnGiant_PlaySound",), @@ -13202,37 +13202,37 @@ 0x80B1D484:("EnPoSisters_Draw",), 0x80B1DEB0:("EnPp_Init",), 0x80B1E234:("EnPp_Destroy",), - 0x80B1E29C:("func_80B1E29C",), - 0x80B1E3D4:("func_80B1E3D4",), - 0x80B1E5A8:("func_80B1E5A8",), - 0x80B1E680:("func_80B1E680",), - 0x80B1E778:("func_80B1E778",), - 0x80B1E958:("func_80B1E958",), - 0x80B1E970:("func_80B1E970",), - 0x80B1EBD8:("func_80B1EBD8",), - 0x80B1EC24:("func_80B1EC24",), - 0x80B1EFFC:("func_80B1EFFC",), - 0x80B1F048:("func_80B1F048",), - 0x80B1F0A4:("func_80B1F0A4",), - 0x80B1F188:("func_80B1F188",), - 0x80B1F244:("func_80B1F244",), - 0x80B1F29C:("func_80B1F29C",), - 0x80B1F4A0:("func_80B1F4A0",), - 0x80B1F560:("func_80B1F560",), - 0x80B1F664:("func_80B1F664",), - 0x80B1F6B4:("func_80B1F6B4",), - 0x80B1F770:("func_80B1F770",), - 0x80B1F940:("func_80B1F940",), - 0x80B1FAD0:("func_80B1FAD0",), - 0x80B1FC7C:("func_80B1FC7C",), - 0x80B1FF20:("func_80B1FF20",), - 0x80B20030:("func_80B20030",), - 0x80B202B8:("func_80B202B8",), - 0x80B203BC:("func_80B203BC",), - 0x80B20668:("func_80B20668",), + 0x80B1E29C:("EnPp_PointlessPosCheck",), + 0x80B1E3D4:("EnPp_SpawnDust",), + 0x80B1E5A8:("EnPp_ChangeAnim",), + 0x80B1E680:("EnPp_PlaySfxForAnimation",), + 0x80B1E778:("EnPp_CheckCollision",), + 0x80B1E958:("EnPp_SetupIdle",), + 0x80B1E970:("EnPp_Idle",), + 0x80B1EBD8:("EnPp_SetupCharge",), + 0x80B1EC24:("EnPp_Charge",), + 0x80B1EFFC:("EnPp_SetupAttack",), + 0x80B1F048:("EnPp_Attack",), + 0x80B1F0A4:("EnPp_SetupBounced",), + 0x80B1F188:("EnPp_Bounced",), + 0x80B1F244:("EnPp_SetupRoar",), + 0x80B1F29C:("EnPp_Roar",), + 0x80B1F4A0:("EnPp_SetupJump",), + 0x80B1F560:("EnPp_Jump",), + 0x80B1F664:("EnPp_SetupStunnedOrFrozen",), + 0x80B1F6B4:("EnPp_StunnedOrFrozen",), + 0x80B1F770:("EnPp_SetupDamaged",), + 0x80B1F940:("EnPp_Damaged",), + 0x80B1FAD0:("EnPp_SetupDead",), + 0x80B1FC7C:("EnPp_Dead",), + 0x80B1FF20:("EnPp_Mask_SetupDetach",), + 0x80B20030:("EnPp_Mask_Detach",), + 0x80B202B8:("EnPp_BodyPart_SetupMove",), + 0x80B203BC:("EnPp_BodyPart_Move",), + 0x80B20668:("EnPp_UpdateDamage",), 0x80B20B40:("EnPp_Update",), - 0x80B20E6C:("func_80B20E6C",), - 0x80B20F70:("func_80B20F70",), + 0x80B20E6C:("EnPp_OverrideLimbDraw",), + 0x80B20F70:("EnPp_PostLimbDraw",), 0x80B21344:("EnPp_Draw",), 0x80B21B00:("EnHakurock_Init",), 0x80B21BB4:("EnHakurock_Destroy",), @@ -13277,7 +13277,7 @@ 0x80B23F50:("ObjWind_Destroy",), 0x80B23F60:("ObjWind_Update",), 0x80B243C0:("ObjWind_Draw",), - 0x80B24630:("EnRacedog_ChangeAnimation",), + 0x80B24630:("EnRacedog_ChangeAnim",), 0x80B246F4:("EnRacedog_UpdateCollision",), 0x80B2478C:("EnRacedog_GetYRotation",), 0x80B248B8:("EnRacedog_GetFloorRot",), @@ -13372,21 +13372,21 @@ 0x80B2ADB0:("func_80B2ADB0",), 0x80B2AF80:("func_80B2AF80",), 0x80B2B180:("func_80B2B180",), - 0x80B2B830:("func_80B2B830",), - 0x80B2B874:("func_80B2B874",), - 0x80B2B8F4:("func_80B2B8F4",), - 0x80B2B974:("func_80B2B974",), - 0x80B2BAA4:("func_80B2BAA4",), - 0x80B2BBFC:("func_80B2BBFC",), - 0x80B2BCF8:("func_80B2BCF8",), - 0x80B2BD30:("func_80B2BD30",), - 0x80B2BD88:("func_80B2BD88",), - 0x80B2BD98:("func_80B2BD98",), - 0x80B2BE54:("func_80B2BE54",), + 0x80B2B830:("EnPst_UpdateCollision",), + 0x80B2B874:("EnPst_HandleLetterDay1",), + 0x80B2B8F4:("EnPst_HandleLetterDay2",), + 0x80B2B974:("EnPst_ChooseBehaviour",), + 0x80B2BAA4:("EnPst_GetMsgEventScript",), + 0x80B2BBFC:("EnPst_CheckTalk",), + 0x80B2BCF8:("EnPst_UpdateFlagsSubs",), + 0x80B2BD30:("EnPst_ProcessScheduleOutput",), + 0x80B2BD88:("EnPst_Idle",), + 0x80B2BD98:("EnPst_FollowSchedule",), + 0x80B2BE54:("EnPst_Talk",), 0x80B2BF3C:("EnPst_Init",), 0x80B2C04C:("EnPst_Destroy",), 0x80B2C078:("EnPst_Update",), - 0x80B2C11C:("func_80B2C11C",), + 0x80B2C11C:("EnPst_OverrideLimbDraw",), 0x80B2C18C:("EnPst_Draw",), 0x80B2C6F0:("EnPoh_Init",), 0x80B2C8B8:("EnPoh_Destroy",), @@ -14130,7 +14130,7 @@ 0x80B5E1D8:("func_80B5E1D8",), 0x80B5E890:("EnDragon_Init",), 0x80B5EA74:("EnDragon_Destroy",), - 0x80B5EAA0:("EnDragon_ChangeAnimation",), + 0x80B5EAA0:("EnDragon_ChangeAnim",), 0x80B5EB40:("EnDragon_SpawnBubbles",), 0x80B5ED90:("EnDragon_RetreatOnceTimerEnds",), 0x80B5EDF0:("EnDragon_SetupRetreatOrIdle",), @@ -14508,7 +14508,7 @@ 0x80B7AEFC:("ObjUm_TerminaFieldIdle",), 0x80B7AF30:("func_80B7AF30",), 0x80B7B154:("ObjUm_DefaultAnim",), - 0x80B7B18C:("ObjUm_UpdateAnim",), + 0x80B7B18C:("ObjUm_ChangeAnim",), 0x80B7B368:("ObjUm_Update",), 0x80B7B598:("ObjUm_OverrideLimbDraw",), 0x80B7B93C:("ObjUm_SpawnFragments",), @@ -15198,7 +15198,7 @@ 0x80BAA220:("EnBaba_Draw",), 0x80BAA6D0:("EnSuttari_UpdateCollider",), 0x80BAA848:("EnSuttari_GetActorById",), - 0x80BAA88C:("EnSuttari_SetNextEntrance",), + 0x80BAA88C:("EnSuttari_TriggerTransition",), 0x80BAA8D0:("EnSuttari_UpdateTime",), 0x80BAA904:("func_80BAA904",), 0x80BAA9B4:("func_80BAA9B4",), @@ -15414,42 +15414,42 @@ 0x80BBC4E4:("func_80BBC4E4",), 0x80BBC500:("func_80BBC500",), 0x80BBC540:("EnZos_Draw",), - 0x80BBCA80:("func_80BBCA80",), - 0x80BBD348:("func_80BBD348",), - 0x80BBD8F0:("func_80BBD8F0",), - 0x80BBD93C:("func_80BBD93C",), - 0x80BBD98C:("func_80BBD98C",), - 0x80BBDACC:("func_80BBDACC",), - 0x80BBDC34:("func_80BBDC34",), - 0x80BBDCFC:("func_80BBDCFC",), - 0x80BBDDF8:("func_80BBDDF8",), - 0x80BBDE78:("func_80BBDE78",), - 0x80BBDF28:("func_80BBDF28",), - 0x80BBDFA8:("func_80BBDFA8",), - 0x80BBE05C:("func_80BBE05C",), - 0x80BBE0E4:("func_80BBE0E4",), - 0x80BBE144:("func_80BBE144",), - 0x80BBE374:("func_80BBE374",), - 0x80BBE498:("func_80BBE498",), - 0x80BBE73C:("func_80BBE73C",), - 0x80BBE844:("func_80BBE844",), - 0x80BBE904:("func_80BBE904",), - 0x80BBE9F8:("func_80BBE9F8",), - 0x80BBEAD8:("func_80BBEAD8",), - 0x80BBEBF8:("func_80BBEBF8",), - 0x80BBECBC:("func_80BBECBC",), - 0x80BBEEB4:("func_80BBEEB4",), - 0x80BBEF34:("func_80BBEF34",), - 0x80BBEFA0:("func_80BBEFA0",), - 0x80BBF01C:("func_80BBF01C",), + 0x80BBCA80:("EnSGoro_ShrineGoron_NextTextId",), + 0x80BBD348:("EnSGoro_BombshopGoron_NextTextId",), + 0x80BBD8F0:("EnSGoro_FindGoronElder",), + 0x80BBD93C:("EnSGoro_FindGoronChild",), + 0x80BBD98C:("EnSGoro_UpdateSleeping",), + 0x80BBDACC:("EnSGoro_UpdateCheerAnimation",), + 0x80BBDC34:("EnSGoro_CheckLullaby",), + 0x80BBDCFC:("EnSGoro_CheckGKBehavior",), + 0x80BBDDF8:("EnSGoro_UpdateToHandtapAnimation",), + 0x80BBDE78:("EnSGoro_UpdateSleepyAnimation",), + 0x80BBDF28:("EnSGoro_UpdateToIdleAnimation",), + 0x80BBDFA8:("EnSGoro_UpdateCollider",), + 0x80BBE05C:("EnSGoro_UpdateEyes",), + 0x80BBE0E4:("EnSGoro_UpdateActorFocus",), + 0x80BBE144:("EnSGoro_UpdateRotationToPlayer",), + 0x80BBE374:("EnSGoro_UpdateAttentionTarget",), + 0x80BBE498:("EnSGoro_SetupAction",), + 0x80BBE73C:("EnSGoro_WinterShrineGoron_Idle",), + 0x80BBE844:("EnSGoro_WinterShrineGoron_Talk",), + 0x80BBE904:("EnSGoro_SpringShrineGoron_Idle",), + 0x80BBE9F8:("EnSGoro_SpringShrineGoron_Talk",), + 0x80BBEAD8:("EnSGoro_ShopGoron_Idle",), + 0x80BBEBF8:("EnSGoro_ShopGoron_FinishUnroll",), + 0x80BBECBC:("EnSGoro_ShopGoron_Talk",), + 0x80BBEEB4:("EnSGoro_ShopGoron_TakePayment",), + 0x80BBEF34:("EnSGoro_ShopGoron_FinishTransaction",), + 0x80BBEFA0:("EnSGoro_Sleep",), + 0x80BBF01C:("EnSGoro_SleepTalk",), 0x80BBF09C:("EnSGoro_Init",), 0x80BBF198:("EnSGoro_Destroy",), 0x80BBF1C4:("EnSGoro_Update",), - 0x80BBF298:("func_80BBF298",), - 0x80BBF3D0:("func_80BBF3D0",), - 0x80BBF3EC:("func_80BBF3EC",), - 0x80BBF5F0:("func_80BBF5F0",), - 0x80BBF6BC:("func_80BBF6BC",), + 0x80BBF298:("EnSGoro_UpdateLimb",), + 0x80BBF3D0:("EnSGoro_OverrideLimbDraw",), + 0x80BBF3EC:("EnSGoro_TransformLimbDraw",), + 0x80BBF5F0:("EnSGoro_DrawUnrolled",), + 0x80BBF6BC:("EnSGoro_DrawRolledUp",), 0x80BBF7BC:("EnSGoro_Draw",), 0x80BBFDB0:("func_80BBFDB0",), 0x80BBFE60:("func_80BBFE60",), @@ -15577,7 +15577,7 @@ 0x80BC61D0:("EnPoComposer_Draw",), 0x80BC6BF0:("EnGuruguru_Init",), 0x80BC6D28:("EnGuruguru_Destroy",), - 0x80BC6D64:("EnGuruguru_ChangeAnimation",), + 0x80BC6D64:("EnGuruguru_ChangeAnim",), 0x80BC6E00:("EnGuruguru_DoNothing",), 0x80BC6E10:("func_80BC6E10",), 0x80BC6F14:("func_80BC6F14",), @@ -15728,7 +15728,7 @@ 0x80BD1D94:("func_80BD1D94",), 0x80BD1DB8:("func_80BD1DB8",), 0x80BD1F1C:("func_80BD1F1C",), - 0x80BD1FC8:("func_80BD1FC8",), + 0x80BD1FC8:("EnZov_ValidatePictograph",), 0x80BD20B4:("EnZov_Update",), 0x80BD2380:("EnZov_OverrideLimbDraw",), 0x80BD2404:("EnZov_PostLimbDraw",), @@ -16148,7 +16148,7 @@ 0x80BE8390:("EnMuto_Draw",), 0x80BE84F0:("EnBaisen_Init",), 0x80BE8664:("EnBaisen_Destroy",), - 0x80BE8690:("EnBaisen_ChangeAnimation",), + 0x80BE8690:("EnBaisen_ChangeAnim",), 0x80BE871C:("func_80BE871C",), 0x80BE87B0:("func_80BE87B0",), 0x80BE87FC:("func_80BE87FC",), @@ -16161,7 +16161,7 @@ 0x80BE8D94:("EnBaisen_Draw",), 0x80BE8F20:("EnHeishi_Init",), 0x80BE9090:("EnHeishi_Destroy",), - 0x80BE90BC:("EnHeishi_ChangeAnimation",), + 0x80BE90BC:("EnHeishi_ChangeAnim",), 0x80BE9148:("EnHeishi_SetHeadRotation",), 0x80BE91DC:("EnHeishi_SetupIdle",), 0x80BE9214:("EnHeishi_Idle",), @@ -16170,7 +16170,7 @@ 0x80BE93D8:("EnHeishi_Draw",), 0x80BE9510:("EnDemoheishi_Init",), 0x80BE95C0:("EnDemoheishi_Destroy",), - 0x80BE95EC:("EnDemoheishi_ChangeAnimation",), + 0x80BE95EC:("EnDemoheishi_ChangeAnim",), 0x80BE9678:("EnDemoheishi_SetHeadRotation",), 0x80BE970C:("EnDemoheishi_SetupIdle",), 0x80BE975C:("EnDemoheishi_Idle",), @@ -16380,7 +16380,7 @@ 0x80BFA2D0:("EnYb_Destroy",), 0x80BFA2FC:("func_80BFA2FC",), 0x80BFA350:("EnYb_ActorShadowFunc",), - 0x80BFA444:("EnYb_SetAnimation",), + 0x80BFA444:("EnYb_ChangeAnim",), 0x80BFA5CC:("EnYb_CanTalk",), 0x80BFA634:("EnYb_UpdateAnimation",), 0x80BFA67C:("EnYb_FinishTeachingCutscene",), @@ -16437,7 +16437,7 @@ 0x80BFD158:("EnScopecoin_Update",), 0x80BFD17C:("EnScopecoin_Draw",), 0x80BFD2E0:("EnBjt_UpdateSkelAnime",), - 0x80BFD30C:("EnBjt_ChangeAnimation",), + 0x80BFD30C:("EnBjt_ChangeAnim",), 0x80BFD3A4:("EnBjt_UpdateCollision",), 0x80BFD434:("EnBjt_TakeItem",), 0x80BFD4FC:("EnBjt_Appear",), @@ -16856,7 +16856,7 @@ 0x80C18120:("BgLbfshot_Init",), 0x80C1817C:("BgLbfshot_Destroy",), 0x80C181B0:("BgLbfshot_Draw",), - 0x80C18240:("func_80C18240",), + 0x80C18240:("BgLastBwall_InitCollider",), 0x80C1838C:("BgLastBwall_Init",), 0x80C184B8:("BgLastBwall_Destroy",), 0x80C184EC:("func_80C184EC",), @@ -16865,7 +16865,7 @@ 0x80C1886C:("func_80C1886C",), 0x80C18884:("func_80C18884",), 0x80C188C4:("func_80C188C4",), - 0x80C18928:("func_80C18928",), + 0x80C18928:("BgLastBwall_DoNothing",), 0x80C18938:("BgLastBwall_Update",), 0x80C1895C:("BgLastBwall_Draw",), 0x80C18B90:("func_80C18B90",), @@ -16912,13 +16912,13 @@ 0x80C1A98C:("EnInvadepohDemo_Destroy",), 0x80C1A9C0:("EnInvadepohDemo_Update",), 0x80C1A9E4:("EnInvadepohDemo_Draw",), - 0x80C1ADC0:("func_80C1ADC0",), + 0x80C1ADC0:("ObjDanpeilift_UpdatePosition",), 0x80C1ADFC:("ObjDanpeilift_Init",), 0x80C1AF50:("ObjDanpeilift_Destroy",), - 0x80C1AF84:("func_80C1AF84",), - 0x80C1AF94:("func_80C1AF94",), - 0x80C1B210:("func_80C1B210",), - 0x80C1B26C:("func_80C1B26C",), + 0x80C1AF84:("ObjDanpeilift_DoNothing",), + 0x80C1AF94:("ObjDanpeilift_Move",), + 0x80C1B210:("ObjDanpeilift_Teleport",), + 0x80C1B26C:("ObjDanpeilift_Wait",), 0x80C1B2A4:("ObjDanpeilift_Update",), 0x80C1B4E4:("ObjDanpeilift_Draw",), 0x80C1B640:("EnFall2_Init",), @@ -16930,7 +16930,7 @@ 0x80C1B9D4:("func_80C1B9D4",), 0x80C1BAC8:("EnFall2_Update",), 0x80C1BAEC:("EnFall2_Draw",), - 0x80C1BD90:("DmAl_ChangeAnimation",), + 0x80C1BD90:("DmAl_ChangeAnim",), 0x80C1BDD8:("func_80C1BDD8",), 0x80C1BF08:("DmAl_Init",), 0x80C1BFB8:("DmAl_Destroy",), @@ -16964,8 +16964,8 @@ 0x80C1D93C:("DmAh_Init",), 0x80C1DA48:("DmAh_Destroy",), 0x80C1DA58:("DmAh_Update",), - 0x80C1DAD4:("func_80C1DAD4",), - 0x80C1DB24:("func_80C1DB24",), + 0x80C1DAD4:("DmAh_PostLimbDraw",), + 0x80C1DB24:("DmAh_TransformLimbDraw",), 0x80C1DCD8:("DmAh_Draw",), 0x80C1DED0:("func_80C1DED0",), 0x80C1DF18:("func_80C1DF18",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index a8944a962..1957dfcbd 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2239,7 +2239,7 @@ 0x801D6194:("D_801D6194","UNK_TYPE4","",0x4), 0x801D61A0:("sSeqInstructionArgsTable","u8","[96]",0x60), 0x801D6200:("D_801D6200","UNK_TYPE1","",0x1), - 0x801D6600:("D_801D6600","UNK_TYPE1","",0x1), + 0x801D6600:("gIsLargeSfxBank","UNK_TYPE1","",0x1), 0x801D6608:("D_801D6608","UNK_TYPE1","",0x1), 0x801D6610:("gChannelsPerBank","UNK_TYPE1","",0x1), 0x801D662C:("gUsedChannelsPerBank","UNK_TYPE1","",0x1), @@ -2258,7 +2258,7 @@ 0x801D6698:("sGanonsTowerLevelsVol","u8","[8]",0x8), 0x801D66A0:("sEnterGanonsTowerTimer","UNK_TYPE1","",0x1), 0x801D66A4:("sSfxVolumeDuration","UNK_TYPE2","",0x2), - 0x801D66A8:("sAudioFileSelectSetting","UNK_TYPE1","",0x1), + 0x801D66A8:("sSoundMode","UNK_TYPE1","",0x1), 0x801D66AC:("sAudioIsWindowOpen","UNK_TYPE1","",0x1), 0x801D66B0:("sAudioCutsceneFlag","UNK_TYPE1","",0x1), 0x801D66B4:("sSpecReverb","UNK_TYPE1","",0x1), @@ -2295,28 +2295,28 @@ 0x801D6FD8:("sCurOcarinaVolume","UNK_TYPE1","",0x1), 0x801D6FDC:("sCurOcarinaVibrato","UNK_TYPE1","",0x1), 0x801D6FE0:("sPlaybackState","UNK_TYPE1","",0x1), - 0x801D6FE4:("D_801D6FE4","UNK_TYPE1","",0x1), - 0x801D6FE8:("D_801D6FE8","UNK_TYPE1","",0x1), + 0x801D6FE4:("sPlaybackStaffStopPos","UNK_TYPE1","",0x1), + 0x801D6FE8:("sPlaybackStaffStartPos","UNK_TYPE1","",0x1), 0x801D6FEC:("sOcarinaFlags","UNK_TYPE4","",0x4), 0x801D6FF0:("sPlaybackNoteTimer","UNK_TYPE4","",0x4), 0x801D6FF4:("sPlaybackNotePos","UNK_TYPE2","",0x2), 0x801D6FF8:("sPlaybackStaffPos","UNK_TYPE2","",0x2), - 0x801D6FFC:("sPrevOcarinaSongFlags","UNK_TYPE4","",0x4), - 0x801D7000:("sPlaybackNoteValue","UNK_TYPE1","",0x1), + 0x801D6FFC:("sPrevOcarinaWithMusicStaffFlags","UNK_TYPE4","",0x4), + 0x801D7000:("sPlaybackPitch","UNK_TYPE1","",0x1), 0x801D7004:("sNotePlaybackVolume","UNK_TYPE1","",0x1), 0x801D7008:("sNotePlaybackVibrato","UNK_TYPE1","",0x1), 0x801D700C:("sNotePlaybackBend","UNK_TYPE1","",0x1), - 0x801D7010:("sNormalizedNotePlaybackTone","f32","",0x4), - 0x801D7014:("sNormalizedNotePlaybackVolume","f32","",0x4), + 0x801D7010:("sRelativeNotePlaybackBend","f32","",0x4), + 0x801D7014:("sRelativeNotePlaybackVolume","f32","",0x4), 0x801D7018:("sOcarinaPlaybackTaskStart","UNK_TYPE4","",0x4), 0x801D701C:("sOcarinaWallCounter","UNK_TYPE4","",0x4), - 0x801D7020:("sCurOcarinaSong","u8","[8]",0x8), - 0x801D7028:("sOcarinaSongAppendPos","UNK_TYPE1","",0x1), + 0x801D7020:("sCurOcarinaSongWithoutMusicStaff","u8","[8]",0x8), + 0x801D7028:("sOcarinaWithoutMusicStaffPos","UNK_TYPE1","",0x1), 0x801D702C:("sOcarinaSongStartingPos","UNK_TYPE1","",0x1), 0x801D7030:("sButtonToPitchMap","UNK_TYPE1","",0x1), 0x801D7038:("sOcarinaMemoryGameAppendPos","UNK_TYPE1","",0x1), - 0x801D703C:("sOcaMemoryGameEndPos","UNK_TYPE1","",0x1), - 0x801D7040:("sOcaMemoryGameNumNotes","UNK_TYPE1","",0x1), + 0x801D703C:("sOcarinaMemoryGameEndPos","UNK_TYPE1","",0x1), + 0x801D7040:("sOcarinaMemoryGameNumNotes","UNK_TYPE1","",0x1), 0x801D7044:("sOcarinaSongNotes","OcarinaNote","[24][20]",0xF00), 0x801D7F44:("sOoTOcarinaSongNotes","OcarinaNote","[9][20]",0x5A0), 0x801D84E4:("sOoTOcarinaSongsNumNotes","UNK_TYPE1","",0x1), @@ -2335,7 +2335,7 @@ 0x801D852C:("sMusicStaffNumNotesPerTest","UNK_TYPE1","",0x1), 0x801D8530:("D_801D8530","UNK_TYPE1","",0x1), 0x801D8534:("D_801D8534","UNK_TYPE4","",0x4), - 0x801D8538:("sIsOcarinaNoteChanged","UNK_TYPE1","",0x1), + 0x801D8538:("sOcarinaDropInputTimer","UNK_TYPE1","",0x1), 0x801D853C:("sScarecrowsLongSongNotes","OcarinaNote","[108]",0x360), 0x801D889C:("gScarecrowLongSongPtr","UNK_PTR","",0x4), 0x801D88A0:("gScarecrowSpawnSongPtr","UNK_PTR","",0x4), @@ -2366,20 +2366,20 @@ 0x801DADD0:("sOcarinaBankParams","UNK_TYPE1","",0x1), 0x801DAE10:("sVoiceBankParams","UNK_TYPE1","",0x1), 0x801DB450:("gSfxParams","UNK_PTR","",0x4), - 0x801DB470:("D_801DB470","UNK_TYPE1","",0x1), - 0x801DB474:("D_801DB474","UNK_TYPE1","",0x1), - 0x801DB478:("D_801DB478","UNK_PTR","[7]",0x1c), - 0x801DB494:("D_801DB494","UNK_TYPE1","",0x1), - 0x801DB49C:("D_801DB49C","UNK_TYPE1","",0x1), - 0x801DB4A0:("D_801DB4A0","UNK_TYPE2","",0x2), - 0x801DB4A4:("D_801DB4A4","UNK_TYPE4","",0x4), - 0x801DB4B0:("D_801DB4B0","UNK_TYPE1","",0x1), - 0x801DB4B8:("D_801DB4B8","UNK_TYPE1","",0x1), + 0x801DB470:("sSfxRequestWriteIndex","UNK_TYPE1","",0x1), + 0x801DB474:("sSfxRequestReadIndex","UNK_TYPE1","",0x1), + 0x801DB478:("gSfxBanks","UNK_PTR","[7]",0x1c), + 0x801DB494:("sSfxBankSizes","UNK_TYPE1","",0x1), + 0x801DB49C:("gSfxChannelLayout","UNK_TYPE1","",0x1), + 0x801DB4A0:("sSfxChannelLowVolumeFlag","UNK_TYPE2","",0x2), + 0x801DB4A4:("gSfxDefaultPos","UNK_TYPE4","",0x4), + 0x801DB4B0:("gSfxDefaultFreqAndVolScale","UNK_TYPE1","",0x1), + 0x801DB4B8:("gSfxDefaultReverb","UNK_TYPE1","",0x1), 0x801DB4C0:("D_801DB4C0","UNK_TYPE1","",0x1), 0x801DB4C4:("D_801DB4C4","UNK_TYPE1","",0x1), 0x801DB4C8:("D_801DB4C8","UNK_TYPE1","",0x1), 0x801DB4CC:("D_801DB4CC","UNK_TYPE1","",0x1), - 0x801DB4D4:("D_801DB4D4","UNK_TYPE1","",0x1), + 0x801DB4D4:("gAudioSpecId","UNK_TYPE1","",0x1), 0x801DB4D8:("D_801DB4D8","UNK_TYPE1","",0x1), 0x801DB4DC:("D_801DB4DC","UNK_TYPE4","",0x4), 0x801DB4E0:("D_801DB4E0","UNK_TYPE1","",0x1), @@ -4273,18 +4273,18 @@ 0x801FD43A:("sPlayingStaff","OcarinaStaff","",0x3), 0x801FD43E:("sPlaybackStaff","OcarinaStaff","",0x3), 0x801FD442:("sRecordingStaff","OcarinaStaff","",0x3), - 0x801FD448:("sOcarinaUpdateTaskCurrent","UNK_TYPE1","",0x1), + 0x801FD448:("sOcarinaUpdateTaskStart","UNK_TYPE1","",0x1), 0x801FD44C:("sOcarinaInputStickRel","OcarinaControlStick","",0x2), 0x801FD450:("sOcarinaInputButtonCur","UNK_TYPE1","",0x1), 0x801FD454:("sOcarinaInputButtonStart","UNK_TYPE1","",0x1), 0x801FD458:("sOcarinaInputButtonPrev","UNK_TYPE1","",0x1), - 0x801FD45C:("sOcaInputBtnPress","UNK_TYPE1","",0x1), - 0x801FD460:("sOcarinaResetDelay","UNK_TYPE1","",0x1), - 0x801FD461:("sOcarinaResetUnused","UNK_TYPE1","",0x1), + 0x801FD45C:("sOcarinaInputButtonPress","UNK_TYPE1","",0x1), + 0x801FD460:("sOcarinaDisableTimer","UNK_TYPE1","",0x1), + 0x801FD461:("sOcarinaUnused","UNK_TYPE1","",0x1), 0x801FD462:("sOcarinaHasStartedSong","UNK_TYPE1","",0x1), 0x801FD463:("sFirstOcarinaSongIndex","UNK_TYPE1","",0x1), 0x801FD464:("sLastOcarinaSongIndex","UNK_TYPE1","",0x1), - 0x801FD468:("sOcarinaAvailSongs","UNK_TYPE1","",0x1), + 0x801FD468:("sOcarinaAvailableSongFlags","UNK_TYPE1","",0x1), 0x801FD46C:("sOcarinaStaffPlayingPos","UNK_TYPE1","",0x1), 0x801FD470:("sMusicStaffPos","UNK_TYPE1","",0x1), 0x801FD4A0:("sMusicStaffCurHeldLength","UNK_TYPE1","",0x1), @@ -4292,7 +4292,7 @@ 0x801FD500:("sMusicStaffExpectedPitch","UNK_TYPE1","",0x1), 0x801FD518:("D_801FD518","UNK_TYPE1","",0x1), 0x801FD530:("D_801FD530","u32","[24]",0x60), - 0x801FD590:("sRecordingSongNote","UNK_TYPE1","",0x1), + 0x801FD590:("sScarecrowsLongSongSecondNote","UNK_TYPE1","",0x1), 0x801FD598:("sCustomSequencePc","UNK_TYPE1","",0x1), 0x801FD5A0:("D_801FD5A0","UNK_TYPE1","",0x1), 0x801FD5A4:("D_801FD5A4","UNK_TYPE1","",0x1), @@ -4302,21 +4302,21 @@ 0x801FD5E8:("D_801FD5E8","UNK_TYPE1","",0x1), 0x801FD608:("D_801FD608","UNK_TYPE1","",0x1), 0x801FD610:("D_801FD610","UNK_TYPE1","",0x1), - 0x801FD710:("D_801FD710","UNK_TYPE1","",0x1), - 0x801FD8C0:("D_801FD8C0","UNK_TYPE1","",0x1), - 0x801FDB00:("D_801FDB00","UNK_TYPE1","",0x1), - 0x801FE100:("D_801FE100","UNK_TYPE1","",0x1), - 0x801FE4C0:("D_801FE4C0","UNK_TYPE1","",0x1), - 0x801FE640:("D_801FE640","UNK_TYPE1","",0x1), - 0x801FE6D0:("D_801FE6D0","UNK_TYPE1","",0x1), - 0x801FE7C0:("D_801FE7C0","SoundRequest","[1]",0x14), - 0x801FFBC0:("D_801FFBC0","UNK_TYPE1","",0x1), - 0x801FFBC8:("D_801FFBC8","UNK_TYPE1","",0x1), - 0x801FFBD0:("D_801FFBD0","UNK_TYPE1","",0x1), - 0x801FFBD8:("D_801FFBD8","UNK_TYPE1","",0x1), - 0x801FFC80:("D_801FFC80","UNK_TYPE1","",0x1), - 0x801FFC84:("D_801FFC84","UNK_TYPE1","",0x1), - 0x801FFC90:("D_801FFC90","UNK_TYPE1","",0x1), + 0x801FD710:("sSfxPlayerBank","UNK_TYPE1","",0x1), + 0x801FD8C0:("sSfxItemBank","UNK_TYPE1","",0x1), + 0x801FDB00:("sSfxEnvironmentBank","UNK_TYPE1","",0x1), + 0x801FE100:("sSfxEnemyBank","UNK_TYPE1","",0x1), + 0x801FE4C0:("sSfxSystemBank","UNK_TYPE1","",0x1), + 0x801FE640:("sSfxOcarinaBank","UNK_TYPE1","",0x1), + 0x801FE6D0:("sSfxVoiceBank","UNK_TYPE1","",0x1), + 0x801FE7C0:("sSfxRequests","SfxRequest","[0x100]",0x14), + 0x801FFBC0:("sSfxBankListEnd","UNK_TYPE1","",0x1), + 0x801FFBC8:("sSfxBankFreeListStart","UNK_TYPE1","",0x1), + 0x801FFBD0:("sSfxBankUnused","UNK_TYPE1","",0x1), + 0x801FFBD8:("gActiveSfx","UNK_TYPE1","",0x1), + 0x801FFC80:("sCurSfxPlayerChannelIndex","UNK_TYPE1","",0x1), + 0x801FFC84:("gSfxBankMuted","UNK_TYPE1","",0x1), + 0x801FFC90:("sUnusedBankLerp","UNK_TYPE1","",0x1), 0x801FFD00:("D_801FFD00","UNK_TYPE1","",0x1), 0x801FFD34:("D_801FFD34","UNK_TYPE1","",0x1), 0x801FFD40:("D_801FFD40","UNK_TYPE1","",0x1), @@ -5712,7 +5712,7 @@ 0x808743E8:("D_808743E8","f32","",0x4), 0x808743EC:("D_808743EC","f32","",0x4), 0x808743F0:("D_808743F0","f32","",0x4), - 0x80874650:("D_80874650","s80874650","[16]",0x1c0), + 0x80874650:("sPowderKegFuseSegments","PowderKegFuseSegment","[16]",0x1c0), 0x80874668:("D_80874668","UNK_TYPE1","",0x1), 0x8087466A:("D_8087466A","UNK_TYPE1","",0x1), 0x8087466C:("D_8087466C","UNK_TYPE1","",0x1), @@ -8418,12 +8418,12 @@ 0x809453C4:("D_809453C4","f32","",0x4), 0x80945600:("Item_Inbox_InitVars","UNK_TYPE1","",0x1), 0x809464B0:("En_Ge1_InitVars","UNK_TYPE1","",0x1), - 0x809464D0:("D_809464D0","UNK_TYPE1","",0x1), - 0x809464FC:("D_809464FC","UNK_TYPE1","",0x1), - 0x80946524:("D_80946524","UNK_TYPE1","",0x1), - 0x80946530:("D_80946530","UNK_TYPE1","",0x1), - 0x8094653C:("D_8094653C","UNK_TYPE1","",0x1), - 0x80946548:("D_80946548","UNK_TYPE1","",0x1), + 0x809464D0:("sCylinderInit","ColliderCylinderInit","",0x1), + 0x809464FC:("sAnimations","AnimationHeader","10",0x28), + 0x80946524:("sHairstyleDLs","Gfx*","3",0xC), + 0x80946530:("sInitialFocusPos","Vec3f","",0xC), + 0x8094653C:("sZeroVec","Vec3f","",0xC), + 0x80946548:("sEyeTextures","TexturePtr","3",0xC), 0x80946560:("jtbl_80946560","UNK_PTR","",0x4), 0x80946880:("Obj_Blockstop_InitVars","UNK_TYPE1","",0x1), 0x80947A40:("En_Sda_InitVars","UNK_TYPE1","",0x1), @@ -8510,7 +8510,7 @@ 0x80951C5C:("D_80951C5C","UNK_TYPE1","",0x1), 0x80951C88:("D_80951C88","UNK_TYPE1","",0x1), 0x80951CB4:("D_80951CB4","UNK_TYPE1","",0x1), - 0x80951CC0:("D_80951CC0","UNK_TYPE1","",0x1), + 0x80951CC0:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80951D90:("D_80951D90","UNK_TYPE1","",0x1), 0x80951D9C:("D_80951D9C","UNK_TYPE1","",0x1), 0x80951DA8:("D_80951DA8","UNK_TYPE1","",0x1), @@ -9849,7 +9849,7 @@ 0x809C1008:("D_809C1008","UNK_TYPE1","",0x1), 0x809C1010:("D_809C1010","f32","",0x4), 0x809C3770:("En_Aob_01_InitVars","UNK_TYPE1","",0x1), - 0x809C3790:("D_809C3790","UNK_TYPE4","",0x4), + 0x809C3790:("sAnimationInfo","UNK_TYPE4","",0x4), 0x809C3820:("D_809C3820","UNK_TYPE1","",0x1), 0x809C384C:("D_809C384C","UNK_TYPE4","",0x4), 0x809C392C:("D_809C392C","UNK_TYPE1","",0x1), @@ -9960,7 +9960,7 @@ 0x809CCD14:("D_809CCD14","f32","",0x4), 0x809CDC30:("En_Bji_01_InitVars","ActorInit","",0x20), 0x809CDC50:("D_809CDC50","UNK_TYPE1","",0x1), - 0x809CDC7C:("D_809CDC7C","UNK_TYPE1","",0x1), + 0x809CDC7C:("sAnimationInfo","UNK_TYPE1","",0x1), 0x809CDCBC:("D_809CDCBC","UNK_TYPE1","",0x1), 0x809CDCC8:("D_809CDCC8","UNK_TYPE1","",0x1), 0x809CDCD4:("D_809CDCD4","UNK_TYPE1","",0x1), @@ -11136,7 +11136,7 @@ 0x80A2E630:("D_80A2E630","f32","",0x4), 0x80A2E910:("Dm_Ravine_InitVars","UNK_TYPE1","",0x1), 0x80A2ECE0:("Dm_Sa_InitVars","UNK_TYPE1","",0x1), - 0x80A2ED00:("D_80A2ED00","UNK_TYPE1","",0x1), + 0x80A2ED00:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80A2ED20:("D_80A2ED20","f32","",0x4), 0x80A31AD0:("En_Slime_InitVars","UNK_TYPE1","",0x1), 0x80A31AF0:("D_80A31AF0","UNK_TYPE1","",0x1), @@ -11652,7 +11652,7 @@ 0x80A53444:("En_Dnq_InitVars","UNK_TYPE1","",0x1), 0x80A53464:("D_80A53464","UNK_TYPE1","",0x1), 0x80A53490:("D_80A53490","UNK_PTR","",0x4), - 0x80A5349C:("D_80A5349C","UNK_TYPE1","",0x1), + 0x80A5349C:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80A535DC:("D_80A535DC","UNK_TYPE1","",0x1), 0x80A535F0:("D_80A535F0","UNK_TYPE4","",0x4), 0x80A535FC:("D_80A535FC","UNK_TYPE1","",0x1), @@ -11720,20 +11720,19 @@ 0x80A55E40:("D_80A55E40","f32","",0x4), 0x80A56100:("En_Firefly2_InitVars","UNK_TYPE1","",0x1), 0x80A583E0:("En_Rat_InitVars","UNK_TYPE1","",0x1), - 0x80A58400:("D_80A58400","UNK_TYPE1","",0x1), - 0x80A58428:("D_80A58428","UNK_TYPE2","",0x2), - 0x80A5842C:("D_80A5842C","UNK_TYPE1","",0x1), - 0x80A5844C:("D_80A5844C","UNK_TYPE1","",0x1), - 0x80A58454:("D_80A58454","UNK_TYPE4","",0x4), - 0x80A58464:("D_80A58464","UNK_TYPE1","",0x1), - 0x80A58470:("D_80A58470","EffectBlureInit2","",0x24), - 0x80A58494:("D_80A58494","UNK_TYPE4","",0x4), - 0x80A58498:("D_80A58498","UNK_TYPE1","",0x1), - 0x80A584A4:("D_80A584A4","UNK_TYPE1","",0x1), - 0x80A584A8:("D_80A584A8","UNK_TYPE1","",0x1), - 0x80A584B4:("D_80A584B4","UNK_TYPE1","",0x1), - 0x80A584C0:("D_80A584C0","UNK_TYPE1","",0x1), - 0x80A584CC:("D_80A584CC","UNK_TYPE1","",0x1), + 0x80A58400:("sSphereInit","UNK_TYPE1","",0x1), + 0x80A5842C:("sDamageTable","UNK_TYPE1","",0x1), + 0x80A5844C:("sColChkInfoInit","UNK_TYPE1","",0x1), + 0x80A58454:("sSparkTextures","UNK_TYPE4","",0x4), + 0x80A58464:("sInitChain","UNK_TYPE1","",0x1), + 0x80A58470:("sBlureInit","EffectBlureInit2","",0x24), + 0x80A58494:("sTexturesDesegmented","UNK_TYPE4","",0x4), + 0x80A58498:("sSmokeAccel","UNK_TYPE1","",0x1), + 0x80A584A4:("sSmokeColor","UNK_TYPE1","",0x1), + 0x80A584A8:("sBlureP1Offset","UNK_TYPE1","",0x1), + 0x80A584B4:("sBlureP2LeftOffset","UNK_TYPE1","",0x1), + 0x80A584C0:("sBlureP2RightOffset","UNK_TYPE1","",0x1), + 0x80A584CC:("sDustVelocity","UNK_TYPE1","",0x1), 0x80A584E0:("D_80A584E0","f32","",0x4), 0x80A584E4:("D_80A584E4","f32","",0x4), 0x80A584E8:("D_80A584E8","f32","",0x4), @@ -12324,7 +12323,7 @@ 0x80A8B280:("D_80A8B280","UNK_TYPE1","",0x1), 0x80A8B2A0:("D_80A8B2A0","UNK_TYPE1","",0x1), 0x80A8B2CC:("D_80A8B2CC","UNK_TYPE1","",0x1), - 0x80A8B2D8:("D_80A8B2D8","UNK_TYPE1","",0x1), + 0x80A8B2D8:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80A8B3D8:("D_80A8B3D8","UNK_TYPE1","",0x1), 0x80A8B3E4:("D_80A8B3E4","UNK_TYPE1","",0x1), 0x80A8B3F0:("D_80A8B3F0","UNK_TYPE1","",0x1), @@ -13155,7 +13154,7 @@ 0x80ADD940:("D_80ADD940","UNK_TYPE1","",0x1), 0x80ADD944:("En_Sellnuts_InitVars","UNK_TYPE1","",0x1), 0x80ADD964:("D_80ADD964","UNK_TYPE1","",0x1), - 0x80ADD990:("D_80ADD990","UNK_TYPE1","",0x1), + 0x80ADD990:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80ADDB00:("D_80ADDB00","UNK_TYPE1","",0x1), 0x80ADDB10:("jtbl_80ADDB10","UNK_PTR","",0x4), 0x80ADDB4C:("D_80ADDB4C","f32","",0x4), @@ -13885,27 +13884,22 @@ 0x80B1DB54:("D_80B1DB54","f32","",0x4), 0x80B1DB58:("D_80B1DB58","f32","",0x4), 0x80B1DB5C:("D_80B1DB5C","f32","",0x4), - 0x80B21620:("D_80B21620","UNK_TYPE4","",0x4), - 0x80B21624:("D_80B21624","UNK_TYPE1","",0x1), + 0x80B21620:("sCurrentDeadBodyPartIndex","UNK_TYPE4","",0x4), + 0x80B21624:("sDamageTable","UNK_TYPE1","",0x1), 0x80B21644:("En_Pp_InitVars","UNK_TYPE1","",0x1), - 0x80B21664:("D_80B21664","UNK_TYPE1","",0x1), - 0x80B21688:("D_80B21688","UNK_TYPE1","",0x1), - 0x80B21698:("D_80B21698","UNK_TYPE1","",0x1), - 0x80B216BC:("D_80B216BC","UNK_TYPE1","",0x1), - 0x80B216CC:("D_80B216CC","UNK_TYPE1","",0x1), - 0x80B2171C:("D_80B2171C","UNK_TYPE1","",0x1), - 0x80B21720:("D_80B21720","UNK_TYPE1","",0x1), - 0x80B21724:("D_80B21724","UNK_TYPE1","",0x1), - 0x80B2174C:("D_80B2174C","UNK_TYPE1","",0x1), - 0x80B21758:("D_80B21758","UNK_TYPE2","",0x2), - 0x80B2175E:("D_80B2175E","UNK_TYPE1","",0x1), - 0x80B21760:("D_80B21760","UNK_TYPE4","",0x4), - 0x80B217CC:("D_80B217CC","f32","",0x4), - 0x80B217D0:("D_80B217D0","f32","",0x4), - 0x80B217D4:("D_80B217D4","f32","",0x4), - 0x80B217D8:("D_80B217D8","f32","",0x4), - 0x80B217DC:("D_80B217DC","f32","",0x4), - 0x80B217E0:("D_80B217E0","f32","",0x4), + 0x80B21664:("sMaskColliderJntSphElementsInit","UNK_TYPE1","",0x1), + 0x80B21688:("sMaskColliderJntSphInit","UNK_TYPE1","",0x1), + 0x80B21698:("sBodyColliderJntSphElementsInit","UNK_TYPE1","",0x1), + 0x80B216BC:("sBodyColliderJntSphInit","UNK_TYPE1","",0x1), + 0x80B216CC:("sQuadInit","UNK_TYPE1","",0x1), + 0x80B2171C:("sDustPrimColor","UNK_TYPE1","",0x1), + 0x80B21720:("sDustEnvColor","UNK_TYPE1","",0x1), + 0x80B21724:("sAnimations","UNK_TYPE1","",0x1), + 0x80B2174C:("sAnimationModes","UNK_TYPE1","",0x1), + 0x80B21758:("sLedgeCheckAngles","UNK_TYPE2","",0x2), + 0x80B21760:("sMaskFireVelocityAndAccel","UNK_TYPE4","",0x4), + 0x80B217CC:("sVertexOffset1","f32","",0x4), + 0x80B217D8:("sVertexOffset2","f32","",0x4), 0x80B217F0:("D_80B217F0","f32","",0x4), 0x80B217F4:("jtbl_80B217F4","UNK_PTR","",0x4), 0x80B21810:("D_80B21810","f32","",0x4), @@ -14274,7 +14268,7 @@ 0x80B3DED0:("D_80B3DED0","f32","",0x4), 0x80B3FBD0:("En_Dai_InitVars","UNK_TYPE1","",0x1), 0x80B3FBF0:("D_80B3FBF0","UNK_TYPE4","",0x4), - 0x80B3FBFC:("D_80B3FBFC","UNK_TYPE1","",0x1), + 0x80B3FBFC:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80B3FC8C:("D_80B3FC8C","UNK_TYPE1","",0x1), 0x80B3FCB4:("D_80B3FCB4","UNK_TYPE4","",0x4), 0x80B3FCE4:("D_80B3FCE4","UNK_TYPE4","",0x4), @@ -14967,7 +14961,7 @@ 0x80B774F0:("En_Tru_Mt_InitVars","UNK_TYPE1","",0x1), 0x80B77510:("D_80B77510","UNK_TYPE1","",0x1), 0x80B7753C:("D_80B7753C","UNK_TYPE1","",0x1), - 0x80B7755C:("D_80B7755C","UNK_TYPE1","",0x1), + 0x80B7755C:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80B7765C:("D_80B7765C","UNK_TYPE1","",0x1), 0x80B77668:("D_80B77668","UNK_TYPE1","",0x1), 0x80B77674:("D_80B77674","UNK_TYPE4","",0x4), @@ -15596,12 +15590,12 @@ 0x80BBC75C:("D_80BBC75C","UNK_TYPE1","",0x1), 0x80BBC770:("D_80BBC770","f32","",0x4), 0x80BBC774:("jtbl_80BBC774","UNK_PTR","",0x4), - 0x80BBF800:("En_S_Goro_InitVars","UNK_TYPE1","",0x1), - 0x80BBF820:("D_80BBF820","UNK_TYPE1","",0x1), - 0x80BBF84C:("D_80BBF84C","UNK_TYPE1","",0x1), - 0x80BBF858:("D_80BBF858","UNK_TYPE1","",0x1), - 0x80BBF878:("D_80BBF878","UNK_TYPE1","",0x1), - 0x80BBF978:("D_80BBF978","UNK_TYPE1","",0x1), + 0x80BBF800:("En_S_Goro_InitVars","ActorInit","",0x20), + 0x80BBF820:("sCylinderInit","ColliderCylinderInit","",0x2C), + 0x80BBF84C:("sColChkInfoInit","CollisionCheckInfoInit2","",0xC), + 0x80BBF858:("sDamageTable","DamageTable","",0x20), + 0x80BBF878:("sAnimationInfo","AnimationInfoS","[16]",0x100), + 0x80BBF978:("sEyeTextures","TexturePtr","[4]",0x18), 0x80BBF990:("jtbl_80BBF990","UNK_PTR","",0x4), 0x80BBF9B4:("jtbl_80BBF9B4","UNK_PTR","",0x4), 0x80BBFA34:("D_80BBFA34","f32","",0x4), @@ -15687,9 +15681,9 @@ 0x80BC7960:("En_Guruguru_InitVars","UNK_TYPE1","",0x1), 0x80BC7980:("D_80BC7980","UNK_TYPE1","",0x1), 0x80BC79A0:("D_80BC79A0","UNK_TYPE1","",0x1), - 0x80BC79CC:("D_80BC79CC","UNK_TYPE1","",0x1), - 0x80BC79D4:("D_80BC79D4","UNK_TYPE1","",0x1), - 0x80BC79D8:("D_80BC79D8","UNK_TYPE1","",0x1), + 0x80BC79CC:("sAnimations","UNK_TYPE1","",0x1), + 0x80BC79D4:("sAnimationModes","UNK_TYPE1","",0x1), + 0x80BC79D8:("sPlaySpeeds","UNK_TYPE1","",0x1), 0x80BC79E0:("D_80BC79E0","UNK_TYPE1","",0x1), 0x80BC79E8:("D_80BC79E8","UNK_TYPE1","",0x1), 0x80BC7EF0:("Oceff_Wipe5_InitVars","UNK_TYPE1","",0x1), @@ -16046,17 +16040,17 @@ 0x80BE8DF0:("En_Baisen_InitVars","UNK_TYPE1","",0x1), 0x80BE8E10:("D_80BE8E10","UNK_TYPE1","",0x1), 0x80BE8E3C:("D_80BE8E3C","UNK_TYPE1","",0x1), - 0x80BE8E4C:("D_80BE8E4C","UNK_TYPE1","",0x1), + 0x80BE8E4C:("sAnimations","UNK_TYPE1","",0x1), 0x80BE8E58:("D_80BE8E58","UNK_TYPE1","",0x1), 0x80BE9430:("En_Heishi_InitVars","UNK_TYPE1","",0x1), 0x80BE9450:("sCylinderInit","UNK_TYPE1","",0x1), 0x80BE947C:("sAnimations","UNK_TYPE1","",0x1), - 0x80BE9490:("sAnimModes","UNK_TYPE1","",0x1), + 0x80BE9490:("sAnimationModes","UNK_TYPE1","",0x1), 0x80BE9A30:("En_Demo_heishi_InitVars","UNK_TYPE1","",0x1), 0x80BE9A50:("sCylinderInit","UNK_TYPE1","",0x1), 0x80BE9A7C:("sTextIds","UNK_TYPE1","",0x1), 0x80BE9A80:("sAnimations","UNK_TYPE1","",0x1), - 0x80BE9A94:("sAnimModes","UNK_TYPE1","",0x1), + 0x80BE9A94:("sAnimationModes","UNK_TYPE1","",0x1), 0x80BEB1B0:("En_Dt_InitVars","UNK_TYPE1","",0x1), 0x80BEB1D0:("D_80BEB1D0","UNK_TYPE1","",0x1), 0x80BEB208:("D_80BEB208","UNK_TYPE1","",0x1), @@ -16301,7 +16295,7 @@ 0x80C058A0:("sTextIds","u16","",0x1), 0x80C058B0:("sCylinderInit","UNK_TYPE1","",0x1), 0x80C058DC:("sAnimations","AnimationHeader*","",0x1), - 0x80C058F8:("sAnimModes","u8","",0x1), + 0x80C058F8:("sAnimationModes","u8","",0x1), 0x80C05900:("sSetPrimColorDL","UNK_TYPE1","",0x1), 0x80C05910:("sSetPrimColorDlPtr","Gfx*","",0x4), 0x80C05914:("sEyeTextures","void*","",0x1), @@ -16572,7 +16566,7 @@ 0x80C1DE20:("D_80C1DE20","UNK_TYPE4","",0x4), 0x80C1DE28:("D_80C1DE28","UNK_TYPE1","",0x1), 0x80C1E1E0:("Dm_Nb_InitVars","UNK_TYPE1","",0x1), - 0x80C1E200:("D_80C1E200","UNK_TYPE1","",0x1), + 0x80C1E200:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80C1E210:("D_80C1E210","UNK_TYPE4","",0x4), 0x80C1E5C0:("En_Drs_InitVars","UNK_TYPE1","",0x1), 0x80C1E5E0:("D_80C1E5E0","UNK_TYPE1","",0x1), @@ -16582,7 +16576,7 @@ 0x80C1E970:("D_80C1E970","UNK_TYPE1","",0x1), 0x80C1E984:("D_80C1E984","UNK_TYPE1","",0x1), 0x80C1F150:("Dm_Bal_InitVars","UNK_TYPE1","",0x1), - 0x80C1F170:("D_80C1F170","UNK_PTR","",0x4), + 0x80C1F170:("sAnimationInfo","UNK_PTR","",0x4), 0x80C1F2C0:("D_80C1F2C0","UNK_TYPE2","",0x2), 0x80C1F2C4:("D_80C1F2C4","UNK_TYPE4","",0x4), 0x80C1F2D0:("D_80C1F2D0","UNK_TYPE1","",0x1), diff --git a/tools/entr.py b/tools/entr.py new file mode 100755 index 000000000..9b16556c5 --- /dev/null +++ b/tools/entr.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 + +enumPrfix = "ENTR_SCENE_" +entranceScenes = [ + "ENTR_SCENE_MAYORS_RESIDENCE", + "ENTR_SCENE_MAJORAS_LAIR", + "ENTR_SCENE_MAGIC_HAGS_POTION_SHOP", + "ENTR_SCENE_RANCH_HOUSE", + "ENTR_SCENE_HONEY_AND_DARLINGS_SHOP", + "ENTR_SCENE_BENEATH_THE_GRAVERYARD", + "ENTR_SCENE_SOUTHERN_SWAMP_CLEARED", + "ENTR_SCENE_CURIOSITY_SHOP", + "ENTR_SCENE_UNSET_08", + "ENTR_SCENE_UNSET_09", + "ENTR_SCENE_GROTTOS", + "ENTR_SCENE_UNSET_0B", + "ENTR_SCENE_UNSET_0C", + "ENTR_SCENE_UNSET_0D", + "ENTR_SCENE_CUTSCENE", + "ENTR_SCENE_UNSET_0F", + "ENTR_SCENE_IKANA_CANYON", + "ENTR_SCENE_PIRATES_FORTRESS", + "ENTR_SCENE_MILK_BAR", + "ENTR_SCENE_STONE_TOWER_TEMPLE", + "ENTR_SCENE_TREASURE_CHEST_SHOP", + "ENTR_SCENE_STONE_TOWER_TEMPLE_REVERSED", + "ENTR_SCENE_CLOCK_TOWER_ROOFTOP", + "ENTR_SCENE_OPENING_DUNGEON", + "ENTR_SCENE_WOODFALL_TEMPLE", + "ENTR_SCENE_PATH_TO_MOUNTAIN_VILLAGE", + "ENTR_SCENE_IKANA_CASTLE", + "ENTR_SCENE_DEKU_SCRUB_PLAYGROUND", + "ENTR_SCENE_ODOLWAS_LAIR", + "ENTR_SCENE_TOWN_SHOOTING_GALLERY", + "ENTR_SCENE_SNOWHEAD_TEMPLE", + "ENTR_SCENE_MILK_ROAD", + "ENTR_SCENE_PIRATES_FORTRESS_INTERIOR", + "ENTR_SCENE_SWAMP_SHOOTING_GALLERY", + "ENTR_SCENE_PINNACLE_ROCK", + "ENTR_SCENE_FAIRY_FOUNTAIN", + "ENTR_SCENE_SWAMP_SPIDER_HOUSE", + "ENTR_SCENE_OCEANSIDE_SPIDER_HOUSE", + "ENTR_SCENE_ASTRAL_OBSERVATORY", + "ENTR_SCENE_MOON_DEKU_TRIAL", + "ENTR_SCENE_DEKU_PALACE", + "ENTR_SCENE_MOUNTAIN_SMITHY", + "ENTR_SCENE_TERMINA_FIELD", + "ENTR_SCENE_POST_OFFICE", + "ENTR_SCENE_MARINE_RESEARCH_LAB", + "ENTR_SCENE_DAMPES_HOUSE", + "ENTR_SCENE_UNSET_2E", + "ENTR_SCENE_GORON_SHRINE", + "ENTR_SCENE_ZORA_HALL", + "ENTR_SCENE_TRADING_POST", + "ENTR_SCENE_ROMANI_RANCH", + "ENTR_SCENE_TWINMOLDS_LAIR", + "ENTR_SCENE_GREAT_BAY_COAST", + "ENTR_SCENE_ZORA_CAPE", + "ENTR_SCENE_LOTTERY_SHOP", + "ENTR_SCENE_UNSET_37", + "ENTR_SCENE_PIRATES_FORTRESS_EXTERIOR", + "ENTR_SCENE_FISHERMANS_HUT", + "ENTR_SCENE_GORON_SHOP", + "ENTR_SCENE_DEKU_KINGS_CHAMBER", + "ENTR_SCENE_MOON_GORON_TRIAL", + "ENTR_SCENE_ROAD_TO_SOUTHERN_SWAMP", + "ENTR_SCENE_DOGGY_RACETRACK", + "ENTR_SCENE_CUCCO_SHACK", + "ENTR_SCENE_IKANA_GRAVEYARD", + "ENTR_SCENE_GOHTS_LAIR", + "ENTR_SCENE_SOUTHERN_SWAMP_POISONED", + "ENTR_SCENE_WOODFALL", + "ENTR_SCENE_MOON_ZORA_TRIAL", + "ENTR_SCENE_GORON_VILLAGE_SPRING", + "ENTR_SCENE_GREAT_BAY_TEMPLE", + "ENTR_SCENE_WATERFALL_RAPIDS", + "ENTR_SCENE_BENEATH_THE_WELL", + "ENTR_SCENE_ZORA_HALL_ROOMS", + "ENTR_SCENE_GORON_VILLAGE_WINTER", + "ENTR_SCENE_GORON_GRAVERYARD", + "ENTR_SCENE_SAKONS_HIDEOUT", + "ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER", + "ENTR_SCENE_GHOST_HUT", + "ENTR_SCENE_DEKU_SHRINE", + "ENTR_SCENE_ROAD_TO_IKANA", + "ENTR_SCENE_SWORDMANS_SCHOOL", + "ENTR_SCENE_MUSIC_BOX_HOUSE", + "ENTR_SCENE_IGOS_DU_IKANAS_LAIR", + "ENTR_SCENE_TOURIST_INFORMATION", + "ENTR_SCENE_STONE_TOWER", + "ENTR_SCENE_STONE_TOWER_INVERTED", + "ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING", + "ENTR_SCENE_PATH_TO_SNOWHEAD", + "ENTR_SCENE_SNOWHEAD", + "ENTR_SCENE_PATH_TO_GORON_VILLAGE_WINTER", + "ENTR_SCENE_PATH_TO_GORON_VILLAGE_SPRING", + "ENTR_SCENE_GYORGS_LAIR", + "ENTR_SCENE_SECRET_SHRINE", + "ENTR_SCENE_STOCK_POT_INN", + "ENTR_SCENE_GREAT_BAY_CUTSCENE", + "ENTR_SCENE_CLOCK_TOWER_INTERIOR", + "ENTR_SCENE_WOODS_OF_MYSTERY", + "ENTR_SCENE_LOST_WOODS", + "ENTR_SCENE_MOON_LINK_TRIAL", + "ENTR_SCENE_THE_MOON", + "ENTR_SCENE_BOMB_SHOP", + "ENTR_SCENE_GIANTS_CHAMBER", + "ENTR_SCENE_GORMAN_TRACK", + "ENTR_SCENE_GORON_RACETRACK", + "ENTR_SCENE_EAST_CLOCK_TOWN", + "ENTR_SCENE_WEST_CLOCK_TOWN", + "ENTR_SCENE_NORTH_CLOCK_TOWN", + "ENTR_SCENE_SOUTH_CLOCK_TOWN", + "ENTR_SCENE_LAUNDRY_POOL", + "ENTR_SCENE_MAX" +] + +def macro(num): + sceneIndex = (num >> 9) & 0x7F + spawnIndex = (num >> 4) & 0x1F + return f'ENTRANCE({entranceScenes[sceneIndex][len(enumPrfix):]}, {spawnIndex})' + +if __name__ == "__main__": + import sys + + if len(sys.argv) < 2: + print(f'{sys.argv[0]} nextEntrance', file=sys.stderr) + exit(1) + + nextEntrance = sys.argv[1] + nextEntrance = int(nextEntrance, 16 if nextEntrance.startswith("0x") else 10) + print(macro(nextEntrance)) diff --git a/tools/fado/.clang-format b/tools/fado/.clang-format new file mode 100644 index 000000000..c7b900f06 --- /dev/null +++ b/tools/fado/.clang-format @@ -0,0 +1,23 @@ +IndentWidth: 4 +Language: Cpp +UseTab: Never +ColumnLimit: 120 +PointerAlignment: Left +BreakBeforeBraces: Attach +SpaceAfterCStyleCast: false +Cpp11BracedListStyle: false +IndentCaseLabels: true +BinPackArguments: true +BinPackParameters: true +AlignAfterOpenBracket: Align +AlignOperands: true +BreakBeforeTernaryOperators: true +BreakBeforeBinaryOperators: None +AllowShortBlocksOnASingleLine: true +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AlignEscapedNewlines: Left +AlignTrailingComments: true +SortIncludes: false diff --git a/tools/fado/.gitignore b/tools/fado/.gitignore new file mode 100644 index 000000000..83b94860c --- /dev/null +++ b/tools/fado/.gitignore @@ -0,0 +1,56 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# Custom +build/ +.vscode diff --git a/tools/fado/.gitrepo b/tools/fado/.gitrepo new file mode 100644 index 000000000..cedec4930 --- /dev/null +++ b/tools/fado/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = git@github.com:EllipticEllipsis/fado.git + branch = master + commit = f7efb10a9a65f27e9ccad7ce270234f20d386ac9 + parent = 90cfafec47fe4b73ad9009e9501e147e86025aa6 + method = merge + cmdver = 0.4.3 diff --git a/tools/fado/LICENSE b/tools/fado/LICENSE new file mode 100644 index 000000000..0ad25db4b --- /dev/null +++ b/tools/fado/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/tools/fado/Makefile b/tools/fado/Makefile new file mode 100644 index 000000000..135f51251 --- /dev/null +++ b/tools/fado/Makefile @@ -0,0 +1,74 @@ +DEBUG ?= 0 +LLD ?= 0 +ASAN ?= 0 +EXPERIMENTAL?= 0 + +ELF := fado.elf + +CC := $(shell ./find_program.sh gcc clang clang-[0-9][0-9] clang-[0-9]) +LD := $(shell ./find_program.sh ld ld.lld ld.lld-*) +INC := -I include -I lib +WARNINGS := -Wall -Wextra -Wpedantic -Wshadow -Werror=implicit-function-declaration -Wvla -Wno-unused-function +CFLAGS := -std=c11 +LDFLAGS := + +ifeq ($(DEBUG),0) + OPTFLAGS := -O2 + CFLAGS += -Werror +else + OPTFLAGS := -O0 -g3 -DDEBUG_ON +endif + +ifneq ($(ASAN),0) + CFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined +endif + +ifneq ($(LLD),0) + LDFLAGS += -fuse-ld=lld +else +ifneq ($(LD),ld) + LDFLAGS += -fuse-ld=lld +endif +endif + +ifneq ($(EXPERIMENTAL),0) + CFLAGS += -DEXPERIMENTAL +endif + +# GCC is too stupid to be trusted with these warnings +ifeq ($(CC),gcc) + WARNINGS += -Wno-implicit-fallthrough -Wno-maybe-uninitialized +endif + +SRC_DIRS := $(shell find src -type d) +C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) +H_FILES := $(foreach dir,$(INC),$(wildcard $(dir)/*.h)) +O_FILES := $(foreach f,$(C_FILES:.c=.o),build/$f) + +LIB_DIRS := $(shell find lib -type d) +# exclude test file since we don't want it +C_LIB_FILES := $(filter-out lib/vc_vector/vc_vector_test.c, $(foreach dir,$(LIB_DIRS),$(wildcard $(dir)/*.c))) +O_LIB_FILES := $(foreach f,$(C_LIB_FILES:.c=.o),build/$f) + +# Main targets +all: $(ELF) + +clean: + $(RM) -r build $(ELF) + +format: + clang-format-11 -i $(C_FILES) $(H_FILES) lib/fairy/* + +.PHONY: all clean format + +# create build directories +$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir)) $(foreach dir,$(LIB_DIRS),build/$(dir))) + +$(ELF): $(O_FILES) $(O_LIB_FILES) + $(CC) $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) $(LDFLAGS) -o $@ $^ + +build/%.o: %.c $(H_FILES) + $(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $< + +build/lib/%.o: lib/%.c + $(CC) -c $(INC) $(WARNINGS) $(CFLAGS) $(OPTFLAGS) -o $@ $< diff --git a/tools/fado/README.md b/tools/fado/README.md new file mode 100644 index 000000000..61b32d603 --- /dev/null +++ b/tools/fado/README.md @@ -0,0 +1,77 @@ +# fado +*Fairy-Assisted (relocations for) Decomplied Overlays* + + +Contains +- **Fairy** a library for reading relocatable MIPS ELF object files (big-endian, suitable for Nintendo 64 games) +- **Fado** a program for generating the `.ovl`/relocation section for Zelda64 overlay files +- **Mido** an automatic dependency file generator + +Compatible with both IDO and GCC (although [see below](N_B)). Both ordinary MIPS REL sections and RELA sections are now supported. + +Output format is the standard "Zelda64" .ovl section, with the relocs divided by section, as used by +- *The Legend of Zelda: Ocarina of Time* (all Nintendo 64/Gamecube/iQue releases) +- *The Legend of Zelda: Majora's Mask* (all Nintendo 64/Gamecube releases) + +In theory it will also work for other Nintendo 64 games that use this system, such as *Yoshi's Story*, but has yet to be tested with these. + + +## Explanation + +The overlay relocation sections used by Zelda64 is described [here](z64_relocation_section_format.md). Fado will produce a `.ovl` section compatible with this format, although as noted there, some compilers need persuasion to produce compatible objects. + + +## How to use + +Compile by running `make`. + +A standalone invocation of Fado would look something like + +```sh +./fado.elf z_en_hs2.o -n ovl_En_Hs2 -o ovl_En_Hs2_reloc.s +``` +This takes as input the compiled object file from the C file (e.g. [this one](https://github.com/zeldaret/oot/blob/eadc477187888e1ae078d021b4a00b1366f0c9a4/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c)), the name of the overlay (`ovl_En_Hs2`) and will output an assembly file `ovl_En_Hs2_reloc.s` containing the relocation section. An example output is included in the repo [here](ovl_En_Hs_reloc.s). Fado will print information from the object file to assist with debugging, by splitting relocs by section, and for each, printing the type, offset, and associated symbol (or section if static): + +```mips +# TEXT RELOCS +.word 0x45000084 # R_MIPS_HI16 0x000084 .data +.word 0x4600008C # R_MIPS_LO16 0x00008C .data +.word 0x450000B4 # R_MIPS_HI16 0x0000B4 .rodata +.word 0x460000BC # R_MIPS_LO16 0x0000BC .rodata +.word 0x450000C0 # R_MIPS_HI16 0x0000C0 func_80A6F1A4 +.word 0x460000C4 # R_MIPS_LO16 0x0000C4 func_80A6F1A4 +``` + +If invoking in a makefile, you will probably want to generate these from a predefined filelist, and with the appropriate dependencies. [The Ocarina of Time decomp repository](http://github.com/zeldaret/oot) contains an example of how to do this using a supplementary program to parse the `spec` format. + +More information can be obtained by running + +```sh +./fado.elf --help +``` + +which contains information on the various options, such as automatic dependency file generation, etc. + + +## N.B. + +- Fado expects the linker script to output symbols for the section sizes, and for them to be declared separately, in the format + +``` +_SEGMENTNAMESegmentSECTIONSize +``` + +e.g. + +``` +_ovl_En_Hs2SegmentTextSize +``` + +etc. + +- By default Fado expects sections to be 0x10-aligned, as is usual for IDO. Some versions of GCC like to align sections to smaller widths, which Fado will handle appropriately, but the linker script must also address this, and at least the default settings seem unable to size the sections correctly due ot placing `fill`s in the wrong places. For now it is recommended to manually align sections to 0x10 if the compiler does not automatically. + - The experimental flag `--alignment`/`-a` can be passed to Fado, and it will use the alignment declared by each section in the elf file instead of padding them to 0x10 bytes, It should be noted this option has not been fully tested because currently we don't have any linker script tool that can properly address the incorrect placing of `fill`s. Fado must be rebuilt passing `EXPERIMENTAL=1` to be able to use this flag. + +- To prevent GCC producing non-compliant HI/LOs, you must pass *both* of the following compiler flags: `-mno-explicit-relocs -mno-split-addresses`. See [here](z64_relocation_section_format.md#hilo) for more details. + +- It is recommended, though not strictly required, that `-fno-merge-constants` is used for GCC, to avoid unpredictable section sizes, and comply with the Zelda64 relocation format's expectation of at most one rodata section. See [here](z64_relocation_section_format.md#rodata) for more details. diff --git a/tools/fado/find_program.sh b/tools/fado/find_program.sh new file mode 100755 index 000000000..77eb53cbe --- /dev/null +++ b/tools/fado/find_program.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +for i in "${@:2}" + do + RESULT=$(IFS=:;find $PATH -maxdepth 1 -name "$i" -print -quit 2> /dev/null | grep -o '[^/]*$') + COUNT=$(echo "$RESULT" | wc -c) + + if [ $COUNT -gt 1 ] + then + echo $RESULT + exit 0 + fi + done + +echo $1 +exit 0 diff --git a/tools/fado/include/fado.h b/tools/fado/include/fado.h new file mode 100644 index 000000000..6044d0a24 --- /dev/null +++ b/tools/fado/include/fado.h @@ -0,0 +1,8 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#pragma once + +#include + +void Fado_Relocs(FILE* outputFile, int inputFilesCount, FILE** inputFiles, const char* ovlName); +// void Fado_WriteRelocFile(FILE* outputFile, FILE** inputFiles, int inputFilesCount); diff --git a/tools/fado/include/help.h b/tools/fado/include/help.h new file mode 100644 index 000000000..35e8f595d --- /dev/null +++ b/tools/fado/include/help.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#pragma once + +#include +#include + +typedef struct { + struct option longOpt; + char* helpArg; + char* helpMsg; +} OptInfo; + +typedef struct { + char* helpArg; + char* helpMsg; +} PosArgInfo; + +/* Formatting sizes used by Help_PrintHelp. Change them before calling Help_PrintHelp to use custom values */ +extern size_t helpTextWidth; +extern size_t helpDtIndent; +extern size_t helpDdIndent; + +void Help_PrintHelp(const char* prologue, size_t posArgCount, const PosArgInfo* posArgInfo, size_t optCount, + const OptInfo* optInfo, const char* epilogue); diff --git a/tools/fado/include/macros.h b/tools/fado/include/macros.h new file mode 100644 index 000000000..e201f8d36 --- /dev/null +++ b/tools/fado/include/macros.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#pragma once + +#include "vc_vector/vc_vector.h" + +/* C macros */ +#define ARRAY_COUNT(arr) (signed long long)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNTU(arr) (unsigned long long)(sizeof(arr) / sizeof(arr[0])) + +#define ALIGN(val, align) (((val) + (align - 1)) / (align) * (align)) + +/* Mathematical macros */ +#define ABS(x) ((x) < 0 ? -(x) : (x)) + +#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) +#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) +#define MEDIAN3(a1, a2, a3) \ + ((a2 >= a1) ? ((a3 >= a2) ? a2 : ((a1 >= a3) ? a1 : a3)) : ((a2 >= a3) ? a2 : ((a3 >= a1) ? a1 : a3))) + +/* vc_vector macros - really these should go in vc_vector.h, but not much choice without touching the library files */ +#define VC_FOREACH(i, v) for (i = vc_vector_begin(v); i != vc_vector_end(v); i = vc_vector_next(v, i)) diff --git a/tools/fado/include/mido.h b/tools/fado/include/mido.h new file mode 100644 index 000000000..b40d8a4c3 --- /dev/null +++ b/tools/fado/include/mido.h @@ -0,0 +1,6 @@ +#pragma once + +#include +#include "vc_vector/vc_vector.h" + +int Mido_WriteDependencyFile(FILE* dependencyFile, const char* relocFile, vc_vector* inputFilesVector); diff --git a/tools/fado/include/mips_elf.h b/tools/fado/include/mips_elf.h new file mode 100644 index 000000000..122e98d25 --- /dev/null +++ b/tools/fado/include/mips_elf.h @@ -0,0 +1,659 @@ +/* This file contains enough of the ELF format definitions for MIPS to enable Fairy and Fado to work. More may need to + * be added later. The content is excerpted directly from elf.h from the GNU C Library, and therefore: */ +/* Copyright (C) 1995-2020 Free Software Foundation, Inc. */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#ifndef MIPS_ELF_H +#define MIPS_ELF_H + +#include + +/* Type for a 16-bit quantity. */ +typedef uint16_t Elf32_Half; + +/* Types for signed and unsigned 32-bit quantities. */ +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; + +/* Types for signed and unsigned 64-bit quantities. */ +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; + +/* Type of addresses. */ +typedef uint32_t Elf32_Addr; + +/* Type of file offsets. */ +typedef uint32_t Elf32_Off; + +/* Type for section indices, which are 16-bit quantities. */ +typedef uint16_t Elf32_Section; + +/* The ELF file header. This appears at the start of every ELF file. */ + +#define EI_NIDENT (16) + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ + Elf32_Half e_type; /* Object file type */ + Elf32_Half e_machine; /* Architecture */ + Elf32_Word e_version; /* Object file version */ + Elf32_Addr e_entry; /* Entry point virtual address */ + Elf32_Off e_phoff; /* Program header table file offset */ + Elf32_Off e_shoff; /* Section header table file offset */ + Elf32_Word e_flags; /* Processor-specific flags */ + Elf32_Half e_ehsize; /* ELF header size in bytes */ + Elf32_Half e_phentsize; /* Program header table entry size */ + Elf32_Half e_phnum; /* Program header table entry count */ + Elf32_Half e_shentsize; /* Section header table entry size */ + Elf32_Half e_shnum; /* Section header table entry count */ + Elf32_Half e_shstrndx; /* Section header string table index */ +} Elf32_Ehdr; + +/* Fields in the e_ident array. The EI_* macros are indices into the + array. The macros under each EI_* macro are the values the byte + may have. */ + +#define EI_MAG0 0 /* File identification byte 0 index */ +#define ELFMAG0 0x7f /* Magic number byte 0 */ + +#define EI_MAG1 1 /* File identification byte 1 index */ +#define ELFMAG1 'E' /* Magic number byte 1 */ + +#define EI_MAG2 2 /* File identification byte 2 index */ +#define ELFMAG2 'L' /* Magic number byte 2 */ + +#define EI_MAG3 3 /* File identification byte 3 index */ +#define ELFMAG3 'F' /* Magic number byte 3 */ + +/* Conglomeration of the identification bytes, for easy testing as a word. */ +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 /* File class byte index */ +#define ELFCLASSNONE 0 /* Invalid class */ +#define ELFCLASS32 1 /* 32-bit objects */ +#define ELFCLASS64 2 /* 64-bit objects */ +#define ELFCLASSNUM 3 + +#define EI_DATA 5 /* Data encoding byte index */ +#define ELFDATANONE 0 /* Invalid data encoding */ +#define ELFDATA2LSB 1 /* 2's complement, little endian */ +#define ELFDATA2MSB 2 /* 2's complement, big endian */ +#define ELFDATANUM 3 + +#define EI_VERSION 6 /* File version byte index */ + /* Value must be EV_CURRENT */ + +#define EI_OSABI 7 /* OS ABI identification */ +#define ELFOSABI_NONE 0 /* UNIX System V ABI */ +#define ELFOSABI_SYSV 0 /* Alias. */ +#define ELFOSABI_HPUX 1 /* HP-UX */ +#define ELFOSABI_NETBSD 2 /* NetBSD. */ +#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */ +#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */ +#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */ +#define ELFOSABI_AIX 7 /* IBM AIX. */ +#define ELFOSABI_IRIX 8 /* SGI Irix. */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD. */ +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto. */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD. */ +#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +#define EI_ABIVERSION 8 /* ABI version */ + +#define EI_PAD 9 /* Byte index of padding bytes */ + +/* Legal values for e_type (object file type). */ + +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* Relocatable file */ +#define ET_EXEC 2 /* Executable file */ +#define ET_DYN 3 /* Shared object file */ +#define ET_CORE 4 /* Core file */ +#define ET_NUM 5 /* Number of defined types */ +#define ET_LOOS 0xfe00 /* OS-specific range start */ +#define ET_HIOS 0xfeff /* OS-specific range end */ +#define ET_LOPROC 0xff00 /* Processor-specific range start */ +#define ET_HIPROC 0xffff /* Processor-specific range end */ + +/* Legal values for e_machine (architecture). */ + +#define EM_NONE 0 /* No machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SUN SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola m68k family */ +#define EM_88K 5 /* Motorola m88k family */ +#define EM_IAMCU 6 /* Intel MCU */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 big-endian */ +#define EM_S370 9 /* IBM System/370 */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ +/* reserved 11-14 */ +#define EM_PARISC 15 /* HPPA */ +/* reserved 16 */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ +#define EM_960 19 /* Intel 80960 */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC 64-bit */ +#define EM_S390 22 /* IBM S390 */ +#define EM_SPU 23 /* IBM SPU/SPC */ +/* reserved 24-35 */ +#define EM_V800 36 /* NEC V800 series */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* ARM */ +#define EM_FAKE_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi SH */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ +#define EM_TRICORE 44 /* Siemens Tricore */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam */ +#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_PDSP 63 /* Sony DSP Processor */ +#define EM_PDP10 64 /* Digital PDP-10 */ +#define EM_PDP11 65 /* Digital PDP-11 */ +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CRIS 76 /* Axis Communications 32-bit emb.proc */ +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit emb.proc */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc */ +#define EM_HUANY 81 /* Harvard University machine-independent object files */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi D10V */ +#define EM_D30V 86 /* Mitsubishi D30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10300 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ +#define EM_ARC_COMPACT 93 /* ARC International ARCompact */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ +#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore */ +#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Proc */ +#define EM_NS32K 97 /* National Semi. 32000 */ +#define EM_TPC 98 /* Tenor Network TPC */ +#define EM_SNP1K 99 /* Trebia SNP 1000 */ +#define EM_ST200 100 /* STMicroelectronics ST200 */ +#define EM_IP2K 101 /* Ubicom IP2xxx */ +#define EM_MAX 102 /* MAX processor */ +#define EM_CR 103 /* National Semi. CompactRISC */ +#define EM_F2MC16 104 /* Fujitsu F2MC16 */ +#define EM_MSP430 105 /* Texas Instruments msp430 */ +#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */ +#define EM_SE_C33 107 /* Seiko Epson S1C33 family */ +#define EM_SEP 108 /* Sharp embedded microprocessor */ +#define EM_ARCA 109 /* Arca RISC */ +#define EM_UNICORE 110 /* PKU-Unity & MPRC Peking Uni. mc series */ +#define EM_EXCESS 111 /* eXcess configurable cpu */ +#define EM_DXP 112 /* Icera Semi. Deep Execution Processor */ +#define EM_ALTERA_NIOS2 113 /* Altera Nios II */ +#define EM_CRX 114 /* National Semi. CompactRISC CRX */ +#define EM_XGATE 115 /* Motorola XGATE */ +#define EM_C166 116 /* Infineon C16x/XC16x */ +#define EM_M16C 117 /* Renesas M16C */ +#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F */ +#define EM_CE 119 /* Freescale Communication Engine RISC */ +#define EM_M32C 120 /* Renesas M32C */ +/* reserved 121-130 */ +#define EM_TSK3000 131 /* Altium TSK3000 */ +#define EM_RS08 132 /* Freescale RS08 */ +#define EM_SHARC 133 /* Analog Devices SHARC family */ +#define EM_ECOG2 134 /* Cyan Technology eCOG2 */ +#define EM_SCORE7 135 /* Sunplus S+core7 RISC */ +#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP */ +#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III */ +#define EM_LATTICEMICO32 138 /* RISC for Lattice FPGA */ +#define EM_SE_C17 139 /* Seiko Epson C17 */ +#define EM_TI_C6000 140 /* Texas Instruments TMS320C6000 DSP */ +#define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP */ +#define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP */ +#define EM_TI_ARP32 143 /* Texas Instruments App. Specific RISC */ +#define EM_TI_PRU 144 /* Texas Instruments Prog. Realtime Unit */ +/* reserved 145-159 */ +#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW DSP */ +#define EM_CYPRESS_M8C 161 /* Cypress M8C */ +#define EM_R32C 162 /* Renesas R32C */ +#define EM_TRIMEDIA 163 /* NXP Semi. TriMedia */ +#define EM_QDSP6 164 /* QUALCOMM DSP6 */ +#define EM_8051 165 /* Intel 8051 and variants */ +#define EM_STXP7X 166 /* STMicroelectronics STxP7x */ +#define EM_NDS32 167 /* Andes Tech. compact code emb. RISC */ +#define EM_ECOG1X 168 /* Cyan Technology eCOG1X */ +#define EM_MAXQ30 169 /* Dallas Semi. MAXQ30 mc */ +#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP */ +#define EM_MANIK 171 /* M2000 Reconfigurable RISC */ +#define EM_CRAYNV2 172 /* Cray NV2 vector architecture */ +#define EM_RX 173 /* Renesas RX */ +#define EM_METAG 174 /* Imagination Tech. META */ +#define EM_MCST_ELBRUS 175 /* MCST Elbrus */ +#define EM_ECOG16 176 /* Cyan Technology eCOG16 */ +#define EM_CR16 177 /* National Semi. CompactRISC CR16 */ +#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */ +#define EM_SLE9X 179 /* Infineon Tech. SLE9X */ +#define EM_L10M 180 /* Intel L10M */ +#define EM_K10M 181 /* Intel K10M */ +/* reserved 182 */ +#define EM_AARCH64 183 /* ARM AARCH64 */ +/* reserved 184 */ +#define EM_AVR32 185 /* Amtel 32-bit microprocessor */ +#define EM_STM8 186 /* STMicroelectronics STM8 */ +#define EM_TILE64 187 /* Tileta TILE64 */ +#define EM_TILEPRO 188 /* Tilera TILEPro */ +#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */ +#define EM_CUDA 190 /* NVIDIA CUDA */ +#define EM_TILEGX 191 /* Tilera TILE-Gx */ +#define EM_CLOUDSHIELD 192 /* CloudShield */ +#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */ +#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */ +#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */ +#define EM_OPEN8 196 /* Open8 RISC */ +#define EM_RL78 197 /* Renesas RL78 */ +#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */ +#define EM_78KOR 199 /* Renesas 78KOR */ +#define EM_56800EX 200 /* Freescale 56800EX DSC */ +#define EM_BA1 201 /* Beyond BA1 */ +#define EM_BA2 202 /* Beyond BA2 */ +#define EM_XCORE 203 /* XMOS xCORE */ +#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */ +/* reserved 205-209 */ +#define EM_KM32 210 /* KM211 KM32 */ +#define EM_KMX32 211 /* KM211 KMX32 */ +#define EM_EMX16 212 /* KM211 KMX16 */ +#define EM_EMX8 213 /* KM211 KMX8 */ +#define EM_KVARC 214 /* KM211 KVARC */ +#define EM_CDP 215 /* Paneve CDP */ +#define EM_COGE 216 /* Cognitive Smart Memory Processor */ +#define EM_COOL 217 /* Bluechip CoolEngine */ +#define EM_NORC 218 /* Nanoradio Optimized RISC */ +#define EM_CSR_KALIMBA 219 /* CSR Kalimba */ +#define EM_Z80 220 /* Zilog Z80 */ +#define EM_VISIUM 221 /* Controls and Data Services VISIUMcore */ +#define EM_FT32 222 /* FTDI Chip FT32 */ +#define EM_MOXIE 223 /* Moxie processor */ +#define EM_AMDGPU 224 /* AMD GPU */ +/* reserved 225-242 */ +#define EM_RISCV 243 /* RISC-V */ + +#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */ +#define EM_CSKY 252 /* C-SKY */ + +#define EM_NUM 253 + +/* Old spellings/synonyms. */ + +#define EM_ARC_A5 EM_ARC_COMPACT + +/* If it is necessary to assign new unofficial EM_* values, please + pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the + chances of collision with official or non-GNU unofficial values. */ + +#define EM_ALPHA 0x9026 + +/* Legal values for e_version (version). */ + +#define EV_NONE 0 /* Invalid ELF version */ +#define EV_CURRENT 1 /* Current version */ +#define EV_NUM 2 + +/* Section header. */ + +typedef struct { + Elf32_Word sh_name; /* Section name (string tbl index) */ + Elf32_Word sh_type; /* Section type */ + Elf32_Word sh_flags; /* Section flags */ + Elf32_Addr sh_addr; /* Section virtual addr at execution */ + Elf32_Off sh_offset; /* Section file offset */ + Elf32_Word sh_size; /* Section size in bytes */ + Elf32_Word sh_link; /* Link to another section */ + Elf32_Word sh_info; /* Additional section information */ + Elf32_Word sh_addralign; /* Section alignment */ + Elf32_Word sh_entsize; /* Entry size if section holds table */ +} Elf32_Shdr; + +/* Special section indices. */ + +#define SHN_UNDEF 0 /* Undefined section */ +#define SHN_LORESERVE 0xff00 /* Start of reserved indices */ +#define SHN_LOPROC 0xff00 /* Start of processor-specific */ +#define SHN_BEFORE 0xff00 /* Order section before all others (Solaris). */ +#define SHN_AFTER 0xff01 /* Order section after all others (Solaris). */ +#define SHN_HIPROC 0xff1f /* End of processor-specific */ +#define SHN_LOOS 0xff20 /* Start of OS-specific */ +#define SHN_HIOS 0xff3f /* End of OS-specific */ +#define SHN_ABS 0xfff1 /* Associated symbol is absolute */ +#define SHN_COMMON 0xfff2 /* Associated symbol is common */ +#define SHN_XINDEX 0xffff /* Index is in extra table. */ +#define SHN_HIRESERVE 0xffff /* End of reserved indices */ +/* Legal values for sh_type (section type). */ + +#define SHT_NULL 0 /* Section header table entry unused */ +#define SHT_PROGBITS 1 /* Program data */ +#define SHT_SYMTAB 2 /* Symbol table */ +#define SHT_STRTAB 3 /* String table */ +#define SHT_RELA 4 /* Relocation entries with addends */ +#define SHT_HASH 5 /* Symbol hash table */ +#define SHT_DYNAMIC 6 /* Dynamic linking information */ +#define SHT_NOTE 7 /* Notes */ +#define SHT_NOBITS 8 /* Program space with no data (bss) */ +#define SHT_REL 9 /* Relocation entries, no addends */ +#define SHT_SHLIB 10 /* Reserved */ +#define SHT_DYNSYM 11 /* Dynamic linker symbol table */ +#define SHT_INIT_ARRAY 14 /* Array of constructors */ +#define SHT_FINI_ARRAY 15 /* Array of destructors */ +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ +#define SHT_GROUP 17 /* Section group */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_NUM 19 /* Number of defined types. */ +#define SHT_LOOS 0x60000000 /* Start OS-specific. */ +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ +#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ +#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ +#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ +#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */ +#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */ +#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */ +#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */ +#define SHT_HIOS 0x6fffffff /* End OS-specific type */ +#define SHT_LOPROC 0x70000000 /* Start of processor-specific */ +#define SHT_HIPROC 0x7fffffff /* End of processor-specific */ +#define SHT_LOUSER 0x80000000 /* Start of application-specific */ +#define SHT_HIUSER 0x8fffffff /* End of application-specific */ + +/* Symbol table entry. */ + +typedef struct { + Elf32_Word st_name; /* Symbol name (string tbl index) */ + Elf32_Addr st_value; /* Symbol value */ + Elf32_Word st_size; /* Symbol size */ + unsigned char st_info; /* Symbol type and binding */ + unsigned char st_other; /* Symbol visibility */ + Elf32_Section st_shndx; /* Section index */ +} Elf32_Sym; + +/* How to extract and insert information held in the st_info field. */ + +#define ELF32_ST_BIND(val) (((unsigned char)(val)) >> 4) +#define ELF32_ST_TYPE(val) ((val)&0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type)&0xf)) + +/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */ +#define ELF64_ST_BIND(val) ELF32_ST_BIND(val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE(val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO((bind), (type)) + +/* Legal values for ST_BIND subfield of st_info (symbol binding). */ + +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* Weak symbol */ +#define STB_NUM 3 /* Number of defined types. */ +#define STB_LOOS 10 /* Start of OS-specific */ +#define STB_GNU_UNIQUE 10 /* Unique symbol. */ +#define STB_HIOS 12 /* End of OS-specific */ +#define STB_LOPROC 13 /* Start of processor-specific */ +#define STB_HIPROC 15 /* End of processor-specific */ + +/* Legal values for ST_TYPE subfield of st_info (symbol type). */ + +#define STT_NOTYPE 0 /* Symbol type is unspecified */ +#define STT_OBJECT 1 /* Symbol is a data object */ +#define STT_FUNC 2 /* Symbol is a code object */ +#define STT_SECTION 3 /* Symbol associated with a section */ +#define STT_FILE 4 /* Symbol's name is file name */ +#define STT_COMMON 5 /* Symbol is a common data object */ +#define STT_TLS 6 /* Symbol is thread-local data object*/ +#define STT_NUM 7 /* Number of defined types. */ +#define STT_LOOS 10 /* Start of OS-specific */ +#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ +#define STT_HIOS 12 /* End of OS-specific */ +#define STT_LOPROC 13 /* Start of processor-specific */ +#define STT_HIPROC 15 /* End of processor-specific */ + +/* Symbol table indices are found in the hash buckets and chain table + of a symbol hash table section. This special index value indicates + the end of a chain, meaning no further symbols are found in that bucket. */ + +#define STN_UNDEF 0 /* End of a chain. */ + +/* How to extract and insert information held in the st_other field. */ + +#define ELF32_ST_VISIBILITY(o) ((o)&0x03) + +/* For ELF64 the definitions are the same. */ +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o) + +/* Symbol visibility specification encoded in the st_other field. */ +#define STV_DEFAULT 0 /* Default symbol visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Sym unavailable in other modules */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ + +/* Relocation table entry without addend (in section of type SHT_REL). */ + +typedef struct { + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ +} Elf32_Rel; + +/* Relocation table entry with addend (in section of type SHT_RELA). */ + +typedef struct { + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ + Elf32_Sword r_addend; /* Addend */ +} Elf32_Rela; + +/* How to extract and insert information held in the r_info field. */ + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val)&0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type)&0xff)) + +/* MIPS R3000 specific definitions. */ + +/* Legal values for e_flags field of Elf32_Ehdr. */ + +#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */ +#define EF_MIPS_PIC 2 /* Contains PIC code. */ +#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */ +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */ +#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */ +#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */ + +/* Legal values for MIPS architecture level. */ + +#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */ +#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */ +#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */ +#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */ +#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */ +#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */ +#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */ +#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */ +#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */ + +/* The following are unofficial names and should not be used. */ + +#define E_MIPS_ARCH_1 EF_MIPS_ARCH_1 +#define E_MIPS_ARCH_2 EF_MIPS_ARCH_2 +#define E_MIPS_ARCH_3 EF_MIPS_ARCH_3 +#define E_MIPS_ARCH_4 EF_MIPS_ARCH_4 +#define E_MIPS_ARCH_5 EF_MIPS_ARCH_5 +#define E_MIPS_ARCH_32 EF_MIPS_ARCH_32 +#define E_MIPS_ARCH_64 EF_MIPS_ARCH_64 + +/* Special section indices. */ + +#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */ +#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */ +#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */ +#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */ +#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */ + +/* Legal values for sh_type field of Elf32_Shdr. */ + +#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */ +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */ +#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */ +#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */ +#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */ +#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */ +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */ +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */ +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */ +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 +#define SHT_MIPS_XHASH 0x7000002b + +/* Legal values for sh_flags field of Elf32_Shdr. */ + +#define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */ +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + +/* Symbol tables. */ + +/* MIPS specific values for `st_other'. */ +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + +/* MIPS specific values for `st_info'. */ +#define STB_MIPS_SPLIT_COMMON 13 + +/* MIPS relocs. */ + +#define R_MIPS_NONE 0 /* No reloc */ +#define R_MIPS_16 1 /* Direct 16 bit */ +#define R_MIPS_32 2 /* Direct 32 bit */ +#define R_MIPS_REL32 3 /* PC relative 32 bit */ +#define R_MIPS_26 4 /* Direct 26 bit shifted */ +#define R_MIPS_HI16 5 /* High 16 bit */ +#define R_MIPS_LO16 6 /* Low 16 bit */ +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ +#define R_MIPS_PC16 10 /* PC relative 16 bit */ +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */ +#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */ +#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */ +#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */ +#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */ +#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */ +#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */ +#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */ +#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */ +#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */ +#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */ +#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ +#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 +/* Keep this the last entry. */ +#define R_MIPS_NUM 128 + +#endif /* MIPS_ELF_H */ diff --git a/tools/fado/lib/fairy/fairy.c b/tools/fado/lib/fairy/fairy.c new file mode 100644 index 000000000..8fc090300 --- /dev/null +++ b/tools/fado/lib/fairy/fairy.c @@ -0,0 +1,418 @@ +/** + * Functions for working with N64 ELF files. + */ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include "fairy.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "vc_vector/vc_vector.h" +#include "macros.h" + +VerbosityLevel gVerbosity = VERBOSITY_NONE; +bool gUseElfAlignment = false; + +int Fairy_DebugPrintf(const char* file, int line, const char* func, VerbosityLevel level, const char* fmt, ...) { + if (gVerbosity >= level) { + int ret = 0; + va_list args; + va_start(args, fmt); + + if (gVerbosity >= VERBOSITY_DEBUG) { + ret += fprintf(stderr, "%s:%d:%s: ", file, line, func); + } + + ret += vfprintf(stderr, fmt, args); + va_end(args); + return ret; + } + return 0; +} + +/* Endian readers. MIPS is BE, so only need these */ +static Elf32_Half Fairy_ReadHalf(const uint8_t* data) { + return data[0] << 8 | data[1] << 0; +} + +static Elf32_Word Fairy_ReadWord(const uint8_t* data) { + return data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3] << 0; +} + +static bool Fairy_VerifyMagic(const uint8_t* data) { + return (data[0] == 0x7F && data[1] == 'E' && data[2] == 'L' && data[3] == 'F'); +} + +static uint16_t Fairy_Swap16(uint16_t x) { + return ((x & 0xFF) << 0x8) | ((x & 0xFF00) >> 0x8); +} + +static uint32_t Fairy_Swap32(uint32_t x) { + return ((x & 0xFF) << 0x18) | ((x & 0xFF00) << 0x8) | ((x & 0xFF0000) >> 0x8) | ((x & 0xFF000000) >> 0x18); +} + +/* Both GCC and Clang define these, so we can avoid an endian header altogether */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define REEND16(x) Fairy_Swap16(x) +#define REEND32(x) Fairy_Swap32(x) +#else +#define REEND16(x) (x) +#define REEND32(x) (x) +#endif + +const char* Fairy_StringFromDefine(const FairyDefineString* dict, int define) { + size_t i; + for (i = 0; dict[i].string != NULL; i++) { + if (dict[i].define == define) { + return dict[i].string; + } + } + return NULL; +} + +/** + * Returns true if the string 'initial' is contained in the string 'string' + * 'initial' must be null-terminated, 'string' ideally is. + */ +bool Fairy_StartsWith(const char* string, const char* initial) { + char s; + char i; + do { + s = *string++; + i = *initial++; + if (i == '\0') { + return true; + } + } while (s == i); + return false; +} + +/* Reading functions */ + +/** + * Every reading function: + * - Returns the pointer to the struct + * - Takes the ouput struct or array as its first argument. This must be pre-allocated + * - Takes the input file as the second argument (At least until I am persuaded to read the whole file into RAM...) + * - The rest of the arguments are important information about the struct it is reading (offset and size, usually) + */ + +FairyFileHeader* Fairy_ReadFileHeader(FairyFileHeader* header, FILE* file) { + fseek(file, 0, SEEK_SET); + assert(fread(header, sizeof(char), 0x34, file) == 0x34); + + if (!Fairy_VerifyMagic(header->e_ident)) { + fprintf(stderr, "Not a valid ELF file.\n"); + return NULL; + } + + if (header->e_ident[EI_CLASS] != ELFCLASS32) { + fprintf(stderr, "Not a 32-bit ELF file.\n"); + return NULL; + } + + header->e_type = REEND16(header->e_type); + if (header->e_type != ET_REL) { + fprintf(stderr, "Not a relocatable object file.\n"); + return NULL; + } + + header->e_machine = REEND16(header->e_machine); + if (header->e_machine != EM_MIPS) { + fprintf(stderr, "Not a MIPS object file.\n"); + return NULL; + } + + header->e_version = REEND32(header->e_version); + header->e_entry = REEND32(header->e_entry); + header->e_phoff = REEND32(header->e_phoff); + header->e_shoff = REEND32(header->e_shoff); + header->e_flags = REEND32(header->e_flags); + header->e_ehsize = REEND16(header->e_ehsize); + header->e_phentsize = REEND16(header->e_phentsize); + header->e_phnum = REEND16(header->e_phnum); + header->e_shentsize = REEND16(header->e_shentsize); + header->e_shnum = REEND16(header->e_shnum); + header->e_shstrndx = REEND16(header->e_shstrndx); + + return header; +} + +/* tableOffset and number should be obtained from the file header */ +FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file, size_t tableOffset, size_t number) { + size_t entrySize = sizeof(FairySecHeader); + size_t tableSize = number * entrySize; + + fseek(file, tableOffset, SEEK_SET); + assert(fread(sectionTable, sizeof(char), tableSize, file) == tableSize); + + /* Since the section table happens to only have entries of width 4, we can byteswap it by pretending it is a raw + * uint32_t array */ + { + size_t i; + uint32_t* data = (uint32_t*)sectionTable; + for (i = 0; i < tableSize / sizeof(uint32_t); i++) { + data[i] = REEND32(data[i]); + } + } + + return sectionTable; +} + +size_t Fairy_ReadSymbolTable(FairySym** symbolTableOut, FILE* file, size_t tableOffset, size_t tableSize) { + size_t number = tableSize / sizeof(FairySym); + FairySym* symbolTable = malloc(tableSize); + + *symbolTableOut = NULL; + + if (symbolTable == NULL) { + return 0; + } + if (fseek(file, tableOffset, SEEK_SET) != 0 || fread(symbolTable, sizeof(char), tableSize, file) != tableSize) { + free(symbolTable); + return 0; + } + + /* Reend the variables that are wider than bytes */ + { + size_t i; + for (i = 0; i < number; i++) { + symbolTable[i].st_name = REEND32(symbolTable[i].st_name); + symbolTable[i].st_value = REEND32(symbolTable[i].st_value); + symbolTable[i].st_size = REEND32(symbolTable[i].st_size); + symbolTable[i].st_shndx = REEND16(symbolTable[i].st_shndx); + } + } + + *symbolTableOut = symbolTable; + return number; +} + +/* Can be used for both the section header string table and the strtab */ +char* Fairy_ReadStringTable(char* stringTable, FILE* file, size_t tableOffset, size_t tableSize) { + fseek(file, tableOffset, SEEK_SET); + assert(fread(stringTable, sizeof(char), tableSize, file) == tableSize); + return stringTable; +} + +/* offset and number are attained from the section table, the returned pointer must be freed */ +size_t Fairy_ReadRelocs(FairyRela** relocsOut, FILE* file, int type, size_t offset, size_t size) { + /* Final size of the relocation table, relocations of type SHT_REL need more space for extra addend of 0 */ + size_t finalSize = (type == SHT_REL) ? ((size * sizeof(FairyRela)) / sizeof(FairyRel)) : size; + void* readBuf = malloc(size); + FairyRela* relocTable = malloc(finalSize); + + *relocsOut = NULL; + + if (readBuf == NULL) { + return 0; + } + if (relocTable == NULL) { + free(readBuf); + return 0; + } + if (fseek(file, offset, SEEK_SET) != 0 || fread(readBuf, sizeof(char), size, file) != size) { + free(readBuf); + free(relocTable); + return 0; + } + + /* Reend the variables that are wider than bytes */ + { + size_t i; + uint32_t* data = (uint32_t*)readBuf; + for (i = 0; i < size / sizeof(uint32_t); i++) { + data[i] = REEND32(data[i]); + } + } + + /* Make the relocation table, for SHT_REL sections add an addend of 0 */ + if (type == SHT_REL) { + size_t i; + FairyRel* rel = (FairyRel*)readBuf; + + for (i = 0; i < size / sizeof(FairyRel); i++) { + relocTable[i].r_info = rel[i].r_info; + relocTable[i].r_offset = rel[i].r_offset; + relocTable[i].r_addend = 0; + } + } else { + memcpy(relocTable, readBuf, size); + } + free(readBuf); + + *relocsOut = relocTable; + return finalSize / sizeof(FairyRela); +} + +char* Fairy_GetSectionName(FairySecHeader* sectionTable, char* shstrtab, size_t index) { + return &shstrtab[sectionTable[index].sh_name]; +} + +/* Look up the index in the symbol table and return a pointer to the beginning of its string */ +char* Fairy_GetSymbolName(FairySym* symtab, char* strtab, size_t index) { + return &strtab[symtab[index].st_name]; +} + +/* FairyFileInfo functions */ + +void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) { + FairyFileHeader fileHeader; + FairySecHeader* sectionTable; + char* shstrtab; + int i; + + assert(fileInfo != NULL); + assert(file != NULL); + + fileInfo->progBitsSections = vc_vector_create(3, sizeof(Elf32_Section), NULL); + for (i = 0; i < 3; i++) { + fileInfo->progBitsSizes[i] = 0; + } + Fairy_ReadFileHeader(&fileHeader, file); + + sectionTable = malloc(fileHeader.e_shnum * fileHeader.e_shentsize); + Fairy_ReadSectionTable(sectionTable, file, fileHeader.e_shoff, fileHeader.e_shnum); + + shstrtab = malloc(sectionTable[fileHeader.e_shstrndx].sh_size * sizeof(char)); + fseek(file, sectionTable[fileHeader.e_shstrndx].sh_offset, SEEK_SET); + assert(fread(shstrtab, sizeof(char), sectionTable[fileHeader.e_shstrndx].sh_size, file) == + sectionTable[fileHeader.e_shstrndx].sh_size); + + /* Search for the sections we need */ + { + size_t currentIndex; + FairySecHeader currentSection; + for (currentIndex = 0; currentIndex < 3; currentIndex++) { + fileInfo->relocTablesInfo[currentIndex].sectionData = NULL; + } + + for (currentIndex = 0; currentIndex < fileHeader.e_shnum; currentIndex++) { + size_t off = 0; + + currentSection = sectionTable[currentIndex]; + + switch (currentSection.sh_type) { + case SHT_PROGBITS: + assert(vc_vector_push_back(fileInfo->progBitsSections, ¤tIndex)); + + { + FairySection sectionType = FAIRY_SECTION_OTHER; + const char* sectionName = &shstrtab[currentSection.sh_name + 1]; + size_t alignedSize; + + /* Ignore the leading "." */ + if (strcmp(sectionName, "text") == 0) { + sectionType = FAIRY_SECTION_TEXT; + } else if (strcmp(sectionName, "data") == 0) { + sectionType = FAIRY_SECTION_DATA; + } else if (Fairy_StartsWith(sectionName, "rodata")) { /* May be several */ + sectionType = FAIRY_SECTION_RODATA; + } + + if (sectionType != FAIRY_SECTION_OTHER) { + if (gUseElfAlignment) { + /* Ensure the next file will start at its correct alignment */ + fileInfo->progBitsSizes[sectionType] = + ALIGN(fileInfo->progBitsSizes[sectionType], currentSection.sh_addralign); + + alignedSize = ALIGN(currentSection.sh_size, currentSection.sh_addralign); + + FAIRY_DEBUG_PRINTF("%s section alignment: 0x%X\n", sectionName, + currentSection.sh_addralign); + FAIRY_DEBUG_PRINTF("%s section size before align: 0x%X\n", sectionName, + currentSection.sh_size); + FAIRY_DEBUG_PRINTF("%s section size after align: 0x%X\n", sectionName, alignedSize); + + fileInfo->progBitsSizes[sectionType] += alignedSize; + } else { + fileInfo->progBitsSizes[sectionType] += ALIGN(currentSection.sh_size, 0x10); + } + + FAIRY_DEBUG_PRINTF("%s section size: 0x%X\n", sectionName, + fileInfo->progBitsSizes[sectionType]); + } + } + + break; + + case SHT_SYMTAB: + if (strcmp(&shstrtab[currentSection.sh_name + 1], "symtab") == 0) { + fileInfo->symtabInfo.sectionType = SHT_SYMTAB; + fileInfo->symtabInfo.sectionEntrySize = sizeof(FairySym); + fileInfo->symtabInfo.sectionEntryCount = + Fairy_ReadSymbolTable((FairySym**)&fileInfo->symtabInfo.sectionData, file, + currentSection.sh_offset, currentSection.sh_size); + } + break; + + case SHT_STRTAB: + if (strcmp(&shstrtab[currentSection.sh_name + 1], "strtab") == 0) { + FAIRY_DEBUG_PRINTF("%s", "strtab found\n"); + fileInfo->strtab = malloc(currentSection.sh_size); + Fairy_ReadStringTable(fileInfo->strtab, file, currentSection.sh_offset, currentSection.sh_size); + } + break; + + case SHT_RELA: + off += 1; + case SHT_REL: + off += 5; + /* This assumes only one reloc section of each name */ + // TODO: is this a problem? + { + FairySection relocSection = FAIRY_SECTION_OTHER; + + /* Ignore the first 5/6 chars, which will always be ".rel."/".rela." */ + if (strcmp(&shstrtab[currentSection.sh_name + off], "text") == 0) { + relocSection = FAIRY_SECTION_TEXT; + } else if (strcmp(&shstrtab[currentSection.sh_name + off], "data") == 0) { + relocSection = FAIRY_SECTION_DATA; + } else if (strcmp(&shstrtab[currentSection.sh_name + off], "rodata") == 0) { + relocSection = FAIRY_SECTION_RODATA; + } else { + break; + } + FAIRY_DEBUG_PRINTF("Found %s section\n", &shstrtab[currentSection.sh_name]); + + fileInfo->relocTablesInfo[relocSection].sectionType = SHT_RELA; + fileInfo->relocTablesInfo[relocSection].sectionEntrySize = sizeof(FairyRela); + fileInfo->relocTablesInfo[relocSection].sectionEntryCount = + Fairy_ReadRelocs((FairyRela**)&fileInfo->relocTablesInfo[relocSection].sectionData, file, + currentSection.sh_type, currentSection.sh_offset, currentSection.sh_size); + } + break; + + default: + break; + } + } + } + + free(sectionTable); + free(shstrtab); +} + +void Fairy_DestroyFile(FairyFileInfo* fileInfo) { + size_t i; + for (i = 0; i < ARRAY_COUNTU(fileInfo->relocTablesInfo); i++) { + if (fileInfo->relocTablesInfo[i].sectionData != NULL) { + FAIRY_DEBUG_PRINTF("Freeing reloc section %zd data\n", i); + free(fileInfo->relocTablesInfo[i].sectionData); + } + } + + vc_vector_release(fileInfo->progBitsSections); + + FAIRY_DEBUG_PRINTF("%s", "Freeing symtab data\n"); + free(fileInfo->symtabInfo.sectionData); + + FAIRY_DEBUG_PRINTF("%s", "Freeing strtab data\n"); + free(fileInfo->strtab); +} diff --git a/tools/fado/lib/fairy/fairy.h b/tools/fado/lib/fairy/fairy.h new file mode 100644 index 000000000..5a3cb3d97 --- /dev/null +++ b/tools/fado/lib/fairy/fairy.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#pragma once + +#include +#include +#include "mips_elf.h" + +#include "vc_vector/vc_vector.h" + +#define FAIRY_DEF_STRING(prefix, x) \ + { prefix##x, #x } + +typedef enum { + VERBOSITY_NONE, + VERBOSITY_INFO, + VERBOSITY_DEBUG //, +} VerbosityLevel; + +extern VerbosityLevel gVerbosity; +extern bool gUseElfAlignment; + +typedef Elf32_Ehdr FairyFileHeader; +typedef Elf32_Shdr FairySecHeader; +typedef Elf32_Sym FairySym; +typedef Elf32_Rel FairyRel; +typedef Elf32_Rela FairyRela; + +typedef struct { + int define; + const char* string; +} FairyDefineString; + +typedef struct { + void* sectionData; + int sectionType; + size_t sectionEntryCount; + size_t sectionEntrySize; +} FairySectionInfo; + +typedef struct { + FairySectionInfo symtabInfo; + char* strtab; + Elf32_Word progBitsSizes[3]; + vc_vector* progBitsSections; + FairySectionInfo relocTablesInfo[3]; +} FairyFileInfo; + +typedef enum { + FAIRY_SECTION_TEXT, + FAIRY_SECTION_DATA, + FAIRY_SECTION_RODATA, + FAIRY_SECTION_OTHER //, +} FairySection; + +/* Prints debugging information to stderr. To be used via the macros. */ +int Fairy_DebugPrintf(const char* file, int line, const char* func, VerbosityLevel level, const char* fmt, ...); +#define FAIRY_INFO_PRINTF(fmt, ...) Fairy_DebugPrintf(__FILE__, __LINE__, __func__, VERBOSITY_INFO, fmt, __VA_ARGS__) +#define FAIRY_DEBUG_PRINTF(fmt, ...) Fairy_DebugPrintf(__FILE__, __LINE__, __func__, VERBOSITY_DEBUG, fmt, __VA_ARGS__) + +const char* Fairy_StringFromDefine(const FairyDefineString* dict, int define); +bool Fairy_StartsWith(const char* string, const char* initial); + +FairyFileHeader* Fairy_ReadFileHeader(FairyFileHeader* header, FILE* file); +FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file, size_t tableOffset, size_t number); +char* Fairy_ReadStringTable(char* stringTable, FILE* file, size_t tableOffset, size_t tableSize); +size_t Fairy_ReadSymbolTable(FairySym** symbolTableOut, FILE* file, size_t tableOffset, size_t tableSize); +size_t Fairy_ReadRelocs(FairyRela** relocsOut, FILE* file, int type, size_t offset, size_t size); + +char* Fairy_GetSectionName(FairySecHeader* sectionTable, char* shstrtab, size_t index); +char* Fairy_GetSymbolName(FairySym* symtab, char* strtab, size_t index); + +void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file); +void Fairy_DestroyFile(FairyFileInfo* fileInfo); diff --git a/tools/fado/lib/fairy/fairy_data.inc b/tools/fado/lib/fairy/fairy_data.inc new file mode 100644 index 000000000..5dfecfc20 --- /dev/null +++ b/tools/fado/lib/fairy/fairy_data.inc @@ -0,0 +1,126 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include "fairy.h" +#include "mips_elf.h" + +// clang-format off +static const FairyDefineString stTypes[] = { + FAIRY_DEF_STRING(STT_, NOTYPE), + FAIRY_DEF_STRING(STT_, OBJECT), + FAIRY_DEF_STRING(STT_, FUNC), + FAIRY_DEF_STRING(STT_, SECTION), + FAIRY_DEF_STRING(STT_, FILE), + FAIRY_DEF_STRING(STT_, COMMON), + FAIRY_DEF_STRING(STT_, TLS), + FAIRY_DEF_STRING(STT_, NUM), + FAIRY_DEF_STRING(STT_, LOOS), + FAIRY_DEF_STRING(STT_, GNU_IFUNC), + FAIRY_DEF_STRING(STT_, HIOS), + FAIRY_DEF_STRING(STT_, LOPROC), + FAIRY_DEF_STRING(STT_, HIPROC), + { 0 }, +}; + +static const FairyDefineString stBinds[] = { + FAIRY_DEF_STRING(STB_, LOCAL), + FAIRY_DEF_STRING(STB_, GLOBAL), + FAIRY_DEF_STRING(STB_, WEAK), + FAIRY_DEF_STRING(STB_, NUM), + FAIRY_DEF_STRING(STB_, LOOS), + FAIRY_DEF_STRING(STB_, GNU_UNIQUE), + FAIRY_DEF_STRING(STB_, HIOS), + FAIRY_DEF_STRING(STB_, LOPROC), + FAIRY_DEF_STRING(STB_, HIPROC), + { 0 }, +}; + +static const FairyDefineString stVisibilities[] = { + FAIRY_DEF_STRING(STV_, DEFAULT), + FAIRY_DEF_STRING(STV_, INTERNAL), + FAIRY_DEF_STRING(STV_, HIDDEN), + FAIRY_DEF_STRING(STV_, PROTECTED), + { 0 }, +}; + +/* TODO: understand this data better: there are several cases with the same number */ +static const FairyDefineString shTypes[] = { + FAIRY_DEF_STRING(SHT_, NULL), + FAIRY_DEF_STRING(SHT_, PROGBITS), + FAIRY_DEF_STRING(SHT_, SYMTAB), + FAIRY_DEF_STRING(SHT_, STRTAB), + FAIRY_DEF_STRING(SHT_, RELA), + FAIRY_DEF_STRING(SHT_, HASH), + FAIRY_DEF_STRING(SHT_, DYNAMIC), + FAIRY_DEF_STRING(SHT_, NOTE), + FAIRY_DEF_STRING(SHT_, NOBITS), + FAIRY_DEF_STRING(SHT_, REL), + FAIRY_DEF_STRING(SHT_, SHLIB), + FAIRY_DEF_STRING(SHT_, DYNSYM), + FAIRY_DEF_STRING(SHT_, INIT_ARRAY), + FAIRY_DEF_STRING(SHT_, FINI_ARRAY), + FAIRY_DEF_STRING(SHT_, PREINIT_ARRAY), + FAIRY_DEF_STRING(SHT_, GROUP), + FAIRY_DEF_STRING(SHT_, SYMTAB_SHNDX), + FAIRY_DEF_STRING(SHT_, NUM), + FAIRY_DEF_STRING(SHT_, LOOS), + FAIRY_DEF_STRING(SHT_, GNU_ATTRIBUTES), + FAIRY_DEF_STRING(SHT_, GNU_HASH), + FAIRY_DEF_STRING(SHT_, GNU_LIBLIST), + FAIRY_DEF_STRING(SHT_, CHECKSUM), + FAIRY_DEF_STRING(SHT_, LOSUNW), + FAIRY_DEF_STRING(SHT_, SUNW_move), + FAIRY_DEF_STRING(SHT_, SUNW_COMDAT), + FAIRY_DEF_STRING(SHT_, SUNW_syminfo), + FAIRY_DEF_STRING(SHT_, GNU_verdef), + FAIRY_DEF_STRING(SHT_, GNU_verneed), + FAIRY_DEF_STRING(SHT_, GNU_versym), + FAIRY_DEF_STRING(SHT_, HISUNW), + FAIRY_DEF_STRING(SHT_, HIOS), + FAIRY_DEF_STRING(SHT_, LOPROC), + FAIRY_DEF_STRING(SHT_, HIPROC), + FAIRY_DEF_STRING(SHT_, LOUSER), + FAIRY_DEF_STRING(SHT_, HIUSER), + FAIRY_DEF_STRING(SHT_, MIPS_LIBLIST), + FAIRY_DEF_STRING(SHT_, MIPS_MSYM), + FAIRY_DEF_STRING(SHT_, MIPS_CONFLICT), + FAIRY_DEF_STRING(SHT_, MIPS_GPTAB), + FAIRY_DEF_STRING(SHT_, MIPS_UCODE), + FAIRY_DEF_STRING(SHT_, MIPS_DEBUG), + FAIRY_DEF_STRING(SHT_, MIPS_REGINFO), + FAIRY_DEF_STRING(SHT_, MIPS_PACKAGE), + FAIRY_DEF_STRING(SHT_, MIPS_PACKSYM), + FAIRY_DEF_STRING(SHT_, MIPS_RELD), + FAIRY_DEF_STRING(SHT_, MIPS_IFACE), + FAIRY_DEF_STRING(SHT_, MIPS_CONTENT), + FAIRY_DEF_STRING(SHT_, MIPS_OPTIONS), + FAIRY_DEF_STRING(SHT_, MIPS_SHDR), + FAIRY_DEF_STRING(SHT_, MIPS_FDESC), + FAIRY_DEF_STRING(SHT_, MIPS_EXTSYM), + FAIRY_DEF_STRING(SHT_, MIPS_DENSE), + FAIRY_DEF_STRING(SHT_, MIPS_PDESC), + FAIRY_DEF_STRING(SHT_, MIPS_LOCSYM), + FAIRY_DEF_STRING(SHT_, MIPS_AUXSYM), + FAIRY_DEF_STRING(SHT_, MIPS_OPTSYM), + FAIRY_DEF_STRING(SHT_, MIPS_LOCSTR), + FAIRY_DEF_STRING(SHT_, MIPS_LINE), + FAIRY_DEF_STRING(SHT_, MIPS_RFDESC), + FAIRY_DEF_STRING(SHT_, MIPS_DELTASYM), + FAIRY_DEF_STRING(SHT_, MIPS_DELTAINST), + FAIRY_DEF_STRING(SHT_, MIPS_DELTACLASS), + FAIRY_DEF_STRING(SHT_, MIPS_DWARF), + FAIRY_DEF_STRING(SHT_, MIPS_DELTADECL), + FAIRY_DEF_STRING(SHT_, MIPS_SYMBOL_LIB), + FAIRY_DEF_STRING(SHT_, MIPS_EVENTS), + FAIRY_DEF_STRING(SHT_, MIPS_TRANSLATE), + FAIRY_DEF_STRING(SHT_, MIPS_PIXIE), + FAIRY_DEF_STRING(SHT_, MIPS_XLATE), + FAIRY_DEF_STRING(SHT_, MIPS_XLATE_DEBUG), + FAIRY_DEF_STRING(SHT_, MIPS_WHIRL), + FAIRY_DEF_STRING(SHT_, MIPS_EH_REGION), + FAIRY_DEF_STRING(SHT_, MIPS_XLATE_OLD), + FAIRY_DEF_STRING(SHT_, MIPS_PDR_EXCEPTION), + // FAIRY_DEF_STRING(SHT_, MIPS_XHASH), /* New in 2019 */ + { 0 }, +}; + +// clang-format on diff --git a/tools/fado/lib/fairy/fairy_print.c b/tools/fado/lib/fairy/fairy_print.c new file mode 100644 index 000000000..80b8fcd9e --- /dev/null +++ b/tools/fado/lib/fairy/fairy_print.c @@ -0,0 +1,463 @@ +/** + * Functions for printing various sections of an N64 ELF file using the functions in Fairy, similarly to readelf + */ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include "fairy.h" + +#include +#include +#include +#include +#include +#include + +#include "fairy_data.inc" + +void Fairy_PrintSymbolTable(FILE* inputFile) { + FairyFileHeader fileHeader; + FairySecHeader* sectionTable; + size_t shstrndx; + char* shstrtab; + FairySym* symbolTable = NULL; + size_t symbolTableNum = 0; + char* strtab = NULL; + + Fairy_ReadFileHeader(&fileHeader, inputFile); + sectionTable = malloc(fileHeader.e_shentsize * fileHeader.e_shnum); + shstrndx = fileHeader.e_shstrndx; + + Fairy_ReadSectionTable(sectionTable, inputFile, fileHeader.e_shoff, fileHeader.e_shnum); + + shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char)); + + fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET); + assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size); + + { + size_t currentIndex; + size_t strtabndx = 0; + for (currentIndex = 0; currentIndex < fileHeader.e_shnum; currentIndex++) { + FairySecHeader currentHeader = sectionTable[currentIndex]; + + switch (currentHeader.sh_type) { + case SHT_SYMTAB: + if (strcmp(&shstrtab[currentHeader.sh_name], ".symtab") == 0) { + printf("symtab found\n"); + symbolTableNum = Fairy_ReadSymbolTable(&symbolTable, inputFile, currentHeader.sh_offset, + currentHeader.sh_size); + } + break; + + case SHT_STRTAB: + if (strcmp(&shstrtab[currentHeader.sh_name], ".strtab") == 0) { + strtabndx = currentIndex; + } + break; + + default: + break; + } + } + + if (symbolTable == NULL) { + puts("No symtab found."); + free(sectionTable); + return; + } + + if (strtabndx != 0) { + printf("strtab found\n"); + printf("Size: %X bytes\n", sectionTable[strtabndx].sh_size); + strtab = malloc(sectionTable[strtabndx].sh_size); + printf("and mallocked\n"); + fseek(inputFile, sectionTable[strtabndx].sh_offset, SEEK_SET); + printf("file offset sought: %X\n", sectionTable[strtabndx].sh_offset); + assert(fread(strtab, sizeof(char), sectionTable[strtabndx].sh_size, inputFile) == + sectionTable[strtabndx].sh_size); + printf("file read\n"); + } + } + + { + size_t currentIndex; + printf("Symbol table\n"); + printf(" Num: Value Size Type Bind Vis Ndx Name\n"); + for (currentIndex = 0; currentIndex < symbolTableNum; currentIndex++) { + FairySym currentSymbol = symbolTable[currentIndex]; + printf("%4zd: ", currentIndex); + printf("%08X ", currentSymbol.st_value); + printf("%4X ", currentSymbol.st_size); + printf("%-11s ", Fairy_StringFromDefine(stTypes, ELF32_ST_TYPE(currentSymbol.st_info))); + printf("%-10s ", Fairy_StringFromDefine(stBinds, ELF32_ST_BIND(currentSymbol.st_info))); + printf("%-11s ", Fairy_StringFromDefine(stVisibilities, ELF32_ST_VISIBILITY(currentSymbol.st_other))); + + if (currentSymbol.st_shndx != 0) { + printf("%3X ", currentSymbol.st_shndx); + } else { + printf("UND "); + } + + if (strtab != NULL) { + printf("%s", &strtab[currentSymbol.st_name]); + } else { + printf("%4X ", currentSymbol.st_name); + } + putchar('\n'); + } + } + + free(sectionTable); + free(symbolTable); + if (strtab != NULL) { + free(strtab); + } +} + +void Fairy_PrintRelocs(FILE* inputFile) { + FairyFileHeader fileHeader; + FairySecHeader* sectionTable; + FairyRela* relocs; + size_t shstrndx; + char* shstrtab; + size_t currentSection; + + Fairy_ReadFileHeader(&fileHeader, inputFile); + sectionTable = malloc(fileHeader.e_shentsize * fileHeader.e_shnum); + shstrndx = fileHeader.e_shstrndx; + + Fairy_ReadSectionTable(sectionTable, inputFile, fileHeader.e_shoff, fileHeader.e_shnum); + + shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char)); + + fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET); + assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size); + + for (currentSection = 0; currentSection < fileHeader.e_shnum; currentSection++) { + size_t nRelocs; + + if (sectionTable[currentSection].sh_type != SHT_REL || sectionTable[currentSection].sh_type != SHT_RELA) { + continue; + } + printf("Section size: %d\n", sectionTable[currentSection].sh_size); + + nRelocs = Fairy_ReadRelocs(&relocs, inputFile, sectionTable[currentSection].sh_type, + sectionTable[currentSection].sh_offset, sectionTable[currentSection].sh_size); + + // fseek(inputFile, sectionTable[currentSection].sh_offset, SEEK_SET); + // assert(fread(relocs, sizeof(char), sectionTable[currentSection].sh_size, inputFile) == + // sectionTable[currentSection].sh_size); + + printf("Relocs in section [%2zd]: %s:\n", currentSection, shstrtab + sectionTable[currentSection].sh_name); + printf("Offset Info Type Symbol\n"); + { + size_t currentReloc; + for (currentReloc = 0; currentReloc < nRelocs; currentReloc++) { + printf("%08X,%08X ", relocs[currentReloc].r_offset, relocs[currentReloc].r_info); + + switch (ELF32_R_TYPE(relocs[currentReloc].r_info)) { + case R_MIPS_NONE: + printf("%-15s", "R_MIPS_NONE"); + break; + case R_MIPS_16: + printf("%-15s", "R_MIPS_16"); + break; + case R_MIPS_32: + printf("%-15s", "R_MIPS_32"); + break; + case R_MIPS_REL32: + printf("%-15s", "R_MIPS_REL32"); + break; + case R_MIPS_26: + printf("%-15s", "R_MIPS_26"); + break; + case R_MIPS_HI16: + printf("%-15s", "R_MIPS_HI16"); + break; + case R_MIPS_LO16: + printf("%-15s", "R_MIPS_LO16"); + break; + default: + break; + } + + printf("%X", ELF32_R_SYM(relocs[currentReloc].r_info)); + + putchar('\n'); + } + putchar('\n'); + } + putchar('\n'); + + free(relocs); + } + free(sectionTable); + free(shstrtab); +} + +void Fairy_PrintSectionTable(FILE* inputFile) { + FairyFileHeader fileHeader; + FairySecHeader* sectionTable; + size_t shstrndx; + char* shstrtab; + size_t currentSection; + + Fairy_ReadFileHeader(&fileHeader, inputFile); + sectionTable = malloc(fileHeader.e_shentsize * fileHeader.e_shnum); + shstrndx = fileHeader.e_shstrndx; + + Fairy_ReadSectionTable(sectionTable, inputFile, fileHeader.e_shoff, fileHeader.e_shnum); + + shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char)); + + fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET); + assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size); + + printf("[Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n"); + for (currentSection = 0; currentSection < fileHeader.e_shnum; currentSection++) { + FairySecHeader entry = sectionTable[currentSection]; + printf("[%2zd] ", currentSection); + printf("%-15s", shstrtab + entry.sh_name); + + printf("%-15s", Fairy_StringFromDefine(shTypes, entry.sh_type)); + + // printf("%08X ", entry.sh_type); + printf("%08X ", entry.sh_addr); + printf("%06X ", entry.sh_offset); + printf("%06X ", entry.sh_size); + printf("%02X ", entry.sh_entsize); + // printf("%08X ", entry.sh_flags); + + { + char flagChars[] = { 'W', 'A', 'X', 'M', 'S', 'I', 'L', 'O', 'G', 'T', 'C', 'x', 'o', 'E', 'p' }; + uint32_t flags = entry.sh_flags; + size_t shift; + int pad = 4; + for (shift = 0; shift < sizeof(flagChars); shift++) { + if ((flags >> shift) & 1) { + putchar(flagChars[shift]); + pad--; + } + } + if (pad > 0) { + printf("%*s", pad, ""); + } + } + + printf("%2X ", entry.sh_link); + printf("%3X ", entry.sh_info); + printf("%2X", entry.sh_addralign); + putchar('\n'); + } +} + +typedef enum { REL_SECTION_NONE, REL_SECTION_TEXT, REL_SECTION_DATA, REL_SECTION_RODATA } FairyOverlayRelSection; + +const char* relSectionStrings[] = { + NULL, + ".text", + ".data", + ".rodata", +}; + +static uint32_t Fairy_PackReloc(FairyOverlayRelSection sec, FairyRela rel) { + return (sec << 0x1E) | (ELF32_R_TYPE(rel.r_info) << 0x18) | rel.r_offset; +} + +void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size_t tableSize, char* shstrtab) { + size_t number = tableSize / sizeof(FairySecHeader); + FairySecHeader currentHeader; + char* sectionName; + size_t relocSectionsCount = 0; + size_t* relocSectionIndices; + int* relocSectionSection; + size_t currentRelocSection = 0; + FairySecHeader symtabHeader; + FairySym* symtab; + FairySecHeader strtabHeader; + char* strtab = NULL; + // size_t symtabSize; + + uint32_t textSize = 0; + uint32_t dataSize = 0; + uint32_t rodataSize = 0; + uint32_t bssSize = 0; + uint32_t relocCount = 0; + + size_t currentSection; + bool symtabFound = false; + bool strtabFound = false; + /* Count the reloc sections */ + for (currentSection = 0; currentSection < number; currentSection++) { + if (sectionTable[currentSection].sh_type == SHT_REL || sectionTable[currentSection].sh_type == SHT_RELA) { + relocSectionsCount++; + } + } + printf("relocSectionsCount: %zd\n", relocSectionsCount); + + relocSectionIndices = malloc(relocSectionsCount * sizeof(int)); + relocSectionSection = malloc(relocSectionsCount * sizeof(int)); + + /* Find the section sizes and the reloc sections */ + for (currentSection = 0; currentSection < number; currentSection++) { + size_t off = 0; + + currentHeader = sectionTable[currentSection]; + sectionName = &shstrtab[currentHeader.sh_name + 1]; /* ignore the initial '.' */ + switch (currentHeader.sh_type) { + case SHT_PROGBITS: + if (Fairy_StartsWith(sectionName, "rodata")) { + printf("rodata\n"); + rodataSize += currentHeader.sh_size; + break; + } + if (Fairy_StartsWith(sectionName, "data")) { + printf("data\n"); + dataSize += currentHeader.sh_size; + break; + } + if (Fairy_StartsWith(sectionName, "text")) { + printf("text\n"); + textSize += currentHeader.sh_size; + break; + } + break; + + case SHT_NOBITS: + if (Fairy_StartsWith(sectionName, "bss")) { + printf("bss\n"); + bssSize += currentHeader.sh_size; + } + break; + + case SHT_RELA: + off += 1; + case SHT_REL: + relocSectionIndices[currentRelocSection] = currentSection; + off += 4; /* ignore the "rel."/"rela." part */ + if (Fairy_StartsWith(§ionName[off], "rodata")) { + printf("%s\n", sectionName); + relocSectionSection[currentRelocSection] = REL_SECTION_RODATA; + } else if (Fairy_StartsWith(§ionName[off], "data")) { + printf("%s\n", sectionName); + relocSectionSection[currentRelocSection] = REL_SECTION_DATA; + } else if (Fairy_StartsWith(§ionName[off], "text")) { + printf("%s\n", sectionName); + relocSectionSection[currentRelocSection] = REL_SECTION_TEXT; + } + + currentRelocSection++; + break; + + case SHT_SYMTAB: + if (Fairy_StartsWith(sectionName, "symtab")) { + symtabHeader = currentHeader; + symtabFound = true; + } + break; + + case SHT_STRTAB: + if (Fairy_StartsWith(sectionName, "strtab")) { + strtabHeader = currentHeader; + strtabFound = true; + } + break; + + default: + break; + } + } + /* Can use symbols here too */ + puts(".section .ovl"); + printf("# OverlayInfo\n"); + printf(".word 0x%08X # .text size\n", textSize); + printf(".word 0x%08X # .data size\n", dataSize); + printf(".word 0x%08X # .rodata size\n", rodataSize); + printf(".word 0x%08X # .bss size\n\n", bssSize); + + if (!symtabFound) { + fprintf(stderr, "Symbol table not found\n"); + return; + } + /* Obtain the symbol table */ + // TODO: Consider replacing this with a lighter-weight read: sufficient to get the name, shndx + Fairy_ReadSymbolTable(&symtab, inputFile, symtabHeader.sh_offset, symtabHeader.sh_size); + + if (!strtabFound) { + fprintf(stderr, "String table not found\n"); + } else { + /* Obtain the string table */ + strtab = malloc(strtabHeader.sh_size); + fseek(inputFile, strtabHeader.sh_offset, SEEK_SET); + assert(fread(strtab, sizeof(char), strtabHeader.sh_size, inputFile) == strtabHeader.sh_size); + } + + /* Do single-file relocs */ + { + FairyRela* relocs; + for (currentSection = 0; currentSection < relocSectionsCount; currentSection++) { + size_t currentReloc; + size_t nRelocs; + + currentHeader = sectionTable[relocSectionIndices[currentSection]]; + nRelocs = Fairy_ReadRelocs(&relocs, inputFile, currentHeader.sh_type, currentHeader.sh_offset, + currentHeader.sh_size); + + for (currentReloc = 0; currentReloc < nRelocs; currentReloc++) { + FairySym symbol = symtab[ELF32_R_SYM(relocs[currentReloc].r_info)]; + if (symbol.st_shndx == SHN_UNDEF) { + continue; // TODO: this is where multifile has to look elsewhere + } + + printf(".word 0x%08X", Fairy_PackReloc(relocSectionSection[currentSection], relocs[currentReloc])); + printf(" # %X (%s), %X, 0x%06X", relocSectionSection[currentSection], &shstrtab[currentHeader.sh_name], + ELF32_R_TYPE(relocs[currentReloc].r_info), relocs[currentReloc].r_offset); + if (strtab != NULL) { + printf(", %s", &strtab[symbol.st_name]); + } + putchar('\n'); + + relocCount++; + } + + free(relocs); + } + } + + printf(".word %d # relocCount\n", relocCount); + + { + uint32_t ovlSectionSize = ((relocCount + 8) & ~0x03) * sizeof(uint32_t); + + printf("\n.word 0x%08X # Overlay section size\n", ovlSectionSize); + } + + free(relocSectionIndices); + free(relocSectionSection); + if (strtab != NULL) { + free(strtab); + } +} + +void PrintZeldaReloc(FILE* inputFile) { + FairyFileHeader fileHeader; + FairySecHeader* sectionTable; + size_t shstrndx; + char* shstrtab; + + Fairy_ReadFileHeader(&fileHeader, inputFile); + sectionTable = malloc(fileHeader.e_shentsize * fileHeader.e_shnum); + shstrndx = fileHeader.e_shstrndx; + + Fairy_ReadSectionTable(sectionTable, inputFile, fileHeader.e_shoff, fileHeader.e_shnum); + + shstrtab = malloc(sectionTable[shstrndx].sh_size * sizeof(char)); + + fseek(inputFile, sectionTable[shstrndx].sh_offset, SEEK_SET); + assert(fread(shstrtab, sizeof(char), sectionTable[shstrndx].sh_size, inputFile) == sectionTable[shstrndx].sh_size); + + Fairy_PrintSectionSizes(sectionTable, inputFile, fileHeader.e_shentsize * fileHeader.e_shnum, shstrtab); + + free(sectionTable); + free(shstrtab); +} diff --git a/tools/fado/lib/fairy/fairy_print.h b/tools/fado/lib/fairy/fairy_print.h new file mode 100644 index 000000000..85061be22 --- /dev/null +++ b/tools/fado/lib/fairy/fairy_print.h @@ -0,0 +1,7 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include + +void Fairy_PrintSymbolTable(FILE* inputFile); +void Fairy_PrintRelocs(FILE* inputFile); +void Fairy_PrintSectionTable(FILE* inputFile); diff --git a/tools/fado/lib/vc_vector/.gitrepo b/tools/fado/lib/vc_vector/.gitrepo new file mode 100644 index 000000000..7ab27b998 --- /dev/null +++ b/tools/fado/lib/vc_vector/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = git@github.com:skogorev/vc_vector.git + branch = master + commit = 39108a4b0aeb904636514b37f418c590084220a7 + parent = 462bee5811d54659236ca51481d01b76c69a37a7 + method = merge + cmdver = 0.4.3 diff --git a/tools/fado/lib/vc_vector/.travis.yml b/tools/fado/lib/vc_vector/.travis.yml new file mode 100644 index 000000000..f30dfb8e2 --- /dev/null +++ b/tools/fado/lib/vc_vector/.travis.yml @@ -0,0 +1,6 @@ +language: c +compiler: + - gcc + - clang +script: + - make && make test diff --git a/tools/fado/lib/vc_vector/LICENSE.md b/tools/fado/lib/vc_vector/LICENSE.md new file mode 100644 index 000000000..05929e19d --- /dev/null +++ b/tools/fado/lib/vc_vector/LICENSE.md @@ -0,0 +1,21 @@ +#The MIT License (MIT) + +*Copyright (c) 2016 Skogorev Anton* + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/fado/lib/vc_vector/Makefile b/tools/fado/lib/vc_vector/Makefile new file mode 100644 index 000000000..129ee97e3 --- /dev/null +++ b/tools/fado/lib/vc_vector/Makefile @@ -0,0 +1,33 @@ +OUT_DIR := build +CFLAGS := -O2 -g -std=c99 -Wall -Wextra -Wpedantic -Werror + +SRCS := $(wildcard *.c) +OBJS := $(patsubst %.c,$(OUT_DIR)/%.o,$(SRCS)) + +LIB_NAME := vc-vector +SOBJ := $(OUT_DIR)/lib$(LIB_NAME).so + +.PHONY: all lib test clean + +all: lib + +lib: $(SOBJ) + +test: $(OUT_DIR)/test_runner + $(OUT_DIR)/test_runner + +clean: + rm -rf $(OUT_DIR) + +$(OUT_DIR): + mkdir -p $(OUT_DIR) + +$(SOBJ): vc_vector.c | $(OUT_DIR) + $(CC) $(CFLAGS) -shared -fPIC $< -o $@ + +$(OUT_DIR)/%.o: %.c | $(OUT_DIR) + $(CC) $(CFLAGS) -c $< -o $@ + +$(OUT_DIR)/test_runner: $(OBJS) | $(OUT_DIR) + $(CC) $^ -o $@ + diff --git a/tools/fado/lib/vc_vector/README.md b/tools/fado/lib/vc_vector/README.md new file mode 100644 index 000000000..c8f8b2ae3 --- /dev/null +++ b/tools/fado/lib/vc_vector/README.md @@ -0,0 +1,92 @@ +# vc_vector +Fast simple C vector implementation + +[![Build Status: make && make test](https://travis-ci.org/skogorev/vc_vector.svg)](https://travis-ci.org/skogorev/vc_vector) + +## Usage + +### Basic +```c +#include "vc_vector.h" + +int main() { + // Creates an empty vector with the default reserved size + // and without custom deleter. Vector will contain 'int' + vc_vector* v = vc_vector_create(0, sizeof(int), NULL); + if (!v) { + return 1; + } + + const int count = 10; + for (int i = 0; i < count; ++i) { + // The function takes a pointer to the elements, + // but the vector will make a copy of the element + vc_vector_push_back(v, &i); + } + + // Print each vector element + for (void* i = vc_vector_begin(v); + i != vc_vector_end(v); + i = vc_vector_next(v, i)) { + printf("%u; ", *(int*)i); + } + + vc_vector_release(v); + return 0; +} +``` + +### Advanced +```c +#include "vc_vector.h" + +struct Item { + int val1; + int val2; +}; + +int main() { + const int n = 10; + + // Creates an empty vector with the reserved size for the 'n' elements + // and with custom deleter 'free'. Vector will contain pointers to 'Item' + vc_vector* v = vc_vector_create(n, sizeof(struct Node*), free); + if (!v) { + return 1; + } + + struct Item* item = NULL; + const int count = n + 1; + // Vector automatically increases the reserved size when 'n + 1' will be added + for (int i = 0; i < count; ++i) { + // Creating item + item = malloc(sizeof(struct Item)); + if (!item) { + continue; + } + + item->val1 = i; + item->val2 = 0; + + // Pushing to the end of the vector + if (!vc_vector_push_back(v, item)) { + // If the item was not pushed, you have to delete it + free(item); + } + } + + // ... + + // Calls custom deleter 'free' for all items + // and releases the vector + vc_vector_release(v); + return 0; +} +``` + +## Projects that use vc_vector +[kraken.io](https://kraken.io/) + +## License + +[MIT License](LICENSE.md) diff --git a/tools/fado/lib/vc_vector/vc_vector.c b/tools/fado/lib/vc_vector/vc_vector.c new file mode 100644 index 000000000..3f677c242 --- /dev/null +++ b/tools/fado/lib/vc_vector/vc_vector.c @@ -0,0 +1,329 @@ +#include "vc_vector.h" +#include +#include + +#define GROWTH_FACTOR 1.5 +#define DEFAULT_COUNT_OF_ELEMENTS 8 +#define MINIMUM_COUNT_OF_ELEMENTS 2 + +// ---------------------------------------------------------------------------- + +// vc_vector structure + +struct vc_vector { + size_t count; + size_t element_size; + size_t reserved_size; + char* data; + vc_vector_deleter* deleter; +}; + +// ---------------------------------------------------------------------------- + +// Auxiliary methods + +bool vc_vector_realloc(vc_vector* vector, size_t new_count) { + const size_t new_size = new_count * vector->element_size; + char* new_data = (char*)realloc(vector->data, new_size); + if (!new_data) { + return false; + } + + vector->reserved_size = new_size; + vector->data = new_data; + return true; +} + +// [first_index, last_index) +void vc_vector_call_deleter(vc_vector* vector, size_t first_index, size_t last_index) { + for (size_t i = first_index; i < last_index; ++i) { + vector->deleter(vc_vector_at(vector, i)); + } +} + +void vc_vector_call_deleter_all(vc_vector* vector) { + vc_vector_call_deleter(vector, 0, vc_vector_count(vector)); +} + +// ---------------------------------------------------------------------------- + +// Control + +vc_vector* vc_vector_create(size_t count_elements, size_t size_of_element, vc_vector_deleter* deleter) { + vc_vector* v = (vc_vector*)malloc(sizeof(vc_vector)); + if (v != NULL) { + v->data = NULL; + v->count = 0; + v->element_size = size_of_element; + v->deleter = deleter; + + if (count_elements < MINIMUM_COUNT_OF_ELEMENTS) { + count_elements = DEFAULT_COUNT_OF_ELEMENTS; + } + + if (size_of_element < 1 || + !vc_vector_realloc(v, count_elements)) { + free(v); + v = NULL; + } + } + + return v; +} + +vc_vector* vc_vector_create_copy(const vc_vector* vector) { + vc_vector* new_vector = vc_vector_create(vector->reserved_size / vector->count, + vector->element_size, + vector->deleter); + if (!new_vector) { + return new_vector; + } + + if (memcpy(vector->data, + new_vector->data, + new_vector->element_size * vector->count) == NULL) { + vc_vector_release(new_vector); + new_vector = NULL; + return new_vector; + } + + new_vector->count = vector->count; + return new_vector; +} + +void vc_vector_release(vc_vector* vector) { + if (vector->deleter != NULL) { + vc_vector_call_deleter_all(vector); + } + + if (vector->reserved_size != 0) { + free(vector->data); + } + + free(vector); +} + +bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2) { + const size_t size_vector1 = vc_vector_size(vector1); + if (size_vector1 != vc_vector_size(vector2)) { + return false; + } + + return memcmp(vector1->data, vector2->data, size_vector1) == 0; +} + +float vc_vector_get_growth_factor() { + return GROWTH_FACTOR; +} + +size_t vc_vector_get_default_count_of_elements() { + return DEFAULT_COUNT_OF_ELEMENTS; +} + +size_t vc_vector_struct_size() { + return sizeof(vc_vector); +} + +// ---------------------------------------------------------------------------- + +// Element access + +void* vc_vector_at(vc_vector* vector, size_t index) { + return vector->data + index * vector->element_size; +} + +void* vc_vector_front(vc_vector* vector) { + return vector->data; +} + +void* vc_vector_back(vc_vector* vector) { + return vector->data + (vector->count - 1) * vector->element_size; +} + +void* vc_vector_data(vc_vector* vector) { + return vector->data; +} + +// ---------------------------------------------------------------------------- + +// Iterators + +void* vc_vector_begin(vc_vector* vector) { + return vector->data; +} + +void* vc_vector_end(vc_vector* vector) { + return vector->data + vector->element_size * vector->count; +} + +void* vc_vector_next(vc_vector* vector, void* i) { + return (char *)i + vector->element_size; +} + +// ---------------------------------------------------------------------------- + +// Capacity + +bool vc_vector_empty(vc_vector* vector) { + return vector->count == 0; +} + +size_t vc_vector_count(const vc_vector* vector) { + return vector->count; +} + +size_t vc_vector_size(const vc_vector* vector) { + return vector->count * vector->element_size; +} + +size_t vc_vector_max_count(const vc_vector* vector) { + return vector->reserved_size / vector->element_size; +} + +size_t vc_vector_max_size(const vc_vector* vector) { + return vector->reserved_size; +} + +bool vc_vector_reserve_count(vc_vector* vector, size_t new_count) { + if (new_count < vector->count) { + return false; + } + + size_t new_size = vector->element_size * new_count; + if (new_size == vector->reserved_size) { + return true; + } + + return vc_vector_realloc(vector, new_count); +} + +bool vc_vector_reserve_size(vc_vector* vector, size_t new_size) { + return vc_vector_reserve_count(vector, new_size / vector->element_size); +} + +// ---------------------------------------------------------------------------- + +// Modifiers + +void vc_vector_clear(vc_vector* vector) { + if (vector->deleter != NULL) { + vc_vector_call_deleter_all(vector); + } + + vector->count = 0; +} + +bool vc_vector_insert(vc_vector* vector, size_t index, const void* value) { + if (vc_vector_max_count(vector) < vector->count + 1) { + if (!vc_vector_realloc(vector, vc_vector_max_count(vector) * GROWTH_FACTOR)) { + return false; + } + } + + if (!memmove(vc_vector_at(vector, index + 1), + vc_vector_at(vector, index), + vector->element_size * (vector->count - index))) { + + return false; + } + + if (memcpy(vc_vector_at(vector, index), + value, + vector->element_size) == NULL) { + return false; + } + + ++vector->count; + return true; +} + +bool vc_vector_erase(vc_vector* vector, size_t index) { + if (vector->deleter != NULL) { + vector->deleter(vc_vector_at(vector, index)); + } + + if (!memmove(vc_vector_at(vector, index), + vc_vector_at(vector, index + 1), + vector->element_size * (vector->count - index))) { + return false; + } + + vector->count--; + return true; +} + +bool vc_vector_erase_range(vc_vector* vector, size_t first_index, size_t last_index) { + if (vector->deleter != NULL) { + vc_vector_call_deleter(vector, first_index, last_index); + } + + if (!memmove(vc_vector_at(vector, first_index), + vc_vector_at(vector, last_index), + vector->element_size * (vector->count - last_index))) { + return false; + } + + vector->count -= last_index - first_index; + return true; +} + +bool vc_vector_append(vc_vector* vector, const void* values, size_t count) { + const size_t count_new = count + vc_vector_count(vector); + + if (vc_vector_max_count(vector) < count_new) { + size_t max_count_to_reserved = vc_vector_max_count(vector) * GROWTH_FACTOR; + while (count_new > max_count_to_reserved) { + max_count_to_reserved *= GROWTH_FACTOR; + } + + if (!vc_vector_realloc(vector, max_count_to_reserved)) { + return false; + } + } + + if (memcpy(vector->data + vector->count * vector->element_size, + values, + vector->element_size * count) == NULL) { + return false; + } + + vector->count = count_new; + return true; +} + +bool vc_vector_push_back(vc_vector* vector, const void* value) { + if (!vc_vector_append(vector, value, 1)) { + return false; + } + + return true; +} + +bool vc_vector_pop_back(vc_vector* vector) { + if (vector->deleter != NULL) { + vector->deleter(vc_vector_back(vector)); + } + + vector->count--; + return true; +} + +bool vc_vector_replace(vc_vector* vector, size_t index, const void* value) { + if (vector->deleter != NULL) { + vector->deleter(vc_vector_at(vector, index)); + } + + return memcpy(vc_vector_at(vector, index), + value, + vector->element_size) != NULL; +} + +bool vc_vector_replace_multiple(vc_vector* vector, size_t index, const void* values, size_t count) { + if (vector->deleter != NULL) { + vc_vector_call_deleter(vector, index, index + count); + } + + return memcpy(vc_vector_at(vector, index), + values, + vector->element_size * count) != NULL; +} diff --git a/tools/fado/lib/vc_vector/vc_vector.h b/tools/fado/lib/vc_vector/vc_vector.h new file mode 100644 index 000000000..2b1422c1a --- /dev/null +++ b/tools/fado/lib/vc_vector/vc_vector.h @@ -0,0 +1,120 @@ +#ifndef VCVECTOR_H +#define VCVECTOR_H + +#include +#include + +typedef struct vc_vector vc_vector; +typedef void (vc_vector_deleter)(void *); + +// ---------------------------------------------------------------------------- +// Control +// ---------------------------------------------------------------------------- + +// Constructs an empty vector with an reserver size for count_elements. +vc_vector* vc_vector_create(size_t count_elements, size_t size_of_element, vc_vector_deleter* deleter); + +// Constructs a copy of an existing vector. +vc_vector* vc_vector_create_copy(const vc_vector* vector); + +// Releases the vector. +void vc_vector_release(vc_vector* vector); + +// Compares vector content +bool vc_vector_is_equals(vc_vector* vector1, vc_vector* vector2); + +// Returns constant value of the vector growth factor. +float vc_vector_get_growth_factor(); + +// Returns constant value of the vector default count of elements. +size_t vc_vector_get_default_count_of_elements(); + +// Returns constant value of the vector struct size. +size_t vc_vector_struct_size(); + +// ---------------------------------------------------------------------------- +// Element access +// ---------------------------------------------------------------------------- + +// Returns the item at index position in the vector. +void* vc_vector_at(vc_vector* vector, size_t index); + +// Returns the first item in the vector. +void* vc_vector_front(vc_vector* vector); + +// Returns the last item in the vector. +void* vc_vector_back(vc_vector* vector); + +// Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector. +void* vc_vector_data(vc_vector* vector); + +// ---------------------------------------------------------------------------- +// Iterators +// ---------------------------------------------------------------------------- + +// Returns a pointer to the first item in the vector. +void* vc_vector_begin(vc_vector* vector); + +// Returns a pointer to the imaginary item after the last item in the vector. +void* vc_vector_end(vc_vector* vector); + +// Returns a pointer to the next element of vector after 'i'. +void* vc_vector_next(vc_vector* vector, void* i); + +// ---------------------------------------------------------------------------- +// Capacity +// ---------------------------------------------------------------------------- + +// Returns true if the vector is empty; otherwise returns false. +bool vc_vector_empty(vc_vector* vector); + +// Returns the number of elements in the vector. +size_t vc_vector_count(const vc_vector* vector); + +// Returns the size (in bytes) of occurrences of value in the vector. +size_t vc_vector_size(const vc_vector* vector); + +// Returns the maximum number of elements that the vector can hold. +size_t vc_vector_max_count(const vc_vector* vector); + +// Returns the maximum size (in bytes) that the vector can hold. +size_t vc_vector_max_size(const vc_vector* vector); + +// Resizes the container so that it contains n elements. +bool vc_vector_reserve_count(vc_vector* vector, size_t new_count); + +// Resizes the container so that it contains new_size / element_size elements. +bool vc_vector_reserve_size(vc_vector* vector, size_t new_size); + +// ---------------------------------------------------------------------------- +// Modifiers +// ---------------------------------------------------------------------------- + +// Removes all elements from the vector (without reallocation). +void vc_vector_clear(vc_vector* vector); + +// The container is extended by inserting a new element at position. +bool vc_vector_insert(vc_vector* vector, size_t index, const void* value); + +// Removes from the vector a single element by 'index' +bool vc_vector_erase(vc_vector* vector, size_t index); + +// Removes from the vector a range of elements '[first_index, last_index)'. +bool vc_vector_erase_range(vc_vector* vector, size_t first_index, size_t last_index); + +// Inserts multiple values at the end of the vector. +bool vc_vector_append(vc_vector* vector, const void* values, size_t count); + +// Inserts value at the end of the vector. +bool vc_vector_push_back(vc_vector* vector, const void* value); + +// Removes the last item in the vector. +bool vc_vector_pop_back(vc_vector* vector); + +// Replace value by index in the vector. +bool vc_vector_replace(vc_vector* vector, size_t index, const void* value); + +// Replace multiple values by index in the vector. +bool vc_vector_replace_multiple(vc_vector* vector, size_t index, const void* values, size_t count); + +#endif // VCVECTOR_H diff --git a/tools/fado/lib/vc_vector/vc_vector_test.c b/tools/fado/lib/vc_vector/vc_vector_test.c new file mode 100644 index 000000000..03a054420 --- /dev/null +++ b/tools/fado/lib/vc_vector/vc_vector_test.c @@ -0,0 +1,353 @@ +#include "vc_vector_test.h" +#include +#include +#include +#include "vc_vector.h" + +#define ASSERT_EQ(expected, actual) \ + do { \ + if ((expected) != (actual)) { \ + fprintf(stderr, \ + "Failed line %u. Expected: %"PRIuMAX". Actual: %"PRIuMAX".\n", \ + __LINE__, (uintmax_t)(expected), (uintmax_t)(actual)); \ + abort(); \ + } \ + } while (0) + +#define ASSERT_NE(not_expected, actual) \ + do { \ + if ((not_expected) == (actual)) { \ + fprintf(stderr, \ + "Failed line %u. Unexpected actual value: %"PRIuMAX".\n", \ + __LINE__, (uintmax_t)(actual)); \ + abort(); \ + } \ + } while (0) + +#define ASSERT_TRUE(actual) ASSERT_EQ(true, (actual)) + +#define ASSERT_FALSE(actual) ASSERT_EQ(false, (actual)) + +#define PRINT_VECTOR(vector, type, format) \ + do { \ + for (void* i = vc_vector_begin(vector); \ + i != vc_vector_end(vector); \ + i = vc_vector_next(vector, i)) { \ + fprintf(stderr, format, *(type*)i); \ + } \ + fprintf(stderr, "\n"); \ + } while (0) + +#define PRINT_VECTOR_INT(vector) PRINT_VECTOR(vector, int, "%d; ") +#define PRINT_VECTOR_STR(vector) PRINT_VECTOR(vector, char *, "%s; ") + +char *mystrdup(const char *s) { + size_t size = strlen(s) + 1; + char *copy = malloc(size); + if (copy != NULL) + memcpy(copy, s, size); + return copy; +} + +// ---------------------------------------------------------------------------- + +void test_vc_vector_create() { + const size_t size_of_type = sizeof(int); + const size_t default_count_of_elements = vc_vector_get_default_count_of_elements(); + + // Creating vector with default count of elements + vc_vector* vector = vc_vector_create(0, size_of_type, NULL); + ASSERT_NE(NULL, vector); + ASSERT_EQ(0, vc_vector_count(vector)); + ASSERT_EQ(0, vc_vector_size(vector)); + ASSERT_EQ(default_count_of_elements, vc_vector_max_count(vector)); + ASSERT_EQ(size_of_type * default_count_of_elements, vc_vector_max_size(vector)); + vc_vector_release(vector); + + // Creating vector with custom count of elements + const size_t test_count_of_elements = 7; + vector = vc_vector_create(test_count_of_elements, size_of_type, NULL); + ASSERT_NE(NULL, vector); + ASSERT_EQ(0, vc_vector_count(vector)); + ASSERT_EQ(0, vc_vector_size(vector)); + ASSERT_EQ(test_count_of_elements, vc_vector_max_count(vector)); + ASSERT_EQ(size_of_type * test_count_of_elements, vc_vector_max_size(vector)); + vc_vector_release(vector); + + // Creating vector with zero size of single element + vector = vc_vector_create(0, 0, NULL); + ASSERT_EQ(NULL, vector); + + // Creating copy of vector + vector = vc_vector_create(0, size_of_type, NULL); + ASSERT_NE(NULL, vector); + for (int i = 0; (size_t)i < test_count_of_elements; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &i)); + } + + vc_vector* vector_copy = vc_vector_create_copy(vector); + ASSERT_NE(NULL, vector_copy); + ASSERT_TRUE(vc_vector_is_equals(vector, vector_copy)); + + vc_vector_release(vector_copy); + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void test_vc_vector_element_access() { + const int test_num_start = 18; + const int test_num_end = 36; + const size_t size_of_type = sizeof(test_num_start); + + vc_vector* vector = vc_vector_create(0, size_of_type, NULL); + ASSERT_NE(0, vector); + for (int i = test_num_start; i <= test_num_end; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &i)); + } + + ASSERT_EQ(test_num_start, *(int*)vc_vector_front(vector)); + ASSERT_EQ(test_num_start, *(int*)vc_vector_data(vector)); + ASSERT_EQ(test_num_end, *(int*)vc_vector_back(vector)); + + for (int i = test_num_start, j = 0; i <= test_num_end; ++i, ++j) { + ASSERT_EQ(i, *(int*)vc_vector_at(vector, j)); + } + + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void test_vc_vector_iterators() { + vc_vector* vector = vc_vector_create(0, sizeof(int), NULL); + ASSERT_NE(NULL, vector); + + const size_t test_count_of_elements = 23; + for (int i = 0; (size_t)i < test_count_of_elements; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &i)); + } + + int j = 0; + for (void* i = vc_vector_begin(vector); + i != vc_vector_end(vector); + i = vc_vector_next(vector, i), ++j) { + ASSERT_EQ(j, *(int*)i); + } + + ASSERT_EQ(test_count_of_elements, (size_t)j); + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void test_vc_vector_capacity() { + const size_t size_of_element = sizeof(int); + const float growth_factor = vc_vector_get_growth_factor(); + ASSERT_EQ(1.5, growth_factor); + + const size_t count_of_elements_initialized = 22; + const size_t max_size_of_vector_initialized = count_of_elements_initialized * size_of_element; + const size_t count_of_elements_ended = 23; + const size_t size_of_vector_ended = count_of_elements_ended * size_of_element; + const size_t max_count_of_vector_ended = count_of_elements_initialized * growth_factor; + const size_t max_size_of_vector_ended = max_count_of_vector_ended * size_of_element; + + vc_vector* vector = vc_vector_create(count_of_elements_initialized, size_of_element, NULL); + ASSERT_NE(NULL, vector); + + ASSERT_EQ(0, vc_vector_count(vector)); + ASSERT_TRUE(vc_vector_empty(vector)); + ASSERT_EQ(0, vc_vector_size(vector)); + ASSERT_EQ(count_of_elements_initialized, vc_vector_max_count(vector)); + ASSERT_EQ(max_size_of_vector_initialized, vc_vector_max_size(vector)); + + for (int i = 0; (size_t)i < count_of_elements_ended; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &i)); + } + + ASSERT_EQ(count_of_elements_ended, vc_vector_count(vector)); + ASSERT_FALSE(vc_vector_empty(vector)); + ASSERT_EQ(size_of_vector_ended, vc_vector_size(vector)); + ASSERT_EQ(max_count_of_vector_ended, vc_vector_max_count(vector)); + ASSERT_EQ(max_size_of_vector_ended, vc_vector_max_size(vector)); + + const size_t test_reserve_count_fail = 10; + ASSERT_FALSE(vc_vector_reserve_count(vector, test_reserve_count_fail)); + + const size_t test_reserve_count = 35; + ASSERT_TRUE(vc_vector_reserve_count(vector, test_reserve_count)); + ASSERT_EQ(test_reserve_count, vc_vector_max_count(vector)); + ASSERT_EQ(test_reserve_count * size_of_element, vc_vector_max_size(vector)); + + // Second time with the same value + ASSERT_TRUE(vc_vector_reserve_count(vector, test_reserve_count)); + ASSERT_EQ(test_reserve_count, vc_vector_max_count(vector)); + ASSERT_EQ(test_reserve_count * size_of_element, vc_vector_max_size(vector)); + + const size_t test_reserve_size = 123 * size_of_element; + ASSERT_TRUE(vc_vector_reserve_size(vector, test_reserve_size)); + ASSERT_EQ(test_reserve_size / size_of_element, vc_vector_max_count(vector)); + ASSERT_EQ(test_reserve_size, vc_vector_max_size(vector)); + + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void test_vc_vector_modifiers() { + const int begin[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 + }; + const size_t size_of_element = sizeof(begin[0]); + const size_t count_of_elements = sizeof(begin) / size_of_element; + + // After deleting first, last and one middle elements + const int after_deleting_some_elements[] = { + /* 1, */ 2, 3, 4, 5, 6, 7, 8, 9, 10, /* 11, */ 12, 13, 14, 15, 16, 17, 18, 19, /* 20 */ + }; + + // After deleting first 3 elemets from begin, 4 from middle and 3 from end + const int after_deleting_some_ranges[] = { + /* 1, 2, 3, */ 4, 5, 6, 7, 8, /* 9, 10, 11, 12, */ 13, 14, 15, 16, 17, /* 18, 19, 20 */ + }; + + vc_vector* vector = vc_vector_create(0, size_of_element, NULL); + ASSERT_NE(NULL, vector); + + // Append test + + ASSERT_TRUE(vc_vector_append(vector, begin, count_of_elements)); + + ASSERT_EQ(count_of_elements, vc_vector_count(vector)); + for (size_t i = 0; i < vc_vector_count(vector); ++i) { + ASSERT_EQ(begin[i], *(int*)vc_vector_at(vector, i)); + } + + // Pop back test + + while (vc_vector_count(vector) > 0) { + ASSERT_TRUE(vc_vector_pop_back(vector)); + } + + ASSERT_TRUE(vc_vector_empty(vector)); + + // Push back test + + for (size_t i = 0; i < count_of_elements; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &begin[i])); + } + + ASSERT_EQ(count_of_elements, vc_vector_count(vector)); + for (size_t i = 0; i < vc_vector_count(vector); ++i) { + ASSERT_EQ(begin[i], *(int*)vc_vector_at(vector, i)); + } + + // Erase test + + vc_vector_clear(vector); + ASSERT_TRUE(vc_vector_append(vector, begin, count_of_elements)); + + ASSERT_TRUE(vc_vector_erase(vector, 0)); + ASSERT_TRUE(vc_vector_erase(vector, vc_vector_count(vector) - 1)); + ASSERT_TRUE(vc_vector_erase(vector, vc_vector_count(vector) / 2)); + + ASSERT_EQ(sizeof(after_deleting_some_elements) / size_of_element, vc_vector_count(vector)); + for (size_t i = 0; i < vc_vector_count(vector); ++i) { + ASSERT_EQ(after_deleting_some_elements[i], *(int*)vc_vector_at(vector, i)); + } + + // Erase range test + + vc_vector_clear(vector); + ASSERT_TRUE(vc_vector_append(vector, begin, count_of_elements)); + + ASSERT_TRUE(vc_vector_erase_range(vector, 0, 3)); + ASSERT_TRUE(vc_vector_erase_range(vector, vc_vector_count(vector) - 3, vc_vector_count(vector))); + ASSERT_TRUE(vc_vector_erase_range(vector, vc_vector_count(vector) / 2 - 2, vc_vector_count(vector) / 2 + 2)); + + ASSERT_EQ(sizeof(after_deleting_some_ranges) / size_of_element, vc_vector_count(vector)); + for (size_t i = 0; i < vc_vector_count(vector); ++i) { + ASSERT_EQ(after_deleting_some_ranges[i], *(int*)vc_vector_at(vector, i)); + } + + // Insert test + + vc_vector_clear(vector); + for (size_t i = 1; i < count_of_elements - 1; ++i) { + ASSERT_TRUE(vc_vector_insert(vector, i - 1, &begin[i])); + } + + ASSERT_TRUE(vc_vector_insert(vector, 0, &begin[0])); + ASSERT_TRUE(vc_vector_insert(vector, vc_vector_count(vector), &begin[count_of_elements - 1])); + + ASSERT_EQ(count_of_elements, vc_vector_count(vector)); + for (size_t i = 0; i < vc_vector_count(vector); ++i) { + ASSERT_EQ(begin[i], *(int*)vc_vector_at(vector, i)); + } + + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void test_vc_vector_strfreefunc(void *data) { + free(*(char **)data); +} + +void test_vc_vector_with_strfreefunc() { + // creates a vector of pointers to char, i.e. a vector of variable sized strings + vc_vector* vector = vc_vector_create(3, sizeof(char *), test_vc_vector_strfreefunc); + ASSERT_NE(NULL, vector); + + char *strs[] = { + mystrdup("abcde"), + mystrdup("edcba"), + mystrdup("1234554321"), + mystrdup("!@#$%"), + mystrdup("not empty string"), + mystrdup(""), + mystrdup("Hello World"), + mystrdup("xxxxx"), + mystrdup("yyyyy") + }; + + for (size_t i = 0; i < 3; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &strs[i])); + } + + ASSERT_EQ(3, vc_vector_count(vector)); + + for (size_t i = 3; i < 6; ++i) { + ASSERT_TRUE(vc_vector_insert(vector, i, &strs[i])); + } + + ASSERT_EQ(6, vc_vector_count(vector)); + vc_vector_clear(vector); // strs[0-6] were freed + ASSERT_EQ(0, vc_vector_count(vector)); + + for (size_t i = 6; i < 9; ++i) { + ASSERT_TRUE(vc_vector_push_back(vector, &strs[i])); + } + + ASSERT_EQ(3, vc_vector_count(vector)); + + vc_vector_release(vector); + + printf("%s passed.\n", __func__); +} + +void vc_vector_run_tests() { + test_vc_vector_create(); + test_vc_vector_element_access(); + test_vc_vector_iterators(); + test_vc_vector_capacity(); + test_vc_vector_modifiers(); + test_vc_vector_with_strfreefunc(); +} + +int main() { + vc_vector_run_tests(); + printf("Tests passed.\n"); + return 0; +} diff --git a/tools/fado/lib/vc_vector/vc_vector_test.h b/tools/fado/lib/vc_vector/vc_vector_test.h new file mode 100644 index 000000000..9439ea3c6 --- /dev/null +++ b/tools/fado/lib/vc_vector/vc_vector_test.h @@ -0,0 +1,6 @@ +#ifndef VCVECTORTESTS_H +#define VCVECTORTESTS_H + +void vc_vector_run_tests(); + +#endif // VCVECTORTESTS_H diff --git a/tools/fado/ovl_En_Hs_reloc.s b/tools/fado/ovl_En_Hs_reloc.s new file mode 100644 index 000000000..d41d172d1 --- /dev/null +++ b/tools/fado/ovl_En_Hs_reloc.s @@ -0,0 +1,46 @@ +.section .ovl +# ovl_En_Hs2OverlayInfo +.word _ovl_En_Hs2SegmentTextSize +.word _ovl_En_Hs2SegmentDataSize +.word _ovl_En_Hs2SegmentRoDataSize +.word _ovl_En_Hs2SegmentBssSize + +.word 28 # relocCount + +# TEXT RELOCS +.word 0x45000084 # R_MIPS_HI16 0x000084 .data +.word 0x4600008C # R_MIPS_LO16 0x00008C .data +.word 0x450000B4 # R_MIPS_HI16 0x0000B4 .rodata +.word 0x460000BC # R_MIPS_LO16 0x0000BC .rodata +.word 0x450000C0 # R_MIPS_HI16 0x0000C0 func_80A6F1A4 +.word 0x460000C4 # R_MIPS_LO16 0x0000C4 func_80A6F1A4 +.word 0x450001DC # R_MIPS_HI16 0x0001DC func_80A6F1A4 +.word 0x460001E0 # R_MIPS_LO16 0x0001E0 func_80A6F1A4 +.word 0x4500022C # R_MIPS_HI16 0x00022C func_80A6F164 +.word 0x46000230 # R_MIPS_LO16 0x000230 func_80A6F164 +.word 0x44000238 # R_MIPS_26 0x000238 func_80A6F0B4 +.word 0x450003D0 # R_MIPS_HI16 0x0003D0 .rodata +.word 0x460003D8 # R_MIPS_LO16 0x0003D8 .rodata +.word 0x45000460 # R_MIPS_HI16 0x000460 .data +.word 0x46000464 # R_MIPS_LO16 0x000464 .data +.word 0x4500049C # R_MIPS_HI16 0x00049C EnHs2_OverrideLimbDraw +.word 0x460004B4 # R_MIPS_LO16 0x0004B4 EnHs2_OverrideLimbDraw +.word 0x450004A0 # R_MIPS_HI16 0x0004A0 EnHs2_PostLimbDraw +.word 0x460004B0 # R_MIPS_LO16 0x0004B0 EnHs2_PostLimbDraw + +# DATA RELOCS +.word 0x82000010 # R_MIPS_32 0x000010 EnHs2_Init +.word 0x82000014 # R_MIPS_32 0x000014 EnHs2_Destroy +.word 0x82000018 # R_MIPS_32 0x000018 EnHs2_Update +.word 0x8200001C # R_MIPS_32 0x00001C EnHs2_Draw + +# RODATA RELOCS +.word 0xC2000020 # R_MIPS_32 0x000020 .text +.word 0xC2000024 # R_MIPS_32 0x000024 .text +.word 0xC2000028 # R_MIPS_32 0x000028 .text +.word 0xC200002C # R_MIPS_32 0x00002C .text +.word 0xC2000030 # R_MIPS_32 0x000030 .text +.word 0 +.word 0 + +.word 0x00000090 # ovl_En_Hs2OverlayInfoOffset diff --git a/tools/fado/src/fado.c b/tools/fado/src/fado.c new file mode 100644 index 000000000..464f8855b --- /dev/null +++ b/tools/fado/src/fado.c @@ -0,0 +1,308 @@ +/** + * Code specific to reading and outputting Zelda 64 relocations + */ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include "fado.h" + +#include +#include +#include +#include +#include +#include +#include "fairy/fairy.h" +#include "macros.h" +#include "vc_vector/vc_vector.h" + +/* String-finding-related functions */ + +bool Fado_CheckInProgBitsSections(Elf32_Section section, vc_vector* progBitsSections) { + Elf32_Section* i; + VC_FOREACH(i, progBitsSections) { + if (*i == section) { + return true; + } + } + return false; +} + +/** + * For each input file, construct a vector of pointers to the starts of the strings defined in that file. + */ +void Fado_ConstructStringVectors(vc_vector** stringVectors, FairyFileInfo* fileInfo, int numFiles) { + int currentFile; + size_t currentSym; + + for (currentFile = 0; currentFile < numFiles; currentFile++) { + FairySym* symtab = fileInfo[currentFile].symtabInfo.sectionData; + + stringVectors[currentFile] = vc_vector_create(0x40, sizeof(char**), NULL); + + /* Build a vector of pointers to defined symbols' names */ + for (currentSym = 0; currentSym < fileInfo[currentFile].symtabInfo.sectionEntryCount; currentSym++) { + if ((symtab[currentSym].st_shndx != STN_UNDEF) && + Fado_CheckInProgBitsSections(symtab[currentSym].st_shndx, fileInfo[currentFile].progBitsSections)) { + /* Have to pass a double pointer so it copies the pointer instead of the start of the string */ + char* stringPtr = &fileInfo[currentFile].strtab[symtab[currentSym].st_name]; + assert(vc_vector_push_back(stringVectors[currentFile], &stringPtr)); + } + } + } +} + +bool Fado_FindSymbolNameInOtherFiles(const char* name, int thisFile, vc_vector** stringVectors, int numFiles) { + int currentFile; + char** currentString; + + for (currentFile = 0; currentFile < numFiles; currentFile++) { + if (currentFile == thisFile) { + continue; + } + VC_FOREACH(currentString, stringVectors[currentFile]) { + if (strcmp(name, *currentString) == 0) { + FAIRY_DEBUG_PRINTF("Match found for %s\n", name); + return true; + } + } + } + FAIRY_DEBUG_PRINTF("No match found for %s\n", name); + return false; +} + +void Fado_DestroyStringVectors(vc_vector** stringVectors, int numFiles) { + int currentFile; + for (currentFile = 0; currentFile < numFiles; currentFile++) { + vc_vector_release(stringVectors[currentFile]); + } + free(stringVectors); +} + +typedef struct { + size_t symbolIndex; + int file; + uint32_t relocWord; +} FadoRelocInfo; + +/* Construct the Zelda64ovl-compatible reloc word from an ELF reloc */ +FadoRelocInfo Fado_MakeReloc(int file, FairySection section, FairyRela* data) { + FadoRelocInfo relocInfo = { 0 }; + uint32_t sectionPrefix = 0; + + relocInfo.symbolIndex = ELF32_R_SYM(data->r_info); + relocInfo.file = file; + + switch (section) { + case FAIRY_SECTION_TEXT: + sectionPrefix = 1; + break; + + case FAIRY_SECTION_DATA: + sectionPrefix = 2; + break; + + case FAIRY_SECTION_RODATA: + sectionPrefix = 3; + break; + + default: + fprintf(stderr, "warning: Relocation section is invalid.\n"); + break; + } + relocInfo.relocWord = + ((sectionPrefix & 3) << 0x1E) | (ELF32_R_TYPE(data->r_info) << 0x18) | (data->r_offset & 0xFFFFFF); + + return relocInfo; +} + +static const FairyDefineString relSectionNames[] = { + FAIRY_DEF_STRING(FAIRY_SECTION_, TEXT), + FAIRY_DEF_STRING(FAIRY_SECTION_, DATA), + FAIRY_DEF_STRING(FAIRY_SECTION_, RODATA), + { 0 }, +}; + +/* Taken from elf.h/mips_elf.h */ +static const FairyDefineString relTypeNames[] = { + FAIRY_DEF_STRING(, R_MIPS_NONE), /* No reloc */ + FAIRY_DEF_STRING(, R_MIPS_16), /* Direct 16 bit */ + FAIRY_DEF_STRING(, R_MIPS_32), /* Direct 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_REL32), /* PC relative 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_26), /* Direct 26 bit shifted */ + FAIRY_DEF_STRING(, R_MIPS_HI16), /* High 16 bit */ + FAIRY_DEF_STRING(, R_MIPS_LO16), /* Low 16 bit */ + FAIRY_DEF_STRING(, R_MIPS_GPREL16), /* GP relative 16 bit */ + FAIRY_DEF_STRING(, R_MIPS_LITERAL), /* 16 bit literal entry */ + FAIRY_DEF_STRING(, R_MIPS_GOT16), /* 16 bit GOT entry */ + FAIRY_DEF_STRING(, R_MIPS_PC16), /* PC relative 16 bit */ + FAIRY_DEF_STRING(, R_MIPS_CALL16), /* 16 bit GOT entry for function */ + FAIRY_DEF_STRING(, R_MIPS_GPREL32), /* GP relative 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_SHIFT5), + FAIRY_DEF_STRING(, R_MIPS_SHIFT6), + FAIRY_DEF_STRING(, R_MIPS_64), + FAIRY_DEF_STRING(, R_MIPS_GOT_DISP), + FAIRY_DEF_STRING(, R_MIPS_GOT_PAGE), + FAIRY_DEF_STRING(, R_MIPS_GOT_OFST), + FAIRY_DEF_STRING(, R_MIPS_GOT_HI16), + FAIRY_DEF_STRING(, R_MIPS_GOT_LO16), + FAIRY_DEF_STRING(, R_MIPS_SUB), + FAIRY_DEF_STRING(, R_MIPS_INSERT_A), + FAIRY_DEF_STRING(, R_MIPS_INSERT_B), + FAIRY_DEF_STRING(, R_MIPS_DELETE), + FAIRY_DEF_STRING(, R_MIPS_HIGHER), + FAIRY_DEF_STRING(, R_MIPS_HIGHEST), + FAIRY_DEF_STRING(, R_MIPS_CALL_HI16), + FAIRY_DEF_STRING(, R_MIPS_CALL_LO16), + FAIRY_DEF_STRING(, R_MIPS_SCN_DISP), + FAIRY_DEF_STRING(, R_MIPS_REL16), + FAIRY_DEF_STRING(, R_MIPS_ADD_IMMEDIATE), + FAIRY_DEF_STRING(, R_MIPS_PJUMP), + FAIRY_DEF_STRING(, R_MIPS_RELGOT), + FAIRY_DEF_STRING(, R_MIPS_JALR), + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPMOD32), /* Module number 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPREL32), /* Module-relative offset 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPMOD64), /* Module number 64 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPREL64), /* Module-relative offset 64 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_GD), /* 16 bit GOT offset for GD */ + FAIRY_DEF_STRING(, R_MIPS_TLS_LDM), /* 16 bit GOT offset for LDM */ + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPREL_HI16), /* Module-relative offset, high 16 bits */ + FAIRY_DEF_STRING(, R_MIPS_TLS_DTPREL_LO16), /* Module-relative offset, low 16 bits */ + FAIRY_DEF_STRING(, R_MIPS_TLS_GOTTPREL), /* 16 bit GOT offset for IE */ + FAIRY_DEF_STRING(, R_MIPS_TLS_TPREL32), /* TP-relative offset, 32 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_TPREL64), /* TP-relative offset, 64 bit */ + FAIRY_DEF_STRING(, R_MIPS_TLS_TPREL_HI16), /* TP-relative offset, high 16 bits */ + FAIRY_DEF_STRING(, R_MIPS_TLS_TPREL_LO16), /* TP-relative offset, low 16 bits */ + FAIRY_DEF_STRING(, R_MIPS_GLOB_DAT), + FAIRY_DEF_STRING(, R_MIPS_COPY), + FAIRY_DEF_STRING(, R_MIPS_JUMP_SLOT), + FAIRY_DEF_STRING(, R_MIPS_NUM), +}; + +/** + * Find all the necessary relocations to retain (those defined in any input file), and print them in the appropriate + * format. + */ +void Fado_Relocs(FILE* outputFile, int inputFilesCount, FILE** inputFiles, const char* ovlName) { + /* General information structs */ + FairyFileInfo* fileInfos = malloc(inputFilesCount * sizeof(FairyFileInfo)); + + /* Symbol tables for each file */ + FairySym** symtabs = malloc(inputFilesCount * sizeof(FairySym*)); + + /* Lists of names of symbols defined in files of the overlay */ + vc_vector** stringVectors = malloc(inputFilesCount * sizeof(vc_vector*)); + + /* The relocs in the format we will print */ + vc_vector* relocList[FAIRY_SECTION_OTHER]; /* Maximum number of reloc sections */ + + /* Offset of current file's current section into the overlay's whole section */ + uint32_t sectionOffset[FAIRY_SECTION_OTHER] = { 0 }; + + /* Total number of relocs */ + uint32_t relocCount = 0; + + /* iterators */ + int currentFile; + FairySection section; + size_t relocIndex; + + for (currentFile = 0; currentFile < inputFilesCount; currentFile++) { + FAIRY_INFO_PRINTF("Begin initialising file %d info.\n", currentFile); + Fairy_InitFile(&fileInfos[currentFile], inputFiles[currentFile]); + FAIRY_INFO_PRINTF("Initialising file %d info complete.\n", currentFile); + + symtabs[currentFile] = fileInfos[currentFile].symtabInfo.sectionData; + } + + Fado_ConstructStringVectors(stringVectors, fileInfos, inputFilesCount); + FAIRY_INFO_PRINTF("%s", "symtabs set\n"); + + /* Construct relocList of all relevant relocs */ + for (section = FAIRY_SECTION_TEXT; section < FAIRY_SECTION_OTHER; section++) { + relocList[section] = vc_vector_create(0x100, sizeof(FadoRelocInfo), NULL); + + for (currentFile = 0; currentFile < inputFilesCount; currentFile++) { + FairyRela* relSection = fileInfos[currentFile].relocTablesInfo[section].sectionData; + + if (relSection != NULL) { + for (relocIndex = 0; relocIndex < fileInfos[currentFile].relocTablesInfo[section].sectionEntryCount; + relocIndex++) { + FadoRelocInfo currentReloc = Fado_MakeReloc(currentFile, section, &relSection[relocIndex]); + + if ((symtabs[currentFile][currentReloc.symbolIndex].st_shndx != STN_UNDEF) || + Fado_FindSymbolNameInOtherFiles( + &fileInfos[currentFile].strtab[symtabs[currentFile][currentReloc.symbolIndex].st_name], + currentFile, stringVectors, inputFilesCount)) { + + currentReloc.relocWord += sectionOffset[section]; + FAIRY_DEBUG_PRINTF("current section offset: %d\n", sectionOffset[section]); + vc_vector_push_back(relocList[section], ¤tReloc); + relocCount++; + } + } + } else { + FAIRY_INFO_PRINTF("%s", "Ignoring empty reloc section\n"); + } + + sectionOffset[section] += fileInfos[currentFile].progBitsSizes[section]; + FAIRY_INFO_PRINTF("section offset: %d\n", sectionOffset[section]); + } + } + + { + /* Write header */ + fprintf(outputFile, ".section .ovl\n"); + fprintf(outputFile, "# %sOverlayInfo\n", ovlName); + fprintf(outputFile, ".word _%sSegmentTextSize\n", ovlName); + fprintf(outputFile, ".word _%sSegmentDataSize\n", ovlName); + fprintf(outputFile, ".word _%sSegmentRoDataSize\n", ovlName); + fprintf(outputFile, ".word _%sSegmentBssSize\n", ovlName); + + fprintf(outputFile, "\n.word %d # relocCount\n", relocCount); + + /* Write reloc table */ + for (section = FAIRY_SECTION_TEXT; section < FAIRY_SECTION_OTHER; section++) { + if (vc_vector_count(relocList[section]) == 0) { + FAIRY_INFO_PRINTF("%s", "Ignoring empty reloc section\n"); + continue; + } + + fprintf(outputFile, "\n# %s RELOCS\n", Fairy_StringFromDefine(relSectionNames, section)); + + { + FadoRelocInfo* currentReloc; + VC_FOREACH(currentReloc, relocList[section]) { + fprintf(outputFile, ".word 0x%X # %-11s 0x%06X %s\n", currentReloc->relocWord, + Fairy_StringFromDefine(relTypeNames, (currentReloc->relocWord >> 0x18) & 0x3F), + currentReloc->relocWord & 0xFFFFFF, + Fairy_GetSymbolName(symtabs[currentReloc->file], fileInfos[currentReloc->file].strtab, + currentReloc->symbolIndex)); + } + } + } + + /* print pads and section size */ + for (relocCount += 5; ((relocCount + 1) & 3) != 0; relocCount++) { + fprintf(outputFile, ".word 0\n"); + } + fprintf(outputFile, "\n.word 0x%08X # %sOverlayInfoOffset\n", 4 * (relocCount + 1), ovlName); + } + + for (currentFile = 0; currentFile < inputFilesCount; currentFile++) { + Fairy_DestroyFile(&fileInfos[currentFile]); + FAIRY_INFO_PRINTF("Freed file %d\n", currentFile); + } + + for (section = FAIRY_SECTION_TEXT; section < FAIRY_SECTION_OTHER; section++) { + if (relocList[section] != NULL) { + vc_vector_release(relocList[section]); + } + FAIRY_INFO_PRINTF("Freed relocList[%d]\n", section); + } + + Fado_DestroyStringVectors(stringVectors, inputFilesCount); + FAIRY_INFO_PRINTF("%s", "Freed string vectors\n"); + free(symtabs); + FAIRY_INFO_PRINTF("%s", "Freed symtabs\n"); + free(fileInfos); +} diff --git a/tools/fado/src/help.c b/tools/fado/src/help.c new file mode 100644 index 000000000..1f0580732 --- /dev/null +++ b/tools/fado/src/help.c @@ -0,0 +1,162 @@ +/** + * Getopt-compatible printing of formatted help. + */ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include "help.h" + +#include +#include +#include +#include +#include +#include + +#include "macros.h" + +/* Values of the variables used by Help_PrintHelp. Defaults are taken from common terminal programs like grep */ +size_t helpTextWidth = 80; +size_t helpDtIndent = 2; +size_t helpDdIndent = 25; + +/** + * Prints a paragraph, word wrapped to helpTextWidth, with a hanging indent. initialColumn is used to determine how wide + * the first line should be, while indentFirstLine should be true if there is no previous text on the line (an ordinary + * paragraph), and false if there is (e.g. as a description list description) + */ +void Help_PrintFlowAndIndent(const char* string, size_t initialColumn, size_t textWidth, size_t hangingIndent, + bool indentFirstLine) { + size_t column = initialColumn; + size_t index = 0; + size_t inLength = strlen(string); + size_t lookAhead; + bool shouldBreak; + + assert(initialColumn < textWidth); + assert(hangingIndent < textWidth); + + if (indentFirstLine) { + printf("%*s", (int)initialColumn, ""); + } + + for (; index <= inLength; index++) { + shouldBreak = 0; + + if (column == textWidth) { + printf("%c\n%*s", string[index], (int)hangingIndent, ""); + column = hangingIndent; + continue; + } + + column++; + + switch (string[index]) { + case '\0': + return; + + case ' ': + if (column == hangingIndent) { + continue; + } + + for (lookAhead = 0; lookAhead <= textWidth - column; lookAhead++) { + // printf("%c\n", src[index + lookAhead]); + if (string[index + lookAhead + 1] == ' ' || string[index + lookAhead + 1] == '\0') { + putchar(' '); + shouldBreak = 1; + break; + } + } + if (shouldBreak) { /* Damn shared keywords. */ + break; + } + case '\n': + printf("\n%*s", (int)hangingIndent, ""); + column = hangingIndent; + break; + + default: + putchar(string[index]); + break; + } + } +} + +/** + * Prints help in the form + * ``` + * prologue (word wrapped) + * + * Positional arguments + * arg1 Description (word + * wrapped) + * arg2 Description (word + * wrapped) + * + * Options + * -a --long-name=ARG Description (word + * wrapped) + * + * epilogue (word wrapped) + * ``` + * where the positional arguments are described using the posArgInfo array, and options are fed using the OptInfo array, + * which should both be null-terminated. posArgCount/optCount is the actual number of positional arguments/options: it + * is used to guarantee no garbage is printed even if the user has not null-terminated the array. (optCount is required + * for constructing the getopt option array anyway.) + */ +void Help_PrintHelp(const char* prologue, size_t posArgCount, const PosArgInfo* posArgInfo, size_t optCount, + const OptInfo* optInfo, const char* epilogue) { + size_t i; + size_t dtLength; + int padding; + + Help_PrintFlowAndIndent(prologue, 0, helpTextWidth, 0, false); + + if (posArgCount != 0) { + printf("\nPositional Argument\n"); + for (i = 0; i < posArgCount; i++) { + if (posArgInfo[i].helpArg == 0) { + break; + } + + dtLength = helpDtIndent + strlen(posArgInfo[i].helpArg); + + padding = helpDdIndent - dtLength - 2; + printf("%*s%s%*s ", (int)helpDtIndent, "", posArgInfo[i].helpArg, CLAMP_MIN(padding, 0), ""); + + Help_PrintFlowAndIndent(posArgInfo[i].helpMsg, CLAMP_MIN(dtLength + 2, helpDdIndent), helpTextWidth, + helpDdIndent, false); + printf("\n"); + } + } + + if (optCount != 0) { + printf("\nOptions\n"); + + for (i = 0; i < optCount; i++) { + if (optInfo[i].longOpt.val == 0) { + break; + } + + dtLength = helpDtIndent + 6 + strlen(optInfo[i].longOpt.name); + + if (optInfo[i].helpArg == NULL) { + padding = helpDdIndent - dtLength - 2; + printf("%*s-%c, --%s%*s ", (int)helpDtIndent, "", optInfo[i].longOpt.val, optInfo[i].longOpt.name, + CLAMP_MIN(padding, 0), ""); + } else { + dtLength += 1 + strlen(optInfo[i].helpArg); + padding = helpDdIndent - dtLength - 2; + printf("%*s-%c, --%s=%s%*s ", (int)helpDtIndent, "", optInfo[i].longOpt.val, optInfo[i].longOpt.name, + optInfo[i].helpArg, CLAMP_MIN(padding, 0), ""); + } + Help_PrintFlowAndIndent(optInfo[i].helpMsg, CLAMP_MIN(dtLength + 2, helpDdIndent), helpTextWidth, + helpDdIndent, false); + printf("\n"); + } + } + + printf("\n"); + Help_PrintFlowAndIndent(epilogue, 0, helpTextWidth, 0, false); + printf("\n"); +} diff --git a/tools/fado/src/main.c b/tools/fado/src/main.c new file mode 100644 index 000000000..c6af79025 --- /dev/null +++ b/tools/fado/src/main.c @@ -0,0 +1,247 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +#include +#include +#include +#include +#include + +#include "macros.h" +#include "fairy/fairy.h" +#include "fado.h" +#include "help.h" +#include "mido.h" +#include "vc_vector/vc_vector.h" + +#include "version.inc" + +void PrintVersion() { + printf("Fado (Fairy-Assisted relocations for Decompiled Overlays), version %s\n", versionNumber); + printf("Copyright (C) 2021 Elliptic Ellipsis\n"); + printf("%s\n", credits); + printf("Repository available at %s.\n", repo); +} + +#if defined _WIN32 || defined __CYGWIN__ +#define PATH_SEPARATOR '\\' +#else +#define PATH_SEPARATOR '/' +#endif + +/** + * (Bad) filename-parsing idea to get the overlay name from the filename. Output must be freed separately. + */ +char* GetOverlayNameFromFilename(const char* src) { + char* ret; + const char* ptr; + const char* start = src; + const char* end = src; + + for (ptr = src; *ptr != '\0'; ptr++) { + if (*ptr == PATH_SEPARATOR) { + start = end + 1; + end = ptr; + } + } + + if (end == src) { + return NULL; + } + + ret = malloc((end - start + 1) * sizeof(char)); + memcpy(ret, start, end - start); + ret[end - start] = '\0'; + + return ret; +} + +#define OPTSTR "M:n:o:v:ahV" +#define USAGE_STRING "Usage: %s [-hV] [-n name] [-o output_file] [-v level] input_files ...\n" + +#define HELP_PROLOGUE \ + "Fado (Fairy-Assisted relocations for Decompiled Overlays\n" \ + "Extract relocations from object files and convert them into the format required by Zelda 64 overlays.\n" +#define HELP_EPILOGUE repo + +// clang-format off +static const PosArgInfo posArgInfo[] = { + { "INPUT_FILE", "Every positional argument is an input file, and there should be at least one input file. All inputs are relocatable .o (object) ELF files" }, + { NULL, NULL } +}; + +static const OptInfo optInfo[] = { + { { "make-dependency", required_argument, NULL, 'M' }, "FILE", "Write the output file's Makefile dependencies to FILE" }, + { { "name", required_argument, NULL, 'n' }, "NAME", "Use NAME as the overlay name. Will use the deepest folder name in the input file's path if not specified" }, + { { "output-file", required_argument, NULL, 'o' }, "FILE", "Output to FILE. Will use stdout if none is specified" }, + { { "verbosity", required_argument, NULL, 'v' }, "N", "Verbosity level, one of 0 (None, default), 1 (Info), 2 (Debug)" }, + + { { "alignment", no_argument, NULL, 'a' }, NULL, "Experimental. Use the alignment declared by each section in the elf file instead of padding to 0x10 bytes. NOTE: It has not been properly tested because the tools we currently have are not compatible non 0x10 alignment" }, + + { { "help", no_argument, NULL, 'h' }, NULL, "Display this message and exit" }, + { { "version", no_argument, NULL, 'V' }, NULL, "Display version information" }, + + { { NULL, 0, NULL, '\0' }, NULL, NULL }, +}; +// clang-format on + +static size_t posArgCount = ARRAY_COUNT(posArgInfo); +static size_t optCount = ARRAY_COUNT(optInfo); +static struct option longOptions[ARRAY_COUNT(optInfo)]; + +void ConstructLongOpts() { + size_t i; + + for (i = 0; i < optCount; i++) { + longOptions[i] = optInfo[i].longOpt; + } +} + +int main(int argc, char** argv) { + int opt; + int inputFilesCount; + FILE** inputFiles; + FILE* outputFile = stdout; + char* outputFileName; + char* dependencyFileName = NULL; + char* ovlName = NULL; + + ConstructLongOpts(); + + if (argc < 2) { + printf(USAGE_STRING, argv[0]); + fprintf(stderr, "No input file specified\n"); + return EXIT_FAILURE; + } + + while (true) { + int optionIndex = 0; + + if ((opt = getopt_long(argc, argv, OPTSTR, longOptions, &optionIndex)) == -1) { + break; + } + + switch (opt) { + case 'M': + dependencyFileName = optarg; + break; + + case 'n': + ovlName = optarg; + break; + + case 'o': + outputFileName = optarg; + outputFile = fopen(optarg, "wb"); + if (outputFile == NULL) { + fprintf(stderr, "error: unable to open output file '%s' for writing\n", optarg); + return EXIT_FAILURE; + } + break; + + case 'v': + if (sscanf(optarg, "%u", &gVerbosity) == 0) { + fprintf(stderr, "warning: verbosity argument '%s' should be a nonnegative decimal integer\n", + optarg); + } + break; + + case 'a': +#ifndef EXPERIMENTAL + goto not_experimental_err; +#endif + gUseElfAlignment = true; + break; + + case 'h': + printf(USAGE_STRING, argv[0]); + Help_PrintHelp(HELP_PROLOGUE, posArgCount, posArgInfo, optCount, optInfo, HELP_EPILOGUE); + return EXIT_FAILURE; + + case 'V': + PrintVersion(); + return EXIT_FAILURE; + + default: + fprintf(stderr, "?? getopt returned character code 0x%X ??\n", opt); + break; + } + } + + FAIRY_INFO_PRINTF("%s", "Options processed\n"); + + { + int i; + + inputFilesCount = argc - optind; + if (inputFilesCount == 0) { + fprintf(stderr, "No input files specified. Exiting.\n"); + return EXIT_FAILURE; + } + + inputFiles = malloc(inputFilesCount * sizeof(FILE*)); + for (i = 0; i < inputFilesCount; i++) { + FAIRY_INFO_PRINTF("Using input file %s\n", argv[optind + i]); + inputFiles[i] = fopen(argv[optind + i], "rb"); + if (inputFiles[i] == NULL) { + fprintf(stderr, "error: unable to open input file '%s' for reading\n", argv[optind + i]); + return EXIT_FAILURE; + } + } + + FAIRY_INFO_PRINTF("Found %d input file%s\n", inputFilesCount, (inputFilesCount == 1 ? "" : "s")); + + if (ovlName == NULL) { // If a name has not been set using an arg + ovlName = GetOverlayNameFromFilename(argv[optind]); + Fado_Relocs(outputFile, inputFilesCount, inputFiles, ovlName); + free(ovlName); + } else { + Fado_Relocs(outputFile, inputFilesCount, inputFiles, ovlName); + } + + for (i = 0; i < inputFilesCount; i++) { + fclose(inputFiles[i]); + } + free(inputFiles); + if (outputFile != stdout) { + fclose(outputFile); + } + } + + if (dependencyFileName != NULL) { + int fileNameLength = strlen(outputFileName); + char* objectFile = malloc((strlen(outputFileName) + 1) * sizeof(char)); + vc_vector* inputFilesVector = vc_vector_create(inputFilesCount, sizeof(char*), NULL); + char* extensionStart; + FILE* dependencyFile = fopen(dependencyFileName, "w"); + + if (dependencyFile == NULL) { + fprintf(stderr, "error: unable to open dependency file '%s' for writing\n", dependencyFileName); + return EXIT_FAILURE; + } + + strcpy(objectFile, outputFileName); + extensionStart = strrchr(objectFile, '.'); + if (extensionStart == objectFile + fileNameLength) { + fprintf(stderr, "error: file name should not end in a '.'\n"); + return EXIT_FAILURE; + } + strcpy(extensionStart, ".o"); + vc_vector_append(inputFilesVector, &argv[optind], inputFilesCount); + + Mido_WriteDependencyFile(dependencyFile, objectFile, inputFilesVector); + + free(objectFile); + vc_vector_release(inputFilesVector); + fclose(dependencyFile); + } + + return EXIT_SUCCESS; + + goto not_experimental_err; // silences a warning +not_experimental_err: + fprintf( + stderr, + "Experimental option '-%c' passed in a non-EXPERIMENTAL build. Rebuild with 'make EXPERIMENTAL=1' to enable.\n", + opt); + return EXIT_FAILURE; +} diff --git a/tools/fado/src/mido.c b/tools/fado/src/mido.c new file mode 100644 index 000000000..bc5f3ed8a --- /dev/null +++ b/tools/fado/src/mido.c @@ -0,0 +1,20 @@ +#include "mido.h" + +#include +#include "macros.h" +#include "vc_vector/vc_vector.h" + +int Mido_WriteDependencyFile(FILE* dependencyFile, const char* relocFile, vc_vector* inputFilesVector) { + char** inputFile; + + fprintf(dependencyFile, "%s:", relocFile); + + VC_FOREACH(inputFile, inputFilesVector) { + fprintf(dependencyFile, " %s", *inputFile); + } + fputs("\n\n", dependencyFile); + VC_FOREACH(inputFile, inputFilesVector) { + fprintf(dependencyFile, "%s:\n\n", *inputFile); + } + return 0; +} diff --git a/tools/fado/src/version.inc b/tools/fado/src/version.inc new file mode 100644 index 000000000..9bc9fbf30 --- /dev/null +++ b/tools/fado/src/version.inc @@ -0,0 +1,5 @@ +/* Copyright (C) 2021 Elliptic Ellipsis */ +/* SPDX-License-Identifier: AGPL-3.0-only */ +const char versionNumber[] = "1.3.1"; +const char credits[] = "Written by Elliptic Ellipsis\nwith additions from AngheloAlf and Tharo"; +const char repo[] = "https://github.com/EllipticEllipsis/fado/"; diff --git a/tools/fado/z64_relocation_section_format.md b/tools/fado/z64_relocation_section_format.md new file mode 100644 index 000000000..c537ff701 --- /dev/null +++ b/tools/fado/z64_relocation_section_format.md @@ -0,0 +1,114 @@ +# Zelda 64 overlay relocation section format + +Both Zelda 64 titles use the same custom dynamic overlay relocation format, which is + + +All elements are 4 bytes in width. + +| Offset | Description | Notes | +| ------- | ------------------------------------------- | ------------------------------------------------------------- | +| 0x00 | Size of overlay .text section | | +| 0x04 | Size of overlay .data section | | +| 0x08 | Size of overlay .rodata section | | +| 0x0C | Size of overlay .bss section | | +| 0x10 | Number of relocation entries | | +| 0x14- | Relocation entries | Must be sorted in increasing order by section, then offset | +| ... | | | +| | (zero padding of section to 0x10 alignment) | | +| End - 4 | Size of overlay .ovl section | Also the offset from the end of the rest of the section sizes | + + +## Relocation entries + +The only element that is not a single number are the relocation entries, which are bitpacked as follows: + +| 0x1F..0x1E | 0x1D..0x18 | 0x17..0x0 | +| ---------- | ---------- | ----------------------------- | +| ss | tttttt | oooo oooo oooo oooo oooo oooo | +| Section | Type | Offset | + + +### Section + +2 bits. Section where the instruction or data to be relocated is. + +| Value | Section | +| ----- | ------- | +| 1 | .text | +| 2 | .data | +| 3 | .rodata | + + +### Type + +6 bits. Four types of standard MIPS relocation are supported. They use the same values as the standard elf formats: + +| Value | Type | Description | +| ----- | ------------- | --------------------------------------------------------------------------------- | +| 2 | `R_MIPS_32` | A full word address (such as a pointer in data or an address in a jumptable) | +| 4 | `R_MIPS_26` | 26-bit direct relocation, for a J-type instruction | +| 5 | `R_MIPS_HI16` | High 16-bit, generally the top half of an address in an `li`/`lui` | +| 6 | `R_MIPS_LO16` | Low 16-bit, the bottom half of an address, such as in an `addiu`,`ori`,`lh`, etc. | + + +### Offset + +0x18 bits. Offset in bytes from the start of the section where the relocation occurs. + + +### Example + +``` +0x82000A30 = 0b1000 0010 0000 0000 0000 1010 0011 0000 +``` + +This splits as + +``` +0b10, 0b000010, 0b0000 0000 0000 1010 0011 0000 = 0x2, 0x2, 0xA30 +``` + +i.e. a full-word (`R_MIPS_32`) relocation at `.data + 0xA30`. + + +## Compiler compatibility + +### HI/LO + +The MIPS ELF format standard specifies that each LO be preceded by a unique HI associated to it (but multiple LOs may associate to the same HI), and the overlay relocation function acts based on this assumption. + +IDO complies with this consistently, but GCC in its wisdom decided that it was appropriate to violate this by default, and allow multiple HIs to associate to the same LO. GCC also likes to reorder relocations in the `.rel.*` sections. + +To prevent these you must pass *both* of the following compiler flags: + +``` +-mno-explicit-relocs -mno-split-addresses +``` + +(GNU do not document this behaviour themselves, although apparently it has been present for many years. It is also not even consistent between versions.) + +### rodata + +It should be clear from the description above that this system expects a single rodata section. Again, IDO will only ever produce one rodata section, but GCC will produce several, albeit only one containing relocatable rodata: the others are for "mergeable" strings and floats/doubles. The cleanest way to deal with this is to pass + +``` +-fno-merge-constants +``` + +which will force GCC to generate a single combined rodata section. If, however, you really think you will benefit from merging constants, to obtain relocations correctly offset from the start of the entire rodata section(s), the actual `.rodata` section must be explicitly linked first. + +For multi-file overlays, the situation is even more complicated, and Fado gets around this by adding up the sizes of all the rodata sections so that we may simply place one files' in one chunk: this means that each individual `.rodata` section should be linked before the others, i.e. + +``` +.text(1) +.text(2) +.data(1) +.data(2) +.rodata(1) +.rodata.cst4(1) +... +.rodata(2) +.rodata.cst4(2) +``` + +or similar. diff --git a/tools/namefixer.py b/tools/namefixer.py index da595fb89..e7b0a10e0 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -138,13 +138,18 @@ wordReplace = { "func_800BE22C": "Actor_ApplyDamage", "Audio_PlaySoundAtPosition": "SoundSource_PlaySfxAtFixedWorldPos", "func_800F0590": "SoundSource_PlaySfxEachFrameAtFixedWorldPos", - "func_8016970C": "Play_CameraSetAtEye", + "func_8016970C": "Play_SetCameraAtEye", + "Play_CameraSetAtEye": "Play_SetCameraAtEye", "func_800BBA88": "Enemy_StartFinishingBlow", "ShrinkWindow_Step": "ShrinkWindow_Update", "ShrinkWindow_Fini": "ShrinkWindow_Destroy", "func_801A89A8": "Audio_QueueSeqCmd", "func_8019F1C0": "Audio_PlaySfxAtPos", - "func_801A72CC": "Audio_StopSfxByPos", + "func_801A5BD0": "AudioSfx_MuteBanks", + "func_801A72CC": "AudioSfx_StopByPos", + "Audio_StopSfxByPos": "AudioSfx_StopByPos", + "func_801A7328": "AudioSfx_StopByPosAndId", + "func_801A75E8": "AudioSfx_StopById", "SkelAnime_LodDrawLimb": "SkelAnime_DrawLimbLod", "SkelAnime_LodDraw": "SkelAnime_DrawLod", "SkelAnime_LodDrawLimbSV": "SkelAnime_DrawFlexLimbLod", @@ -255,7 +260,8 @@ wordReplace = { "func_800B8B84": "Actor_PickUpNearby", "func_800B8BB0": "Actor_LiftActor", "func_800B8BD0": "Actor_PickUpFar", - "func_801A5CFC": "Audio_PlaySfxGeneral", + "func_801A5CFC": "AudioSfx_PlaySfx", + "Audio_PlaySfxGeneral": "AudioSfx_PlaySfx", "func_800BBDAC": "Actor_SpawnFloorDustRing", "func_800B8708": "Player_GetExchangeItemId", "func_801233E4": "Player_InCsMode", @@ -451,17 +457,25 @@ wordReplace = { "func_800DFFAC": "Camera_ChangeDoorCam", "func_801694DC": "Play_CreateSubCamera", "Play_GetActiveCameraIndex": "Play_GetActiveCamId", - "func_80169590": "Play_CameraChangeStatus", + "func_80169590": "Play_ChangeCameraStatus", + "Play_CameraChangeStatus": "Play_ChangeCameraStatus", "func_80169600": "Play_ClearCamera", "func_80169668": "Play_ClearAllSubCameras", - "func_8016981C": "Play_CameraSetAtEyeUp", - "func_80169940": "Play_CameraSetFov", - "func_80169988": "Play_CameraSetRoll", + "func_8016981C": "Play_SetCameraAtEyeUp", + "func_80169940": "Play_SetCameraFov", + "func_80169988": "Play_SetCameraRoll", + "Play_CameraSetAtEyeUp": "Play_SetCameraAtEyeUp", + "Play_CameraSetFov": "Play_SetCameraFov", + "Play_CameraSetRoll": "Play_SetCameraRoll", "func_801699D4": "Play_CopyCamera", - "func_80169AC0": "Play_CameraChangeSetting", - "func_80169BC4": "Play_CameraGetUID", + "func_80169AC0": "Play_ChangeCameraSetting", + "Play_CameraChangeSetting": "Play_ChangeCameraSetting", + "func_80169BC4": "Play_GetCameraUID", + "Play_CameraGetUID": "Play_GetCameraUID", "func_80169C64": "Play_GetActorCsCamSetting", + "Play_GetCsCamDataSetting": "Play_GetActorCsCamSetting", "func_80169C84": "Play_GetActorCsCamFuncData", + "Play_GetCsCamDataVec3s": "Play_GetActorCsCamFuncData", "convert_scene_number_among_shared_scenes": "Play_GetOriginalSceneNumber", "func_80169D40": "Play_SaveCycleSceneFlags", "func_80169DCC": "Play_SetRespawnData", @@ -593,6 +607,9 @@ wordReplace = { "ActorCutscene_GetCurrentCamera": "ActorCutscene_GetCurrentSubCamId", + "Entrance_CreateIndex": "Entrance_Create", + "Entrance_CreateIndexFromSpawn": "Entrance_CreateFromSpawn", + # Structs "ActorAnimationEntry": "AnimationInfo", "ActorAnimationEntryS": "AnimationInfoS", @@ -637,7 +654,7 @@ wordReplace = { "gSaveContext.playerName": "gSaveContext.save.playerData.playerName", "gSaveContext.inventory": "gSaveContext.save.inventory", "gSaveContext.equippedMask": "gSaveContext.save.equippedMask", - "gSaveContext.entranceIndex": "gSaveContext.save.entranceIndex", + "gSaveContext.entranceIndex": "gSaveContext.save.entrance", "gSaveContext.time": "gSaveContext.save.time", "gSaveContext.unk_14": "gSaveContext.save.daySpeed", "gSaveContext.unk_FE6": "gSaveContext.save.bombersCaughtNum", @@ -654,6 +671,7 @@ wordReplace = { "gSaveContext.unk_1016": "gSaveContext.jinxTimer", "gSaveContext.unk_3F58": "gSaveContext.sunsSongState", "gSaveContext.unk_48C8": "gSaveContext.dungeonIndex", + "gSaveContext.save.entranceIndex": "gSaveContext.save.entrance", "player->unk_A87": "player->exchangeItemId", "player->leftHandActor": "player->heldActor", @@ -686,6 +704,7 @@ wordReplace = { "play->msgCtx.unk12023": "play->msgCtx.stateTimer", "play->msgCtx.unk1202A": "play->msgCtx.ocarinaMode", "play->msgCtx.unk1202C": "play->msgCtx.ocarinaAction", + "play->nextEntranceIndex": "play->nextEntrance", "play->sceneLoadFlag": "play->transitionTrigger", "play->unk_18B4A": "play->transitionMode", @@ -709,6 +728,22 @@ wordReplace = { "ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,", "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,", + "EXCH_ITEM_MINUS1": "PLAYER_AP_MINUS1", + "EXCH_ITEM_NONE": "PLAYER_AP_NONE", + "EXCH_ITEM_PICTO_BOX": "PLAYER_AP_PICTO_BOX", + "EXCH_ITEM_1E": "PLAYER_AP_BOTTLE_MUSHROOM", + "EXCH_ITEM_MOON_TEAR": "PLAYER_AP_MOON_TEAR", + "EXCH_ITEM_DEED_LAND": "PLAYER_AP_DEED_LAND", + "EXCH_ITEM_ROOM_KEY": "PLAYER_AP_ROOM_KEY", + "EXCH_ITEM_LETTER_TO_KAFEI": "PLAYER_AP_LETTER_TO_KAFEI", + "EXCH_ITEM_2E": "PLAYER_AP_MAGIC_BEANS", + "EXCH_ITEM_DEED_SWAMP": "PLAYER_AP_DEED_SWAMP", + "EXCH_ITEM_DEED_MOUNTAIN": "PLAYER_AP_DEED_MOUNTAIN", + "EXCH_ITEM_DEED_OCEAN": "PLAYER_AP_DEED_OCEAN", + "EXCH_ITEM_LETTER_MAMA": "PLAYER_AP_LETTER_MAMA", + "ITEM_FISHING_POLE": "ITEM_FISHING_ROD", + "PLAYER_AP_FISHING_POLE": "PLAYER_AP_FISHING_ROD", + # Example of custom behaviour: # "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames } diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index d884a1081..15c5a5f60 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -149,7 +149,7 @@ asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsSolderSrchBall_Spaw asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsKakera_Spawn.s,EffectSsKakera_Spawn,0x800B2810,0x2E asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_Spawn.s,EffectSsIcePiece_Spawn,0x800B28C8,0x1A asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_SpawnBurst.s,EffectSsIcePiece_SpawnBurst,0x800B2930,0x65 -asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlyingVec3f.s,EffectSsEnIce_SpawnFlyingVec3f,0x800B2AC4,0x20 +asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_SpawnFlying.s,EffectSsEnIce_SpawnFlying,0x800B2AC4,0x20 asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B44.s,func_800B2B44,0x800B2B44,0xE asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800B2B7C.s,func_800B2B7C,0x800B2B7C,0x11 asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsEnIce_Spawn.s,EffectSsEnIce_Spawn,0x800B2BC0,0x22 @@ -297,7 +297,7 @@ asm/non_matchings/code/z_actor/func_800B8804.s,func_800B8804,0x800B8804,0xA asm/non_matchings/code/z_actor/func_800B882C.s,func_800B882C,0x800B882C,0x10 asm/non_matchings/code/z_actor/func_800B886C.s,func_800B886C,0x800B886C,0xB asm/non_matchings/code/z_actor/Actor_GetScreenPos.s,Actor_GetScreenPos,0x800B8898,0x27 -asm/non_matchings/code/z_actor/func_800B8934.s,func_800B8934,0x800B8934,0x31 +asm/non_matchings/code/z_actor/Actor_OnScreen.s,Actor_OnScreen,0x800B8934,0x31 asm/non_matchings/code/z_actor/Actor_HasParent.s,Actor_HasParent,0x800B89F8,0x9 asm/non_matchings/code/z_actor/Actor_PickUp.s,Actor_PickUp,0x800B8A1C,0x5A asm/non_matchings/code/z_actor/Actor_PickUpNearby.s,Actor_PickUpNearby,0x800B8B84,0xB @@ -627,37 +627,37 @@ asm/non_matchings/code/z_bg_item/DynaPoly_IsInSwitchPressedState.s,DynaPoly_IsIn asm/non_matchings/code/z_bg_item/DynaPoly_IsInHeavySwitchPressedState.s,DynaPoly_IsInHeavySwitchPressedState,0x800CAFDC,0x9 asm/non_matchings/code/z_bg_item/DynaPoly_ValidateMove.s,DynaPoly_ValidateMove,0x800CB000,0x84 asm/non_matchings/code/z_camera/Camera_fabsf.s,Camera_fabsf,0x800CB210,0xC -asm/non_matchings/code/z_camera/Camera_LengthVec3f.s,Camera_LengthVec3f,0x800CB240,0xC -asm/non_matchings/code/z_camera/func_800CB270.s,func_800CB270,0x800CB270,0x30 -asm/non_matchings/code/z_camera/Camera_Lerpf.s,Camera_Lerpf,0x800CB330,0x1A -asm/non_matchings/code/z_camera/Camera_Lerps.s,Camera_Lerps,0x800CB398,0x25 -asm/non_matchings/code/z_camera/func_800CB42C.s,func_800CB42C,0x800CB42C,0x25 -asm/non_matchings/code/z_camera/Camera_LerpVec3f.s,Camera_LerpVec3f,0x800CB4C0,0x21 -asm/non_matchings/code/z_camera/func_800CB544.s,func_800CB544,0x800CB544,0x10 -asm/non_matchings/code/z_camera/func_800CB584.s,func_800CB584,0x800CB584,0x16 -asm/non_matchings/code/z_camera/func_800CB5DC.s,func_800CB5DC,0x800CB5DC,0xC -asm/non_matchings/code/z_camera/func_800CB60C.s,func_800CB60C,0x800CB60C,0x1A -asm/non_matchings/code/z_camera/func_800CB674.s,func_800CB674,0x800CB674,0x15 -asm/non_matchings/code/z_camera/func_800CB6C8.s,func_800CB6C8,0x800CB6C8,0xE -asm/non_matchings/code/z_camera/func_800CB700.s,func_800CB700,0x800CB700,0x20 -asm/non_matchings/code/z_camera/func_800CB780.s,func_800CB780,0x800CB780,0x13 +asm/non_matchings/code/z_camera/Camera_Vec3fMagnitude.s,Camera_Vec3fMagnitude,0x800CB240,0xC +asm/non_matchings/code/z_camera/Camera_QuadraticAttenuation.s,Camera_QuadraticAttenuation,0x800CB270,0x30 +asm/non_matchings/code/z_camera/Camera_LerpCeilF.s,Camera_LerpCeilF,0x800CB330,0x1A +asm/non_matchings/code/z_camera/Camera_LerpCeilS.s,Camera_LerpCeilS,0x800CB398,0x25 +asm/non_matchings/code/z_camera/Camera_LerpFloorS.s,Camera_LerpFloorS,0x800CB42C,0x25 +asm/non_matchings/code/z_camera/Camera_LerpCeilVec3f.s,Camera_LerpCeilVec3f,0x800CB4C0,0x21 +asm/non_matchings/code/z_camera/Camera_SetUpdateRatesFastPitch.s,Camera_SetUpdateRatesFastPitch,0x800CB544,0x10 +asm/non_matchings/code/z_camera/Camera_SetUpdateRatesFastYaw.s,Camera_SetUpdateRatesFastYaw,0x800CB584,0x16 +asm/non_matchings/code/z_camera/Camera_SetUpdateRatesSlow.s,Camera_SetUpdateRatesSlow,0x800CB5DC,0xC +asm/non_matchings/code/z_camera/Camera_Vec3sToVec3f.s,Camera_Vec3sToVec3f,0x800CB60C,0x1A +asm/non_matchings/code/z_camera/Camera_AngleDiffAndScale.s,Camera_AngleDiffAndScale,0x800CB674,0x15 +asm/non_matchings/code/z_camera/Camera_UpdateAtActorOffset.s,Camera_UpdateAtActorOffset,0x800CB6C8,0xE +asm/non_matchings/code/z_camera/Camera_GetFocalActorHeight.s,Camera_GetFocalActorHeight,0x800CB700,0x20 +asm/non_matchings/code/z_camera/Camera_GetRunSpeedLimit.s,Camera_GetRunSpeedLimit,0x800CB780,0x13 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/Camera_IsMountedOnHorse.s,Camera_IsMountedOnHorse,0x800CB7F8,0xC +asm/non_matchings/code/z_camera/Camera_IsDekuHovering.s,Camera_IsDekuHovering,0x800CB828,0xB asm/non_matchings/code/z_camera/func_800CB854.s,func_800CB854,0x800CB854,0xB 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/Camera_IsDiving.s,Camera_IsDiving,0x800CB8C8,0xB +asm/non_matchings/code/z_camera/Camera_IsPlayerFormZora.s,Camera_IsPlayerFormZora,0x800CB8F4,0xC asm/non_matchings/code/z_camera/func_800CB924.s,func_800CB924,0x800CB924,0xB asm/non_matchings/code/z_camera/func_800CB950.s,func_800CB950,0x800CB950,0x2E -asm/non_matchings/code/z_camera/func_800CBA08.s,func_800CBA08,0x800CBA08,0xB -asm/non_matchings/code/z_camera/func_800CBA34.s,func_800CBA34,0x800CBA34,0x12 +asm/non_matchings/code/z_camera/Camera_IsClimbingLedge.s,Camera_IsClimbingLedge,0x800CBA08,0xB +asm/non_matchings/code/z_camera/Camera_IsChargingSwordOrDekuFlowerDive.s,Camera_IsChargingSwordOrDekuFlowerDive,0x800CBA34,0x12 asm/non_matchings/code/z_camera/func_800CBA7C.s,func_800CBA7C,0x800CBA7C,0xC asm/non_matchings/code/z_camera/func_800CBAAC.s,func_800CBAAC,0x800CBAAC,0xA -asm/non_matchings/code/z_camera/func_800CBAD4.s,func_800CBAD4,0x800CBAD4,0x21 -asm/non_matchings/code/z_camera/func_800CBB58.s,func_800CBB58,0x800CBB58,0xC +asm/non_matchings/code/z_camera/Camera_GetFocalActorPos.s,Camera_GetFocalActorPos,0x800CBAD4,0x21 +asm/non_matchings/code/z_camera/Camera_IsUnderwaterAsZora.s,Camera_IsUnderwaterAsZora,0x800CBB58,0xC asm/non_matchings/code/z_camera/func_800CBB88.s,func_800CBB88,0x800CBB88,0x1E -asm/non_matchings/code/z_camera/func_800CBC00.s,func_800CBC00,0x800CBC00,0xC +asm/non_matchings/code/z_camera/Camera_IsUsingZoraFins.s,Camera_IsUsingZoraFins,0x800CBC00,0xC asm/non_matchings/code/z_camera/func_800CBC30.s,func_800CBC30,0x800CBC30,0x15 asm/non_matchings/code/z_camera/func_800CBC84.s,func_800CBC84,0x800CBC84,0xC8 asm/non_matchings/code/z_camera/func_800CBFA4.s,func_800CBFA4,0x800CBFA4,0x17 @@ -772,8 +772,8 @@ asm/non_matchings/code/z_camera/Camera_Free.s,Camera_Free,0x800DDDA8,0xA asm/non_matchings/code/z_camera/Camera_Init.s,Camera_Init,0x800DDDD0,0x84 asm/non_matchings/code/z_camera/func_800DDFE0.s,func_800DDFE0,0x800DDFE0,0x40 asm/non_matchings/code/z_camera/func_800DE0E0.s,func_800DE0E0,0x800DE0E0,0x3 -asm/non_matchings/code/z_camera/func_800DE0EC.s,func_800DE0EC,0x800DE0EC,0x87 -asm/non_matchings/code/z_camera/func_800DE308.s,func_800DE308,0x800DE308,0x7 +asm/non_matchings/code/z_camera/Camera_InitPlayerSettings.s,Camera_InitPlayerSettings,0x800DE0EC,0x87 +asm/non_matchings/code/z_camera/Camera_ChangeStatus.s,Camera_ChangeStatus,0x800DE308,0x7 asm/non_matchings/code/z_camera/func_800DE324.s,func_800DE324,0x800DE324,0xC2 asm/non_matchings/code/z_camera/func_800DE62C.s,func_800DE62C,0x800DE62C,0x85 asm/non_matchings/code/z_camera/func_800DE840.s,func_800DE840,0x800DE840,0x14 @@ -794,7 +794,7 @@ asm/non_matchings/code/z_camera/Camera_GetCamDir.s,Camera_GetCamDir,0x800DFC90,0 asm/non_matchings/code/z_camera/Camera_GetCamDirPitch.s,Camera_GetCamDirPitch,0x800DFCB4,0xA asm/non_matchings/code/z_camera/Camera_GetCamDirYaw.s,Camera_GetCamDirYaw,0x800DFCDC,0xA asm/non_matchings/code/z_camera/Camera_AddQuake.s,Camera_AddQuake,0x800DFD04,0x1D -asm/non_matchings/code/z_camera/func_800DFD78.s,func_800DFD78,0x800DFD78,0x5E +asm/non_matchings/code/z_camera/Camera_SetViewParam.s,Camera_SetViewParam,0x800DFD78,0x5E asm/non_matchings/code/z_camera/func_800DFEF0.s,func_800DFEF0,0x800DFEF0,0xA asm/non_matchings/code/z_camera/func_800DFF18.s,func_800DFF18,0x800DFF18,0x7 asm/non_matchings/code/z_camera/func_800DFF34.s,func_800DFF34,0x800DFF34,0x4 @@ -802,7 +802,7 @@ asm/non_matchings/code/z_camera/func_800DFF44.s,func_800DFF44,0x800DFF44,0x7 asm/non_matchings/code/z_camera/Camera_SetFlags.s,Camera_SetFlags,0x800DFF60,0x9 asm/non_matchings/code/z_camera/Camera_ClearFlags.s,Camera_ClearFlags,0x800DFF84,0xA asm/non_matchings/code/z_camera/Camera_ChangeDoorCam.s,Camera_ChangeDoorCam,0x800DFFAC,0x34 -asm/non_matchings/code/z_camera/func_800E007C.s,func_800E007C,0x800E007C,0x4C +asm/non_matchings/code/z_camera/Camera_Copy.s,Camera_Copy,0x800E007C,0x4C asm/non_matchings/code/z_camera/func_800E01AC.s,func_800E01AC,0x800E01AC,0x3 asm/non_matchings/code/z_camera/Camera_GetQuakeOffset.s,Camera_GetQuakeOffset,0x800E01B8,0x9 asm/non_matchings/code/z_camera/func_800E01DC.s,func_800E01DC,0x800E01DC,0x13 @@ -1970,8 +1970,8 @@ asm/non_matchings/code/z_scene/Scene_HeaderCmdSetAreaVisitedFlag.s,Scene_HeaderC asm/non_matchings/code/z_scene/Scene_HeaderCmdAnimatedMaterials.s,Scene_HeaderCmdAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11 asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 -asm/non_matchings/code/z_scene/Entrance_CreateIndex.s,Entrance_CreateIndex,0x80130768,0x7 -asm/non_matchings/code/z_scene/Entrance_CreateIndexFromSpawn.s,Entrance_CreateIndexFromSpawn,0x80130784,0xF +asm/non_matchings/code/z_scene/Entrance_Create.s,Entrance_Create,0x80130768,0x7 +asm/non_matchings/code/z_scene/Entrance_CreateFromSpawn.s,Entrance_CreateFromSpawn,0x80130784,0xF asm/non_matchings/code/z_scene_proc/Scene_ExecuteDrawConfig.s,Scene_ExecuteDrawConfig,0x801307C0,0xD asm/non_matchings/code/z_scene_proc/Scene_DrawConfigDefault.s,Scene_DrawConfigDefault,0x801307F4,0x10 asm/non_matchings/code/z_scene_proc/AnimatedMat_TexScroll.s,AnimatedMat_TexScroll,0x80130834,0x1B @@ -2500,18 +2500,18 @@ asm/non_matchings/code/z_play/func_80165E7C.s,func_80165E7C,0x80165E7C,0x11 asm/non_matchings/code/z_play/func_80165EC0.s,func_80165EC0,0x80165EC0,0x68 asm/non_matchings/code/z_play/func_80166060.s,func_80166060,0x80166060,0x16 asm/non_matchings/code/z_play/func_801660B8.s,func_801660B8,0x801660B8,0x21 -asm/non_matchings/code/z_play/Play_Fini.s,Play_Fini,0x8016613C,0xA2 +asm/non_matchings/code/z_play/Play_Destroy.s,Play_Destroy,0x8016613C,0xA2 asm/non_matchings/code/z_play/func_801663C4.s,func_801663C4,0x801663C4,0xA0 asm/non_matchings/code/z_play/func_80166644.s,func_80166644,0x80166644,0x9C asm/non_matchings/code/z_play/func_801668B4.s,func_801668B4,0x801668B4,0x2D asm/non_matchings/code/z_play/func_80166968.s,func_80166968,0x80166968,0x72 asm/non_matchings/code/z_play/func_80166B30.s,func_80166B30,0x80166B30,0x339 -asm/non_matchings/code/z_play/func_80167814.s,func_80167814,0x80167814,0x174 +asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80167814,0x174 asm/non_matchings/code/z_play/func_80167DE4.s,func_80167DE4,0x80167DE4,0x4A asm/non_matchings/code/z_play/func_80167F0C.s,func_80167F0C,0x80167F0C,0x61 asm/non_matchings/code/z_play/Play_Draw.s,Play_Draw,0x80168090,0x347 asm/non_matchings/code/z_play/func_80168DAC.s,func_80168DAC,0x80168DAC,0x6E -asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80168F64,0x5A +asm/non_matchings/code/z_play/Play_Main.s,Play_Main,0x80168F64,0x5A asm/non_matchings/code/z_play/Play_InCsMode.s,Play_InCsMode,0x801690CC,0xD asm/non_matchings/code/z_play/func_80169100.s,func_80169100,0x80169100,0x3C asm/non_matchings/code/z_play/func_801691F0.s,func_801691F0,0x801691F0,0xC @@ -2519,22 +2519,22 @@ asm/non_matchings/code/z_play/Play_LoadScene.s,Play_LoadScene,0x80169220,0x17 asm/non_matchings/code/z_play/func_8016927C.s,func_8016927C,0x8016927C,0x12 asm/non_matchings/code/z_play/func_801692C4.s,func_801692C4,0x801692C4,0x44 asm/non_matchings/code/z_play/Play_SceneInit.s,Play_SceneInit,0x801693D4,0x28 -asm/non_matchings/code/z_play/func_80169474.s,func_80169474,0x80169474,0x1A +asm/non_matchings/code/z_play/Play_GetScreenPos.s,Play_GetScreenPos,0x80169474,0x1A asm/non_matchings/code/z_play/Play_CreateSubCamera.s,Play_CreateSubCamera,0x801694DC,0x2A asm/non_matchings/code/z_play/Play_GetActiveCamId.s,Play_GetActiveCamId,0x80169584,0x3 -asm/non_matchings/code/z_play/Play_CameraChangeStatus.s,Play_CameraChangeStatus,0x80169590,0x1C +asm/non_matchings/code/z_play/Play_ChangeCameraStatus.s,Play_ChangeCameraStatus,0x80169590,0x1C asm/non_matchings/code/z_play/Play_ClearCamera.s,Play_ClearCamera,0x80169600,0x1A asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s,Play_ClearAllSubCameras,0x80169668,0x1B asm/non_matchings/code/z_play/Play_GetCamera.s,Play_GetCamera,0x801696D4,0xE -asm/non_matchings/code/z_play/Play_CameraSetAtEye.s,Play_CameraSetAtEye,0x8016970C,0x44 -asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s,Play_CameraSetAtEyeUp,0x8016981C,0x49 -asm/non_matchings/code/z_play/Play_CameraSetFov.s,Play_CameraSetFov,0x80169940,0x12 -asm/non_matchings/code/z_play/Play_CameraSetRoll.s,Play_CameraSetRoll,0x80169988,0x13 +asm/non_matchings/code/z_play/Play_SetCameraAtEye.s,Play_SetCameraAtEye,0x8016970C,0x44 +asm/non_matchings/code/z_play/Play_SetCameraAtEyeUp.s,Play_SetCameraAtEyeUp,0x8016981C,0x49 +asm/non_matchings/code/z_play/Play_SetCameraFov.s,Play_SetCameraFov,0x80169940,0x12 +asm/non_matchings/code/z_play/Play_SetCameraRoll.s,Play_SetCameraRoll,0x80169988,0x13 asm/non_matchings/code/z_play/Play_CopyCamera.s,Play_CopyCamera,0x801699D4,0x1F asm/non_matchings/code/z_play/func_80169A50.s,func_80169A50,0x80169A50,0x1C -asm/non_matchings/code/z_play/Play_CameraChangeSetting.s,Play_CameraChangeSetting,0x80169AC0,0xF +asm/non_matchings/code/z_play/Play_ChangeCameraSetting.s,Play_ChangeCameraSetting,0x80169AC0,0xF 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/Play_GetCameraUID.s,Play_GetCameraUID,0x80169BC4,0xD asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B 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 @@ -3204,10 +3204,10 @@ asm/non_matchings/code/code_80192BE0/func_8019372C.s,func_8019372C,0x8019372C,0x asm/non_matchings/code/code_80192BE0/func_80193774.s,func_80193774,0x80193774,0x26 asm/non_matchings/code/code_80192BE0/func_8019380C.s,func_8019380C,0x8019380C,0x13 asm/non_matchings/code/code_80192BE0/func_80193858.s,func_80193858,0x80193858,0x9 -asm/non_matchings/code/code_80192BE0/func_8019387C.s,func_8019387C,0x8019387C,0x9 -asm/non_matchings/code/code_80192BE0/Audio_QueueCmdS8.s,Audio_QueueCmdS8,0x801938A0,0xC +asm/non_matchings/code/code_80192BE0/AudioThread_QueueCmdS32.s,AudioThread_QueueCmdS32,0x8019387C,0x9 +asm/non_matchings/code/code_80192BE0/AudioThread_QueueCmdS8.s,AudioThread_QueueCmdS8,0x801938A0,0xC asm/non_matchings/code/code_80192BE0/func_801938D0.s,func_801938D0,0x801938D0,0xC -asm/non_matchings/code/code_80192BE0/func_80193900.s,func_80193900,0x80193900,0x24 +asm/non_matchings/code/code_80192BE0/AudioThread_ScheduleProcessCmds.s,AudioThread_ScheduleProcessCmds,0x80193900,0x24 asm/non_matchings/code/code_80192BE0/func_80193990.s,func_80193990,0x80193990,0x6 asm/non_matchings/code/code_80192BE0/func_801939A8.s,func_801939A8,0x801939A8,0x51 asm/non_matchings/code/code_80192BE0/func_80193AEC.s,func_80193AEC,0x80193AEC,0x2D @@ -3234,11 +3234,11 @@ asm/non_matchings/code/code_80192BE0/func_8019440C.s,func_8019440C,0x8019440C,0x asm/non_matchings/code/code_80192BE0/func_80194528.s,func_80194528,0x80194528,0x8 asm/non_matchings/code/code_80192BE0/func_80194548.s,func_80194548,0x80194548,0x8 asm/non_matchings/code/code_80192BE0/func_80194568.s,func_80194568,0x80194568,0x40 -asm/non_matchings/code/code_80192BE0/Audio_NextRandom.s,Audio_NextRandom,0x80194668,0x1F -asm/non_matchings/code/code_80192BE0/Audio_InitMesgQueues.s,Audio_InitMesgQueues,0x801946E4,0xB +asm/non_matchings/code/code_80192BE0/AudioThread_NextRandom.s,AudioThread_NextRandom,0x80194668,0x1F +asm/non_matchings/code/code_80192BE0/AudioThread_InitMesgQueues.s,AudioThread_InitMesgQueues,0x801946E4,0xB asm/non_matchings/code/code_80194710/Audio_InvalDCache.s,Audio_InvalDCache,0x80194710,0x10 asm/non_matchings/code/code_80194710/Audio_WritebackDCache.s,Audio_WritebackDCache,0x80194750,0x10 -asm/non_matchings/code/code_80194710/func_80194790.s,func_80194790,0x80194790,0x1D +asm/non_matchings/code/code_80194710/osAiSetNextBuffer.s,osAiSetNextBuffer,0x80194790,0x1D asm/non_matchings/code/code_80194710/func_80194804.s,func_80194804,0x80194804,0xF asm/non_matchings/code/code_80194710/func_80194840.s,func_80194840,0x80194840,0x1C asm/non_matchings/code/code_80194710/func_801948B0.s,func_801948B0,0x801948B0,0x20 @@ -3321,52 +3321,52 @@ asm/non_matchings/code/audio_seqplayer/AudioSeq_InitSequencePlayer.s,AudioSeq_In 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 -asm/non_matchings/code/code_8019AF00/func_8019AF00.s,func_8019AF00,0x8019AF00,0x16 -asm/non_matchings/code/code_8019AF00/func_8019AF58.s,func_8019AF58,0x8019AF58,0x24 -asm/non_matchings/code/code_8019AF00/func_8019AFE8.s,func_8019AFE8,0x8019AFE8,0x11 -asm/non_matchings/code/code_8019AF00/func_8019B02C.s,func_8019B02C,0x8019B02C,0x12 -asm/non_matchings/code/code_8019AF00/AudioOcarina_MapSongFromNotesToButtons.s,AudioOcarina_MapSongFromNotesToButtons,0x8019B074,0x34 -asm/non_matchings/code/code_8019AF00/func_8019B144.s,func_8019B144,0x8019B144,0x8D -asm/non_matchings/code/code_8019AF00/func_8019B378.s,func_8019B378,0x8019B378,0x5 -asm/non_matchings/code/code_8019AF00/func_8019B38C.s,func_8019B38C,0x8019B38C,0x11 -asm/non_matchings/code/code_8019AF00/func_8019B3D0.s,func_8019B3D0,0x8019B3D0,0x3A -asm/non_matchings/code/code_8019AF00/func_8019B4B8.s,func_8019B4B8,0x8019B4B8,0x23 +asm/non_matchings/code/code_8019AF00/AudioOcarina_ReadControllerInput.s,AudioOcarina_ReadControllerInput,0x8019AF00,0x16 +asm/non_matchings/code/code_8019AF00/AudioOcarina_BendPitchTwoSemitones.s,AudioOcarina_BendPitchTwoSemitones,0x8019AF58,0x24 +asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlayingState.s,AudioOcarina_GetPlayingState,0x8019AFE8,0x11 +asm/non_matchings/code/code_8019AF00/AudioOcarina_MapPitchToButton.s,AudioOcarina_MapPitchToButton,0x8019B02C,0x12 +asm/non_matchings/code/code_8019AF00/AudioOcarina_MapSongFromPitchToButton.s,AudioOcarina_MapSongFromPitchToButton,0x8019B074,0x34 +asm/non_matchings/code/code_8019AF00/AudioOcarina_Start.s,AudioOcarina_Start,0x8019B144,0x8D +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetSongStartingPos.s,AudioOcarina_SetSongStartingPos,0x8019B378,0x5 +asm/non_matchings/code/code_8019AF00/AudioOcarina_StartAtSongStartingPos.s,AudioOcarina_StartAtSongStartingPos,0x8019B38C,0x11 +asm/non_matchings/code/code_8019AF00/AudioOcarina_StartForSongCheck.s,AudioOcarina_StartForSongCheck,0x8019B3D0,0x3A +asm/non_matchings/code/code_8019AF00/AudioOcarina_StartWithSongNoteLengths.s,AudioOcarina_StartWithSongNoteLengths,0x8019B4B8,0x23 asm/non_matchings/code/code_8019AF00/AudioOcarina_StartDefault.s,AudioOcarina_StartDefault,0x8019B544,0x9 asm/non_matchings/code/code_8019AF00/func_8019B568.s,func_8019B568,0x8019B568,0x11 asm/non_matchings/code/code_8019AF00/func_8019B5AC.s,func_8019B5AC,0x8019B5AC,0x10 asm/non_matchings/code/code_8019AF00/func_8019B5EC.s,func_8019B5EC,0x8019B5EC,0xB -asm/non_matchings/code/code_8019AF00/func_8019B618.s,func_8019B618,0x8019B618,0xF -asm/non_matchings/code/code_8019AF00/func_8019B654.s,func_8019B654,0x8019B654,0x18 -asm/non_matchings/code/code_8019AF00/func_8019B6B4.s,func_8019B6B4,0x8019B6B4,0x164 -asm/non_matchings/code/code_8019AF00/func_8019BC44.s,func_8019BC44,0x8019BC44,0x95 -asm/non_matchings/code/code_8019AF00/func_8019BE98.s,func_8019BE98,0x8019BE98,0xCA -asm/non_matchings/code/code_8019AF00/func_8019C1C0.s,func_8019C1C0,0x8019C1C0,0x4 -asm/non_matchings/code/code_8019AF00/func_8019C1D0.s,func_8019C1D0,0x8019C1D0,0x26 -asm/non_matchings/code/code_8019AF00/func_8019C268.s,func_8019C268,0x8019C268,0x1F -asm/non_matchings/code/code_8019AF00/func_8019C2E4.s,func_8019C2E4,0x8019C2E4,0x7 -asm/non_matchings/code/code_8019AF00/AudioOcarina_SetInstrumentId.s,AudioOcarina_SetInstrumentId,0x8019C300,0x26 -asm/non_matchings/code/code_8019AF00/func_8019C398.s,func_8019C398,0x8019C398,0x82 -asm/non_matchings/code/code_8019AF00/func_8019C5A0.s,func_8019C5A0,0x8019C5A0,0xCE -asm/non_matchings/code/code_8019AF00/func_8019C8D8.s,func_8019C8D8,0x8019C8D8,0x10C -asm/non_matchings/code/code_8019AF00/func_8019CD08.s,func_8019CD08,0x8019CD08,0x4B -asm/non_matchings/code/code_8019AF00/func_8019CE34.s,func_8019CE34,0x8019CE34,0xE -asm/non_matchings/code/code_8019AF00/func_8019CE6C.s,func_8019CE6C,0x8019CE6C,0x14 -asm/non_matchings/code/code_8019AF00/func_8019CEBC.s,func_8019CEBC,0x8019CEBC,0x2C -asm/non_matchings/code/code_8019AF00/func_8019CF6C.s,func_8019CF6C,0x8019CF6C,0x3 -asm/non_matchings/code/code_8019AF00/func_8019CF78.s,func_8019CF78,0x8019CF78,0x9 +asm/non_matchings/code/code_8019AF00/AudioOcarina_CheckIfStartedSong.s,AudioOcarina_CheckIfStartedSong,0x8019B618,0xF +asm/non_matchings/code/code_8019AF00/AudioOcarina_UpdateCurOcarinaSong.s,AudioOcarina_UpdateCurOcarinaSong,0x8019B654,0x18 +asm/non_matchings/code/code_8019AF00/AudioOcarina_CheckSongsWithMusicStaff.s,AudioOcarina_CheckSongsWithMusicStaff,0x8019B6B4,0x164 +asm/non_matchings/code/code_8019AF00/AudioOcarina_CheckSongsWithoutMusicStaff.s,AudioOcarina_CheckSongsWithoutMusicStaff,0x8019BC44,0x95 +asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayControllerInput.s,AudioOcarina_PlayControllerInput,0x8019BE98,0xCA +asm/non_matchings/code/code_8019AF00/AudioOcarina_EnableInput.s,AudioOcarina_EnableInput,0x8019C1C0,0x4 +asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetAndMute.s,AudioOcarina_ResetAndMute,0x8019C1D0,0x26 +asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetAndReadInput.s,AudioOcarina_ResetAndReadInput,0x8019C268,0x1F +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetOcarinaDisableTimer.s,AudioOcarina_SetOcarinaDisableTimer,0x8019C2E4,0x7 +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetInstrument.s,AudioOcarina_SetInstrument,0x8019C300,0x26 +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetPlaybackSong.s,AudioOcarina_SetPlaybackSong,0x8019C398,0x82 +asm/non_matchings/code/code_8019AF00/AudioOcarina_PlaybackSong.s,AudioOcarina_PlaybackSong,0x8019C5A0,0xCE +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetRecordingSong.s,AudioOcarina_SetRecordingSong,0x8019C8D8,0x10C +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetRecordingState.s,AudioOcarina_SetRecordingState,0x8019CD08,0x4B +asm/non_matchings/code/code_8019AF00/AudioOcarina_UpdateRecordingStaff.s,AudioOcarina_UpdateRecordingStaff,0x8019CE34,0xE +asm/non_matchings/code/code_8019AF00/AudioOcarina_UpdatePlayingStaff.s,AudioOcarina_UpdatePlayingStaff,0x8019CE6C,0x14 +asm/non_matchings/code/code_8019AF00/AudioOcarina_UpdatePlaybackStaff.s,AudioOcarina_UpdatePlaybackStaff,0x8019CEBC,0x2C +asm/non_matchings/code/code_8019AF00/AudioOcarina_GetRecordingStaff.s,AudioOcarina_GetRecordingStaff,0x8019CF6C,0x3 +asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlayingStaff.s,AudioOcarina_GetPlayingStaff,0x8019CF78,0x9 asm/non_matchings/code/code_8019AF00/AudioOcarina_GetPlaybackStaff.s,AudioOcarina_GetPlaybackStaff,0x8019CF9C,0x3 -asm/non_matchings/code/code_8019AF00/func_8019CFA8.s,func_8019CFA8,0x8019CFA8,0x63 +asm/non_matchings/code/code_8019AF00/AudioOcarina_RecordSong.s,AudioOcarina_RecordSong,0x8019CFA8,0x63 asm/non_matchings/code/code_8019AF00/AudioOcarina_TerminaWallValidateNotes.s,AudioOcarina_TerminaWallValidateNotes,0x8019D134,0x4E asm/non_matchings/code/code_8019AF00/AudioOcarina_TerminaWallGenerateNotes.s,AudioOcarina_TerminaWallGenerateNotes,0x8019D26C,0x87 -asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameSetNumNotes.s,AudioOcarina_MemoryGameSetNumNotes,0x8019D488,0x1C -asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameGenerateNotes.s,AudioOcarina_MemoryGameGenerateNotes,0x8019D4F8,0x42 -asm/non_matchings/code/code_8019AF00/func_8019D600.s,func_8019D600,0x8019D600,0x56 -asm/non_matchings/code/code_8019AF00/func_8019D758.s,func_8019D758,0x8019D758,0x43 -asm/non_matchings/code/code_8019AF00/func_8019D864.s,func_8019D864,0x8019D864,0x14 -asm/non_matchings/code/code_8019AF00/func_8019D8B4.s,func_8019D8B4,0x8019D8B4,0xC -asm/non_matchings/code/code_8019AF00/func_8019D8E4.s,func_8019D8E4,0x8019D8E4,0x191 -asm/non_matchings/code/code_8019AF00/func_8019DF28.s,func_8019DF28,0x8019DF28,0xF -asm/non_matchings/code/code_8019AF00/func_8019DF64.s,func_8019DF64,0x8019DF64,0x25 +asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameInit.s,AudioOcarina_MemoryGameInit,0x8019D488,0x1C +asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameNextNote.s,AudioOcarina_MemoryGameNextNote,0x8019D4F8,0x42 +asm/non_matchings/code/code_8019AF00/AudioOcarina_Update.s,AudioOcarina_Update,0x8019D600,0x56 +asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayLongScarecrowAfterCredits.s,AudioOcarina_PlayLongScarecrowAfterCredits,0x8019D758,0x43 +asm/non_matchings/code/code_8019AF00/AudioOcarina_SetCustomSequence.s,AudioOcarina_SetCustomSequence,0x8019D864,0x14 +asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayCustomSequence.s,AudioOcarina_PlayCustomSequence,0x8019D8B4,0xC +asm/non_matchings/code/code_8019AF00/AudioOcarina_CreateCustomSequence.s,AudioOcarina_CreateCustomSequence,0x8019D8E4,0x191 +asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetInstrument.s,AudioOcarina_ResetInstrument,0x8019DF28,0xF +asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetStaffs.s,AudioOcarina_ResetStaffs,0x8019DF64,0x25 asm/non_matchings/code/code_8019AF00/func_8019DFF8.s,func_8019DFF8,0x8019DFF8,0x2 asm/non_matchings/code/code_8019AF00/func_8019E000.s,func_8019E000,0x8019E000,0x3 asm/non_matchings/code/code_8019AF00/func_8019E00C.s,func_8019E00C,0x8019E00C,0x2 @@ -3374,27 +3374,27 @@ asm/non_matchings/code/code_8019AF00/func_8019E014.s,func_8019E014,0x8019E014,0x asm/non_matchings/code/code_8019AF00/func_8019E0FC.s,func_8019E0FC,0x8019E0FC,0x2 asm/non_matchings/code/code_8019AF00/func_8019E104.s,func_8019E104,0x8019E104,0x3 asm/non_matchings/code/code_8019AF00/func_8019E110.s,func_8019E110,0x8019E110,0xF -asm/non_matchings/code/code_8019AF00/func_8019E14C.s,func_8019E14C,0x8019E14C,0x76 -asm/non_matchings/code/code_8019AF00/func_8019E324.s,func_8019E324,0x8019E324,0x63 -asm/non_matchings/code/code_8019AF00/func_8019E4B0.s,func_8019E4B0,0x8019E4B0,0x61 -asm/non_matchings/code/code_8019AF00/func_8019E634.s,func_8019E634,0x8019E634,0x8C -asm/non_matchings/code/code_8019AF00/func_8019E864.s,func_8019E864,0x8019E864,0x77 -asm/non_matchings/code/code_8019AF00/func_8019EA40.s,func_8019EA40,0x8019EA40,0x3B -asm/non_matchings/code/code_8019AF00/func_8019EB2C.s,func_8019EB2C,0x8019EB2C,0x13E -asm/non_matchings/code/code_8019AF00/func_8019F024.s,func_8019F024,0x8019F024,0xE -asm/non_matchings/code/code_8019AF00/func_8019F05C.s,func_8019F05C,0x8019F05C,0x1B +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeVolume.s,AudioSfx_ComputeVolume,0x8019E14C,0x76 +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeReverb.s,AudioSfx_ComputeReverb,0x8019E324,0x63 +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputePanSigned.s,AudioSfx_ComputePanSigned,0x8019E4B0,0x61 +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeFreqScale.s,AudioSfx_ComputeFreqScale,0x8019E634,0x8C +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeSurroundSoundFilter.s,AudioSfx_ComputeSurroundSoundFilter,0x8019E864,0x77 +asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeCombFilter.s,AudioSfx_ComputeCombFilter,0x8019EA40,0x3B +asm/non_matchings/code/code_8019AF00/AudioSfx_SetProperties.s,AudioSfx_SetProperties,0x8019EB2C,0x13E +asm/non_matchings/code/code_8019AF00/AudioSfx_SetFreqAndStereoBits.s,AudioSfx_SetFreqAndStereoBits,0x8019F024,0xE +asm/non_matchings/code/code_8019AF00/AudioSfx_ResetSfxChannelState.s,AudioSfx_ResetSfxChannelState,0x8019F05C,0x1B asm/non_matchings/code/code_8019AF00/play_sound.s,play_sound,0x8019F0C8,0x18 asm/non_matchings/code/code_8019AF00/func_8019F128.s,func_8019F128,0x8019F128,0x12 asm/non_matchings/code/code_8019AF00/func_8019F170.s,func_8019F170,0x8019F170,0x14 asm/non_matchings/code/code_8019AF00/Audio_PlaySfxAtPos.s,Audio_PlaySfxAtPos,0x8019F1C0,0x12 asm/non_matchings/code/code_8019AF00/func_8019F208.s,func_8019F208,0x8019F208,0xA asm/non_matchings/code/code_8019AF00/func_8019F230.s,func_8019F230,0x8019F230,0xA -asm/non_matchings/code/code_8019AF00/func_8019F258.s,func_8019F258,0x8019F258,0x2A -asm/non_matchings/code/code_8019AF00/func_8019F300.s,func_8019F300,0x8019F300,0x48 +asm/non_matchings/code/code_8019AF00/AudioSfx_AddSfxSetting.s,AudioSfx_AddSfxSetting,0x8019F258,0x2A +asm/non_matchings/code/code_8019AF00/AudioSfx_ProcessSfxSettings.s,AudioSfx_ProcessSfxSettings,0x8019F300,0x48 asm/non_matchings/code/code_8019AF00/func_8019F420.s,func_8019F420,0x8019F420,0x23 asm/non_matchings/code/code_8019AF00/func_8019F4AC.s,func_8019F4AC,0x8019F4AC,0x25 asm/non_matchings/code/code_8019AF00/func_8019F540.s,func_8019F540,0x8019F540,0xC -asm/non_matchings/code/code_8019AF00/func_8019F570.s,func_8019F570,0x8019F570,0xF +asm/non_matchings/code/code_8019AF00/AudioSfx_LowerSfxSettingsReverb.s,AudioSfx_LowerSfxSettingsReverb,0x8019F570,0xF asm/non_matchings/code/code_8019AF00/func_8019F5AC.s,func_8019F5AC,0x8019F5AC,0x23 asm/non_matchings/code/code_8019AF00/func_8019F638.s,func_8019F638,0x8019F638,0x52 asm/non_matchings/code/code_8019AF00/func_8019F780.s,func_8019F780,0x8019F780,0x16 @@ -3428,7 +3428,7 @@ asm/non_matchings/code/code_8019AF00/Audio_UpdateRiverSoundVolumes.s,Audio_Updat asm/non_matchings/code/code_8019AF00/func_801A0554.s,func_801A0554,0x801A0554,0x24 asm/non_matchings/code/code_8019AF00/func_801A05E4.s,func_801A05E4,0x801A05E4,0x3 asm/non_matchings/code/code_8019AF00/func_801A05F0.s,func_801A05F0,0x801A05F0,0x19 -asm/non_matchings/code/code_8019AF00/func_801A0654.s,func_801A0654,0x801A0654,0x6F +asm/non_matchings/code/code_8019AF00/AudioSfx_SetChannelIO.s,AudioSfx_SetChannelIO,0x801A0654,0x6F asm/non_matchings/code/code_8019AF00/func_801A0810.s,func_801A0810,0x801A0810,0x16 asm/non_matchings/code/code_8019AF00/func_801A0868.s,func_801A0868,0x801A0868,0x5B asm/non_matchings/code/code_8019AF00/func_801A09D4.s,func_801A09D4,0x801A09D4,0xA7 @@ -3506,7 +3506,7 @@ asm/non_matchings/code/code_8019AF00/func_801A429C.s,func_801A429C,0x801A429C,0x asm/non_matchings/code/code_8019AF00/func_801A42C8.s,func_801A42C8,0x801A42C8,0x17 asm/non_matchings/code/code_8019AF00/func_801A4324.s,func_801A4324,0x801A4324,0x9 asm/non_matchings/code/code_8019AF00/func_801A4348.s,func_801A4348,0x801A4348,0xE -asm/non_matchings/code/code_8019AF00/func_801A4380.s,func_801A4380,0x801A4380,0x2A +asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBanks.s,Audio_SetSfxVolumeExceptSystemAndOcarinaBanks,0x801A4380,0x2A asm/non_matchings/code/code_8019AF00/func_801A4428.s,func_801A4428,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 asm/non_matchings/code/code_8019AF00/func_801A44C4.s,func_801A44C4,0x801A44C4,0x4 @@ -3517,9 +3517,9 @@ asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x asm/non_matchings/code/code_8019AF00/func_801A47DC.s,func_801A47DC,0x801A47DC,0x41 asm/non_matchings/code/code_8019AF00/func_801A48E0.s,func_801A48E0,0x801A48E0,0x52 asm/non_matchings/code/code_8019AF00/func_801A4A28.s,func_801A4A28,0x801A4A28,0x56 -asm/non_matchings/code/code_8019AF00/func_801A4B80.s,func_801A4B80,0x801A4B80,0x2C -asm/non_matchings/code/code_8019AF00/func_801A4C30.s,func_801A4C30,0x801A4C30,0x9 -asm/non_matchings/code/code_8019AF00/func_801A4C54.s,func_801A4C54,0x801A4C54,0x2B +asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s,Audio_SetNatureAmbienceRandomBend,0x801A4B80,0x2C +asm/non_matchings/code/code_8019AF00/Audio_Init.s,Audio_Init,0x801A4C30,0x9 +asm/non_matchings/code/code_8019AF00/AudioSfx_Init.s,AudioSfx_Init,0x801A4C54,0x2B asm/non_matchings/code/code_8019AF00/func_801A4D00.s,func_801A4D00,0x801A4D00,0x14 asm/non_matchings/code/code_8019AF00/func_801A4D50.s,func_801A4D50,0x801A4D50,0x15 asm/non_matchings/code/code_8019AF00/func_801A4DA4.s,func_801A4DA4,0x801A4DA4,0x14 @@ -3546,29 +3546,29 @@ asm/non_matchings/code/code_801A51F0/func_801A5680.s,func_801A5680,0x801A5680,0x asm/non_matchings/code/code_801A51F0/func_801A5808.s,func_801A5808,0x801A5808,0x82 asm/non_matchings/code/code_801A51F0/func_801A5A10.s,func_801A5A10,0x801A5A10,0x3 asm/non_matchings/code/code_801A51F0/func_801A5A1C.s,func_801A5A1C,0x801A5A1C,0x69 -asm/non_matchings/code/code_801A5BD0/func_801A5BD0.s,func_801A5BD0,0x801A5BD0,0x16 -asm/non_matchings/code/code_801A5BD0/func_801A5C28.s,func_801A5C28,0x801A5C28,0x19 -asm/non_matchings/code/code_801A5BD0/func_801A5C8C.s,func_801A5C8C,0x801A5C8C,0x1C -asm/non_matchings/code/code_801A5BD0/Audio_PlaySfxGeneral.s,Audio_PlaySfxGeneral,0x801A5CFC,0x38 -asm/non_matchings/code/code_801A5BD0/func_801A5DDC.s,func_801A5DDC,0x801A5DDC,0x68 -asm/non_matchings/code/code_801A5BD0/func_801A5F7C.s,func_801A5F7C,0x801A5F7C,0x12D -asm/non_matchings/code/code_801A5BD0/func_801A6430.s,func_801A6430,0x801A6430,0x66 -asm/non_matchings/code/code_801A5BD0/func_801A65C8.s,func_801A65C8,0x801A65C8,0x1D1 -asm/non_matchings/code/code_801A5BD0/func_801A6D0C.s,func_801A6D0C,0x801A6D0C,0xDE -asm/non_matchings/code/code_801A5BD0/func_801A7084.s,func_801A7084,0x801A7084,0x39 -asm/non_matchings/code/code_801A5BD0/func_801A7168.s,func_801A7168,0x801A7168,0x47 -asm/non_matchings/code/code_801A5BD0/func_801A7284.s,func_801A7284,0x801A7284,0x12 -asm/non_matchings/code/code_801A5BD0/Audio_StopSfxByPos.s,Audio_StopSfxByPos,0x801A72CC,0x17 -asm/non_matchings/code/code_801A5BD0/func_801A7328.s,func_801A7328,0x801A7328,0x57 -asm/non_matchings/code/code_801A5BD0/func_801A7484.s,func_801A7484,0x801A7484,0x59 -asm/non_matchings/code/code_801A5BD0/func_801A75E8.s,func_801A75E8,0x801A75E8,0x4E -asm/non_matchings/code/code_801A5BD0/func_801A7720.s,func_801A7720,0x801A7720,0x1D -asm/non_matchings/code/code_801A5BD0/func_801A7794.s,func_801A7794,0x801A7794,0x25 -asm/non_matchings/code/code_801A5BD0/func_801A7828.s,func_801A7828,0x801A7828,0x15 -asm/non_matchings/code/code_801A5BD0/func_801A787C.s,func_801A787C,0x801A787C,0x1A -asm/non_matchings/code/code_801A5BD0/Audio_IsSfxPlaying.s,Audio_IsSfxPlaying,0x801A78E4,0x1A -asm/non_matchings/code/code_801A5BD0/func_801A794C.s,func_801A794C,0x801A794C,0x71 -asm/non_matchings/code/code_801A7B10/func_801A7B10.s,func_801A7B10,0x801A7B10,0x7D +asm/non_matchings/code/code_801A5BD0/AudioSfx_MuteBanks.s,AudioSfx_MuteBanks,0x801A5BD0,0x16 +asm/non_matchings/code/code_801A5BD0/AudioSfx_LowerBgmVolume.s,AudioSfx_LowerBgmVolume,0x801A5C28,0x19 +asm/non_matchings/code/code_801A5BD0/AudioSfx_RestoreBgmVolume.s,AudioSfx_RestoreBgmVolume,0x801A5C8C,0x1C +asm/non_matchings/code/code_801A5BD0/AudioSfx_PlaySfx.s,AudioSfx_PlaySfx,0x801A5CFC,0x38 +asm/non_matchings/code/code_801A5BD0/AudioSfx_RemoveMatchingRequests.s,AudioSfx_RemoveMatchingRequests,0x801A5DDC,0x68 +asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessRequest.s,AudioSfx_ProcessRequest,0x801A5F7C,0x12D +asm/non_matchings/code/code_801A5BD0/AudioSfx_RemoveBankEntry.s,AudioSfx_RemoveBankEntry,0x801A6430,0x66 +asm/non_matchings/code/code_801A5BD0/AudioSfx_ChooseActiveSfx.s,AudioSfx_ChooseActiveSfx,0x801A65C8,0x1D1 +asm/non_matchings/code/code_801A5BD0/AudioSfx_PlayActiveSfx.s,AudioSfx_PlayActiveSfx,0x801A6D0C,0xDE +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByBank.s,AudioSfx_StopByBank,0x801A7084,0x39 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByPosAndBankImpl.s,AudioSfx_StopByPosAndBankImpl,0x801A7168,0x47 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByPosAndBank.s,AudioSfx_StopByPosAndBank,0x801A7284,0x12 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByPos.s,AudioSfx_StopByPos,0x801A72CC,0x17 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByPosAndId.s,AudioSfx_StopByPosAndId,0x801A7328,0x57 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopByTokenAndId.s,AudioSfx_StopByTokenAndId,0x801A7484,0x59 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StopById.s,AudioSfx_StopById,0x801A75E8,0x4E +asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessRequests.s,AudioSfx_ProcessRequests,0x801A7720,0x1D +asm/non_matchings/code/code_801A5BD0/AudioSfx_SetBankLerp.s,AudioSfx_SetBankLerp,0x801A7794,0x25 +asm/non_matchings/code/code_801A5BD0/AudioSfx_StepBankLerp.s,AudioSfx_StepBankLerp,0x801A7828,0x15 +asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessActiveSfx.s,AudioSfx_ProcessActiveSfx,0x801A787C,0x1A +asm/non_matchings/code/code_801A5BD0/AudioSfx_IsPlaying.s,AudioSfx_IsPlaying,0x801A78E4,0x1A +asm/non_matchings/code/code_801A5BD0/AudioSfx_Reset.s,AudioSfx_Reset,0x801A794C,0x71 +asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s,Audio_StartSequence,0x801A7B10,0x7D asm/non_matchings/code/code_801A7B10/func_801A7D04.s,func_801A7D04,0x801A7D04,0x20 asm/non_matchings/code/code_801A7B10/func_801A7D84.s,func_801A7D84,0x801A7D84,0x309 asm/non_matchings/code/code_801A7B10/Audio_QueueSeqCmd.s,Audio_QueueSeqCmd,0x801A89A8,0xA diff --git a/undefined_syms.txt b/undefined_syms.txt index c9a2964db..faf0aba38 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -431,8 +431,6 @@ D_0403F230 = 0x0403F230; D_04044300 = 0x04044300; D_0404F250 = 0x0404F250; D_04050550 = 0x04050550; -D_04050648 = 0x04050648; -D_040506E0 = 0x040506E0; D_04050D10 = 0x04050D10; D_040510B0 = 0x040510B0; D_04051180 = 0x04051180; @@ -929,18 +927,6 @@ D_06001398 = 0x06001398; D_06000074 = 0x06000074; D_06001E60 = 0x06001E60; -// ovl_En_Bigpamet - -D_06000440 = 0x06000440; -D_06000AF4 = 0x06000AF4; -D_06000B30 = 0x06000B30; -D_06001A50 = 0x06001A50; -D_06001C68 = 0x06001C68; -D_060031DC = 0x060031DC; -D_06004210 = 0x06004210; -D_06007C70 = 0x06007C70; -D_0600823C = 0x0600823C; - // ovl_En_Bombal D_06000A00 = 0x06000A00; @@ -1080,11 +1066,6 @@ D_0600007C = 0x0600007C; D_0600CFE0 = 0x0600CFE0; D_06011058 = 0x06011058; -// ovl_En_Ge1 - -D_06002B98 = 0x06002B98; -D_06002CA0 = 0x06002CA0; - // ovl_En_Ge2 D_0600030C = 0x0600030C; @@ -1299,11 +1280,6 @@ D_06006F38 = 0x06006F38; D_06006FD8 = 0x06006FD8; D_06009930 = 0x06009930; -// ovl_En_Pp - -D_0600A844 = 0x0600A844; -D_06012768 = 0x06012768; - // ovl_En_Pr2 D_06003904 = 0x06003904; @@ -1314,12 +1290,6 @@ D_06004340 = 0x06004340; D_06001A80 = 0x06001A80; -// ovl_En_Rat - -D_06000174 = 0x06000174; -D_0600026C = 0x0600026C; -D_06001858 = 0x06001858; - // ovl_En_Ru D_0600C700 = 0x0600C700;